diff --git a/frontend/src/components/ocme/ocmeCycleCount.tsx b/frontend/src/components/ocme/ocmeCycleCount.tsx index 71c4348..9b8c33e 100644 --- a/frontend/src/components/ocme/ocmeCycleCount.tsx +++ b/frontend/src/components/ocme/ocmeCycleCount.tsx @@ -1,185 +1,213 @@ -import {toast} from "sonner"; -import {LstCard} from "../extendedUI/LstCard"; -import {Button} from "../ui/button"; -import {Input} from "../ui/input"; -import {Table, TableBody, TableCell, TableHead, TableHeader, TableRow} from "../ui/table"; -import {Skeleton} from "../ui/skeleton"; +import { toast } from "sonner"; +import { LstCard } from "../extendedUI/LstCard"; +import { Button } from "../ui/button"; +import { Input } from "../ui/input"; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "../ui/table"; +import { Skeleton } from "../ui/skeleton"; //import CycleCountLog from "./CycleCountLog"; -import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from "../ui/select"; -import {Controller, useForm} from "react-hook-form"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "../ui/select"; +import { Controller, useForm } from "react-hook-form"; import axios from "axios"; -import {useState} from "react"; +import { useState } from "react"; export default function OcmeCycleCount() { - const token = localStorage.getItem("auth_token"); - const [data, setData] = useState([]); - const [counting, setCounting] = useState(false); - const { - register, - handleSubmit, - //watch, - formState: {errors}, - reset, - control, - } = useForm(); + const token = localStorage.getItem("auth_token"); + const [data, setData] = useState([]); + const [counting, setCounting] = useState(false); + const { + register, + handleSubmit, + //watch, + formState: { errors }, + reset, + control, + } = useForm(); - const onSubmit = async (data: any) => { - setData([]); - setCounting(true); - toast.success(`Cycle count started`); - try { - const res = await axios.post("/ocme/api/v1/cyclecount", data, { - headers: {Authorization: `Bearer ${token}`}, - }); - toast.success(res.data.message); - setData(res.data.data); - setCounting(false); - reset(); - } catch (error) { - toast.error("There was an error cycle counting"); - setCounting(false); - reset(); - } - }; - return ( -
Please enter the name or laneID you want to cycle count.
-+ Please enter the name or laneID you want to cycle count. +
+