added card icon logic to sber payments
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { useState, useMemo, useCallback } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { CreditCard } from "lucide-react";
|
||||
import type { ColumnDef, VisibilityState } from "@tanstack/react-table";
|
||||
|
||||
import { DataTable } from "@/components/dataTable";
|
||||
@@ -17,6 +18,7 @@ import { useInfiniteBranches } from "@/features/shared/hooks/useSharedBranchUser
|
||||
import { useInfiniteUsers } from "@/features/allUsers/hooks/useAllUsers";
|
||||
import type { SberPaymentOrderItem, SberPaymentStatus } from "@/features/sberPayments/api/sberPaymentsApi";
|
||||
import type { LocalizedText } from "@/features/branches/api/branchesApi";
|
||||
import { PayDialog } from "@/features/visaMasterPayments/components/PayDialog";
|
||||
|
||||
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -49,6 +51,7 @@ export default function SberPaymentsListPage() {
|
||||
const deleteMutation = useDeleteSberPaymentReal();
|
||||
|
||||
const [deleteTarget, setDeleteTarget] = useState<SberPaymentOrderItem | null>(null);
|
||||
const [payTarget, setPayTarget] = useState<SberPaymentOrderItem | null>(null);
|
||||
const [page, setPage] = useState(1);
|
||||
const [perPage, setPerPage] = useState(25);
|
||||
const [search, setSearch] = useState("");
|
||||
@@ -217,6 +220,17 @@ export default function SberPaymentsListPage() {
|
||||
onEdit={() => navigate(`/sber-payments/${row.original.id}/edit`)}
|
||||
onDelete={() => setDeleteTarget(row.original)}
|
||||
isDeleting={deleteMutation.isPending}
|
||||
extraActions={
|
||||
row.original.status === "approved"
|
||||
? [
|
||||
{
|
||||
icon: CreditCard,
|
||||
title: t("intlPayment.pay.action", "Töleg et"),
|
||||
onClick: () => setPayTarget(row.original),
|
||||
},
|
||||
]
|
||||
: []
|
||||
}
|
||||
/>
|
||||
),
|
||||
size: 90,
|
||||
@@ -364,6 +378,14 @@ export default function SberPaymentsListPage() {
|
||||
}}
|
||||
isLoading={deleteMutation.isPending}
|
||||
/>
|
||||
|
||||
<PayDialog
|
||||
id={payTarget?.id ? String(payTarget.id) : ""}
|
||||
open={payTarget !== null}
|
||||
onOpenChange={(open) => {
|
||||
if (!open) setPayTarget(null);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@ import { format } from "date-fns";
|
||||
import { Search, Download } from "lucide-react";
|
||||
import { useParams, useNavigate } from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useState } from "react";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { StatusCell } from "@/constants";
|
||||
import { BentoGrid, BentoCard, InfoRow, AuditLog, ViewActions, type AuditRowProps } from "@/components/viewPageComponents";
|
||||
import { useIntlPayment, useDeleteIntlPayment } from "@/features/visaMasterPayments/hooks/useVisaMasterPayments";
|
||||
import { PaymentHistoryTable } from "@/features/visaMasterPayments/components/PaymentHistoryTable";
|
||||
import { ACCEPTED_DOC_DEFS, SENT_DOC_DEFS, docLabel, type TFn } from "@/features/sberPayments/constants/documents";
|
||||
|
||||
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
||||
@@ -88,7 +88,6 @@ export default function SberPaymentViewPage() {
|
||||
const t: TFn = (key, fallback) => _t(key, fallback ?? key) as string;
|
||||
const { id } = useParams<{ id: string }>();
|
||||
const navigate = useNavigate();
|
||||
const [historySearch, setHistorySearch] = useState("");
|
||||
|
||||
const { data: order, isLoading } = useIntlPayment(id ?? "");
|
||||
const deleteMutation = useDeleteIntlPayment();
|
||||
@@ -223,29 +222,7 @@ export default function SberPaymentViewPage() {
|
||||
{/* ── Row 5: Töleg taryhy ───────────────────────────────────────────── */}
|
||||
<BentoGrid cols={1}>
|
||||
<BentoCard title={t("sberPayments.view.sections.paymentHistory", "Töleg taryhy")}>
|
||||
<div className="p-4">
|
||||
<div className="relative max-w-xs mb-4">
|
||||
<Search size={13} className="absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground" />
|
||||
<input
|
||||
type="text"
|
||||
value={historySearch}
|
||||
onChange={(e) => setHistorySearch(e.target.value)}
|
||||
placeholder={t("common.search", "Gözlemek")}
|
||||
className="h-9 w-full pl-9 pr-3 rounded-md border border-border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col items-center justify-center py-10 text-muted-foreground/50">
|
||||
<div className="w-12 h-12 mb-3 rounded-lg border-2 border-dashed border-muted-foreground/20 flex items-center justify-center">
|
||||
<svg viewBox="0 0 24 24" className="w-6 h-6" fill="none" stroke="currentColor" strokeWidth={1.5}>
|
||||
<rect x="3" y="3" width="18" height="18" rx="2" />
|
||||
<line x1="3" y1="9" x2="21" y2="9" />
|
||||
<line x1="9" y1="21" x2="9" y2="9" />
|
||||
</svg>
|
||||
</div>
|
||||
<p className="text-sm">{t("sberPayments.view.noPaymentHistory", "Berlen kriteriýalara Töleg gabat gelmedi.")}</p>
|
||||
</div>
|
||||
</div>
|
||||
<PaymentHistoryTable orderId={order.id} />
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user