From c71b514d9add69c63e608b22bd8a936fa770b167 Mon Sep 17 00:00:00 2001 From: Blake Matthes Date: Tue, 25 Mar 2025 07:27:45 -0500 Subject: [PATCH] refactor(frontend): prettier change to formatting --- .../src/components/ocme/ocmeCycleCount.tsx | 382 ++++++++++-------- 1 file changed, 205 insertions(+), 177 deletions(-) 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.

-
-
-
-
- -
- ( - - )} - /> -
-
- -
-
-
-
- - - - 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} - - ); - })} - - )} -
-
-
-
- {/*
+ 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}` }, + }); + console.log(data); + toast.success(res.data.message); + setData(res.data.data); + setCounting(false); + reset(); + } catch (error) { + console.log(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} + + + ); + })} + + )} +
+
+
+
+ {/*
*/} -
- ); +
+ ); }