#194 Print First time note coming issue solving

This commit is contained in:
karthikalakshmi 2026-02-27 10:50:36 +05:30
parent 768eae15a1
commit eb73151a56
3 changed files with 66 additions and 56 deletions

View File

@ -1,4 +1,4 @@
import { useEffect, lazy, Suspense, useRef } from 'react'; import { useEffect, lazy, Suspense, useRef, useState } from 'react';
import { useLocation, useNavigate } from 'react-router-dom'; import { useLocation, useNavigate } from 'react-router-dom';
import { App as CapacitorApp } from '@capacitor/app'; import { App as CapacitorApp } from '@capacitor/app';
import { Routes, Route } from 'react-router-dom'; import { Routes, Route } from 'react-router-dom';
@ -26,6 +26,7 @@ import WeightScaleApp from './Pages/BookingScreen/WeightscaleApp.jsx';
import useSubscriptionManager from './useSubscriptionManager.js'; import useSubscriptionManager from './useSubscriptionManager.js';
import useSessionManager from './useSessionManager.js'; import useSessionManager from './useSessionManager.js';
import ExtendSubscriptionModal from './Pages/ExtentedModal/ExtendSubscriptionModal.jsx'; import ExtendSubscriptionModal from './Pages/ExtentedModal/ExtendSubscriptionModal.jsx';
import devtools from 'devtools-detect';
const isCapacitor = () => !!window.Capacitor?.isNativePlatform?.(); const isCapacitor = () => !!window.Capacitor?.isNativePlatform?.();
@ -51,7 +52,7 @@ const AppRoutes = () => {
} = useSubscriptionManager(sessionData, logout); } = useSubscriptionManager(sessionData, logout);
const location = useLocation(); const location = useLocation();
const navigate = useNavigate(); const navigate = useNavigate();
const [devToolsOpen, setDevToolsOpen] = useState(false);
// Flag to prevent stack push when back button navigates // Flag to prevent stack push when back button navigates
const isBackNav = useRef(false); const isBackNav = useRef(false);
@ -188,7 +189,47 @@ const AppRoutes = () => {
} catch (err) {} } catch (err) {}
}; };
}, [navigate, location.pathname, location.search]); }, [navigate, location.pathname, location.search]);
// mohan
useEffect(() => {
if (isMobile || isIOS) {
console.log("📱 Mobile/iOS device → skipping DevTools detection");
return;
}
const checkDevTools = setInterval(() => {
if (devtools.isOpen && !devToolsOpen) {
setDevToolsOpen(true);
document.body.innerHTML =
"<h1 style='color: red; text-align: center;'>Close Inspect to continue using the application.</h1>";
}
else if (!devtools.isOpen && devToolsOpen) {
setDevToolsOpen(false);
setTimeout(() => {
window.location.reload();
}, 100);
clearInterval(checkDevTools);
}
if (!devtools.isOpen) {
let before = performance.now();
let after = performance.now();
let executionDelay = after - before;
if (executionDelay > 100) {
setDevToolsOpen(true);
document.body.innerHTML =
"<h1 style='color: red; text-align: center;'>Close Inspect to continue using the application.</h1>";
} else {
setDevToolsOpen(false);
}
}
}, 1000);
return () => clearInterval(checkDevTools);
}, [devToolsOpen]);
if (extendModel) { if (extendModel) {
return ( return (
<ExtendSubscriptionModal <ExtendSubscriptionModal

View File

@ -10,58 +10,25 @@ import { ApplicationPreferences } from '../../Features/BrachLogin/BranchLogin.js
import { SelectedPrintTemplate } from '../../Features/ThemeChange/ThemeChange'; import { SelectedPrintTemplate } from '../../Features/ThemeChange/ThemeChange';
import { PreferenceData } from '../../Features/BookingScreen/BookingData/BookingData.js'; import { PreferenceData } from '../../Features/BookingScreen/BookingData/BookingData.js';
// js Files // js Files
const PrintStyle1 = lazy( import PrintStyle1 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.jsx';
() => import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.jsx') import PrintStyle2 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.jsx';
); import PrintStyle3 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.jsx';
const PrintStyle2 = lazy( import PrintStyle4 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.jsx';
() => import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.jsx') import PrintStyle5 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.jsx';
); import PrintStyle6 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx';
const PrintStyle3 = lazy( import PrintStyle7 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.jsx';
() => import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.jsx') import PrintStyle8 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.jsx';
); import PrintStyle9 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.jsx';
const PrintStyle4 = lazy( import PrintStyle10 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.jsx';
() => import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.jsx') import PrintStyle11 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.jsx';
); import PrintStyle12 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx';
const PrintStyle5 = lazy(
() => import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.jsx') import PrintA4Style11 from '../BookingScreen/PrintTemplates/A4/PrintA4Style11.jsx';
); import PrintA5Style11 from '../BookingScreen/PrintTemplates/A4/PrintStyleA5.jsx';
const PrintStyle6 = lazy( import A4Standard from '../BookingScreen/PrintTemplates/A4/A4Standard.jsx';
() => import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx') import TaxInvoice from '../BookingScreen/PrintTemplates/A4/TaxInvoice.jsx';
);
const PrintStyle7 = lazy(
() => import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.jsx')
);
const PrintStyle8 = lazy(
() => import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.jsx')
);
const PrintStyle9 = lazy(
() => import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.jsx')
);
const PrintStyle10 = lazy(
() =>
import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.jsx')
);
const PrintStyle11 = lazy(
() =>
import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.jsx')
);
const PrintStyle12 = lazy(
() =>
import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx')
);
const PrintA4Style11 = lazy(
() => import('../BookingScreen/PrintTemplates/A4/PrintA4Style11.jsx')
);
const PrintA5Style11 = lazy(
() => import('../BookingScreen/PrintTemplates/A4/PrintStyleA5.jsx')
);
const A4Standard = lazy(
() => import('../BookingScreen/PrintTemplates/A4/A4Standard.jsx')
);
const TaxInvoice = lazy(
() => import('../BookingScreen/PrintTemplates/A4/TaxInvoice.jsx')
);
const PaymentPdfBooking = ({ const PaymentPdfBooking = ({
index, index,
orderId, orderId,

View File

@ -1,6 +1,6 @@
import { useEffect } from 'react'; import { useEffect } from 'react';
import { useDispatch } from 'react-redux'; import { useDispatch } from 'react-redux';
import { getTemplate } from '../Features/ThemeChange/ThemeChange.js'; import { getPrintSelectionComponentData, getTemplate } from '../Features/ThemeChange/ThemeChange.js';
export const useTemplate = (CompId, BranchId, AppId) => { export const useTemplate = (CompId, BranchId, AppId) => {
@ -9,7 +9,9 @@ export const useTemplate = (CompId, BranchId, AppId) => {
useEffect(() => { useEffect(() => {
const fetchTemplate = async () => { const fetchTemplate = async () => {
try { try {
const Data = { AppId, CompId, BranchId };
await dispatch(getTemplate({ CompId, BranchId, AppId })).unwrap(); await dispatch(getTemplate({ CompId, BranchId, AppId })).unwrap();
dispatch(getPrintSelectionComponentData(Data)).unwrap();
} catch (error) { } catch (error) {
console.error('Failed to fetch template:', error); console.error('Failed to fetch template:', error);
} }