mirror of
https://github.com/BarkProductions/barkman.git
synced 2026-06-12 22:11:54 +00:00
removed local automatic barcode generation. changed barcode to string
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user