fixed some ux components, added constants
This commit is contained in:
1 parent
6da59f42d9
commit
5073166931
30 files changed
+409
-425
No files matched your search
@@ -16,6 +16,7 @@ import type { LoanOrder } from "@/features/loanOrders/api/loanOrdersApi";
|
||||
import { BRANCHES_BY_REGION } from "@/features/loanOrders/api/loanOrdersApi";
|
||||
import { validateStep, DEFAULT_FORM_VALUES, buildPayload } from "@/features/loanOrders/schemas/loanOrder.schema";
|
||||
import type { LoanOrderFormData } from "@/features/loanOrders/schemas/loanOrder.schema";
|
||||
import { PASSPORT_SERIES_OPTIONS, getStatusOptions } from "@/constants";
|
||||
|
||||
// ─── Static options ───────────────────────────────────────────────────────────
|
||||
|
||||
@@ -47,13 +48,6 @@ const MARRIAGE_OPTIONS = [
|
||||
{ value: "LEGAL", label: "Raýat nika" },
|
||||
];
|
||||
|
||||
const STATUS_OPTIONS = [
|
||||
{ value: "GARAŞYLÝAR", label: "Garaşylýar" },
|
||||
{ value: "IŞLENÝÄR", label: "Işlenýär" },
|
||||
{ value: "KANAGATLANDYRYLAN", label: "Kanagatlandyrylan" },
|
||||
{ value: "RED_EDILDI", label: "Red edildi" },
|
||||
];
|
||||
|
||||
const LOAN_TYPE_OPTIONS = [
|
||||
{ value: "consumer", label: "Sarp ediş karzy" },
|
||||
{ value: "mortgage", label: "Ipoteka" },
|
||||
@@ -62,11 +56,6 @@ const LOAN_TYPE_OPTIONS = [
|
||||
{ value: "business", label: "Işewürlik karzy" },
|
||||
];
|
||||
|
||||
const PASSPORT_SERIES_OPTIONS = [
|
||||
{ value: "I", label: "I" },
|
||||
{ value: "II", label: "II" },
|
||||
];
|
||||
|
||||
const MONTH_OPTIONS = Array.from({ length: 12 }, (_, i) => ({
|
||||
value: String(i + 1).padStart(2, "0"),
|
||||
label: String(i + 1).padStart(2, "0"),
|
||||
@@ -207,6 +196,8 @@ interface StepContentProps {
|
||||
// ─── Step panels ──────────────────────────────────────────────────────────────
|
||||
|
||||
function StepStatus({ form, errors, set, t }: StepContentProps) {
|
||||
const statusOptions = useMemo(() => getStatusOptions(t, "loanOrderStatus"), [t]);
|
||||
|
||||
return (
|
||||
<BentoGrid cols={2}>
|
||||
<BentoCard>
|
||||
@@ -216,7 +207,7 @@ function StepStatus({ form, errors, set, t }: StepContentProps) {
|
||||
required
|
||||
value={form.status}
|
||||
onChange={(v) => set("status", v)}
|
||||
options={STATUS_OPTIONS}
|
||||
options={statusOptions}
|
||||
error={errors.status}
|
||||
placeholder={t("loanOrderForm.placeholders.select") || "Saýlaň"}
|
||||
/>
|
||||
@@ -1061,7 +1052,7 @@ export function LoanOrderForm({ mode, initialData }: LoanOrderFormProps) {
|
||||
|
||||
function mapInitial(order: LoanOrder): Partial<LoanOrderFormData> {
|
||||
return {
|
||||
status: order.status ?? "GARAŞYLÝAR",
|
||||
status: order.status ?? "pending",
|
||||
loanType: order.loanType ?? "",
|
||||
region: order.region ?? "Aşgabat",
|
||||
branch: order.branch ?? "",
|
||||
|
||||
Reference in new issue
Block a user