refactored some view pages

This commit is contained in:
@jcarymuhammedow committed 2026-06-04 17:36:57 +05:00
1 parent ef9d6201eb
commit 84c5ff4153
4 files changed
+234 -350

No files matched your search

+44 -110
View File
@@ -1,9 +1,6 @@
import { useParams, useNavigate } from "react-router-dom"; import { useParams, useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { import { useCardPin, useDeleteCardPin } from "@/features/cardPins/hooks/useCardPins";
useCardPin,
useDeleteCardPin,
} from "@/features/cardPins/hooks/useCardPins";
import type { CardPinStatus } from "@/features/cardPins/api/cardPinApi"; import type { CardPinStatus } from "@/features/cardPins/api/cardPinApi";
import { Skeleton } from "@/components/ui/skeleton"; import { Skeleton } from "@/components/ui/skeleton";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
@@ -18,33 +15,30 @@ import {
AlertDialogHeader, AlertDialogHeader,
AlertDialogTitle, AlertDialogTitle,
} from "@/components/ui/alert-dialog"; } from "@/components/ui/alert-dialog";
import { import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadge";
StatusBadge,
type StatusBadgeVariant,
} from "@/components/ui/statusBadge";
import { AlertCircle, CheckCircle2, XCircle } from "lucide-react"; import { AlertCircle, CheckCircle2, XCircle } from "lucide-react";
import { BentoGrid, BentoCard, InfoRow, PassportImage } from "@/components/viewPageComponents"; import { BentoGrid, BentoCard, InfoRow, PassportImage } from "@/components/viewPageComponents";
// ─── Status config ──────────────────────────────────────────────────────────── // ─── Status config ────────────────────────────────────────────────────────────
const STATUS_VARIANT: Record<CardPinStatus, StatusBadgeVariant> = { const STATUS_VARIANT: Record<CardPinStatus, StatusBadgeVariant> = {
pending: "warning", pending: "warning",
approved: "success", approved: "success",
rejected: "error", rejected: "error",
} };
const STATUS_ICON: Record<CardPinStatus, React.ElementType> = { const STATUS_ICON: Record<CardPinStatus, React.ElementType> = {
pending: AlertCircle, pending: AlertCircle,
approved: CheckCircle2, approved: CheckCircle2,
rejected: XCircle, rejected: XCircle,
} };
function CardPinStatusBadge({ status }: { status: CardPinStatus }) { function CardPinStatusBadge({ status }: { status: CardPinStatus }) {
const { t } = useTranslation() const { t } = useTranslation();
const variant = STATUS_VARIANT[status] const variant = STATUS_VARIANT[status];
const Icon = STATUS_ICON[status] const Icon = STATUS_ICON[status];
if (!variant) return <span className="text-xs text-muted-foreground">{status}</span> if (!variant) return <span className="text-xs text-muted-foreground">{status}</span>;
return <StatusBadge label={t(`cardPin.status.${status}`)} variant={variant} icon={Icon} /> return <StatusBadge label={t(`cardPin.status.${status}`)} variant={variant} icon={Icon} />;
} }
// ─── Skeleton ───────────────────────────────────────────────────────────────── // ─── Skeleton ─────────────────────────────────────────────────────────────────
@@ -64,34 +58,29 @@ function CardPinViewSkeleton() {
))} ))}
</div> </div>
</div> </div>
) );
} }
// ─── Page ───────────────────────────────────────────────────────────────────── // ─── Page ─────────────────────────────────────────────────────────────────────
export default function CardPinViewPage() { export default function CardPinViewPage() {
const { id } = useParams<{ id: string }>() const { id } = useParams<{ id: string }>();
const navigate = useNavigate() const navigate = useNavigate();
const { t } = useTranslation() const { t } = useTranslation();
const { data, isLoading, isError } = useCardPin(id!) const { data, isLoading, isError } = useCardPin(id!);
const { mutate: deletePin, isPending: isDeleting } = useDeleteCardPin() const { mutate: deletePin, isPending: isDeleting } = useDeleteCardPin();
if (isLoading) { if (isLoading) {
return <CardPinViewSkeleton /> return <CardPinViewSkeleton />;
} }
if (isError || !data) { if (isError || !data) {
return ( return <div className="flex items-center justify-center py-24 text-muted-foreground">{t("common.notFound", "Maglumat tapylmady")}</div>;
<div className="flex items-center justify-center py-24 text-muted-foreground">
{t("common.notFound", "Maglumat tapylmady")}
</div>
)
} }
return ( return (
<div className="mx-auto flex flex-col gap-6"> <div className="mx-auto flex flex-col gap-6">
{/* ── Page header ──────────────────────────────────────────────────── */} {/* ── Page header ──────────────────────────────────────────────────── */}
<div className="flex items-start justify-between"> <div className="flex items-start justify-between">
<h1 className="text-xl font-bold text-foreground"> <h1 className="text-xl font-bold text-foreground">
@@ -100,28 +89,19 @@ export default function CardPinViewPage() {
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<AlertDialog> <AlertDialog>
<AlertDialogTitle asChild> <AlertDialogTitle asChild>
<Button <Button size="icon" variant="ghost" className="h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10">
size="icon"
variant="ghost"
className="h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10"
>
<Trash2 size={15} /> <Trash2 size={15} />
</Button> </Button>
</AlertDialogTitle> </AlertDialogTitle>
<AlertDialogContent> <AlertDialogContent>
<AlertDialogHeader> <AlertDialogHeader>
<AlertDialogTitle> <AlertDialogTitle>{t("cardPin.deleteTitle", "Pozmak isleýärsiňizmi?")}</AlertDialogTitle>
{t("cardPin.deleteTitle", "Pozmak isleýärsiňizmi?")}
</AlertDialogTitle>
<AlertDialogDescription> <AlertDialogDescription>
{t("cardPin.deleteDesc", "Bu amal yzyna dolanyp bolmaz.")}{" "} {t("cardPin.deleteDesc", "Bu amal yzyna dolanyp bolmaz.")} {data.id}
{data.id}
</AlertDialogDescription> </AlertDialogDescription>
</AlertDialogHeader> </AlertDialogHeader>
<AlertDialogFooter> <AlertDialogFooter>
<AlertDialogCancel disabled={isDeleting}> <AlertDialogCancel disabled={isDeleting}>{t("common.cancel", "Ýatyr")}</AlertDialogCancel>
{t("common.cancel", "Ýatyr")}
</AlertDialogCancel>
<AlertDialogAction <AlertDialogAction
disabled={isDeleting} disabled={isDeleting}
className="bg-destructive hover:bg-destructive/90" className="bg-destructive hover:bg-destructive/90"
@@ -133,12 +113,7 @@ export default function CardPinViewPage() {
</AlertDialogContent> </AlertDialogContent>
</AlertDialog> </AlertDialog>
<Button <Button size="icon" variant="ghost" className="h-8 w-8" onClick={() => navigate(`/card-pins/${id}/edit`)}>
size="icon"
variant="ghost"
className="h-8 w-8"
onClick={() => navigate(`/card-pins/${id}/edit`)}
>
<Pencil size={15} /> <Pencil size={15} />
</Button> </Button>
</div> </div>
@@ -147,97 +122,56 @@ export default function CardPinViewPage() {
{/* ── Row 1: Meta + Kart + Lokasiýa ───────────────────────────────── */} {/* ── Row 1: Meta + Kart + Lokasiýa ───────────────────────────────── */}
<BentoGrid cols={3}> <BentoGrid cols={3}>
<BentoCard title={t("cardPin.metaSection", "Esasy maglumatlar")}> <BentoCard title={t("cardPin.metaSection", "Esasy maglumatlar")}>
<InfoRow label={t("common.id", "ID")}> <InfoRow label={t("common.id", "ID")} value={data.id} />
<span className="font-mono">{data.id}</span> <InfoRow label={t("cardPin.createdAt", "Döredilen wagty")} value={data.created_at} />
</InfoRow>
<InfoRow label={t("cardPin.createdAt", "Döredilen wagty")}>
{data.created_at}
</InfoRow>
<InfoRow label={t("cardPin.status", "Status")}> <InfoRow label={t("cardPin.status", "Status")}>
<CardPinStatusBadge status={data.status} /> <CardPinStatusBadge status={data.status} />
</InfoRow> </InfoRow>
<InfoRow label={t("cardPin.note", "Bellik")}> <InfoRow label={t("cardPin.note", "Bellik")} value={data.note || undefined} />
{data.note || "—"} <InfoRow label={t("cardPin.createdBy", "Sargyt eden")} value={data.created_by_label} isLink />
</InfoRow>
<InfoRow label={t("cardPin.createdBy", "Sargyt eden")}>
<span className="text-primary font-medium">{data.created_by_label}</span>
</InfoRow>
</BentoCard> </BentoCard>
<BentoCard title={t("cardPin.cardSection", "Kart")}> <BentoCard title={t("cardPin.cardSection", "Kart")}>
<InfoRow label={t("cardPin.cardNumber", "Kart belgisi")}> <InfoRow label={t("cardPin.cardNumber", "Kart belgisi")} value={data.card_number} />
<span className="font-mono tracking-wider">{data.card_number}</span> <InfoRow label={t("cardPin.cardExpireMonth", "Kart Möhleti (aý)")} value={null} />
</InfoRow> <InfoRow label={t("cardPin.cardExpireYear", "Kart Möhleti (ýyl)")} value={null} />
<InfoRow label={t("cardPin.cardExpireMonth", "Kart Möhleti (aý)")}>
—
</InfoRow>
<InfoRow label={t("cardPin.cardExpireYear", "Kart Möhleti (ýyl)")}>
—
</InfoRow>
</BentoCard> </BentoCard>
<BentoCard title={t("cardPin.locationSection", "Lokasiýa")}> <BentoCard title={t("cardPin.locationSection", "Lokasiýa")}>
<InfoRow label={t("cardPin.province", "Welaýat")}> <InfoRow label={t("cardPin.province", "Welaýat")} value={data.province_label} />
{data.province_label} <InfoRow label={t("cardPin.branch", "Şahamça")} value={data.branch_label} isLink />
</InfoRow>
<InfoRow label={t("cardPin.branch", "Şahamça")}>
<span className="text-primary font-medium">{data.branch_label}</span>
</InfoRow>
</BentoCard> </BentoCard>
</BentoGrid> </BentoGrid>
{/* ── Row 2: Şahsy + Pasport maglumatlary ─────────────────────────── */} {/* ── Row 2: Şahsy + Pasport maglumatlary ─────────────────────────── */}
<BentoGrid cols={2}> <BentoGrid cols={2}>
<BentoCard title={t("cardPin.personalSection", "Şahsy maglumatlar")}> <BentoCard title={t("cardPin.personalSection", "Şahsy maglumatlar")}>
<InfoRow label={t("cardPin.fullName", "Doly ady")}> <InfoRow label={t("cardPin.fullName", "Doly ady")} value={`${data.last_name} ${data.first_name} ${data.father_name}`} />
{`${data.last_name} ${data.first_name} ${data.father_name}`} <InfoRow label={t("cardPin.birthDate", "Doglan güni")} value={data.birth_date} />
</InfoRow> <InfoRow label={t("cardPin.phone", "Telefon")} value={`+${data.phone}`} />
<InfoRow label={t("cardPin.birthDate", "Doglan güni")}>
{data.birth_date}
</InfoRow>
<InfoRow label={t("cardPin.phone", "Telefon")}>
+{data.phone}
</InfoRow>
</BentoCard> </BentoCard>
<BentoCard title={t("cardPin.passportSection", "Pasport")}> <BentoCard title={t("cardPin.passportSection", "Pasport")}>
<InfoRow label={t("cardPin.passportSeries", "Pasport seriýasy")}> <InfoRow label={t("cardPin.passportSeries", "Pasport seriýasy")} value={data.passport_series} />
{data.passport_series} <InfoRow label={t("cardPin.passportNumber", "Pasport belgisi")} value={data.passport_number} />
</InfoRow>
<InfoRow label={t("cardPin.passportNumber", "Pasport belgisi")}>
{data.passport_number}
</InfoRow>
</BentoCard> </BentoCard>
</BentoGrid> </BentoGrid>
{/* ── Row 3: Passport images ───────────────────────────────────────── */} {/* ── Row 3: Passport images ───────────────────────────────────────── */}
<BentoGrid cols={4}> <BentoGrid cols={4}>
<BentoCard title={t("cardPin.passportFile1", "Sahypa 1")}> <BentoCard title={t("cardPin.passportFile1", "Sahypa 1")}>
<PassportImage <PassportImage label={t("cardPin.passportFile1", "Pasport (sahypa 1)")} url={data.passport_file_1} />
label={t("cardPin.passportFile1", "Pasport (sahypa 1)")}
url={data.passport_file_1}
/>
</BentoCard> </BentoCard>
<BentoCard title={t("cardPin.passportFile2", "Sahypa 2-3")}> <BentoCard title={t("cardPin.passportFile2", "Sahypa 2-3")}>
<PassportImage <PassportImage label={t("cardPin.passportFile2", "Pasport (2-3-nji sahypa)")} url={data.passport_file_2} />
label={t("cardPin.passportFile2", "Pasport (2-3-nji sahypa)")}
url={data.passport_file_2}
/>
</BentoCard> </BentoCard>
<BentoCard title={t("cardPin.passportFile3", "Sahypa 8-9")}> <BentoCard title={t("cardPin.passportFile3", "Sahypa 8-9")}>
<PassportImage <PassportImage label={t("cardPin.passportFile3", "Pasport (8-9 sahypa)")} url={data.passport_file_3} />
label={t("cardPin.passportFile3", "Pasport (8-9 sahypa)")}
url={data.passport_file_3}
/>
</BentoCard> </BentoCard>
<BentoCard title={t("cardPin.passportFile4", "Sahypa 32")}> <BentoCard title={t("cardPin.passportFile4", "Sahypa 32")}>
<PassportImage <PassportImage label={t("cardPin.passportFile4", "Pasport (32-nji sahypa)")} url={data.passport_file_4} />
label={t("cardPin.passportFile4", "Pasport (32-nji sahypa)")}
url={data.passport_file_4}
/>
</BentoCard> </BentoCard>
</BentoGrid> </BentoGrid>
</div> </div>
) );
} }
@@ -1,10 +1,6 @@
import { useParams, useNavigate } from "react-router-dom"; import { useParams, useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { import { useCardRequisite, useDeleteCardRequisite, useDownloadCardRequisite } from "@/features/cardRequisites/hooks/useCardRequisites";
useCardRequisite,
useDeleteCardRequisite,
useDownloadCardRequisite,
} from "@/features/cardRequisites/hooks/useCardRequisites";
import type { CardRequisiteStatus } from "@/features/cardRequisites/api/cardRequisitesApi"; import type { CardRequisiteStatus } from "@/features/cardRequisites/api/cardRequisitesApi";
import { Skeleton } from "@/components/ui/skeleton"; import { Skeleton } from "@/components/ui/skeleton";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
@@ -19,33 +15,30 @@ import {
AlertDialogHeader, AlertDialogHeader,
AlertDialogTitle, AlertDialogTitle,
} from "@/components/ui/alert-dialog"; } from "@/components/ui/alert-dialog";
import { import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadge";
StatusBadge,
type StatusBadgeVariant,
} from "@/components/ui/statusBadge";
import { AlertCircle, CheckCircle2, XCircle } from "lucide-react"; import { AlertCircle, CheckCircle2, XCircle } from "lucide-react";
import { BentoGrid, BentoCard, InfoRow, PassportImage } from "@/components/viewPageComponents"; import { BentoGrid, BentoCard, InfoRow, PassportImage } from "@/components/viewPageComponents";
// ─── Status config ──────────────────────────────────────────────────────────── // ─── Status config ────────────────────────────────────────────────────────────
const STATUS_VARIANT: Record<CardRequisiteStatus, StatusBadgeVariant> = { const STATUS_VARIANT: Record<CardRequisiteStatus, StatusBadgeVariant> = {
pending: "warning", pending: "warning",
approved: "success", approved: "success",
rejected: "error", rejected: "error",
} };
const STATUS_ICON: Record<CardRequisiteStatus, React.ElementType> = { const STATUS_ICON: Record<CardRequisiteStatus, React.ElementType> = {
pending: AlertCircle, pending: AlertCircle,
approved: CheckCircle2, approved: CheckCircle2,
rejected: XCircle, rejected: XCircle,
} };
function CardRequisiteStatusBadge({ status }: { status: CardRequisiteStatus }) { function CardRequisiteStatusBadge({ status }: { status: CardRequisiteStatus }) {
const { t } = useTranslation() const { t } = useTranslation();
const variant = STATUS_VARIANT[status] const variant = STATUS_VARIANT[status];
const Icon = STATUS_ICON[status] const Icon = STATUS_ICON[status];
if (!variant) return <span className="text-xs text-muted-foreground">{status}</span> if (!variant) return <span className="text-xs text-muted-foreground">{status}</span>;
return <StatusBadge label={t(`cardRequisite.status.${status}`)} variant={variant} icon={Icon} /> return <StatusBadge label={t(`cardRequisite.status.${status}`)} variant={variant} icon={Icon} />;
} }
// ─── Skeleton ───────────────────────────────────────────────────────────────── // ─── Skeleton ─────────────────────────────────────────────────────────────────
@@ -65,35 +58,30 @@ function CardRequisiteViewSkeleton() {
))} ))}
</div> </div>
</div> </div>
) );
} }
// ─── Page ───────────────────────────────────────────────────────────────────── // ─── Page ─────────────────────────────────────────────────────────────────────
export default function CardRequisiteViewPage() { export default function CardRequisiteViewPage() {
const { id } = useParams<{ id: string }>() const { id } = useParams<{ id: string }>();
const navigate = useNavigate() const navigate = useNavigate();
const { t } = useTranslation() const { t } = useTranslation();
const { data, isLoading, isError } = useCardRequisite(id ?? "") const { data, isLoading, isError } = useCardRequisite(id ?? "");
const deleteMutation = useDeleteCardRequisite() const deleteMutation = useDeleteCardRequisite();
const downloadMutation = useDownloadCardRequisite() const downloadMutation = useDownloadCardRequisite();
if (isLoading) { if (isLoading) {
return <CardRequisiteViewSkeleton /> return <CardRequisiteViewSkeleton />;
} }
if (isError || !data) { if (isError || !data) {
return ( return <div className="flex items-center justify-center py-24 text-muted-foreground">{t("common.notFound", "Maglumat tapylmady")}</div>;
<div className="flex items-center justify-center py-24 text-muted-foreground">
{t("common.notFound", "Maglumat tapylmady")}
</div>
)
} }
return ( return (
<div className="mx-auto flex flex-col gap-6"> <div className="mx-auto flex flex-col gap-6">
{/* ── Page header ──────────────────────────────────────────────────── */} {/* ── Page header ──────────────────────────────────────────────────── */}
<div className="flex items-start justify-between"> <div className="flex items-start justify-between">
<h1 className="text-xl font-bold text-foreground"> <h1 className="text-xl font-bold text-foreground">
@@ -101,7 +89,8 @@ export default function CardRequisiteViewPage() {
</h1> </h1>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Button <Button
size="icon" variant="ghost" size="icon"
variant="ghost"
className="h-8 w-8" className="h-8 w-8"
onClick={() => downloadMutation.mutate(data.id)} onClick={() => downloadMutation.mutate(data.id)}
disabled={downloadMutation.isPending} disabled={downloadMutation.isPending}
@@ -110,27 +99,19 @@ export default function CardRequisiteViewPage() {
</Button> </Button>
<AlertDialog> <AlertDialog>
<AlertDialogTitle asChild> <AlertDialogTitle asChild>
<Button <Button size="icon" variant="ghost" className="h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10">
size="icon"
variant="ghost"
className="h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10"
>
<Trash2 size={15} /> <Trash2 size={15} />
</Button> </Button>
</AlertDialogTitle> </AlertDialogTitle>
<AlertDialogContent> <AlertDialogContent>
<AlertDialogHeader> <AlertDialogHeader>
<AlertDialogTitle> <AlertDialogTitle>{t("cardRequisite.deleteTitle", "Pozmak isleýärsiňizmi?")}</AlertDialogTitle>
{t("cardRequisite.deleteTitle", "Pozmak isleýärsiňizmi?")}
</AlertDialogTitle>
<AlertDialogDescription> <AlertDialogDescription>
{t("cardRequisite.deleteDesc", "Bu amal yzyna dolanyp bolmaz.")} {data.id} {t("cardRequisite.deleteDesc", "Bu amal yzyna dolanyp bolmaz.")} {data.id}
</AlertDialogDescription> </AlertDialogDescription>
</AlertDialogHeader> </AlertDialogHeader>
<AlertDialogFooter> <AlertDialogFooter>
<AlertDialogCancel disabled={deleteMutation.isPending}> <AlertDialogCancel disabled={deleteMutation.isPending}>{t("common.cancel", "Ýatyr")}</AlertDialogCancel>
{t("common.cancel", "Ýatyr")}
</AlertDialogCancel>
<AlertDialogAction <AlertDialogAction
disabled={deleteMutation.isPending} disabled={deleteMutation.isPending}
className="bg-destructive hover:bg-destructive/90" className="bg-destructive hover:bg-destructive/90"
@@ -142,10 +123,7 @@ export default function CardRequisiteViewPage() {
</AlertDialogContent> </AlertDialogContent>
</AlertDialog> </AlertDialog>
<Button <Button size="icon" variant="ghost" className="h-8 w-8" onClick={() => navigate(`/card-requisites/${id}/edit`)}>
size="icon" variant="ghost" className="h-8 w-8"
onClick={() => navigate(`/card-requisites/${id}/edit`)}
>
<Pencil size={15} /> <Pencil size={15} />
</Button> </Button>
</div> </div>
@@ -154,101 +132,63 @@ export default function CardRequisiteViewPage() {
{/* ── Row 1: Meta + Kart + Lokasiýa ────────────────────────────────── */} {/* ── Row 1: Meta + Kart + Lokasiýa ────────────────────────────────── */}
<BentoGrid cols={3}> <BentoGrid cols={3}>
<BentoCard title={t("cardRequisite.metaSection", "Esasy maglumatlar")}> <BentoCard title={t("cardRequisite.metaSection", "Esasy maglumatlar")}>
<InfoRow label={t("common.id", "ID")}> <InfoRow label={t("common.id", "ID")} value={data.id} />
<span className="font-mono">{data.id}</span> <InfoRow label={t("cardRequisite.createdAt", "Döredilen wagty")} value={data.created_at} />
</InfoRow>
<InfoRow label={t("cardRequisite.createdAt", "Döredilen wagty")}>
{data.created_at}
</InfoRow>
<InfoRow label={t("cardRequisite.status", "Status")}> <InfoRow label={t("cardRequisite.status", "Status")}>
<CardRequisiteStatusBadge status={data.status} /> <CardRequisiteStatusBadge status={data.status} />
</InfoRow> </InfoRow>
<InfoRow label={t("cardRequisite.note", "Bellik")}> <InfoRow label={t("cardRequisite.note", "Bellik")} value={data.note || undefined} />
{data.note || "—"} <InfoRow
</InfoRow> label={t("cardRequisite.createdBy", "Sargyt eden")}
<InfoRow label={t("cardRequisite.createdBy", "Sargyt eden")}> value={data.first_name && data.last_name ? `${data.last_name}_${data.first_name}` : undefined}
{data.first_name && data.last_name ? ( isLink
<span className="text-primary font-medium"> />
{data.last_name}_{data.first_name}
</span>
) : "—"}
</InfoRow>
</BentoCard> </BentoCard>
<BentoCard title={t("cardRequisite.cardSection", "Kart")}> <BentoCard title={t("cardRequisite.cardSection", "Kart")}>
<InfoRow label={t("cardRequisite.cardNumber", "Kart belgisi")}> <InfoRow label={t("cardRequisite.cardNumber", "Kart belgisi")} value={data.card_number} />
<span className="font-mono tracking-wider">{data.card_number}</span> <InfoRow label={t("cardRequisite.cardExpireMonth", "Kart Möhleti (aý)")} value={data.card_expiry_month} />
</InfoRow> <InfoRow label={t("cardRequisite.cardExpireYear", "Kart Möhleti (ýyl)")} value={data.card_expiry_year} />
<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>
</BentoCard> </BentoCard>
<BentoCard title={t("cardRequisite.locationSection", "Lokasiýa")}> <BentoCard title={t("cardRequisite.locationSection", "Lokasiýa")}>
<InfoRow label={t("cardRequisite.province", "Welaýat")}> <InfoRow label={t("cardRequisite.province", "Welaýat")} value={data.province_name ?? undefined} />
{data.province_name ?? "—"} <InfoRow label={t("cardRequisite.branch", "Şahamça")} value={data.branch_name ?? undefined} isLink />
</InfoRow>
<InfoRow label={t("cardRequisite.branch", "Şahamça")}>
<span className="text-primary font-medium">{data.branch_name ?? "—"}</span>
</InfoRow>
</BentoCard> </BentoCard>
</BentoGrid> </BentoGrid>
{/* ── Row 2: Şahsy + Pasport maglumatlary ──────────────────────────── */} {/* ── Row 2: Şahsy + Pasport maglumatlary ──────────────────────────── */}
<BentoGrid cols={2}> <BentoGrid cols={2}>
<BentoCard title={t("cardRequisite.personalSection", "Şahsy maglumatlar")}> <BentoCard title={t("cardRequisite.personalSection", "Şahsy maglumatlar")}>
<InfoRow label={t("cardRequisite.fullName", "Doly ady")}> <InfoRow
{[data.first_name, data.last_name, data.middle_name].filter(Boolean).join(" ")} label={t("cardRequisite.fullName", "Doly ady")}
</InfoRow> value={[data.first_name, data.last_name, data.middle_name].filter(Boolean).join(" ")}
<InfoRow label={t("cardRequisite.birthDate", "Doglan güni")}> />
{data.birth_date} <InfoRow label={t("cardRequisite.birthDate", "Doglan güni")} value={data.birth_date} />
</InfoRow> <InfoRow label={t("cardRequisite.phone", "Telefon")} value={data.phone} />
<InfoRow label={t("cardRequisite.phone", "Telefon")}>
{data.phone}
</InfoRow>
</BentoCard> </BentoCard>
<BentoCard title={t("cardRequisite.passportSection", "Pasport")}> <BentoCard title={t("cardRequisite.passportSection", "Pasport")}>
<InfoRow label={t("cardRequisite.passportSeries", "Pasport seriýasy")}> <InfoRow label={t("cardRequisite.passportSeries", "Pasport seriýasy")} value={data.passport_series} />
{data.passport_series} <InfoRow label={t("cardRequisite.passportNumber", "Pasport belgisi")} value={data.passport_number} />
</InfoRow>
<InfoRow label={t("cardRequisite.passportNumber", "Pasport belgisi")}>
{data.passport_number}
</InfoRow>
</BentoCard> </BentoCard>
</BentoGrid> </BentoGrid>
{/* ── Row 3: Passport images ────────────────────────────────────────── */} {/* ── Row 3: Passport images ────────────────────────────────────────── */}
<BentoGrid cols={4}> <BentoGrid cols={4}>
<BentoCard title={t("cardRequisite.passportFile1", "Sahypa 1")}> <BentoCard title={t("cardRequisite.passportFile1", "Sahypa 1")}>
<PassportImage <PassportImage label={t("cardRequisite.passportFile1", "Pasport (sahypa 1)")} src={data.passport_page1_url} />
label={t("cardRequisite.passportFile1", "Pasport (sahypa 1)")}
src={data.passport_page1_url}
/>
</BentoCard> </BentoCard>
<BentoCard title={t("cardRequisite.passportFile2", "Sahypa 2-3")}> <BentoCard title={t("cardRequisite.passportFile2", "Sahypa 2-3")}>
<PassportImage <PassportImage label={t("cardRequisite.passportFile2", "Pasport (2-3-nji sahypa)")} src={data.passport_page2_3_url} />
label={t("cardRequisite.passportFile2", "Pasport (2-3-nji sahypa)")}
src={data.passport_page2_3_url}
/>
</BentoCard> </BentoCard>
<BentoCard title={t("cardRequisite.passportFile3", "Sahypa 8-9")}> <BentoCard title={t("cardRequisite.passportFile3", "Sahypa 8-9")}>
<PassportImage <PassportImage label={t("cardRequisite.passportFile3", "Pasport (8-9 sahypa)")} src={data.passport_page8_9_url} />
label={t("cardRequisite.passportFile3", "Pasport (8-9 sahypa)")}
src={data.passport_page8_9_url}
/>
</BentoCard> </BentoCard>
<BentoCard title={t("cardRequisite.passportFile4", "Sahypa 32")}> <BentoCard title={t("cardRequisite.passportFile4", "Sahypa 32")}>
<PassportImage <PassportImage label={t("cardRequisite.passportFile4", "Pasport (32-nji sahypa)")} src={data.passport_page32_url} />
label={t("cardRequisite.passportFile4", "Pasport (32-nji sahypa)")}
src={data.passport_page32_url}
/>
</BentoCard> </BentoCard>
</BentoGrid> </BentoGrid>
</div> </div>
) );
} }
@@ -111,8 +111,8 @@ export default function CardOrderDetailPage() {
{/* ── Row 1: Meta + Kart + Lokasiýa ───────────────────────────────── */} {/* ── Row 1: Meta + Kart + Lokasiýa ───────────────────────────────── */}
<BentoGrid cols={3}> <BentoGrid cols={3}>
<BentoCard title={t("cardOrder.section.meta", "Esasy maglumatlar")}> <BentoCard title={t("cardOrder.section.meta", "Esasy maglumatlar")}>
<InfoRow label={t("common.id", "ID")}>{order.id}</InfoRow> <InfoRow label={t("common.id", "ID")} value={order.id} />
<InfoRow label={t("cardOrder.field.createdAt", "Döredilen wagty")}>{order.createdAt}</InfoRow> <InfoRow label={t("cardOrder.field.createdAt", "Döredilen wagty")} value={order.createdAt} />
<InfoRow label={t("cardOrder.field.status", "Status")}> <InfoRow label={t("cardOrder.field.status", "Status")}>
<CardOrderStatusBadge status={order.status} /> <CardOrderStatusBadge status={order.status} />
</InfoRow> </InfoRow>
@@ -123,45 +123,38 @@ export default function CardOrderDetailPage() {
{order.isPaid ? "✓" : "✕"} {order.isPaid ? "✓" : "✕"}
</span> </span>
</InfoRow> </InfoRow>
<InfoRow label={t("cardOrder.field.note", "Bellik")}>{order.note ?? "—"}</InfoRow> <InfoRow label={t("cardOrder.field.note", "Bellik")} value={order.note ?? undefined} />
<InfoRow label={t("cardOrder.field.createdBy", "Sargyt eden")}> <InfoRow label={t("cardOrder.field.createdBy", "Sargyt eden")} value={order.createdBy} isLink />
<span className="text-primary font-medium">{order.createdBy}</span>
</InfoRow>
</BentoCard> </BentoCard>
<BentoCard title={t("cardOrder.section.card", "Kart")}> <BentoCard title={t("cardOrder.section.card", "Kart")}>
<InfoRow label={t("cardOrder.field.issuanceReason", "Kartyň çykarylmagynyň sebäbi")}> <InfoRow label={t("cardOrder.field.issuanceReason", "Kartyň çykarylmagynyň sebäbi")} value={order.issuanceReasonName} isLink />
<span className="text-primary font-medium">{order.issuanceReasonName}</span> <InfoRow label={t("cardOrder.field.cardType", "Kart görnüşi")} value={order.cardTypeName} />
</InfoRow>
<InfoRow label={t("cardOrder.field.cardType", "Kart görnüşi")}>
<span className="text-cyan-400 font-medium">{order.cardTypeName}</span>
</InfoRow>
</BentoCard> </BentoCard>
<BentoCard title={t("cardOrder.section.location", "Lokasiýa")}> <BentoCard title={t("cardOrder.section.location", "Lokasiýa")}>
<InfoRow label={t("cardOrder.field.province", "Welaýat")}>{order.provinceName}</InfoRow> <InfoRow label={t("cardOrder.field.province", "Welaýat")} value={order.provinceName} />
<InfoRow label={t("cardOrder.field.branch", "Şahamça")}> <InfoRow label={t("cardOrder.field.branch", "Şahamça")} value={order.branchName} />
<span className="text-cyan-400 font-medium">{order.branchName}</span>
</InfoRow>
</BentoCard> </BentoCard>
</BentoGrid> </BentoGrid>
{/* ── Row 2: Şahsy maglumatlar (full width — many fields) ─────────── */} {/* ── Row 2: Şahsy maglumatlar (full width — many fields) ─────────── */}
<BentoGrid cols={2}> <BentoGrid cols={2}>
<BentoCard title={t("cardOrder.section.personal", "Şahsy maglumatlar")}> <BentoCard title={t("cardOrder.section.personal", "Şahsy maglumatlar")}>
<InfoRow label={t("cardOrder.field.fullName", "Doly ady")}> <InfoRow
{[order.lastName, order.firstName, order.middleName].filter(Boolean).join(" ")} label={t("cardOrder.field.fullName", "Doly ady")}
</InfoRow> value={[order.lastName, order.firstName, order.middleName].filter(Boolean).join(" ")}
<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.birthDate", "Doglan güni")} value={order.birthDate} />
<InfoRow label={t("cardOrder.field.registeredAddress", "Ýazgy edilen salgy")}>{order.registeredAddress}</InfoRow> <InfoRow label={t("cardOrder.field.citizenship", "Raýatlyk")} value={order.citizenship} />
<InfoRow label={t("cardOrder.field.currentAddress", "Häzirki ýaşaýyş ýeri")}>{order.currentAddress}</InfoRow> <InfoRow label={t("cardOrder.field.registeredAddress", "Ýazgy edilen salgy")} value={order.registeredAddress} />
<InfoRow label={t("cardOrder.field.workplace", "Işleýän ýeri we wezipesi")}>{order.workplace}</InfoRow> <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>
<BentoCard title={t("cardOrder.section.contacts", "Kontakt")}> <BentoCard title={t("cardOrder.section.contacts", "Kontakt")}>
<InfoRow label={t("cardOrder.field.phone", "Telefon")}>{order.phone}</InfoRow> <InfoRow label={t("cardOrder.field.phone", "Telefon")} value={order.phone} />
<InfoRow label={t("cardOrder.field.phoneExtra", "Telefon goşmaça")}>{order.phoneExtra ?? "—"}</InfoRow> <InfoRow label={t("cardOrder.field.phoneExtra", "Telefon goşmaça")} value={order.phoneExtra ?? undefined} />
</BentoCard> </BentoCard>
</BentoGrid> </BentoGrid>
@@ -1,46 +1,47 @@
import { useState } from 'react' import { useState } from "react";
import { useParams, useNavigate } from 'react-router-dom' import { useParams, useNavigate } from "react-router-dom";
import { useTranslation } from 'react-i18next' import { useTranslation } from "react-i18next";
import { Pencil, Trash2, Download, Search, AlertCircle, CheckCircle2, XCircle } from 'lucide-react' import { Pencil, Trash2, Download, Search, AlertCircle, CheckCircle2, XCircle } from "lucide-react";
import { ConfirmDialog } from '@/components/confirmDialog' import { ConfirmDialog } from "@/components/confirmDialog";
import { Skeleton } from '@/components/ui/skeleton' import { Skeleton } from "@/components/ui/skeleton";
import { StatusBadge, type StatusBadgeVariant } from '@/components/ui/statusBadge' import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadge";
import { BentoGrid, BentoCard, InfoRow } from '@/components/viewPageComponents' import { BentoGrid, BentoCard, InfoRow } from "@/components/viewPageComponents";
import { useIntlPayment, useDeleteIntlPayment } from '@/features/visaMasterPayments/hooks/useVisaMasterPayments' import { useIntlPayment, useDeleteIntlPayment } from "@/features/visaMasterPayments/hooks/useVisaMasterPayments";
import type { IntlPaymentStatus } from '@/features/visaMasterPayments/api/visaMasterPaymentsApi' import type { IntlPaymentStatus } from "@/features/visaMasterPayments/api/visaMasterPaymentsApi";
// ─── Status config ──────────────────────────────────────────────────────────── // ─── Status config ────────────────────────────────────────────────────────────
const STATUS_VARIANT: Record<IntlPaymentStatus, StatusBadgeVariant> = { const STATUS_VARIANT: Record<IntlPaymentStatus, StatusBadgeVariant> = {
pending: 'warning', pending: "warning",
approved: 'success', approved: "success",
rejected: 'error', rejected: "error",
} };
const STATUS_ICON: Record<IntlPaymentStatus, React.ElementType> = { const STATUS_ICON: Record<IntlPaymentStatus, React.ElementType> = {
pending: AlertCircle, pending: AlertCircle,
approved: CheckCircle2, approved: CheckCircle2,
rejected: XCircle, rejected: XCircle,
} };
function PaymentStatusBadge({ status }: { status: IntlPaymentStatus }) { function PaymentStatusBadge({ status }: { status: IntlPaymentStatus }) {
const { t } = useTranslation() const { t } = useTranslation();
const variant = STATUS_VARIANT[status] ?? STATUS_VARIANT.pending const variant = STATUS_VARIANT[status] ?? STATUS_VARIANT.pending;
const Icon = STATUS_ICON[status] ?? STATUS_ICON.pending const Icon = STATUS_ICON[status] ?? STATUS_ICON.pending;
return <StatusBadge label={t(`intlPayment.status.${status}`)} variant={variant} icon={Icon} /> return <StatusBadge label={t(`intlPayment.status.${status}`)} variant={variant} icon={Icon} />;
} }
// ─── DocFile row ────────────────────────────────────────────────────────────── // ─── DocFile row ──────────────────────────────────────────────────────────────
function DocFileRow({ label, url }: { label: string; url: string | null }) { function DocFileRow({ label, url }: { label: string; url: string | null }) {
if (!url) return ( if (!url)
<InfoRow label={label}> return (
<span className="text-muted-foreground/50">—</span> <InfoRow label={label}>
</InfoRow> <span className="text-muted-foreground/50">—</span>
) </InfoRow>
);
const filename = url.split('/').pop() ?? 'faýl' const filename = url.split("/").pop() ?? "faýl";
const isImage = /\.(jpg|jpeg|png|gif|webp)$/i.test(url) const isImage = /\.(jpg|jpeg|png|gif|webp)$/i.test(url);
return ( return (
<InfoRow label={label}> <InfoRow label={label}>
@@ -66,7 +67,7 @@ function DocFileRow({ label, url }: { label: string; url: string | null }) {
</a> </a>
</div> </div>
</InfoRow> </InfoRow>
) );
} }
// ─── Skeleton ───────────────────────────────────────────────────────────────── // ─── Skeleton ─────────────────────────────────────────────────────────────────
@@ -86,68 +87,92 @@ function IntlPaymentViewSkeleton() {
))} ))}
</div> </div>
</div> </div>
) );
} }
// ─── Page ───────────────────────────────────────────────────────────────────── // ─── Page ─────────────────────────────────────────────────────────────────────
export default function IntlPaymentViewPage() { export default function IntlPaymentViewPage() {
const { id } = useParams<{ id: string }>() const { id } = useParams<{ id: string }>();
const navigate = useNavigate() const navigate = useNavigate();
const { t } = useTranslation() const { t } = useTranslation();
const [historySearch, setHistorySearch] = useState('') const [historySearch, setHistorySearch] = useState("");
const [deleteOpen, setDeleteOpen] = useState(false) const [deleteOpen, setDeleteOpen] = useState(false);
const { data, isLoading, isError } = useIntlPayment(id!) const { data, isLoading, isError } = useIntlPayment(id!);
const { mutate: deletePayment, isPending: isDeleting } = useDeleteIntlPayment() const { mutate: deletePayment, isPending: isDeleting } = useDeleteIntlPayment();
const confirmDelete = () => { const confirmDelete = () => {
deletePayment(data!.id, { onSuccess: () => navigate('/intl-payments/visa-master') }) deletePayment(data!.id, { onSuccess: () => navigate("/intl-payments/visa-master") });
} };
if (isLoading) return <IntlPaymentViewSkeleton /> if (isLoading) return <IntlPaymentViewSkeleton />;
if (isError || !data) { if (isError || !data) {
return ( return (
<div className="flex items-center justify-center h-64 text-muted-foreground text-sm"> <div className="flex items-center justify-center h-64 text-muted-foreground text-sm">
{t('common.notFound', 'Maglumat tapylmady')} {t("common.notFound", "Maglumat tapylmady")}
</div> </div>
) );
} }
const KABUL_DOCS = [ const KABUL_DOCS = [
{ label: 'Talypyň degişli welaýata "SBERBANK" kartyň rekwizitleri', url: data.doc_sberbank_account }, { label: 'Talypyň degişli welaýata "SBERBANK" kartyň rekwizitleri', url: data.doc_sberbank_account },
{ label: 'Talypyň daşary ýurt döwletiniň ýokary okuw mekdebinde okaýandygy baradaky güwänamasy', url: data.doc_school_enrollment }, { label: "Talypyň daşary ýurt döwletiniň ýokary okuw mekdebinde okaýandygy baradaky güwänamasy", url: data.doc_school_enrollment },
{ label: 'Talypyň bilendiriň göçürmesi', url: data.doc_summons }, { label: "Talypyň bilendiriň göçürmesi", url: data.doc_summons },
{ label: 'Talypyň degişli Türkmenistanyň raýatynyň içki milli pasportynyň asyl görnüşi we göçürmesi', url: data.doc_passport_tm }, { label: "Talypyň degişli Türkmenistanyň raýatynyň içki milli pasportynyň asyl görnüşi we göçürmesi", url: data.doc_passport_tm },
{ label: 'Talypyň Türkmenistandan çykmak we Türkmenistana girmek üçin pasportynyň göçürmesi', url: data.doc_foreign_passport }, { label: "Talypyň Türkmenistandan çykmak we Türkmenistana girmek üçin pasportynyň göçürmesi", url: data.doc_foreign_passport },
{ label: 'Talypyň Türkmenistandan çykmak we Türkmenistana girmek üçin pasportynyň daşary ýurtda galan döwründe bakýan döwleti baradaky bellenen sahypasynyň göçürmesi', url: data.doc_foreign_passport_copy }, {
{ label: 'Talypyň Türkmenistandan çykmak we Türkmenistana girmek üçin pasportynyň dowletiniň girmesiz baradaky bellenen sahypasynyň göçürmesi', url: data.doc_exit_permission }, label:
{ label: 'Talypyň daşary ýurt döwletiniň ýokary okuw mekdebinde okaýandygy barada maglumatlary daşary ýurt döwletiniň ýokary okuw mekdebinden haty', url: data.doc_school_foreign_info }, "Talypyň Türkmenistandan çykmak we Türkmenistana girmek üçin pasportynyň daşary ýurtda galan döwründe bakýan döwleti baradaky bellenen sahypasynyň göçürmesi",
{ label: 'Talypyň daşary ýurt döwletinde okaýandygy baradaky güwänamany daşary ýurt döwletiniň ýokary okuw mekdebinden haty', url: data.doc_school_departure_info }, url: data.doc_foreign_passport_copy,
] },
{
label:
"Talypyň Türkmenistandan çykmak we Türkmenistana girmek üçin pasportynyň dowletiniň girmesiz baradaky bellenen sahypasynyň göçürmesi",
url: data.doc_exit_permission,
},
{
label:
"Talypyň daşary ýurt döwletiniň ýokary okuw mekdebinde okaýandygy barada maglumatlary daşary ýurt döwletiniň ýokary okuw mekdebinden haty",
url: data.doc_school_foreign_info,
},
{
label: "Talypyň daşary ýurt döwletinde okaýandygy baradaky güwänamany daşary ýurt döwletiniň ýokary okuw mekdebinden haty",
url: data.doc_school_departure_info,
},
];
const UPGRAD_DOCS = [ const UPGRAD_DOCS = [
{ label: 'Upgradyý degişli Türkmenistanyň raýatynyň içki milli pasportynyň asyl görnüşi we göçürmesi', url: data.upd_doc_passport_tm }, { label: "Upgradyý degişli Türkmenistanyň raýatynyň içki milli pasportynyň asyl görnüşi we göçürmesi", url: data.upd_doc_passport_tm },
{ label: 'Upgradyý degişli Türkmenistandan çykmak we Türkmenistana girmek üçin pasportynyň göçürmesi', url: data.upd_doc_foreign_passport }, {
{ label: 'Upgradyý Türkmenistandan çykmak we Türkmenistana girmek üçin pasportynyň daşary ýurt döwletinde galýandygy baradaky şaýmynyň bellenen sahypasynyň göçürmesi', url: data.upd_doc_visa }, label: "Upgradyý degişli Türkmenistandan çykmak we Türkmenistana girmek üçin pasportynyň göçürmesi",
{ label: 'Upgradyýyň we kabul edijiniň resminamalarynyň göçürmesi', url: data.upd_doc_acceptance_letter }, url: data.upd_doc_foreign_passport,
{ label: 'Upgradyý we kabul ediji täze 2015-nji ýyldan soňra pasportynyň seriýasy baradaky maglumatlary', url: data.upd_doc_passport_biometric }, },
{ label: 'Upgradyý we kabul ediji täze 2015-nji ýyldan soňra pasportynyň seriýasy baradaky göwnamasy', url: data.upd_doc_passport_old }, {
] label:
"Upgradyý Türkmenistandan çykmak we Türkmenistana girmek üçin pasportynyň daşary ýurt döwletinde galýandygy baradaky şaýmynyň bellenen sahypasynyň göçürmesi",
url: data.upd_doc_visa,
},
{ label: "Upgradyýyň we kabul edijiniň resminamalarynyň göçürmesi", url: data.upd_doc_acceptance_letter },
{
label: "Upgradyý we kabul ediji täze 2015-nji ýyldan soňra pasportynyň seriýasy baradaky maglumatlary",
url: data.upd_doc_passport_biometric,
},
{ label: "Upgradyý we kabul ediji täze 2015-nji ýyldan soňra pasportynyň seriýasy baradaky göwnamasy", url: data.upd_doc_passport_old },
];
return ( return (
<div className="flex flex-col gap-6"> <div className="flex flex-col gap-6">
{/* ── Page header ──────────────────────────────────────────────────── */} {/* ── Page header ──────────────────────────────────────────────────── */}
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<h1 className="text-xl font-semibold text-foreground"> <h1 className="text-xl font-semibold text-foreground">
{t('intlPayment.viewTitle', 'Halkara töleg')}: {data.id} {t("intlPayment.viewTitle", "Halkara töleg")}: {data.id}
</h1> </h1>
<div className="flex items-center gap-1.5"> <div className="flex items-center gap-1.5">
<button <button
className="p-2 rounded-md cursor-pointer hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors disabled:opacity-50" className="p-2 rounded-md cursor-pointer hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors disabled:opacity-50"
title={t('common.delete', 'Poz')} title={t("common.delete", "Poz")}
onClick={() => setDeleteOpen(true)} onClick={() => setDeleteOpen(true)}
> >
<Trash2 size={16} /> <Trash2 size={16} />
@@ -156,7 +181,7 @@ export default function IntlPaymentViewPage() {
<button <button
onClick={() => navigate(`/intl-payments/visa-master/${id}/edit`)} onClick={() => navigate(`/intl-payments/visa-master/${id}/edit`)}
className="p-2 rounded-md cursor-pointer hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors" className="p-2 rounded-md cursor-pointer hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
title={t('common.edit', 'Redaktirle')} title={t("common.edit", "Redaktirle")}
> >
<Pencil size={16} /> <Pencil size={16} />
</button> </button>
@@ -165,55 +190,47 @@ export default function IntlPaymentViewPage() {
{/* ── Row 1: Meta + Ýüztuman + Lokasiýa ───────────────────────────── */} {/* ── Row 1: Meta + Ýüztuman + Lokasiýa ───────────────────────────── */}
<BentoGrid cols={3}> <BentoGrid cols={3}>
<BentoCard title={t('intlPayment.statusSection', 'Esasy maglumatlar')}> <BentoCard title={t("intlPayment.statusSection", "Esasy maglumatlar")}>
<InfoRow label={t('intlPayment.client', 'Ulanyjy')}> <InfoRow label={t("intlPayment.client", "Ulanyjy")} value={data.client_label} isLink />
<span className="text-primary font-medium">{data.client_label}</span> <InfoRow label={t("common.id", "ID")} value={data.id} />
</InfoRow> <InfoRow label={t("intlPayment.status", "Status")}>
<InfoRow label={t("common.id", "ID")}>
<span className="font-mono">{data.id}</span>
</InfoRow>
<InfoRow label={t('intlPayment.status', 'Status')}>
<PaymentStatusBadge status={data.status} /> <PaymentStatusBadge status={data.status} />
</InfoRow> </InfoRow>
<InfoRow label={t('intlPayment.tilowanMonth', 'Tölewan (Aý/aý)')} value={data.created_at} /> <InfoRow label={t("intlPayment.tilowanMonth", "Tölewan (Aý/aý)")} value={data.created_at} />
<InfoRow label={t('intlPayment.note', 'Bellik')} value={data.note} /> <InfoRow label={t("intlPayment.note", "Bellik")} value={data.note} />
</BentoCard> </BentoCard>
<BentoCard title={t('intlPayment.currencySection', 'Ýüztumanyň görnüşi')}> <BentoCard title={t("intlPayment.currencySection", "Ýüztumanyň görnüşi")}>
<InfoRow label={t('intlPayment.currencyType', 'Görnüşi')} value={data.currency_type_label} /> <InfoRow label={t("intlPayment.currencyType", "Görnüşi")} value={data.currency_type_label} />
</BentoCard> </BentoCard>
<BentoCard title={t('intlPayment.locationSection', 'Lokasiýa')}> <BentoCard title={t("intlPayment.locationSection", "Lokasiýa")}>
<InfoRow label={t('intlPayment.province', 'Welaýat')} value={data.province_label} /> <InfoRow label={t("intlPayment.province", "Welaýat")} value={data.province_label} />
<InfoRow label={t('intlPayment.branch', 'Şahamça')}> <InfoRow label={t("intlPayment.branch", "Şahamça")} value={data.branch_label} isLink />
<span className="text-primary font-medium">{data.branch_label}</span>
</InfoRow>
</BentoCard> </BentoCard>
</BentoGrid> </BentoGrid>
{/* ── Row 2: Şahsy maglumatlar + Töleg ─────────────────────────────── */} {/* ── Row 2: Şahsy maglumatlar + Töleg ─────────────────────────────── */}
<BentoGrid cols={2}> <BentoGrid cols={2}>
<BentoCard title={t('intlPayment.personalSection', 'Şahsy maglumatlar')}> <BentoCard title={t("intlPayment.personalSection", "Şahsy maglumatlar")}>
<InfoRow label={t('intlPayment.passportFirstName', 'Pasportdaky ady')} value={data.passport_first_name} /> <InfoRow label={t("intlPayment.passportFirstName", "Pasportdaky ady")} value={data.passport_first_name} />
<InfoRow label={t('intlPayment.passportLastName', 'Pasportdaky familiýa')} value={data.passport_last_name} /> <InfoRow label={t("intlPayment.passportLastName", "Pasportdaky familiýa")} value={data.passport_last_name} />
<InfoRow label={t('intlPayment.phone', 'Telefon')}> <InfoRow label={t("intlPayment.phone", "Telefon")} value={`+${data.phone}`} />
<span>+{data.phone}</span> <InfoRow label={t("intlPayment.email", "E-poçta")} value={data.email} />
</InfoRow> <InfoRow label={t("intlPayment.homeAddress", "Häzirki ýaşyş ýeri")} value={data.home_address} />
<InfoRow label={t('intlPayment.email', 'E-poçta')} value={data.email} />
<InfoRow label={t('intlPayment.homeAddress', 'Häzirki ýaşyş ýeri')} value={data.home_address} />
</BentoCard> </BentoCard>
<BentoCard title={t('intlPayment.paymentSection', 'Töleg')}> <BentoCard title={t("intlPayment.paymentSection", "Töleg")}>
<InfoRow label={t('intlPayment.payerFullName', 'Töleg upgradyjynyň maglumatlary')} value={data.payer_full_name} /> <InfoRow label={t("intlPayment.payerFullName", "Töleg upgradyjynyň maglumatlary")} value={data.payer_full_name} />
<InfoRow label={t('intlPayment.payerAccount', 'Töleg upgradyjynyň goşun hasaby')} value={data.payer_account_number} /> <InfoRow label={t("intlPayment.payerAccount", "Töleg upgradyjynyň goşun hasaby")} value={data.payer_account_number} />
<InfoRow label={t('intlPayment.passportSeries', 'Pasport seriýasy')} value={data.passport_series} /> <InfoRow label={t("intlPayment.passportSeries", "Pasport seriýasy")} value={data.passport_series} />
<InfoRow label={t('intlPayment.passportNumber', 'Pasport nomeri')} value={data.passport_number} /> <InfoRow label={t("intlPayment.passportNumber", "Pasport nomeri")} value={data.passport_number} />
</BentoCard> </BentoCard>
</BentoGrid> </BentoGrid>
{/* ── Row 3: Kabul ediji resminamalar ──────────────────────────────── */} {/* ── Row 3: Kabul ediji resminamalar ──────────────────────────────── */}
<BentoGrid cols={1}> <BentoGrid cols={1}>
<BentoCard title={t('intlPayment.kabulDocsSection', 'Kabul ediji talyp boyunca resminamalar')}> <BentoCard title={t("intlPayment.kabulDocsSection", "Kabul ediji talyp boyunca resminamalar")}>
{KABUL_DOCS.map((doc, i) => ( {KABUL_DOCS.map((doc, i) => (
<DocFileRow key={i} label={doc.label} url={doc.url} /> <DocFileRow key={i} label={doc.label} url={doc.url} />
))} ))}
@@ -222,7 +239,7 @@ export default function IntlPaymentViewPage() {
{/* ── Row 4: Upgradyý resminamalar ─────────────────────────────────── */} {/* ── Row 4: Upgradyý resminamalar ─────────────────────────────────── */}
<BentoGrid cols={1}> <BentoGrid cols={1}>
<BentoCard title={t('intlPayment.upgradDocsSection', 'Upgradyý boyunca resminamalar')}> <BentoCard title={t("intlPayment.upgradDocsSection", "Upgradyý boyunca resminamalar")}>
{UPGRAD_DOCS.map((doc, i) => ( {UPGRAD_DOCS.map((doc, i) => (
<DocFileRow key={i} label={doc.label} url={doc.url} /> <DocFileRow key={i} label={doc.label} url={doc.url} />
))} ))}
@@ -231,7 +248,7 @@ export default function IntlPaymentViewPage() {
{/* ── Row 5: Töleg taryhy ───────────────────────────────────────────── */} {/* ── Row 5: Töleg taryhy ───────────────────────────────────────────── */}
<BentoGrid cols={1}> <BentoGrid cols={1}>
<BentoCard title={t('intlPayment.paymentHistory', 'Töleg taryhy')}> <BentoCard title={t("intlPayment.paymentHistory", "Töleg taryhy")}>
<div className="p-4"> <div className="p-4">
<div className="relative max-w-xs mb-4"> <div className="relative max-w-xs mb-4">
<Search size={13} className="absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground" /> <Search size={13} className="absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground" />
@@ -239,7 +256,7 @@ export default function IntlPaymentViewPage() {
type="text" type="text"
value={historySearch} value={historySearch}
onChange={(e) => setHistorySearch(e.target.value)} onChange={(e) => setHistorySearch(e.target.value)}
placeholder={t('intlPayment.search', 'Gözlemek')} placeholder={t("intlPayment.search", "Gözlemek")}
className="h-9 w-full pl-9 pr-3 rounded-md border border-border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring" className="h-9 w-full pl-9 pr-3 rounded-md border border-border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring"
/> />
</div> </div>
@@ -252,7 +269,7 @@ export default function IntlPaymentViewPage() {
<line x1="9" y1="9" x2="9" y2="21" /> <line x1="9" y1="9" x2="9" y2="21" />
</svg> </svg>
</div> </div>
<p className="text-sm">{t('intlPayment.noHistory', 'Beriilen kriteriýalara Töleg gabat gelmedi')}</p> <p className="text-sm">{t("intlPayment.noHistory", "Beriilen kriteriýalara Töleg gabat gelmedi")}</p>
</div> </div>
</div> </div>
</BentoCard> </BentoCard>
@@ -261,12 +278,12 @@ export default function IntlPaymentViewPage() {
<ConfirmDialog <ConfirmDialog
open={deleteOpen} open={deleteOpen}
onOpenChange={setDeleteOpen} onOpenChange={setDeleteOpen}
title={t('intlPayment.deleteTitle', 'Pozmak isleýärsiňizmi?')} title={t("intlPayment.deleteTitle", "Pozmak isleýärsiňizmi?")}
description={`${t('intlPayment.deleteDesc', 'Bu amal yzyna dolanyp bolmaz.')} ${data?.id}`} description={`${t("intlPayment.deleteDesc", "Bu amal yzyna dolanyp bolmaz.")} ${data?.id}`}
confirmLabel={t('common.delete', 'Poz')} confirmLabel={t("common.delete", "Poz")}
onConfirm={confirmDelete} onConfirm={confirmDelete}
isLoading={isDeleting} isLoading={isDeleting}
/> />
</div> </div>
) );
} }