changed payment history api in visa/master payments
This commit is contained in:
1 parent
cbfb467651
commit
879ed77121
15 files changed
+1174
-190
No files matched your search
@@ -13,6 +13,7 @@ import { useCards, useDeleteCard } from "@/features/orderNewCard/hooks/useOrderN
|
||||
import type { CardOrder } from "@/features/orderNewCard/api/orderNewCardApi";
|
||||
import { useInfiniteBranches } from "@/features/branches/hooks/useBranches";
|
||||
import { useInfiniteCardTypes } from "@/features/cardTypes/hooks/useCardTypes";
|
||||
import { useInfiniteClients } from "@/features/clients/hooks/useClients";
|
||||
import type { LocalizedText } from "@/features/branches/api/branchesApi";
|
||||
import { getStatusOptions, getRegionOptions, StatusCell, ActiveStatusCell } from "@/constants";
|
||||
import { formatFromApiDate } from "@/lib/utils/dateUtils";
|
||||
@@ -55,9 +56,11 @@ export default function CardOrdersPage() {
|
||||
const [filterEnabled, setFilterEnabled] = useState(false);
|
||||
const [branchSearch, setBranchSearch] = useState("");
|
||||
const [cardTypeSearch, setCardTypeSearch] = useState("");
|
||||
const [userSearch, setUserSearch] = useState("");
|
||||
|
||||
const isBranchFilterEnabled = filterEnabled || Boolean(getFilter("branch_id"));
|
||||
const isCardTypeFilterEnabled = filterEnabled || Boolean(getFilter("card_type_id"));
|
||||
const isUserFilterEnabled = filterEnabled || Boolean(getFilter("user_id"));
|
||||
|
||||
const {
|
||||
data: branchesInfiniteData,
|
||||
@@ -75,6 +78,14 @@ export default function CardOrdersPage() {
|
||||
isLoading: isCardTypesLoading,
|
||||
} = useInfiniteCardTypes(cardTypeSearch, isCardTypeFilterEnabled);
|
||||
|
||||
const {
|
||||
data: usersData,
|
||||
fetchNextPage: fetchNextUsers,
|
||||
hasNextPage: hasNextUsers,
|
||||
isFetchingNextPage: isFetchingNextUsers,
|
||||
isLoading: isUsersLoading,
|
||||
} = useInfiniteClients(userSearch, isUserFilterEnabled);
|
||||
|
||||
const queryParams = useMemo(
|
||||
() => ({
|
||||
search: search || undefined,
|
||||
@@ -251,6 +262,17 @@ export default function CardOrdersPage() {
|
||||
[cardTypesInfiniteData, lang],
|
||||
);
|
||||
|
||||
const userOptions = useMemo(
|
||||
() =>
|
||||
(usersData?.pages ?? []).flatMap((page) =>
|
||||
(page?.users ?? []).map((u) => ({
|
||||
value: String(u.id),
|
||||
label: u.name || u.username || String(u.id),
|
||||
})),
|
||||
),
|
||||
[usersData],
|
||||
);
|
||||
|
||||
// ── Filter fields ──────────────────────────────────────────────────────────
|
||||
const filterFields = useMemo<FilterField[]>(
|
||||
() => [
|
||||
@@ -278,8 +300,15 @@ export default function CardOrdersPage() {
|
||||
},
|
||||
{
|
||||
id: "user_id",
|
||||
label: t("cardOrder.filter.userId", "Ulanyjy ID"),
|
||||
type: "text",
|
||||
label: t("cardOrder.filter.user", "Ulanyjy"),
|
||||
type: "infinite-select",
|
||||
options: userOptions,
|
||||
loading: isUsersLoading,
|
||||
isLoadingMore: isFetchingNextUsers,
|
||||
hasNextPage: hasNextUsers,
|
||||
onLoadMore: fetchNextUsers,
|
||||
searchValue: userSearch,
|
||||
onSearchChange: setUserSearch,
|
||||
},
|
||||
{
|
||||
id: "card_state_id",
|
||||
@@ -312,6 +341,12 @@ export default function CardOrdersPage() {
|
||||
isFetchingNextCardTypes,
|
||||
hasNextCardTypes,
|
||||
cardTypeSearch,
|
||||
userOptions,
|
||||
isUsersLoading,
|
||||
isFetchingNextUsers,
|
||||
hasNextUsers,
|
||||
userSearch,
|
||||
fetchNextUsers,
|
||||
],
|
||||
);
|
||||
|
||||
|
||||
@@ -338,7 +338,10 @@ export default function IntlPaymentViewPage() {
|
||||
</div>
|
||||
|
||||
{/* Single history table */}
|
||||
<PaymentHistoryTable orderId={id} />
|
||||
<PaymentHistoryTable
|
||||
orderId={data.id}
|
||||
paymentId={(data as any).paymentId ?? (data as any).payment_id ?? (data as any).payment?.id}
|
||||
/>
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// pages/OnlinePaymentHistoryPage.tsx
|
||||
|
||||
import { useState, useMemo, useCallback } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useNavigate, Link } from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Eye } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { DataTable, type ColumnDef } from "@/components/dataTable";
|
||||
import { DataTable, type ColumnDef, type SortingState } from "@/components/dataTable";
|
||||
import { DataTableToolbar, type ActiveFilter, type FilterField } from "@/components/dataTableToolbar";
|
||||
import type { VisibilityState } from "@tanstack/react-table";
|
||||
import { useGetOnlinePayments } from "@/features/onlinePaymentHistory/hooks/useOnlinePaymentsHistory";
|
||||
import type { OnlinePayment } from "@/features/onlinePaymentHistory/api/onlinePaymentsHistoryApi";
|
||||
import type { OnlinePayment, PaymentSortField, PaymentSortOrder } from "@/features/onlinePaymentHistory/api/onlinePaymentsHistoryApi";
|
||||
import { GatewayStatusBadge, PaidBadge } from "../../features/onlinePaymentHistory/components/PaymentStatusBadge";
|
||||
import { getGatewayStatusOptions } from "@/constants/paymentStatus";
|
||||
import { getPaymentHistoryStatusOptions } from "@/constants/paymentStatus";
|
||||
import { useInfiniteBranches } from "@/features/branches/hooks/useBranches";
|
||||
|
||||
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
||||
@@ -79,6 +79,7 @@ export default function OnlinePaymentHistoryPage() {
|
||||
// ─── Column state
|
||||
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>(DEFAULT_VISIBILITY);
|
||||
const [columnOrder, setColumnOrder] = useState<string[]>([...DEFAULT_ORDER]);
|
||||
const [sorting, setSorting] = useState<SortingState>([{ id: "createdAt", desc: true }]);
|
||||
|
||||
// ─── Filters — fieldId matches query param name for easy mapping
|
||||
const [activeFilters, setActiveFilters] = useState<ActiveFilter[]>([
|
||||
@@ -86,6 +87,7 @@ export default function OnlinePaymentHistoryPage() {
|
||||
{ fieldId: "branchId", value: "" },
|
||||
{ fieldId: "orderId", value: "" },
|
||||
{ fieldId: "userId", value: "" },
|
||||
{ fieldId: "amount", value: "" },
|
||||
]);
|
||||
|
||||
// ─── Branch infinite-select data
|
||||
@@ -115,7 +117,21 @@ export default function OnlinePaymentHistoryPage() {
|
||||
// ─── Derive query params from active filters
|
||||
const filterMap = useMemo(() => Object.fromEntries(activeFilters.map((f) => [f.fieldId, f.value])), [activeFilters]);
|
||||
|
||||
const gatewayStatusOptions = useMemo(() => getGatewayStatusOptions(t), [t]);
|
||||
const gatewayStatusOptions = useMemo(() => getPaymentHistoryStatusOptions(t), [t]);
|
||||
|
||||
const sortMap: Record<string, PaymentSortField> = useMemo(
|
||||
() => ({
|
||||
id: "id",
|
||||
createdAt: "created_at",
|
||||
gatewayStatus: "status",
|
||||
totalAmountTmt: "amount",
|
||||
}),
|
||||
[],
|
||||
);
|
||||
|
||||
const activeSort = sorting[0];
|
||||
const sortField: PaymentSortField = activeSort ? (sortMap[activeSort.id] ?? "created_at") : "created_at";
|
||||
const sortOrder: PaymentSortOrder = activeSort ? (activeSort.desc ? "desc" : "asc") : "desc";
|
||||
|
||||
const queryParams = useMemo(
|
||||
() => ({
|
||||
@@ -126,8 +142,11 @@ export default function OnlinePaymentHistoryPage() {
|
||||
branchId: filterMap.branchId ? Number(filterMap.branchId) : undefined,
|
||||
orderId: filterMap.orderId ? Number(filterMap.orderId) : undefined,
|
||||
userId: filterMap.userId ? Number(filterMap.userId) : undefined,
|
||||
amount: filterMap.amount || undefined,
|
||||
sort: sortField,
|
||||
order: sortOrder,
|
||||
}),
|
||||
[page, perPage, search, filterMap],
|
||||
[page, perPage, search, filterMap, sortField, sortOrder],
|
||||
);
|
||||
|
||||
const { data, isLoading } = useGetOnlinePayments(queryParams);
|
||||
@@ -179,6 +198,11 @@ export default function OnlinePaymentHistoryPage() {
|
||||
label: t("onlinePayments.filters.userId", "User ID"),
|
||||
type: "text",
|
||||
},
|
||||
{
|
||||
id: "amount",
|
||||
label: t("onlinePayments.filters.amount", "Möçber"),
|
||||
type: "text",
|
||||
},
|
||||
],
|
||||
[t, branchOptions, isBranchesLoading, isFetchingNextBranches, hasNextBranches, branchSearch, gatewayStatusOptions],
|
||||
);
|
||||
@@ -190,8 +214,16 @@ export default function OnlinePaymentHistoryPage() {
|
||||
id: "id",
|
||||
accessorKey: "id",
|
||||
header: t(COLUMN_LABEL_KEYS.id, "ID"),
|
||||
cell: ({ row }) => <span className="tabular-nums text-foreground font-medium">{row.original.id}</span>,
|
||||
size: 50,
|
||||
cell: ({ row }) => (
|
||||
<Link
|
||||
to={`/online-payments-history/payments/${row.original.id}`}
|
||||
className="font-mono text-xs font-medium text-primary hover:underline"
|
||||
>
|
||||
{row.original.id}
|
||||
</Link>
|
||||
),
|
||||
size: 60,
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
id: "orderId",
|
||||
@@ -199,6 +231,7 @@ export default function OnlinePaymentHistoryPage() {
|
||||
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",
|
||||
@@ -206,6 +239,7 @@ export default function OnlinePaymentHistoryPage() {
|
||||
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",
|
||||
@@ -217,6 +251,7 @@ export default function OnlinePaymentHistoryPage() {
|
||||
</span>
|
||||
),
|
||||
size: 200,
|
||||
enableSorting: false,
|
||||
},
|
||||
{
|
||||
id: "passport",
|
||||
@@ -228,6 +263,7 @@ export default function OnlinePaymentHistoryPage() {
|
||||
</span>
|
||||
),
|
||||
size: 150,
|
||||
enableSorting: false,
|
||||
},
|
||||
{
|
||||
id: "totalAmountTmt",
|
||||
@@ -235,6 +271,7 @@ export default function OnlinePaymentHistoryPage() {
|
||||
header: t(COLUMN_LABEL_KEYS.totalAmountTmt, "TOTAL (TMT)"),
|
||||
cell: ({ row }) => <span className="tabular-nums text-foreground font-medium">{row.original.totalAmountTmt.toLocaleString()}</span>,
|
||||
size: 110,
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
id: "gatewayStatus",
|
||||
@@ -242,6 +279,7 @@ export default function OnlinePaymentHistoryPage() {
|
||||
header: t(COLUMN_LABEL_KEYS.gatewayStatus, "GATEWAY STATUS"),
|
||||
cell: ({ row }) => <GatewayStatusBadge status={row.original.gatewayStatus} />,
|
||||
size: 140,
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
id: "paid",
|
||||
@@ -249,6 +287,7 @@ export default function OnlinePaymentHistoryPage() {
|
||||
header: t(COLUMN_LABEL_KEYS.paid, "PAID"),
|
||||
cell: ({ row }) => <PaidBadge paid={row.original.paid} />,
|
||||
size: 90,
|
||||
enableSorting: false,
|
||||
},
|
||||
{
|
||||
id: "createdAt",
|
||||
@@ -258,6 +297,7 @@ export default function OnlinePaymentHistoryPage() {
|
||||
<span className="text-muted-foreground text-xs whitespace-nowrap">{formatDateTime(row.original.createdAt)}</span>
|
||||
),
|
||||
size: 140,
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
id: "actions",
|
||||
@@ -270,7 +310,7 @@ export default function OnlinePaymentHistoryPage() {
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-8 w-8 text-muted-foreground hover:text-foreground"
|
||||
onClick={() => navigate(`/online-payments-history/${row.original.orderId}`)}
|
||||
onClick={() => navigate(`/online-payments-history/payments/${row.original.id}`)}
|
||||
title={t("common.view", "Görmek")}
|
||||
>
|
||||
<Eye size={15} />
|
||||
@@ -331,6 +371,9 @@ export default function OnlinePaymentHistoryPage() {
|
||||
onColumnOrderChange={setColumnOrder}
|
||||
enableRowSelection
|
||||
getRowId={(row) => String(row.id)}
|
||||
sorting={sorting}
|
||||
onSortingChange={setSorting}
|
||||
manualSorting
|
||||
currentPage={page}
|
||||
totalPages={totalPages}
|
||||
totalCount={totalCount}
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
import { useParams, useNavigate, Link } from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { ArrowLeft, AlertTriangle } from "lucide-react";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { BentoGrid, BentoCard, InfoRow } from "@/components/viewPageComponents";
|
||||
import { GatewayStatusBadge, PaidBadge } from "@/features/onlinePaymentHistory/components/PaymentStatusBadge";
|
||||
import { useGetOnlinePaymentDetail, useGetOnlinePaymentById } from "@/features/onlinePaymentHistory/hooks/useOnlinePaymentsHistory";
|
||||
import { formatFromApiDate } from "@/lib/utils/dateUtils";
|
||||
import type { PaymentHistoryStep } from "@/features/onlinePaymentHistory/api/onlinePaymentsHistoryApi";
|
||||
import { rawEnumKey, type TranslateFn } from "@/constants/enumLabels";
|
||||
|
||||
function formatDateTime(iso: string | null | undefined): string {
|
||||
if (!iso) return "—";
|
||||
return formatFromApiDate(iso);
|
||||
}
|
||||
|
||||
function resolveLang(lang: string): "en" | "ru" | "tm" {
|
||||
if (lang === "ru") return "ru";
|
||||
if (lang === "tk") return "tm";
|
||||
return "en";
|
||||
}
|
||||
|
||||
function detailKeyLabel(key: string, t: TranslateFn): string {
|
||||
return t(`onlinePayments.detailKeys.${key}`, rawEnumKey(key));
|
||||
}
|
||||
|
||||
function StepTimelineRow({ step }: { step: PaymentHistoryStep }) {
|
||||
const { t } = useTranslation();
|
||||
const detailEntries = Object.entries(step.detail ?? {});
|
||||
|
||||
return (
|
||||
<div className="flex gap-4 relative">
|
||||
<div className="flex flex-col items-center">
|
||||
<div className="w-3 h-3 rounded-full bg-primary mt-1 shrink-0 z-10" />
|
||||
<div className="w-px flex-1 bg-border mt-1" />
|
||||
</div>
|
||||
|
||||
<div className="pb-6 flex-1 min-w-0">
|
||||
<div className="flex flex-wrap items-center gap-3 mb-1">
|
||||
<GatewayStatusBadge status={step.step} />
|
||||
<span className="text-xs text-muted-foreground whitespace-nowrap">{formatDateTime(step.createdAt)}</span>
|
||||
<span className="text-xs text-muted-foreground">{step.createdByName}</span>
|
||||
</div>
|
||||
|
||||
{detailEntries.length > 0 && (
|
||||
<div className="mt-2 rounded-md border bg-muted/30 px-3 py-2 space-y-1">
|
||||
{detailEntries.map(([key, value]) => (
|
||||
<div key={key} className="flex gap-2 text-xs">
|
||||
<span className="text-muted-foreground font-medium min-w-[120px]">{detailKeyLabel(key, t)}</span>
|
||||
<span className="text-foreground break-all">{String(value)}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function OnlinePaymentDetailViewPage() {
|
||||
const { id } = useParams<{ id: string }>();
|
||||
const navigate = useNavigate();
|
||||
const { t, i18n } = useTranslation();
|
||||
const lang = resolveLang(i18n.language);
|
||||
|
||||
const { data, isLoading, isError } = useGetOnlinePaymentDetail(id!);
|
||||
const { data: steps } = useGetOnlinePaymentById(data?.orderId ?? (data?.id || 0));
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<Skeleton className="h-8 w-64" />
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<Skeleton className="h-56 w-full rounded-xl" />
|
||||
<Skeleton className="h-56 w-full rounded-xl" />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (isError || !data) {
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center py-16 gap-4">
|
||||
<p className="text-muted-foreground">{t("common.notFound", "Maglumat tapylmady")}</p>
|
||||
<Button variant="outline" size="sm" onClick={() => navigate(-1)}>
|
||||
<ArrowLeft className="size-4 mr-2" />
|
||||
{t("common.back", "Yza")}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const branchName = data.branchName?.[lang] || data.branchName?.tm || data.branchName?.en || "—";
|
||||
const fullName = [data.passportName, data.passportSurname].filter(Boolean).join(" ");
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{/* ── Page Header ──────────────────────────────────────────────────────── */}
|
||||
<div className="flex items-center justify-between flex-wrap gap-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<Button variant="outline" size="icon" onClick={() => navigate(-1)} className="h-9 w-9">
|
||||
<ArrowLeft className="size-4" />
|
||||
</Button>
|
||||
<div>
|
||||
<div className="flex items-center gap-2">
|
||||
<h1 className="text-xl font-semibold text-foreground tracking-tight">
|
||||
{t("onlinePayments.paymentViewTitle", "Töleg maglumaty")}: #{data.id}
|
||||
</h1>
|
||||
<GatewayStatusBadge status={data.gatewayStatus} />
|
||||
<PaidBadge paid={data.paid} />
|
||||
</div>
|
||||
{data.orderNumber && (
|
||||
<p className="text-xs text-muted-foreground mt-0.5">
|
||||
{t("onlinePayments.columns.orderNumber", "Sargyt belgisi")}: {data.orderNumber}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{data.orderId && (
|
||||
<Button variant="secondary" size="sm" asChild>
|
||||
<Link to={`/visa-master/${data.orderId}`}>
|
||||
{t("onlinePayments.goToOrder", "Sargyda geç")} (#{data.orderId})
|
||||
</Link>
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* ── Error / Alert (if gateway response error exists) ─────────────────── */}
|
||||
{data.gatewayResponse && (data.gatewayResponse.errorCode || data.gatewayResponse.errorMessage) && (
|
||||
<div className="flex items-start gap-3 p-4 rounded-xl border border-destructive/30 bg-destructive/5 text-destructive">
|
||||
<AlertTriangle className="size-5 shrink-0 mt-0.5" />
|
||||
<div className="space-y-1 text-sm">
|
||||
<div className="font-semibold">
|
||||
Gateway Ýalňyşlygy {data.gatewayResponse.errorCode ? `(Kod: ${data.gatewayResponse.errorCode})` : ""}
|
||||
</div>
|
||||
{data.gatewayResponse.errorMessage && <div className="text-foreground/90">{data.gatewayResponse.errorMessage}</div>}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* ── Row 1: General & Financial Information ───────────────────────────── */}
|
||||
<BentoGrid cols={2}>
|
||||
<BentoCard title={t("onlinePayments.sectionGeneral", "Esasy maglumatlar")}>
|
||||
<InfoRow label={t("common.id", "ID")} value={data.id} />
|
||||
<InfoRow
|
||||
label={t("onlinePayments.columns.orderId", "Sargyt ID")}
|
||||
value={data.orderId}
|
||||
isLink={Boolean(data.orderId)}
|
||||
href={`/visa-master/${data.orderId}`}
|
||||
/>
|
||||
<InfoRow label={t("onlinePayments.columns.orderNumber", "Sargyt belgisi")} value={data.orderNumber || "—"} />
|
||||
<InfoRow label={t("onlinePayments.columns.orderUniqueId", "Sargyt unikal ID")} value={data.orderUniqueId || "—"} />
|
||||
<InfoRow label={t("onlinePayments.columns.type", "Görnüşi")}>
|
||||
<span className="text-xs font-semibold uppercase tracking-wide text-foreground">{data.type}</span>
|
||||
</InfoRow>
|
||||
<InfoRow label={t("onlinePayments.columns.description", "Düşündiriş")} value={data.description || "—"} />
|
||||
<InfoRow label={t("onlinePayments.columns.gatewayStatus", "Gateway statusy")}>
|
||||
<GatewayStatusBadge status={data.gatewayStatus} />
|
||||
</InfoRow>
|
||||
<InfoRow label={t("onlinePayments.columns.paid", "Töleg ýagdaýy")}>
|
||||
<PaidBadge paid={data.paid} />
|
||||
</InfoRow>
|
||||
<InfoRow label={t("onlinePayments.columns.createdAt", "Döredilen wagty")} value={formatDateTime(data.createdAt)} />
|
||||
<InfoRow label={t("onlinePayments.columns.updatedAt", "Täzelenen wagty")} value={formatDateTime(data.updatedAt)} />
|
||||
</BentoCard>
|
||||
|
||||
<BentoCard title={t("onlinePayments.sectionFinancial", "Maliýe maglumatlary")}>
|
||||
<InfoRow
|
||||
label={t("onlinePayments.columns.amountTmt", "Töleg möçberi (TMT)")}
|
||||
value={`${data.amountTmt?.toLocaleString?.() ?? data.amountTmt} TMT`}
|
||||
/>
|
||||
<InfoRow
|
||||
label={t("onlinePayments.columns.bankFeeTmt", "Bank komissiýasy")}
|
||||
value={`${data.bankFeeTmt?.toLocaleString?.() ?? data.bankFeeTmt} TMT`}
|
||||
/>
|
||||
<InfoRow
|
||||
label={t("onlinePayments.columns.gbusFeeTmt", "GBUS komissiýasy")}
|
||||
value={`${data.gbusFeeTmt?.toLocaleString?.() ?? data.gbusFeeTmt} TMT`}
|
||||
/>
|
||||
<InfoRow label={t("onlinePayments.columns.totalAmount", "Jemi töleg möçberi")}>
|
||||
<span className="font-semibold text-primary">{data.totalAmountTmt?.toLocaleString?.() ?? data.totalAmountTmt} TMT</span>
|
||||
</InfoRow>
|
||||
<InfoRow
|
||||
label={t("onlinePayments.columns.amountUsd", "Möçber (USD)")}
|
||||
value={data.amountUsd != null ? `${data.amountUsd} $` : "—"}
|
||||
/>
|
||||
<InfoRow
|
||||
label={t("onlinePayments.columns.exchangeRateUsd", "Hümmet (USD)")}
|
||||
value={data.exchangeRateUsd != null ? `${data.exchangeRateUsd} TMT` : "—"}
|
||||
/>
|
||||
<InfoRow
|
||||
label={t("onlinePayments.columns.paymentPeriod", "Töleg döwri")}
|
||||
value={data.paymentPeriod ? formatDateTime(data.paymentPeriod) : "—"}
|
||||
/>
|
||||
<InfoRow label={t("onlinePayments.columns.apiClient", "API Client")} value={data.apiClient || "—"} />
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
{/* ── Row 2: Customer & Branch Information ─────────────────────────────── */}
|
||||
<BentoGrid cols={2}>
|
||||
<BentoCard title={t("onlinePayments.sectionCustomer", "Müşderi we Ulanyjy")}>
|
||||
<InfoRow label={t("onlinePayments.columns.passport", "Müşderi")} value={fullName || "—"} />
|
||||
<InfoRow
|
||||
label={t("onlinePayments.columns.userId", "Ulanyjy ID")}
|
||||
value={data.userId}
|
||||
isLink={Boolean(data.userId)}
|
||||
href={`/all-users/${data.userId}`}
|
||||
/>
|
||||
<InfoRow
|
||||
label={t("onlinePayments.columns.createdByName", "Döreden işgär")}
|
||||
value={data.createdByName ? `${data.createdByName} (ID: ${data.createdById})` : "—"}
|
||||
/>
|
||||
</BentoCard>
|
||||
|
||||
<BentoCard title={t("onlinePayments.sectionBranch", "Şahamça maglumaty")}>
|
||||
<InfoRow
|
||||
label={t("onlinePayments.columns.branch", "Şahamça")}
|
||||
value={branchName}
|
||||
isLink={Boolean(data.branchId)}
|
||||
href={`/settings/location/branches/${data.branchId}`}
|
||||
/>
|
||||
<InfoRow label={t("onlinePayments.columns.branchId", "Şahamça ID")} value={data.branchId} />
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
{/* ── Row 3: Step-by-Step History Log (Timeline) ───────────────────────── */}
|
||||
{steps && steps.length > 0 && (
|
||||
<BentoCard title={t("onlinePayments.detail.stepsCount", "Ädimler taryhy")}>
|
||||
<div className="p-4">
|
||||
{steps.map((step) => (
|
||||
<StepTimelineRow key={step.id} step={step} />
|
||||
))}
|
||||
</div>
|
||||
</BentoCard>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user