refactored some view pages
This commit is contained in:
1 parent
ef9d6201eb
commit
84c5ff4153
4 files changed
+234
-350
No files matched your search
@@ -1,9 +1,6 @@
|
||||
import { useParams, useNavigate } from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
useCardPin,
|
||||
useDeleteCardPin,
|
||||
} from "@/features/cardPins/hooks/useCardPins";
|
||||
import { useCardPin, useDeleteCardPin } from "@/features/cardPins/hooks/useCardPins";
|
||||
import type { CardPinStatus } from "@/features/cardPins/api/cardPinApi";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -18,33 +15,30 @@ import {
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
} from "@/components/ui/alert-dialog";
|
||||
import {
|
||||
StatusBadge,
|
||||
type StatusBadgeVariant,
|
||||
} from "@/components/ui/statusBadge";
|
||||
import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadge";
|
||||
import { AlertCircle, CheckCircle2, XCircle } from "lucide-react";
|
||||
import { BentoGrid, BentoCard, InfoRow, PassportImage } from "@/components/viewPageComponents";
|
||||
|
||||
// ─── Status config ────────────────────────────────────────────────────────────
|
||||
|
||||
const STATUS_VARIANT: Record<CardPinStatus, StatusBadgeVariant> = {
|
||||
pending: "warning",
|
||||
pending: "warning",
|
||||
approved: "success",
|
||||
rejected: "error",
|
||||
}
|
||||
};
|
||||
|
||||
const STATUS_ICON: Record<CardPinStatus, React.ElementType> = {
|
||||
pending: AlertCircle,
|
||||
pending: AlertCircle,
|
||||
approved: CheckCircle2,
|
||||
rejected: XCircle,
|
||||
}
|
||||
};
|
||||
|
||||
function CardPinStatusBadge({ status }: { status: CardPinStatus }) {
|
||||
const { t } = useTranslation()
|
||||
const variant = STATUS_VARIANT[status]
|
||||
const Icon = STATUS_ICON[status]
|
||||
if (!variant) return <span className="text-xs text-muted-foreground">{status}</span>
|
||||
return <StatusBadge label={t(`cardPin.status.${status}`)} variant={variant} icon={Icon} />
|
||||
const { t } = useTranslation();
|
||||
const variant = STATUS_VARIANT[status];
|
||||
const Icon = STATUS_ICON[status];
|
||||
if (!variant) return <span className="text-xs text-muted-foreground">{status}</span>;
|
||||
return <StatusBadge label={t(`cardPin.status.${status}`)} variant={variant} icon={Icon} />;
|
||||
}
|
||||
|
||||
// ─── Skeleton ─────────────────────────────────────────────────────────────────
|
||||
@@ -64,34 +58,29 @@ function CardPinViewSkeleton() {
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// ─── Page ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
export default function CardPinViewPage() {
|
||||
const { id } = useParams<{ id: string }>()
|
||||
const navigate = useNavigate()
|
||||
const { t } = useTranslation()
|
||||
const { id } = useParams<{ id: string }>();
|
||||
const navigate = useNavigate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { data, isLoading, isError } = useCardPin(id!)
|
||||
const { mutate: deletePin, isPending: isDeleting } = useDeleteCardPin()
|
||||
const { data, isLoading, isError } = useCardPin(id!);
|
||||
const { mutate: deletePin, isPending: isDeleting } = useDeleteCardPin();
|
||||
|
||||
if (isLoading) {
|
||||
return <CardPinViewSkeleton />
|
||||
return <CardPinViewSkeleton />;
|
||||
}
|
||||
|
||||
if (isError || !data) {
|
||||
return (
|
||||
<div className="flex items-center justify-center py-24 text-muted-foreground">
|
||||
{t("common.notFound", "Maglumat tapylmady")}
|
||||
</div>
|
||||
)
|
||||
return <div className="flex items-center justify-center py-24 text-muted-foreground">{t("common.notFound", "Maglumat tapylmady")}</div>;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="mx-auto flex flex-col gap-6">
|
||||
|
||||
{/* ── Page header ──────────────────────────────────────────────────── */}
|
||||
<div className="flex items-start justify-between">
|
||||
<h1 className="text-xl font-bold text-foreground">
|
||||
@@ -100,28 +89,19 @@ export default function CardPinViewPage() {
|
||||
<div className="flex items-center gap-2">
|
||||
<AlertDialog>
|
||||
<AlertDialogTitle asChild>
|
||||
<Button
|
||||
size="icon"
|
||||
variant="ghost"
|
||||
className="h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10"
|
||||
>
|
||||
<Button size="icon" variant="ghost" className="h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10">
|
||||
<Trash2 size={15} />
|
||||
</Button>
|
||||
</AlertDialogTitle>
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>
|
||||
{t("cardPin.deleteTitle", "Pozmak isleýärsiňizmi?")}
|
||||
</AlertDialogTitle>
|
||||
<AlertDialogTitle>{t("cardPin.deleteTitle", "Pozmak isleýärsiňizmi?")}</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
{t("cardPin.deleteDesc", "Bu amal yzyna dolanyp bolmaz.")}{" "}
|
||||
{data.id}
|
||||
{t("cardPin.deleteDesc", "Bu amal yzyna dolanyp bolmaz.")} {data.id}
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel disabled={isDeleting}>
|
||||
{t("common.cancel", "Ýatyr")}
|
||||
</AlertDialogCancel>
|
||||
<AlertDialogCancel disabled={isDeleting}>{t("common.cancel", "Ýatyr")}</AlertDialogCancel>
|
||||
<AlertDialogAction
|
||||
disabled={isDeleting}
|
||||
className="bg-destructive hover:bg-destructive/90"
|
||||
@@ -133,12 +113,7 @@ export default function CardPinViewPage() {
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
|
||||
<Button
|
||||
size="icon"
|
||||
variant="ghost"
|
||||
className="h-8 w-8"
|
||||
onClick={() => navigate(`/card-pins/${id}/edit`)}
|
||||
>
|
||||
<Button size="icon" variant="ghost" className="h-8 w-8" onClick={() => navigate(`/card-pins/${id}/edit`)}>
|
||||
<Pencil size={15} />
|
||||
</Button>
|
||||
</div>
|
||||
@@ -147,97 +122,56 @@ export default function CardPinViewPage() {
|
||||
{/* ── Row 1: Meta + Kart + Lokasiýa ───────────────────────────────── */}
|
||||
<BentoGrid cols={3}>
|
||||
<BentoCard title={t("cardPin.metaSection", "Esasy maglumatlar")}>
|
||||
<InfoRow label={t("common.id", "ID")}>
|
||||
<span className="font-mono">{data.id}</span>
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardPin.createdAt", "Döredilen wagty")}>
|
||||
{data.created_at}
|
||||
</InfoRow>
|
||||
<InfoRow label={t("common.id", "ID")} value={data.id} />
|
||||
<InfoRow label={t("cardPin.createdAt", "Döredilen wagty")} value={data.created_at} />
|
||||
<InfoRow label={t("cardPin.status", "Status")}>
|
||||
<CardPinStatusBadge status={data.status} />
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardPin.note", "Bellik")}>
|
||||
{data.note || "—"}
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardPin.createdBy", "Sargyt eden")}>
|
||||
<span className="text-primary font-medium">{data.created_by_label}</span>
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardPin.note", "Bellik")} value={data.note || undefined} />
|
||||
<InfoRow label={t("cardPin.createdBy", "Sargyt eden")} value={data.created_by_label} isLink />
|
||||
</BentoCard>
|
||||
|
||||
<BentoCard title={t("cardPin.cardSection", "Kart")}>
|
||||
<InfoRow label={t("cardPin.cardNumber", "Kart belgisi")}>
|
||||
<span className="font-mono tracking-wider">{data.card_number}</span>
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardPin.cardExpireMonth", "Kart Möhleti (aý)")}>
|
||||
—
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardPin.cardExpireYear", "Kart Möhleti (ýyl)")}>
|
||||
—
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardPin.cardNumber", "Kart belgisi")} value={data.card_number} />
|
||||
<InfoRow label={t("cardPin.cardExpireMonth", "Kart Möhleti (aý)")} value={null} />
|
||||
<InfoRow label={t("cardPin.cardExpireYear", "Kart Möhleti (ýyl)")} value={null} />
|
||||
</BentoCard>
|
||||
|
||||
<BentoCard title={t("cardPin.locationSection", "Lokasiýa")}>
|
||||
<InfoRow label={t("cardPin.province", "Welaýat")}>
|
||||
{data.province_label}
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardPin.branch", "Şahamça")}>
|
||||
<span className="text-primary font-medium">{data.branch_label}</span>
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardPin.province", "Welaýat")} value={data.province_label} />
|
||||
<InfoRow label={t("cardPin.branch", "Şahamça")} value={data.branch_label} isLink />
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
{/* ── Row 2: Şahsy + Pasport maglumatlary ─────────────────────────── */}
|
||||
<BentoGrid cols={2}>
|
||||
<BentoCard title={t("cardPin.personalSection", "Şahsy maglumatlar")}>
|
||||
<InfoRow label={t("cardPin.fullName", "Doly ady")}>
|
||||
{`${data.last_name} ${data.first_name} ${data.father_name}`}
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardPin.birthDate", "Doglan güni")}>
|
||||
{data.birth_date}
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardPin.phone", "Telefon")}>
|
||||
+{data.phone}
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardPin.fullName", "Doly ady")} value={`${data.last_name} ${data.first_name} ${data.father_name}`} />
|
||||
<InfoRow label={t("cardPin.birthDate", "Doglan güni")} value={data.birth_date} />
|
||||
<InfoRow label={t("cardPin.phone", "Telefon")} value={`+${data.phone}`} />
|
||||
</BentoCard>
|
||||
|
||||
<BentoCard title={t("cardPin.passportSection", "Pasport")}>
|
||||
<InfoRow label={t("cardPin.passportSeries", "Pasport seriýasy")}>
|
||||
{data.passport_series}
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardPin.passportNumber", "Pasport belgisi")}>
|
||||
{data.passport_number}
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardPin.passportSeries", "Pasport seriýasy")} value={data.passport_series} />
|
||||
<InfoRow label={t("cardPin.passportNumber", "Pasport belgisi")} value={data.passport_number} />
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
{/* ── Row 3: Passport images ───────────────────────────────────────── */}
|
||||
<BentoGrid cols={4}>
|
||||
<BentoCard title={t("cardPin.passportFile1", "Sahypa 1")}>
|
||||
<PassportImage
|
||||
label={t("cardPin.passportFile1", "Pasport (sahypa 1)")}
|
||||
url={data.passport_file_1}
|
||||
/>
|
||||
<PassportImage label={t("cardPin.passportFile1", "Pasport (sahypa 1)")} url={data.passport_file_1} />
|
||||
</BentoCard>
|
||||
<BentoCard title={t("cardPin.passportFile2", "Sahypa 2-3")}>
|
||||
<PassportImage
|
||||
label={t("cardPin.passportFile2", "Pasport (2-3-nji sahypa)")}
|
||||
url={data.passport_file_2}
|
||||
/>
|
||||
<PassportImage label={t("cardPin.passportFile2", "Pasport (2-3-nji sahypa)")} url={data.passport_file_2} />
|
||||
</BentoCard>
|
||||
<BentoCard title={t("cardPin.passportFile3", "Sahypa 8-9")}>
|
||||
<PassportImage
|
||||
label={t("cardPin.passportFile3", "Pasport (8-9 sahypa)")}
|
||||
url={data.passport_file_3}
|
||||
/>
|
||||
<PassportImage label={t("cardPin.passportFile3", "Pasport (8-9 sahypa)")} url={data.passport_file_3} />
|
||||
</BentoCard>
|
||||
<BentoCard title={t("cardPin.passportFile4", "Sahypa 32")}>
|
||||
<PassportImage
|
||||
label={t("cardPin.passportFile4", "Pasport (32-nji sahypa)")}
|
||||
url={data.passport_file_4}
|
||||
/>
|
||||
<PassportImage label={t("cardPin.passportFile4", "Pasport (32-nji sahypa)")} url={data.passport_file_4} />
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
</div>
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -1,10 +1,6 @@
|
||||
import { useParams, useNavigate } from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
useCardRequisite,
|
||||
useDeleteCardRequisite,
|
||||
useDownloadCardRequisite,
|
||||
} from "@/features/cardRequisites/hooks/useCardRequisites";
|
||||
import { useCardRequisite, useDeleteCardRequisite, useDownloadCardRequisite } from "@/features/cardRequisites/hooks/useCardRequisites";
|
||||
import type { CardRequisiteStatus } from "@/features/cardRequisites/api/cardRequisitesApi";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -19,33 +15,30 @@ import {
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
} from "@/components/ui/alert-dialog";
|
||||
import {
|
||||
StatusBadge,
|
||||
type StatusBadgeVariant,
|
||||
} from "@/components/ui/statusBadge";
|
||||
import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadge";
|
||||
import { AlertCircle, CheckCircle2, XCircle } from "lucide-react";
|
||||
import { BentoGrid, BentoCard, InfoRow, PassportImage } from "@/components/viewPageComponents";
|
||||
|
||||
// ─── Status config ────────────────────────────────────────────────────────────
|
||||
|
||||
const STATUS_VARIANT: Record<CardRequisiteStatus, StatusBadgeVariant> = {
|
||||
pending: "warning",
|
||||
pending: "warning",
|
||||
approved: "success",
|
||||
rejected: "error",
|
||||
}
|
||||
};
|
||||
|
||||
const STATUS_ICON: Record<CardRequisiteStatus, React.ElementType> = {
|
||||
pending: AlertCircle,
|
||||
pending: AlertCircle,
|
||||
approved: CheckCircle2,
|
||||
rejected: XCircle,
|
||||
}
|
||||
};
|
||||
|
||||
function CardRequisiteStatusBadge({ status }: { status: CardRequisiteStatus }) {
|
||||
const { t } = useTranslation()
|
||||
const variant = STATUS_VARIANT[status]
|
||||
const Icon = STATUS_ICON[status]
|
||||
if (!variant) return <span className="text-xs text-muted-foreground">{status}</span>
|
||||
return <StatusBadge label={t(`cardRequisite.status.${status}`)} variant={variant} icon={Icon} />
|
||||
const { t } = useTranslation();
|
||||
const variant = STATUS_VARIANT[status];
|
||||
const Icon = STATUS_ICON[status];
|
||||
if (!variant) return <span className="text-xs text-muted-foreground">{status}</span>;
|
||||
return <StatusBadge label={t(`cardRequisite.status.${status}`)} variant={variant} icon={Icon} />;
|
||||
}
|
||||
|
||||
// ─── Skeleton ─────────────────────────────────────────────────────────────────
|
||||
@@ -65,35 +58,30 @@ function CardRequisiteViewSkeleton() {
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// ─── Page ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
export default function CardRequisiteViewPage() {
|
||||
const { id } = useParams<{ id: string }>()
|
||||
const navigate = useNavigate()
|
||||
const { t } = useTranslation()
|
||||
const { id } = useParams<{ id: string }>();
|
||||
const navigate = useNavigate();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { data, isLoading, isError } = useCardRequisite(id ?? "")
|
||||
const deleteMutation = useDeleteCardRequisite()
|
||||
const downloadMutation = useDownloadCardRequisite()
|
||||
const { data, isLoading, isError } = useCardRequisite(id ?? "");
|
||||
const deleteMutation = useDeleteCardRequisite();
|
||||
const downloadMutation = useDownloadCardRequisite();
|
||||
|
||||
if (isLoading) {
|
||||
return <CardRequisiteViewSkeleton />
|
||||
return <CardRequisiteViewSkeleton />;
|
||||
}
|
||||
|
||||
if (isError || !data) {
|
||||
return (
|
||||
<div className="flex items-center justify-center py-24 text-muted-foreground">
|
||||
{t("common.notFound", "Maglumat tapylmady")}
|
||||
</div>
|
||||
)
|
||||
return <div className="flex items-center justify-center py-24 text-muted-foreground">{t("common.notFound", "Maglumat tapylmady")}</div>;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="mx-auto flex flex-col gap-6">
|
||||
|
||||
{/* ── Page header ──────────────────────────────────────────────────── */}
|
||||
<div className="flex items-start justify-between">
|
||||
<h1 className="text-xl font-bold text-foreground">
|
||||
@@ -101,7 +89,8 @@ export default function CardRequisiteViewPage() {
|
||||
</h1>
|
||||
<div className="flex items-center gap-2">
|
||||
<Button
|
||||
size="icon" variant="ghost"
|
||||
size="icon"
|
||||
variant="ghost"
|
||||
className="h-8 w-8"
|
||||
onClick={() => downloadMutation.mutate(data.id)}
|
||||
disabled={downloadMutation.isPending}
|
||||
@@ -110,27 +99,19 @@ export default function CardRequisiteViewPage() {
|
||||
</Button>
|
||||
<AlertDialog>
|
||||
<AlertDialogTitle asChild>
|
||||
<Button
|
||||
size="icon"
|
||||
variant="ghost"
|
||||
className="h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10"
|
||||
>
|
||||
<Button size="icon" variant="ghost" className="h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10">
|
||||
<Trash2 size={15} />
|
||||
</Button>
|
||||
</AlertDialogTitle>
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>
|
||||
{t("cardRequisite.deleteTitle", "Pozmak isleýärsiňizmi?")}
|
||||
</AlertDialogTitle>
|
||||
<AlertDialogTitle>{t("cardRequisite.deleteTitle", "Pozmak isleýärsiňizmi?")}</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
{t("cardRequisite.deleteDesc", "Bu amal yzyna dolanyp bolmaz.")} {data.id}
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel disabled={deleteMutation.isPending}>
|
||||
{t("common.cancel", "Ýatyr")}
|
||||
</AlertDialogCancel>
|
||||
<AlertDialogCancel disabled={deleteMutation.isPending}>{t("common.cancel", "Ýatyr")}</AlertDialogCancel>
|
||||
<AlertDialogAction
|
||||
disabled={deleteMutation.isPending}
|
||||
className="bg-destructive hover:bg-destructive/90"
|
||||
@@ -142,10 +123,7 @@ export default function CardRequisiteViewPage() {
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
|
||||
<Button
|
||||
size="icon" variant="ghost" className="h-8 w-8"
|
||||
onClick={() => navigate(`/card-requisites/${id}/edit`)}
|
||||
>
|
||||
<Button size="icon" variant="ghost" className="h-8 w-8" onClick={() => navigate(`/card-requisites/${id}/edit`)}>
|
||||
<Pencil size={15} />
|
||||
</Button>
|
||||
</div>
|
||||
@@ -154,101 +132,63 @@ export default function CardRequisiteViewPage() {
|
||||
{/* ── Row 1: Meta + Kart + Lokasiýa ────────────────────────────────── */}
|
||||
<BentoGrid cols={3}>
|
||||
<BentoCard title={t("cardRequisite.metaSection", "Esasy maglumatlar")}>
|
||||
<InfoRow label={t("common.id", "ID")}>
|
||||
<span className="font-mono">{data.id}</span>
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardRequisite.createdAt", "Döredilen wagty")}>
|
||||
{data.created_at}
|
||||
</InfoRow>
|
||||
<InfoRow label={t("common.id", "ID")} value={data.id} />
|
||||
<InfoRow label={t("cardRequisite.createdAt", "Döredilen wagty")} value={data.created_at} />
|
||||
<InfoRow label={t("cardRequisite.status", "Status")}>
|
||||
<CardRequisiteStatusBadge status={data.status} />
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardRequisite.note", "Bellik")}>
|
||||
{data.note || "—"}
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardRequisite.createdBy", "Sargyt eden")}>
|
||||
{data.first_name && data.last_name ? (
|
||||
<span className="text-primary font-medium">
|
||||
{data.last_name}_{data.first_name}
|
||||
</span>
|
||||
) : "—"}
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardRequisite.note", "Bellik")} value={data.note || undefined} />
|
||||
<InfoRow
|
||||
label={t("cardRequisite.createdBy", "Sargyt eden")}
|
||||
value={data.first_name && data.last_name ? `${data.last_name}_${data.first_name}` : undefined}
|
||||
isLink
|
||||
/>
|
||||
</BentoCard>
|
||||
|
||||
<BentoCard title={t("cardRequisite.cardSection", "Kart")}>
|
||||
<InfoRow label={t("cardRequisite.cardNumber", "Kart belgisi")}>
|
||||
<span className="font-mono tracking-wider">{data.card_number}</span>
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardRequisite.cardExpireMonth", "Kart Möhleti (aý)")}>
|
||||
{data.card_expiry_month}
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardRequisite.cardExpireYear", "Kart Möhleti (ýyl)")}>
|
||||
{data.card_expiry_year}
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardRequisite.cardNumber", "Kart belgisi")} value={data.card_number} />
|
||||
<InfoRow label={t("cardRequisite.cardExpireMonth", "Kart Möhleti (aý)")} value={data.card_expiry_month} />
|
||||
<InfoRow label={t("cardRequisite.cardExpireYear", "Kart Möhleti (ýyl)")} value={data.card_expiry_year} />
|
||||
</BentoCard>
|
||||
|
||||
<BentoCard title={t("cardRequisite.locationSection", "Lokasiýa")}>
|
||||
<InfoRow label={t("cardRequisite.province", "Welaýat")}>
|
||||
{data.province_name ?? "—"}
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardRequisite.branch", "Şahamça")}>
|
||||
<span className="text-primary font-medium">{data.branch_name ?? "—"}</span>
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardRequisite.province", "Welaýat")} value={data.province_name ?? undefined} />
|
||||
<InfoRow label={t("cardRequisite.branch", "Şahamça")} value={data.branch_name ?? undefined} isLink />
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
{/* ── Row 2: Şahsy + Pasport maglumatlary ──────────────────────────── */}
|
||||
<BentoGrid cols={2}>
|
||||
<BentoCard title={t("cardRequisite.personalSection", "Şahsy maglumatlar")}>
|
||||
<InfoRow label={t("cardRequisite.fullName", "Doly ady")}>
|
||||
{[data.first_name, data.last_name, data.middle_name].filter(Boolean).join(" ")}
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardRequisite.birthDate", "Doglan güni")}>
|
||||
{data.birth_date}
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardRequisite.phone", "Telefon")}>
|
||||
{data.phone}
|
||||
</InfoRow>
|
||||
<InfoRow
|
||||
label={t("cardRequisite.fullName", "Doly ady")}
|
||||
value={[data.first_name, data.last_name, data.middle_name].filter(Boolean).join(" ")}
|
||||
/>
|
||||
<InfoRow label={t("cardRequisite.birthDate", "Doglan güni")} value={data.birth_date} />
|
||||
<InfoRow label={t("cardRequisite.phone", "Telefon")} value={data.phone} />
|
||||
</BentoCard>
|
||||
|
||||
<BentoCard title={t("cardRequisite.passportSection", "Pasport")}>
|
||||
<InfoRow label={t("cardRequisite.passportSeries", "Pasport seriýasy")}>
|
||||
{data.passport_series}
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardRequisite.passportNumber", "Pasport belgisi")}>
|
||||
{data.passport_number}
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardRequisite.passportSeries", "Pasport seriýasy")} value={data.passport_series} />
|
||||
<InfoRow label={t("cardRequisite.passportNumber", "Pasport belgisi")} value={data.passport_number} />
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
{/* ── Row 3: Passport images ────────────────────────────────────────── */}
|
||||
<BentoGrid cols={4}>
|
||||
<BentoCard title={t("cardRequisite.passportFile1", "Sahypa 1")}>
|
||||
<PassportImage
|
||||
label={t("cardRequisite.passportFile1", "Pasport (sahypa 1)")}
|
||||
src={data.passport_page1_url}
|
||||
/>
|
||||
<PassportImage label={t("cardRequisite.passportFile1", "Pasport (sahypa 1)")} src={data.passport_page1_url} />
|
||||
</BentoCard>
|
||||
<BentoCard title={t("cardRequisite.passportFile2", "Sahypa 2-3")}>
|
||||
<PassportImage
|
||||
label={t("cardRequisite.passportFile2", "Pasport (2-3-nji sahypa)")}
|
||||
src={data.passport_page2_3_url}
|
||||
/>
|
||||
<PassportImage label={t("cardRequisite.passportFile2", "Pasport (2-3-nji sahypa)")} src={data.passport_page2_3_url} />
|
||||
</BentoCard>
|
||||
<BentoCard title={t("cardRequisite.passportFile3", "Sahypa 8-9")}>
|
||||
<PassportImage
|
||||
label={t("cardRequisite.passportFile3", "Pasport (8-9 sahypa)")}
|
||||
src={data.passport_page8_9_url}
|
||||
/>
|
||||
<PassportImage label={t("cardRequisite.passportFile3", "Pasport (8-9 sahypa)")} src={data.passport_page8_9_url} />
|
||||
</BentoCard>
|
||||
<BentoCard title={t("cardRequisite.passportFile4", "Sahypa 32")}>
|
||||
<PassportImage
|
||||
label={t("cardRequisite.passportFile4", "Pasport (32-nji sahypa)")}
|
||||
src={data.passport_page32_url}
|
||||
/>
|
||||
<PassportImage label={t("cardRequisite.passportFile4", "Pasport (32-nji sahypa)")} src={data.passport_page32_url} />
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -111,8 +111,8 @@ export default function CardOrderDetailPage() {
|
||||
{/* ── Row 1: Meta + Kart + Lokasiýa ───────────────────────────────── */}
|
||||
<BentoGrid cols={3}>
|
||||
<BentoCard title={t("cardOrder.section.meta", "Esasy maglumatlar")}>
|
||||
<InfoRow label={t("common.id", "ID")}>{order.id}</InfoRow>
|
||||
<InfoRow label={t("cardOrder.field.createdAt", "Döredilen wagty")}>{order.createdAt}</InfoRow>
|
||||
<InfoRow label={t("common.id", "ID")} value={order.id} />
|
||||
<InfoRow label={t("cardOrder.field.createdAt", "Döredilen wagty")} value={order.createdAt} />
|
||||
<InfoRow label={t("cardOrder.field.status", "Status")}>
|
||||
<CardOrderStatusBadge status={order.status} />
|
||||
</InfoRow>
|
||||
@@ -123,45 +123,38 @@ export default function CardOrderDetailPage() {
|
||||
{order.isPaid ? "✓" : "✕"}
|
||||
</span>
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardOrder.field.note", "Bellik")}>{order.note ?? "—"}</InfoRow>
|
||||
<InfoRow label={t("cardOrder.field.createdBy", "Sargyt eden")}>
|
||||
<span className="text-primary font-medium">{order.createdBy}</span>
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardOrder.field.note", "Bellik")} value={order.note ?? undefined} />
|
||||
<InfoRow label={t("cardOrder.field.createdBy", "Sargyt eden")} value={order.createdBy} isLink />
|
||||
</BentoCard>
|
||||
|
||||
<BentoCard title={t("cardOrder.section.card", "Kart")}>
|
||||
<InfoRow label={t("cardOrder.field.issuanceReason", "Kartyň çykarylmagynyň sebäbi")}>
|
||||
<span className="text-primary font-medium">{order.issuanceReasonName}</span>
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardOrder.field.cardType", "Kart görnüşi")}>
|
||||
<span className="text-cyan-400 font-medium">{order.cardTypeName}</span>
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardOrder.field.issuanceReason", "Kartyň çykarylmagynyň sebäbi")} value={order.issuanceReasonName} isLink />
|
||||
<InfoRow label={t("cardOrder.field.cardType", "Kart görnüşi")} value={order.cardTypeName} />
|
||||
</BentoCard>
|
||||
|
||||
<BentoCard title={t("cardOrder.section.location", "Lokasiýa")}>
|
||||
<InfoRow label={t("cardOrder.field.province", "Welaýat")}>{order.provinceName}</InfoRow>
|
||||
<InfoRow label={t("cardOrder.field.branch", "Şahamça")}>
|
||||
<span className="text-cyan-400 font-medium">{order.branchName}</span>
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardOrder.field.province", "Welaýat")} value={order.provinceName} />
|
||||
<InfoRow label={t("cardOrder.field.branch", "Şahamça")} value={order.branchName} />
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
{/* ── Row 2: Şahsy maglumatlar (full width — many fields) ─────────── */}
|
||||
<BentoGrid cols={2}>
|
||||
<BentoCard title={t("cardOrder.section.personal", "Şahsy maglumatlar")}>
|
||||
<InfoRow label={t("cardOrder.field.fullName", "Doly ady")}>
|
||||
{[order.lastName, order.firstName, order.middleName].filter(Boolean).join(" ")}
|
||||
</InfoRow>
|
||||
<InfoRow label={t("cardOrder.field.birthDate", "Doglan güni")}>{order.birthDate}</InfoRow>
|
||||
<InfoRow label={t("cardOrder.field.citizenship", "Raýatlyk")}>{order.citizenship}</InfoRow>
|
||||
<InfoRow label={t("cardOrder.field.registeredAddress", "Ýazgy edilen salgy")}>{order.registeredAddress}</InfoRow>
|
||||
<InfoRow label={t("cardOrder.field.currentAddress", "Häzirki ýaşaýyş ýeri")}>{order.currentAddress}</InfoRow>
|
||||
<InfoRow label={t("cardOrder.field.workplace", "Işleýän ýeri we wezipesi")}>{order.workplace}</InfoRow>
|
||||
<InfoRow
|
||||
label={t("cardOrder.field.fullName", "Doly ady")}
|
||||
value={[order.lastName, order.firstName, order.middleName].filter(Boolean).join(" ")}
|
||||
/>
|
||||
<InfoRow label={t("cardOrder.field.birthDate", "Doglan güni")} value={order.birthDate} />
|
||||
<InfoRow label={t("cardOrder.field.citizenship", "Raýatlyk")} value={order.citizenship} />
|
||||
<InfoRow label={t("cardOrder.field.registeredAddress", "Ýazgy edilen salgy")} value={order.registeredAddress} />
|
||||
<InfoRow label={t("cardOrder.field.currentAddress", "Häzirki ýaşaýyş ýeri")} value={order.currentAddress} />
|
||||
<InfoRow label={t("cardOrder.field.workplace", "Işleýän ýeri we wezipesi")} value={order.workplace} />
|
||||
</BentoCard>
|
||||
|
||||
<BentoCard title={t("cardOrder.section.contacts", "Kontakt")}>
|
||||
<InfoRow label={t("cardOrder.field.phone", "Telefon")}>{order.phone}</InfoRow>
|
||||
<InfoRow label={t("cardOrder.field.phoneExtra", "Telefon goşmaça")}>{order.phoneExtra ?? "—"}</InfoRow>
|
||||
<InfoRow label={t("cardOrder.field.phone", "Telefon")} value={order.phone} />
|
||||
<InfoRow label={t("cardOrder.field.phoneExtra", "Telefon goşmaça")} value={order.phoneExtra ?? undefined} />
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
|
||||
Reference in new issue
Block a user