@acorex-platform/extension-health-human-capital-management-client 0.0.21
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-extension-health-human-capital-management-client-acorex-platform-extension-health-human-capital-management-client-C6Xgmw5Z.mjs +598 -0
- package/fesm2022/acorex-platform-extension-health-human-capital-management-client-acorex-platform-extension-health-human-capital-management-client-C6Xgmw5Z.mjs.map +1 -0
- package/fesm2022/acorex-platform-extension-health-human-capital-management-client-contracts.mjs +16 -0
- package/fesm2022/acorex-platform-extension-health-human-capital-management-client-contracts.mjs.map +1 -0
- package/fesm2022/acorex-platform-extension-health-human-capital-management-client-edit-my-health-profile.command-Xmbl54L5.mjs +141 -0
- package/fesm2022/acorex-platform-extension-health-human-capital-management-client-edit-my-health-profile.command-Xmbl54L5.mjs.map +1 -0
- package/fesm2022/acorex-platform-extension-health-human-capital-management-client-manage-my-health-conditions.command-Dkvx6R-w.mjs +78 -0
- package/fesm2022/acorex-platform-extension-health-human-capital-management-client-manage-my-health-conditions.command-Dkvx6R-w.mjs.map +1 -0
- package/fesm2022/acorex-platform-extension-health-human-capital-management-client-manage-my-health-entity-list-dialog.service-DqmxkgFo.mjs +108 -0
- package/fesm2022/acorex-platform-extension-health-human-capital-management-client-manage-my-health-entity-list-dialog.service-DqmxkgFo.mjs.map +1 -0
- package/fesm2022/acorex-platform-extension-health-human-capital-management-client-manage-my-health-events.command-CI2pOceW.mjs +111 -0
- package/fesm2022/acorex-platform-extension-health-human-capital-management-client-manage-my-health-events.command-CI2pOceW.mjs.map +1 -0
- package/fesm2022/acorex-platform-extension-health-human-capital-management-client.mjs +2 -0
- package/fesm2022/acorex-platform-extension-health-human-capital-management-client.mjs.map +1 -0
- package/package.json +28 -0
- package/types/acorex-platform-extension-health-human-capital-management-client-contracts.d.ts +9 -0
- package/types/acorex-platform-extension-health-human-capital-management-client.d.ts +36 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-extension-health-human-capital-management-client-acorex-platform-extension-health-human-capital-management-client-C6Xgmw5Z.mjs","sources":["../../../../libs/extensions/health/human-capital-management/client/src/lib/employee-health.entity-modifier.ts","../../../../libs/extensions/health/human-capital-management/client/src/lib/health-subject-resolver.service.ts","../../../../libs/extensions/health/human-capital-management/client/src/lib/profile-page/health-hcm-profile-groups.hook.ts","../../../../libs/extensions/health/human-capital-management/client/src/lib/profile-page/health-profile-insights.util.ts","../../../../libs/extensions/health/human-capital-management/client/src/lib/profile-page/health-hcm-profile-sections-insights.hook.ts","../../../../libs/extensions/health/human-capital-management/client/src/lib/profile-page/health-hcm-profile-sections.hook.ts","../../../../libs/extensions/health/human-capital-management/client/src/lib/health-hcm-extension.module.ts","../../../../libs/extensions/health/human-capital-management/client/src/acorex-platform-extension-health-human-capital-management-client.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport {\n HEALTH_PERSON_SUBJECT_TYPE,\n healthPersonSubjectReferenceConditions,\n RootConfig as HealthCoreConfig,\n} from '@acorex-platform/module-health-core-client/contracts';\nimport { RootConfig as HcmRootConfig } from '@acorex-platform/module-human-capital-management-client/contracts';\nimport { AXPEntityAction, AXPEntityCommandScope, entityDetailsCrudActions } from '@acorex-platform/framework-shared/entity';\nimport { AXPEntityModifierProvider } from '@acorex-platform/framework-client/layout/entity';\n\n//#endregion\n\n//#region ---- Helpers ----\n\nfunction healthEventStartActions(): AXPEntityAction[] {\n return [\n {\n title: '@health-core:health-events.actions.start.title',\n icon: 'fa-light fa-play',\n command: {\n name: 'Entity:Create',\n options: {\n process: {\n redirect: false,\n canCreateNewOne: true,\n data: {},\n },\n },\n },\n priority: 'primary',\n type: 'create',\n scope: AXPEntityCommandScope.TypeLevel,\n items:\n `{{ await ${HealthCoreConfig.module.name}.HealthEvents('${HEALTH_PERSON_SUBJECT_TYPE}') }}` as unknown as AXPEntityAction[],\n },\n ];\n}\n\nfunction healthRecordCreateAction(titleKey: string): AXPEntityAction {\n return {\n title: titleKey,\n icon: 'fa-light fa-plus',\n command: {\n name: 'Entity:Create',\n options: {\n process: {\n redirect: false,\n data: {\n subject: {\n type: HEALTH_PERSON_SUBJECT_TYPE,\n id: '{{ context.eval(\"personId\") }}',\n title:\n '{{ context.eval(\"person.fullName\") || (context.eval(\"person.firstName\") + \" \" + context.eval(\"person.lastName\")) }}',\n },\n },\n },\n },\n },\n priority: 'primary',\n type: 'create',\n scope: AXPEntityCommandScope.TypeLevel,\n };\n}\n\n//#endregion\n\n//#region ---- Entity modifier ----\n\n/** Adds health-related entities to the HCM Employee detail view. */\nexport const AXEHealthHcmEmployeeHealthEntityModifier: AXPEntityModifierProvider = {\n entityName: HcmRootConfig.entities.employee.name,\n modifier: (ctx) => {\n ctx.relatedEntities.add(\n {\n entity: `${HealthCoreConfig.module.name}.${HealthCoreConfig.entities.healthProfile.name}`,\n title: '@health-core:health-profiles.entities.health-profile.title',\n conditions: healthPersonSubjectReferenceConditions(),\n excludeProperties: ['subject.id'],\n layout: {\n type: 'page-detail', position: 'after', order: 6,\n },\n },\n {\n entity: `${HealthCoreConfig.module.name}.${HealthCoreConfig.entities.healthCondition.name}`,\n title: '@health-core:health-conditions.entities.health-condition.plural',\n conditions: healthPersonSubjectReferenceConditions(),\n excludeProperties: ['subject.id'],\n actions: [\n healthRecordCreateAction('@health-core:health-conditions.actions.create.title'),\n ...entityDetailsCrudActions('subject.id', { create: false }),\n ],\n layout: { type: 'page-list', position: 'after', order: 7 },\n },\n {\n entity: `${HealthCoreConfig.module.name}.${HealthCoreConfig.entities.healthEvent.name}`,\n title: '@health-core:health-events.entities.health-event.plural',\n columns: ['recordTypeId', 'occurredDate', 'endDate', 'provider', 'statusId'],\n conditions: healthPersonSubjectReferenceConditions(),\n excludeProperties: ['subject.id'],\n actions: [\n ...healthEventStartActions(),\n ...entityDetailsCrudActions('subject.id', { create: false, edit: false, delete: false, view: false }),\n ],\n layout: { type: 'page-list', position: 'after', order: 8 },\n },\n );\n },\n};\n\n//#endregion\n","//#region ----- Imports -----\n\nimport { inject, Injectable } from '@angular/core';\nimport type { AXPEntityReference } from '@acorex-platform/framework-shared/core';\n\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { first, get } from 'lodash-es';\n\nimport { RootConfig as HcmRootConfig } from '@acorex-platform/module-human-capital-management-client/contracts';\nimport { RootConfig as PersonCoreConfig } from '@acorex-platform/module-person-core-client/contracts';\n\n//#endregion\n\n//#region ----- Types -----\n\nexport type AXEHealthSubjectContext = {\n personSubject: AXPEntityReference | null;\n employeeSubject: AXPEntityReference | null;\n};\n\ntype EmployeePersonSnapshot = {\n id?: string;\n fullName?: string;\n firstName?: string;\n lastName?: string;\n};\n\ntype EmployeeRow = {\n id: string;\n personId?: string;\n person?: EmployeePersonSnapshot;\n employeeCode?: string;\n};\n\n//#endregion\n\n//#region ----- Service -----\n\n/** Resolves polymorphic health subjects from the current user's HCM employee (includes person). */\n@Injectable({ providedIn: 'root' })\nexport class AXEHealthSubjectResolverService {\n //#region ----- Services & Dependencies -----\n\n private readonly sessionService = inject(AXPSessionService);\n private readonly entityService = inject(AXPEntityService);\n\n //#endregion\n\n //#region ----- State Signals -----\n\n private cachedUserId: string | null = null;\n private cachedContext: AXEHealthSubjectContext | null = null;\n private inflight: Promise<AXEHealthSubjectContext> | null = null;\n\n //#endregion\n\n //#region ----- Public API -----\n\n async resolveForCurrentUser(): Promise<AXEHealthSubjectContext> {\n const userId = this.sessionService.user?.id;\n if (!userId) {\n this.clearCache();\n return { personSubject: null, employeeSubject: null };\n }\n\n if (this.cachedUserId === userId && this.cachedContext) {\n return this.cachedContext;\n }\n\n if (this.inflight && this.cachedUserId === userId) {\n return this.inflight;\n }\n\n this.cachedUserId = userId;\n this.inflight = this.loadContext(userId).finally(() => {\n this.inflight = null;\n });\n\n this.cachedContext = await this.inflight;\n return this.cachedContext;\n }\n\n clearCache(): void {\n this.cachedUserId = null;\n this.cachedContext = null;\n this.inflight = null;\n }\n\n //#endregion\n\n //#region ----- Private Methods -----\n\n private async loadContext(userId: string): Promise<AXEHealthSubjectContext> {\n const employee = await this.findEmployeeByUserId(userId);\n if (!employee) {\n return { personSubject: null, employeeSubject: null };\n }\n\n return {\n personSubject: this.toPersonSubjectFromEmployee(employee),\n employeeSubject: this.toEmployeeSubject(employee),\n };\n }\n\n private async findEmployeeByUserId(userId: string): Promise<EmployeeRow | undefined> {\n const employeeResult = await this.entityService\n .withEntity(HcmRootConfig.module.name, HcmRootConfig.entities.employee.name)\n .data<string, EmployeeRow>()\n .query({\n filter: { field: 'userId', operator: { type: 'equal' }, value: userId },\n take: 1,\n skip: 0,\n });\n\n return first(employeeResult.items);\n }\n\n private toEmployeeSubject(employee: EmployeeRow): AXPEntityReference {\n const employeeTitle = get(employee, 'person.fullName') || get(employee, 'employeeCode') || employee.id;\n\n return {\n type: `${HcmRootConfig.module.name}.${HcmRootConfig.entities.employee.name}`,\n id: employee.id,\n title: employeeTitle,\n };\n }\n\n private toPersonSubjectFromEmployee(employee: EmployeeRow): AXPEntityReference | null {\n const personId = get(employee, 'person.id') || get(employee, 'personId');\n if (!personId) {\n return null;\n }\n\n const personTitle =\n get(employee, 'person.fullName') ||\n `${get(employee, 'person.firstName', '')} ${get(employee, 'person.lastName', '')}`.trim() ||\n personId;\n\n return {\n type: `${PersonCoreConfig.module.name}.${PersonCoreConfig.entities.person.name}`,\n id: personId,\n title: personTitle,\n };\n }\n\n //#endregion\n}\n\n//#endregion\n","import { inject } from '@angular/core';\nimport { AXPDistributedEventListenerProvider } from '@acorex-platform/framework-client/core';\n\nimport {\n PROFILE_PAGE_GROUPS_HOOK,\n type AXPUserProfileGroupsPayload,\n} from '@acorex-platform/module-auth-client';\n\nimport { AXEHealthSubjectResolverService } from '../health-subject-resolver.service';\n\n//#region ---- Health profile group ----\n\n/** Adds the Health tab when the current user has a resolvable person health subject. */\nexport const HealthHcmProfileGroupsHookProvider: AXPDistributedEventListenerProvider<\n AXPUserProfileGroupsPayload,\n AXPUserProfileGroupsPayload\n> = {\n key: PROFILE_PAGE_GROUPS_HOOK,\n priority: 25,\n execute: async (payload) => {\n const subjectResolver = inject(AXEHealthSubjectResolverService);\n const subjects = await subjectResolver.resolveForCurrentUser();\n\n if (!subjects.personSubject) {\n return payload;\n }\n\n return {\n ...payload,\n groups: [\n ...payload.groups,\n {\n id: 'health',\n title: '@health-core:profile-page.groups.health.title',\n icon: 'far fa-heart-pulse',\n priority: 25,\n },\n ],\n };\n },\n};\n\n//#endregion\n","//#region ----- Imports -----\n\nimport type { AXMHealthCoreHealthProfileEntityModel } from '@acorex-platform/module-health-core-client/contracts';\nimport { isValidMultiLanguageObject, resolveMultiLanguageString } from '@acorex/core/translation';\n\nimport type { AXPUserProfileSectionInsight } from '@acorex-platform/module-auth-client';\n\n//#endregion\n\n//#region ----- Constants -----\n\nexport const HEALTH_PROFILE_SUMMARY_SECTION_ID = 'health-profile-summary';\n\nconst FIELD_TITLES = {\n bloodType: '@health-core:health-profiles.entities.health-profile.fields.blood-type-id',\n disabilityStatus: '@health-core:health-profiles.entities.health-profile.fields.disability-status-id',\n smokingStatus: '@health-core:health-profiles.entities.health-profile.fields.smoking-status',\n alcoholConsumption: '@health-core:health-profiles.entities.health-profile.fields.alcohol-consumption',\n healthRiskLevel: '@health-core:health-profiles.entities.health-profile.fields.health-risk-level',\n doctorName: '@health-core:health-profiles.entities.health-profile.fields.doctor-name',\n emergencyContactName: '@health-core:health-profiles.entities.health-profile.fields.emergency-contact-name',\n} as const;\n\nconst SMOKING_STATUS_LABELS: Record<string, string> = {\n never: '@health-core:datasources.smoking-status-options.samples.never',\n former: '@health-core:datasources.smoking-status-options.samples.former',\n current: '@health-core:datasources.smoking-status-options.samples.current',\n 'prefer-not-to-say': '@health-core:datasources.smoking-status-options.samples.prefer-not-to-say',\n};\n\nconst ALCOHOL_CONSUMPTION_LABELS: Record<string, string> = {\n never: '@health-core:datasources.alcohol-consumption-options.samples.never',\n occasional: '@health-core:datasources.alcohol-consumption-options.samples.occasional',\n regular: '@health-core:datasources.alcohol-consumption-options.samples.regular',\n heavy: '@health-core:datasources.alcohol-consumption-options.samples.heavy',\n 'prefer-not-to-say': '@health-core:datasources.alcohol-consumption-options.samples.prefer-not-to-say',\n};\n\nconst HEALTH_RISK_LEVEL_LABELS: Record<string, string> = {\n low: '@health-core:datasources.health-risk-level-options.samples.low',\n medium: '@health-core:datasources.health-risk-level-options.samples.medium',\n high: '@health-core:datasources.health-risk-level-options.samples.high',\n critical: '@health-core:datasources.health-risk-level-options.samples.critical',\n};\n\n//#endregion\n\n//#region ----- Insights -----\n\n/** Builds Medical Summary card insights from a health profile row. */\nexport function buildHealthProfileInsights(\n profile: AXMHealthCoreHealthProfileEntityModel,\n): AXPUserProfileSectionInsight[] {\n const insights: AXPUserProfileSectionInsight[] = [];\n\n const bloodTypeTitle = resolveLookupTitle(profile.bloodType?.title);\n if (bloodTypeTitle) {\n insights.push({\n id: 'blood-type',\n icon: 'far fa-droplet',\n title: FIELD_TITLES.bloodType,\n text: bloodTypeTitle,\n });\n }\n\n const disabilityTitle = resolveLookupTitle(profile.disabilityStatus?.title);\n if (disabilityTitle) {\n insights.push({\n id: 'disability-status',\n icon: 'far fa-wheelchair',\n title: FIELD_TITLES.disabilityStatus,\n text: disabilityTitle,\n });\n }\n\n const smokingLabel = resolveEnumLabel(profile.smokingStatus, SMOKING_STATUS_LABELS);\n if (smokingLabel) {\n insights.push({\n id: 'smoking-status',\n icon: 'far fa-smoking',\n title: FIELD_TITLES.smokingStatus,\n text: smokingLabel,\n });\n }\n\n const alcoholLabel = resolveEnumLabel(profile.alcoholConsumption, ALCOHOL_CONSUMPTION_LABELS);\n if (alcoholLabel) {\n insights.push({\n id: 'alcohol-consumption',\n icon: 'far fa-wine-glass',\n title: FIELD_TITLES.alcoholConsumption,\n text: alcoholLabel,\n });\n }\n\n const doctorName = profile.doctorName?.trim();\n if (doctorName) {\n insights.push({\n id: 'doctor-name',\n icon: 'far fa-user-doctor',\n title: FIELD_TITLES.doctorName,\n text: doctorName,\n });\n }\n\n const emergencyContact = profile.emergencyContactName?.trim();\n if (emergencyContact) {\n insights.push({\n id: 'emergency-contact',\n icon: 'far fa-user-nurse',\n title: FIELD_TITLES.emergencyContactName,\n text: emergencyContact,\n });\n }\n\n // Risk last so it stays visually distinct at the end of the badge row.\n const riskLabel = resolveEnumLabel(profile.healthRiskLevel, HEALTH_RISK_LEVEL_LABELS);\n if (riskLabel) {\n insights.push({\n id: 'health-risk-level',\n icon: 'far fa-triangle-exclamation',\n title: FIELD_TITLES.healthRiskLevel,\n text: riskLabel,\n });\n }\n\n return insights;\n}\n\nfunction resolveEnumLabel(value: string | undefined, labels: Record<string, string>): string | undefined {\n const key = value?.trim();\n if (!key) {\n return undefined;\n }\n\n return labels[key] ?? key;\n}\n\nfunction resolveLookupTitle(title: unknown): string | undefined {\n if (title == null) {\n return undefined;\n }\n\n if (typeof title === 'string') {\n const trimmed = title.trim();\n return trimmed.length ? trimmed : undefined;\n }\n\n if (isValidMultiLanguageObject(title)) {\n const resolved = resolveMultiLanguageString(title, 'en-US').trim();\n return resolved.length ? resolved : undefined;\n }\n\n return undefined;\n}\n\n//#endregion\n","//#region ----- Imports -----\n\nimport { inject } from '@angular/core';\nimport {\n HEALTH_PERSON_SUBJECT_TYPE,\n RootConfig as HealthCoreRootConfig,\n} from '@acorex-platform/module-health-core-client/contracts';\nimport type { AXMHealthCoreHealthProfileEntityModel } from '@acorex-platform/module-health-core-client/contracts';\nimport { AXPDistributedEventListenerProvider } from '@acorex-platform/framework-client/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport {\n PROFILE_PAGE_SECTIONS_HOOK,\n isUserProfileSectionsGroupRequested,\n type AXPUserProfileSectionsPayload,\n} from '@acorex-platform/module-auth-client';\n\nimport { AXEHealthCoreProfileCommandKeys } from '@acorex-platform/extension-health-human-capital-management-client/contracts';\nimport { AXEHealthSubjectResolverService } from '../health-subject-resolver.service';\nimport {\n HEALTH_PROFILE_SUMMARY_SECTION_ID,\n buildHealthProfileInsights,\n} from './health-profile-insights.util';\n\n//#endregion\n\n//#region ----- Health profile insights hook -----\n\n/** Adds live health profile summary and passes existing profile id into the edit action. */\nexport const HealthHcmProfileSectionsInsightsHookProvider: AXPDistributedEventListenerProvider<\n AXPUserProfileSectionsPayload,\n AXPUserProfileSectionsPayload\n> = {\n key: PROFILE_PAGE_SECTIONS_HOOK,\n priority: 26,\n execute: async (payload) => {\n if (!isUserProfileSectionsGroupRequested(payload, 'health')) {\n return payload;\n }\n\n const subjectResolver = inject(AXEHealthSubjectResolverService);\n const entityService = inject(AXPEntityService);\n const subjects = await subjectResolver.resolveForCurrentUser();\n const personSubject = subjects.personSubject;\n\n if (!personSubject?.id || !personSubject.type) {\n return payload;\n }\n\n const result = await entityService\n .withEntity(HealthCoreRootConfig.module.name, HealthCoreRootConfig.entities.healthProfile.name)\n .data<string, AXMHealthCoreHealthProfileEntityModel>()\n .query({\n filter: {\n logic: 'and',\n filters: [\n { field: 'subject.type', operator: { type: 'equal' }, value: HEALTH_PERSON_SUBJECT_TYPE },\n { field: 'subject.id', operator: { type: 'equal' }, value: personSubject.id },\n ],\n },\n take: 1,\n skip: 0,\n });\n\n const profile = result.items[0];\n const existingProfileId = profile?.id ?? null;\n const insights = profile ? buildHealthProfileInsights(profile) : [];\n\n return {\n ...payload,\n sections: payload.sections.map((section) => {\n if (section.id !== HEALTH_PROFILE_SUMMARY_SECTION_ID) {\n return section;\n }\n\n return {\n ...section,\n ...(insights.length ? { insights } : { insights: undefined }),\n actions: (section.actions ?? []).map((action) => {\n if (action.command?.name !== AXEHealthCoreProfileCommandKeys.Profile.EditMyHealthProfile) {\n return action;\n }\n\n return {\n ...action,\n command: {\n ...action.command,\n options: {\n ...(action.command.options ?? {}),\n existingProfileId,\n },\n },\n };\n }),\n };\n }),\n };\n },\n};\n\n//#endregion\n","import { inject } from '@angular/core';\nimport { AXPDistributedEventListenerProvider } from '@acorex-platform/framework-client/core';\n\nimport {\n PROFILE_PAGE_SECTIONS_HOOK,\n isUserProfileSectionsGroupRequested,\n type AXPUserProfileSection,\n type AXPUserProfileSectionsPayload,\n} from '@acorex-platform/module-auth-client';\n\nimport { AXEHealthCoreProfileCommandKeys } from '@acorex-platform/extension-health-human-capital-management-client/contracts';\nimport { AXEHealthSubjectResolverService } from '../health-subject-resolver.service';\n\n//#region ---- Health profile sections ----\n\n/** Contributes health section cards on the profile Health tab (person subject). */\nexport const HealthHcmProfileSectionsHookProvider: AXPDistributedEventListenerProvider<\n AXPUserProfileSectionsPayload,\n AXPUserProfileSectionsPayload\n> = {\n key: PROFILE_PAGE_SECTIONS_HOOK,\n priority: 25,\n execute: async (payload) => {\n if (!isUserProfileSectionsGroupRequested(payload, 'health')) {\n return payload;\n }\n\n const subjectResolver = inject(AXEHealthSubjectResolverService);\n const subjects = await subjectResolver.resolveForCurrentUser();\n\n if (!subjects.personSubject) {\n return payload;\n }\n\n const sections: AXPUserProfileSection[] = [\n {\n id: 'health-profile-summary',\n groupId: 'health',\n title: '@health-core:health-profiles.entities.health-profile.title',\n description: '@health-core:profile-page.sections.health-profile.description',\n icon: 'far fa-heart-pulse',\n priority: 10,\n layout: { colSpan: 6 },\n actions: [\n {\n name: 'manage-health-profile',\n title: '@general:actions.edit.title',\n icon: 'far fa-pen',\n command: {\n name: AXEHealthCoreProfileCommandKeys.Profile.EditMyHealthProfile,\n },\n default: true,\n },\n ],\n },\n {\n id: 'health-conditions',\n groupId: 'health',\n title: '@health-core:health-conditions.entities.health-condition.plural',\n description: '@health-core:profile-page.sections.health-conditions.description',\n icon: 'far fa-file-medical',\n priority: 20,\n layout: { colSpan: 6 },\n actions: [\n {\n name: 'manage-health-conditions',\n title: '@general:actions.edit.title',\n icon: 'far fa-pen',\n command: {\n name: AXEHealthCoreProfileCommandKeys.Profile.ManageMyHealthConditions,\n },\n default: true,\n },\n ],\n },\n {\n id: 'health-events',\n groupId: 'health',\n title: '@health-core:health-events.entities.health-event.plural',\n description: '@health-core:profile-page.sections.health-events.description',\n icon: 'far fa-notes-medical',\n priority: 30,\n layout: { colSpan: 6 },\n actions: [\n {\n name: 'manage-health-events',\n title: '@general:actions.edit.title',\n icon: 'far fa-pen',\n command: {\n name: AXEHealthCoreProfileCommandKeys.Profile.ManageMyHealthEvents,\n },\n default: true,\n },\n ],\n },\n ];\n\n return {\n ...payload,\n sections: [...payload.sections, ...sections],\n };\n },\n};\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXMHealthCoreModule } from '@acorex-platform/module-health-core-client';\nimport { AXMHumanCapitalManagementModule } from '@acorex-platform/module-human-capital-management-client';\nimport { AXP_DISTRIBUTED_EVENT_LISTENER_PROVIDER } from '@acorex-platform/framework-client/core';\nimport { AXP_ENTITY_MODIFIER } from '@acorex-platform/framework-client/layout/entity';\nimport { provideCommandSetups } from '@acorex-platform/framework-client/runtime';\nimport { NgModule } from '@angular/core';\n\nimport { AXEHealthCoreProfileCommandKeys } from '@acorex-platform/extension-health-human-capital-management-client/contracts';\nimport { AXEHealthHcmEmployeeHealthEntityModifier } from './employee-health.entity-modifier';\nimport { HealthHcmProfileGroupsHookProvider } from './profile-page/health-hcm-profile-groups.hook';\nimport { HealthHcmProfileSectionsInsightsHookProvider } from './profile-page/health-hcm-profile-sections-insights.hook';\nimport { HealthHcmProfileSectionsHookProvider } from './profile-page/health-hcm-profile-sections.hook';\n\n//#endregion\n\n//#region ---- Module ----\n\n/**\n * Bridges HealthCore health records with HCM Employee detail and My Profile Health tab.\n */\n@NgModule({\n imports: [AXMHealthCoreModule, AXMHumanCapitalManagementModule],\n providers: [\n {\n provide: AXP_ENTITY_MODIFIER,\n useValue: AXEHealthHcmEmployeeHealthEntityModifier,\n multi: true,\n },\n {\n provide: AXP_DISTRIBUTED_EVENT_LISTENER_PROVIDER,\n useValue: HealthHcmProfileGroupsHookProvider,\n multi: true,\n },\n {\n provide: AXP_DISTRIBUTED_EVENT_LISTENER_PROVIDER,\n useValue: HealthHcmProfileSectionsHookProvider,\n multi: true,\n },\n {\n provide: AXP_DISTRIBUTED_EVENT_LISTENER_PROVIDER,\n useValue: HealthHcmProfileSectionsInsightsHookProvider,\n multi: true,\n },\n provideCommandSetups([\n {\n key: AXEHealthCoreProfileCommandKeys.Profile.EditMyHealthProfile,\n command: () =>\n import('./profile-page/commands/edit-my-health-profile.command').then(\n (c) => c.AXEEditMyHealthProfileCommand,\n ),\n },\n {\n key: AXEHealthCoreProfileCommandKeys.Profile.ManageMyHealthConditions,\n command: () =>\n import('./profile-page/commands/manage-my-health-conditions.command').then(\n (c) => c.AXEManageMyHealthConditionsCommand,\n ),\n },\n {\n key: AXEHealthCoreProfileCommandKeys.Profile.ManageMyHealthEvents,\n command: () =>\n import('./profile-page/commands/manage-my-health-events.command').then(\n (c) => c.AXEManageMyHealthEventsCommand,\n ),\n },\n ]),\n ],\n})\nexport class AXEHealthHumanCapitalManagementExtensionModule {}\n\n//#endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["HealthCoreConfig","HcmRootConfig","PersonCoreConfig","HealthCoreRootConfig"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAWA;AAEA;AAEA,SAAS,uBAAuB,GAAA;IAC9B,OAAO;AACL,QAAA;AACE,YAAA,KAAK,EAAE,gDAAgD;AACvD,YAAA,IAAI,EAAE,kBAAkB;AACxB,YAAA,OAAO,EAAE;AACP,gBAAA,IAAI,EAAE,eAAe;AACrB,gBAAA,OAAO,EAAE;AACP,oBAAA,OAAO,EAAE;AACP,wBAAA,QAAQ,EAAE,KAAK;AACf,wBAAA,eAAe,EAAE,IAAI;AACrB,wBAAA,IAAI,EAAE,EAAE;AACT,qBAAA;AACF,iBAAA;AACF,aAAA;AACD,YAAA,QAAQ,EAAE,SAAS;AACnB,YAAA,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,qBAAqB,CAAC,SAAS;YACtC,KAAK,EACH,YAAYA,U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AACtD,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACD,wBAAA,oBAAoB,CAAC;AACnB,4BAAA;AACE,gCAAA,GAAG,EAAE,+BAA+B,CAAC,OAAO,CAAC,mBAAmB;AAChE,gCAAA,OAAO,EAAE,MACP,OAAO,gHAAwD,CAAC,CAAC,IAAI,CACnE,CAAC,CAAC,KAAK,CAAC,CAAC,6BAA6B,CACvC;AACJ,6BAAA;AACD,4BAAA;AACE,gCAAA,GAAG,EAAE,+BAA+B,CAAC,OAAO,CAAC,wBAAwB;AACrE,gCAAA,OAAO,EAAE,MACP,OAAO,qHAA6D,CAAC,CAAC,IAAI,CACxE,CAAC,CAAC,KAAK,CAAC,CAAC,kCAAkC,CAC5C;AACJ,6BAAA;AACD,4BAAA;AACE,gCAAA,GAAG,EAAE,+BAA+B,CAAC,OAAO,CAAC,oBAAoB;AACjE,gCAAA,OAAO,EAAE,MACP,OAAO,iHAAyD,CAAC,CAAC,IAAI,CACpE,CAAC,CAAC,KAAK,CAAC,CAAC,8BAA8B,CACxC;AACJ,6BAAA;yBACF,CAAC;AACH,qBAAA;AACF,iBAAA;;;ACrED;;AAEG;;;;"}
|
package/fesm2022/acorex-platform-extension-health-human-capital-management-client-contracts.mjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region ---- Command keys ----
|
|
2
|
+
const AXEHealthCoreProfileCommandKeys = {
|
|
3
|
+
Profile: {
|
|
4
|
+
EditMyHealthProfile: 'HealthCore.Profile:EditMyHealthProfile',
|
|
5
|
+
ManageMyHealthConditions: 'HealthCore.Profile:ManageMyHealthConditions',
|
|
6
|
+
ManageMyHealthEvents: 'HealthCore.Profile:ManageMyHealthEvents',
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Generated bundle index. Do not edit.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export { AXEHealthCoreProfileCommandKeys };
|
|
16
|
+
//# sourceMappingURL=acorex-platform-extension-health-human-capital-management-client-contracts.mjs.map
|
package/fesm2022/acorex-platform-extension-health-human-capital-management-client-contracts.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-extension-health-human-capital-management-client-contracts.mjs","sources":["../../../../libs/extensions/health/human-capital-management/contracts/src/commands.keys.ts","../../../../libs/extensions/health/human-capital-management/contracts/src/acorex-platform-extension-health-human-capital-management-client-contracts.ts"],"sourcesContent":["//#region ---- Command keys ----\n\nexport const AXEHealthCoreProfileCommandKeys = {\n Profile: {\n EditMyHealthProfile: 'HealthCore.Profile:EditMyHealthProfile',\n ManageMyHealthConditions: 'HealthCore.Profile:ManageMyHealthConditions',\n ManageMyHealthEvents: 'HealthCore.Profile:ManageMyHealthEvents',\n },\n} as const;\n\n//#endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAA;AAEO,MAAM,+BAA+B,GAAG;AAC7C,IAAA,OAAO,EAAE;AACP,QAAA,mBAAmB,EAAE,wCAAwC;AAC7D,QAAA,wBAAwB,EAAE,6CAA6C;AACvE,QAAA,oBAAoB,EAAE,yCAAyC;AAChE,KAAA;;AAGH;;ACVA;;AAEG;;;;"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { AXTranslationService } from '@acorex/core/translation';
|
|
2
|
+
import { RootConfig, HEALTH_PERSON_SUBJECT_TYPE } from '@acorex-platform/module-health-core-client/contracts';
|
|
3
|
+
import { runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';
|
|
4
|
+
import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
|
|
5
|
+
import { AXPCommandService } from '@acorex-platform/framework-client/runtime';
|
|
6
|
+
import * as i0 from '@angular/core';
|
|
7
|
+
import { inject, Injectable } from '@angular/core';
|
|
8
|
+
import { first } from 'lodash-es';
|
|
9
|
+
import { A as AXEHealthSubjectResolverService, H as HEALTH_PROFILE_SUMMARY_SECTION_ID, b as buildHealthProfileInsights } from './acorex-platform-extension-health-human-capital-management-client-acorex-platform-extension-health-human-capital-management-client-C6Xgmw5Z.mjs';
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region ----- Edit my health profile command -----
|
|
13
|
+
/** Opens create/update dialog for the current user's health profile (person subject). */
|
|
14
|
+
class AXEEditMyHealthProfileCommand {
|
|
15
|
+
constructor() {
|
|
16
|
+
//#region ----- Services & Dependencies -----
|
|
17
|
+
this.commandService = inject(AXPCommandService);
|
|
18
|
+
this.entityService = inject(AXPEntityService);
|
|
19
|
+
this.subjectResolver = inject(AXEHealthSubjectResolverService);
|
|
20
|
+
this.translateService = inject(AXTranslationService);
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region ----- Constants -----
|
|
23
|
+
this.entityKey = `${RootConfig.module.name}.${RootConfig.entities.healthProfile.name}`;
|
|
24
|
+
this.entityInfo = {
|
|
25
|
+
module: RootConfig.module.name,
|
|
26
|
+
name: RootConfig.entities.healthProfile.name,
|
|
27
|
+
title: RootConfig.entities.healthProfile.title,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region ----- Command -----
|
|
32
|
+
async execute(input = {}) {
|
|
33
|
+
const subjects = await this.subjectResolver.resolveForCurrentUser();
|
|
34
|
+
const personSubject = subjects.personSubject;
|
|
35
|
+
if (!personSubject?.id || !personSubject.type) {
|
|
36
|
+
return {
|
|
37
|
+
success: false,
|
|
38
|
+
message: {
|
|
39
|
+
text: await this.translateService.translateAsync('@health-core:profile-page.commands.manage-health-profile.messages.no-subject'),
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const dialogTitle = await this.translateService.translateAsync('@health-core:health-profiles.entities.health-profile.title');
|
|
44
|
+
const commandOptions = {
|
|
45
|
+
excludeProperties: ['subject.id'],
|
|
46
|
+
decoration: {
|
|
47
|
+
header: {
|
|
48
|
+
title: dialogTitle,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
layout: {
|
|
52
|
+
size: 'lg',
|
|
53
|
+
},
|
|
54
|
+
process: {
|
|
55
|
+
redirect: false,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
const existingProfileId = await this.resolveExistingProfileId(input, personSubject.id);
|
|
59
|
+
const commandResult = existingProfileId
|
|
60
|
+
? await this.commandService.execute('Entity:Edit', {
|
|
61
|
+
entity: this.entityKey,
|
|
62
|
+
entityInfo: this.entityInfo,
|
|
63
|
+
data: existingProfileId,
|
|
64
|
+
options: commandOptions,
|
|
65
|
+
})
|
|
66
|
+
: await this.commandService.execute('Entity:Create', {
|
|
67
|
+
entity: this.entityKey,
|
|
68
|
+
entityInfo: this.entityInfo,
|
|
69
|
+
data: {
|
|
70
|
+
subject: {
|
|
71
|
+
type: HEALTH_PERSON_SUBJECT_TYPE,
|
|
72
|
+
id: personSubject.id,
|
|
73
|
+
title: personSubject.title,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
options: commandOptions,
|
|
77
|
+
});
|
|
78
|
+
if (!commandResult?.success) {
|
|
79
|
+
return commandResult ?? { success: false };
|
|
80
|
+
}
|
|
81
|
+
const savedProfile = runtimeCommandPayloadData(commandResult);
|
|
82
|
+
const sectionPatch = this.buildSectionPatch(savedProfile);
|
|
83
|
+
return {
|
|
84
|
+
...commandResult,
|
|
85
|
+
metadata: {
|
|
86
|
+
...(commandResult.metadata ?? {}),
|
|
87
|
+
refresh: false,
|
|
88
|
+
...(sectionPatch ? { healthProfileSectionPatch: sectionPatch } : {}),
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region ----- Private Methods -----
|
|
94
|
+
buildSectionPatch(profile) {
|
|
95
|
+
if (!profile?.id) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
sectionId: HEALTH_PROFILE_SUMMARY_SECTION_ID,
|
|
100
|
+
insights: buildHealthProfileInsights(profile),
|
|
101
|
+
existingProfileId: profile.id,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
async resolveExistingProfileId(input, personId) {
|
|
105
|
+
if (typeof input.existingProfileId === 'string' && input.existingProfileId.trim()) {
|
|
106
|
+
return input.existingProfileId.trim();
|
|
107
|
+
}
|
|
108
|
+
// Insights hook already decided there is no profile — skip discovery Query.
|
|
109
|
+
if (input.existingProfileId === null) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
const existingProfile = await this.findProfileBySubject(HEALTH_PERSON_SUBJECT_TYPE, personId);
|
|
113
|
+
return existingProfile?.id ?? null;
|
|
114
|
+
}
|
|
115
|
+
async findProfileBySubject(subjectType, subjectId) {
|
|
116
|
+
const result = await this.entityService
|
|
117
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.healthProfile.name)
|
|
118
|
+
.data()
|
|
119
|
+
.query({
|
|
120
|
+
filter: {
|
|
121
|
+
logic: 'and',
|
|
122
|
+
filters: [
|
|
123
|
+
{ field: 'subject.type', operator: { type: 'equal' }, value: subjectType },
|
|
124
|
+
{ field: 'subject.id', operator: { type: 'equal' }, value: subjectId },
|
|
125
|
+
],
|
|
126
|
+
},
|
|
127
|
+
take: 1,
|
|
128
|
+
skip: 0,
|
|
129
|
+
});
|
|
130
|
+
return first(result.items);
|
|
131
|
+
}
|
|
132
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXEEditMyHealthProfileCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
133
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXEEditMyHealthProfileCommand, providedIn: 'root' }); }
|
|
134
|
+
}
|
|
135
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXEEditMyHealthProfileCommand, decorators: [{
|
|
136
|
+
type: Injectable,
|
|
137
|
+
args: [{ providedIn: 'root' }]
|
|
138
|
+
}] });
|
|
139
|
+
|
|
140
|
+
export { AXEEditMyHealthProfileCommand };
|
|
141
|
+
//# sourceMappingURL=acorex-platform-extension-health-human-capital-management-client-edit-my-health-profile.command-Xmbl54L5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-extension-health-human-capital-management-client-edit-my-health-profile.command-Xmbl54L5.mjs","sources":["../../../../libs/extensions/health/human-capital-management/client/src/lib/profile-page/commands/edit-my-health-profile.command.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport {\n HEALTH_PERSON_SUBJECT_TYPE,\n RootConfig as HealthCoreRootConfig,\n} from '@acorex-platform/module-health-core-client/contracts';\nimport type { AXMHealthCoreHealthProfileEntityModel } from '@acorex-platform/module-health-core-client/contracts';\nimport { runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';\n\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { first } from 'lodash-es';\n\nimport { AXEHealthSubjectResolverService } from '../../health-subject-resolver.service';\nimport {\n HEALTH_PROFILE_SUMMARY_SECTION_ID,\n buildHealthProfileInsights,\n} from '../health-profile-insights.util';\n\n//#endregion\n\n//#region ----- Types -----\n\ntype EditMyHealthProfileInput = {\n /** When set by the profile page insights hook, skips the discovery Query. */\n existingProfileId?: string | null;\n};\n\nexport type AXEHealthProfileSectionPatch = {\n sectionId: string;\n insights: ReturnType<typeof buildHealthProfileInsights>;\n existingProfileId: string | null;\n};\n\n//#endregion\n\n//#region ----- Edit my health profile command -----\n\n/** Opens create/update dialog for the current user's health profile (person subject). */\n@Injectable({ providedIn: 'root' })\nexport class AXEEditMyHealthProfileCommand implements AXPCommand {\n //#region ----- Services & Dependencies -----\n\n private readonly commandService = inject(AXPCommandService);\n private readonly entityService = inject(AXPEntityService);\n private readonly subjectResolver = inject(AXEHealthSubjectResolverService);\n private readonly translateService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ----- Constants -----\n\n private readonly entityKey = `${HealthCoreRootConfig.module.name}.${HealthCoreRootConfig.entities.healthProfile.name}`;\n\n private readonly entityInfo = {\n module: HealthCoreRootConfig.module.name,\n name: HealthCoreRootConfig.entities.healthProfile.name,\n title: HealthCoreRootConfig.entities.healthProfile.title,\n };\n\n //#endregion\n\n //#region ----- Command -----\n\n async execute(input: EditMyHealthProfileInput = {}): AXPCommandExecuteResultPromise<unknown> {\n const subjects = await this.subjectResolver.resolveForCurrentUser();\n const personSubject = subjects.personSubject;\n\n if (!personSubject?.id || !personSubject.type) {\n return {\n success: false,\n message: {\n text: await this.translateService.translateAsync(\n '@health-core:profile-page.commands.manage-health-profile.messages.no-subject',\n ),\n },\n };\n }\n\n const dialogTitle = await this.translateService.translateAsync(\n '@health-core:health-profiles.entities.health-profile.title',\n );\n\n const commandOptions = {\n excludeProperties: ['subject.id'],\n decoration: {\n header: {\n title: dialogTitle,\n },\n },\n layout: {\n size: 'lg',\n },\n process: {\n redirect: false,\n },\n };\n\n const existingProfileId = await this.resolveExistingProfileId(input, personSubject.id);\n\n const commandResult = existingProfileId\n ? await this.commandService.execute('Entity:Edit', {\n entity: this.entityKey,\n entityInfo: this.entityInfo,\n data: existingProfileId,\n options: commandOptions,\n })\n : await this.commandService.execute('Entity:Create', {\n entity: this.entityKey,\n entityInfo: this.entityInfo,\n data: {\n subject: {\n type: HEALTH_PERSON_SUBJECT_TYPE,\n id: personSubject.id,\n title: personSubject.title,\n },\n },\n options: commandOptions,\n });\n\n if (!commandResult?.success) {\n return commandResult ?? { success: false };\n }\n\n const savedProfile = runtimeCommandPayloadData(commandResult) as\n | AXMHealthCoreHealthProfileEntityModel\n | undefined;\n const sectionPatch = this.buildSectionPatch(savedProfile);\n\n return {\n ...commandResult,\n metadata: {\n ...(commandResult.metadata ?? {}),\n refresh: false,\n ...(sectionPatch ? { healthProfileSectionPatch: sectionPatch } : {}),\n },\n };\n }\n\n //#endregion\n\n //#region ----- Private Methods -----\n\n private buildSectionPatch(\n profile: AXMHealthCoreHealthProfileEntityModel | undefined,\n ): AXEHealthProfileSectionPatch | null {\n if (!profile?.id) {\n return null;\n }\n\n return {\n sectionId: HEALTH_PROFILE_SUMMARY_SECTION_ID,\n insights: buildHealthProfileInsights(profile),\n existingProfileId: profile.id,\n };\n }\n\n private async resolveExistingProfileId(\n input: EditMyHealthProfileInput,\n personId: string,\n ): Promise<string | null> {\n if (typeof input.existingProfileId === 'string' && input.existingProfileId.trim()) {\n return input.existingProfileId.trim();\n }\n\n // Insights hook already decided there is no profile — skip discovery Query.\n if (input.existingProfileId === null) {\n return null;\n }\n\n const existingProfile = await this.findProfileBySubject(HEALTH_PERSON_SUBJECT_TYPE, personId);\n return existingProfile?.id ?? null;\n }\n\n private async findProfileBySubject(\n subjectType: string,\n subjectId: string,\n ): Promise<AXMHealthCoreHealthProfileEntityModel | undefined> {\n const result = await this.entityService\n .withEntity(HealthCoreRootConfig.module.name, HealthCoreRootConfig.entities.healthProfile.name)\n .data<string, AXMHealthCoreHealthProfileEntityModel>()\n .query({\n filter: {\n logic: 'and',\n filters: [\n { field: 'subject.type', operator: { type: 'equal' }, value: subjectType },\n { field: 'subject.id', operator: { type: 'equal' }, value: subjectId },\n ],\n },\n take: 1,\n skip: 0,\n });\n\n return first(result.items);\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":["HealthCoreRootConfig"],"mappings":";;;;;;;;;;AAqCA;AAEA;AAEA;MAEa,6BAA6B,CAAA;AAD1C,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAA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E,EAAE,KAAK,EAAE,WAAW,EAAE;AAC1E,oBAAA,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;AACvE,iBAAA;AACF,aAAA;AACD,YAAA,IAAI,EAAE,CAAC;AACP,YAAA,IAAI,EAAE,CAAC;AACR,SAAA,CAAC;AAEJ,QAAA,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;IAC5B;8GA1JW,6BAA6B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA7B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,6BAA6B,cADhB,MAAM,EAAA,CAAA,CAAA;;2FACnB,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBADzC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { AXTranslationService } from '@acorex/core/translation';
|
|
2
|
+
import { RootConfig, HEALTH_PERSON_SUBJECT_TYPE } from '@acorex-platform/module-health-core-client/contracts';
|
|
3
|
+
import { entityDetailsCrudActions } from '@acorex-platform/framework-shared/entity';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { inject, Injectable } from '@angular/core';
|
|
6
|
+
import { A as AXEHealthSubjectResolverService } from './acorex-platform-extension-health-human-capital-management-client-acorex-platform-extension-health-human-capital-management-client-C6Xgmw5Z.mjs';
|
|
7
|
+
import { A as AXEManageMyHealthEntityListDialogService, b as buildHealthSubjectCreateAction } from './acorex-platform-extension-health-human-capital-management-client-manage-my-health-entity-list-dialog.service-DqmxkgFo.mjs';
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region ---- Manage my health conditions command ----
|
|
11
|
+
/** Opens an editable popup listing health conditions for the current user's person subject. */
|
|
12
|
+
class AXEManageMyHealthConditionsCommand {
|
|
13
|
+
constructor() {
|
|
14
|
+
//#region ---- Services & Dependencies ----
|
|
15
|
+
this.dialogService = inject(AXEManageMyHealthEntityListDialogService);
|
|
16
|
+
this.subjectResolver = inject(AXEHealthSubjectResolverService);
|
|
17
|
+
this.translateService = inject(AXTranslationService);
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region ---- Constants ----
|
|
20
|
+
this.entityKey = `${RootConfig.module.name}.${RootConfig.entities.healthCondition.name}`;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region ---- Command ----
|
|
24
|
+
async execute() {
|
|
25
|
+
const subjects = await this.subjectResolver.resolveForCurrentUser();
|
|
26
|
+
const personSubject = subjects.personSubject;
|
|
27
|
+
if (!personSubject?.id || !personSubject.type) {
|
|
28
|
+
return {
|
|
29
|
+
success: false,
|
|
30
|
+
message: {
|
|
31
|
+
text: await this.translateService.translateAsync('@health-core:profile-page.commands.manage-health-profile.messages.no-subject'),
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return this.dialogService.open({
|
|
36
|
+
sectionTitleKey: '@health-core:health-conditions.entities.health-condition.plural',
|
|
37
|
+
subjectName: personSubject.title ?? '',
|
|
38
|
+
entityKey: this.entityKey,
|
|
39
|
+
personContext: {
|
|
40
|
+
id: personSubject.id,
|
|
41
|
+
personId: personSubject.id,
|
|
42
|
+
fullName: personSubject.title,
|
|
43
|
+
},
|
|
44
|
+
filters: [
|
|
45
|
+
{
|
|
46
|
+
field: 'subject.type',
|
|
47
|
+
operator: { type: 'equal' },
|
|
48
|
+
value: HEALTH_PERSON_SUBJECT_TYPE,
|
|
49
|
+
hidden: true,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
field: 'subject.id',
|
|
53
|
+
operator: { type: 'equal' },
|
|
54
|
+
value: personSubject.id,
|
|
55
|
+
hidden: true,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
actions: [
|
|
59
|
+
buildHealthSubjectCreateAction('@health-core:health-conditions.actions.create.title', {
|
|
60
|
+
type: HEALTH_PERSON_SUBJECT_TYPE,
|
|
61
|
+
id: personSubject.id,
|
|
62
|
+
title: personSubject.title,
|
|
63
|
+
}),
|
|
64
|
+
...entityDetailsCrudActions('subject.id', { create: false }),
|
|
65
|
+
],
|
|
66
|
+
excludeProperties: ['subject.id'],
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXEManageMyHealthConditionsCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
70
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXEManageMyHealthConditionsCommand, providedIn: 'root' }); }
|
|
71
|
+
}
|
|
72
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXEManageMyHealthConditionsCommand, decorators: [{
|
|
73
|
+
type: Injectable,
|
|
74
|
+
args: [{ providedIn: 'root' }]
|
|
75
|
+
}] });
|
|
76
|
+
|
|
77
|
+
export { AXEManageMyHealthConditionsCommand };
|
|
78
|
+
//# sourceMappingURL=acorex-platform-extension-health-human-capital-management-client-manage-my-health-conditions.command-Dkvx6R-w.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-extension-health-human-capital-management-client-manage-my-health-conditions.command-Dkvx6R-w.mjs","sources":["../../../../libs/extensions/health/human-capital-management/client/src/lib/profile-page/commands/manage-my-health-conditions.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport {\n HEALTH_PERSON_SUBJECT_TYPE,\n RootConfig as HealthCoreRootConfig,\n} from '@acorex-platform/module-health-core-client/contracts';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { entityDetailsCrudActions } from '@acorex-platform/framework-shared/entity';\n\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXEHealthSubjectResolverService } from '../../health-subject-resolver.service';\nimport {\n AXEManageMyHealthEntityListDialogService,\n buildHealthSubjectCreateAction,\n} from '../services/manage-my-health-entity-list-dialog.service';\n\n//#endregion\n\n//#region ---- Manage my health conditions command ----\n\n/** Opens an editable popup listing health conditions for the current user's person subject. */\n@Injectable({ providedIn: 'root' })\nexport class AXEManageMyHealthConditionsCommand implements AXPCommand {\n //#region ---- Services & Dependencies ----\n\n private readonly dialogService = inject(AXEManageMyHealthEntityListDialogService);\n private readonly subjectResolver = inject(AXEHealthSubjectResolverService);\n private readonly translateService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Constants ----\n\n private readonly entityKey = `${HealthCoreRootConfig.module.name}.${HealthCoreRootConfig.entities.healthCondition.name}`;\n\n //#endregion\n\n //#region ---- Command ----\n\n async execute(): AXPCommandExecuteResultPromise<unknown> {\n const subjects = await this.subjectResolver.resolveForCurrentUser();\n const personSubject = subjects.personSubject;\n\n if (!personSubject?.id || !personSubject.type) {\n return {\n success: false,\n message: {\n text: await this.translateService.translateAsync(\n '@health-core:profile-page.commands.manage-health-profile.messages.no-subject',\n ),\n },\n };\n }\n\n return this.dialogService.open({\n sectionTitleKey: '@health-core:health-conditions.entities.health-condition.plural',\n subjectName: personSubject.title ?? '',\n entityKey: this.entityKey,\n personContext: {\n id: personSubject.id,\n personId: personSubject.id,\n fullName: personSubject.title,\n },\n filters: [\n {\n field: 'subject.type',\n operator: { type: 'equal' },\n value: HEALTH_PERSON_SUBJECT_TYPE,\n hidden: true,\n },\n {\n field: 'subject.id',\n operator: { type: 'equal' },\n value: personSubject.id,\n hidden: true,\n },\n ],\n actions: [\n buildHealthSubjectCreateAction(\n '@health-core:health-conditions.actions.create.title',\n {\n type: HEALTH_PERSON_SUBJECT_TYPE,\n id: personSubject.id,\n title: personSubject.title,\n },\n ),\n ...entityDetailsCrudActions('subject.id', { create: false }),\n ],\n excludeProperties: ['subject.id'],\n });\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":["HealthCoreRootConfig"],"mappings":";;;;;;;;AAmBA;AAEA;AAEA;MAEa,kCAAkC,CAAA;AAD/C,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,wCAAwC,CAAC;AAChE,QAAA,IAAA,CAAA,eAAe,GAAG,MAAM,CAAC,+BAA+B,CAAC;AACzD,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,oBAAoB,CAAC;;;AAM/C,QAAA,IAAA,CAAA,SAAS,GAAG,CAAA,EAAGA,UAAoB,CAAC,MAAM,CAAC,IAAI,CAAA,CAAA,EAAIA,UAAoB,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,EAAE;AA4DzH,IAAA;;;AAtDC,IAAA,MAAM,OAAO,GAAA;QACX,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,qBAAqB,EAAE;AACnE,QAAA,MAAM,aAAa,GAAG,QAAQ,CAAC,aAAa;QAE5C,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE;YAC7C,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAC9C,8EAA8E,CAC/E;AACF,iBAAA;aACF;QACH;AAEA,QAAA,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;AAC7B,YAAA,eAAe,EAAE,iEAAiE;AAClF,YAAA,WAAW,EAAE,aAAa,CAAC,KAAK,IAAI,E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EAAA,UAAA,EAAA,CAAA;kBAD9C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { AXPWidgetsCatalog } from '@acorex-platform/framework-shared/core';
|
|
2
|
+
import { AXPEntityCommandScope } from '@acorex-platform/framework-shared/entity';
|
|
3
|
+
import { AXTranslationService } from '@acorex/core/translation';
|
|
4
|
+
import { AXPLayoutBuilderService, resolveLayoutBuilderDialogResult } from '@acorex-platform/framework-client/layout/builder';
|
|
5
|
+
import * as i0 from '@angular/core';
|
|
6
|
+
import { inject, Injectable } from '@angular/core';
|
|
7
|
+
|
|
8
|
+
//#region ---- Imports ----
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region ---- Service ----
|
|
11
|
+
/** Opens a filtered, editable entity list for the current user's health profile sections. */
|
|
12
|
+
class AXEManageMyHealthEntityListDialogService {
|
|
13
|
+
constructor() {
|
|
14
|
+
//#region ---- Services & Dependencies ----
|
|
15
|
+
this.layoutBuilder = inject(AXPLayoutBuilderService);
|
|
16
|
+
this.translateService = inject(AXTranslationService);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region ---- Public API ----
|
|
20
|
+
async open(options) {
|
|
21
|
+
const sectionTitle = await this.translateService.translateAsync(options.sectionTitleKey);
|
|
22
|
+
const dialogTitle = await this.translateService.translateAsync('@health-core:profile-page.commands.manage-health-records.dialog.title', { params: { sectionTitle, subjectName: options.subjectName } });
|
|
23
|
+
const result = await this.layoutBuilder
|
|
24
|
+
.create()
|
|
25
|
+
.dialog((dialog) => {
|
|
26
|
+
dialog.setTitle(dialogTitle).setSize('lg').setCloseButton(true);
|
|
27
|
+
dialog.setContext({ ...options.personContext });
|
|
28
|
+
dialog.content((layout) => {
|
|
29
|
+
layout.flex((flex) => {
|
|
30
|
+
flex.setDirection('column');
|
|
31
|
+
flex.setAlignItems('stretch');
|
|
32
|
+
flex.customWidget(AXPWidgetsCatalog.entityList, (widget) => {
|
|
33
|
+
widget.name(`${options.entityKey}-profile-list`);
|
|
34
|
+
widget.defaultValue({
|
|
35
|
+
toolbar: {
|
|
36
|
+
filters: options.filters,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
widget.options({
|
|
40
|
+
entity: options.entityKey,
|
|
41
|
+
showEntityActions: true,
|
|
42
|
+
showToolbar: true,
|
|
43
|
+
actions: options.actions,
|
|
44
|
+
maxHeight: options.maxHeight ?? '60vh',
|
|
45
|
+
excludeProperties: options.excludeProperties,
|
|
46
|
+
...(options.includeColumns?.length ? { includeColumns: options.includeColumns } : {}),
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
dialog.setActions((actions) => {
|
|
52
|
+
actions.cancel('@general:actions.close.title');
|
|
53
|
+
});
|
|
54
|
+
dialog.onAction(async (dialogRef) => {
|
|
55
|
+
if (dialogRef.action() === 'cancel') {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
return { outcome: 'closed' };
|
|
59
|
+
});
|
|
60
|
+
})
|
|
61
|
+
.show();
|
|
62
|
+
resolveLayoutBuilderDialogResult(result);
|
|
63
|
+
return {
|
|
64
|
+
success: true,
|
|
65
|
+
kind: 'object',
|
|
66
|
+
data: { outcome: 'closed' },
|
|
67
|
+
metadata: { refresh: false },
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXEManageMyHealthEntityListDialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
71
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXEManageMyHealthEntityListDialogService, providedIn: 'root' }); }
|
|
72
|
+
}
|
|
73
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXEManageMyHealthEntityListDialogService, decorators: [{
|
|
74
|
+
type: Injectable,
|
|
75
|
+
args: [{ providedIn: 'root' }]
|
|
76
|
+
}] });
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region ---- Action helpers ----
|
|
79
|
+
/** Create action with a pre-filled polymorphic health subject. */
|
|
80
|
+
function buildHealthSubjectCreateAction(titleKey, subject) {
|
|
81
|
+
return {
|
|
82
|
+
name: 'create-health-record',
|
|
83
|
+
title: titleKey,
|
|
84
|
+
icon: 'fa-light fa-plus',
|
|
85
|
+
command: {
|
|
86
|
+
name: 'Entity:Create',
|
|
87
|
+
options: {
|
|
88
|
+
process: {
|
|
89
|
+
redirect: false,
|
|
90
|
+
canCreateNewOne: true,
|
|
91
|
+
data: {
|
|
92
|
+
subject: {
|
|
93
|
+
type: subject.type,
|
|
94
|
+
id: subject.id,
|
|
95
|
+
title: subject.title,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
priority: 'primary',
|
|
102
|
+
type: 'create',
|
|
103
|
+
scope: AXPEntityCommandScope.TypeLevel,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export { AXEManageMyHealthEntityListDialogService as A, buildHealthSubjectCreateAction as b };
|
|
108
|
+
//# sourceMappingURL=acorex-platform-extension-health-human-capital-management-client-manage-my-health-entity-list-dialog.service-DqmxkgFo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-extension-health-human-capital-management-client-manage-my-health-entity-list-dialog.service-DqmxkgFo.mjs","sources":["../../../../libs/extensions/health/human-capital-management/client/src/lib/profile-page/services/manage-my-health-entity-list-dialog.service.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPWidgetsCatalog } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityAction, AXPEntityCommandScope } from '@acorex-platform/framework-shared/entity';\nimport { AXTranslationService } from '@acorex/core/translation';\n\nimport {\n AXPLayoutBuilderService,\n type AXPDialogRef,\n type IWidgetBuilder,\n resolveLayoutBuilderDialogResult,\n} from '@acorex-platform/framework-client/layout/builder';\n\nimport { inject, Injectable } from '@angular/core';\nimport type { AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport type AXEManageMyHealthEntityListDialogOptions = {\n sectionTitleKey: string;\n subjectName: string;\n entityKey: string;\n personContext: Record<string, unknown>;\n filters: Array<{ field: string; operator: { type: string }; value: unknown; hidden?: boolean }>;\n actions: AXPEntityAction[];\n excludeProperties?: string[];\n includeColumns?: string[];\n maxHeight?: string;\n};\n\n//#endregion\n\n//#region ---- Service ----\n\n/** Opens a filtered, editable entity list for the current user's health profile sections. */\n@Injectable({ providedIn: 'root' })\nexport class AXEManageMyHealthEntityListDialogService {\n //#region ---- Services & Dependencies ----\n\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly translateService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Public API ----\n\n async open(options: AXEManageMyHealthEntityListDialogOptions): AXPCommandExecuteResultPromise<{\n outcome: 'closed';\n }> {\n const sectionTitle = await this.translateService.translateAsync(options.sectionTitleKey);\n const dialogTitle = await this.translateService.translateAsync(\n '@health-core:profile-page.commands.manage-health-records.dialog.title',\n { params: { sectionTitle, subjectName: options.subjectName } },\n );\n\n const result = await this.layoutBuilder\n .create()\n .dialog<{ outcome: 'closed' } | null>((dialog) => {\n dialog.setTitle(dialogTitle).setSize('lg').setCloseButton(true);\n dialog.setContext({ ...options.personContext });\n\n dialog.content((layout) => {\n layout.flex((flex) => {\n flex.setDirection('column');\n flex.setAlignItems('stretch');\n flex.customWidget(AXPWidgetsCatalog.entityList, (widget: IWidgetBuilder) => {\n widget.name(`${options.entityKey}-profile-list`);\n widget.defaultValue({\n toolbar: {\n filters: options.filters,\n },\n });\n widget.options({\n entity: options.entityKey,\n showEntityActions: true,\n showToolbar: true,\n actions: options.actions,\n maxHeight: options.maxHeight ?? '60vh',\n excludeProperties: options.excludeProperties,\n ...(options.includeColumns?.length ? { includeColumns: options.includeColumns } : {}),\n });\n });\n });\n });\n\n dialog.setActions((actions) => {\n actions.cancel('@general:actions.close.title');\n });\n\n dialog.onAction(async (dialogRef: AXPDialogRef) => {\n if (dialogRef.action() === 'cancel') {\n return null;\n }\n\n return { outcome: 'closed' as const };\n });\n })\n .show();\n\n resolveLayoutBuilderDialogResult<{ outcome: 'closed' }>(result);\n\n return {\n success: true,\n kind: 'object',\n data: { outcome: 'closed' },\n metadata: { refresh: false },\n };\n }\n\n //#endregion\n}\n\n//#endregion\n\n//#region ---- Action helpers ----\n\n/** Create action with a pre-filled polymorphic health subject. */\nexport function buildHealthSubjectCreateAction(\n titleKey: string,\n subject: { type: string; id: string; title?: string },\n): AXPEntityAction {\n return {\n name: 'create-health-record',\n title: titleKey,\n icon: 'fa-light fa-plus',\n command: {\n name: 'Entity:Create',\n options: {\n process: {\n redirect: false,\n canCreateNewOne: true,\n data: {\n subject: {\n type: subject.type,\n id: subject.id,\n title: subject.title,\n },\n },\n },\n },\n },\n priority: 'primary',\n type: 'create',\n scope: AXPEntityCommandScope.TypeLevel,\n };\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;AAAA;AAgCA;AAEA;AAEA;MAEa,wCAAwC,CAAA;AADrD,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,uBAAuB,CAAC;AAC/C,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAsEjE,IAAA;;;IAhEC,MAAM,IAAI,CAAC,OAAiD,EAAA;AAG1D,QAAA,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,OAAO,CAAC,eAAe,CAAC;QACxF,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAC5D,uEAAuE,EACvE,EAAE,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,EAAE,sBAAsB;AAC5B,QAAA,KAAK,EAAE,QAAQ;AACf,QAAA,IAAI,EAAE,kBAAkB;AACxB,QAAA,OAAO,EAAE;AACP,YAAA,IAAI,EAAE,eAAe;AACrB,YAAA,OAAO,EAAE;AACP,gBAAA,OAAO,EAAE;AACP,oBAAA,QAAQ,EAAE,KAAK;AACf,oBAAA,eAAe,EAAE,IAAI;AACrB,oBAAA,IAAI,EAAE;AACJ,wBAAA,OAAO,EAAE;4BACP,IAAI,EAAE,OAAO,CAAC,IAAI;4BAClB,EAAE,EAAE,OAAO,CAAC,EAAE;4BACd,KAAK,EAAE,OAAO,CAAC,KAAK;AACrB,yBAAA;AACF,qBAAA;AACF,iBAAA;AACF,aAAA;AACF,SAAA;AACD,QAAA,QAAQ,EAAE,SAAS;AACnB,QAAA,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,qBAAqB,CAAC,SAAS;KACvC;AACH;;;;"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { entityDetailsCrudActions, AXPEntityCommandScope } from '@acorex-platform/framework-shared/entity';
|
|
2
|
+
import { AXTranslationService } from '@acorex/core/translation';
|
|
3
|
+
import { RootConfig, HEALTH_PERSON_SUBJECT_TYPE } from '@acorex-platform/module-health-core-client/contracts';
|
|
4
|
+
import { AXPExpressionEvaluatorService } from '@acorex-platform/framework-client/core';
|
|
5
|
+
import * as i0 from '@angular/core';
|
|
6
|
+
import { inject, Injectable } from '@angular/core';
|
|
7
|
+
import { get } from 'lodash-es';
|
|
8
|
+
import { A as AXEHealthSubjectResolverService } from './acorex-platform-extension-health-human-capital-management-client-acorex-platform-extension-health-human-capital-management-client-C6Xgmw5Z.mjs';
|
|
9
|
+
import { A as AXEManageMyHealthEntityListDialogService } from './acorex-platform-extension-health-human-capital-management-client-manage-my-health-entity-list-dialog.service-DqmxkgFo.mjs';
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region ---- Manage my health events command ----
|
|
13
|
+
/** Opens an editable popup listing health records (events) for the current user's person subject. */
|
|
14
|
+
class AXEManageMyHealthEventsCommand {
|
|
15
|
+
constructor() {
|
|
16
|
+
//#region ---- Services & Dependencies ----
|
|
17
|
+
this.dialogService = inject(AXEManageMyHealthEntityListDialogService);
|
|
18
|
+
this.expressionEvaluator = inject(AXPExpressionEvaluatorService);
|
|
19
|
+
this.subjectResolver = inject(AXEHealthSubjectResolverService);
|
|
20
|
+
this.translateService = inject(AXTranslationService);
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region ---- Constants ----
|
|
23
|
+
this.entityKey = `${RootConfig.module.name}.${RootConfig.entities.healthEvent.name}`;
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region ---- Command ----
|
|
27
|
+
async execute() {
|
|
28
|
+
const subjects = await this.subjectResolver.resolveForCurrentUser();
|
|
29
|
+
const personSubject = subjects.personSubject;
|
|
30
|
+
if (!personSubject?.id || !personSubject.type) {
|
|
31
|
+
return {
|
|
32
|
+
success: false,
|
|
33
|
+
message: {
|
|
34
|
+
text: await this.translateService.translateAsync('@health-core:profile-page.commands.manage-health-profile.messages.no-subject'),
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const personContext = {
|
|
39
|
+
id: personSubject.id,
|
|
40
|
+
personId: personSubject.id,
|
|
41
|
+
fullName: personSubject.title,
|
|
42
|
+
};
|
|
43
|
+
const startActions = await this.buildHealthEventStartActions(personContext);
|
|
44
|
+
return this.dialogService.open({
|
|
45
|
+
sectionTitleKey: '@health-core:health-events.entities.health-event.plural',
|
|
46
|
+
subjectName: personSubject.title ?? '',
|
|
47
|
+
entityKey: this.entityKey,
|
|
48
|
+
personContext,
|
|
49
|
+
filters: [
|
|
50
|
+
{
|
|
51
|
+
field: 'subject.type',
|
|
52
|
+
operator: { type: 'equal' },
|
|
53
|
+
value: HEALTH_PERSON_SUBJECT_TYPE,
|
|
54
|
+
hidden: true,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
field: 'subject.id',
|
|
58
|
+
operator: { type: 'equal' },
|
|
59
|
+
value: personSubject.id,
|
|
60
|
+
hidden: true,
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
actions: [
|
|
64
|
+
...startActions,
|
|
65
|
+
...entityDetailsCrudActions('subject.id', { create: false, edit: false, delete: false, view: false }),
|
|
66
|
+
],
|
|
67
|
+
excludeProperties: ['subject.id'],
|
|
68
|
+
includeColumns: ['recordTypeId', 'occurredDate', 'endDate', 'provider', 'statusId'],
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region ---- Private Methods ----
|
|
73
|
+
async buildHealthEventStartActions(personContext) {
|
|
74
|
+
const scope = {
|
|
75
|
+
context: {
|
|
76
|
+
eval: (path) => get(personContext, path),
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
const items = (await this.expressionEvaluator.evaluate(`{{ await ${RootConfig.module.name}.HealthEvents('${HEALTH_PERSON_SUBJECT_TYPE}') }}`, scope));
|
|
80
|
+
return [
|
|
81
|
+
{
|
|
82
|
+
name: 'start-health-event',
|
|
83
|
+
title: '@health-core:health-events.actions.start.title',
|
|
84
|
+
icon: 'fa-light fa-play',
|
|
85
|
+
command: {
|
|
86
|
+
name: 'Entity:Create',
|
|
87
|
+
options: {
|
|
88
|
+
process: {
|
|
89
|
+
redirect: false,
|
|
90
|
+
canCreateNewOne: true,
|
|
91
|
+
data: {},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
priority: 'primary',
|
|
96
|
+
type: 'create',
|
|
97
|
+
scope: AXPEntityCommandScope.TypeLevel,
|
|
98
|
+
items,
|
|
99
|
+
},
|
|
100
|
+
];
|
|
101
|
+
}
|
|
102
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXEManageMyHealthEventsCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
103
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXEManageMyHealthEventsCommand, providedIn: 'root' }); }
|
|
104
|
+
}
|
|
105
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXEManageMyHealthEventsCommand, decorators: [{
|
|
106
|
+
type: Injectable,
|
|
107
|
+
args: [{ providedIn: 'root' }]
|
|
108
|
+
}] });
|
|
109
|
+
|
|
110
|
+
export { AXEManageMyHealthEventsCommand };
|
|
111
|
+
//# sourceMappingURL=acorex-platform-extension-health-human-capital-management-client-manage-my-health-events.command-CI2pOceW.mjs.map
|