diff --git a/src/app/admin/(floor-plan-update)/floor-plan/page.jsx b/src/app/admin/(floor-plan-update)/floor-plan/page.jsx index 14d22b9..c3b4d07 100644 --- a/src/app/admin/(floor-plan-update)/floor-plan/page.jsx +++ b/src/app/admin/(floor-plan-update)/floor-plan/page.jsx @@ -38,7 +38,7 @@ const DineInInner = () => { enable: 0, }); const [errors, setErrors] = useState({}); - const [deleteConfirm, setDeleteConfirm] = useState({ show: false, id: null }); + const [deleteConfirm, setDeleteConfirm] = useState({ show: false, id: null, isDeleted: null}); const [restaruntBranch, setRestaruntBranch] = useState("") const [floorData, setFloorData] = useState(null); const [roomData, setRoomData] = useState(null); @@ -66,7 +66,7 @@ const DineInInner = () => { description: "", }); const [roomErrors, setRoomErrors] = useState({}); - const [roomDeleteConfirm, setRoomDeleteConfirm] = useState({ show: false, id: null }); + const [roomDeleteConfirm, setRoomDeleteConfirm] = useState({ show: false, id: null, isDeleted: null }); useEffect(() => { const restarunt = localStorage.getItem("restaurantbranch") @@ -286,9 +286,12 @@ const DineInInner = () => { }; const handleRoomDelete = async () => { - try { - await client.delete(`/Dine360 Room/${roomDeleteConfirm?.id}`); - setRoomDeleteConfirm({ show: false, id: null }); + try { + const body = { + isdeleted: roomDeleteConfirm?.isDeleted == 0 ? 1 : 0 + } + await client.put(`/Dine360 Room/${roomDeleteConfirm?.id}`, body); + setRoomDeleteConfirm({ show: false, id: null, isDeleted: null }); getRoomData(selectedFloor); } catch (error) { if ( @@ -576,6 +579,9 @@ const DineInInner = () => { }} >
Are you sure you want to delete this Room?
++ {roomDeleteConfirm?.isDeleted === 0 + ? "Are you sure you want to set this room as Delete?" + : "Are you sure you want to set this room as Restore?"}
Are you sure you want to delete this Table?
++ {floorDeleteConfirm?.isDeleted === 0 + ? "Are you sure you want to set this table as Delete?" + : "Are you sure you want to set this table as Restore?"} +