This commit is contained in:
zadit frontend
2024-08-01 07:49:04 +00:00
parent e424195d2e
commit a158e44071
6 changed files with 191 additions and 19 deletions

View File

@@ -332,6 +332,12 @@ const Header = ({
</Child>
</>
)}
{user.username !== undefined &&
(user.roleId === 1 || user.roleId === 2) && (
<Child onClick={() => setModal("update_stock")}>
update stock
</Child>
)}
{user.username !== undefined && user.roleId === 2 && (
<Child hasChildren>
connected guest sides

View File

@@ -24,6 +24,7 @@ const Modal = ({ shopId, isOpen, onClose, modalContent }) => {
&times;
</button>
{modalContent === "edit_tables" && <TableMaps shopId={shopId} />}
{modalContent === "new_transaction" && <TableMaps shopId={shopId} />}
</div>
</div>
);

View File

@@ -101,10 +101,10 @@ const TableCanvas = ({ shopId }) => {
context.textBaseline = "middle";
context.fillText(
table.tableId === (selectedTable?.tableId || newTable?.tableId)
? tableNo == 0
? tableNo === 0
? "clerk"
: tableNo
: table.tableNo == 0
: table.tableNo === 0
? "clerk"
: table.tableNo,
table.xposition + rectWidth / 2,
@@ -257,9 +257,9 @@ const TableCanvas = ({ shopId }) => {
const handleSetTableNo = (event) => {
const newValue = event.target.value;
// Prevent setting value to '0' or starting with '0'
// if (newValue === "" || /^[1-9][0-9]*$/.test(newValue)) {
setTableNo(newValue);
// }
if (newValue === "" || /^[1-9][0-9]*$/.test(newValue)) {
setTableNo(newValue);
}
};
return (
@@ -333,6 +333,7 @@ const TableCanvas = ({ shopId }) => {
type="text"
placeholder="Table No"
value={tableNo}
disabled={tableNo === 0 ? "disabled" : ""}
onChange={handleSetTableNo}
style={{
marginRight: "10px",
@@ -376,8 +377,12 @@ const TableCanvas = ({ shopId }) => {
}}
onClick={() => handleSelect(table)}
>
Table {table.tableNo} - Position: ({table.xposition},{" "}
{table.yposition})
{
table.tableNo === 0
? "Clerk" // Display "Clerk" if tableNo is 0
: `Table ${table.tableNo}` // Display "Table {tableNo}" otherwise
}{" "}
- Position: ({table.xposition}, {table.yposition})
</li>
))}
</ul>