forked from Yara724/api
YARA-1258
This commit is contained in:
@@ -48,6 +48,15 @@ export const PR = {
|
||||
evaluationExpert: "کارشناس ارزیاب",
|
||||
evaluationSubmittedAt: "تاریخ و ساعت ثبت ارزیابی",
|
||||
evaluationResponse: "پاسخ / توضیحات کارشناس",
|
||||
evaluationPartsSection: "قیمت قطعات",
|
||||
part: "قطعه",
|
||||
partName: "نام قطعه",
|
||||
damageType: "نوع خسارت",
|
||||
partPrice: "قیمت قطعه",
|
||||
repairSalary: "اجرت تعمیر",
|
||||
totalPayment: "مبلغ کل",
|
||||
factorNeeded: "نیازمند فاکتور",
|
||||
daghi: "داغی",
|
||||
admitsGuilt: "اقرار به تقصیر",
|
||||
claimsDamage: "ادعای خسارت",
|
||||
acceptsExpertOpinion: "پذیرش نظر کارشناس",
|
||||
@@ -194,6 +203,32 @@ const STATUS_LABELS: Record<string, string> = {
|
||||
false: "خیر",
|
||||
};
|
||||
|
||||
const WEATHER_LABELS: Record<string, string> = {
|
||||
clear: "صاف",
|
||||
sunny: "صاف",
|
||||
rainy: "بارانی",
|
||||
rain: "بارانی",
|
||||
snowy: "برفی",
|
||||
snow: "برفی",
|
||||
foggy: "مهآلود",
|
||||
fog: "مهآلود",
|
||||
};
|
||||
|
||||
const ROAD_LABELS: Record<string, string> = {
|
||||
muddy: "گلی",
|
||||
icy: "یخزده",
|
||||
wet: "مرطوب",
|
||||
dry: "خشک",
|
||||
};
|
||||
|
||||
const LIGHT_LABELS: Record<string, string> = {
|
||||
daylight: "روز",
|
||||
day: "روز",
|
||||
night: "شب",
|
||||
low_light: "کمنور",
|
||||
lowlight: "کمنور",
|
||||
};
|
||||
|
||||
/** Turn `party.insurance.policyNumber` into a Persian label. */
|
||||
export function persianFieldPath(path: string): string {
|
||||
if (!path) return PR.data;
|
||||
@@ -231,3 +266,19 @@ export function persianStatus(value: unknown): string | undefined {
|
||||
const key = String(value);
|
||||
return STATUS_LABELS[key] ?? key;
|
||||
}
|
||||
|
||||
export function persianAccidentCondition(
|
||||
kind: "weather" | "road" | "light",
|
||||
value: unknown,
|
||||
): string | undefined {
|
||||
if (value === undefined || value === null || value === "") return undefined;
|
||||
const raw = String(value).trim();
|
||||
const normalized = raw.toLowerCase().replace(/[\s-]+/g, "_");
|
||||
const labels =
|
||||
kind === "weather"
|
||||
? WEATHER_LABELS
|
||||
: kind === "road"
|
||||
? ROAD_LABELS
|
||||
: LIGHT_LABELS;
|
||||
return labels[normalized] ?? raw;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user