@acorex-platform/module-workplacesafety-management-client 0.0.57 → 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,7 +1,7 @@
1
1
  import { resolveEntityRowDisplayText } from '@acorex-platform/framework-client/common';
2
2
  import { RootConfig, dedupeSafetyPlanSectionStructure, collectBuiltInRepeatableSectionTypeIds, resolveEntityRefId, isActivitySectionType, resolveSectionItemEntityName, asSafetyPlanDisplayText } from '@acorex-platform/module-workplacesafety-management-client/contracts';
3
3
  import { s as safetyPlanSectionsToBuilderValue } from './acorex-platform-module-workplacesafety-management-client-safety-plan-section-builder.types-C0SEJsVM.mjs';
4
- import { h as hydrateSafetyPlanActivitySectionsForPreview } from './acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-TrVl3-T6.mjs';
4
+ import { h as hydrateSafetyPlanActivitySectionsForPreview } from './acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-Q2vVYxP-.mjs';
5
5
 
6
6
  //#region ----- Imports -----
7
7
  //#endregion
@@ -133,4 +133,4 @@ async function hydrateCatalogItemSnapshots(entityService, translationService, va
133
133
  //#endregion
134
134
 
135
135
  export { loadSafetyPlanPreviewStructure as l };
136
- //# sourceMappingURL=acorex-platform-module-workplacesafety-management-client-load-safety-plan-preview-structure-Ce67NSIZ.mjs.map
136
+ //# sourceMappingURL=acorex-platform-module-workplacesafety-management-client-load-safety-plan-preview-structure-DgfDb0uz.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-load-safety-plan-preview-structure-Ce67NSIZ.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan/commands/load-safety-plan-preview-structure.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { resolveEntityRowDisplayText } from '@acorex-platform/framework-client/common';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport {\n asSafetyPlanDisplayText,\n collectBuiltInRepeatableSectionTypeIds,\n dedupeSafetyPlanSectionStructure,\n isActivitySectionType,\n resolveEntityRefId,\n resolveSectionItemEntityName,\n RootConfig,\n type AXMSafetyPlanSectionBuilderValue,\n} from '@acorex-platform/module-workplacesafety-management-client/contracts';\nimport { AXTranslationService } from '@acorex/core/translation';\n\nimport { safetyPlanSectionsToBuilderValue } from '../../safety-plan-sections-page/safety-plan-section-builder.types';\nimport { hydrateSafetyPlanActivitySectionsForPreview } from '../../safety-plan-preview/hydrate-safety-plan-activity-sections';\n\n//#endregion\n\n//#region ----- Constants -----\n\nconst SAFETY_PLAN_SECTION_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanSection.name}`;\nconst SECTION_TYPE_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.sectionType.name}`;\n\n//#endregion\n\n//#region ----- Public API -----\n\n/**\n * Loads a safety plan's section structure for the existing preview modal\n * (same shape the sections page feeds into AXMSafetyPlanPreviewService).\n */\nexport async function loadSafetyPlanPreviewStructure(\n entityService: AXPEntityService,\n translationService: AXTranslationService,\n planId: string,\n): Promise<AXMSafetyPlanSectionBuilderValue> {\n const editable = await loadSafetyPlanEditableStructure(entityService, translationService, planId);\n // Activity sections reference SafetyPlanActivity; hydrate nested section items for preview.\n return hydrateSafetyPlanActivitySectionsForPreview(entityService, translationService, editable);\n}\n\n/**\n * Loads section structure for editing (Fill / sections page shape).\n * Skips preview-only activity hydration so the builder can persist cleanly.\n */\nexport async function loadSafetyPlanEditableStructure(\n entityService: AXPEntityService,\n translationService: AXTranslationService,\n planId: string,\n): Promise<AXMSafetyPlanSectionBuilderValue> {\n const repeatableSectionTypeIds = await loadRepeatableSectionTypeIds(entityService);\n\n const result = await 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 return hydrateCatalogItemSnapshots(entityService, translationService, deduped);\n}\n\n//#endregion\n\n//#region ----- Helpers -----\n\nasync function loadRepeatableSectionTypeIds(entityService: AXPEntityService): Promise<string[]> {\n const builtIn = collectBuiltInRepeatableSectionTypeIds();\n try {\n const result = await 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\nasync function hydrateCatalogItemSnapshots(\n entityService: AXPEntityService,\n translationService: AXTranslationService,\n value: AXMSafetyPlanSectionBuilderValue,\n): Promise<AXMSafetyPlanSectionBuilderValue> {\n const locale = translationService.getActiveLang?.() ?? 'en-US';\n const missingByEntity = new Map<string, Set<string>>();\n\n for (const section of value.sections) {\n if (isActivitySectionType(section.sectionTypeId, section.sectionType)) {\n continue;\n }\n 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 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//#endregion\n"],"names":[],"mappings":";;;;;AAAA;AAmBA;AAEA;AAEA,MAAM,0BAA0B,GAAG,CAAA,EAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAA,CAAA,EAAI,UAAU,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,EAAE;AAC5G,MAAM,mBAAmB,GAAG,CAAA,EAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAA,CAAA,EAAI,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE;AAE/F;AAEA;AAEA;;;AAGG;AACI,eAAe,8BAA8B,CAClD,aAA+B,EAC/B,kBAAwC,EACxC,MAAc,EAAA;IAEd,MAAM,QAAQ,GAAG,MAAM,+BAA+B,CAAC,aAAa,EAAE,kBAAkB,EAAE,MAAM,CAAC;;IAEjG,OAAO,2CAA2C,CAAC,aAAa,EAAE,kBAAkB,EAAE,QAAQ,CAAC;AACjG;AAEA;;;AAGG;AACI,eAAe,+BAA+B,CACnD,aAA+B,EAC/B,kBAAwC,EACxC,MAAc,EAAA;AAEd,IAAA,MAAM,wBAAwB,GAAG,MAAM,4BAA4B,CAAC,aAAa,CAAC;AAElF,IAAA,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;AACrF,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,IAAI,EAAE,IAAI;AACV,QAAA,MAAM,EAAE;AACN,YAAA,KAAK,EAAE,KAAK;AACZ,YAAA,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,E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AM;AAClC,gBAAA,GAAG,IAAI;AACP,gBAAA,KAAK,EAAE,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,KAAI;oBAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;oBACpF,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;oBACjC,OAAO;wBACL,EAAE;wBACF,KAAK,EAAE,uBAAuB,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,MAAM,EAAE,KAAK;wBAChE,IAAI,EAAE,uBAAuB,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,MAAM,EAAE,IAAI;qBAC9D;AACH,gBAAA,CAAC,CAAC;AACH,aAAA,CAAC,CAAC;AACJ,SAAA,CAAC,CAAC;KACJ;AACH;AAEA;;"}
1
+ {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-load-safety-plan-preview-structure-DgfDb0uz.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan/commands/load-safety-plan-preview-structure.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { resolveEntityRowDisplayText } from '@acorex-platform/framework-client/common';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport {\n asSafetyPlanDisplayText,\n collectBuiltInRepeatableSectionTypeIds,\n dedupeSafetyPlanSectionStructure,\n isActivitySectionType,\n resolveEntityRefId,\n resolveSectionItemEntityName,\n RootConfig,\n type AXMSafetyPlanSectionBuilderValue,\n} from '@acorex-platform/module-workplacesafety-management-client/contracts';\nimport { AXTranslationService } from '@acorex/core/translation';\n\nimport { safetyPlanSectionsToBuilderValue } from '../../safety-plan-sections-page/safety-plan-section-builder.types';\nimport { hydrateSafetyPlanActivitySectionsForPreview } from '../../safety-plan-preview/hydrate-safety-plan-activity-sections';\n\n//#endregion\n\n//#region ----- Constants -----\n\nconst SAFETY_PLAN_SECTION_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanSection.name}`;\nconst SECTION_TYPE_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.sectionType.name}`;\n\n//#endregion\n\n//#region ----- Public API -----\n\n/**\n * Loads a safety plan's section structure for the existing preview modal\n * (same shape the sections page feeds into AXMSafetyPlanPreviewService).\n */\nexport async function loadSafetyPlanPreviewStructure(\n entityService: AXPEntityService,\n translationService: AXTranslationService,\n planId: string,\n): Promise<AXMSafetyPlanSectionBuilderValue> {\n const editable = await loadSafetyPlanEditableStructure(entityService, translationService, planId);\n // Activity sections reference SafetyPlanActivity; hydrate nested section items for preview.\n return hydrateSafetyPlanActivitySectionsForPreview(entityService, translationService, editable);\n}\n\n/**\n * Loads section structure for editing (Fill / sections page shape).\n * Skips preview-only activity hydration so the builder can persist cleanly.\n */\nexport async function loadSafetyPlanEditableStructure(\n entityService: AXPEntityService,\n translationService: AXTranslationService,\n planId: string,\n): Promise<AXMSafetyPlanSectionBuilderValue> {\n const repeatableSectionTypeIds = await loadRepeatableSectionTypeIds(entityService);\n\n const result = await 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 return hydrateCatalogItemSnapshots(entityService, translationService, deduped);\n}\n\n//#endregion\n\n//#region ----- Helpers -----\n\nasync function loadRepeatableSectionTypeIds(entityService: AXPEntityService): Promise<string[]> {\n const builtIn = collectBuiltInRepeatableSectionTypeIds();\n try {\n const result = await 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\nasync function hydrateCatalogItemSnapshots(\n entityService: AXPEntityService,\n translationService: AXTranslationService,\n value: AXMSafetyPlanSectionBuilderValue,\n): Promise<AXMSafetyPlanSectionBuilderValue> {\n const locale = translationService.getActiveLang?.() ?? 'en-US';\n const missingByEntity = new Map<string, Set<string>>();\n\n for (const section of value.sections) {\n if (isActivitySectionType(section.sectionTypeId, section.sectionType)) {\n continue;\n }\n 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 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//#endregion\n"],"names":[],"mappings":";;;;;AAAA;AAmBA;AAEA;AAEA,MAAM,0BAA0B,GAAG,CAAA,EAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAA,CAAA,EAAI,UAAU,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,EAAE;AAC5G,MAAM,mBAAmB,GAAG,CAAA,EAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAA,CAAA,EAAI,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE;AAE/F;AAEA;AAEA;;;AAGG;AACI,eAAe,8BAA8B,CAClD,aAA+B,EAC/B,kBAAwC,EACxC,MAAc,EAAA;IAEd,MAAM,QAAQ,GAAG,MAAM,+BAA+B,CAAC,aAAa,EAAE,kBAAkB,EAAE,MAAM,CAAC;;IAEjG,OAAO,2CAA2C,CAAC,aAAa,EAAE,kBAAkB,EAAE,QAAQ,CAAC;AACjG;AAEA;;;AAGG;AACI,eAAe,+BAA+B,CACnD,aAA+B,EAC/B,kBAAwC,EACxC,MAAc,EAAA;AAEd,IAAA,MAAM,wBAAwB,GAAG,MAAM,4BAA4B,CAAC,aAAa,CAAC;AAElF,IAAA,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;AACrF,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,IAAI,EAAE,IAAI;AACV,QA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,QAAA,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,MAAM;AACzC,YAAA,GAAG,OAAO;AACV,YAAA,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,MAAM;AAClC,gBAAA,GAAG,IAAI;AACP,gBAAA,KAAK,EAAE,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,KAAI;oBAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;oBACpF,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;oBACjC,OAAO;wBACL,EAAE;wBACF,KAAK,EAAE,uBAAuB,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,MAAM,EAAE,KAAK;wBAChE,IAAI,EAAE,uBAAuB,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,MAAM,EAAE,IAAI;qBAC9D;AACH,gBAAA,CAAC,CAAC;AACH,aAAA,CAAC,CAAC;AACJ,SAAA,CAAC,CAAC;KACJ;AACH;AAEA;;"}
@@ -4,9 +4,9 @@ import { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/t
4
4
  import * as i0 from '@angular/core';
5
5
  import { inject, Injectable } from '@angular/core';
6
6
  import { get, isString, isEmpty, defaultTo } from 'lodash';
7
- import { A as AXMSafetyPlanPreviewService } from './acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-TrVl3-T6.mjs';
7
+ import { A as AXMSafetyPlanPreviewService } from './acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-Q2vVYxP-.mjs';
8
8
  import { l as loadSafetyPlanFillValues } from './acorex-platform-module-workplacesafety-management-client-safety-plan-fill-values.util-RLOdySf7.mjs';
9
- import { l as loadSafetyPlanPreviewStructure } from './acorex-platform-module-workplacesafety-management-client-load-safety-plan-preview-structure-Ce67NSIZ.mjs';
9
+ import { l as loadSafetyPlanPreviewStructure } from './acorex-platform-module-workplacesafety-management-client-load-safety-plan-preview-structure-DgfDb0uz.mjs';
10
10
 
11
11
  //#region ----- Imports -----
12
12
  //#endregion
@@ -99,4 +99,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
99
99
  }] });
100
100
 
101
101
  export { AXMPreviewSafetyPlanCommand };
102
- //# sourceMappingURL=acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-DJqqiYlD.mjs.map
102
+ //# sourceMappingURL=acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-CqJHTLNq.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-DJqqiYlD.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan/commands/preview-safety-plan.command.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { resolveEntityRowDisplayText } from '@acorex-platform/framework-client/common';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport type { AXPCommand, AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\nimport { defaultTo, get, isEmpty, isString } from 'lodash';\n\nimport { AXMSafetyPlanPreviewService } from '../../safety-plan-preview/safety-plan-preview.service';\nimport { loadSafetyPlanFillValues } from '../../safety-plan-preview/safety-plan-fill-values.util';\nimport { loadSafetyPlanPreviewStructure } from './load-safety-plan-preview-structure';\n\n//#endregion\n\n//#region ----- Types -----\n\nexport interface AXMPreviewSafetyPlanCommandInput {\n id?: string;\n title?: string;\n data?: Record<string, unknown>;\n options?: Partial<AXMPreviewSafetyPlanCommandInput>;\n __context__?: {\n entity?: string;\n data?: { id?: string; title?: unknown };\n options?: { id?: string; title?: unknown };\n };\n}\n\n//#endregion\n\n//#region ----- Command -----\n\n@Injectable()\nexport class AXMPreviewSafetyPlanCommand implements AXPCommand<AXMPreviewSafetyPlanCommandInput, void> {\n //#region ----- Services & Dependencies -----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly translationService = inject(AXTranslationService);\n private readonly previewService = inject(AXMSafetyPlanPreviewService);\n\n //#endregion\n\n //#region ----- Command Implementation -----\n\n async execute(input: AXMPreviewSafetyPlanCommandInput = {}): AXPCommandExecuteResultPromise<void> {\n try {\n const planId = this.resolvePlanId(input);\n if (!planId) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),\n },\n };\n }\n\n const structure = await loadSafetyPlanPreviewStructure(\n this.entityService,\n this.translationService,\n planId,\n );\n const fillValues = await loadSafetyPlanFillValues(this.entityService, planId);\n const dialogTitle = await this.resolveDialogTitle(input);\n\n await this.previewService.open({\n title: dialogTitle,\n structure,\n planId,\n fillValues,\n });\n\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: { refresh: false },\n };\n } catch {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync('@general:messages.generic.error.description'),\n },\n };\n }\n }\n\n //#endregion\n\n //#region ----- Utility Methods -----\n\n private resolvePlanId(input: AXMPreviewSafetyPlanCommandInput): string | undefined {\n const context = input.__context__;\n const candidates = [\n input.id,\n input.options?.id,\n get(input, 'options.id'),\n context?.options?.id,\n context?.data?.id,\n input.data?.['id'],\n ];\n\n for (const candidate of candidates) {\n if (isString(candidate) && !isEmpty(candidate.trim())) {\n return candidate.trim();\n }\n }\n\n return undefined;\n }\n\n private async resolveDialogTitle(input: AXMPreviewSafetyPlanCommandInput): Promise<string> {\n const previewLabel =\n (await this.translationService.translateAsync('@general:actions.preview.title')) || 'Preview';\n const locale = this.translationService.getActiveLang?.() ?? 'en-US';\n\n const explicitTitle = defaultTo(\n input.title,\n defaultTo(input.options?.title, defaultTo(get(input, 'options.title'), input.__context__?.options?.title)),\n );\n if (isString(explicitTitle) && explicitTitle.trim().length > 0) {\n return `${previewLabel}: ${resolveMultiLanguageString(explicitTitle, locale).trim()}`;\n }\n\n const contextTitle = defaultTo(input.data?.['title'], input.__context__?.data?.title);\n if (contextTitle != null) {\n const recordTitle = resolveEntityRowDisplayText(contextTitle, locale).trim();\n if (recordTitle.length > 0) {\n return `${previewLabel}: ${recordTitle}`;\n }\n }\n\n return previewLabel;\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;AAAA;AA6BA;AAEA;MAGa,2BAA2B,CAAA;AADxC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,2BAA2B,CAAC;AAkGtE,IAAA;;;AA5FC,IAAA,MAAM,OAAO,CAAC,KAAA,GAA0C,EAAE,EAAA;AACxD,QAAA,IAAI;YACF,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;YACxC,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO;AACL,oBAAA,OAAO,EAAE,KAAK;AACd,oBAAA,OAAO,EAAE;wBACP,IAAI,EAAE,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,uCAAuC,CAAC;AAC5F,qBAAA;iBACF;YACH;AAEA,YAAA,MAAM,SAAS,GAAG,MAAM,8BAA8B,CACpD,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,kBAAkB,EACvB,MAAM,CACP;YACD,MAAM,UAAU,GAAG,MAAM,wBAAwB,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC;YAC7E,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC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../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan/commands/preview-safety-plan.command.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { resolveEntityRowDisplayText } from '@acorex-platform/framework-client/common';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport type { AXPCommand, AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\nimport { defaultTo, get, isEmpty, isString } from 'lodash';\n\nimport { AXMSafetyPlanPreviewService } from '../../safety-plan-preview/safety-plan-preview.service';\nimport { loadSafetyPlanFillValues } from '../../safety-plan-preview/safety-plan-fill-values.util';\nimport { loadSafetyPlanPreviewStructure } from './load-safety-plan-preview-structure';\n\n//#endregion\n\n//#region ----- Types -----\n\nexport interface AXMPreviewSafetyPlanCommandInput {\n id?: string;\n title?: string;\n data?: Record<string, unknown>;\n options?: Partial<AXMPreviewSafetyPlanCommandInput>;\n __context__?: {\n entity?: string;\n data?: { id?: string; title?: unknown };\n options?: { id?: string; title?: unknown };\n };\n}\n\n//#endregion\n\n//#region ----- Command -----\n\n@Injectable()\nexport class AXMPreviewSafetyPlanCommand implements AXPCommand<AXMPreviewSafetyPlanCommandInput, void> {\n //#region ----- Services & Dependencies -----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly translationService = inject(AXTranslationService);\n private readonly previewService = inject(AXMSafetyPlanPreviewService);\n\n //#endregion\n\n //#region ----- Command Implementation -----\n\n async execute(input: AXMPreviewSafetyPlanCommandInput = {}): AXPCommandExecuteResultPromise<void> {\n try {\n const planId = this.resolvePlanId(input);\n if (!planId) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),\n },\n };\n }\n\n const structure = await loadSafetyPlanPreviewStructure(\n this.entityService,\n this.translationService,\n planId,\n );\n const fillValues = await loadSafetyPlanFillValues(this.entityService, planId);\n const dialogTitle = await this.resolveDialogTitle(input);\n\n await this.previewService.open({\n title: dialogTitle,\n structure,\n planId,\n fillValues,\n });\n\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: { refresh: false },\n };\n } catch {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync('@general:messages.generic.error.description'),\n },\n };\n }\n }\n\n //#endregion\n\n //#region ----- Utility Methods -----\n\n private resolvePlanId(input: AXMPreviewSafetyPlanCommandInput): string | undefined {\n const context = input.__context__;\n const candidates = [\n input.id,\n input.options?.id,\n get(input, 'options.id'),\n context?.options?.id,\n context?.data?.id,\n input.data?.['id'],\n ];\n\n for (const candidate of candidates) {\n if (isString(candidate) && !isEmpty(candidate.trim())) {\n return candidate.trim();\n }\n }\n\n return undefined;\n }\n\n private async resolveDialogTitle(input: AXMPreviewSafetyPlanCommandInput): Promise<string> {\n const previewLabel =\n (await this.translationService.translateAsync('@general:actions.preview.title')) || 'Preview';\n const locale = this.translationService.getActiveLang?.() ?? 'en-US';\n\n const explicitTitle = defaultTo(\n input.title,\n defaultTo(input.options?.title, defaultTo(get(input, 'options.title'), input.__context__?.options?.title)),\n );\n if (isString(explicitTitle) && explicitTitle.trim().length > 0) {\n return `${previewLabel}: ${resolveMultiLanguageString(explicitTitle, locale).trim()}`;\n }\n\n const contextTitle = defaultTo(input.data?.['title'], input.__context__?.data?.title);\n if (contextTitle != null) {\n const recordTitle = resolveEntityRowDisplayText(contextTitle, locale).trim();\n if (recordTitle.length > 0) {\n return `${previewLabel}: ${recordTitle}`;\n }\n }\n\n return previewLabel;\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;AAAA;AA6BA;AAEA;MAGa,2BAA2B,CAAA;AADxC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,cAAc,GAAG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I,GAAG,OAAO,CAAC,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,EAAE,KAAK,CAAC;AACrF,QAAA,IAAI,YAAY,IAAI,IAAI,EAAE;YACxB,MAAM,WAAW,GAAG,2BAA2B,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE;AAC5E,YAAA,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;AAC1B,gBAAA,OAAO,CAAA,EAAG,YAAY,CAAA,EAAA,EAAK,WAAW,EAAE;YAC1C;QACF;AAEA,QAAA,OAAO,YAAY;IACrB;8GApGW,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA3B,2BAA2B,EAAA,CAAA,CAAA;;2FAA3B,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBADvC;;;"}
@@ -1,4 +1,4 @@
1
- import { AXPDialogRendererComponent } from '@acorex-platform/framework-client/layout/builder';
1
+ import { AXPDialogOpener, AXPDialogRendererComponent } from '@acorex-platform/framework-client/layout/builder';
2
2
  import { AXMFormTemplateTypes } from '@acorex-platform/module-assessment-management-client/contracts';
3
3
  import { AXPopupService } from '@acorex/components/popup';
4
4
  import * as i0 from '@angular/core';
@@ -276,6 +276,7 @@ class AXMShowJobDocSetupCommand {
276
276
  constructor() {
277
277
  //#region ----- Services & Dependencies -----
278
278
  this.popupService = inject(AXPopupService);
279
+ this.dialogOpener = inject(AXPDialogOpener);
279
280
  }
280
281
  //#endregion
281
282
  //#region ----- Command -----
@@ -291,28 +292,48 @@ class AXMShowJobDocSetupCommand {
291
292
  },
292
293
  },
293
294
  };
294
- const dialogResult = await new Promise((resolve) => {
295
- this.popupService.open(AXPDialogRendererComponent, {
296
- title: dialogConfig.title,
297
- size: 'md',
298
- closeButton: true,
299
- closeOnBackdropClick: false,
300
- draggable: true,
301
- data: {
302
- config: dialogConfig,
303
- callBack: (result) => {
304
- if (typeof result?.close === 'function') {
305
- result.close();
306
- }
307
- const actionName = result?.action?.();
308
- resolve({
309
- context: result?.context?.() ?? dialogConfig.context,
310
- action: typeof actionName === 'string' && actionName.length > 0 ? actionName : 'cancel',
311
- });
295
+ const outcome = await this.dialogOpener.run({
296
+ load: () => Promise.resolve(AXPDialogRendererComponent),
297
+ data: { title: dialogConfig.title, size: 'md' },
298
+ present: (notifyShown, component) => new Promise((resolve) => {
299
+ let settled = false;
300
+ const finish = (value) => {
301
+ if (settled) {
302
+ return;
303
+ }
304
+ settled = true;
305
+ resolve(value);
306
+ };
307
+ const opened = this.popupService.open(component, {
308
+ title: dialogConfig.title,
309
+ size: 'md',
310
+ closeButton: true,
311
+ closeOnBackdropClick: false,
312
+ draggable: true,
313
+ data: {
314
+ config: dialogConfig,
315
+ callBack: (result) => {
316
+ if (typeof result?.close === 'function') {
317
+ result.close();
318
+ }
319
+ const actionName = result?.action?.();
320
+ finish({
321
+ context: result?.context?.() ?? dialogConfig.context,
322
+ action: typeof actionName === 'string' && actionName.length > 0 ? actionName : 'cancel',
323
+ });
324
+ },
312
325
  },
313
- },
314
- });
326
+ });
327
+ notifyShown();
328
+ void opened.finally(() => {
329
+ finish({ context: dialogConfig.context, action: 'cancel' });
330
+ });
331
+ }),
315
332
  });
333
+ if (outcome.duplicate) {
334
+ return { success: false };
335
+ }
336
+ const dialogResult = outcome.result;
316
337
  const data = (dialogResult?.context ?? {});
317
338
  const rawAction = dialogResult?.action;
318
339
  let action = 'cancel';
@@ -338,4 +359,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
338
359
  }] });
339
360
 
340
361
  export { AXMShowJobDocSetupCommand, SHOW_JOB_DOC_SETUP_COMMAND_KEY };
341
- //# sourceMappingURL=acorex-platform-module-workplacesafety-management-client-show-job-doc-setup.command-UlWyzIXQ.mjs.map
362
+ //# sourceMappingURL=acorex-platform-module-workplacesafety-management-client-show-job-doc-setup.command-B0g4JL0B.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-show-job-doc-setup.command-B0g4JL0B.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/job-doc/show-job-doc-setup.command.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport {\n AXPDialogOpener,\n AXPDialogRendererComponent,\n type DialogRendererConfig,\n type DialogRendererResult,\n} from '@acorex-platform/framework-client/layout/builder';\nimport type { AXPActionMenuItem, AXPWidgetNode } from '@acorex-platform/framework-shared/core';\nimport type { AXPCommand, AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXMFormTemplateTypes } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { AXPopupService } from '@acorex/components/popup';\nimport { Injectable, inject } from '@angular/core';\n\n//#endregion\n\n//#region ----- Constants -----\n\n/** Frontend workflow activity. Layout is built here so dialog expressions are not pre-evaluated. */\nexport const SHOW_JOB_DOC_SETUP_COMMAND_KEY = 'WorkplaceSafetyManagement.JobDoc:ShowSetup';\n\nconst I18N = '@workplacesafety-management:job-doc';\nconst REQUIRED = [{ rule: 'required', message: '@general:validation.messages.required' }];\nconst IMPOSSIBLE_PARTY_ID = '00000000-0000-0000-0000-000000000000';\nconst PROJECT_ENTITY = 'ProjectManagement.Project';\n\nconst key = (suffix: string): string => `${I18N}.${suffix}`;\n\n//#endregion\n\n//#region ----- Layout -----\n\nfunction field(\n label: string,\n child: AXPWidgetNode,\n extra?: AXPWidgetNode['options'],\n visible?: string,\n): AXPWidgetNode {\n return {\n type: 'form-field',\n ...(visible ? { visible } : {}),\n options: {\n label,\n showLabel: true,\n ...(visible ? { visible } : {}),\n ...extra,\n },\n children: [child],\n };\n}\n\nfunction gridItem(child: AXPWidgetNode, visible?: string): AXPWidgetNode {\n return {\n type: 'grid-item-layout',\n ...(visible ? { visible } : {}),\n options: {\n colSpan: 12,\n ...(visible ? { visible } : {}),\n },\n children: [child],\n };\n}\n\nfunction lookup(path: string, options: AXPWidgetNode['options']): AXPWidgetNode {\n return {\n type: 'lookup-editor',\n path,\n name: path,\n options,\n };\n}\n\n/** Same shape as entity-form visibility, for example `{{ context.eval(\"hasAttachments\") }}`. */\nfunction sourceIs(source: 'questionnaire' | 'form'): string {\n return `{{ context.eval(\"contentSource\") == \"${source}\" }}`;\n}\n\nfunction buildJobDocSetupLayout(): AXPWidgetNode {\n return {\n type: 'grid-layout',\n mode: 'edit',\n options: {\n grid: {\n default: {\n columns: 'repeat(12, 1fr)',\n rows: 'repeat(9, auto)',\n gap: '20px',\n },\n },\n },\n children: [\n gridItem(\n field(key('setup.source'), {\n type: 'selection-list-editor',\n path: 'contentSource',\n name: 'contentSource',\n options: {\n multiple: false,\n direction: { id: 'horizontal' },\n valueField: 'id',\n textField: 'title',\n dataSource: [\n { id: 'questionnaire', title: key('setup.sources.questionnaire') },\n { id: 'form', title: key('setup.sources.form') },\n ],\n validations: REQUIRED,\n },\n triggers: [\n {\n event: \"{{ events.context('contentSource') }}\",\n action:\n \"{{ context.set('questionnaireId', context.eval('contentSource') == 'questionnaire' ? context.eval('questionnaireId') : null); context.set('templateId', context.eval('contentSource') == 'form' ? context.eval('templateId') : null); }}\",\n },\n ],\n }),\n ),\n gridItem(\n field(\n key('setup.questionnaire'),\n lookup('questionnaireId', {\n entity: 'AssessmentManagement.Questionnaire',\n textField: 'title',\n valueField: 'id',\n look: 'select',\n expose: [{ source: 'id', target: 'questionnaireId' }],\n validations: REQUIRED,\n }),\n undefined,\n sourceIs('questionnaire'),\n ),\n sourceIs('questionnaire'),\n ),\n gridItem(\n field(\n key('setup.form'),\n lookup('templateId', {\n entity: 'AssessmentManagement.Template',\n textField: 'title',\n valueField: 'id',\n look: 'select',\n expose: [\n { source: 'id', target: 'templateId' },\n { source: 'title', target: 'templateTitle' },\n ],\n filter: {\n logic: 'and',\n filters: [\n {\n field: 'type.id',\n operator: { type: 'equal' },\n value: AXMFormTemplateTypes.Form.id,\n },\n ],\n },\n validations: REQUIRED,\n }),\n undefined,\n sourceIs('form'),\n ),\n sourceIs('form'),\n ),\n gridItem(\n field(\n key('setup.assignee'),\n lookup('assigneeUserId', {\n entity: 'SecurityManagement.User',\n textField: 'displayName',\n valueField: 'id',\n look: 'select',\n columns: ['displayName', 'username'],\n expose: [\n { source: 'id', target: 'assigneeUserId' },\n { source: 'displayName', target: 'assigneeUser.displayName' },\n ],\n validations: REQUIRED,\n }),\n ),\n ),\n gridItem(\n field(\n key('setup.sign-offs'),\n lookup('signOffUserIds', {\n entity: 'SecurityManagement.User',\n textField: 'displayName',\n valueField: 'id',\n look: 'select',\n multiple: true,\n allowClear: true,\n columns: ['displayName', 'username'],\n expose: [{ source: 'id', target: 'signOffUserIds' }],\n }),\n { description: key('setup.sign-off-help') },\n ),\n ),\n gridItem(\n field(\n key('setup.project'),\n lookup('projectId', {\n entity: PROJECT_ENTITY,\n textField: 'title',\n valueField: 'id',\n look: 'select',\n columns: [\n 'code',\n 'title',\n { name: 'customerId', visible: false },\n { name: 'contactAssignmentId', visible: false },\n { name: 'locationAssignmentId', visible: false },\n ],\n expose: [\n { source: 'id', target: 'projectId' },\n { source: 'title', target: 'projectTitle' },\n { source: 'customerId', target: 'customerId' },\n { source: 'customer.partyId', target: 'customer.partyId' },\n { source: 'contactAssignmentId', target: 'projectContactAssignmentId' },\n { source: 'locationAssignmentId', target: 'projectLocationAssignmentId' },\n ],\n validations: REQUIRED,\n }),\n ),\n ),\n gridItem(\n field(\n key('setup.customer'),\n lookup('customerId', {\n entity: 'CustomerManagement.Customer',\n textField: 'party.title',\n valueField: 'id',\n look: 'select',\n columns: ['party.code', 'party.title', { name: 'partyId', visible: false }],\n expose: [\n { source: 'id', target: 'customer.id' },\n { source: 'party.title', target: 'customer.title' },\n { source: 'partyId', target: 'customer.partyId' },\n ],\n }),\n ),\n ),\n gridItem(\n field(key('setup.contact'), {\n ...lookup('contactAssignmentId', {\n entity: 'PersonCore.ContactAssignment',\n textField: 'person.fullName',\n valueField: 'id',\n look: 'select',\n disabled: '{{ !context.eval(\"customerId\") }}',\n columns: ['person.fullName', 'role.title'],\n expose: [\n { source: 'id', target: 'contactAssignment.id' },\n { source: 'person.fullName', target: 'contactAssignment.person.fullName' },\n ],\n filter: {\n logic: 'and',\n filters: [\n {\n field: 'partyId',\n operator: { type: 'equal' },\n value: `{{ context.eval(\"customer.partyId\") || \"${IMPOSSIBLE_PARTY_ID}\" }}`,\n },\n ],\n },\n }),\n triggers: [\n {\n event: \"{{ events.context('customerId') }}\",\n action:\n \"{{ widget.setValue(null); context.set('contactAssignmentId', null); context.set('contactAssignment', null); widget.refresh(); }}\",\n },\n {\n event: \"{{ events.context('customer.partyId') }}\",\n action: '{{ widget.refresh(); }}',\n },\n {\n event: \"{{ events.context('projectContactAssignmentId') }}\",\n action:\n \"{{ setTimeout(() => { widget.setValue(context.eval('projectContactAssignmentId')); context.set('contactAssignmentId', context.eval('projectContactAssignmentId')); widget.refresh(); }, 0); }}\",\n },\n ],\n }),\n ),\n gridItem(\n field(key('setup.location'), {\n ...lookup('locationAssignmentId', {\n entity: 'LocationManagement.LocationAssignment',\n textField: 'location.title',\n valueField: 'id',\n look: 'select',\n disabled: '{{ !context.eval(\"customerId\") }}',\n columns: ['location.title', 'role.title', 'location.street1', 'location.city.title'],\n expose: [\n { source: 'id', target: 'locationAssignment.id' },\n { source: 'location.title', target: 'locationAssignment.title' },\n ],\n filter: {\n logic: 'and',\n filters: [\n {\n field: 'ownerRef.type',\n operator: { type: 'equal' },\n value: 'CustomerManagement.Customer',\n },\n {\n field: 'ownerRef.id',\n operator: { type: 'equal' },\n value: '{{ context.eval(\"customerId\") }}',\n },\n ],\n },\n }),\n triggers: [\n {\n event: \"{{ events.context('customerId') }}\",\n action:\n \"{{ widget.setValue(null); context.set('locationAssignmentId', null); context.set('locationAssignment', null); widget.refresh(); }}\",\n },\n {\n event: \"{{ events.context('projectLocationAssignmentId') }}\",\n action:\n \"{{ setTimeout(() => { widget.setValue(context.eval('projectLocationAssignmentId')); context.set('locationAssignmentId', context.eval('projectLocationAssignmentId')); widget.refresh(); }, 0); }}\",\n },\n ],\n }),\n ),\n ],\n };\n}\n\nconst setupActions: { prefix: AXPActionMenuItem[]; suffix: AXPActionMenuItem[] } = {\n prefix: [],\n suffix: [\n {\n title: '@general:actions.cancel.title',\n icon: 'fa-times',\n color: 'default',\n command: { name: 'cancel' },\n },\n {\n title: '@general:actions.submit.title',\n icon: 'fa-check',\n color: 'primary',\n command: { name: 'submit', options: { validate: true } },\n },\n ],\n};\n\n//#endregion\n\n//#region ----- Command -----\n\n@Injectable()\nexport class AXMShowJobDocSetupCommand implements AXPCommand<void, Record<string, unknown>> {\n //#region ----- Services & Dependencies -----\n\n private readonly popupService = inject(AXPopupService);\n private readonly dialogOpener = inject(AXPDialogOpener);\n\n //#endregion\n\n //#region ----- Command -----\n\n async execute(): AXPCommandExecuteResultPromise<Record<string, unknown>> {\n const dialogConfig: DialogRendererConfig = {\n title: key('setup.title'),\n context: { contentSource: 'questionnaire' },\n definition: buildJobDocSetupLayout(),\n actions: {\n footer: {\n prefix: setupActions.prefix,\n suffix: setupActions.suffix,\n },\n },\n };\n\n const outcome = await this.dialogOpener.run({\n load: () => Promise.resolve(AXPDialogRendererComponent),\n data: { title: dialogConfig.title, size: 'md' },\n present: (notifyShown, component) =>\n new Promise<DialogRendererResult>((resolve) => {\n let settled = false;\n const finish = (value: DialogRendererResult) => {\n if (settled) {\n return;\n }\n settled = true;\n resolve(value);\n };\n const opened = this.popupService.open(component, {\n title: dialogConfig.title,\n size: 'md',\n closeButton: true,\n closeOnBackdropClick: false,\n draggable: true,\n data: {\n config: dialogConfig,\n callBack: (result: { close?: () => void; context?: () => Record<string, unknown>; action?: () => string | undefined }) => {\n if (typeof result?.close === 'function') {\n result.close();\n }\n const actionName = result?.action?.();\n finish({\n context: result?.context?.() ?? dialogConfig.context,\n action: typeof actionName === 'string' && actionName.length > 0 ? actionName : 'cancel',\n });\n },\n },\n });\n notifyShown();\n void opened.finally(() => {\n finish({ context: dialogConfig.context, action: 'cancel' });\n });\n }),\n });\n\n if (outcome.duplicate) {\n return { success: false };\n }\n\n const dialogResult = outcome.result;\n\n const data = (dialogResult?.context ?? {}) as Record<string, unknown>;\n const rawAction = dialogResult?.action;\n let action = 'cancel';\n if (typeof rawAction === 'string' && rawAction.length > 0) {\n action = rawAction;\n } else if (rawAction && typeof rawAction === 'object' && 'name' in rawAction) {\n const name = (rawAction as { name?: string }).name;\n action = name && name.length > 0 ? name : 'cancel';\n }\n\n return {\n success: true,\n kind: 'object',\n data,\n metadata: { outcome: action },\n };\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;AAAA;AAcA;AAEA;AAEA;AACO,MAAM,8BAA8B,GAAG;AAE9C,MAAM,IAAI,GAAG,qCAAqC;AAClD,MAAM,QAAQ,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,uCAAuC,EAAE,CAAC;AACzF,MAAM,mBAAmB,GAAG,sCAAsC;AAClE,MAAM,cAAc,GAAG,2BAA2B;AAElD,MAAM,GAAG,GAAG,CAAC,MAAc,KAAa,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,MAAM,CAAA,CAAE;AAE3D;AAEA;AAEA,SAAS,KAAK,CACZ,KAAa,EACb,KAAoB,EACpB,KAAgC,EAChC,OAAgB,EAAA;IAEhB,OAAO;AACL,QAAA,IAAI,EAAE,YAAY;AAClB,QAAA,IAAI,OAAO,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;AAC/B,QAAA,OAAO,EAAE;YACP,KAAK;AACL,YAAA,SAAS,EAAE,IAAI;AACf,YAAA,IAAI,OAAO,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;AAC/B,YAAA,GAAG,KAAK;AACT,SAAA;QACD,QAAQ,EAAE,CAAC,KAAK,CAAC;KAClB;AACH;AAEA,SAAS,QAAQ,CAAC,KAAoB,EAAE,OAAgB,EAAA;IACtD,OAAO;AACL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FW,yBAAyB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAzB,yBAAyB,EAAA,CAAA,CAAA;;2FAAzB,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBADrC;;;"}
@@ -1,2 +1,2 @@
1
- export { A as AXMWorkplaceSafetyManagementMenuProvider, a as AXMWorkplaceSafetyManagementModule, b as AXMWorkplaceSafetyManagementSearchCommandProvider } from './acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-C2CZZwOj.mjs';
1
+ export { A as AXMWorkplaceSafetyManagementMenuProvider, a as AXMWorkplaceSafetyManagementModule, b as AXMWorkplaceSafetyManagementSearchCommandProvider } from './acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-CQsOLmlJ.mjs';
2
2
  //# sourceMappingURL=acorex-platform-module-workplacesafety-management-client.mjs.map
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@acorex-platform/module-workplacesafety-management-client",
3
- "version": "0.0.57",
3
+ "version": "0.0.58",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "@acorex-platform/module-data-management-client": "0.0.57",
6
+ "@acorex-platform/module-data-management-client": "0.0.58",
7
7
  "@angular/common": "^21.0.0 || ^22.0.0",
8
8
  "@angular/core": "^21.0.0 || ^22.0.0"
9
9
  },
@@ -1 +0,0 @@
1
- {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-TrVl3-T6.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-preview/safety-plan-preview.service.ts","../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-preview/hydrate-safety-plan-activity-sections.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { Injectable, inject } from '@angular/core';\nimport { AXPopupService } from '@acorex/components/popup';\nimport { AXPDeviceService } from '@acorex-platform/framework-client/core';\n\nimport type {\n AXMSafetyPlanPreviewOpenOptions,\n AXMSafetyPlanPreviewResult,\n AXMSafetyPlanPreviewWorkflowActionSet,\n} from './safety-plan-preview.types';\n\n//#endregion\n\n//#region ----- Service -----\n\n@Injectable({ providedIn: 'root' })\nexport class AXMSafetyPlanPreviewService {\n //#region ----- Services & Dependencies -----\n\n private readonly popupService = inject(AXPopupService);\n private readonly deviceService = inject(AXPDeviceService);\n\n //#endregion\n\n //#region ----- Public API -----\n\n async open(options: AXMSafetyPlanPreviewOpenOptions): Promise<AXMSafetyPlanPreviewResult | null> {\n const { AXMSafetyPlanPreviewModalComponent } = await import('./safety-plan-preview-modal.component');\n const workflowActionSet = this.resolveWorkflowActionSet(options);\n const result = await this.popupService.open(AXMSafetyPlanPreviewModalComponent, {\n title: options.title,\n size: this.deviceService.isSmall() ? 'full' : 'lg',\n data: {\n structure: options.structure,\n workflowActionSet,\n editable: options.editable === true,\n planId: options.planId,\n fillValues: options.fillValues ?? {},\n },\n });\n\n return (result?.data as AXMSafetyPlanPreviewResult | undefined) ?? null;\n }\n\n //#endregion\n\n //#region ----- Helpers -----\n\n private resolveWorkflowActionSet(\n options: AXMSafetyPlanPreviewOpenOptions,\n ): AXMSafetyPlanPreviewWorkflowActionSet | undefined {\n if (\n options.workflowActionSet === 'draft' ||\n options.workflowActionSet === 'assigned' ||\n options.workflowActionSet === 'locked'\n ) {\n return options.workflowActionSet;\n }\n if (options.showWorkflowActions === true) {\n return 'draft';\n }\n return undefined;\n }\n\n //#endregion\n}\n\n//#endregion\n\n","//#region ----- Imports -----\n\nimport { resolveEntityRowDisplayText } from '@acorex-platform/framework-client/common';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport {\n asSafetyPlanDisplayText,\n isActivitySectionType,\n mapSafetyPlanActivityItemsToSectionSnapshots,\n resolveEntityRefId,\n resolveSectionItemEntityName,\n RootConfig,\n type AXMSafetyPlanActivitySectionSnapshot,\n type AXMSafetyPlanSectionBuilderValue,\n type AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel,\n} from '@acorex-platform/module-workplacesafety-management-client/contracts';\nimport { AXTranslationService } from '@acorex/core/translation';\n\n//#endregion\n\n//#region ----- Public API -----\n\n/**\n * Loads each Activity catalog row's predefined `items` onto `activityRow.sections`\n * and fills missing catalog item titles for preview rendering.\n */\nexport async function hydrateSafetyPlanActivitySectionsForPreview(\n entityService: AXPEntityService,\n translationService: AXTranslationService,\n value: AXMSafetyPlanSectionBuilderValue,\n): Promise<AXMSafetyPlanSectionBuilderValue> {\n const activityIds = collectActivityIdsNeedingSections(value);\n if (activityIds.length === 0) {\n return value;\n }\n\n const loadedById = await loadSafetyPlanActivitiesById(entityService, activityIds);\n if (loadedById.size === 0) {\n return value;\n }\n\n const withSections: AXMSafetyPlanSectionBuilderValue = {\n sections: value.sections.map((section) => {\n if (!isActivitySectionType(section.sectionTypeId, section.sectionType)) {\n return section;\n }\n return {\n ...section,\n items: section.items.map((item) => {\n const activityId = resolveEntityRefId(item.id) ?? resolveEntityRefId(item.itemIds?.[0]);\n if (!activityId) {\n return item;\n }\n const loaded = loadedById.get(activityId);\n if (!loaded) {\n return item;\n }\n const existingRow = item.activityRow;\n return {\n ...item,\n activityRow: {\n ...existingRow,\n title: existingRow?.title || loaded.title,\n code: existingRow?.code || loaded.code,\n description: existingRow?.description || loaded.description,\n sections: loaded.sections,\n },\n };\n }),\n };\n }),\n };\n\n return hydrateNestedActivityCatalogSnapshots(entityService, translationService, withSections);\n}\n\n//#endregion\n\n//#region ----- Helpers -----\n\nfunction collectActivityIdsNeedingSections(value: AXMSafetyPlanSectionBuilderValue): string[] {\n const ids = new Set<string>();\n for (const section of value.sections) {\n if (!isActivitySectionType(section.sectionTypeId, section.sectionType)) {\n continue;\n }\n for (const item of section.items ?? []) {\n const hasSections = (item.activityRow?.sections?.length ?? 0) > 0;\n if (hasSections) {\n continue;\n }\n const activityId = resolveEntityRefId(item.id) ?? resolveEntityRefId(item.itemIds?.[0]);\n if (activityId) {\n ids.add(activityId);\n }\n }\n }\n return [...ids];\n}\n\nasync function loadSafetyPlanActivitiesById(\n entityService: AXPEntityService,\n activityIds: string[],\n): Promise<\n Map<\n string,\n {\n title?: string;\n code?: string;\n description?: string;\n sections: AXMSafetyPlanActivitySectionSnapshot[];\n }\n >\n> {\n const entityKey = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanActivity.name}`;\n const loaded = new Map<\n string,\n {\n title?: string;\n code?: string;\n description?: string;\n sections: AXMSafetyPlanActivitySectionSnapshot[];\n }\n >();\n\n await Promise.all(\n activityIds.map(async (id) => {\n try {\n const row = await entityService.withEntity(entityKey).data().byKey(id);\n if (!row) {\n return;\n }\n const record = row as {\n title?: string;\n code?: string;\n description?: string;\n items?: AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel[];\n };\n loaded.set(id, {\n title: typeof record.title === 'string' ? record.title : undefined,\n code: typeof record.code === 'string' ? record.code : undefined,\n description: typeof record.description === 'string' ? record.description : undefined,\n sections: mapSafetyPlanActivityItemsToSectionSnapshots(record.items),\n });\n } catch {\n /* skip activities the session cannot read */\n }\n }),\n );\n\n return loaded;\n}\n\nasync function hydrateNestedActivityCatalogSnapshots(\n entityService: AXPEntityService,\n translationService: AXTranslationService,\n value: AXMSafetyPlanSectionBuilderValue,\n): Promise<AXMSafetyPlanSectionBuilderValue> {\n const locale = translationService.getActiveLang?.() ?? 'en-US';\n const missingByEntity = new Map<string, Set<string>>();\n\n for (const section of value.sections) {\n if (!isActivitySectionType(section.sectionTypeId, section.sectionType)) {\n continue;\n }\n for (const item of section.items ?? []) {\n for (const activitySection of item.activityRow?.sections ?? []) {\n const entityName = resolveSectionItemEntityName(\n activitySection.sectionTypeId,\n activitySection.sectionType,\n );\n if (!entityName) {\n continue;\n }\n for (const id of activitySection.itemIds ?? []) {\n const snapshot = activitySection.items?.find((entry) => entry.id === id);\n if (asSafetyPlanDisplayText(snapshot?.title) || asSafetyPlanDisplayText(snapshot?.code)) {\n continue;\n }\n const ids = missingByEntity.get(entityName) ?? new Set<string>();\n ids.add(id);\n missingByEntity.set(entityName, ids);\n }\n }\n }\n }\n\n if (missingByEntity.size === 0) {\n return value;\n }\n\n const loadedById = new Map<string, { title?: string; code?: string }>();\n await Promise.all(\n [...missingByEntity.entries()].map(async ([entityName, ids]) => {\n const idList = [...ids];\n try {\n const result = await entityService.withEntity(entityName).data().query({\n skip: 0,\n take: Math.max(idList.length, 1),\n filter:\n idList.length === 1\n ? { field: 'id', operator: { type: 'equal' }, value: idList[0] }\n : { field: 'id', operator: { type: 'in' }, value: idList },\n } as never);\n for (const row of result.items ?? []) {\n const record = row as unknown as Record<string, unknown>;\n const id = resolveEntityRefId(record['id']);\n if (!id) {\n continue;\n }\n loadedById.set(id, {\n title: resolveEntityRowDisplayText(record['title'], locale) || undefined,\n code: asSafetyPlanDisplayText(record['code']) || undefined,\n });\n }\n } catch {\n /* skip entities the session cannot read */\n }\n }),\n );\n\n if (loadedById.size === 0) {\n return value;\n }\n\n return {\n sections: value.sections.map((section) => ({\n ...section,\n items: section.items.map((item) => {\n if (!item.activityRow?.sections?.length) {\n return item;\n }\n return {\n ...item,\n activityRow: {\n ...item.activityRow,\n sections: item.activityRow.sections.map((activitySection) => ({\n ...activitySection,\n items: (activitySection.itemIds ?? []).map((id, index) => {\n const existing =\n activitySection.items?.find((entry) => entry.id === id) ??\n activitySection.items?.[index];\n const loaded = loadedById.get(id);\n return {\n id,\n title: asSafetyPlanDisplayText(existing?.title) || loaded?.title,\n code: asSafetyPlanDisplayText(existing?.code) || loaded?.code,\n };\n }),\n })),\n },\n };\n }),\n })),\n };\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;AAAA;AAYA;AAEA;MAGa,2BAA2B,CAAA;AADxC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AA6C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-management-client-show-job-doc-setup.command-UlWyzIXQ.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/job-doc/show-job-doc-setup.command.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport {\n AXPDialogRendererComponent,\n type DialogRendererConfig,\n type DialogRendererResult,\n} from '@acorex-platform/framework-client/layout/builder';\nimport type { AXPActionMenuItem, AXPWidgetNode } from '@acorex-platform/framework-shared/core';\nimport type { AXPCommand, AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXMFormTemplateTypes } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { AXPopupService } from '@acorex/components/popup';\nimport { Injectable, inject } from '@angular/core';\n\n//#endregion\n\n//#region ----- Constants -----\n\n/** Frontend workflow activity. Layout is built here so dialog expressions are not pre-evaluated. */\nexport const SHOW_JOB_DOC_SETUP_COMMAND_KEY = 'WorkplaceSafetyManagement.JobDoc:ShowSetup';\n\nconst I18N = '@workplacesafety-management:job-doc';\nconst REQUIRED = [{ rule: 'required', message: '@general:validation.messages.required' }];\nconst IMPOSSIBLE_PARTY_ID = '00000000-0000-0000-0000-000000000000';\nconst PROJECT_ENTITY = 'ProjectManagement.Project';\n\nconst key = (suffix: string): string => `${I18N}.${suffix}`;\n\n//#endregion\n\n//#region ----- Layout -----\n\nfunction field(\n label: string,\n child: AXPWidgetNode,\n extra?: AXPWidgetNode['options'],\n visible?: string,\n): AXPWidgetNode {\n return {\n type: 'form-field',\n ...(visible ? { visible } : {}),\n options: {\n label,\n showLabel: true,\n ...(visible ? { visible } : {}),\n ...extra,\n },\n children: [child],\n };\n}\n\nfunction gridItem(child: AXPWidgetNode, visible?: string): AXPWidgetNode {\n return {\n type: 'grid-item-layout',\n ...(visible ? { visible } : {}),\n options: {\n colSpan: 12,\n ...(visible ? { visible } : {}),\n },\n children: [child],\n };\n}\n\nfunction lookup(path: string, options: AXPWidgetNode['options']): AXPWidgetNode {\n return {\n type: 'lookup-editor',\n path,\n name: path,\n options,\n };\n}\n\n/** Same shape as entity-form visibility, for example `{{ context.eval(\"hasAttachments\") }}`. */\nfunction sourceIs(source: 'questionnaire' | 'form'): string {\n return `{{ context.eval(\"contentSource\") == \"${source}\" }}`;\n}\n\nfunction buildJobDocSetupLayout(): AXPWidgetNode {\n return {\n type: 'grid-layout',\n mode: 'edit',\n options: {\n grid: {\n default: {\n columns: 'repeat(12, 1fr)',\n rows: 'repeat(9, auto)',\n gap: '20px',\n },\n },\n },\n children: [\n gridItem(\n field(key('setup.source'), {\n type: 'selection-list-editor',\n path: 'contentSource',\n name: 'contentSource',\n options: {\n multiple: false,\n direction: { id: 'horizontal' },\n valueField: 'id',\n textField: 'title',\n dataSource: [\n { id: 'questionnaire', title: key('setup.sources.questionnaire') },\n { id: 'form', title: key('setup.sources.form') },\n ],\n validations: REQUIRED,\n },\n triggers: [\n {\n event: \"{{ events.context('contentSource') }}\",\n action:\n \"{{ context.set('questionnaireId', context.eval('contentSource') == 'questionnaire' ? context.eval('questionnaireId') : null); context.set('templateId', context.eval('contentSource') == 'form' ? context.eval('templateId') : null); }}\",\n },\n ],\n }),\n ),\n gridItem(\n field(\n key('setup.questionnaire'),\n lookup('questionnaireId', {\n entity: 'AssessmentManagement.Questionnaire',\n textField: 'title',\n valueField: 'id',\n look: 'select',\n expose: [{ source: 'id', target: 'questionnaireId' }],\n validations: REQUIRED,\n }),\n undefined,\n sourceIs('questionnaire'),\n ),\n sourceIs('questionnaire'),\n ),\n gridItem(\n field(\n key('setup.form'),\n lookup('templateId', {\n entity: 'AssessmentManagement.Template',\n textField: 'title',\n valueField: 'id',\n look: 'select',\n expose: [\n { source: 'id', target: 'templateId' },\n { source: 'title', target: 'templateTitle' },\n ],\n filter: {\n logic: 'and',\n filters: [\n {\n field: 'type.id',\n operator: { type: 'equal' },\n value: AXMFormTemplateTypes.Form.id,\n },\n ],\n },\n validations: REQUIRED,\n }),\n undefined,\n sourceIs('form'),\n ),\n sourceIs('form'),\n ),\n gridItem(\n field(\n key('setup.assignee'),\n lookup('assigneeUserId', {\n entity: 'SecurityManagement.User',\n textField: 'displayName',\n valueField: 'id',\n look: 'select',\n columns: ['displayName', 'username'],\n expose: [\n { source: 'id', target: 'assigneeUserId' },\n { source: 'displayName', target: 'assigneeUser.displayName' },\n ],\n validations: REQUIRED,\n }),\n ),\n ),\n gridItem(\n field(\n key('setup.sign-offs'),\n lookup('signOffUserIds', {\n entity: 'SecurityManagement.User',\n textField: 'displayName',\n valueField: 'id',\n look: 'select',\n multiple: true,\n allowClear: true,\n columns: ['displayName', 'username'],\n expose: [{ source: 'id', target: 'signOffUserIds' }],\n }),\n { description: key('setup.sign-off-help') },\n ),\n ),\n gridItem(\n field(\n key('setup.project'),\n lookup('projectId', {\n entity: PROJECT_ENTITY,\n textField: 'title',\n valueField: 'id',\n look: 'select',\n columns: [\n 'code',\n 'title',\n { name: 'customerId', visible: false },\n { name: 'contactAssignmentId', visible: false },\n { name: 'locationAssignmentId', visible: false },\n ],\n expose: [\n { source: 'id', target: 'projectId' },\n { source: 'title', target: 'projectTitle' },\n { source: 'customerId', target: 'customerId' },\n { source: 'customer.partyId', target: 'customer.partyId' },\n { source: 'contactAssignmentId', target: 'projectContactAssignmentId' },\n { source: 'locationAssignmentId', target: 'projectLocationAssignmentId' },\n ],\n validations: REQUIRED,\n }),\n ),\n ),\n gridItem(\n field(\n key('setup.customer'),\n lookup('customerId', {\n entity: 'CustomerManagement.Customer',\n textField: 'party.title',\n valueField: 'id',\n look: 'select',\n columns: ['party.code', 'party.title', { name: 'partyId', visible: false }],\n expose: [\n { source: 'id', target: 'customer.id' },\n { source: 'party.title', target: 'customer.title' },\n { source: 'partyId', target: 'customer.partyId' },\n ],\n }),\n ),\n ),\n gridItem(\n field(key('setup.contact'), {\n ...lookup('contactAssignmentId', {\n entity: 'PersonCore.ContactAssignment',\n textField: 'person.fullName',\n valueField: 'id',\n look: 'select',\n disabled: '{{ !context.eval(\"customerId\") }}',\n columns: ['person.fullName', 'role.title'],\n expose: [\n { source: 'id', target: 'contactAssignment.id' },\n { source: 'person.fullName', target: 'contactAssignment.person.fullName' },\n ],\n filter: {\n logic: 'and',\n filters: [\n {\n field: 'partyId',\n operator: { type: 'equal' },\n value: `{{ context.eval(\"customer.partyId\") || \"${IMPOSSIBLE_PARTY_ID}\" }}`,\n },\n ],\n },\n }),\n triggers: [\n {\n event: \"{{ events.context('customerId') }}\",\n action:\n \"{{ widget.setValue(null); context.set('contactAssignmentId', null); context.set('contactAssignment', null); widget.refresh(); }}\",\n },\n {\n event: \"{{ events.context('customer.partyId') }}\",\n action: '{{ widget.refresh(); }}',\n },\n {\n event: \"{{ events.context('projectContactAssignmentId') }}\",\n action:\n \"{{ setTimeout(() => { widget.setValue(context.eval('projectContactAssignmentId')); context.set('contactAssignmentId', context.eval('projectContactAssignmentId')); widget.refresh(); }, 0); }}\",\n },\n ],\n }),\n ),\n gridItem(\n field(key('setup.location'), {\n ...lookup('locationAssignmentId', {\n entity: 'LocationManagement.LocationAssignment',\n textField: 'location.title',\n valueField: 'id',\n look: 'select',\n disabled: '{{ !context.eval(\"customerId\") }}',\n columns: ['location.title', 'role.title', 'location.street1', 'location.city.title'],\n expose: [\n { source: 'id', target: 'locationAssignment.id' },\n { source: 'location.title', target: 'locationAssignment.title' },\n ],\n filter: {\n logic: 'and',\n filters: [\n {\n field: 'ownerRef.type',\n operator: { type: 'equal' },\n value: 'CustomerManagement.Customer',\n },\n {\n field: 'ownerRef.id',\n operator: { type: 'equal' },\n value: '{{ context.eval(\"customerId\") }}',\n },\n ],\n },\n }),\n triggers: [\n {\n event: \"{{ events.context('customerId') }}\",\n action:\n \"{{ widget.setValue(null); context.set('locationAssignmentId', null); context.set('locationAssignment', null); widget.refresh(); }}\",\n },\n {\n event: \"{{ events.context('projectLocationAssignmentId') }}\",\n action:\n \"{{ setTimeout(() => { widget.setValue(context.eval('projectLocationAssignmentId')); context.set('locationAssignmentId', context.eval('projectLocationAssignmentId')); widget.refresh(); }, 0); }}\",\n },\n ],\n }),\n ),\n ],\n };\n}\n\nconst setupActions: { prefix: AXPActionMenuItem[]; suffix: AXPActionMenuItem[] } = {\n prefix: [],\n suffix: [\n {\n title: '@general:actions.cancel.title',\n icon: 'fa-times',\n color: 'default',\n command: { name: 'cancel' },\n },\n {\n title: '@general:actions.submit.title',\n icon: 'fa-check',\n color: 'primary',\n command: { name: 'submit', options: { validate: true } },\n },\n ],\n};\n\n//#endregion\n\n//#region ----- Command -----\n\n@Injectable()\nexport class AXMShowJobDocSetupCommand implements AXPCommand<void, Record<string, unknown>> {\n //#region ----- Services & Dependencies -----\n\n private readonly popupService = inject(AXPopupService);\n\n //#endregion\n\n //#region ----- Command -----\n\n async execute(): AXPCommandExecuteResultPromise<Record<string, unknown>> {\n const dialogConfig: DialogRendererConfig = {\n title: key('setup.title'),\n context: { contentSource: 'questionnaire' },\n definition: buildJobDocSetupLayout(),\n actions: {\n footer: {\n prefix: setupActions.prefix,\n suffix: setupActions.suffix,\n },\n },\n };\n\n const dialogResult = await new Promise<DialogRendererResult>((resolve) => {\n this.popupService.open(AXPDialogRendererComponent, {\n title: dialogConfig.title,\n size: 'md',\n closeButton: true,\n closeOnBackdropClick: false,\n draggable: true,\n data: {\n config: dialogConfig,\n callBack: (result: { close?: () => void; context?: () => Record<string, unknown>; action?: () => string | undefined }) => {\n if (typeof result?.close === 'function') {\n result.close();\n }\n const actionName = result?.action?.();\n resolve({\n context: result?.context?.() ?? dialogConfig.context,\n action: typeof actionName === 'string' && actionName.length > 0 ? actionName : 'cancel',\n });\n },\n },\n });\n });\n\n const data = (dialogResult?.context ?? {}) as Record<string, unknown>;\n const rawAction = dialogResult?.action;\n let action = 'cancel';\n if (typeof rawAction === 'string' && rawAction.length > 0) {\n action = rawAction;\n } else if (rawAction && typeof rawAction === 'object' && 'name' in rawAction) {\n const name = (rawAction as { name?: string }).name;\n action = name && name.length > 0 ? name : 'cancel';\n }\n\n return {\n success: true,\n kind: 'object',\n data,\n metadata: { outcome: action },\n };\n }\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