@acorex-platform/module-workplacesafety-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 (18) hide show
  1. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-C2CZZwOj.mjs → acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-CQsOLmlJ.mjs} +9 -9
  2. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-C2CZZwOj.mjs.map → acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-CQsOLmlJ.mjs.map} +1 -1
  3. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-fill-safety-plan.command-lJl0qpvT.mjs → acorex-platform-module-workplacesafety-management-client-fill-safety-plan.command-D-m6-mUn.mjs} +3 -3
  4. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-fill-safety-plan.command-lJl0qpvT.mjs.map → acorex-platform-module-workplacesafety-management-client-fill-safety-plan.command-D-m6-mUn.mjs.map} +1 -1
  5. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-TrVl3-T6.mjs → acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-Q2vVYxP-.mjs} +17 -13
  6. package/fesm2022/acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-Q2vVYxP-.mjs.map +1 -0
  7. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-index-D_LE40Xc.mjs → acorex-platform-module-workplacesafety-management-client-index-BGIQtdXI.mjs} +3 -3
  8. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-index-D_LE40Xc.mjs.map → acorex-platform-module-workplacesafety-management-client-index-BGIQtdXI.mjs.map} +1 -1
  9. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-load-safety-plan-preview-structure-Ce67NSIZ.mjs → acorex-platform-module-workplacesafety-management-client-load-safety-plan-preview-structure-DgfDb0uz.mjs} +2 -2
  10. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-load-safety-plan-preview-structure-Ce67NSIZ.mjs.map → acorex-platform-module-workplacesafety-management-client-load-safety-plan-preview-structure-DgfDb0uz.mjs.map} +1 -1
  11. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-DJqqiYlD.mjs → acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-CqJHTLNq.mjs} +3 -3
  12. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-DJqqiYlD.mjs.map → acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-CqJHTLNq.mjs.map} +1 -1
  13. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-show-job-doc-setup.command-UlWyzIXQ.mjs → acorex-platform-module-workplacesafety-management-client-show-job-doc-setup.command-B0g4JL0B.mjs} +43 -22
  14. package/fesm2022/acorex-platform-module-workplacesafety-management-client-show-job-doc-setup.command-B0g4JL0B.mjs.map +1 -0
  15. package/fesm2022/acorex-platform-module-workplacesafety-management-client.mjs +1 -1
  16. package/package.json +2 -2
  17. package/fesm2022/acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-TrVl3-T6.mjs.map +0 -1
  18. package/fesm2022/acorex-platform-module-workplacesafety-management-client-show-job-doc-setup.command-UlWyzIXQ.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-index-D_LE40Xc.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-sections-page/safety-plan-section-widget-options.util.ts","../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-sections-page/safety-plan-section-widget-options.service.ts","../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-sections-page/safety-plan-section-builder.component.ts","../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-sections-page/safety-plan-section-builder.component.html","../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-sections-page/safety-plan-sections-page.component.ts","../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-sections-page/safety-plan-sections-page-component.provider.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport type {\n AXPBuilderSection,\n AXPWidgetPropertyInjection,\n} from '@acorex-platform/framework-client/layout/components';\nimport { AXP_BEHAVIOR_PROPERTY_GROUP } from '@acorex-platform/framework-client/layout/widgets';\nimport { AXPWidgetsList, type AXPWidgetNode } from '@acorex-platform/framework-shared/core';\nimport { createBooleanProperty } from '@acorex-platform/framework-shared/widget-core';\nimport {\n asSafetyPlanDisplayText,\n resolveEntityRefId,\n resolveSectionTypeKey,\n type AXMSafetyPlanSectionWidgetOptions,\n type AXMSectionTypeCode,\n type AXMSectionTypeSnapshot,\n} from '@acorex-platform/module-workplacesafety-management-client/contracts';\n\nimport { PPE_ITEM_VIEWER_WIDGET_NAME } from '../ppe-item-viewer/ppe-item-viewer.types';\n\n//#endregion\n\n//#region ----- Types -----\n\nexport type AXMSafetyPlanConfigurableWidgetType =\n | typeof PPE_ITEM_VIEWER_WIDGET_NAME\n | typeof AXPWidgetsList.Editors.ControlHierarchyDiagram;\n\n//#endregion\n\n//#region ----- Constants -----\n\nexport const SAFETY_PLAN_PPE_WIDGET_PROPERTY_EXCLUDE = [\n 'name',\n 'path',\n 'ppeItems',\n 'readonly',\n 'disabled',\n 'triggers',\n 'requiredValidation',\n] as const;\n\nexport const SAFETY_PLAN_HIERARCHY_WIDGET_PROPERTY_EXCLUDE = ['name', 'path'] as const;\n\nconst PPE_OPTION_KEYS = ['layout'] as const;\nconst HIERARCHY_OPTION_KEYS = ['viewType', 'showTitle', 'showViewTypeSelector'] as const;\n\n//#endregion\n\n//#region ----- Resolve -----\n\nexport function resolveSafetyPlanSectionConfigurableWidgetType(\n sectionTypeId: string | undefined,\n snapshot?: AXMSectionTypeSnapshot,\n sectionTitle?: unknown,\n sectionDescription?: unknown,\n): AXMSafetyPlanConfigurableWidgetType | null {\n const resolvedKeys = [\n resolveSectionTypeKey(sectionTypeId, snapshot),\n resolveSectionTypeKeyFromCode(snapshot?.code),\n resolveSectionTypeKeyFromTitle(sectionTitle),\n resolveSectionTypeKeyFromTitle(snapshot?.title),\n resolveSectionTypeKeyFromDescription(sectionDescription),\n resolveSectionTypeKeyFromDescription(snapshot?.description),\n ];\n if (resolvedKeys.includes('Ppe')) {\n return PPE_ITEM_VIEWER_WIDGET_NAME;\n }\n if (resolvedKeys.includes('HierarchyLevel')) {\n return AXPWidgetsList.Editors.ControlHierarchyDiagram;\n }\n return null;\n}\n\nfunction resolveSectionTypeKeyFromCode(code: string | undefined): AXMSectionTypeCode | undefined {\n const compact = asSafetyPlanDisplayText(code).replace(/\\s+/g, '').toLowerCase();\n if (!compact) {\n return undefined;\n }\n if (compact === 'hierarchylevel' || compact === 'hierarchy') {\n return 'HierarchyLevel';\n }\n if (compact === 'ppe') {\n return 'Ppe';\n }\n return undefined;\n}\n\nfunction resolveSectionTypeKeyFromTitle(title: unknown): AXMSectionTypeCode | undefined {\n const compact = asSafetyPlanDisplayText(title).replace(/\\s+/g, '').toLowerCase();\n if (!compact) {\n return undefined;\n }\n if (compact === 'hierarchylevel' || compact.includes('hierarchy')) {\n return 'HierarchyLevel';\n }\n if (compact === 'ppe' || compact === 'ppeitem' || compact === 'ppeitems') {\n return 'Ppe';\n }\n return undefined;\n}\n\nfunction resolveSectionTypeKeyFromDescription(description: unknown): AXMSectionTypeCode | undefined {\n const text = asSafetyPlanDisplayText(description).toLowerCase();\n if (!text) {\n return undefined;\n }\n if (text.includes('control hierarchy')) {\n return 'HierarchyLevel';\n }\n if (text.includes('personal protective equipment')) {\n return 'Ppe';\n }\n return undefined;\n}\n\nfunction readBuilderSectionTypeId(section: AXPBuilderSection): string | undefined {\n return resolveEntityRefId(section['sectionTypeId']) ?? resolveEntityRefId(section['sectionType']) ?? undefined;\n}\n\nexport function resolveConfigurableWidgetTypeForSection(\n section: AXPBuilderSection,\n): AXMSafetyPlanConfigurableWidgetType | null {\n return resolveSafetyPlanSectionConfigurableWidgetType(\n readBuilderSectionTypeId(section),\n section['sectionType'] as AXMSectionTypeSnapshot | undefined,\n section['title'],\n section['description'],\n );\n}\n\nexport function canConfigureSafetyPlanSectionWidget(section: AXPBuilderSection): boolean {\n return resolveConfigurableWidgetTypeForSection(section) != null;\n}\n\nexport function widgetTitleKeyForConfigurableType(widgetType: AXMSafetyPlanConfigurableWidgetType): string {\n if (widgetType === PPE_ITEM_VIEWER_WIDGET_NAME) {\n return '@workplacesafety-management:ppe-items.components.ppe-item-viewer.widget-title';\n }\n return '@workplacesafety-management:control-measure-types.components.control-hierarchy-diagram.widget-title';\n}\n\n//#endregion\n\n//#region ----- Options -----\n\nexport function readSectionWidgetOptions(section: AXPBuilderSection): AXMSafetyPlanSectionWidgetOptions {\n const raw = section['widgetOptions'];\n if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {\n return {};\n }\n return { ...(raw as AXMSafetyPlanSectionWidgetOptions) };\n}\n\nexport function pickSavedWidgetOptions(\n widgetType: AXMSafetyPlanConfigurableWidgetType,\n existing: AXMSafetyPlanSectionWidgetOptions,\n incoming: Record<string, unknown>,\n): AXMSafetyPlanSectionWidgetOptions {\n const merged = { ...existing, ...incoming };\n const keys = widgetType === PPE_ITEM_VIEWER_WIDGET_NAME ? PPE_OPTION_KEYS : HIERARCHY_OPTION_KEYS;\n const next: AXMSafetyPlanSectionWidgetOptions = {};\n for (const key of keys) {\n const value = merged[key];\n if (value !== undefined && value !== null) {\n (next as Record<string, unknown>)[key] = value;\n }\n }\n return next;\n}\n\nexport function buildSafetyPlanSectionWidgetNode(\n widgetType: AXMSafetyPlanConfigurableWidgetType,\n options: AXMSafetyPlanSectionWidgetOptions,\n): AXPWidgetNode {\n return {\n type: widgetType,\n options: { ...options },\n };\n}\n\nexport function hierarchyWidgetCustomProperties(): AXPWidgetPropertyInjection[] {\n return [\n {\n property: createBooleanProperty({\n name: 'showTitle',\n title:\n '@workplacesafety-management:control-measure-types.components.control-hierarchy-diagram.fields.show-title.title',\n path: 'options.showTitle',\n group: AXP_BEHAVIOR_PROPERTY_GROUP,\n defaultValue: false,\n }),\n },\n {\n property: createBooleanProperty({\n name: 'showViewTypeSelector',\n title:\n '@workplacesafety-management:control-measure-types.components.control-hierarchy-diagram.fields.show-view-type-selector.title',\n path: 'options.showViewTypeSelector',\n group: AXP_BEHAVIOR_PROPERTY_GROUP,\n defaultValue: true,\n }),\n },\n ];\n}\n\n//#endregion\n","//#region ----- Imports -----\n\nimport {\n AXPWidgetPropertyViewerService,\n type AXPBuilderSection,\n type AXPBuilderValue,\n} from '@acorex-platform/framework-client/layout/components';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\n\nimport { PPE_ITEM_VIEWER_WIDGET_NAME } from '../ppe-item-viewer/ppe-item-viewer.types';\nimport {\n buildSafetyPlanSectionWidgetNode,\n canConfigureSafetyPlanSectionWidget,\n hierarchyWidgetCustomProperties,\n pickSavedWidgetOptions,\n readSectionWidgetOptions,\n resolveConfigurableWidgetTypeForSection,\n SAFETY_PLAN_HIERARCHY_WIDGET_PROPERTY_EXCLUDE,\n SAFETY_PLAN_PPE_WIDGET_PROPERTY_EXCLUDE,\n widgetTitleKeyForConfigurableType,\n type AXMSafetyPlanConfigurableWidgetType,\n} from './safety-plan-section-widget-options.util';\n\n//#endregion\n\n//#region ----- Service -----\n\n@Injectable({ providedIn: 'root' })\nexport class AXMSafetyPlanSectionWidgetOptionsService {\n //#region ----- Services & Dependencies -----\n\n private readonly widgetPropertyViewer = inject(AXPWidgetPropertyViewerService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ----- Public API -----\n\n canConfigure(section: AXPBuilderSection): boolean {\n return canConfigureSafetyPlanSectionWidget(section);\n }\n\n async prompt(\n section: AXPBuilderSection,\n _value: AXPBuilderValue,\n ): Promise<Record<string, unknown> | null> {\n const widgetType = resolveConfigurableWidgetTypeForSection(section);\n if (!widgetType) {\n return null;\n }\n\n const existing = readSectionWidgetOptions(section);\n const title =\n (await this.translationService.translateAsync(widgetTitleKeyForConfigurableType(widgetType))) ||\n (await this.translationService.translateAsync('@general:actions.edit.title')) ||\n 'Edit';\n\n const result = await this.widgetPropertyViewer\n .create()\n .dialog((dialog) => {\n dialog\n .setTitle(title)\n .setMode('simple')\n .setWidget(buildSafetyPlanSectionWidgetNode(widgetType, existing))\n .setExclude([...this.excludeFor(widgetType)]);\n if (widgetType !== PPE_ITEM_VIEWER_WIDGET_NAME) {\n dialog.setCustom({ properties: hierarchyWidgetCustomProperties() });\n }\n })\n .show();\n\n if (!result?.values) {\n return null;\n }\n\n const incoming = (result.values.options as Record<string, unknown> | undefined) ?? {};\n return {\n widgetOptions: pickSavedWidgetOptions(widgetType, existing, incoming),\n };\n }\n\n //#endregion\n\n //#region ----- Helpers -----\n\n private excludeFor(widgetType: AXMSafetyPlanConfigurableWidgetType): readonly string[] {\n return widgetType === PPE_ITEM_VIEWER_WIDGET_NAME\n ? SAFETY_PLAN_PPE_WIDGET_PROPERTY_EXCLUDE\n : SAFETY_PLAN_HIERARCHY_WIDGET_PROPERTY_EXCLUDE;\n }\n\n //#endregion\n}\n\n//#endregion\n","import { AXPDataGenerator } from '@acorex-platform/framework-client/core';\nimport { AXPWidgetsCatalog } from '@acorex-platform/framework-shared/core';\nimport { AXButtonModule } from '@acorex/components/button';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationModule, AXTranslationService } from '@acorex/core/translation';\nimport {\n AXPDynamicFormDefinition,\n AXPDynamicFormGroupDefinition,\n AXPLayoutBuilderService,\n} from '@acorex-platform/framework-client/layout/builder';\nimport {\n AXPEntityDataSelectorService,\n AXPEntityDefinitionRegistryService,\n AXPEntityService,\n} from '@acorex-platform/framework-client/layout/entity';\nimport {\n AXPBuilderItem,\n AXPBuilderItemViewModel,\n AXPBuilderSection,\n AXPBuilderValue,\n AXPStandardSectionItemsBuilderComponent,\n AXPStandardSectionItemsBuilderConfig,\n} from '@acorex-platform/framework-client/layout/components';\nimport { CommonModule } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport { isEqual } from 'lodash';\nimport type { AXMSectionTypeSnapshot } from '@acorex-platform/module-workplacesafety-management-client/contracts';\nimport {\n RootConfig,\n WORKPLACE_SAFETY_SECTION_TYPE_LOOKUP_WIDGET_OPTIONS,\n clearDependentItemsOnParentChange,\n dedupeSafetyPlanSectionItemSelection,\n enrichSectionTypeSnapshot,\n isActivitySectionType,\n mapSafetyPlanActivityItemsToSectionSnapshots,\n mapSafetyPlanSectionSelectedItems,\n resolveSafetyPlanSectionItemColumns,\n resolveSafetyPlanSectionItemEntityKey,\n resolveSafetyPlanSectionItemFilterAsync,\n asSafetyPlanDisplayText,\n type AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel,\n} from '@acorex-platform/module-workplacesafety-management-client/contracts';\nimport {\n AXMSafetyPlanSectionBuilderItemValue,\n AXMSafetyPlanSectionBuilderValue,\n AXMSafetyPlanActivityRowBuilderPayload,\n normalizeSafetyPlanSectionBuilderValue,\n} from './safety-plan-section-builder.types';\nimport { AXMSafetyPlanSectionWidgetOptionsService } from './safety-plan-section-widget-options.service';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\n//#region ----- Types -----\ninterface SafetyPlanSectionDialogValue {\n sectionTypeId: string;\n sectionType?: AXMSectionTypeSnapshot;\n /** Synced from the selected Section Type (display-only in the dialog). */\n sectionTypeDescription?: string;\n /** Derived from Section Type title; not shown in the dialog. */\n title: string;\n /** Optional section description copied from the type description on create/edit. */\n description?: string;\n}\ninterface SafetyPlanSectionItemDialogValue {\n itemIds: string[];\n items?: { id: string; title?: string; code?: string }[];\n}\ninterface SectionBuilderContext {\n sectionTypeId: string;\n sectionType?: AXMSectionTypeSnapshot;\n safetyPlanActivityId?: string;\n safetyPlanActivity?: { id: string; title?: string; code?: string };\n}\n//#endregion\n//#region ----- Component -----\n@Component({\n selector: 'axm-safety-plan-section-builder',\n templateUrl: './safety-plan-section-builder.component.html',\n styleUrl: './safety-plan-section-builder.component.css',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [CommonModule, AXButtonModule, AXDecoratorModule, AXTranslationModule, AXPStandardSectionItemsBuilderComponent],\n})\nexport class AXMSafetyPlanSectionBuilderComponent {\n //#region ----- Inputs / Outputs -----\n readonly value = input<AXMSafetyPlanSectionBuilderValue | null | undefined>(null);\n readonly safetyPlanId = input<string | undefined>(undefined);\n readonly options = input<Record<string, unknown>>({});\n readonly valueChange = output<AXMSafetyPlanSectionBuilderValue>();\n //#endregion\n //#region ----- Services & Dependencies -----\n private readonly standardRef = viewChild(AXPStandardSectionItemsBuilderComponent);\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly translationService = inject(AXTranslationService);\n private readonly toastService = inject(AXToastService);\n private readonly entityDataSelector = inject(AXPEntityDataSelectorService);\n private readonly entityRegistry = inject(AXPEntityDefinitionRegistryService);\n private readonly entityService = inject(AXPEntityService);\n private readonly commandService = inject(AXPCommandService);\n private readonly widgetOptionsService = inject(AXMSafetyPlanSectionWidgetOptionsService);\n //#endregion\n //#region ----- State Signals -----\n protected readonly builderValue = signal<AXPBuilderValue>({ sections: [] });\n /** Applied on the next builder commit so section header title survives item add/edit. */\n private readonly pendingSectionTitles = new Map<string, string>();\n protected readonly standardConfig = computed<AXPStandardSectionItemsBuilderConfig>(() => ({\n mapItemToView: (item) => this.mapItemToView(item),\n promptAddSection: this.allowAddSection() ? (value) => this.promptAddSection(value) : async () => null,\n promptEditSection: (section, value) => this.promptSectionHeaderEdit(section, value),\n promptAddItems: this.allowAddItems() ? (sectionId, value) => this.promptAddItems(sectionId, value) : undefined,\n promptEditItem: (item, sectionId, value) => this.promptEditItem(item, sectionId, value),\n showSectionTechnicalName: false,\n allowReorderSections: this.allowReorderSections(),\n minSectionCount: this.allowAddSection() ? 0 : Number.MAX_SAFE_INTEGER,\n texts: {\n addSection: '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.actions.add-section.title',\n addItem: '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.actions.add-item.title',\n },\n }));\n protected readonly hideHeaderActions = computed(() => (this.options()['hideHeaderActions'] as boolean) === true);\n protected readonly allowAddSection = computed(() => (this.options()['allowAddSection'] as boolean) !== false);\n protected readonly allowEditSection = computed(() => (this.options()['allowEditSection'] as boolean) === true);\n protected readonly allowEditItem = computed(() => (this.options()['allowEditItem'] as boolean) === true);\n protected readonly allowAddItems = computed(() => (this.options()['allowAddItems'] as boolean) !== false);\n protected readonly allowReorderSections = computed(() => {\n const option = this.options()['allowReorderSections'];\n return typeof option === 'boolean' ? option : true;\n });\n protected readonly readonly = computed(() => (this.options()['readonly'] as boolean) === true);\n //#endregion\n //#region ----- Lifecycle -----\n #syncValueToBuilder = effect(() => {\n const normalized = normalizeSafetyPlanSectionBuilderValue(this.value());\n const next = this.toBuilderValue(normalized);\n if (isEqual(untracked(() => this.builderValue()), next)) {\n return;\n }\n this.builderValue.set(next);\n });\n //#endregion\n //#region ----- Public API -----\n async addSection(): Promise<void> {\n await this.standardRef()?.addSection();\n }\n syncAfterSave(value: AXMSafetyPlanSectionBuilderValue): void {\n const normalized = normalizeSafetyPlanSectionBuilderValue(value);\n this.builderValue.set(this.toBuilderValue(normalized));\n queueMicrotask(() => this.standardRef()?.markClean());\n }\n resetAfterDiscard(): void {\n const normalized = normalizeSafetyPlanSectionBuilderValue(this.value());\n this.builderValue.set(this.toBuilderValue(normalized));\n queueMicrotask(() => this.standardRef()?.markClean());\n }\n //#endregion\n //#region ----- Event Handlers -----\n protected onBuilderValueChange(next: AXPBuilderValue): void {\n const previous = this.fromBuilderValue(this.builderValue());\n let nextValue = clearDependentItemsOnParentChange(previous, this.fromBuilderValue(next));\n if (this.pendingSectionTitles.size > 0) {\n nextValue = {\n sections: nextValue.sections.map((section) => {\n const title = this.pendingSectionTitles.get(section.id);\n return title ? { ...section, title } : section;\n }),\n };\n this.pendingSectionTitles.clear();\n }\n this.builderValue.set(this.toBuilderValue(nextValue));\n this.valueChange.emit(nextValue);\n }\n //#endregion\n //#region ----- Section prompts -----\n private async promptAddSection(value: AXPBuilderValue): Promise<Record<string, unknown> | null> {\n const dialogValue = await this.promptSectionForm('create', {\n sectionTypeId: '',\n sectionTypeDescription: '',\n title: '',\n description: '',\n });\n if (!dialogValue) return null;\n const sectionId = AXPDataGenerator.uuid();\n return {\n id: sectionId,\n name: sectionId,\n sectionTypeId: dialogValue.sectionTypeId,\n sectionType: dialogValue.sectionType,\n title: dialogValue.title,\n description: dialogValue.description ?? '',\n safetyPlanId: this.safetyPlanId() ?? '',\n sortOrder: (value.sections?.length ?? 0) + 1,\n items: [],\n };\n }\n private async promptSectionHeaderEdit(\n section: AXPBuilderSection,\n value: AXPBuilderValue,\n ): Promise<Record<string, unknown> | null> {\n if (this.widgetOptionsService.canConfigure(section)) {\n return this.widgetOptionsService.prompt(section, value);\n }\n if (!this.allowEditSection()) {\n return null;\n }\n return this.promptEditSection(section, value);\n }\n private async promptEditSection(\n section: AXPBuilderSection,\n value: AXPBuilderValue,\n ): Promise<Record<string, unknown> | null> {\n const previousSectionTypeId = String(section['sectionTypeId'] ?? '');\n const sectionTypeSnapshot = section['sectionType'] as AXMSectionTypeSnapshot | undefined;\n const dialogValue = await this.promptSectionForm('edit', {\n sectionTypeId: previousSectionTypeId,\n sectionType: sectionTypeSnapshot,\n sectionTypeDescription:\n enrichSectionTypeSnapshot(previousSectionTypeId, sectionTypeSnapshot)?.description ??\n String(section['description'] ?? ''),\n title: String(section['title'] ?? ''),\n description: String(section['description'] ?? ''),\n });\n if (!dialogValue) return null;\n const sectionTypeChanged = previousSectionTypeId !== dialogValue.sectionTypeId;\n const isActivity = isActivitySectionType(dialogValue.sectionTypeId, dialogValue.sectionType);\n const keepSafetyPlanActivity =\n isActivity && !sectionTypeChanged\n ? {\n safetyPlanActivityId: section['safetyPlanActivityId'],\n safetyPlanActivity: section['safetyPlanActivity'],\n }\n : {\n safetyPlanActivityId: undefined,\n safetyPlanActivity: undefined,\n };\n return {\n ...section,\n sectionTypeId: dialogValue.sectionTypeId,\n sectionType: dialogValue.sectionType,\n title: dialogValue.title,\n description: dialogValue.description ?? '',\n ...keepSafetyPlanActivity,\n ...(sectionTypeChanged ? { items: [] } : {}),\n };\n }\n private async promptSectionForm(\n mode: 'create' | 'edit',\n seed: SafetyPlanSectionDialogValue,\n ): Promise<SafetyPlanSectionDialogValue | null> {\n const titleKey =\n mode === 'create'\n ? '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.actions.add-section.title'\n : '@general:actions.edit.title';\n const title = (await this.translationService.translateAsync(titleKey)) || (mode === 'create' ? 'Add Section' : 'Edit');\n const result = await this.layoutBuilder\n .create()\n .dialog<{ success: boolean; value?: SafetyPlanSectionDialogValue }>((dialog) => {\n dialog\n .setTitle(title)\n .setSize('md')\n .setCloseButton(true)\n .setContext({ ...seed })\n .content((layout) => {\n layout.mode('edit');\n layout.dynamicForm(this.buildSectionFormDefinition());\n })\n .setActions((actions) => {\n actions.cancel('@general:actions.cancel.title').submit('@general:actions.save.title');\n })\n .onAction((dialogRef) => {\n if (dialogRef.action() === 'cancel') {\n return { success: false };\n }\n const context = dialogRef.context() as Partial<SafetyPlanSectionDialogValue>;\n const sectionTypeId = String(context.sectionTypeId ?? '').trim();\n if (!sectionTypeId) {\n return { success: false };\n }\n const sectionType = enrichSectionTypeSnapshot(sectionTypeId, context.sectionType);\n const titleValue =\n String(context.title ?? '').trim() ||\n String(sectionType?.title ?? '').trim() ||\n String(sectionType?.code ?? '').trim();\n if (!titleValue) {\n return { success: false };\n }\n const description =\n String(context.sectionTypeDescription ?? '').trim() ||\n String(context.description ?? '').trim() ||\n String(sectionType?.description ?? '').trim();\n return {\n success: true,\n kind: 'object',\n value: {\n sectionTypeId,\n sectionType,\n title: titleValue,\n description,\n sectionTypeDescription: description,\n },\n };\n });\n })\n .show();\n return result?.success && result.value ? result.value : null;\n }\n\n private buildSectionFormDefinition(): AXPDynamicFormDefinition {\n const group: AXPDynamicFormGroupDefinition = {\n name: 'section',\n title: '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.title',\n parameters: [\n {\n path: 'sectionTypeId',\n title: '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.section-type.title',\n widget: {\n path: 'sectionTypeId',\n type: AXPWidgetsCatalog.lookup,\n options: {\n entity: `${RootConfig.module.name}.${RootConfig.entities.sectionType.name}`,\n ...WORKPLACE_SAFETY_SECTION_TYPE_LOOKUP_WIDGET_OPTIONS,\n },\n },\n },\n {\n path: 'sectionTypeDescription',\n title:\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.description.title',\n widget: {\n path: 'sectionTypeDescription',\n type: AXPWidgetsCatalog.largeText,\n options: {\n readonly: true,\n rows: 2,\n },\n },\n },\n ],\n };\n return { groups: [group] };\n }\n //#endregion\n //#region ----- Item prompts -----\n private async promptAddItems(sectionId: string, value: AXPBuilderValue): Promise<AXPBuilderItem[] | null> {\n const section = value.sections.find((s) => s.id === sectionId);\n if (!section || !this.sectionContextFromBuilderSection(section)) {\n return null;\n }\n const sectionContext = this.sectionContextFromBuilderSection(section)!;\n if (isActivitySectionType(sectionContext.sectionTypeId, sectionContext.sectionType)) {\n const picked = await this.promptActivityPicker();\n if (!picked) {\n return null;\n }\n // Section stays named after the section type (\"Activity\"); item carries the catalog title.\n const sectionTypeTitle =\n String(sectionContext.sectionType?.title ?? '').trim() ||\n (await this.translationService.translateAsync(\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.activity.title',\n )) ||\n 'Activity';\n this.patchSectionTitle(sectionId, sectionTypeTitle);\n const currentSection = this.builderValue().sections.find((entry) => entry.id === sectionId) ?? section;\n const itemCount =\n this.builderValue().sections.find((entry) => entry.id === sectionId)?.items.length ??\n currentSection.items.length;\n const activityTitle = String(picked.title ?? '').trim() || 'Activity';\n return [\n this.toBuilderItemFromActivityRow(\n {\n title: activityTitle,\n code: picked.code,\n description: picked.description,\n sections: picked.sections,\n },\n itemCount,\n picked.id,\n ),\n ];\n }\n const existingIds = this.collectEntityIdsFromBuilderItems(section.items);\n const dialogValue = await this.openItemDataSelector('create', undefined, sectionId, value, section, true);\n if (!dialogValue) return null;\n const selected = this.expandDialogSelectionToLinkedEntities(dialogValue).filter(\n (entry) => !existingIds.has(entry.id),\n );\n if (!selected.length) {\n return null;\n }\n const startOrder = section.items.length;\n return selected.map((entry, index) =>\n this.toBuilderItemFromEntity(sectionId, entry, startOrder + index),\n );\n }\n private async promptEditItem(\n item: AXPBuilderItem,\n sectionId: string,\n value: AXPBuilderValue,\n ): Promise<AXPBuilderItem | null> {\n const section = value.sections.find((s) => s.id === sectionId);\n if (!section || !this.sectionContextFromBuilderSection(section)) {\n return null;\n }\n const sectionContext = this.sectionContextFromBuilderSection(section)!;\n if (isActivitySectionType(sectionContext.sectionTypeId, sectionContext.sectionType)) {\n const activityId = String(item.id ?? item['entityId'] ?? '').trim();\n if (!activityId) {\n return null;\n }\n const edited = await this.openSafetyPlanActivityEditor(activityId);\n if (!edited) {\n return null;\n }\n const activityTitle = String(edited.title ?? '').trim() || 'Activity';\n return this.toBuilderItemFromActivityRow(\n {\n title: activityTitle,\n code: edited.code,\n description: edited.description,\n sections: edited.sections,\n },\n item.order ?? 0,\n edited.id,\n );\n }\n if (!this.allowEditItem()) {\n return null;\n }\n const currentEntityId = this.resolveBuilderItemEntityId(item);\n const seed: SafetyPlanSectionItemDialogValue | undefined = currentEntityId\n ? {\n itemIds: [currentEntityId],\n items: Array.isArray(item['items'])\n ? (item['items'] as AXMSafetyPlanSectionBuilderItemValue['items'])\n : [],\n }\n : undefined;\n const dialogValue = await this.openItemDataSelector('edit', seed, sectionId, value, section, false);\n if (!dialogValue) return null;\n const selected = this.expandDialogSelectionToLinkedEntities(dialogValue);\n if (!selected.length) {\n return null;\n }\n const otherIds = this.collectEntityIdsFromBuilderItems(\n section.items.filter((row) => String(row.id) !== String(item.id)),\n );\n const replacement = selected.find((entry) => !otherIds.has(entry.id)) ?? selected[0];\n return this.toBuilderItemFromEntity(sectionId, replacement, item.order ?? 0);\n }\n private async toastActivityRequired(): Promise<void> {\n this.toastService.show({\n color: 'warning',\n title: await this.translationService.translateAsync('@general:messages.generic.error.title'),\n content: await this.translationService.translateAsync(\n '@workplacesafety-management:safety-plan-sections.messages.activity-required.message',\n ),\n });\n }\n /** Prompts for Activity catalog selection (used by Activity section add/edit). */\n private async promptActivityPicker(): Promise<{\n id: string;\n title?: string;\n code?: string;\n description?: string;\n sections: NonNullable<AXMSafetyPlanActivityRowBuilderPayload['sections']>;\n } | null> {\n const title =\n (await this.translationService.translateAsync(\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.activity.title',\n )) || 'Activity';\n const activityEntity = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanActivity.name}`;\n const result = await this.layoutBuilder\n .create()\n .dialog<{\n success: boolean;\n value?: { safetyPlanActivityId: string; safetyPlanActivity?: { id: string; title?: string; code?: string } };\n }>((dialog) => {\n dialog\n .setTitle(title)\n .setSize('md')\n .setCloseButton(true)\n .setContext({ safetyPlanActivityId: '' })\n .content((layout) => {\n layout.mode('edit');\n layout.dynamicForm({\n groups: [\n {\n name: 'activity',\n title:\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.activity.title',\n parameters: [\n {\n path: 'safetyPlanActivityId',\n title:\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.activity.title',\n widget: {\n path: 'safetyPlanActivityId',\n type: AXPWidgetsCatalog.lookup,\n options: {\n entity: activityEntity,\n look: 'select',\n textField: 'title',\n valueField: 'id',\n columns: ['code', 'title'],\n allowCreate: 'quick',\n expose: [\n { source: 'id', target: 'safetyPlanActivity.id' },\n { source: 'title', target: 'safetyPlanActivity.title' },\n { source: 'code', target: 'safetyPlanActivity.code' },\n ],\n },\n },\n },\n ],\n },\n ],\n });\n })\n .setActions((actions) => {\n actions.cancel('@general:actions.cancel.title').submit('@general:actions.save.title');\n })\n .onAction(async (dialogRef) => {\n if (dialogRef.action() === 'cancel') {\n return { success: false };\n }\n const context = dialogRef.context() as {\n safetyPlanActivityId?: string;\n safetyPlanActivity?: { id: string; title?: string; code?: string };\n };\n const safetyPlanActivityId = String(context.safetyPlanActivityId ?? '').trim();\n if (!safetyPlanActivityId) {\n return { success: false };\n }\n return {\n success: true,\n kind: 'object',\n value: {\n safetyPlanActivityId,\n safetyPlanActivity: context.safetyPlanActivity,\n },\n };\n });\n })\n .show();\n if (!result?.success || !result.value?.safetyPlanActivityId) {\n return null;\n }\n const loaded = await this.loadSafetyPlanActivity(result.value.safetyPlanActivityId);\n if (!loaded) {\n await this.toastActivityRequired();\n return null;\n }\n return loaded;\n }\n private patchSectionTitle(sectionId: string, title: string): void {\n const trimmed = title.trim();\n if (!trimmed) {\n return;\n }\n this.pendingSectionTitles.set(sectionId, trimmed);\n }\n private sectionContextFromBuilderSection(section: AXPBuilderSection): SectionBuilderContext | null {\n const sectionTypeId = String(section['sectionTypeId'] ?? '').trim();\n if (!sectionTypeId) {\n return null;\n }\n return {\n sectionTypeId,\n sectionType: enrichSectionTypeSnapshot(\n sectionTypeId,\n section['sectionType'] as AXMSectionTypeSnapshot | undefined,\n ),\n safetyPlanActivityId:\n typeof section['safetyPlanActivityId'] === 'string' ? section['safetyPlanActivityId'].trim() : undefined,\n safetyPlanActivity: section['safetyPlanActivity'] as SectionBuilderContext['safetyPlanActivity'],\n };\n }\n //#endregion\n //#region ----- Catalog item selector -----\n private resolveSectionIndex(sectionId: string, builderValue: AXPBuilderValue): number {\n const orderedSections = [...builderValue.sections].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));\n return orderedSections.findIndex((section) => section.id === sectionId);\n }\n private async loadHazardRiskRecords(hazardRiskIds: string[]): Promise<Record<string, unknown>[]> {\n if (!hazardRiskIds.length) {\n return [];\n }\n const entityKey = `${RootConfig.module.name}.${RootConfig.entities.hazardRisk.name}`;\n const accessor = this.entityService.withEntity(entityKey);\n const results = await Promise.all(\n hazardRiskIds.map((id) => accessor.data().byKey(id).catch(() => null)),\n );\n return results\n .filter((record): record is NonNullable<(typeof results)[number]> => record != null)\n .map((record) => record as unknown as Record<string, unknown>);\n }\n private async resolveItemFilterForSection(\n sectionTypeId: string,\n sectionId: string,\n builderValue: AXPBuilderValue,\n ): Promise<Record<string, unknown> | null> {\n const orderedSections = [...builderValue.sections].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));\n const sectionIndex = this.resolveSectionIndex(sectionId, builderValue);\n if (sectionIndex < 0) {\n return null;\n }\n const sections = this.fromBuilderValue({ sections: orderedSections }).sections;\n return resolveSafetyPlanSectionItemFilterAsync(\n sectionTypeId,\n sections,\n sectionIndex,\n (ids) => this.loadHazardRiskRecords(ids),\n );\n }\n private async openItemDataSelector(\n mode: 'create' | 'edit',\n seed: SafetyPlanSectionItemDialogValue | undefined,\n sectionId: string,\n builderValue: AXPBuilderValue,\n section: AXPBuilderSection,\n allowMultiple: boolean,\n ): Promise<SafetyPlanSectionItemDialogValue | null> {\n const sectionContext = this.sectionContextFromBuilderSection(section);\n if (!sectionContext) {\n return null;\n }\n const entityKey = resolveSafetyPlanSectionItemEntityKey(\n sectionContext.sectionTypeId,\n sectionContext.sectionType,\n );\n if (!entityKey) {\n return null;\n }\n const dotIndex = entityKey.indexOf('.');\n if (dotIndex <= 0) {\n return null;\n }\n const entity = await this.entityRegistry.resolve(\n entityKey.substring(0, dotIndex),\n entityKey.substring(dotIndex + 1),\n );\n if (!entity) {\n return null;\n }\n const filter = await this.resolveItemFilterForSection(\n sectionContext.sectionTypeId,\n sectionId,\n builderValue,\n );\n const columns = resolveSafetyPlanSectionItemColumns(sectionContext.sectionTypeId);\n const selectedItemIds = (seed?.itemIds ?? []).filter((id): id is string => typeof id === 'string' && id.length > 0);\n const titleKey =\n mode === 'create'\n ? '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.actions.add-item.title'\n : '@general:actions.edit.title';\n const title = (await this.translationService.translateAsync(titleKey)) || (mode === 'create' ? 'Add Item' : 'Edit');\n const result = await this.entityDataSelector.open({\n entity,\n title,\n allowMultiple,\n selectedItemIds: selectedItemIds.length > 0 ? selectedItemIds : undefined,\n columns,\n filters: filter ?? undefined,\n allowCreate: 'none',\n showCategoryFilter: false,\n });\n if (!result) {\n return null;\n }\n if (!result.items?.length) {\n return mode === 'edit' ? { itemIds: [], items: [] } : null;\n }\n const items = mapSafetyPlanSectionSelectedItems(sectionContext.sectionTypeId, result.items);\n return dedupeSafetyPlanSectionItemSelection({\n id: `${sectionId}__item_1`,\n itemIds: items.map((item) => item.id),\n items,\n });\n }\n //#endregion\n //#region ----- Builder value mapping -----\n private mapItemToView(item: AXPBuilderItem): AXPBuilderItemViewModel {\n const activityRow = item['activityRow'] as AXMSafetyPlanActivityRowBuilderPayload | undefined;\n if (activityRow) {\n const code = String(activityRow.code ?? '').trim();\n const description = String(activityRow.description ?? item['description'] ?? '').trim();\n return {\n icon: 'fa-light fa-list-check',\n title: String(activityRow.title ?? item['title'] ?? '').trim() || 'Row',\n name: description || code || undefined,\n badges: [],\n };\n }\n const snapshot = Array.isArray(item['items'])\n ? (item['items'] as { title?: string; code?: string }[])[0]\n : undefined;\n const title =\n asSafetyPlanDisplayText(item['title']) || asSafetyPlanDisplayText(snapshot?.title);\n const code = asSafetyPlanDisplayText(item['name']) || asSafetyPlanDisplayText(snapshot?.code);\n return {\n icon: 'fa-light fa-list-check',\n title,\n name: code || undefined,\n badges: [],\n };\n }\n private toBuilderValue(value: AXMSafetyPlanSectionBuilderValue): AXPBuilderValue {\n return {\n sections: value.sections.map((section, sectionIndex) => ({\n id: section.id,\n order: sectionIndex,\n name: section.id,\n sectionTypeId: section.sectionTypeId,\n sectionType: enrichSectionTypeSnapshot(section.sectionTypeId, section.sectionType),\n title: section.title,\n description: section.description ?? '',\n code: section.code,\n safetyPlanId: section.safetyPlanId ?? this.safetyPlanId() ?? '',\n sourceSafetyPlanTypeSectionId: section.sourceSafetyPlanTypeSectionId,\n sortOrder: section.sortOrder ?? sectionIndex + 1,\n required: section.required === true,\n safetyPlanActivityId: section.safetyPlanActivityId,\n safetyPlanActivity: section.safetyPlanActivity,\n widgetOptions: section.widgetOptions,\n items: this.expandSectionItemsToBuilderRows(section.id, section.items, section),\n })),\n } as AXPBuilderValue;\n }\n private fromBuilderValue(value: AXPBuilderValue): AXMSafetyPlanSectionBuilderValue {\n return normalizeSafetyPlanSectionBuilderValue({\n sections: value.sections.map((section, sectionIndex) => ({\n id: section.id,\n sectionTypeId: String(section['sectionTypeId'] ?? ''),\n sectionType: enrichSectionTypeSnapshot(\n String(section['sectionTypeId'] ?? ''),\n section['sectionType'] as AXMSectionTypeSnapshot | undefined,\n ),\n title: String(section['title'] ?? ''),\n description: String(section['description'] ?? ''),\n code: typeof section['code'] === 'string' ? section['code'] : undefined,\n safetyPlanId: String(section['safetyPlanId'] ?? this.safetyPlanId() ?? ''),\n sourceSafetyPlanTypeSectionId:\n typeof section['sourceSafetyPlanTypeSectionId'] === 'string'\n ? section['sourceSafetyPlanTypeSectionId']\n : undefined,\n sortOrder:\n typeof section['sortOrder'] === 'number' ? section['sortOrder'] : sectionIndex + 1,\n required: section['required'] === true,\n safetyPlanActivityId:\n typeof section['safetyPlanActivityId'] === 'string' ? section['safetyPlanActivityId'] : undefined,\n safetyPlanActivity:\n section['safetyPlanActivity'] as AXMSafetyPlanSectionBuilderValue['sections'][number]['safetyPlanActivity'],\n widgetOptions:\n section['widgetOptions'] && typeof section['widgetOptions'] === 'object' && !Array.isArray(section['widgetOptions'])\n ? { ...(section['widgetOptions'] as Record<string, unknown>) }\n : undefined,\n items: this.collapseBuilderRowsToStorageItems(section.id, section.items, section),\n })),\n });\n }\n private expandSectionItemsToBuilderRows(\n sectionId: string,\n items: AXMSafetyPlanSectionBuilderItemValue[],\n section: {\n sectionTypeId?: string;\n sectionType?: AXMSectionTypeSnapshot;\n },\n ): AXPBuilderItem[] {\n if (\n isActivitySectionType(section.sectionTypeId, section.sectionType) ||\n items.some((item) => item.activityRow)\n ) {\n return items\n .filter((item) => item.activityRow)\n .map((item, order) =>\n this.toBuilderItemFromActivityRow(\n {\n ...item.activityRow!,\n title: item.activityRow!.title || item.items?.[0]?.title || 'Row',\n },\n order,\n item.id,\n ),\n );\n }\n const linked = this.flattenLinkedEntities(items);\n return linked.map((entry, order) => this.toBuilderItemFromEntity(sectionId, entry, order));\n }\n private collapseBuilderRowsToStorageItems(\n sectionId: string,\n items: AXPBuilderItem[],\n section: AXPBuilderSection,\n ): AXMSafetyPlanSectionBuilderItemValue[] {\n const ordered = [...items].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));\n const sectionTypeId = String(section['sectionTypeId'] ?? '');\n const sectionType = section['sectionType'] as AXMSectionTypeSnapshot | undefined;\n if (isActivitySectionType(sectionTypeId, sectionType) || ordered.some((item) => item['activityRow'])) {\n const stepItems: AXMSafetyPlanSectionBuilderItemValue[] = [];\n ordered.forEach((item, index) => {\n const activityRow = item['activityRow'] as AXMSafetyPlanActivityRowBuilderPayload | undefined;\n if (!activityRow) {\n return;\n }\n const stepId =\n typeof item.id === 'string' && item.id && !String(item.id).includes('__entity_')\n ? String(item.id)\n : AXPDataGenerator.uuid();\n const title = activityRow.title?.trim() || 'Row';\n stepItems.push({\n id: stepId,\n itemIds: [stepId],\n items: [{ id: stepId, title, code: activityRow.code }],\n activityRow: {\n ...activityRow,\n title,\n sortOrder: index + 1,\n },\n });\n });\n return stepItems;\n }\n const itemIds: string[] = [];\n const snapshots: NonNullable<AXMSafetyPlanSectionBuilderItemValue['items']> = [];\n for (const item of ordered) {\n const entityId = this.resolveBuilderItemEntityId(item);\n if (!entityId || itemIds.includes(entityId)) {\n continue;\n }\n itemIds.push(entityId);\n const snapshot = Array.isArray(item['items'])\n ? (item['items'] as NonNullable<AXMSafetyPlanSectionBuilderItemValue['items']>)[0]\n : undefined;\n snapshots.push({\n id: entityId,\n title:\n asSafetyPlanDisplayText(snapshot?.title) ||\n asSafetyPlanDisplayText(item['title']) ||\n undefined,\n code:\n asSafetyPlanDisplayText(snapshot?.code) ||\n asSafetyPlanDisplayText(item['name']) ||\n undefined,\n });\n }\n if (!itemIds.length) {\n return [];\n }\n return [\n dedupeSafetyPlanSectionItemSelection({\n id: `${sectionId}__item_1`,\n itemIds,\n items: snapshots,\n }),\n ];\n }\n private flattenLinkedEntities(\n items: AXMSafetyPlanSectionBuilderItemValue[],\n ): Array<{ id: string; title?: string; code?: string }> {\n const linked: Array<{ id: string; title?: string; code?: string }> = [];\n const seen = new Set<string>();\n for (const slot of items) {\n const ids = Array.isArray(slot.itemIds) ? slot.itemIds : [];\n const snapshots = Array.isArray(slot.items) ? slot.items : [];\n for (let index = 0; index < ids.length; index += 1) {\n const id = String(ids[index] ?? '').trim();\n if (!id || seen.has(id)) {\n continue;\n }\n seen.add(id);\n const snapshot = snapshots.find((entry) => entry?.id === id) ?? snapshots[index];\n linked.push({\n id,\n title: asSafetyPlanDisplayText(snapshot?.title) || undefined,\n code: asSafetyPlanDisplayText(snapshot?.code) || undefined,\n });\n }\n }\n return linked;\n }\n private expandDialogSelectionToLinkedEntities(\n dialogValue: SafetyPlanSectionItemDialogValue,\n ): Array<{ id: string; title?: string; code?: string }> {\n return this.flattenLinkedEntities([\n {\n id: 'dialog',\n itemIds: [...(dialogValue.itemIds ?? [])],\n items: dialogValue.items ? [...dialogValue.items] : [],\n },\n ]);\n }\n private collectEntityIdsFromBuilderItems(items: AXPBuilderItem[]): Set<string> {\n const ids = new Set<string>();\n for (const item of items) {\n const entityId = this.resolveBuilderItemEntityId(item);\n if (entityId) {\n ids.add(entityId);\n }\n }\n return ids;\n }\n private resolveBuilderItemEntityId(item: AXPBuilderItem): string | null {\n if (typeof item['entityId'] === 'string' && item['entityId'].trim()) {\n return item['entityId'].trim();\n }\n if (Array.isArray(item['itemIds']) && typeof item['itemIds'][0] === 'string' && item['itemIds'][0].trim()) {\n return item['itemIds'][0].trim();\n }\n const snapshot = Array.isArray(item['items'])\n ? (item['items'] as { id?: string }[])[0]\n : undefined;\n if (typeof snapshot?.id === 'string' && snapshot.id.trim()) {\n return snapshot.id.trim();\n }\n return null;\n }\n private toBuilderItemFromEntity(\n sectionId: string,\n entry: { id: string; title?: string; code?: string },\n order: number,\n ): AXPBuilderItem {\n const title = asSafetyPlanDisplayText(entry.title);\n const code = asSafetyPlanDisplayText(entry.code);\n return {\n id: `${sectionId}__entity_${entry.id}`,\n order,\n entityId: entry.id,\n itemIds: [entry.id],\n items: [{ id: entry.id, title: title || undefined, code: code || undefined }],\n title,\n name: code,\n };\n }\n private toBuilderItemFromActivityRow(\n row: AXMSafetyPlanActivityRowBuilderPayload,\n order: number,\n id?: string,\n ): AXPBuilderItem {\n const stepId =\n typeof id === 'string' && id.trim() && !id.includes('__item_') && !id.includes('__entity_')\n ? id.trim()\n : AXPDataGenerator.uuid();\n const title = String(row.title ?? '').trim() || 'Row';\n const code = String(row.code ?? '').trim();\n const description = String(row.description ?? '').trim();\n return {\n id: stepId,\n order,\n entityId: stepId,\n itemIds: [stepId],\n items: [{ id: stepId, title, code: code || undefined }],\n title,\n name: code,\n description: description || undefined,\n activityRow: {\n ...row,\n title,\n description: description || undefined,\n sortOrder: order + 1,\n },\n };\n }\n /** Opens the SafetyPlanActivity update form so predefined sections (items) can be viewed/edited. */\n private async openSafetyPlanActivityEditor(activityId: string): Promise<{\n id: string;\n title?: string;\n code?: string;\n description?: string;\n sections: AXMSafetyPlanActivityRowBuilderPayload['sections'];\n } | null> {\n const activityEntity = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanActivity.name}`;\n const result = await this.commandService.execute('Entity:Edit', {\n entity: activityEntity,\n data: activityId,\n dialogSize: 'lg',\n });\n if (!result?.success) {\n return null;\n }\n return this.loadSafetyPlanActivity(activityId);\n }\n\n private async loadSafetyPlanActivity(activityId: string): Promise<{\n id: string;\n title?: string;\n code?: string;\n description?: string;\n sections: NonNullable<AXMSafetyPlanActivityRowBuilderPayload['sections']>;\n } | null> {\n try {\n const entityKey = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanActivity.name}`;\n const row = await this.entityService.withEntity(entityKey).data().byKey(activityId);\n if (!row) {\n return null;\n }\n const record = row as {\n id?: string;\n title?: string;\n code?: string;\n description?: string;\n items?: AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel[];\n };\n return {\n id: String(record.id ?? activityId),\n title: record.title,\n code: record.code,\n description: typeof record.description === 'string' ? record.description : undefined,\n sections: mapSafetyPlanActivityItemsToSectionSnapshots(record.items),\n };\n } catch {\n return null;\n }\n }\n //#endregion\n}\n//#endregion\n","<div class=\"axm-safety-plan-section-builder\">\n @if (!readonly() && !hideHeaderActions() && allowAddSection()) {\n <div class=\"__header\">\n <div class=\"__header-left\"></div>\n <div class=\"__header-right\">\n <ax-button\n class=\"ax-sm\"\n [text]=\"\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.actions.add-section.title'\n | translate\n | async\n \"\n [color]=\"'primary'\"\n (onClick)=\"addSection()\"\n >\n <ax-prefix>\n <ax-icon icon=\"fa-light fa-layer-group\"></ax-icon>\n </ax-prefix>\n </ax-button>\n </div>\n </div>\n }\n\n <axp-standard-section-items-builder\n class=\"block min-h-[200px]\"\n [value]=\"builderValue()\"\n [config]=\"standardConfig()\"\n [readonly]=\"readonly()\"\n (valueChange)=\"onBuilderValueChange($event)\"\n />\n</div>\n","//#region ---- Imports ----\n\nimport { AXPDataGenerator, AXPContextStore } from '@acorex-platform/framework-client/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport { AXPPageLayoutBase, AXPPageLayoutBaseComponent } from '@acorex-platform/framework-client/layout/views';\nimport type { AXPLayoutDetailsViewAction } from '@acorex-platform/framework-client/layout/views';\nimport type {\n AXMSafetyPlanSectionBuilderValue,\n AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel,\n} from '@acorex-platform/module-workplacesafety-management-client/contracts';\nimport {\n RootConfig,\n buildSectionStructureFromTypeSections,\n collectBuiltInRepeatableSectionTypeIds,\n dedupeSafetyPlanSectionStructure,\n pickSafetyPlanTypeSectionsForStructure,\n resolveEntityRefId,\n resolveSectionItemEntityName,\n isActivitySectionType,\n toBuilderValueFromStructure,\n asSafetyPlanDisplayText,\n} from '@acorex-platform/module-workplacesafety-management-client/contracts';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport { cloneDeep, isEqual } from 'lodash';\nimport { AXSkeletonModule } from '@acorex/components/skeleton';\nimport { AXMSafetyPlanSectionBuilderComponent } from './safety-plan-section-builder.component';\nimport {\n normalizeSafetyPlanSectionBuilderValue,\n safetyPlanSectionsToBuilderValue,\n} from './safety-plan-section-builder.types';\nimport { SAFETY_PLAN_SECTIONS_SAVE_COMMAND } from './save-safety-plan-sections.command';\nimport { AXMSafetyPlanPreviewService } from '../safety-plan-preview/safety-plan-preview.service';\nimport { hydrateSafetyPlanActivitySectionsForPreview } from '../safety-plan-preview/hydrate-safety-plan-activity-sections';\nimport { AXTranslationModule } from '@acorex/core/translation';\nimport { AsyncPipe } from '@angular/common';\nimport { AXPSystemStatusType } from '@acorex-platform/framework-shared/core';\nimport { resolveEntityRowDisplayText } from '@acorex-platform/framework-client/common';\n\n//#endregion\n\n//#region ---- Constants ----\n\nconst SAFETY_PLAN_SECTIONS_ADD_SECTION_COMMAND = 'SafetyPlan:Sections:AddSection';\nconst SAFETY_PLAN_SECTIONS_PREVIEW_COMMAND = 'SafetyPlan:Sections:Preview';\nconst SAFETY_PLAN_SECTIONS_DISCARD_COMMAND = 'SafetyPlan:Sections:Discard';\n\nconst SAFETY_PLAN_SECTION_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanSection.name}`;\nconst SAFETY_PLAN_TYPE_SECTION_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanTypeSection.name}`;\nconst SECTION_TYPE_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.sectionType.name}`;\n\n//#endregion\n\n//#region ---- Component ----\n\n@Component({\n selector: 'axm-safety-plan-sections-page',\n standalone: true,\n imports: [AXMSafetyPlanSectionBuilderComponent, AXTranslationModule, AsyncPipe, AXSkeletonModule],\n template: `\n @if (safetyPlanId() || hasStructure()) {\n <div class=\"relative block w-full min-h-0\">\n <!-- ----- Skeleton overlay while structure loads (builder stays mounted) ----- -->\n @if (showStructureLoading()) {\n <div class=\"flex flex-col gap-3 p-4 absolute inset-0 z-10 bg-white/80 dark:bg-black/40\">\n <ax-skeleton [animated]=\"true\" class=\"h-5 w-2/5 rounded-md\"></ax-skeleton>\n <ax-skeleton [animated]=\"true\" class=\"h-24 w-full rounded-md\"></ax-skeleton>\n <ax-skeleton [animated]=\"true\" class=\"h-24 w-full rounded-md\"></ax-skeleton>\n <ax-skeleton [animated]=\"true\" class=\"h-4 w-3/5 rounded-md\"></ax-skeleton>\n </div>\n }\n <!-- ----- Sections builder — mounted once structure is known (or editing an existing plan) ----- -->\n <axm-safety-plan-section-builder\n #builderRef\n [value]=\"committedValue()\"\n [safetyPlanId]=\"safetyPlanId() ?? undefined\"\n [options]=\"builderOptions()\"\n (valueChange)=\"onValueChange($event)\"\n />\n </div>\n }\n <!-- ----- Prompt to select plan type + structure before sections can load ----- -->\n @else {\n <p class=\"text-muted p-4\">\n {{\n '@workplacesafety-management:safety-plans.entities.safety-plan.pages.sections.select-plan-type-first'\n | translate\n | async\n }}\n </p>\n }\n `,\n host: {\n class: 'block w-full min-h-0',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: AXPPageLayoutBase,\n useExisting: AXMSafetyPlanSectionsPageComponent,\n },\n ],\n})\nexport class AXMSafetyPlanSectionsPageComponent extends AXPPageLayoutBaseComponent {\n /** Default `{}`: avoid NG0950 before page-component-renderer calls setInput. */\n rootContext = input<Record<string, unknown>>({});\n pageConfig = input<Record<string, unknown>>();\n options = input<Record<string, unknown>>({});\n\n protected readonly builderRef = viewChild<AXMSafetyPlanSectionBuilderComponent>('builderRef');\n\n private readonly commandService = inject(AXPCommandService);\n private readonly entityService = inject(AXPEntityService);\n private readonly contextStore = inject(AXPContextStore);\n private readonly hostPageLayout = inject(AXPPageLayoutBase, { optional: true, skipSelf: true });\n private readonly previewService = inject(AXMSafetyPlanPreviewService);\n\n private readonly baselineValue = signal<AXMSafetyPlanSectionBuilderValue | null>(null);\n protected readonly committedValue = signal<AXMSafetyPlanSectionBuilderValue | null>(null);\n protected readonly isLoadingStructure = signal(false);\n /** Prevents re-entrant sync loops when applyStructure mutates shared form context. */\n private readonly lastSyncedKey = signal<string | null>(null);\n /** In-flight sync key — blocks concurrent loads for the same pair without blocking retries after cancel. */\n private readonly inflightSyncKey = signal<string | null>(null);\n private readonly appliedPlanTypeId = signal<string | null>(null);\n private readonly appliedStructureId = signal<string | null>(null);\n /**\n * Bumped only when the user changes structure after a successful sync (see `#detectStructureUserChange`).\n * Keeps `#syncFromContext` from tracking context `structureId` during unrelated context churn.\n */\n private readonly structureReloadToken = signal(0);\n /**\n * Stable builder options — same pattern as questionnaire `prePostConfigStable`\n * (new object every CD caused builder config thrash / flicker).\n */\n private readonly builderOptionsStable = signal<Record<string, unknown>>({\n hideHeaderActions: true,\n readonly: false,\n allowAddSection: true,\n allowAddItems: true,\n allowReorderSections: true,\n allowEditSection: false,\n allowEditItem: false,\n });\n\n protected readonly safetyPlanId = computed((): string | null => {\n const raw = this.rootContext()?.['id'];\n return typeof raw === 'string' && raw.length > 0 ? raw : null;\n });\n\n protected readonly planTypeId = computed((): string | null => {\n const ctx = this.rootContext() ?? {};\n return (\n resolveEntityRefId(ctx['safetyPlanTypeId']) ??\n resolveEntityRefId((ctx['safetyPlanType'] as { id?: unknown } | undefined)?.id) ??\n resolveEntityRefId(ctx['safetyPlanType'])\n );\n });\n\n protected readonly structureId = computed((): string | null => {\n const ctx = this.rootContext() ?? {};\n return (\n resolveEntityRefId(ctx['structureId']) ??\n resolveEntityRefId((ctx['structure'] as { id?: unknown } | undefined)?.id) ??\n resolveEntityRefId(ctx['structure'])\n );\n });\n\n protected readonly hasStructure = computed(() => !!this.structureId());\n\n /**\n * Covers the first paint before `#syncFromContext` sets `isLoadingStructure`, and the full sync span.\n * Avoids flashing an empty builder after create-and-continue.\n */\n protected readonly showStructureLoading = computed((): boolean => {\n if (this.isLoadingStructure()) {\n return true;\n }\n if (!(this.safetyPlanId() || this.hasStructure())) {\n return false;\n }\n return this.lastSyncedKey() == null && this.committedValue() == null;\n });\n\n protected readonly isDraftPlan = computed((): boolean => {\n const status = this.rootContext()?.['status'];\n return !status || status === AXPSystemStatusType.Draft;\n });\n\n /** Stable reference for the builder — updated only when option values change. */\n protected readonly builderOptions = computed(() => this.builderOptionsStable());\n\n protected readonly isDirty = computed(() => {\n return !isEqual(this.baselineValue() ?? { sections: [] }, this.committedValue() ?? { sections: [] });\n });\n\n /** Keep builder options stable across rootContext snapshot churn (questionnaire pattern). */\n #stabilizeBuilderOptions = effect(() => {\n const draft = this.isDraftPlan();\n const next: Record<string, unknown> = {\n hideHeaderActions: true,\n readonly: !draft,\n allowAddSection: draft,\n allowAddItems: draft,\n allowReorderSections: draft,\n allowEditSection: false,\n allowEditItem: false,\n };\n const current = untracked(() => this.builderOptionsStable());\n if (!isEqual(current, next)) {\n this.builderOptionsStable.set(next);\n }\n });\n\n /**\n * Plan type changed on the form — clear structure and wait for a manual structure pick.\n * Does not rebuild sections; structure selection drives the next load.\n */\n #detectPlanTypeUserChange = effect(() => {\n const typeId = this.planTypeId();\n const applied = untracked(() => this.appliedPlanTypeId());\n if (!typeId || applied == null || typeId === applied) {\n return;\n }\n\n this.appliedPlanTypeId.set(typeId);\n this.appliedStructureId.set(null);\n this.lastSyncedKey.set(null);\n this.inflightSyncKey.set(null);\n this.updateRootContextField('structureId', null);\n this.updateRootContextField('structure', null);\n });\n\n /**\n * User changed structure after a successful sync — bump token so `#syncFromContext` reloads.\n */\n #detectStructureUserChange = effect(() => {\n const contextStructureId = this.structureId();\n const applied = untracked(() => this.appliedStructureId());\n if (!contextStructureId || applied == null) {\n return;\n }\n if (contextStructureId === applied) {\n return;\n }\n if (untracked(() => this.lastSyncedKey()) == null) {\n return;\n }\n this.lastSyncedKey.set(null);\n this.structureReloadToken.update((n) => n + 1);\n });\n\n #syncFromContext = effect((onCleanup) => {\n this.structureReloadToken();\n const planId = this.safetyPlanId();\n const typeId = this.planTypeId();\n const structureId = this.structureId();\n const syncKey = this.buildSyncKey(planId, typeId, structureId);\n\n if (\n untracked(() => this.lastSyncedKey()) === syncKey ||\n untracked(() => this.inflightSyncKey()) === syncKey\n ) {\n return;\n }\n\n const inflight = untracked(() => this.inflightSyncKey());\n if (inflight && inflight.startsWith(`${planId ?? ''}|${typeId ?? ''}|`)) {\n return;\n }\n\n this.inflightSyncKey.set(syncKey);\n\n let cancelled = false;\n let activeSyncKey = syncKey;\n\n const clearInflight = (): void => {\n if (untracked(() => this.inflightSyncKey()) === activeSyncKey) {\n this.inflightSyncKey.set(null);\n }\n };\n\n const markSynced = (finalStructureId: string | null = structureId): void => {\n activeSyncKey = this.buildSyncKey(planId, typeId, finalStructureId);\n this.lastSyncedKey.set(activeSyncKey);\n this.inflightSyncKey.set(null);\n };\n\n const run = async (): Promise<void> => {\n if (cancelled) {\n return;\n }\n\n // Create (no plan yet): exit without SectionType query until structure defaults are needed.\n if (!planId) {\n if (!typeId) {\n this.appliedPlanTypeId.set(null);\n this.appliedStructureId.set(null);\n this.applyStructure({ sections: [] }, { asBaseline: true });\n markSynced(null);\n return;\n }\n\n // Plan type alone must not auto-pick a structure or rebuild sections.\n if (!structureId) {\n this.appliedPlanTypeId.set(typeId);\n this.appliedStructureId.set(null);\n markSynced(null);\n return;\n }\n\n this.isLoadingStructure.set(true);\n try {\n const repeatableSectionTypeIds = await this.loadRepeatableSectionTypeIds();\n if (cancelled) {\n return;\n }\n\n const defaults = await this.loadDefaultsForStructure(\n typeId,\n structureId,\n repeatableSectionTypeIds,\n );\n if (cancelled) return;\n this.applyStructure(defaults, { asBaseline: true });\n this.appliedPlanTypeId.set(typeId);\n this.appliedStructureId.set(structureId);\n markSynced(structureId);\n } catch {\n if (cancelled) return;\n clearInflight();\n await this.showStructureLoadError();\n } finally {\n if (!cancelled) {\n this.isLoadingStructure.set(false);\n }\n }\n return;\n }\n\n // Edit / create-and-continue: one continuous loading span through SectionType → sections → defaults.\n this.isLoadingStructure.set(true);\n try {\n const repeatableSectionTypeIds = await this.loadRepeatableSectionTypeIds();\n if (cancelled) {\n return;\n }\n\n // Load independent saved sections once — never append type defaults on top.\n const previousStructureId = untracked(() => this.appliedStructureId());\n const structureChanged =\n !!structureId && !!previousStructureId && previousStructureId !== structureId;\n\n if (structureChanged && this.isDraftPlan()) {\n const defaults = await this.loadDefaultsForStructure(\n typeId ?? '',\n structureId,\n repeatableSectionTypeIds,\n );\n if (cancelled) return;\n this.applyStructure(defaults, { asBaseline: true });\n this.appliedPlanTypeId.set(typeId);\n this.appliedStructureId.set(structureId);\n markSynced(structureId);\n return;\n }\n\n const loaded = await this.fetchSectionsFromBackend(planId, repeatableSectionTypeIds);\n if (cancelled) return;\n\n if (loaded.sections.length > 0) {\n this.applyStructure(loaded, { asBaseline: true });\n this.appliedPlanTypeId.set(typeId);\n this.appliedStructureId.set(structureId);\n markSynced(structureId);\n return;\n }\n\n if (!typeId) {\n this.appliedPlanTypeId.set(null);\n this.appliedStructureId.set(null);\n this.applyStructure({ sections: [] }, { asBaseline: true });\n markSynced(null);\n return;\n }\n\n // Plan type alone must not auto-pick a structure or rebuild sections.\n if (!structureId) {\n this.appliedPlanTypeId.set(typeId);\n this.appliedStructureId.set(null);\n markSynced(null);\n return;\n }\n\n const defaults = await this.loadDefaultsForStructure(\n typeId,\n structureId,\n repeatableSectionTypeIds,\n );\n if (cancelled) return;\n this.applyStructure(defaults, { asBaseline: true });\n this.appliedPlanTypeId.set(typeId);\n this.appliedStructureId.set(structureId);\n markSynced(structureId);\n } catch {\n if (cancelled) return;\n clearInflight();\n await this.showStructureLoadError();\n } finally {\n if (!cancelled) {\n this.isLoadingStructure.set(false);\n }\n }\n };\n\n void run();\n\n onCleanup(() => {\n cancelled = true;\n clearInflight();\n });\n });\n\n protected onValueChange(value: AXMSafetyPlanSectionBuilderValue): void {\n const withOrder = normalizeSafetyPlanSectionBuilderValue({\n sections: value.sections.map((section, index) => ({\n ...section,\n sortOrder: index + 1,\n })),\n });\n if (isEqual(untracked(() => this.committedValue()), withOrder)) {\n return;\n }\n this.committedValue.set(withOrder);\n this.persistContextField('sectionStructure', withOrder, 'user');\n this.persistContextField('sections', withOrder, 'user');\n this.recompute();\n }\n\n override getWizardStepContext(): Record<string, unknown> | null {\n const value = this.committedValue();\n if (!value) {\n return null;\n }\n const cloned = cloneDeep(value);\n return { sectionStructure: cloned, sections: cloned };\n }\n\n override hasUnsavedChanges(): boolean {\n return this.isDirty();\n }\n\n override async getPrimaryMenuItems(): Promise<AXPLayoutDetailsViewAction[]> {\n const actions: AXPLayoutDetailsViewAction[] = [];\n const loading = this.showStructureLoading();\n const canPreview =\n !loading &&\n (!!this.hasStructure() || !!this.safetyPlanId() || (this.committedValue()?.sections.length ?? 0) > 0);\n\n if (this.isDraftPlan() && !loading) {\n actions.push({\n title:\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.actions.add-section.title',\n icon: 'fa-light fa-layer-group',\n zone: 'header' as const,\n priority: 'primary' as const,\n color: 'primary' as const,\n command: { name: SAFETY_PLAN_SECTIONS_ADD_SECTION_COMMAND, options: {} },\n });\n }\n\n if (canPreview) {\n actions.push({\n title:\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.actions.preview.title',\n icon: 'fa-light fa-eye',\n zone: 'header' as const,\n priority: 'primary' as const,\n color: 'default' as const,\n command: { name: SAFETY_PLAN_SECTIONS_PREVIEW_COMMAND, options: {} },\n });\n }\n\n if (!this.isDraftPlan() || loading) {\n return actions;\n }\n\n if (this.safetyPlanId()) {\n actions.push(\n {\n title: '@general:actions.discard.title',\n icon: 'fa-light fa-rotate-left',\n zone: 'footer' as const,\n priority: 'secondary',\n color: 'default',\n visible: this.isDirty(),\n command: { name: SAFETY_PLAN_SECTIONS_DISCARD_COMMAND, options: {} },\n },\n {\n title: '@general:actions.save.title',\n icon: 'fa-light fa-floppy-disk',\n zone: 'footer' as const,\n priority: 'primary',\n color: 'primary',\n visible: this.isDirty(),\n command: { name: SAFETY_PLAN_SECTIONS_SAVE_COMMAND, options: {} },\n },\n );\n }\n\n return actions;\n }\n\n override async execute(command: { name: string; options?: unknown }): Promise<void> {\n if (command.name === SAFETY_PLAN_SECTIONS_ADD_SECTION_COMMAND) {\n await this.builderRef()?.addSection();\n return;\n }\n\n if (command.name === SAFETY_PLAN_SECTIONS_PREVIEW_COMMAND) {\n await this.handlePreview();\n return;\n }\n\n if (command.name === SAFETY_PLAN_SECTIONS_DISCARD_COMMAND) {\n this.handleDiscard();\n return;\n }\n\n if (command.name !== SAFETY_PLAN_SECTIONS_SAVE_COMMAND) return;\n\n await this.handleSave({ silent: false });\n }\n\n private async handlePreview(): Promise<void> {\n const previewLabel =\n (await this.translateService.translateAsync('@general:actions.preview.title')) || 'Preview';\n const locale = this.translateService.getActiveLang?.() ?? 'en-US';\n const planTitle = resolveEntityRowDisplayText(this.rootContext()?.['title'], locale);\n const title = planTitle ? `${previewLabel}: ${planTitle}` : previewLabel;\n const structure = await hydrateSafetyPlanActivitySectionsForPreview(\n this.entityService,\n this.translateService,\n cloneDeep(this.committedValue() ?? { sections: [] }),\n );\n await this.previewService.open({\n title,\n structure,\n });\n }\n\n private async handleSave(options?: { silent?: boolean }): Promise<void> {\n const silent = options?.silent === true;\n const id = this.safetyPlanId();\n const value = this.committedValue() ?? { sections: [] };\n\n if (!id) {\n if (!silent) {\n this.toastService.show({\n color: 'danger',\n title: await this.translateService.translateAsync('@general:messages.generic.error.title'),\n content: await this.translateService.translateAsync(\n '@workplacesafety-management:safety-plans.entities.safety-plan.pages.sections.save-plan-first',\n ),\n });\n }\n return;\n }\n\n const result = await this.commandService.execute(SAFETY_PLAN_SECTIONS_SAVE_COMMAND, { id, value });\n\n if (result?.success) {\n // Always reload from backend after save so UI never keeps a stale/appended local list.\n const repeatableSectionTypeIds = await this.loadRepeatableSectionTypeIds();\n const saved = await this.fetchSectionsFromBackend(id, repeatableSectionTypeIds);\n this.applyStructure(saved, { asBaseline: true });\n this.lastSyncedKey.set(this.buildSyncKey(id, this.planTypeId(), this.structureId()));\n this.inflightSyncKey.set(null);\n this.builderRef()?.syncAfterSave(saved);\n this.recompute();\n if (!silent) {\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 });\n }\n return;\n }\n\n this.toastService.show({\n color: 'danger',\n title: await this.translateService.translateAsync('@general:messages.generic.error.title'),\n content:\n typeof result?.message?.text === 'string' && result.message.text.startsWith('@')\n ? await this.translateService.translateAsync(result.message.text)\n : await this.translateService.translateAsync('@general:messages.entity.update-failed'),\n });\n }\n\n protected override recompute(): void {\n super.recompute();\n const layout = this.hostPageLayout as unknown as { recompute?: () => void } | null | undefined;\n layout?.recompute?.();\n }\n\n private handleDiscard(): void {\n const baseline = this.baselineValue() ?? { sections: [] };\n this.committedValue.set(baseline);\n this.updateRootContextField('sectionStructure', baseline);\n this.updateRootContextField('sections', baseline);\n this.builderRef()?.resetAfterDiscard();\n this.recompute();\n }\n\n private applyStructure(\n value: AXMSafetyPlanSectionBuilderValue,\n options: { asBaseline: boolean },\n ): void {\n const normalized = normalizeSafetyPlanSectionBuilderValue(value);\n if (options.asBaseline) {\n this.baselineValue.set(normalized);\n }\n if (!isEqual(untracked(() => this.committedValue()), normalized)) {\n this.committedValue.set(normalized);\n }\n // Mirror onto the current rootContext object only (no contextStore.update).\n // Store writes during load re-snapshot rootContext and remount/lazy-reload the page.\n this.mirrorRootContextField('sectionStructure', normalized);\n this.mirrorRootContextField('sections', normalized);\n }\n\n private buildSyncKey(\n planId: string | null,\n typeId: string | null,\n structureId: string | null,\n ): string {\n return `${planId ?? ''}|${typeId ?? ''}|${structureId ?? ''}`;\n }\n\n /** Mutate the current rootContext input object without notifying the context store. */\n private mirrorRootContextField(field: string, value: unknown): void {\n const ctx = this.rootContext() as Record<string, unknown> | undefined;\n if (!ctx || typeof ctx !== 'object') {\n return;\n }\n ctx[field] = cloneDeep(value);\n }\n\n /**\n * User edits / explicit plan-type changes: write through AXPContextStore (skips when equal)\n * and mirror onto the current rootContext input object.\n */\n private persistContextField(\n field: string,\n value: unknown,\n origin: 'user' | 'system',\n ): void {\n this.contextStore.update(field, cloneDeep(value), { origin });\n this.mirrorRootContextField(field, value);\n }\n\n private updateRootContextField(field: string, value: unknown): void {\n // Prefer store writes for explicit field updates (plan type / structure / discard).\n this.persistContextField(field, value, 'system');\n }\n private async fetchSectionsFromBackend(\n planId: string,\n repeatableSectionTypeIds: readonly string[] = [],\n ): Promise<AXMSafetyPlanSectionBuilderValue> {\n const result = await this.entityService.withEntity(SAFETY_PLAN_SECTION_ENTITY).data().query({\n skip: 0,\n take: 1000,\n filter: {\n logic: 'and',\n filters: [{ field: 'safetyPlanId', operator: { type: 'equal' }, value: planId }],\n },\n } as never);\n\n const rawLoaded = safetyPlanSectionsToBuilderValue(\n (result.items ?? []) as Parameters<typeof safetyPlanSectionsToBuilderValue>[0],\n );\n const deduped = dedupeSafetyPlanSectionStructure(rawLoaded, { repeatableSectionTypeIds });\n\n // Activity sections store SafetyPlanActivity rows on items; no column schema to hydrate.\n return this.hydrateCatalogItemSnapshots(deduped);\n }\n\n /**\n * Repeater lookups are not joined on query. Fill missing catalog item titles from\n * Hazard / HazardRisk / PPE / Control records so seeded item cards are not blank.\n */\n private async hydrateCatalogItemSnapshots(\n value: AXMSafetyPlanSectionBuilderValue,\n ): Promise<AXMSafetyPlanSectionBuilderValue> {\n const locale = this.translateService.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 const entityName = resolveSectionItemEntityName(section.sectionTypeId, section.sectionType);\n if (!entityName) {\n continue;\n }\n for (const slot of section.items) {\n for (const id of slot.itemIds ?? []) {\n const snapshot = slot.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 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 this.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((slot) => ({\n ...slot,\n items: (slot.itemIds ?? []).map((id, index) => {\n const existing = slot.items?.find((entry) => entry.id === id) ?? slot.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 private async loadRepeatableSectionTypeIds(): Promise<string[]> {\n const builtIn = collectBuiltInRepeatableSectionTypeIds();\n try {\n const result = await this.entityService.withEntity(SECTION_TYPE_ENTITY).data().query({\n skip: 0,\n take: 1000,\n } as never);\n const fromQuery = (result.items ?? [])\n .filter((row) => (row as { isRepeatable?: unknown }).isRepeatable === true)\n .map((row) => resolveEntityRefId((row as { id?: unknown }).id))\n .filter((id): id is string => !!id);\n return [...new Set([...fromQuery, ...builtIn])];\n } catch {\n return builtIn;\n }\n }\n\n private async queryTypeSectionsForPlanType(\n typeId: string,\n ): Promise<AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[]> {\n const result = await this.entityService.withEntity(SAFETY_PLAN_TYPE_SECTION_ENTITY).data().query({\n skip: 0,\n take: 1000,\n sort: [{ field: 'sortOrder', dir: 'asc' }],\n filter: {\n logic: 'and',\n filters: [\n { field: 'safetyPlanTypeId', operator: { type: 'equal' }, value: typeId },\n { field: 'isArchived', operator: { type: 'equal' }, value: false },\n ],\n },\n } as never);\n\n return ((result.items ?? []) as AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[]).filter(\n (row) => resolveEntityRefId(row.safetyPlanTypeId) === typeId,\n );\n }\n\n private async loadDefaultsForStructure(\n typeId: string,\n structureId: string | null,\n repeatableSectionTypeIds: readonly string[] = [],\n ): Promise<AXMSafetyPlanSectionBuilderValue> {\n if (!typeId) {\n return { sections: [] };\n }\n\n const typeSections = await this.queryTypeSectionsForPlanType(typeId);\n const sourceRows = pickSafetyPlanTypeSectionsForStructure(typeSections, structureId);\n\n const structure = dedupeSafetyPlanSectionStructure(\n buildSectionStructureFromTypeSections(sourceRows, {\n createId: () => AXPDataGenerator.uuid(),\n }),\n { repeatableSectionTypeIds },\n );\n\n return toBuilderValueFromStructure(await this.enrichSectionTitlesFromSectionTypes(structure));\n }\n\n /**\n * Fills missing section titles from SectionType records when type-section snapshots omit them.\n */\n private async enrichSectionTitlesFromSectionTypes(\n structure: ReturnType<typeof buildSectionStructureFromTypeSections>,\n ): Promise<ReturnType<typeof buildSectionStructureFromTypeSections>> {\n const missingIds = [\n ...new Set(\n structure.sections\n .filter((section) => !section.sectionType?.title || section.title === section.sectionTypeId)\n .map((section) => section.sectionTypeId)\n .filter((id) => !!id),\n ),\n ];\n if (!missingIds.length) {\n return structure;\n }\n\n const sectionTypeEntity = `${RootConfig.module.name}.${RootConfig.entities.sectionType.name}`;\n const result = await this.entityService.withEntity(sectionTypeEntity).data().query({\n skip: 0,\n take: Math.max(missingIds.length, 1),\n filter: {\n logic: 'or',\n filters: missingIds.map((id) => ({\n field: 'id',\n operator: { type: 'equal' },\n value: id,\n })),\n },\n } as never);\n\n const byId = new Map<string, { title?: string; code?: string }>();\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) continue;\n const title = record['title'];\n const code = record['code'];\n byId.set(id, {\n title: typeof title === 'string' ? title : undefined,\n code: typeof code === 'string' ? code : undefined,\n });\n }\n\n return {\n sections: structure.sections.map((section) => {\n const meta = byId.get(section.sectionTypeId);\n if (!meta?.title && !meta?.code) {\n return section;\n }\n const title = (meta.title ?? meta.code ?? section.title).trim();\n return {\n ...section,\n title,\n sectionType: {\n id: section.sectionTypeId,\n title: meta.title ?? section.sectionType?.title,\n code: meta.code ?? section.sectionType?.code,\n },\n };\n }),\n };\n }\n\n private async showStructureLoadError(): Promise<void> {\n this.toastService.show({\n color: 'danger',\n title: await this.translateService.translateAsync('@general:messages.generic.error.title'),\n content: await this.translateService.translateAsync(\n '@workplacesafety-management:safety-plans.messages.section-structure.load-failed',\n ),\n });\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport {\n AXPPageComponentDefinition,\n AXPPageComponentProvider,\n} from '@acorex-platform/framework-client/layout/components';\nimport { Injectable } from '@angular/core';\nimport { SAFETY_PLAN_SECTIONS_PAGE_COMPONENT_KEY } from '@acorex-platform/module-workplacesafety-management-client/contracts';\n\n//#endregion\n\n//#region ---- Safety plan sections page provider ----\n\n@Injectable()\nexport class AXMSafetyPlanSectionsPageComponentProvider implements AXPPageComponentProvider {\n async components(): Promise<AXPPageComponentDefinition[]> {\n return [\n {\n key: SAFETY_PLAN_SECTIONS_PAGE_COMPONENT_KEY,\n loader: () =>\n import('./safety-plan-sections-page.component').then((m) => m.AXMSafetyPlanSectionsPageComponent),\n },\n ];\n }\n}\n\n//#endregion\n"],"names":["i4"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AA4BA;AAEA;AAEO,MAAM,uCAAuC,GAAG;IACrD,MAAM;IACN,MAAM;IACN,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IACV,oBAAoB;CACZ;AAEH,MAAM,6CAA6C,GAAG,CAAC,MAAM,EAAE,MAAM,CAAU;AAEtF,MAAM,eAAe,GAAG,CAAC,QAAQ,CAAU;AAC3C,MAAM,qBAAqB,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,sBAAsB,CAAU;AAExF;AAEA;AAEM,SAAU,8CAA8C,CAC5D,aAAiC,EACjC,QAAiC,EACjC,YAAsB,EACtB,kBAA4B,EAAA;AAE5B,IAAA,MAAM,YAAY,GAAG;AACnB,QAAA,qBAAqB,CAAC,aAAa,EAAE,QAAQ,CAAC;AAC9C,QAAA,6BAA6B,CAAC,QAAQ,EAAE,IAAI,CAAC;QAC7C,8BAA8B,CAAC,YAAY,CAAC;AAC5C,QAAA,8BAA8B,CAAC,QAAQ,EAAE,KAAK,CAAC;QAC/C,oCAAoC,CAAC,kBAAkB,CAAC;AACxD,QAAA,oCAAoC,CAAC,QAAQ,EAAE,WAAW,CAAC;KAC5D;AACD,IAAA,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AAChC,QAAA,OAAO,2BAA2B;IACpC;AACA,IAAA,IAAI,YAAY,CAAC,QAAQ,CAAC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CAA0C,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA1C,0CAA0C,EAAA,CAAA,CAAA;;2FAA1C,0CAA0C,EAAA,UAAA,EAAA,CAAA;kBADtD;;;"}
1
+ {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-index-BGIQtdXI.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-sections-page/safety-plan-section-widget-options.util.ts","../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-sections-page/safety-plan-section-widget-options.service.ts","../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-sections-page/safety-plan-section-builder.component.ts","../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-sections-page/safety-plan-section-builder.component.html","../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-sections-page/safety-plan-sections-page.component.ts","../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-sections-page/safety-plan-sections-page-component.provider.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport type {\n AXPBuilderSection,\n AXPWidgetPropertyInjection,\n} from '@acorex-platform/framework-client/layout/components';\nimport { AXP_BEHAVIOR_PROPERTY_GROUP } from '@acorex-platform/framework-client/layout/widgets';\nimport { AXPWidgetsList, type AXPWidgetNode } from '@acorex-platform/framework-shared/core';\nimport { createBooleanProperty } from '@acorex-platform/framework-shared/widget-core';\nimport {\n asSafetyPlanDisplayText,\n resolveEntityRefId,\n resolveSectionTypeKey,\n type AXMSafetyPlanSectionWidgetOptions,\n type AXMSectionTypeCode,\n type AXMSectionTypeSnapshot,\n} from '@acorex-platform/module-workplacesafety-management-client/contracts';\n\nimport { PPE_ITEM_VIEWER_WIDGET_NAME } from '../ppe-item-viewer/ppe-item-viewer.types';\n\n//#endregion\n\n//#region ----- Types -----\n\nexport type AXMSafetyPlanConfigurableWidgetType =\n | typeof PPE_ITEM_VIEWER_WIDGET_NAME\n | typeof AXPWidgetsList.Editors.ControlHierarchyDiagram;\n\n//#endregion\n\n//#region ----- Constants -----\n\nexport const SAFETY_PLAN_PPE_WIDGET_PROPERTY_EXCLUDE = [\n 'name',\n 'path',\n 'ppeItems',\n 'readonly',\n 'disabled',\n 'triggers',\n 'requiredValidation',\n] as const;\n\nexport const SAFETY_PLAN_HIERARCHY_WIDGET_PROPERTY_EXCLUDE = ['name', 'path'] as const;\n\nconst PPE_OPTION_KEYS = ['layout'] as const;\nconst HIERARCHY_OPTION_KEYS = ['viewType', 'showTitle', 'showViewTypeSelector'] as const;\n\n//#endregion\n\n//#region ----- Resolve -----\n\nexport function resolveSafetyPlanSectionConfigurableWidgetType(\n sectionTypeId: string | undefined,\n snapshot?: AXMSectionTypeSnapshot,\n sectionTitle?: unknown,\n sectionDescription?: unknown,\n): AXMSafetyPlanConfigurableWidgetType | null {\n const resolvedKeys = [\n resolveSectionTypeKey(sectionTypeId, snapshot),\n resolveSectionTypeKeyFromCode(snapshot?.code),\n resolveSectionTypeKeyFromTitle(sectionTitle),\n resolveSectionTypeKeyFromTitle(snapshot?.title),\n resolveSectionTypeKeyFromDescription(sectionDescription),\n resolveSectionTypeKeyFromDescription(snapshot?.description),\n ];\n if (resolvedKeys.includes('Ppe')) {\n return PPE_ITEM_VIEWER_WIDGET_NAME;\n }\n if (resolvedKeys.includes('HierarchyLevel')) {\n return AXPWidgetsList.Editors.ControlHierarchyDiagram;\n }\n return null;\n}\n\nfunction resolveSectionTypeKeyFromCode(code: string | undefined): AXMSectionTypeCode | undefined {\n const compact = asSafetyPlanDisplayText(code).replace(/\\s+/g, '').toLowerCase();\n if (!compact) {\n return undefined;\n }\n if (compact === 'hierarchylevel' || compact === 'hierarchy') {\n return 'HierarchyLevel';\n }\n if (compact === 'ppe') {\n return 'Ppe';\n }\n return undefined;\n}\n\nfunction resolveSectionTypeKeyFromTitle(title: unknown): AXMSectionTypeCode | undefined {\n const compact = asSafetyPlanDisplayText(title).replace(/\\s+/g, '').toLowerCase();\n if (!compact) {\n return undefined;\n }\n if (compact === 'hierarchylevel' || compact.includes('hierarchy')) {\n return 'HierarchyLevel';\n }\n if (compact === 'ppe' || compact === 'ppeitem' || compact === 'ppeitems') {\n return 'Ppe';\n }\n return undefined;\n}\n\nfunction resolveSectionTypeKeyFromDescription(description: unknown): AXMSectionTypeCode | undefined {\n const text = asSafetyPlanDisplayText(description).toLowerCase();\n if (!text) {\n return undefined;\n }\n if (text.includes('control hierarchy')) {\n return 'HierarchyLevel';\n }\n if (text.includes('personal protective equipment')) {\n return 'Ppe';\n }\n return undefined;\n}\n\nfunction readBuilderSectionTypeId(section: AXPBuilderSection): string | undefined {\n return resolveEntityRefId(section['sectionTypeId']) ?? resolveEntityRefId(section['sectionType']) ?? undefined;\n}\n\nexport function resolveConfigurableWidgetTypeForSection(\n section: AXPBuilderSection,\n): AXMSafetyPlanConfigurableWidgetType | null {\n return resolveSafetyPlanSectionConfigurableWidgetType(\n readBuilderSectionTypeId(section),\n section['sectionType'] as AXMSectionTypeSnapshot | undefined,\n section['title'],\n section['description'],\n );\n}\n\nexport function canConfigureSafetyPlanSectionWidget(section: AXPBuilderSection): boolean {\n return resolveConfigurableWidgetTypeForSection(section) != null;\n}\n\nexport function widgetTitleKeyForConfigurableType(widgetType: AXMSafetyPlanConfigurableWidgetType): string {\n if (widgetType === PPE_ITEM_VIEWER_WIDGET_NAME) {\n return '@workplacesafety-management:ppe-items.components.ppe-item-viewer.widget-title';\n }\n return '@workplacesafety-management:control-measure-types.components.control-hierarchy-diagram.widget-title';\n}\n\n//#endregion\n\n//#region ----- Options -----\n\nexport function readSectionWidgetOptions(section: AXPBuilderSection): AXMSafetyPlanSectionWidgetOptions {\n const raw = section['widgetOptions'];\n if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {\n return {};\n }\n return { ...(raw as AXMSafetyPlanSectionWidgetOptions) };\n}\n\nexport function pickSavedWidgetOptions(\n widgetType: AXMSafetyPlanConfigurableWidgetType,\n existing: AXMSafetyPlanSectionWidgetOptions,\n incoming: Record<string, unknown>,\n): AXMSafetyPlanSectionWidgetOptions {\n const merged = { ...existing, ...incoming };\n const keys = widgetType === PPE_ITEM_VIEWER_WIDGET_NAME ? PPE_OPTION_KEYS : HIERARCHY_OPTION_KEYS;\n const next: AXMSafetyPlanSectionWidgetOptions = {};\n for (const key of keys) {\n const value = merged[key];\n if (value !== undefined && value !== null) {\n (next as Record<string, unknown>)[key] = value;\n }\n }\n return next;\n}\n\nexport function buildSafetyPlanSectionWidgetNode(\n widgetType: AXMSafetyPlanConfigurableWidgetType,\n options: AXMSafetyPlanSectionWidgetOptions,\n): AXPWidgetNode {\n return {\n type: widgetType,\n options: { ...options },\n };\n}\n\nexport function hierarchyWidgetCustomProperties(): AXPWidgetPropertyInjection[] {\n return [\n {\n property: createBooleanProperty({\n name: 'showTitle',\n title:\n '@workplacesafety-management:control-measure-types.components.control-hierarchy-diagram.fields.show-title.title',\n path: 'options.showTitle',\n group: AXP_BEHAVIOR_PROPERTY_GROUP,\n defaultValue: false,\n }),\n },\n {\n property: createBooleanProperty({\n name: 'showViewTypeSelector',\n title:\n '@workplacesafety-management:control-measure-types.components.control-hierarchy-diagram.fields.show-view-type-selector.title',\n path: 'options.showViewTypeSelector',\n group: AXP_BEHAVIOR_PROPERTY_GROUP,\n defaultValue: true,\n }),\n },\n ];\n}\n\n//#endregion\n","//#region ----- Imports -----\n\nimport {\n AXPWidgetPropertyViewerService,\n type AXPBuilderSection,\n type AXPBuilderValue,\n} from '@acorex-platform/framework-client/layout/components';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\n\nimport { PPE_ITEM_VIEWER_WIDGET_NAME } from '../ppe-item-viewer/ppe-item-viewer.types';\nimport {\n buildSafetyPlanSectionWidgetNode,\n canConfigureSafetyPlanSectionWidget,\n hierarchyWidgetCustomProperties,\n pickSavedWidgetOptions,\n readSectionWidgetOptions,\n resolveConfigurableWidgetTypeForSection,\n SAFETY_PLAN_HIERARCHY_WIDGET_PROPERTY_EXCLUDE,\n SAFETY_PLAN_PPE_WIDGET_PROPERTY_EXCLUDE,\n widgetTitleKeyForConfigurableType,\n type AXMSafetyPlanConfigurableWidgetType,\n} from './safety-plan-section-widget-options.util';\n\n//#endregion\n\n//#region ----- Service -----\n\n@Injectable({ providedIn: 'root' })\nexport class AXMSafetyPlanSectionWidgetOptionsService {\n //#region ----- Services & Dependencies -----\n\n private readonly widgetPropertyViewer = inject(AXPWidgetPropertyViewerService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ----- Public API -----\n\n canConfigure(section: AXPBuilderSection): boolean {\n return canConfigureSafetyPlanSectionWidget(section);\n }\n\n async prompt(\n section: AXPBuilderSection,\n _value: AXPBuilderValue,\n ): Promise<Record<string, unknown> | null> {\n const widgetType = resolveConfigurableWidgetTypeForSection(section);\n if (!widgetType) {\n return null;\n }\n\n const existing = readSectionWidgetOptions(section);\n const title =\n (await this.translationService.translateAsync(widgetTitleKeyForConfigurableType(widgetType))) ||\n (await this.translationService.translateAsync('@general:actions.edit.title')) ||\n 'Edit';\n\n const result = await this.widgetPropertyViewer\n .create()\n .dialog((dialog) => {\n dialog\n .setTitle(title)\n .setMode('simple')\n .setWidget(buildSafetyPlanSectionWidgetNode(widgetType, existing))\n .setExclude([...this.excludeFor(widgetType)]);\n if (widgetType !== PPE_ITEM_VIEWER_WIDGET_NAME) {\n dialog.setCustom({ properties: hierarchyWidgetCustomProperties() });\n }\n })\n .show();\n\n if (!result?.values) {\n return null;\n }\n\n const incoming = (result.values.options as Record<string, unknown> | undefined) ?? {};\n return {\n widgetOptions: pickSavedWidgetOptions(widgetType, existing, incoming),\n };\n }\n\n //#endregion\n\n //#region ----- Helpers -----\n\n private excludeFor(widgetType: AXMSafetyPlanConfigurableWidgetType): readonly string[] {\n return widgetType === PPE_ITEM_VIEWER_WIDGET_NAME\n ? SAFETY_PLAN_PPE_WIDGET_PROPERTY_EXCLUDE\n : SAFETY_PLAN_HIERARCHY_WIDGET_PROPERTY_EXCLUDE;\n }\n\n //#endregion\n}\n\n//#endregion\n","import { AXPDataGenerator } from '@acorex-platform/framework-client/core';\nimport { AXPWidgetsCatalog } from '@acorex-platform/framework-shared/core';\nimport { AXButtonModule } from '@acorex/components/button';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationModule, AXTranslationService } from '@acorex/core/translation';\nimport {\n AXPDynamicFormDefinition,\n AXPDynamicFormGroupDefinition,\n AXPLayoutBuilderService,\n} from '@acorex-platform/framework-client/layout/builder';\nimport {\n AXPEntityDataSelectorService,\n AXPEntityDefinitionRegistryService,\n AXPEntityService,\n} from '@acorex-platform/framework-client/layout/entity';\nimport {\n AXPBuilderItem,\n AXPBuilderItemViewModel,\n AXPBuilderSection,\n AXPBuilderValue,\n AXPStandardSectionItemsBuilderComponent,\n AXPStandardSectionItemsBuilderConfig,\n} from '@acorex-platform/framework-client/layout/components';\nimport { CommonModule } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport { isEqual } from 'lodash';\nimport type { AXMSectionTypeSnapshot } from '@acorex-platform/module-workplacesafety-management-client/contracts';\nimport {\n RootConfig,\n WORKPLACE_SAFETY_SECTION_TYPE_LOOKUP_WIDGET_OPTIONS,\n clearDependentItemsOnParentChange,\n dedupeSafetyPlanSectionItemSelection,\n enrichSectionTypeSnapshot,\n isActivitySectionType,\n mapSafetyPlanActivityItemsToSectionSnapshots,\n mapSafetyPlanSectionSelectedItems,\n resolveSafetyPlanSectionItemColumns,\n resolveSafetyPlanSectionItemEntityKey,\n resolveSafetyPlanSectionItemFilterAsync,\n asSafetyPlanDisplayText,\n type AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel,\n} from '@acorex-platform/module-workplacesafety-management-client/contracts';\nimport {\n AXMSafetyPlanSectionBuilderItemValue,\n AXMSafetyPlanSectionBuilderValue,\n AXMSafetyPlanActivityRowBuilderPayload,\n normalizeSafetyPlanSectionBuilderValue,\n} from './safety-plan-section-builder.types';\nimport { AXMSafetyPlanSectionWidgetOptionsService } from './safety-plan-section-widget-options.service';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\n//#region ----- Types -----\ninterface SafetyPlanSectionDialogValue {\n sectionTypeId: string;\n sectionType?: AXMSectionTypeSnapshot;\n /** Synced from the selected Section Type (display-only in the dialog). */\n sectionTypeDescription?: string;\n /** Derived from Section Type title; not shown in the dialog. */\n title: string;\n /** Optional section description copied from the type description on create/edit. */\n description?: string;\n}\ninterface SafetyPlanSectionItemDialogValue {\n itemIds: string[];\n items?: { id: string; title?: string; code?: string }[];\n}\ninterface SectionBuilderContext {\n sectionTypeId: string;\n sectionType?: AXMSectionTypeSnapshot;\n safetyPlanActivityId?: string;\n safetyPlanActivity?: { id: string; title?: string; code?: string };\n}\n//#endregion\n//#region ----- Component -----\n@Component({\n selector: 'axm-safety-plan-section-builder',\n templateUrl: './safety-plan-section-builder.component.html',\n styleUrl: './safety-plan-section-builder.component.css',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [CommonModule, AXButtonModule, AXDecoratorModule, AXTranslationModule, AXPStandardSectionItemsBuilderComponent],\n})\nexport class AXMSafetyPlanSectionBuilderComponent {\n //#region ----- Inputs / Outputs -----\n readonly value = input<AXMSafetyPlanSectionBuilderValue | null | undefined>(null);\n readonly safetyPlanId = input<string | undefined>(undefined);\n readonly options = input<Record<string, unknown>>({});\n readonly valueChange = output<AXMSafetyPlanSectionBuilderValue>();\n //#endregion\n //#region ----- Services & Dependencies -----\n private readonly standardRef = viewChild(AXPStandardSectionItemsBuilderComponent);\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly translationService = inject(AXTranslationService);\n private readonly toastService = inject(AXToastService);\n private readonly entityDataSelector = inject(AXPEntityDataSelectorService);\n private readonly entityRegistry = inject(AXPEntityDefinitionRegistryService);\n private readonly entityService = inject(AXPEntityService);\n private readonly commandService = inject(AXPCommandService);\n private readonly widgetOptionsService = inject(AXMSafetyPlanSectionWidgetOptionsService);\n //#endregion\n //#region ----- State Signals -----\n protected readonly builderValue = signal<AXPBuilderValue>({ sections: [] });\n /** Applied on the next builder commit so section header title survives item add/edit. */\n private readonly pendingSectionTitles = new Map<string, string>();\n protected readonly standardConfig = computed<AXPStandardSectionItemsBuilderConfig>(() => ({\n mapItemToView: (item) => this.mapItemToView(item),\n promptAddSection: this.allowAddSection() ? (value) => this.promptAddSection(value) : async () => null,\n promptEditSection: (section, value) => this.promptSectionHeaderEdit(section, value),\n promptAddItems: this.allowAddItems() ? (sectionId, value) => this.promptAddItems(sectionId, value) : undefined,\n promptEditItem: (item, sectionId, value) => this.promptEditItem(item, sectionId, value),\n showSectionTechnicalName: false,\n allowReorderSections: this.allowReorderSections(),\n minSectionCount: this.allowAddSection() ? 0 : Number.MAX_SAFE_INTEGER,\n texts: {\n addSection: '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.actions.add-section.title',\n addItem: '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.actions.add-item.title',\n },\n }));\n protected readonly hideHeaderActions = computed(() => (this.options()['hideHeaderActions'] as boolean) === true);\n protected readonly allowAddSection = computed(() => (this.options()['allowAddSection'] as boolean) !== false);\n protected readonly allowEditSection = computed(() => (this.options()['allowEditSection'] as boolean) === true);\n protected readonly allowEditItem = computed(() => (this.options()['allowEditItem'] as boolean) === true);\n protected readonly allowAddItems = computed(() => (this.options()['allowAddItems'] as boolean) !== false);\n protected readonly allowReorderSections = computed(() => {\n const option = this.options()['allowReorderSections'];\n return typeof option === 'boolean' ? option : true;\n });\n protected readonly readonly = computed(() => (this.options()['readonly'] as boolean) === true);\n //#endregion\n //#region ----- Lifecycle -----\n #syncValueToBuilder = effect(() => {\n const normalized = normalizeSafetyPlanSectionBuilderValue(this.value());\n const next = this.toBuilderValue(normalized);\n if (isEqual(untracked(() => this.builderValue()), next)) {\n return;\n }\n this.builderValue.set(next);\n });\n //#endregion\n //#region ----- Public API -----\n async addSection(): Promise<void> {\n await this.standardRef()?.addSection();\n }\n syncAfterSave(value: AXMSafetyPlanSectionBuilderValue): void {\n const normalized = normalizeSafetyPlanSectionBuilderValue(value);\n this.builderValue.set(this.toBuilderValue(normalized));\n queueMicrotask(() => this.standardRef()?.markClean());\n }\n resetAfterDiscard(): void {\n const normalized = normalizeSafetyPlanSectionBuilderValue(this.value());\n this.builderValue.set(this.toBuilderValue(normalized));\n queueMicrotask(() => this.standardRef()?.markClean());\n }\n //#endregion\n //#region ----- Event Handlers -----\n protected onBuilderValueChange(next: AXPBuilderValue): void {\n const previous = this.fromBuilderValue(this.builderValue());\n let nextValue = clearDependentItemsOnParentChange(previous, this.fromBuilderValue(next));\n if (this.pendingSectionTitles.size > 0) {\n nextValue = {\n sections: nextValue.sections.map((section) => {\n const title = this.pendingSectionTitles.get(section.id);\n return title ? { ...section, title } : section;\n }),\n };\n this.pendingSectionTitles.clear();\n }\n this.builderValue.set(this.toBuilderValue(nextValue));\n this.valueChange.emit(nextValue);\n }\n //#endregion\n //#region ----- Section prompts -----\n private async promptAddSection(value: AXPBuilderValue): Promise<Record<string, unknown> | null> {\n const dialogValue = await this.promptSectionForm('create', {\n sectionTypeId: '',\n sectionTypeDescription: '',\n title: '',\n description: '',\n });\n if (!dialogValue) return null;\n const sectionId = AXPDataGenerator.uuid();\n return {\n id: sectionId,\n name: sectionId,\n sectionTypeId: dialogValue.sectionTypeId,\n sectionType: dialogValue.sectionType,\n title: dialogValue.title,\n description: dialogValue.description ?? '',\n safetyPlanId: this.safetyPlanId() ?? '',\n sortOrder: (value.sections?.length ?? 0) + 1,\n items: [],\n };\n }\n private async promptSectionHeaderEdit(\n section: AXPBuilderSection,\n value: AXPBuilderValue,\n ): Promise<Record<string, unknown> | null> {\n if (this.widgetOptionsService.canConfigure(section)) {\n return this.widgetOptionsService.prompt(section, value);\n }\n if (!this.allowEditSection()) {\n return null;\n }\n return this.promptEditSection(section, value);\n }\n private async promptEditSection(\n section: AXPBuilderSection,\n value: AXPBuilderValue,\n ): Promise<Record<string, unknown> | null> {\n const previousSectionTypeId = String(section['sectionTypeId'] ?? '');\n const sectionTypeSnapshot = section['sectionType'] as AXMSectionTypeSnapshot | undefined;\n const dialogValue = await this.promptSectionForm('edit', {\n sectionTypeId: previousSectionTypeId,\n sectionType: sectionTypeSnapshot,\n sectionTypeDescription:\n enrichSectionTypeSnapshot(previousSectionTypeId, sectionTypeSnapshot)?.description ??\n String(section['description'] ?? ''),\n title: String(section['title'] ?? ''),\n description: String(section['description'] ?? ''),\n });\n if (!dialogValue) return null;\n const sectionTypeChanged = previousSectionTypeId !== dialogValue.sectionTypeId;\n const isActivity = isActivitySectionType(dialogValue.sectionTypeId, dialogValue.sectionType);\n const keepSafetyPlanActivity =\n isActivity && !sectionTypeChanged\n ? {\n safetyPlanActivityId: section['safetyPlanActivityId'],\n safetyPlanActivity: section['safetyPlanActivity'],\n }\n : {\n safetyPlanActivityId: undefined,\n safetyPlanActivity: undefined,\n };\n return {\n ...section,\n sectionTypeId: dialogValue.sectionTypeId,\n sectionType: dialogValue.sectionType,\n title: dialogValue.title,\n description: dialogValue.description ?? '',\n ...keepSafetyPlanActivity,\n ...(sectionTypeChanged ? { items: [] } : {}),\n };\n }\n private async promptSectionForm(\n mode: 'create' | 'edit',\n seed: SafetyPlanSectionDialogValue,\n ): Promise<SafetyPlanSectionDialogValue | null> {\n const titleKey =\n mode === 'create'\n ? '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.actions.add-section.title'\n : '@general:actions.edit.title';\n const title = (await this.translationService.translateAsync(titleKey)) || (mode === 'create' ? 'Add Section' : 'Edit');\n const result = await this.layoutBuilder\n .create()\n .dialog<{ success: boolean; value?: SafetyPlanSectionDialogValue }>((dialog) => {\n dialog\n .setTitle(title)\n .setSize('md')\n .setCloseButton(true)\n .setContext({ ...seed })\n .content((layout) => {\n layout.mode('edit');\n layout.dynamicForm(this.buildSectionFormDefinition());\n })\n .setActions((actions) => {\n actions.cancel('@general:actions.cancel.title').submit('@general:actions.save.title');\n })\n .onAction((dialogRef) => {\n if (dialogRef.action() === 'cancel') {\n return { success: false };\n }\n const context = dialogRef.context() as Partial<SafetyPlanSectionDialogValue>;\n const sectionTypeId = String(context.sectionTypeId ?? '').trim();\n if (!sectionTypeId) {\n return { success: false };\n }\n const sectionType = enrichSectionTypeSnapshot(sectionTypeId, context.sectionType);\n const titleValue =\n String(context.title ?? '').trim() ||\n String(sectionType?.title ?? '').trim() ||\n String(sectionType?.code ?? '').trim();\n if (!titleValue) {\n return { success: false };\n }\n const description =\n String(context.sectionTypeDescription ?? '').trim() ||\n String(context.description ?? '').trim() ||\n String(sectionType?.description ?? '').trim();\n return {\n success: true,\n kind: 'object',\n value: {\n sectionTypeId,\n sectionType,\n title: titleValue,\n description,\n sectionTypeDescription: description,\n },\n };\n });\n })\n .show();\n return result?.success && result.value ? result.value : null;\n }\n\n private buildSectionFormDefinition(): AXPDynamicFormDefinition {\n const group: AXPDynamicFormGroupDefinition = {\n name: 'section',\n title: '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.title',\n parameters: [\n {\n path: 'sectionTypeId',\n title: '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.section-type.title',\n widget: {\n path: 'sectionTypeId',\n type: AXPWidgetsCatalog.lookup,\n options: {\n entity: `${RootConfig.module.name}.${RootConfig.entities.sectionType.name}`,\n ...WORKPLACE_SAFETY_SECTION_TYPE_LOOKUP_WIDGET_OPTIONS,\n },\n },\n },\n {\n path: 'sectionTypeDescription',\n title:\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.description.title',\n widget: {\n path: 'sectionTypeDescription',\n type: AXPWidgetsCatalog.largeText,\n options: {\n readonly: true,\n rows: 2,\n },\n },\n },\n ],\n };\n return { groups: [group] };\n }\n //#endregion\n //#region ----- Item prompts -----\n private async promptAddItems(sectionId: string, value: AXPBuilderValue): Promise<AXPBuilderItem[] | null> {\n const section = value.sections.find((s) => s.id === sectionId);\n if (!section || !this.sectionContextFromBuilderSection(section)) {\n return null;\n }\n const sectionContext = this.sectionContextFromBuilderSection(section)!;\n if (isActivitySectionType(sectionContext.sectionTypeId, sectionContext.sectionType)) {\n const picked = await this.promptActivityPicker();\n if (!picked) {\n return null;\n }\n // Section stays named after the section type (\"Activity\"); item carries the catalog title.\n const sectionTypeTitle =\n String(sectionContext.sectionType?.title ?? '').trim() ||\n (await this.translationService.translateAsync(\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.activity.title',\n )) ||\n 'Activity';\n this.patchSectionTitle(sectionId, sectionTypeTitle);\n const currentSection = this.builderValue().sections.find((entry) => entry.id === sectionId) ?? section;\n const itemCount =\n this.builderValue().sections.find((entry) => entry.id === sectionId)?.items.length ??\n currentSection.items.length;\n const activityTitle = String(picked.title ?? '').trim() || 'Activity';\n return [\n this.toBuilderItemFromActivityRow(\n {\n title: activityTitle,\n code: picked.code,\n description: picked.description,\n sections: picked.sections,\n },\n itemCount,\n picked.id,\n ),\n ];\n }\n const existingIds = this.collectEntityIdsFromBuilderItems(section.items);\n const dialogValue = await this.openItemDataSelector('create', undefined, sectionId, value, section, true);\n if (!dialogValue) return null;\n const selected = this.expandDialogSelectionToLinkedEntities(dialogValue).filter(\n (entry) => !existingIds.has(entry.id),\n );\n if (!selected.length) {\n return null;\n }\n const startOrder = section.items.length;\n return selected.map((entry, index) =>\n this.toBuilderItemFromEntity(sectionId, entry, startOrder + index),\n );\n }\n private async promptEditItem(\n item: AXPBuilderItem,\n sectionId: string,\n value: AXPBuilderValue,\n ): Promise<AXPBuilderItem | null> {\n const section = value.sections.find((s) => s.id === sectionId);\n if (!section || !this.sectionContextFromBuilderSection(section)) {\n return null;\n }\n const sectionContext = this.sectionContextFromBuilderSection(section)!;\n if (isActivitySectionType(sectionContext.sectionTypeId, sectionContext.sectionType)) {\n const activityId = String(item.id ?? item['entityId'] ?? '').trim();\n if (!activityId) {\n return null;\n }\n const edited = await this.openSafetyPlanActivityEditor(activityId);\n if (!edited) {\n return null;\n }\n const activityTitle = String(edited.title ?? '').trim() || 'Activity';\n return this.toBuilderItemFromActivityRow(\n {\n title: activityTitle,\n code: edited.code,\n description: edited.description,\n sections: edited.sections,\n },\n item.order ?? 0,\n edited.id,\n );\n }\n if (!this.allowEditItem()) {\n return null;\n }\n const currentEntityId = this.resolveBuilderItemEntityId(item);\n const seed: SafetyPlanSectionItemDialogValue | undefined = currentEntityId\n ? {\n itemIds: [currentEntityId],\n items: Array.isArray(item['items'])\n ? (item['items'] as AXMSafetyPlanSectionBuilderItemValue['items'])\n : [],\n }\n : undefined;\n const dialogValue = await this.openItemDataSelector('edit', seed, sectionId, value, section, false);\n if (!dialogValue) return null;\n const selected = this.expandDialogSelectionToLinkedEntities(dialogValue);\n if (!selected.length) {\n return null;\n }\n const otherIds = this.collectEntityIdsFromBuilderItems(\n section.items.filter((row) => String(row.id) !== String(item.id)),\n );\n const replacement = selected.find((entry) => !otherIds.has(entry.id)) ?? selected[0];\n return this.toBuilderItemFromEntity(sectionId, replacement, item.order ?? 0);\n }\n private async toastActivityRequired(): Promise<void> {\n this.toastService.show({\n color: 'warning',\n title: await this.translationService.translateAsync('@general:messages.generic.error.title'),\n content: await this.translationService.translateAsync(\n '@workplacesafety-management:safety-plan-sections.messages.activity-required.message',\n ),\n });\n }\n /** Prompts for Activity catalog selection (used by Activity section add/edit). */\n private async promptActivityPicker(): Promise<{\n id: string;\n title?: string;\n code?: string;\n description?: string;\n sections: NonNullable<AXMSafetyPlanActivityRowBuilderPayload['sections']>;\n } | null> {\n const title =\n (await this.translationService.translateAsync(\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.activity.title',\n )) || 'Activity';\n const activityEntity = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanActivity.name}`;\n const result = await this.layoutBuilder\n .create()\n .dialog<{\n success: boolean;\n value?: { safetyPlanActivityId: string; safetyPlanActivity?: { id: string; title?: string; code?: string } };\n }>((dialog) => {\n dialog\n .setTitle(title)\n .setSize('md')\n .setCloseButton(true)\n .setContext({ safetyPlanActivityId: '' })\n .content((layout) => {\n layout.mode('edit');\n layout.dynamicForm({\n groups: [\n {\n name: 'activity',\n title:\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.activity.title',\n parameters: [\n {\n path: 'safetyPlanActivityId',\n title:\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.activity.title',\n widget: {\n path: 'safetyPlanActivityId',\n type: AXPWidgetsCatalog.lookup,\n options: {\n entity: activityEntity,\n look: 'select',\n textField: 'title',\n valueField: 'id',\n columns: ['code', 'title'],\n allowCreate: 'quick',\n expose: [\n { source: 'id', target: 'safetyPlanActivity.id' },\n { source: 'title', target: 'safetyPlanActivity.title' },\n { source: 'code', target: 'safetyPlanActivity.code' },\n ],\n },\n },\n },\n ],\n },\n ],\n });\n })\n .setActions((actions) => {\n actions.cancel('@general:actions.cancel.title').submit('@general:actions.save.title');\n })\n .onAction(async (dialogRef) => {\n if (dialogRef.action() === 'cancel') {\n return { success: false };\n }\n const context = dialogRef.context() as {\n safetyPlanActivityId?: string;\n safetyPlanActivity?: { id: string; title?: string; code?: string };\n };\n const safetyPlanActivityId = String(context.safetyPlanActivityId ?? '').trim();\n if (!safetyPlanActivityId) {\n return { success: false };\n }\n return {\n success: true,\n kind: 'object',\n value: {\n safetyPlanActivityId,\n safetyPlanActivity: context.safetyPlanActivity,\n },\n };\n });\n })\n .show();\n if (!result?.success || !result.value?.safetyPlanActivityId) {\n return null;\n }\n const loaded = await this.loadSafetyPlanActivity(result.value.safetyPlanActivityId);\n if (!loaded) {\n await this.toastActivityRequired();\n return null;\n }\n return loaded;\n }\n private patchSectionTitle(sectionId: string, title: string): void {\n const trimmed = title.trim();\n if (!trimmed) {\n return;\n }\n this.pendingSectionTitles.set(sectionId, trimmed);\n }\n private sectionContextFromBuilderSection(section: AXPBuilderSection): SectionBuilderContext | null {\n const sectionTypeId = String(section['sectionTypeId'] ?? '').trim();\n if (!sectionTypeId) {\n return null;\n }\n return {\n sectionTypeId,\n sectionType: enrichSectionTypeSnapshot(\n sectionTypeId,\n section['sectionType'] as AXMSectionTypeSnapshot | undefined,\n ),\n safetyPlanActivityId:\n typeof section['safetyPlanActivityId'] === 'string' ? section['safetyPlanActivityId'].trim() : undefined,\n safetyPlanActivity: section['safetyPlanActivity'] as SectionBuilderContext['safetyPlanActivity'],\n };\n }\n //#endregion\n //#region ----- Catalog item selector -----\n private resolveSectionIndex(sectionId: string, builderValue: AXPBuilderValue): number {\n const orderedSections = [...builderValue.sections].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));\n return orderedSections.findIndex((section) => section.id === sectionId);\n }\n private async loadHazardRiskRecords(hazardRiskIds: string[]): Promise<Record<string, unknown>[]> {\n if (!hazardRiskIds.length) {\n return [];\n }\n const entityKey = `${RootConfig.module.name}.${RootConfig.entities.hazardRisk.name}`;\n const accessor = this.entityService.withEntity(entityKey);\n const results = await Promise.all(\n hazardRiskIds.map((id) => accessor.data().byKey(id).catch(() => null)),\n );\n return results\n .filter((record): record is NonNullable<(typeof results)[number]> => record != null)\n .map((record) => record as unknown as Record<string, unknown>);\n }\n private async resolveItemFilterForSection(\n sectionTypeId: string,\n sectionId: string,\n builderValue: AXPBuilderValue,\n ): Promise<Record<string, unknown> | null> {\n const orderedSections = [...builderValue.sections].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));\n const sectionIndex = this.resolveSectionIndex(sectionId, builderValue);\n if (sectionIndex < 0) {\n return null;\n }\n const sections = this.fromBuilderValue({ sections: orderedSections }).sections;\n return resolveSafetyPlanSectionItemFilterAsync(\n sectionTypeId,\n sections,\n sectionIndex,\n (ids) => this.loadHazardRiskRecords(ids),\n );\n }\n private async openItemDataSelector(\n mode: 'create' | 'edit',\n seed: SafetyPlanSectionItemDialogValue | undefined,\n sectionId: string,\n builderValue: AXPBuilderValue,\n section: AXPBuilderSection,\n allowMultiple: boolean,\n ): Promise<SafetyPlanSectionItemDialogValue | null> {\n const sectionContext = this.sectionContextFromBuilderSection(section);\n if (!sectionContext) {\n return null;\n }\n const entityKey = resolveSafetyPlanSectionItemEntityKey(\n sectionContext.sectionTypeId,\n sectionContext.sectionType,\n );\n if (!entityKey) {\n return null;\n }\n const dotIndex = entityKey.indexOf('.');\n if (dotIndex <= 0) {\n return null;\n }\n const entity = await this.entityRegistry.resolve(\n entityKey.substring(0, dotIndex),\n entityKey.substring(dotIndex + 1),\n );\n if (!entity) {\n return null;\n }\n const filter = await this.resolveItemFilterForSection(\n sectionContext.sectionTypeId,\n sectionId,\n builderValue,\n );\n const columns = resolveSafetyPlanSectionItemColumns(sectionContext.sectionTypeId);\n const selectedItemIds = (seed?.itemIds ?? []).filter((id): id is string => typeof id === 'string' && id.length > 0);\n const titleKey =\n mode === 'create'\n ? '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.actions.add-item.title'\n : '@general:actions.edit.title';\n const title = (await this.translationService.translateAsync(titleKey)) || (mode === 'create' ? 'Add Item' : 'Edit');\n const result = await this.entityDataSelector.open({\n entity,\n title,\n allowMultiple,\n selectedItemIds: selectedItemIds.length > 0 ? selectedItemIds : undefined,\n columns,\n filters: filter ?? undefined,\n allowCreate: 'none',\n showCategoryFilter: false,\n });\n if (!result) {\n return null;\n }\n if (!result.items?.length) {\n return mode === 'edit' ? { itemIds: [], items: [] } : null;\n }\n const items = mapSafetyPlanSectionSelectedItems(sectionContext.sectionTypeId, result.items);\n return dedupeSafetyPlanSectionItemSelection({\n id: `${sectionId}__item_1`,\n itemIds: items.map((item) => item.id),\n items,\n });\n }\n //#endregion\n //#region ----- Builder value mapping -----\n private mapItemToView(item: AXPBuilderItem): AXPBuilderItemViewModel {\n const activityRow = item['activityRow'] as AXMSafetyPlanActivityRowBuilderPayload | undefined;\n if (activityRow) {\n const code = String(activityRow.code ?? '').trim();\n const description = String(activityRow.description ?? item['description'] ?? '').trim();\n return {\n icon: 'fa-light fa-list-check',\n title: String(activityRow.title ?? item['title'] ?? '').trim() || 'Row',\n name: description || code || undefined,\n badges: [],\n };\n }\n const snapshot = Array.isArray(item['items'])\n ? (item['items'] as { title?: string; code?: string }[])[0]\n : undefined;\n const title =\n asSafetyPlanDisplayText(item['title']) || asSafetyPlanDisplayText(snapshot?.title);\n const code = asSafetyPlanDisplayText(item['name']) || asSafetyPlanDisplayText(snapshot?.code);\n return {\n icon: 'fa-light fa-list-check',\n title,\n name: code || undefined,\n badges: [],\n };\n }\n private toBuilderValue(value: AXMSafetyPlanSectionBuilderValue): AXPBuilderValue {\n return {\n sections: value.sections.map((section, sectionIndex) => ({\n id: section.id,\n order: sectionIndex,\n name: section.id,\n sectionTypeId: section.sectionTypeId,\n sectionType: enrichSectionTypeSnapshot(section.sectionTypeId, section.sectionType),\n title: section.title,\n description: section.description ?? '',\n code: section.code,\n safetyPlanId: section.safetyPlanId ?? this.safetyPlanId() ?? '',\n sourceSafetyPlanTypeSectionId: section.sourceSafetyPlanTypeSectionId,\n sortOrder: section.sortOrder ?? sectionIndex + 1,\n required: section.required === true,\n safetyPlanActivityId: section.safetyPlanActivityId,\n safetyPlanActivity: section.safetyPlanActivity,\n widgetOptions: section.widgetOptions,\n items: this.expandSectionItemsToBuilderRows(section.id, section.items, section),\n })),\n } as AXPBuilderValue;\n }\n private fromBuilderValue(value: AXPBuilderValue): AXMSafetyPlanSectionBuilderValue {\n return normalizeSafetyPlanSectionBuilderValue({\n sections: value.sections.map((section, sectionIndex) => ({\n id: section.id,\n sectionTypeId: String(section['sectionTypeId'] ?? ''),\n sectionType: enrichSectionTypeSnapshot(\n String(section['sectionTypeId'] ?? ''),\n section['sectionType'] as AXMSectionTypeSnapshot | undefined,\n ),\n title: String(section['title'] ?? ''),\n description: String(section['description'] ?? ''),\n code: typeof section['code'] === 'string' ? section['code'] : undefined,\n safetyPlanId: String(section['safetyPlanId'] ?? this.safetyPlanId() ?? ''),\n sourceSafetyPlanTypeSectionId:\n typeof section['sourceSafetyPlanTypeSectionId'] === 'string'\n ? section['sourceSafetyPlanTypeSectionId']\n : undefined,\n sortOrder:\n typeof section['sortOrder'] === 'number' ? section['sortOrder'] : sectionIndex + 1,\n required: section['required'] === true,\n safetyPlanActivityId:\n typeof section['safetyPlanActivityId'] === 'string' ? section['safetyPlanActivityId'] : undefined,\n safetyPlanActivity:\n section['safetyPlanActivity'] as AXMSafetyPlanSectionBuilderValue['sections'][number]['safetyPlanActivity'],\n widgetOptions:\n section['widgetOptions'] && typeof section['widgetOptions'] === 'object' && !Array.isArray(section['widgetOptions'])\n ? { ...(section['widgetOptions'] as Record<string, unknown>) }\n : undefined,\n items: this.collapseBuilderRowsToStorageItems(section.id, section.items, section),\n })),\n });\n }\n private expandSectionItemsToBuilderRows(\n sectionId: string,\n items: AXMSafetyPlanSectionBuilderItemValue[],\n section: {\n sectionTypeId?: string;\n sectionType?: AXMSectionTypeSnapshot;\n },\n ): AXPBuilderItem[] {\n if (\n isActivitySectionType(section.sectionTypeId, section.sectionType) ||\n items.some((item) => item.activityRow)\n ) {\n return items\n .filter((item) => item.activityRow)\n .map((item, order) =>\n this.toBuilderItemFromActivityRow(\n {\n ...item.activityRow!,\n title: item.activityRow!.title || item.items?.[0]?.title || 'Row',\n },\n order,\n item.id,\n ),\n );\n }\n const linked = this.flattenLinkedEntities(items);\n return linked.map((entry, order) => this.toBuilderItemFromEntity(sectionId, entry, order));\n }\n private collapseBuilderRowsToStorageItems(\n sectionId: string,\n items: AXPBuilderItem[],\n section: AXPBuilderSection,\n ): AXMSafetyPlanSectionBuilderItemValue[] {\n const ordered = [...items].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));\n const sectionTypeId = String(section['sectionTypeId'] ?? '');\n const sectionType = section['sectionType'] as AXMSectionTypeSnapshot | undefined;\n if (isActivitySectionType(sectionTypeId, sectionType) || ordered.some((item) => item['activityRow'])) {\n const stepItems: AXMSafetyPlanSectionBuilderItemValue[] = [];\n ordered.forEach((item, index) => {\n const activityRow = item['activityRow'] as AXMSafetyPlanActivityRowBuilderPayload | undefined;\n if (!activityRow) {\n return;\n }\n const stepId =\n typeof item.id === 'string' && item.id && !String(item.id).includes('__entity_')\n ? String(item.id)\n : AXPDataGenerator.uuid();\n const title = activityRow.title?.trim() || 'Row';\n stepItems.push({\n id: stepId,\n itemIds: [stepId],\n items: [{ id: stepId, title, code: activityRow.code }],\n activityRow: {\n ...activityRow,\n title,\n sortOrder: index + 1,\n },\n });\n });\n return stepItems;\n }\n const itemIds: string[] = [];\n const snapshots: NonNullable<AXMSafetyPlanSectionBuilderItemValue['items']> = [];\n for (const item of ordered) {\n const entityId = this.resolveBuilderItemEntityId(item);\n if (!entityId || itemIds.includes(entityId)) {\n continue;\n }\n itemIds.push(entityId);\n const snapshot = Array.isArray(item['items'])\n ? (item['items'] as NonNullable<AXMSafetyPlanSectionBuilderItemValue['items']>)[0]\n : undefined;\n snapshots.push({\n id: entityId,\n title:\n asSafetyPlanDisplayText(snapshot?.title) ||\n asSafetyPlanDisplayText(item['title']) ||\n undefined,\n code:\n asSafetyPlanDisplayText(snapshot?.code) ||\n asSafetyPlanDisplayText(item['name']) ||\n undefined,\n });\n }\n if (!itemIds.length) {\n return [];\n }\n return [\n dedupeSafetyPlanSectionItemSelection({\n id: `${sectionId}__item_1`,\n itemIds,\n items: snapshots,\n }),\n ];\n }\n private flattenLinkedEntities(\n items: AXMSafetyPlanSectionBuilderItemValue[],\n ): Array<{ id: string; title?: string; code?: string }> {\n const linked: Array<{ id: string; title?: string; code?: string }> = [];\n const seen = new Set<string>();\n for (const slot of items) {\n const ids = Array.isArray(slot.itemIds) ? slot.itemIds : [];\n const snapshots = Array.isArray(slot.items) ? slot.items : [];\n for (let index = 0; index < ids.length; index += 1) {\n const id = String(ids[index] ?? '').trim();\n if (!id || seen.has(id)) {\n continue;\n }\n seen.add(id);\n const snapshot = snapshots.find((entry) => entry?.id === id) ?? snapshots[index];\n linked.push({\n id,\n title: asSafetyPlanDisplayText(snapshot?.title) || undefined,\n code: asSafetyPlanDisplayText(snapshot?.code) || undefined,\n });\n }\n }\n return linked;\n }\n private expandDialogSelectionToLinkedEntities(\n dialogValue: SafetyPlanSectionItemDialogValue,\n ): Array<{ id: string; title?: string; code?: string }> {\n return this.flattenLinkedEntities([\n {\n id: 'dialog',\n itemIds: [...(dialogValue.itemIds ?? [])],\n items: dialogValue.items ? [...dialogValue.items] : [],\n },\n ]);\n }\n private collectEntityIdsFromBuilderItems(items: AXPBuilderItem[]): Set<string> {\n const ids = new Set<string>();\n for (const item of items) {\n const entityId = this.resolveBuilderItemEntityId(item);\n if (entityId) {\n ids.add(entityId);\n }\n }\n return ids;\n }\n private resolveBuilderItemEntityId(item: AXPBuilderItem): string | null {\n if (typeof item['entityId'] === 'string' && item['entityId'].trim()) {\n return item['entityId'].trim();\n }\n if (Array.isArray(item['itemIds']) && typeof item['itemIds'][0] === 'string' && item['itemIds'][0].trim()) {\n return item['itemIds'][0].trim();\n }\n const snapshot = Array.isArray(item['items'])\n ? (item['items'] as { id?: string }[])[0]\n : undefined;\n if (typeof snapshot?.id === 'string' && snapshot.id.trim()) {\n return snapshot.id.trim();\n }\n return null;\n }\n private toBuilderItemFromEntity(\n sectionId: string,\n entry: { id: string; title?: string; code?: string },\n order: number,\n ): AXPBuilderItem {\n const title = asSafetyPlanDisplayText(entry.title);\n const code = asSafetyPlanDisplayText(entry.code);\n return {\n id: `${sectionId}__entity_${entry.id}`,\n order,\n entityId: entry.id,\n itemIds: [entry.id],\n items: [{ id: entry.id, title: title || undefined, code: code || undefined }],\n title,\n name: code,\n };\n }\n private toBuilderItemFromActivityRow(\n row: AXMSafetyPlanActivityRowBuilderPayload,\n order: number,\n id?: string,\n ): AXPBuilderItem {\n const stepId =\n typeof id === 'string' && id.trim() && !id.includes('__item_') && !id.includes('__entity_')\n ? id.trim()\n : AXPDataGenerator.uuid();\n const title = String(row.title ?? '').trim() || 'Row';\n const code = String(row.code ?? '').trim();\n const description = String(row.description ?? '').trim();\n return {\n id: stepId,\n order,\n entityId: stepId,\n itemIds: [stepId],\n items: [{ id: stepId, title, code: code || undefined }],\n title,\n name: code,\n description: description || undefined,\n activityRow: {\n ...row,\n title,\n description: description || undefined,\n sortOrder: order + 1,\n },\n };\n }\n /** Opens the SafetyPlanActivity update form so predefined sections (items) can be viewed/edited. */\n private async openSafetyPlanActivityEditor(activityId: string): Promise<{\n id: string;\n title?: string;\n code?: string;\n description?: string;\n sections: AXMSafetyPlanActivityRowBuilderPayload['sections'];\n } | null> {\n const activityEntity = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanActivity.name}`;\n const result = await this.commandService.execute('Entity:Edit', {\n entity: activityEntity,\n data: activityId,\n dialogSize: 'lg',\n });\n if (!result?.success) {\n return null;\n }\n return this.loadSafetyPlanActivity(activityId);\n }\n\n private async loadSafetyPlanActivity(activityId: string): Promise<{\n id: string;\n title?: string;\n code?: string;\n description?: string;\n sections: NonNullable<AXMSafetyPlanActivityRowBuilderPayload['sections']>;\n } | null> {\n try {\n const entityKey = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanActivity.name}`;\n const row = await this.entityService.withEntity(entityKey).data().byKey(activityId);\n if (!row) {\n return null;\n }\n const record = row as {\n id?: string;\n title?: string;\n code?: string;\n description?: string;\n items?: AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel[];\n };\n return {\n id: String(record.id ?? activityId),\n title: record.title,\n code: record.code,\n description: typeof record.description === 'string' ? record.description : undefined,\n sections: mapSafetyPlanActivityItemsToSectionSnapshots(record.items),\n };\n } catch {\n return null;\n }\n }\n //#endregion\n}\n//#endregion\n","<div class=\"axm-safety-plan-section-builder\">\n @if (!readonly() && !hideHeaderActions() && allowAddSection()) {\n <div class=\"__header\">\n <div class=\"__header-left\"></div>\n <div class=\"__header-right\">\n <ax-button\n class=\"ax-sm\"\n [text]=\"\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.actions.add-section.title'\n | translate\n | async\n \"\n [color]=\"'primary'\"\n (onClick)=\"addSection()\"\n >\n <ax-prefix>\n <ax-icon icon=\"fa-light fa-layer-group\"></ax-icon>\n </ax-prefix>\n </ax-button>\n </div>\n </div>\n }\n\n <axp-standard-section-items-builder\n class=\"block min-h-[200px]\"\n [value]=\"builderValue()\"\n [config]=\"standardConfig()\"\n [readonly]=\"readonly()\"\n (valueChange)=\"onBuilderValueChange($event)\"\n />\n</div>\n","//#region ---- Imports ----\n\nimport { AXPDataGenerator, AXPContextStore } from '@acorex-platform/framework-client/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport { AXPPageLayoutBase, AXPPageLayoutBaseComponent } from '@acorex-platform/framework-client/layout/views';\nimport type { AXPLayoutDetailsViewAction } from '@acorex-platform/framework-client/layout/views';\nimport type {\n AXMSafetyPlanSectionBuilderValue,\n AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel,\n} from '@acorex-platform/module-workplacesafety-management-client/contracts';\nimport {\n RootConfig,\n buildSectionStructureFromTypeSections,\n collectBuiltInRepeatableSectionTypeIds,\n dedupeSafetyPlanSectionStructure,\n pickSafetyPlanTypeSectionsForStructure,\n resolveEntityRefId,\n resolveSectionItemEntityName,\n isActivitySectionType,\n toBuilderValueFromStructure,\n asSafetyPlanDisplayText,\n} from '@acorex-platform/module-workplacesafety-management-client/contracts';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport { cloneDeep, isEqual } from 'lodash';\nimport { AXSkeletonModule } from '@acorex/components/skeleton';\nimport { AXMSafetyPlanSectionBuilderComponent } from './safety-plan-section-builder.component';\nimport {\n normalizeSafetyPlanSectionBuilderValue,\n safetyPlanSectionsToBuilderValue,\n} from './safety-plan-section-builder.types';\nimport { SAFETY_PLAN_SECTIONS_SAVE_COMMAND } from './save-safety-plan-sections.command';\nimport { AXMSafetyPlanPreviewService } from '../safety-plan-preview/safety-plan-preview.service';\nimport { hydrateSafetyPlanActivitySectionsForPreview } from '../safety-plan-preview/hydrate-safety-plan-activity-sections';\nimport { AXTranslationModule } from '@acorex/core/translation';\nimport { AsyncPipe } from '@angular/common';\nimport { AXPSystemStatusType } from '@acorex-platform/framework-shared/core';\nimport { resolveEntityRowDisplayText } from '@acorex-platform/framework-client/common';\n\n//#endregion\n\n//#region ---- Constants ----\n\nconst SAFETY_PLAN_SECTIONS_ADD_SECTION_COMMAND = 'SafetyPlan:Sections:AddSection';\nconst SAFETY_PLAN_SECTIONS_PREVIEW_COMMAND = 'SafetyPlan:Sections:Preview';\nconst SAFETY_PLAN_SECTIONS_DISCARD_COMMAND = 'SafetyPlan:Sections:Discard';\n\nconst SAFETY_PLAN_SECTION_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanSection.name}`;\nconst SAFETY_PLAN_TYPE_SECTION_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanTypeSection.name}`;\nconst SECTION_TYPE_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.sectionType.name}`;\n\n//#endregion\n\n//#region ---- Component ----\n\n@Component({\n selector: 'axm-safety-plan-sections-page',\n standalone: true,\n imports: [AXMSafetyPlanSectionBuilderComponent, AXTranslationModule, AsyncPipe, AXSkeletonModule],\n template: `\n @if (safetyPlanId() || hasStructure()) {\n <div class=\"relative block w-full min-h-0\">\n <!-- ----- Skeleton overlay while structure loads (builder stays mounted) ----- -->\n @if (showStructureLoading()) {\n <div class=\"flex flex-col gap-3 p-4 absolute inset-0 z-10 bg-white/80 dark:bg-black/40\">\n <ax-skeleton [animated]=\"true\" class=\"h-5 w-2/5 rounded-md\"></ax-skeleton>\n <ax-skeleton [animated]=\"true\" class=\"h-24 w-full rounded-md\"></ax-skeleton>\n <ax-skeleton [animated]=\"true\" class=\"h-24 w-full rounded-md\"></ax-skeleton>\n <ax-skeleton [animated]=\"true\" class=\"h-4 w-3/5 rounded-md\"></ax-skeleton>\n </div>\n }\n <!-- ----- Sections builder — mounted once structure is known (or editing an existing plan) ----- -->\n <axm-safety-plan-section-builder\n #builderRef\n [value]=\"committedValue()\"\n [safetyPlanId]=\"safetyPlanId() ?? undefined\"\n [options]=\"builderOptions()\"\n (valueChange)=\"onValueChange($event)\"\n />\n </div>\n }\n <!-- ----- Prompt to select plan type + structure before sections can load ----- -->\n @else {\n <p class=\"text-muted p-4\">\n {{\n '@workplacesafety-management:safety-plans.entities.safety-plan.pages.sections.select-plan-type-first'\n | translate\n | async\n }}\n </p>\n }\n `,\n host: {\n class: 'block w-full min-h-0',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: AXPPageLayoutBase,\n useExisting: AXMSafetyPlanSectionsPageComponent,\n },\n ],\n})\nexport class AXMSafetyPlanSectionsPageComponent extends AXPPageLayoutBaseComponent {\n /** Default `{}`: avoid NG0950 before page-component-renderer calls setInput. */\n rootContext = input<Record<string, unknown>>({});\n pageConfig = input<Record<string, unknown>>();\n options = input<Record<string, unknown>>({});\n\n protected readonly builderRef = viewChild<AXMSafetyPlanSectionBuilderComponent>('builderRef');\n\n private readonly commandService = inject(AXPCommandService);\n private readonly entityService = inject(AXPEntityService);\n private readonly contextStore = inject(AXPContextStore);\n private readonly hostPageLayout = inject(AXPPageLayoutBase, { optional: true, skipSelf: true });\n private readonly previewService = inject(AXMSafetyPlanPreviewService);\n\n private readonly baselineValue = signal<AXMSafetyPlanSectionBuilderValue | null>(null);\n protected readonly committedValue = signal<AXMSafetyPlanSectionBuilderValue | null>(null);\n protected readonly isLoadingStructure = signal(false);\n /** Prevents re-entrant sync loops when applyStructure mutates shared form context. */\n private readonly lastSyncedKey = signal<string | null>(null);\n /** In-flight sync key — blocks concurrent loads for the same pair without blocking retries after cancel. */\n private readonly inflightSyncKey = signal<string | null>(null);\n private readonly appliedPlanTypeId = signal<string | null>(null);\n private readonly appliedStructureId = signal<string | null>(null);\n /**\n * Bumped only when the user changes structure after a successful sync (see `#detectStructureUserChange`).\n * Keeps `#syncFromContext` from tracking context `structureId` during unrelated context churn.\n */\n private readonly structureReloadToken = signal(0);\n /**\n * Stable builder options — same pattern as questionnaire `prePostConfigStable`\n * (new object every CD caused builder config thrash / flicker).\n */\n private readonly builderOptionsStable = signal<Record<string, unknown>>({\n hideHeaderActions: true,\n readonly: false,\n allowAddSection: true,\n allowAddItems: true,\n allowReorderSections: true,\n allowEditSection: false,\n allowEditItem: false,\n });\n\n protected readonly safetyPlanId = computed((): string | null => {\n const raw = this.rootContext()?.['id'];\n return typeof raw === 'string' && raw.length > 0 ? raw : null;\n });\n\n protected readonly planTypeId = computed((): string | null => {\n const ctx = this.rootContext() ?? {};\n return (\n resolveEntityRefId(ctx['safetyPlanTypeId']) ??\n resolveEntityRefId((ctx['safetyPlanType'] as { id?: unknown } | undefined)?.id) ??\n resolveEntityRefId(ctx['safetyPlanType'])\n );\n });\n\n protected readonly structureId = computed((): string | null => {\n const ctx = this.rootContext() ?? {};\n return (\n resolveEntityRefId(ctx['structureId']) ??\n resolveEntityRefId((ctx['structure'] as { id?: unknown } | undefined)?.id) ??\n resolveEntityRefId(ctx['structure'])\n );\n });\n\n protected readonly hasStructure = computed(() => !!this.structureId());\n\n /**\n * Covers the first paint before `#syncFromContext` sets `isLoadingStructure`, and the full sync span.\n * Avoids flashing an empty builder after create-and-continue.\n */\n protected readonly showStructureLoading = computed((): boolean => {\n if (this.isLoadingStructure()) {\n return true;\n }\n if (!(this.safetyPlanId() || this.hasStructure())) {\n return false;\n }\n return this.lastSyncedKey() == null && this.committedValue() == null;\n });\n\n protected readonly isDraftPlan = computed((): boolean => {\n const status = this.rootContext()?.['status'];\n return !status || status === AXPSystemStatusType.Draft;\n });\n\n /** Stable reference for the builder — updated only when option values change. */\n protected readonly builderOptions = computed(() => this.builderOptionsStable());\n\n protected readonly isDirty = computed(() => {\n return !isEqual(this.baselineValue() ?? { sections: [] }, this.committedValue() ?? { sections: [] });\n });\n\n /** Keep builder options stable across rootContext snapshot churn (questionnaire pattern). */\n #stabilizeBuilderOptions = effect(() => {\n const draft = this.isDraftPlan();\n const next: Record<string, unknown> = {\n hideHeaderActions: true,\n readonly: !draft,\n allowAddSection: draft,\n allowAddItems: draft,\n allowReorderSections: draft,\n allowEditSection: false,\n allowEditItem: false,\n };\n const current = untracked(() => this.builderOptionsStable());\n if (!isEqual(current, next)) {\n this.builderOptionsStable.set(next);\n }\n });\n\n /**\n * Plan type changed on the form — clear structure and wait for a manual structure pick.\n * Does not rebuild sections; structure selection drives the next load.\n */\n #detectPlanTypeUserChange = effect(() => {\n const typeId = this.planTypeId();\n const applied = untracked(() => this.appliedPlanTypeId());\n if (!typeId || applied == null || typeId === applied) {\n return;\n }\n\n this.appliedPlanTypeId.set(typeId);\n this.appliedStructureId.set(null);\n this.lastSyncedKey.set(null);\n this.inflightSyncKey.set(null);\n this.updateRootContextField('structureId', null);\n this.updateRootContextField('structure', null);\n });\n\n /**\n * User changed structure after a successful sync — bump token so `#syncFromContext` reloads.\n */\n #detectStructureUserChange = effect(() => {\n const contextStructureId = this.structureId();\n const applied = untracked(() => this.appliedStructureId());\n if (!contextStructureId || applied == null) {\n return;\n }\n if (contextStructureId === applied) {\n return;\n }\n if (untracked(() => this.lastSyncedKey()) == null) {\n return;\n }\n this.lastSyncedKey.set(null);\n this.structureReloadToken.update((n) => n + 1);\n });\n\n #syncFromContext = effect((onCleanup) => {\n this.structureReloadToken();\n const planId = this.safetyPlanId();\n const typeId = this.planTypeId();\n const structureId = this.structureId();\n const syncKey = this.buildSyncKey(planId, typeId, structureId);\n\n if (\n untracked(() => this.lastSyncedKey()) === syncKey ||\n untracked(() => this.inflightSyncKey()) === syncKey\n ) {\n return;\n }\n\n const inflight = untracked(() => this.inflightSyncKey());\n if (inflight && inflight.startsWith(`${planId ?? ''}|${typeId ?? ''}|`)) {\n return;\n }\n\n this.inflightSyncKey.set(syncKey);\n\n let cancelled = false;\n let activeSyncKey = syncKey;\n\n const clearInflight = (): void => {\n if (untracked(() => this.inflightSyncKey()) === activeSyncKey) {\n this.inflightSyncKey.set(null);\n }\n };\n\n const markSynced = (finalStructureId: string | null = structureId): void => {\n activeSyncKey = this.buildSyncKey(planId, typeId, finalStructureId);\n this.lastSyncedKey.set(activeSyncKey);\n this.inflightSyncKey.set(null);\n };\n\n const run = async (): Promise<void> => {\n if (cancelled) {\n return;\n }\n\n // Create (no plan yet): exit without SectionType query until structure defaults are needed.\n if (!planId) {\n if (!typeId) {\n this.appliedPlanTypeId.set(null);\n this.appliedStructureId.set(null);\n this.applyStructure({ sections: [] }, { asBaseline: true });\n markSynced(null);\n return;\n }\n\n // Plan type alone must not auto-pick a structure or rebuild sections.\n if (!structureId) {\n this.appliedPlanTypeId.set(typeId);\n this.appliedStructureId.set(null);\n markSynced(null);\n return;\n }\n\n this.isLoadingStructure.set(true);\n try {\n const repeatableSectionTypeIds = await this.loadRepeatableSectionTypeIds();\n if (cancelled) {\n return;\n }\n\n const defaults = await this.loadDefaultsForStructure(\n typeId,\n structureId,\n repeatableSectionTypeIds,\n );\n if (cancelled) return;\n this.applyStructure(defaults, { asBaseline: true });\n this.appliedPlanTypeId.set(typeId);\n this.appliedStructureId.set(structureId);\n markSynced(structureId);\n } catch {\n if (cancelled) return;\n clearInflight();\n await this.showStructureLoadError();\n } finally {\n if (!cancelled) {\n this.isLoadingStructure.set(false);\n }\n }\n return;\n }\n\n // Edit / create-and-continue: one continuous loading span through SectionType → sections → defaults.\n this.isLoadingStructure.set(true);\n try {\n const repeatableSectionTypeIds = await this.loadRepeatableSectionTypeIds();\n if (cancelled) {\n return;\n }\n\n // Load independent saved sections once — never append type defaults on top.\n const previousStructureId = untracked(() => this.appliedStructureId());\n const structureChanged =\n !!structureId && !!previousStructureId && previousStructureId !== structureId;\n\n if (structureChanged && this.isDraftPlan()) {\n const defaults = await this.loadDefaultsForStructure(\n typeId ?? '',\n structureId,\n repeatableSectionTypeIds,\n );\n if (cancelled) return;\n this.applyStructure(defaults, { asBaseline: true });\n this.appliedPlanTypeId.set(typeId);\n this.appliedStructureId.set(structureId);\n markSynced(structureId);\n return;\n }\n\n const loaded = await this.fetchSectionsFromBackend(planId, repeatableSectionTypeIds);\n if (cancelled) return;\n\n if (loaded.sections.length > 0) {\n this.applyStructure(loaded, { asBaseline: true });\n this.appliedPlanTypeId.set(typeId);\n this.appliedStructureId.set(structureId);\n markSynced(structureId);\n return;\n }\n\n if (!typeId) {\n this.appliedPlanTypeId.set(null);\n this.appliedStructureId.set(null);\n this.applyStructure({ sections: [] }, { asBaseline: true });\n markSynced(null);\n return;\n }\n\n // Plan type alone must not auto-pick a structure or rebuild sections.\n if (!structureId) {\n this.appliedPlanTypeId.set(typeId);\n this.appliedStructureId.set(null);\n markSynced(null);\n return;\n }\n\n const defaults = await this.loadDefaultsForStructure(\n typeId,\n structureId,\n repeatableSectionTypeIds,\n );\n if (cancelled) return;\n this.applyStructure(defaults, { asBaseline: true });\n this.appliedPlanTypeId.set(typeId);\n this.appliedStructureId.set(structureId);\n markSynced(structureId);\n } catch {\n if (cancelled) return;\n clearInflight();\n await this.showStructureLoadError();\n } finally {\n if (!cancelled) {\n this.isLoadingStructure.set(false);\n }\n }\n };\n\n void run();\n\n onCleanup(() => {\n cancelled = true;\n clearInflight();\n });\n });\n\n protected onValueChange(value: AXMSafetyPlanSectionBuilderValue): void {\n const withOrder = normalizeSafetyPlanSectionBuilderValue({\n sections: value.sections.map((section, index) => ({\n ...section,\n sortOrder: index + 1,\n })),\n });\n if (isEqual(untracked(() => this.committedValue()), withOrder)) {\n return;\n }\n this.committedValue.set(withOrder);\n this.persistContextField('sectionStructure', withOrder, 'user');\n this.persistContextField('sections', withOrder, 'user');\n this.recompute();\n }\n\n override getWizardStepContext(): Record<string, unknown> | null {\n const value = this.committedValue();\n if (!value) {\n return null;\n }\n const cloned = cloneDeep(value);\n return { sectionStructure: cloned, sections: cloned };\n }\n\n override hasUnsavedChanges(): boolean {\n return this.isDirty();\n }\n\n override async getPrimaryMenuItems(): Promise<AXPLayoutDetailsViewAction[]> {\n const actions: AXPLayoutDetailsViewAction[] = [];\n const loading = this.showStructureLoading();\n const canPreview =\n !loading &&\n (!!this.hasStructure() || !!this.safetyPlanId() || (this.committedValue()?.sections.length ?? 0) > 0);\n\n if (this.isDraftPlan() && !loading) {\n actions.push({\n title:\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.actions.add-section.title',\n icon: 'fa-light fa-layer-group',\n zone: 'header' as const,\n priority: 'primary' as const,\n color: 'primary' as const,\n command: { name: SAFETY_PLAN_SECTIONS_ADD_SECTION_COMMAND, options: {} },\n });\n }\n\n if (canPreview) {\n actions.push({\n title:\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.actions.preview.title',\n icon: 'fa-light fa-eye',\n zone: 'header' as const,\n priority: 'primary' as const,\n color: 'default' as const,\n command: { name: SAFETY_PLAN_SECTIONS_PREVIEW_COMMAND, options: {} },\n });\n }\n\n if (!this.isDraftPlan() || loading) {\n return actions;\n }\n\n if (this.safetyPlanId()) {\n actions.push(\n {\n title: '@general:actions.discard.title',\n icon: 'fa-light fa-rotate-left',\n zone: 'footer' as const,\n priority: 'secondary',\n color: 'default',\n visible: this.isDirty(),\n command: { name: SAFETY_PLAN_SECTIONS_DISCARD_COMMAND, options: {} },\n },\n {\n title: '@general:actions.save.title',\n icon: 'fa-light fa-floppy-disk',\n zone: 'footer' as const,\n priority: 'primary',\n color: 'primary',\n visible: this.isDirty(),\n command: { name: SAFETY_PLAN_SECTIONS_SAVE_COMMAND, options: {} },\n },\n );\n }\n\n return actions;\n }\n\n override async execute(command: { name: string; options?: unknown }): Promise<void> {\n if (command.name === SAFETY_PLAN_SECTIONS_ADD_SECTION_COMMAND) {\n await this.builderRef()?.addSection();\n return;\n }\n\n if (command.name === SAFETY_PLAN_SECTIONS_PREVIEW_COMMAND) {\n await this.handlePreview();\n return;\n }\n\n if (command.name === SAFETY_PLAN_SECTIONS_DISCARD_COMMAND) {\n this.handleDiscard();\n return;\n }\n\n if (command.name !== SAFETY_PLAN_SECTIONS_SAVE_COMMAND) return;\n\n await this.handleSave({ silent: false });\n }\n\n private async handlePreview(): Promise<void> {\n const previewLabel =\n (await this.translateService.translateAsync('@general:actions.preview.title')) || 'Preview';\n const locale = this.translateService.getActiveLang?.() ?? 'en-US';\n const planTitle = resolveEntityRowDisplayText(this.rootContext()?.['title'], locale);\n const title = planTitle ? `${previewLabel}: ${planTitle}` : previewLabel;\n const structure = await hydrateSafetyPlanActivitySectionsForPreview(\n this.entityService,\n this.translateService,\n cloneDeep(this.committedValue() ?? { sections: [] }),\n );\n await this.previewService.open({\n title,\n structure,\n });\n }\n\n private async handleSave(options?: { silent?: boolean }): Promise<void> {\n const silent = options?.silent === true;\n const id = this.safetyPlanId();\n const value = this.committedValue() ?? { sections: [] };\n\n if (!id) {\n if (!silent) {\n this.toastService.show({\n color: 'danger',\n title: await this.translateService.translateAsync('@general:messages.generic.error.title'),\n content: await this.translateService.translateAsync(\n '@workplacesafety-management:safety-plans.entities.safety-plan.pages.sections.save-plan-first',\n ),\n });\n }\n return;\n }\n\n const result = await this.commandService.execute(SAFETY_PLAN_SECTIONS_SAVE_COMMAND, { id, value });\n\n if (result?.success) {\n // Always reload from backend after save so UI never keeps a stale/appended local list.\n const repeatableSectionTypeIds = await this.loadRepeatableSectionTypeIds();\n const saved = await this.fetchSectionsFromBackend(id, repeatableSectionTypeIds);\n this.applyStructure(saved, { asBaseline: true });\n this.lastSyncedKey.set(this.buildSyncKey(id, this.planTypeId(), this.structureId()));\n this.inflightSyncKey.set(null);\n this.builderRef()?.syncAfterSave(saved);\n this.recompute();\n if (!silent) {\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 });\n }\n return;\n }\n\n this.toastService.show({\n color: 'danger',\n title: await this.translateService.translateAsync('@general:messages.generic.error.title'),\n content:\n typeof result?.message?.text === 'string' && result.message.text.startsWith('@')\n ? await this.translateService.translateAsync(result.message.text)\n : await this.translateService.translateAsync('@general:messages.entity.update-failed'),\n });\n }\n\n protected override recompute(): void {\n super.recompute();\n const layout = this.hostPageLayout as unknown as { recompute?: () => void } | null | undefined;\n layout?.recompute?.();\n }\n\n private handleDiscard(): void {\n const baseline = this.baselineValue() ?? { sections: [] };\n this.committedValue.set(baseline);\n this.updateRootContextField('sectionStructure', baseline);\n this.updateRootContextField('sections', baseline);\n this.builderRef()?.resetAfterDiscard();\n this.recompute();\n }\n\n private applyStructure(\n value: AXMSafetyPlanSectionBuilderValue,\n options: { asBaseline: boolean },\n ): void {\n const normalized = normalizeSafetyPlanSectionBuilderValue(value);\n if (options.asBaseline) {\n this.baselineValue.set(normalized);\n }\n if (!isEqual(untracked(() => this.committedValue()), normalized)) {\n this.committedValue.set(normalized);\n }\n // Mirror onto the current rootContext object only (no contextStore.update).\n // Store writes during load re-snapshot rootContext and remount/lazy-reload the page.\n this.mirrorRootContextField('sectionStructure', normalized);\n this.mirrorRootContextField('sections', normalized);\n }\n\n private buildSyncKey(\n planId: string | null,\n typeId: string | null,\n structureId: string | null,\n ): string {\n return `${planId ?? ''}|${typeId ?? ''}|${structureId ?? ''}`;\n }\n\n /** Mutate the current rootContext input object without notifying the context store. */\n private mirrorRootContextField(field: string, value: unknown): void {\n const ctx = this.rootContext() as Record<string, unknown> | undefined;\n if (!ctx || typeof ctx !== 'object') {\n return;\n }\n ctx[field] = cloneDeep(value);\n }\n\n /**\n * User edits / explicit plan-type changes: write through AXPContextStore (skips when equal)\n * and mirror onto the current rootContext input object.\n */\n private persistContextField(\n field: string,\n value: unknown,\n origin: 'user' | 'system',\n ): void {\n this.contextStore.update(field, cloneDeep(value), { origin });\n this.mirrorRootContextField(field, value);\n }\n\n private updateRootContextField(field: string, value: unknown): void {\n // Prefer store writes for explicit field updates (plan type / structure / discard).\n this.persistContextField(field, value, 'system');\n }\n private async fetchSectionsFromBackend(\n planId: string,\n repeatableSectionTypeIds: readonly string[] = [],\n ): Promise<AXMSafetyPlanSectionBuilderValue> {\n const result = await this.entityService.withEntity(SAFETY_PLAN_SECTION_ENTITY).data().query({\n skip: 0,\n take: 1000,\n filter: {\n logic: 'and',\n filters: [{ field: 'safetyPlanId', operator: { type: 'equal' }, value: planId }],\n },\n } as never);\n\n const rawLoaded = safetyPlanSectionsToBuilderValue(\n (result.items ?? []) as Parameters<typeof safetyPlanSectionsToBuilderValue>[0],\n );\n const deduped = dedupeSafetyPlanSectionStructure(rawLoaded, { repeatableSectionTypeIds });\n\n // Activity sections store SafetyPlanActivity rows on items; no column schema to hydrate.\n return this.hydrateCatalogItemSnapshots(deduped);\n }\n\n /**\n * Repeater lookups are not joined on query. Fill missing catalog item titles from\n * Hazard / HazardRisk / PPE / Control records so seeded item cards are not blank.\n */\n private async hydrateCatalogItemSnapshots(\n value: AXMSafetyPlanSectionBuilderValue,\n ): Promise<AXMSafetyPlanSectionBuilderValue> {\n const locale = this.translateService.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 const entityName = resolveSectionItemEntityName(section.sectionTypeId, section.sectionType);\n if (!entityName) {\n continue;\n }\n for (const slot of section.items) {\n for (const id of slot.itemIds ?? []) {\n const snapshot = slot.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 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 this.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((slot) => ({\n ...slot,\n items: (slot.itemIds ?? []).map((id, index) => {\n const existing = slot.items?.find((entry) => entry.id === id) ?? slot.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 private async loadRepeatableSectionTypeIds(): Promise<string[]> {\n const builtIn = collectBuiltInRepeatableSectionTypeIds();\n try {\n const result = await this.entityService.withEntity(SECTION_TYPE_ENTITY).data().query({\n skip: 0,\n take: 1000,\n } as never);\n const fromQuery = (result.items ?? [])\n .filter((row) => (row as { isRepeatable?: unknown }).isRepeatable === true)\n .map((row) => resolveEntityRefId((row as { id?: unknown }).id))\n .filter((id): id is string => !!id);\n return [...new Set([...fromQuery, ...builtIn])];\n } catch {\n return builtIn;\n }\n }\n\n private async queryTypeSectionsForPlanType(\n typeId: string,\n ): Promise<AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[]> {\n const result = await this.entityService.withEntity(SAFETY_PLAN_TYPE_SECTION_ENTITY).data().query({\n skip: 0,\n take: 1000,\n sort: [{ field: 'sortOrder', dir: 'asc' }],\n filter: {\n logic: 'and',\n filters: [\n { field: 'safetyPlanTypeId', operator: { type: 'equal' }, value: typeId },\n { field: 'isArchived', operator: { type: 'equal' }, value: false },\n ],\n },\n } as never);\n\n return ((result.items ?? []) as AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[]).filter(\n (row) => resolveEntityRefId(row.safetyPlanTypeId) === typeId,\n );\n }\n\n private async loadDefaultsForStructure(\n typeId: string,\n structureId: string | null,\n repeatableSectionTypeIds: readonly string[] = [],\n ): Promise<AXMSafetyPlanSectionBuilderValue> {\n if (!typeId) {\n return { sections: [] };\n }\n\n const typeSections = await this.queryTypeSectionsForPlanType(typeId);\n const sourceRows = pickSafetyPlanTypeSectionsForStructure(typeSections, structureId);\n\n const structure = dedupeSafetyPlanSectionStructure(\n buildSectionStructureFromTypeSections(sourceRows, {\n createId: () => AXPDataGenerator.uuid(),\n }),\n { repeatableSectionTypeIds },\n );\n\n return toBuilderValueFromStructure(await this.enrichSectionTitlesFromSectionTypes(structure));\n }\n\n /**\n * Fills missing section titles from SectionType records when type-section snapshots omit them.\n */\n private async enrichSectionTitlesFromSectionTypes(\n structure: ReturnType<typeof buildSectionStructureFromTypeSections>,\n ): Promise<ReturnType<typeof buildSectionStructureFromTypeSections>> {\n const missingIds = [\n ...new Set(\n structure.sections\n .filter((section) => !section.sectionType?.title || section.title === section.sectionTypeId)\n .map((section) => section.sectionTypeId)\n .filter((id) => !!id),\n ),\n ];\n if (!missingIds.length) {\n return structure;\n }\n\n const sectionTypeEntity = `${RootConfig.module.name}.${RootConfig.entities.sectionType.name}`;\n const result = await this.entityService.withEntity(sectionTypeEntity).data().query({\n skip: 0,\n take: Math.max(missingIds.length, 1),\n filter: {\n logic: 'or',\n filters: missingIds.map((id) => ({\n field: 'id',\n operator: { type: 'equal' },\n value: id,\n })),\n },\n } as never);\n\n const byId = new Map<string, { title?: string; code?: string }>();\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) continue;\n const title = record['title'];\n const code = record['code'];\n byId.set(id, {\n title: typeof title === 'string' ? title : undefined,\n code: typeof code === 'string' ? code : undefined,\n });\n }\n\n return {\n sections: structure.sections.map((section) => {\n const meta = byId.get(section.sectionTypeId);\n if (!meta?.title && !meta?.code) {\n return section;\n }\n const title = (meta.title ?? meta.code ?? section.title).trim();\n return {\n ...section,\n title,\n sectionType: {\n id: section.sectionTypeId,\n title: meta.title ?? section.sectionType?.title,\n code: meta.code ?? section.sectionType?.code,\n },\n };\n }),\n };\n }\n\n private async showStructureLoadError(): Promise<void> {\n this.toastService.show({\n color: 'danger',\n title: await this.translateService.translateAsync('@general:messages.generic.error.title'),\n content: await this.translateService.translateAsync(\n '@workplacesafety-management:safety-plans.messages.section-structure.load-failed',\n ),\n });\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport {\n AXPPageComponentDefinition,\n AXPPageComponentProvider,\n} from '@acorex-platform/framework-client/layout/components';\nimport { Injectable } from '@angular/core';\nimport { SAFETY_PLAN_SECTIONS_PAGE_COMPONENT_KEY } from '@acorex-platform/module-workplacesafety-management-client/contracts';\n\n//#endregion\n\n//#region ---- Safety plan sections page provider ----\n\n@Injectable()\nexport class AXMSafetyPlanSectionsPageComponentProvider implements AXPPageComponentProvider {\n async components(): Promise<AXPPageComponentDefinition[]> {\n return [\n {\n key: SAFETY_PLAN_SECTIONS_PAGE_COMPONENT_KEY,\n loader: () =>\n import('./safety-plan-sections-page.component').then((m) => m.AXMSafetyPlanSectionsPageComponent),\n },\n ];\n }\n}\n\n//#endregion\n"],"names":["i4"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AA4BA;AAEA;AAEO,MAAM,uCAAuC,GAAG;IACrD,MAAM;IACN,MAAM;IACN,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IACV,oBAAoB;CACZ;AAEH,MAAM,6CAA6C,GAAG,CAAC,MAAM,EAAE,MAAM,CAAU;AAEtF,MAAM,eAAe,GAAG,CAAC,QAAQ,CAAU;AAC3C,MAAM,qBAAqB,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,sBAAsB,CAAU;AAExF;AAEA;AAEM,SA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