diff --git a/src/App.jsx b/src/App.jsx
index f56faf2..c30c163 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -10,8 +10,12 @@ import { routesConfig } from './routesConfig';
import { GlobalItemCard } from './Features/BookingScreen/BookingData/BookingData.js';
import { clearSession, getSession } from './Services/Others.js';
-const KisokSelBooking = lazy(() => import('./Pages/SelfBooking/KisokSelBooking'));
-const IndividualBooking = lazy(() => import('./Pages/SelfBooking/IndividualBooking'));
+const KisokSelBooking = lazy(
+ () => import('./Pages/SelfBooking/KisokSelBooking')
+);
+const IndividualBooking = lazy(
+ () => import('./Pages/SelfBooking/IndividualBooking')
+);
const commonSubDir = import.meta.env.ENV_COMMON_BASE_URL;
const subDirectory = import.meta.env.ENV_BASE_URL;
@@ -23,13 +27,13 @@ import useSubscriptionManager from './useSubscriptionManager.js';
import useSessionManager from './useSessionManager.js';
import ExtendSubscriptionModal from './Pages/ExtentedModal/ExtendSubscriptionModal.jsx';
-const isCapacitor = () => !!(window.Capacitor?.isNativePlatform?.());
+const isCapacitor = () => !!window.Capacitor?.isNativePlatform?.();
// ✅ Define your home/exit pages here
const HOME_PAGES = [
'/landing-page/home',
'/home/landing-page/home',
- 'app-page/home', // android minimize
+ 'app-page/home', // android minimize
];
const LOGIN_PAGES = ['signin', 'login', 'auth'];
@@ -37,7 +41,14 @@ const LOGIN_PAGES = ['signin', 'login', 'auth'];
const AppRoutes = () => {
const ItemCard = useSelector(GlobalItemCard);
const { sessionData, logout } = useSessionManager(ItemCard);
- const { remainingDays, handleCancel, freeExtend, extendModel,handlePay, setExtendModel } = useSubscriptionManager(sessionData, logout);
+ const {
+ remainingDays,
+ handleCancel,
+ freeExtend,
+ extendModel,
+ handlePay,
+ setExtendModel,
+ } = useSubscriptionManager(sessionData, logout);
const location = useLocation();
const navigate = useNavigate();
@@ -56,7 +67,7 @@ const AppRoutes = () => {
const path = location.pathname + (location.search || '');
// Don't track login pages
- if (LOGIN_PAGES.some(p => path.includes(p))) return;
+ if (LOGIN_PAGES.some((p) => path.includes(p))) return;
const raw = sessionStorage.getItem('navStack');
let stack = raw ? JSON.parse(raw) : [];
@@ -78,7 +89,7 @@ const AppRoutes = () => {
const currentPath = location.pathname;
// On home page — just stay, don't redirect
- if (HOME_PAGES.some(p => currentPath.includes(p))) {
+ if (HOME_PAGES.some((p) => currentPath.includes(p))) {
window.history.go(1); // stay here
return;
}
@@ -104,77 +115,77 @@ const AppRoutes = () => {
useEffect(() => {
if (!isMobile && !isIOS && !isCapacitor()) return;
- const handler = async () => {
+ let backButtonListener;
+
+ const setupBackButton = async () => {
try {
- const currentPath = location.pathname + (location.search || '');
- console.log('🔙 Back pressed:', currentPath);
+ backButtonListener = await CapacitorApp.addListener(
+ 'backButton',
+ async () => {
+ try {
+ const currentPath = location.pathname + (location.search || '');
+ console.log('🔙 Back pressed:', currentPath);
- // ✅ On home page
- if (HOME_PAGES.some(p => currentPath.includes(p))) {
- if (isCapacitor()) {
- console.log('📱 Minimizing app');
- await CapacitorApp.minimizeApp(); // minimize — not exit
+ // 🏠 Home page → minimize
+ if (HOME_PAGES.some((p) => currentPath.includes(p))) {
+ if (isCapacitor()) {
+ await CapacitorApp.minimizeApp();
+ }
+ return;
+ }
+
+ // 🚪 Login page → exit
+ if (LOGIN_PAGES.some((p) => currentPath.includes(p))) {
+ if (isCapacitor()) {
+ await CapacitorApp.exitApp();
+ }
+ return;
+ }
+
+ const raw = sessionStorage.getItem('navStack');
+ let stack = raw ? JSON.parse(raw) : [];
+
+ while (stack.length && stack[stack.length - 1] === currentPath) {
+ stack.pop();
+ }
+
+ if (stack.length) {
+ const previous = stack[stack.length - 1];
+
+ if (LOGIN_PAGES.some((p) => previous.includes(p))) {
+ const home = '/landing-page/home';
+ sessionStorage.setItem('navStack', JSON.stringify([home]));
+ isBackNav.current = true;
+ navigate(home);
+ return;
+ }
+
+ sessionStorage.setItem('navStack', JSON.stringify(stack));
+ isBackNav.current = true;
+ navigate(previous);
+ } else {
+ const home = '/landing-page/home';
+ sessionStorage.setItem('navStack', JSON.stringify([home]));
+ isBackNav.current = true;
+ navigate(home);
+ }
+ } catch (err) {
+ console.error('Back handler error:', err);
+ navigate('/landing-page/home');
+ }
}
- return;
- }
-
- // ✅ On login page → exit app
- if (LOGIN_PAGES.some(p => currentPath.includes(p))) {
- console.log('🚪 Exiting app');
- if (isCapacitor()) await CapacitorApp.exitApp();
- return;
- }
-
- // ✅ Get stack and go back one by one
- const raw = sessionStorage.getItem('navStack');
- let stack = raw ? JSON.parse(raw) : [];
-
- // Remove current path from top
- while (stack.length > 0 && stack[stack.length - 1] === currentPath) {
- stack.pop();
- }
-
- if (stack.length > 0) {
- const previous = stack[stack.length - 1];
-
- // If previous is login → go to home instead
- if (LOGIN_PAGES.some(p => previous.includes(p))) {
- console.log('⬅️ Previous was login → going home');
- const home = '/landing-page/home';
- sessionStorage.setItem('navStack', JSON.stringify([home]));
- isBackNav.current = true;
- navigate(home);
- return;
- }
-
- console.log('⬅️ Back to:', previous);
- sessionStorage.setItem('navStack', JSON.stringify(stack));
- isBackNav.current = true; // ✅ Prevent loop
- navigate(previous);
-
- } else {
- // Stack empty → go home
- const home = '/landing-page/home';
- console.log('📭 Stack empty → home');
- sessionStorage.setItem('navStack', JSON.stringify([home]));
- isBackNav.current = true;
- navigate(home);
- }
- } catch (e) {
- console.error('Back error:', e);
- navigate('/landing-page/home');
+ );
+ } catch (err) {
+ console.error('Listener error:', err);
}
};
- let listener;
- try {
- listener = CapacitorApp.addListener('backButton', handler);
- } catch (e) {}
+ setupBackButton();
return () => {
try {
- if (listener?.remove) listener.remove();
- } catch (e) {}
+ backButtonListener?.remove();
+ } catch (err) {}
};
}, [navigate, location.pathname, location.search]);
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBillingTable1.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBillingTable1.jsx
index fe5830d..2a99898 100644
--- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBillingTable1.jsx
+++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBillingTable1.jsx
@@ -156,8 +156,8 @@ const BSBillingTable1 = () => {
OrderType === 'Hold'
? tableData?.filter((a, b) => a.BookingTypeName === 'TakeAway')
: tableData?.filter(
- (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
- );
+ (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
+ );
const OldtableDataDinein = tableData?.filter(
(a, b) => a.BookingTypeName === 'Dine In' && a?.SalesId
@@ -165,8 +165,8 @@ const BSBillingTable1 = () => {
const OldtableDataTakeAway =
OrderType != 'Hold'
? tableData?.filter(
- (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
- )
+ (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
+ )
: [];
const [OpenEditTotalAmt, setOpenEditTotalAmt] = useState(false);
const [OpenImeiDetail, setOpenImeiDetail] = useState(false);
@@ -1115,9 +1115,9 @@ const BSBillingTable1 = () => {
)?.map((item, idx) =>
idx === 0
? {
- ...item,
- FreeQty,
- }
+ ...item,
+ FreeQty,
+ }
: item
),
};
@@ -1470,7 +1470,7 @@ const BSBillingTable1 = () => {
OrderQty: isPaidproduct?.OrderQty,
CompleteRemove: true,
InwardDtlId: item?.InwardDtlId,
- OrderRate:item?.OrderRate,
+ OrderRate: item?.OrderRate,
BuyInwardDtlId: null,
Offer: item?.Offer,
});
@@ -1506,7 +1506,7 @@ const BSBillingTable1 = () => {
InwardDtlId: item?.InwardDtlId,
BuyInwardDtlId: null,
Offer: item?.Offer,
- OrderRate:item?.OrderRate,
+ OrderRate: item?.OrderRate,
});
await ChangeOfferAppliedProdsFn({
inwardDtlId: item?.InwardDtlId,
@@ -1536,7 +1536,7 @@ const BSBillingTable1 = () => {
OrderQty: isPaidProductAvailableInCart?.OrderQty,
CompleteRemove: true,
InwardDtlId: isPaidProductAvailableInCart?.InwardDtlId,
- OrderRate:isPaidProductAvailableInCart?.OrderRate,
+ OrderRate: isPaidProductAvailableInCart?.OrderRate,
BuyInwardDtlId: null,
Offer: 0,
});
@@ -1622,7 +1622,7 @@ const BSBillingTable1 = () => {
InwardDtlId: item?.InwardDtlId,
BuyInwardDtlId: null,
Offer: item?.Offer,
- OrderRate:item?.OrderRate,
+ OrderRate: item?.OrderRate,
});
await ChangeFreeprodlistFn({
OverAllFreeQty: freeProdList?.OverAllFreeQty,
@@ -1649,7 +1649,7 @@ const BSBillingTable1 = () => {
InwardDtlId: item?.InwardDtlId,
BuyInwardDtlId: null,
Offer: item?.Offer,
- OrderRate:item?.OrderRate,
+ OrderRate: item?.OrderRate,
});
await ChangeFreeprodlistFn({
OverAllFreeQty: freeProdList?.OverAllFreeQty,
@@ -1982,7 +1982,7 @@ const BSBillingTable1 = () => {
CompleteRemove: true,
InwardDtlId: item?.InwardDtlId,
BuyInwardDtlId: item?.InwardDtlId,
- OrderRate:item?.OrderRate,
+ OrderRate: item?.OrderRate,
Offer: item?.Offer,
});
await ChangeFreeprodlistFn({
@@ -2001,7 +2001,7 @@ const BSBillingTable1 = () => {
CompleteRemove: true,
InwardDtlId: item?.InwardDtlId,
BuyInwardDtlId: item?.InwardDtlId,
- OrderRate:item?.OrderRate,
+ OrderRate: item?.OrderRate,
Offer: item?.Offer,
});
await ChangeFreeprodlistFn({
@@ -2144,7 +2144,7 @@ const BSBillingTable1 = () => {
OpenEditTotalAmount();
}
}}
- // onClick={tableData?.length>0? OpenEditTotalAmount :""}
+ // onClick={tableData?.length>0? OpenEditTotalAmount :""}
>
{!isMobile ? (
Parking
-
- Quick Add
(Alt +N)
-
Dine In
-Take Away
-Extra Charge
-Re Print
-Parking
+
+ Quick Add
(Alt +N)
+
Dine In
+Take Away
+Extra Charge
+Re Print
+