added wifi icon to online history
This commit is contained in:
@@ -189,8 +189,10 @@ export async function fetchOnlinePaymentById(id: number): Promise<any[]> {
|
||||
* GET /payment-history/payments/:id
|
||||
* Returns a single payment's detailed information.
|
||||
*/
|
||||
export async function fetchOnlinePaymentDetail(id: number | string): Promise<OnlinePaymentDetail> {
|
||||
const { data } = await apiClient.get<OnlinePaymentDetail>(`/payment-history/payments/${id}`);
|
||||
export async function fetchOnlinePaymentDetail(id: number | string, lang?: string): Promise<OnlinePaymentDetail> {
|
||||
const { data } = await apiClient.get<OnlinePaymentDetail>(`/payment-history/payments/${id}`, {
|
||||
params: lang ? { lang } : undefined,
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ export const onlinePaymentKeys = {
|
||||
lists: () => [...onlinePaymentKeys.all, "list"] as const,
|
||||
list: (params: OnlinePaymentListParams) => [...onlinePaymentKeys.lists(), params] as const,
|
||||
detail: (id: number | string) => [...onlinePaymentKeys.all, "detail", String(id)] as const,
|
||||
paymentDetail: (id: number | string) => [...onlinePaymentKeys.all, "paymentDetail", String(id)] as const,
|
||||
paymentDetail: (id: number | string, lang?: string) => [...onlinePaymentKeys.all, "paymentDetail", String(id), lang ?? ""] as const,
|
||||
paymentGateway: (id: number | string) => [...onlinePaymentKeys.all, "paymentGateway", String(id)] as const,
|
||||
orderHistory: (id: number | string, params: Record<string, unknown>) =>
|
||||
[...onlinePaymentKeys.all, "orderHistory", String(id), params] as const,
|
||||
@@ -52,10 +52,10 @@ export function useGetOnlinePaymentById(id: number | string) {
|
||||
/**
|
||||
* Fetches the detailed payment record from /payment-history/payments/:id
|
||||
*/
|
||||
export function useGetOnlinePaymentDetail(id: number | string) {
|
||||
export function useGetOnlinePaymentDetail(id: number | string, options?: { lang?: string }) {
|
||||
return useQuery({
|
||||
queryKey: onlinePaymentKeys.paymentDetail(id),
|
||||
queryFn: () => fetchOnlinePaymentDetail(id),
|
||||
queryKey: onlinePaymentKeys.paymentDetail(id, options?.lang),
|
||||
queryFn: () => fetchOnlinePaymentDetail(id, options?.lang),
|
||||
enabled: !!id,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { formatFromApiPhone, formatToApiPhone } from "@/lib/utils";
|
||||
import { isStatusValue } from "@/constants";
|
||||
import type { LocalizedText } from "@/features/branches/api/branchesApi";
|
||||
import { postFile, buildFileUrl } from "@/features/shared/api/sharedApi";
|
||||
import type { GatewayResponse } from "@/features/onlinePaymentHistory/api/onlinePaymentsHistoryApi";
|
||||
|
||||
// ─── Shared types ─────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -56,6 +57,7 @@ export interface PaymentResultResponse {
|
||||
paymentPeriod: string;
|
||||
gatewayStatus: "pending" | "success" | "failed" | string;
|
||||
gatewayReference?: string;
|
||||
gatewayResponse?: GatewayResponse;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
@@ -428,8 +430,10 @@ export const intlPaymentApi = {
|
||||
return res.data as PayResponse;
|
||||
},
|
||||
|
||||
async status(id: string): Promise<PaymentResultResponse> {
|
||||
const { data } = await apiClient.get<PaymentResultResponse>(`/visa-master-payment-orders/${id}/status`);
|
||||
async status(id: string, lang?: string): Promise<PaymentResultResponse> {
|
||||
const { data } = await apiClient.get<PaymentResultResponse>(`/visa-master-payment-orders/${id}/status`, {
|
||||
params: lang ? { lang } : undefined,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type React from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Database, AlertTriangle, Eye, ExternalLink } from "lucide-react";
|
||||
import { AlertTriangle, Database, Eye, ExternalLink } from "lucide-react";
|
||||
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from "@/components/ui/dialog";
|
||||
@@ -23,9 +23,8 @@ interface PaymentDetailDialogProps {
|
||||
}
|
||||
|
||||
export function PaymentDetailDialog({ paymentId, open, onOpenChange }: PaymentDetailDialogProps) {
|
||||
const { t, i18n } = useTranslation();
|
||||
const lang = resolveLang(i18n.language);
|
||||
const { data, isLoading, isError } = useGetOnlinePaymentDetail(paymentId ?? 0);
|
||||
const { t } = useTranslation();
|
||||
const { data, isLoading, isError } = useGetOnlinePaymentDetail(paymentId ?? 0, { lang: "tm" });
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
@@ -34,147 +33,42 @@ export function PaymentDetailDialog({ paymentId, open, onOpenChange }: PaymentDe
|
||||
<div className="flex items-center gap-2 pr-6 flex-wrap">
|
||||
<Database className="size-5 text-primary shrink-0" />
|
||||
<DialogTitle className="text-base font-semibold">
|
||||
{t("onlinePayments.paymentViewTitle", "Töleg maglumaty")}: #{paymentId}
|
||||
{t("onlinePayments.paymentViewTitle", "Halk bankdan gelen netije")}: #{paymentId}
|
||||
</DialogTitle>
|
||||
{data && (
|
||||
<>
|
||||
<GatewayStatusBadge status={data.gatewayStatus} />
|
||||
<PaidBadge paid={data.paid} />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{data?.orderNumber && (
|
||||
<DialogDescription className="text-xs">
|
||||
{t("onlinePayments.columns.orderNumber", "Sargyt belgisi")}: {data.orderNumber}
|
||||
</DialogDescription>
|
||||
)}
|
||||
<DialogDescription className="text-xs">{t("onlinePayments.gatewayResponse.title", "Gateway response")}</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
{isLoading ? (
|
||||
<div className="space-y-3 py-2">
|
||||
<Skeleton className="h-6 w-1/3" />
|
||||
<Skeleton className="h-4 w-1/2" />
|
||||
<Skeleton className="h-28 w-full rounded-lg" />
|
||||
<Skeleton className="h-28 w-full rounded-lg" />
|
||||
<Skeleton className="h-72 w-full rounded-lg" />
|
||||
</div>
|
||||
) : isError || !data ? (
|
||||
<div className="py-8 text-center text-sm text-destructive">{t("common.error", "Maglumat ýüklenende ýalňyşlyk ýüze çykdy")}</div>
|
||||
) : (
|
||||
<div className="space-y-3 text-xs">
|
||||
{/* Gateway error alert */}
|
||||
{data.gatewayResponse && (data.gatewayResponse.errorCode || data.gatewayResponse.errorMessage) && (
|
||||
<div className="flex items-start gap-2.5 p-3 rounded-lg border border-destructive/30 bg-destructive/10 text-destructive">
|
||||
<AlertTriangle className="size-4 shrink-0 mt-0.5" />
|
||||
<div className="space-y-0.5">
|
||||
<div className="space-y-3">
|
||||
{data.gatewayResponse && (data.gatewayResponse.errorCode != null || data.gatewayResponse.errorMessage) && (
|
||||
<div className="flex items-start gap-2.5 rounded-lg border border-destructive/30 bg-destructive/10 p-3 text-destructive">
|
||||
<AlertTriangle className="mt-0.5 size-4 shrink-0" />
|
||||
<div className="space-y-0.5 text-xs">
|
||||
<div className="font-semibold">
|
||||
Gateway ýalňyşlygy {data.gatewayResponse.errorCode ? `(${data.gatewayResponse.errorCode})` : ""}
|
||||
{t("onlinePayments.gatewayErrorTitle", "Gateway error")}
|
||||
{data.gatewayResponse.errorCode != null && (
|
||||
<span>
|
||||
{" "}
|
||||
({t("onlinePayments.gateway.errorCode", "Error code")}: {data.gatewayResponse.errorCode})
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{data.gatewayResponse.errorMessage && <div>{data.gatewayResponse.errorMessage}</div>}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Section 1: General */}
|
||||
<div className="rounded-lg border border-border p-3 space-y-2 bg-muted/10">
|
||||
<p className="font-semibold text-muted-foreground uppercase text-[11px] tracking-wide">
|
||||
{t("onlinePayments.sectionGeneral", "Esasy maglumatlar")}
|
||||
</p>
|
||||
<div className="space-y-1.5">
|
||||
<Row label={t("common.id", "ID")}>
|
||||
<span className="font-mono font-medium">{data.id}</span>
|
||||
</Row>
|
||||
<Row label={t("onlinePayments.columns.orderId", "Sargyt ID")}>
|
||||
<Link to={`/visa-master/${data.orderId}`} className="font-mono text-primary hover:underline">
|
||||
#{data.orderId}
|
||||
</Link>
|
||||
</Row>
|
||||
<Row label={t("onlinePayments.columns.orderNumber", "Sargyt belgisi")}>
|
||||
<span className="font-mono">{data.orderNumber || "—"}</span>
|
||||
</Row>
|
||||
<Row label={t("onlinePayments.columns.type", "Görnüşi")}>
|
||||
<span className="uppercase font-medium">{data.type}</span>
|
||||
</Row>
|
||||
{data.description && (
|
||||
<Row label={t("onlinePayments.columns.description", "Düşündiriş")}>
|
||||
<span>{data.description}</span>
|
||||
</Row>
|
||||
)}
|
||||
<Row label={t("onlinePayments.columns.createdAt", "Döredilen wagty")}>
|
||||
<span>{formatFromApiDate(data.createdAt)}</span>
|
||||
</Row>
|
||||
<Row label={t("onlinePayments.columns.updatedAt", "Täzelenen wagty")}>
|
||||
<span>{formatFromApiDate(data.updatedAt)}</span>
|
||||
</Row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Section 2: Financial */}
|
||||
<div className="rounded-lg border border-border p-3 space-y-2 bg-muted/10">
|
||||
<p className="font-semibold text-muted-foreground uppercase text-[11px] tracking-wide">
|
||||
{t("onlinePayments.sectionFinancial", "Maliýe maglumatlary")}
|
||||
</p>
|
||||
<div className="space-y-1.5">
|
||||
<Row label={t("onlinePayments.columns.amountTmt", "Töleg möçberi")}>
|
||||
<span className="font-medium">{data.amountTmt?.toLocaleString?.() ?? data.amountTmt} TMT</span>
|
||||
</Row>
|
||||
<Row label={t("onlinePayments.columns.totalAmount", "Jemi töleg möçberi")}>
|
||||
<span className="font-semibold text-primary">{data.totalAmountTmt?.toLocaleString?.() ?? data.totalAmountTmt} TMT</span>
|
||||
</Row>
|
||||
<Row label={t("onlinePayments.columns.bankFeeTmt", "Bank komissiýasy")}>
|
||||
<span>{data.bankFeeTmt?.toLocaleString?.() ?? data.bankFeeTmt} TMT</span>
|
||||
</Row>
|
||||
<Row label={t("onlinePayments.columns.gbusFeeTmt", "GBUS komissiýasy")}>
|
||||
<span>{data.gbusFeeTmt?.toLocaleString?.() ?? data.gbusFeeTmt} TMT</span>
|
||||
</Row>
|
||||
{data.amountUsd != null && (
|
||||
<Row label={t("onlinePayments.columns.amountUsd", "Möçber (USD)")}>
|
||||
<span>{data.amountUsd} $</span>
|
||||
</Row>
|
||||
)}
|
||||
{data.exchangeRateUsd != null && (
|
||||
<Row label={t("onlinePayments.columns.exchangeRateUsd", "Hümmet (USD)")}>
|
||||
<span>{data.exchangeRateUsd} TMT</span>
|
||||
</Row>
|
||||
)}
|
||||
{data.paymentPeriod && (
|
||||
<Row label={t("onlinePayments.columns.paymentPeriod", "Töleg döwri")}>
|
||||
<span>{formatFromApiDate(data.paymentPeriod)}</span>
|
||||
</Row>
|
||||
)}
|
||||
{data.apiClient && (
|
||||
<Row label={t("onlinePayments.columns.apiClient", "API Client")}>
|
||||
<span className="font-mono">{data.apiClient}</span>
|
||||
</Row>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Section 3: Customer & Branch */}
|
||||
<div className="rounded-lg border border-border p-3 space-y-2 bg-muted/10">
|
||||
<p className="font-semibold text-muted-foreground uppercase text-[11px] tracking-wide">
|
||||
{t("onlinePayments.sectionCustomer", "Müşderi we Şahamça")}
|
||||
</p>
|
||||
<div className="space-y-1.5">
|
||||
<Row label={t("onlinePayments.columns.passport", "Müşderi")}>
|
||||
<span className="font-medium">{[data.passportName, data.passportSurname].filter(Boolean).join(" ") || "—"}</span>
|
||||
</Row>
|
||||
<Row label={t("onlinePayments.columns.userId", "Ulanyjy ID")}>
|
||||
<Link to={`/all-users/${data.userId}`} className="font-mono text-primary hover:underline">
|
||||
#{data.userId}
|
||||
</Link>
|
||||
</Row>
|
||||
<Row label={t("onlinePayments.columns.branch", "Şahamça")}>
|
||||
<span>
|
||||
{(typeof data.branchName === "string"
|
||||
? data.branchName
|
||||
: data.branchName?.[lang] || data.branchName?.tm || data.branchName?.en) || "—"}
|
||||
</span>
|
||||
</Row>
|
||||
<Row label={t("onlinePayments.columns.createdByName", "Döreden işgär")}>
|
||||
<span>{data.createdByName || "—"}</span>
|
||||
</Row>
|
||||
</div>
|
||||
</div>
|
||||
<pre className="max-h-[65vh] overflow-auto rounded-lg border border-border bg-muted/30 p-4 text-xs leading-5 text-foreground whitespace-pre-wrap break-all">
|
||||
{JSON.stringify(data.gatewayResponse ?? {}, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
)}
|
||||
</DialogContent>
|
||||
|
||||
@@ -95,11 +95,11 @@ export function usePayIntlPayment() {
|
||||
});
|
||||
}
|
||||
|
||||
export function useCheckIntlPaymentStatus() {
|
||||
export function useCheckIntlPaymentStatus(lang = "tm") {
|
||||
const qc = useQueryClient();
|
||||
const { t } = useTranslation();
|
||||
return useMutation({
|
||||
mutationFn: (id: string) => intlPaymentApi.status(id),
|
||||
mutationFn: (id: string) => intlPaymentApi.status(id, lang),
|
||||
onSuccess: (data) => {
|
||||
qc.invalidateQueries({ queryKey: INTL_PAYMENT_KEYS.lists() });
|
||||
qc.invalidateQueries({ queryKey: INTL_PAYMENT_KEYS.detail(String(data.orderId)) });
|
||||
|
||||
@@ -1649,6 +1649,12 @@
|
||||
"onlinePayments.gatewayCardSection": "Card and bank details",
|
||||
"onlinePayments.callbackSection": "Callback and connection",
|
||||
"onlinePayments.gatewayErrorTitle": "Gateway error",
|
||||
"onlinePayments.gatewayResponse.title": "Gateway response",
|
||||
"onlinePayments.statusCheck.open": "Check payment status",
|
||||
"onlinePayments.statusCheck.title": "Check payment status",
|
||||
"onlinePayments.statusCheck.confirmDescription": "Are you sure you want to check this payment status?",
|
||||
"onlinePayments.statusCheck.resultDescription": "Response received from Halk Bank",
|
||||
"onlinePayments.statusCheck.confirm": "Check status",
|
||||
"onlinePayments.gateway.orderStatus": "Gateway order status",
|
||||
"onlinePayments.gateway.errorCode": "Error code",
|
||||
"onlinePayments.gateway.errorMessage": "Gateway response",
|
||||
|
||||
@@ -1650,6 +1650,12 @@
|
||||
"onlinePayments.gatewayCardSection": "Данные карты и банка",
|
||||
"onlinePayments.callbackSection": "Callback и соединение",
|
||||
"onlinePayments.gatewayErrorTitle": "Ошибка шлюза",
|
||||
"onlinePayments.gatewayResponse.title": "Ответ шлюза",
|
||||
"onlinePayments.statusCheck.open": "Проверить статус платежа",
|
||||
"onlinePayments.statusCheck.title": "Проверка статуса платежа",
|
||||
"onlinePayments.statusCheck.confirmDescription": "Вы уверены, что хотите проверить статус этого платежа?",
|
||||
"onlinePayments.statusCheck.resultDescription": "Ответ, полученный от Halk Bank",
|
||||
"onlinePayments.statusCheck.confirm": "Проверить статус",
|
||||
"onlinePayments.gateway.orderStatus": "Статус заказа в шлюзе",
|
||||
"onlinePayments.gateway.errorCode": "Код ошибки",
|
||||
"onlinePayments.gateway.errorMessage": "Ответ шлюза",
|
||||
|
||||
@@ -1648,6 +1648,12 @@
|
||||
"onlinePayments.gatewayCardSection": "Kart we bank maglumatlary",
|
||||
"onlinePayments.callbackSection": "Callback we baglanyşyk",
|
||||
"onlinePayments.gatewayErrorTitle": "Gateway ýalňyşlygy",
|
||||
"onlinePayments.gatewayResponse.title": "Gateway jogaby",
|
||||
"onlinePayments.statusCheck.open": "Töleg ýagdaýyny barla",
|
||||
"onlinePayments.statusCheck.title": "Töleg ýagdaýyny barlamak",
|
||||
"onlinePayments.statusCheck.confirmDescription": "Bu tölegiň ýagdaýyny barlamak isleýäňizmi?",
|
||||
"onlinePayments.statusCheck.resultDescription": "Halk bankdan gelen netije",
|
||||
"onlinePayments.statusCheck.confirm": "Ýagdaýy barla",
|
||||
"onlinePayments.gateway.orderStatus": "Gateway sargyt statusy",
|
||||
"onlinePayments.gateway.errorCode": "Ýalňyşlyk kody",
|
||||
"onlinePayments.gateway.errorMessage": "Gateway jogaby",
|
||||
|
||||
102
src/pages/onlinePaymentsHistory/PaymentStatusDialog.tsx
Normal file
102
src/pages/onlinePaymentsHistory/PaymentStatusDialog.tsx
Normal file
@@ -0,0 +1,102 @@
|
||||
import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { AlertTriangle, Wifi } from "lucide-react";
|
||||
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog";
|
||||
import { useCheckIntlPaymentStatus } from "@/features/visaMasterPayments/hooks/useVisaMasterPayments";
|
||||
|
||||
interface PaymentStatusDialogProps {
|
||||
orderId: number | null;
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
}
|
||||
|
||||
export function PaymentStatusDialog({ orderId, open, onOpenChange }: PaymentStatusDialogProps) {
|
||||
const { t } = useTranslation();
|
||||
const [result, setResult] = useState<Awaited<ReturnType<ReturnType<typeof useCheckIntlPaymentStatus>["mutateAsync"]>> | null>(null);
|
||||
const statusMutation = useCheckIntlPaymentStatus("tm");
|
||||
|
||||
const handleOpenChange = (nextOpen: boolean) => {
|
||||
if (!nextOpen) {
|
||||
setResult(null);
|
||||
statusMutation.reset();
|
||||
}
|
||||
onOpenChange(nextOpen);
|
||||
};
|
||||
|
||||
const handleConfirm = async () => {
|
||||
if (orderId === null) return;
|
||||
const response = await statusMutation.mutateAsync(String(orderId));
|
||||
setResult(response);
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={handleOpenChange}>
|
||||
<DialogContent className="max-h-[85vh] overflow-y-auto sm:max-w-lg">
|
||||
<DialogHeader>
|
||||
<div className="flex items-center gap-2 pr-6">
|
||||
<Wifi className="size-5 text-primary" />
|
||||
<DialogTitle>{t("onlinePayments.statusCheck.title", "Check payment status")}</DialogTitle>
|
||||
</div>
|
||||
<DialogDescription>
|
||||
{result
|
||||
? t("onlinePayments.statusCheck.resultDescription", "Halk bankdan gelen netije")
|
||||
: t("onlinePayments.statusCheck.confirmDescription", "Are you sure you want to check this payment status?")}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
{statusMutation.isPending ? (
|
||||
<div className="space-y-3 py-2">
|
||||
<Skeleton className="h-6 w-1/3" />
|
||||
<Skeleton className="h-72 w-full rounded-lg" />
|
||||
</div>
|
||||
) : statusMutation.isError ? (
|
||||
<div className="space-y-4">
|
||||
<p className="text-sm text-destructive">{t("common.error", "An error occurred")}</p>
|
||||
<Button variant="outline" onClick={() => statusMutation.reset()}>
|
||||
{t("common.retry", "Retry")}
|
||||
</Button>
|
||||
</div>
|
||||
) : result ? (
|
||||
<div className="space-y-3">
|
||||
{result.gatewayResponse && (result.gatewayResponse.errorCode != null || result.gatewayResponse.errorMessage) && (
|
||||
<div className="flex items-start gap-2.5 rounded-lg border border-destructive/30 bg-destructive/10 p-3 text-destructive">
|
||||
<AlertTriangle className="mt-0.5 size-4 shrink-0" />
|
||||
<div className="space-y-0.5 text-xs">
|
||||
<div className="font-semibold">
|
||||
{t("onlinePayments.gatewayErrorTitle", "Gateway error")}
|
||||
{result.gatewayResponse.errorCode != null && (
|
||||
<span>
|
||||
{" "}
|
||||
({t("onlinePayments.gateway.errorCode", "Error code")}: {result.gatewayResponse.errorCode})
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{result.gatewayResponse.errorMessage && <div>{result.gatewayResponse.errorMessage}</div>}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{/* <GatewayStatusBadge status={result.gatewayStatus} /> */}
|
||||
{/* <PaidBadge paid={result.paid} /> */}
|
||||
</div>
|
||||
<pre className="max-h-[65vh] overflow-auto rounded-lg border border-border bg-muted/30 p-4 text-xs leading-5 text-foreground whitespace-pre-wrap break-all">
|
||||
{JSON.stringify(result.gatewayResponse ?? {}, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button variant="outline" onClick={() => handleOpenChange(false)}>
|
||||
{t("common.cancel", "Cancel")}
|
||||
</Button>
|
||||
<Button onClick={handleConfirm} disabled={orderId === null}>
|
||||
{t("onlinePayments.statusCheck.confirm", "Check status")}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
import { useState, useMemo, useCallback } from "react";
|
||||
import { useNavigate, Link } from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Eye } from "lucide-react";
|
||||
import { Eye, WifiSync } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { DataTable, type ColumnDef, type SortingState } from "@/components/dataTable";
|
||||
import { DataTableToolbar, type ActiveFilter, type FilterField } from "@/components/dataTableToolbar";
|
||||
@@ -14,6 +14,7 @@ import { GatewayStatusBadge, PaidBadge } from "../../features/onlinePaymentHisto
|
||||
import { getPaymentHistoryStatusOptions } from "@/constants/paymentStatus";
|
||||
import { useInfiniteBranches } from "@/features/branches/hooks/useBranches";
|
||||
import { resolveLocalizedName } from "@/features/branches/api/branchesApi";
|
||||
import { PaymentStatusDialog } from "./PaymentStatusDialog";
|
||||
|
||||
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -76,6 +77,7 @@ export default function OnlinePaymentHistoryPage() {
|
||||
const [page, setPage] = useState(1);
|
||||
const [perPage, setPerPage] = useState(25);
|
||||
const [search, setSearch] = useState("");
|
||||
const [statusOrderId, setStatusOrderId] = useState<number | null>(null);
|
||||
|
||||
// ─── Column state
|
||||
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>(DEFAULT_VISIBILITY);
|
||||
@@ -307,6 +309,15 @@ export default function OnlinePaymentHistoryPage() {
|
||||
enableHiding: false,
|
||||
cell: ({ row }) => (
|
||||
<div className="flex items-center justify-end gap-1">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-8 w-8 text-muted-foreground hover:text-foreground"
|
||||
onClick={() => setStatusOrderId(row.original.orderId)}
|
||||
title={t("onlinePayments.statusCheck.open", "Check payment status")}
|
||||
>
|
||||
<WifiSync size={15} />
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
@@ -380,6 +391,13 @@ export default function OnlinePaymentHistoryPage() {
|
||||
totalCount={totalCount}
|
||||
onPageChange={setPage}
|
||||
/>
|
||||
<PaymentStatusDialog
|
||||
orderId={statusOrderId}
|
||||
open={statusOrderId !== null}
|
||||
onOpenChange={(open) => {
|
||||
if (!open) setStatusOrderId(null);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ export default function OnlinePaymentDetailPage() {
|
||||
<div>
|
||||
<h1 className="text-xl font-semibold text-foreground mb-6">
|
||||
{t("onlinePayments.detail.title", "Onlaýn töleg taryhy giňişleýin")}
|
||||
{orderId ? ` — Order #${orderId}` : ""} ffffffffffffffffffffffffffff
|
||||
{orderId ? ` — Order #${orderId}` : ""}
|
||||
</h1>
|
||||
|
||||
<Section>
|
||||
|
||||
@@ -66,7 +66,7 @@ export default function OnlinePaymentDetailViewPage() {
|
||||
<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}
|
||||
{t("onlinePayments.paymentViewTitle", "Halk bankdan gelen netije")}: #{data.id}
|
||||
</h1>
|
||||
{/* <GatewayStatusBadge status={data.gatewayStatus} /> */}
|
||||
{/* <PaidBadge paid={data.paid} /> */}
|
||||
|
||||
Reference in New Issue
Block a user