diff --git a/frontend/src/components/production/ocp/ManualPrinting/ManualPrintForm.tsx b/frontend/src/components/production/ocp/ManualPrinting/ManualPrintForm.tsx index bbff004..d4f085c 100644 --- a/frontend/src/components/production/ocp/ManualPrinting/ManualPrintForm.tsx +++ b/frontend/src/components/production/ocp/ManualPrinting/ManualPrintForm.tsx @@ -30,6 +30,7 @@ import { toast } from "sonner"; const printReason = [ { key: "printerIssue", label: "Printer Related" }, { key: "missingRfidTag", label: "Missing or incorrect tag" }, + { key: "rfidMissScan", label: "Missed Scan from RFID reader" }, { key: "strapper", label: "Strapper Error" }, { key: "manualCheck", label: "20th pallet check" }, { key: "outOfSync", label: "Labeler Out of Sync" }, @@ -39,6 +40,7 @@ export default function ManualPrintForm() { const token = localStorage.getItem("auth_token"); const { settings } = useSettingStore(); const [open, setOpen] = useState(false); + const [isSubmitting, setIsSubmitting] = useState(false); const server = settings.filter((n) => n.name === "server")[0]?.value; // const serverPort = settings.filter((n) => n.name === "serverPort")[0]?.value; // const serverUrl = `http://${server}:${serverPort}`; @@ -57,6 +59,7 @@ export default function ManualPrintForm() { const handleManualPrintLog = async (logData: any) => { // toast.success(`A new label was sent to printer: ${lot.PrinterName} for line ${lot.MachineDescription} `); const logdataUrl = `/api/ocp/manuallabellog`; + setIsSubmitting(true); axios .post(logdataUrl, logData, { headers: { Authorization: `Bearer ${token}` }, @@ -70,16 +73,19 @@ export default function ManualPrintForm() { } reset(); setOpen(false); + setIsSubmitting(false); }) .catch((e) => { if (e.response.status === 500) { toast.error(`Internal Server error please try again.`); + setIsSubmitting(false); return { sucess: false }; } if (e.response.status === 401) { //console.log(e.response); toast.error(`You are not authorized to do this.`); + setIsSubmitting(false); return { sucess: false }; } }); @@ -250,7 +256,11 @@ export default function ManualPrintForm() { > Close -