From fea93d7f55b143eca34f676693ead67f1f59fef9 Mon Sep 17 00:00:00 2001 From: norda-gunni <161026627+norda-gunni@users.noreply.github.com> Date: Wed, 20 Nov 2024 12:30:09 +0000 Subject: [PATCH] fix(application-system): Fix accident notification data (#16954) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../accident-notification-v2.utils.ts | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/libs/application/template-api-modules/src/lib/modules/templates/accident-notification/accident-notification-v2.utils.ts b/libs/application/template-api-modules/src/lib/modules/templates/accident-notification/accident-notification-v2.utils.ts index f1c711319e56..fac1472df1ac 100644 --- a/libs/application/template-api-modules/src/lib/modules/templates/accident-notification/accident-notification-v2.utils.ts +++ b/libs/application/template-api-modules/src/lib/modules/templates/accident-notification/accident-notification-v2.utils.ts @@ -51,9 +51,9 @@ export const applicationToAccidentReport = ( const reportingForMap = { [WhoIsTheNotificationForEnum.ME]: MinarsidurAPIModelsAccidentReportsReporterDTOReportingForEnum.NUMBER_1, - [WhoIsTheNotificationForEnum.JURIDICALPERSON]: - MinarsidurAPIModelsAccidentReportsReporterDTOReportingForEnum.NUMBER_2, [WhoIsTheNotificationForEnum.POWEROFATTORNEY]: + MinarsidurAPIModelsAccidentReportsReporterDTOReportingForEnum.NUMBER_2, + [WhoIsTheNotificationForEnum.JURIDICALPERSON]: MinarsidurAPIModelsAccidentReportsReporterDTOReportingForEnum.NUMBER_3, [WhoIsTheNotificationForEnum.CHILDINCUSTODY]: MinarsidurAPIModelsAccidentReportsReporterDTOReportingForEnum.NUMBER_4, @@ -373,12 +373,14 @@ const getEmployer = ( answers.applicant && utils.isRepresentativeOfCompanyOrInstitute(answers) ) { + const { companyName, companyNationalId } = answers.juridicalPerson + const { name, email, phoneNumber } = answers.applicant return { - companyName: answers.juridicalPerson.companyNationalId, - companyNationalId: answers.juridicalPerson.companyName, - representativeName: answers.applicant.name ?? '', - representativeEmail: answers.applicant.email ?? '', - representativePhone: answers.applicant.phoneNumber ?? '', + companyName, + companyNationalId, + representativeName: name ?? '', + representativeEmail: email ?? '', + representativePhone: phoneNumber ?? '', } } @@ -390,12 +392,18 @@ const getEmployer = ( return undefined } + const { + name: companyName = '', + nationalRegistrationId: companyNationalId = '', + } = companyInfo + const { name, email, phoneNumber } = representative + return { - companyName: companyInfo.name ?? '', - companyNationalId: companyInfo.nationalRegistrationId ?? '', - representativeName: representative.name ?? '', - representativeEmail: representative.email ?? '', - representativePhone: representative.phoneNumber ?? '', + companyName, + companyNationalId, + representativeName: name ?? '', + representativeEmail: email ?? '', + representativePhone: phoneNumber ?? '', } }