Files
ERP/frontend/src/pages/Dashboard/LedgerTable.tsx
T

53 lines
1.6 KiB
TypeScript

import { Inbox } from "lucide-react";
import type { Quote, Store } from "../../lib/types";
import { QuoteCard } from "./QuoteCard";
import { EmptyState } from "../../components/EmptyState";
export interface LedgerTableProps {
store: Store;
quotes: Quote[];
expanded: Set<string>;
onToggleExpand: (id: string) => void;
onAccept: (id: string) => void;
onEdit: (id: string) => void;
canWrite?: boolean;
}
// دفتر پیشنهادها — فهرست کارت‌ها (واکنش‌گرا و بهینه برای موبایل)
export function LedgerTable({
store,
quotes,
expanded,
onToggleExpand,
onAccept,
onEdit,
canWrite = true,
}: LedgerTableProps) {
if (!quotes.length) {
return (
<div className="rounded-xl border border-line bg-panel p-2 sm:rounded-lg">
<EmptyState icon={Inbox} text="پیشنهادی مطابق فیلترها یافت نشد" />
</div>
);
}
return (
<div className="flex flex-col gap-2.5 sm:gap-3">
{quotes.map((q) => (
<QuoteCard
key={q.id}
store={store}
q={q}
expanded={expanded.has(q.id)}
onToggleExpand={() => onToggleExpand(q.id)}
onAccept={() => onAccept(q.id)}
onEdit={() => onEdit(q.id)}
canWrite={canWrite}
/>
))}
<div className="px-2 py-3 text-center text-[10.5px] leading-5 text-muted sm:py-1 sm:text-[11px]">
هشدار «منقضی» = قیمت پیشنهادی از تاریخ انقضا گذشته؛ برای پیش‌بینی قیمت، شمارش نمی‌شود.
</div>
</div>
);
}