floor delete method changed to put method.
This commit is contained in:
parent
ab8ed33cd2
commit
7bed4a6576
@ -55,7 +55,7 @@ const DineInInner = () => {
|
||||
description: "",
|
||||
});
|
||||
const [floorErrors, setFloorErrors] = useState({});
|
||||
const [floorDeleteConfirm, setFloorDeleteConfirm] = useState({ show: false, id: null });
|
||||
const [floorDeleteConfirm, setFloorDeleteConfirm] = useState({ show: false, id: null, isDeleted: null });
|
||||
|
||||
// Room
|
||||
const [showRoomModal, setShowRoomModal] = useState(false);
|
||||
@ -216,8 +216,11 @@ const DineInInner = () => {
|
||||
|
||||
const handleFloorDelete = async () => {
|
||||
try {
|
||||
await client.delete(`/Dine360 Floor/${floorDeleteConfirm.id}`);
|
||||
setFloorDeleteConfirm({ show: false, id: null });
|
||||
const body = {
|
||||
isdeleted: floorDeleteConfirm?.isDeleted == 0 ? 1 : 0
|
||||
}
|
||||
await client.put(`/Dine360 Floor/${floorDeleteConfirm.id}`, body);
|
||||
setFloorDeleteConfirm({ show: false, id: null, isDeleted: null });
|
||||
getFloor();
|
||||
} catch (error) {
|
||||
if (
|
||||
@ -491,7 +494,11 @@ const DineInInner = () => {
|
||||
getRoomData(floor.name);
|
||||
}}
|
||||
>
|
||||
<div className="card-body px-3 py-1 d-flex align-items-center justify-content-center" >
|
||||
<div className="card-body px-3 py-1 d-flex gap-2 align-items-center justify-content-center" >
|
||||
{
|
||||
floor?.isdeleted == 1 && (<Icon icon="mdi:block-helper" style={{color:"red"}}/>)
|
||||
}
|
||||
|
||||
<span
|
||||
className="text-truncate text-sm fw-semibold w-100"
|
||||
title={floor.floorname}
|
||||
@ -522,9 +529,17 @@ const DineInInner = () => {
|
||||
<li>
|
||||
<Link className="dropdown-item px-16 py-8 d-flex align-items-center gap-2 rounded text-secondary-light bg-hover-neutral-200 text-hover-neutral-900" href="#" onClick={(e) => {
|
||||
e.preventDefault();
|
||||
setFloorDeleteConfirm({ show: true, id: floor.name });
|
||||
setFloorDeleteConfirm({ show: true, id: floor.name, isDeleted: floor.isdeleted });
|
||||
}}>
|
||||
<Icon icon="fluent:delete-24-regular" /> Delete
|
||||
{floor.isdeleted === 1 ? (
|
||||
<>
|
||||
<Icon icon="mdi:restore" /> Restore
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Icon icon="fluent:delete-24-regular" /> Delete
|
||||
</>
|
||||
)}
|
||||
</Link>
|
||||
</li>
|
||||
</ul>
|
||||
@ -577,7 +592,7 @@ const DineInInner = () => {
|
||||
type="button"
|
||||
data-bs-toggle="dropdown"
|
||||
>
|
||||
<Icon icon="entypo:dots-three-vertical" />
|
||||
<Icon icon="entypo:dots-three-vertical" />
|
||||
</button>
|
||||
<ul className="dropdown-menu">
|
||||
<li>
|
||||
@ -825,23 +840,29 @@ const DineInInner = () => {
|
||||
|
||||
<div className="modal-body">
|
||||
<div className="d-flex justify-content-between mb-1">
|
||||
<h6 className="text-lg mb-0">Confirm Delete</h6>
|
||||
<h6 className="text-lg mb-0">
|
||||
{floorDeleteConfirm?.isDeleted === 0 ? "Confirm to Delete" : "Confirm to Restore"}
|
||||
</h6>
|
||||
<button
|
||||
type="button"
|
||||
className="btn-close"
|
||||
onClick={() => setFloorDeleteConfirm({ show: false, id: null })}
|
||||
onClick={() => setFloorDeleteConfirm({ show: false, id: null, isDeleted: null })}
|
||||
></button>
|
||||
</div>
|
||||
<p className="m-0">Are you sure you want to delete this floor?</p>
|
||||
<p className="m-0">
|
||||
{floorDeleteConfirm?.isDeleted === 0
|
||||
? "Are you sure you want to set this floor as Delete?"
|
||||
: "Are you sure you want to set this floor as Restore?"}
|
||||
</p>
|
||||
<div className="d-flex justify-content-end gap-2 mt-1 ">
|
||||
<button
|
||||
className="btn btn-outline-danger px-14 py-6 text-sm"
|
||||
onClick={() => setFloorDeleteConfirm({ show: false, id: null })}
|
||||
onClick={() => setFloorDeleteConfirm({ show: false, id: null, isDeleted: null })}
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
<button className="btn btn-danger px-14 py-6 text-sm" onClick={handleFloorDelete}>
|
||||
Delete
|
||||
{floorDeleteConfirm?.isDeleted === 0 ? "Delete" : "Restore"}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user