// ============================================================ // جدول «پیدا شده» — مفقودیهای باقیماندهی انبار (LOSS − FOUND) // با انتخاب انبار همهی مفقودیها میآیند و نام متریال فقط فیلتر است. // ============================================================ import type { InventoryTransaction } from "../../../lib/types"; import { faNum } from "../../../lib/formatters"; import { cn } from "../../../lib/utils"; import { specsLine, type RowDraft } from "./StockTable"; export interface LossItem { tx: InventoryTransaction; remaining: number; } interface FoundTableProps { items: LossItem[]; rows: RowDraft[]; setRows: (r: RowDraft[]) => void; unitNameFn: (id: number | null | undefined) => string; emptyMsg: string; loading?: boolean; } function parseLocal(s: string): number { const v = parseFloat(String(s).replace(/[۰-۹]/g, (d) => String("۰۱۲۳۴۵۶۷۸۹".indexOf(d))).replace(/[،,]/g, "")); return isFinite(v) ? v : 0; } export function FoundTable({ items, rows, setRows, unitNameFn, emptyMsg, loading }: FoundTableProps) { if (loading) { return
| متریال | مشخصهها | برند | واحد | مانده مفقودی | تعداد پیداشده | یادداشت |
|---|---|---|---|---|---|---|
| {tx.material?.name || "—"} | {specsLine(tx.specs)} | {tx.brand?.name || "—"} | {unitNameFn(tx.unit?.id)} | {faNum(remaining)} |
setRows(rows.map((x, xi) => (xi === i ? { ...x, qty: e.target.value } : x)))}
/>
{over && بیشتر از مفقودی! }
|
setRows(rows.map((x, xi) => (xi === i ? { ...x, note: e.target.value } : x)))} /> |