diff --git a/src/app/admin/(pos-system)/pos/dine-in/page.jsx b/src/app/admin/(pos-system)/pos/dine-in/page.jsx
index 9b47a2e..4f8db51 100644
--- a/src/app/admin/(pos-system)/pos/dine-in/page.jsx
+++ b/src/app/admin/(pos-system)/pos/dine-in/page.jsx
@@ -9,6 +9,8 @@ import PageLoader from "@/components/common-component/PageLoader";
import PageNoData from "@/components/common-component/PageNoData";
import Breadcrumb from "@/components/Breadcrumb";
import { Icon } from "@iconify/react";
+import axios from "axios";
+import { Baseurl } from "@utils/BaseUrl.utils";
const DineInInner = () => {
@@ -33,6 +35,7 @@ const DineInInner = () => {
minimumoccupancy: "",
totalcapacity: "",
description: "",
+ enable: 0,
});
const [errors, setErrors] = useState({});
const [deleteConfirm, setDeleteConfirm] = useState({ show: false, id: null });
@@ -144,7 +147,25 @@ const DineInInner = () => {
if (isEditMode) {
await client.put(`/Dine360 Table/${selectedFloorId}`, Body);
} else {
- await client.post(`/Dine360 Table`, Body);
+ const createTable = await client.post(`/Dine360 Table`, Body);
+
+ if (formData.enable == 1) {
+ const tableName = createTable?.data?.data?.name;
+ const RestaurantBranch = createTable?.data?.data?.restaurantbranch;
+ const AutoCreateBody = {
+ table: tableName,
+ restaurantbranch: RestaurantBranch,
+ enabled: formData.enable, // Uncomment if needed
+ };
+
+ try {
+ await axios.post(`${Baseurl}/Add-Table-To-Day`, AutoCreateBody);
+ } catch (apiError) {
+ console.error("Error while auto-creating table for the day:", apiError);
+ alert("Table created, but failed to assign it to the day.");
+ }
+ }
+
}
getTableData();
resetForm();
@@ -167,6 +188,7 @@ const DineInInner = () => {
totalcapacity: "",
// branch: "",
description: "",
+ enable: 0,
});
setShowModal(false);
setIsEditMode(false);
@@ -532,6 +554,29 @@ const DineInInner = () => {
{errors.branch}
)}
*/}
+ {
+ !isEditMode && (
+
+
+ setFormData({
+ ...formData,
+ enable: e.target.checked ? 1 : 0,
+ })
+ }
+ />
+
+
+ )
+ }
+