@acorex-platform/module-workplacesafety-management-client 0.0.38 → 0.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-Ds0Fkspp.mjs → acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-C2CZZwOj.mjs} +104 -33
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-C2CZZwOj.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-control-hierarchy-levels.mjs +19 -5
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-control-hierarchy-levels.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-control-measure.mjs +19 -5
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-control-measure.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-ppe-rule.mjs +19 -5
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-ppe-rule.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-register.mjs +19 -5
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-register.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-risk.mjs +22 -72
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-risk.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard.mjs +20 -6
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-ppe-item.mjs +19 -5
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-ppe-item.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-activity.mjs +1516 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-activity.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-section.mjs +82 -12
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-section.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-type-section.mjs +82 -12
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-type-section.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-type.mjs +19 -5
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-type.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan.mjs +39 -6
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-template.mjs +20 -5
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-template.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-section-type.mjs +19 -5
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-section-type.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-work-step-type.mjs +82 -12
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-work-step-type.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-BI4TLvSE.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-C46YEBVd.mjs} +21 -21
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-C46YEBVd.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-hierarchy-levels.entity-COlCNnyK.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-hierarchy-levels.entity-oylKTsgJ.mjs} +16 -2
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-hierarchy-levels.entity-oylKTsgJ.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-measure.entity-BrXGzqZU.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-measure.entity-DHm1nRwW.mjs} +16 -2
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-measure.entity-DHm1nRwW.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-ppe-rule.entity-DHJus7OP.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-ppe-rule.entity-DH-hPuAD.mjs} +16 -2
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-ppe-rule.entity-DH-hPuAD.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-register.entity-CogjoDox.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-register.entity-g4AT_IiT.mjs} +16 -2
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-register.entity-g4AT_IiT.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-risk.entity-9UWHmIXV.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-risk.entity-BwNlWbnC.mjs} +18 -72
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-risk.entity-BwNlWbnC.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard.entity-CNPbxULL.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard.entity-Cogwbd1P.mjs} +17 -3
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard.entity-Cogwbd1P.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-ppe-item.entity-D5iOBl3P.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-ppe-item.entity-0xqGaPnk.mjs} +16 -2
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-ppe-item.entity-0xqGaPnk.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-risk-management.integration-CUZIl8zt.mjs +7 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-risk-management.integration-CUZIl8zt.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-activity.entity-CZCYupQT.mjs +324 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-activity.entity-CZCYupQT.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section-dependency-TdIMIkM7.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section-dependency-D0fzHV_L.mjs} +62 -10
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section-dependency-D0fzHV_L.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section.entity-DJAI-7lB.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section.entity-BpziBgGf.mjs} +17 -3
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section.entity-DJAI-7lB.mjs.map → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section.entity-BpziBgGf.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type-section.entity-BGZ1VAW3.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type-section.entity-D8wL0ned.mjs} +17 -3
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type-section.entity-D8wL0ned.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type.entity-B6NYL4xi.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type.entity-DrqQDYn9.mjs} +16 -2
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type.entity-DrqQDYn9.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan.entity-BSUR9jqs.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan.entity-DaRnWCin.mjs} +36 -3
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan.entity-DaRnWCin.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-template.entity-CIHy_hLh.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-template.entity-Coj5Rzry.mjs} +17 -2
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-template.entity-Coj5Rzry.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-section-type.entity-Cs4nIHou.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-section-type.entity-BU5roQ5-.mjs} +16 -2
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-section-type.entity-BU5roQ5-.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-work-step-type.entity-CJFWDOoh.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-work-step-type.entity-DijGV30H.mjs} +17 -3
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-work-step-type.entity-DijGV30H.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog.mjs +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts.mjs +144 -168
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-fill-safety-plan.command-lJl0qpvT.mjs +165 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-fill-safety-plan.command-lJl0qpvT.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-TrVl3-T6.mjs +240 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-TrVl3-T6.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-index-gbDgxqrV.mjs → acorex-platform-module-workplacesafety-management-client-index-D_LE40Xc.mjs} +130 -398
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-index-D_LE40Xc.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-load-safety-plan-preview-structure-Ce67NSIZ.mjs +136 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-load-safety-plan-preview-structure-Ce67NSIZ.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-local-entities.mjs +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-local-entities.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-DJqqiYlD.mjs +102 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-DJqqiYlD.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-fill-values.util-RLOdySf7.mjs +33 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-fill-values.util-RLOdySf7.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-CQ2xB7Va.mjs → acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-B9lElhxc.mjs} +252 -72
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-B9lElhxc.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-section-builder.types-C0SEJsVM.mjs +185 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-section-builder.types-C0SEJsVM.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-CLj3y_JD.mjs → acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-D0aRQHWk.mjs} +30 -94
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-D0aRQHWk.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-show-job-doc-setup.command-UlWyzIXQ.mjs +341 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-show-job-doc-setup.command-UlWyzIXQ.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client.mjs +1 -1
- package/package.json +6 -6
- package/types/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-activity.d.ts +5 -0
- package/types/acorex-platform-module-workplacesafety-management-client-contracts.d.ts +133 -157
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-Ds0Fkspp.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-work-step.mjs +0 -542
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-work-step.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-BI4TLvSE.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-hierarchy-levels.entity-COlCNnyK.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-measure.entity-BrXGzqZU.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-ppe-rule.entity-DHJus7OP.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-register.entity-CogjoDox.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-risk.entity-9UWHmIXV.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard.entity-CNPbxULL.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-ppe-item.entity-D5iOBl3P.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section-dependency-TdIMIkM7.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type-section.entity-BGZ1VAW3.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type.entity-B6NYL4xi.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-work-step.entity-BlCbf5qP.mjs +0 -405
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-work-step.entity-BlCbf5qP.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan.entity-BSUR9jqs.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-template.entity-CIHy_hLh.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-section-type.entity-Cs4nIHou.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-work-step-type.entity-CJFWDOoh.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-index-gbDgxqrV.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-BU95c4xb.mjs +0 -254
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-BU95c4xb.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-CQ2xB7Va.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-preview.service-DJP41MuL.mjs +0 -36
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-preview.service-DJP41MuL.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-section-builder.types-LaN1NIgc.mjs +0 -204
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-section-builder.types-LaN1NIgc.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-CLj3y_JD.mjs.map +0 -1
- package/types/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-work-step.d.ts +0 -5
|
@@ -2,7 +2,7 @@ import { AXPDataGenerator, AXPContextStore } from '@acorex-platform/framework-cl
|
|
|
2
2
|
import { AXPEntityDataSelectorService, AXPEntityDefinitionRegistryService, AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
|
|
3
3
|
import { AXPCommandService } from '@acorex-platform/framework-client/runtime';
|
|
4
4
|
import { AXPPageLayoutBaseComponent, AXPPageLayoutBase } from '@acorex-platform/framework-client/layout/views';
|
|
5
|
-
import { resolveSectionTypeKey, asSafetyPlanDisplayText, resolveEntityRefId, clearDependentItemsOnParentChange, enrichSectionTypeSnapshot,
|
|
5
|
+
import { resolveSectionTypeKey, asSafetyPlanDisplayText, resolveEntityRefId, clearDependentItemsOnParentChange, enrichSectionTypeSnapshot, isActivitySectionType, WORKPLACE_SAFETY_SECTION_TYPE_LOOKUP_WIDGET_OPTIONS, RootConfig, resolveSafetyPlanSectionItemFilterAsync, resolveSafetyPlanSectionItemEntityKey, resolveSafetyPlanSectionItemColumns, mapSafetyPlanSectionSelectedItems, dedupeSafetyPlanSectionItemSelection, mapSafetyPlanActivityItemsToSectionSnapshots, dedupeSafetyPlanSectionStructure, resolveSectionItemEntityName, collectBuiltInRepeatableSectionTypeIds, pickSafetyPlanTypeSectionsForStructure, buildSectionStructureFromTypeSections, toBuilderValueFromStructure, SAFETY_PLAN_SECTIONS_PAGE_COMPONENT_KEY } from '@acorex-platform/module-workplacesafety-management-client/contracts';
|
|
6
6
|
import * as i0 from '@angular/core';
|
|
7
7
|
import { inject, Injectable, input, output, viewChild, signal, computed, effect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
8
8
|
import { isEqual, cloneDeep } from 'lodash';
|
|
@@ -20,13 +20,13 @@ import { AXPLayoutBuilderService } from '@acorex-platform/framework-client/layou
|
|
|
20
20
|
import { AXPWidgetPropertyViewerService, AXPStandardSectionItemsBuilderComponent } from '@acorex-platform/framework-client/layout/components';
|
|
21
21
|
import * as i3 from '@angular/common';
|
|
22
22
|
import { CommonModule, AsyncPipe } from '@angular/common';
|
|
23
|
-
import { n as normalizeSafetyPlanSectionBuilderValue, s as
|
|
24
|
-
import { P as PPE_ITEM_VIEWER_WIDGET_NAME } from './acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-
|
|
23
|
+
import { n as normalizeSafetyPlanSectionBuilderValue, s as safetyPlanSectionsToBuilderValue } from './acorex-platform-module-workplacesafety-management-client-safety-plan-section-builder.types-C0SEJsVM.mjs';
|
|
24
|
+
import { P as PPE_ITEM_VIEWER_WIDGET_NAME } from './acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-C2CZZwOj.mjs';
|
|
25
25
|
import { AXP_BEHAVIOR_PROPERTY_GROUP } from '@acorex-platform/framework-client/layout/widgets';
|
|
26
26
|
import { createBooleanProperty } from '@acorex-platform/framework-shared/widget-core';
|
|
27
|
-
import { SAFETY_PLAN_SECTIONS_SAVE_COMMAND } from './acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-
|
|
28
|
-
export { AXMSaveSafetyPlanSectionsCommand } from './acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-
|
|
29
|
-
import { A as AXMSafetyPlanPreviewService } from './acorex-platform-module-workplacesafety-management-client-safety-plan-
|
|
27
|
+
import { SAFETY_PLAN_SECTIONS_SAVE_COMMAND } from './acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-D0aRQHWk.mjs';
|
|
28
|
+
export { AXMSaveSafetyPlanSectionsCommand } from './acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-D0aRQHWk.mjs';
|
|
29
|
+
import { A as AXMSafetyPlanPreviewService, h as hydrateSafetyPlanActivitySectionsForPreview } from './acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-TrVl3-T6.mjs';
|
|
30
30
|
import { resolveEntityRowDisplayText } from '@acorex-platform/framework-client/common';
|
|
31
31
|
|
|
32
32
|
//#region ----- Imports -----
|
|
@@ -249,6 +249,7 @@ class AXMSafetyPlanSectionBuilderComponent {
|
|
|
249
249
|
this.entityDataSelector = inject(AXPEntityDataSelectorService);
|
|
250
250
|
this.entityRegistry = inject(AXPEntityDefinitionRegistryService);
|
|
251
251
|
this.entityService = inject(AXPEntityService);
|
|
252
|
+
this.commandService = inject(AXPCommandService);
|
|
252
253
|
this.widgetOptionsService = inject(AXMSafetyPlanSectionWidgetOptionsService);
|
|
253
254
|
//#endregion
|
|
254
255
|
//#region ----- State Signals -----
|
|
@@ -382,17 +383,15 @@ class AXMSafetyPlanSectionBuilderComponent {
|
|
|
382
383
|
if (!dialogValue)
|
|
383
384
|
return null;
|
|
384
385
|
const sectionTypeChanged = previousSectionTypeId !== dialogValue.sectionTypeId;
|
|
385
|
-
const
|
|
386
|
-
const
|
|
386
|
+
const isActivity = isActivitySectionType(dialogValue.sectionTypeId, dialogValue.sectionType);
|
|
387
|
+
const keepSafetyPlanActivity = isActivity && !sectionTypeChanged
|
|
387
388
|
? {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
columns: section['columns'],
|
|
389
|
+
safetyPlanActivityId: section['safetyPlanActivityId'],
|
|
390
|
+
safetyPlanActivity: section['safetyPlanActivity'],
|
|
391
391
|
}
|
|
392
392
|
: {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
columns: [],
|
|
393
|
+
safetyPlanActivityId: undefined,
|
|
394
|
+
safetyPlanActivity: undefined,
|
|
396
395
|
};
|
|
397
396
|
return {
|
|
398
397
|
...section,
|
|
@@ -400,7 +399,7 @@ class AXMSafetyPlanSectionBuilderComponent {
|
|
|
400
399
|
sectionType: dialogValue.sectionType,
|
|
401
400
|
title: dialogValue.title,
|
|
402
401
|
description: dialogValue.description ?? '',
|
|
403
|
-
...
|
|
402
|
+
...keepSafetyPlanActivity,
|
|
404
403
|
...(sectionTypeChanged ? { items: [] } : {}),
|
|
405
404
|
};
|
|
406
405
|
}
|
|
@@ -499,43 +498,29 @@ class AXMSafetyPlanSectionBuilderComponent {
|
|
|
499
498
|
if (!section || !this.sectionContextFromBuilderSection(section)) {
|
|
500
499
|
return null;
|
|
501
500
|
}
|
|
502
|
-
|
|
503
|
-
if (
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
if (!assigned) {
|
|
507
|
-
return null;
|
|
508
|
-
}
|
|
509
|
-
const updatedSection = this.builderValue().sections.find((entry) => entry.id === sectionId);
|
|
510
|
-
const nextContext = updatedSection ? this.sectionContextFromBuilderSection(updatedSection) : null;
|
|
511
|
-
if (!nextContext?.workStepTypeId || nextContext.columns.length === 0) {
|
|
512
|
-
return null;
|
|
513
|
-
}
|
|
514
|
-
sectionContext = nextContext;
|
|
515
|
-
}
|
|
516
|
-
const currentSection = this.builderValue().sections.find((entry) => entry.id === sectionId) ?? section;
|
|
517
|
-
const sectionTitle = String(currentSection['title'] ?? '').trim();
|
|
518
|
-
const sectionTypeTitle = String(sectionContext.sectionType?.title ?? '').trim();
|
|
519
|
-
const applyTitleToSection = (currentSection.items?.length ?? 0) === 0 ||
|
|
520
|
-
!sectionTitle ||
|
|
521
|
-
sectionTitle === sectionTypeTitle ||
|
|
522
|
-
sectionTitle === sectionContext.sectionTypeId;
|
|
523
|
-
const row = await this.promptStepTableRowForm('create', sectionContext, {
|
|
524
|
-
title: applyTitleToSection
|
|
525
|
-
? sectionTitle && sectionTitle !== sectionTypeTitle
|
|
526
|
-
? sectionTitle
|
|
527
|
-
: String(sectionContext.workStepType?.title ?? '').trim()
|
|
528
|
-
: '',
|
|
529
|
-
}, { requireTitle: true, applyTitleToSection });
|
|
530
|
-
if (!row) {
|
|
501
|
+
const sectionContext = this.sectionContextFromBuilderSection(section);
|
|
502
|
+
if (isActivitySectionType(sectionContext.sectionTypeId, sectionContext.sectionType)) {
|
|
503
|
+
const picked = await this.promptActivityPicker();
|
|
504
|
+
if (!picked) {
|
|
531
505
|
return null;
|
|
532
506
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
507
|
+
// Section stays named after the section type ("Activity"); item carries the catalog title.
|
|
508
|
+
const sectionTypeTitle = String(sectionContext.sectionType?.title ?? '').trim() ||
|
|
509
|
+
(await this.translationService.translateAsync('@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.activity.title')) ||
|
|
510
|
+
'Activity';
|
|
511
|
+
this.patchSectionTitle(sectionId, sectionTypeTitle);
|
|
512
|
+
const currentSection = this.builderValue().sections.find((entry) => entry.id === sectionId) ?? section;
|
|
536
513
|
const itemCount = this.builderValue().sections.find((entry) => entry.id === sectionId)?.items.length ??
|
|
537
514
|
currentSection.items.length;
|
|
538
|
-
|
|
515
|
+
const activityTitle = String(picked.title ?? '').trim() || 'Activity';
|
|
516
|
+
return [
|
|
517
|
+
this.toBuilderItemFromActivityRow({
|
|
518
|
+
title: activityTitle,
|
|
519
|
+
code: picked.code,
|
|
520
|
+
description: picked.description,
|
|
521
|
+
sections: picked.sections,
|
|
522
|
+
}, itemCount, picked.id),
|
|
523
|
+
];
|
|
539
524
|
}
|
|
540
525
|
const existingIds = this.collectEntityIdsFromBuilderItems(section.items);
|
|
541
526
|
const dialogValue = await this.openItemDataSelector('create', undefined, sectionId, value, section, true);
|
|
@@ -554,30 +539,22 @@ class AXMSafetyPlanSectionBuilderComponent {
|
|
|
554
539
|
return null;
|
|
555
540
|
}
|
|
556
541
|
const sectionContext = this.sectionContextFromBuilderSection(section);
|
|
557
|
-
if (
|
|
558
|
-
const
|
|
559
|
-
if (!
|
|
542
|
+
if (isActivitySectionType(sectionContext.sectionTypeId, sectionContext.sectionType)) {
|
|
543
|
+
const activityId = String(item.id ?? item['entityId'] ?? '').trim();
|
|
544
|
+
if (!activityId) {
|
|
560
545
|
return null;
|
|
561
546
|
}
|
|
562
|
-
const
|
|
563
|
-
|
|
564
|
-
title: String(existing.title ?? item['title'] ?? '').trim(),
|
|
565
|
-
};
|
|
566
|
-
const isPrimaryRow = (item.order ?? 0) === 0;
|
|
567
|
-
const row = await this.promptStepTableRowForm('edit', sectionContext, seed, {
|
|
568
|
-
requireTitle: true,
|
|
569
|
-
applyTitleToSection: isPrimaryRow,
|
|
570
|
-
});
|
|
571
|
-
if (!row) {
|
|
547
|
+
const edited = await this.openSafetyPlanActivityEditor(activityId);
|
|
548
|
+
if (!edited) {
|
|
572
549
|
return null;
|
|
573
550
|
}
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
}, item.order ?? 0,
|
|
551
|
+
const activityTitle = String(edited.title ?? '').trim() || 'Activity';
|
|
552
|
+
return this.toBuilderItemFromActivityRow({
|
|
553
|
+
title: activityTitle,
|
|
554
|
+
code: edited.code,
|
|
555
|
+
description: edited.description,
|
|
556
|
+
sections: edited.sections,
|
|
557
|
+
}, item.order ?? 0, edited.id);
|
|
581
558
|
}
|
|
582
559
|
if (!this.allowEditItem()) {
|
|
583
560
|
return null;
|
|
@@ -602,46 +579,17 @@ class AXMSafetyPlanSectionBuilderComponent {
|
|
|
602
579
|
const replacement = selected.find((entry) => !otherIds.has(entry.id)) ?? selected[0];
|
|
603
580
|
return this.toBuilderItemFromEntity(sectionId, replacement, item.order ?? 0);
|
|
604
581
|
}
|
|
605
|
-
async
|
|
582
|
+
async toastActivityRequired() {
|
|
606
583
|
this.toastService.show({
|
|
607
584
|
color: 'warning',
|
|
608
585
|
title: await this.translationService.translateAsync('@general:messages.generic.error.title'),
|
|
609
|
-
content: await this.translationService.translateAsync('@workplacesafety-management:safety-plan-sections.messages.
|
|
586
|
+
content: await this.translationService.translateAsync('@workplacesafety-management:safety-plan-sections.messages.activity-required.message'),
|
|
610
587
|
});
|
|
611
588
|
}
|
|
612
|
-
/** Prompts for
|
|
613
|
-
async
|
|
614
|
-
const
|
|
615
|
-
|
|
616
|
-
return false;
|
|
617
|
-
}
|
|
618
|
-
const current = this.fromBuilderValue(this.builderValue());
|
|
619
|
-
const next = {
|
|
620
|
-
sections: current.sections.map((section) => {
|
|
621
|
-
if (section.id !== sectionId) {
|
|
622
|
-
return section;
|
|
623
|
-
}
|
|
624
|
-
return {
|
|
625
|
-
...section,
|
|
626
|
-
workStepTypeId: picked.id,
|
|
627
|
-
workStepType: { id: picked.id, title: picked.title, code: picked.code },
|
|
628
|
-
columns: picked.columns,
|
|
629
|
-
};
|
|
630
|
-
}),
|
|
631
|
-
};
|
|
632
|
-
this.builderValue.set(this.toBuilderValue(next));
|
|
633
|
-
this.valueChange.emit(next);
|
|
634
|
-
return true;
|
|
635
|
-
}
|
|
636
|
-
patchSectionTitle(sectionId, title) {
|
|
637
|
-
const trimmed = title.trim();
|
|
638
|
-
if (!trimmed) {
|
|
639
|
-
return;
|
|
640
|
-
}
|
|
641
|
-
this.pendingSectionTitles.set(sectionId, trimmed);
|
|
642
|
-
}
|
|
643
|
-
async promptWorkStepPicker() {
|
|
644
|
-
const title = (await this.translationService.translateAsync('@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.work-step.title')) || 'Work Step';
|
|
589
|
+
/** Prompts for Activity catalog selection (used by Activity section add/edit). */
|
|
590
|
+
async promptActivityPicker() {
|
|
591
|
+
const title = (await this.translationService.translateAsync('@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.activity.title')) || 'Activity';
|
|
592
|
+
const activityEntity = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanActivity.name}`;
|
|
645
593
|
const result = await this.layoutBuilder
|
|
646
594
|
.create()
|
|
647
595
|
.dialog((dialog) => {
|
|
@@ -649,31 +597,32 @@ class AXMSafetyPlanSectionBuilderComponent {
|
|
|
649
597
|
.setTitle(title)
|
|
650
598
|
.setSize('md')
|
|
651
599
|
.setCloseButton(true)
|
|
652
|
-
.setContext({
|
|
600
|
+
.setContext({ safetyPlanActivityId: '' })
|
|
653
601
|
.content((layout) => {
|
|
654
602
|
layout.mode('edit');
|
|
655
603
|
layout.dynamicForm({
|
|
656
604
|
groups: [
|
|
657
605
|
{
|
|
658
|
-
name: '
|
|
659
|
-
title: '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.
|
|
606
|
+
name: 'activity',
|
|
607
|
+
title: '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.activity.title',
|
|
660
608
|
parameters: [
|
|
661
609
|
{
|
|
662
|
-
path: '
|
|
663
|
-
title: '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.
|
|
610
|
+
path: 'safetyPlanActivityId',
|
|
611
|
+
title: '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.activity.title',
|
|
664
612
|
widget: {
|
|
665
|
-
path: '
|
|
613
|
+
path: 'safetyPlanActivityId',
|
|
666
614
|
type: AXPWidgetsCatalog.lookup,
|
|
667
615
|
options: {
|
|
668
|
-
entity:
|
|
616
|
+
entity: activityEntity,
|
|
669
617
|
look: 'select',
|
|
670
618
|
textField: 'title',
|
|
671
619
|
valueField: 'id',
|
|
672
620
|
columns: ['code', 'title'],
|
|
621
|
+
allowCreate: 'quick',
|
|
673
622
|
expose: [
|
|
674
|
-
{ source: 'id', target: '
|
|
675
|
-
{ source: 'title', target: '
|
|
676
|
-
{ source: 'code', target: '
|
|
623
|
+
{ source: 'id', target: 'safetyPlanActivity.id' },
|
|
624
|
+
{ source: 'title', target: 'safetyPlanActivity.title' },
|
|
625
|
+
{ source: 'code', target: 'safetyPlanActivity.code' },
|
|
677
626
|
],
|
|
678
627
|
},
|
|
679
628
|
},
|
|
@@ -691,31 +640,38 @@ class AXMSafetyPlanSectionBuilderComponent {
|
|
|
691
640
|
return { success: false };
|
|
692
641
|
}
|
|
693
642
|
const context = dialogRef.context();
|
|
694
|
-
const
|
|
695
|
-
if (!
|
|
643
|
+
const safetyPlanActivityId = String(context.safetyPlanActivityId ?? '').trim();
|
|
644
|
+
if (!safetyPlanActivityId) {
|
|
696
645
|
return { success: false };
|
|
697
646
|
}
|
|
698
647
|
return {
|
|
699
648
|
success: true,
|
|
700
649
|
kind: 'object',
|
|
701
650
|
value: {
|
|
702
|
-
|
|
703
|
-
|
|
651
|
+
safetyPlanActivityId,
|
|
652
|
+
safetyPlanActivity: context.safetyPlanActivity,
|
|
704
653
|
},
|
|
705
654
|
};
|
|
706
655
|
});
|
|
707
656
|
})
|
|
708
657
|
.show();
|
|
709
|
-
if (!result?.success || !result.value?.
|
|
658
|
+
if (!result?.success || !result.value?.safetyPlanActivityId) {
|
|
710
659
|
return null;
|
|
711
660
|
}
|
|
712
|
-
const loaded = await this.
|
|
661
|
+
const loaded = await this.loadSafetyPlanActivity(result.value.safetyPlanActivityId);
|
|
713
662
|
if (!loaded) {
|
|
714
|
-
await this.
|
|
663
|
+
await this.toastActivityRequired();
|
|
715
664
|
return null;
|
|
716
665
|
}
|
|
717
666
|
return loaded;
|
|
718
667
|
}
|
|
668
|
+
patchSectionTitle(sectionId, title) {
|
|
669
|
+
const trimmed = title.trim();
|
|
670
|
+
if (!trimmed) {
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
this.pendingSectionTitles.set(sectionId, trimmed);
|
|
674
|
+
}
|
|
719
675
|
sectionContextFromBuilderSection(section) {
|
|
720
676
|
const sectionTypeId = String(section['sectionTypeId'] ?? '').trim();
|
|
721
677
|
if (!sectionTypeId) {
|
|
@@ -724,9 +680,8 @@ class AXMSafetyPlanSectionBuilderComponent {
|
|
|
724
680
|
return {
|
|
725
681
|
sectionTypeId,
|
|
726
682
|
sectionType: enrichSectionTypeSnapshot(sectionTypeId, section['sectionType']),
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
columns: normalizeStepTableColumns(section['columns']),
|
|
683
|
+
safetyPlanActivityId: typeof section['safetyPlanActivityId'] === 'string' ? section['safetyPlanActivityId'].trim() : undefined,
|
|
684
|
+
safetyPlanActivity: section['safetyPlanActivity'],
|
|
730
685
|
};
|
|
731
686
|
}
|
|
732
687
|
//#endregion
|
|
@@ -805,13 +760,14 @@ class AXMSafetyPlanSectionBuilderComponent {
|
|
|
805
760
|
//#endregion
|
|
806
761
|
//#region ----- Builder value mapping -----
|
|
807
762
|
mapItemToView(item) {
|
|
808
|
-
const
|
|
809
|
-
if (
|
|
810
|
-
const code = String(
|
|
763
|
+
const activityRow = item['activityRow'];
|
|
764
|
+
if (activityRow) {
|
|
765
|
+
const code = String(activityRow.code ?? '').trim();
|
|
766
|
+
const description = String(activityRow.description ?? item['description'] ?? '').trim();
|
|
811
767
|
return {
|
|
812
|
-
icon: 'fa-light fa-
|
|
813
|
-
title: String(
|
|
814
|
-
name: code || undefined,
|
|
768
|
+
icon: 'fa-light fa-list-check',
|
|
769
|
+
title: String(activityRow.title ?? item['title'] ?? '').trim() || 'Row',
|
|
770
|
+
name: description || code || undefined,
|
|
815
771
|
badges: [],
|
|
816
772
|
};
|
|
817
773
|
}
|
|
@@ -842,9 +798,8 @@ class AXMSafetyPlanSectionBuilderComponent {
|
|
|
842
798
|
sourceSafetyPlanTypeSectionId: section.sourceSafetyPlanTypeSectionId,
|
|
843
799
|
sortOrder: section.sortOrder ?? sectionIndex + 1,
|
|
844
800
|
required: section.required === true,
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
columns: normalizeStepTableColumns(section.columns),
|
|
801
|
+
safetyPlanActivityId: section.safetyPlanActivityId,
|
|
802
|
+
safetyPlanActivity: section.safetyPlanActivity,
|
|
848
803
|
widgetOptions: section.widgetOptions,
|
|
849
804
|
items: this.expandSectionItemsToBuilderRows(section.id, section.items, section),
|
|
850
805
|
})),
|
|
@@ -865,9 +820,8 @@ class AXMSafetyPlanSectionBuilderComponent {
|
|
|
865
820
|
: undefined,
|
|
866
821
|
sortOrder: typeof section['sortOrder'] === 'number' ? section['sortOrder'] : sectionIndex + 1,
|
|
867
822
|
required: section['required'] === true,
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
columns: normalizeStepTableColumns(section['columns']),
|
|
823
|
+
safetyPlanActivityId: typeof section['safetyPlanActivityId'] === 'string' ? section['safetyPlanActivityId'] : undefined,
|
|
824
|
+
safetyPlanActivity: section['safetyPlanActivity'],
|
|
871
825
|
widgetOptions: section['widgetOptions'] && typeof section['widgetOptions'] === 'object' && !Array.isArray(section['widgetOptions'])
|
|
872
826
|
? { ...section['widgetOptions'] }
|
|
873
827
|
: undefined,
|
|
@@ -876,15 +830,13 @@ class AXMSafetyPlanSectionBuilderComponent {
|
|
|
876
830
|
});
|
|
877
831
|
}
|
|
878
832
|
expandSectionItemsToBuilderRows(sectionId, items, section) {
|
|
879
|
-
if (
|
|
880
|
-
items.some((item) => item.
|
|
881
|
-
const columns = normalizeStepTableColumns(section.columns);
|
|
833
|
+
if (isActivitySectionType(section.sectionTypeId, section.sectionType) ||
|
|
834
|
+
items.some((item) => item.activityRow)) {
|
|
882
835
|
return items
|
|
883
|
-
.filter((item) => item.
|
|
884
|
-
.map((item, order) => this.
|
|
885
|
-
...item.
|
|
886
|
-
title: item.
|
|
887
|
-
summarizeStepTableRow(item.stepTableRow.cells ?? [], columns),
|
|
836
|
+
.filter((item) => item.activityRow)
|
|
837
|
+
.map((item, order) => this.toBuilderItemFromActivityRow({
|
|
838
|
+
...item.activityRow,
|
|
839
|
+
title: item.activityRow.title || item.items?.[0]?.title || 'Row',
|
|
888
840
|
}, order, item.id));
|
|
889
841
|
}
|
|
890
842
|
const linked = this.flattenLinkedEntities(items);
|
|
@@ -894,26 +846,23 @@ class AXMSafetyPlanSectionBuilderComponent {
|
|
|
894
846
|
const ordered = [...items].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
895
847
|
const sectionTypeId = String(section['sectionTypeId'] ?? '');
|
|
896
848
|
const sectionType = section['sectionType'];
|
|
897
|
-
if (
|
|
898
|
-
const columns = normalizeStepTableColumns(section['columns']);
|
|
849
|
+
if (isActivitySectionType(sectionTypeId, sectionType) || ordered.some((item) => item['activityRow'])) {
|
|
899
850
|
const stepItems = [];
|
|
900
851
|
ordered.forEach((item, index) => {
|
|
901
|
-
const
|
|
902
|
-
if (!
|
|
852
|
+
const activityRow = item['activityRow'];
|
|
853
|
+
if (!activityRow) {
|
|
903
854
|
return;
|
|
904
855
|
}
|
|
905
856
|
const stepId = typeof item.id === 'string' && item.id && !String(item.id).includes('__entity_')
|
|
906
857
|
? String(item.id)
|
|
907
858
|
: AXPDataGenerator.uuid();
|
|
908
|
-
const title =
|
|
909
|
-
summarizeStepTableRow(stepTableRow.cells ?? [], columns) ||
|
|
910
|
-
'Row';
|
|
859
|
+
const title = activityRow.title?.trim() || 'Row';
|
|
911
860
|
stepItems.push({
|
|
912
861
|
id: stepId,
|
|
913
862
|
itemIds: [stepId],
|
|
914
|
-
items: [{ id: stepId, title, code:
|
|
915
|
-
|
|
916
|
-
...
|
|
863
|
+
items: [{ id: stepId, title, code: activityRow.code }],
|
|
864
|
+
activityRow: {
|
|
865
|
+
...activityRow,
|
|
917
866
|
title,
|
|
918
867
|
sortOrder: index + 1,
|
|
919
868
|
},
|
|
@@ -1022,12 +971,13 @@ class AXMSafetyPlanSectionBuilderComponent {
|
|
|
1022
971
|
name: code,
|
|
1023
972
|
};
|
|
1024
973
|
}
|
|
1025
|
-
|
|
974
|
+
toBuilderItemFromActivityRow(row, order, id) {
|
|
1026
975
|
const stepId = typeof id === 'string' && id.trim() && !id.includes('__item_') && !id.includes('__entity_')
|
|
1027
976
|
? id.trim()
|
|
1028
977
|
: AXPDataGenerator.uuid();
|
|
1029
978
|
const title = String(row.title ?? '').trim() || 'Row';
|
|
1030
979
|
const code = String(row.code ?? '').trim();
|
|
980
|
+
const description = String(row.description ?? '').trim();
|
|
1031
981
|
return {
|
|
1032
982
|
id: stepId,
|
|
1033
983
|
order,
|
|
@@ -1036,227 +986,42 @@ class AXMSafetyPlanSectionBuilderComponent {
|
|
|
1036
986
|
items: [{ id: stepId, title, code: code || undefined }],
|
|
1037
987
|
title,
|
|
1038
988
|
name: code,
|
|
1039
|
-
|
|
989
|
+
description: description || undefined,
|
|
990
|
+
activityRow: {
|
|
1040
991
|
...row,
|
|
1041
992
|
title,
|
|
993
|
+
description: description || undefined,
|
|
1042
994
|
sortOrder: order + 1,
|
|
1043
995
|
},
|
|
1044
996
|
};
|
|
1045
997
|
}
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
const
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
: '@general:actions.edit.title';
|
|
1054
|
-
const dialogTitle = (await this.translationService.translateAsync(titleKey)) ||
|
|
1055
|
-
(mode === 'create' ? 'Add Row' : 'Edit');
|
|
1056
|
-
const result = await this.layoutBuilder
|
|
1057
|
-
.create()
|
|
1058
|
-
.dialog((dialog) => {
|
|
1059
|
-
dialog
|
|
1060
|
-
.setTitle(dialogTitle)
|
|
1061
|
-
.setSize('lg')
|
|
1062
|
-
.setCloseButton(true)
|
|
1063
|
-
.setContext({ ...seed })
|
|
1064
|
-
.content((layout) => {
|
|
1065
|
-
layout.mode('edit');
|
|
1066
|
-
layout.dynamicForm(this.buildStepTableRowFormDefinition(columns, { includeTitle: requireTitle }));
|
|
1067
|
-
})
|
|
1068
|
-
.setActions((actions) => {
|
|
1069
|
-
actions.cancel('@general:actions.cancel.title').submit('@general:actions.save.title');
|
|
1070
|
-
})
|
|
1071
|
-
.onAction((dialogRef) => {
|
|
1072
|
-
if (dialogRef.action() === 'cancel') {
|
|
1073
|
-
return { success: false };
|
|
1074
|
-
}
|
|
1075
|
-
const context = dialogRef.context();
|
|
1076
|
-
const customTitle = String(context['title'] ?? '').trim();
|
|
1077
|
-
if (requireTitle && !customTitle) {
|
|
1078
|
-
return { success: false };
|
|
1079
|
-
}
|
|
1080
|
-
const cells = this.dialogValueToCells(context, columns);
|
|
1081
|
-
if (!this.validateRequiredStepTableCells(cells, columns)) {
|
|
1082
|
-
return { success: false };
|
|
1083
|
-
}
|
|
1084
|
-
return {
|
|
1085
|
-
success: true,
|
|
1086
|
-
kind: 'object',
|
|
1087
|
-
value: {
|
|
1088
|
-
cells,
|
|
1089
|
-
title: customTitle || summarizeStepTableRow(cells, columns),
|
|
1090
|
-
},
|
|
1091
|
-
};
|
|
1092
|
-
});
|
|
1093
|
-
})
|
|
1094
|
-
.show();
|
|
1095
|
-
return result?.success && result.value ? result.value : null;
|
|
1096
|
-
}
|
|
1097
|
-
buildStepTableRowFormDefinition(columns, options) {
|
|
1098
|
-
const ordered = sortStepTableColumns(columns);
|
|
1099
|
-
const parameters = [];
|
|
1100
|
-
if (options?.includeTitle) {
|
|
1101
|
-
parameters.push({
|
|
1102
|
-
path: 'title',
|
|
1103
|
-
title: '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.title.title',
|
|
1104
|
-
widget: {
|
|
1105
|
-
path: 'title',
|
|
1106
|
-
type: AXPWidgetsCatalog.text,
|
|
1107
|
-
options: {
|
|
1108
|
-
placeholder: '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.title.placeholder',
|
|
1109
|
-
},
|
|
1110
|
-
},
|
|
1111
|
-
});
|
|
1112
|
-
}
|
|
1113
|
-
for (const column of ordered) {
|
|
1114
|
-
const key = stepTableColumnKey(column);
|
|
1115
|
-
const lookupEntity = resolveStepTableColumnLookupEntity(column);
|
|
1116
|
-
const multi = isStepTableColumnMultiLookup(column);
|
|
1117
|
-
parameters.push({
|
|
1118
|
-
path: key,
|
|
1119
|
-
title: stepTableColumnTitle(column),
|
|
1120
|
-
widget: lookupEntity
|
|
1121
|
-
? {
|
|
1122
|
-
path: key,
|
|
1123
|
-
type: AXPWidgetsCatalog.lookup,
|
|
1124
|
-
options: {
|
|
1125
|
-
look: multi ? 'lookup' : 'select',
|
|
1126
|
-
entity: lookupEntity,
|
|
1127
|
-
textField: 'title',
|
|
1128
|
-
valueField: 'id',
|
|
1129
|
-
columns: ['code', 'title'],
|
|
1130
|
-
...(multi ? { multiple: true } : {}),
|
|
1131
|
-
expose: multi
|
|
1132
|
-
? [
|
|
1133
|
-
{ source: 'id', target: `${key}Refs.{id}` },
|
|
1134
|
-
{ source: 'title', target: `${key}Refs.{title}` },
|
|
1135
|
-
{ source: 'code', target: `${key}Refs.{code}` },
|
|
1136
|
-
]
|
|
1137
|
-
: [
|
|
1138
|
-
{ source: 'id', target: `${key}Ref.id` },
|
|
1139
|
-
{ source: 'title', target: `${key}Ref.title` },
|
|
1140
|
-
{ source: 'code', target: `${key}Ref.code` },
|
|
1141
|
-
],
|
|
1142
|
-
},
|
|
1143
|
-
}
|
|
1144
|
-
: {
|
|
1145
|
-
path: key,
|
|
1146
|
-
type: AXPWidgetsCatalog.text,
|
|
1147
|
-
},
|
|
1148
|
-
});
|
|
1149
|
-
}
|
|
1150
|
-
return {
|
|
1151
|
-
groups: [
|
|
1152
|
-
{
|
|
1153
|
-
name: 'step-table-row',
|
|
1154
|
-
title: '@workplacesafety-management:safety-plan-work-steps.entities.safety-plan-work-step.groups.table-content',
|
|
1155
|
-
parameters,
|
|
1156
|
-
},
|
|
1157
|
-
],
|
|
1158
|
-
};
|
|
1159
|
-
}
|
|
1160
|
-
validateRequiredStepTableCells(cells, columns) {
|
|
1161
|
-
for (const column of columns) {
|
|
1162
|
-
if (column.required !== true) {
|
|
1163
|
-
continue;
|
|
1164
|
-
}
|
|
1165
|
-
const key = stepTableColumnKey(column);
|
|
1166
|
-
const cell = cells.find((entry) => entry.columnKey === key);
|
|
1167
|
-
if (!cell) {
|
|
1168
|
-
return false;
|
|
1169
|
-
}
|
|
1170
|
-
const lookupEntity = resolveStepTableColumnLookupEntity(column);
|
|
1171
|
-
if (lookupEntity) {
|
|
1172
|
-
if (!(cell.refIds?.length)) {
|
|
1173
|
-
return false;
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
else if (!cell.textValue?.trim()) {
|
|
1177
|
-
return false;
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
return true;
|
|
1181
|
-
}
|
|
1182
|
-
cellsToDialogValue(cells, columns) {
|
|
1183
|
-
const ordered = sortStepTableColumns(columns);
|
|
1184
|
-
const normalized = normalizeStepTableRows([{ id: 'row', sortOrder: 1, cells }], ordered)[0];
|
|
1185
|
-
const dialogRow = {};
|
|
1186
|
-
for (const column of ordered) {
|
|
1187
|
-
const key = stepTableColumnKey(column);
|
|
1188
|
-
const cell = normalized?.cells.find((entry) => entry.columnKey === key);
|
|
1189
|
-
if (!cell) {
|
|
1190
|
-
continue;
|
|
1191
|
-
}
|
|
1192
|
-
const lookupEntity = resolveStepTableColumnLookupEntity(column);
|
|
1193
|
-
if (!lookupEntity) {
|
|
1194
|
-
dialogRow[key] = cell.textValue ?? '';
|
|
1195
|
-
continue;
|
|
1196
|
-
}
|
|
1197
|
-
if (isStepTableColumnMultiLookup(column)) {
|
|
1198
|
-
dialogRow[key] = cell.refIds ?? [];
|
|
1199
|
-
dialogRow[`${key}Refs`] = cell.refs ?? [];
|
|
1200
|
-
}
|
|
1201
|
-
else {
|
|
1202
|
-
dialogRow[key] = cell.refIds?.[0];
|
|
1203
|
-
dialogRow[`${key}Ref`] = cell.refs?.[0];
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
|
-
return dialogRow;
|
|
1207
|
-
}
|
|
1208
|
-
dialogValueToCells(row, columns) {
|
|
1209
|
-
const ordered = sortStepTableColumns(columns);
|
|
1210
|
-
return ordered.map((column) => {
|
|
1211
|
-
const key = stepTableColumnKey(column);
|
|
1212
|
-
const lookupEntity = resolveStepTableColumnLookupEntity(column);
|
|
1213
|
-
if (!lookupEntity) {
|
|
1214
|
-
return {
|
|
1215
|
-
columnKey: key,
|
|
1216
|
-
textValue: typeof row[key] === 'string' ? String(row[key]) : '',
|
|
1217
|
-
};
|
|
1218
|
-
}
|
|
1219
|
-
if (isStepTableColumnMultiLookup(column)) {
|
|
1220
|
-
const refs = Array.isArray(row[`${key}Refs`])
|
|
1221
|
-
? row[`${key}Refs`]
|
|
1222
|
-
: [];
|
|
1223
|
-
const ids = Array.isArray(row[key])
|
|
1224
|
-
? row[key].filter((value) => typeof value === 'string')
|
|
1225
|
-
: refs
|
|
1226
|
-
.map((ref) => (typeof ref?.id === 'string' ? ref.id : ''))
|
|
1227
|
-
.filter(Boolean);
|
|
1228
|
-
return {
|
|
1229
|
-
columnKey: key,
|
|
1230
|
-
refIds: ids,
|
|
1231
|
-
refs: ids.map((idValue) => {
|
|
1232
|
-
const ref = refs.find((entry) => entry?.id === idValue);
|
|
1233
|
-
return { id: idValue, title: ref?.title, code: ref?.code };
|
|
1234
|
-
}),
|
|
1235
|
-
};
|
|
1236
|
-
}
|
|
1237
|
-
const ref = row[`${key}Ref`];
|
|
1238
|
-
const idValue = (typeof row[key] === 'string' && String(row[key])) ||
|
|
1239
|
-
(typeof ref?.id === 'string' ? ref.id : '');
|
|
1240
|
-
return {
|
|
1241
|
-
columnKey: key,
|
|
1242
|
-
refIds: idValue ? [idValue] : [],
|
|
1243
|
-
refs: idValue ? [{ id: idValue, title: ref?.title, code: ref?.code }] : [],
|
|
1244
|
-
};
|
|
998
|
+
/** Opens the SafetyPlanActivity update form so predefined sections (items) can be viewed/edited. */
|
|
999
|
+
async openSafetyPlanActivityEditor(activityId) {
|
|
1000
|
+
const activityEntity = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanActivity.name}`;
|
|
1001
|
+
const result = await this.commandService.execute('Entity:Edit', {
|
|
1002
|
+
entity: activityEntity,
|
|
1003
|
+
data: activityId,
|
|
1004
|
+
dialogSize: 'lg',
|
|
1245
1005
|
});
|
|
1006
|
+
if (!result?.success) {
|
|
1007
|
+
return null;
|
|
1008
|
+
}
|
|
1009
|
+
return this.loadSafetyPlanActivity(activityId);
|
|
1246
1010
|
}
|
|
1247
|
-
async
|
|
1011
|
+
async loadSafetyPlanActivity(activityId) {
|
|
1248
1012
|
try {
|
|
1249
|
-
const entityKey = `${RootConfig.module.name}.${RootConfig.entities.
|
|
1250
|
-
const row = await this.entityService.withEntity(entityKey).data().byKey(
|
|
1013
|
+
const entityKey = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanActivity.name}`;
|
|
1014
|
+
const row = await this.entityService.withEntity(entityKey).data().byKey(activityId);
|
|
1251
1015
|
if (!row) {
|
|
1252
1016
|
return null;
|
|
1253
1017
|
}
|
|
1254
1018
|
const record = row;
|
|
1255
1019
|
return {
|
|
1256
|
-
id: String(record.id ??
|
|
1020
|
+
id: String(record.id ?? activityId),
|
|
1257
1021
|
title: record.title,
|
|
1258
1022
|
code: record.code,
|
|
1259
|
-
|
|
1023
|
+
description: typeof record.description === 'string' ? record.description : undefined,
|
|
1024
|
+
sections: mapSafetyPlanActivityItemsToSectionSnapshots(record.items),
|
|
1260
1025
|
};
|
|
1261
1026
|
}
|
|
1262
1027
|
catch {
|
|
@@ -1278,7 +1043,6 @@ const SAFETY_PLAN_SECTIONS_ADD_SECTION_COMMAND = 'SafetyPlan:Sections:AddSection
|
|
|
1278
1043
|
const SAFETY_PLAN_SECTIONS_PREVIEW_COMMAND = 'SafetyPlan:Sections:Preview';
|
|
1279
1044
|
const SAFETY_PLAN_SECTIONS_DISCARD_COMMAND = 'SafetyPlan:Sections:Discard';
|
|
1280
1045
|
const SAFETY_PLAN_SECTION_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanSection.name}`;
|
|
1281
|
-
const SAFETY_PLAN_WORK_STEP_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanWorkStep.name}`;
|
|
1282
1046
|
const SAFETY_PLAN_TYPE_SECTION_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanTypeSection.name}`;
|
|
1283
1047
|
const SECTION_TYPE_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.sectionType.name}`;
|
|
1284
1048
|
//#endregion
|
|
@@ -1693,9 +1457,10 @@ class AXMSafetyPlanSectionsPageComponent extends AXPPageLayoutBaseComponent {
|
|
|
1693
1457
|
const locale = this.translateService.getActiveLang?.() ?? 'en-US';
|
|
1694
1458
|
const planTitle = resolveEntityRowDisplayText(this.rootContext()?.['title'], locale);
|
|
1695
1459
|
const title = planTitle ? `${previewLabel}: ${planTitle}` : previewLabel;
|
|
1460
|
+
const structure = await hydrateSafetyPlanActivitySectionsForPreview(this.entityService, this.translateService, cloneDeep(this.committedValue() ?? { sections: [] }));
|
|
1696
1461
|
await this.previewService.open({
|
|
1697
1462
|
title,
|
|
1698
|
-
structure
|
|
1463
|
+
structure,
|
|
1699
1464
|
});
|
|
1700
1465
|
}
|
|
1701
1466
|
async handleSave(options) {
|
|
@@ -1799,18 +1564,8 @@ class AXMSafetyPlanSectionsPageComponent extends AXPPageLayoutBaseComponent {
|
|
|
1799
1564
|
});
|
|
1800
1565
|
const rawLoaded = safetyPlanSectionsToBuilderValue((result.items ?? []));
|
|
1801
1566
|
const deduped = dedupeSafetyPlanSectionStructure(rawLoaded, { repeatableSectionTypeIds });
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
take: 2000,
|
|
1805
|
-
filter: {
|
|
1806
|
-
logic: 'and',
|
|
1807
|
-
filters: [{ field: 'safetyPlanId', operator: { type: 'equal' }, value: planId }],
|
|
1808
|
-
},
|
|
1809
|
-
});
|
|
1810
|
-
const columnsByWorkStepTypeId = await this.loadWorkStepTypeColumns(deduped.sections
|
|
1811
|
-
.map((section) => section.workStepTypeId)
|
|
1812
|
-
.filter((id) => typeof id === 'string' && id.length > 0));
|
|
1813
|
-
return this.hydrateCatalogItemSnapshots(hydrateStepTableSectionsWithWorkSteps(deduped, (workStepsResult.items ?? []), columnsByWorkStepTypeId));
|
|
1567
|
+
// Activity sections store SafetyPlanActivity rows on items; no column schema to hydrate.
|
|
1568
|
+
return this.hydrateCatalogItemSnapshots(deduped);
|
|
1814
1569
|
}
|
|
1815
1570
|
/**
|
|
1816
1571
|
* Repeater lookups are not joined on query. Fill missing catalog item titles from
|
|
@@ -1820,7 +1575,7 @@ class AXMSafetyPlanSectionsPageComponent extends AXPPageLayoutBaseComponent {
|
|
|
1820
1575
|
const locale = this.translateService.getActiveLang?.() ?? 'en-US';
|
|
1821
1576
|
const missingByEntity = new Map();
|
|
1822
1577
|
for (const section of value.sections) {
|
|
1823
|
-
if (
|
|
1578
|
+
if (isActivitySectionType(section.sectionTypeId, section.sectionType)) {
|
|
1824
1579
|
continue;
|
|
1825
1580
|
}
|
|
1826
1581
|
const entityName = resolveSectionItemEntityName(section.sectionTypeId, section.sectionType);
|
|
@@ -1890,29 +1645,6 @@ class AXMSafetyPlanSectionsPageComponent extends AXPPageLayoutBaseComponent {
|
|
|
1890
1645
|
})),
|
|
1891
1646
|
};
|
|
1892
1647
|
}
|
|
1893
|
-
async loadWorkStepTypeColumns(workStepTypeIds) {
|
|
1894
|
-
const uniqueIds = [...new Set(workStepTypeIds)];
|
|
1895
|
-
const columnsById = new Map();
|
|
1896
|
-
if (!uniqueIds.length) {
|
|
1897
|
-
return columnsById;
|
|
1898
|
-
}
|
|
1899
|
-
const entityKey = `${RootConfig.module.name}.${RootConfig.entities.workStepType.name}`;
|
|
1900
|
-
const accessor = this.entityService.withEntity(entityKey);
|
|
1901
|
-
await Promise.all(uniqueIds.map(async (id) => {
|
|
1902
|
-
try {
|
|
1903
|
-
const row = await accessor.data().byKey(id);
|
|
1904
|
-
if (!row) {
|
|
1905
|
-
return;
|
|
1906
|
-
}
|
|
1907
|
-
const record = row;
|
|
1908
|
-
columnsById.set(id, normalizeStepTableColumns(record.columns));
|
|
1909
|
-
}
|
|
1910
|
-
catch {
|
|
1911
|
-
// Leave missing types without columns; hydrate falls back to row snapshots.
|
|
1912
|
-
}
|
|
1913
|
-
}));
|
|
1914
|
-
return columnsById;
|
|
1915
|
-
}
|
|
1916
1648
|
async loadRepeatableSectionTypeIds() {
|
|
1917
1649
|
const builtIn = collectBuiltInRepeatableSectionTypeIds();
|
|
1918
1650
|
try {
|
|
@@ -2137,4 +1869,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
2137
1869
|
}] });
|
|
2138
1870
|
|
|
2139
1871
|
export { AXMSafetyPlanSectionBuilderComponent, AXMSafetyPlanSectionsPageComponent, AXMSafetyPlanSectionsPageComponentProvider, SAFETY_PLAN_SECTIONS_SAVE_COMMAND };
|
|
2140
|
-
//# sourceMappingURL=acorex-platform-module-workplacesafety-management-client-index-
|
|
1872
|
+
//# sourceMappingURL=acorex-platform-module-workplacesafety-management-client-index-D_LE40Xc.mjs.map
|