diff --git a/frontend/src/components/dashboard/Cards.tsx b/frontend/src/components/dashboard/Cards.tsx
index 379d7ef..3f9fe1c 100644
--- a/frontend/src/components/dashboard/Cards.tsx
+++ b/frontend/src/components/dashboard/Cards.tsx
@@ -1,25 +1,15 @@
import { useCardStore } from "@/lib/store/useCardStore";
-import { useForm } from "@tanstack/react-form";
import { Label } from "../ui/label";
import { Checkbox } from "../ui/checkbox";
-import { Input } from "../ui/input";
-// import {
-// Select,
-// SelectContent,
-// SelectGroup,
-// SelectItem,
-// SelectLabel,
-// SelectTrigger,
-// SelectValue,
-// } from "../ui/select";
import { Button } from "../ui/button";
+import { useAppForm } from "@/utils/formStuff";
export default function Cards(card: any) {
const { addCard, removeCard, cards } = useCardStore();
let existing: any = cards.filter((n: any) => n.name === card.name);
//console.log(existing);
- const form = useForm({
+ const form = useAppForm({
defaultValues: {
name: existing[0]?.name || card.name,
rowType: existing[0]?.type ?? card.rowType,
@@ -62,7 +52,7 @@ export default function Cards(card: any) {
}}
className="flex flex-row"
>
-
{!card.inventory && (
<>
-
- // value.length > 3
- // ? undefined
- // : "Username must be longer than 3 letters",
- // }}
- children={(field) => {
- return (
-
-
-
- field.handleChange(
- e.target.value
- )
- }
- />
-
- );
- }}
+ children={(field) => (
+
+ )}
/>
-
- {/* {}}}
- children={(field) => {
- return (
-
-
-
-
- );
- }}
- /> */}
>
)}
diff --git a/frontend/src/components/dashboard/DashBoard.tsx b/frontend/src/components/dashboard/DashBoard.tsx
index 45a1212..f4cc2b5 100644
--- a/frontend/src/components/dashboard/DashBoard.tsx
+++ b/frontend/src/components/dashboard/DashBoard.tsx
@@ -27,9 +27,10 @@ export default function DashBoard() {
);
} else {
+ //console.log(name.split("-")[0], a);
return (
-
+
);
}
diff --git a/frontend/src/components/logistics/warehouse/InventoryCard.tsx b/frontend/src/components/logistics/warehouse/InventoryCard.tsx
index 61e5a89..418f8c1 100644
--- a/frontend/src/components/logistics/warehouse/InventoryCard.tsx
+++ b/frontend/src/components/logistics/warehouse/InventoryCard.tsx
@@ -9,8 +9,12 @@ import { useQuery } from "@tanstack/react-query";
//import { toast } from "sonner";
export default function INVCheckCard(props: any) {
- //{ style = {} }
- const { data, isError, isLoading } = useQuery(getinventoryCheck(props));
+ const { age, rowType } = props.data;
+
+ //console.log(props.data);
+ const { data, isError, isLoading } = useQuery(
+ getinventoryCheck({ age: age })
+ );
if (isLoading) return Loading inventory data...
;
if (isError) {
@@ -23,11 +27,11 @@ export default function INVCheckCard(props: any) {
let laneData: any = data;
if (props.type != "") {
laneData = laneData.filter(
- (l: any) => l.rowType === props.type.toUpperCase()
+ (l: any) => l.rowType === rowType.toUpperCase()
);
// age
- laneData = laneData.filter((l: any) => l.DaysSinceLast >= props.age);
+ laneData = laneData.filter((l: any) => l.DaysSinceLast >= age);
}
// const handleCloseCard = () => {
@@ -36,5 +40,5 @@ export default function INVCheckCard(props: any) {
// toast.success("card removed");
// };
- return ;
+ return ;
}
diff --git a/frontend/src/components/ui/popover.tsx b/frontend/src/components/ui/popover.tsx
index 83728a8..6d51b6c 100644
--- a/frontend/src/components/ui/popover.tsx
+++ b/frontend/src/components/ui/popover.tsx
@@ -28,7 +28,7 @@ function PopoverContent({
align={align}
sideOffset={sideOffset}
className={cn(
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-hidden",
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
className
)}
{...props}
diff --git a/frontend/src/utils/formStuff/options/checkbox.tsx b/frontend/src/utils/formStuff/options/checkbox.tsx
new file mode 100644
index 0000000..d800f6d
--- /dev/null
+++ b/frontend/src/utils/formStuff/options/checkbox.tsx
@@ -0,0 +1,34 @@
+import { Checkbox } from "@radix-ui/react-checkbox";
+import { useFieldContext } from "..";
+import { Label } from "@/components/ui/label";
+import { FieldErrors } from "./FieldErrors";
+
+type CheckboxFieldProps = {
+ label: string;
+ description?: string;
+};
+
+export const CheckboxField = ({ label }: CheckboxFieldProps) => {
+ const field = useFieldContext();
+
+ return (
+
+
+
+
+
+
{
+ field.handleChange(checked === true);
+ }}
+ onBlur={field.handleBlur}
+ />
+
+
+
+ );
+};
diff --git a/frontend/src/utils/querys/logistics/getInventoryCheck.tsx b/frontend/src/utils/querys/logistics/getInventoryCheck.tsx
index a764bc2..80786f7 100644
--- a/frontend/src/utils/querys/logistics/getInventoryCheck.tsx
+++ b/frontend/src/utils/querys/logistics/getInventoryCheck.tsx
@@ -13,7 +13,7 @@ export function getinventoryCheck(data: any) {
}
const fetchStockSilo = async (info: any) => {
- console.log(info);
+ //console.log("What tpye of info:", info);
const { data } = await axios.post(`/api/logistics/cyclecountcheck`, {
age: info.age ? parseInt(info.age) : null,
type: "",