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 axios from "axios"; 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 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.

( )} />
LaneID Lane AV Description Running Number In Ocme In Stock Result {data.length === 0 ? ( {Array(10) .fill(0) .map((_, i) => ( ))} ) : ( <> {data.map((i: any) => { let classname = ``; if ( i.info === "Quality Check Required" ) { classname = `bg-red-500`; } if (i.info === "Sent to Inv") { classname = `bg-amber-700`; } return ( {i.alpla_laneID} {i.alpla_laneDescription} {i.Article} {i.alpla_laneDescription} {i.runningNumber} {i.ocme} {i.stock} {i.info} ); })} )}
{/*
*/}
); }