updated online history table ui

This commit is contained in:
Jelaletdin12
2026-10-25 20:33:19 +05:00
parent c3cf23a192
commit 5fd800d506
5 changed files with 83 additions and 79 deletions

View File

@@ -18,6 +18,7 @@ export type GatewayStatus = "success" | "failed" | "pending" | "processing";
export interface OnlinePayment {
id: number;
orderId: number;
orderNumber?: string;
orderUniqueId: string;
type: string; // "visa" | "sber" | "kart" | ...
branchId: number;
@@ -30,6 +31,8 @@ export interface OnlinePayment {
bankFeeTmt: number;
gbusFeeTmt: number;
totalAmountTmt: number;
apiClientName?: string;
description?: string;
exchangeRateUsd: number;
paymentPeriod: string;
gatewayStatus: string;

View File

@@ -1061,12 +1061,17 @@
"loanTypes.viewTitle": "Loan type detail",
"notFound": "Not found",
"onlinePayments.title": "Online payments",
"onlinePayments.columns.orderNumber": "PNR",
"onlinePayments.columns.id": "ID",
"onlinePayments.columns.amount": "AMOUNT",
"onlinePayments.columns.apiClient": "API CLIENT",
"onlinePayments.columns.apiClientName": "API CLIENT",
"onlinePayments.columns.description": "DESCRIPTION",
"onlinePayments.columns.status": "STATUS",
"onlinePayments.columns.gatewayStatus": "STATUS",
"onlinePayments.columns.passportName": "PASSPORT NAME",
"onlinePayments.columns.username": "USERNAME",
"onlinePayments.columns.createdAt": "CREATED AT",
"onlinePayments.columns.totalAmount": "TOTAL (TMT)",
"onlinePayments.actions.callback": "Send callback",
"onlinePayments.detail.title": "Online payment detail",
"onlinePayments.notFound": "Payment not found",
@@ -1594,13 +1599,10 @@
"visaMasterSberSettings.createTitle": "Create setting",
"visaMasterSberSettings.editTitle": "Edit setting",
"onlinePayments.viewTitle": "Payment detail",
"onlinePayments.columns.id": "ID",
"onlinePayments.columns.orderId": "ORDER ID",
"onlinePayments.columns.type": "TYPE",
"onlinePayments.columns.branch": "BRANCH",
"onlinePayments.columns.passport": "PASSPORT",
"onlinePayments.columns.totalAmount": "TOTAL (TMT)",
"onlinePayments.columns.gatewayStatus": "GATEWAY STATUS",
"onlinePayments.columns.paid": "PAID",
"onlinePayments.filters.status": "Status",
"onlinePayments.filters.branch": "Branch",
@@ -1673,7 +1675,6 @@
"onlinePayments.columns.gatewayReference": "Gateway reference",
"onlinePayments.columns.callbackStatus": "Callback status",
"onlinePayments.columns.callbackAt": "Callback time",
"onlinePayments.columns.apiClientName": "API client",
"onlinePayments.columns.formUrl": "Form URL",
"onlinePayments.columns.successUrl": "Success URL",
"cardTypes.viewTitle": "Card type detail",

View File

@@ -1062,12 +1062,17 @@
"loanTypes.viewTitle": "Детали типа кредита",
"notFound": "Не найдено",
"onlinePayments.title": "Онлайн-платежи",
"onlinePayments.columns.orderNumber": "PNR",
"onlinePayments.columns.id": "ID",
"onlinePayments.columns.amount": "СУММА",
"onlinePayments.columns.apiClient": "API CLIENT",
"onlinePayments.columns.description": "DESC",
"onlinePayments.columns.status": "СТАТУС",
"onlinePayments.columns.apiClient": "API-клиент",
"onlinePayments.columns.apiClientName": "API-клиент",
"onlinePayments.columns.description": "ОПИСАНИЕ",
"onlinePayments.columns.gatewayStatus": "СТАТУС",
"onlinePayments.columns.passportName": "ИМЯ ПО ПАСПОРТУ",
"onlinePayments.columns.username": "USERNAME",
"onlinePayments.columns.createdAt": "ДАТА СОЗДАНИЯ",
"onlinePayments.columns.totalAmount": "ИТОГО (TMT)",
"onlinePayments.actions.callback": "Отправить callback",
"onlinePayments.detail.title": "Детали онлайн-платежа",
"onlinePayments.notFound": "Платеж не найден",
@@ -1595,13 +1600,10 @@
"visaMasterSberSettings.createTitle": "Создать настройку",
"visaMasterSberSettings.editTitle": "Редактировать настройку",
"onlinePayments.viewTitle": "Детали платежа",
"onlinePayments.columns.id": "ID",
"onlinePayments.columns.orderId": "BELGI ORDER",
"onlinePayments.columns.type": "ТИП",
"onlinePayments.columns.branch": "ФИЛИАЛ",
"onlinePayments.columns.passport": "ПАСПОРТ",
"onlinePayments.columns.totalAmount": "ИТОГО (TMT)",
"onlinePayments.columns.gatewayStatus": "СТАТУС ШЛЮЗА",
"onlinePayments.columns.paid": "ОПЛАЧЕНО",
"onlinePayments.filters.status": "Статус",
"onlinePayments.filters.branch": "Филиал",
@@ -1674,7 +1676,6 @@
"onlinePayments.columns.gatewayReference": "Референс шлюза",
"onlinePayments.columns.callbackStatus": "Статус callback",
"onlinePayments.columns.callbackAt": "Время callback",
"onlinePayments.columns.apiClientName": "API-клиент",
"onlinePayments.columns.formUrl": "URL формы",
"onlinePayments.columns.successUrl": "URL успешного перехода",
"cardTypes.viewTitle": "Детали типа карты",

View File

@@ -1059,12 +1059,17 @@
"loanTypes.viewTitle": "Karz görnüşi giňişleýin",
"notFound": "Tapylmady",
"onlinePayments.title": "Onlaýn töleg taryhy",
"onlinePayments.columns.orderNumber": "PNR",
"onlinePayments.columns.id": "ID",
"onlinePayments.columns.amount": "MÖÇBERI",
"onlinePayments.columns.apiClient": "API CLIENT",
"onlinePayments.columns.description": "DESC",
"onlinePayments.columns.status": "STATUS",
"onlinePayments.columns.apiClient": "API MÜŞDERISI",
"onlinePayments.columns.apiClientName": "API MÜŞDERISI",
"onlinePayments.columns.description": "DÜŞÜNDIRIŞ",
"onlinePayments.columns.gatewayStatus": "STATUS",
"onlinePayments.columns.passportName": "PASPORT ADY",
"onlinePayments.columns.username": "USERNAME",
"onlinePayments.columns.createdAt": "DÖREDILEN WAGTY",
"onlinePayments.columns.totalAmount": "JEMI (TMT)",
"onlinePayments.actions.callback": "Callback ugrat",
"onlinePayments.detail.title": "Onlaýn töleg taryhy giňişleýin",
"onlinePayments.notFound": "Töleg tapylmady",
@@ -1593,13 +1598,10 @@
"visaMasterSberSettings.createTitle": "Sazlama döretmek",
"visaMasterSberSettings.editTitle": "Sazlama üýtgetmek",
"onlinePayments.viewTitle": "Töleg giňišleýin",
"onlinePayments.columns.id": "ID",
"onlinePayments.columns.orderId": "ORDER BELGISI",
"onlinePayments.columns.type": "GÖRNÜŞI",
"onlinePayments.columns.branch": "ŞAHAMÇA",
"onlinePayments.columns.passport": "PASPORT",
"onlinePayments.columns.totalAmount": "JEMI (TMT)",
"onlinePayments.columns.gatewayStatus": "GATEWAY STATUSY",
"onlinePayments.columns.paid": "TÖLENDI",
"onlinePayments.filters.status": "Status",
"onlinePayments.filters.branch": "Şahamça",
@@ -1672,7 +1674,6 @@
"onlinePayments.columns.gatewayReference": "Gateway referensi",
"onlinePayments.columns.callbackStatus": "Callback statusy",
"onlinePayments.columns.callbackAt": "Callback wagty",
"onlinePayments.columns.apiClientName": "API müşderisi",
"onlinePayments.columns.formUrl": "Form URL-si",
"onlinePayments.columns.successUrl": "Üstünlik URL-si",
"cardTypes.viewTitle": "Kart görnüşi giňişleýin",

View File

@@ -10,7 +10,7 @@ import { DataTableToolbar, type ActiveFilter, type FilterField } from "@/compone
import type { VisibilityState } from "@tanstack/react-table";
import { useGetOnlinePayments } from "@/features/onlinePaymentHistory/hooks/useOnlinePaymentsHistory";
import type { OnlinePayment, PaymentSortField, PaymentSortOrder } from "@/features/onlinePaymentHistory/api/onlinePaymentsHistoryApi";
import { GatewayStatusBadge, PaidBadge } from "../../features/onlinePaymentHistory/components/PaymentStatusBadge";
import { GatewayStatusBadge } from "../../features/onlinePaymentHistory/components/PaymentStatusBadge";
import { getPaymentHistoryStatusOptions } from "@/constants/paymentStatus";
import { useInfiniteBranches } from "@/features/branches/hooks/useBranches";
import { resolveLocalizedName } from "@/features/branches/api/branchesApi";
@@ -37,17 +37,25 @@ function resolveLang(lang: string): "en" | "ru" | "tm" {
// ─── Constants ────────────────────────────────────────────────────────────────
const COLUMN_IDS = ["id", "orderId", "type", "branchName", "passport", "totalAmountTmt", "gatewayStatus", "paid", "createdAt"] as const;
const COLUMN_IDS = [
"orderNumber",
"id",
"totalAmountTmt",
"apiClientName",
"description",
"gatewayStatus",
"passportName",
"createdAt",
] as const;
const DEFAULT_VISIBILITY: VisibilityState = {
orderNumber: true,
id: true,
orderId: true,
type: true,
branchName: true,
passport: true,
totalAmountTmt: true,
apiClientName: true,
description: true,
gatewayStatus: true,
paid: true,
passportName: true,
createdAt: true,
};
@@ -55,14 +63,13 @@ const DEFAULT_ORDER = [...COLUMN_IDS, "actions"];
/** Column id → i18n key, shared by the table headers and the column-toggle list. */
const COLUMN_LABEL_KEYS: Record<(typeof COLUMN_IDS)[number], string> = {
orderNumber: "onlinePayments.columns.orderNumber",
id: "onlinePayments.columns.id",
orderId: "onlinePayments.columns.orderId",
type: "onlinePayments.columns.type",
branchName: "onlinePayments.columns.branch",
passport: "onlinePayments.columns.passport",
totalAmountTmt: "onlinePayments.columns.totalAmount",
apiClientName: "onlinePayments.columns.apiClientName",
description: "onlinePayments.columns.description",
gatewayStatus: "onlinePayments.columns.gatewayStatus",
paid: "onlinePayments.columns.paid",
passportName: "onlinePayments.columns.passportName",
createdAt: "onlinePayments.columns.createdAt",
};
@@ -213,6 +220,14 @@ export default function OnlinePaymentHistoryPage() {
// ─── Columns
const columns = useMemo<ColumnDef<OnlinePayment>[]>(
() => [
{
id: "orderNumber",
accessorKey: "orderNumber",
header: t(COLUMN_LABEL_KEYS.orderNumber, "PNR"),
cell: ({ row }) => <span className="font-mono text-xs text-foreground">{row.original.orderNumber || "—"}</span>,
size: 140,
enableSorting: false,
},
{
id: "id",
accessorKey: "id",
@@ -228,68 +243,51 @@ export default function OnlinePaymentHistoryPage() {
size: 60,
enableSorting: true,
},
{
id: "orderId",
accessorKey: "orderId",
header: t(COLUMN_LABEL_KEYS.orderId, "ORDER ID"),
cell: ({ row }) => <span className="tabular-nums text-foreground font-medium">{row.original.orderId}</span>,
size: 90,
enableSorting: false,
},
{
id: "type",
accessorKey: "type",
header: t(COLUMN_LABEL_KEYS.type, "TYPE"),
cell: ({ row }) => <span className="text-xs font-semibold uppercase tracking-wide text-foreground">{row.original.type}</span>,
size: 80,
enableSorting: false,
},
{
id: "branchName",
accessorKey: "branchName",
header: t(COLUMN_LABEL_KEYS.branchName, "BRANCH"),
cell: ({ row }) => (
<span className="text-sm text-foreground truncate max-w-[200px] block">
{row.original.branchName?.[lang] ?? row.original.branchName?.en ?? "—"}
</span>
),
size: 200,
enableSorting: false,
},
{
id: "passport",
accessorKey: "passport",
header: t(COLUMN_LABEL_KEYS.passport, "PASSPORT"),
cell: ({ row }) => (
<span className="text-sm text-foreground">
{row.original.passportName} {row.original.passportSurname}
</span>
),
size: 150,
enableSorting: false,
},
{
id: "totalAmountTmt",
accessorKey: "totalAmountTmt",
header: t(COLUMN_LABEL_KEYS.totalAmountTmt, "TOTAL (TMT)"),
cell: ({ row }) => <span className="tabular-nums text-foreground font-medium">{row.original.totalAmountTmt.toLocaleString()}</span>,
cell: ({ row }) => (
<span className="tabular-nums text-foreground font-medium">{row.original.totalAmountTmt?.toLocaleString() ?? "—"}</span>
),
size: 110,
enableSorting: true,
},
{
id: "apiClientName",
accessorKey: "apiClientName",
header: t(COLUMN_LABEL_KEYS.apiClientName, "API CLIENT"),
cell: ({ row }) => (
<span className="text-sm text-foreground truncate max-w-[220px] block">{row.original.apiClientName || "—"}</span>
),
size: 220,
enableSorting: false,
},
{
id: "description",
accessorKey: "description",
header: t(COLUMN_LABEL_KEYS.description, "DESC"),
cell: ({ row }) => <span className="text-sm text-foreground truncate max-w-[180px] block">{row.original.description || "—"}</span>,
size: 180,
enableSorting: false,
},
{
id: "gatewayStatus",
accessorKey: "gatewayStatus",
header: t(COLUMN_LABEL_KEYS.gatewayStatus, "GATEWAY STATUS"),
header: t(COLUMN_LABEL_KEYS.gatewayStatus, "STATUS"),
cell: ({ row }) => <GatewayStatusBadge status={row.original.gatewayStatus} />,
size: 140,
enableSorting: true,
},
{
id: "paid",
accessorKey: "paid",
header: t(COLUMN_LABEL_KEYS.paid, "PAID"),
cell: ({ row }) => <PaidBadge paid={row.original.paid} />,
size: 90,
id: "passportName",
accessorKey: "passportName",
header: t(COLUMN_LABEL_KEYS.passportName, "PASSPORT NAME"),
cell: ({ row }) => {
const fullName = [row.original.passportName, row.original.passportSurname].filter(Boolean).join(" ");
return <span className="text-sm text-foreground">{fullName || "—"}</span>;
},
size: 150,
enableSorting: false,
},
{
@@ -332,7 +330,7 @@ export default function OnlinePaymentHistoryPage() {
size: 60,
},
],
[t, navigate, lang],
[t, navigate],
);
const toggleableColumns = useMemo(() => COLUMN_IDS.map((id) => ({ id, label: t(COLUMN_LABEL_KEYS[id], id) })), [t]);