mirror of
https://github.com/BarkProductions/barkman.git
synced 2026-06-13 06:11:55 +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 {IconX, IconCheck} from '@tabler/icons-react';
|
||||||
import {notifications} from '@mantine/notifications';
|
import {notifications} from '@mantine/notifications';
|
||||||
import useInventoryList from "./hooks/useInventoryList.tsx";
|
import useInventoryList from "./hooks/useInventoryList.tsx";
|
||||||
import {useEffect} from "react";
|
|
||||||
|
|
||||||
|
|
||||||
function AddItem() {
|
function AddItem() {
|
||||||
@@ -18,7 +17,7 @@ function AddItem() {
|
|||||||
const newItemForm = useForm<NewItem>({
|
const newItemForm = useForm<NewItem>({
|
||||||
mode: 'uncontrolled',
|
mode: 'uncontrolled',
|
||||||
initialValues: {
|
initialValues: {
|
||||||
barcode: 0,
|
barcode: "",
|
||||||
name: "",
|
name: "",
|
||||||
brand: "",
|
brand: "",
|
||||||
serialNumber: "",
|
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.isPending) return 'Loading...'
|
||||||
if (inventoryQuery.error) return 'An error has occurred: ' + inventoryQuery.error.message
|
if (inventoryQuery.error) return 'An error has occurred: ' + inventoryQuery.error.message
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export interface InventoryItem {
|
export interface InventoryItem {
|
||||||
id: number,
|
id: number,
|
||||||
barcode: number,
|
barcode: string,
|
||||||
brand: string,
|
brand: string,
|
||||||
name: string,
|
name: string,
|
||||||
status: {id: string; name: string},
|
status: {id: string; name: string},
|
||||||
@@ -12,7 +12,7 @@ export interface InventoryItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface NewItem {
|
export interface NewItem {
|
||||||
barcode: number,
|
barcode: string,
|
||||||
brand: string,
|
brand: string,
|
||||||
name: string,
|
name: string,
|
||||||
serialNumber: string,
|
serialNumber: string,
|
||||||
|
|||||||
Reference in New Issue
Block a user