+ |
+
+ {(field) => (
+ field.handleChange(e.target.value)}
+ onBlur={field.handleBlur}
+ size="sm"
+ />
+ )}
+
+ |
+
+
+ {(field) => (
+ field.handleChange(e.target.value)}
+ onBlur={field.handleBlur}
+ size="sm"
+ />
+ )}
+
+ |
+ {formatDate(storage.created_at)} |
+ {formatDate(storage.updated_at)} |
+
+
+ |
+
+ );
+};
diff --git a/frontend/src/misc/interfaces.ts b/frontend/src/misc/interfaces.ts
index 10f4a25..501d6cd 100644
--- a/frontend/src/misc/interfaces.ts
+++ b/frontend/src/misc/interfaces.ts
@@ -20,3 +20,11 @@ export type ProductFormValues = {
price: string;
storage_location_uuid: string;
};
+
+export interface Storage {
+ name: string;
+ description: string | null;
+ created_at: string;
+ updated_at: string;
+ uuid: string;
+}
\ No newline at end of file
diff --git a/frontend/src/pages/Inventory.tsx b/frontend/src/pages/Inventory.tsx
index 6930358..308385c 100644
--- a/frontend/src/pages/Inventory.tsx
+++ b/frontend/src/pages/Inventory.tsx
@@ -28,6 +28,7 @@ import ArrowDownwardIcon from "@mui/icons-material/ArrowDownward";
import { useQuery } from "@tanstack/react-query";
import { getProducts } from "../utils/uxFncs";
import { visuallyHidden } from "@mui/utils";
+import { formatDate } from "../utils/uxFncs";
type Order = "asc" | "desc";
@@ -47,17 +48,6 @@ type ProductRow = {
refillDate: string;
};
-const formatDate = (value?: string | null) => {
- if (!value) {
- return "-";
- }
- const date = new Date(value);
- if (Number.isNaN(date.getTime())) {
- return "-";
- }
- return date.toLocaleDateString("de-DE");
-};
-
const descendingComparator =