refactored badge
This commit is contained in:
1 parent
26057e1fac
commit
2ba061b76c
5 files changed
+245
-499
No files matched your search
@@ -3,16 +3,11 @@ import { Download, Eye, ChevronDown, Inbox } from "lucide-react";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { DataTable, type ColumnDef } from "@/components/dataTable";
|
import { DataTable, type ColumnDef } from "@/components/dataTable";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
// ─── BentoGrid ────────────────────────────────────────────────────────────────
|
// ─── BentoGrid ────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
export function BentoGrid({
|
export function BentoGrid({ cols = 2, children }: { cols?: 1 | 2 | 3 | 4; children: React.ReactNode }) {
|
||||||
cols = 2,
|
|
||||||
children,
|
|
||||||
}: {
|
|
||||||
cols?: 1 | 2 | 3 | 4;
|
|
||||||
children: React.ReactNode;
|
|
||||||
}) {
|
|
||||||
const colClass = {
|
const colClass = {
|
||||||
1: "grid-cols-1",
|
1: "grid-cols-1",
|
||||||
2: "grid-cols-1 sm:grid-cols-2",
|
2: "grid-cols-1 sm:grid-cols-2",
|
||||||
@@ -31,30 +26,14 @@ interface BentoCardProps {
|
|||||||
noPadding?: boolean;
|
noPadding?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function BentoCard({
|
export function BentoCard({ title, span, children, noPadding }: BentoCardProps) {
|
||||||
title,
|
const spanClass = span === "full" ? "sm:col-span-full" : span === 2 ? "sm:col-span-2" : span === 3 ? "sm:col-span-3" : "";
|
||||||
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 (
|
return (
|
||||||
<div
|
<div className={`bg-card border border-border rounded-xl overflow-hidden min-w-0 ${spanClass}`}>
|
||||||
className={`bg-card border border-border rounded-xl overflow-hidden min-w-0 ${spanClass}`}
|
|
||||||
>
|
|
||||||
{title && (
|
{title && (
|
||||||
<div className="px-4 py-2.5 border-b border-border">
|
<div className="px-4 py-2.5 border-b border-border">
|
||||||
<p className="text-xs font-semibold text-muted-foreground uppercase tracking-wide truncate">
|
<p className="text-xs font-semibold text-muted-foreground uppercase tracking-wide truncate">{title}</p>
|
||||||
{title}
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{noPadding ? <div>{children}</div> : children}
|
{noPadding ? <div>{children}</div> : children}
|
||||||
@@ -69,23 +48,24 @@ export interface InfoRowProps {
|
|||||||
value?: string | number | null;
|
value?: string | number | null;
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
isLink?: boolean;
|
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);
|
const content = children ?? (value != null ? String(value) : null);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col sm:grid sm:grid-cols-[minmax(0,42%)_minmax(0,58%)] items-start sm:items-center py-2.5 px-4 border-b border-border last:border-0 gap-0.5 sm:gap-0">
|
<div className="flex flex-col sm:grid sm:grid-cols-[minmax(0,42%)_minmax(0,58%)] items-start sm:items-center py-2.5 px-4 border-b border-border last:border-0 gap-0.5 sm:gap-0">
|
||||||
<span className="text-xs sm:text-sm text-muted-foreground leading-snug">
|
<span className="text-xs sm:text-sm text-muted-foreground leading-snug">{label}</span>
|
||||||
{label}
|
|
||||||
</span>
|
|
||||||
{content != null && content !== "" ? (
|
{content != null && content !== "" ? (
|
||||||
typeof content === "string" ? (
|
typeof content === "string" ? (
|
||||||
<span
|
isLink && href ? (
|
||||||
className={`text-sm break-words min-w-0 ${isLink ? "text-primary font-medium" : "text-foreground"}`}
|
<Link to={href} className="text-sm break-words min-w-0 text-[#2bbae6] font-medium cursor-pointer hover:underline">
|
||||||
>
|
{content}
|
||||||
{content}
|
</Link>
|
||||||
</span>
|
) : (
|
||||||
|
<span className={`text-sm break-words min-w-0 ${isLink ? "text-primary font-medium" : "text-foreground"}`}>{content}</span>
|
||||||
|
)
|
||||||
) : (
|
) : (
|
||||||
<div className="text-sm min-w-0">{content}</div>
|
<div className="text-sm min-w-0">{content}</div>
|
||||||
)
|
)
|
||||||
@@ -116,9 +96,7 @@ export function MultiLangRow({ label, value }: MultiLangRowProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col sm:grid sm:grid-cols-[minmax(0,42%)_minmax(0,58%)] items-start py-2.5 px-4 border-b border-border last:border-0 gap-1 sm:gap-0">
|
<div className="flex flex-col sm:grid sm:grid-cols-[minmax(0,42%)_minmax(0,58%)] items-start py-2.5 px-4 border-b border-border last:border-0 gap-1 sm:gap-0">
|
||||||
<span className="text-xs sm:text-sm text-muted-foreground leading-snug pt-1">
|
<span className="text-xs sm:text-sm text-muted-foreground leading-snug pt-1">{label}</span>
|
||||||
{label}
|
|
||||||
</span>
|
|
||||||
<div className="w-full min-w-0 flex flex-col gap-1.5 py-0.5">
|
<div className="w-full min-w-0 flex flex-col gap-1.5 py-0.5">
|
||||||
{langs.map((l) =>
|
{langs.map((l) =>
|
||||||
l.val ? (
|
l.val ? (
|
||||||
@@ -126,9 +104,7 @@ export function MultiLangRow({ label, value }: MultiLangRowProps) {
|
|||||||
<span className="inline-flex items-center justify-center border border-border bg-muted/50 text-muted-foreground text-[9px] font-bold px-1.5 py-0.5 rounded min-w-[22px] mt-0.5 select-none">
|
<span className="inline-flex items-center justify-center border border-border bg-muted/50 text-muted-foreground text-[9px] font-bold px-1.5 py-0.5 rounded min-w-[22px] mt-0.5 select-none">
|
||||||
{l.code}
|
{l.code}
|
||||||
</span>
|
</span>
|
||||||
<span className="text-sm text-foreground break-words flex-1 min-w-0">
|
<span className="text-sm text-foreground break-words flex-1 min-w-0">{l.val}</span>
|
||||||
{l.val}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
) : null,
|
) : null,
|
||||||
)}
|
)}
|
||||||
@@ -148,14 +124,8 @@ export interface SectionProps {
|
|||||||
export function Section({ title, children }: SectionProps) {
|
export function Section({ title, children }: SectionProps) {
|
||||||
return (
|
return (
|
||||||
<div className="mb-6">
|
<div className="mb-6">
|
||||||
{title ? (
|
{title ? <h2 className="text-base font-semibold text-foreground mb-2">{title}</h2> : null}
|
||||||
<h2 className="text-base font-semibold text-foreground mb-2">
|
<div className="bg-card border border-border rounded-xl overflow-hidden">{children}</div>
|
||||||
{title}
|
|
||||||
</h2>
|
|
||||||
) : null}
|
|
||||||
<div className="bg-card border border-border rounded-xl overflow-hidden">
|
|
||||||
{children}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -172,21 +142,11 @@ export function CollapsibleSection({ title, children }: CollapsibleSectionProps)
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div
|
<div className="flex items-center gap-2 mb-2 cursor-pointer select-none w-fit" onClick={() => setOpen((v) => !v)}>
|
||||||
className="flex items-center gap-2 mb-2 cursor-pointer select-none w-fit"
|
|
||||||
onClick={() => setOpen((v) => !v)}
|
|
||||||
>
|
|
||||||
<h2 className="text-base font-semibold text-foreground">{title}</h2>
|
<h2 className="text-base font-semibold text-foreground">{title}</h2>
|
||||||
<ChevronDown
|
<ChevronDown size={15} className={`text-muted-foreground transition-transform duration-200 ${open ? "" : "-rotate-90"}`} />
|
||||||
size={15}
|
|
||||||
className={`text-muted-foreground transition-transform duration-200 ${open ? "" : "-rotate-90"}`}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
{open && (
|
{open && <div className="bg-card border border-border rounded-xl overflow-hidden p-4 space-y-3">{children}</div>}
|
||||||
<div className="bg-card border border-border rounded-xl overflow-hidden p-4 space-y-3">
|
|
||||||
{children}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -208,11 +168,7 @@ export function PassportImage({ label, src, url }: PassportImageProps) {
|
|||||||
<span className="text-xs sm:text-sm text-muted-foreground">{label}</span>
|
<span className="text-xs sm:text-sm text-muted-foreground">{label}</span>
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
{imageSrc ? (
|
{imageSrc ? (
|
||||||
<img
|
<img src={imageSrc} alt={label} className="w-28 h-20 object-cover rounded-md border border-border" />
|
||||||
src={imageSrc}
|
|
||||||
alt={label}
|
|
||||||
className="w-28 h-20 object-cover rounded-md border border-border"
|
|
||||||
/>
|
|
||||||
) : (
|
) : (
|
||||||
<div className="w-28 h-20 bg-muted rounded-md border border-border flex items-center justify-center">
|
<div className="w-28 h-20 bg-muted rounded-md border border-border flex items-center justify-center">
|
||||||
<span className="text-xs text-muted-foreground">—</span>
|
<span className="text-xs text-muted-foreground">—</span>
|
||||||
@@ -264,9 +220,7 @@ export function StatusBadge({ status }: { status: string }) {
|
|||||||
|
|
||||||
// ─── useAuditColumns ──────────────────────────────────────────────────────────
|
// ─── useAuditColumns ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
export function useAuditColumns(
|
export function useAuditColumns(onView?: (log: AuditRowProps) => void): ColumnDef<AuditRowProps>[] {
|
||||||
onView?: (log: AuditRowProps) => void,
|
|
||||||
): ColumnDef<AuditRowProps>[] {
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return useMemo(
|
return useMemo(
|
||||||
@@ -274,35 +228,23 @@ export function useAuditColumns(
|
|||||||
{
|
{
|
||||||
accessorKey: "id",
|
accessorKey: "id",
|
||||||
header: t("audit.columns.id", "ID"),
|
header: t("audit.columns.id", "ID"),
|
||||||
cell: ({ row }) => (
|
cell: ({ row }) => <span className="text-xs font-mono text-muted-foreground">{row.original.id}</span>,
|
||||||
<span className="text-xs font-mono text-muted-foreground">
|
|
||||||
{row.original.id}
|
|
||||||
</span>
|
|
||||||
),
|
|
||||||
size: 130,
|
size: 130,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "action",
|
accessorKey: "action",
|
||||||
header: t("audit.columns.action", "AMALYŇ ADY"),
|
header: t("audit.columns.action", "AMALYŇ ADY"),
|
||||||
cell: ({ row }) => (
|
cell: ({ row }) => <span className="text-sm font-medium text-primary">{row.original.action}</span>,
|
||||||
<span className="text-sm font-medium text-primary">
|
|
||||||
{row.original.action}
|
|
||||||
</span>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "by",
|
accessorKey: "by",
|
||||||
header: t("audit.columns.by", "KIM TARAPYNDAN"),
|
header: t("audit.columns.by", "KIM TARAPYNDAN"),
|
||||||
cell: ({ row }) => (
|
cell: ({ row }) => <span className="text-sm text-foreground">{row.original.by}</span>,
|
||||||
<span className="text-sm text-foreground">{row.original.by}</span>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "target",
|
accessorKey: "target",
|
||||||
header: t("audit.columns.target", "AMALYŇ NYŞANY"),
|
header: t("audit.columns.target", "AMALYŇ NYŞANY"),
|
||||||
cell: ({ row }) => (
|
cell: ({ row }) => <span className="text-sm text-foreground">{row.original.target}</span>,
|
||||||
<span className="text-sm text-foreground">{row.original.target}</span>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "status",
|
accessorKey: "status",
|
||||||
@@ -313,11 +255,7 @@ export function useAuditColumns(
|
|||||||
{
|
{
|
||||||
accessorKey: "date",
|
accessorKey: "date",
|
||||||
header: t("audit.columns.date", "SENE"),
|
header: t("audit.columns.date", "SENE"),
|
||||||
cell: ({ row }) => (
|
cell: ({ row }) => <span className="text-sm text-foreground whitespace-nowrap">{row.original.date}</span>,
|
||||||
<span className="text-sm text-foreground whitespace-nowrap">
|
|
||||||
{row.original.date}
|
|
||||||
</span>
|
|
||||||
),
|
|
||||||
size: 160,
|
size: 160,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -374,15 +312,7 @@ export function EmptyState({ label }: EmptyStateProps) {
|
|||||||
|
|
||||||
// ─── AuditLog ─────────────────────────────────────────────────────────────────
|
// ─── AuditLog ─────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
export function AuditLog({
|
export function AuditLog({ logs, currentPage, totalPages, totalCount, onPageChange, isLoading, onView }: AuditLogProps) {
|
||||||
logs,
|
|
||||||
currentPage,
|
|
||||||
totalPages,
|
|
||||||
totalCount,
|
|
||||||
onPageChange,
|
|
||||||
isLoading,
|
|
||||||
onView,
|
|
||||||
}: AuditLogProps) {
|
|
||||||
const columns = useAuditColumns(onView);
|
const columns = useAuditColumns(onView);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Download } from "lucide-react";
|
import { Download, AlertCircle, CheckCircle2, XCircle } from "lucide-react";
|
||||||
import { DeleteDialog } from "@/components/deleteDialog";
|
import { DeleteDialog } from "@/components/deleteDialog";
|
||||||
import { DataTable, type ColumnDef } from "@/components/dataTable";
|
import { DataTable, type ColumnDef } from "@/components/dataTable";
|
||||||
import { DataTableToolbar, type ColumnMeta } from "@/components/dataTableToolbar";
|
import { DataTableToolbar, type ColumnMeta } from "@/components/dataTableToolbar";
|
||||||
@@ -11,29 +11,20 @@ import { TableActions } from "@/components/tableActions";
|
|||||||
import type { VisibilityState } from "@tanstack/react-table";
|
import type { VisibilityState } from "@tanstack/react-table";
|
||||||
import { useCardRequisites, useDeleteCardRequisite, useDownloadCardRequisite } from "@/features/cardRequisites/hooks/useCardRequisites";
|
import { useCardRequisites, useDeleteCardRequisite, useDownloadCardRequisite } from "@/features/cardRequisites/hooks/useCardRequisites";
|
||||||
import type { CardRequisite, CardRequisiteStatus } from "@/features/cardRequisites/api/cardRequisitesApi";
|
import type { CardRequisite, CardRequisiteStatus } from "@/features/cardRequisites/api/cardRequisitesApi";
|
||||||
|
import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadge";
|
||||||
|
|
||||||
// ─── Status badge ─────────────────────────────────────────────────────────────
|
// ─── Status badge ─────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
const STATUS_BADGE: Record<CardRequisiteStatus, { label: string; className: string }> = {
|
const STATUS_CONFIG: Record<CardRequisiteStatus, { label: string; variant: StatusBadgeVariant; icon: React.ElementType }> = {
|
||||||
pending: {
|
pending: { label: "Garaşylýar", variant: "warning", icon: AlertCircle },
|
||||||
label: "Garaşylýar",
|
approved: { label: "Tassyklanan", variant: "success", icon: CheckCircle2 },
|
||||||
className: "bg-yellow-500/15 text-yellow-500 border-yellow-500/20",
|
rejected: { label: "Ret edilen", variant: "error", icon: XCircle },
|
||||||
},
|
|
||||||
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",
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function StatusBadge({ status }: { status: CardRequisiteStatus }) {
|
function CardRequisiteStatusBadge({ status }: { status: CardRequisiteStatus }) {
|
||||||
const cfg = STATUS_BADGE[status] ?? STATUS_BADGE.pending;
|
const cfg = STATUS_CONFIG[status];
|
||||||
return (
|
if (!cfg) return <span className="text-xs text-muted-foreground">{status}</span>;
|
||||||
<span className={`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium border ${cfg.className}`}>{cfg.label}</span>
|
return <StatusBadge label={cfg.label} variant={cfg.variant} icon={cfg.icon} />;
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Page ─────────────────────────────────────────────────────────────────────
|
// ─── Page ─────────────────────────────────────────────────────────────────────
|
||||||
@@ -115,7 +106,7 @@ export default function CardRequisitesPage() {
|
|||||||
id: "status",
|
id: "status",
|
||||||
accessorKey: "status",
|
accessorKey: "status",
|
||||||
header: t("Status", "STATUS"),
|
header: t("Status", "STATUS"),
|
||||||
cell: ({ row }) => <StatusBadge status={row.original.status} />,
|
cell: ({ row }) => <CardRequisiteStatusBadge status={row.original.status} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "actions",
|
id: "actions",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useParams, useNavigate, Link } from "react-router-dom";
|
import { useParams, useNavigate, Link } from "react-router-dom";
|
||||||
import { useTranslation } from "react-i18next";
|
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 { Button } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
AlertDialog,
|
AlertDialog,
|
||||||
@@ -14,30 +14,24 @@ import {
|
|||||||
AlertDialogTitle,
|
AlertDialogTitle,
|
||||||
} from "@/components/ui/alert-dialog";
|
} from "@/components/ui/alert-dialog";
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import {
|
import { useCardOrderById, useDeleteCardOrder } from "@/features/orderNewCard/hooks/useOrderNewCard";
|
||||||
useCardOrderById,
|
|
||||||
useDeleteCardOrder,
|
|
||||||
} from "@/features/orderNewCard/hooks/useOrderNewCard";
|
|
||||||
import type { CardOrderStatus } from "@/features/orderNewCard/api/orderNewCardApi";
|
import type { CardOrderStatus } from "@/features/orderNewCard/api/orderNewCardApi";
|
||||||
import { BentoGrid, BentoCard, InfoRow, PassportImage } from "@/components/viewPageComponents";
|
import { BentoGrid, BentoCard, InfoRow, PassportImage } from "@/components/viewPageComponents";
|
||||||
|
import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadge";
|
||||||
|
|
||||||
// ─── Status badge ─────────────────────────────────────────────────────────────
|
// ─── Status badge ─────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
const STATUS_STYLE: Record<CardOrderStatus, { className: string; icon: string }> = {
|
const STATUS_CONFIG: Record<CardOrderStatus, { label: string; variant: StatusBadgeVariant; icon: React.ElementType }> = {
|
||||||
PENDING: { icon: "⏳", className: "bg-amber-500/10 text-amber-400 border border-amber-500/20" },
|
PENDING: { label: "Garaşylýar", variant: "warning", icon: AlertCircle },
|
||||||
APPROVED: { icon: "✓", className: "bg-emerald-500/10 text-emerald-400 border border-emerald-500/20" },
|
APPROVED: { label: "Tassyklandy", variant: "success", icon: CheckCircle2 },
|
||||||
REJECTED: { icon: "✕", className: "bg-red-500/10 text-red-400 border border-red-500/20" },
|
REJECTED: { label: "Ýatyryldy", variant: "error", icon: XCircle },
|
||||||
}
|
};
|
||||||
|
|
||||||
function StatusBadge({ status }: { status: CardOrderStatus }) {
|
function CardOrderStatusBadge({ status }: { status: CardOrderStatus }) {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation();
|
||||||
const cfg = STATUS_STYLE[status]
|
const cfg = STATUS_CONFIG[status];
|
||||||
return (
|
if (!cfg) return <span className="text-xs text-muted-foreground">{status}</span>;
|
||||||
<span className={`inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-[11px] font-bold tracking-wide ${cfg.className}`}>
|
return <StatusBadge label={t(`cardOrder.status.${status.toLowerCase()}`)} variant={cfg.variant} icon={cfg.icon} />;
|
||||||
<span className="text-[10px]">{cfg.icon}</span>
|
|
||||||
{t(`cardOrder.status.${status.toLowerCase()}`)}
|
|
||||||
</span>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Skeleton ─────────────────────────────────────────────────────────────────
|
// ─── Skeleton ─────────────────────────────────────────────────────────────────
|
||||||
@@ -57,43 +51,36 @@ function DetailSkeleton() {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Page ─────────────────────────────────────────────────────────────────────
|
// ─── Page ─────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
export default function CardOrderDetailPage() {
|
export default function CardOrderDetailPage() {
|
||||||
const { id } = useParams<{ id: string }>()
|
const { id } = useParams<{ id: string }>();
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate();
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const [deleteOpen, setDeleteOpen] = useState(false)
|
const [deleteOpen, setDeleteOpen] = useState(false);
|
||||||
|
|
||||||
const { data: order, isLoading } = useCardOrderById(id ?? "")
|
const { data: order, isLoading } = useCardOrderById(id ?? "");
|
||||||
const deleteMutation = useDeleteCardOrder()
|
const deleteMutation = useDeleteCardOrder();
|
||||||
|
|
||||||
const handleDelete = async () => {
|
const handleDelete = async () => {
|
||||||
if (!id) return
|
if (!id) return;
|
||||||
await deleteMutation.mutateAsync(id)
|
await deleteMutation.mutateAsync(id);
|
||||||
navigate("/order-new-card")
|
navigate("/order-new-card");
|
||||||
}
|
};
|
||||||
|
|
||||||
if (isLoading) return <DetailSkeleton />
|
if (isLoading) return <DetailSkeleton />;
|
||||||
if (!order)
|
if (!order) return <p className="text-muted-foreground text-sm">{t("common.notFound", "Tapylmady")}</p>;
|
||||||
return (
|
|
||||||
<p className="text-muted-foreground text-sm">
|
|
||||||
{t("common.notFound", "Tapylmady")}
|
|
||||||
</p>
|
|
||||||
)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-6">
|
<div className="flex flex-col gap-6">
|
||||||
|
|
||||||
{/* ── Page header ──────────────────────────────────────────────────── */}
|
{/* ── Page header ──────────────────────────────────────────────────── */}
|
||||||
<div className="flex items-start justify-between gap-4">
|
<div className="flex items-start justify-between gap-4">
|
||||||
<h1 className="text-xl font-semibold text-foreground">
|
<h1 className="text-xl font-semibold text-foreground">
|
||||||
{t("cardOrder.detailTitle", "Kart sargyt giriş üçin")}:{" "}
|
{t("cardOrder.detailTitle", "Kart sargyt giriş üçin")}: <span className="text-primary font-mono">{order.id}</span>
|
||||||
<span className="text-primary font-mono">{order.id}</span>
|
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<div className="flex items-center gap-2 shrink-0">
|
<div className="flex items-center gap-2 shrink-0">
|
||||||
@@ -125,20 +112,18 @@ export default function CardOrderDetailPage() {
|
|||||||
<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")}>{order.id}</InfoRow>
|
||||||
<InfoRow label={t("cardOrder.field.createdAt", "Döredilen wagty")}>
|
<InfoRow label={t("cardOrder.field.createdAt", "Döredilen wagty")}>{order.createdAt}</InfoRow>
|
||||||
{order.createdAt}
|
|
||||||
</InfoRow>
|
|
||||||
<InfoRow label={t("cardOrder.field.status", "Status")}>
|
<InfoRow label={t("cardOrder.field.status", "Status")}>
|
||||||
<StatusBadge status={order.status} />
|
<CardOrderStatusBadge status={order.status} />
|
||||||
</InfoRow>
|
</InfoRow>
|
||||||
<InfoRow label={t("cardOrder.field.isPaid", "Tölenen")}>
|
<InfoRow label={t("cardOrder.field.isPaid", "Tölenen")}>
|
||||||
<span className={`inline-flex items-center justify-center w-5 h-5 rounded-full text-xs font-bold ${order.isPaid ? "bg-emerald-500/15 text-emerald-400" : "bg-red-500/15 text-red-400"}`}>
|
<span
|
||||||
|
className={`inline-flex items-center justify-center w-5 h-5 rounded-full text-xs font-bold ${order.isPaid ? "bg-emerald-500/15 text-emerald-400" : "bg-red-500/15 text-red-400"}`}
|
||||||
|
>
|
||||||
{order.isPaid ? "✓" : "✕"}
|
{order.isPaid ? "✓" : "✕"}
|
||||||
</span>
|
</span>
|
||||||
</InfoRow>
|
</InfoRow>
|
||||||
<InfoRow label={t("cardOrder.field.note", "Bellik")}>
|
<InfoRow label={t("cardOrder.field.note", "Bellik")}>{order.note ?? "—"}</InfoRow>
|
||||||
{order.note ?? "—"}
|
|
||||||
</InfoRow>
|
|
||||||
<InfoRow label={t("cardOrder.field.createdBy", "Sargyt eden")}>
|
<InfoRow label={t("cardOrder.field.createdBy", "Sargyt eden")}>
|
||||||
<span className="text-primary font-medium">{order.createdBy}</span>
|
<span className="text-primary font-medium">{order.createdBy}</span>
|
||||||
</InfoRow>
|
</InfoRow>
|
||||||
@@ -154,9 +139,7 @@ export default function CardOrderDetailPage() {
|
|||||||
</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")}>
|
<InfoRow label={t("cardOrder.field.province", "Welaýat")}>{order.provinceName}</InfoRow>
|
||||||
{order.provinceName}
|
|
||||||
</InfoRow>
|
|
||||||
<InfoRow label={t("cardOrder.field.branch", "Şahamça")}>
|
<InfoRow label={t("cardOrder.field.branch", "Şahamça")}>
|
||||||
<span className="text-cyan-400 font-medium">{order.branchName}</span>
|
<span className="text-cyan-400 font-medium">{order.branchName}</span>
|
||||||
</InfoRow>
|
</InfoRow>
|
||||||
@@ -169,58 +152,32 @@ export default function CardOrderDetailPage() {
|
|||||||
<InfoRow label={t("cardOrder.field.fullName", "Doly ady")}>
|
<InfoRow label={t("cardOrder.field.fullName", "Doly ady")}>
|
||||||
{[order.lastName, order.firstName, order.middleName].filter(Boolean).join(" ")}
|
{[order.lastName, order.firstName, order.middleName].filter(Boolean).join(" ")}
|
||||||
</InfoRow>
|
</InfoRow>
|
||||||
<InfoRow label={t("cardOrder.field.birthDate", "Doglan güni")}>
|
<InfoRow label={t("cardOrder.field.birthDate", "Doglan güni")}>{order.birthDate}</InfoRow>
|
||||||
{order.birthDate}
|
<InfoRow label={t("cardOrder.field.citizenship", "Raýatlyk")}>{order.citizenship}</InfoRow>
|
||||||
</InfoRow>
|
<InfoRow label={t("cardOrder.field.registeredAddress", "Ýazgy edilen salgy")}>{order.registeredAddress}</InfoRow>
|
||||||
<InfoRow label={t("cardOrder.field.citizenship", "Raýatlyk")}>
|
<InfoRow label={t("cardOrder.field.currentAddress", "Häzirki ýaşaýyş ýeri")}>{order.currentAddress}</InfoRow>
|
||||||
{order.citizenship}
|
<InfoRow label={t("cardOrder.field.workplace", "Işleýän ýeri we wezipesi")}>{order.workplace}</InfoRow>
|
||||||
</InfoRow>
|
|
||||||
<InfoRow label={t("cardOrder.field.registeredAddress", "Ýazgy edilen salgy")}>
|
|
||||||
{order.registeredAddress}
|
|
||||||
</InfoRow>
|
|
||||||
<InfoRow label={t("cardOrder.field.currentAddress", "Häzirki ýaşaýyş ýeri")}>
|
|
||||||
{order.currentAddress}
|
|
||||||
</InfoRow>
|
|
||||||
<InfoRow label={t("cardOrder.field.workplace", "Işleýän ýeri we wezipesi")}>
|
|
||||||
{order.workplace}
|
|
||||||
</InfoRow>
|
|
||||||
</BentoCard>
|
</BentoCard>
|
||||||
|
|
||||||
<BentoCard title={t("cardOrder.section.contacts", "Kontakt")}>
|
<BentoCard title={t("cardOrder.section.contacts", "Kontakt")}>
|
||||||
<InfoRow label={t("cardOrder.field.phone", "Telefon")}>
|
<InfoRow label={t("cardOrder.field.phone", "Telefon")}>{order.phone}</InfoRow>
|
||||||
{order.phone}
|
<InfoRow label={t("cardOrder.field.phoneExtra", "Telefon goşmaça")}>{order.phoneExtra ?? "—"}</InfoRow>
|
||||||
</InfoRow>
|
|
||||||
<InfoRow label={t("cardOrder.field.phoneExtra", "Telefon goşmaça")}>
|
|
||||||
{order.phoneExtra ?? "—"}
|
|
||||||
</InfoRow>
|
|
||||||
</BentoCard>
|
</BentoCard>
|
||||||
</BentoGrid>
|
</BentoGrid>
|
||||||
|
|
||||||
{/* ── Row 3: Passport images ───────────────────────────────────────── */}
|
{/* ── Row 3: Passport images ───────────────────────────────────────── */}
|
||||||
<BentoGrid cols={4}>
|
<BentoGrid cols={4}>
|
||||||
<BentoCard title={t("cardOrder.field.passportPage1", "Sahypa 1")}>
|
<BentoCard title={t("cardOrder.field.passportPage1", "Sahypa 1")}>
|
||||||
<PassportImage
|
<PassportImage label={t("cardOrder.field.passportPage1", "Pasport (sahypa 1)")} url={order.passportFiles.page1} />
|
||||||
label={t("cardOrder.field.passportPage1", "Pasport (sahypa 1)")}
|
|
||||||
url={order.passportFiles.page1}
|
|
||||||
/>
|
|
||||||
</BentoCard>
|
</BentoCard>
|
||||||
<BentoCard title={t("cardOrder.field.passportPage23", "Sahypa 2-3")}>
|
<BentoCard title={t("cardOrder.field.passportPage23", "Sahypa 2-3")}>
|
||||||
<PassportImage
|
<PassportImage label={t("cardOrder.field.passportPage23", "Pasport (2-3-nji sahypa)")} url={order.passportFiles.page23} />
|
||||||
label={t("cardOrder.field.passportPage23", "Pasport (2-3-nji sahypa)")}
|
|
||||||
url={order.passportFiles.page23}
|
|
||||||
/>
|
|
||||||
</BentoCard>
|
</BentoCard>
|
||||||
<BentoCard title={t("cardOrder.field.passportPage89", "Sahypa 8-9")}>
|
<BentoCard title={t("cardOrder.field.passportPage89", "Sahypa 8-9")}>
|
||||||
<PassportImage
|
<PassportImage label={t("cardOrder.field.passportPage89", "Pasport (8-9 sahypa)")} url={order.passportFiles.page89} />
|
||||||
label={t("cardOrder.field.passportPage89", "Pasport (8-9 sahypa)")}
|
|
||||||
url={order.passportFiles.page89}
|
|
||||||
/>
|
|
||||||
</BentoCard>
|
</BentoCard>
|
||||||
<BentoCard title={t("cardOrder.field.passportPage32", "Sahypa 32")}>
|
<BentoCard title={t("cardOrder.field.passportPage32", "Sahypa 32")}>
|
||||||
<PassportImage
|
<PassportImage label={t("cardOrder.field.passportPage32", "Pasport (32-nji sahypa)")} url={order.passportFiles.page32} />
|
||||||
label={t("cardOrder.field.passportPage32", "Pasport (32-nji sahypa)")}
|
|
||||||
url={order.passportFiles.page32}
|
|
||||||
/>
|
|
||||||
</BentoCard>
|
</BentoCard>
|
||||||
</BentoGrid>
|
</BentoGrid>
|
||||||
|
|
||||||
@@ -228,27 +185,19 @@ export default function CardOrderDetailPage() {
|
|||||||
<AlertDialog open={deleteOpen} onOpenChange={setDeleteOpen}>
|
<AlertDialog open={deleteOpen} onOpenChange={setDeleteOpen}>
|
||||||
<AlertDialogContent>
|
<AlertDialogContent>
|
||||||
<AlertDialogHeader>
|
<AlertDialogHeader>
|
||||||
<AlertDialogTitle>
|
<AlertDialogTitle>{t("cardOrder.deleteTitle", "Pozmak isleýärsiňizmi?")}</AlertDialogTitle>
|
||||||
{t("cardOrder.deleteTitle", "Pozmak isleýärsiňizmi?")}
|
|
||||||
</AlertDialogTitle>
|
|
||||||
<AlertDialogDescription>
|
<AlertDialogDescription>
|
||||||
{t("cardOrder.deleteDescription", "Bu kart sargyt hemişelik pozular. Bu işi yzyna gaýtaryp bolmaz.")}
|
{t("cardOrder.deleteDescription", "Bu kart sargyt hemişelik pozular. Bu işi yzyna gaýtaryp bolmaz.")}
|
||||||
</AlertDialogDescription>
|
</AlertDialogDescription>
|
||||||
</AlertDialogHeader>
|
</AlertDialogHeader>
|
||||||
<AlertDialogFooter>
|
<AlertDialogFooter>
|
||||||
<AlertDialogCancel>{t("common.cancel", "Ýatyr")}</AlertDialogCancel>
|
<AlertDialogCancel>{t("common.cancel", "Ýatyr")}</AlertDialogCancel>
|
||||||
<AlertDialogAction
|
<AlertDialogAction onClick={handleDelete} className="bg-destructive text-destructive-foreground hover:bg-destructive/90">
|
||||||
onClick={handleDelete}
|
{deleteMutation.isPending ? t("common.deleting", "Pozulýar...") : t("common.delete", "Pozmak")}
|
||||||
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
|
|
||||||
>
|
|
||||||
{deleteMutation.isPending
|
|
||||||
? t("common.deleting", "Pozulýar...")
|
|
||||||
: t("common.delete", "Pozmak")}
|
|
||||||
</AlertDialogAction>
|
</AlertDialogAction>
|
||||||
</AlertDialogFooter>
|
</AlertDialogFooter>
|
||||||
</AlertDialogContent>
|
</AlertDialogContent>
|
||||||
</AlertDialog>
|
</AlertDialog>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
+112
-94
@@ -7,36 +7,16 @@ import {
|
|||||||
Users,
|
Users,
|
||||||
DollarSign,
|
DollarSign,
|
||||||
Activity,
|
Activity,
|
||||||
|
AlertCircle,
|
||||||
|
CheckCircle2,
|
||||||
|
XCircle,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import {
|
import { AreaChart, Area, BarChart, Bar, XAxis, YAxis, CartesianGrid, PieChart, Pie, Cell } from "recharts";
|
||||||
AreaChart,
|
import { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent } from "@/components/ui/chart";
|
||||||
Area,
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||||
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 { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadge";
|
||||||
|
|
||||||
// ─── Mock data ────────────────────────────────────────────────────────────────
|
// ─── Mock data ────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -67,17 +47,17 @@ const barData = [
|
|||||||
|
|
||||||
const pieData = [
|
const pieData = [
|
||||||
{ name: "Kanagatlandyrylan", value: 6746, key: "approved" },
|
{ name: "Kanagatlandyrylan", value: 6746, key: "approved" },
|
||||||
{ name: "Garaşylýar", value: 208, key: "pending" },
|
{ name: "Garaşylýar", value: 208, key: "pending" },
|
||||||
{ name: "Işlenilýär", value: 157, key: "processing" },
|
{ name: "Işlenilýär", value: 157, key: "processing" },
|
||||||
{ name: "Ýatyrylan", value: 245, key: "rejected" },
|
{ name: "Ýatyrylan", value: 245, key: "rejected" },
|
||||||
{ name: "Bellige alyndy", value: 450, key: "registered" },
|
{ name: "Bellige alyndy", value: 450, key: "registered" },
|
||||||
];
|
];
|
||||||
|
|
||||||
const recentActivity = [
|
const recentActivity = [
|
||||||
{ id: "#KS-2841", name: "Serdar Annagurban", amount: "12 500 TMT", status: "approved", time: "2 min öň" },
|
{ 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-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-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-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 öň" },
|
{ id: "#KS-2837", name: "Merdan Hojamyradow", amount: "18 000 TMT", status: "approved", time: "2 sa öň" },
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -90,27 +70,31 @@ const areaConfig = {
|
|||||||
|
|
||||||
const barConfig = {
|
const barConfig = {
|
||||||
approved: { label: "Tassyklanan", color: "var(--chart-1)" },
|
approved: { label: "Tassyklanan", color: "var(--chart-1)" },
|
||||||
rejected: { label: "Ýatyryldy", color: "var(--chart-5)" },
|
rejected: { label: "Ýatyryldy", color: "var(--chart-5)" },
|
||||||
} satisfies Record<string, { label: string; color: string }>;
|
} satisfies Record<string, { label: string; color: string }>;
|
||||||
|
|
||||||
const pieConfig = {
|
const pieConfig = {
|
||||||
approved: { label: "Kanagatlandyrylan", color: "var(--chart-2)" },
|
approved: { label: "Kanagatlandyrylan", color: "var(--chart-2)" },
|
||||||
pending: { label: "Garaşylýar", color: "var(--chart-4)" },
|
pending: { label: "Garaşylýar", color: "var(--chart-4)" },
|
||||||
processing: { label: "Işlenilýär", color: "var(--chart-1)" },
|
processing: { label: "Işlenilýär", color: "var(--chart-1)" },
|
||||||
rejected: { label: "Ýatyrylan", color: "var(--chart-5)" },
|
rejected: { label: "Ýatyrylan", color: "var(--chart-5)" },
|
||||||
registered: { label: "Bellige alyndy", color: "var(--chart-3)" },
|
registered: { label: "Bellige alyndy", color: "var(--chart-3)" },
|
||||||
} satisfies Record<string, { label: string; color: string }>;
|
} satisfies Record<string, { label: string; color: string }>;
|
||||||
|
|
||||||
// ─── Stat card ────────────────────────────────────────────────────────────────
|
// ─── Stat card ────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
function StatCard({
|
function StatCard({
|
||||||
title, value, change, icon: Icon, accent,
|
title,
|
||||||
|
value,
|
||||||
|
change,
|
||||||
|
icon: Icon,
|
||||||
|
accent,
|
||||||
}: {
|
}: {
|
||||||
title: string
|
title: string;
|
||||||
value: string
|
value: string;
|
||||||
change: number
|
change: number;
|
||||||
icon: React.ElementType
|
icon: React.ElementType;
|
||||||
accent: string
|
accent: string;
|
||||||
}) {
|
}) {
|
||||||
const positive = change >= 0;
|
const positive = change >= 0;
|
||||||
return (
|
return (
|
||||||
@@ -123,10 +107,12 @@ function StatCard({
|
|||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<p className="text-3xl font-semibold tracking-tight">{value}</p>
|
<p className="text-3xl font-semibold tracking-tight">{value}</p>
|
||||||
<p className={cn(
|
<p
|
||||||
"mt-1 flex items-center gap-1 text-xs font-medium",
|
className={cn(
|
||||||
positive ? "text-emerald-600 dark:text-emerald-400" : "text-destructive",
|
"mt-1 flex items-center gap-1 text-xs font-medium",
|
||||||
)}>
|
positive ? "text-emerald-600 dark:text-emerald-400" : "text-destructive",
|
||||||
|
)}
|
||||||
|
>
|
||||||
{positive ? <ArrowUpRight size={13} /> : <ArrowDownRight size={13} />}
|
{positive ? <ArrowUpRight size={13} /> : <ArrowDownRight size={13} />}
|
||||||
{Math.abs(change)}% geçen aýa garanyňda
|
{Math.abs(change)}% geçen aýa garanyňda
|
||||||
</p>
|
</p>
|
||||||
@@ -152,22 +138,16 @@ function StatCardSkeleton() {
|
|||||||
|
|
||||||
// ─── Status badge ─────────────────────────────────────────────────────────────
|
// ─── Status badge ─────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
function StatusBadge({ status }: { status: string }) {
|
const STATUS_CONFIG: Record<string, { label: string; variant: StatusBadgeVariant; icon: React.ElementType }> = {
|
||||||
const styles: Record<string, string> = {
|
approved: { label: "Tassyklandy", variant: "success", icon: CheckCircle2 },
|
||||||
approved: "bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400 hover:bg-emerald-100",
|
pending: { label: "Garaşylýar", variant: "warning", icon: AlertCircle },
|
||||||
pending: "bg-amber-100 text-amber-700 dark:bg-amber-950 dark:text-amber-400 hover:bg-amber-100",
|
rejected: { label: "Ýatyryldy", variant: "error", icon: XCircle },
|
||||||
rejected: "bg-red-100 text-red-700 dark:bg-red-950 dark:text-red-400 hover:bg-red-100",
|
};
|
||||||
};
|
|
||||||
const labels: Record<string, string> = {
|
function DashboardStatusBadge({ status }: { status: string }) {
|
||||||
approved: "Tassyklandy",
|
const cfg = STATUS_CONFIG[status];
|
||||||
pending: "Garaşylýar",
|
if (!cfg) return <span className="text-xs text-muted-foreground">{status}</span>;
|
||||||
rejected: "Ýatyryldy",
|
return <StatusBadge label={cfg.label} variant={cfg.variant} icon={cfg.icon} />;
|
||||||
};
|
|
||||||
return (
|
|
||||||
<Badge variant="secondary" className={cn("text-[10px] px-1.5 py-0", styles[status])}>
|
|
||||||
{labels[status]}
|
|
||||||
</Badge>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Page ─────────────────────────────────────────────────────────────────────
|
// ─── Page ─────────────────────────────────────────────────────────────────────
|
||||||
@@ -185,7 +165,9 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4">
|
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4">
|
||||||
{[...Array(4)].map((_, i) => <StatCardSkeleton key={i} />)}
|
{[...Array(4)].map((_, i) => (
|
||||||
|
<StatCardSkeleton key={i} />
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-1 lg:grid-cols-3 gap-4">
|
<div className="grid grid-cols-1 lg:grid-cols-3 gap-4">
|
||||||
@@ -198,13 +180,17 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole
|
|||||||
<CardContent>
|
<CardContent>
|
||||||
<div className="h-[220px] w-full flex flex-col justify-end relative">
|
<div className="h-[220px] w-full flex flex-col justify-end relative">
|
||||||
<div className="absolute left-0 top-0 h-full flex flex-col justify-between pb-6">
|
<div className="absolute left-0 top-0 h-full flex flex-col justify-between pb-6">
|
||||||
{[...Array(5)].map((_, i) => <Skeleton key={i} className="h-2.5 w-6" />)}
|
{[...Array(5)].map((_, i) => (
|
||||||
|
<Skeleton key={i} className="h-2.5 w-6" />
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="ml-8 flex-1 relative overflow-hidden rounded-md">
|
<div className="ml-8 flex-1 relative overflow-hidden rounded-md">
|
||||||
<Skeleton className="absolute inset-0" />
|
<Skeleton className="absolute inset-0" />
|
||||||
</div>
|
</div>
|
||||||
<div className="ml-8 mt-2 flex justify-between">
|
<div className="ml-8 mt-2 flex justify-between">
|
||||||
{[...Array(12)].map((_, i) => <Skeleton key={i} className="h-2.5 w-6" />)}
|
{[...Array(12)].map((_, i) => (
|
||||||
|
<Skeleton key={i} className="h-2.5 w-6" />
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-3 flex items-center gap-4">
|
<div className="mt-3 flex items-center gap-4">
|
||||||
@@ -256,7 +242,9 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole
|
|||||||
<CardContent>
|
<CardContent>
|
||||||
<div className="h-[180px] w-full flex flex-col justify-end relative">
|
<div className="h-[180px] w-full flex flex-col justify-end relative">
|
||||||
<div className="absolute left-0 top-0 h-full flex flex-col justify-between pb-6">
|
<div className="absolute left-0 top-0 h-full flex flex-col justify-between pb-6">
|
||||||
{[...Array(4)].map((_, i) => <Skeleton key={i} className="h-2.5 w-6" />)}
|
{[...Array(4)].map((_, i) => (
|
||||||
|
<Skeleton key={i} className="h-2.5 w-6" />
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="ml-8 flex items-end justify-between gap-1.5 h-[148px]">
|
<div className="ml-8 flex items-end justify-between gap-1.5 h-[148px]">
|
||||||
{[65, 85, 50, 95, 75, 40, 30].map((h, i) => (
|
{[65, 85, 50, 95, 75, 40, 30].map((h, i) => (
|
||||||
@@ -267,7 +255,9 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="ml-8 mt-2 flex justify-between">
|
<div className="ml-8 mt-2 flex justify-between">
|
||||||
{[...Array(7)].map((_, i) => <Skeleton key={i} className="h-2.5 w-4" />)}
|
{[...Array(7)].map((_, i) => (
|
||||||
|
<Skeleton key={i} className="h-2.5 w-4" />
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-3 flex items-center gap-4">
|
<div className="mt-3 flex items-center gap-4">
|
||||||
@@ -317,20 +307,40 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole
|
|||||||
<div className="w-full space-y-6">
|
<div className="w-full space-y-6">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-2xl font-semibold tracking-tight">
|
<h1 className="text-2xl font-semibold tracking-tight">{t("Dashboard", "Baş sahypa")}</h1>
|
||||||
{t("Dashboard", "Baş sahypa")}
|
<p className="text-sm text-muted-foreground mt-0.5">{t("Overview of all operations", "Ähli amallaryň gysgaça görünüşi")}</p>
|
||||||
</h1>
|
|
||||||
<p className="text-sm text-muted-foreground mt-0.5">
|
|
||||||
{t("Overview of all operations", "Ähli amallaryň gysgaça görünüşi")}
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Stat cards */}
|
{/* Stat cards */}
|
||||||
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4">
|
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4">
|
||||||
<StatCard title={t("Loan orders", "Karz sargytlary")} value="2 841" change={12.4} icon={FileText} accent="bg-blue-100 text-blue-600 dark:bg-blue-950 dark:text-blue-400" />
|
<StatCard
|
||||||
<StatCard title={t("Active cards", "Işjeň kartlar")} value="6 968" change={5.1} icon={CreditCard} accent="bg-violet-100 text-violet-600 dark:bg-violet-950 dark:text-violet-400" />
|
title={t("Loan orders", "Karz sargytlary")}
|
||||||
<StatCard title={t("Active clients", "Işjeň müşderiler")} value="1 204" change={-3.2} icon={Users} accent="bg-amber-100 text-amber-600 dark:bg-amber-950 dark:text-amber-400" />
|
value="2 841"
|
||||||
<StatCard title={t("Online payments", "Onlaýn tölegler")} value="438" change={18.7} icon={DollarSign} accent="bg-emerald-100 text-emerald-600 dark:bg-emerald-950 dark:text-emerald-400" />
|
change={12.4}
|
||||||
|
icon={FileText}
|
||||||
|
accent="bg-blue-100 text-blue-600 dark:bg-blue-950 dark:text-blue-400"
|
||||||
|
/>
|
||||||
|
<StatCard
|
||||||
|
title={t("Active cards", "Işjeň kartlar")}
|
||||||
|
value="6 968"
|
||||||
|
change={5.1}
|
||||||
|
icon={CreditCard}
|
||||||
|
accent="bg-violet-100 text-violet-600 dark:bg-violet-950 dark:text-violet-400"
|
||||||
|
/>
|
||||||
|
<StatCard
|
||||||
|
title={t("Active clients", "Işjeň müşderiler")}
|
||||||
|
value="1 204"
|
||||||
|
change={-3.2}
|
||||||
|
icon={Users}
|
||||||
|
accent="bg-amber-100 text-amber-600 dark:bg-amber-950 dark:text-amber-400"
|
||||||
|
/>
|
||||||
|
<StatCard
|
||||||
|
title={t("Online payments", "Onlaýn tölegler")}
|
||||||
|
value="438"
|
||||||
|
change={18.7}
|
||||||
|
icon={DollarSign}
|
||||||
|
accent="bg-emerald-100 text-emerald-600 dark:bg-emerald-950 dark:text-emerald-400"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Area chart + Pie chart */}
|
{/* Area chart + Pie chart */}
|
||||||
@@ -345,11 +355,11 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole
|
|||||||
<AreaChart data={areaData} margin={{ top: 4, right: 4, left: -24, bottom: 0 }}>
|
<AreaChart data={areaData} margin={{ top: 4, right: 4, left: -24, bottom: 0 }}>
|
||||||
<defs>
|
<defs>
|
||||||
<linearGradient id="fillLoans" x1="0" y1="0" x2="0" y2="1">
|
<linearGradient id="fillLoans" x1="0" y1="0" x2="0" y2="1">
|
||||||
<stop offset="5%" stopColor="var(--color-loans)" stopOpacity={0.2} />
|
<stop offset="5%" stopColor="var(--color-loans)" stopOpacity={0.2} />
|
||||||
<stop offset="95%" stopColor="var(--color-loans)" stopOpacity={0} />
|
<stop offset="95%" stopColor="var(--color-loans)" stopOpacity={0} />
|
||||||
</linearGradient>
|
</linearGradient>
|
||||||
<linearGradient id="fillCards" x1="0" y1="0" x2="0" y2="1">
|
<linearGradient id="fillCards" x1="0" y1="0" x2="0" y2="1">
|
||||||
<stop offset="5%" stopColor="var(--color-cards)" stopOpacity={0.2} />
|
<stop offset="5%" stopColor="var(--color-cards)" stopOpacity={0.2} />
|
||||||
<stop offset="95%" stopColor="var(--color-cards)" stopOpacity={0} />
|
<stop offset="95%" stopColor="var(--color-cards)" stopOpacity={0} />
|
||||||
</linearGradient>
|
</linearGradient>
|
||||||
</defs>
|
</defs>
|
||||||
@@ -373,7 +383,17 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole
|
|||||||
<CardContent>
|
<CardContent>
|
||||||
<ChartContainer config={pieConfig} className="h-[160px] w-full">
|
<ChartContainer config={pieConfig} className="h-[160px] w-full">
|
||||||
<PieChart>
|
<PieChart>
|
||||||
<Pie data={pieData} cx="50%" cy="50%" innerRadius={48} outerRadius={72} paddingAngle={2} dataKey="value" nameKey="name" strokeWidth={0}>
|
<Pie
|
||||||
|
data={pieData}
|
||||||
|
cx="50%"
|
||||||
|
cy="50%"
|
||||||
|
innerRadius={48}
|
||||||
|
outerRadius={72}
|
||||||
|
paddingAngle={2}
|
||||||
|
dataKey="value"
|
||||||
|
nameKey="name"
|
||||||
|
strokeWidth={0}
|
||||||
|
>
|
||||||
{pieData.map((entry, i) => (
|
{pieData.map((entry, i) => (
|
||||||
<Cell key={i} fill={`var(--color-${entry.key})`} />
|
<Cell key={i} fill={`var(--color-${entry.key})`} />
|
||||||
))}
|
))}
|
||||||
@@ -388,9 +408,7 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole
|
|||||||
<span className="h-1.5 w-1.5 rounded-full flex-shrink-0" style={{ background: `var(--color-${d.key})` }} />
|
<span className="h-1.5 w-1.5 rounded-full flex-shrink-0" style={{ background: `var(--color-${d.key})` }} />
|
||||||
{d.name}
|
{d.name}
|
||||||
</span>
|
</span>
|
||||||
<span className="font-medium tabular-nums">
|
<span className="font-medium tabular-nums">{((d.value / total) * 100).toFixed(0)}%</span>
|
||||||
{((d.value / total) * 100).toFixed(0)}%
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -413,7 +431,7 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole
|
|||||||
<YAxis tickLine={false} axisLine={false} tick={{ fontSize: 11, fill: "var(--muted-foreground)" }} />
|
<YAxis tickLine={false} axisLine={false} tick={{ fontSize: 11, fill: "var(--muted-foreground)" }} />
|
||||||
<ChartTooltip content={<ChartTooltipContent />} />
|
<ChartTooltip content={<ChartTooltipContent />} />
|
||||||
<Bar dataKey="approved" fill="var(--color-approved)" radius={[4, 4, 0, 0]} maxBarSize={20} />
|
<Bar dataKey="approved" fill="var(--color-approved)" radius={[4, 4, 0, 0]} maxBarSize={20} />
|
||||||
<Bar dataKey="rejected" fill="var(--color-rejected)" radius={[4, 4, 0, 0]} maxBarSize={20} />
|
<Bar dataKey="rejected" fill="var(--color-rejected)" radius={[4, 4, 0, 0]} maxBarSize={20} />
|
||||||
<ChartLegend content={<ChartLegendContent />} />
|
<ChartLegend content={<ChartLegendContent />} />
|
||||||
</BarChart>
|
</BarChart>
|
||||||
</ChartContainer>
|
</ChartContainer>
|
||||||
@@ -424,9 +442,7 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole
|
|||||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-3">
|
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-3">
|
||||||
<div>
|
<div>
|
||||||
<CardTitle>{t("Recent activity", "Soňky hereketler")}</CardTitle>
|
<CardTitle>{t("Recent activity", "Soňky hereketler")}</CardTitle>
|
||||||
<CardDescription className="mt-0.5">
|
<CardDescription className="mt-0.5">{t("Latest loan orders", "Iň soňky karz sargytlary")}</CardDescription>
|
||||||
{t("Latest loan orders", "Iň soňky karz sargytlary")}
|
|
||||||
</CardDescription>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-1 text-xs text-muted-foreground">
|
<div className="flex items-center gap-1 text-xs text-muted-foreground">
|
||||||
<Activity size={12} />
|
<Activity size={12} />
|
||||||
@@ -442,11 +458,13 @@ export default function DashboardPage({ isLoading = false }: { isLoading?: boole
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
<p className="text-sm font-medium truncate">{item.name}</p>
|
<p className="text-sm font-medium truncate">{item.name}</p>
|
||||||
<p className="text-xs text-muted-foreground">{item.id} · {item.time}</p>
|
<p className="text-xs text-muted-foreground">
|
||||||
|
{item.id} · {item.time}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="text-right shrink-0 space-y-0.5">
|
<div className="text-right shrink-0 space-y-0.5">
|
||||||
<p className="text-sm font-medium tabular-nums">{item.amount}</p>
|
<p className="text-sm font-medium tabular-nums">{item.amount}</p>
|
||||||
<StatusBadge status={item.status} />
|
<DashboardStatusBadge status={item.status} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -2,60 +2,36 @@ import { useState } from "react";
|
|||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Trash2, Pencil } from "lucide-react";
|
import { Trash2, Pencil } from "lucide-react";
|
||||||
import {
|
import { useLoanOrderById, useDeleteLoanOrder } from "@/features/loanOrders/hooks/useLoanOrders";
|
||||||
useLoanOrderById,
|
|
||||||
useDeleteLoanOrder,
|
|
||||||
} from "@/features/loanOrders/hooks/useLoanOrders";
|
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
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 type { LoanOrderMobileStatus } from "@/features/loanOrderMobiles/api/loanOrderMobilesApi";
|
import type { LoanOrderStatus } from "@/features/loanOrders/api/loanOrdersApi";
|
||||||
import {
|
import { BentoGrid, BentoCard, InfoRow, PassportImage, AuditLog, type AuditRowProps } from "@/components/viewPageComponents";
|
||||||
BentoGrid,
|
|
||||||
BentoCard,
|
|
||||||
InfoRow,
|
|
||||||
PassportImage,
|
|
||||||
AuditLog,
|
|
||||||
type AuditRowProps,
|
|
||||||
} from "@/components/viewPageComponents";
|
|
||||||
import { ConfirmDialog } from "@/components/confirmDialog";
|
import { ConfirmDialog } from "@/components/confirmDialog";
|
||||||
|
|
||||||
// ─── Status config ────────────────────────────────────────────────────────────
|
// ─── Status config ────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
const STATUS_VARIANT: Record<LoanOrderMobileStatus, StatusBadgeVariant> = {
|
const STATUS_VARIANT: Record<LoanOrderStatus, StatusBadgeVariant> = {
|
||||||
GARAŞYLÝAR: "warning",
|
GARAŞYLÝAR: "warning",
|
||||||
KANAGATLANDYRYLAN: "success",
|
KANAGATLANDYRYLAN: "success",
|
||||||
RED_EDILDI: "error",
|
RED_EDILDI: "error",
|
||||||
IŞLENÝÄR: "warning",
|
IŞLENÝÄR: "warning",
|
||||||
};
|
};
|
||||||
|
|
||||||
const STATUS_ICON: Record<LoanOrderMobileStatus, React.ElementType> = {
|
const STATUS_ICON: Record<LoanOrderStatus, React.ElementType> = {
|
||||||
GARAŞYLÝAR: AlertCircle,
|
GARAŞYLÝAR: AlertCircle,
|
||||||
KANAGATLANDYRYLAN: CheckCircle2,
|
KANAGATLANDYRYLAN: CheckCircle2,
|
||||||
RED_EDILDI: XCircle,
|
RED_EDILDI: XCircle,
|
||||||
IŞLENÝÄR: AlertCircle,
|
IŞLENÝÄR: AlertCircle,
|
||||||
};
|
};
|
||||||
|
|
||||||
function LoanOrderMobileStatusBadge({
|
function LoanOrderMobileStatusBadge({ status }: { status: LoanOrderStatus }) {
|
||||||
status,
|
|
||||||
}: {
|
|
||||||
status: LoanOrderMobileStatus;
|
|
||||||
}) {
|
|
||||||
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)
|
if (!variant) return <span className="text-xs text-muted-foreground">{status}</span>;
|
||||||
return <span className="text-xs text-muted-foreground">{status}</span>;
|
return <StatusBadge label={t(`loanOrderStatus.${status}`)} variant={variant} icon={Icon} />;
|
||||||
return (
|
|
||||||
<StatusBadge
|
|
||||||
label={t(`loanOrderStatus.${status}`)}
|
|
||||||
variant={variant}
|
|
||||||
icon={Icon}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Skeleton ─────────────────────────────────────────────────────────────────
|
// ─── Skeleton ─────────────────────────────────────────────────────────────────
|
||||||
@@ -66,10 +42,7 @@ function LoanOrderViewSkeleton() {
|
|||||||
<Skeleton className="h-7 w-64" />
|
<Skeleton className="h-7 w-64" />
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||||
{[...Array(6)].map((_, i) => (
|
{[...Array(6)].map((_, i) => (
|
||||||
<div
|
<div key={i} className="bg-card border border-border rounded-xl p-4 flex flex-col gap-3">
|
||||||
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" />
|
<Skeleton className="h-3 w-24 mb-1" />
|
||||||
{[...Array(3)].map((_, j) => (
|
{[...Array(3)].map((_, j) => (
|
||||||
<Skeleton key={j} className="h-4 w-full" />
|
<Skeleton key={j} className="h-4 w-full" />
|
||||||
@@ -105,11 +78,7 @@ export default function LoanOrderViewPage() {
|
|||||||
if (isLoading) return <LoanOrderViewSkeleton />;
|
if (isLoading) return <LoanOrderViewSkeleton />;
|
||||||
|
|
||||||
if (!order) {
|
if (!order) {
|
||||||
return (
|
return <div className="flex items-center justify-center h-64 text-muted-foreground text-sm">{t("common.notFound", "Tapylmady")}</div>;
|
||||||
<div className="flex items-center justify-center h-64 text-muted-foreground text-sm">
|
|
||||||
{t("common.notFound", "Tapylmady")}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const auditLogs: AuditRowProps[] = [
|
const auditLogs: AuditRowProps[] = [
|
||||||
@@ -154,31 +123,17 @@ export default function LoanOrderViewPage() {
|
|||||||
{/* Meta */}
|
{/* Meta */}
|
||||||
<BentoCard title={t("loanOrders.sections.meta", "Esasy maglumatlar")}>
|
<BentoCard title={t("loanOrders.sections.meta", "Esasy maglumatlar")}>
|
||||||
<InfoRow label={t("common.id", "ID")} value={order.id} />
|
<InfoRow label={t("common.id", "ID")} value={order.id} />
|
||||||
<InfoRow
|
<InfoRow label={t("loanOrders.columns.createdAt", "Döredilen wagty")} value={order.createdAt} />
|
||||||
label={t("loanOrders.columns.createdAt", "Döredilen wagty")}
|
|
||||||
value={order.createdAt}
|
|
||||||
/>
|
|
||||||
<InfoRow label={t("loanOrders.columns.status", "Status")}>
|
<InfoRow label={t("loanOrders.columns.status", "Status")}>
|
||||||
<LoanOrderMobileStatusBadge status={order.status} />
|
<LoanOrderMobileStatusBadge status={order.status} />
|
||||||
</InfoRow>
|
</InfoRow>
|
||||||
<InfoRow
|
<InfoRow label={t("loanOrders.fields.amount", "Berlik")} value={order.amount ? String(order.amount) : undefined} />
|
||||||
label={t("loanOrders.fields.amount", "Berlik")}
|
<InfoRow label={t("loanOrders.fields.createdBy", "Sargyt eden")} value={order.createdBy ?? undefined} isLink />
|
||||||
value={order.amount ? String(order.amount) : undefined}
|
|
||||||
/>
|
|
||||||
<InfoRow
|
|
||||||
label={t("loanOrders.fields.createdBy", "Sargyt eden")}
|
|
||||||
value={order.createdBy ?? undefined}
|
|
||||||
isLink
|
|
||||||
/>
|
|
||||||
</BentoCard>
|
</BentoCard>
|
||||||
|
|
||||||
{/* Loan */}
|
{/* Loan */}
|
||||||
<BentoCard title={t("loanOrders.sections.loan", "Karz")}>
|
<BentoCard title={t("loanOrders.sections.loan", "Karz")}>
|
||||||
<InfoRow
|
<InfoRow label={t("loanOrders.columns.loanType", "Karz görnüşi")} value={order.loanType} isLink />
|
||||||
label={t("loanOrders.columns.loanType", "Karz görnüşi")}
|
|
||||||
value={order.loanType}
|
|
||||||
isLink
|
|
||||||
/>
|
|
||||||
<InfoRow
|
<InfoRow
|
||||||
label={t("loanOrders.fields.loanAmount", "Karz mukdary")}
|
label={t("loanOrders.fields.loanAmount", "Karz mukdary")}
|
||||||
value={order.loanAmount ? String(order.loanAmount) : undefined}
|
value={order.loanAmount ? String(order.loanAmount) : undefined}
|
||||||
@@ -187,74 +142,29 @@ export default function LoanOrderViewPage() {
|
|||||||
|
|
||||||
{/* Location */}
|
{/* Location */}
|
||||||
<BentoCard title={t("loanOrders.sections.location", "Lokasiýa")}>
|
<BentoCard title={t("loanOrders.sections.location", "Lokasiýa")}>
|
||||||
<InfoRow
|
<InfoRow label={t("loanOrders.columns.region", "Welaýat")} value={order.region} />
|
||||||
label={t("loanOrders.columns.region", "Welaýat")}
|
<InfoRow label={t("loanOrders.columns.branch", "Şahamça")} value={order.branch} isLink />
|
||||||
value={order.region}
|
|
||||||
/>
|
|
||||||
<InfoRow
|
|
||||||
label={t("loanOrders.columns.branch", "Şahamça")}
|
|
||||||
value={order.branch}
|
|
||||||
isLink
|
|
||||||
/>
|
|
||||||
</BentoCard>
|
</BentoCard>
|
||||||
</BentoGrid>
|
</BentoGrid>
|
||||||
|
|
||||||
{/* ── Row 2: Personal + Contacts ──────────────────────────────────── */}
|
{/* ── Row 2: Personal + Contacts ──────────────────────────────────── */}
|
||||||
<BentoGrid cols={2}>
|
<BentoGrid cols={2}>
|
||||||
{/* Personal */}
|
{/* Personal */}
|
||||||
<BentoCard
|
<BentoCard title={t("loanOrders.sections.personal", "Şahsy maglumatlar")}>
|
||||||
title={t("loanOrders.sections.personal", "Şahsy maglumatlar")}
|
<InfoRow label={t("loanOrders.fields.fullName", "Doly ady")} value={order.fullName ?? `${order.firstName} ${order.lastName}`} />
|
||||||
>
|
<InfoRow label={t("loanOrders.fields.education", "Bilimi")} value={order.education ?? undefined} />
|
||||||
<InfoRow
|
<InfoRow label={t("loanOrders.fields.maritalStatus", "Maşgala ýagdaýy")} value={order.maritalStatus ?? undefined} />
|
||||||
label={t("loanOrders.fields.fullName", "Doly ady")}
|
<InfoRow label={t("loanOrders.fields.birthDate", "Doglan güni")} value={order.birthDate ?? undefined} />
|
||||||
value={order.fullName ?? `${order.firstName} ${order.lastName}`}
|
<InfoRow label={t("loanOrders.fields.registeredAddress", "Ýazgy edilen salgy")} value={order.registeredAddress ?? undefined} />
|
||||||
/>
|
<InfoRow label={t("loanOrders.fields.currentAddress", "Häzirki ýaşaýyş ýeri")} value={order.currentAddress ?? undefined} />
|
||||||
<InfoRow
|
|
||||||
label={t("loanOrders.fields.education", "Bilimi")}
|
|
||||||
value={order.education ?? undefined}
|
|
||||||
/>
|
|
||||||
<InfoRow
|
|
||||||
label={t("loanOrders.fields.maritalStatus", "Maşgala ýagdaýy")}
|
|
||||||
value={order.maritalStatus ?? undefined}
|
|
||||||
/>
|
|
||||||
<InfoRow
|
|
||||||
label={t("loanOrders.fields.birthDate", "Doglan güni")}
|
|
||||||
value={order.birthDate ?? undefined}
|
|
||||||
/>
|
|
||||||
<InfoRow
|
|
||||||
label={t(
|
|
||||||
"loanOrders.fields.registeredAddress",
|
|
||||||
"Ýazgy edilen salgy",
|
|
||||||
)}
|
|
||||||
value={order.registeredAddress ?? undefined}
|
|
||||||
/>
|
|
||||||
<InfoRow
|
|
||||||
label={t(
|
|
||||||
"loanOrders.fields.currentAddress",
|
|
||||||
"Häzirki ýaşaýyş ýeri",
|
|
||||||
)}
|
|
||||||
value={order.currentAddress ?? undefined}
|
|
||||||
/>
|
|
||||||
</BentoCard>
|
</BentoCard>
|
||||||
|
|
||||||
{/* Contacts */}
|
{/* Contacts */}
|
||||||
<BentoCard title={t("loanOrders.sections.contacts", "Habarlaşmak")}>
|
<BentoCard title={t("loanOrders.sections.contacts", "Habarlaşmak")}>
|
||||||
<InfoRow
|
<InfoRow label={t("loanOrders.fields.email", "E-poçta")} value={order.email ?? undefined} />
|
||||||
label={t("loanOrders.fields.email", "E-poçta")}
|
<InfoRow label={t("loanOrders.columns.phone", "Telefon")} value={order.phone} />
|
||||||
value={order.email ?? undefined}
|
<InfoRow label={t("loanOrders.fields.phoneAlt", "Telefon goşmaça")} value={order.phoneAlt ?? undefined} />
|
||||||
/>
|
<InfoRow label={t("loanOrders.fields.homePhone", "Öý telefony")} value={order.homePhone ?? undefined} />
|
||||||
<InfoRow
|
|
||||||
label={t("loanOrders.columns.phone", "Telefon")}
|
|
||||||
value={order.phone}
|
|
||||||
/>
|
|
||||||
<InfoRow
|
|
||||||
label={t("loanOrders.fields.phoneAlt", "Telefon goşmaça")}
|
|
||||||
value={order.phoneAlt ?? undefined}
|
|
||||||
/>
|
|
||||||
<InfoRow
|
|
||||||
label={t("loanOrders.fields.homePhone", "Öý telefony")}
|
|
||||||
value={order.homePhone ?? undefined}
|
|
||||||
/>
|
|
||||||
</BentoCard>
|
</BentoCard>
|
||||||
</BentoGrid>
|
</BentoGrid>
|
||||||
|
|
||||||
@@ -262,58 +172,21 @@ export default function LoanOrderViewPage() {
|
|||||||
<BentoGrid cols={2}>
|
<BentoGrid cols={2}>
|
||||||
{/* Employment */}
|
{/* Employment */}
|
||||||
<BentoCard title={t("loanOrders.sections.employment", "Iş")}>
|
<BentoCard title={t("loanOrders.sections.employment", "Iş")}>
|
||||||
<InfoRow
|
<InfoRow label={t("loanOrders.fields.employer", "Kärhananyň ady")} value={order.employer ?? undefined} />
|
||||||
label={t("loanOrders.fields.employer", "Kärhananyň ady")}
|
<InfoRow label={t("loanOrders.fields.deptPhone", "Işgärler bölüminiň belgisi")} value={order.deptPhone ?? undefined} />
|
||||||
value={order.employer ?? undefined}
|
<InfoRow label={t("loanOrders.fields.workRegion", "Işleýän welaýaty")} value={order.workRegion ?? undefined} />
|
||||||
/>
|
<InfoRow label={t("loanOrders.fields.workCity", "Işleýän etraby")} value={order.workCity ?? undefined} isLink />
|
||||||
<InfoRow
|
<InfoRow label={t("loanOrders.fields.position", "Wezipe")} value={order.position ?? undefined} />
|
||||||
label={t(
|
<InfoRow label={t("loanOrders.fields.salary", "Zähmet haky")} value={order.salary ? String(order.salary) : undefined} />
|
||||||
"loanOrders.fields.deptPhone",
|
<InfoRow label={t("loanOrders.fields.employedSince", "Işe başlan wagty")} value={order.employedSince ?? undefined} />
|
||||||
"Işgärler bölüminiň belgisi",
|
|
||||||
)}
|
|
||||||
value={order.deptPhone ?? undefined}
|
|
||||||
/>
|
|
||||||
<InfoRow
|
|
||||||
label={t("loanOrders.fields.workRegion", "Işleýän welaýaty")}
|
|
||||||
value={order.workRegion ?? undefined}
|
|
||||||
/>
|
|
||||||
<InfoRow
|
|
||||||
label={t("loanOrders.fields.workCity", "Işleýän etraby")}
|
|
||||||
value={order.workCity ?? undefined}
|
|
||||||
isLink
|
|
||||||
/>
|
|
||||||
<InfoRow
|
|
||||||
label={t("loanOrders.fields.position", "Wezipe")}
|
|
||||||
value={order.position ?? undefined}
|
|
||||||
/>
|
|
||||||
<InfoRow
|
|
||||||
label={t("loanOrders.fields.salary", "Zähmet haky")}
|
|
||||||
value={order.salary ? String(order.salary) : undefined}
|
|
||||||
/>
|
|
||||||
<InfoRow
|
|
||||||
label={t("loanOrders.fields.employedSince", "Işe başlan wagty")}
|
|
||||||
value={order.employedSince ?? undefined}
|
|
||||||
/>
|
|
||||||
</BentoCard>
|
</BentoCard>
|
||||||
|
|
||||||
{/* Passport info */}
|
{/* Passport info */}
|
||||||
<BentoCard title={t("loanOrders.sections.passport", "Pasport")}>
|
<BentoCard title={t("loanOrders.sections.passport", "Pasport")}>
|
||||||
|
<InfoRow label={t("loanOrders.fields.passportNumber", "Pasport")} value={order.passportNumber ?? undefined} />
|
||||||
|
<InfoRow label={t("loanOrders.fields.passportIssuedBy", "Kim tarapyndan berildi")} value={order.passportIssuedBy ?? undefined} />
|
||||||
<InfoRow
|
<InfoRow
|
||||||
label={t("loanOrders.fields.passportNumber", "Pasport")}
|
label={t("loanOrders.fields.passportBirthPlace", "Doglan ýeri (pasport)")}
|
||||||
value={order.passportNumber ?? undefined}
|
|
||||||
/>
|
|
||||||
<InfoRow
|
|
||||||
label={t(
|
|
||||||
"loanOrders.fields.passportIssuedBy",
|
|
||||||
"Kim tarapyndan berildi",
|
|
||||||
)}
|
|
||||||
value={order.passportIssuedBy ?? undefined}
|
|
||||||
/>
|
|
||||||
<InfoRow
|
|
||||||
label={t(
|
|
||||||
"loanOrders.fields.passportBirthPlace",
|
|
||||||
"Doglan ýeri (pasport)",
|
|
||||||
)}
|
|
||||||
value={order.passportBirthPlace ?? undefined}
|
value={order.passportBirthPlace ?? undefined}
|
||||||
/>
|
/>
|
||||||
</BentoCard>
|
</BentoCard>
|
||||||
@@ -322,35 +195,20 @@ export default function LoanOrderViewPage() {
|
|||||||
{/* ── Row 4: Passport images ───────────────────────────────────────── */}
|
{/* ── Row 4: Passport images ───────────────────────────────────────── */}
|
||||||
<BentoGrid cols={4}>
|
<BentoGrid cols={4}>
|
||||||
<BentoCard title={t("loanOrders.fields.passportPage1", "Sahypa 1")}>
|
<BentoCard title={t("loanOrders.fields.passportPage1", "Sahypa 1")}>
|
||||||
<PassportImage
|
<PassportImage label={t("loanOrders.fields.passportPage1", "Pasport (sahypa 1)")} src={order.passportPage1Url ?? undefined} />
|
||||||
label={t("loanOrders.fields.passportPage1", "Pasport (sahypa 1)")}
|
|
||||||
src={order.passportPage1Url ?? undefined}
|
|
||||||
/>
|
|
||||||
</BentoCard>
|
</BentoCard>
|
||||||
<BentoCard title={t("loanOrders.fields.passportPage23", "Sahypa 2-3")}>
|
<BentoCard title={t("loanOrders.fields.passportPage23", "Sahypa 2-3")}>
|
||||||
<PassportImage
|
<PassportImage
|
||||||
label={t(
|
label={t("loanOrders.fields.passportPage23", "Pasport (2-3-nji sahypa)")}
|
||||||
"loanOrders.fields.passportPage23",
|
|
||||||
"Pasport (2-3-nji sahypa)",
|
|
||||||
)}
|
|
||||||
src={order.passportPage23Url ?? undefined}
|
src={order.passportPage23Url ?? undefined}
|
||||||
/>
|
/>
|
||||||
</BentoCard>
|
</BentoCard>
|
||||||
<BentoCard title={t("loanOrders.fields.passportPage89", "Sahypa 8-9")}>
|
<BentoCard title={t("loanOrders.fields.passportPage89", "Sahypa 8-9")}>
|
||||||
<PassportImage
|
<PassportImage label={t("loanOrders.fields.passportPage89", "Pasport (8-9 sahypa)")} src={order.passportPage89Url ?? undefined} />
|
||||||
label={t(
|
|
||||||
"loanOrders.fields.passportPage89",
|
|
||||||
"Pasport (8-9 sahypa)",
|
|
||||||
)}
|
|
||||||
src={order.passportPage89Url ?? undefined}
|
|
||||||
/>
|
|
||||||
</BentoCard>
|
</BentoCard>
|
||||||
<BentoCard title={t("loanOrders.fields.passportPage32", "Sahypa 32")}>
|
<BentoCard title={t("loanOrders.fields.passportPage32", "Sahypa 32")}>
|
||||||
<PassportImage
|
<PassportImage
|
||||||
label={t(
|
label={t("loanOrders.fields.passportPage32", "Pasport (32-nji sahypa)")}
|
||||||
"loanOrders.fields.passportPage32",
|
|
||||||
"Pasport (32-nji sahypa)",
|
|
||||||
)}
|
|
||||||
src={order.passportPage32Url ?? undefined}
|
src={order.passportPage32Url ?? undefined}
|
||||||
/>
|
/>
|
||||||
</BentoCard>
|
</BentoCard>
|
||||||
|
|||||||
Reference in new issue
Block a user