diff --git a/admin/src/components/ItemTable.tsx b/admin/src/components/ItemTable.tsx
index acc83fe..d18123e 100644
--- a/admin/src/components/ItemTable.tsx
+++ b/admin/src/components/ItemTable.tsx
@@ -10,6 +10,7 @@ import {
Heading,
Icon,
Tag,
+ Input,
} from "@chakra-ui/react";
import { Tooltip } from "@/components/ui/tooltip";
import MyAlert from "./myChakra/MyAlert";
@@ -19,10 +20,11 @@ import {
CirclePlus,
CheckCircle2,
XCircle,
+ Save,
} from "lucide-react";
import Cookies from "js-cookie";
import { useState, useEffect } from "react";
-import { deleteItem } from "@/utils/userActions";
+import { deleteItem, handleEditItems } from "@/utils/userActions";
import AddItemForm from "./AddItemForm";
import { formatDateTime } from "@/utils/userFuncs";
@@ -44,6 +46,18 @@ const ItemTable: React.FC = () => {
const [reload, setReload] = useState(false);
const [addForm, setAddForm] = useState(false);
+ const handleItemNameChange = (id: number, value: string) => {
+ setItems((prev) =>
+ prev.map((it) => (it.id === id ? { ...it, item_name: value } : it))
+ );
+ };
+
+ const handleCanBorrowRoleChange = (id: number, value: string) => {
+ setItems((prev) =>
+ prev.map((it) => (it.id === id ? { ...it, can_borrow_role: value } : it))
+ );
+ };
+
const setError = (
status: "error" | "success",
message: string,
@@ -180,8 +194,22 @@ const ItemTable: React.FC = () => {
{items.map((item) => (
{item.id}
- {item.item_name}
- {item.can_borrow_role}
+
+
+ handleItemNameChange(item.id, e.target.value)
+ }
+ value={item.item_name}
+ />
+
+
+
+ handleCanBorrowRoleChange(item.id, e.target.value)
+ }
+ value={item.can_borrow_role}
+ />
+
{item.inSafe ? (
{
{formatDateTime(item.entry_created_at)}
+