fixed some missed data, added role based function(user)
This commit is contained in:
1 parent
5884ec831c
commit
9ad86634dd
31 files changed
+1276
-977
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import type { TFunction } from "i18next";
|
||||
import type { SelectOption } from "@/components/formInput";
|
||||
|
||||
export const REGION_CODES = ["AG", "AH", "BN", "DZ", "LB", "MR"] as const;
|
||||
|
||||
export type RegionCode = (typeof REGION_CODES)[number];
|
||||
|
||||
/** Distinct region set used by loan paid-off letters. */
|
||||
export const LOAN_PAID_OFF_REGION_CODES = ["AG", "AH", "BA", "DA", "LE", "MA"] as const;
|
||||
|
||||
export type LoanPaidOffRegionCode = (typeof LOAN_PAID_OFF_REGION_CODES)[number];
|
||||
|
||||
export const REGION_LABELS: Record<string, string> = {
|
||||
AG: "Aşgabat",
|
||||
AH: "Ahal",
|
||||
BN: "Balkan",
|
||||
DZ: "Daşoguz",
|
||||
LB: "Lebap",
|
||||
MR: "Mary",
|
||||
};
|
||||
|
||||
type TranslateFn = TFunction | ((key: string, fallback?: string) => string);
|
||||
|
||||
export function getRegionOptions(
|
||||
t: TranslateFn,
|
||||
prefix = "loanOrders",
|
||||
codes: readonly string[] = REGION_CODES,
|
||||
labels?: Record<string, string>,
|
||||
): SelectOption[] {
|
||||
return codes.map((code) => ({
|
||||
value: code,
|
||||
label: t(`${prefix}.regions.${code}`, labels?.[code] ?? code),
|
||||
}));
|
||||
}
|
||||
Reference in new issue
Block a user