fix: support manual accident addresses and expose final Fanavaran completion

Accept and persist address-only locations across user and expert flows, preserve workflow authorization, and include addresses in reports and Fanavaran review. Expose persisted final submission completion so the expert panel can prevent repeat sends.
This commit is contained in:
SepehrYahyaee
2026-11-21 09:45:13 +03:30
parent b63525c863
commit c6022a1646
15 changed files with 244 additions and 25 deletions
@@ -1887,7 +1887,7 @@ export class ClaimRequestManagementService {
private async buildFanavaranSubmitPayload(input: {
accidentReason?: { id?: string | number | null; fanavaran?: number | null };
createdAt?: Date | string;
location?: { lat?: number; lon?: number };
location?: { lat?: number; lon?: number; address?: string };
damageParts?: any[];
resolvePolicyId: () => Promise<number | null>;
logPrefix: string;
@@ -1929,7 +1929,7 @@ export class ClaimRequestManagementService {
result.AccidentTime = this.getTime24Hour(input.createdAt);
}
result.AccidentLocationAddress = FANAVARAN_ACCIDENT_LOCATION_ADDRESS;
result.AccidentLocationAddress = input.location?.address?.trim() || FANAVARAN_ACCIDENT_LOCATION_ADDRESS;
result.EstimateAmount = this.normalizeFanavaranEstimateAmount(
input.damageParts ? this.calculateEstimateAmount(input.damageParts) : 0,
@@ -5891,7 +5891,7 @@ export class ClaimRequestManagementService {
}),
);
const initial: FanavaranFieldValues = {
AccidentLocationAddress: FANAVARAN_ACCIDENT_LOCATION_ADDRESS,
AccidentLocationAddress: blame.parties?.find((party: any) => party.role === 'FIRST')?.location?.address?.trim() || blame.parties?.find((party: any) => party.location?.address?.trim())?.location.address.trim() || FANAVARAN_ACCIDENT_LOCATION_ADDRESS,
AccidentCityId: defaults.AccidentCityId,
AccidentReportTypeId: defaults.AccidentReportTypeId,
DmgHistoryStatus: defaults.DmgHistoryStatus,