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 ConsumeMaterial() { const {register: register1, handleSubmit: handleSubmit1, reset} = useForm(); const [submitting, setSubmitting] = useState(false); const {token} = useSessionStore(); const handleConsume = async (data: any) => { setSubmitting(!submitting); try { const result = await axios.post(`/api/logistics/consume`, data, { headers: {Authorization: `Bearer ${token}`}, }); if (result.data.success) { toast.success(result.data.message); setSubmitting(!submitting); reset(); } if (!result.data.success) { //console.log(result.data); setSubmitting(!submitting); toast.error(result.data.message); } } catch (error: any) { //console.log(error); setSubmitting(!submitting); if (error.status === 401) { toast.error("Unauthorized to do this task."); } else { toast.error("Unexpected error if this continues please constact an admin."); } } }; return (

Consuming Material.

  1. 1. Enter the running number of the material you would like to consume
  2. 2. Enter the lot number you will be consuming to
  3. 3. Press consume material

*This process is only for barcoded material, if it is set to auto consume you will encounter and error.

); }