- {/* Page Header */}
{t('cardOrder.title', 'Kart sargytlary')}
- {/* Table Card */}
+
+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
+
+function PaymentPaidStatusBadge({ status }: { status: PaymentPaidStatus }) {
+ const cfg = PAID_STATUS_CONFIG[status]
+ if (!cfg) return {String(status)}
+ return
+}
+
+function PaymentStatusBadge({ status }: { status: PaymentStatus }) {
+ const cfg = STATUS_CONFIG[status]
+ if (!cfg) return {String(status)}
+ return
+}
+
// ─── Column Definitions ───────────────────────────────────────────────────────
@@ -131,12 +179,12 @@ export default function SberPaymentsListPage() {
),
- cell: ({ row }) => ,
+ cell: ({ row }) => ,
},
{
accessorKey: 'paidStatus',
header: 'Tolenen (sul ay)',
- cell: ({ row }) => ,
+ cell: ({ row }) => ,
},
{
id: 'actions',
@@ -298,15 +346,6 @@ export default function SberPaymentsListPage() {
totalCount={data?.pagination.totalCount ?? 0}
onPageChange={setPage}
/>
-
- {/* Pagination Info */}
-
-
- {data?.pagination.currentPage && data?.pagination.perPage && data?.pagination.totalCount
- ? `${(data.pagination.currentPage - 1) * data.pagination.perPage + 1}-${Math.min(data.pagination.currentPage * data.pagination.perPage, data.pagination.totalCount)} of ${data.pagination.totalCount}`
- : ''}
-
-
)
}
diff --git a/src/pages/internationalPayments/sberPaymentsView/index.tsx b/src/pages/internationalPayments/sberPaymentsView/index.tsx
index 1eb8c8b..a5f8365 100644
--- a/src/pages/internationalPayments/sberPaymentsView/index.tsx
+++ b/src/pages/internationalPayments/sberPaymentsView/index.tsx
@@ -1,69 +1,147 @@
+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, Clock } from 'lucide-react'
-
-import { useSberPaymentOrder, useDeleteSberPayment } from '@/features/sberPayments/hooks/useSberPayments'
-import { StatusBadge, PaidStatusBadge } from '@/features/sberPayments/components/statusBadge'
-import { Button } from '@/components/ui/button'
-import { Spinner } from '@/components/ui/spinner'
-import { cn } from '@/lib/utils'
+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";
+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 }
+>;
+
+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 (
+
{String(status)}
+ );
+ return (
+
+ );
+}
+
+function PaymentStatusBadge({ status }: { status: PaymentStatus }) {
+ const cfg = STATUS_CONFIG[status];
+ if (!cfg)
+ return (
+
{String(status)}
+ );
+ return (
+
+ );
+}
// ─── Info Row Component ───────────────────────────────────────────────────────
-function InfoRow({
- label,
- value,
- highlight = false
-}: {
- label: string
- value: React.ReactNode
- highlight?: boolean
+function InfoRow({
+ label,
+ value,
+ highlight = false,
+}: {
+ label: string;
+ value: React.ReactNode;
+ highlight?: boolean;
}) {
return (
- {label}
-
- {value || '—'}
+
+ {label}
+
+
+ {value || "—"}
- )
+ );
}
// ─── Section Component ────────────────────────────────────────────────────────
-function Section({
- title,
- children,
- className
-}: {
- title: string
- children: React.ReactNode
- className?: string
+function Section({
+ title,
+ children,
+ className,
+}: {
+ title: string;
+ children: React.ReactNode;
+ className?: string;
}) {
return (
-
+
{title}
-
- {children}
-
+
{children}
- )
+ );
}
// ─── Document Item Component ──────────────────────────────────────────────────
-function DocumentItem({
- label,
- fileName,
- fileUrl
-}: {
- label: string
- fileName: string | null
- fileUrl: string | null
+function DocumentItem({
+ label,
+ fileName,
+ fileUrl,
+}: {
+ label: string;
+ fileName: string | null;
+ fileUrl: string | null;
}) {
return (
@@ -88,47 +166,51 @@ function DocumentItem({
)}
- )
+ );
}
// ─── View Page Component ──────────────────────────────────────────────────────
export default function SberPaymentViewPage() {
- const params = useParams()
- const navigate = useNavigate()
- const id = params.id as string
-
- const { data: order, isLoading } = useSberPaymentOrder(id)
- const deleteMutation = useDeleteSberPayment()
-
+ const params = useParams();
+ const navigate = useNavigate();
+ const id = params.id as string;
+
+ 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 (confirm("Bu tolegi pozmak isleyanizmi?")) {
+ await deleteMutation.mutateAsync(id);
+ navigate("/sber-payments");
}
- }
-
+ };
+
if (isLoading) {
return (
- )
+ );
}
-
+
if (!order) {
return (
Toleg tapylmady
-
- )
+ );
}
-
+
return (
-
+
{/* Header Actions */}
-
+
{/* Status Section */}
- } />
- } />
+ }
+ />
+ }
+ />
-
+
{/* Location Section */}
@@ -165,7 +253,7 @@ export default function SberPaymentViewPage() {
-
+
{/* Personal Info Section */}
@@ -176,17 +264,20 @@ export default function SberPaymentViewPage() {
-
+
{/* Payment Info Section */}
-
+
-
-
+
Tolegi kabul edijinin maglumatlary
@@ -201,13 +292,15 @@ export default function SberPaymentViewPage() {
{order.passportNumber}
-
Ady Familiyasy Atasynyn ady
+
+ Ady Familiyasy Atasynyn ady
+
{order.fullName}
-
+
{/* Documents - Accepted */}
@@ -224,39 +317,43 @@ export default function SberPaymentViewPage() {
))}
-
+
{/* Documents - Sent */}
Ugradyjy boyunca resminamalary
- {order.documents?.slice(6).map((doc) => (
-
- )) || (
+ {order.documents
+ ?.slice(6)
+ .map((doc) => (
+
+ )) || (
Resminamalar yok
)}
-
+
{/* Payment History */}
-
Toleg taryhy
+
+ Toleg taryhy
+
-
+
@@ -266,28 +363,37 @@ export default function SberPaymentViewPage() {
className="flex-1 bg-transparent text-sm placeholder:text-muted-foreground/50 focus:outline-none"
/>
-
+
-
-
Berlen kriteriyalara Toleg gabat gelmedi.
+
+ Berlen kriteriyalara Toleg gabat gelmedi.
+
-
+
-
+
{/* Activity Log */}
@@ -298,7 +404,7 @@ export default function SberPaymentViewPage() {
-
+
{/* Table Header */}
@@ -309,27 +415,35 @@ export default function SberPaymentViewPage() {
Analys statusy
Sene
-
+
{/* Table Body */}
{order.activityLog?.length ? (
order.activityLog.map((log) => (
-
-
{log.id.split('-')[1] ?? '45384'}
+
+
+ {log.id.split("-")[1] ?? "45384"}
+
{log.analysisName}
{log.createdBy}
{log.target}
-
+
{log.status}
- {format(new Date(log.createdAt), 'dd/MM/yyyy, HH:mm:ss')} GMT+5
+ {format(new Date(log.createdAt), "dd/MM/yyyy, HH:mm:ss")}{" "}
+ GMT+5
))
@@ -339,14 +453,7 @@ export default function SberPaymentViewPage() {
)}
-
- {/* Pagination */}
-
- Onki
- 1-1 of 1
- Indiki
-
- )
+ );
}
diff --git a/src/pages/internationalPayments/visaMasterPayments/index.tsx b/src/pages/internationalPayments/visaMasterPayments/index.tsx
index 485faf9..44d26be 100644
--- a/src/pages/internationalPayments/visaMasterPayments/index.tsx
+++ b/src/pages/internationalPayments/visaMasterPayments/index.tsx
@@ -19,22 +19,32 @@ import {
AlertDialogTitle,
} from '@/components/ui/alert-dialog'
import { cn } from '@/lib/utils'
+import { StatusBadge, type StatusBadgeVariant } from '@/components/ui/statusBadge'
+import { AlertCircle, CheckCircle2, XCircle } from 'lucide-react'
+// ─── Status badge ─────────────────────────────────────────────────────────────
-// ─── Status Badge ─────────────────────────────────────────────────────────────
+const STATUS_CONFIG = {
+ pending: {
+ label: 'Garaşylýar',
+ variant: 'warning' as StatusBadgeVariant,
+ icon: AlertCircle,
+ },
+ approved: {
+ label: 'Tassyklandy',
+ variant: 'success' as StatusBadgeVariant,
+ icon: CheckCircle2,
+ },
+ rejected: {
+ label: 'Ýatyryldy',
+ variant: 'error' as StatusBadgeVariant,
+ icon: XCircle,
+ },
+} satisfies Record