diff --git a/src/app/warehouse/page.tsx b/src/app/warehouse/page.tsx index e92591e..74a0cac 100644 --- a/src/app/warehouse/page.tsx +++ b/src/app/warehouse/page.tsx @@ -1,4 +1,5 @@ "use client"; +import Image from "next/image"; import axios from "axios"; import useSWR from "swr"; import { Dispatch, SetStateAction, useMemo, useState } from "react"; @@ -80,7 +81,7 @@ function FilterInput({ // Modal Component for Bulk Logging function BulkLogModal({ onClose }: { onClose: () => void }) { const [palletNote, setPalletNote] = useState(""); - const [warehouseLocation, setWarehouseLocation] = useState(""); + const [warehouseArea, setWarehouseArea] = useState(""); const [error, setError] = useState(""); const [isSubmitting, setIsSubmitting] = useState(false); @@ -91,7 +92,7 @@ function BulkLogModal({ onClose }: { onClose: () => void }) { }; async function handleLog() { - if (!palletNote || !warehouseLocation) { + if (!palletNote || !warehouseArea) { setError("All fields are required."); return; } @@ -99,10 +100,10 @@ function BulkLogModal({ onClose }: { onClose: () => void }) { try { await axios.post("/api/warehouse/log-bulk", { palletNote, - warehouseLocation, + warehouseArea, }); - alert(`Logged bulk pallet to storage: ${warehouseLocation}`); + alert(`Logged bulk pallet to storage: ${warehouseArea}`); onClose(); } catch { setError("Failed to log pallet. Please try again."); @@ -130,11 +131,11 @@ function BulkLogModal({ onClose }: { onClose: () => void }) { /> setWarehouseLocation(e.target.value)} + placeholder="Warehouse Area (e.g., B-05)" + value={warehouseArea} + onChange={(e) => setWarehouseArea(e.target.value)} className="w-full p-2 border border-neutral-300 rounded-md placeholder-neutral-400 focus:ring-2 focus:ring-blue-500" - aria-label="Storage Location" + aria-label="Warehouse Area" disabled={isSubmitting} /> @@ -185,7 +186,7 @@ function LogModal({ onClose }: { onClose: () => void }) { const [type, setType] = useState(""); const [description, setDescription] = useState(""); const [earthquakeCode, setEarthquakeCode] = useState(""); - const [warehouseLocation, setWarehouseLocation] = useState(""); + const [warehouseArea, setWarehouseArea] = useState(""); const [isRequired, setIsRequired] = useState(true); const [error, setError] = useState(""); const [isSubmitting, setIsSubmitting] = useState(false); @@ -213,7 +214,7 @@ function LogModal({ onClose }: { onClose: () => void }) { }; async function handleLog() { - if (!name || !type || !description || !earthquakeCode || !warehouseLocation) { + if (!name || !type || !description || !earthquakeCode || !warehouseArea) { setError("All fields are required."); return; } @@ -228,7 +229,7 @@ function LogModal({ onClose }: { onClose: () => void }) { formData.append("type", type); formData.append("description", description); formData.append("earthquakeCode", earthquakeCode); - formData.append("warehouseLocation", warehouseLocation); + formData.append("warehouseArea", warehouseArea); if (image) { formData.append("image", image); } @@ -237,7 +238,7 @@ function LogModal({ onClose }: { onClose: () => void }) { headers: { "Content-Type": "multipart/form-data" }, }); - alert(`Logged ${name} to storage: ${warehouseLocation}`); + alert(`Logged ${name} to storage: ${warehouseArea}`); onClose(); } catch { setError("Failed to log artefact. Please try again."); @@ -301,11 +302,11 @@ function LogModal({ onClose }: { onClose: () => void }) { /> setWarehouseLocation(e.target.value)} + placeholder="Warehouse Area (e.g., A-12)" + value={warehouseArea} + onChange={(e) => setWarehouseArea(e.target.value)} className="w-full p-2 border border-neutral-300 rounded-md placeholder-neutral-400 focus:ring-2 focus:ring-blue-500" - aria-label="Storage Location" + aria-label="Warehouse Area" disabled={isSubmitting} />
{error}
}Created At: {new Date(artefact.createdAt).toLocaleDateString("en-GB")}
setWarehouseLocation(e.target.value)} + placeholder="Warehouse Area (e.g., A-12)" + value={warehouseArea} + onChange={(e) => setWarehouseArea(e.target.value)} className="w-full p-2 border border-neutral-300 rounded-md placeholder-neutral-400 focus:ring-2 focus:ring-blue-500" aria-label="Storage Location" disabled={isSubmitting} /> -