forked from Yara724/api
Fixed Participants
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
} from "src/helpers/blame-damaged-party";
|
||||
import { toJalaliDateAndTime } from "src/helpers/date-jalali";
|
||||
import { PartyRole } from "src/request-management/entities/schema/partyRole.enum";
|
||||
import { sanitizeStoredInquiryParticipants } from "src/request-management/inquiry-participant-resolver";
|
||||
import {
|
||||
InsurerFileReportField,
|
||||
InsurerFileReportSection,
|
||||
@@ -611,9 +612,8 @@ function buildParticipantRolesSection(
|
||||
title: string,
|
||||
party: ReportParty | null | undefined,
|
||||
): InsurerFileReportSection | undefined {
|
||||
const participants = Array.isArray(party?.participants)
|
||||
? party.participants
|
||||
: [];
|
||||
const participants =
|
||||
sanitizeStoredInquiryParticipants(party?.participants) ?? [];
|
||||
const assignments = party?.participantRoles;
|
||||
if (!assignments || participants.length === 0) return undefined;
|
||||
|
||||
@@ -627,22 +627,20 @@ function buildParticipantRolesSection(
|
||||
const participant = participants.find(
|
||||
(candidate) => String(candidate.participantId) === String(participantId),
|
||||
);
|
||||
const value = participant?.unknown
|
||||
? PR.unknown
|
||||
: [
|
||||
asString(participant?.fullName),
|
||||
participant?.nationalCode
|
||||
? `${PR.nationalCode}: ${asString(participant.nationalCode)}`
|
||||
: undefined,
|
||||
participant?.birthday
|
||||
? `${PR.birthDate}: ${formatBirthDate(participant.birthday)}`
|
||||
: undefined,
|
||||
participant?.licenseNumber
|
||||
? `${PR.licenseNumber}: ${asString(participant.licenseNumber)}`
|
||||
: undefined,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join("، ");
|
||||
const value = [
|
||||
asString(participant?.fullName),
|
||||
participant?.nationalCode
|
||||
? `${PR.nationalCode}: ${asString(participant.nationalCode)}`
|
||||
: undefined,
|
||||
participant?.birthday
|
||||
? `${PR.birthDate}: ${formatBirthDate(participant.birthday)}`
|
||||
: undefined,
|
||||
participant?.licenseNumber
|
||||
? `${PR.licenseNumber}: ${asString(participant.licenseNumber)}`
|
||||
: undefined,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join("، ");
|
||||
return {
|
||||
label: roleLabels[role] ?? persianFieldPath(role),
|
||||
value: value || PR.empty,
|
||||
|
||||
Reference in New Issue
Block a user