table isDeleted issues Fixed

This commit is contained in:
alaguraj 2025-08-11 15:52:41 +05:30
parent 78d753c65a
commit 214ce43ff9

View File

@ -38,7 +38,7 @@ const DineInInner = () => {
enable: 0, enable: 0,
}); });
const [errors, setErrors] = useState({}); const [errors, setErrors] = useState({});
const [deleteConfirm, setDeleteConfirm] = useState({ show: false, id: null, isDeleted: null}); const [deleteConfirm, setDeleteConfirm] = useState({ show: false, id: null, isDeleted: null });
const [restaruntBranch, setRestaruntBranch] = useState("") const [restaruntBranch, setRestaruntBranch] = useState("")
const [floorData, setFloorData] = useState(null); const [floorData, setFloorData] = useState(null);
const [roomData, setRoomData] = useState(null); const [roomData, setRoomData] = useState(null);
@ -286,7 +286,7 @@ const DineInInner = () => {
}; };
const handleRoomDelete = async () => { const handleRoomDelete = async () => {
try { try {
const body = { const body = {
isdeleted: roomDeleteConfirm?.isDeleted == 0 ? 1 : 0 isdeleted: roomDeleteConfirm?.isDeleted == 0 ? 1 : 0
} }
@ -458,7 +458,10 @@ const DineInInner = () => {
const handleDelete = async () => { const handleDelete = async () => {
try { try {
await client.put(`/Dine360 Table/${deleteConfirm.id}`); const body = {
isdeleted: deleteConfirm?.isDeleted == 0 ? 1 : 0
}
await client.put(`/Dine360 Table/${deleteConfirm.id}`, body);
setDeleteConfirm({ show: false, id: null, isDeleted: null }); setDeleteConfirm({ show: false, id: null, isDeleted: null });
getTableData(selectedRoom); getTableData(selectedRoom);
} catch (error) { } catch (error) {
@ -499,7 +502,7 @@ const DineInInner = () => {
> >
<div className="card-body px-3 py-1 d-flex gap-2 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"}}/>) floor?.isdeleted == 1 && (<Icon icon="mdi:block-helper" style={{ color: "red" }} />)
} }
<span <span
@ -580,7 +583,7 @@ const DineInInner = () => {
> >
<div className="card-body px-3 py-1 d-flex gap-2 align-items-center"> <div className="card-body px-3 py-1 d-flex gap-2 align-items-center">
{ {
room?.isdeleted == 1 && (<Icon icon="mdi:block-helper" style={{color:"red"}}/>) room?.isdeleted == 1 && (<Icon icon="mdi:block-helper" style={{ color: "red" }} />)
} }
<span <span
className="text-truncatew-100 text-sm fw-semibold" className="text-truncatew-100 text-sm fw-semibold"
@ -614,7 +617,7 @@ const DineInInner = () => {
e.preventDefault(); e.preventDefault();
setRoomDeleteConfirm({ show: true, id: room.name, isDeleted: room.isdeleted }); setRoomDeleteConfirm({ show: true, id: room.name, isDeleted: room.isdeleted });
}}> }}>
{room.isdeleted === 1 ? ( {room.isdeleted === 1 ? (
<> <>
<Icon icon="mdi:restore" /> Restore <Icon icon="mdi:restore" /> Restore
</> </>
@ -702,6 +705,7 @@ const DineInInner = () => {
// onClick={() => handleTableClick(table)} // onClick={() => handleTableClick(table)}
> >
<div style={{ position: 'relative', paddingTop: "20px", width: "150px" }}> <div style={{ position: 'relative', paddingTop: "20px", width: "150px" }}>
<img <img
src={`/assets/images/seat/${(() => { src={`/assets/images/seat/${(() => {
if (table?.totalcapacity <= 2) return 'seating-24.png'; if (table?.totalcapacity <= 2) return 'seating-24.png';
@ -717,6 +721,12 @@ const DineInInner = () => {
{ 'grayscale': table.status === 'booked' } { 'grayscale': table.status === 'booked' }
)} )}
/> />
{
table?.isdeleted == 1 && (<Icon icon="mdi:block-helper" style={{
color: "red", position: "absolute", top: "28%",
left: "15%", zIndex: 1
}} />)
}
<h6 <h6
className={`position-absolute text-xs translate-middle text-white fw-bold text-center d-flex align-items-center justify-content-center ${table?.status === "Available" ? "bg-success-500" : table?.status === "Booked" ? "bg-warning-500" : "bg-secondary-500"}`} className={`position-absolute text-xs translate-middle text-white fw-bold text-center d-flex align-items-center justify-content-center ${table?.status === "Available" ? "bg-success-500" : table?.status === "Booked" ? "bg-warning-500" : "bg-secondary-500"}`}
@ -765,16 +775,16 @@ const DineInInner = () => {
e.preventDefault(); e.preventDefault();
setDeleteConfirm({ show: true, id: table.name, isDeleted: table.isdeleted }) setDeleteConfirm({ show: true, id: table.name, isDeleted: table.isdeleted })
}} }}
> >
{table.isdeleted === 1 ? ( {table.isdeleted === 1 ? (
<> <>
<Icon icon="mdi:restore" /> Restore <Icon icon="mdi:restore" /> Restore
</> </>
) : ( ) : (
<> <>
<Icon icon="fluent:delete-24-regular" /> Delete <Icon icon="fluent:delete-24-regular" /> Delete
</> </>
)} )}
</Link> </Link>
</li> </li>
</ul> </ul>
@ -960,7 +970,7 @@ 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"> <h6 className="text-lg mb-0">
{roomDeleteConfirm?.isDeleted === 0 ? "Confirm to Delete" : "Confirm to Restore"} {roomDeleteConfirm?.isDeleted === 0 ? "Confirm to Delete" : "Confirm to Restore"}
</h6> </h6>
<button <button
@ -1167,7 +1177,7 @@ 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"> <h6 className="text-lg mb-0">
{deleteConfirm?.isDeleted === 0 ? "Confirm to Delete" : "Confirm to Restore"} {deleteConfirm?.isDeleted === 0 ? "Confirm to Delete" : "Confirm to Restore"}
</h6> </h6>
<button <button
type="button" type="button"