Initial commit
This commit is contained in:
parent
1a7870a9ed
commit
ddeed6d14a
Binary file not shown.
|
|
@ -49,7 +49,7 @@
|
||||||
</provider>
|
</provider>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.USB_PERMISSION" />
|
<uses-permission android:name="android.permission.USB_PERMISSION" />
|
||||||
<uses-feature android:name="android.hardware.usb.host" />
|
<uses-feature android:name="android.hardware.usb.host" />
|
||||||
|
|
|
||||||
126
index.html
126
index.html
|
|
@ -3,9 +3,14 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" href="/fav.ico" />
|
<link rel="icon" href="/fav.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=1" />
|
<meta
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/antd/dist/reset.css" />
|
name="viewport"
|
||||||
|
content="width=device-width, initial-scale=1.0, user-scalable=no"
|
||||||
|
/>
|
||||||
|
<!-- <link
|
||||||
|
rel="stylesheet"
|
||||||
|
href="https://cdn.jsdelivr.net/npm/antd/dist/reset.css"
|
||||||
|
/> -->
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
|
|
||||||
|
|
@ -77,7 +82,18 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script> -->
|
</script> -->
|
||||||
<!-- <script src="https://cdn.jsdelivr.net/npm/eruda"></script>
|
<!-- public/index.html -->
|
||||||
|
<script>
|
||||||
|
// Safety check for older WebViews
|
||||||
|
try {
|
||||||
|
document.querySelector(":where(div)");
|
||||||
|
} catch (e) {
|
||||||
|
console.warn(
|
||||||
|
"Old WebView detected - StyleProvider fix should handle this",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/eruda"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/eruda-network"></script>
|
<script src="https://cdn.jsdelivr.net/npm/eruda-network"></script>
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
(function () {
|
||||||
|
|
@ -125,7 +141,107 @@
|
||||||
}
|
}
|
||||||
}, 2000);
|
}, 2000);
|
||||||
})();
|
})();
|
||||||
</script> -->
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* ============================================
|
||||||
|
Android POS - Global Fixes
|
||||||
|
Targets Android WebView (Chrome 83 and below)
|
||||||
|
where flex `gap` is NOT supported
|
||||||
|
============================================ */
|
||||||
|
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ============================================
|
||||||
|
FIX 1: flex gap fallback for Android WebView
|
||||||
|
`gap` in flexbox needs Chrome 84+.
|
||||||
|
We use margin-based spacing as a universal fallback.
|
||||||
|
This targets ALL flex containers globally.
|
||||||
|
============================================ */
|
||||||
|
|
||||||
|
/* Ant Design specific flex gap fixes */
|
||||||
|
.ant-space-horizontal > .ant-space-item:not(:last-child) {
|
||||||
|
margin-right: 8px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-space-vertical > .ant-space-item:not(:last-child) {
|
||||||
|
margin-bottom: 8px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ant Design Row/Col gap fix */
|
||||||
|
.ant-row {
|
||||||
|
display: -webkit-box !important;
|
||||||
|
display: -webkit-flex !important;
|
||||||
|
display: flex !important;
|
||||||
|
-webkit-flex-wrap: wrap !important;
|
||||||
|
flex-wrap: wrap !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ============================================
|
||||||
|
FIX 2: :where() selector fallback for Chrome 83
|
||||||
|
Ant Design v5 uses :where() which breaks on
|
||||||
|
older Android WebViews
|
||||||
|
============================================ */
|
||||||
|
.ant-btn {
|
||||||
|
display: inline-block;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-form-item {
|
||||||
|
display: block;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Flex display with webkit prefix for old WebViews */
|
||||||
|
.ant-flex,
|
||||||
|
.ant-space,
|
||||||
|
.ant-row,
|
||||||
|
.ant-card,
|
||||||
|
.ant-card-body {
|
||||||
|
display: -webkit-box !important;
|
||||||
|
display: -webkit-flex !important;
|
||||||
|
display: flex !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ============================================
|
||||||
|
FIX 3: Ant Design Modal Override for Android
|
||||||
|
============================================ */
|
||||||
|
.ant-modal-wrap {
|
||||||
|
position: fixed !important;
|
||||||
|
top: 0 !important;
|
||||||
|
left: 0 !important;
|
||||||
|
width: 100% !important;
|
||||||
|
height: 100% !important;
|
||||||
|
/* z-index: 1000 !important; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-modal {
|
||||||
|
margin: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ============================================
|
||||||
|
FIX 4: Safe area support for notch devices
|
||||||
|
============================================ */
|
||||||
|
@supports (padding: max(0px)) {
|
||||||
|
body {
|
||||||
|
padding-left: env(safe-area-inset-left);
|
||||||
|
padding-right: env(safe-area-inset-right);
|
||||||
|
padding-top: env(safe-area-inset-top);
|
||||||
|
padding-bottom: env(safe-area-inset-bottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -2,13 +2,13 @@ ENV_BASE_URL='/'
|
||||||
ENV_COMMON_BASE_URL='http://192.168.1.16:3000/'
|
ENV_COMMON_BASE_URL='http://192.168.1.16:3000/'
|
||||||
# ENV_API_URL='http://192.168.1.25:8001'
|
# ENV_API_URL='http://192.168.1.25:8001'
|
||||||
# ENV_API_URL='http://api.pozo.co.in/Retailapi_UnderTest'
|
# ENV_API_URL='http://api.pozo.co.in/Retailapi_UnderTest'
|
||||||
# ENV_API_URL='https://api.pozo.dev/pozo-retail-api'
|
ENV_API_URL='https://api.pozo.dev/pozo-retail-api'
|
||||||
# ENV_API_URL_COMMON='https://api.pozo.dev/pozo-common-api'
|
ENV_API_URL_COMMON='https://api.pozo.dev/pozo-common-api'
|
||||||
# ENV_API_URL_TOKEN='https://api.pozo.dev/JwtToken'
|
ENV_API_URL_TOKEN='https://api.pozo.dev/JwtToken'
|
||||||
ENV_API_URL='http://192.168.1.37:8012'
|
# ENV_API_URL='http://192.168.1.37:8012'
|
||||||
ENV_API_URL_COMMON='http://192.168.1.37:8013'
|
# ENV_API_URL_COMMON='http://192.168.1.37:8013'
|
||||||
ENV_API_URL_TOKEN='http://192.168.1.37:8001'
|
# ENV_API_URL_TOKEN='http://192.168.1.37:8001'
|
||||||
ENV_API_URL_OCR='http://192.168.1.37:8070'
|
# ENV_API_URL_OCR='http://192.168.1.37:8070'
|
||||||
# ENV_API_URL='https://api.pozo.app/pozo-retail-api'
|
# ENV_API_URL='https://api.pozo.app/pozo-retail-api'
|
||||||
# ENV_API_URL_COMMON='https://api.pozo.app/pozo-common-api'
|
# ENV_API_URL_COMMON='https://api.pozo.app/pozo-common-api'
|
||||||
# ENV_API_URL_TOKEN='https://api.pozo.app/JwtToken'
|
# ENV_API_URL_TOKEN='https://api.pozo.app/JwtToken'
|
||||||
|
|
|
||||||
|
|
@ -20,48 +20,48 @@
|
||||||
|
|
||||||
# live Server (173 server)
|
# live Server (173 server)
|
||||||
|
|
||||||
ENV_BASE_URL='/apps/retail/'
|
# ENV_BASE_URL='/apps/retail/'
|
||||||
ENV_COMMON_BASE_URL='https://pozo.app'
|
# ENV_COMMON_BASE_URL='https://pozo.app'
|
||||||
ENV_API_URL='https://api.pozo.app/pozo-retail-api'
|
# ENV_API_URL='https://api.pozo.app/pozo-retail-api'
|
||||||
ENV_API_URL_COMMON='https://api.pozo.app/pozo-common-api'
|
# ENV_API_URL_COMMON='https://api.pozo.app/pozo-common-api'
|
||||||
ENV_API_URL_TOKEN='https://api.pozo.app/JwtToken'
|
# ENV_API_URL_TOKEN='https://api.pozo.app/JwtToken'
|
||||||
ENV_API_URL_OCR='http://192.168.1.37:8070'
|
# ENV_API_URL_OCR='http://192.168.1.37:8070'
|
||||||
ENV_IMAGE_UPLOAD_API_URL="https://api.pozo.app/pozo-common-image-api/"
|
# ENV_IMAGE_UPLOAD_API_URL="https://api.pozo.app/pozo-common-image-api/"
|
||||||
ENV_SECRET_KEY="3a939a2eed2cca4b64cd47f51b23b135b2b9b765273f695d47682ea803c8429d"
|
# ENV_SECRET_KEY="3a939a2eed2cca4b64cd47f51b23b135b2b9b765273f695d47682ea803c8429d"
|
||||||
ENV_URL_SECRET_KEY="f2ef79b8b2d4fc1cc569726a5a753552257b4ff2872d6a71cf3119bce3f07c1b"
|
# ENV_URL_SECRET_KEY="f2ef79b8b2d4fc1cc569726a5a753552257b4ff2872d6a71cf3119bce3f07c1b"
|
||||||
ENV_MAIN_BASE_URL='https://pozo.app/apps/retail/'
|
# ENV_MAIN_BASE_URL='https://pozo.app/apps/retail/'
|
||||||
ENV_CUSTOM_PAYMENT_URL='https://pozo.app/CustomPaymentGateway/CustomPaymentGateway'
|
# ENV_CUSTOM_PAYMENT_URL='https://pozo.app/CustomPaymentGateway/CustomPaymentGateway'
|
||||||
ENV_IFSC_API_URL = "https://ifsc.razorpay.com"
|
# ENV_IFSC_API_URL = "https://ifsc.razorpay.com"
|
||||||
ENV_PAYMENT_DEVICE_URL='https://pozo.app/PaymentDevice/PaymentDevice/api/upload-transaction'
|
# ENV_PAYMENT_DEVICE_URL='https://pozo.app/PaymentDevice/PaymentDevice/api/upload-transaction'
|
||||||
ENV_PAYMENT_STATUS_GET_URL='https://pozo.app/PaymentDevice/PaymentDevice/api/get-transaction-status'
|
# ENV_PAYMENT_STATUS_GET_URL='https://pozo.app/PaymentDevice/PaymentDevice/api/get-transaction-status'
|
||||||
ENV_ANDROID_PRINTER= 'https://pozo.app/downloads/resources/POZO%20Printer.apk'
|
# ENV_ANDROID_PRINTER= 'https://pozo.app/downloads/resources/POZO%20Printer.apk'
|
||||||
ENV_ANDROID_KIOSK= 'https://pozo.app/downloads/resources/POZO%20KIOSK.apk'
|
# ENV_ANDROID_KIOSK= 'https://pozo.app/downloads/resources/POZO%20KIOSK.apk'
|
||||||
ENV_ANDROID_HANDHELD= 'https://pozo.app/downloads/resources/Handheld.apk'
|
# ENV_ANDROID_HANDHELD= 'https://pozo.app/downloads/resources/Handheld.apk'
|
||||||
ENV_ANDROID_BILLING= 'https://pozo.app/downloads/resources/PozoApp.apk'
|
# ENV_ANDROID_BILLING= 'https://pozo.app/downloads/resources/PozoApp.apk'
|
||||||
ENV_EMAIL_API='https://api.pozo.app/pozo-sms-email-template-api'
|
# ENV_EMAIL_API='https://api.pozo.app/pozo-sms-email-template-api'
|
||||||
ENV_SIGNALR_SERVER_URL='https://api.pozo.app/'
|
# ENV_SIGNALR_SERVER_URL='https://api.pozo.app/'
|
||||||
|
|
||||||
#(172 server)
|
#(172 server)
|
||||||
|
|
||||||
# ENV_BASE_URL='/apps/retail/'
|
ENV_BASE_URL='/'
|
||||||
# ENV_COMMON_BASE_URL='https://pozo.dev'
|
ENV_COMMON_BASE_URL='https://pozo.dev'
|
||||||
# ENV_API_URL='https://api.pozo.dev/pozo-retail-api'
|
ENV_API_URL='https://api.pozo.dev/pozo-retail-api'
|
||||||
# ENV_API_URL_COMMON='https://api.pozo.dev/pozo-common-api'
|
ENV_API_URL_COMMON='https://api.pozo.dev/pozo-common-api'
|
||||||
# ENV_API_URL_TOKEN='https://api.pozo.dev/JwtToken'
|
ENV_API_URL_TOKEN='https://api.pozo.dev/JwtToken'
|
||||||
# ENV_API_URL_OCR='https://api.pozo.dev/pozo-scantext-api'
|
ENV_API_URL_OCR='https://api.pozo.dev/pozo-scantext-api'
|
||||||
# ENV_IMAGE_UPLOAD_API_URL="https://api.pozo.dev/pozo-common-image-api"
|
ENV_IMAGE_UPLOAD_API_URL="https://api.pozo.dev/pozo-common-image-api"
|
||||||
# ENV_SECRET_KEY="3a939a2eed2cca4b64cd47f51b23b135b2b9b765273f695d47682ea803c8429d"
|
ENV_SECRET_KEY="3a939a2eed2cca4b64cd47f51b23b135b2b9b765273f695d47682ea803c8429d"
|
||||||
# ENV_URL_SECRET_KEY="f2ef79b8b2d4fc1cc569726a5a753552257b4ff2872d6a71cf3119bce3f07c1b"
|
ENV_URL_SECRET_KEY="f2ef79b8b2d4fc1cc569726a5a753552257b4ff2872d6a71cf3119bce3f07c1b"
|
||||||
# ENV_MAIN_BASE_URL='https://pozo.dev/apps/retail/'
|
ENV_MAIN_BASE_URL='https://pozo.dev/apps/retail/'
|
||||||
# ENV_SIGNALR_SERVER_URL='https://api.pozo.dev/'
|
ENV_SIGNALR_SERVER_URL='https://api.pozo.dev/'
|
||||||
# ENV_CUSTOM_PAYMENT_URL='https://pozo.app/CustomPaymentGateway/CustomPaymentGateway'
|
ENV_CUSTOM_PAYMENT_URL='https://pozo.app/CustomPaymentGateway/CustomPaymentGateway'
|
||||||
# ENV_IFSC_API_URL = "https://ifsc.razorpay.com"
|
ENV_IFSC_API_URL = "https://ifsc.razorpay.com"
|
||||||
# ENV_PAYMENT_DEVICE_URL='https://pozo.dev/PaymentDevice/PaymentDevice/api/upload-transaction'
|
ENV_PAYMENT_DEVICE_URL='https://pozo.dev/PaymentDevice/PaymentDevice/api/upload-transaction'
|
||||||
# ENV_PAYMENT_STATUS_GET_URL='https://pozo.dev/PaymentDevice/PaymentDevice/api/get-transaction-status'
|
ENV_PAYMENT_STATUS_GET_URL='https://pozo.dev/PaymentDevice/PaymentDevice/api/get-transaction-status'
|
||||||
# # ENV_PAYMENT_DEVICE_URL='https://www.plutuscloudserviceuat.in:8201/API/CloudBasedIntegration/V1/UploadBilledTransaction'
|
# ENV_PAYMENT_DEVICE_URL='https://www.plutuscloudserviceuat.in:8201/API/CloudBasedIntegration/V1/UploadBilledTransaction'
|
||||||
# # ENV_PAYMENT_STATUS_GET_URL='https://www.plutuscloudserviceuat.in:8201/API/CloudBasedIntegration/V1/GetCloudBasedTxnStatus'
|
# ENV_PAYMENT_STATUS_GET_URL='https://www.plutuscloudserviceuat.in:8201/API/CloudBasedIntegration/V1/GetCloudBasedTxnStatus'
|
||||||
# ENV_ANDROID_PRINTER= 'https://pozo.dev/downloads/resources/POZO%20Printer.apk'
|
ENV_ANDROID_PRINTER= 'https://pozo.dev/downloads/resources/POZO%20Printer.apk'
|
||||||
# ENV_ANDROID_KIOSK= 'https://pozo.dev/downloads/resources/POZO%20KIOSK.apk'
|
ENV_ANDROID_KIOSK= 'https://pozo.dev/downloads/resources/POZO%20KIOSK.apk'
|
||||||
# ENV_ANDROID_HANDHELD= 'https://pozo.dev/downloads/resources/Handheld.apk'
|
ENV_ANDROID_HANDHELD= 'https://pozo.dev/downloads/resources/Handheld.apk'
|
||||||
# ENV_ANDROID_BILLING= 'https://pozo.dev/downloads/resources/PozoApp.apk'
|
ENV_ANDROID_BILLING= 'https://pozo.dev/downloads/resources/PozoApp.apk'
|
||||||
# ENV_EMAIL_API='https://api.pozo.dev/pozo-sms-email-template-api'
|
ENV_EMAIL_API='https://api.pozo.dev/pozo-sms-email-template-api'
|
||||||
|
|
|
||||||
|
|
@ -1557,7 +1557,7 @@ const AppPage = () => {
|
||||||
),
|
),
|
||||||
getItem(
|
getItem(
|
||||||
'HOME',
|
'HOME',
|
||||||
`${subDirectory}app-page/home`,
|
`${subDirectory}`,
|
||||||
<BiHomeSmile className="iconsize" />
|
<BiHomeSmile className="iconsize" />
|
||||||
),
|
),
|
||||||
getItem(
|
getItem(
|
||||||
|
|
@ -1607,7 +1607,7 @@ const AppPage = () => {
|
||||||
),
|
),
|
||||||
getItem(
|
getItem(
|
||||||
'HOME',
|
'HOME',
|
||||||
`${subDirectory}app-page/home`,
|
`${subDirectory}`,
|
||||||
<BiHomeSmile className="iconsize" />
|
<BiHomeSmile className="iconsize" />
|
||||||
),
|
),
|
||||||
getItem(
|
getItem(
|
||||||
|
|
@ -1643,7 +1643,7 @@ const AppPage = () => {
|
||||||
|
|
||||||
getItem(
|
getItem(
|
||||||
'Dashboard',
|
'Dashboard',
|
||||||
`${subDirectory}app-page/home`,
|
`${subDirectory}`,
|
||||||
<MdInsertChartOutlined className="iconsize" />
|
<MdInsertChartOutlined className="iconsize" />
|
||||||
),
|
),
|
||||||
getItem('Master', `${subDirectory}master`, <MdDisplaySettings />, [
|
getItem('Master', `${subDirectory}master`, <MdDisplaySettings />, [
|
||||||
|
|
@ -2117,7 +2117,7 @@ const AppPage = () => {
|
||||||
|
|
||||||
getItem(
|
getItem(
|
||||||
'Dashboard',
|
'Dashboard',
|
||||||
`${subDirectory}app-page/home`,
|
`${subDirectory}`,
|
||||||
<MdInsertChartOutlined className="iconsize" />
|
<MdInsertChartOutlined className="iconsize" />
|
||||||
),
|
),
|
||||||
SadminUserSettingMenu?.length > 0 &&
|
SadminUserSettingMenu?.length > 0 &&
|
||||||
|
|
@ -2212,7 +2212,7 @@ const AppPage = () => {
|
||||||
),
|
),
|
||||||
getItem(
|
getItem(
|
||||||
'Dashboard',
|
'Dashboard',
|
||||||
`${subDirectory}app-page/home`,
|
`${subDirectory}`,
|
||||||
<MdInsertChartOutlined className="iconsize" />
|
<MdInsertChartOutlined className="iconsize" />
|
||||||
),
|
),
|
||||||
getItem('Master', `${subDirectory}master`, <MdDisplaySettings />, [
|
getItem('Master', `${subDirectory}master`, <MdDisplaySettings />, [
|
||||||
|
|
@ -2703,7 +2703,7 @@ const AppPage = () => {
|
||||||
),
|
),
|
||||||
getItem(
|
getItem(
|
||||||
'Dashboard',
|
'Dashboard',
|
||||||
`${subDirectory}app-page/home`,
|
`${subDirectory}`,
|
||||||
<MdInsertChartOutlined className="iconsize" />
|
<MdInsertChartOutlined className="iconsize" />
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
@ -2787,7 +2787,7 @@ const AppPage = () => {
|
||||||
// Retail Menu Flow Final END
|
// Retail Menu Flow Final END
|
||||||
// *************************** */
|
// *************************** */
|
||||||
|
|
||||||
const isCurrentPath = location.pathname === `${subDirectory}app-page/home`;
|
const isCurrentPath = location.pathname === `${subDirectory}`;
|
||||||
console.log(items, 'itemsitems');
|
console.log(items, 'itemsitems');
|
||||||
return (
|
return (
|
||||||
<div className="appPage">
|
<div className="appPage">
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,8 @@ const TurboAddForm = () => {
|
||||||
const prodSubCategories = useSelector(prodSubCatDataSelector);
|
const prodSubCategories = useSelector(prodSubCatDataSelector);
|
||||||
const allProdSubCategories = useSelector(allProdSubCatDataSelector);
|
const allProdSubCategories = useSelector(allProdSubCatDataSelector);
|
||||||
const searchText = useSelector(GlobalSearchData);
|
const searchText = useSelector(GlobalSearchData);
|
||||||
|
console.log(searchText,"GlobalSearchData");
|
||||||
|
console.log("new console")
|
||||||
// Session data
|
// Session data
|
||||||
const AppId = useMemo(() => getSession('AppId'), []);
|
const AppId = useMemo(() => getSession('AppId'), []);
|
||||||
const CompId = useMemo(() => getSession('CompId'), []);
|
const CompId = useMemo(() => getSession('CompId'), []);
|
||||||
|
|
@ -1957,7 +1959,8 @@ const TurboAddForm = () => {
|
||||||
<BarCodeScan
|
<BarCodeScan
|
||||||
style={{ FontSize: '12px', marginLeft: '8px' }}
|
style={{ FontSize: '12px', marginLeft: '8px' }}
|
||||||
onScan={(value) => {
|
onScan={(value) => {
|
||||||
changeSearchedData(value);
|
console.log('Scanned value:', value);
|
||||||
|
handleQrData(value);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import {
|
||||||
getCommonAppPreference,
|
getCommonAppPreference,
|
||||||
changeWarehouse,
|
changeWarehouse,
|
||||||
} from './Features/BrachLogin/BranchLogin.js';
|
} from './Features/BrachLogin/BranchLogin.js';
|
||||||
import { clearSession, getSession } from './Services/Others';
|
import { clearSession, getSession, sessionStore } from './Services/Others';
|
||||||
import {
|
import {
|
||||||
FeatureAddon,
|
FeatureAddon,
|
||||||
GlobalFeatAddOnData,
|
GlobalFeatAddOnData,
|
||||||
|
|
@ -43,7 +43,18 @@ const ProtectedRoutes = ({ routesConfig }) => {
|
||||||
const [accessCheckComplete, setAccessCheckComplete] = useState(false);
|
const [accessCheckComplete, setAccessCheckComplete] = useState(false);
|
||||||
const FeatureAddonData = useSelector(GlobalFeatAddOnData);
|
const FeatureAddonData = useSelector(GlobalFeatAddOnData);
|
||||||
useTemplate(CompId, BranchId, AppId);
|
useTemplate(CompId, BranchId, AppId);
|
||||||
|
sessionStore('AppId', 6);
|
||||||
|
sessionStore('BranchId', 556);
|
||||||
|
sessionStore('AppName', 'Bakery');
|
||||||
|
sessionStore('CompId', 462);
|
||||||
|
sessionStore('MobileNo', '6382594417');
|
||||||
|
sessionStore('UserType', 'Admin');
|
||||||
|
sessionStore('UserId', 1884);
|
||||||
|
sessionStore('userName', 'Karthiga');
|
||||||
|
sessionStore(
|
||||||
|
'auth',
|
||||||
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiNjM4MjU5NDQxNyIsIlBhc3N3b3JkIjoiWkB6NDEwNDg0IiwiYXVkIjpbImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tcmV0YWlsLWFwaSIsImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tY29tbW9uLWFwaSIsImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tc21zLWVtYWlsLXRlbXBsYXRlLWFwaSIsImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tY29tbW9uLWFwaSJdLCJleHAiOjE3NzUxNTgwNTIsImlzcyI6Imh0dHBzOi8vYXBpLnBvem8uZGV2L0p3dFRva2VuIn0.xPuA6vnS7UdDWAnwMLEPhV0UcqPCwtb7tllpMYjOb-A'
|
||||||
|
);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getApplicationPreference();
|
getApplicationPreference();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
@ -269,221 +280,221 @@ const ProtectedRoutes = ({ routesConfig }) => {
|
||||||
).unwrap();
|
).unwrap();
|
||||||
if (response?.data?.statusCode === 1) {
|
if (response?.data?.statusCode === 1) {
|
||||||
if (response?.data?.data?.length == 1) {
|
if (response?.data?.data?.length == 1) {
|
||||||
navigate(`${subDirectory}app-page/home`);
|
navigate(`${subDirectory}`);
|
||||||
} else {
|
} else {
|
||||||
navigate(`${subDirectory}app-page/branch-login`);
|
navigate(`${subDirectory}app-page/branch-login`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
// useEffect(() => {
|
||||||
const performAccessChecks = async () => {
|
// const performAccessChecks = async () => {
|
||||||
if (!hasRedirected) {
|
// if (!hasRedirected) {
|
||||||
let featureAddon;
|
// let featureAddon;
|
||||||
let featureAddonData;
|
// let featureAddonData;
|
||||||
|
|
||||||
if (UserType !== 'Super Admin' && UserType !== 'Super Admin User') {
|
// if (UserType !== 'Super Admin' && UserType !== 'Super Admin User') {
|
||||||
if (FeatureAddonData?.FeatureDtls?.length > 0) {
|
// if (FeatureAddonData?.FeatureDtls?.length > 0) {
|
||||||
featureAddonData = FeatureAddonData?.FeatureDtls;
|
// featureAddonData = FeatureAddonData?.FeatureDtls;
|
||||||
} else {
|
// } else {
|
||||||
featureAddon = await dispatch(
|
// featureAddon = await dispatch(
|
||||||
FeatureAddon({ AppId: AppId, UserId: UserId })
|
// FeatureAddon({ AppId: AppId, UserId: UserId })
|
||||||
).unwrap();
|
// ).unwrap();
|
||||||
if (featureAddon?.data?.statusCode === 1) {
|
// if (featureAddon?.data?.statusCode === 1) {
|
||||||
featureAddonData =
|
// featureAddonData =
|
||||||
featureAddon?.data?.data?.[0]?.FeatAddonHdr?.[0]?.FeatureDtls;
|
// featureAddon?.data?.data?.[0]?.FeatAddonHdr?.[0]?.FeatureDtls;
|
||||||
} else {
|
// } else {
|
||||||
featureAddonData = [];
|
// featureAddonData = [];
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
const currentPath = location.pathname.replace(/\/$/, ''); // Remove trailing slash
|
// const currentPath = location.pathname.replace(/\/$/, ''); // Remove trailing slash
|
||||||
let shouldNavigate = false;
|
// let shouldNavigate = false;
|
||||||
|
|
||||||
// Find the current route in routesConfig based on currentPath
|
// // Find the current route in routesConfig based on currentPath
|
||||||
const currentRoute = routesConfig?.find((route) => {
|
// const currentRoute = routesConfig?.find((route) => {
|
||||||
if (route.path === currentPath) return true;
|
// if (route.path === currentPath) return true;
|
||||||
if (route.children) {
|
// if (route.children) {
|
||||||
return route.children.some((child) => {
|
// return route.children.some((child) => {
|
||||||
const childPath = `${route.path}/${child.path}`;
|
// const childPath = `${route.path}/${child.path}`;
|
||||||
return childPath === currentPath;
|
// return childPath === currentPath;
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
return false;
|
// return false;
|
||||||
});
|
// });
|
||||||
|
|
||||||
if (!currentRoute) {
|
// if (!currentRoute) {
|
||||||
// alert("Unauthorized action detected. You have been logged out.")
|
// // alert("Unauthorized action detected. You have been logged out.")
|
||||||
Logout();
|
// Logout();
|
||||||
setHasRedirected(true);
|
// setHasRedirected(true);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
const empAccessData = getEmpAccessFromChildren(
|
// const empAccessData = getEmpAccessFromChildren(
|
||||||
currentRoute,
|
// currentRoute,
|
||||||
currentPath
|
// currentPath
|
||||||
);
|
// );
|
||||||
const accessData = getEmpAccessDataFromChildren(
|
// const accessData = getEmpAccessDataFromChildren(
|
||||||
currentRoute,
|
// currentRoute,
|
||||||
currentPath
|
// currentPath
|
||||||
);
|
// );
|
||||||
|
|
||||||
const checkPreferenceAccessData = ['Dine In', 'KOT', 'Estimate'];
|
// const checkPreferenceAccessData = ['Dine In', 'KOT', 'Estimate'];
|
||||||
const checkPlanAccessData = [
|
// const checkPlanAccessData = [
|
||||||
'Product Catalogue',
|
// 'Product Catalogue',
|
||||||
'Sales Setup',
|
// 'Sales Setup',
|
||||||
'Print Setup',
|
// 'Print Setup',
|
||||||
'Kiosk Setup',
|
// 'Kiosk Setup',
|
||||||
'Kiosk Sales',
|
// 'Kiosk Sales',
|
||||||
];
|
// ];
|
||||||
// Cmd it start
|
// // Cmd it start
|
||||||
|
|
||||||
// if (!UserId && empAccessData != 'Public') {
|
// // if (!UserId && empAccessData != 'Public') {
|
||||||
// if (!UserId && (empAccessData === "Kiosk Sales" || empAccessData === "View Bill")) {
|
// // if (!UserId && (empAccessData === "Kiosk Sales" || empAccessData === "View Bill")) {
|
||||||
// // Allow KioskBookingPage to load and set session values
|
// // // Allow KioskBookingPage to load and set session values
|
||||||
// setAccessCheckComplete(true);
|
// // setAccessCheckComplete(true);
|
||||||
// return;
|
// // return;
|
||||||
// }else{
|
// // }else{
|
||||||
// console.log("UserId is undefined, logging out...");
|
// // console.log("UserId is undefined, logging out...");
|
||||||
// // alert("User invalid. Redirecting to login...")
|
// // // alert("User invalid. Redirecting to login...")
|
||||||
// sessionStorage.clear();
|
// // sessionStorage.clear();
|
||||||
// window.location.replace(`${commonUrl}`);
|
// // window.location.replace(`${commonUrl}`);
|
||||||
// setHasRedirected(true);
|
// // setHasRedirected(true);
|
||||||
// return;
|
// // return;
|
||||||
// }
|
// // }
|
||||||
// }
|
// // }
|
||||||
|
|
||||||
// Cmd it End
|
// // Cmd it End
|
||||||
const userAccessChecks = {
|
// const userAccessChecks = {
|
||||||
'Super Admin': () => {
|
// 'Super Admin': () => {
|
||||||
let empPreferenceCheck = true;
|
// let empPreferenceCheck = true;
|
||||||
if (checkPreferenceAccessData.includes(empAccessData)) {
|
// if (checkPreferenceAccessData.includes(empAccessData)) {
|
||||||
empPreferenceCheck = checkAccess(empAccessData);
|
// empPreferenceCheck = checkAccess(empAccessData);
|
||||||
} else {
|
// } else {
|
||||||
empPreferenceCheck = true;
|
// empPreferenceCheck = true;
|
||||||
}
|
// }
|
||||||
return !empPreferenceCheck;
|
// return !empPreferenceCheck;
|
||||||
},
|
// },
|
||||||
'Super Admin User': async () => {
|
// 'Super Admin User': async () => {
|
||||||
const SAdminuserPin = await dispatch(
|
// const SAdminuserPin = await dispatch(
|
||||||
checkSession({ UserId, sessionId })
|
// checkSession({ UserId, sessionId })
|
||||||
).unwrap();
|
// ).unwrap();
|
||||||
if (
|
// if (
|
||||||
(SAdminuserPin?.data?.statusCode === 1 &&
|
// (SAdminuserPin?.data?.statusCode === 1 &&
|
||||||
SAdminuserPin?.data?.data?.filter(
|
// SAdminuserPin?.data?.data?.filter(
|
||||||
(item) =>
|
// (item) =>
|
||||||
item?.AppId == AppId &&
|
// item?.AppId == AppId &&
|
||||||
item?.CompId == CompId &&
|
// item?.CompId == CompId &&
|
||||||
item?.BranchId == BranchId
|
// item?.BranchId == BranchId
|
||||||
)?.[0]?.Status === 'L') ||
|
// )?.[0]?.Status === 'L') ||
|
||||||
BranchId === null ||
|
// BranchId === null ||
|
||||||
BranchId === '' ||
|
// BranchId === '' ||
|
||||||
BranchId === undefined
|
// BranchId === undefined
|
||||||
) {
|
// ) {
|
||||||
if (sessionStorage.getItem('BranchId') !== null) {
|
// if (sessionStorage.getItem('BranchId') !== null) {
|
||||||
clearSession('BranchId');
|
// clearSession('BranchId');
|
||||||
}
|
// }
|
||||||
fetchBranchData();
|
// fetchBranchData();
|
||||||
} else {
|
// } else {
|
||||||
if (empAccessData) {
|
// if (empAccessData) {
|
||||||
const superAdminUserAccessCheck =
|
// const superAdminUserAccessCheck =
|
||||||
await checkSuperAdminUserAccess(empAccessData, currentPath);
|
// await checkSuperAdminUserAccess(empAccessData, currentPath);
|
||||||
let empPreferenceCheck = true;
|
// let empPreferenceCheck = true;
|
||||||
if (checkPreferenceAccessData.includes(empAccessData)) {
|
// if (checkPreferenceAccessData.includes(empAccessData)) {
|
||||||
empPreferenceCheck = checkAccess(empAccessData);
|
// empPreferenceCheck = checkAccess(empAccessData);
|
||||||
} else {
|
// } else {
|
||||||
empPreferenceCheck = true;
|
// empPreferenceCheck = true;
|
||||||
}
|
// }
|
||||||
return !superAdminUserAccessCheck || !empPreferenceCheck;
|
// return !superAdminUserAccessCheck || !empPreferenceCheck;
|
||||||
} else {
|
// } else {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
Admin: () => {
|
// Admin: () => {
|
||||||
if (accessData === 'Super Admin') {
|
// if (accessData === 'Super Admin') {
|
||||||
return true;
|
// return true;
|
||||||
} else {
|
// } else {
|
||||||
let empPreferenceCheck = true;
|
// let empPreferenceCheck = true;
|
||||||
let empPlanAccessCheck = true;
|
// let empPlanAccessCheck = true;
|
||||||
|
|
||||||
if (checkPreferenceAccessData.includes(empAccessData)) {
|
// if (checkPreferenceAccessData.includes(empAccessData)) {
|
||||||
empPreferenceCheck = checkAccess(empAccessData);
|
// empPreferenceCheck = checkAccess(empAccessData);
|
||||||
} else {
|
// } else {
|
||||||
empPreferenceCheck = true;
|
// empPreferenceCheck = true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (checkPlanAccessData.includes(empAccessData)) {
|
// if (checkPlanAccessData.includes(empAccessData)) {
|
||||||
empPlanAccessCheck = checkPlanAccess(
|
// empPlanAccessCheck = checkPlanAccess(
|
||||||
empAccessData,
|
// empAccessData,
|
||||||
featureAddonData
|
// featureAddonData
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
empPlanAccessCheck = true;
|
// empPlanAccessCheck = true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
return !empPreferenceCheck || !empPlanAccessCheck;
|
// return !empPreferenceCheck || !empPlanAccessCheck;
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
Employee: async () => {
|
// Employee: async () => {
|
||||||
if (empAccessData && accessData !== 'Super Admin') {
|
// if (empAccessData && accessData !== 'Super Admin') {
|
||||||
const empAccessCheck = await checkEmpAccess(
|
// const empAccessCheck = await checkEmpAccess(
|
||||||
empAccessData,
|
// empAccessData,
|
||||||
currentPath
|
// currentPath
|
||||||
);
|
// );
|
||||||
let empPreferenceCheck = true;
|
// let empPreferenceCheck = true;
|
||||||
let empPlanAccessCheck = true;
|
// let empPlanAccessCheck = true;
|
||||||
|
|
||||||
if (checkPreferenceAccessData.includes(empAccessData)) {
|
// if (checkPreferenceAccessData.includes(empAccessData)) {
|
||||||
empPreferenceCheck = checkAccess(empAccessData);
|
// empPreferenceCheck = checkAccess(empAccessData);
|
||||||
} else {
|
// } else {
|
||||||
empPreferenceCheck = true;
|
// empPreferenceCheck = true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (checkPlanAccessData.includes(empAccessData)) {
|
// if (checkPlanAccessData.includes(empAccessData)) {
|
||||||
empPlanAccessCheck = checkPlanAccess(
|
// empPlanAccessCheck = checkPlanAccess(
|
||||||
empAccessData,
|
// empAccessData,
|
||||||
featureAddonData
|
// featureAddonData
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
empPlanAccessCheck = true;
|
// empPlanAccessCheck = true;
|
||||||
}
|
// }
|
||||||
if (location.pathname === '/app-page/relieve-request') {
|
// if (location.pathname === '/app-page/relieve-request') {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
return (
|
// return (
|
||||||
!empAccessCheck || !empPreferenceCheck || !empPlanAccessCheck
|
// !empAccessCheck || !empPreferenceCheck || !empPlanAccessCheck
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
if (accessData === 'Super Admin') {
|
// if (accessData === 'Super Admin') {
|
||||||
return true;
|
// return true;
|
||||||
} else {
|
// } else {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
};
|
// };
|
||||||
|
|
||||||
if (userAccessChecks[UserType]) {
|
// if (userAccessChecks[UserType]) {
|
||||||
shouldNavigate = await userAccessChecks[UserType]();
|
// shouldNavigate = await userAccessChecks[UserType]();
|
||||||
} else {
|
// } else {
|
||||||
shouldNavigate = true;
|
// shouldNavigate = true;
|
||||||
}
|
// }
|
||||||
console.log('shouldNavigate', shouldNavigate);
|
// console.log('shouldNavigate', shouldNavigate);
|
||||||
if (shouldNavigate) {
|
// if (shouldNavigate) {
|
||||||
// alert("Unauthorized action detected. You have been logged out.")
|
// // alert("Unauthorized action detected. You have been logged out.")
|
||||||
Logout();
|
// Logout();
|
||||||
setHasRedirected(true);
|
// setHasRedirected(true);
|
||||||
} else {
|
// } else {
|
||||||
console.log('Access granted for current route.');
|
// console.log('Access granted for current route.');
|
||||||
}
|
// }
|
||||||
|
|
||||||
setAccessCheckComplete(true);
|
// setAccessCheckComplete(true);
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
performAccessChecks();
|
// performAccessChecks();
|
||||||
}, [UserType, routesConfig, navigate, hasRedirected, location.pathname]);
|
// }, [UserType, routesConfig, navigate, hasRedirected, location.pathname]);
|
||||||
|
|
||||||
const Logout = async () => {
|
const Logout = async () => {
|
||||||
const status = 'N'; // replace with your actual status
|
const status = 'N'; // replace with your actual status
|
||||||
|
|
@ -531,7 +542,7 @@ const ProtectedRoutes = ({ routesConfig }) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Suspense fallback={<div></div>}>
|
<Suspense fallback={<div></div>}>
|
||||||
<Routes>{accessCheckComplete && renderRoutes(routesConfig)}</Routes>
|
<Routes>{ renderRoutes(routesConfig)}</Routes>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
266
src/check.html
266
src/check.html
|
|
@ -1,38 +1,270 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
var loc = window.location;
|
||||||
|
if (
|
||||||
|
loc.protocol === "capacitor:" ||
|
||||||
|
loc.protocol === "file:" ||
|
||||||
|
loc.href === "about:blank"
|
||||||
|
) {
|
||||||
|
var base = document.createElement("base");
|
||||||
|
base.href = "http://192.168.1.35:3015/";
|
||||||
|
document.head.appendChild(base);
|
||||||
|
window.location.replace("http://192.168.1.35:3015/");
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" href="/fav.ico" />
|
<link rel="icon" href="/fav.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta
|
||||||
|
name="viewport"
|
||||||
|
content="width=device-width, initial-scale=1.0, user-scalable=no"
|
||||||
|
/>
|
||||||
|
<!-- <link
|
||||||
|
rel="stylesheet"
|
||||||
|
href="https://cdn.jsdelivr.net/npm/antd/dist/reset.css"
|
||||||
|
/> -->
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
|
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
|
<link
|
||||||
|
rel="preload"
|
||||||
|
as="font"
|
||||||
|
href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,400;0,500;0,600;0,700;1,200&display=swap"
|
||||||
|
rel="stylesheet"
|
||||||
|
/>
|
||||||
|
<link
|
||||||
|
href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&family=Manrope:wght@200;300;400;500;600;700;800&family=Montserrat:wght@400;500;600;700&family=Poppins:ital,wght@1,200&display=swap"
|
||||||
|
/>
|
||||||
|
<link
|
||||||
|
href="https://fonts.googleapis.com/css2?family=Arimo:ital,wght@0,400..700;1,400..700&family=Crimson+Pro:ital,wght@0,200..900;1,200..900&family=Dhurjati&family=Diplomata+SC&family=Inconsolata:wght@200..900&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&family=Lexend+Zetta:wght@200;300;400;500;700&family=Libre+Franklin:ital,wght@0,100..900;1,100..900&family=Podkova:wght@400..800&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto+Slab:wght@200;300;400;500;600;700&family=VT323&family=Cute+Font&family=Kumar+One&family=Lemon&family=Lily+Script+One&family=M+PLUS+Rounded+1c&family=Maiden+Orange&family=Kode+Mono:wght@400..700&display=swap"
|
||||||
|
rel="stylesheet"
|
||||||
|
/>
|
||||||
|
<link
|
||||||
|
href="https://fonts.googleapis.com/css2?family=Fredoka:wght@300..700&display=swap"
|
||||||
|
rel="stylesheet"
|
||||||
|
/>
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
|
<link
|
||||||
|
href="https://fonts.googleapis.com/css2?family=Freeman&display=swap"
|
||||||
|
rel="stylesheet"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
|
<link
|
||||||
|
href="https://fonts.googleapis.com/css2?family=Concert+One&display=swap"
|
||||||
|
rel="stylesheet"
|
||||||
|
/>
|
||||||
|
|
||||||
<link
|
<link
|
||||||
href="https://fonts.googleapis.com/css2?family=Calistoga&display=swap"
|
href="https://fonts.googleapis.com/css2?family=Calistoga&display=swap"
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
/>
|
/>
|
||||||
|
<link
|
||||||
|
href="https://fonts.googleapis.com/css2?family=Calistoga&display=swap"
|
||||||
|
rel="stylesheet"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- <link href="https://vjs.zencdn.net/8.3.0/video-js.css" rel="stylesheet" /> -->
|
||||||
|
<!-- <link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet"> -->
|
||||||
|
|
||||||
<title>Pozo Retail Software</title>
|
<title>Pozo Retail Software</title>
|
||||||
|
<!-- mohan -->
|
||||||
|
<!-- <script>
|
||||||
|
// Disable right-cli ck menu and common hotkeys
|
||||||
|
document.addEventListener("contextmenu", (event) => event.preventDefault());
|
||||||
|
document.addEventListener("keydown", (event) => {
|
||||||
|
if (
|
||||||
|
(event.ctrlKey && event.shiftKey && ["I", "J", "C"].includes(event.key.toUpperCase())) ||
|
||||||
|
(event.ctrlKey && ["U", "S"].includes(event.key.toUpperCase())) ||
|
||||||
|
event.key === "F12"
|
||||||
|
) {
|
||||||
|
event.preventDefault();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script> -->
|
||||||
|
<!-- public/index.html -->
|
||||||
<script>
|
<script>
|
||||||
// Disable right-click menu and common hotkeys
|
// Safety check for older WebViews
|
||||||
document.addEventListener('contextmenu', (event) =>
|
try {
|
||||||
event.preventDefault()
|
document.querySelector(":where(div)");
|
||||||
);
|
} catch (e) {
|
||||||
document.addEventListener('keydown', (event) => {
|
console.warn(
|
||||||
if (
|
"Old WebView detected - StyleProvider fix should handle this",
|
||||||
(event.ctrlKey &&
|
);
|
||||||
event.shiftKey &&
|
}
|
||||||
['I', 'J', 'C'].includes(event.key.toUpperCase())) ||
|
|
||||||
(event.ctrlKey && ['U', 'S'].includes(event.key.toUpperCase())) ||
|
|
||||||
event.key === 'F12'
|
|
||||||
) {
|
|
||||||
event.preventDefault();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/eruda"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/eruda-network"></script>
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
// Always enable Eruda
|
||||||
|
eruda.init();
|
||||||
|
eruda.add(erudaNetwork);
|
||||||
|
eruda.show();
|
||||||
|
|
||||||
|
console.log("✅ Eruda Debug Console Loaded (Always On)");
|
||||||
|
|
||||||
|
// Axios interceptor for API logs
|
||||||
|
setTimeout(() => {
|
||||||
|
if (window.axios) {
|
||||||
|
axios.interceptors.request.use((config) => {
|
||||||
|
console.log(
|
||||||
|
"[API Request]",
|
||||||
|
config.method?.toUpperCase(),
|
||||||
|
config.url,
|
||||||
|
config.data,
|
||||||
|
);
|
||||||
|
return config;
|
||||||
|
});
|
||||||
|
axios.interceptors.response.use(
|
||||||
|
(response) => {
|
||||||
|
console.log(
|
||||||
|
"[API Response]",
|
||||||
|
response.config.url,
|
||||||
|
response.status,
|
||||||
|
response.data,
|
||||||
|
);
|
||||||
|
return response;
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
console.error("[API Error]", error.config?.url, error.message);
|
||||||
|
return Promise.reject(error);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
console.log("✅ Axios interceptors attached");
|
||||||
|
} else {
|
||||||
|
console.warn("⚠️ Axios not found on window");
|
||||||
|
}
|
||||||
|
}, 2000);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* ============================================
|
||||||
|
Android POS - Global Fixes
|
||||||
|
Targets Android WebView (Chrome 83 and below)
|
||||||
|
where flex `gap` is NOT supported
|
||||||
|
============================================ */
|
||||||
|
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ============================================
|
||||||
|
FIX 1: flex gap fallback for Android WebView
|
||||||
|
`gap` in flexbox needs Chrome 84+.
|
||||||
|
We use margin-based spacing as a universal fallback.
|
||||||
|
This targets ALL flex containers globally.
|
||||||
|
============================================ */
|
||||||
|
|
||||||
|
/* Ant Design specific flex gap fixes */
|
||||||
|
.ant-space-horizontal > .ant-space-item:not(:last-child) {
|
||||||
|
margin-right: 8px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-space-vertical > .ant-space-item:not(:last-child) {
|
||||||
|
margin-bottom: 8px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ant Design Row/Col gap fix */
|
||||||
|
.ant-row {
|
||||||
|
display: -webkit-box !important;
|
||||||
|
display: -webkit-flex !important;
|
||||||
|
display: flex !important;
|
||||||
|
-webkit-flex-wrap: wrap !important;
|
||||||
|
flex-wrap: wrap !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ============================================
|
||||||
|
FIX 2: :where() selector fallback for Chrome 83
|
||||||
|
Ant Design v5 uses :where() which breaks on
|
||||||
|
older Android WebViews
|
||||||
|
============================================ */
|
||||||
|
.ant-btn {
|
||||||
|
display: inline-block;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-form-item {
|
||||||
|
display: block;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Flex display with webkit prefix for old WebViews */
|
||||||
|
.ant-flex,
|
||||||
|
.ant-space,
|
||||||
|
.ant-row,
|
||||||
|
.ant-card,
|
||||||
|
.ant-card-body {
|
||||||
|
display: -webkit-box !important;
|
||||||
|
display: -webkit-flex !important;
|
||||||
|
display: flex !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ============================================
|
||||||
|
FIX 3: Ant Design Modal Override for Android
|
||||||
|
============================================ */
|
||||||
|
.ant-modal-wrap {
|
||||||
|
position: fixed !important;
|
||||||
|
top: 0 !important;
|
||||||
|
left: 0 !important;
|
||||||
|
width: 100% !important;
|
||||||
|
height: 100% !important;
|
||||||
|
/* z-index: 1000 !important; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-modal {
|
||||||
|
margin: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ============================================
|
||||||
|
FIX 4: Safe area support for notch devices
|
||||||
|
============================================ */
|
||||||
|
@supports (padding: max(0px)) {
|
||||||
|
body {
|
||||||
|
padding-left: env(safe-area-inset-left);
|
||||||
|
padding-right: env(safe-area-inset-right);
|
||||||
|
padding-top: env(safe-area-inset-top);
|
||||||
|
padding-bottom: env(safe-area-inset-bottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<script type="module" src="/src/main.jsx"></script>
|
<script type="module" src="/src/main.jsx"></script>
|
||||||
|
<script
|
||||||
|
type="module"
|
||||||
|
href="@import url('https://fonts.googleapis.com/css2?family=Calistoga&display=swap')"
|
||||||
|
></script>
|
||||||
|
<!-- <script src="https://vjs.zencdn.net/8.3.0/video.min.js"></script> -->
|
||||||
|
<!-- <script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script> -->
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
<!-- <iframe id="ifmcontentstoprint" style="
|
||||||
|
height: 0px;
|
||||||
|
width: 0px;
|
||||||
|
position: absolute;
|
||||||
|
padding: 0px;
|
||||||
|
margin: 0px;
|
||||||
|
/* font-family: 'Poppins', sans-serif; */
|
||||||
|
"></iframe> -->
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
856
src/check.jsx
856
src/check.jsx
|
|
@ -1,539 +1,387 @@
|
||||||
import { useEffect, useState } from 'react';
|
// import React, { useRef, useState, useEffect } from "react";
|
||||||
import { Routes, Route, useNavigate } from 'react-router-dom';
|
// import { BarcodeScanner } from "@capacitor-mlkit/barcode-scanning";
|
||||||
import { useDispatch } from 'react-redux';
|
// import { BsUpcScan } from "react-icons/bs";
|
||||||
import {
|
// import { BrowserMultiFormatReader } from "@zxing/library";
|
||||||
getEmpAccesData,
|
// import { Capacitor } from "@capacitor/core";
|
||||||
GenerateLogout,
|
// import { DefaultModal } from "../Components/Modal/DefaultModal";
|
||||||
getSAdminUserAccesData,
|
|
||||||
PricingAppPricingName,
|
|
||||||
checkSession,
|
|
||||||
getCompBranchData,
|
|
||||||
getCommonAppPreference,
|
|
||||||
changeWarehouse,
|
|
||||||
} from './Features/BrachLogin/BranchLogin.js';
|
|
||||||
import { clearSession, getSession } from './Services/Others';
|
|
||||||
import {
|
|
||||||
FeatureAddon,
|
|
||||||
GlobalFeatAddOnData,
|
|
||||||
} from './Features/BookingScreen/BookingData/BookingData.js';
|
|
||||||
import { Suspense } from 'react';
|
|
||||||
import { gettableData } from './Features/PreferenceMaster/PreferenceMaster.js';
|
|
||||||
import { useSelector } from 'react-redux';
|
|
||||||
import { useTemplate } from './utils/useTemplate.js';
|
|
||||||
|
|
||||||
const commonUrl = import.meta.env.ENV_COMMON_BASE_URL;
|
// export default function BarCodeScan({ onScan }) {
|
||||||
const subDirectory = import.meta.env.BASE_URL;
|
// const isMobileApp = Capacitor.getPlatform() !== "web";
|
||||||
|
// const [scanning, setScanning] = useState(false);
|
||||||
|
// const [modalOpen, setModalOpen] = useState(false);
|
||||||
|
// const videoRef = useRef(null);
|
||||||
|
// const codeReaderRef = useRef(null);
|
||||||
|
// const streamRef = useRef(null);
|
||||||
|
|
||||||
const ProtectedRoutes = ({ routesConfig }) => {
|
// const startScan = async () => {
|
||||||
useTemplate(
|
// if (scanning) return;
|
||||||
getSession('CompId'),
|
// setScanning(true);
|
||||||
getSession('BranchId'),
|
|
||||||
getSession('AppId')
|
|
||||||
);
|
|
||||||
const navigate = useNavigate();
|
|
||||||
const dispatch = useDispatch();
|
|
||||||
const UserType = getSession('UserType');
|
|
||||||
const [hasRedirected, setHasRedirected] = useState(false);
|
|
||||||
const AppId = getSession('AppId');
|
|
||||||
const CompId = getSession('CompId');
|
|
||||||
const BranchId = getSession('BranchId');
|
|
||||||
const UserId = getSession('UserId');
|
|
||||||
const sessionId = getSession('SessionId');
|
|
||||||
const Warehouse = getSession('Warehouse');
|
|
||||||
const [accessCheckComplete, setAccessCheckComplete] = useState(false);
|
|
||||||
const FeatureAddonData = useSelector(GlobalFeatAddOnData);
|
|
||||||
useTemplate(CompId, BranchId, AppId);
|
|
||||||
|
|
||||||
useEffect(() => {
|
// if (isMobileApp) {
|
||||||
getApplicationPreference();
|
// // Mobile: MLKit scanner
|
||||||
}, []);
|
// try {
|
||||||
//sri
|
// const perm = await BarcodeScanner.requestPermissions();
|
||||||
useEffect(() => {
|
// if (perm.camera !== "granted") {
|
||||||
if (Warehouse) {
|
// alert("Camera permission not granted");
|
||||||
dispatch(changeWarehouse(true));
|
// setScanning(false);
|
||||||
}
|
// return;
|
||||||
}, [Warehouse]);
|
// }
|
||||||
const getApplicationPreference = async () => {
|
|
||||||
await dispatch(getCommonAppPreference(AppId)).unwrap();
|
|
||||||
};
|
|
||||||
|
|
||||||
const getEmpAccess = async () => {
|
// const { barcodes } = await BarcodeScanner.scan();
|
||||||
let data = {
|
// if (barcodes && barcodes.length > 0) {
|
||||||
UserId: UserId,
|
// onScan(barcodes[0].rawValue);
|
||||||
AppId: AppId,
|
// }
|
||||||
CompId: CompId,
|
// } catch (err) {
|
||||||
BranchId: BranchId,
|
// alert("Error scanning barcode: " + err.message);
|
||||||
};
|
// } finally {
|
||||||
|
// setScanning(false);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// // Web: open modal and start camera
|
||||||
|
// setModalOpen(true);
|
||||||
|
// setTimeout(() => startWebScan(), 50); // wait for modal DOM
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
const response = await dispatch(getEmpAccesData(data)).unwrap();
|
// const startWebScan = async () => {
|
||||||
if (response?.data?.statusCode === 1) {
|
// try {
|
||||||
return response?.data?.data?.[0]?.EmpAccessDetails;
|
// codeReaderRef.current = new BrowserMultiFormatReader();
|
||||||
}
|
// streamRef.current = await navigator.mediaDevices.getUserMedia({
|
||||||
return null;
|
// video: { facingMode: "environment" },
|
||||||
};
|
// });
|
||||||
|
// if (videoRef.current) {
|
||||||
|
// videoRef.current.srcObject = streamRef.current;
|
||||||
|
// videoRef.current.play();
|
||||||
|
// }
|
||||||
|
|
||||||
const getSadminUserAccess = async () => {
|
// codeReaderRef.current.decodeFromVideoDevice(
|
||||||
let data = {
|
// null,
|
||||||
UserId: UserId,
|
// videoRef.current,
|
||||||
AppId: AppId,
|
// (result) => {
|
||||||
};
|
// if (result) {
|
||||||
const response = await dispatch(getSAdminUserAccesData(data)).unwrap();
|
// onScan(result.getText());
|
||||||
if (response?.data?.statusCode === 1) {
|
// stopWebScan();
|
||||||
return response?.data?.data?.[0]?.AppMenuAccessDetails;
|
// setModalOpen(false);
|
||||||
}
|
// }
|
||||||
return null;
|
// }
|
||||||
};
|
// );
|
||||||
|
// } catch (err) {
|
||||||
|
// alert("Error accessing camera: " + err.message);
|
||||||
|
// setScanning(false);
|
||||||
|
// setModalOpen(false);
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
const Dinein = async () => {
|
// const stopWebScan = () => {
|
||||||
if (AppId && CompId && BranchId) {
|
// if (streamRef.current) {
|
||||||
let DineinData = {
|
// streamRef.current.getTracks().forEach((track) => track.stop());
|
||||||
AppId: AppId,
|
// streamRef.current = null;
|
||||||
CompId: CompId,
|
// }
|
||||||
BranchId: BranchId,
|
// if (codeReaderRef.current) {
|
||||||
UserId: UserId,
|
// codeReaderRef.current.reset();
|
||||||
};
|
// codeReaderRef.current = null;
|
||||||
const response = await dispatch(gettableData(DineinData)).unwrap();
|
// }
|
||||||
if (response?.data?.statusCode === 1) {
|
// setScanning(false);
|
||||||
const SettingValueData = response?.data?.data
|
// };
|
||||||
?.find((e) => e.AppId === AppId)
|
|
||||||
?.SettingDtlDetails?.some(
|
|
||||||
(e) => e.SettingIdName === 'DineIn' && e.SettingValue === 'Y'
|
|
||||||
);
|
|
||||||
const EstimateValueData = response?.data?.data
|
|
||||||
?.find((e) => e.AppId === AppId)
|
|
||||||
?.SettingDtlDetails?.some(
|
|
||||||
(e) => e.SettingIdName === 'Estimation' && e.SettingValue === 'Y'
|
|
||||||
);
|
|
||||||
return (SettingValueData, EstimateValueData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const checkAccess = async (empAccess) => {
|
// const closeModal = () => {
|
||||||
if (!empAccess) return false;
|
// stopWebScan();
|
||||||
let DineinData,
|
// setModalOpen(false);
|
||||||
EstimateData = await Dinein();
|
// };
|
||||||
switch (empAccess) {
|
|
||||||
case 'Dine In':
|
|
||||||
case 'KOT':
|
|
||||||
return !!DineinData;
|
|
||||||
case 'Estimate':
|
|
||||||
return !!EstimateData;
|
|
||||||
default:
|
|
||||||
return false; // Restrict access if no valid match found
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getPricingName = async () => {
|
// // Stop camera if component unmounts
|
||||||
if (!AppId || !UserId) return;
|
// useEffect(() => () => stopWebScan(), []);
|
||||||
const data = {
|
|
||||||
appId: AppId,
|
|
||||||
userId: UserId,
|
|
||||||
};
|
|
||||||
try {
|
|
||||||
const response = await dispatch(PricingAppPricingName(data)).unwrap();
|
|
||||||
const responseData = response?.data;
|
|
||||||
const pricingData = responseData?.data;
|
|
||||||
const hasAdvance = pricingData?.some(
|
|
||||||
(item) => item.PricingName === 'Premium'
|
|
||||||
);
|
|
||||||
const hasProOrAdvance =
|
|
||||||
hasAdvance ||
|
|
||||||
pricingData.some((item) => item.PricingName === 'Customized');
|
|
||||||
return (hasAdvance, hasProOrAdvance);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching pricing name:', error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const checkPlanAccess = async (empAccess, featureAddonData) => {
|
// return (
|
||||||
if (!empAccess) return false;
|
// <div style={{ display: "flex", justifyContent: "center", padding: 20 }}>
|
||||||
let Advance,
|
// {!scanning && (
|
||||||
ProORAdvance = await getPricingName();
|
// <BsUpcScan
|
||||||
switch (empAccess) {
|
// onClick={startScan}
|
||||||
case 'Product Catalogue':
|
// style={{ fontSize: 32, color: "#007bff", cursor: "pointer" }}
|
||||||
return (
|
// />
|
||||||
ProORAdvance ||
|
// )}
|
||||||
featureAddonData?.some(
|
|
||||||
(item) => item?.FeatureAddonName?.toLowerCase() === 'catalog'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
case 'Sales Setup':
|
|
||||||
case 'Print Setup':
|
|
||||||
return (
|
|
||||||
Advance ||
|
|
||||||
featureAddonData?.some(
|
|
||||||
(item) =>
|
|
||||||
item?.FeatureAddonName?.toLowerCase() === 'customized template'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
case 'Kiosk Setup':
|
|
||||||
case 'Kiosk Sales':
|
|
||||||
return featureAddonData?.some(
|
|
||||||
(item) => item?.FeatureAddonName?.toLowerCase() === 'kiosk sales'
|
|
||||||
);
|
|
||||||
default:
|
|
||||||
return false; // Restrict access if no valid match found
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const checkEmpAccess = async (empAccess, currentPath) => {
|
// <DefaultModal
|
||||||
if (!empAccess) return false;
|
// title="Barcode Reader"
|
||||||
const Access = await getEmpAccess();
|
// width={500}
|
||||||
let accessType;
|
// open={modalOpen}
|
||||||
if (currentPath.endsWith('/new')) {
|
// footer={false}
|
||||||
accessType = 'AddAccess';
|
// handleCancel={() => {
|
||||||
} else if (currentPath.endsWith('/update')) {
|
// closeModal();
|
||||||
accessType = 'UpdateAccess';
|
// }}
|
||||||
} else {
|
// >
|
||||||
accessType = 'ReadAccess';
|
// <div
|
||||||
}
|
// style={{
|
||||||
// const config = Access?.find(config =>
|
// display: "flex",
|
||||||
// config.ConfigName === empAccess && config[accessType] === 'Y'
|
// flexDirection: "column",
|
||||||
// );
|
// alignItems: "center",
|
||||||
const config = Access?.find(
|
// justifyContent: "center",
|
||||||
(config) =>
|
// }}
|
||||||
(config.ConfigName === empAccess && config[accessType] === 'Y') ||
|
// >
|
||||||
(currentPath.includes('supplier-master') &&
|
// <video
|
||||||
(config.ConfigName === 'Supplier' ||
|
// ref={videoRef}
|
||||||
config.ConfigName === 'Seller') &&
|
// style={{
|
||||||
config[accessType] === 'Y')
|
// width: "100%",
|
||||||
);
|
// maxWidth: 400,
|
||||||
|
// borderRadius: 8,
|
||||||
|
// border: "2px solid #000",
|
||||||
|
// }}
|
||||||
|
// />
|
||||||
|
|
||||||
return !!config;
|
// <button
|
||||||
};
|
// onClick={closeModal}
|
||||||
|
// style={{
|
||||||
|
// marginTop: 20,
|
||||||
|
// padding: "10px 20px",
|
||||||
|
// fontSize: 16,
|
||||||
|
// borderRadius: 8,
|
||||||
|
// border: "none",
|
||||||
|
// cursor: "pointer",
|
||||||
|
// }}
|
||||||
|
// >
|
||||||
|
// Close
|
||||||
|
// </button>
|
||||||
|
// </div>
|
||||||
|
// </DefaultModal>
|
||||||
|
|
||||||
const checkSuperAdminUserAccess = async (empAccess, currentPath) => {
|
// </div>
|
||||||
console.log('empAccessData1', empAccess, currentPath);
|
// );
|
||||||
if (!empAccess) return false;
|
// }
|
||||||
const Access = await getSadminUserAccess();
|
|
||||||
let accessType;
|
|
||||||
if (currentPath.endsWith('/new')) {
|
|
||||||
accessType = 'AddAccess';
|
|
||||||
} else if (currentPath.endsWith('/update')) {
|
|
||||||
accessType = 'UpdateAccess';
|
|
||||||
} else {
|
|
||||||
accessType = 'ReadAccess';
|
|
||||||
}
|
|
||||||
console.log('empAccessData2', Access, accessType);
|
|
||||||
// const config = Access?.find(config =>
|
|
||||||
// config.MenuName === empAccess && config[accessType] === 'Y'
|
|
||||||
// );
|
|
||||||
const config = Access?.find(
|
|
||||||
(config) =>
|
|
||||||
(config.MenuName === empAccess && config[accessType] === 'Y') ||
|
|
||||||
(currentPath.includes('supplier-master') &&
|
|
||||||
(config.MenuName === 'Supplier' || config.MenuName === 'Seller') &&
|
|
||||||
config[accessType] === 'Y')
|
|
||||||
);
|
|
||||||
console.log('empAccessData3', config);
|
|
||||||
|
|
||||||
return !!config;
|
import React, { useRef, useState, useEffect } from 'react';
|
||||||
};
|
import { BarcodeScanner } from '@capacitor-mlkit/barcode-scanning';
|
||||||
|
import { BsUpcScan } from 'react-icons/bs';
|
||||||
|
import { Capacitor } from '@capacitor/core';
|
||||||
|
import { DefaultModal } from '../Components/Modal/DefaultModal';
|
||||||
|
import QrScanner from 'qr-scanner/qr-scanner.min.js';
|
||||||
|
import { BrowserMultiFormatReader, BarcodeFormat } from '@zxing/library';
|
||||||
|
|
||||||
const getEmpAccessFromChildren = (route, currentPath) => {
|
QrScanner.WORKER_PATH = new URL(
|
||||||
if (route.path === currentPath) {
|
'qr-scanner/qr-scanner-worker.min.js',
|
||||||
return route.empAccess || null;
|
import.meta.url
|
||||||
}
|
).toString();
|
||||||
|
|
||||||
if (route.children) {
|
export default function BarCodeScan({ onScan }) {
|
||||||
for (const child of route.children) {
|
const isMobileApp = Capacitor.getPlatform() !== 'web';
|
||||||
const childPath = `${route.path}/${child.path}`;
|
const [scanning, setScanning] = useState(false);
|
||||||
if (childPath === currentPath) {
|
const [modalOpen, setModalOpen] = useState(false);
|
||||||
return child.empAccess || null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
const videoRef = useRef(null);
|
||||||
};
|
const qrScannerRef = useRef(null);
|
||||||
|
const barcodeReaderRef = useRef(null);
|
||||||
|
|
||||||
const getEmpAccessDataFromChildren = (route, currentPath) => {
|
// -------------------------
|
||||||
if (route.path === currentPath) {
|
// START SCAN
|
||||||
return route.access || null;
|
// -------------------------
|
||||||
}
|
const startScan = async () => {
|
||||||
if (route.children) {
|
if (scanning) return;
|
||||||
for (const child of route.children) {
|
setScanning(true);
|
||||||
const childPath = `${route.path}/${child.path}`;
|
|
||||||
if (childPath === currentPath) {
|
|
||||||
return child.access || null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const fetchBranchData = async () => {
|
if (isMobileApp) {
|
||||||
const response = await dispatch(
|
try {
|
||||||
getCompBranchData({ CompId: CompId, AppId: AppId })
|
const perm = await BarcodeScanner.requestPermissions();
|
||||||
).unwrap();
|
if (perm.camera !== 'granted') {
|
||||||
if (response?.data?.statusCode === 1) {
|
alert('Camera permission not granted');
|
||||||
if (response?.data?.data?.length == 1) {
|
setScanning(false);
|
||||||
navigate(`${subDirectory}app-page/home`);
|
|
||||||
} else {
|
|
||||||
navigate(`${subDirectory}app-page/branch-login`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
useEffect(() => {
|
|
||||||
const performAccessChecks = async () => {
|
|
||||||
if (!hasRedirected) {
|
|
||||||
let featureAddon;
|
|
||||||
let featureAddonData;
|
|
||||||
|
|
||||||
if (UserType !== 'Super Admin' && UserType !== 'Super Admin User') {
|
|
||||||
if (FeatureAddonData?.FeatureDtls?.length > 0) {
|
|
||||||
featureAddonData = FeatureAddonData?.FeatureDtls;
|
|
||||||
} else {
|
|
||||||
featureAddon = await dispatch(
|
|
||||||
FeatureAddon({ AppId: AppId, UserId: UserId })
|
|
||||||
).unwrap();
|
|
||||||
if (featureAddon?.data?.statusCode === 1) {
|
|
||||||
featureAddonData =
|
|
||||||
featureAddon?.data?.data?.[0]?.FeatAddonHdr?.[0]?.FeatureDtls;
|
|
||||||
} else {
|
|
||||||
featureAddonData = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const currentPath = location.pathname.replace(/\/$/, ''); // Remove trailing slash
|
|
||||||
let shouldNavigate = false;
|
|
||||||
|
|
||||||
// Find the current route in routesConfig based on currentPath
|
|
||||||
const currentRoute = routesConfig?.find((route) => {
|
|
||||||
if (route.path === currentPath) return true;
|
|
||||||
if (route.children) {
|
|
||||||
return route.children.some((child) => {
|
|
||||||
const childPath = `${route.path}/${child.path}`;
|
|
||||||
return childPath === currentPath;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!currentRoute) {
|
|
||||||
// alert("Unauthorized action detected. You have been logged out.")
|
|
||||||
Logout();
|
|
||||||
setHasRedirected(true);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const empAccessData = getEmpAccessFromChildren(
|
const { barcodes } = await BarcodeScanner.scan();
|
||||||
currentRoute,
|
if (barcodes?.length > 0) {
|
||||||
currentPath
|
onScan(barcodes[0].rawValue);
|
||||||
);
|
|
||||||
const accessData = getEmpAccessDataFromChildren(
|
|
||||||
currentRoute,
|
|
||||||
currentPath
|
|
||||||
);
|
|
||||||
|
|
||||||
const checkPreferenceAccessData = ['Dine In', 'KOT', 'Estimate'];
|
|
||||||
const checkPlanAccessData = [
|
|
||||||
'Product Catalogue',
|
|
||||||
'Sales Setup',
|
|
||||||
'Print Setup',
|
|
||||||
'Kiosk Setup',
|
|
||||||
'Kiosk Sales',
|
|
||||||
];
|
|
||||||
// Cmd it start
|
|
||||||
|
|
||||||
// if (!UserId && empAccessData != 'Public') {
|
|
||||||
// if (!UserId && (empAccessData === "Kiosk Sales" || empAccessData === "View Bill")) {
|
|
||||||
// // Allow KioskBookingPage to load and set session values
|
|
||||||
// setAccessCheckComplete(true);
|
|
||||||
// return;
|
|
||||||
// }else{
|
|
||||||
// console.log("UserId is undefined, logging out...");
|
|
||||||
// // alert("User invalid. Redirecting to login...")
|
|
||||||
// sessionStorage.clear();
|
|
||||||
// window.location.replace(`${commonUrl}`);
|
|
||||||
// setHasRedirected(true);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Cmd it End
|
|
||||||
const userAccessChecks = {
|
|
||||||
'Super Admin': () => {
|
|
||||||
let empPreferenceCheck = true;
|
|
||||||
if (checkPreferenceAccessData.includes(empAccessData)) {
|
|
||||||
empPreferenceCheck = checkAccess(empAccessData);
|
|
||||||
} else {
|
|
||||||
empPreferenceCheck = true;
|
|
||||||
}
|
|
||||||
return !empPreferenceCheck;
|
|
||||||
},
|
|
||||||
'Super Admin User': async () => {
|
|
||||||
const SAdminuserPin = await dispatch(
|
|
||||||
checkSession({ UserId, sessionId })
|
|
||||||
).unwrap();
|
|
||||||
if (
|
|
||||||
(SAdminuserPin?.data?.statusCode === 1 &&
|
|
||||||
SAdminuserPin?.data?.data?.filter(
|
|
||||||
(item) =>
|
|
||||||
item?.AppId == AppId &&
|
|
||||||
item?.CompId == CompId &&
|
|
||||||
item?.BranchId == BranchId
|
|
||||||
)?.[0]?.Status === 'L') ||
|
|
||||||
BranchId === null ||
|
|
||||||
BranchId === '' ||
|
|
||||||
BranchId === undefined
|
|
||||||
) {
|
|
||||||
if (sessionStorage.getItem('BranchId') !== null) {
|
|
||||||
clearSession('BranchId');
|
|
||||||
}
|
|
||||||
fetchBranchData();
|
|
||||||
} else {
|
|
||||||
if (empAccessData) {
|
|
||||||
const superAdminUserAccessCheck =
|
|
||||||
await checkSuperAdminUserAccess(empAccessData, currentPath);
|
|
||||||
let empPreferenceCheck = true;
|
|
||||||
if (checkPreferenceAccessData.includes(empAccessData)) {
|
|
||||||
empPreferenceCheck = checkAccess(empAccessData);
|
|
||||||
} else {
|
|
||||||
empPreferenceCheck = true;
|
|
||||||
}
|
|
||||||
return !superAdminUserAccessCheck || !empPreferenceCheck;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Admin: () => {
|
|
||||||
if (accessData === 'Super Admin') {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
let empPreferenceCheck = true;
|
|
||||||
let empPlanAccessCheck = true;
|
|
||||||
|
|
||||||
if (checkPreferenceAccessData.includes(empAccessData)) {
|
|
||||||
empPreferenceCheck = checkAccess(empAccessData);
|
|
||||||
} else {
|
|
||||||
empPreferenceCheck = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (checkPlanAccessData.includes(empAccessData)) {
|
|
||||||
empPlanAccessCheck = checkPlanAccess(
|
|
||||||
empAccessData,
|
|
||||||
featureAddonData
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
empPlanAccessCheck = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return !empPreferenceCheck || !empPlanAccessCheck;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Employee: async () => {
|
|
||||||
if (empAccessData && accessData !== 'Super Admin') {
|
|
||||||
const empAccessCheck = await checkEmpAccess(
|
|
||||||
empAccessData,
|
|
||||||
currentPath
|
|
||||||
);
|
|
||||||
let empPreferenceCheck = true;
|
|
||||||
let empPlanAccessCheck = true;
|
|
||||||
|
|
||||||
if (checkPreferenceAccessData.includes(empAccessData)) {
|
|
||||||
empPreferenceCheck = checkAccess(empAccessData);
|
|
||||||
} else {
|
|
||||||
empPreferenceCheck = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (checkPlanAccessData.includes(empAccessData)) {
|
|
||||||
empPlanAccessCheck = checkPlanAccess(
|
|
||||||
empAccessData,
|
|
||||||
featureAddonData
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
empPlanAccessCheck = true;
|
|
||||||
}
|
|
||||||
if (location.pathname === '/app-page/relieve-request') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
!empAccessCheck || !empPreferenceCheck || !empPlanAccessCheck
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
if (accessData === 'Super Admin') {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
if (userAccessChecks[UserType]) {
|
|
||||||
shouldNavigate = await userAccessChecks[UserType]();
|
|
||||||
} else {
|
|
||||||
shouldNavigate = true;
|
|
||||||
}
|
}
|
||||||
console.log('shouldNavigate', shouldNavigate);
|
} catch (err) {
|
||||||
if (shouldNavigate) {
|
console.error(err);
|
||||||
// alert("Unauthorized action detected. You have been logged out.")
|
} finally {
|
||||||
Logout();
|
setScanning(false);
|
||||||
setHasRedirected(true);
|
|
||||||
} else {
|
|
||||||
console.log('Access granted for current route.');
|
|
||||||
}
|
|
||||||
|
|
||||||
setAccessCheckComplete(true);
|
|
||||||
}
|
}
|
||||||
};
|
} else {
|
||||||
|
setModalOpen(true);
|
||||||
performAccessChecks();
|
|
||||||
}, [UserType, routesConfig, navigate, hasRedirected, location.pathname]);
|
|
||||||
|
|
||||||
const Logout = async () => {
|
|
||||||
const status = 'N'; // replace with your actual status
|
|
||||||
const res = await dispatch(GenerateLogout({ UserId, status })).unwrap();
|
|
||||||
if (res?.data?.statusCode === 1) {
|
|
||||||
sessionStorage.clear();
|
|
||||||
window.location.replace(`${commonUrl}`);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderRoutes = (routes) => {
|
// -------------------------
|
||||||
return routes.map(({ path, component: Component, children }) => {
|
// START WEB SCAN (HYBRID)
|
||||||
const fullPath = `${path}`;
|
// -------------------------
|
||||||
|
const startWebScan = async () => {
|
||||||
|
if (!videoRef.current) return;
|
||||||
|
|
||||||
if (!Component) {
|
// Start QR scanner (fast)
|
||||||
console.error(`Component not found for path: ${fullPath}`);
|
qrScannerRef.current = new QrScanner(
|
||||||
return null;
|
videoRef.current,
|
||||||
|
(result) => {
|
||||||
|
stopWebScan();
|
||||||
|
onScan(result.data);
|
||||||
|
setModalOpen(false);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
maxScansPerSecond: 25,
|
||||||
}
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (children) {
|
await qrScannerRef.current.start();
|
||||||
return (
|
|
||||||
<Route key={fullPath} path={fullPath} element={<Component />}>
|
|
||||||
{children.map(({ path: childPath, component: ChildComponent }) => {
|
|
||||||
if (!ChildComponent) {
|
|
||||||
console.error(
|
|
||||||
`Child component not found for path: ${childPath}`
|
|
||||||
);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<Route
|
|
||||||
key={childPath}
|
|
||||||
path={childPath}
|
|
||||||
element={<ChildComponent />}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</Route>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return <Route key={fullPath} path={fullPath} element={<Component />} />;
|
// Start Barcode scanner (ZXing)
|
||||||
|
barcodeReaderRef.current = new BrowserMultiFormatReader(undefined, {
|
||||||
|
possibleFormats: [
|
||||||
|
BarcodeFormat.CODE_128,
|
||||||
|
BarcodeFormat.EAN_13,
|
||||||
|
BarcodeFormat.UPC_A,
|
||||||
|
BarcodeFormat.UPC_E,
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
barcodeReaderRef.current.timeBetweenDecodingAttempts = 50;
|
||||||
|
|
||||||
|
barcodeReaderRef.current.decodeFromVideoDevice(
|
||||||
|
null,
|
||||||
|
videoRef.current,
|
||||||
|
(result) => {
|
||||||
|
if (result) {
|
||||||
|
stopWebScan();
|
||||||
|
onScan(result.getText());
|
||||||
|
setModalOpen(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
const stopWebScan = () => {
|
||||||
<Suspense fallback={<div></div>}>
|
if (qrScannerRef.current) {
|
||||||
<Routes>{accessCheckComplete && renderRoutes(routesConfig)}</Routes>
|
qrScannerRef.current.stop();
|
||||||
</Suspense>
|
qrScannerRef.current.destroy();
|
||||||
);
|
qrScannerRef.current = null;
|
||||||
};
|
}
|
||||||
|
|
||||||
export default ProtectedRoutes;
|
if (barcodeReaderRef.current) {
|
||||||
|
barcodeReaderRef.current.reset();
|
||||||
|
barcodeReaderRef.current = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
setScanning(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeModal = () => {
|
||||||
|
stopWebScan();
|
||||||
|
setModalOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (modalOpen) {
|
||||||
|
startWebScan();
|
||||||
|
}
|
||||||
|
}, [modalOpen]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
return () => stopWebScan();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className="BarCodeScanMaster"
|
||||||
|
style={{ display: 'flex', justifyContent: 'center', padding: 20 }}
|
||||||
|
>
|
||||||
|
{!scanning && (
|
||||||
|
<BsUpcScan
|
||||||
|
onClick={startScan}
|
||||||
|
style={{
|
||||||
|
fontSize: 32,
|
||||||
|
color: '#007bff',
|
||||||
|
cursor: 'pointer',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<DefaultModal
|
||||||
|
title="QR / Barcode Reader"
|
||||||
|
width={500}
|
||||||
|
open={modalOpen}
|
||||||
|
footer={false}
|
||||||
|
handleCancel={closeModal}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
position: 'relative',
|
||||||
|
width: '100%',
|
||||||
|
maxWidth: 400,
|
||||||
|
margin: 'auto',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{/* VIDEO */}
|
||||||
|
<video
|
||||||
|
ref={videoRef}
|
||||||
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
borderRadius: 8,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* DARK OVERLAY */}
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
position: 'absolute',
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
background: 'rgba(0,0,0,0.5)',
|
||||||
|
borderRadius: 8,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* SCAN BOX */}
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
position: 'absolute',
|
||||||
|
top: '50%',
|
||||||
|
left: '50%',
|
||||||
|
width: '70%',
|
||||||
|
height: '60%',
|
||||||
|
transform: 'translate(-50%, -50%)',
|
||||||
|
border: '3px solid #00ff00',
|
||||||
|
borderRadius: 12,
|
||||||
|
boxShadow: '0 0 0 2000px rgba(0,0,0,0.4)',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* SCAN LINE */}
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
position: 'absolute',
|
||||||
|
left: '15%',
|
||||||
|
width: '70%',
|
||||||
|
height: 2,
|
||||||
|
background: 'red',
|
||||||
|
animation: 'scanAnimation 2s infinite linear',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button
|
||||||
|
onClick={closeModal}
|
||||||
|
style={{
|
||||||
|
marginTop: 20,
|
||||||
|
padding: '10px 20px',
|
||||||
|
fontSize: 16,
|
||||||
|
borderRadius: 8,
|
||||||
|
border: 'none',
|
||||||
|
cursor: 'pointer',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Close
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{/* Animation */}
|
||||||
|
<style>
|
||||||
|
{`
|
||||||
|
@keyframes scanAnimation {
|
||||||
|
0% { top: 25%; }
|
||||||
|
50% { top: 70%; }
|
||||||
|
100% { top: 25%; }
|
||||||
|
}
|
||||||
|
`}
|
||||||
|
</style>
|
||||||
|
</DefaultModal>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
||||||
2243
src/check.scss
2243
src/check.scss
File diff suppressed because it is too large
Load Diff
298
src/index.css
298
src/index.css
|
|
@ -288,8 +288,8 @@ a {
|
||||||
|
|
||||||
.payment-error-msg {
|
.payment-error-msg {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-family: var(--PARA_FONT_FAMILY);
|
font-family: VAR(--PARA_FONT_FAMILY);
|
||||||
color: var(--ERROR_COLOR);
|
color: VAR(--ERROR_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable all Ant Design table animations and hover effects */
|
/* Disable all Ant Design table animations and hover effects */
|
||||||
|
|
@ -315,6 +315,54 @@ a {
|
||||||
|
|
||||||
.ant-modal .ant-modal-content {
|
.ant-modal .ant-modal-content {
|
||||||
padding: 34px !important;
|
padding: 34px !important;
|
||||||
|
/* Android WebView 83 fix: ensure positioning context for close button */
|
||||||
|
position: relative !important;
|
||||||
|
overflow: visible !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ============================================
|
||||||
|
ANDROID WEBVIEW 83 - Modal Close Button Fix
|
||||||
|
On Chrome 83, position:absolute inside a flex
|
||||||
|
container loses its anchor. Force it to always
|
||||||
|
sit at top-right of the modal content box.
|
||||||
|
============================================ */
|
||||||
|
.ant-modal-close {
|
||||||
|
position: absolute !important;
|
||||||
|
top: 0 !important;
|
||||||
|
right: 0 !important;
|
||||||
|
z-index: 10 !important;
|
||||||
|
width: 44px !important;
|
||||||
|
height: 44px !important;
|
||||||
|
display: -webkit-box !important;
|
||||||
|
display: -webkit-flex !important;
|
||||||
|
display: flex !important;
|
||||||
|
-webkit-box-align: center !important;
|
||||||
|
-webkit-align-items: center !important;
|
||||||
|
align-items: center !important;
|
||||||
|
-webkit-box-pack: center !important;
|
||||||
|
-webkit-justify-content: center !important;
|
||||||
|
justify-content: center !important;
|
||||||
|
cursor: pointer !important;
|
||||||
|
background: transparent !important;
|
||||||
|
border: none !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
line-height: 1 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-modal-close-x {
|
||||||
|
display: -webkit-box !important;
|
||||||
|
display: -webkit-flex !important;
|
||||||
|
display: flex !important;
|
||||||
|
-webkit-box-align: center !important;
|
||||||
|
-webkit-align-items: center !important;
|
||||||
|
align-items: center !important;
|
||||||
|
-webkit-box-pack: center !important;
|
||||||
|
-webkit-justify-content: center !important;
|
||||||
|
justify-content: center !important;
|
||||||
|
width: 100% !important;
|
||||||
|
height: 100% !important;
|
||||||
|
font-size: 16px !important;
|
||||||
|
line-height: 1 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-table-wrapper .ant-table-thead > tr > th,
|
.ant-table-wrapper .ant-table-thead > tr > th,
|
||||||
|
|
@ -328,3 +376,249 @@ a {
|
||||||
.ant-table-tbody .ant-table-cell {
|
.ant-table-tbody .ant-table-cell {
|
||||||
font-family: 'Poppins' !important;
|
font-family: 'Poppins' !important;
|
||||||
}
|
}
|
||||||
|
.ant-modal-wrap {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-dropdown {
|
||||||
|
position: absolute !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ============================================
|
||||||
|
ANDROID WEBVIEW FLEX GAP FIX
|
||||||
|
Chrome 83 and below does not support gap in flexbox.
|
||||||
|
Use margin fallbacks instead.
|
||||||
|
============================================ */
|
||||||
|
|
||||||
|
/* Ant Design Space fix */
|
||||||
|
.ant-space {
|
||||||
|
display: -webkit-box !important;
|
||||||
|
display: -webkit-flex !important;
|
||||||
|
display: flex !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-space-horizontal > .ant-space-item:not(:last-child) {
|
||||||
|
margin-right: 8px !important;
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-space-vertical > .ant-space-item:not(:last-child) {
|
||||||
|
margin-bottom: 8px !important;
|
||||||
|
margin-right: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ant Design Row/Col grid fix */
|
||||||
|
.ant-row {
|
||||||
|
display: -webkit-box !important;
|
||||||
|
display: -webkit-flex !important;
|
||||||
|
display: flex !important;
|
||||||
|
-webkit-flex-wrap: wrap !important;
|
||||||
|
flex-wrap: wrap !important;
|
||||||
|
margin-left: -8px;
|
||||||
|
margin-right: -8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-col {
|
||||||
|
padding-left: 8px;
|
||||||
|
padding-right: 8px;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Global flex gap fallback for custom components.
|
||||||
|
If you use gap: Xpx on a flex container, add class
|
||||||
|
'flex-gap-8', 'flex-gap-12', 'flex-gap-16' instead */
|
||||||
|
.flex-gap-4 > *:not(:last-child) {
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
.flex-gap-8 > *:not(:last-child) {
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
.flex-gap-12 > *:not(:last-child) {
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
.flex-gap-16 > *:not(:last-child) {
|
||||||
|
margin-right: 16px;
|
||||||
|
}
|
||||||
|
.flex-gap-24 > *:not(:last-child) {
|
||||||
|
margin-right: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-col-gap-4 > *:not(:last-child) {
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
.flex-col-gap-8 > *:not(:last-child) {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
.flex-col-gap-12 > *:not(:last-child) {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
.flex-col-gap-16 > *:not(:last-child) {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
.flex-col-gap-24 > *:not(:last-child) {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Global old Android flex gap polyfill.
|
||||||
|
JS marks gap-using flex containers with [data-old-flex-gap="1"] and
|
||||||
|
writes --old-row-gap / --old-col-gap values per container. */
|
||||||
|
/* .old-android-webview [data-old-flex-gap] {
|
||||||
|
margin-top: calc(var(--old-row-gap) * -0.5);
|
||||||
|
margin-left: calc(var(--old-col-gap) * -1.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.old-android-webview [data-old-flex-gap] > * {
|
||||||
|
margin-top: var(--old-row-gap);
|
||||||
|
margin-left: var(--old-col-gap);
|
||||||
|
} */
|
||||||
|
|
||||||
|
.old-android-webview [data-old-flex-gap] {
|
||||||
|
margin-top: calc(var(--old-row-gap) * -0.5);
|
||||||
|
margin-left: calc(var(--old-row-gap) * -0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.old-android-webview [data-old-flex-gap] > * {
|
||||||
|
margin-top: var(--old-row-gap);
|
||||||
|
margin-right: var(--old-col-gap, 0px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.old-android-webview [data-old-flex-gap] > *:last-child {
|
||||||
|
margin-right: 0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Old Android horizontal category margin spacing (gap not working - use margins) */
|
||||||
|
.old-android-webview .CategoryHorizontal-master-container > * {
|
||||||
|
margin-right: 1rem !important;
|
||||||
|
margin-left: 0.3rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.old-android-webview .CategoryHorizontal-master-container > *:last-child {
|
||||||
|
margin-right: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.old-android-webview .CategoryHorizontal-scroll-container > * {
|
||||||
|
margin-right: 0.5rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.old-android-webview .CategoryHorizontal-scroll-container > *:last-child {
|
||||||
|
margin-right: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Table shrink fix */
|
||||||
|
.old-android-webview .BSCategory1-tablecont,
|
||||||
|
.old-android-webview [class*="-tablecont"] {
|
||||||
|
min-width: 420px !important;
|
||||||
|
width: 420px !important;
|
||||||
|
max-width: 450px !important;
|
||||||
|
flex-grow: 1 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Old Android itemcard rupee ₹ more left space + item name centered */
|
||||||
|
.old-android-webview .BSItemCard-itemPrice,
|
||||||
|
.old-android-webview .BSItemCard-itemMRP,
|
||||||
|
.old-android-webview .qtyUomName-itemCard {
|
||||||
|
padding-left: 0rem !important;
|
||||||
|
padding-right: 1.5rem !important;
|
||||||
|
width: 135px !important;
|
||||||
|
letter-spacing: 0 !important;
|
||||||
|
font-size: 13px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.old-android-webview .BSItemCard-itemName {
|
||||||
|
text-align: center !important;
|
||||||
|
justify-content: center !important;
|
||||||
|
margin: 0 10px !important;
|
||||||
|
display: block !important;
|
||||||
|
padding: 0 1px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Old Android global layout fix - BSLayout1Master table width like margin locks */
|
||||||
|
.old-android-webview .BSLayout1Master {
|
||||||
|
--table-width-fix: 430px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.flex-wrap > * {
|
||||||
|
margin: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* gap values map */
|
||||||
|
[data-gap='2'] > * {
|
||||||
|
margin: 2px;
|
||||||
|
}
|
||||||
|
[data-gap='4'] > * {
|
||||||
|
margin: 4px;
|
||||||
|
}
|
||||||
|
[data-gap='8'] > * {
|
||||||
|
margin: 8px;
|
||||||
|
}
|
||||||
|
[data-gap='10'] > * {
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
[data-gap='16'] > * {
|
||||||
|
margin: 16px;
|
||||||
|
}
|
||||||
|
[data-gap='24'] > * {
|
||||||
|
margin: 24px;
|
||||||
|
}
|
||||||
|
[data-gap='34'] > * {
|
||||||
|
margin: 34px;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ==============================================
|
||||||
|
GLOBAL MARGIN CONTROL - OLD ANDROID DEVICE
|
||||||
|
Easily control margins globally with CSS vars
|
||||||
|
Overrides polyfill auto-margins
|
||||||
|
============================================== */
|
||||||
|
|
||||||
|
:root {
|
||||||
|
/* Global Margin Scale - Easily adjust all at once */
|
||||||
|
--GLOBAL_MARGIN-XXS: 0.125rem;
|
||||||
|
--GLOBAL_MARGIN-XS: 0.25rem;
|
||||||
|
--GLOBAL_MARGIN-SM: 0.5rem;
|
||||||
|
--GLOBAL_MARGIN-MD: 1rem;
|
||||||
|
--GLOBAL_MARGIN-LG: 1.5rem;
|
||||||
|
--GLOBAL_MARGIN-XL: 2rem;
|
||||||
|
|
||||||
|
/* Old Android Lock - Force control */
|
||||||
|
--ANDROID_MARGIN-LOCK: 1px 0.4px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Lock ALL margins for old Android - Full Control */
|
||||||
|
.old-android-webview *,
|
||||||
|
.old-android-webview *:before,
|
||||||
|
.old-android-webview *:after {
|
||||||
|
margin: var(--ANDROID_MARGIN-LOCK, inherit) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Per-element margin classes - Use these everywhere */
|
||||||
|
.margin-xxs { margin: var(--GLOBAL_MARGIN-XXS) !important; }
|
||||||
|
.margin-xs { margin: var(--GLOBAL_MARGIN-XS) !important; }
|
||||||
|
.margin-sm { margin: var(--GLOBAL_MARGIN-SM) !important; }
|
||||||
|
.margin-md { margin: var(--GLOBAL_MARGIN-MD) !important; }
|
||||||
|
.margin-lg { margin: var(--GLOBAL_MARGIN-LG) !important; }
|
||||||
|
.margin-xl { margin: var(--GLOBAL_MARGIN-XL) !important; }
|
||||||
|
|
||||||
|
/* Directional control */
|
||||||
|
.margin-t-sm { margin-top: var(--GLOBAL_MARGIN-SM) !important; }
|
||||||
|
.margin-r-sm { margin-right: var(--GLOBAL_MARGIN-SM) !important; }
|
||||||
|
.margin-b-sm { margin-bottom: var(--GLOBAL_MARGIN-SM) !important; }
|
||||||
|
.margin-l-sm { margin-left: var(--GLOBAL_MARGIN-SM) !important; }
|
||||||
|
|
||||||
|
/* OLD ANDROID SUMMARY TABLE FIX - Prevent collapse */
|
||||||
|
.old-android-webview table,
|
||||||
|
|
||||||
|
/* Disable AntD margin interference */
|
||||||
|
.ant-space-item,
|
||||||
|
.ant-row > *,
|
||||||
|
.ant-col > * {
|
||||||
|
margin: var(--ANDROID_MARGIN-LOCK, 0) !important;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
214
src/main.jsx
214
src/main.jsx
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'antd/dist/reset.css';
|
||||||
import ReactDOM from 'react-dom/client';
|
import ReactDOM from 'react-dom/client';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
import { BrowserRouter } from 'react-router-dom';
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
|
|
@ -8,9 +9,217 @@ import AppRoutes from './App.jsx';
|
||||||
import { AuthProvider } from './AuthContext';
|
import { AuthProvider } from './AuthContext';
|
||||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||||
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
|
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
|
||||||
|
import { ConfigProvider } from 'antd';
|
||||||
|
import {
|
||||||
|
StyleProvider,
|
||||||
|
legacyLogicalPropertiesTransformer,
|
||||||
|
} from '@ant-design/cssinjs';
|
||||||
|
|
||||||
|
import 'core-js/stable';
|
||||||
|
import 'regenerator-runtime/runtime';
|
||||||
|
import { isOldAndroidWebView } from './utils/isOldAndroidWebView.js';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import './index.css';
|
||||||
|
import "../src/Components/Forms/main.scss"
|
||||||
|
// src\Components\Forms\main.scss
|
||||||
const queryClient = new QueryClient();
|
const queryClient = new QueryClient();
|
||||||
|
|
||||||
|
/* -------------------------------------------------------
|
||||||
|
OLD ANDROID SAFE POLYFILLS
|
||||||
|
------------------------------------------------------- */
|
||||||
|
|
||||||
|
if (typeof window.Element === 'undefined') {
|
||||||
|
window.Element = function () {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof window.HTMLElement === 'undefined') {
|
||||||
|
window.HTMLElement = function () {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window.NodeList && !NodeList.prototype.forEach) {
|
||||||
|
NodeList.prototype.forEach = function (callback, thisArg) {
|
||||||
|
thisArg = thisArg || window;
|
||||||
|
for (var i = 0; i < this.length; i++) {
|
||||||
|
callback.call(thisArg, this[i], i, this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!window.requestAnimationFrame) {
|
||||||
|
window.requestAnimationFrame = function (callback) {
|
||||||
|
return setTimeout(callback, 16);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------
|
||||||
|
Detect Old Android WebView
|
||||||
|
------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
/* Detect Old Android WebView - line 170 fixed */
|
||||||
|
const ua2 = navigator.userAgent;
|
||||||
|
const chromeMatch2 = ua2.match(/Chrome\/(\\d+)/);
|
||||||
|
const isOldWebView =
|
||||||
|
chromeMatch2 && parseInt(chromeMatch2[1]) <= 85 && /Android/.test(ua2);
|
||||||
|
|
||||||
|
if (isOldWebView) {
|
||||||
|
const applyGapFix = () => {
|
||||||
|
document.querySelectorAll('*').forEach((el) => {
|
||||||
|
const style = window.getComputedStyle(el);
|
||||||
|
const display = style.display;
|
||||||
|
|
||||||
|
if (display !== 'flex' && display !== 'inline-flex') return;
|
||||||
|
|
||||||
|
const rowGap = style.rowGap;
|
||||||
|
const colGap = style.columnGap;
|
||||||
|
|
||||||
|
if (!rowGap || rowGap === 'normal' || rowGap === '0px') return;
|
||||||
|
|
||||||
|
// ✅ Last child fix included
|
||||||
|
Array.from(el.children).forEach((child, i, arr) => {
|
||||||
|
child.style.marginBottom = rowGap;
|
||||||
|
child.style.marginRight = colGap || rowGap;
|
||||||
|
|
||||||
|
// Last child margin remove
|
||||||
|
if (i === arr.length - 1) {
|
||||||
|
child.style.marginRight = '0px';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
applyGapFix();
|
||||||
|
setTimeout(applyGapFix, 500);
|
||||||
|
setTimeout(applyGapFix, 1500);
|
||||||
|
|
||||||
|
|
||||||
|
new MutationObserver(applyGapFix).observe(document.body, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------
|
||||||
|
FLEX GAP POLYFILL + Table Width Fix for Old Android
|
||||||
|
------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* Table Width Fix - uses existing detection (no duplicate vars) */
|
||||||
|
if (isOldAndroidWebView) {
|
||||||
|
document.documentElement.classList.add('old-android-webview');
|
||||||
|
document.body.classList.add('old-android-webview');
|
||||||
|
|
||||||
|
// Force 420px table width immediately
|
||||||
|
const style = document.createElement('style');
|
||||||
|
style.textContent = `
|
||||||
|
.old-android-webview .BSCategory1-tablecont,
|
||||||
|
.old-android-webview [class*="-tablecont"] {
|
||||||
|
width: 420px !important;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
document.head.appendChild(style);
|
||||||
|
|
||||||
|
document.documentElement.classList.add('old-android-webview');
|
||||||
|
document.body.classList.add('old-android-webview');
|
||||||
|
|
||||||
|
const shouldApplyGap = (value) =>
|
||||||
|
!!value && value !== 'normal' && value !== '0px';
|
||||||
|
|
||||||
|
const processElement = (element) => {
|
||||||
|
if (typeof HTMLElement === 'undefined' || !(element instanceof HTMLElement))
|
||||||
|
return;
|
||||||
|
|
||||||
|
const style = window.getComputedStyle(element);
|
||||||
|
|
||||||
|
const isFlexContainer =
|
||||||
|
style.display === 'flex' || style.display === 'inline-flex';
|
||||||
|
|
||||||
|
if (!isFlexContainer) return;
|
||||||
|
|
||||||
|
const rowGap = style.rowGap;
|
||||||
|
const columnGap = style.columnGap;
|
||||||
|
|
||||||
|
const hasRowGap = shouldApplyGap(rowGap);
|
||||||
|
const hasColumnGap = shouldApplyGap(columnGap);
|
||||||
|
|
||||||
|
if (!hasRowGap && !hasColumnGap) {
|
||||||
|
element.removeAttribute('data-old-flex-gap');
|
||||||
|
element.style.removeProperty('--old-row-gap');
|
||||||
|
element.style.removeProperty('--old-col-gap');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
element.setAttribute('data-old-flex-gap', '1');
|
||||||
|
element.style.setProperty('--old-row-gap', hasRowGap ? rowGap : '0px');
|
||||||
|
element.style.setProperty(
|
||||||
|
'--old-col-gap',
|
||||||
|
hasColumnGap ? columnGap : '0px'
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const processTree = (root) => {
|
||||||
|
if (typeof HTMLElement === 'undefined' || !(root instanceof HTMLElement))
|
||||||
|
return;
|
||||||
|
|
||||||
|
processElement(root);
|
||||||
|
|
||||||
|
const nodes = root.querySelectorAll('*');
|
||||||
|
|
||||||
|
for (let i = 0; i < nodes.length; i++) {
|
||||||
|
processElement(nodes[i]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const applyGlobalFlexGapPolyfill = () => {
|
||||||
|
processTree(document.body);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (document.readyState === 'loading') {
|
||||||
|
document.addEventListener('DOMContentLoaded', applyGlobalFlexGapPolyfill, {
|
||||||
|
once: true,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
applyGlobalFlexGapPolyfill();
|
||||||
|
}
|
||||||
|
|
||||||
|
requestAnimationFrame(applyGlobalFlexGapPolyfill);
|
||||||
|
setTimeout(applyGlobalFlexGapPolyfill, 800);
|
||||||
|
setTimeout(applyGlobalFlexGapPolyfill, 2000);
|
||||||
|
|
||||||
|
let scheduled = false;
|
||||||
|
|
||||||
|
const observer = new MutationObserver(() => {
|
||||||
|
if (!scheduled) {
|
||||||
|
scheduled = true;
|
||||||
|
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
applyGlobalFlexGapPolyfill();
|
||||||
|
scheduled = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
observer.observe(document.body, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------
|
||||||
|
REACT APP
|
||||||
|
------------------------------------------------------- */
|
||||||
|
|
||||||
ReactDOM.createRoot(document.getElementById('root')).render(
|
ReactDOM.createRoot(document.getElementById('root')).render(
|
||||||
|
<StyleProvider
|
||||||
|
hashPriority="high"
|
||||||
|
hashed={false}
|
||||||
|
autoClear={false}
|
||||||
|
container={document.head}
|
||||||
|
transformers={[legacyLogicalPropertiesTransformer]}
|
||||||
|
>
|
||||||
|
<ConfigProvider theme={{ hashed: false }}>
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
|
|
@ -19,8 +228,11 @@ ReactDOM.createRoot(document.getElementById('root')).render(
|
||||||
</AuthProvider>
|
</AuthProvider>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
</Provider>
|
</Provider>
|
||||||
{process.env.NODE_ENV == 'development' && (
|
|
||||||
|
{process.env.NODE_ENV === 'development' && (
|
||||||
<ReactQueryDevtools initialIsOpen={false} />
|
<ReactQueryDevtools initialIsOpen={false} />
|
||||||
)}
|
)}
|
||||||
</QueryClientProvider>
|
</QueryClientProvider>
|
||||||
|
</ConfigProvider>
|
||||||
|
</StyleProvider>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -676,19 +676,18 @@ const subDirectory = import.meta.env.BASE_URL;
|
||||||
const apiCommonUrl = import.meta.env.ENV_API_URL_COMMON;
|
const apiCommonUrl = import.meta.env.ENV_API_URL_COMMON;
|
||||||
|
|
||||||
const initSession = () => {
|
const initSession = () => {
|
||||||
sessionStore('AppId', 1);
|
sessionStore('AppId', 6);
|
||||||
sessionStore('BranchId', 121);
|
sessionStore('BranchId', 556);
|
||||||
sessionStore('AppName', 'Bakery');
|
sessionStore('AppName', 'Bakery');
|
||||||
sessionStore('CompId', 72);
|
sessionStore('CompId', 462);
|
||||||
sessionStore('MobileNo', '8072329153');
|
sessionStore('MobileNo', '6382594417');
|
||||||
sessionStore('UserType', 'Admin');
|
sessionStore('UserType', 'Admin');
|
||||||
sessionStore('UserId', 39);
|
sessionStore('UserId', 1884);
|
||||||
sessionStore('userName', 'Karthiga');
|
sessionStore('userName', 'Karthiga');
|
||||||
|
sessionStore(
|
||||||
sessionStorage.setItem(
|
'auth',
|
||||||
'auth',
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiNjM4MjU5NDQxNyIsIlBhc3N3b3JkIjoiWkB6NDEwNDg0IiwiYXVkIjpbImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tcmV0YWlsLWFwaSIsImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tY29tbW9uLWFwaSIsImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tc21zLWVtYWlsLXRlbXBsYXRlLWFwaSIsImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tY29tbW9uLWFwaSJdLCJleHAiOjE3NzUxNTgwNTIsImlzcyI6Imh0dHBzOi8vYXBpLnBvem8uZGV2L0p3dFRva2VuIn0.xPuA6vnS7UdDWAnwMLEPhV0UcqPCwtb7tllpMYjOb-A'
|
||||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiODA3MjMyOTE1MyIsIlBhc3N3b3JkIjoiWkB6MTIzNCIsImF1ZCI6WyJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTIiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTQiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiXSwiZXhwIjoxNzc0Mzc5NTY2LCJpc3MiOiJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMDEifQ.uTdcz-FHE4GTux7FTtT2pQt9gEe-17_mIrwJWbHdHE8'
|
);
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getAppType = async () => {
|
const getAppType = async () => {
|
||||||
|
|
@ -779,13 +778,13 @@ export const routesConfig = [
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: `${subDirectory}app-page`,
|
path: `${subDirectory}`,
|
||||||
component: React.lazy(() =>
|
component: React.lazy(() =>
|
||||||
fetchComponent().then((module) => ({ default: module.default }))
|
fetchComponent().then((module) => ({ default: module.default }))
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'home',
|
path: '/',
|
||||||
component: React.lazy(() =>
|
component: React.lazy(() =>
|
||||||
fetchHomeComponent().then((module) => ({ default: module.default }))
|
fetchHomeComponent().then((module) => ({ default: module.default }))
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { isOldAndroidWebView } from './isOldAndroidWebView';
|
||||||
|
|
||||||
|
export const gapStyle = (size) => {
|
||||||
|
size = size || '8px';
|
||||||
|
if (isOldAndroidWebView()) {
|
||||||
|
return {
|
||||||
|
marginRight: size,
|
||||||
|
marginBottom: size
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return { gap: size };
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
export const isOldAndroidWebView = (() => {
|
||||||
|
const ua = navigator.userAgent;
|
||||||
|
const match = ua.match(/Chrome\/(\d+)/);
|
||||||
|
return match && parseInt(match[1]) <= 85 && /Android/.test(ua);
|
||||||
|
})();
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from "vite";
|
||||||
import react from '@vitejs/plugin-react';
|
import react from "@vitejs/plugin-react";
|
||||||
import legacy from '@vitejs/plugin-legacy';
|
import legacy from '@vitejs/plugin-legacy';
|
||||||
import esbuild from 'esbuild';
|
import esbuild from 'esbuild';
|
||||||
|
|
||||||
export default defineConfig(({ mode }) => {
|
export default defineConfig(({ mode }) => {
|
||||||
const isProd = mode === 'production';
|
const isProd = mode === "production";
|
||||||
|
|
||||||
return {
|
return {
|
||||||
oxc: {
|
oxc: {
|
||||||
target: 'es2015'
|
target: 'es2015'
|
||||||
},
|
},
|
||||||
|
|
@ -35,32 +34,22 @@ export default defineConfig(({ mode }) => {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
base: '/',
|
|
||||||
envDir: 'src',
|
|
||||||
envPrefix: 'ENV_',
|
|
||||||
|
|
||||||
server: {
|
base: isProd ? "/" : "/", //for capcitor base: isProd ? "/" : "/",
|
||||||
host: '0.0.0.0',
|
|
||||||
port: process.env.PORT || 3015,
|
|
||||||
|
|
||||||
hmr: {
|
|
||||||
host: '192.168.1.35',
|
|
||||||
port: 3015,
|
|
||||||
protocol: 'ws',
|
|
||||||
clientPort: 3015,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
optimizeDeps: {
|
envDir: "src",
|
||||||
include: ['jspdf'],
|
envPrefix: "ENV_",
|
||||||
|
|
||||||
|
server: {
|
||||||
|
host: true, // 🔥 auto detect your IP
|
||||||
|
port: process.env.PORT || 3015,
|
||||||
},
|
},
|
||||||
|
|
||||||
build: {
|
build: {
|
||||||
target: 'es2015',
|
minify: "esbuild",
|
||||||
minify: 'esbuild',
|
|
||||||
esbuild: {
|
esbuild: {
|
||||||
drop: isProd ? ['console', 'debugger'] : [],
|
drop: isProd ? ["console", "debugger"] : [],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue