refactor(frontend): prettier change to formatting
This commit is contained in:
@@ -2,10 +2,23 @@ import {toast} from "sonner";
|
|||||||
import { LstCard } from "../extendedUI/LstCard";
|
import { LstCard } from "../extendedUI/LstCard";
|
||||||
import { Button } from "../ui/button";
|
import { Button } from "../ui/button";
|
||||||
import { Input } from "../ui/input";
|
import { Input } from "../ui/input";
|
||||||
import {Table, TableBody, TableCell, TableHead, TableHeader, TableRow} from "../ui/table";
|
import {
|
||||||
|
Table,
|
||||||
|
TableBody,
|
||||||
|
TableCell,
|
||||||
|
TableHead,
|
||||||
|
TableHeader,
|
||||||
|
TableRow,
|
||||||
|
} from "../ui/table";
|
||||||
import { Skeleton } from "../ui/skeleton";
|
import { Skeleton } from "../ui/skeleton";
|
||||||
//import CycleCountLog from "./CycleCountLog";
|
//import CycleCountLog from "./CycleCountLog";
|
||||||
import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from "../ui/select";
|
import {
|
||||||
|
Select,
|
||||||
|
SelectContent,
|
||||||
|
SelectItem,
|
||||||
|
SelectTrigger,
|
||||||
|
SelectValue,
|
||||||
|
} from "../ui/select";
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
@@ -28,24 +41,29 @@ export default function OcmeCycleCount() {
|
|||||||
setCounting(true);
|
setCounting(true);
|
||||||
toast.success(`Cycle count started`);
|
toast.success(`Cycle count started`);
|
||||||
try {
|
try {
|
||||||
const res = await axios.post("/ocme/api/v1/cyclecount", data, {
|
const res = await axios.post("/ocme/api/v1/cycleCount", data, {
|
||||||
headers: { Authorization: `Bearer ${token}` },
|
headers: { Authorization: `Bearer ${token}` },
|
||||||
});
|
});
|
||||||
|
console.log(data);
|
||||||
toast.success(res.data.message);
|
toast.success(res.data.message);
|
||||||
setData(res.data.data);
|
setData(res.data.data);
|
||||||
setCounting(false);
|
setCounting(false);
|
||||||
reset();
|
reset();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
toast.error("There was an error cycle counting");
|
toast.error("There was an error cycle counting");
|
||||||
setCounting(false);
|
setCounting(false);
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-row w-screen">
|
<div className="flex flex-row w-screen">
|
||||||
<div className="m-2 w-5/6">
|
<div className="m-2 w-5/6">
|
||||||
<LstCard>
|
<LstCard>
|
||||||
<p className="ml-2">Please enter the name or laneID you want to cycle count.</p>
|
<p className="ml-2">
|
||||||
|
Please enter the name or laneID you want to cycle count.
|
||||||
|
</p>
|
||||||
<div>
|
<div>
|
||||||
<form onSubmit={handleSubmit(onSubmit)}>
|
<form onSubmit={handleSubmit(onSubmit)}>
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
@@ -78,7 +96,7 @@ export default function OcmeCycleCount() {
|
|||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value="name">Name</SelectItem>
|
<SelectItem value="name">Name</SelectItem>
|
||||||
<SelectItem value="laneId">Lane ID</SelectItem>
|
<SelectItem value="laneID">Lane ID</SelectItem>
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
)}
|
)}
|
||||||
@@ -86,7 +104,11 @@ export default function OcmeCycleCount() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Button className="m-2" type="submit" disabled={counting}>
|
<Button className="m-2" type="submit" disabled={counting}>
|
||||||
{counting ? <span>Counting...</span> : <span>CycleCount</span>}
|
{counting ? (
|
||||||
|
<span>Counting...</span>
|
||||||
|
) : (
|
||||||
|
<span>CycleCount</span>
|
||||||
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@@ -105,7 +127,7 @@ export default function OcmeCycleCount() {
|
|||||||
<TableHead>Result</TableHead>
|
<TableHead>Result</TableHead>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHeader>
|
</TableHeader>
|
||||||
{data.length === 0 ? (
|
{data?.length === 0 ? (
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{Array(10)
|
{Array(10)
|
||||||
.fill(0)
|
.fill(0)
|
||||||
@@ -140,7 +162,7 @@ export default function OcmeCycleCount() {
|
|||||||
</TableBody>
|
</TableBody>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{data.map((i: any) => {
|
{data?.map((i: any) => {
|
||||||
let classname = ``;
|
let classname = ``;
|
||||||
if (i.info === "Quality Check Required") {
|
if (i.info === "Quality Check Required") {
|
||||||
classname = `bg-red-500`;
|
classname = `bg-red-500`;
|
||||||
@@ -165,9 +187,15 @@ export default function OcmeCycleCount() {
|
|||||||
<TableCell className={`font-medium ${classname}`}>
|
<TableCell className={`font-medium ${classname}`}>
|
||||||
{i.runningNumber}
|
{i.runningNumber}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={`font-medium ${classname}`}>{i.ocme}</TableCell>
|
<TableCell className={`font-medium ${classname}`}>
|
||||||
<TableCell className={`font-medium ${classname}`}>{i.stock}</TableCell>
|
{i.ocme}
|
||||||
<TableCell className={`font-medium ${classname}`}>{i.info}</TableCell>
|
</TableCell>
|
||||||
|
<TableCell className={`font-medium ${classname}`}>
|
||||||
|
{i.stock}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell className={`font-medium ${classname}`}>
|
||||||
|
{i.info}
|
||||||
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
Reference in New Issue
Block a user