fixed some page ui
This commit is contained in:
@@ -1,415 +1,306 @@
|
||||
import { format } from "date-fns";
|
||||
import {
|
||||
Trash2,
|
||||
Edit,
|
||||
Search,
|
||||
Download,
|
||||
Clock,
|
||||
XCircle,
|
||||
CheckCircle2,
|
||||
AlertCircle,
|
||||
} from "lucide-react";
|
||||
import { format } from 'date-fns'
|
||||
import { Trash2, Edit, Search, Download, XCircle, CheckCircle2, AlertCircle } from 'lucide-react'
|
||||
import { useParams, useNavigate } from 'react-router-dom'
|
||||
import { Skeleton } from '@/components/ui/skeleton'
|
||||
import { StatusBadge, type StatusBadgeVariant } from '@/components/ui/statusBadge'
|
||||
import { InfoRow, AuditLog, type AuditRowProps } from '@/components/viewPageComponents'
|
||||
import { useSberPaymentOrder, useDeleteSberPayment } from '@/features/sberPayments/hooks/useSberPayments'
|
||||
import type { PaymentPaidStatus, PaymentStatus } from '@/features/sberPayments/api/sberPaymentsApi'
|
||||
import { useState } from 'react'
|
||||
|
||||
import {
|
||||
useSberPaymentOrder,
|
||||
useDeleteSberPayment,
|
||||
} from "@/features/sberPayments/hooks/useSberPayments";
|
||||
import type {
|
||||
PaymentPaidStatus,
|
||||
PaymentStatus,
|
||||
} from "@/features/sberPayments/api/sberPaymentsApi";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { useParams, useNavigate } from "react-router-dom";
|
||||
import {
|
||||
StatusBadge,
|
||||
type StatusBadgeVariant,
|
||||
} from "@/components/ui/statusBadge";
|
||||
import { InfoRow, Section } from "@/components/viewPageComponents";
|
||||
// ─── Status config ────────────────────────────────────────────────────────────
|
||||
|
||||
const STATUS_CONFIG = {
|
||||
GARASYLYYAR: {
|
||||
label: "Garaşylýar",
|
||||
variant: "warning" as StatusBadgeVariant,
|
||||
icon: AlertCircle,
|
||||
},
|
||||
KANAGATLANDYRYLAN: {
|
||||
label: "Tassyklandy",
|
||||
variant: "success" as StatusBadgeVariant,
|
||||
icon: CheckCircle2,
|
||||
},
|
||||
RET_EDILEN: {
|
||||
label: "Ýatyryldy",
|
||||
variant: "error" as StatusBadgeVariant,
|
||||
icon: XCircle,
|
||||
},
|
||||
} satisfies Record<
|
||||
PaymentStatus,
|
||||
{ label: string; variant: StatusBadgeVariant; icon: React.ElementType }
|
||||
>;
|
||||
GARASYLYYAR: { label: 'Garaşylýar', variant: 'warning' as StatusBadgeVariant, icon: AlertCircle },
|
||||
KANAGATLANDYRYLAN: { label: 'Tassyklandy', variant: 'success' as StatusBadgeVariant, icon: CheckCircle2 },
|
||||
RET_EDILEN: { label: 'Ýatyryldy', variant: 'error' as StatusBadgeVariant, icon: XCircle },
|
||||
} satisfies Record<PaymentStatus, { label: string; variant: StatusBadgeVariant; icon: React.ElementType }>
|
||||
|
||||
const PAID_STATUS_CONFIG = {
|
||||
Tolenmedik: {
|
||||
label: "Tölmedi",
|
||||
variant: "error" as StatusBadgeVariant,
|
||||
icon: XCircle,
|
||||
},
|
||||
Tolendi: {
|
||||
label: "Tölendi",
|
||||
variant: "success" as StatusBadgeVariant,
|
||||
icon: CheckCircle2,
|
||||
},
|
||||
} satisfies Record<
|
||||
PaymentPaidStatus,
|
||||
{ label: string; variant: StatusBadgeVariant; icon: React.ElementType }
|
||||
>;
|
||||
|
||||
function PaymentPaidStatusBadge({ status }: { status: PaymentPaidStatus }) {
|
||||
const cfg = PAID_STATUS_CONFIG[status];
|
||||
if (!cfg)
|
||||
return (
|
||||
<span className="text-xs text-muted-foreground">{String(status)}</span>
|
||||
);
|
||||
return (
|
||||
<StatusBadge label={cfg.label} variant={cfg.variant} icon={cfg.icon} />
|
||||
);
|
||||
}
|
||||
Tolenmedik: { label: 'Tölmedi', variant: 'error' as StatusBadgeVariant, icon: XCircle },
|
||||
Tolendi: { label: 'Tölendi', variant: 'success' as StatusBadgeVariant, icon: CheckCircle2 },
|
||||
} satisfies Record<PaymentPaidStatus, { label: string; variant: StatusBadgeVariant; icon: React.ElementType }>
|
||||
|
||||
function PaymentStatusBadge({ status }: { status: PaymentStatus }) {
|
||||
const cfg = STATUS_CONFIG[status];
|
||||
if (!cfg)
|
||||
return (
|
||||
<span className="text-xs text-muted-foreground">{String(status)}</span>
|
||||
);
|
||||
return (
|
||||
<StatusBadge label={cfg.label} variant={cfg.variant} icon={cfg.icon} />
|
||||
);
|
||||
const cfg = STATUS_CONFIG[status]
|
||||
if (!cfg) return <span className="text-xs text-muted-foreground">{String(status)}</span>
|
||||
return <StatusBadge label={cfg.label} variant={cfg.variant} icon={cfg.icon} />
|
||||
}
|
||||
// ─── Info Row Component ───────────────────────────────────────────────────────
|
||||
|
||||
function PaymentPaidStatusBadge({ status }: { status: PaymentPaidStatus }) {
|
||||
const cfg = PAID_STATUS_CONFIG[status]
|
||||
if (!cfg) return <span className="text-xs text-muted-foreground">{String(status)}</span>
|
||||
return <StatusBadge label={cfg.label} variant={cfg.variant} icon={cfg.icon} />
|
||||
}
|
||||
|
||||
// ─── Bento primitives ─────────────────────────────────────────────────────────
|
||||
|
||||
// ─── Document Item Component ──────────────────────────────────────────────────
|
||||
function BentoGrid({ cols = 2, children }: { cols?: 1 | 2 | 3 | 4; children: React.ReactNode }) {
|
||||
const colClass = {
|
||||
1: 'grid-cols-1',
|
||||
2: 'grid-cols-1 sm:grid-cols-2',
|
||||
3: 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-3',
|
||||
4: 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-4',
|
||||
}[cols]
|
||||
return <div className={`grid ${colClass} gap-4`}>{children}</div>
|
||||
}
|
||||
|
||||
function DocumentItem({
|
||||
function BentoCard({
|
||||
title,
|
||||
span,
|
||||
children,
|
||||
}: {
|
||||
title?: string
|
||||
span?: 'full' | 2 | 3
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
const spanClass =
|
||||
span === 'full' ? 'sm:col-span-full' :
|
||||
span === 2 ? 'sm:col-span-2' :
|
||||
span === 3 ? 'sm:col-span-3' : ''
|
||||
|
||||
return (
|
||||
<div className={`bg-card border border-border rounded-xl overflow-hidden ${spanClass}`}>
|
||||
{title && (
|
||||
<div className="px-4 py-2.5 border-b border-border">
|
||||
<p className="text-xs font-semibold text-muted-foreground uppercase tracking-wide">
|
||||
{title}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
{children}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// ─── Document row ─────────────────────────────────────────────────────────────
|
||||
|
||||
function DocumentRow({
|
||||
label,
|
||||
fileName,
|
||||
fileUrl,
|
||||
}: {
|
||||
label: string;
|
||||
fileName: string | null;
|
||||
fileUrl: string | null;
|
||||
label: string
|
||||
fileName: string | null
|
||||
fileUrl: string | null
|
||||
}) {
|
||||
if (!fileUrl) return (
|
||||
<InfoRow label={label}>
|
||||
<span className="text-muted-foreground/50">—</span>
|
||||
</InfoRow>
|
||||
)
|
||||
|
||||
const name = fileName ?? fileUrl.split('/').pop() ?? 'faýl'
|
||||
|
||||
return (
|
||||
<div className="flex items-start gap-4 py-3 border-b border-border last:border-b-0 px-4">
|
||||
<span className="w-80 shrink-0 text-sm text-muted-foreground leading-relaxed">
|
||||
{label}
|
||||
</span>
|
||||
<div className="flex-1">
|
||||
{fileUrl ? (
|
||||
<div className="flex items-center gap-2">
|
||||
<button className="p-1.5 rounded bg-muted hover:bg-accent transition-colors">
|
||||
<Search size={14} className="text-muted-foreground" />
|
||||
</button>
|
||||
<button className="p-1.5 rounded bg-muted hover:bg-accent transition-colors">
|
||||
<Download size={14} className="text-muted-foreground" />
|
||||
</button>
|
||||
<span className="px-3 py-1.5 bg-primary/20 text-primary text-xs font-medium rounded">
|
||||
{fileName}
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
<span className="text-sm text-muted-foreground">—</span>
|
||||
)}
|
||||
<InfoRow label={label}>
|
||||
<div className="flex items-center gap-2">
|
||||
<button className="p-1.5 rounded bg-muted hover:bg-accent transition-colors">
|
||||
<Search size={12} className="text-muted-foreground" />
|
||||
</button>
|
||||
<a
|
||||
href={fileUrl}
|
||||
download
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 rounded-md bg-primary/10 hover:bg-primary/20 text-xs text-primary transition-colors"
|
||||
>
|
||||
<Download size={12} />
|
||||
<span className="max-w-[140px] truncate">{name}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
</InfoRow>
|
||||
)
|
||||
}
|
||||
|
||||
// ─── View Page Component ──────────────────────────────────────────────────────
|
||||
// ─── Skeleton ─────────────────────────────────────────────────────────────────
|
||||
|
||||
function SberPaymentViewSkeleton() {
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
<Skeleton className="h-7 w-64" />
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
{[...Array(4)].map((_, i) => (
|
||||
<div key={i} className="bg-card border border-border rounded-xl p-4 flex flex-col gap-3">
|
||||
<Skeleton className="h-3 w-24 mb-1" />
|
||||
{[...Array(3)].map((_, j) => (
|
||||
<Skeleton key={j} className="h-4 w-full" />
|
||||
))}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// ─── Page ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
export default function SberPaymentViewPage() {
|
||||
const params = useParams();
|
||||
const navigate = useNavigate();
|
||||
const id = params.id as string;
|
||||
const { id } = useParams<{ id: string }>()
|
||||
const navigate = useNavigate()
|
||||
const [historySearch, setHistorySearch] = useState('')
|
||||
|
||||
const { data: order, isLoading } = useSberPaymentOrder(id);
|
||||
const deleteMutation = useDeleteSberPayment();
|
||||
const { data: order, isLoading } = useSberPaymentOrder(id!)
|
||||
const deleteMutation = useDeleteSberPayment()
|
||||
|
||||
const handleDelete = async () => {
|
||||
if (confirm("Bu tolegi pozmak isleyanizmi?")) {
|
||||
await deleteMutation.mutateAsync(id);
|
||||
navigate("/sber-payments");
|
||||
}
|
||||
};
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-[400px]">
|
||||
<Spinner className="w-8 h-8" />
|
||||
</div>
|
||||
);
|
||||
if (!window.confirm('Bu tolegi pozmak isleyanizmi?')) return
|
||||
await deleteMutation.mutateAsync(id!)
|
||||
navigate('/sber-payments')
|
||||
}
|
||||
|
||||
if (isLoading) return <SberPaymentViewSkeleton />
|
||||
|
||||
if (!order) {
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center min-h-[400px] text-muted-foreground">
|
||||
<p>Toleg tapylmady</p>
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => navigate("/sber-payments")}
|
||||
className="mt-4"
|
||||
>
|
||||
Yza
|
||||
</Button>
|
||||
<div className="flex items-center justify-center h-64 text-muted-foreground text-sm">
|
||||
Toleg tapylmady
|
||||
</div>
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
const kabulDocs = order.documents?.slice(0, 6) ?? []
|
||||
const ugradDocs = order.documents?.slice(6) ?? []
|
||||
|
||||
const auditLogs: AuditRowProps[] = order.activityLog?.map((log) => ({
|
||||
id: log.id.split('-')[1] ?? log.id,
|
||||
action: log.analysisName,
|
||||
by: log.createdBy,
|
||||
target: log.target,
|
||||
status: log.status,
|
||||
date: format(new Date(log.createdAt), 'dd/MM/yyyy, HH:mm:ss') + ' GMT+5',
|
||||
})) ?? []
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{/* Header Actions */}
|
||||
<div className="flex items-center justify-end gap-2">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={handleDelete}
|
||||
className="text-destructive hover:text-destructive hover:bg-destructive/10"
|
||||
>
|
||||
<Trash2 size={18} />
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={() => navigate(`/sber-payments/${id}/edit`)}
|
||||
>
|
||||
<Edit size={18} />
|
||||
</Button>
|
||||
<div className="flex flex-col gap-6">
|
||||
|
||||
{/* ── Page header ──────────────────────────────────────────────────── */}
|
||||
<div className="flex items-center justify-between">
|
||||
<h1 className="text-xl font-semibold text-foreground">
|
||||
Sberbank töleg: {order.id}
|
||||
</h1>
|
||||
<div className="flex items-center gap-1.5">
|
||||
<button
|
||||
onClick={handleDelete}
|
||||
disabled={deleteMutation.isPending}
|
||||
className="p-2 rounded-md cursor-pointer hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors disabled:opacity-50"
|
||||
title="Poz"
|
||||
>
|
||||
<Trash2 size={16} />
|
||||
</button>
|
||||
<button
|
||||
onClick={() => navigate(`/sber-payments/${id}/edit`)}
|
||||
className="p-2 rounded-md cursor-pointer hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
|
||||
title="Redaktirle"
|
||||
>
|
||||
<Edit size={16} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Status Section */}
|
||||
<Section title="Status">
|
||||
<div className="px-4">
|
||||
{/* ── Row 1: Meta + Lokasiýa ────────────────────────────────────────── */}
|
||||
<BentoGrid cols={2}>
|
||||
<BentoCard title="Esasy maglumatlar">
|
||||
<InfoRow label="ID" value={order.id} />
|
||||
<InfoRow label="Status">
|
||||
<PaymentStatusBadge status={order.status} />
|
||||
</InfoRow>
|
||||
<InfoRow label="Tolenen (Sul ay)">
|
||||
<InfoRow label="Tölenen (Sul aý)">
|
||||
<PaymentPaidStatusBadge status={order.paidStatus} />
|
||||
</InfoRow>
|
||||
<InfoRow label="Bellik" value={order.bellik} />
|
||||
</div>
|
||||
</Section>
|
||||
</BentoCard>
|
||||
|
||||
{/* Location Section */}
|
||||
<Section title="Lokasiya">
|
||||
<div className="px-4">
|
||||
<InfoRow label="Welayat" value={order.welayat} />
|
||||
<InfoRow label="Sahamca" value={order.sahamca} isLink />
|
||||
</div>
|
||||
</Section>
|
||||
<BentoCard title="Lokasiýa">
|
||||
<InfoRow label="Welaýat" value={order.welayat} />
|
||||
<InfoRow label="Şahamça" value={order.sahamca} isLink />
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
{/* Personal Info Section */}
|
||||
<Section title="Sahsy maglumatlar">
|
||||
<div className="px-4">
|
||||
<InfoRow label="Pasportdaky ady" value={order.firstName} />
|
||||
<InfoRow label="Pasportdaky familiya" value={order.lastName} />
|
||||
<InfoRow label="Telefon" value={order.phone} />
|
||||
<InfoRow label="E-pocta" value={order.email} />
|
||||
<InfoRow label="Hazirki yasayys yeri" value={order.address} />
|
||||
</div>
|
||||
</Section>
|
||||
{/* ── Row 2: Şahsy maglumatlar + Töleg ─────────────────────────────── */}
|
||||
<BentoGrid cols={2}>
|
||||
<BentoCard title="Şahsy maglumatlar">
|
||||
<InfoRow label="Pasportdaky ady" value={order.firstName} />
|
||||
<InfoRow label="Pasportdaky familiýa" value={order.lastName} />
|
||||
<InfoRow label="Telefon" value={order.phone} />
|
||||
<InfoRow label="E-poçta" value={order.email} />
|
||||
<InfoRow label="Häzirki ýaşaýyş ýeri" value={order.address} />
|
||||
</BentoCard>
|
||||
|
||||
{/* Payment Info Section */}
|
||||
<Section title="Toleg">
|
||||
<div className="px-4">
|
||||
<BentoCard title="Töleg">
|
||||
<InfoRow
|
||||
label="Tolegi ugradyjynyn maglumatlary"
|
||||
value={`I-M${order.passportNumber?.slice(0, 2) ?? "XX"}-${order.passportNumber ?? ""} ${order.fullName}`}
|
||||
label="Töleg ugradyjynyň maglumatlary"
|
||||
value={`I-M${order.passportNumber?.slice(0, 2) ?? 'XX'}-${order.passportNumber ?? ''} ${order.fullName}`}
|
||||
/>
|
||||
<InfoRow
|
||||
label="Toleg ugradyjynyn goyum hasaby"
|
||||
value={order.accountNumber}
|
||||
/>
|
||||
</div>
|
||||
<InfoRow label="Töleg ugradyjynyň goýum hasaby" value={order.accountNumber} />
|
||||
<InfoRow label="Pasport seriýasy" value={order.passportSeries} />
|
||||
<InfoRow label="Pasport nomeri" value={order.passportNumber} />
|
||||
<InfoRow label="Ady Familiýasy Atasynyň ady" value={order.fullName} />
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
<div className="px-4 py-3 bg-muted/30 border-t border-border">
|
||||
<div className="text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2">
|
||||
Tolegi kabul edijinin maglumatlary
|
||||
</div>
|
||||
<div className="grid grid-cols-3 gap-4 text-sm">
|
||||
<div>
|
||||
<span className="text-muted-foreground">Pasport seriyasy</span>
|
||||
<p className="font-medium">{order.passportSeries}</p>
|
||||
</div>
|
||||
<div>
|
||||
<span className="text-muted-foreground">Pasport nomeri</span>
|
||||
<p className="font-medium">{order.passportNumber}</p>
|
||||
</div>
|
||||
<div>
|
||||
<span className="text-muted-foreground">
|
||||
Ady Familiyasy Atasynyn ady
|
||||
</span>
|
||||
<p className="font-medium">{order.fullName}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Section>
|
||||
{/* ── Row 3: Kabul ediji resminamalary ─────────────────────────────── */}
|
||||
<BentoGrid cols={1}>
|
||||
<BentoCard title="Kabul ediji talyp boyunca resminamalary">
|
||||
{kabulDocs.length > 0
|
||||
? kabulDocs.map((doc) => (
|
||||
<DocumentRow key={doc.id} label={doc.label} fileName={doc.name} fileUrl={doc.fileUrl} />
|
||||
))
|
||||
: (
|
||||
<div className="px-4 py-8 text-center text-sm text-muted-foreground">
|
||||
Resminamalar ýok
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
{/* Documents - Accepted */}
|
||||
<div className="space-y-3">
|
||||
<h2 className="text-base font-semibold text-foreground">
|
||||
Kabul ediji talyp boyunca resminamalary
|
||||
</h2>
|
||||
<div className="bg-card rounded-lg border border-border">
|
||||
{order.documents?.slice(0, 6).map((doc) => (
|
||||
<DocumentItem
|
||||
key={doc.id}
|
||||
label={doc.label}
|
||||
fileName={doc.name}
|
||||
fileUrl={doc.fileUrl}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
{/* ── Row 4: Ugradyjy resminamalary ────────────────────────────────── */}
|
||||
<BentoGrid cols={1}>
|
||||
<BentoCard title="Ugradyjy boyunca resminamalary">
|
||||
{ugradDocs.length > 0
|
||||
? ugradDocs.map((doc) => (
|
||||
<DocumentRow key={doc.id} label={doc.label} fileName={doc.name} fileUrl={doc.fileUrl} />
|
||||
))
|
||||
: (
|
||||
<div className="px-4 py-8 text-center text-sm text-muted-foreground">
|
||||
Resminamalar ýok
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
{/* Documents - Sent */}
|
||||
<div className="space-y-3">
|
||||
<h2 className="text-base font-semibold text-foreground">
|
||||
Ugradyjy boyunca resminamalary
|
||||
</h2>
|
||||
<div className="bg-card rounded-lg border border-border">
|
||||
{order.documents
|
||||
?.slice(6)
|
||||
.map((doc) => (
|
||||
<DocumentItem
|
||||
key={doc.id}
|
||||
label={doc.label}
|
||||
fileName={doc.name}
|
||||
fileUrl={doc.fileUrl}
|
||||
{/* ── Row 5: Töleg taryhy ───────────────────────────────────────────── */}
|
||||
<BentoGrid cols={1}>
|
||||
<BentoCard title="Töleg taryhy">
|
||||
<div className="p-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" />
|
||||
<input
|
||||
type="text"
|
||||
value={historySearch}
|
||||
onChange={(e) => setHistorySearch(e.target.value)}
|
||||
placeholder="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"
|
||||
/>
|
||||
)) || (
|
||||
<div className="px-4 py-8 text-center text-muted-foreground text-sm">
|
||||
Resminamalar yok
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Payment History */}
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<h2 className="text-base font-semibold text-foreground">
|
||||
Toleg taryhy
|
||||
</h2>
|
||||
<button className="text-muted-foreground hover:text-foreground transition-colors">
|
||||
<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor">
|
||||
<path d="M6 0L7.5 4.5L12 6L7.5 7.5L6 12L4.5 7.5L0 6L4.5 4.5L6 0Z" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="bg-card rounded-lg border border-border">
|
||||
<div className="flex items-center gap-2 px-4 py-3 border-b border-border">
|
||||
<Search size={14} className="text-muted-foreground" />
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Gozlemek"
|
||||
className="flex-1 bg-transparent text-sm placeholder:text-muted-foreground/50 focus:outline-none"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-center py-12 text-muted-foreground">
|
||||
<div className="text-center">
|
||||
<div className="w-12 h-12 mx-auto mb-3 rounded-lg bg-muted/50 flex items-center justify-center">
|
||||
<svg
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="1.5"
|
||||
>
|
||||
<div className="flex flex-col items-center justify-center py-10 text-muted-foreground/50">
|
||||
<div className="w-12 h-12 mb-3 rounded-lg border-2 border-dashed border-muted-foreground/20 flex items-center justify-center">
|
||||
<svg viewBox="0 0 24 24" className="w-6 h-6" fill="none" stroke="currentColor" strokeWidth={1.5}>
|
||||
<rect x="3" y="3" width="18" height="18" rx="2" />
|
||||
<line x1="3" y1="9" x2="21" y2="9" />
|
||||
<line x1="9" y1="21" x2="9" y2="9" />
|
||||
</svg>
|
||||
</div>
|
||||
<p className="text-sm">
|
||||
Berlen kriteriyalara Toleg gabat gelmedi.
|
||||
</p>
|
||||
<p className="text-sm">Berlen kriteriýalara Töleg gabat gelmedi.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
<div className="flex items-center justify-end">
|
||||
<button className="p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors">
|
||||
<Clock size={16} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/* ── Audit log ────────────────────────────────────────────────────── */}
|
||||
<AuditLog logs={auditLogs} />
|
||||
|
||||
{/* Activity Log */}
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<h2 className="text-base font-semibold text-foreground">Ammallar</h2>
|
||||
<button className="text-muted-foreground hover:text-foreground transition-colors">
|
||||
<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor">
|
||||
<path d="M6 0L7.5 4.5L12 6L7.5 7.5L6 12L4.5 7.5L0 6L4.5 4.5L6 0Z" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="bg-card rounded-lg border border-border overflow-hidden">
|
||||
{/* Table Header */}
|
||||
<div className="grid grid-cols-6 gap-4 px-4 py-2 bg-muted/40 text-xs font-semibold text-muted-foreground uppercase tracking-wider">
|
||||
<span>ID</span>
|
||||
<span>Analys ady</span>
|
||||
<span>Kim tarapyndan</span>
|
||||
<span>Analys nysany (Targets)</span>
|
||||
<span>Analys statusy</span>
|
||||
<span>Sene</span>
|
||||
</div>
|
||||
|
||||
{/* Table Body */}
|
||||
{order.activityLog?.length ? (
|
||||
order.activityLog.map((log) => (
|
||||
<div
|
||||
key={log.id}
|
||||
className="grid grid-cols-6 gap-4 px-4 py-3 border-t border-border text-sm"
|
||||
>
|
||||
<span className="text-primary font-medium">
|
||||
{log.id.split("-")[1] ?? "45384"}
|
||||
</span>
|
||||
<span>{log.analysisName}</span>
|
||||
<span className="text-muted-foreground">{log.createdBy}</span>
|
||||
<span className="text-muted-foreground">{log.target}</span>
|
||||
<span>
|
||||
<span
|
||||
className={cn(
|
||||
"inline-flex items-center px-2 py-0.5 rounded text-xs font-semibold",
|
||||
log.status === "FINISHED"
|
||||
? "bg-primary/20 text-primary"
|
||||
: "bg-muted text-muted-foreground",
|
||||
)}
|
||||
>
|
||||
{log.status}
|
||||
</span>
|
||||
</span>
|
||||
<span className="text-muted-foreground">
|
||||
{format(new Date(log.createdAt), "dd/MM/yyyy, HH:mm:ss")}{" "}
|
||||
GMT+5
|
||||
</span>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<div className="px-4 py-8 text-center text-muted-foreground text-sm border-t border-border">
|
||||
Ammallar yok
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
import { useState } from 'react'
|
||||
import { useParams, useNavigate } from 'react-router-dom'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useIntlPayment, useDeleteIntlPayment } from '@/features/visaMasterPayments/hooks/useVisaMasterPayments'
|
||||
import type { IntlPaymentStatus } from '@/features/visaMasterPayments/api/visaMasterPaymentsApi'
|
||||
import { Spinner } from '@/components/ui/spinner'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Pencil, Trash2, Download, Search } from 'lucide-react'
|
||||
import { Pencil, Trash2, Download, Search, AlertCircle, CheckCircle2, XCircle } from 'lucide-react'
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
@@ -16,59 +13,120 @@ import {
|
||||
AlertDialogTitle,
|
||||
AlertDialogTrigger,
|
||||
} from '@/components/ui/alert-dialog'
|
||||
import { useState } from 'react'
|
||||
import { Skeleton } from '@/components/ui/skeleton'
|
||||
import { StatusBadge, type StatusBadgeVariant } from '@/components/ui/statusBadge'
|
||||
import { InfoRow, Section } from '@/components/viewPageComponents'
|
||||
// ─── Status Badge ─────────────────────────────────────────────────────────────
|
||||
import { InfoRow } from '@/components/viewPageComponents'
|
||||
import { useIntlPayment, useDeleteIntlPayment } from '@/features/visaMasterPayments/hooks/useVisaMasterPayments'
|
||||
import type { IntlPaymentStatus } from '@/features/visaMasterPayments/api/visaMasterPaymentsApi'
|
||||
|
||||
const STATUS_MAP: Record<IntlPaymentStatus, { label: string; variant: StatusBadgeVariant }> = {
|
||||
pending: { label: 'Garaşylýar', variant: 'warning' },
|
||||
approved: { label: 'Tassyklandy', variant: 'success' },
|
||||
rejected: { label: 'Ret edildi', variant: 'error' },
|
||||
// ─── Status config ────────────────────────────────────────────────────────────
|
||||
|
||||
const STATUS_MAP: Record<IntlPaymentStatus, { label: string; variant: StatusBadgeVariant; icon: React.ElementType }> = {
|
||||
pending: { label: 'Garaşylýar', variant: 'warning', icon: AlertCircle },
|
||||
approved: { label: 'Tassyklandy', variant: 'success', icon: CheckCircle2 },
|
||||
rejected: { label: 'Ret edildi', variant: 'error', icon: XCircle },
|
||||
}
|
||||
|
||||
function PaymentStatusBadge({ status }: { status: IntlPaymentStatus }) {
|
||||
const cfg = STATUS_MAP[status] ?? STATUS_MAP.pending
|
||||
return <StatusBadge label={cfg.label} variant={cfg.variant} icon={cfg.icon} />
|
||||
}
|
||||
|
||||
// ─── Bento primitives ─────────────────────────────────────────────────────────
|
||||
|
||||
function BentoGrid({ cols = 2, children }: { cols?: 1 | 2 | 3 | 4; children: React.ReactNode }) {
|
||||
const colClass = {
|
||||
1: 'grid-cols-1',
|
||||
2: 'grid-cols-1 sm:grid-cols-2',
|
||||
3: 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-3',
|
||||
4: 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-4',
|
||||
}[cols]
|
||||
return <div className={`grid ${colClass} gap-4`}>{children}</div>
|
||||
}
|
||||
|
||||
function BentoCard({
|
||||
title,
|
||||
span,
|
||||
children,
|
||||
}: {
|
||||
title?: string
|
||||
span?: 'full' | 2 | 3
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
const spanClass =
|
||||
span === 'full' ? 'sm:col-span-full' :
|
||||
span === 2 ? 'sm:col-span-2' :
|
||||
span === 3 ? 'sm:col-span-3' : ''
|
||||
|
||||
return (
|
||||
<StatusBadge label={cfg.label} variant={cfg.variant} />
|
||||
<div className={`bg-card border border-border rounded-xl overflow-hidden ${spanClass}`}>
|
||||
{title && (
|
||||
<div className="px-4 py-2.5 border-b border-border">
|
||||
<p className="text-xs font-semibold text-muted-foreground uppercase tracking-wide">
|
||||
{title}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
{children}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ─── DocFile row ─────────────────────────────────────────────────────────────
|
||||
// ─── DocFile row ──────────────────────────────────────────────────────────────
|
||||
|
||||
function DocFileRow({ label, url }: { label: string; url: string | null }) {
|
||||
if (!url) return (
|
||||
<div className="flex items-start gap-4 py-3 border-b border-border last:border-0">
|
||||
<span className="text-sm text-muted-foreground flex-1 leading-snug">{label}</span>
|
||||
<span className="text-sm text-muted-foreground/50">—</span>
|
||||
</div>
|
||||
<InfoRow label={label}>
|
||||
<span className="text-muted-foreground/50">—</span>
|
||||
</InfoRow>
|
||||
)
|
||||
|
||||
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 (
|
||||
<div className="flex items-start gap-4 py-3 border-b border-border last:border-0">
|
||||
<span className="text-sm text-muted-foreground flex-1 leading-snug">{label}</span>
|
||||
<div className="flex items-center gap-2 shrink-0">
|
||||
<InfoRow label={label}>
|
||||
<div className="flex items-center gap-2">
|
||||
{isImage && (
|
||||
<a href={url} target="_blank" rel="noreferrer"
|
||||
<a
|
||||
href={url}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 rounded-md bg-muted/50 hover:bg-muted text-xs text-foreground transition-colors"
|
||||
>
|
||||
<Search size={12} />
|
||||
<span className="max-w-[140px] truncate">{filename}</span>
|
||||
</a>
|
||||
)}
|
||||
<a href={url} download
|
||||
<a
|
||||
href={url}
|
||||
download
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 rounded-md bg-primary/10 hover:bg-primary/20 text-xs text-primary transition-colors"
|
||||
>
|
||||
<Download size={12} />
|
||||
<span className="max-w-[140px] truncate">{filename}</span>
|
||||
</a>
|
||||
</div>
|
||||
</InfoRow>
|
||||
)
|
||||
}
|
||||
|
||||
// ─── Skeleton ─────────────────────────────────────────────────────────────────
|
||||
|
||||
function IntlPaymentViewSkeleton() {
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
<Skeleton className="h-7 w-64" />
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
{[...Array(4)].map((_, i) => (
|
||||
<div key={i} className="bg-card border border-border rounded-xl p-4 flex flex-col gap-3">
|
||||
<Skeleton className="h-3 w-24 mb-1" />
|
||||
{[...Array(3)].map((_, j) => (
|
||||
<Skeleton key={j} className="h-4 w-full" />
|
||||
))}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -76,62 +134,62 @@ function DocFileRow({ label, url }: { label: string; url: string | null }) {
|
||||
// ─── Page ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
export default function IntlPaymentViewPage() {
|
||||
const { id } = useParams<{ id: string }>()
|
||||
const navigate = useNavigate()
|
||||
const { t } = useTranslation()
|
||||
|
||||
const { data, isLoading, isError } = useIntlPayment(id!)
|
||||
const { mutate: deletePayment, isPending: isDeleting } = useDeleteIntlPayment()
|
||||
const { id } = useParams<{ id: string }>()
|
||||
const navigate = useNavigate()
|
||||
const { t } = useTranslation()
|
||||
const [historySearch, setHistorySearch] = useState('')
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="flex items-center justify-center py-24">
|
||||
<Spinner className="size-8 text-primary" />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
const { data, isLoading, isError } = useIntlPayment(id!)
|
||||
const { mutate: deletePayment, isPending: isDeleting } = useDeleteIntlPayment()
|
||||
|
||||
if (isLoading) return <IntlPaymentViewSkeleton />
|
||||
|
||||
if (isError || !data) {
|
||||
return (
|
||||
<div className="flex items-center justify-center py-24 text-muted-foreground">
|
||||
<div className="flex items-center justify-center h-64 text-muted-foreground text-sm">
|
||||
{t('common.notFound', 'Maglumat tapylmady')}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const KABUL_DOCS = [
|
||||
{ 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ň 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ň 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: '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 },
|
||||
{ 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ň 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ň 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: '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 = [
|
||||
{ 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ý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 },
|
||||
{ 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ý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 (
|
||||
<div className=" mx-auto space-y-6">
|
||||
{/* Header */}
|
||||
<div className="flex items-start justify-between">
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="flex flex-col gap-6">
|
||||
|
||||
{/* ── Page header ──────────────────────────────────────────────────── */}
|
||||
<div className="flex items-center justify-between">
|
||||
<h1 className="text-xl font-semibold text-foreground">
|
||||
{t('intlPayment.viewTitle', 'Halkara töleg')}: {data.id}
|
||||
</h1>
|
||||
<div className="flex items-center gap-1.5">
|
||||
<AlertDialog>
|
||||
<AlertDialogTrigger asChild>
|
||||
<Button size="icon" variant="ghost" className="h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10">
|
||||
<Trash2 size={15} />
|
||||
</Button>
|
||||
<button
|
||||
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')}
|
||||
>
|
||||
<Trash2 size={16} />
|
||||
</button>
|
||||
</AlertDialogTrigger>
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
@@ -153,17 +211,19 @@ export default function IntlPaymentViewPage() {
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
|
||||
<Button size="icon" variant="ghost" className="h-8 w-8"
|
||||
<button
|
||||
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"
|
||||
title={t('common.edit', 'Redaktirle')}
|
||||
>
|
||||
<Pencil size={15} />
|
||||
</Button>
|
||||
<Pencil size={16} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Status */}
|
||||
<Section title={t('intlPayment.statusSection', 'Status')}>
|
||||
<div className="divide-y divide-border">
|
||||
{/* ── Row 1: Meta + Ýüztuman + Lokasiýa ───────────────────────────── */}
|
||||
<BentoGrid cols={3}>
|
||||
<BentoCard title={t('intlPayment.statusSection', 'Esasy maglumatlar')}>
|
||||
<InfoRow label={t('intlPayment.client', 'Ulanyjy')}>
|
||||
<span className="text-primary font-medium">{data.client_label}</span>
|
||||
</InfoRow>
|
||||
@@ -173,125 +233,89 @@ export default function IntlPaymentViewPage() {
|
||||
<InfoRow label={t('intlPayment.status', 'Status')}>
|
||||
<PaymentStatusBadge status={data.status} />
|
||||
</InfoRow>
|
||||
<InfoRow label={t('intlPayment.tilowanMonth', 'Tölewan (Aý/aý)')}>
|
||||
{data.created_at}
|
||||
</InfoRow>
|
||||
<InfoRow label={t('intlPayment.note', 'Bellik')}>
|
||||
{data.note}
|
||||
</InfoRow>
|
||||
</div>
|
||||
</Section>
|
||||
<InfoRow label={t('intlPayment.tilowanMonth', 'Tölewan (Aý/aý)')} value={data.created_at} />
|
||||
<InfoRow label={t('intlPayment.note', 'Bellik')} value={data.note} />
|
||||
</BentoCard>
|
||||
|
||||
{/* Ýüztumanyň görnüşi */}
|
||||
<Section title={t('intlPayment.currencySection', 'Ýüztumanyň görnüşi')}>
|
||||
<div className="divide-y divide-border">
|
||||
<InfoRow label={t('intlPayment.currencyType', 'Ýüztumanyň görnüşi')}>
|
||||
{data.currency_type_label}
|
||||
</InfoRow>
|
||||
</div>
|
||||
</Section>
|
||||
<BentoCard title={t('intlPayment.currencySection', 'Ýüztumanyň görnüşi')}>
|
||||
<InfoRow label={t('intlPayment.currencyType', 'Görnüşi')} value={data.currency_type_label} />
|
||||
</BentoCard>
|
||||
|
||||
{/* Lokasiýa */}
|
||||
<Section title={t('intlPayment.locationSection', 'Lokasiýa')}>
|
||||
<div className="divide-y divide-border">
|
||||
<InfoRow label={t('intlPayment.province', 'Welaýat')}>{data.province_label}</InfoRow>
|
||||
<BentoCard title={t('intlPayment.locationSection', 'Lokasiýa')}>
|
||||
<InfoRow label={t('intlPayment.province', 'Welaýat')} value={data.province_label} />
|
||||
<InfoRow label={t('intlPayment.branch', 'Şahamça')}>
|
||||
<span className="text-primary font-medium">{data.branch_label}</span>
|
||||
</InfoRow>
|
||||
</div>
|
||||
</Section>
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
{/* Şahsy maglumatlar */}
|
||||
<Section title={t('intlPayment.personalSection', 'Şahsy maglumatlar')}>
|
||||
<div className="divide-y divide-border">
|
||||
<InfoRow label={t('intlPayment.passportFirstName', 'Pasportdaky ady')}>{data.passport_first_name}</InfoRow>
|
||||
<InfoRow label={t('intlPayment.passportLastName', 'Pasportdaky familiýa')}>{data.passport_last_name}</InfoRow>
|
||||
<InfoRow label={t('intlPayment.phone', 'Telefon')}>+{data.phone}</InfoRow>
|
||||
<InfoRow label={t('intlPayment.email', 'E-poçta')}>{data.email}</InfoRow>
|
||||
<InfoRow label={t('intlPayment.homeAddress', 'Häzirki ýaşyş ýeri')}>{data.home_address}</InfoRow>
|
||||
</div>
|
||||
</Section>
|
||||
|
||||
{/* Töleg */}
|
||||
<Section title={t('intlPayment.paymentSection', 'Töleg')}>
|
||||
<div className="divide-y divide-border mb-4">
|
||||
<InfoRow label={t('intlPayment.payerFullName', 'Töleg upgradyjynyň maglumatlary')}>
|
||||
{data.payer_full_name}
|
||||
{/* ── Row 2: Şahsy maglumatlar + Töleg ─────────────────────────────── */}
|
||||
<BentoGrid cols={2}>
|
||||
<BentoCard title={t('intlPayment.personalSection', 'Şahsy maglumatlar')}>
|
||||
<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.phone', 'Telefon')}>
|
||||
<span>+{data.phone}</span>
|
||||
</InfoRow>
|
||||
<InfoRow label={t('intlPayment.payerAccount', 'Töleg upgradyjynyň goşun hasaby')}>
|
||||
{data.payer_account_number}
|
||||
</InfoRow>
|
||||
</div>
|
||||
{/* Receiver table */}
|
||||
<div className="border border-border rounded-lg overflow-hidden">
|
||||
<table className="w-full text-sm">
|
||||
<thead className="bg-muted/40">
|
||||
<tr>
|
||||
<th className="text-left px-4 py-2.5 text-xs font-semibold text-muted-foreground uppercase">
|
||||
{t('intlPayment.passportSeries', 'Pasport seriýasy')}
|
||||
</th>
|
||||
<th className="text-left px-4 py-2.5 text-xs font-semibold text-muted-foreground uppercase">
|
||||
{t('intlPayment.passportNumber', 'Pasport nomeri')}
|
||||
</th>
|
||||
<th className="text-left px-4 py-2.5 text-xs font-semibold text-muted-foreground uppercase">
|
||||
{t('intlPayment.payerFullName', 'Ady Familiýasy Atasnyň ady')}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr className="border-t border-border">
|
||||
<td className="px-4 py-3">{data.passport_series} – {data.passport_number}</td>
|
||||
<td className="px-4 py-3">{data.passport_number}</td>
|
||||
<td className="px-4 py-3">{data.payer_full_name}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</Section>
|
||||
<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>
|
||||
|
||||
{/* Kabul ediji talyp boyunca resminamalar */}
|
||||
<Section title={t('intlPayment.kabulDocsSection', 'Kabul ediji talyp boyunca resminamalar')}>
|
||||
<div>
|
||||
<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.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.passportNumber', 'Pasport nomeri')} value={data.passport_number} />
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
{/* ── Row 3: Kabul ediji resminamalar ──────────────────────────────── */}
|
||||
<BentoGrid cols={1}>
|
||||
<BentoCard title={t('intlPayment.kabulDocsSection', 'Kabul ediji talyp boyunca resminamalar')}>
|
||||
{KABUL_DOCS.map((doc, i) => (
|
||||
<DocFileRow key={i} label={doc.label} url={doc.url} />
|
||||
))}
|
||||
</div>
|
||||
</Section>
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
{/* Upgradyý boyunca resminamalar */}
|
||||
<Section title={t('intlPayment.upgradDocsSection', 'Upgradyý boyunca resminamalar')}>
|
||||
<div>
|
||||
{/* ── Row 4: Upgradyý resminamalar ─────────────────────────────────── */}
|
||||
<BentoGrid cols={1}>
|
||||
<BentoCard title={t('intlPayment.upgradDocsSection', 'Upgradyý boyunca resminamalar')}>
|
||||
{UPGRAD_DOCS.map((doc, i) => (
|
||||
<DocFileRow key={i} label={doc.label} url={doc.url} />
|
||||
))}
|
||||
</div>
|
||||
</Section>
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
{/* Töleg taryhy */}
|
||||
<Section title={t('intlPayment.paymentHistory', 'Töleg taryhy')}>
|
||||
<div className="flex items-center gap-2 mb-4">
|
||||
<div className="relative flex-1 max-w-xs">
|
||||
<Search size={13} className="absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground" />
|
||||
<input
|
||||
type="text"
|
||||
value={historySearch}
|
||||
onChange={(e) => setHistorySearch(e.target.value)}
|
||||
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"
|
||||
/>
|
||||
{/* ── Row 5: Töleg taryhy ───────────────────────────────────────────── */}
|
||||
<BentoGrid cols={1}>
|
||||
<BentoCard title={t('intlPayment.paymentHistory', 'Töleg taryhy')}>
|
||||
<div className="p-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" />
|
||||
<input
|
||||
type="text"
|
||||
value={historySearch}
|
||||
onChange={(e) => setHistorySearch(e.target.value)}
|
||||
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"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col items-center justify-center py-10 text-muted-foreground/50">
|
||||
<div className="w-12 h-12 mb-3 rounded-lg border-2 border-dashed border-muted-foreground/20 flex items-center justify-center">
|
||||
<svg viewBox="0 0 24 24" className="w-6 h-6" fill="none" stroke="currentColor" strokeWidth={1.5}>
|
||||
<rect x="3" y="3" width="18" height="18" rx="2" />
|
||||
<line x1="3" y1="9" x2="21" y2="9" />
|
||||
<line x1="9" y1="9" x2="9" y2="21" />
|
||||
</svg>
|
||||
</div>
|
||||
<p className="text-sm">{t('intlPayment.noHistory', 'Beriilen kriteriýalara Töleg gabat gelmedi')}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-col items-center justify-center py-12 text-muted-foreground/50">
|
||||
<div className="w-12 h-12 mb-3 rounded-lg border-2 border-dashed border-muted-foreground/20 flex items-center justify-center">
|
||||
<svg viewBox="0 0 24 24" className="w-6 h-6" fill="none" stroke="currentColor" strokeWidth={1.5}>
|
||||
<rect x="3" y="3" width="18" height="18" rx="2" />
|
||||
<line x1="3" y1="9" x2="21" y2="9" />
|
||||
<line x1="9" y1="9" x2="9" y2="21" />
|
||||
</svg>
|
||||
</div>
|
||||
<p className="text-sm">{t('intlPayment.noHistory', 'Beriilen kriteriýalara Töleg gabat gelmedi')}</p>
|
||||
</div>
|
||||
</Section>
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
42
src/pages/notFoundPage/index.tsx
Normal file
42
src/pages/notFoundPage/index.tsx
Normal file
@@ -0,0 +1,42 @@
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
export default function NotFoundPage() {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center min-h-screen bg-background text-foreground p-6 transition-colors duration-300">
|
||||
<div className="text-center space-y-6 max-w-md">
|
||||
<h1 className="text-9xl font-extrabold tracking-widest text-primary/80 select-none">
|
||||
404
|
||||
</h1>
|
||||
|
||||
<div className="space-y-2">
|
||||
<h2 className="text-2xl font-bold tracking-tight sm:text-3xl">
|
||||
{t("errors.pageNotFoundTitle")}
|
||||
</h2>
|
||||
<p className="text-muted-foreground">
|
||||
{t("errors.pageNotFoundDescription")}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-center gap-4">
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => navigate(-1)}
|
||||
>
|
||||
{t("common.goBack")}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
onClick={() => navigate("/")}
|
||||
>
|
||||
{t("common.backToHome")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user