fixed some missed data, added role based function(user)
This commit is contained in:
@@ -20,7 +20,7 @@ import type { IntlPaymentFormData } from "../schemas/visaMasterPayment.schema";
|
||||
import { useInfiniteBranches } from "@/features/shared/hooks/useSharedBranchUsers";
|
||||
import { useInfiniteClients } from "@/features/clients/hooks/useClients";
|
||||
import type { LocalizedText } from "@/features/branches/api/branchesApi";
|
||||
import { PASSPORT_SERIES_OPTIONS, getStatusOptions } from "@/constants";
|
||||
import { PASSPORT_SERIES_OPTIONS, getStatusOptions, getRegionOptions, REGION_CODES, REGION_LABELS } from "@/constants";
|
||||
|
||||
// ─── Types ────────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -38,17 +38,6 @@ const CURRENCY_OPTIONS = [
|
||||
{ value: "mastercard", label: "MasterCard" },
|
||||
];
|
||||
|
||||
const REGION_CODES = ["AG", "AH", "BN", "DZ", "LB", "MR"] as const;
|
||||
|
||||
const REGION_LABELS: Record<string, string> = {
|
||||
AG: "Aşgabat",
|
||||
AH: "Ahal",
|
||||
BN: "Balkan",
|
||||
DZ: "Daşoguz",
|
||||
LB: "Lebap",
|
||||
MR: "Mary",
|
||||
};
|
||||
|
||||
function resolveLocalizedName(name: LocalizedText | string | null | undefined, lang = "en"): string {
|
||||
if (!name) return "";
|
||||
if (typeof name === "string") return name;
|
||||
@@ -56,13 +45,6 @@ function resolveLocalizedName(name: LocalizedText | string | null | undefined, l
|
||||
return name[key as keyof LocalizedText] ?? name.tm ?? name.en ?? name.ru ?? "";
|
||||
}
|
||||
|
||||
function getRegionOptions(t: TFunction): { value: string; label: string }[] {
|
||||
return REGION_CODES.map((code) => ({
|
||||
value: code,
|
||||
label: t(`intlPayment.regions.${code}`, REGION_LABELS[code] ?? code),
|
||||
}));
|
||||
}
|
||||
|
||||
const KABUL_DOCS: { key: keyof IntlPaymentFormData; label: string }[] = [
|
||||
{ key: "doc_sberbank_account", label: "Talypyň SBERBANK kartynyň rekwizitleri" },
|
||||
{ key: "doc_school_enrollment", label: "Daşary ýurt ÝOM-da okaýandygy barada güwänamasy" },
|
||||
@@ -251,7 +233,7 @@ function StepLocation({ form, errors, set, t, initialData }: StepContentProps) {
|
||||
const [branchSearch, setBranchSearch] = useState("");
|
||||
const branchQuery = useInfiniteBranches(branchSearch);
|
||||
|
||||
const regionOptions = useMemo(() => getRegionOptions(t), [t]);
|
||||
const regionOptions = useMemo(() => getRegionOptions(t, "intlPayment", REGION_CODES, REGION_LABELS), [t]);
|
||||
|
||||
const branchOptions: InfiniteSelectOption[] = useMemo(() => {
|
||||
const opts: InfiniteSelectOption[] = (branchQuery.data?.pages ?? [])
|
||||
|
||||
Reference in New Issue
Block a user