@acorex-platform/module-assessment-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 (95) hide show
  1. package/fesm2022/{acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-juxXq2pM.mjs → acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-DxRFMK3k.mjs} +1472 -160
  2. package/fesm2022/acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-DxRFMK3k.mjs.map +1 -0
  3. package/fesm2022/{acorex-platform-module-assessment-management-client-assessment-voice.commands-CaElbuNh.mjs → acorex-platform-module-assessment-management-client-assessment-voice.commands-DGYCwZ7v.mjs} +2 -2
  4. package/fesm2022/{acorex-platform-module-assessment-management-client-assessment-voice.commands-CaElbuNh.mjs.map → acorex-platform-module-assessment-management-client-assessment-voice.commands-DGYCwZ7v.mjs.map} +1 -1
  5. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-questionnaire.mjs +1 -11
  6. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-questionnaire.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-template.mjs +1 -78
  8. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-template.mjs.map +1 -1
  9. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-DYpWu3Vx.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-DDCy1T4t.mjs} +6 -6
  10. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-DYpWu3Vx.mjs.map → acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-DDCy1T4t.mjs.map} +1 -1
  11. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-CUctZ-0K.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-DXJp2k3o.mjs} +2 -2
  12. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-CUctZ-0K.mjs.map → acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-DXJp2k3o.mjs.map} +1 -1
  13. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-C2JJw_JJ.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-Q7-5toSQ.mjs} +2 -2
  14. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-C2JJw_JJ.mjs.map → acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-Q7-5toSQ.mjs.map} +1 -1
  15. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-D3y_rWUI.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-CPEpSSlP.mjs} +2 -2
  16. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-D3y_rWUI.mjs.map → acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-CPEpSSlP.mjs.map} +1 -1
  17. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-CVz5W0fF.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-DOG7yHv-.mjs} +3 -13
  18. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-DOG7yHv-.mjs.map +1 -0
  19. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-template.entity-C01AW5NW.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-template.entity-BeYGYRb7.mjs} +3 -80
  20. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-template.entity-BeYGYRb7.mjs.map +1 -0
  21. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog.mjs +1 -1
  22. package/fesm2022/acorex-platform-module-assessment-management-client-contracts.mjs +33 -1
  23. package/fesm2022/acorex-platform-module-assessment-management-client-contracts.mjs.map +1 -1
  24. package/fesm2022/{acorex-platform-module-assessment-management-client-fill-assessment-session.command-CMIq-DDl.mjs → acorex-platform-module-assessment-management-client-fill-assessment-session.command-DY_9qPYh.mjs} +2 -2
  25. package/fesm2022/{acorex-platform-module-assessment-management-client-fill-assessment-session.command-CMIq-DDl.mjs.map → acorex-platform-module-assessment-management-client-fill-assessment-session.command-DY_9qPYh.mjs.map} +1 -1
  26. package/fesm2022/acorex-platform-module-assessment-management-client-form-template-viewer-edit.component-BlGBTznW.mjs +112 -0
  27. package/fesm2022/acorex-platform-module-assessment-management-client-form-template-viewer-edit.component-BlGBTznW.mjs.map +1 -0
  28. package/fesm2022/{acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-COZcUPEj.mjs → acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-CeLpGSGc.mjs} +4 -4
  29. package/fesm2022/{acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-COZcUPEj.mjs.map → acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-CeLpGSGc.mjs.map} +1 -1
  30. package/fesm2022/{acorex-platform-module-assessment-management-client-form-template-viewer.service-CvSRpoos.mjs → acorex-platform-module-assessment-management-client-form-template-viewer.service-DoO7ZQmw.mjs} +15 -11
  31. package/fesm2022/acorex-platform-module-assessment-management-client-form-template-viewer.service-DoO7ZQmw.mjs.map +1 -0
  32. package/fesm2022/acorex-platform-module-assessment-management-client-index-er5gI6QK.mjs +68 -0
  33. package/fesm2022/acorex-platform-module-assessment-management-client-index-er5gI6QK.mjs.map +1 -0
  34. package/fesm2022/{acorex-platform-module-assessment-management-client-open-form-template.command-CmR-xFHE.mjs → acorex-platform-module-assessment-management-client-open-form-template.command-Cz23Vkyv.mjs} +3 -3
  35. package/fesm2022/{acorex-platform-module-assessment-management-client-open-form-template.command-CmR-xFHE.mjs.map → acorex-platform-module-assessment-management-client-open-form-template.command-Cz23Vkyv.mjs.map} +1 -1
  36. package/fesm2022/{acorex-platform-module-assessment-management-client-preview-form-template.command-BEzE0620.mjs → acorex-platform-module-assessment-management-client-preview-form-template.command-DDQOvVpt.mjs} +2 -2
  37. package/fesm2022/{acorex-platform-module-assessment-management-client-preview-form-template.command-BEzE0620.mjs.map → acorex-platform-module-assessment-management-client-preview-form-template.command-DDQOvVpt.mjs.map} +1 -1
  38. package/fesm2022/{acorex-platform-module-assessment-management-client-preview-question.command-BGT8qB1_.mjs → acorex-platform-module-assessment-management-client-preview-question.command-D4YlqMUf.mjs} +2 -2
  39. package/fesm2022/{acorex-platform-module-assessment-management-client-preview-question.command-BGT8qB1_.mjs.map → acorex-platform-module-assessment-management-client-preview-question.command-D4YlqMUf.mjs.map} +1 -1
  40. package/fesm2022/{acorex-platform-module-assessment-management-client-preview-questionnaire.command-duK7Tjjp.mjs → acorex-platform-module-assessment-management-client-preview-questionnaire.command-BYh-3EP9.mjs} +2 -2
  41. package/fesm2022/{acorex-platform-module-assessment-management-client-preview-questionnaire.command-duK7Tjjp.mjs.map → acorex-platform-module-assessment-management-client-preview-questionnaire.command-BYh-3EP9.mjs.map} +1 -1
  42. package/fesm2022/{acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-B7_G_C5B.mjs → acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-DARYq7ZJ.mjs} +4 -4
  43. package/fesm2022/{acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-B7_G_C5B.mjs.map → acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-DARYq7ZJ.mjs.map} +1 -1
  44. package/fesm2022/acorex-platform-module-assessment-management-client-questionnaire-questions-editor-edit.component-DIktPLmP.mjs +69 -0
  45. package/fesm2022/acorex-platform-module-assessment-management-client-questionnaire-questions-editor-edit.component-DIktPLmP.mjs.map +1 -0
  46. package/fesm2022/acorex-platform-module-assessment-management-client-questionnaire-viewer-edit.component-BAoqjZ7K.mjs +78 -0
  47. package/fesm2022/acorex-platform-module-assessment-management-client-questionnaire-viewer-edit.component-BAoqjZ7K.mjs.map +1 -0
  48. package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-daQL4OD_.mjs → acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-O-d2f3fv.mjs} +4 -4
  49. package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-daQL4OD_.mjs.map → acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-O-d2f3fv.mjs.map} +1 -1
  50. package/fesm2022/acorex-platform-module-assessment-management-client-related-content-viewer-page-component.provider-D0Rkeywu.mjs +26 -0
  51. package/fesm2022/acorex-platform-module-assessment-management-client-related-content-viewer-page-component.provider-D0Rkeywu.mjs.map +1 -0
  52. package/fesm2022/acorex-platform-module-assessment-management-client-related-content-viewer-page.component-CI9AlM58.mjs +315 -0
  53. package/fesm2022/acorex-platform-module-assessment-management-client-related-content-viewer-page.component-CI9AlM58.mjs.map +1 -0
  54. package/fesm2022/{acorex-platform-module-assessment-management-client-review-assessment-session.command-CPeFh1m7.mjs → acorex-platform-module-assessment-management-client-review-assessment-session.command-CHeyD-AC.mjs} +2 -2
  55. package/fesm2022/{acorex-platform-module-assessment-management-client-review-assessment-session.command-CPeFh1m7.mjs.map → acorex-platform-module-assessment-management-client-review-assessment-session.command-CHeyD-AC.mjs.map} +1 -1
  56. package/fesm2022/acorex-platform-module-assessment-management-client-show-form-template-viewer-popup.command-DlpkbJCZ.mjs +117 -0
  57. package/fesm2022/acorex-platform-module-assessment-management-client-show-form-template-viewer-popup.command-DlpkbJCZ.mjs.map +1 -0
  58. package/fesm2022/acorex-platform-module-assessment-management-client-show-questionnaire-questions-popup.command-t67ngnrD.mjs +129 -0
  59. package/fesm2022/acorex-platform-module-assessment-management-client-show-questionnaire-questions-popup.command-t67ngnrD.mjs.map +1 -0
  60. package/fesm2022/acorex-platform-module-assessment-management-client-show-questionnaire-viewer-popup.command-DHgNcZ60.mjs +120 -0
  61. package/fesm2022/acorex-platform-module-assessment-management-client-show-questionnaire-viewer-popup.command-DHgNcZ60.mjs.map +1 -0
  62. package/fesm2022/{acorex-platform-module-assessment-management-client-template-picker.component-D_UCdFOH.mjs → acorex-platform-module-assessment-management-client-template-picker.component-DzboI7GV.mjs} +3 -3
  63. package/fesm2022/{acorex-platform-module-assessment-management-client-template-picker.component-D_UCdFOH.mjs.map → acorex-platform-module-assessment-management-client-template-picker.component-DzboI7GV.mjs.map} +1 -1
  64. package/fesm2022/{acorex-platform-module-assessment-management-client-template-widget-edit.component-DERabYdH.mjs → acorex-platform-module-assessment-management-client-template-widget-edit.component-3DZovs7s.mjs} +2 -2
  65. package/fesm2022/{acorex-platform-module-assessment-management-client-template-widget-edit.component-DERabYdH.mjs.map → acorex-platform-module-assessment-management-client-template-widget-edit.component-3DZovs7s.mjs.map} +1 -1
  66. package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-cell-type-widget-edit.component-DRFfLOCE.mjs +90 -0
  67. package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-cell-type-widget-edit.component-DRFfLOCE.mjs.map +1 -0
  68. package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-grid.component-DENxbikr.mjs +77 -0
  69. package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-grid.component-DENxbikr.mjs.map +1 -0
  70. package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-schema-widget-edit.component-Bcvp2Dx5.mjs +236 -0
  71. package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-schema-widget-edit.component-Bcvp2Dx5.mjs.map +1 -0
  72. package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-widget-column.component-B3Lx7yuD.mjs +50 -0
  73. package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-widget-column.component-B3Lx7yuD.mjs.map +1 -0
  74. package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-widget-edit.component-CrvzEcSh.mjs +81 -0
  75. package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-widget-edit.component-CrvzEcSh.mjs.map +1 -0
  76. package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-widget-view.component-sSky9nAq.mjs +30 -0
  77. package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-widget-view.component-sSky9nAq.mjs.map +1 -0
  78. package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet.util-T-kPrzoj.mjs +423 -0
  79. package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet.util-T-kPrzoj.mjs.map +1 -0
  80. package/fesm2022/{acorex-platform-module-assessment-management-client-view-session-answers.command-DjJajIkL.mjs → acorex-platform-module-assessment-management-client-view-session-answers.command-CxZirYRJ.mjs} +2 -2
  81. package/fesm2022/{acorex-platform-module-assessment-management-client-view-session-answers.command-DjJajIkL.mjs.map → acorex-platform-module-assessment-management-client-view-session-answers.command-CxZirYRJ.mjs.map} +1 -1
  82. package/fesm2022/acorex-platform-module-assessment-management-client.mjs +1 -1
  83. package/i18n/en-AU/assessment-management.json +69 -0
  84. package/i18n/en-AU/form-template-management.json +8 -0
  85. package/i18n/en-US/assessment-management.json +69 -0
  86. package/i18n/en-US/form-template-management.json +8 -0
  87. package/i18n/fa-IR/assessment-management.json +69 -0
  88. package/i18n/fa-IR/form-template-management.json +8 -0
  89. package/package.json +3 -3
  90. package/types/acorex-platform-module-assessment-management-client-contracts.d.ts +23 -3
  91. package/types/acorex-platform-module-assessment-management-client.d.ts +10 -1
  92. package/fesm2022/acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-juxXq2pM.mjs.map +0 -1
  93. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-CVz5W0fF.mjs.map +0 -1
  94. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-template.entity-C01AW5NW.mjs.map +0 -1
  95. package/fesm2022/acorex-platform-module-assessment-management-client-form-template-viewer.service-CvSRpoos.mjs.map +0 -1
@@ -0,0 +1,315 @@
1
+ import { AXPEntityDefinitionRegistryService, AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
2
+ import * as i1 from '@acorex-platform/framework-client/layout/widget-core';
3
+ import { AXPWidgetCoreModule } from '@acorex-platform/framework-client/layout/widget-core';
4
+ import { AXPPageLayoutBaseComponent, AXPPageLayoutBase } from '@acorex-platform/framework-client/layout/views';
5
+ import * as i0 from '@angular/core';
6
+ import { input, inject, signal, computed, effect, ChangeDetectionStrategy, Component } from '@angular/core';
7
+ import { ActivatedRoute } from '@angular/router';
8
+ import { get, cloneDeep, isEqual } from 'lodash-es';
9
+
10
+ const RELATED_CONTENT_VIEWER_PAGE_SAVE_COMMAND = 'EntityRelatedContentViewerPage:Save';
11
+ const RELATED_CONTENT_VIEWER_PAGE_DISCARD_COMMAND = 'EntityRelatedContentViewerPage:Discard';
12
+ //#region ----- Component -----
13
+ /**
14
+ * Side-menu page that renders a related form or questionnaire viewer.
15
+ * The plugin stores the widget on the answers field; this page hosts that widget.
16
+ */
17
+ class AXMRelatedContentViewerPageComponent extends AXPPageLayoutBaseComponent {
18
+ //#endregion
19
+ //#region ----- Lifecycle -----
20
+ constructor() {
21
+ super();
22
+ //#region ----- Inputs -----
23
+ this.rootContext = input({}, /* @ts-ignore */
24
+ ...(ngDevMode ? [{ debugName: "rootContext" }] : /* istanbul ignore next */ []));
25
+ this.pageConfig = input(/* @ts-ignore */
26
+ ...(ngDevMode ? [undefined, { debugName: "pageConfig" }] : /* istanbul ignore next */ []));
27
+ /** Stamped by the viewer plugin (`widget`, `contentOption`, `expression`, `entity`). */
28
+ this.options = input({}, /* @ts-ignore */
29
+ ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
30
+ //#endregion
31
+ //#region ----- Services & Dependencies -----
32
+ this.route = inject(ActivatedRoute);
33
+ this.entityRegistry = inject(AXPEntityDefinitionRegistryService);
34
+ this.entityService = inject(AXPEntityService);
35
+ this.hostPageLayout = inject(AXPPageLayoutBase, { optional: true, skipSelf: true });
36
+ //#endregion
37
+ //#region ----- State Signals -----
38
+ this.entityDef = signal(null, /* @ts-ignore */
39
+ ...(ngDevMode ? [{ debugName: "entityDef" }] : /* istanbul ignore next */ []));
40
+ this.localContext = signal(null, /* @ts-ignore */
41
+ ...(ngDevMode ? [{ debugName: "localContext" }] : /* istanbul ignore next */ []));
42
+ this.isDirty = signal(false, /* @ts-ignore */
43
+ ...(ngDevMode ? [{ debugName: "isDirty" }] : /* istanbul ignore next */ []));
44
+ this.isSaving = signal(false, /* @ts-ignore */
45
+ ...(ngDevMode ? [{ debugName: "isSaving" }] : /* istanbul ignore next */ []));
46
+ this.previousRecordId = signal(undefined, /* @ts-ignore */
47
+ ...(ngDevMode ? [{ debugName: "previousRecordId" }] : /* istanbul ignore next */ []));
48
+ this.widgetRenderKey = signal(0, /* @ts-ignore */
49
+ ...(ngDevMode ? [{ debugName: "widgetRenderKey" }] : /* istanbul ignore next */ []));
50
+ //#endregion
51
+ //#region ----- Computed Properties -----
52
+ this.context = computed(() => {
53
+ return this.localContext() ?? this.rootContext() ?? {};
54
+ }, /* @ts-ignore */
55
+ ...(ngDevMode ? [{ debugName: "context" }] : /* istanbul ignore next */ []));
56
+ this.fieldName = computed(() => {
57
+ const field = this.pageConfig()?.['field'];
58
+ return typeof field === 'string' ? field : '';
59
+ }, /* @ts-ignore */
60
+ ...(ngDevMode ? [{ debugName: "fieldName" }] : /* istanbul ignore next */ []));
61
+ this.recordId = computed(() => {
62
+ const id = this.rootContext()?.['id'];
63
+ if (typeof id === 'string' && id.length > 0) {
64
+ return id;
65
+ }
66
+ if (typeof id === 'number' && !Number.isNaN(id)) {
67
+ return String(id);
68
+ }
69
+ return undefined;
70
+ }, /* @ts-ignore */
71
+ ...(ngDevMode ? [{ debugName: "recordId" }] : /* istanbul ignore next */ []));
72
+ this.entityKey = computed(() => {
73
+ const stamped = this.options()?.['entity'];
74
+ if (typeof stamped === 'string' && stamped.includes('.')) {
75
+ return stamped;
76
+ }
77
+ const moduleName = this.route.snapshot.parent?.paramMap.get('module');
78
+ const entityName = this.route.snapshot.paramMap.get('entity');
79
+ return moduleName && entityName ? `${moduleName}.${entityName}` : '';
80
+ }, /* @ts-ignore */
81
+ ...(ngDevMode ? [{ debugName: "entityKey" }] : /* istanbul ignore next */ []));
82
+ this.node = computed(() => {
83
+ const field = this.fieldName();
84
+ if (!field) {
85
+ return null;
86
+ }
87
+ const stamped = this.nodeFromPageOptions(field);
88
+ if (stamped) {
89
+ return stamped;
90
+ }
91
+ const entity = this.entityDef();
92
+ if (!entity?.properties) {
93
+ return null;
94
+ }
95
+ const property = entity.properties.find((item) => item.name === field);
96
+ const widget = property?.schema?.interface;
97
+ if (!widget?.type) {
98
+ return null;
99
+ }
100
+ return {
101
+ type: widget.type,
102
+ path: field,
103
+ name: field,
104
+ children: widget.children,
105
+ valueTransforms: widget.valueTransforms,
106
+ options: widget.options,
107
+ };
108
+ }, /* @ts-ignore */
109
+ ...(ngDevMode ? [{ debugName: "node" }] : /* istanbul ignore next */ []));
110
+ effect((onCleanup) => {
111
+ const moduleName = this.route.snapshot.parent?.paramMap.get('module');
112
+ const entityName = this.route.snapshot.paramMap.get('entity');
113
+ if (!moduleName || !entityName) {
114
+ this.entityDef.set(null);
115
+ return;
116
+ }
117
+ let cancelled = false;
118
+ this.entityRegistry.resolve(moduleName, entityName).then((entity) => {
119
+ if (!cancelled) {
120
+ this.entityDef.set(entity);
121
+ }
122
+ });
123
+ onCleanup(() => {
124
+ cancelled = true;
125
+ });
126
+ });
127
+ effect(() => {
128
+ const recordId = this.recordId();
129
+ if (!recordId || recordId === this.previousRecordId()) {
130
+ return;
131
+ }
132
+ this.previousRecordId.set(recordId);
133
+ this.localContext.set(null);
134
+ this.isDirty.set(false);
135
+ this.widgetRenderKey.update((key) => key + 1);
136
+ });
137
+ }
138
+ //#endregion
139
+ //#region ----- Unsaved Changes -----
140
+ hasUnsavedChanges() {
141
+ return this.isDirty();
142
+ }
143
+ /**
144
+ * Merges filled answers into the create/update wizard form context on Next/Done.
145
+ */
146
+ getWizardStepContext() {
147
+ const field = this.fieldName();
148
+ if (!field) {
149
+ return null;
150
+ }
151
+ const answers = get(this.localContext() ?? this.rootContext() ?? {}, field);
152
+ if (answers == null) {
153
+ return null;
154
+ }
155
+ return { [field]: cloneDeep(answers) };
156
+ }
157
+ //#endregion
158
+ //#region ----- Event Handlers -----
159
+ async getPrimaryMenuItems() {
160
+ const dirty = this.isDirty();
161
+ const saving = this.isSaving();
162
+ const canPersist = !!this.recordId();
163
+ const saveTitle = (await this.translateService.translateAsync('@general:actions.save.title')) || 'Save';
164
+ const discardTitle = (await this.translateService.translateAsync('@general:actions.discard.title')) || 'Discard';
165
+ return [
166
+ {
167
+ title: discardTitle,
168
+ icon: 'fa-light fa-rotate-left',
169
+ zone: 'footer',
170
+ priority: 'secondary',
171
+ color: 'default',
172
+ visible: dirty,
173
+ disabled: saving,
174
+ command: { name: RELATED_CONTENT_VIEWER_PAGE_DISCARD_COMMAND, options: {} },
175
+ },
176
+ {
177
+ title: saveTitle,
178
+ icon: 'fa-light fa-floppy-disk',
179
+ zone: 'footer',
180
+ priority: 'primary',
181
+ color: 'primary',
182
+ // Create wizard has no id yet — answers merge via getWizardStepContext on Next/Done.
183
+ visible: dirty && canPersist,
184
+ disabled: saving,
185
+ command: { name: RELATED_CONTENT_VIEWER_PAGE_SAVE_COMMAND, options: {} },
186
+ },
187
+ ];
188
+ }
189
+ onContextChanged(event) {
190
+ if (event.state !== 'changed' || this.isSaving()) {
191
+ return;
192
+ }
193
+ const field = this.fieldName();
194
+ const answers = get(event.data, field);
195
+ const base = this.localContext() ?? this.rootContext() ?? {};
196
+ this.localContext.set({ ...base, [field]: answers });
197
+ this.isDirty.set(!isEqual(answers ?? null, get(this.rootContext(), field) ?? null));
198
+ this.recompute();
199
+ }
200
+ execute(command) {
201
+ if (command.name === RELATED_CONTENT_VIEWER_PAGE_DISCARD_COMMAND) {
202
+ this.handleDiscard();
203
+ return;
204
+ }
205
+ if (command.name !== RELATED_CONTENT_VIEWER_PAGE_SAVE_COMMAND) {
206
+ return;
207
+ }
208
+ return this.handleSave();
209
+ }
210
+ //#endregion
211
+ //#region ----- Persistence -----
212
+ handleDiscard() {
213
+ this.localContext.set(null);
214
+ this.isDirty.set(false);
215
+ this.widgetRenderKey.update((key) => key + 1);
216
+ this.recompute();
217
+ }
218
+ async handleSave() {
219
+ const field = this.fieldName();
220
+ const id = this.recordId();
221
+ const entity = this.entityKey();
222
+ const answers = get(this.localContext() ?? this.rootContext() ?? {}, field);
223
+ if (!field || !id || !entity) {
224
+ return {
225
+ success: false,
226
+ message: {
227
+ text: await this.translateService.translateAsync('@general:messages.entity.invalid-data'),
228
+ },
229
+ };
230
+ }
231
+ this.isSaving.set(true);
232
+ this.recompute();
233
+ try {
234
+ await this.entityService.withEntity(entity).data().update(id, { [field]: answers });
235
+ const root = this.rootContext();
236
+ if (root && typeof root === 'object') {
237
+ root[field] = answers;
238
+ }
239
+ this.localContext.set({ ...(root ?? {}), [field]: answers });
240
+ this.isDirty.set(false);
241
+ this.recompute();
242
+ this.toastService.show({
243
+ color: 'success',
244
+ title: await this.translateService.translateAsync('@general:messages.generic.success.title'),
245
+ content: await this.translateService.translateAsync('@general:messages.generic.success.description'),
246
+ location: 'bottom-center',
247
+ closeButton: true,
248
+ timeOut: 3000,
249
+ timeOutProgress: true,
250
+ });
251
+ return { success: true, kind: 'object', data: undefined };
252
+ }
253
+ catch {
254
+ this.toastService.show({
255
+ color: 'danger',
256
+ title: await this.translateService.translateAsync('@general:messages.error.title'),
257
+ content: await this.translateService.translateAsync('@general:messages.entity.update-failed'),
258
+ });
259
+ return { success: false };
260
+ }
261
+ finally {
262
+ this.isSaving.set(false);
263
+ this.recompute();
264
+ }
265
+ }
266
+ recompute() {
267
+ super.recompute();
268
+ const maybeLayout = this.hostPageLayout;
269
+ maybeLayout?.recompute?.();
270
+ }
271
+ //#endregion
272
+ //#region ----- Helpers -----
273
+ nodeFromPageOptions(field) {
274
+ const opts = this.options() ?? {};
275
+ const widget = opts['widget'];
276
+ const contentOption = opts['contentOption'];
277
+ const expression = opts['expression'];
278
+ if (typeof widget !== 'string' || !widget) {
279
+ return null;
280
+ }
281
+ if (typeof contentOption !== 'string' || !contentOption) {
282
+ return null;
283
+ }
284
+ if (typeof expression !== 'string' || !expression) {
285
+ return null;
286
+ }
287
+ return {
288
+ type: widget,
289
+ path: field,
290
+ name: field,
291
+ options: { [contentOption]: expression },
292
+ };
293
+ }
294
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMRelatedContentViewerPageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
295
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXMRelatedContentViewerPageComponent, isStandalone: true, selector: "axm-related-content-viewer-page", inputs: { rootContext: { classPropertyName: "rootContext", publicName: "rootContext", isSignal: true, isRequired: false, transformFunction: null }, pageConfig: { classPropertyName: "pageConfig", publicName: "pageConfig", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.axp-page-layout-base": "true" } }, providers: [
296
+ {
297
+ provide: AXPPageLayoutBase,
298
+ useExisting: AXMRelatedContentViewerPageComponent,
299
+ },
300
+ ], usesInheritance: true, ngImport: i0, template: "<div class=\"axm-related-content-viewer-page__panel\">\n @for (renderKey of [widgetRenderKey()]; track renderKey) {\n <axp-widgets-container [context]=\"context()\" (onContextChanged)=\"onContextChanged($event)\">\n <!--->\n <!-- ----- Viewer widget resolved from the answers field or stamped page options ----- -->\n @if (node(); as widgetNode) {\n <ng-container axp-widget-renderer [node]=\"widgetNode\" [mode]=\"'edit'\"></ng-container>\n }\n </axp-widgets-container>\n }\n</div>\n", styles: ["@layer properties;:host{display:block;height:100%;min-height:0px}.axm-related-content-viewer-page__panel{box-sizing:border-box;height:100%;min-height:0px;overflow:auto;border-radius:var(--radius-lg, .5rem);border-style:var(--tw-border-style);border-width:1px;border-color:rgba(var(--ax-sys-color-surface));padding:calc(var(--spacing, .25rem) * 4)}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "ngmodule", type: AXPWidgetCoreModule }, { kind: "component", type: i1.AXPWidgetContainerComponent, selector: "axp-widgets-container", inputs: ["context", "functions"], outputs: ["onContextChanged"] }, { kind: "directive", type: i1.AXPWidgetRendererDirective, selector: "[axp-widget-renderer]", inputs: ["parentNode", "index", "mode", "node"], outputs: ["onOptionsChanged", "onValueChanged", "onLoad"], exportAs: ["widgetRenderer"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
301
+ }
302
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMRelatedContentViewerPageComponent, decorators: [{
303
+ type: Component,
304
+ args: [{ selector: 'axm-related-content-viewer-page', standalone: true, imports: [AXPWidgetCoreModule], providers: [
305
+ {
306
+ provide: AXPPageLayoutBase,
307
+ useExisting: AXMRelatedContentViewerPageComponent,
308
+ },
309
+ ], changeDetection: ChangeDetectionStrategy.OnPush, host: {
310
+ '[class.axp-page-layout-base]': 'true',
311
+ }, template: "<div class=\"axm-related-content-viewer-page__panel\">\n @for (renderKey of [widgetRenderKey()]; track renderKey) {\n <axp-widgets-container [context]=\"context()\" (onContextChanged)=\"onContextChanged($event)\">\n <!--->\n <!-- ----- Viewer widget resolved from the answers field or stamped page options ----- -->\n @if (node(); as widgetNode) {\n <ng-container axp-widget-renderer [node]=\"widgetNode\" [mode]=\"'edit'\"></ng-container>\n }\n </axp-widgets-container>\n }\n</div>\n", styles: ["@layer properties;:host{display:block;height:100%;min-height:0px}.axm-related-content-viewer-page__panel{box-sizing:border-box;height:100%;min-height:0px;overflow:auto;border-radius:var(--radius-lg, .5rem);border-style:var(--tw-border-style);border-width:1px;border-color:rgba(var(--ax-sys-color-surface));padding:calc(var(--spacing, .25rem) * 4)}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
312
+ }], ctorParameters: () => [], propDecorators: { rootContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "rootContext", required: false }] }], pageConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageConfig", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
313
+
314
+ export { AXMRelatedContentViewerPageComponent };
315
+ //# sourceMappingURL=acorex-platform-module-assessment-management-client-related-content-viewer-page.component-CI9AlM58.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-assessment-management-client-related-content-viewer-page.component-CI9AlM58.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/content-display/related-content-viewer-page/related-content-viewer-page.component.ts","../../../../libs/modules/assessment-management/client/src/lib/features/content-display/related-content-viewer-page/related-content-viewer-page.component.html"],"sourcesContent":["import { AXPEntityDefinitionRegistryService, AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPWidgetCoreModule } from '@acorex-platform/framework-client/layout/widget-core';\nimport {\n AXPPageLayoutBase,\n AXPPageLayoutBaseComponent,\n type AXPLayoutDetailsViewAction,\n} from '@acorex-platform/framework-client/layout/views';\nimport {\n type AXPContextChangeEvent,\n type AXPExecuteCommand,\n type AXPWidgetNode,\n} from '@acorex-platform/framework-shared/core';\nimport { AXPEntity } from '@acorex-platform/framework-shared/entity';\nimport type { AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { ChangeDetectionStrategy, Component, computed, effect, inject, input, signal, type Signal } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { cloneDeep, get, isEqual } from 'lodash-es';\n\nconst RELATED_CONTENT_VIEWER_PAGE_SAVE_COMMAND = 'EntityRelatedContentViewerPage:Save';\nconst RELATED_CONTENT_VIEWER_PAGE_DISCARD_COMMAND = 'EntityRelatedContentViewerPage:Discard';\n\n//#region ----- Component -----\n\n/**\n * Side-menu page that renders a related form or questionnaire viewer.\n * The plugin stores the widget on the answers field; this page hosts that widget.\n */\n@Component({\n selector: 'axm-related-content-viewer-page',\n standalone: true,\n imports: [AXPWidgetCoreModule],\n templateUrl: './related-content-viewer-page.component.html',\n styleUrl: './related-content-viewer-page.component.css',\n providers: [\n {\n provide: AXPPageLayoutBase,\n useExisting: AXMRelatedContentViewerPageComponent,\n },\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class.axp-page-layout-base]': 'true',\n },\n})\nexport class AXMRelatedContentViewerPageComponent extends AXPPageLayoutBaseComponent {\n //#region ----- Inputs -----\n\n rootContext = input<Record<string, unknown>>({});\n\n pageConfig = input<Record<string, unknown>>();\n\n /** Stamped by the viewer plugin (`widget`, `contentOption`, `expression`, `entity`). */\n options = input<Record<string, unknown>>({});\n\n //#endregion\n\n //#region ----- Services & Dependencies -----\n\n private readonly route = inject(ActivatedRoute);\n private readonly entityRegistry = inject(AXPEntityDefinitionRegistryService);\n private readonly entityService = inject(AXPEntityService);\n private readonly hostPageLayout = inject(AXPPageLayoutBase, { optional: true, skipSelf: true });\n\n //#endregion\n\n //#region ----- State Signals -----\n\n private readonly entityDef = signal<AXPEntity | null>(null);\n private readonly localContext = signal<Record<string, unknown> | null>(null);\n protected readonly isDirty = signal(false);\n private readonly isSaving = signal(false);\n private readonly previousRecordId = signal<string | undefined>(undefined);\n protected readonly widgetRenderKey = signal(0);\n\n //#endregion\n\n //#region ----- Lifecycle -----\n\n constructor() {\n super();\n\n effect((onCleanup) => {\n const moduleName = this.route.snapshot.parent?.paramMap.get('module');\n const entityName = this.route.snapshot.paramMap.get('entity');\n if (!moduleName || !entityName) {\n this.entityDef.set(null);\n return;\n }\n let cancelled = false;\n this.entityRegistry.resolve(moduleName, entityName).then((entity) => {\n if (!cancelled) {\n this.entityDef.set(entity);\n }\n });\n onCleanup(() => {\n cancelled = true;\n });\n });\n\n effect(() => {\n const recordId = this.recordId();\n if (!recordId || recordId === this.previousRecordId()) {\n return;\n }\n this.previousRecordId.set(recordId);\n this.localContext.set(null);\n this.isDirty.set(false);\n this.widgetRenderKey.update((key) => key + 1);\n });\n }\n\n //#endregion\n\n //#region ----- Computed Properties -----\n\n protected readonly context: Signal<Record<string, unknown>> = computed(() => {\n return this.localContext() ?? this.rootContext() ?? {};\n });\n\n protected readonly fieldName = computed(() => {\n const field = this.pageConfig()?.['field'];\n return typeof field === 'string' ? field : '';\n });\n\n protected readonly recordId = computed((): string | undefined => {\n const id = this.rootContext()?.['id'];\n if (typeof id === 'string' && id.length > 0) {\n return id;\n }\n if (typeof id === 'number' && !Number.isNaN(id)) {\n return String(id);\n }\n return undefined;\n });\n\n protected readonly entityKey = computed(() => {\n const stamped = this.options()?.['entity'];\n if (typeof stamped === 'string' && stamped.includes('.')) {\n return stamped;\n }\n const moduleName = this.route.snapshot.parent?.paramMap.get('module');\n const entityName = this.route.snapshot.paramMap.get('entity');\n return moduleName && entityName ? `${moduleName}.${entityName}` : '';\n });\n\n protected readonly node = computed<AXPWidgetNode | null>(() => {\n const field = this.fieldName();\n if (!field) {\n return null;\n }\n\n const stamped = this.nodeFromPageOptions(field);\n if (stamped) {\n return stamped;\n }\n\n const entity = this.entityDef();\n if (!entity?.properties) {\n return null;\n }\n const property = entity.properties.find((item: { name: string }) => item.name === field);\n const widget = property?.schema?.interface;\n if (!widget?.type) {\n return null;\n }\n return {\n type: widget.type,\n path: field,\n name: field,\n children: widget.children,\n valueTransforms: widget.valueTransforms,\n options: widget.options,\n } as AXPWidgetNode;\n });\n\n //#endregion\n\n //#region ----- Unsaved Changes -----\n\n override hasUnsavedChanges(): boolean {\n return this.isDirty();\n }\n\n /**\n * Merges filled answers into the create/update wizard form context on Next/Done.\n */\n override getWizardStepContext(): Record<string, unknown> | null {\n const field = this.fieldName();\n if (!field) {\n return null;\n }\n const answers = get(this.localContext() ?? this.rootContext() ?? {}, field);\n if (answers == null) {\n return null;\n }\n return { [field]: cloneDeep(answers) };\n }\n\n //#endregion\n\n //#region ----- Event Handlers -----\n\n override async getPrimaryMenuItems(): Promise<AXPLayoutDetailsViewAction[]> {\n const dirty = this.isDirty();\n const saving = this.isSaving();\n const canPersist = !!this.recordId();\n const saveTitle = (await this.translateService.translateAsync('@general:actions.save.title')) || 'Save';\n const discardTitle = (await this.translateService.translateAsync('@general:actions.discard.title')) || 'Discard';\n\n return [\n {\n title: discardTitle,\n icon: 'fa-light fa-rotate-left',\n zone: 'footer',\n priority: 'secondary',\n color: 'default',\n visible: dirty,\n disabled: saving,\n command: { name: RELATED_CONTENT_VIEWER_PAGE_DISCARD_COMMAND, options: {} },\n },\n {\n title: saveTitle,\n icon: 'fa-light fa-floppy-disk',\n zone: 'footer',\n priority: 'primary',\n color: 'primary',\n // Create wizard has no id yet — answers merge via getWizardStepContext on Next/Done.\n visible: dirty && canPersist,\n disabled: saving,\n command: { name: RELATED_CONTENT_VIEWER_PAGE_SAVE_COMMAND, options: {} },\n },\n ];\n }\n\n protected onContextChanged(event: AXPContextChangeEvent): void {\n if (event.state !== 'changed' || this.isSaving()) {\n return;\n }\n const field = this.fieldName();\n const answers = get(event.data, field);\n const base = this.localContext() ?? this.rootContext() ?? {};\n this.localContext.set({ ...base, [field]: answers });\n this.isDirty.set(!isEqual(answers ?? null, get(this.rootContext(), field) ?? null));\n this.recompute();\n }\n\n override execute(command: AXPExecuteCommand): void | Promise<void> {\n if (command.name === RELATED_CONTENT_VIEWER_PAGE_DISCARD_COMMAND) {\n this.handleDiscard();\n return;\n }\n if (command.name !== RELATED_CONTENT_VIEWER_PAGE_SAVE_COMMAND) {\n return;\n }\n return this.handleSave() as unknown as Promise<void>;\n }\n\n //#endregion\n\n //#region ----- Persistence -----\n\n private handleDiscard(): void {\n this.localContext.set(null);\n this.isDirty.set(false);\n this.widgetRenderKey.update((key) => key + 1);\n this.recompute();\n }\n\n private async handleSave(): AXPCommandExecuteResultPromise {\n const field = this.fieldName();\n const id = this.recordId();\n const entity = this.entityKey();\n const answers = get(this.localContext() ?? this.rootContext() ?? {}, field);\n\n if (!field || !id || !entity) {\n return {\n success: false,\n message: {\n text: await this.translateService.translateAsync('@general:messages.entity.invalid-data'),\n },\n };\n }\n\n this.isSaving.set(true);\n this.recompute();\n try {\n await this.entityService.withEntity(entity).data().update(id, { [field]: answers } as never);\n const root = this.rootContext();\n if (root && typeof root === 'object') {\n root[field] = answers;\n }\n this.localContext.set({ ...(root ?? {}), [field]: answers });\n this.isDirty.set(false);\n this.recompute();\n this.toastService.show({\n color: 'success',\n title: await this.translateService.translateAsync('@general:messages.generic.success.title'),\n content: await this.translateService.translateAsync('@general:messages.generic.success.description'),\n location: 'bottom-center',\n closeButton: true,\n timeOut: 3000,\n timeOutProgress: true,\n });\n return { success: true, kind: 'object', data: undefined };\n } catch {\n this.toastService.show({\n color: 'danger',\n title: await this.translateService.translateAsync('@general:messages.error.title'),\n content: await this.translateService.translateAsync('@general:messages.entity.update-failed'),\n });\n return { success: false };\n } finally {\n this.isSaving.set(false);\n this.recompute();\n }\n }\n\n protected override recompute(): void {\n super.recompute();\n const maybeLayout = this.hostPageLayout as unknown as { recompute?: () => void };\n maybeLayout?.recompute?.();\n }\n\n //#endregion\n\n //#region ----- Helpers -----\n\n private nodeFromPageOptions(field: string): AXPWidgetNode | null {\n const opts = this.options() ?? {};\n const widget = opts['widget'];\n const contentOption = opts['contentOption'];\n const expression = opts['expression'];\n if (typeof widget !== 'string' || !widget) {\n return null;\n }\n if (typeof contentOption !== 'string' || !contentOption) {\n return null;\n }\n if (typeof expression !== 'string' || !expression) {\n return null;\n }\n return {\n type: widget,\n path: field,\n name: field,\n options: { [contentOption]: expression },\n };\n }\n\n //#endregion\n}\n\n//#endregion\n","<div class=\"axm-related-content-viewer-page__panel\">\n @for (renderKey of [widgetRenderKey()]; track renderKey) {\n <axp-widgets-container [context]=\"context()\" (onContextChanged)=\"onContextChanged($event)\">\n <!--->\n <!-- ----- Viewer widget resolved from the answers field or stamped page options ----- -->\n @if (node(); as widgetNode) {\n <ng-container axp-widget-renderer [node]=\"widgetNode\" [mode]=\"'edit'\"></ng-container>\n }\n </axp-widgets-container>\n }\n</div>\n"],"names":[],"mappings":";;;;;;;;;AAkBA,MAAM,wCAAwC,GAAG,qCAAqC;AACtF,MAAM,2CAA2C,GAAG,wCAAwC;AAE5F;AAEA;;;AAGG;AAkBG,MAAO,oCAAqC,SAAQ,0BAA0B,CAAA;;;AAkClF,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE;;QAhCT,IAAA,CAAA,WAAW,GAAG,KAAK,CAA0B,EAAE;wFAAC;AAEhD,QAAA,IAAA,CAAA,UAAU,GAAG,KAAK;kGAA2B;;QAG7C,IAAA,CAAA,OAAO,GAAG,KAAK,CAA0B,EAAE;oFAAC;;;AAM3B,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC;AAC9B,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,kCAAkC,CAAC;AAC3D,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ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BAAA,EAAA,gBAAA,EAAA,QAAA,CAAA,EAAA,QAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAclB,oCAAoC,EAAA,UAAA,EAAA,CAAA;kBAjBhD,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iCAAiC,cAC/B,IAAI,EAAA,OAAA,EACP,CAAC,mBAAmB,CAAC,EAAA,SAAA,EAGnB;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAA,oCAAsC;AAClD,yBAAA;qBACF,EAAA,eAAA,EACgB,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,8BAA8B,EAAE,MAAM;AACvC,qBAAA,EAAA,QAAA,EAAA,ygBAAA,EAAA,MAAA,EAAA,CAAA,ksBAAA,CAAA,EAAA;;;"}
@@ -3,7 +3,7 @@ import * as i0 from '@angular/core';
3
3
  import { inject, Injectable } from '@angular/core';
4
4
  import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
5
5
  import { defaultTo, get, isString, isEmpty, toString, first } from 'lodash';
6
- import { a as AXMQuestionnaireViewerService } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-juxXq2pM.mjs';
6
+ import { h as AXMQuestionnaireViewerService } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-DxRFMK3k.mjs';
7
7
  import { RootConfig } from '@acorex-platform/module-assessment-management-client/contracts';
8
8
  import { a as openAssessmentSessionAnswersReviewDecision } from './acorex-platform-module-assessment-management-client-assessment-session-answers-view.util-42ZcOY2C.mjs';
9
9
 
@@ -230,4 +230,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
230
230
  }] });
231
231
 
232
232
  export { ReviewAssessmentSessionCommand };
233
- //# sourceMappingURL=acorex-platform-module-assessment-management-client-review-assessment-session.command-CPeFh1m7.mjs.map
233
+ //# sourceMappingURL=acorex-platform-module-assessment-management-client-review-assessment-session.command-CHeyD-AC.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-assessment-management-client-review-assessment-session.command-CPeFh1m7.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-viewer/commands/review-assessment-session.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult, type AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\n\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { defaultTo, first, get, isEmpty, isString, toString } from 'lodash';\nimport { AXMQuestionnaireViewerService } from '../questionnaire-viewer.service';\nimport type { AXMAssessmentManagementAssessmentCaseEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport type { AXMAssessmentManagementAssessmentSessionEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { RootConfig } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { openAssessmentSessionAnswersReviewDecision } from '../utils/assessment-session-answers-view.util';\nimport type { AXMQuestionnaireViewerServiceResult } from '../questionnaire-viewer.service';\n\n//#endregion\n\n//#region ---- Command Input/Output Types ----\n\nexport type ReviewAssessmentSessionOutcome = 'SignedOff' | 'Rejected' | 'Cancelled';\n\nexport interface ReviewAssessmentSessionCommandInput {\n caseId: string;\n sessionId?: string;\n title?: AXPMultiLanguageString | string;\n showAs?: 'popup';\n}\n\nexport interface ReviewAssessmentSessionCommandOutput {\n caseId: string;\n sessionId: string;\n answers: Record<string, unknown>;\n questions: AXMQuestionnaireViewerServiceResult['questions'];\n}\n\ntype ReviewAssessmentSessionCommandInvocation = ReviewAssessmentSessionCommandInput & {\n data?: Record<string, unknown>;\n options?: Partial<ReviewAssessmentSessionCommandInput>;\n};\n\n//#endregion\n\n//#region ---- Review Assessment Session Command ----\n\n/**\n * Opens a readonly answers viewer with Sign off / Reject for workflow manager review.\n */\n@Injectable()\nexport class ReviewAssessmentSessionCommand\n implements AXPCommand<ReviewAssessmentSessionCommandInput, ReviewAssessmentSessionCommandOutput>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly questionnaireViewerService = inject(AXMQuestionnaireViewerService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(\n input: ReviewAssessmentSessionCommandInvocation,\n ): AXPCommandExecuteResultPromise<ReviewAssessmentSessionCommandOutput> {\n try {\n const caseId = this.resolveCaseId(input);\n const sessionId = this.resolveSessionId(input);\n\n if (!caseId) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.review-assessment-session.errors.case-id-required' },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const assessmentCase = await this.loadCase(caseId);\n if (!assessmentCase) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@assessment-management:commands.review-assessment-session.errors.case-not-found',\n { params: { caseId } },\n ),\n },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n let session: AXMAssessmentManagementAssessmentSessionEntityModel | null = null;\n if (sessionId) {\n session = await this.loadSession(sessionId, input);\n } else {\n session = await this.findLatestSession(caseId);\n }\n\n if (!session) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.review-assessment-session.errors.session-not-found' },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const resolvedSessionId = session.id;\n const viewerTitle = await this.resolveViewerTitle(input.title, assessmentCase.title);\n\n const popupResult = await openAssessmentSessionAnswersReviewDecision(\n {\n entityService: this.entityService,\n questionnaireViewerService: this.questionnaireViewerService,\n translationService: this.translationService,\n },\n session,\n assessmentCase,\n { title: viewerTitle },\n );\n\n const outcome = this.resolveOutcome(popupResult);\n const answers = defaultTo(get(popupResult, 'answers'), {}) as Record<string, unknown>;\n const questions = defaultTo(get(popupResult, 'questions'), []);\n\n return { success: true, kind: 'object',\n data: {\n caseId,\n sessionId: resolvedSessionId,\n answers,\n questions,\n },\n metadata: { outcome },\n };\n } catch (error: unknown) {\n const fallback = await this.translationService.translateAsync(\n '@general:messages.generic.error.description',\n );\n const message = error instanceof Error ? error.message : fallback;\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@assessment-management:commands.review-assessment-session.errors.failed',\n { params: { message } },\n ),\n },\n metadata: { outcome: 'Cancelled' },\n };\n }\n }\n\n //#endregion\n\n //#region ---- Resolution helpers ----\n\n private asNonEmptyString(value: unknown): string | undefined {\n if (isString(value) && !isEmpty(value)) {\n return value;\n }\n if (value != null && !isString(value)) {\n const normalized = toString(value).trim();\n return isEmpty(normalized) ? undefined : normalized;\n }\n return undefined;\n }\n\n private resolveSessionId(input: ReviewAssessmentSessionCommandInvocation): string | null {\n const candidates = [\n get(input, 'sessionId'),\n get(input, 'options.sessionId'),\n get(input, 'options.sessionId'),\n ];\n for (const candidate of candidates) {\n const resolved = this.asNonEmptyString(candidate);\n if (resolved) {\n return resolved;\n }\n }\n return null;\n }\n\n private resolveCaseId(input: ReviewAssessmentSessionCommandInvocation): string | null {\n const candidates = [get(input, 'caseId'), get(input, 'options.caseId'), get(input, 'options.caseId')];\n for (const candidate of candidates) {\n const resolved = this.asNonEmptyString(candidate);\n if (resolved) {\n return resolved;\n }\n }\n return null;\n }\n\n private async loadSession(\n sessionId: string,\n input: ReviewAssessmentSessionCommandInvocation,\n ): Promise<AXMAssessmentManagementAssessmentSessionEntityModel | null> {\n const row = get(input, 'data') as Record<string, unknown> | undefined;\n const rowCaseId = this.asNonEmptyString(get(row, 'caseId'));\n\n if (row && rowCaseId) {\n return {\n ...(row as unknown as AXMAssessmentManagementAssessmentSessionEntityModel),\n id: sessionId,\n answers: defaultTo(get(row, 'answers') as Record<string, unknown> | undefined, {}),\n };\n }\n\n const sessionAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>();\n\n const listMatch = await sessionAccessor.query({\n skip: 0,\n take: 1,\n filter: {\n field: 'id',\n operator: { type: 'equal' },\n value: sessionId,\n },\n });\n\n const fromQuery = first(listMatch.items);\n if (fromQuery) {\n return fromQuery;\n }\n\n return defaultTo(await sessionAccessor.byKey(sessionId), null);\n }\n\n private async loadCase(caseId: string): Promise<AXMAssessmentManagementAssessmentCaseEntityModel | null> {\n const caseAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentCase.name)\n .data<string, AXMAssessmentManagementAssessmentCaseEntityModel>();\n\n const listMatch = await caseAccessor.query({\n skip: 0,\n take: 1,\n filter: {\n field: 'id',\n operator: { type: 'equal' },\n value: caseId,\n },\n });\n\n const fromQuery = first(listMatch.items);\n if (fromQuery) {\n return fromQuery;\n }\n\n return defaultTo(await caseAccessor.byKey(caseId), null);\n }\n\n private async findLatestSession(\n caseId: string,\n ): Promise<AXMAssessmentManagementAssessmentSessionEntityModel | null> {\n const sessionAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>();\n\n const listMatch = await sessionAccessor.query({\n skip: 0,\n take: 1,\n sort: [\n { field: 'lastSavedAt', dir: 'desc' },\n { field: 'createdAt', dir: 'desc' },\n ],\n filter: {\n field: 'caseId',\n operator: { type: 'equal' },\n value: caseId,\n },\n });\n\n return first(listMatch.items) ?? null;\n }\n\n private async resolveViewerTitle(\n inputTitle: AXPMultiLanguageString | string | undefined,\n caseTitle: string | undefined,\n ): Promise<string> {\n const explicit = this.normalizeTitle(inputTitle);\n if (explicit) {\n return explicit;\n }\n\n const fromCase = this.normalizeTitle(caseTitle);\n if (fromCase) {\n return fromCase;\n }\n\n const reviewTitleKey = '@assessment-management:sessions.actions.review-answers.title';\n const reviewTitleBase = await this.translationService.translateAsync(reviewTitleKey);\n return reviewTitleBase || 'Review answers';\n }\n\n private normalizeTitle(value: AXPMultiLanguageString | string | undefined | null | false): string {\n if (value == null || value === false) {\n return '';\n }\n if (typeof value === 'string') {\n return value.trim();\n }\n const locale = this.translationService.getActiveLang();\n return resolveMultiLanguageString(value, locale).trim();\n }\n\n private resolveOutcome(result: AXMQuestionnaireViewerServiceResult | null | undefined): ReviewAssessmentSessionOutcome {\n if (result?.decision === 'signed-off') {\n return 'SignedOff';\n }\n if (result?.decision === 'rejected') {\n return 'Rejected';\n }\n return 'Cancelled';\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;AAyCA;AAEA;AAEA;;AAEG;MAEU,8BAA8B,CAAA;AAD3C,IAAA,WAAA,GAAA;;AAMmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,0BAA0B,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAClE,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAqQnE,IAAA;;;IA/PC,MAAM,OAAO,CACX,KAA+C,EAAA;AAE/C,QAAA,IAAI;YACF,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;YACxC,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC;YAE9C,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO;AACL,oBAAA,OAAO,EAAE,KAAK;AACd,oBAAA,OAAO,EAAE,EAAE,IAAI,EAAE,mFAAmF,EAAE;AACtG,oBAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE;iBACnC;YACH;YAEA,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;YAClD,IAAI,CAAC,cAAc,EAAE;gBACnB,OAAO;AACL,oBAAA,OAAO,EAAE,KAA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kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC;QACpF,OAAO,eAAe,IAAI,gBAAgB;IAC5C;AAEQ,IAAA,cAAc,CAAC,KAAiE,EAAA;QACtF,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,KAAK,EAAE;AACpC,YAAA,OAAO,EAAE;QACX;AACA,QAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC7B,YAAA,OAAO,KAAK,CAAC,IAAI,EAAE;QACrB;QACA,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,aAAa,EAAE;QACtD,OAAO,0BAA0B,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE;IACzD;AAEQ,IAAA,cAAc,CAAC,MAA8D,EAAA;AACnF,QAAA,IAAI,MAAM,EAAE,QAAQ,KAAK,YAAY,EAAE;AACrC,YAAA,OAAO,WAAW;QACpB;AACA,QAAA,IAAI,MAAM,EAAE,QAAQ,KAAK,UAAU,EAAE;AACnC,YAAA,OAAO,UAAU;QACnB;AACA,QAAA,OAAO,WAAW;IACpB;8GAzQW,8BAA8B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA9B,8BAA8B,EAAA,CAAA,CAAA;;2FAA9B,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAD1C;;;"}
1
+ {"version":3,"file":"acorex-platform-module-assessment-management-client-review-assessment-session.command-CHeyD-AC.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-viewer/commands/review-assessment-session.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult, type AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\n\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { defaultTo, first, get, isEmpty, isString, toString } from 'lodash';\nimport { AXMQuestionnaireViewerService } from '../questionnaire-viewer.service';\nimport type { AXMAssessmentManagementAssessmentCaseEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport type { AXMAssessmentManagementAssessmentSessionEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { RootConfig } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { openAssessmentSessionAnswersReviewDecision } from '../utils/assessment-session-answers-view.util';\nimport type { AXMQuestionnaireViewerServiceResult } from '../questionnaire-viewer.service';\n\n//#endregion\n\n//#region ---- Command Input/Output Types ----\n\nexport type ReviewAssessmentSessionOutcome = 'SignedOff' | 'Rejected' | 'Cancelled';\n\nexport interface ReviewAssessmentSessionCommandInput {\n caseId: string;\n sessionId?: string;\n title?: AXPMultiLanguageString | string;\n showAs?: 'popup';\n}\n\nexport interface ReviewAssessmentSessionCommandOutput {\n caseId: string;\n sessionId: string;\n answers: Record<string, unknown>;\n questions: AXMQuestionnaireViewerServiceResult['questions'];\n}\n\ntype ReviewAssessmentSessionCommandInvocation = ReviewAssessmentSessionCommandInput & {\n data?: Record<string, unknown>;\n options?: Partial<ReviewAssessmentSessionCommandInput>;\n};\n\n//#endregion\n\n//#region ---- Review Assessment Session Command ----\n\n/**\n * Opens a readonly answers viewer with Sign off / Reject for workflow manager review.\n */\n@Injectable()\nexport class ReviewAssessmentSessionCommand\n implements AXPCommand<ReviewAssessmentSessionCommandInput, ReviewAssessmentSessionCommandOutput>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly questionnaireViewerService = inject(AXMQuestionnaireViewerService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(\n input: ReviewAssessmentSessionCommandInvocation,\n ): AXPCommandExecuteResultPromise<ReviewAssessmentSessionCommandOutput> {\n try {\n const caseId = this.resolveCaseId(input);\n const sessionId = this.resolveSessionId(input);\n\n if (!caseId) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.review-assessment-session.errors.case-id-required' },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const assessmentCase = await this.loadCase(caseId);\n if (!assessmentCase) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@assessment-management:commands.review-assessment-session.errors.case-not-found',\n { params: { caseId } },\n ),\n },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n let session: AXMAssessmentManagementAssessmentSessionEntityModel | null = null;\n if (sessionId) {\n session = await this.loadSession(sessionId, input);\n } else {\n session = await this.findLatestSession(caseId);\n }\n\n if (!session) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.review-assessment-session.errors.session-not-found' },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const resolvedSessionId = session.id;\n const viewerTitle = await this.resolveViewerTitle(input.title, assessmentCase.title);\n\n const popupResult = await openAssessmentSessionAnswersReviewDecision(\n {\n entityService: this.entityService,\n questionnaireViewerService: this.questionnaireViewerService,\n translationService: this.translationService,\n },\n session,\n assessmentCase,\n { title: viewerTitle },\n );\n\n const outcome = this.resolveOutcome(popupResult);\n const answers = defaultTo(get(popupResult, 'answers'), {}) as Record<string, unknown>;\n const questions = defaultTo(get(popupResult, 'questions'), []);\n\n return { success: true, kind: 'object',\n data: {\n caseId,\n sessionId: resolvedSessionId,\n answers,\n questions,\n },\n metadata: { outcome },\n };\n } catch (error: unknown) {\n const fallback = await this.translationService.translateAsync(\n '@general:messages.generic.error.description',\n );\n const message = error instanceof Error ? error.message : fallback;\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@assessment-management:commands.review-assessment-session.errors.failed',\n { params: { message } },\n ),\n },\n metadata: { outcome: 'Cancelled' },\n };\n }\n }\n\n //#endregion\n\n //#region ---- Resolution helpers ----\n\n private asNonEmptyString(value: unknown): string | undefined {\n if (isString(value) && !isEmpty(value)) {\n return value;\n }\n if (value != null && !isString(value)) {\n const normalized = toString(value).trim();\n return isEmpty(normalized) ? undefined : normalized;\n }\n return undefined;\n }\n\n private resolveSessionId(input: ReviewAssessmentSessionCommandInvocation): string | null {\n const candidates = [\n get(input, 'sessionId'),\n get(input, 'options.sessionId'),\n get(input, 'options.sessionId'),\n ];\n for (const candidate of candidates) {\n const resolved = this.asNonEmptyString(candidate);\n if (resolved) {\n return resolved;\n }\n }\n return null;\n }\n\n private resolveCaseId(input: ReviewAssessmentSessionCommandInvocation): string | null {\n const candidates = [get(input, 'caseId'), get(input, 'options.caseId'), get(input, 'options.caseId')];\n for (const candidate of candidates) {\n const resolved = this.asNonEmptyString(candidate);\n if (resolved) {\n return resolved;\n }\n }\n return null;\n }\n\n private async loadSession(\n sessionId: string,\n input: ReviewAssessmentSessionCommandInvocation,\n ): Promise<AXMAssessmentManagementAssessmentSessionEntityModel | null> {\n const row = get(input, 'data') as Record<string, unknown> | undefined;\n const rowCaseId = this.asNonEmptyString(get(row, 'caseId'));\n\n if (row && rowCaseId) {\n return {\n ...(row as unknown as AXMAssessmentManagementAssessmentSessionEntityModel),\n id: sessionId,\n answers: defaultTo(get(row, 'answers') as Record<string, unknown> | undefined, {}),\n };\n }\n\n const sessionAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>();\n\n const listMatch = await sessionAccessor.query({\n skip: 0,\n take: 1,\n filter: {\n field: 'id',\n operator: { type: 'equal' },\n value: sessionId,\n },\n });\n\n const fromQuery = first(listMatch.items);\n if (fromQuery) {\n return fromQuery;\n }\n\n return defaultTo(await sessionAccessor.byKey(sessionId), null);\n }\n\n private async loadCase(caseId: string): Promise<AXMAssessmentManagementAssessmentCaseEntityModel | null> {\n const caseAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentCase.name)\n .data<string, AXMAssessmentManagementAssessmentCaseEntityModel>();\n\n const listMatch = await caseAccessor.query({\n skip: 0,\n take: 1,\n filter: {\n field: 'id',\n operator: { type: 'equal' },\n value: caseId,\n },\n });\n\n const fromQuery = first(listMatch.items);\n if (fromQuery) {\n return fromQuery;\n }\n\n return defaultTo(await caseAccessor.byKey(caseId), null);\n }\n\n private async findLatestSession(\n caseId: string,\n ): Promise<AXMAssessmentManagementAssessmentSessionEntityModel | null> {\n const sessionAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>();\n\n const listMatch = await sessionAccessor.query({\n skip: 0,\n take: 1,\n sort: [\n { field: 'lastSavedAt', dir: 'desc' },\n { field: 'createdAt', dir: 'desc' },\n ],\n filter: {\n field: 'caseId',\n operator: { type: 'equal' },\n value: caseId,\n },\n });\n\n return first(listMatch.items) ?? null;\n }\n\n private async resolveViewerTitle(\n inputTitle: AXPMultiLanguageString | string | undefined,\n caseTitle: string | undefined,\n ): Promise<string> {\n const explicit = this.normalizeTitle(inputTitle);\n if (explicit) {\n return explicit;\n }\n\n const fromCase = this.normalizeTitle(caseTitle);\n if (fromCase) {\n return fromCase;\n }\n\n const reviewTitleKey = '@assessment-management:sessions.actions.review-answers.title';\n const reviewTitleBase = await this.translationService.translateAsync(reviewTitleKey);\n return reviewTitleBase || 'Review answers';\n }\n\n private normalizeTitle(value: AXPMultiLanguageString | string | undefined | null | false): string {\n if (value == null || value === false) {\n return '';\n }\n if (typeof value === 'string') {\n return value.trim();\n }\n const locale = this.translationService.getActiveLang();\n return resolveMultiLanguageString(value, locale).trim();\n }\n\n private resolveOutcome(result: AXMQuestionnaireViewerServiceResult | null | undefined): ReviewAssessmentSessionOutcome {\n if (result?.decision === 'signed-off') {\n return 'SignedOff';\n }\n if (result?.decision === 'rejected') {\n return 'Rejected';\n }\n return 'Cancelled';\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;AAyCA;AAEA;AAEA;;AAEG;MAEU,8BAA8B,CAAA;AAD3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AAA,IAAI,MAAM,EAAE,QAAQ,KAAK,YAAY,EAAE;AACrC,YAAA,OAAO,WAAW;QACpB;AACA,QAAA,IAAI,MAAM,EAAE,QAAQ,KAAK,UAAU,EAAE;AACnC,YAAA,OAAO,UAAU;QACnB;AACA,QAAA,OAAO,WAAW;IACpB;8GAzQW,8BAA8B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA9B,8BAA8B,EAAA,CAAA,CAAA;;2FAA9B,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAD1C;;;"}
@@ -0,0 +1,117 @@
1
+ import { AXPBroadcastEventService } from '@acorex-platform/framework-client/core';
2
+ import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
3
+ import { AXPEntityEventsKeys } from '@acorex-platform/framework-shared/entity';
4
+ import { AXTranslationService } from '@acorex/core/translation';
5
+ import * as i0 from '@angular/core';
6
+ import { inject, Injectable } from '@angular/core';
7
+ import { isPlainObject } from 'lodash-es';
8
+ import { A as AXMFormTemplateViewerService } from './acorex-platform-module-assessment-management-client-form-template-viewer.service-DoO7ZQmw.mjs';
9
+ import { c as AXMRelatedContentRecordService, d as readRelatedRecordId, e as FORM_TEMPLATE_VIEWER_FIELD, f as FORM_TEMPLATE_VIEWER_SOURCE_FIELD } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-DxRFMK3k.mjs';
10
+
11
+ //#endregion
12
+ //#region ----- Command -----
13
+ /**
14
+ * Opens the form stored on the related record and saves the filled context on this record.
15
+ */
16
+ class ShowFormTemplateViewerPopupCommand {
17
+ constructor() {
18
+ //#region ----- Services & Dependencies -----
19
+ this.formViewer = inject(AXMFormTemplateViewerService);
20
+ this.records = inject(AXMRelatedContentRecordService);
21
+ this.entityService = inject(AXPEntityService);
22
+ this.translationService = inject(AXTranslationService);
23
+ this.eventService = inject(AXPBroadcastEventService);
24
+ }
25
+ //#endregion
26
+ //#region ----- Command Handling -----
27
+ async execute(input) {
28
+ const evaluated = resolveInput(input);
29
+ const entity = evaluated.entity?.trim() ?? '';
30
+ const id = readRelatedRecordId(evaluated.id);
31
+ const path = evaluated.path?.trim() ?? '';
32
+ const targetEntity = evaluated.targetEntity?.trim() ?? '';
33
+ const field = evaluated.field?.trim() || FORM_TEMPLATE_VIEWER_FIELD;
34
+ const sourceField = evaluated.sourceField?.trim() || FORM_TEMPLATE_VIEWER_SOURCE_FIELD;
35
+ if (!entity || !id || !path || !targetEntity) {
36
+ return {
37
+ success: false,
38
+ message: {
39
+ text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),
40
+ },
41
+ };
42
+ }
43
+ try {
44
+ const host = await this.records.find(entity, id);
45
+ if (!host) {
46
+ return {
47
+ success: false,
48
+ message: {
49
+ text: await this.translationService.translateAsync('@general:messages.entity.not-found'),
50
+ },
51
+ };
52
+ }
53
+ const relatedId = readRelatedRecordId(host[path]);
54
+ const template = relatedId ? await this.records.readFormTemplate(targetEntity, relatedId, sourceField) : null;
55
+ if (template == null || template === '') {
56
+ return {
57
+ success: false,
58
+ message: {
59
+ text: await this.translationService.translateAsync('@form-template-management:templates.viewer.messages.missing-template'),
60
+ },
61
+ };
62
+ }
63
+ const current = host[field];
64
+ const opened = await this.formViewer.open({
65
+ template: typeof template === 'string' ? template : JSON.stringify(template),
66
+ title: evaluated.title,
67
+ context: isPlainObject(current) ? current : {},
68
+ });
69
+ if (typeof opened === 'string' || opened.cancelled) {
70
+ return { success: false };
71
+ }
72
+ await this.entityService.withEntity(entity).data().update(id, { [field]: opened.context });
73
+ this.eventService.publish(AXPEntityEventsKeys.REFRESH_LAYOUT, { name: entity });
74
+ return {
75
+ success: true,
76
+ kind: 'object',
77
+ data: { id, [field]: opened.context },
78
+ message: {
79
+ text: await this.translationService.translateAsync('@general:messages.entity.updated'),
80
+ },
81
+ };
82
+ }
83
+ catch {
84
+ return {
85
+ success: false,
86
+ message: {
87
+ text: await this.translationService.translateAsync('@general:messages.generic.error.description'),
88
+ },
89
+ };
90
+ }
91
+ }
92
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ShowFormTemplateViewerPopupCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
93
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ShowFormTemplateViewerPopupCommand, providedIn: 'root' }); }
94
+ }
95
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ShowFormTemplateViewerPopupCommand, decorators: [{
96
+ type: Injectable,
97
+ args: [{ providedIn: 'root' }]
98
+ }] });
99
+ //#endregion
100
+ //#region ----- Helpers -----
101
+ function resolveInput(input) {
102
+ const raw = (input ?? {});
103
+ const options = raw.options ?? {};
104
+ const data = raw.data ?? {};
105
+ return {
106
+ entity: options.entity ?? raw.entity ?? '',
107
+ id: options.id ?? raw.id ?? data.id ?? '',
108
+ field: options.field ?? raw.field,
109
+ path: options.path ?? raw.path ?? '',
110
+ sourceField: options.sourceField ?? raw.sourceField,
111
+ targetEntity: options.targetEntity ?? raw.targetEntity ?? '',
112
+ title: options.title ?? raw.title,
113
+ };
114
+ }
115
+
116
+ export { ShowFormTemplateViewerPopupCommand };
117
+ //# sourceMappingURL=acorex-platform-module-assessment-management-client-show-form-template-viewer-popup.command-DlpkbJCZ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-assessment-management-client-show-form-template-viewer-popup.command-DlpkbJCZ.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/content-display/form-template-viewer/show-form-template-viewer-popup.command.ts"],"sourcesContent":["import { AXPBroadcastEventService } from '@acorex-platform/framework-client/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPEntityEventsKeys } from '@acorex-platform/framework-shared/entity';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { inject, Injectable } from '@angular/core';\nimport { isPlainObject } from 'lodash-es';\nimport { AXMFormTemplateViewerService } from '../../form-template/viewer/form-template-viewer.service';\nimport { FORM_TEMPLATE_VIEWER_FIELD, FORM_TEMPLATE_VIEWER_SOURCE_FIELD } from '../content-display.constants';\nimport { readRelatedRecordId } from '../content-display.util';\nimport { AXMRelatedContentRecordService } from '../related-content-record.service';\n\n//#region ----- Types -----\n\nexport interface ShowFormTemplateViewerPopupInput {\n entity: string;\n id: string;\n field?: string;\n path: string;\n sourceField?: string;\n targetEntity: string;\n title?: string;\n}\n\n//#endregion\n\n//#region ----- Command -----\n\n/**\n * Opens the form stored on the related record and saves the filled context on this record.\n */\n@Injectable({ providedIn: 'root' })\nexport class ShowFormTemplateViewerPopupCommand implements AXPCommand<ShowFormTemplateViewerPopupInput, unknown> {\n //#region ----- Services & Dependencies -----\n\n private readonly formViewer = inject(AXMFormTemplateViewerService);\n private readonly records = inject(AXMRelatedContentRecordService);\n private readonly entityService = inject(AXPEntityService);\n private readonly translationService = inject(AXTranslationService);\n private readonly eventService = inject(AXPBroadcastEventService);\n\n //#endregion\n\n //#region ----- Command Handling -----\n\n async execute(input: ShowFormTemplateViewerPopupInput | undefined): AXPCommandExecuteResultPromise<unknown> {\n const evaluated = resolveInput(input);\n const entity = evaluated.entity?.trim() ?? '';\n const id = readRelatedRecordId(evaluated.id);\n const path = evaluated.path?.trim() ?? '';\n const targetEntity = evaluated.targetEntity?.trim() ?? '';\n const field = evaluated.field?.trim() || FORM_TEMPLATE_VIEWER_FIELD;\n const sourceField = evaluated.sourceField?.trim() || FORM_TEMPLATE_VIEWER_SOURCE_FIELD;\n\n if (!entity || !id || !path || !targetEntity) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),\n },\n };\n }\n\n try {\n const host = await this.records.find(entity, id);\n if (!host) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync('@general:messages.entity.not-found'),\n },\n };\n }\n\n const relatedId = readRelatedRecordId(host[path]);\n const template = relatedId ? await this.records.readFormTemplate(targetEntity, relatedId, sourceField) : null;\n if (template == null || template === '') {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@form-template-management:templates.viewer.messages.missing-template',\n ),\n },\n };\n }\n\n const current = host[field];\n const opened = await this.formViewer.open({\n template: typeof template === 'string' ? template : JSON.stringify(template),\n title: evaluated.title,\n context: isPlainObject(current) ? (current as Record<string, unknown>) : {},\n });\n if (typeof opened === 'string' || opened.cancelled) {\n return { success: false };\n }\n\n await this.entityService.withEntity(entity).data().update(id, { [field]: opened.context } as never);\n this.eventService.publish(AXPEntityEventsKeys.REFRESH_LAYOUT, { name: entity });\n return {\n success: true,\n kind: 'object',\n data: { id, [field]: opened.context },\n message: {\n text: await this.translationService.translateAsync('@general:messages.entity.updated'),\n },\n };\n } catch {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync('@general:messages.generic.error.description'),\n },\n };\n }\n }\n\n //#endregion\n}\n\n//#endregion\n\n//#region ----- Helpers -----\n\nfunction resolveInput(input: ShowFormTemplateViewerPopupInput | undefined): ShowFormTemplateViewerPopupInput {\n const raw = (input ?? {}) as ShowFormTemplateViewerPopupInput & {\n options?: Partial<ShowFormTemplateViewerPopupInput>;\n data?: Partial<ShowFormTemplateViewerPopupInput> & { id?: string };\n };\n const options = raw.options ?? {};\n const data = raw.data ?? {};\n return {\n entity: options.entity ?? raw.entity ?? '',\n id: options.id ?? raw.id ?? data.id ?? '',\n field: options.field ?? raw.field,\n path: options.path ?? raw.path ?? '',\n sourceField: options.sourceField ?? raw.sourceField,\n targetEntity: options.targetEntity ?? raw.targetEntity ?? '',\n title: options.title ?? raw.title,\n };\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;AAwBA;AAEA;AAEA;;AAEG;MAEU,kCAAkC,CAAA;AAD/C,IAAA,WAAA,GAAA;;AA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