From 2ba061b76c894994d9dee444ad06f9c0f98eb0f4 Mon Sep 17 00:00:00 2001 From: "@jcarymuhammedow" Date: Thu, 4 Jun 2026 16:43:36 +0500 Subject: [PATCH] refactored badge --- src/components/viewPageComponents.tsx | 132 +++------- .../cardDepartment/cardRequisites/index.tsx | 31 +-- .../cardDepartment/orderNewCardView/index.tsx | 151 ++++-------- src/pages/dashboard/index.tsx | 208 ++++++++-------- .../loanDepartment/loanOrderView/index.tsx | 226 ++++-------------- 5 files changed, 247 insertions(+), 501 deletions(-) diff --git a/src/components/viewPageComponents.tsx b/src/components/viewPageComponents.tsx index 445da9a..8aa2ebd 100644 --- a/src/components/viewPageComponents.tsx +++ b/src/components/viewPageComponents.tsx @@ -3,16 +3,11 @@ import { Download, Eye, ChevronDown, Inbox } from "lucide-react"; import { useTranslation } from "react-i18next"; import { Badge } from "@/components/ui/badge"; import { DataTable, type ColumnDef } from "@/components/dataTable"; +import { Link } from "react-router-dom"; // ─── BentoGrid ──────────────────────────────────────────────────────────────── -export function BentoGrid({ - cols = 2, - children, -}: { - cols?: 1 | 2 | 3 | 4; - children: React.ReactNode; -}) { +export 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", @@ -31,30 +26,14 @@ interface BentoCardProps { noPadding?: boolean; } -export function BentoCard({ - title, - span, - children, - noPadding, -}: BentoCardProps) { - const spanClass = - span === "full" - ? "sm:col-span-full" - : span === 2 - ? "sm:col-span-2" - : span === 3 - ? "sm:col-span-3" - : ""; +export function BentoCard({ title, span, children, noPadding }: BentoCardProps) { + const spanClass = span === "full" ? "sm:col-span-full" : span === 2 ? "sm:col-span-2" : span === 3 ? "sm:col-span-3" : ""; return ( -
+
{title && (
-

- {title} -

+

{title}

)} {noPadding ?
{children}
: children} @@ -69,23 +48,24 @@ export interface InfoRowProps { value?: string | number | null; children?: React.ReactNode; isLink?: boolean; + href?: string; } -export function InfoRow({ label, value, children, isLink }: InfoRowProps) { +export function InfoRow({ label, value, children, isLink, href }: InfoRowProps) { const content = children ?? (value != null ? String(value) : null); return (
- - {label} - + {label} {content != null && content !== "" ? ( typeof content === "string" ? ( - - {content} - + isLink && href ? ( + + {content} + + ) : ( + {content} + ) ) : (
{content}
) @@ -116,9 +96,7 @@ export function MultiLangRow({ label, value }: MultiLangRowProps) { return (
- - {label} - + {label}
{langs.map((l) => l.val ? ( @@ -126,9 +104,7 @@ export function MultiLangRow({ label, value }: MultiLangRowProps) { {l.code} - - {l.val} - + {l.val}
) : null, )} @@ -148,14 +124,8 @@ export interface SectionProps { export function Section({ title, children }: SectionProps) { return (
- {title ? ( -

- {title} -

- ) : null} -
- {children} -
+ {title ?

{title}

: null} +
{children}
); } @@ -172,21 +142,11 @@ export function CollapsibleSection({ title, children }: CollapsibleSectionProps) return (
-
setOpen((v) => !v)} - > +
setOpen((v) => !v)}>

{title}

- +
- {open && ( -
- {children} -
- )} + {open &&
{children}
}
); } @@ -208,11 +168,7 @@ export function PassportImage({ label, src, url }: PassportImageProps) { {label}
{imageSrc ? ( - {label} + {label} ) : (
— @@ -264,9 +220,7 @@ export function StatusBadge({ status }: { status: string }) { // ─── useAuditColumns ────────────────────────────────────────────────────────── -export function useAuditColumns( - onView?: (log: AuditRowProps) => void, -): ColumnDef[] { +export function useAuditColumns(onView?: (log: AuditRowProps) => void): ColumnDef[] { const { t } = useTranslation(); return useMemo( @@ -274,35 +228,23 @@ export function useAuditColumns( { accessorKey: "id", header: t("audit.columns.id", "ID"), - cell: ({ row }) => ( - - {row.original.id} - - ), + cell: ({ row }) => {row.original.id}, size: 130, }, { accessorKey: "action", header: t("audit.columns.action", "AMALYŇ ADY"), - cell: ({ row }) => ( - - {row.original.action} - - ), + cell: ({ row }) => {row.original.action}, }, { accessorKey: "by", header: t("audit.columns.by", "KIM TARAPYNDAN"), - cell: ({ row }) => ( - {row.original.by} - ), + cell: ({ row }) => {row.original.by}, }, { accessorKey: "target", header: t("audit.columns.target", "AMALYŇ NYŞANY"), - cell: ({ row }) => ( - {row.original.target} - ), + cell: ({ row }) => {row.original.target}, }, { accessorKey: "status", @@ -313,11 +255,7 @@ export function useAuditColumns( { accessorKey: "date", header: t("audit.columns.date", "SENE"), - cell: ({ row }) => ( - - {row.original.date} - - ), + cell: ({ row }) => {row.original.date}, size: 160, }, { @@ -374,15 +312,7 @@ export function EmptyState({ label }: EmptyStateProps) { // ─── AuditLog ───────────────────────────────────────────────────────────────── -export function AuditLog({ - logs, - currentPage, - totalPages, - totalCount, - onPageChange, - isLoading, - onView, -}: AuditLogProps) { +export function AuditLog({ logs, currentPage, totalPages, totalCount, onPageChange, isLoading, onView }: AuditLogProps) { const columns = useAuditColumns(onView); return ( diff --git a/src/pages/cardDepartment/cardRequisites/index.tsx b/src/pages/cardDepartment/cardRequisites/index.tsx index 466c4df..fd5e986 100644 --- a/src/pages/cardDepartment/cardRequisites/index.tsx +++ b/src/pages/cardDepartment/cardRequisites/index.tsx @@ -1,7 +1,7 @@ import { useState } from "react"; import { useNavigate } from "react-router-dom"; import { useTranslation } from "react-i18next"; -import { Download } from "lucide-react"; +import { Download, AlertCircle, CheckCircle2, XCircle } from "lucide-react"; import { DeleteDialog } from "@/components/deleteDialog"; import { DataTable, type ColumnDef } from "@/components/dataTable"; import { DataTableToolbar, type ColumnMeta } from "@/components/dataTableToolbar"; @@ -11,29 +11,20 @@ import { TableActions } from "@/components/tableActions"; import type { VisibilityState } from "@tanstack/react-table"; import { useCardRequisites, useDeleteCardRequisite, useDownloadCardRequisite } from "@/features/cardRequisites/hooks/useCardRequisites"; import type { CardRequisite, CardRequisiteStatus } from "@/features/cardRequisites/api/cardRequisitesApi"; +import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadge"; // ─── Status badge ───────────────────────────────────────────────────────────── -const STATUS_BADGE: Record = { - pending: { - label: "Garaşylýar", - className: "bg-yellow-500/15 text-yellow-500 border-yellow-500/20", - }, - approved: { - label: "Tassyklanan", - className: "bg-emerald-500/15 text-emerald-500 border-emerald-500/20", - }, - rejected: { - label: "Ret edilen", - className: "bg-red-500/15 text-red-500 border-red-500/20", - }, +const STATUS_CONFIG: Record = { + pending: { label: "Garaşylýar", variant: "warning", icon: AlertCircle }, + approved: { label: "Tassyklanan", variant: "success", icon: CheckCircle2 }, + rejected: { label: "Ret edilen", variant: "error", icon: XCircle }, }; -function StatusBadge({ status }: { status: CardRequisiteStatus }) { - const cfg = STATUS_BADGE[status] ?? STATUS_BADGE.pending; - return ( - {cfg.label} - ); +function CardRequisiteStatusBadge({ status }: { status: CardRequisiteStatus }) { + const cfg = STATUS_CONFIG[status]; + if (!cfg) return {status}; + return ; } // ─── Page ───────────────────────────────────────────────────────────────────── @@ -115,7 +106,7 @@ export default function CardRequisitesPage() { id: "status", accessorKey: "status", header: t("Status", "STATUS"), - cell: ({ row }) => , + cell: ({ row }) => , }, { id: "actions", diff --git a/src/pages/cardDepartment/orderNewCardView/index.tsx b/src/pages/cardDepartment/orderNewCardView/index.tsx index 3cfeac2..0a00f96 100644 --- a/src/pages/cardDepartment/orderNewCardView/index.tsx +++ b/src/pages/cardDepartment/orderNewCardView/index.tsx @@ -1,7 +1,7 @@ import { useState } from "react"; import { useParams, useNavigate, Link } from "react-router-dom"; import { useTranslation } from "react-i18next"; -import { Printer, Download, Trash2, Pencil } from "lucide-react"; +import { Printer, Download, Trash2, Pencil, AlertCircle, CheckCircle2, XCircle } from "lucide-react"; import { Button } from "@/components/ui/button"; import { AlertDialog, @@ -14,30 +14,24 @@ import { AlertDialogTitle, } from "@/components/ui/alert-dialog"; import { Skeleton } from "@/components/ui/skeleton"; -import { - useCardOrderById, - useDeleteCardOrder, -} from "@/features/orderNewCard/hooks/useOrderNewCard"; +import { useCardOrderById, useDeleteCardOrder } from "@/features/orderNewCard/hooks/useOrderNewCard"; import type { CardOrderStatus } from "@/features/orderNewCard/api/orderNewCardApi"; import { BentoGrid, BentoCard, InfoRow, PassportImage } from "@/components/viewPageComponents"; +import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadge"; // ─── Status badge ───────────────────────────────────────────────────────────── -const STATUS_STYLE: Record = { - PENDING: { icon: "⏳", className: "bg-amber-500/10 text-amber-400 border border-amber-500/20" }, - APPROVED: { icon: "✓", className: "bg-emerald-500/10 text-emerald-400 border border-emerald-500/20" }, - REJECTED: { icon: "✕", className: "bg-red-500/10 text-red-400 border border-red-500/20" }, -} +const STATUS_CONFIG: Record = { + PENDING: { label: "Garaşylýar", variant: "warning", icon: AlertCircle }, + APPROVED: { label: "Tassyklandy", variant: "success", icon: CheckCircle2 }, + REJECTED: { label: "Ýatyryldy", variant: "error", icon: XCircle }, +}; -function StatusBadge({ status }: { status: CardOrderStatus }) { - const { t } = useTranslation() - const cfg = STATUS_STYLE[status] - return ( - - {cfg.icon} - {t(`cardOrder.status.${status.toLowerCase()}`)} - - ) +function CardOrderStatusBadge({ status }: { status: CardOrderStatus }) { + const { t } = useTranslation(); + const cfg = STATUS_CONFIG[status]; + if (!cfg) return {status}; + return ; } // ─── Skeleton ───────────────────────────────────────────────────────────────── @@ -57,43 +51,36 @@ function DetailSkeleton() { ))}
- ) + ); } // ─── Page ───────────────────────────────────────────────────────────────────── export default function CardOrderDetailPage() { - const { id } = useParams<{ id: string }>() - const navigate = useNavigate() - const { t } = useTranslation() + const { id } = useParams<{ id: string }>(); + const navigate = useNavigate(); + const { t } = useTranslation(); - const [deleteOpen, setDeleteOpen] = useState(false) + const [deleteOpen, setDeleteOpen] = useState(false); - const { data: order, isLoading } = useCardOrderById(id ?? "") - const deleteMutation = useDeleteCardOrder() + const { data: order, isLoading } = useCardOrderById(id ?? ""); + const deleteMutation = useDeleteCardOrder(); const handleDelete = async () => { - if (!id) return - await deleteMutation.mutateAsync(id) - navigate("/order-new-card") - } + if (!id) return; + await deleteMutation.mutateAsync(id); + navigate("/order-new-card"); + }; - if (isLoading) return - if (!order) - return ( -

- {t("common.notFound", "Tapylmady")} -

- ) + if (isLoading) return ; + if (!order) return

{t("common.notFound", "Tapylmady")}

; return (
- {/* ── Page header ──────────────────────────────────────────────────── */}

- {t("cardOrder.detailTitle", "Kart sargyt giriş üçin")}:{" "} - {order.id} + {t("cardOrder.detailTitle", "Kart sargyt giriş üçin")}: {order.id}

@@ -125,20 +112,18 @@ export default function CardOrderDetailPage() { {order.id} - - {order.createdAt} - + {order.createdAt} - + - + {order.isPaid ? "✓" : "✕"} - - {order.note ?? "—"} - + {order.note ?? "—"} {order.createdBy} @@ -154,9 +139,7 @@ export default function CardOrderDetailPage() { - - {order.provinceName} - + {order.provinceName} {order.branchName} @@ -169,58 +152,32 @@ export default function CardOrderDetailPage() { {[order.lastName, order.firstName, order.middleName].filter(Boolean).join(" ")} - - {order.birthDate} - - - {order.citizenship} - - - {order.registeredAddress} - - - {order.currentAddress} - - - {order.workplace} - + {order.birthDate} + {order.citizenship} + {order.registeredAddress} + {order.currentAddress} + {order.workplace} - - {order.phone} - - - {order.phoneExtra ?? "—"} - + {order.phone} + {order.phoneExtra ?? "—"} {/* ── Row 3: Passport images ───────────────────────────────────────── */} - + - + - + - + @@ -228,27 +185,19 @@ export default function CardOrderDetailPage() { - - {t("cardOrder.deleteTitle", "Pozmak isleýärsiňizmi?")} - + {t("cardOrder.deleteTitle", "Pozmak isleýärsiňizmi?")} {t("cardOrder.deleteDescription", "Bu kart sargyt hemişelik pozular. Bu işi yzyna gaýtaryp bolmaz.")} {t("common.cancel", "Ýatyr")} - - {deleteMutation.isPending - ? t("common.deleting", "Pozulýar...") - : t("common.delete", "Pozmak")} + + {deleteMutation.isPending ? t("common.deleting", "Pozulýar...") : t("common.delete", "Pozmak")} -
- ) -} \ No newline at end of file + ); +} diff --git a/src/pages/dashboard/index.tsx b/src/pages/dashboard/index.tsx index 5b6cb29..18c065c 100644 --- a/src/pages/dashboard/index.tsx +++ b/src/pages/dashboard/index.tsx @@ -7,36 +7,16 @@ import { Users, DollarSign, Activity, + AlertCircle, + CheckCircle2, + XCircle, } from "lucide-react"; -import { - AreaChart, - Area, - BarChart, - Bar, - XAxis, - YAxis, - CartesianGrid, - PieChart, - Pie, - Cell, -} from "recharts"; -import { - ChartContainer, - ChartTooltip, - ChartTooltipContent, - ChartLegend, - ChartLegendContent, -} from "@/components/ui/chart"; -import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, -} from "@/components/ui/card"; -import { Badge } from "@/components/ui/badge"; +import { AreaChart, Area, BarChart, Bar, XAxis, YAxis, CartesianGrid, PieChart, Pie, Cell } from "recharts"; +import { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent } from "@/components/ui/chart"; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Skeleton } from "@/components/ui/skeleton"; import { cn } from "@/lib/utils"; +import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadge"; // ─── Mock data ──────────────────────────────────────────────────────────────── @@ -67,17 +47,17 @@ const barData = [ const pieData = [ { name: "Kanagatlandyrylan", value: 6746, key: "approved" }, - { name: "Garaşylýar", value: 208, key: "pending" }, - { name: "Işlenilýär", value: 157, key: "processing" }, - { name: "Ýatyrylan", value: 245, key: "rejected" }, - { name: "Bellige alyndy", value: 450, key: "registered" }, + { name: "Garaşylýar", value: 208, key: "pending" }, + { name: "Işlenilýär", value: 157, key: "processing" }, + { name: "Ýatyrylan", value: 245, key: "rejected" }, + { name: "Bellige alyndy", value: 450, key: "registered" }, ]; const recentActivity = [ - { id: "#KS-2841", name: "Serdar Annagurban", amount: "12 500 TMT", status: "approved", time: "2 min öň" }, - { id: "#KS-2840", name: "Aýgül Myradowa", amount: "8 000 TMT", status: "pending", time: "14 min öň" }, - { id: "#KS-2839", name: "Kakajan Durdyýew", amount: "25 000 TMT", status: "approved", time: "31 min öň" }, - { id: "#KS-2838", name: "Ogulgerek Sähedowa", amount: "5 500 TMT", status: "rejected", time: "1 sa öň" }, + { id: "#KS-2841", name: "Serdar Annagurban", amount: "12 500 TMT", status: "approved", time: "2 min öň" }, + { id: "#KS-2840", name: "Aýgül Myradowa", amount: "8 000 TMT", status: "pending", time: "14 min öň" }, + { id: "#KS-2839", name: "Kakajan Durdyýew", amount: "25 000 TMT", status: "approved", time: "31 min öň" }, + { id: "#KS-2838", name: "Ogulgerek Sähedowa", amount: "5 500 TMT", status: "rejected", time: "1 sa öň" }, { id: "#KS-2837", name: "Merdan Hojamyradow", amount: "18 000 TMT", status: "approved", time: "2 sa öň" }, ]; @@ -90,27 +70,31 @@ const areaConfig = { const barConfig = { approved: { label: "Tassyklanan", color: "var(--chart-1)" }, - rejected: { label: "Ýatyryldy", color: "var(--chart-5)" }, + rejected: { label: "Ýatyryldy", color: "var(--chart-5)" }, } satisfies Record; const pieConfig = { - approved: { label: "Kanagatlandyrylan", color: "var(--chart-2)" }, - pending: { label: "Garaşylýar", color: "var(--chart-4)" }, - processing: { label: "Işlenilýär", color: "var(--chart-1)" }, - rejected: { label: "Ýatyrylan", color: "var(--chart-5)" }, - registered: { label: "Bellige alyndy", color: "var(--chart-3)" }, + approved: { label: "Kanagatlandyrylan", color: "var(--chart-2)" }, + pending: { label: "Garaşylýar", color: "var(--chart-4)" }, + processing: { label: "Işlenilýär", color: "var(--chart-1)" }, + rejected: { label: "Ýatyrylan", color: "var(--chart-5)" }, + registered: { label: "Bellige alyndy", color: "var(--chart-3)" }, } satisfies Record; // ─── Stat card ──────────────────────────────────────────────────────────────── function StatCard({ - title, value, change, icon: Icon, accent, + title, + value, + change, + icon: Icon, + accent, }: { - title: string - value: string - change: number - icon: React.ElementType - accent: string + title: string; + value: string; + change: number; + icon: React.ElementType; + accent: string; }) { const positive = change >= 0; return ( @@ -123,10 +107,12 @@ function StatCard({

{value}

-

+

{positive ? : } {Math.abs(change)}% geçen aýa garanyňda

@@ -152,22 +138,16 @@ function StatCardSkeleton() { // ─── Status badge ───────────────────────────────────────────────────────────── -function StatusBadge({ status }: { status: string }) { - const styles: Record = { - approved: "bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400 hover:bg-emerald-100", - pending: "bg-amber-100 text-amber-700 dark:bg-amber-950 dark:text-amber-400 hover:bg-amber-100", - rejected: "bg-red-100 text-red-700 dark:bg-red-950 dark:text-red-400 hover:bg-red-100", - }; - const labels: Record = { - approved: "Tassyklandy", - pending: "Garaşylýar", - rejected: "Ýatyryldy", - }; - return ( - - {labels[status]} - - ); +const STATUS_CONFIG: Record = { + approved: { label: "Tassyklandy", variant: "success", icon: CheckCircle2 }, + pending: { label: "Garaşylýar", variant: "warning", icon: AlertCircle }, + rejected: { label: "Ýatyryldy", variant: "error", icon: XCircle }, +}; + +function DashboardStatusBadge({ status }: { status: string }) { + const cfg = STATUS_CONFIG[status]; + if (!cfg) return {status}; + return ; } // ─── Page ───────────────────────────────────────────────────────────────────── @@ -185,7 +165,9 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole
- {[...Array(4)].map((_, i) => )} + {[...Array(4)].map((_, i) => ( + + ))}
@@ -198,13 +180,17 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole
- {[...Array(5)].map((_, i) => )} + {[...Array(5)].map((_, i) => ( + + ))}
- {[...Array(12)].map((_, i) => )} + {[...Array(12)].map((_, i) => ( + + ))}
@@ -256,7 +242,9 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole
- {[...Array(4)].map((_, i) => )} + {[...Array(4)].map((_, i) => ( + + ))}
{[65, 85, 50, 95, 75, 40, 30].map((h, i) => ( @@ -267,7 +255,9 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole ))}
- {[...Array(7)].map((_, i) => )} + {[...Array(7)].map((_, i) => ( + + ))}
@@ -317,20 +307,40 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole
{/* Header */}
-

- {t("Dashboard", "Baş sahypa")} -

-

- {t("Overview of all operations", "Ähli amallaryň gysgaça görünüşi")} -

+

{t("Dashboard", "Baş sahypa")}

+

{t("Overview of all operations", "Ähli amallaryň gysgaça görünüşi")}

{/* Stat cards */}
- - - - + + + +
{/* Area chart + Pie chart */} @@ -345,11 +355,11 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole - + - + @@ -373,7 +383,17 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole - + {pieData.map((entry, i) => ( ))} @@ -388,9 +408,7 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole {d.name} - - {((d.value / total) * 100).toFixed(0)}% - + {((d.value / total) * 100).toFixed(0)}%
))}
@@ -413,7 +431,7 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole } /> - + } /> @@ -424,9 +442,7 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole
{t("Recent activity", "Soňky hereketler")} - - {t("Latest loan orders", "Iň soňky karz sargytlary")} - + {t("Latest loan orders", "Iň soňky karz sargytlary")}
@@ -442,11 +458,13 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole

{item.name}

-

{item.id} · {item.time}

+

+ {item.id} · {item.time} +

{item.amount}

- +
))} @@ -456,4 +474,4 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole
); -} \ No newline at end of file +} diff --git a/src/pages/loanDepartment/loanOrderView/index.tsx b/src/pages/loanDepartment/loanOrderView/index.tsx index fd7b281..f7f9e96 100644 --- a/src/pages/loanDepartment/loanOrderView/index.tsx +++ b/src/pages/loanDepartment/loanOrderView/index.tsx @@ -2,60 +2,36 @@ import { useState } from "react"; import { useNavigate, useParams } from "react-router-dom"; import { useTranslation } from "react-i18next"; import { Trash2, Pencil } from "lucide-react"; -import { - useLoanOrderById, - useDeleteLoanOrder, -} from "@/features/loanOrders/hooks/useLoanOrders"; +import { useLoanOrderById, useDeleteLoanOrder } from "@/features/loanOrders/hooks/useLoanOrders"; import { Skeleton } from "@/components/ui/skeleton"; -import { - StatusBadge, - type StatusBadgeVariant, -} from "@/components/ui/statusBadge"; +import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadge"; import { AlertCircle, CheckCircle2, XCircle } from "lucide-react"; -import type { LoanOrderMobileStatus } from "@/features/loanOrderMobiles/api/loanOrderMobilesApi"; -import { - BentoGrid, - BentoCard, - InfoRow, - PassportImage, - AuditLog, - type AuditRowProps, -} from "@/components/viewPageComponents"; +import type { LoanOrderStatus } from "@/features/loanOrders/api/loanOrdersApi"; +import { BentoGrid, BentoCard, InfoRow, PassportImage, AuditLog, type AuditRowProps } from "@/components/viewPageComponents"; import { ConfirmDialog } from "@/components/confirmDialog"; // ─── Status config ──────────────────────────────────────────────────────────── -const STATUS_VARIANT: Record = { +const STATUS_VARIANT: Record = { GARAŞYLÝAR: "warning", KANAGATLANDYRYLAN: "success", RED_EDILDI: "error", IŞLENÝÄR: "warning", }; -const STATUS_ICON: Record = { +const STATUS_ICON: Record = { GARAŞYLÝAR: AlertCircle, KANAGATLANDYRYLAN: CheckCircle2, RED_EDILDI: XCircle, IŞLENÝÄR: AlertCircle, }; -function LoanOrderMobileStatusBadge({ - status, -}: { - status: LoanOrderMobileStatus; -}) { +function LoanOrderMobileStatusBadge({ status }: { status: LoanOrderStatus }) { const { t } = useTranslation(); const variant = STATUS_VARIANT[status]; const Icon = STATUS_ICON[status]; - if (!variant) - return {status}; - return ( - - ); + if (!variant) return {status}; + return ; } // ─── Skeleton ───────────────────────────────────────────────────────────────── @@ -66,10 +42,7 @@ function LoanOrderViewSkeleton() {
{[...Array(6)].map((_, i) => ( -
+
{[...Array(3)].map((_, j) => ( @@ -105,11 +78,7 @@ export default function LoanOrderViewPage() { if (isLoading) return ; if (!order) { - return ( -
- {t("common.notFound", "Tapylmady")} -
- ); + return
{t("common.notFound", "Tapylmady")}
; } const auditLogs: AuditRowProps[] = [ @@ -154,31 +123,17 @@ export default function LoanOrderViewPage() { {/* Meta */} - + - - + + {/* Loan */} - + - - + + {/* ── Row 2: Personal + Contacts ──────────────────────────────────── */} {/* Personal */} - - - - - - - + + + + + + + {/* Contacts */} - - - - + + + + @@ -262,58 +172,21 @@ export default function LoanOrderViewPage() { {/* Employment */} - - - - - - - + + + + + + + {/* Passport info */} + + - - @@ -322,35 +195,20 @@ export default function LoanOrderViewPage() { {/* ── Row 4: Passport images ───────────────────────────────────────── */} - + - +