diff --git a/database/migrations/0067_shallow_trish_tilby.sql b/database/migrations/0067_shallow_trish_tilby.sql new file mode 100644 index 0000000..3d75d93 --- /dev/null +++ b/database/migrations/0067_shallow_trish_tilby.sql @@ -0,0 +1 @@ +ALTER TABLE "printerData" ADD COLUMN "processes" jsonb DEFAULT '[]'::jsonb; \ No newline at end of file diff --git a/frontend/src/components/logistics/materialHelper/consumption/PreformReturn.tsx b/frontend/src/components/logistics/materialHelper/consumption/PreformReturn.tsx new file mode 100644 index 0000000..460b0c7 --- /dev/null +++ b/frontend/src/components/logistics/materialHelper/consumption/PreformReturn.tsx @@ -0,0 +1,149 @@ +import { LstCard } from "@/components/extendedUI/LstCard"; +import { Button } from "@/components/ui/button"; +import { CardHeader } from "@/components/ui/card"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { useSessionStore } from "@/lib/store/sessionStore"; +import axios from "axios"; +import { useState } from "react"; + +import { useForm } from "react-hook-form"; +import { toast } from "sonner"; + +export default function PreformReturn() { + const { + register: register1, + handleSubmit: handleSubmit1, + reset, + } = useForm(); + const [submitting, setSubmitting] = useState(false); + const { token } = useSessionStore(); + + const handleConsume = async (data: any) => { + setSubmitting(true); + try { + const result = await axios.post(`/api/logistics/consume`, data, { + headers: { Authorization: `Bearer ${token}` }, + }); + if (result.data.success) { + toast.success(result.data.message); + setSubmitting(false); + reset(); + } + if (!result.data.success) { + //console.log(result.data); + setSubmitting(false); + + toast.error(result.data.message); + } + } catch (error: any) { + //console.log(error); + setSubmitting(false); + if (error.status === 401) { + toast.error("Unauthorized to do this task."); + } else { + toast.error( + "Unexpected error if this continues please constact an admin." + ); + } + } + }; + return ( +
+ + +

Preform Return.

+
+
+
+ +
+
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+ + +
+
+
+
+ +
+
    +
  1. + 1. Enter the running number of the + preform cage you would like to return +
  2. +
  3. + 2. Enter the new weight of the gaylord +
  4. +
  5. + 3. Select the printer you would like to + print to +
  6. +
+

+ *As soon as you press preform return it will + print a new label and return to the staging + location. +

+
+
+
+
+
+
+ ); +}