diff --git a/src/pages/Products.jsx b/src/pages/Products.jsx index 9639679..5aad77c 100644 --- a/src/pages/Products.jsx +++ b/src/pages/Products.jsx @@ -16,6 +16,7 @@ import { HiOutlineSearch, HiOutlineCube, HiOutlineX, + HiOutlinePrinter, } from "react-icons/hi"; const CATEGORIES = [ @@ -184,6 +185,104 @@ export default function Products() { return matchesSearch && matchesCategory; }); + const handlePrintProducts = () => { + const printWindow = window.open("", "_blank"); + + if (!printWindow) { + toast.error("تعذر فتح نافذة الطباعة"); + return; + } + + const rows = filteredProducts + .map((product, index) => { + const category = getCategoryMeta(product.category); + const totalValue = + (Number(product.quantity) || 0) * (Number(product.purchasePrice) || 0); + + return ` +
عدد المنتجات المطبوعة: ${filteredProducts.length}
+| # | +اسم المنتج | +الفئة | +الكمية | +سعر الشراء | +إجمالي القيمة | +الحالة | +
|---|
{products.length} منتج في المخزون