diff --git a/app/admin/stock/page.tsx b/app/admin/stock/page.tsx new file mode 100644 index 0000000..e9721a8 --- /dev/null +++ b/app/admin/stock/page.tsx @@ -0,0 +1,45 @@ +/** + * Stock Management Page + * Full page for managing inventory and stock levels + */ + +"use client"; + +import { useAuth } from "@/lib/hooks/useAuth"; +import { useRouter } from "next/navigation"; +import { useEffect } from "react"; +import Navbar from "@/components/NavBar"; +import StockManagementDashboard from "@/components/products/StockManagementDashboard"; + +export default function StockManagementPage() { + const { isAdmin, isLoading } = useAuth(); + const router = useRouter(); + + useEffect(() => { + if (!isLoading && !isAdmin) { + router.push("/dashboard"); + } + }, [isAdmin, isLoading, router]); + + if (isLoading) { + return ( +
+ {product.description || "No description."} +
+This product does not have additional variants.
+ ) : ( ++ Showing {products.length} of{" "} + {pagination.total} products +
++ Monitor inventory levels and manage stock +
+{successMessage}
+Low Stock Items
++ {lowStockItems.length} +
+Out of Stock
++ {lowStockItems.filter((item) => item.stock === 0).length} +
+Pending Updates
++ {bulkUpdates.length} +
++ {item.productTitle} +
+{item.variantName}
+Current
++ {item.currentStock} +
+{error}
+All products are well stocked!
+| + Product + | ++ Variant + | ++ Stock + | ++ Status + | ++ Price + | ++ Actions + | +
|---|---|---|---|---|---|
|
+
+ {item.product?.title || "Unknown"}
+
+ |
+
+
+ {variantName}
+
+ |
+
+
+ {item.stock} units
+
+ |
+ + + {stockStatus.label} + + | +
+
+ {formatCurrency(
+ item.priceOverride || item.product?.price || 0,
+ item.product?.currency || "ETB"
+ )}
+
+ |
+ + + | +