@acorex-platform/module-workplacesafety-management-client 2.0.0-next.5 → 2.0.0-next.50

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 (22) hide show
  1. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-CQsOLmlJ.mjs → acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-WoADykTl.mjs} +12 -12
  2. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-CQsOLmlJ.mjs.map → acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-WoADykTl.mjs.map} +1 -1
  3. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram-widget-view.component-eDWG-sJ7.mjs → acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram-widget-view.component-CplIrmy1.mjs} +2 -2
  4. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram-widget-view.component-eDWG-sJ7.mjs.map → acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram-widget-view.component-CplIrmy1.mjs.map} +1 -1
  5. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram.component-CfxHwZtH.mjs → acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram.component-B4Xem1ro.mjs} +2 -2
  6. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram.component-CfxHwZtH.mjs.map → acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram.component-B4Xem1ro.mjs.map} +1 -1
  7. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-fill-safety-plan.command-D-m6-mUn.mjs → acorex-platform-module-workplacesafety-management-client-fill-safety-plan.command-MUyZCEGu.mjs} +3 -3
  8. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-fill-safety-plan.command-D-m6-mUn.mjs.map → acorex-platform-module-workplacesafety-management-client-fill-safety-plan.command-MUyZCEGu.mjs.map} +1 -1
  9. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-Q2vVYxP-.mjs → acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-BxVoD0Xb.mjs} +2 -2
  10. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-Q2vVYxP-.mjs.map → acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-BxVoD0Xb.mjs.map} +1 -1
  11. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-index-BGIQtdXI.mjs → acorex-platform-module-workplacesafety-management-client-index-x3bUQx1Y.mjs} +3 -3
  12. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-index-BGIQtdXI.mjs.map → acorex-platform-module-workplacesafety-management-client-index-x3bUQx1Y.mjs.map} +1 -1
  13. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-load-safety-plan-preview-structure-DgfDb0uz.mjs → acorex-platform-module-workplacesafety-management-client-load-safety-plan-preview-structure-B2GOM4uJ.mjs} +2 -2
  14. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-load-safety-plan-preview-structure-DgfDb0uz.mjs.map → acorex-platform-module-workplacesafety-management-client-load-safety-plan-preview-structure-B2GOM4uJ.mjs.map} +1 -1
  15. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-ppe-item-viewer-widget-edit.component-BqHXrGn9.mjs → acorex-platform-module-workplacesafety-management-client-ppe-item-viewer-widget-edit.component-B5qY_1PI.mjs} +3 -3
  16. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-ppe-item-viewer-widget-edit.component-BqHXrGn9.mjs.map → acorex-platform-module-workplacesafety-management-client-ppe-item-viewer-widget-edit.component-B5qY_1PI.mjs.map} +1 -1
  17. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-CqJHTLNq.mjs → acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-BqRFFXZO.mjs} +3 -3
  18. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-CqJHTLNq.mjs.map → acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-BqRFFXZO.mjs.map} +1 -1
  19. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-B9lElhxc.mjs → acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-DNeDu1Q8.mjs} +3 -3
  20. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-B9lElhxc.mjs.map → acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-DNeDu1Q8.mjs.map} +1 -1
  21. package/fesm2022/acorex-platform-module-workplacesafety-management-client.mjs +1 -1
  22. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-fill-safety-plan.command-D-m6-mUn.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan/commands/fill-safety-plan.command.ts"],"sourcesContent":["//#region ----- Imports -----\n\n\n\nimport { resolveEntityRowDisplayText } from '@acorex-platform/framework-client/common';\n\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport type { AXPCommand, AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\n\nimport type { AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\n\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\n\nimport { Injectable, inject } from '@angular/core';\n\nimport { defaultTo, get, isEmpty, isString } from 'lodash';\n\n\n\nimport { AXMSafetyPlanPreviewService } from '../../safety-plan-preview/safety-plan-preview.service';\n\nimport type { AXMSafetyPlanPreviewWorkflowActionSet } from '../../safety-plan-preview/safety-plan-preview.types';\n\nimport { loadSafetyPlanFillValues } from '../../safety-plan-preview/safety-plan-fill-values.util';\n\nimport { loadSafetyPlanPreviewStructure } from './load-safety-plan-preview-structure';\n\n\n\n//#endregion\n\n\n\n//#region ----- Types -----\n\n\n\nexport type FillSafetyPlanOutcome = 'Submitted' | 'Saved' | 'Cancelled' | 'Locked' | 'SignOff';\n\n\n\nexport interface AXMFillSafetyPlanCommandInput {\n\n id?: string;\n\n title?: AXPMultiLanguageString | string;\n\n showAs?: 'popup';\n\n /** draft = Save as Draft/Submit. assigned = Save/Lock. locked = Sign Off. */\n\n workflowActionSet?: AXMSafetyPlanPreviewWorkflowActionSet;\n\n /** Edit section values and persist them when the dialog closes. */\n\n editable?: boolean | string;\n\n data?: Record<string, unknown>;\n\n options?: Partial<AXMFillSafetyPlanCommandInput>;\n\n __context__?: {\n\n entity?: string;\n\n data?: { id?: string; title?: unknown };\n\n options?: { id?: string; title?: unknown; workflowActionSet?: unknown; editable?: unknown };\n\n };\n\n}\n\n\n\n//#endregion\n\n\n\n//#region ----- Command -----\n\n\n\n/**\n\n * Opens the Safety Plan preview. Save as Draft, Submit, Lock, and Sign Off persist fill values first.\n\n * Outcomes depend on workflowActionSet:\n\n * - draft: Saved | Submitted | Cancelled\n\n * - assigned: Saved | Locked | Cancelled\n\n * - locked: SignOff | Cancelled\n\n */\n\n@Injectable()\n\nexport class AXMFillSafetyPlanCommand implements AXPCommand<AXMFillSafetyPlanCommandInput, void> {\n\n //#region ----- Services & Dependencies -----\n\n\n\n private readonly entityService = inject(AXPEntityService);\n\n private readonly translationService = inject(AXTranslationService);\n\n private readonly previewService = inject(AXMSafetyPlanPreviewService);\n\n\n\n //#endregion\n\n\n\n //#region ----- Command Implementation -----\n\n\n\n async execute(input: AXMFillSafetyPlanCommandInput = {}): AXPCommandExecuteResultPromise<void> {\n\n try {\n\n const planId = this.resolvePlanId(input);\n\n if (!planId) {\n\n return {\n\n success: false,\n\n message: {\n\n text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),\n\n },\n\n metadata: { outcome: 'Cancelled' satisfies FillSafetyPlanOutcome },\n\n };\n\n }\n\n\n\n const structure = await loadSafetyPlanPreviewStructure(\n\n this.entityService,\n\n this.translationService,\n\n planId,\n\n );\n\n const fillValues = await loadSafetyPlanFillValues(this.entityService, planId);\n\n const dialogTitle = await this.resolveDialogTitle(input);\n\n const workflowActionSet = this.resolveWorkflowActionSet(input);\n\n const editable = this.resolveEditable(input);\n\n\n\n const result = await this.previewService.open({\n\n title: dialogTitle,\n\n structure,\n\n planId,\n\n fillValues,\n\n workflowActionSet,\n\n editable,\n\n });\n\n\n\n const outcome = this.resolveOutcome(result);\n\n return {\n\n success: true,\n\n kind: 'object',\n\n data: undefined,\n\n metadata: { outcome, refresh: false },\n\n };\n\n } catch {\n\n return {\n\n success: false,\n\n message: {\n\n text: await this.translationService.translateAsync('@general:messages.generic.error.description'),\n\n },\n\n metadata: { outcome: 'Cancelled' satisfies FillSafetyPlanOutcome },\n\n };\n\n }\n\n }\n\n\n\n //#endregion\n\n\n\n //#region ----- Utility Methods -----\n\n\n\n private resolveWorkflowActionSet(\n\n input: AXMFillSafetyPlanCommandInput,\n\n ): AXMSafetyPlanPreviewWorkflowActionSet | undefined {\n\n const candidates = [\n\n input.workflowActionSet,\n\n input.options?.workflowActionSet,\n\n get(input, 'options.workflowActionSet'),\n\n input.__context__?.options?.workflowActionSet,\n\n ];\n\n\n\n for (const candidate of candidates) {\n\n if (candidate === 'draft' || candidate === 'assigned' || candidate === 'locked') {\n\n return candidate;\n\n }\n\n }\n\n\n\n return undefined;\n\n }\n\n\n\n private resolveEditable(input: AXMFillSafetyPlanCommandInput): boolean {\n\n const candidates = [\n\n input.editable,\n\n input.options?.editable,\n\n get(input, 'options.editable'),\n\n input.__context__?.options?.editable,\n\n ];\n\n\n\n return candidates.some((candidate) => candidate === true || candidate === 'true');\n\n }\n\n\n\n private resolveOutcome(\n\n result: { saved?: boolean; submitted?: boolean; locked?: boolean; signOff?: boolean } | null,\n\n ): FillSafetyPlanOutcome {\n\n if (result?.signOff === true) {\n\n return 'SignOff';\n\n }\n\n if (result?.locked === true) {\n\n return 'Locked';\n\n }\n\n if (result?.submitted === true) {\n\n return 'Submitted';\n\n }\n\n if (result?.saved === true) {\n\n return 'Saved';\n\n }\n\n return 'Cancelled';\n\n }\n\n\n\n private resolvePlanId(input: AXMFillSafetyPlanCommandInput): string | undefined {\n\n const context = input.__context__;\n\n const candidates = [\n\n input.id,\n\n input.options?.id,\n\n get(input, 'options.id'),\n\n context?.options?.id,\n\n context?.data?.id,\n\n input.data?.['id'],\n\n ];\n\n\n\n for (const candidate of candidates) {\n\n if (isString(candidate) && !isEmpty(candidate.trim())) {\n\n return candidate.trim();\n\n }\n\n }\n\n\n\n return undefined;\n\n }\n\n\n\n private async resolveDialogTitle(input: AXMFillSafetyPlanCommandInput): Promise<string> {\n\n const locale = this.translationService.getActiveLang?.() ?? 'en-US';\n\n\n\n const explicitTitle = defaultTo(\n\n input.title,\n\n defaultTo(input.options?.title, defaultTo(get(input, 'options.title'), input.__context__?.options?.title)),\n\n );\n\n if (isString(explicitTitle) && explicitTitle.trim().length > 0) {\n\n return resolveMultiLanguageString(explicitTitle, locale).trim();\n\n }\n\n if (explicitTitle != null && typeof explicitTitle === 'object') {\n\n const resolved = resolveMultiLanguageString(explicitTitle as AXPMultiLanguageString, locale).trim();\n\n if (resolved.length > 0) {\n\n return resolved;\n\n }\n\n }\n\n\n\n const contextTitle = defaultTo(input.data?.['title'], input.__context__?.data?.title);\n\n if (contextTitle != null) {\n\n const recordTitle = resolveEntityRowDisplayText(contextTitle, locale).trim();\n\n if (recordTitle.length > 0) {\n\n return recordTitle;\n\n }\n\n }\n\n\n\n return (\n\n (await this.translationService.translateAsync(\n\n '@workplacesafety-management:safety-plan-sections.preview.fill-title',\n\n )) || 'Safety Plan'\n\n );\n\n }\n\n\n\n //#endregion\n\n}\n\n\n\n//#endregion\n\n\n"],"names":[],"mappings":";;;;;;;;;;AAAA;AA4EA;AAIA;AAIA;;;;;;;;;;;;AAYG;MAIU,wBAAwB,CAAA;AAFrC,IAAA,WAAA,GAAA;;AAQmB,QAAA,IAAA,CAAA,aAA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A;kBAFpC;;;"}
1
+ {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-fill-safety-plan.command-MUyZCEGu.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan/commands/fill-safety-plan.command.ts"],"sourcesContent":["//#region ----- Imports -----\n\n\n\nimport { resolveEntityRowDisplayText } from '@acorex-platform/framework-client/common';\n\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport type { AXPCommand, AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\n\nimport type { AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\n\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\n\nimport { Injectable, inject } from '@angular/core';\n\nimport { defaultTo, get, isEmpty, isString } from 'lodash';\n\n\n\nimport { AXMSafetyPlanPreviewService } from '../../safety-plan-preview/safety-plan-preview.service';\n\nimport type { AXMSafetyPlanPreviewWorkflowActionSet } from '../../safety-plan-preview/safety-plan-preview.types';\n\nimport { loadSafetyPlanFillValues } from '../../safety-plan-preview/safety-plan-fill-values.util';\n\nimport { loadSafetyPlanPreviewStructure } from './load-safety-plan-preview-structure';\n\n\n\n//#endregion\n\n\n\n//#region ----- Types -----\n\n\n\nexport type FillSafetyPlanOutcome = 'Submitted' | 'Saved' | 'Cancelled' | 'Locked' | 'SignOff';\n\n\n\nexport interface AXMFillSafetyPlanCommandInput {\n\n id?: string;\n\n title?: AXPMultiLanguageString | string;\n\n showAs?: 'popup';\n\n /** draft = Save as Draft/Submit. assigned = Save/Lock. locked = Sign Off. */\n\n workflowActionSet?: AXMSafetyPlanPreviewWorkflowActionSet;\n\n /** Edit section values and persist them when the dialog closes. */\n\n editable?: boolean | string;\n\n data?: Record<string, unknown>;\n\n options?: Partial<AXMFillSafetyPlanCommandInput>;\n\n __context__?: {\n\n entity?: string;\n\n data?: { id?: string; title?: unknown };\n\n options?: { id?: string; title?: unknown; workflowActionSet?: unknown; editable?: unknown };\n\n };\n\n}\n\n\n\n//#endregion\n\n\n\n//#region ----- Command -----\n\n\n\n/**\n\n * Opens the Safety Plan preview. Save as Draft, Submit, Lock, and Sign Off persist fill values first.\n\n * Outcomes depend on workflowActionSet:\n\n * - draft: Saved | Submitted | Cancelled\n\n * - assigned: Saved | Locked | Cancelled\n\n * - locked: SignOff | Cancelled\n\n */\n\n@Injectable()\n\nexport class AXMFillSafetyPlanCommand implements AXPCommand<AXMFillSafetyPlanCommandInput, void> {\n\n //#region ----- Services & Dependencies -----\n\n\n\n private readonly entityService = inject(AXPEntityService);\n\n private readonly translationService = inject(AXTranslationService);\n\n private readonly previewService = inject(AXMSafetyPlanPreviewService);\n\n\n\n //#endregion\n\n\n\n //#region ----- Command Implementation -----\n\n\n\n async execute(input: AXMFillSafetyPlanCommandInput = {}): AXPCommandExecuteResultPromise<void> {\n\n try {\n\n const planId = this.resolvePlanId(input);\n\n if (!planId) {\n\n return {\n\n success: false,\n\n message: {\n\n text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),\n\n },\n\n metadata: { outcome: 'Cancelled' satisfies FillSafetyPlanOutcome },\n\n };\n\n }\n\n\n\n const structure = await loadSafetyPlanPreviewStructure(\n\n this.entityService,\n\n this.translationService,\n\n planId,\n\n );\n\n const fillValues = await loadSafetyPlanFillValues(this.entityService, planId);\n\n const dialogTitle = await this.resolveDialogTitle(input);\n\n const workflowActionSet = this.resolveWorkflowActionSet(input);\n\n const editable = this.resolveEditable(input);\n\n\n\n const result = await this.previewService.open({\n\n title: dialogTitle,\n\n structure,\n\n planId,\n\n fillValues,\n\n workflowActionSet,\n\n editable,\n\n });\n\n\n\n const outcome = this.resolveOutcome(result);\n\n return {\n\n success: true,\n\n kind: 'object',\n\n data: undefined,\n\n metadata: { outcome, refresh: false },\n\n };\n\n } catch {\n\n return {\n\n success: false,\n\n message: {\n\n text: await this.translationService.translateAsync('@general:messages.generic.error.description'),\n\n },\n\n metadata: { outcome: 'Cancelled' satisfies FillSafetyPlanOutcome },\n\n };\n\n }\n\n }\n\n\n\n //#endregion\n\n\n\n //#region ----- Utility Methods -----\n\n\n\n private resolveWorkflowActionSet(\n\n input: AXMFillSafetyPlanCommandInput,\n\n ): AXMSafetyPlanPreviewWorkflowActionSet | undefined {\n\n const candidates = [\n\n input.workflowActionSet,\n\n input.options?.workflowActionSet,\n\n get(input, 'options.workflowActionSet'),\n\n input.__context__?.options?.workflowActionSet,\n\n ];\n\n\n\n for (const candidate of candidates) {\n\n if (candidate === 'draft' || candidate === 'assigned' || candidate === 'locked') {\n\n return candidate;\n\n }\n\n }\n\n\n\n return undefined;\n\n }\n\n\n\n private resolveEditable(input: AXMFillSafetyPlanCommandInput): boolean {\n\n const candidates = [\n\n input.editable,\n\n input.options?.editable,\n\n get(input, 'options.editable'),\n\n input.__context__?.options?.editable,\n\n ];\n\n\n\n return candidates.some((candidate) => candidate === true || candidate === 'true');\n\n }\n\n\n\n private resolveOutcome(\n\n result: { saved?: boolean; submitted?: boolean; locked?: boolean; signOff?: boolean } | null,\n\n ): FillSafetyPlanOutcome {\n\n if (result?.signOff === true) {\n\n return 'SignOff';\n\n }\n\n if (result?.locked === true) {\n\n return 'Locked';\n\n }\n\n if (result?.submitted === true) {\n\n return 'Submitted';\n\n }\n\n if (result?.saved === true) {\n\n return 'Saved';\n\n }\n\n return 'Cancelled';\n\n }\n\n\n\n private resolvePlanId(input: AXMFillSafetyPlanCommandInput): string | undefined {\n\n const context = input.__context__;\n\n const candidates = [\n\n input.id,\n\n input.options?.id,\n\n get(input, 'options.id'),\n\n context?.options?.id,\n\n context?.data?.id,\n\n input.data?.['id'],\n\n ];\n\n\n\n for (const candidate of candidates) {\n\n if (isString(candidate) && !isEmpty(candidate.trim())) {\n\n return candidate.trim();\n\n }\n\n }\n\n\n\n return undefined;\n\n }\n\n\n\n private async resolveDialogTitle(input: AXMFillSafetyPlanCommandInput): Promise<string> {\n\n const locale = this.translationService.getActiveLang?.() ?? 'en-US';\n\n\n\n const explicitTitle = defaultTo(\n\n input.title,\n\n defaultTo(input.options?.title, defaultTo(get(input, 'options.title'), input.__context__?.options?.title)),\n\n );\n\n if (isString(explicitTitle) && explicitTitle.trim().length > 0) {\n\n return resolveMultiLanguageString(explicitTitle, locale).trim();\n\n }\n\n if (explicitTitle != null && typeof explicitTitle === 'object') {\n\n const resolved = resolveMultiLanguageString(explicitTitle as AXPMultiLanguageString, locale).trim();\n\n if (resolved.length > 0) {\n\n return resolved;\n\n }\n\n }\n\n\n\n const contextTitle = defaultTo(input.data?.['title'], input.__context__?.data?.title);\n\n if (contextTitle != null) {\n\n const recordTitle = resolveEntityRowDisplayText(contextTitle, locale).trim();\n\n if (recordTitle.length > 0) {\n\n return recordTitle;\n\n }\n\n }\n\n\n\n return (\n\n (await this.translationService.translateAsync(\n\n '@workplacesafety-management:safety-plan-sections.preview.fill-title',\n\n )) || 'Safety Plan'\n\n );\n\n }\n\n\n\n //#endregion\n\n}\n\n\n\n//#endregion\n\n\n"],"names":[],"mappings":";;;;;;;;;;AAAA;AA4EA;AAIA;AAIA;;;;;;;;;;;;AAYG;MAIU,wBAAwB,CAAA;AAFrC,IAAA,WAAA,GAAA;;AAQmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAExC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAEjD,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,2BAA2B,CAAC;AAkUtE,IAAA;;;AAtTC,IAAA,MAAM,OAAO,CAAC,KAAA,GAAuC,EAAE,EAAA;AAErD,QAAA,IAAI;YAEF,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;YAExC,IAAI,CAAC,MAAM,EAAE;gBAEX,OAAO;AAEL,oBAAA,OAAO,EAAE,KAAK;AAEd,oBAAA,OAAO,EAAE;wBAEP,IAAI,EAAE,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,uCAAuC,CAAC;AA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I,EAAE;AAEnG,YAAA,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;AAEvB,gBAAA,OAAO,QAAQ;YAEjB;QAEF;QAIA,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,EAAE,KAAK,CAAC;AAErF,QAAA,IAAI,YAAY,IAAI,IAAI,EAAE;YAExB,MAAM,WAAW,GAAG,2BAA2B,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE;AAE5E,YAAA,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;AAE1B,gBAAA,OAAO,WAAW;YAEpB;QAEF;AAIA,QAAA,QAEE,CAAC,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAE3C,qEAAqE,CAEtE,KAAK,aAAa;IAIvB;8GAtUW,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAxB,wBAAwB,EAAA,CAAA,CAAA;;2FAAxB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBAFpC;;;"}
@@ -20,7 +20,7 @@ class AXMSafetyPlanPreviewService {
20
20
  async open(options) {
21
21
  const workflowActionSet = this.resolveWorkflowActionSet(options);
22
22
  const result = await this.dialogOpener.openPopup({
23
- load: () => import('./acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-B9lElhxc.mjs').then((module) => module.AXMSafetyPlanPreviewModalComponent),
23
+ load: () => import('./acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-DNeDu1Q8.mjs').then((module) => module.AXMSafetyPlanPreviewModalComponent),
24
24
  data: { planId: options.planId ?? '', title: options.title },
25
25
  show: (component) => this.popupService.open(component, {
26
26
  title: options.title,
@@ -241,4 +241,4 @@ async function hydrateNestedActivityCatalogSnapshots(entityService, translationS
241
241
  //#endregion
242
242
 
243
243
  export { AXMSafetyPlanPreviewService as A, hydrateSafetyPlanActivitySectionsForPreview as h };
244
- //# sourceMappingURL=acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-Q2vVYxP-.mjs.map
244
+ //# sourceMappingURL=acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-BxVoD0Xb.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-Q2vVYxP-.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-preview/safety-plan-preview.service.ts","../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-preview/hydrate-safety-plan-activity-sections.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { Injectable, inject } from '@angular/core';\nimport { AXPopupService } from '@acorex/components/popup';\nimport { AXPDialogOpener } from '@acorex-platform/framework-client/core';\nimport { AXPDeviceService } from '@acorex-platform/framework-client/core';\n\nimport type {\n AXMSafetyPlanPreviewOpenOptions,\n AXMSafetyPlanPreviewResult,\n AXMSafetyPlanPreviewWorkflowActionSet,\n} from './safety-plan-preview.types';\n\n//#endregion\n\n//#region ----- Service -----\n\n@Injectable({ providedIn: 'root' })\nexport class AXMSafetyPlanPreviewService {\n //#region ----- Services & Dependencies -----\n\n private readonly popupService = inject(AXPopupService);\n private readonly dialogOpener = inject(AXPDialogOpener);\n private readonly deviceService = inject(AXPDeviceService);\n\n //#endregion\n\n //#region ----- Public API -----\n\n async open(options: AXMSafetyPlanPreviewOpenOptions): Promise<AXMSafetyPlanPreviewResult | null> {\n const workflowActionSet = this.resolveWorkflowActionSet(options);\n const result = await this.dialogOpener.openPopup({\n load: () => import('./safety-plan-preview-modal.component').then((module) => module.AXMSafetyPlanPreviewModalComponent),\n data: { planId: options.planId ?? '', title: options.title },\n show: (component) =>\n this.popupService.open(component, {\n title: options.title,\n size: this.deviceService.isSmall() ? 'full' : 'lg',\n data: {\n structure: options.structure,\n workflowActionSet,\n editable: options.editable === true,\n planId: options.planId,\n fillValues: options.fillValues ?? {},\n },\n }),\n });\n\n return (result?.data as AXMSafetyPlanPreviewResult | undefined) ?? null;\n }\n\n //#endregion\n\n //#region ----- Helpers -----\n\n private resolveWorkflowActionSet(\n options: AXMSafetyPlanPreviewOpenOptions,\n ): AXMSafetyPlanPreviewWorkflowActionSet | undefined {\n if (\n options.workflowActionSet === 'draft' ||\n options.workflowActionSet === 'assigned' ||\n options.workflowActionSet === 'locked'\n ) {\n return options.workflowActionSet;\n }\n if (options.showWorkflowActions === true) {\n return 'draft';\n }\n return undefined;\n }\n\n //#endregion\n}\n\n//#endregion\n\n","//#region ----- Imports -----\n\nimport { resolveEntityRowDisplayText } from '@acorex-platform/framework-client/common';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport {\n asSafetyPlanDisplayText,\n isActivitySectionType,\n mapSafetyPlanActivityItemsToSectionSnapshots,\n resolveEntityRefId,\n resolveSectionItemEntityName,\n RootConfig,\n type AXMSafetyPlanActivitySectionSnapshot,\n type AXMSafetyPlanSectionBuilderValue,\n type AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel,\n} from '@acorex-platform/module-workplacesafety-management-client/contracts';\nimport { AXTranslationService } from '@acorex/core/translation';\n\n//#endregion\n\n//#region ----- Public API -----\n\n/**\n * Loads each Activity catalog row's predefined `items` onto `activityRow.sections`\n * and fills missing catalog item titles for preview rendering.\n */\nexport async function hydrateSafetyPlanActivitySectionsForPreview(\n entityService: AXPEntityService,\n translationService: AXTranslationService,\n value: AXMSafetyPlanSectionBuilderValue,\n): Promise<AXMSafetyPlanSectionBuilderValue> {\n const activityIds = collectActivityIdsNeedingSections(value);\n if (activityIds.length === 0) {\n return value;\n }\n\n const loadedById = await loadSafetyPlanActivitiesById(entityService, activityIds);\n if (loadedById.size === 0) {\n return value;\n }\n\n const withSections: AXMSafetyPlanSectionBuilderValue = {\n sections: value.sections.map((section) => {\n if (!isActivitySectionType(section.sectionTypeId, section.sectionType)) {\n return section;\n }\n return {\n ...section,\n items: section.items.map((item) => {\n const activityId = resolveEntityRefId(item.id) ?? resolveEntityRefId(item.itemIds?.[0]);\n if (!activityId) {\n return item;\n }\n const loaded = loadedById.get(activityId);\n if (!loaded) {\n return item;\n }\n const existingRow = item.activityRow;\n return {\n ...item,\n activityRow: {\n ...existingRow,\n title: existingRow?.title || loaded.title,\n code: existingRow?.code || loaded.code,\n description: existingRow?.description || loaded.description,\n sections: loaded.sections,\n },\n };\n }),\n };\n }),\n };\n\n return hydrateNestedActivityCatalogSnapshots(entityService, translationService, withSections);\n}\n\n//#endregion\n\n//#region ----- Helpers -----\n\nfunction collectActivityIdsNeedingSections(value: AXMSafetyPlanSectionBuilderValue): string[] {\n const ids = new Set<string>();\n for (const section of value.sections) {\n if (!isActivitySectionType(section.sectionTypeId, section.sectionType)) {\n continue;\n }\n for (const item of section.items ?? []) {\n const hasSections = (item.activityRow?.sections?.length ?? 0) > 0;\n if (hasSections) {\n continue;\n }\n const activityId = resolveEntityRefId(item.id) ?? resolveEntityRefId(item.itemIds?.[0]);\n if (activityId) {\n ids.add(activityId);\n }\n }\n }\n return [...ids];\n}\n\nasync function loadSafetyPlanActivitiesById(\n entityService: AXPEntityService,\n activityIds: string[],\n): Promise<\n Map<\n string,\n {\n title?: string;\n code?: string;\n description?: string;\n sections: AXMSafetyPlanActivitySectionSnapshot[];\n }\n >\n> {\n const entityKey = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanActivity.name}`;\n const loaded = new Map<\n string,\n {\n title?: string;\n code?: string;\n description?: string;\n sections: AXMSafetyPlanActivitySectionSnapshot[];\n }\n >();\n\n await Promise.all(\n activityIds.map(async (id) => {\n try {\n const row = await entityService.withEntity(entityKey).data().byKey(id);\n if (!row) {\n return;\n }\n const record = row as {\n title?: string;\n code?: string;\n description?: string;\n items?: AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel[];\n };\n loaded.set(id, {\n title: typeof record.title === 'string' ? record.title : undefined,\n code: typeof record.code === 'string' ? record.code : undefined,\n description: typeof record.description === 'string' ? record.description : undefined,\n sections: mapSafetyPlanActivityItemsToSectionSnapshots(record.items),\n });\n } catch {\n /* skip activities the session cannot read */\n }\n }),\n );\n\n return loaded;\n}\n\nasync function hydrateNestedActivityCatalogSnapshots(\n entityService: AXPEntityService,\n translationService: AXTranslationService,\n value: AXMSafetyPlanSectionBuilderValue,\n): Promise<AXMSafetyPlanSectionBuilderValue> {\n const locale = translationService.getActiveLang?.() ?? 'en-US';\n const missingByEntity = new Map<string, Set<string>>();\n\n for (const section of value.sections) {\n if (!isActivitySectionType(section.sectionTypeId, section.sectionType)) {\n continue;\n }\n for (const item of section.items ?? []) {\n for (const activitySection of item.activityRow?.sections ?? []) {\n const entityName = resolveSectionItemEntityName(\n activitySection.sectionTypeId,\n activitySection.sectionType,\n );\n if (!entityName) {\n continue;\n }\n for (const id of activitySection.itemIds ?? []) {\n const snapshot = activitySection.items?.find((entry) => entry.id === id);\n if (asSafetyPlanDisplayText(snapshot?.title) || asSafetyPlanDisplayText(snapshot?.code)) {\n continue;\n }\n const ids = missingByEntity.get(entityName) ?? new Set<string>();\n ids.add(id);\n missingByEntity.set(entityName, ids);\n }\n }\n }\n }\n\n if (missingByEntity.size === 0) {\n return value;\n }\n\n const loadedById = new Map<string, { title?: string; code?: string }>();\n await Promise.all(\n [...missingByEntity.entries()].map(async ([entityName, ids]) => {\n const idList = [...ids];\n try {\n const result = await entityService.withEntity(entityName).data().query({\n skip: 0,\n take: Math.max(idList.length, 1),\n filter:\n idList.length === 1\n ? { field: 'id', operator: { type: 'equal' }, value: idList[0] }\n : { field: 'id', operator: { type: 'in' }, value: idList },\n } as never);\n for (const row of result.items ?? []) {\n const record = row as unknown as Record<string, unknown>;\n const id = resolveEntityRefId(record['id']);\n if (!id) {\n continue;\n }\n loadedById.set(id, {\n title: resolveEntityRowDisplayText(record['title'], locale) || undefined,\n code: asSafetyPlanDisplayText(record['code']) || undefined,\n });\n }\n } catch {\n /* skip entities the session cannot read */\n }\n }),\n );\n\n if (loadedById.size === 0) {\n return value;\n }\n\n return {\n sections: value.sections.map((section) => ({\n ...section,\n items: section.items.map((item) => {\n if (!item.activityRow?.sections?.length) {\n return item;\n }\n return {\n ...item,\n activityRow: {\n ...item.activityRow,\n sections: item.activityRow.sections.map((activitySection) => ({\n ...activitySection,\n items: (activitySection.itemIds ?? []).map((id, index) => {\n const existing =\n activitySection.items?.find((entry) => entry.id === id) ??\n activitySection.items?.[index];\n const loaded = loadedById.get(id);\n return {\n id,\n title: asSafetyPlanDisplayText(existing?.title) || loaded?.title,\n code: asSafetyPlanDisplayText(existing?.code) || loaded?.code,\n };\n }),\n })),\n },\n };\n }),\n })),\n };\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;AAAA;AAaA;AAEA;MAGa,2BAA2B,CAAA;AADxC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,eAAe,CAAC;AACtC,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAiD1D,IAAA;;;IA3CC,MAAM,IAAI,CAAC,OAAwC,EAAA;QACjD,MAAM,iBAAiB,GAAG,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC;QAChE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC;AAC/C,YAAA,IAAI,EAAE,MAAM,OAAO,6GAAuC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,kCAAkC,CAAC;AACvH,YAAA,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE;AAC5D,YAAA,IAAI,EAAE,CAAC,SAAS,KACd,IAAI,CAAC,YAAY,CAAC,IAAI,CAA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,EAAE,QAAQ,EAAE,MAAM,EAAE;AACvC,oBAAA,OAAO,IAAI;gBACb;gBACA,OAAO;AACL,oBAAA,GAAG,IAAI;AACP,oBAAA,WAAW,EAAE;wBACX,GAAG,IAAI,CAAC,WAAW;AACnB,wBAAA,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,eAAe,MAAM;AAC5D,4BAAA,GAAG,eAAe;AAClB,4BAAA,KAAK,EAAE,CAAC,eAAe,CAAC,OAAO,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,KAAI;AACvD,gCAAA,MAAM,QAAQ,GACZ,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC;AACvD,oCAAA,eAAe,CAAC,KAAK,GAAG,KAAK,CAAC;gCAChC,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gCACjC,OAAO;oCACL,EAAE;oCACF,KAAK,EAAE,uBAAuB,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,MAAM,EAAE,KAAK;oCAChE,IAAI,EAAE,uBAAuB,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,MAAM,EAAE,IAAI;iCAC9D;AACH,4BAAA,CAAC,CAAC;AACH,yBAAA,CAAC,CAAC;AACJ,qBAAA;iBACF;AACH,YAAA,CAAC,CAAC;AACH,SAAA,CAAC,CAAC;KACJ;AACH;AAEA;;"}
1
+ {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-BxVoD0Xb.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-preview/safety-plan-preview.service.ts","../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-preview/hydrate-safety-plan-activity-sections.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { Injectable, inject } from '@angular/core';\nimport { AXPopupService } from '@acorex/components/popup';\nimport { AXPDialogOpener } from '@acorex-platform/framework-client/core';\nimport { AXPDeviceService } from '@acorex-platform/framework-client/core';\n\nimport type {\n AXMSafetyPlanPreviewOpenOptions,\n AXMSafetyPlanPreviewResult,\n AXMSafetyPlanPreviewWorkflowActionSet,\n} from './safety-plan-preview.types';\n\n//#endregion\n\n//#region ----- Service -----\n\n@Injectable({ providedIn: 'root' })\nexport class AXMSafetyPlanPreviewService {\n //#region ----- Services & Dependencies -----\n\n private readonly popupService = inject(AXPopupService);\n private readonly dialogOpener = inject(AXPDialogOpener);\n private readonly deviceService = inject(AXPDeviceService);\n\n //#endregion\n\n //#region ----- Public API -----\n\n async open(options: AXMSafetyPlanPreviewOpenOptions): Promise<AXMSafetyPlanPreviewResult | null> {\n const workflowActionSet = this.resolveWorkflowActionSet(options);\n const result = await this.dialogOpener.openPopup({\n load: () => import('./safety-plan-preview-modal.component').then((module) => module.AXMSafetyPlanPreviewModalComponent),\n data: { planId: options.planId ?? '', title: options.title },\n show: (component) =>\n this.popupService.open(component, {\n title: options.title,\n size: this.deviceService.isSmall() ? 'full' : 'lg',\n data: {\n structure: options.structure,\n workflowActionSet,\n editable: options.editable === true,\n planId: options.planId,\n fillValues: options.fillValues ?? {},\n },\n }),\n });\n\n return (result?.data as AXMSafetyPlanPreviewResult | undefined) ?? null;\n }\n\n //#endregion\n\n //#region ----- Helpers -----\n\n private resolveWorkflowActionSet(\n options: AXMSafetyPlanPreviewOpenOptions,\n ): AXMSafetyPlanPreviewWorkflowActionSet | undefined {\n if (\n options.workflowActionSet === 'draft' ||\n options.workflowActionSet === 'assigned' ||\n options.workflowActionSet === 'locked'\n ) {\n return options.workflowActionSet;\n }\n if (options.showWorkflowActions === true) {\n return 'draft';\n }\n return undefined;\n }\n\n //#endregion\n}\n\n//#endregion\n\n","//#region ----- Imports -----\n\nimport { resolveEntityRowDisplayText } from '@acorex-platform/framework-client/common';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport {\n asSafetyPlanDisplayText,\n isActivitySectionType,\n mapSafetyPlanActivityItemsToSectionSnapshots,\n resolveEntityRefId,\n resolveSectionItemEntityName,\n RootConfig,\n type AXMSafetyPlanActivitySectionSnapshot,\n type AXMSafetyPlanSectionBuilderValue,\n type AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel,\n} from '@acorex-platform/module-workplacesafety-management-client/contracts';\nimport { AXTranslationService } from '@acorex/core/translation';\n\n//#endregion\n\n//#region ----- Public API -----\n\n/**\n * Loads each Activity catalog row's predefined `items` onto `activityRow.sections`\n * and fills missing catalog item titles for preview rendering.\n */\nexport async function hydrateSafetyPlanActivitySectionsForPreview(\n entityService: AXPEntityService,\n translationService: AXTranslationService,\n value: AXMSafetyPlanSectionBuilderValue,\n): Promise<AXMSafetyPlanSectionBuilderValue> {\n const activityIds = collectActivityIdsNeedingSections(value);\n if (activityIds.length === 0) {\n return value;\n }\n\n const loadedById = await loadSafetyPlanActivitiesById(entityService, activityIds);\n if (loadedById.size === 0) {\n return value;\n }\n\n const withSections: AXMSafetyPlanSectionBuilderValue = {\n sections: value.sections.map((section) => {\n if (!isActivitySectionType(section.sectionTypeId, section.sectionType)) {\n return section;\n }\n return {\n ...section,\n items: section.items.map((item) => {\n const activityId = resolveEntityRefId(item.id) ?? resolveEntityRefId(item.itemIds?.[0]);\n if (!activityId) {\n return item;\n }\n const loaded = loadedById.get(activityId);\n if (!loaded) {\n return item;\n }\n const existingRow = item.activityRow;\n return {\n ...item,\n activityRow: {\n ...existingRow,\n title: existingRow?.title || loaded.title,\n code: existingRow?.code || loaded.code,\n description: existingRow?.description || loaded.description,\n sections: loaded.sections,\n },\n };\n }),\n };\n }),\n };\n\n return hydrateNestedActivityCatalogSnapshots(entityService, translationService, withSections);\n}\n\n//#endregion\n\n//#region ----- Helpers -----\n\nfunction collectActivityIdsNeedingSections(value: AXMSafetyPlanSectionBuilderValue): string[] {\n const ids = new Set<string>();\n for (const section of value.sections) {\n if (!isActivitySectionType(section.sectionTypeId, section.sectionType)) {\n continue;\n }\n for (const item of section.items ?? []) {\n const hasSections = (item.activityRow?.sections?.length ?? 0) > 0;\n if (hasSections) {\n continue;\n }\n const activityId = resolveEntityRefId(item.id) ?? resolveEntityRefId(item.itemIds?.[0]);\n if (activityId) {\n ids.add(activityId);\n }\n }\n }\n return [...ids];\n}\n\nasync function loadSafetyPlanActivitiesById(\n entityService: AXPEntityService,\n activityIds: string[],\n): Promise<\n Map<\n string,\n {\n title?: string;\n code?: string;\n description?: string;\n sections: AXMSafetyPlanActivitySectionSnapshot[];\n }\n >\n> {\n const entityKey = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanActivity.name}`;\n const loaded = new Map<\n string,\n {\n title?: string;\n code?: string;\n description?: string;\n sections: AXMSafetyPlanActivitySectionSnapshot[];\n }\n >();\n\n await Promise.all(\n activityIds.map(async (id) => {\n try {\n const row = await entityService.withEntity(entityKey).data().byKey(id);\n if (!row) {\n return;\n }\n const record = row as {\n title?: string;\n code?: string;\n description?: string;\n items?: AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel[];\n };\n loaded.set(id, {\n title: typeof record.title === 'string' ? record.title : undefined,\n code: typeof record.code === 'string' ? record.code : undefined,\n description: typeof record.description === 'string' ? record.description : undefined,\n sections: mapSafetyPlanActivityItemsToSectionSnapshots(record.items),\n });\n } catch {\n /* skip activities the session cannot read */\n }\n }),\n );\n\n return loaded;\n}\n\nasync function hydrateNestedActivityCatalogSnapshots(\n entityService: AXPEntityService,\n translationService: AXTranslationService,\n value: AXMSafetyPlanSectionBuilderValue,\n): Promise<AXMSafetyPlanSectionBuilderValue> {\n const locale = translationService.getActiveLang?.() ?? 'en-US';\n const missingByEntity = new Map<string, Set<string>>();\n\n for (const section of value.sections) {\n if (!isActivitySectionType(section.sectionTypeId, section.sectionType)) {\n continue;\n }\n for (const item of section.items ?? []) {\n for (const activitySection of item.activityRow?.sections ?? []) {\n const entityName = resolveSectionItemEntityName(\n activitySection.sectionTypeId,\n activitySection.sectionType,\n );\n if (!entityName) {\n continue;\n }\n for (const id of activitySection.itemIds ?? []) {\n const snapshot = activitySection.items?.find((entry) => entry.id === id);\n if (asSafetyPlanDisplayText(snapshot?.title) || asSafetyPlanDisplayText(snapshot?.code)) {\n continue;\n }\n const ids = missingByEntity.get(entityName) ?? new Set<string>();\n ids.add(id);\n missingByEntity.set(entityName, ids);\n }\n }\n }\n }\n\n if (missingByEntity.size === 0) {\n return value;\n }\n\n const loadedById = new Map<string, { title?: string; code?: string }>();\n await Promise.all(\n [...missingByEntity.entries()].map(async ([entityName, ids]) => {\n const idList = [...ids];\n try {\n const result = await entityService.withEntity(entityName).data().query({\n skip: 0,\n take: Math.max(idList.length, 1),\n filter:\n idList.length === 1\n ? { field: 'id', operator: { type: 'equal' }, value: idList[0] }\n : { field: 'id', operator: { type: 'in' }, value: idList },\n } as never);\n for (const row of result.items ?? []) {\n const record = row as unknown as Record<string, unknown>;\n const id = resolveEntityRefId(record['id']);\n if (!id) {\n continue;\n }\n loadedById.set(id, {\n title: resolveEntityRowDisplayText(record['title'], locale) || undefined,\n code: asSafetyPlanDisplayText(record['code']) || undefined,\n });\n }\n } catch {\n /* skip entities the session cannot read */\n }\n }),\n );\n\n if (loadedById.size === 0) {\n return value;\n }\n\n return {\n sections: value.sections.map((section) => ({\n ...section,\n items: section.items.map((item) => {\n if (!item.activityRow?.sections?.length) {\n return item;\n }\n return {\n ...item,\n activityRow: {\n ...item.activityRow,\n sections: item.activityRow.sections.map((activitySection) => ({\n ...activitySection,\n items: (activitySection.itemIds ?? []).map((id, index) => {\n const existing =\n activitySection.items?.find((entry) => entry.id === id) ??\n activitySection.items?.[index];\n const loaded = loadedById.get(id);\n return {\n id,\n title: asSafetyPlanDisplayText(existing?.title) || loaded?.title,\n code: asSafetyPlanDisplayText(existing?.code) || loaded?.code,\n };\n }),\n })),\n },\n };\n }),\n })),\n };\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;AAAA;AAaA;AAEA;MAGa,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,eAAe,CAAC,KAAK,GAAG,KAAK,CAAC;gCAChC,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gCACjC,OAAO;oCACL,EAAE;oCACF,KAAK,EAAE,uBAAuB,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,MAAM,EAAE,KAAK;oCAChE,IAAI,EAAE,uBAAuB,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,MAAM,EAAE,IAAI;iCAC9D;AACH,4BAAA,CAAC,CAAC;AACH,yBAAA,CAAC,CAAC;AACJ,qBAAA;iBACF;AACH,YAAA,CAAC,CAAC;AACH,SAAA,CAAC,CAAC;KACJ;AACH;AAEA;;"}
@@ -21,12 +21,12 @@ import { AXPWidgetPropertyViewerService, AXPStandardSectionItemsBuilderComponent
21
21
  import * as i3 from '@angular/common';
22
22
  import { CommonModule, AsyncPipe } from '@angular/common';
23
23
  import { n as normalizeSafetyPlanSectionBuilderValue, s as safetyPlanSectionsToBuilderValue } from './acorex-platform-module-workplacesafety-management-client-safety-plan-section-builder.types-C0SEJsVM.mjs';
24
- import { P as PPE_ITEM_VIEWER_WIDGET_NAME } from './acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-CQsOLmlJ.mjs';
24
+ import { P as PPE_ITEM_VIEWER_WIDGET_NAME } from './acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-WoADykTl.mjs';
25
25
  import { AXP_BEHAVIOR_PROPERTY_GROUP } from '@acorex-platform/framework-client/layout/widgets';
26
26
  import { createBooleanProperty } from '@acorex-platform/framework-shared/widget-core';
27
27
  import { SAFETY_PLAN_SECTIONS_SAVE_COMMAND } from './acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-D0aRQHWk.mjs';
28
28
  export { AXMSaveSafetyPlanSectionsCommand } from './acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-D0aRQHWk.mjs';
29
- import { A as AXMSafetyPlanPreviewService, h as hydrateSafetyPlanActivitySectionsForPreview } from './acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-Q2vVYxP-.mjs';
29
+ import { A as AXMSafetyPlanPreviewService, h as hydrateSafetyPlanActivitySectionsForPreview } from './acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-BxVoD0Xb.mjs';
30
30
  import { resolveEntityRowDisplayText } from '@acorex-platform/framework-client/common';
31
31
 
32
32
  //#region ----- Imports -----
@@ -1869,4 +1869,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
1869
1869
  }] });
1870
1870
 
1871
1871
  export { AXMSafetyPlanSectionBuilderComponent, AXMSafetyPlanSectionsPageComponent, AXMSafetyPlanSectionsPageComponentProvider, SAFETY_PLAN_SECTIONS_SAVE_COMMAND };
1872
- //# sourceMappingURL=acorex-platform-module-workplacesafety-management-client-index-BGIQtdXI.mjs.map
1872
+ //# sourceMappingURL=acorex-platform-module-workplacesafety-management-client-index-x3bUQx1Y.mjs.map