floor delete method changed to put method.
This commit is contained in:
parent
ab8ed33cd2
commit
7bed4a6576
@ -55,7 +55,7 @@ const DineInInner = () => {
|
|||||||
description: "",
|
description: "",
|
||||||
});
|
});
|
||||||
const [floorErrors, setFloorErrors] = useState({});
|
const [floorErrors, setFloorErrors] = useState({});
|
||||||
const [floorDeleteConfirm, setFloorDeleteConfirm] = useState({ show: false, id: null });
|
const [floorDeleteConfirm, setFloorDeleteConfirm] = useState({ show: false, id: null, isDeleted: null });
|
||||||
|
|
||||||
// Room
|
// Room
|
||||||
const [showRoomModal, setShowRoomModal] = useState(false);
|
const [showRoomModal, setShowRoomModal] = useState(false);
|
||||||
@ -216,8 +216,11 @@ const DineInInner = () => {
|
|||||||
|
|
||||||
const handleFloorDelete = async () => {
|
const handleFloorDelete = async () => {
|
||||||
try {
|
try {
|
||||||
await client.delete(`/Dine360 Floor/${floorDeleteConfirm.id}`);
|
const body = {
|
||||||
setFloorDeleteConfirm({ show: false, id: null });
|
isdeleted: floorDeleteConfirm?.isDeleted == 0 ? 1 : 0
|
||||||
|
}
|
||||||
|
await client.put(`/Dine360 Floor/${floorDeleteConfirm.id}`, body);
|
||||||
|
setFloorDeleteConfirm({ show: false, id: null, isDeleted: null });
|
||||||
getFloor();
|
getFloor();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (
|
if (
|
||||||
@ -491,7 +494,11 @@ const DineInInner = () => {
|
|||||||
getRoomData(floor.name);
|
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
|
<span
|
||||||
className="text-truncate text-sm fw-semibold w-100"
|
className="text-truncate text-sm fw-semibold w-100"
|
||||||
title={floor.floorname}
|
title={floor.floorname}
|
||||||
@ -522,9 +529,17 @@ const DineInInner = () => {
|
|||||||
<li>
|
<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) => {
|
<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();
|
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>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -577,7 +592,7 @@ const DineInInner = () => {
|
|||||||
type="button"
|
type="button"
|
||||||
data-bs-toggle="dropdown"
|
data-bs-toggle="dropdown"
|
||||||
>
|
>
|
||||||
<Icon icon="entypo:dots-three-vertical" />
|
<Icon icon="entypo:dots-three-vertical" />
|
||||||
</button>
|
</button>
|
||||||
<ul className="dropdown-menu">
|
<ul className="dropdown-menu">
|
||||||
<li>
|
<li>
|
||||||
@ -825,23 +840,29 @@ const DineInInner = () => {
|
|||||||
|
|
||||||
<div className="modal-body">
|
<div className="modal-body">
|
||||||
<div className="d-flex justify-content-between mb-1">
|
<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
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn-close"
|
className="btn-close"
|
||||||
onClick={() => setFloorDeleteConfirm({ show: false, id: null })}
|
onClick={() => setFloorDeleteConfirm({ show: false, id: null, isDeleted: null })}
|
||||||
></button>
|
></button>
|
||||||
</div>
|
</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 ">
|
<div className="d-flex justify-content-end gap-2 mt-1 ">
|
||||||
<button
|
<button
|
||||||
className="btn btn-outline-danger px-14 py-6 text-sm"
|
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
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
<button className="btn btn-danger px-14 py-6 text-sm" onClick={handleFloorDelete}>
|
<button className="btn btn-danger px-14 py-6 text-sm" onClick={handleFloorDelete}>
|
||||||
Delete
|
{floorDeleteConfirm?.isDeleted === 0 ? "Delete" : "Restore"}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user