Compare commits
No commits in common. "ddeed6d14adf556ea14b038b60c66ca5b6e80cce" and "80b252cd3879d22d5c024285111dadd02d3562f4" have entirely different histories.
ddeed6d14a
...
80b252cd38
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,14 +3,9 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" href="/fav.ico" />
|
<link rel="icon" href="/fav.ico" />
|
||||||
<meta
|
<meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=1" />
|
||||||
name="viewport"
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/antd/dist/reset.css" />
|
||||||
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 />
|
||||||
|
|
||||||
|
|
@ -82,18 +77,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script> -->
|
</script> -->
|
||||||
<!-- public/index.html -->
|
<!-- <script src="https://cdn.jsdelivr.net/npm/eruda"></script>
|
||||||
<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 () {
|
||||||
|
|
@ -141,107 +125,7 @@
|
||||||
}
|
}
|
||||||
}, 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
|
|
@ -31,6 +31,7 @@
|
||||||
"@tanstack/react-query-devtools": "^5.91.1",
|
"@tanstack/react-query-devtools": "^5.91.1",
|
||||||
"@tanstack/react-virtual": "^3.13.18",
|
"@tanstack/react-virtual": "^3.13.18",
|
||||||
"@types/node": "^25.5.0",
|
"@types/node": "^25.5.0",
|
||||||
|
"@vitejs/plugin-legacy": "^8.0.1",
|
||||||
"@zxing/library": "^0.21.3",
|
"@zxing/library": "^0.21.3",
|
||||||
"antd": "^5.17.4",
|
"antd": "^5.17.4",
|
||||||
"antd-img-crop": "^4.22.0",
|
"antd-img-crop": "^4.22.0",
|
||||||
|
|
@ -89,7 +90,6 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "^18.3.3",
|
"@types/react": "^18.3.3",
|
||||||
"@types/react-dom": "^18.3.0",
|
"@types/react-dom": "^18.3.0",
|
||||||
"@vitejs/plugin-legacy": "^8.0.0",
|
|
||||||
"@vitejs/plugin-react": "^6.0.1",
|
"@vitejs/plugin-react": "^6.0.1",
|
||||||
"esbuild": "^0.27.4",
|
"esbuild": "^0.27.4",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.57.0",
|
||||||
|
|
@ -98,7 +98,7 @@
|
||||||
"eslint-plugin-react-refresh": "^0.4.7",
|
"eslint-plugin-react-refresh": "^0.4.7",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"rollup-plugin-obfuscator": "^1.1.0",
|
"rollup-plugin-obfuscator": "^1.1.0",
|
||||||
"sass": "^1.77.2",
|
"sass": "^1.98.0",
|
||||||
"terser": "^5.31.3",
|
"terser": "^5.31.3",
|
||||||
"vite": "^8.0.0",
|
"vite": "^8.0.0",
|
||||||
"vite-plugin-obfuscator": "^1.0.5",
|
"vite-plugin-obfuscator": "^1.0.5",
|
||||||
|
|
|
||||||
|
|
@ -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='/'
|
# ENV_BASE_URL='/apps/retail/'
|
||||||
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'
|
||||||
|
|
|
||||||
|
|
@ -432,7 +432,7 @@ export const getCustomerForHold = createAsyncThunk(
|
||||||
|
|
||||||
export const getAllCustomerAndBranch = createAsyncThunk(
|
export const getAllCustomerAndBranch = createAsyncThunk(
|
||||||
'product/getAllCustomerAndBranch',
|
'product/getAllCustomerAndBranch',
|
||||||
async ({ CompId, AppId, BranchId,selectedCustomertype }) => {
|
async ({ CompId, AppId, BranchId }) => {
|
||||||
if (
|
if (
|
||||||
CompId != null &&
|
CompId != null &&
|
||||||
CompId != undefined &&
|
CompId != undefined &&
|
||||||
|
|
@ -442,7 +442,7 @@ export const getAllCustomerAndBranch = createAsyncThunk(
|
||||||
AppId != undefined
|
AppId != undefined
|
||||||
) {
|
) {
|
||||||
return await axiosRetailInstanceData.get(
|
return await axiosRetailInstanceData.get(
|
||||||
`/Customer/AllCustomerBranchDropdown?compId=${CompId}&branchId=${BranchId}&appId=${AppId}&type=${selectedCustomertype}`
|
`/Customer/AllCustomerBranchDropdown?compId=${CompId}&branchId=${BranchId}&appId=${AppId}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1557,7 +1557,7 @@ const AppPage = () => {
|
||||||
),
|
),
|
||||||
getItem(
|
getItem(
|
||||||
'HOME',
|
'HOME',
|
||||||
`${subDirectory}`,
|
`${subDirectory}app-page/home`,
|
||||||
<BiHomeSmile className="iconsize" />
|
<BiHomeSmile className="iconsize" />
|
||||||
),
|
),
|
||||||
getItem(
|
getItem(
|
||||||
|
|
@ -1607,7 +1607,7 @@ const AppPage = () => {
|
||||||
),
|
),
|
||||||
getItem(
|
getItem(
|
||||||
'HOME',
|
'HOME',
|
||||||
`${subDirectory}`,
|
`${subDirectory}app-page/home`,
|
||||||
<BiHomeSmile className="iconsize" />
|
<BiHomeSmile className="iconsize" />
|
||||||
),
|
),
|
||||||
getItem(
|
getItem(
|
||||||
|
|
@ -1643,7 +1643,7 @@ const AppPage = () => {
|
||||||
|
|
||||||
getItem(
|
getItem(
|
||||||
'Dashboard',
|
'Dashboard',
|
||||||
`${subDirectory}`,
|
`${subDirectory}app-page/home`,
|
||||||
<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}`,
|
`${subDirectory}app-page/home`,
|
||||||
<MdInsertChartOutlined className="iconsize" />
|
<MdInsertChartOutlined className="iconsize" />
|
||||||
),
|
),
|
||||||
SadminUserSettingMenu?.length > 0 &&
|
SadminUserSettingMenu?.length > 0 &&
|
||||||
|
|
@ -2212,7 +2212,7 @@ const AppPage = () => {
|
||||||
),
|
),
|
||||||
getItem(
|
getItem(
|
||||||
'Dashboard',
|
'Dashboard',
|
||||||
`${subDirectory}`,
|
`${subDirectory}app-page/home`,
|
||||||
<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}`,
|
`${subDirectory}app-page/home`,
|
||||||
<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}`;
|
const isCurrentPath = location.pathname === `${subDirectory}app-page/home`;
|
||||||
console.log(items, 'itemsitems');
|
console.log(items, 'itemsitems');
|
||||||
return (
|
return (
|
||||||
<div className="appPage">
|
<div className="appPage">
|
||||||
|
|
|
||||||
|
|
@ -676,7 +676,13 @@ const BSNavbar1 = (props, BookingNavbar) => {
|
||||||
</TooltipWrapper>
|
</TooltipWrapper>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<BSNavBarWeightScale />
|
||||||
|
</div>
|
||||||
<div className="BSBillingNav1div2">
|
<div className="BSBillingNav1div2">
|
||||||
<div className="NavbarDivForSearch">
|
<div className="NavbarDivForSearch">
|
||||||
{/* Multiple search */}
|
{/* Multiple search */}
|
||||||
|
|
@ -714,22 +720,7 @@ const BSNavbar1 = (props, BookingNavbar) => {
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{!OtherServicesglobal && (
|
|
||||||
<>
|
|
||||||
{FeatureAddonData?.FeatureDtls?.find(
|
|
||||||
(item) =>
|
|
||||||
item?.FeatureAddonName?.toLowerCase() === 'weight scale'
|
|
||||||
) && (
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<BSNavBarWeightScale />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{!OtherServicesglobal && (
|
{!OtherServicesglobal && (
|
||||||
<>
|
<>
|
||||||
{OpenFailData && (
|
{OpenFailData && (
|
||||||
|
|
@ -845,7 +836,18 @@ const BSNavbar1 = (props, BookingNavbar) => {
|
||||||
|
|
||||||
{!OtherServicesglobal && (
|
{!OtherServicesglobal && (
|
||||||
<>
|
<>
|
||||||
|
{FeatureAddonData?.FeatureDtls?.find(
|
||||||
|
(item) =>
|
||||||
|
item?.FeatureAddonName?.toLowerCase() === 'weight scale'
|
||||||
|
) && (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<BSNavBarWeightScale />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{FeatureAddonData?.FeatureDtls?.find(
|
{FeatureAddonData?.FeatureDtls?.find(
|
||||||
(item) => item?.FeatureAddonName?.toLowerCase() === 'preorder'
|
(item) => item?.FeatureAddonName?.toLowerCase() === 'preorder'
|
||||||
) && (
|
) && (
|
||||||
|
|
@ -1152,7 +1154,20 @@ const BSNavbar1 = (props, BookingNavbar) => {
|
||||||
|
|
||||||
{!OtherServicesglobal && (
|
{!OtherServicesglobal && (
|
||||||
<>
|
<>
|
||||||
|
{/* Weight Scale */}
|
||||||
|
{FeatureAddonData?.FeatureDtls?.find(
|
||||||
|
(item) =>
|
||||||
|
item?.FeatureAddonName?.toLowerCase() === 'weight scale'
|
||||||
|
) && (
|
||||||
|
<div
|
||||||
|
className="ResNavbarIcons"
|
||||||
|
style={{
|
||||||
|
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<BSNavBarWeightScale />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{/* PreOrder */}
|
{/* PreOrder */}
|
||||||
{FeatureAddonData?.FeatureDtls?.find(
|
{FeatureAddonData?.FeatureDtls?.find(
|
||||||
(item) => item?.FeatureAddonName?.toLowerCase() === 'preorder'
|
(item) => item?.FeatureAddonName?.toLowerCase() === 'preorder'
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ import { blobToBase64,encryptObject, pdfDiv } from "../../../../Services/Others"
|
||||||
import { PrintStyleFunction } from "../../../paymentpdfPage/PrintStyleFunction";
|
import { PrintStyleFunction } from "../../../paymentpdfPage/PrintStyleFunction";
|
||||||
import { Emailsend } from "../../../../Features/PurchaseOrder/PurchaseOrder";
|
import { Emailsend } from "../../../../Features/PurchaseOrder/PurchaseOrder";
|
||||||
import { PublicQrCodepost } from "../../../../Features/ConfigMasterPage/ConfigMasterPage";
|
import { PublicQrCodepost } from "../../../../Features/ConfigMasterPage/ConfigMasterPage";
|
||||||
import { downloadFile } from "../../../../utils/downloadFile";
|
|
||||||
const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
|
const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
|
||||||
export const MobilePdfPrint = async ({
|
export const MobilePdfPrint = async ({
|
||||||
printerTemplateStyle = 'Style 13',
|
printerTemplateStyle = 'Style 13',
|
||||||
|
|
@ -112,26 +111,14 @@ export const MobilePdfPrint = async ({
|
||||||
|
|
||||||
if (PrintComing === 'download') {
|
if (PrintComing === 'download') {
|
||||||
// 📥 Download PDF
|
// 📥 Download PDF
|
||||||
// const link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
// link.href = URL.createObjectURL(pdfBlob);
|
link.href = URL.createObjectURL(pdfBlob);
|
||||||
// link.download = `Receipt_${new Date().getTime()}.pdf`;
|
link.download = `Receipt_${new Date().getTime()}.pdf`;
|
||||||
// document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
// link.click();
|
link.click();
|
||||||
// document.body.removeChild(link);
|
document.body.removeChild(link);
|
||||||
// URL.revokeObjectURL(link.href);
|
URL.revokeObjectURL(link.href);
|
||||||
const buffer = await pdfBlob.arrayBuffer();
|
|
||||||
|
|
||||||
downloadFile(
|
|
||||||
buffer,
|
|
||||||
`Receipt_${new Date().getTime()}.pdf`,
|
|
||||||
"application/pdf",
|
|
||||||
(success) => {
|
|
||||||
if (!success) {
|
|
||||||
|
|
||||||
console.error('Failed to download the file. Please try again.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
// Clear printed orders
|
// Clear printed orders
|
||||||
setPrintOrderDetails([]);
|
setPrintOrderDetails([]);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -435,8 +435,7 @@ const SalesNetAmountModal = ({
|
||||||
color: '#2e7d32',
|
color: '#2e7d32',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* {total-RefundAmt} */}
|
{total-RefundAmt}
|
||||||
{total}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -175,21 +175,6 @@ const Printstyle4 = ({
|
||||||
(setting) =>
|
(setting) =>
|
||||||
setting?.SettingIdName?.toLowerCase() === 'estimateprintheader'
|
setting?.SettingIdName?.toLowerCase() === 'estimateprintheader'
|
||||||
)?.SettingValue === 'Y';
|
)?.SettingValue === 'Y';
|
||||||
const estimatebrname =
|
|
||||||
SettingData?.[0]?.SettingDtlDetails?.find(
|
|
||||||
(setting) =>
|
|
||||||
setting?.SettingIdName?.toLowerCase() === 'estimatebrname'
|
|
||||||
)?.SettingValue === 'Y';
|
|
||||||
const estimatebraddress =
|
|
||||||
SettingData?.[0]?.SettingDtlDetails?.find(
|
|
||||||
(setting) =>
|
|
||||||
setting?.SettingIdName?.toLowerCase() === 'estimatebraddress'
|
|
||||||
)?.SettingValue === 'Y';
|
|
||||||
const estimatebrphone =
|
|
||||||
SettingData?.[0]?.SettingDtlDetails?.find(
|
|
||||||
(setting) =>
|
|
||||||
setting?.SettingIdName?.toLowerCase() === 'estimatebrphone'
|
|
||||||
)?.SettingValue === 'Y';
|
|
||||||
const estimateTitle =
|
const estimateTitle =
|
||||||
SettingData?.[0]?.SettingDtlDetails?.find(
|
SettingData?.[0]?.SettingDtlDetails?.find(
|
||||||
(setting) => setting?.SettingIdName?.toLowerCase() === 'estimatetitle'
|
(setting) => setting?.SettingIdName?.toLowerCase() === 'estimatetitle'
|
||||||
|
|
@ -3362,7 +3347,7 @@ const Printstyle4 = ({
|
||||||
width={100}
|
width={100}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
{estimatebrname && <div
|
<div
|
||||||
style={{
|
style={{
|
||||||
fontSize: '16px',
|
fontSize: '16px',
|
||||||
fontWeight: '600',
|
fontWeight: '600',
|
||||||
|
|
@ -3374,10 +3359,10 @@ const Printstyle4 = ({
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
|
{GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
|
||||||
</div>}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{estimatebraddress && <div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
|
|
@ -3401,14 +3386,12 @@ const Printstyle4 = ({
|
||||||
? '-'
|
? '-'
|
||||||
: '') + table2Data?.AddressDetails?.[0]?.Zip
|
: '') + table2Data?.AddressDetails?.[0]?.Zip
|
||||||
: '')}
|
: '')}
|
||||||
</div>}
|
</div>
|
||||||
{estimatebrphone && (
|
|
||||||
<div style={{ fontWeight: '500', fontSize: '10px' }}>
|
<div style={{ fontWeight: '500', fontSize: '10px' }}>
|
||||||
{' '}
|
{' '}
|
||||||
Mobile : +91{' '}
|
Mobile : +91{' '}
|
||||||
{GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
|
{GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{/* <div>
|
{/* <div>
|
||||||
|
|
|
||||||
|
|
@ -335,13 +335,6 @@ const RetailBookingClosing = (props) => {
|
||||||
{safeRound(PaymentClosingData?.OverAllUpiAmount)}
|
{safeRound(PaymentClosingData?.OverAllUpiAmount)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{PaymentClosingData?.OverAllRefundAmount > 0 && (<div className="ClosepayBTN">
|
|
||||||
<p>Refund Amount</p>
|
|
||||||
<div>=</div>
|
|
||||||
<span style={{ color: '#28AA3A', cursor: 'pointer' }}>
|
|
||||||
{safeRound(PaymentClosingData?.OverAllRefundAmount)}
|
|
||||||
</span>
|
|
||||||
</div>)}
|
|
||||||
<div className="ClosepayBTN">
|
<div className="ClosepayBTN">
|
||||||
<p> Total Cash In Hand</p>
|
<p> Total Cash In Hand</p>
|
||||||
<div>=</div>
|
<div>=</div>
|
||||||
|
|
|
||||||
|
|
@ -82,9 +82,7 @@ const SalesCountComponent = React.memo(
|
||||||
SelfTakeAwayAmount,
|
SelfTakeAwayAmount,
|
||||||
SelfDineInAmount,
|
SelfDineInAmount,
|
||||||
PreOrderAmount,
|
PreOrderAmount,
|
||||||
RefundAmt,
|
RefundAmt
|
||||||
DineInRefundAmount,
|
|
||||||
TakeAwayRefundAmount
|
|
||||||
} = GlobalsalesDetailData.length > 0 ? GlobalsalesDetailData[0] : {};
|
} = GlobalsalesDetailData.length > 0 ? GlobalsalesDetailData[0] : {};
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
@ -174,7 +172,7 @@ const SalesCountComponent = React.memo(
|
||||||
{takeAwayPreference && (
|
{takeAwayPreference && (
|
||||||
<p>
|
<p>
|
||||||
Take Away:{' '}
|
Take Away:{' '}
|
||||||
{(TakeAwayOrderCount + SelfTakeAwayOrderCount || 0)}
|
{TakeAwayOrderCount + SelfTakeAwayOrderCount || 0}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
<p>Dine In: {DineInOrderCount + SelfDineInOrderCount || 0}</p>
|
<p>Dine In: {DineInOrderCount + SelfDineInOrderCount || 0}</p>
|
||||||
|
|
@ -530,20 +528,6 @@ const SalesCountComponent = React.memo(
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{ TakeAwayRefundAmount != 0 && <div
|
|
||||||
style={{
|
|
||||||
display: 'flex',
|
|
||||||
gap: '1rem',
|
|
||||||
justifyContent: 'flex-end',
|
|
||||||
fontFamily: 'Poppins',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div>Refund (-) :</div>
|
|
||||||
<div>
|
|
||||||
{safeRound(TakeAwayRefundAmount)}
|
|
||||||
</div>
|
|
||||||
</div>}
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
|
|
@ -564,12 +548,11 @@ const SalesCountComponent = React.memo(
|
||||||
<div>Total</div>
|
<div>Total</div>
|
||||||
<div>
|
<div>
|
||||||
{safeRound(
|
{safeRound(
|
||||||
(TakeAwayAmount ?? 0) +
|
TakeAwayAmount +
|
||||||
(SelfTakeAwayAmount ?? 0) +
|
SelfTakeAwayAmount +
|
||||||
(PreOrderAmount ?? 0) -
|
PreOrderAmount -
|
||||||
(OverAllTakeAwayOfferAmount ?? 0) -
|
OverAllTakeAwayOfferAmount
|
||||||
(TakeAwayRefundAmount ?? 0)
|
)}
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -579,11 +562,10 @@ const SalesCountComponent = React.memo(
|
||||||
{isMobile ? 'TA' : 'Take Away'}:{' '}
|
{isMobile ? 'TA' : 'Take Away'}:{' '}
|
||||||
<span>
|
<span>
|
||||||
{safeRound(
|
{safeRound(
|
||||||
((TakeAwayAmount || 0) +
|
(TakeAwayAmount ||
|
||||||
(SelfTakeAwayAmount || 0) +
|
0 + SelfTakeAwayAmount ||
|
||||||
(PreOrderAmount || 0)) -
|
0 + PreOrderAmount ||
|
||||||
(OverAllTakeAwayOfferAmount || 0) -
|
0) - OverAllTakeAwayOfferAmount
|
||||||
(TakeAwayRefundAmount || 0)
|
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -621,21 +603,6 @@ const SalesCountComponent = React.memo(
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{ DineInRefundAmount != 0 && <div
|
|
||||||
style={{
|
|
||||||
display: 'flex',
|
|
||||||
gap: '1rem',
|
|
||||||
justifyContent: 'flex-end',
|
|
||||||
fontFamily: 'Poppins',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div>Refund (-) :</div>
|
|
||||||
<div>
|
|
||||||
{safeRound(DineInRefundAmount)}
|
|
||||||
</div>
|
|
||||||
</div>}
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
|
|
@ -656,11 +623,10 @@ const SalesCountComponent = React.memo(
|
||||||
<div>Total</div>
|
<div>Total</div>
|
||||||
<div>
|
<div>
|
||||||
{safeRound(
|
{safeRound(
|
||||||
(DineInAmount ?? 0) +
|
DineInAmount +
|
||||||
(SelfDineInAmount ?? 0) -
|
SelfDineInAmount -
|
||||||
(OverAllDineInOfferAmount ?? 0) -
|
OverAllDineInOfferAmount
|
||||||
(DineInRefundAmount ?? 0)
|
)}
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -670,10 +636,9 @@ const SalesCountComponent = React.memo(
|
||||||
{isMobile ? 'DI' : 'Dine In'}:{' '}
|
{isMobile ? 'DI' : 'Dine In'}:{' '}
|
||||||
<span>
|
<span>
|
||||||
{safeRound(
|
{safeRound(
|
||||||
(DineInAmount ?? 0) +
|
DineInAmount +
|
||||||
(SelfDineInAmount ?? 0) -
|
SelfDineInAmount -
|
||||||
(OverAllDineInOfferAmount ?? 0) -
|
OverAllDineInOfferAmount
|
||||||
(DineInRefundAmount ?? 0)
|
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -698,19 +663,12 @@ const SalesCountComponent = React.memo(
|
||||||
{isMobile ? 'NA' : 'Net Amt'}:{' '}
|
{isMobile ? 'NA' : 'Net Amt'}:{' '}
|
||||||
<span>
|
<span>
|
||||||
{safeRound(
|
{safeRound(
|
||||||
(
|
(TakeAwayAmount +
|
||||||
(TakeAwayAmount ?? 0) +
|
SelfTakeAwayAmount +
|
||||||
(SelfTakeAwayAmount ?? 0) +
|
PreOrderAmount -
|
||||||
(PreOrderAmount ?? 0) -
|
OverAllTakeAwayOfferAmount || 0) +
|
||||||
(OverAllTakeAwayOfferAmount ?? 0)
|
(DineInAmount + SelfDineInAmount - OverAllDineInOfferAmount)
|
||||||
) +
|
)}
|
||||||
(
|
|
||||||
(DineInAmount ?? 0) +
|
|
||||||
(SelfDineInAmount ?? 0) -
|
|
||||||
(OverAllDineInOfferAmount ?? 0)
|
|
||||||
) -
|
|
||||||
(RefundAmt ?? 0)
|
|
||||||
)}
|
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
{Customisebillno && <CustomisedInvoiceChange />}
|
{Customisebillno && <CustomisedInvoiceChange />}
|
||||||
|
|
|
||||||
|
|
@ -777,10 +777,6 @@ const ChangePaymentmode = () => {
|
||||||
dispatch(ChangeSelectedCustDisable(false));
|
dispatch(ChangeSelectedCustDisable(false));
|
||||||
SelectCanPaymode(null);
|
SelectCanPaymode(null);
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
setMessageType('error');
|
|
||||||
setMessageData(response?.data?.response);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Payment mode change failed:', error);
|
console.error('Payment mode change failed:', error);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ import {
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Space,
|
Space,
|
||||||
Segmented,
|
Segmented,
|
||||||
Checkbox,
|
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import { BsUpcScan } from "react-icons/bs";
|
import { BsUpcScan } from "react-icons/bs";
|
||||||
import {
|
import {
|
||||||
|
|
@ -117,7 +116,6 @@ const DeliveryChellanForm = () => {
|
||||||
const [selectedOrder, setSelectedOrder] = useState();
|
const [selectedOrder, setSelectedOrder] = useState();
|
||||||
const [orderTableData, setOrderTableData] = useState([]);
|
const [orderTableData, setOrderTableData] = useState([]);
|
||||||
const [emailSending, setEmailSending] = useState(false);
|
const [emailSending, setEmailSending] = useState(false);
|
||||||
const [selectedCustomertype, setSelectedCustomertype] = useState('N');
|
|
||||||
|
|
||||||
const items = [
|
const items = [
|
||||||
{
|
{
|
||||||
|
|
@ -134,11 +132,9 @@ const DeliveryChellanForm = () => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(changeBreadCrumb({ items: items }));
|
dispatch(changeBreadCrumb({ items: items }));
|
||||||
getProduct();
|
getProduct();
|
||||||
|
fetchdata();
|
||||||
getPrintData();
|
getPrintData();
|
||||||
}, []);
|
}, []);
|
||||||
useEffect(() => {
|
|
||||||
fetchdata();
|
|
||||||
}, [selectedCustomertype]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (UserType === 'Employee') {
|
if (UserType === 'Employee') {
|
||||||
|
|
@ -265,14 +261,14 @@ const DeliveryChellanForm = () => {
|
||||||
console.log(AllCustomer, "AllCustomerAllCustomer")
|
console.log(AllCustomer, "AllCustomerAllCustomer")
|
||||||
const fetchdata = async () => {
|
const fetchdata = async () => {
|
||||||
try {
|
try {
|
||||||
const resCustomer = await dispatch(getAllCustomerAndBranch({ CompId, AppId, BranchId, selectedCustomertype })).unwrap();
|
const resCustomer = await dispatch(getAllCustomerAndBranch({ CompId, AppId, BranchId })).unwrap();
|
||||||
if (resCustomer?.data?.statusCode === 1) {
|
if (resCustomer?.data?.statusCode === 1) {
|
||||||
setAllCustomer(resCustomer?.data?.data);
|
setAllCustomer(resCustomer?.data?.data);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
setAllCustomer([]);
|
setAllCustomer([]);
|
||||||
// setMessageType("error");
|
setMessageType("error");
|
||||||
// setMessageData(resCustomer?.data?.response);
|
setMessageData(resCustomer?.data?.response);
|
||||||
}
|
}
|
||||||
|
|
||||||
const resOrders = await dispatch(PendingOrdersDC({ CompId, AppId, BranchId })).unwrap();
|
const resOrders = await dispatch(PendingOrdersDC({ CompId, AppId, BranchId })).unwrap();
|
||||||
|
|
@ -280,8 +276,8 @@ const DeliveryChellanForm = () => {
|
||||||
setOrdersCustomer(resOrders?.data?.data?.PurchaseOrder);
|
setOrdersCustomer(resOrders?.data?.data?.PurchaseOrder);
|
||||||
} else {
|
} else {
|
||||||
setOrdersCustomer([]);
|
setOrdersCustomer([]);
|
||||||
// setMessageType("error");
|
setMessageType("error");
|
||||||
// setMessageData(resOrders?.data?.response);
|
setMessageData(resOrders?.data?.response);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
@ -1246,7 +1242,7 @@ const DeliveryChellanForm = () => {
|
||||||
setMessageData('Email failed to send');
|
setMessageData('Email failed to send');
|
||||||
setMessageType('error');
|
setMessageType('error');
|
||||||
}
|
}
|
||||||
finally {
|
finally{
|
||||||
setEmailSending(false);
|
setEmailSending(false);
|
||||||
}
|
}
|
||||||
}, 300);
|
}, 300);
|
||||||
|
|
@ -1349,7 +1345,7 @@ const DeliveryChellanForm = () => {
|
||||||
</div>
|
</div>
|
||||||
<div className="DeliveryChellanDetails">
|
<div className="DeliveryChellanDetails">
|
||||||
|
|
||||||
{segmentValue === "N" ? <div style={{ display: "flex", alignItems: "center", gap: "12px" }}>
|
{segmentValue === "N" ? <div>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="CustId"
|
name="CustId"
|
||||||
rules={[
|
rules={[
|
||||||
|
|
@ -1372,21 +1368,6 @@ const DeliveryChellanForm = () => {
|
||||||
onChangeFunction={handleAdminUserDropDownChange}
|
onChangeFunction={handleAdminUserDropDownChange}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
{/* <Form.Item> */}
|
|
||||||
<Tooltip
|
|
||||||
title="Check to view all branch customers. Uncheck to view only your branch customers.">
|
|
||||||
<Checkbox
|
|
||||||
checked={selectedCustomertype === 'Y'}
|
|
||||||
onChange={(e) => {
|
|
||||||
setSelectedCustomertype(e.target.checked ? 'Y' : 'N');
|
|
||||||
}}
|
|
||||||
> {selectedCustomertype === 'Y'
|
|
||||||
? 'All Branch'
|
|
||||||
: 'My Branch'}
|
|
||||||
</Checkbox>
|
|
||||||
</Tooltip>
|
|
||||||
{/* </Form.Item> */}
|
|
||||||
</div> : <div>
|
</div> : <div>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="Order"
|
name="Order"
|
||||||
|
|
@ -1741,7 +1722,7 @@ const DeliveryChellanForm = () => {
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
/> */}
|
/> */}
|
||||||
{(iSEmail || emailSending) && (
|
{(iSEmail || emailSending )&& (
|
||||||
<EmailModel
|
<EmailModel
|
||||||
open={iSEmail}
|
open={iSEmail}
|
||||||
emailSending={emailSending}
|
emailSending={emailSending}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
import { Form, Checkbox, Radio, Divider, InputNumber } from 'antd';
|
import { Form, Checkbox, Radio, Divider, InputNumber } from 'antd';
|
||||||
import { ArrowRightOutlined } from '@ant-design/icons';
|
import { ArrowRightOutlined } from '@ant-design/icons';
|
||||||
|
|
@ -30,7 +30,6 @@ const PreferenceList = ({ setting = false }) => {
|
||||||
const { SadminuserAccess, featureaddDetails } = useAuth();
|
const { SadminuserAccess, featureaddDetails } = useAuth();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const formRef = useRef();
|
const formRef = useRef();
|
||||||
const prevEstimateRef = useRef([]);
|
|
||||||
const CompId = getSession('CompId');
|
const CompId = getSession('CompId');
|
||||||
const BranchId = getSession('BranchId');
|
const BranchId = getSession('BranchId');
|
||||||
const AppId = getSession('AppId');
|
const AppId = getSession('AppId');
|
||||||
|
|
@ -158,10 +157,6 @@ const PreferenceList = ({ setting = false }) => {
|
||||||
...(allSettingsMap['estimatetitle']?.value === 'Y'
|
...(allSettingsMap['estimatetitle']?.value === 'Y'
|
||||||
? ['estimatetitle']
|
? ['estimatetitle']
|
||||||
: []),
|
: []),
|
||||||
...(allSettingsMap['estimatebrname']?.value === 'Y' ? ['estimatebrname'] : []),
|
|
||||||
...(allSettingsMap['estimatebraddress']?.value === 'Y' ? ['estimatebraddress'] : []),
|
|
||||||
...(allSettingsMap['estimatebrphone']?.value === 'Y' ? ['estimatebrphone'] : []),
|
|
||||||
|
|
||||||
],
|
],
|
||||||
scanlayout: allSettingsMap['scanlayout']?.value === 'Y',
|
scanlayout: allSettingsMap['scanlayout']?.value === 'Y',
|
||||||
verifyproduct: allSettingsMap['verifyproduct']?.value === 'Y',
|
verifyproduct: allSettingsMap['verifyproduct']?.value === 'Y',
|
||||||
|
|
@ -212,9 +207,9 @@ const PreferenceList = ({ setting = false }) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
useEffect(() => {
|
useEffect(()=>{
|
||||||
fetchTableData();
|
fetchTableData();
|
||||||
}, [selectedUserId])
|
},[selectedUserId])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (settingsList) {
|
if (settingsList) {
|
||||||
|
|
@ -222,8 +217,6 @@ const PreferenceList = ({ setting = false }) => {
|
||||||
setInitialValues(built);
|
setInitialValues(built);
|
||||||
console.log(built, 'built');
|
console.log(built, 'built');
|
||||||
formRef.current?.setFieldsValue(built);
|
formRef.current?.setFieldsValue(built);
|
||||||
prevEstimateRef.current = built.estimateSettings ?? [];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}, [settingsList]);
|
}, [settingsList]);
|
||||||
|
|
||||||
|
|
@ -318,7 +311,7 @@ const PreferenceList = ({ setting = false }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchTableData = async () => {
|
const fetchTableData = async () => {
|
||||||
const res = await dispatch(gettableData({ CompId, BranchId, AppId, UserId: selectedUserId })).unwrap();
|
const res = await dispatch(gettableData({ CompId, BranchId, AppId,UserId:selectedUserId })).unwrap();
|
||||||
const data = { CompId, BranchId, AppId, UserId: selectedUserId };
|
const data = { CompId, BranchId, AppId, UserId: selectedUserId };
|
||||||
// const res = await dispatch(getPreferenceData(data)).unwrap();
|
// const res = await dispatch(getPreferenceData(data)).unwrap();
|
||||||
if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) {
|
if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) {
|
||||||
|
|
@ -412,15 +405,8 @@ const PreferenceList = ({ setting = false }) => {
|
||||||
dinein: values.enabledModules,
|
dinein: values.enabledModules,
|
||||||
estimation: values.enabledModules,
|
estimation: values.enabledModules,
|
||||||
parking: values.enabledFeatures,
|
parking: values.enabledFeatures,
|
||||||
// estimateprintheader: values.estimateSettings,
|
|
||||||
// estimatebrname: values.estimatebrname,
|
|
||||||
// estimatebraddress: values.estimatebraddress,
|
|
||||||
// estimatebrphone: values.estimatebrphone,
|
|
||||||
estimateprintheader: values.estimateSettings,
|
estimateprintheader: values.estimateSettings,
|
||||||
estimatetitle: values.estimateSettings,
|
estimatetitle: values.estimateSettings,
|
||||||
estimatebrname: values.estimateSettings,
|
|
||||||
estimatebraddress: values.estimateSettings,
|
|
||||||
estimatebrphone: values.estimateSettings,
|
|
||||||
offer: values.enabledFeatures,
|
offer: values.enabledFeatures,
|
||||||
whatsapp: values.pdfSendOptions,
|
whatsapp: values.pdfSendOptions,
|
||||||
sms: values.pdfSendOptions,
|
sms: values.pdfSendOptions,
|
||||||
|
|
@ -506,7 +492,7 @@ const PreferenceList = ({ setting = false }) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [userDropDown]);
|
}, [userDropDown]);
|
||||||
const UserDropDownChange = (value) => {
|
const UserDropDownChange = (value) => {
|
||||||
let user = userDropDown?.find((item) => item?.UserId === value);
|
let user = userDropDown?.find((item) => item?.UserId === value);
|
||||||
setSelectedUserId(user?.UserId)
|
setSelectedUserId(user?.UserId)
|
||||||
|
|
@ -514,11 +500,11 @@ const PreferenceList = ({ setting = false }) => {
|
||||||
userId: value,
|
userId: value,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const userDropData = async () => {
|
const userDropData = async () => {
|
||||||
const data = {
|
const data ={
|
||||||
branchId: BranchId,
|
branchId:BranchId,
|
||||||
compId: CompId,
|
compId:CompId,
|
||||||
appId: AppId
|
appId:AppId
|
||||||
}
|
}
|
||||||
const gettinguserDropDown = await dispatch(getBranchUsers(data)).unwrap();
|
const gettinguserDropDown = await dispatch(getBranchUsers(data)).unwrap();
|
||||||
// const gettinguserDropDown = await dispatch(UserDataBasedOnBranchId(BranchId)).unwrap();
|
// const gettinguserDropDown = await dispatch(UserDataBasedOnBranchId(BranchId)).unwrap();
|
||||||
|
|
@ -539,7 +525,7 @@ const PreferenceList = ({ setting = false }) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderCheckbox = (name, label) =>
|
const renderCheckbox = (name, label) =>
|
||||||
allSettingsMap[name] !== undefined && (
|
allSettingsMap[name] !== undefined && (
|
||||||
|
|
@ -547,53 +533,6 @@ const PreferenceList = ({ setting = false }) => {
|
||||||
<Checkbox>Yes</Checkbox>
|
<Checkbox>Yes</Checkbox>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
);
|
);
|
||||||
const ESTIMATE_PRINT_SETTINGS = [
|
|
||||||
{
|
|
||||||
key: 'estimateprintheader',
|
|
||||||
label: 'Show shop header',
|
|
||||||
children: [
|
|
||||||
{ key: 'estimatebrname', label: 'name' },
|
|
||||||
{ key: 'estimatebraddress', label: 'address' },
|
|
||||||
{ key: 'estimatebrphone', label: 'phone number' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'estimatetitle',
|
|
||||||
label: 'Show "Estimate" title',
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
const handleEstimateChange = (checkedValues) => {
|
|
||||||
const prev = prevEstimateRef.current;
|
|
||||||
let updated = [...checkedValues];
|
|
||||||
|
|
||||||
ESTIMATE_PRINT_SETTINGS.forEach(({ key, children }) => {
|
|
||||||
if (!children.length) return;
|
|
||||||
|
|
||||||
const childKeys = children
|
|
||||||
.filter((c) => allSettingsMap[c.key] !== undefined)
|
|
||||||
.map((c) => c.key);
|
|
||||||
|
|
||||||
const parentJustChecked = checkedValues.includes(key) && !prev.includes(key);
|
|
||||||
|
|
||||||
// Parent just checked → add all children
|
|
||||||
if (parentJustChecked) {
|
|
||||||
updated = [...new Set([...updated, ...childKeys])];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate AFTER updated may have changed above ✅
|
|
||||||
const anyChildChecked = childKeys.some((c) => updated.includes(c));
|
|
||||||
|
|
||||||
// All children removed → remove parent
|
|
||||||
if (updated.includes(key) && !anyChildChecked) { // ✅ uses variable, no duplicate
|
|
||||||
updated = updated.filter((v) => v !== key);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
prevEstimateRef.current = updated;
|
|
||||||
formRef.current?.setFieldValue('estimateSettings', updated);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
@ -682,7 +621,7 @@ const PreferenceList = ({ setting = false }) => {
|
||||||
initialValues={initialValues}
|
initialValues={initialValues}
|
||||||
className="preferences-list"
|
className="preferences-list"
|
||||||
>
|
>
|
||||||
{(UserType === 'Admin' || UserType === 'Super Admin' || UserType === 'Super Admin User') && (<span>
|
{(UserType === 'Admin' || UserType === 'Super Admin' || UserType === 'Super Admin User')&& ( <span>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="userId"
|
name="userId"
|
||||||
rules={[
|
rules={[
|
||||||
|
|
@ -1225,31 +1164,24 @@ const PreferenceList = ({ setting = false }) => {
|
||||||
'mobilea4',
|
'mobilea4',
|
||||||
'Prefer printing in A4/A5 on mobile?'
|
'Prefer printing in A4/A5 on mobile?'
|
||||||
)}
|
)}
|
||||||
{ESTIMATE_PRINT_SETTINGS.some(({ key }) => allSettingsMap[key] !== undefined) && (
|
{(allSettingsMap['estimateprintheader'] !== undefined ||
|
||||||
<Form.Item noStyle shouldUpdate>
|
allSettingsMap['estimatetitle'] !== undefined) && (
|
||||||
{({ getFieldValue }) => (
|
<Form.Item
|
||||||
<Form.Item name="estimateSettings" label="Estimate Print Settings :">
|
name="estimateSettings"
|
||||||
<Checkbox.Group onChange={(vals) => handleEstimateChange(vals, formRef)}>
|
label="Estimate Print Settings :"
|
||||||
{ESTIMATE_PRINT_SETTINGS
|
>
|
||||||
.filter(({ key }) => allSettingsMap[key] !== undefined)
|
<Checkbox.Group>
|
||||||
.map(({ key, label, children }) => (
|
{allSettingsMap['estimateprintheader'] !== undefined && (
|
||||||
<React.Fragment key={key}>
|
<Checkbox value="estimateprintheader">
|
||||||
<Checkbox value={key}>{label}</Checkbox>
|
Show shop header (Name, Address, GST)
|
||||||
|
|
||||||
{children.length > 0 &&
|
|
||||||
getFieldValue('estimateSettings')?.includes(key) &&
|
|
||||||
children
|
|
||||||
.filter((child) => allSettingsMap[child.key] !== undefined)
|
|
||||||
.map((child) => (
|
|
||||||
<Checkbox key={child.key} value={child.key}>
|
|
||||||
{child.label}
|
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
))}
|
|
||||||
</React.Fragment>
|
|
||||||
))}
|
|
||||||
</Checkbox.Group>
|
|
||||||
</Form.Item>
|
|
||||||
)}
|
)}
|
||||||
|
{allSettingsMap['estimatetitle'] !== undefined && (
|
||||||
|
<Checkbox value="estimatetitle">
|
||||||
|
Show “Estimate (R/W)” title
|
||||||
|
</Checkbox>
|
||||||
|
)}
|
||||||
|
</Checkbox.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,6 @@ const ProductForm = ({ formType }) => {
|
||||||
|
|
||||||
const state = location?.state;
|
const state = location?.state;
|
||||||
const editstate = state?.editstate;
|
const editstate = state?.editstate;
|
||||||
console.log(editstate,'editstate23233232');
|
|
||||||
|
|
||||||
const formRef = useRef(null);
|
const formRef = useRef(null);
|
||||||
const formCategoryRef = useRef(null);
|
const formCategoryRef = useRef(null);
|
||||||
|
|
|
||||||
|
|
@ -177,8 +177,6 @@ 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'), []);
|
||||||
|
|
@ -1959,8 +1957,7 @@ const TurboAddForm = () => {
|
||||||
<BarCodeScan
|
<BarCodeScan
|
||||||
style={{ FontSize: '12px', marginLeft: '8px' }}
|
style={{ FontSize: '12px', marginLeft: '8px' }}
|
||||||
onScan={(value) => {
|
onScan={(value) => {
|
||||||
console.log('Scanned value:', value);
|
changeSearchedData(value);
|
||||||
handleQrData(value);
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ const DateWiseReport = () => {
|
||||||
setting?.SettingIdName?.toLowerCase() === 'mobilea4' &&
|
setting?.SettingIdName?.toLowerCase() === 'mobilea4' &&
|
||||||
setting?.SettingValue === 'Y'
|
setting?.SettingValue === 'Y'
|
||||||
);
|
);
|
||||||
console.log(MobileA4Print, SettingDataSelector, 'MobileA4PrintMobileA4Print');
|
console.log(MobileA4Print,SettingDataSelector, 'MobileA4PrintMobileA4Print');
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (dataSource?.length > 0) {
|
if (dataSource?.length > 0) {
|
||||||
|
|
@ -369,7 +369,7 @@ const DateWiseReport = () => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const getPreference = async () => {
|
const getPreference = async () => {
|
||||||
const data = { AppId: AppId, CompId: CompId, BranchId: BranchId, UserId: sessionuserid };
|
const data = { AppId: AppId, CompId: CompId, BranchId: BranchId,UserId: sessionuserid };
|
||||||
const { data: res } = await dispatch(getPreferenceData(data)).unwrap();
|
const { data: res } = await dispatch(getPreferenceData(data)).unwrap();
|
||||||
const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find(
|
const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find(
|
||||||
(setting) =>
|
(setting) =>
|
||||||
|
|
@ -947,12 +947,6 @@ const DateWiseReport = () => {
|
||||||
<td>{datewiseData?.[0]?.TotalExtraChargeAmount}</td>
|
<td>{datewiseData?.[0]?.TotalExtraChargeAmount}</td>
|
||||||
</tr>
|
</tr>
|
||||||
)}
|
)}
|
||||||
{datewiseData?.[0]?.RefundAmount > 0 && (
|
|
||||||
<tr>
|
|
||||||
<td>Refund (-)</td>
|
|
||||||
<td>{datewiseData?.[0]?.RefundAmount}</td>
|
|
||||||
</tr>
|
|
||||||
)}
|
|
||||||
{datewiseData?.[0]?.PreOrderNetAmount > 0 && (
|
{datewiseData?.[0]?.PreOrderNetAmount > 0 && (
|
||||||
<tr>
|
<tr>
|
||||||
<td>Preorder</td>
|
<td>Preorder</td>
|
||||||
|
|
@ -988,10 +982,8 @@ const DateWiseReport = () => {
|
||||||
datewiseData?.[0]?.WholeSaleExpenseNetAmount
|
datewiseData?.[0]?.WholeSaleExpenseNetAmount
|
||||||
) || 0
|
) || 0
|
||||||
: safeRound(
|
: safeRound(
|
||||||
(datewiseData?.[0]?.TotalBillAmount || 0) +
|
datewiseData?.[0]?.TotalNetAmount +
|
||||||
(datewiseData?.[0]?.TaxAmount || 0) +
|
(datewiseData?.[0]?.PreOrderNetAmount || 0)
|
||||||
(datewiseData?.[0]?.PreOrderNetAmount || 0) -
|
|
||||||
(datewiseData?.[0]?.RefundAmount || 0)
|
|
||||||
) || 0}
|
) || 0}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
||||||
|
|
@ -436,7 +436,6 @@ const ItemWiseReport = () => {
|
||||||
BalanceQty:item?.BalanceQty,
|
BalanceQty:item?.BalanceQty,
|
||||||
Amount: item?.TotalAmt,
|
Amount: item?.TotalAmt,
|
||||||
StockAvailable:item?.StockAvailable,
|
StockAvailable:item?.StockAvailable,
|
||||||
RefundAmount: item?.RefundAmount,
|
|
||||||
}));
|
}));
|
||||||
const itemData = DateWisTableData;
|
const itemData = DateWisTableData;
|
||||||
|
|
||||||
|
|
@ -1211,14 +1210,6 @@ const ItemWiseReport = () => {
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
)}
|
)}
|
||||||
{ItemWiseData?.[0]?.RefundAmount > 0 && (
|
|
||||||
<tr>
|
|
||||||
<td>Refund (-) </td>
|
|
||||||
<td>
|
|
||||||
{safeRound(ItemWiseData?.[0]?.RefundAmount)}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
)}
|
|
||||||
{ItemWiseData?.[0]?.PreOrderNetAmount > 0 && (
|
{ItemWiseData?.[0]?.PreOrderNetAmount > 0 && (
|
||||||
<tr>
|
<tr>
|
||||||
<td>Preorder</td>
|
<td>Preorder</td>
|
||||||
|
|
@ -1252,7 +1243,7 @@ const ItemWiseReport = () => {
|
||||||
(ItemWiseData?.[0]?.TotalOfferAmount
|
(ItemWiseData?.[0]?.TotalOfferAmount
|
||||||
? ItemWiseData?.[0]?.TotalOfferAmount
|
? ItemWiseData?.[0]?.TotalOfferAmount
|
||||||
: 0)
|
: 0)
|
||||||
) - (ItemWiseData?.[0]?.RefundAmount || 0) || 0}
|
) || 0}
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ import { useSelector } from 'react-redux';
|
||||||
import excelExport from '../../../Images/xls-export.png';
|
import excelExport from '../../../Images/xls-export.png';
|
||||||
import ExcelJS from 'exceljs';
|
import ExcelJS from 'exceljs';
|
||||||
import { saveAs } from 'file-saver';
|
import { saveAs } from 'file-saver';
|
||||||
import { downloadFile } from '../../../utils/downloadFile.js';
|
|
||||||
|
|
||||||
dayjs.extend(customParseFormat);
|
dayjs.extend(customParseFormat);
|
||||||
|
|
||||||
|
|
@ -621,19 +620,8 @@ const LedgerReport = () => {
|
||||||
hours = String(hours).padStart(2, '0');
|
hours = String(hours).padStart(2, '0');
|
||||||
|
|
||||||
const fileName = `Ledger Report_${day}-${month}-${year}_${hours}-${minutes}-${ampm}.xlsx`;
|
const fileName = `Ledger Report_${day}-${month}-${year}_${hours}-${minutes}-${ampm}.xlsx`;
|
||||||
downloadFile(
|
|
||||||
buffer,
|
saveAs(blob, fileName);
|
||||||
fileName,
|
|
||||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
||||||
(success) => {
|
|
||||||
if (success) {
|
|
||||||
console.log("File downloaded and opened successfully!");
|
|
||||||
} else {
|
|
||||||
console.log("Failed to download/open file.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
// saveAs(blob, fileName);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const FirstOrderLedgerDateRaw = dayjs(FirstOrderLedgerDate);
|
const FirstOrderLedgerDateRaw = dayjs(FirstOrderLedgerDate);
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ const SalesRemovallist = () => {
|
||||||
const [Tabledata, setTabledata] = useState();
|
const [Tabledata, setTabledata] = useState();
|
||||||
const [Zero, SetZero] = useState(false);
|
const [Zero, SetZero] = useState(false);
|
||||||
const [OrderProductdata, setOrderProductdata] = useState([]);
|
const [OrderProductdata, setOrderProductdata] = useState([]);
|
||||||
|
console.log('OrderProductdata', OrderProductdata);
|
||||||
const [OrderDataModel, setOrderDataModal] = useState(false);
|
const [OrderDataModel, setOrderDataModal] = useState(false);
|
||||||
const [PaymentModal, setPaymentModal] = useState(false);
|
const [PaymentModal, setPaymentModal] = useState(false);
|
||||||
const [Paymentdata, setPaymentdata] = useState([]);
|
const [Paymentdata, setPaymentdata] = useState([]);
|
||||||
|
|
@ -710,31 +711,40 @@ const SalesRemovallist = () => {
|
||||||
|
|
||||||
const handleSave = (row) => {
|
const handleSave = (row) => {
|
||||||
const newData = [...OrderProductdata];
|
const newData = [...OrderProductdata];
|
||||||
|
|
||||||
const index = newData.findIndex((item) => row.ProdId === item.ProdId);
|
const index = newData.findIndex((item) => row.ProdId === item.ProdId);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
const existing = newData[index];
|
const item = newData.splice(index, 1, { ...row })[0];
|
||||||
const salesQty = Number(row.SalesQty);
|
|
||||||
const rate = Number(row?.Rate || 0);
|
|
||||||
const refundQty = Number(existing.OldSalesQty) - salesQty;
|
|
||||||
const refundAmount = refundQty * rate;
|
|
||||||
const updatedRow = {
|
|
||||||
...existing,
|
|
||||||
...row,
|
|
||||||
SalesQty: salesQty,
|
|
||||||
OrderQty: salesQty,
|
|
||||||
OrderRate: rate,
|
|
||||||
TotalAmt: salesQty * rate,
|
|
||||||
RefundQty: refundQty,
|
|
||||||
RefundAmount: refundAmount,
|
|
||||||
};
|
|
||||||
newData.splice(index, 1, updatedRow);
|
|
||||||
|
|
||||||
const TotalAmount = newData.reduce(
|
setOrderProductdata(item);
|
||||||
|
|
||||||
|
// Recalculate offer amounts
|
||||||
|
const updatedTableData = newData.map((item) => {
|
||||||
|
if (item.ProdId === row.ProdId) {
|
||||||
|
const updatedTotalAmt = row.SalesQty * Number(row?.Rate || 0);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
SalesQty: item.SalesQty,
|
||||||
|
OrderQty: item.SalesQty,
|
||||||
|
TotalAmt: updatedTotalAmt, // Update the recalculated TotalAmt
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const recalculatedTotalAmt = item.SalesQty * Number(item?.Rate || 0);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
TotalAmt: recalculatedTotalAmt, // Ensure all rows' TotalAmt are updated
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const TotalAmount = updatedTableData.reduce(
|
||||||
(sum, item) => sum + Number(item?.TotalAmt || 0),
|
(sum, item) => sum + Number(item?.TotalAmt || 0),
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
setTotalAmts(TotalAmount);
|
setTotalAmts(TotalAmount);
|
||||||
setOrderProductdata(newData);
|
setOrderProductdata(updatedTableData);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -909,16 +919,19 @@ const SalesRemovallist = () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const totalRefundAmount = OrderProductdata.reduce(
|
console.log(
|
||||||
(sum, prod) => sum + Number(prod?.RefundAmount || 0),
|
SalesQty,
|
||||||
0
|
SalesQty.ProductIdentifierDtls.length,
|
||||||
|
matchingProducts.length,
|
||||||
|
SalesQty.ProductIdentifierDtls.length >= matchingProducts.length,
|
||||||
|
'!!!!!!!!!'
|
||||||
);
|
);
|
||||||
|
|
||||||
if (allQtyMatch) {
|
if (allQtyMatch) {
|
||||||
const postdatas = Proddata?.map((item) => ({
|
const postdatas = Proddata.map((item) => ({
|
||||||
OrderId: item?.OrderId,
|
OrderId: item?.OrderId,
|
||||||
SalesId: item?.SalesId,
|
SalesId: item?.SalesId,
|
||||||
OrderQty:item?.OrderQty,
|
OrderQty:item?.SalesId,
|
||||||
CompId: item?.CompId,
|
CompId: item?.CompId,
|
||||||
BranchId: item?.BranchId,
|
BranchId: item?.BranchId,
|
||||||
OrderType: item?.OrderType,
|
OrderType: item?.OrderType,
|
||||||
|
|
@ -929,7 +942,7 @@ const SalesRemovallist = () => {
|
||||||
ActiveStatus: item?.ActiveStatus,
|
ActiveStatus: item?.ActiveStatus,
|
||||||
UpdatedBy: item?.CreatedBy,
|
UpdatedBy: item?.CreatedBy,
|
||||||
AppId: item?.AppId,
|
AppId: item?.AppId,
|
||||||
RefundAmount: totalRefundAmount,
|
RefundAmount: item?.RefundAmount,
|
||||||
AddlInfo: item?.AddlInfo,
|
AddlInfo: item?.AddlInfo,
|
||||||
BillAmount: item?.BillAmount,
|
BillAmount: item?.BillAmount,
|
||||||
OverallDiscSales: item?.OverallDisc,
|
OverallDiscSales: item?.OverallDisc,
|
||||||
|
|
@ -943,8 +956,7 @@ const SalesRemovallist = () => {
|
||||||
PaymentStatus: item?.PaymentStatus,
|
PaymentStatus: item?.PaymentStatus,
|
||||||
|
|
||||||
OrderDtlDetails: OrderProductdata.map((prod) => ({
|
OrderDtlDetails: OrderProductdata.map((prod) => ({
|
||||||
// ActiveStatus: prod?.ActiveStatus,
|
ActiveStatus: prod?.ActiveStatus,
|
||||||
ActiveStatus: "D",
|
|
||||||
ProdId: prod?.ProdId,
|
ProdId: prod?.ProdId,
|
||||||
Type: prod?.Type,
|
Type: prod?.Type,
|
||||||
// OrderQty: prod?.OrderQty,
|
// OrderQty: prod?.OrderQty,
|
||||||
|
|
@ -1002,7 +1014,7 @@ const SalesRemovallist = () => {
|
||||||
ActiveStatus: item?.ActiveStatus,
|
ActiveStatus: item?.ActiveStatus,
|
||||||
UpdatedBy: item?.CreatedBy,
|
UpdatedBy: item?.CreatedBy,
|
||||||
AppId: item?.AppId,
|
AppId: item?.AppId,
|
||||||
RefundAmount: totalRefundAmount,
|
RefundAmount: item?.RefundAmount,
|
||||||
AddlInfo: item?.AddlInfo,
|
AddlInfo: item?.AddlInfo,
|
||||||
BillAmount: item?.BillAmount,
|
BillAmount: item?.BillAmount,
|
||||||
OverallDiscSales: item?.OverallDisc,
|
OverallDiscSales: item?.OverallDisc,
|
||||||
|
|
@ -1059,7 +1071,7 @@ const SalesRemovallist = () => {
|
||||||
} else if (isIdentifyDetailsValid) {
|
} else if (isIdentifyDetailsValid) {
|
||||||
// else if(isSalesQtyOldSalesQty){
|
// else if(isSalesQtyOldSalesQty){
|
||||||
|
|
||||||
const postdatas = Proddata?.map((item) => ({
|
const postdatas = Proddata.map((item) => ({
|
||||||
OrderId: item?.OrderId,
|
OrderId: item?.OrderId,
|
||||||
SalesId: item?.SalesId,
|
SalesId: item?.SalesId,
|
||||||
CompId: item?.CompId,
|
CompId: item?.CompId,
|
||||||
|
|
@ -1072,7 +1084,7 @@ const SalesRemovallist = () => {
|
||||||
ActiveStatus: item?.ActiveStatus,
|
ActiveStatus: item?.ActiveStatus,
|
||||||
UpdatedBy: item?.CreatedBy,
|
UpdatedBy: item?.CreatedBy,
|
||||||
AppId: item?.AppId,
|
AppId: item?.AppId,
|
||||||
RefundAmount: totalRefundAmount,
|
RefundAmount: item?.RefundAmount,
|
||||||
AddlInfo: item?.AddlInfo,
|
AddlInfo: item?.AddlInfo,
|
||||||
BillAmount: item?.BillAmount,
|
BillAmount: item?.BillAmount,
|
||||||
OverallDiscSales: item?.OverallDisc,
|
OverallDiscSales: item?.OverallDisc,
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ const DateWiseReportPdf = ({
|
||||||
}) => {
|
}) => {
|
||||||
|
|
||||||
let PrintDetailsdata = datewiseData?.[0]?.AddressDetails?.[0];
|
let PrintDetailsdata = datewiseData?.[0]?.AddressDetails?.[0];
|
||||||
const refundAmount = datewiseData?.[0]?.RefundAmount || 0;
|
|
||||||
console.log(PrintDetailsdata, 'hhhhhhhhhhhhhhhj');
|
console.log(PrintDetailsdata, 'hhhhhhhhhhhhhhhj');
|
||||||
const [currentTime, setCurrentTime] = useState('');
|
const [currentTime, setCurrentTime] = useState('');
|
||||||
|
|
||||||
|
|
@ -286,16 +285,14 @@ const DateWiseReportPdf = ({
|
||||||
{TotalCharges > 0 && (
|
{TotalCharges > 0 && (
|
||||||
<p className="totaldetails"> Charges: {TotalCharges}</p>
|
<p className="totaldetails"> Charges: {TotalCharges}</p>
|
||||||
)}
|
)}
|
||||||
{refundAmount > 0 && (
|
|
||||||
<p className="totaldetails"> Refund: {refundAmount}</p>
|
|
||||||
)}
|
|
||||||
{TotalDiscount > 0 && (
|
{TotalDiscount > 0 && (
|
||||||
<p className="totaldetails"> Discount(-): {TotalDiscount}</p>
|
<p className="totaldetails"> Discount(-): {TotalDiscount}</p>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<p className="totaldetails">-------------------------</p>
|
<p className="totaldetails">-------------------------</p>
|
||||||
<p className="totaldetails">
|
<p className="totaldetails">
|
||||||
{' '}
|
{' '}
|
||||||
Net: {Math.round(TotalBillAmount + TaxAmount + (TotalPreOrderAmount || 0) - (refundAmount))}
|
Net: {Math.round(TotalNetAmount + (TotalPreOrderAmount || 0))}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{/* current Time */}
|
{/* current Time */}
|
||||||
|
|
|
||||||
|
|
@ -177,9 +177,6 @@ const ItemWiseReportPdf = ({
|
||||||
{TotalCharges > 0 && (
|
{TotalCharges > 0 && (
|
||||||
<p className="totaldetails"> Charges: {parseFloat(TotalCharges).toFixed(2)}</p>
|
<p className="totaldetails"> Charges: {parseFloat(TotalCharges).toFixed(2)}</p>
|
||||||
)}
|
)}
|
||||||
{itemData?.[0]?.RefundAmount > 0 && (
|
|
||||||
<p className="totaldetails"> Refund: {parseFloat(itemData?.[0]?.RefundAmount).toFixed(2)}</p>
|
|
||||||
)}
|
|
||||||
{TotalDiscount > 0 && (
|
{TotalDiscount > 0 && (
|
||||||
<p className="totaldetails"> Discount(-): { parseFloat(TotalDiscount).toFixed(2)}</p>
|
<p className="totaldetails"> Discount(-): { parseFloat(TotalDiscount).toFixed(2)}</p>
|
||||||
)}
|
)}
|
||||||
|
|
@ -193,7 +190,7 @@ const ItemWiseReportPdf = ({
|
||||||
(TotalTaxAmount || 0) +
|
(TotalTaxAmount || 0) +
|
||||||
(TotalCharges || 0) +
|
(TotalCharges || 0) +
|
||||||
(TotalPreOrderAmount || 0) -
|
(TotalPreOrderAmount || 0) -
|
||||||
(TotalDiscount || 0) - (itemData?.[0]?.RefundAmount || 0)
|
(TotalDiscount || 0)
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import {
|
||||||
getCommonAppPreference,
|
getCommonAppPreference,
|
||||||
changeWarehouse,
|
changeWarehouse,
|
||||||
} from './Features/BrachLogin/BranchLogin.js';
|
} from './Features/BrachLogin/BranchLogin.js';
|
||||||
import { clearSession, getSession, sessionStore } from './Services/Others';
|
import { clearSession, getSession } from './Services/Others';
|
||||||
import {
|
import {
|
||||||
FeatureAddon,
|
FeatureAddon,
|
||||||
GlobalFeatAddOnData,
|
GlobalFeatAddOnData,
|
||||||
|
|
@ -43,18 +43,7 @@ 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();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
@ -280,221 +269,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}`);
|
navigate(`${subDirectory}app-page/home`);
|
||||||
} 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);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const empAccessData = getEmpAccessFromChildren(
|
||||||
|
currentRoute,
|
||||||
|
currentPath
|
||||||
|
);
|
||||||
|
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);
|
// setHasRedirected(true);
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// const empAccessData = getEmpAccessFromChildren(
|
|
||||||
// currentRoute,
|
|
||||||
// currentPath
|
|
||||||
// );
|
|
||||||
// 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)) {
|
// Cmd it End
|
||||||
// empPlanAccessCheck = checkPlanAccess(
|
const userAccessChecks = {
|
||||||
// empAccessData,
|
'Super Admin': () => {
|
||||||
// featureAddonData
|
let empPreferenceCheck = true;
|
||||||
// );
|
if (checkPreferenceAccessData.includes(empAccessData)) {
|
||||||
// } else {
|
empPreferenceCheck = checkAccess(empAccessData);
|
||||||
// empPlanAccessCheck = true;
|
} 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;
|
||||||
|
|
||||||
// return !empPreferenceCheck || !empPlanAccessCheck;
|
if (checkPreferenceAccessData.includes(empAccessData)) {
|
||||||
// }
|
empPreferenceCheck = checkAccess(empAccessData);
|
||||||
// },
|
} else {
|
||||||
// Employee: async () => {
|
empPreferenceCheck = true;
|
||||||
// if (empAccessData && accessData !== 'Super Admin') {
|
}
|
||||||
// const empAccessCheck = await checkEmpAccess(
|
|
||||||
// empAccessData,
|
|
||||||
// currentPath
|
|
||||||
// );
|
|
||||||
// let empPreferenceCheck = true;
|
|
||||||
// let empPlanAccessCheck = true;
|
|
||||||
|
|
||||||
// if (checkPreferenceAccessData.includes(empAccessData)) {
|
if (checkPlanAccessData.includes(empAccessData)) {
|
||||||
// empPreferenceCheck = checkAccess(empAccessData);
|
empPlanAccessCheck = checkPlanAccess(
|
||||||
// } else {
|
empAccessData,
|
||||||
// empPreferenceCheck = true;
|
featureAddonData
|
||||||
// }
|
);
|
||||||
|
} else {
|
||||||
|
empPlanAccessCheck = true;
|
||||||
|
}
|
||||||
|
|
||||||
// if (checkPlanAccessData.includes(empAccessData)) {
|
return !empPreferenceCheck || !empPlanAccessCheck;
|
||||||
// empPlanAccessCheck = checkPlanAccess(
|
}
|
||||||
// empAccessData,
|
},
|
||||||
// featureAddonData
|
Employee: async () => {
|
||||||
// );
|
if (empAccessData && accessData !== 'Super Admin') {
|
||||||
// } else {
|
const empAccessCheck = await checkEmpAccess(
|
||||||
// empPlanAccessCheck = true;
|
empAccessData,
|
||||||
// }
|
currentPath
|
||||||
// if (location.pathname === '/app-page/relieve-request') {
|
);
|
||||||
// return false;
|
let empPreferenceCheck = true;
|
||||||
// }
|
let empPlanAccessCheck = true;
|
||||||
// return (
|
|
||||||
// !empAccessCheck || !empPreferenceCheck || !empPlanAccessCheck
|
|
||||||
// );
|
|
||||||
// } else {
|
|
||||||
// if (accessData === 'Super Admin') {
|
|
||||||
// return true;
|
|
||||||
// } else {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// };
|
|
||||||
|
|
||||||
// if (userAccessChecks[UserType]) {
|
if (checkPreferenceAccessData.includes(empAccessData)) {
|
||||||
// shouldNavigate = await userAccessChecks[UserType]();
|
empPreferenceCheck = checkAccess(empAccessData);
|
||||||
// } else {
|
} else {
|
||||||
// shouldNavigate = true;
|
empPreferenceCheck = true;
|
||||||
// }
|
}
|
||||||
// console.log('shouldNavigate', shouldNavigate);
|
|
||||||
// if (shouldNavigate) {
|
|
||||||
// // alert("Unauthorized action detected. You have been logged out.")
|
|
||||||
// Logout();
|
|
||||||
// setHasRedirected(true);
|
|
||||||
// } else {
|
|
||||||
// console.log('Access granted for current route.');
|
|
||||||
// }
|
|
||||||
|
|
||||||
// setAccessCheckComplete(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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
// performAccessChecks();
|
if (userAccessChecks[UserType]) {
|
||||||
// }, [UserType, routesConfig, navigate, hasRedirected, location.pathname]);
|
shouldNavigate = await userAccessChecks[UserType]();
|
||||||
|
} else {
|
||||||
|
shouldNavigate = true;
|
||||||
|
}
|
||||||
|
console.log('shouldNavigate', shouldNavigate);
|
||||||
|
if (shouldNavigate) {
|
||||||
|
// alert("Unauthorized action detected. You have been logged out.")
|
||||||
|
Logout();
|
||||||
|
setHasRedirected(true);
|
||||||
|
} else {
|
||||||
|
console.log('Access granted for current route.');
|
||||||
|
}
|
||||||
|
|
||||||
|
setAccessCheckComplete(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
performAccessChecks();
|
||||||
|
}, [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
|
||||||
|
|
@ -542,7 +531,7 @@ const ProtectedRoutes = ({ routesConfig }) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Suspense fallback={<div></div>}>
|
<Suspense fallback={<div></div>}>
|
||||||
<Routes>{ renderRoutes(routesConfig)}</Routes>
|
<Routes>{accessCheckComplete && renderRoutes(routesConfig)}</Routes>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,7 @@ const getCapCookieData = (key) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const sessionStore = (key, value) => {
|
export const sessionStore = (key, value) => {
|
||||||
|
console.log("Storing session:", key, value);
|
||||||
const encryptedValue = key !== "auth"
|
const encryptedValue = key !== "auth"
|
||||||
? CryptoJS.AES.encrypt(JSON.stringify(value), SECRET_KEY).toString()
|
? CryptoJS.AES.encrypt(JSON.stringify(value), SECRET_KEY).toString()
|
||||||
: value;
|
: value;
|
||||||
|
|
|
||||||
256
src/check.html
256
src/check.html
|
|
@ -1,270 +1,38 @@
|
||||||
<!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
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
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>
|
||||||
<!-- <script>
|
// Disable right-click menu and common hotkeys
|
||||||
// Disable right-cli ck menu and common hotkeys
|
document.addEventListener('contextmenu', (event) =>
|
||||||
document.addEventListener("contextmenu", (event) => event.preventDefault());
|
event.preventDefault()
|
||||||
document.addEventListener("keydown", (event) => {
|
);
|
||||||
|
document.addEventListener('keydown', (event) => {
|
||||||
if (
|
if (
|
||||||
(event.ctrlKey && event.shiftKey && ["I", "J", "C"].includes(event.key.toUpperCase())) ||
|
(event.ctrlKey &&
|
||||||
(event.ctrlKey && ["U", "S"].includes(event.key.toUpperCase())) ||
|
event.shiftKey &&
|
||||||
event.key === "F12"
|
['I', 'J', 'C'].includes(event.key.toUpperCase())) ||
|
||||||
|
(event.ctrlKey && ['U', 'S'].includes(event.key.toUpperCase())) ||
|
||||||
|
event.key === 'F12'
|
||||||
) {
|
) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</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>
|
||||||
<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>
|
||||||
|
|
|
||||||
876
src/check.jsx
876
src/check.jsx
|
|
@ -1,387 +1,539 @@
|
||||||
// import React, { useRef, useState, useEffect } from "react";
|
import { useEffect, useState } from 'react';
|
||||||
// import { BarcodeScanner } from "@capacitor-mlkit/barcode-scanning";
|
import { Routes, Route, useNavigate } from 'react-router-dom';
|
||||||
// import { BsUpcScan } from "react-icons/bs";
|
import { useDispatch } from 'react-redux';
|
||||||
// import { BrowserMultiFormatReader } from "@zxing/library";
|
import {
|
||||||
// import { Capacitor } from "@capacitor/core";
|
getEmpAccesData,
|
||||||
// import { DefaultModal } from "../Components/Modal/DefaultModal";
|
GenerateLogout,
|
||||||
|
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';
|
||||||
|
|
||||||
// export default function BarCodeScan({ onScan }) {
|
const commonUrl = import.meta.env.ENV_COMMON_BASE_URL;
|
||||||
// const isMobileApp = Capacitor.getPlatform() !== "web";
|
const subDirectory = import.meta.env.BASE_URL;
|
||||||
// const [scanning, setScanning] = useState(false);
|
|
||||||
// const [modalOpen, setModalOpen] = useState(false);
|
|
||||||
// const videoRef = useRef(null);
|
|
||||||
// const codeReaderRef = useRef(null);
|
|
||||||
// const streamRef = useRef(null);
|
|
||||||
|
|
||||||
// const startScan = async () => {
|
const ProtectedRoutes = ({ routesConfig }) => {
|
||||||
// if (scanning) return;
|
useTemplate(
|
||||||
// setScanning(true);
|
getSession('CompId'),
|
||||||
|
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);
|
||||||
|
|
||||||
// if (isMobileApp) {
|
useEffect(() => {
|
||||||
// // Mobile: MLKit scanner
|
getApplicationPreference();
|
||||||
// try {
|
}, []);
|
||||||
// const perm = await BarcodeScanner.requestPermissions();
|
//sri
|
||||||
// if (perm.camera !== "granted") {
|
useEffect(() => {
|
||||||
// alert("Camera permission not granted");
|
if (Warehouse) {
|
||||||
// setScanning(false);
|
dispatch(changeWarehouse(true));
|
||||||
// return;
|
}
|
||||||
// }
|
}, [Warehouse]);
|
||||||
|
const getApplicationPreference = async () => {
|
||||||
|
await dispatch(getCommonAppPreference(AppId)).unwrap();
|
||||||
|
};
|
||||||
|
|
||||||
// const { barcodes } = await BarcodeScanner.scan();
|
const getEmpAccess = async () => {
|
||||||
// if (barcodes && barcodes.length > 0) {
|
let data = {
|
||||||
// onScan(barcodes[0].rawValue);
|
UserId: UserId,
|
||||||
// }
|
AppId: AppId,
|
||||||
// } catch (err) {
|
CompId: CompId,
|
||||||
// alert("Error scanning barcode: " + err.message);
|
BranchId: BranchId,
|
||||||
// } finally {
|
};
|
||||||
// setScanning(false);
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// // Web: open modal and start camera
|
|
||||||
// setModalOpen(true);
|
|
||||||
// setTimeout(() => startWebScan(), 50); // wait for modal DOM
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
// const startWebScan = async () => {
|
const response = await dispatch(getEmpAccesData(data)).unwrap();
|
||||||
// try {
|
if (response?.data?.statusCode === 1) {
|
||||||
// codeReaderRef.current = new BrowserMultiFormatReader();
|
return response?.data?.data?.[0]?.EmpAccessDetails;
|
||||||
// streamRef.current = await navigator.mediaDevices.getUserMedia({
|
}
|
||||||
// video: { facingMode: "environment" },
|
return null;
|
||||||
// });
|
};
|
||||||
// if (videoRef.current) {
|
|
||||||
// videoRef.current.srcObject = streamRef.current;
|
|
||||||
// videoRef.current.play();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// codeReaderRef.current.decodeFromVideoDevice(
|
const getSadminUserAccess = async () => {
|
||||||
// null,
|
let data = {
|
||||||
// videoRef.current,
|
UserId: UserId,
|
||||||
// (result) => {
|
AppId: AppId,
|
||||||
// if (result) {
|
};
|
||||||
// onScan(result.getText());
|
const response = await dispatch(getSAdminUserAccesData(data)).unwrap();
|
||||||
// stopWebScan();
|
if (response?.data?.statusCode === 1) {
|
||||||
// setModalOpen(false);
|
return response?.data?.data?.[0]?.AppMenuAccessDetails;
|
||||||
// }
|
}
|
||||||
// }
|
return null;
|
||||||
// );
|
};
|
||||||
// } catch (err) {
|
|
||||||
// alert("Error accessing camera: " + err.message);
|
|
||||||
// setScanning(false);
|
|
||||||
// setModalOpen(false);
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
// const stopWebScan = () => {
|
const Dinein = async () => {
|
||||||
// if (streamRef.current) {
|
if (AppId && CompId && BranchId) {
|
||||||
// streamRef.current.getTracks().forEach((track) => track.stop());
|
let DineinData = {
|
||||||
// streamRef.current = null;
|
AppId: AppId,
|
||||||
// }
|
CompId: CompId,
|
||||||
// if (codeReaderRef.current) {
|
BranchId: BranchId,
|
||||||
// codeReaderRef.current.reset();
|
UserId: UserId,
|
||||||
// codeReaderRef.current = null;
|
};
|
||||||
// }
|
const response = await dispatch(gettableData(DineinData)).unwrap();
|
||||||
// setScanning(false);
|
if (response?.data?.statusCode === 1) {
|
||||||
// };
|
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 closeModal = () => {
|
const checkAccess = async (empAccess) => {
|
||||||
// stopWebScan();
|
if (!empAccess) return false;
|
||||||
// setModalOpen(false);
|
let DineinData,
|
||||||
// };
|
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
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// // Stop camera if component unmounts
|
const getPricingName = async () => {
|
||||||
// useEffect(() => () => stopWebScan(), []);
|
if (!AppId || !UserId) return;
|
||||||
|
const data = {
|
||||||
// return (
|
appId: AppId,
|
||||||
// <div style={{ display: "flex", justifyContent: "center", padding: 20 }}>
|
userId: UserId,
|
||||||
// {!scanning && (
|
};
|
||||||
// <BsUpcScan
|
|
||||||
// onClick={startScan}
|
|
||||||
// style={{ fontSize: 32, color: "#007bff", cursor: "pointer" }}
|
|
||||||
// />
|
|
||||||
// )}
|
|
||||||
|
|
||||||
// <DefaultModal
|
|
||||||
// title="Barcode Reader"
|
|
||||||
// width={500}
|
|
||||||
// open={modalOpen}
|
|
||||||
// footer={false}
|
|
||||||
// handleCancel={() => {
|
|
||||||
// closeModal();
|
|
||||||
// }}
|
|
||||||
// >
|
|
||||||
// <div
|
|
||||||
// style={{
|
|
||||||
// display: "flex",
|
|
||||||
// flexDirection: "column",
|
|
||||||
// alignItems: "center",
|
|
||||||
// justifyContent: "center",
|
|
||||||
// }}
|
|
||||||
// >
|
|
||||||
// <video
|
|
||||||
// ref={videoRef}
|
|
||||||
// style={{
|
|
||||||
// width: "100%",
|
|
||||||
// maxWidth: 400,
|
|
||||||
// borderRadius: 8,
|
|
||||||
// border: "2px solid #000",
|
|
||||||
// }}
|
|
||||||
// />
|
|
||||||
|
|
||||||
// <button
|
|
||||||
// onClick={closeModal}
|
|
||||||
// style={{
|
|
||||||
// marginTop: 20,
|
|
||||||
// padding: "10px 20px",
|
|
||||||
// fontSize: 16,
|
|
||||||
// borderRadius: 8,
|
|
||||||
// border: "none",
|
|
||||||
// cursor: "pointer",
|
|
||||||
// }}
|
|
||||||
// >
|
|
||||||
// Close
|
|
||||||
// </button>
|
|
||||||
// </div>
|
|
||||||
// </DefaultModal>
|
|
||||||
|
|
||||||
// </div>
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
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';
|
|
||||||
|
|
||||||
QrScanner.WORKER_PATH = new URL(
|
|
||||||
'qr-scanner/qr-scanner-worker.min.js',
|
|
||||||
import.meta.url
|
|
||||||
).toString();
|
|
||||||
|
|
||||||
export default function BarCodeScan({ onScan }) {
|
|
||||||
const isMobileApp = Capacitor.getPlatform() !== 'web';
|
|
||||||
const [scanning, setScanning] = useState(false);
|
|
||||||
const [modalOpen, setModalOpen] = useState(false);
|
|
||||||
|
|
||||||
const videoRef = useRef(null);
|
|
||||||
const qrScannerRef = useRef(null);
|
|
||||||
const barcodeReaderRef = useRef(null);
|
|
||||||
|
|
||||||
// -------------------------
|
|
||||||
// START SCAN
|
|
||||||
// -------------------------
|
|
||||||
const startScan = async () => {
|
|
||||||
if (scanning) return;
|
|
||||||
setScanning(true);
|
|
||||||
|
|
||||||
if (isMobileApp) {
|
|
||||||
try {
|
try {
|
||||||
const perm = await BarcodeScanner.requestPermissions();
|
const response = await dispatch(PricingAppPricingName(data)).unwrap();
|
||||||
if (perm.camera !== 'granted') {
|
const responseData = response?.data;
|
||||||
alert('Camera permission not granted');
|
const pricingData = responseData?.data;
|
||||||
setScanning(false);
|
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) => {
|
||||||
|
if (!empAccess) return false;
|
||||||
|
let Advance,
|
||||||
|
ProORAdvance = await getPricingName();
|
||||||
|
switch (empAccess) {
|
||||||
|
case 'Product Catalogue':
|
||||||
|
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) => {
|
||||||
|
if (!empAccess) return false;
|
||||||
|
const Access = await getEmpAccess();
|
||||||
|
let accessType;
|
||||||
|
if (currentPath.endsWith('/new')) {
|
||||||
|
accessType = 'AddAccess';
|
||||||
|
} else if (currentPath.endsWith('/update')) {
|
||||||
|
accessType = 'UpdateAccess';
|
||||||
|
} else {
|
||||||
|
accessType = 'ReadAccess';
|
||||||
|
}
|
||||||
|
// const config = Access?.find(config =>
|
||||||
|
// config.ConfigName === empAccess && config[accessType] === 'Y'
|
||||||
|
// );
|
||||||
|
const config = Access?.find(
|
||||||
|
(config) =>
|
||||||
|
(config.ConfigName === empAccess && config[accessType] === 'Y') ||
|
||||||
|
(currentPath.includes('supplier-master') &&
|
||||||
|
(config.ConfigName === 'Supplier' ||
|
||||||
|
config.ConfigName === 'Seller') &&
|
||||||
|
config[accessType] === 'Y')
|
||||||
|
);
|
||||||
|
|
||||||
|
return !!config;
|
||||||
|
};
|
||||||
|
|
||||||
|
const checkSuperAdminUserAccess = async (empAccess, currentPath) => {
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getEmpAccessFromChildren = (route, currentPath) => {
|
||||||
|
if (route.path === currentPath) {
|
||||||
|
return route.empAccess || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (route.children) {
|
||||||
|
for (const child of route.children) {
|
||||||
|
const childPath = `${route.path}/${child.path}`;
|
||||||
|
if (childPath === currentPath) {
|
||||||
|
return child.empAccess || null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getEmpAccessDataFromChildren = (route, currentPath) => {
|
||||||
|
if (route.path === currentPath) {
|
||||||
|
return route.access || null;
|
||||||
|
}
|
||||||
|
if (route.children) {
|
||||||
|
for (const child of route.children) {
|
||||||
|
const childPath = `${route.path}/${child.path}`;
|
||||||
|
if (childPath === currentPath) {
|
||||||
|
return child.access || null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchBranchData = async () => {
|
||||||
|
const response = await dispatch(
|
||||||
|
getCompBranchData({ CompId: CompId, AppId: AppId })
|
||||||
|
).unwrap();
|
||||||
|
if (response?.data?.statusCode === 1) {
|
||||||
|
if (response?.data?.data?.length == 1) {
|
||||||
|
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 { barcodes } = await BarcodeScanner.scan();
|
const empAccessData = getEmpAccessFromChildren(
|
||||||
if (barcodes?.length > 0) {
|
currentRoute,
|
||||||
onScan(barcodes[0].rawValue);
|
currentPath
|
||||||
}
|
);
|
||||||
} catch (err) {
|
const accessData = getEmpAccessDataFromChildren(
|
||||||
console.error(err);
|
currentRoute,
|
||||||
} finally {
|
currentPath
|
||||||
setScanning(false);
|
);
|
||||||
}
|
|
||||||
|
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 {
|
} else {
|
||||||
setModalOpen(true);
|
empPreferenceCheck = true;
|
||||||
}
|
}
|
||||||
};
|
return !empPreferenceCheck;
|
||||||
|
|
||||||
// -------------------------
|
|
||||||
// START WEB SCAN (HYBRID)
|
|
||||||
// -------------------------
|
|
||||||
const startWebScan = async () => {
|
|
||||||
if (!videoRef.current) return;
|
|
||||||
|
|
||||||
// Start QR scanner (fast)
|
|
||||||
qrScannerRef.current = new QrScanner(
|
|
||||||
videoRef.current,
|
|
||||||
(result) => {
|
|
||||||
stopWebScan();
|
|
||||||
onScan(result.data);
|
|
||||||
setModalOpen(false);
|
|
||||||
},
|
},
|
||||||
{
|
'Super Admin User': async () => {
|
||||||
maxScansPerSecond: 25,
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
await qrScannerRef.current.start();
|
return !empPreferenceCheck || !empPlanAccessCheck;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Employee: async () => {
|
||||||
|
if (empAccessData && accessData !== 'Super Admin') {
|
||||||
|
const empAccessCheck = await checkEmpAccess(
|
||||||
|
empAccessData,
|
||||||
|
currentPath
|
||||||
|
);
|
||||||
|
let empPreferenceCheck = true;
|
||||||
|
let empPlanAccessCheck = true;
|
||||||
|
|
||||||
// Start Barcode scanner (ZXing)
|
if (checkPreferenceAccessData.includes(empAccessData)) {
|
||||||
barcodeReaderRef.current = new BrowserMultiFormatReader(undefined, {
|
empPreferenceCheck = checkAccess(empAccessData);
|
||||||
possibleFormats: [
|
} else {
|
||||||
BarcodeFormat.CODE_128,
|
empPreferenceCheck = true;
|
||||||
BarcodeFormat.EAN_13,
|
}
|
||||||
BarcodeFormat.UPC_A,
|
|
||||||
BarcodeFormat.UPC_E,
|
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);
|
||||||
|
if (shouldNavigate) {
|
||||||
|
// alert("Unauthorized action detected. You have been logged out.")
|
||||||
|
Logout();
|
||||||
|
setHasRedirected(true);
|
||||||
|
} else {
|
||||||
|
console.log('Access granted for current route.');
|
||||||
|
}
|
||||||
|
|
||||||
|
setAccessCheckComplete(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 }) => {
|
||||||
|
const fullPath = `${path}`;
|
||||||
|
|
||||||
|
if (!Component) {
|
||||||
|
console.error(`Component not found for path: ${fullPath}`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (children) {
|
||||||
|
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 />} />;
|
||||||
});
|
});
|
||||||
|
|
||||||
barcodeReaderRef.current.timeBetweenDecodingAttempts = 50;
|
|
||||||
|
|
||||||
barcodeReaderRef.current.decodeFromVideoDevice(
|
|
||||||
null,
|
|
||||||
videoRef.current,
|
|
||||||
(result) => {
|
|
||||||
if (result) {
|
|
||||||
stopWebScan();
|
|
||||||
onScan(result.getText());
|
|
||||||
setModalOpen(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const stopWebScan = () => {
|
|
||||||
if (qrScannerRef.current) {
|
|
||||||
qrScannerRef.current.stop();
|
|
||||||
qrScannerRef.current.destroy();
|
|
||||||
qrScannerRef.current = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 (
|
return (
|
||||||
<div
|
<Suspense fallback={<div></div>}>
|
||||||
className="BarCodeScanMaster"
|
<Routes>{accessCheckComplete && renderRoutes(routesConfig)}</Routes>
|
||||||
style={{ display: 'flex', justifyContent: 'center', padding: 20 }}
|
</Suspense>
|
||||||
>
|
|
||||||
{!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>
|
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
export default ProtectedRoutes;
|
||||||
|
|
|
||||||
2135
src/check.scss
2135
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,54 +315,6 @@ 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,
|
||||||
|
|
@ -376,249 +328,3 @@ 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,4 +1,3 @@
|
||||||
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';
|
||||||
|
|
@ -9,217 +8,9 @@ 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>
|
||||||
|
|
@ -228,11 +19,8 @@ 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,17 +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', 6);
|
sessionStore('AppId', 1);
|
||||||
sessionStore('BranchId', 556);
|
sessionStore('BranchId', 121);
|
||||||
sessionStore('AppName', 'Bakery');
|
sessionStore('AppName', 'Bakery');
|
||||||
sessionStore('CompId', 462);
|
sessionStore('CompId', 72);
|
||||||
sessionStore('MobileNo', '6382594417');
|
sessionStore('MobileNo', '8072329153');
|
||||||
sessionStore('UserType', 'Admin');
|
sessionStore('UserType', 'Admin');
|
||||||
sessionStore('UserId', 1884);
|
sessionStore('UserId', 39);
|
||||||
sessionStore('userName', 'Karthiga');
|
sessionStore('userName', 'Karthiga');
|
||||||
sessionStore(
|
|
||||||
|
sessionStorage.setItem(
|
||||||
'auth',
|
'auth',
|
||||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiNjM4MjU5NDQxNyIsIlBhc3N3b3JkIjoiWkB6NDEwNDg0IiwiYXVkIjpbImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tcmV0YWlsLWFwaSIsImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tY29tbW9uLWFwaSIsImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tc21zLWVtYWlsLXRlbXBsYXRlLWFwaSIsImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tY29tbW9uLWFwaSJdLCJleHAiOjE3NzUxNTgwNTIsImlzcyI6Imh0dHBzOi8vYXBpLnBvem8uZGV2L0p3dFRva2VuIn0.xPuA6vnS7UdDWAnwMLEPhV0UcqPCwtb7tllpMYjOb-A'
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiODA3MjMyOTE1MyIsIlBhc3N3b3JkIjoiWkB6MTIzNCIsImF1ZCI6WyJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTIiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTQiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiXSwiZXhwIjoxNzc0Mzc5NTY2LCJpc3MiOiJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMDEifQ.uTdcz-FHE4GTux7FTtT2pQt9gEe-17_mIrwJWbHdHE8'
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -778,13 +779,13 @@ export const routesConfig = [
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: `${subDirectory}`,
|
path: `${subDirectory}app-page`,
|
||||||
component: React.lazy(() =>
|
component: React.lazy(() =>
|
||||||
fetchComponent().then((module) => ({ default: module.default }))
|
fetchComponent().then((module) => ({ default: module.default }))
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/',
|
path: 'home',
|
||||||
component: React.lazy(() =>
|
component: React.lazy(() =>
|
||||||
fetchHomeComponent().then((module) => ({ default: module.default }))
|
fetchHomeComponent().then((module) => ({ default: module.default }))
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
import { isOldAndroidWebView } from './isOldAndroidWebView';
|
|
||||||
|
|
||||||
export const gapStyle = (size) => {
|
|
||||||
size = size || '8px';
|
|
||||||
if (isOldAndroidWebView()) {
|
|
||||||
return {
|
|
||||||
marginRight: size,
|
|
||||||
marginBottom: size
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return { gap: size };
|
|
||||||
};
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
export const isOldAndroidWebView = (() => {
|
|
||||||
const ua = navigator.userAgent;
|
|
||||||
const match = ua.match(/Chrome\/(\d+)/);
|
|
||||||
return match && parseInt(match[1]) <= 85 && /Android/.test(ua);
|
|
||||||
})();
|
|
||||||
|
|
@ -1,41 +1,13 @@
|
||||||
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 esbuild from 'esbuild';
|
|
||||||
export default defineConfig(({ mode }) => {
|
export default defineConfig(({ mode }) => {
|
||||||
const isProd = mode === "production";
|
const isProd = mode === "production";
|
||||||
|
|
||||||
return {
|
return {
|
||||||
oxc: {
|
plugins: [react()],
|
||||||
target: 'es2015'
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
react(),
|
|
||||||
legacy({
|
|
||||||
targets: [
|
|
||||||
"defaults",
|
|
||||||
"Android >= 5",
|
|
||||||
"Chrome >= 60"
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
name: 'downlevel-dev',
|
|
||||||
enforce: 'post',
|
|
||||||
async transform(code, id) {
|
|
||||||
if (mode === 'development' && /\.(mjs|js|ts|jsx|tsx)(?:[?#]|$)/.test(id)) {
|
|
||||||
try {
|
|
||||||
const res = await esbuild.transform(code, { target: 'chrome64', loader: 'jsx' });
|
|
||||||
return res.code;
|
|
||||||
} catch (e) {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
|
base: isProd ? "/apps/retail/" : "/", //for capcitor base: isProd ? "/" : "/",
|
||||||
base: isProd ? "/" : "/", //for capcitor base: isProd ? "/" : "/",
|
|
||||||
|
|
||||||
envDir: "src",
|
envDir: "src",
|
||||||
envPrefix: "ENV_",
|
envPrefix: "ENV_",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue