Skip to content

Commit

Permalink
fix(application-system): Fix accident notification data
Browse files Browse the repository at this point in the history
  • Loading branch information
norda-gunni committed Nov 20, 2024
1 parent ad73e94 commit 745d6a5
Showing 1 changed file with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,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,
Expand Down Expand Up @@ -371,12 +371,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 ?? '',
}
}

Expand All @@ -388,12 +390,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 ?? '',
}
}

Expand Down

0 comments on commit 745d6a5

Please sign in to comment.