removed local automatic barcode generation. changed barcode to string

This commit is contained in:
2026-06-10 19:07:23 -05:00
parent d317758569
commit 2e927efe0a
2 changed files with 3 additions and 11 deletions
+1 -9
View File
@@ -6,7 +6,6 @@ import {useNavigate} from "react-router";
import {IconX, IconCheck} from '@tabler/icons-react';
import {notifications} from '@mantine/notifications';
import useInventoryList from "./hooks/useInventoryList.tsx";
import {useEffect} from "react";
function AddItem() {
@@ -18,7 +17,7 @@ function AddItem() {
const newItemForm = useForm<NewItem>({
mode: 'uncontrolled',
initialValues: {
barcode: 0,
barcode: "",
name: "",
brand: "",
serialNumber: "",
@@ -68,13 +67,6 @@ function AddItem() {
})
useEffect(() => {
if (inventoryQuery.data) {
const nextBarcode = inventoryQuery.data[inventoryQuery.data.length - 1].barcode + 1;
newItemForm.setValues({barcode: nextBarcode});
}
},[inventoryQuery.data]);
if (inventoryQuery.isPending) return 'Loading...'
if (inventoryQuery.error) return 'An error has occurred: ' + inventoryQuery.error.message
+2 -2
View File
@@ -1,6 +1,6 @@
export interface InventoryItem {
id: number,
barcode: number,
barcode: string,
brand: string,
name: string,
status: {id: string; name: string},
@@ -12,7 +12,7 @@ export interface InventoryItem {
}
export interface NewItem {
barcode: number,
barcode: string,
brand: string,
name: string,
serialNumber: string,