Compare commits
No commits in common. "ddeed6d14adf556ea14b038b60c66ca5b6e80cce" and "80b252cd3879d22d5c024285111dadd02d3562f4" have entirely different histories.
ddeed6d14a
...
80b252cd38
Binary file not shown.
|
|
@ -49,7 +49,7 @@
|
|||
</provider>
|
||||
|
||||
</application>
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.USB_PERMISSION" />
|
||||
<uses-feature android:name="android.hardware.usb.host" />
|
||||
|
|
|
|||
126
index.html
126
index.html
|
|
@ -3,14 +3,9 @@
|
|||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/fav.ico" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, user-scalable=no"
|
||||
/>
|
||||
<!-- <link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/antd/dist/reset.css"
|
||||
/> -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=1" />
|
||||
<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 />
|
||||
|
||||
|
|
@ -82,18 +77,7 @@
|
|||
}
|
||||
});
|
||||
</script> -->
|
||||
<!-- public/index.html -->
|
||||
<script>
|
||||
// Safety check for older WebViews
|
||||
try {
|
||||
document.querySelector(":where(div)");
|
||||
} catch (e) {
|
||||
console.warn(
|
||||
"Old WebView detected - StyleProvider fix should handle this",
|
||||
);
|
||||
}
|
||||
</script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/eruda"></script>
|
||||
<!-- <script src="https://cdn.jsdelivr.net/npm/eruda"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/eruda-network"></script>
|
||||
<script>
|
||||
(function () {
|
||||
|
|
@ -141,107 +125,7 @@
|
|||
}
|
||||
}, 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>
|
||||
</script> -->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -31,6 +31,7 @@
|
|||
"@tanstack/react-query-devtools": "^5.91.1",
|
||||
"@tanstack/react-virtual": "^3.13.18",
|
||||
"@types/node": "^25.5.0",
|
||||
"@vitejs/plugin-legacy": "^8.0.1",
|
||||
"@zxing/library": "^0.21.3",
|
||||
"antd": "^5.17.4",
|
||||
"antd-img-crop": "^4.22.0",
|
||||
|
|
@ -89,7 +90,6 @@
|
|||
"devDependencies": {
|
||||
"@types/react": "^18.3.3",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@vitejs/plugin-legacy": "^8.0.0",
|
||||
"@vitejs/plugin-react": "^6.0.1",
|
||||
"esbuild": "^0.27.4",
|
||||
"eslint": "^8.57.0",
|
||||
|
|
@ -98,7 +98,7 @@
|
|||
"eslint-plugin-react-refresh": "^0.4.7",
|
||||
"prettier": "^3.5.3",
|
||||
"rollup-plugin-obfuscator": "^1.1.0",
|
||||
"sass": "^1.77.2",
|
||||
"sass": "^1.98.0",
|
||||
"terser": "^5.31.3",
|
||||
"vite": "^8.0.0",
|
||||
"vite-plugin-obfuscator": "^1.0.5",
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@ ENV_BASE_URL='/'
|
|||
ENV_COMMON_BASE_URL='http://192.168.1.16:3000/'
|
||||
# ENV_API_URL='http://192.168.1.25:8001'
|
||||
# ENV_API_URL='http://api.pozo.co.in/Retailapi_UnderTest'
|
||||
ENV_API_URL='https://api.pozo.dev/pozo-retail-api'
|
||||
ENV_API_URL_COMMON='https://api.pozo.dev/pozo-common-api'
|
||||
ENV_API_URL_TOKEN='https://api.pozo.dev/JwtToken'
|
||||
# ENV_API_URL='http://192.168.1.37:8012'
|
||||
# ENV_API_URL_COMMON='http://192.168.1.37:8013'
|
||||
# ENV_API_URL_TOKEN='http://192.168.1.37:8001'
|
||||
# ENV_API_URL_OCR='http://192.168.1.37:8070'
|
||||
# ENV_API_URL='https://api.pozo.dev/pozo-retail-api'
|
||||
# ENV_API_URL_COMMON='https://api.pozo.dev/pozo-common-api'
|
||||
# ENV_API_URL_TOKEN='https://api.pozo.dev/JwtToken'
|
||||
ENV_API_URL='http://192.168.1.37:8012'
|
||||
ENV_API_URL_COMMON='http://192.168.1.37:8013'
|
||||
ENV_API_URL_TOKEN='http://192.168.1.37:8001'
|
||||
ENV_API_URL_OCR='http://192.168.1.37:8070'
|
||||
# ENV_API_URL='https://api.pozo.app/pozo-retail-api'
|
||||
# ENV_API_URL_COMMON='https://api.pozo.app/pozo-common-api'
|
||||
# ENV_API_URL_TOKEN='https://api.pozo.app/JwtToken'
|
||||
|
|
|
|||
|
|
@ -20,48 +20,48 @@
|
|||
|
||||
# live Server (173 server)
|
||||
|
||||
# ENV_BASE_URL='/apps/retail/'
|
||||
# ENV_COMMON_BASE_URL='https://pozo.app'
|
||||
# ENV_API_URL='https://api.pozo.app/pozo-retail-api'
|
||||
# ENV_API_URL_COMMON='https://api.pozo.app/pozo-common-api'
|
||||
# ENV_API_URL_TOKEN='https://api.pozo.app/JwtToken'
|
||||
# ENV_API_URL_OCR='http://192.168.1.37:8070'
|
||||
# ENV_IMAGE_UPLOAD_API_URL="https://api.pozo.app/pozo-common-image-api/"
|
||||
# ENV_SECRET_KEY="3a939a2eed2cca4b64cd47f51b23b135b2b9b765273f695d47682ea803c8429d"
|
||||
# ENV_URL_SECRET_KEY="f2ef79b8b2d4fc1cc569726a5a753552257b4ff2872d6a71cf3119bce3f07c1b"
|
||||
# ENV_MAIN_BASE_URL='https://pozo.app/apps/retail/'
|
||||
# ENV_CUSTOM_PAYMENT_URL='https://pozo.app/CustomPaymentGateway/CustomPaymentGateway'
|
||||
# ENV_IFSC_API_URL = "https://ifsc.razorpay.com"
|
||||
# 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_ANDROID_PRINTER= 'https://pozo.app/downloads/resources/POZO%20Printer.apk'
|
||||
# ENV_ANDROID_KIOSK= 'https://pozo.app/downloads/resources/POZO%20KIOSK.apk'
|
||||
# ENV_ANDROID_HANDHELD= 'https://pozo.app/downloads/resources/Handheld.apk'
|
||||
# ENV_ANDROID_BILLING= 'https://pozo.app/downloads/resources/PozoApp.apk'
|
||||
# ENV_EMAIL_API='https://api.pozo.app/pozo-sms-email-template-api'
|
||||
# ENV_SIGNALR_SERVER_URL='https://api.pozo.app/'
|
||||
ENV_BASE_URL='/apps/retail/'
|
||||
ENV_COMMON_BASE_URL='https://pozo.app'
|
||||
ENV_API_URL='https://api.pozo.app/pozo-retail-api'
|
||||
ENV_API_URL_COMMON='https://api.pozo.app/pozo-common-api'
|
||||
ENV_API_URL_TOKEN='https://api.pozo.app/JwtToken'
|
||||
ENV_API_URL_OCR='http://192.168.1.37:8070'
|
||||
ENV_IMAGE_UPLOAD_API_URL="https://api.pozo.app/pozo-common-image-api/"
|
||||
ENV_SECRET_KEY="3a939a2eed2cca4b64cd47f51b23b135b2b9b765273f695d47682ea803c8429d"
|
||||
ENV_URL_SECRET_KEY="f2ef79b8b2d4fc1cc569726a5a753552257b4ff2872d6a71cf3119bce3f07c1b"
|
||||
ENV_MAIN_BASE_URL='https://pozo.app/apps/retail/'
|
||||
ENV_CUSTOM_PAYMENT_URL='https://pozo.app/CustomPaymentGateway/CustomPaymentGateway'
|
||||
ENV_IFSC_API_URL = "https://ifsc.razorpay.com"
|
||||
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_ANDROID_PRINTER= 'https://pozo.app/downloads/resources/POZO%20Printer.apk'
|
||||
ENV_ANDROID_KIOSK= 'https://pozo.app/downloads/resources/POZO%20KIOSK.apk'
|
||||
ENV_ANDROID_HANDHELD= 'https://pozo.app/downloads/resources/Handheld.apk'
|
||||
ENV_ANDROID_BILLING= 'https://pozo.app/downloads/resources/PozoApp.apk'
|
||||
ENV_EMAIL_API='https://api.pozo.app/pozo-sms-email-template-api'
|
||||
ENV_SIGNALR_SERVER_URL='https://api.pozo.app/'
|
||||
|
||||
#(172 server)
|
||||
|
||||
ENV_BASE_URL='/'
|
||||
ENV_COMMON_BASE_URL='https://pozo.dev'
|
||||
ENV_API_URL='https://api.pozo.dev/pozo-retail-api'
|
||||
ENV_API_URL_COMMON='https://api.pozo.dev/pozo-common-api'
|
||||
ENV_API_URL_TOKEN='https://api.pozo.dev/JwtToken'
|
||||
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_SECRET_KEY="3a939a2eed2cca4b64cd47f51b23b135b2b9b765273f695d47682ea803c8429d"
|
||||
ENV_URL_SECRET_KEY="f2ef79b8b2d4fc1cc569726a5a753552257b4ff2872d6a71cf3119bce3f07c1b"
|
||||
ENV_MAIN_BASE_URL='https://pozo.dev/apps/retail/'
|
||||
ENV_SIGNALR_SERVER_URL='https://api.pozo.dev/'
|
||||
ENV_CUSTOM_PAYMENT_URL='https://pozo.app/CustomPaymentGateway/CustomPaymentGateway'
|
||||
ENV_IFSC_API_URL = "https://ifsc.razorpay.com"
|
||||
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_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_ANDROID_PRINTER= 'https://pozo.dev/downloads/resources/POZO%20Printer.apk'
|
||||
ENV_ANDROID_KIOSK= 'https://pozo.dev/downloads/resources/POZO%20KIOSK.apk'
|
||||
ENV_ANDROID_HANDHELD= 'https://pozo.dev/downloads/resources/Handheld.apk'
|
||||
ENV_ANDROID_BILLING= 'https://pozo.dev/downloads/resources/PozoApp.apk'
|
||||
ENV_EMAIL_API='https://api.pozo.dev/pozo-sms-email-template-api'
|
||||
# ENV_BASE_URL='/apps/retail/'
|
||||
# ENV_COMMON_BASE_URL='https://pozo.dev'
|
||||
# ENV_API_URL='https://api.pozo.dev/pozo-retail-api'
|
||||
# ENV_API_URL_COMMON='https://api.pozo.dev/pozo-common-api'
|
||||
# ENV_API_URL_TOKEN='https://api.pozo.dev/JwtToken'
|
||||
# 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_SECRET_KEY="3a939a2eed2cca4b64cd47f51b23b135b2b9b765273f695d47682ea803c8429d"
|
||||
# ENV_URL_SECRET_KEY="f2ef79b8b2d4fc1cc569726a5a753552257b4ff2872d6a71cf3119bce3f07c1b"
|
||||
# ENV_MAIN_BASE_URL='https://pozo.dev/apps/retail/'
|
||||
# ENV_SIGNALR_SERVER_URL='https://api.pozo.dev/'
|
||||
# ENV_CUSTOM_PAYMENT_URL='https://pozo.app/CustomPaymentGateway/CustomPaymentGateway'
|
||||
# ENV_IFSC_API_URL = "https://ifsc.razorpay.com"
|
||||
# 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_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_ANDROID_PRINTER= 'https://pozo.dev/downloads/resources/POZO%20Printer.apk'
|
||||
# ENV_ANDROID_KIOSK= 'https://pozo.dev/downloads/resources/POZO%20KIOSK.apk'
|
||||
# ENV_ANDROID_HANDHELD= 'https://pozo.dev/downloads/resources/Handheld.apk'
|
||||
# ENV_ANDROID_BILLING= 'https://pozo.dev/downloads/resources/PozoApp.apk'
|
||||
# ENV_EMAIL_API='https://api.pozo.dev/pozo-sms-email-template-api'
|
||||
|
|
|
|||
|
|
@ -432,7 +432,7 @@ export const getCustomerForHold = createAsyncThunk(
|
|||
|
||||
export const getAllCustomerAndBranch = createAsyncThunk(
|
||||
'product/getAllCustomerAndBranch',
|
||||
async ({ CompId, AppId, BranchId,selectedCustomertype }) => {
|
||||
async ({ CompId, AppId, BranchId }) => {
|
||||
if (
|
||||
CompId != null &&
|
||||
CompId != undefined &&
|
||||
|
|
@ -442,7 +442,7 @@ export const getAllCustomerAndBranch = createAsyncThunk(
|
|||
AppId != undefined
|
||||
) {
|
||||
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(
|
||||
'HOME',
|
||||
`${subDirectory}`,
|
||||
`${subDirectory}app-page/home`,
|
||||
<BiHomeSmile className="iconsize" />
|
||||
),
|
||||
getItem(
|
||||
|
|
@ -1607,7 +1607,7 @@ const AppPage = () => {
|
|||
),
|
||||
getItem(
|
||||
'HOME',
|
||||
`${subDirectory}`,
|
||||
`${subDirectory}app-page/home`,
|
||||
<BiHomeSmile className="iconsize" />
|
||||
),
|
||||
getItem(
|
||||
|
|
@ -1643,7 +1643,7 @@ const AppPage = () => {
|
|||
|
||||
getItem(
|
||||
'Dashboard',
|
||||
`${subDirectory}`,
|
||||
`${subDirectory}app-page/home`,
|
||||
<MdInsertChartOutlined className="iconsize" />
|
||||
),
|
||||
getItem('Master', `${subDirectory}master`, <MdDisplaySettings />, [
|
||||
|
|
@ -2117,7 +2117,7 @@ const AppPage = () => {
|
|||
|
||||
getItem(
|
||||
'Dashboard',
|
||||
`${subDirectory}`,
|
||||
`${subDirectory}app-page/home`,
|
||||
<MdInsertChartOutlined className="iconsize" />
|
||||
),
|
||||
SadminUserSettingMenu?.length > 0 &&
|
||||
|
|
@ -2212,7 +2212,7 @@ const AppPage = () => {
|
|||
),
|
||||
getItem(
|
||||
'Dashboard',
|
||||
`${subDirectory}`,
|
||||
`${subDirectory}app-page/home`,
|
||||
<MdInsertChartOutlined className="iconsize" />
|
||||
),
|
||||
getItem('Master', `${subDirectory}master`, <MdDisplaySettings />, [
|
||||
|
|
@ -2703,7 +2703,7 @@ const AppPage = () => {
|
|||
),
|
||||
getItem(
|
||||
'Dashboard',
|
||||
`${subDirectory}`,
|
||||
`${subDirectory}app-page/home`,
|
||||
<MdInsertChartOutlined className="iconsize" />
|
||||
),
|
||||
|
||||
|
|
@ -2787,7 +2787,7 @@ const AppPage = () => {
|
|||
// Retail Menu Flow Final END
|
||||
// *************************** */
|
||||
|
||||
const isCurrentPath = location.pathname === `${subDirectory}`;
|
||||
const isCurrentPath = location.pathname === `${subDirectory}app-page/home`;
|
||||
console.log(items, 'itemsitems');
|
||||
return (
|
||||
<div className="appPage">
|
||||
|
|
|
|||
|
|
@ -676,7 +676,13 @@ const BSNavbar1 = (props, BookingNavbar) => {
|
|||
</TooltipWrapper>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div
|
||||
style={{
|
||||
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
|
||||
}}
|
||||
>
|
||||
<BSNavBarWeightScale />
|
||||
</div>
|
||||
<div className="BSBillingNav1div2">
|
||||
<div className="NavbarDivForSearch">
|
||||
{/* Multiple search */}
|
||||
|
|
@ -714,22 +720,7 @@ const BSNavbar1 = (props, BookingNavbar) => {
|
|||
</>
|
||||
)}
|
||||
</div>
|
||||
{!OtherServicesglobal && (
|
||||
<>
|
||||
{FeatureAddonData?.FeatureDtls?.find(
|
||||
(item) =>
|
||||
item?.FeatureAddonName?.toLowerCase() === 'weight scale'
|
||||
) && (
|
||||
<div
|
||||
style={{
|
||||
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
|
||||
}}
|
||||
>
|
||||
<BSNavBarWeightScale />
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
{!OtherServicesglobal && (
|
||||
<>
|
||||
{OpenFailData && (
|
||||
|
|
@ -845,7 +836,18 @@ const BSNavbar1 = (props, BookingNavbar) => {
|
|||
|
||||
{!OtherServicesglobal && (
|
||||
<>
|
||||
|
||||
{FeatureAddonData?.FeatureDtls?.find(
|
||||
(item) =>
|
||||
item?.FeatureAddonName?.toLowerCase() === 'weight scale'
|
||||
) && (
|
||||
<div
|
||||
style={{
|
||||
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
|
||||
}}
|
||||
>
|
||||
<BSNavBarWeightScale />
|
||||
</div>
|
||||
)}
|
||||
{FeatureAddonData?.FeatureDtls?.find(
|
||||
(item) => item?.FeatureAddonName?.toLowerCase() === 'preorder'
|
||||
) && (
|
||||
|
|
@ -1152,7 +1154,20 @@ const BSNavbar1 = (props, BookingNavbar) => {
|
|||
|
||||
{!OtherServicesglobal && (
|
||||
<>
|
||||
|
||||
{/* Weight Scale */}
|
||||
{FeatureAddonData?.FeatureDtls?.find(
|
||||
(item) =>
|
||||
item?.FeatureAddonName?.toLowerCase() === 'weight scale'
|
||||
) && (
|
||||
<div
|
||||
className="ResNavbarIcons"
|
||||
style={{
|
||||
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
|
||||
}}
|
||||
>
|
||||
<BSNavBarWeightScale />
|
||||
</div>
|
||||
)}
|
||||
{/* PreOrder */}
|
||||
{FeatureAddonData?.FeatureDtls?.find(
|
||||
(item) => item?.FeatureAddonName?.toLowerCase() === 'preorder'
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import { blobToBase64,encryptObject, pdfDiv } from "../../../../Services/Others"
|
|||
import { PrintStyleFunction } from "../../../paymentpdfPage/PrintStyleFunction";
|
||||
import { Emailsend } from "../../../../Features/PurchaseOrder/PurchaseOrder";
|
||||
import { PublicQrCodepost } from "../../../../Features/ConfigMasterPage/ConfigMasterPage";
|
||||
import { downloadFile } from "../../../../utils/downloadFile";
|
||||
const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
|
||||
export const MobilePdfPrint = async ({
|
||||
printerTemplateStyle = 'Style 13',
|
||||
|
|
@ -112,26 +111,14 @@ export const MobilePdfPrint = async ({
|
|||
|
||||
if (PrintComing === 'download') {
|
||||
// 📥 Download PDF
|
||||
// const link = document.createElement('a');
|
||||
// link.href = URL.createObjectURL(pdfBlob);
|
||||
// link.download = `Receipt_${new Date().getTime()}.pdf`;
|
||||
// document.body.appendChild(link);
|
||||
// link.click();
|
||||
// document.body.removeChild(link);
|
||||
// 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.');
|
||||
}
|
||||
}
|
||||
);
|
||||
const link = document.createElement('a');
|
||||
link.href = URL.createObjectURL(pdfBlob);
|
||||
link.download = `Receipt_${new Date().getTime()}.pdf`;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
URL.revokeObjectURL(link.href);
|
||||
|
||||
// Clear printed orders
|
||||
setPrintOrderDetails([]);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -435,8 +435,7 @@ const SalesNetAmountModal = ({
|
|||
color: '#2e7d32',
|
||||
}}
|
||||
>
|
||||
{/* {total-RefundAmt} */}
|
||||
{total}
|
||||
{total-RefundAmt}
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -335,13 +335,6 @@ const RetailBookingClosing = (props) => {
|
|||
{safeRound(PaymentClosingData?.OverAllUpiAmount)}
|
||||
</span>
|
||||
</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">
|
||||
<p> Total Cash In Hand</p>
|
||||
<div>=</div>
|
||||
|
|
|
|||
|
|
@ -82,9 +82,7 @@ const SalesCountComponent = React.memo(
|
|||
SelfTakeAwayAmount,
|
||||
SelfDineInAmount,
|
||||
PreOrderAmount,
|
||||
RefundAmt,
|
||||
DineInRefundAmount,
|
||||
TakeAwayRefundAmount
|
||||
RefundAmt
|
||||
} = GlobalsalesDetailData.length > 0 ? GlobalsalesDetailData[0] : {};
|
||||
|
||||
const dispatch = useDispatch();
|
||||
|
|
@ -174,7 +172,7 @@ const SalesCountComponent = React.memo(
|
|||
{takeAwayPreference && (
|
||||
<p>
|
||||
Take Away:{' '}
|
||||
{(TakeAwayOrderCount + SelfTakeAwayOrderCount || 0)}
|
||||
{TakeAwayOrderCount + SelfTakeAwayOrderCount || 0}
|
||||
</p>
|
||||
)}
|
||||
<p>Dine In: {DineInOrderCount + SelfDineInOrderCount || 0}</p>
|
||||
|
|
@ -530,20 +528,6 @@ const SalesCountComponent = React.memo(
|
|||
)}
|
||||
</div>
|
||||
</div>
|
||||
{ TakeAwayRefundAmount != 0 && <div
|
||||
style={{
|
||||
display: 'flex',
|
||||
gap: '1rem',
|
||||
justifyContent: 'flex-end',
|
||||
fontFamily: 'Poppins',
|
||||
}}
|
||||
>
|
||||
<div>Refund (-) :</div>
|
||||
<div>
|
||||
{safeRound(TakeAwayRefundAmount)}
|
||||
</div>
|
||||
</div>}
|
||||
|
||||
<div
|
||||
style={{
|
||||
flexGrow: 1,
|
||||
|
|
@ -564,12 +548,11 @@ const SalesCountComponent = React.memo(
|
|||
<div>Total</div>
|
||||
<div>
|
||||
{safeRound(
|
||||
(TakeAwayAmount ?? 0) +
|
||||
(SelfTakeAwayAmount ?? 0) +
|
||||
(PreOrderAmount ?? 0) -
|
||||
(OverAllTakeAwayOfferAmount ?? 0) -
|
||||
(TakeAwayRefundAmount ?? 0)
|
||||
)}
|
||||
TakeAwayAmount +
|
||||
SelfTakeAwayAmount +
|
||||
PreOrderAmount -
|
||||
OverAllTakeAwayOfferAmount
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -579,12 +562,11 @@ const SalesCountComponent = React.memo(
|
|||
{isMobile ? 'TA' : 'Take Away'}:{' '}
|
||||
<span>
|
||||
{safeRound(
|
||||
((TakeAwayAmount || 0) +
|
||||
(SelfTakeAwayAmount || 0) +
|
||||
(PreOrderAmount || 0)) -
|
||||
(OverAllTakeAwayOfferAmount || 0) -
|
||||
(TakeAwayRefundAmount || 0)
|
||||
)}
|
||||
(TakeAwayAmount ||
|
||||
0 + SelfTakeAwayAmount ||
|
||||
0 + PreOrderAmount ||
|
||||
0) - OverAllTakeAwayOfferAmount
|
||||
)}
|
||||
</span>
|
||||
</p>
|
||||
|
||||
|
|
@ -621,21 +603,6 @@ const SalesCountComponent = React.memo(
|
|||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{ DineInRefundAmount != 0 && <div
|
||||
style={{
|
||||
display: 'flex',
|
||||
gap: '1rem',
|
||||
justifyContent: 'flex-end',
|
||||
fontFamily: 'Poppins',
|
||||
}}
|
||||
>
|
||||
<div>Refund (-) :</div>
|
||||
<div>
|
||||
{safeRound(DineInRefundAmount)}
|
||||
</div>
|
||||
</div>}
|
||||
|
||||
<div
|
||||
style={{
|
||||
flexGrow: 1,
|
||||
|
|
@ -656,11 +623,10 @@ const SalesCountComponent = React.memo(
|
|||
<div>Total</div>
|
||||
<div>
|
||||
{safeRound(
|
||||
(DineInAmount ?? 0) +
|
||||
(SelfDineInAmount ?? 0) -
|
||||
(OverAllDineInOfferAmount ?? 0) -
|
||||
(DineInRefundAmount ?? 0)
|
||||
)}
|
||||
DineInAmount +
|
||||
SelfDineInAmount -
|
||||
OverAllDineInOfferAmount
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -670,10 +636,9 @@ const SalesCountComponent = React.memo(
|
|||
{isMobile ? 'DI' : 'Dine In'}:{' '}
|
||||
<span>
|
||||
{safeRound(
|
||||
(DineInAmount ?? 0) +
|
||||
(SelfDineInAmount ?? 0) -
|
||||
(OverAllDineInOfferAmount ?? 0) -
|
||||
(DineInRefundAmount ?? 0)
|
||||
DineInAmount +
|
||||
SelfDineInAmount -
|
||||
OverAllDineInOfferAmount
|
||||
)}
|
||||
</span>
|
||||
</p>
|
||||
|
|
@ -698,19 +663,12 @@ const SalesCountComponent = React.memo(
|
|||
{isMobile ? 'NA' : 'Net Amt'}:{' '}
|
||||
<span>
|
||||
{safeRound(
|
||||
(
|
||||
(TakeAwayAmount ?? 0) +
|
||||
(SelfTakeAwayAmount ?? 0) +
|
||||
(PreOrderAmount ?? 0) -
|
||||
(OverAllTakeAwayOfferAmount ?? 0)
|
||||
) +
|
||||
(
|
||||
(DineInAmount ?? 0) +
|
||||
(SelfDineInAmount ?? 0) -
|
||||
(OverAllDineInOfferAmount ?? 0)
|
||||
) -
|
||||
(RefundAmt ?? 0)
|
||||
)}
|
||||
(TakeAwayAmount +
|
||||
SelfTakeAwayAmount +
|
||||
PreOrderAmount -
|
||||
OverAllTakeAwayOfferAmount || 0) +
|
||||
(DineInAmount + SelfDineInAmount - OverAllDineInOfferAmount)
|
||||
)}
|
||||
</span>
|
||||
</p>
|
||||
{Customisebillno && <CustomisedInvoiceChange />}
|
||||
|
|
|
|||
|
|
@ -777,10 +777,6 @@ const ChangePaymentmode = () => {
|
|||
dispatch(ChangeSelectedCustDisable(false));
|
||||
SelectCanPaymode(null);
|
||||
}
|
||||
else{
|
||||
setMessageType('error');
|
||||
setMessageData(response?.data?.response);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Payment mode change failed:', error);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import {
|
|||
Tooltip,
|
||||
Space,
|
||||
Segmented,
|
||||
Checkbox,
|
||||
} from 'antd';
|
||||
import { BsUpcScan } from "react-icons/bs";
|
||||
import {
|
||||
|
|
@ -63,7 +62,7 @@ import { getPrintSelectionComponentData } from '../../Features/ThemeChange/Theme
|
|||
import { DCPDFMobilePrint } from './DCPDFMobilePrint.js';
|
||||
import { isMobile } from 'react-device-detect';
|
||||
import EmailModel from '../BookingScreen/Components/UtillComponents/EmailModel.jsx';
|
||||
|
||||
|
||||
|
||||
const DeliveryChellanForm = () => {
|
||||
const { SadminuserAccess } = useAuth();
|
||||
|
|
@ -116,8 +115,7 @@ const DeliveryChellanForm = () => {
|
|||
const [segmentValue, setSegmentValue] = useState("N")
|
||||
const [selectedOrder, setSelectedOrder] = useState();
|
||||
const [orderTableData, setOrderTableData] = useState([]);
|
||||
const [emailSending, setEmailSending] = useState(false);
|
||||
const [selectedCustomertype, setSelectedCustomertype] = useState('N');
|
||||
const [emailSending, setEmailSending] = useState(false);
|
||||
|
||||
const items = [
|
||||
{
|
||||
|
|
@ -134,11 +132,9 @@ const DeliveryChellanForm = () => {
|
|||
useEffect(() => {
|
||||
dispatch(changeBreadCrumb({ items: items }));
|
||||
getProduct();
|
||||
fetchdata();
|
||||
getPrintData();
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
fetchdata();
|
||||
}, [selectedCustomertype]);
|
||||
|
||||
useEffect(() => {
|
||||
if (UserType === 'Employee') {
|
||||
|
|
@ -265,14 +261,14 @@ const DeliveryChellanForm = () => {
|
|||
console.log(AllCustomer, "AllCustomerAllCustomer")
|
||||
const fetchdata = async () => {
|
||||
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) {
|
||||
setAllCustomer(resCustomer?.data?.data);
|
||||
|
||||
} else {
|
||||
setAllCustomer([]);
|
||||
// setMessageType("error");
|
||||
// setMessageData(resCustomer?.data?.response);
|
||||
setMessageType("error");
|
||||
setMessageData(resCustomer?.data?.response);
|
||||
}
|
||||
|
||||
const resOrders = await dispatch(PendingOrdersDC({ CompId, AppId, BranchId })).unwrap();
|
||||
|
|
@ -280,8 +276,8 @@ const DeliveryChellanForm = () => {
|
|||
setOrdersCustomer(resOrders?.data?.data?.PurchaseOrder);
|
||||
} else {
|
||||
setOrdersCustomer([]);
|
||||
// setMessageType("error");
|
||||
// setMessageData(resOrders?.data?.response);
|
||||
setMessageType("error");
|
||||
setMessageData(resOrders?.data?.response);
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
|
|
@ -1161,7 +1157,7 @@ const DeliveryChellanForm = () => {
|
|||
|
||||
};
|
||||
const handlePrint = async () => {
|
||||
setIsSubmitted(false);
|
||||
setIsSubmitted(false);
|
||||
const DCstyle = await DCPrintStyleFunction(
|
||||
DCPrintTemplateStyle == undefined ? 'Style 13' : DCPrintTemplateStyle);
|
||||
const stylesMap = {
|
||||
|
|
@ -1192,8 +1188,8 @@ const DeliveryChellanForm = () => {
|
|||
if (isMobile) {
|
||||
DCPDFMobilePrint({
|
||||
PrintTempData: DCPrintTemplateDtl,
|
||||
UserId: UserId,
|
||||
dispatch
|
||||
UserId: UserId,
|
||||
dispatch
|
||||
})
|
||||
}
|
||||
else {
|
||||
|
|
@ -1223,7 +1219,7 @@ const DeliveryChellanForm = () => {
|
|||
// setPrintData(record);
|
||||
|
||||
if (orderData?.CustMail) {
|
||||
setEmailSending(true);
|
||||
setEmailSending(true);
|
||||
setTimeout(async () => {
|
||||
try {
|
||||
const blob = await pdfDiv('DC-Default-Print', PurchaseOrderStyle);
|
||||
|
|
@ -1246,15 +1242,15 @@ const DeliveryChellanForm = () => {
|
|||
setMessageData('Email failed to send');
|
||||
setMessageType('error');
|
||||
}
|
||||
finally {
|
||||
setEmailSending(false);
|
||||
finally{
|
||||
setEmailSending(false);
|
||||
}
|
||||
}, 300);
|
||||
} else {
|
||||
setPendingOrderDetails(ProductDetails);
|
||||
setPendingRecord(record);
|
||||
setiSEmail(true);
|
||||
setIsSubmitted(false);
|
||||
setIsSubmitted(false);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1307,7 +1303,7 @@ const DeliveryChellanForm = () => {
|
|||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
}}>
|
||||
}}>
|
||||
<FormHeader title={'Delivery Challan'} />
|
||||
<div
|
||||
style={{
|
||||
|
|
@ -1349,7 +1345,7 @@ const DeliveryChellanForm = () => {
|
|||
</div>
|
||||
<div className="DeliveryChellanDetails">
|
||||
|
||||
{segmentValue === "N" ? <div style={{ display: "flex", alignItems: "center", gap: "12px" }}>
|
||||
{segmentValue === "N" ? <div>
|
||||
<Form.Item
|
||||
name="CustId"
|
||||
rules={[
|
||||
|
|
@ -1372,21 +1368,6 @@ const DeliveryChellanForm = () => {
|
|||
onChangeFunction={handleAdminUserDropDownChange}
|
||||
/>
|
||||
</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>
|
||||
<Form.Item
|
||||
name="Order"
|
||||
|
|
@ -1741,14 +1722,14 @@ const DeliveryChellanForm = () => {
|
|||
</div>
|
||||
}
|
||||
/> */}
|
||||
{(iSEmail || emailSending) && (
|
||||
<EmailModel
|
||||
open={iSEmail}
|
||||
emailSending={emailSending}
|
||||
handleCancel={() => setiSEmail(false)}
|
||||
form={form}
|
||||
handleSendEmailWithEnteredEmail={handleSendEmailWithEnteredEmail}
|
||||
/>)}
|
||||
{(iSEmail || emailSending )&& (
|
||||
<EmailModel
|
||||
open={iSEmail}
|
||||
emailSending={emailSending}
|
||||
handleCancel={() => setiSEmail(false)}
|
||||
form={form}
|
||||
handleSendEmailWithEnteredEmail={handleSendEmailWithEnteredEmail}
|
||||
/>)}
|
||||
{PrintingData?.length > 0 &&
|
||||
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -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 { Form, Checkbox, Radio, Divider, InputNumber } from 'antd';
|
||||
import { ArrowRightOutlined } from '@ant-design/icons';
|
||||
|
|
@ -30,7 +30,6 @@ const PreferenceList = ({ setting = false }) => {
|
|||
const { SadminuserAccess, featureaddDetails } = useAuth();
|
||||
const dispatch = useDispatch();
|
||||
const formRef = useRef();
|
||||
const prevEstimateRef = useRef([]);
|
||||
const CompId = getSession('CompId');
|
||||
const BranchId = getSession('BranchId');
|
||||
const AppId = getSession('AppId');
|
||||
|
|
@ -158,10 +157,6 @@ const PreferenceList = ({ setting = false }) => {
|
|||
...(allSettingsMap['estimatetitle']?.value === 'Y'
|
||||
? ['estimatetitle']
|
||||
: []),
|
||||
...(allSettingsMap['estimatebrname']?.value === 'Y' ? ['estimatebrname'] : []),
|
||||
...(allSettingsMap['estimatebraddress']?.value === 'Y' ? ['estimatebraddress'] : []),
|
||||
...(allSettingsMap['estimatebrphone']?.value === 'Y' ? ['estimatebrphone'] : []),
|
||||
|
||||
],
|
||||
scanlayout: allSettingsMap['scanlayout']?.value === 'Y',
|
||||
verifyproduct: allSettingsMap['verifyproduct']?.value === 'Y',
|
||||
|
|
@ -212,9 +207,9 @@ const PreferenceList = ({ setting = false }) => {
|
|||
}
|
||||
};
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
useEffect(()=>{
|
||||
fetchTableData();
|
||||
}, [selectedUserId])
|
||||
},[selectedUserId])
|
||||
|
||||
useEffect(() => {
|
||||
if (settingsList) {
|
||||
|
|
@ -222,8 +217,6 @@ const PreferenceList = ({ setting = false }) => {
|
|||
setInitialValues(built);
|
||||
console.log(built, 'built');
|
||||
formRef.current?.setFieldsValue(built);
|
||||
prevEstimateRef.current = built.estimateSettings ?? [];
|
||||
|
||||
}
|
||||
}, [settingsList]);
|
||||
|
||||
|
|
@ -318,7 +311,7 @@ const PreferenceList = ({ setting = false }) => {
|
|||
};
|
||||
|
||||
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 res = await dispatch(getPreferenceData(data)).unwrap();
|
||||
if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) {
|
||||
|
|
@ -412,15 +405,8 @@ const PreferenceList = ({ setting = false }) => {
|
|||
dinein: values.enabledModules,
|
||||
estimation: values.enabledModules,
|
||||
parking: values.enabledFeatures,
|
||||
// estimateprintheader: values.estimateSettings,
|
||||
// estimatebrname: values.estimatebrname,
|
||||
// estimatebraddress: values.estimatebraddress,
|
||||
// estimatebrphone: values.estimatebrphone,
|
||||
estimateprintheader: values.estimateSettings,
|
||||
estimatetitle: values.estimateSettings,
|
||||
estimatebrname: values.estimateSettings,
|
||||
estimatebraddress: values.estimateSettings,
|
||||
estimatebrphone: values.estimateSettings,
|
||||
offer: values.enabledFeatures,
|
||||
whatsapp: values.pdfSendOptions,
|
||||
sms: values.pdfSendOptions,
|
||||
|
|
@ -495,51 +481,51 @@ const PreferenceList = ({ setting = false }) => {
|
|||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (userDropDown?.length > 0 && !formRef.current?.getFieldValue("userId")) {
|
||||
const adminUser = userDropDown.find(
|
||||
(user) => user.UserTypeName === "Admin"
|
||||
);
|
||||
if (userDropDown?.length > 0 && !formRef.current?.getFieldValue("userId")) {
|
||||
const adminUser = userDropDown.find(
|
||||
(user) => user.UserTypeName === "Admin"
|
||||
);
|
||||
|
||||
if (adminUser) {
|
||||
formRef.current?.setFieldsValue({
|
||||
userId: adminUser.UserId
|
||||
});
|
||||
}
|
||||
if (adminUser) {
|
||||
formRef.current?.setFieldsValue({
|
||||
userId: adminUser.UserId
|
||||
});
|
||||
}
|
||||
}, [userDropDown]);
|
||||
}
|
||||
}, [userDropDown]);
|
||||
const UserDropDownChange = (value) => {
|
||||
let user = userDropDown?.find((item) => item?.UserId === value);
|
||||
setSelectedUserId(user?.UserId)
|
||||
setSelectedUserId(user?.UserId)
|
||||
formRef.current?.setFieldsValue({
|
||||
userId: value,
|
||||
});
|
||||
};
|
||||
const userDropData = async () => {
|
||||
const data = {
|
||||
branchId: BranchId,
|
||||
compId: CompId,
|
||||
appId: AppId
|
||||
}
|
||||
const gettinguserDropDown = await dispatch(getBranchUsers(data)).unwrap();
|
||||
// const gettinguserDropDown = await dispatch(UserDataBasedOnBranchId(BranchId)).unwrap();
|
||||
const userDropData = async () => {
|
||||
const data ={
|
||||
branchId:BranchId,
|
||||
compId:CompId,
|
||||
appId:AppId
|
||||
}
|
||||
const gettinguserDropDown = await dispatch(getBranchUsers(data)).unwrap();
|
||||
// const gettinguserDropDown = await dispatch(UserDataBasedOnBranchId(BranchId)).unwrap();
|
||||
|
||||
|
||||
if (gettinguserDropDown?.data?.statusCode === 1) {
|
||||
const finaluserDropDown = gettinguserDropDown?.data?.data?.filter((value) => value.ActiveStatus === "A");
|
||||
setUserDropDown(finaluserDropDown);
|
||||
if (gettinguserDropDown?.data?.statusCode === 1) {
|
||||
const finaluserDropDown = gettinguserDropDown?.data?.data?.filter((value) => value.ActiveStatus === "A");
|
||||
setUserDropDown(finaluserDropDown);
|
||||
|
||||
if (UserType === 'Employee') {
|
||||
setSelectedUserId(UserId);
|
||||
} else {
|
||||
const adminUser = finaluserDropDown.find(
|
||||
(user) => user.UserTypeName === "Admin"
|
||||
);
|
||||
if (adminUser) {
|
||||
setSelectedUserId(adminUser.UserId);
|
||||
}
|
||||
if (UserType === 'Employee') {
|
||||
setSelectedUserId(UserId);
|
||||
} else {
|
||||
const adminUser = finaluserDropDown.find(
|
||||
(user) => user.UserTypeName === "Admin"
|
||||
);
|
||||
if (adminUser) {
|
||||
setSelectedUserId(adminUser.UserId);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const renderCheckbox = (name, label) =>
|
||||
allSettingsMap[name] !== undefined && (
|
||||
|
|
@ -547,53 +533,6 @@ const PreferenceList = ({ setting = false }) => {
|
|||
<Checkbox>Yes</Checkbox>
|
||||
</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 (
|
||||
<>
|
||||
|
|
@ -682,7 +621,7 @@ const PreferenceList = ({ setting = false }) => {
|
|||
initialValues={initialValues}
|
||||
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
|
||||
name="userId"
|
||||
rules={[
|
||||
|
|
@ -1225,33 +1164,26 @@ const PreferenceList = ({ setting = false }) => {
|
|||
'mobilea4',
|
||||
'Prefer printing in A4/A5 on mobile?'
|
||||
)}
|
||||
{ESTIMATE_PRINT_SETTINGS.some(({ key }) => allSettingsMap[key] !== undefined) && (
|
||||
<Form.Item noStyle shouldUpdate>
|
||||
{({ getFieldValue }) => (
|
||||
<Form.Item name="estimateSettings" label="Estimate Print Settings :">
|
||||
<Checkbox.Group onChange={(vals) => handleEstimateChange(vals, formRef)}>
|
||||
{ESTIMATE_PRINT_SETTINGS
|
||||
.filter(({ key }) => allSettingsMap[key] !== undefined)
|
||||
.map(({ key, label, children }) => (
|
||||
<React.Fragment key={key}>
|
||||
<Checkbox value={key}>{label}</Checkbox>
|
||||
|
||||
{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>
|
||||
))}
|
||||
</React.Fragment>
|
||||
))}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
</Form.Item>
|
||||
)}
|
||||
{(allSettingsMap['estimateprintheader'] !== undefined ||
|
||||
allSettingsMap['estimatetitle'] !== undefined) && (
|
||||
<Form.Item
|
||||
name="estimateSettings"
|
||||
label="Estimate Print Settings :"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['estimateprintheader'] !== undefined && (
|
||||
<Checkbox value="estimateprintheader">
|
||||
Show shop header (Name, Address, GST)
|
||||
</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['estimatetitle'] !== undefined && (
|
||||
<Checkbox value="estimatetitle">
|
||||
Show “Estimate (R/W)” title
|
||||
</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
</div>
|
||||
<div className="PreferencesBTN">
|
||||
<Buttons
|
||||
|
|
|
|||
|
|
@ -101,7 +101,6 @@ const ProductForm = ({ formType }) => {
|
|||
|
||||
const state = location?.state;
|
||||
const editstate = state?.editstate;
|
||||
console.log(editstate,'editstate23233232');
|
||||
|
||||
const formRef = useRef(null);
|
||||
const formCategoryRef = useRef(null);
|
||||
|
|
|
|||
|
|
@ -177,8 +177,6 @@ const TurboAddForm = () => {
|
|||
const prodSubCategories = useSelector(prodSubCatDataSelector);
|
||||
const allProdSubCategories = useSelector(allProdSubCatDataSelector);
|
||||
const searchText = useSelector(GlobalSearchData);
|
||||
console.log(searchText,"GlobalSearchData");
|
||||
console.log("new console")
|
||||
// Session data
|
||||
const AppId = useMemo(() => getSession('AppId'), []);
|
||||
const CompId = useMemo(() => getSession('CompId'), []);
|
||||
|
|
@ -1959,8 +1957,7 @@ const TurboAddForm = () => {
|
|||
<BarCodeScan
|
||||
style={{ FontSize: '12px', marginLeft: '8px' }}
|
||||
onScan={(value) => {
|
||||
console.log('Scanned value:', value);
|
||||
handleQrData(value);
|
||||
changeSearchedData(value);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ const DateWiseReport = () => {
|
|||
setting?.SettingIdName?.toLowerCase() === 'mobilea4' &&
|
||||
setting?.SettingValue === 'Y'
|
||||
);
|
||||
console.log(MobileA4Print, SettingDataSelector, 'MobileA4PrintMobileA4Print');
|
||||
console.log(MobileA4Print,SettingDataSelector, 'MobileA4PrintMobileA4Print');
|
||||
|
||||
useEffect(() => {
|
||||
if (dataSource?.length > 0) {
|
||||
|
|
@ -143,22 +143,22 @@ const DateWiseReport = () => {
|
|||
const Billamountspace = Math.max(
|
||||
0,
|
||||
6 -
|
||||
String(
|
||||
(AppType
|
||||
? datewiseData?.[0]?.WholeSaleExpenseNetAmount
|
||||
: datewiseData?.[0]?.TotalBillAmount
|
||||
)?.toFixed(2)
|
||||
).length
|
||||
String(
|
||||
(AppType
|
||||
? datewiseData?.[0]?.WholeSaleExpenseNetAmount
|
||||
: datewiseData?.[0]?.TotalBillAmount
|
||||
)?.toFixed(2)
|
||||
).length
|
||||
);
|
||||
const Taxamountspace = Math.max(
|
||||
0,
|
||||
6 -
|
||||
String(
|
||||
(AppType
|
||||
? datewiseData?.[0]?.WholeSaleExpenseTaxAmount
|
||||
: datewiseData?.[0]?.TaxAmount
|
||||
)?.toFixed(2)
|
||||
).length
|
||||
String(
|
||||
(AppType
|
||||
? datewiseData?.[0]?.WholeSaleExpenseTaxAmount
|
||||
: datewiseData?.[0]?.TaxAmount
|
||||
)?.toFixed(2)
|
||||
).length
|
||||
);
|
||||
const Chargesamountspace = Math.max(
|
||||
0,
|
||||
|
|
@ -171,22 +171,22 @@ const DateWiseReport = () => {
|
|||
const Discountamountspace = Math.max(
|
||||
0,
|
||||
6 -
|
||||
String(
|
||||
(AppType
|
||||
? datewiseData?.[0]?.WholeSaleExpenseTotalOverallDisc
|
||||
: datewiseData?.[0]?.TotalOfferAmount
|
||||
)?.toFixed(2)
|
||||
).length
|
||||
String(
|
||||
(AppType
|
||||
? datewiseData?.[0]?.WholeSaleExpenseTotalOverallDisc
|
||||
: datewiseData?.[0]?.TotalOfferAmount
|
||||
)?.toFixed(2)
|
||||
).length
|
||||
);
|
||||
const Netamountspace = Math.max(
|
||||
0,
|
||||
6 -
|
||||
String(
|
||||
(AppType
|
||||
? datewiseData?.[0]?.WholeSaleExpenseNetAmount
|
||||
: datewiseData?.[0]?.TotalNetAmount
|
||||
)?.toFixed(2)
|
||||
).length
|
||||
String(
|
||||
(AppType
|
||||
? datewiseData?.[0]?.WholeSaleExpenseNetAmount
|
||||
: datewiseData?.[0]?.TotalNetAmount
|
||||
)?.toFixed(2)
|
||||
).length
|
||||
);
|
||||
var data = datewiseData && datewiseData[0] ? datewiseData[0] : {};
|
||||
var receiptTextdata =
|
||||
|
|
@ -209,8 +209,8 @@ const DateWiseReport = () => {
|
|||
parseFloat(
|
||||
!AppType
|
||||
? (data?.TotalBillAmount || 0) -
|
||||
(data?.TotalExtraChargeAmount || 0) +
|
||||
(data?.TotalOfferAmount || 0)
|
||||
(data?.TotalExtraChargeAmount || 0) +
|
||||
(data?.TotalOfferAmount || 0)
|
||||
: data?.WholeSaleExpenseNetAmount || 0
|
||||
).toFixed(2) +
|
||||
' '.repeat(Billamountspace) +
|
||||
|
|
@ -265,7 +265,7 @@ const DateWiseReport = () => {
|
|||
AppType
|
||||
? datewiseData?.[0]?.WholeSaleExpenseNetAmount || 0
|
||||
: datewiseData?.[0]?.TotalNetAmount +
|
||||
(datewiseData?.[0]?.PreOrderNetAmount || 0) || 0
|
||||
(datewiseData?.[0]?.PreOrderNetAmount || 0) || 0
|
||||
)
|
||||
).toFixed(2) +
|
||||
' '.repeat(Netamountspace) +
|
||||
|
|
@ -369,7 +369,7 @@ const DateWiseReport = () => {
|
|||
}, []);
|
||||
|
||||
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 decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find(
|
||||
(setting) =>
|
||||
|
|
@ -552,33 +552,33 @@ const DateWiseReport = () => {
|
|||
// printStyle: style,
|
||||
// });
|
||||
// } else {
|
||||
var textEncoded = encodeURI(receiptText);
|
||||
var TypeCheck = 'PrintReceipt';
|
||||
var scheme = 'pozoprinter';
|
||||
var packageName = 'com.example.pozoprinter';
|
||||
var textEncoded = encodeURI(receiptText);
|
||||
var TypeCheck = 'PrintReceipt';
|
||||
var scheme = 'pozoprinter';
|
||||
var packageName = 'com.example.pozoprinter';
|
||||
|
||||
window.location.href =
|
||||
scheme +
|
||||
'://' +
|
||||
textEncoded +
|
||||
'#Intent;scheme=' +
|
||||
scheme +
|
||||
';package=' +
|
||||
packageName +
|
||||
'ImgS' +
|
||||
LogoImage +
|
||||
'ImgE' +
|
||||
TypeCheck +
|
||||
'TokenS' +
|
||||
TokenData +
|
||||
'TokenE' +
|
||||
'EstimateS' +
|
||||
'' +
|
||||
'EstimateE' +
|
||||
'HasFooterTextS' +
|
||||
FooterPrint +
|
||||
'HasFooterTextE' +
|
||||
';end;';
|
||||
window.location.href =
|
||||
scheme +
|
||||
'://' +
|
||||
textEncoded +
|
||||
'#Intent;scheme=' +
|
||||
scheme +
|
||||
';package=' +
|
||||
packageName +
|
||||
'ImgS' +
|
||||
LogoImage +
|
||||
'ImgE' +
|
||||
TypeCheck +
|
||||
'TokenS' +
|
||||
TokenData +
|
||||
'TokenE' +
|
||||
'EstimateS' +
|
||||
'' +
|
||||
'EstimateE' +
|
||||
'HasFooterTextS' +
|
||||
FooterPrint +
|
||||
'HasFooterTextE' +
|
||||
';end;';
|
||||
// }
|
||||
} else {
|
||||
await printDiv('RePrint', style);
|
||||
|
|
@ -724,7 +724,7 @@ const DateWiseReport = () => {
|
|||
onChangeFunction={(e) => UserDropDownChange(e)}
|
||||
isOnchanges={selectedUserData ? true : false}
|
||||
valueData={selectedUserData}
|
||||
// defaultValue={LastSelectConfig}
|
||||
// defaultValue={LastSelectConfig}
|
||||
/>
|
||||
</Form.Item>
|
||||
)}
|
||||
|
|
@ -921,38 +921,32 @@ const DateWiseReport = () => {
|
|||
<td>
|
||||
{!AppType
|
||||
? (datewiseData?.[0]?.TotalBillAmount || 0) -
|
||||
(datewiseData?.[0]?.TotalExtraChargeAmount || 0) +
|
||||
(datewiseData?.[0]?.TotalOfferAmount || 0)
|
||||
(datewiseData?.[0]?.TotalExtraChargeAmount || 0) +
|
||||
(datewiseData?.[0]?.TotalOfferAmount || 0)
|
||||
: datewiseData?.[0]?.WholeSaleExpenseNetAmount}
|
||||
</td>
|
||||
</tr>
|
||||
{!AppType
|
||||
? datewiseData?.[0]?.TaxAmount > 0 && (
|
||||
<tr>
|
||||
<td>Tax</td>
|
||||
<td>{datewiseData?.[0]?.TaxAmount}</td>
|
||||
</tr>
|
||||
)
|
||||
<tr>
|
||||
<td>Tax</td>
|
||||
<td>{datewiseData?.[0]?.TaxAmount}</td>
|
||||
</tr>
|
||||
)
|
||||
: datewiseData?.[0]?.WholeSaleExpenseTaxAmount > 0 && (
|
||||
<tr>
|
||||
<td>Tax</td>
|
||||
<td>
|
||||
{datewiseData?.[0]?.WholeSaleExpenseTaxAmount}
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
<tr>
|
||||
<td>Tax</td>
|
||||
<td>
|
||||
{datewiseData?.[0]?.WholeSaleExpenseTaxAmount}
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
{datewiseData?.[0]?.TotalExtraChargeAmount > 0 && (
|
||||
<tr>
|
||||
<td>Charges</td>
|
||||
<td>{datewiseData?.[0]?.TotalExtraChargeAmount}</td>
|
||||
</tr>
|
||||
)}
|
||||
{datewiseData?.[0]?.RefundAmount > 0 && (
|
||||
<tr>
|
||||
<td>Refund (-)</td>
|
||||
<td>{datewiseData?.[0]?.RefundAmount}</td>
|
||||
</tr>
|
||||
)}
|
||||
{datewiseData?.[0]?.PreOrderNetAmount > 0 && (
|
||||
<tr>
|
||||
<td>Preorder</td>
|
||||
|
|
@ -961,23 +955,23 @@ const DateWiseReport = () => {
|
|||
)}
|
||||
{AppType
|
||||
? datewiseData?.[0]?.WholeSaleExpenseTotalOverallDisc >
|
||||
0 && (
|
||||
<tr>
|
||||
<td>Discount(-)</td>
|
||||
<td>
|
||||
{
|
||||
datewiseData?.[0]
|
||||
?.WholeSaleExpenseTotalOverallDisc
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
0 && (
|
||||
<tr>
|
||||
<td>Discount(-)</td>
|
||||
<td>
|
||||
{
|
||||
datewiseData?.[0]
|
||||
?.WholeSaleExpenseTotalOverallDisc
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
: datewiseData?.[0]?.TotalOfferAmount > 0 && (
|
||||
<tr>
|
||||
<td>Discount(-)</td>
|
||||
<td>{datewiseData?.[0]?.TotalOfferAmount}</td>
|
||||
</tr>
|
||||
)}
|
||||
<tr>
|
||||
<td>Discount(-)</td>
|
||||
<td>{datewiseData?.[0]?.TotalOfferAmount}</td>
|
||||
</tr>
|
||||
)}
|
||||
|
||||
<p className="DateWiseReport-border-dashed"></p>
|
||||
<tr>
|
||||
|
|
@ -985,14 +979,12 @@ const DateWiseReport = () => {
|
|||
<td className="DateWiseReport-netAmount">
|
||||
{AppType
|
||||
? safeRound(
|
||||
datewiseData?.[0]?.WholeSaleExpenseNetAmount
|
||||
) || 0
|
||||
datewiseData?.[0]?.WholeSaleExpenseNetAmount
|
||||
) || 0
|
||||
: safeRound(
|
||||
(datewiseData?.[0]?.TotalBillAmount || 0) +
|
||||
(datewiseData?.[0]?.TaxAmount || 0) +
|
||||
(datewiseData?.[0]?.PreOrderNetAmount || 0) -
|
||||
(datewiseData?.[0]?.RefundAmount || 0)
|
||||
) || 0}
|
||||
datewiseData?.[0]?.TotalNetAmount +
|
||||
(datewiseData?.[0]?.PreOrderNetAmount || 0)
|
||||
) || 0}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
@ -1007,7 +999,7 @@ const DateWiseReport = () => {
|
|||
<Denomination onchange={handleDenominationChange} />
|
||||
{TotalCashInHand[0]?.PaymentMethod === 'Cash' &&
|
||||
TotalCashInHand[0]?.NetAmount <
|
||||
parseInt(denominationData?.OverAllTotal) &&
|
||||
parseInt(denominationData?.OverAllTotal) &&
|
||||
parseInt(denominationData?.OverAllTotal) > 0 && (
|
||||
<div
|
||||
className="amountMissmatch"
|
||||
|
|
|
|||
|
|
@ -436,7 +436,6 @@ const ItemWiseReport = () => {
|
|||
BalanceQty:item?.BalanceQty,
|
||||
Amount: item?.TotalAmt,
|
||||
StockAvailable:item?.StockAvailable,
|
||||
RefundAmount: item?.RefundAmount,
|
||||
}));
|
||||
const itemData = DateWisTableData;
|
||||
|
||||
|
|
@ -1211,14 +1210,6 @@ const ItemWiseReport = () => {
|
|||
</td>
|
||||
</tr>
|
||||
)}
|
||||
{ItemWiseData?.[0]?.RefundAmount > 0 && (
|
||||
<tr>
|
||||
<td>Refund (-) </td>
|
||||
<td>
|
||||
{safeRound(ItemWiseData?.[0]?.RefundAmount)}
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
{ItemWiseData?.[0]?.PreOrderNetAmount > 0 && (
|
||||
<tr>
|
||||
<td>Preorder</td>
|
||||
|
|
@ -1252,7 +1243,7 @@ const ItemWiseReport = () => {
|
|||
(ItemWiseData?.[0]?.TotalOfferAmount
|
||||
? ItemWiseData?.[0]?.TotalOfferAmount
|
||||
: 0)
|
||||
) - (ItemWiseData?.[0]?.RefundAmount || 0) || 0}
|
||||
) || 0}
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ import { useSelector } from 'react-redux';
|
|||
import excelExport from '../../../Images/xls-export.png';
|
||||
import ExcelJS from 'exceljs';
|
||||
import { saveAs } from 'file-saver';
|
||||
import { downloadFile } from '../../../utils/downloadFile.js';
|
||||
|
||||
dayjs.extend(customParseFormat);
|
||||
|
||||
|
|
@ -621,19 +620,8 @@ const LedgerReport = () => {
|
|||
hours = String(hours).padStart(2, '0');
|
||||
|
||||
const fileName = `Ledger Report_${day}-${month}-${year}_${hours}-${minutes}-${ampm}.xlsx`;
|
||||
downloadFile(
|
||||
buffer,
|
||||
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);
|
||||
|
||||
saveAs(blob, fileName);
|
||||
};
|
||||
|
||||
const FirstOrderLedgerDateRaw = dayjs(FirstOrderLedgerDate);
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ const SalesRemovallist = () => {
|
|||
const [Tabledata, setTabledata] = useState();
|
||||
const [Zero, SetZero] = useState(false);
|
||||
const [OrderProductdata, setOrderProductdata] = useState([]);
|
||||
console.log('OrderProductdata', OrderProductdata);
|
||||
const [OrderDataModel, setOrderDataModal] = useState(false);
|
||||
const [PaymentModal, setPaymentModal] = useState(false);
|
||||
const [Paymentdata, setPaymentdata] = useState([]);
|
||||
|
|
@ -710,31 +711,40 @@ const SalesRemovallist = () => {
|
|||
|
||||
const handleSave = (row) => {
|
||||
const newData = [...OrderProductdata];
|
||||
|
||||
const index = newData.findIndex((item) => row.ProdId === item.ProdId);
|
||||
if (index > -1) {
|
||||
const existing = newData[index];
|
||||
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 item = newData.splice(index, 1, { ...row })[0];
|
||||
|
||||
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),
|
||||
0
|
||||
);
|
||||
setTotalAmts(TotalAmount);
|
||||
setOrderProductdata(newData);
|
||||
setOrderProductdata(updatedTableData);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -909,16 +919,19 @@ const SalesRemovallist = () => {
|
|||
);
|
||||
});
|
||||
|
||||
const totalRefundAmount = OrderProductdata.reduce(
|
||||
(sum, prod) => sum + Number(prod?.RefundAmount || 0),
|
||||
0
|
||||
console.log(
|
||||
SalesQty,
|
||||
SalesQty.ProductIdentifierDtls.length,
|
||||
matchingProducts.length,
|
||||
SalesQty.ProductIdentifierDtls.length >= matchingProducts.length,
|
||||
'!!!!!!!!!'
|
||||
);
|
||||
|
||||
if (allQtyMatch) {
|
||||
const postdatas = Proddata?.map((item) => ({
|
||||
const postdatas = Proddata.map((item) => ({
|
||||
OrderId: item?.OrderId,
|
||||
SalesId: item?.SalesId,
|
||||
OrderQty:item?.OrderQty,
|
||||
OrderQty:item?.SalesId,
|
||||
CompId: item?.CompId,
|
||||
BranchId: item?.BranchId,
|
||||
OrderType: item?.OrderType,
|
||||
|
|
@ -929,7 +942,7 @@ const SalesRemovallist = () => {
|
|||
ActiveStatus: item?.ActiveStatus,
|
||||
UpdatedBy: item?.CreatedBy,
|
||||
AppId: item?.AppId,
|
||||
RefundAmount: totalRefundAmount,
|
||||
RefundAmount: item?.RefundAmount,
|
||||
AddlInfo: item?.AddlInfo,
|
||||
BillAmount: item?.BillAmount,
|
||||
OverallDiscSales: item?.OverallDisc,
|
||||
|
|
@ -943,8 +956,7 @@ const SalesRemovallist = () => {
|
|||
PaymentStatus: item?.PaymentStatus,
|
||||
|
||||
OrderDtlDetails: OrderProductdata.map((prod) => ({
|
||||
// ActiveStatus: prod?.ActiveStatus,
|
||||
ActiveStatus: "D",
|
||||
ActiveStatus: prod?.ActiveStatus,
|
||||
ProdId: prod?.ProdId,
|
||||
Type: prod?.Type,
|
||||
// OrderQty: prod?.OrderQty,
|
||||
|
|
@ -1002,7 +1014,7 @@ const SalesRemovallist = () => {
|
|||
ActiveStatus: item?.ActiveStatus,
|
||||
UpdatedBy: item?.CreatedBy,
|
||||
AppId: item?.AppId,
|
||||
RefundAmount: totalRefundAmount,
|
||||
RefundAmount: item?.RefundAmount,
|
||||
AddlInfo: item?.AddlInfo,
|
||||
BillAmount: item?.BillAmount,
|
||||
OverallDiscSales: item?.OverallDisc,
|
||||
|
|
@ -1059,7 +1071,7 @@ const SalesRemovallist = () => {
|
|||
} else if (isIdentifyDetailsValid) {
|
||||
// else if(isSalesQtyOldSalesQty){
|
||||
|
||||
const postdatas = Proddata?.map((item) => ({
|
||||
const postdatas = Proddata.map((item) => ({
|
||||
OrderId: item?.OrderId,
|
||||
SalesId: item?.SalesId,
|
||||
CompId: item?.CompId,
|
||||
|
|
@ -1072,7 +1084,7 @@ const SalesRemovallist = () => {
|
|||
ActiveStatus: item?.ActiveStatus,
|
||||
UpdatedBy: item?.CreatedBy,
|
||||
AppId: item?.AppId,
|
||||
RefundAmount: totalRefundAmount,
|
||||
RefundAmount: item?.RefundAmount,
|
||||
AddlInfo: item?.AddlInfo,
|
||||
BillAmount: item?.BillAmount,
|
||||
OverallDiscSales: item?.OverallDisc,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ const DateWiseReportPdf = ({
|
|||
}) => {
|
||||
|
||||
let PrintDetailsdata = datewiseData?.[0]?.AddressDetails?.[0];
|
||||
const refundAmount = datewiseData?.[0]?.RefundAmount || 0;
|
||||
console.log(PrintDetailsdata, 'hhhhhhhhhhhhhhhj');
|
||||
const [currentTime, setCurrentTime] = useState('');
|
||||
|
||||
|
|
@ -286,16 +285,14 @@ const DateWiseReportPdf = ({
|
|||
{TotalCharges > 0 && (
|
||||
<p className="totaldetails"> Charges: {TotalCharges}</p>
|
||||
)}
|
||||
{refundAmount > 0 && (
|
||||
<p className="totaldetails"> Refund: {refundAmount}</p>
|
||||
)}
|
||||
{TotalDiscount > 0 && (
|
||||
<p className="totaldetails"> Discount(-): {TotalDiscount}</p>
|
||||
)}
|
||||
|
||||
<p className="totaldetails">-------------------------</p>
|
||||
<p className="totaldetails">
|
||||
{' '}
|
||||
Net: {Math.round(TotalBillAmount + TaxAmount + (TotalPreOrderAmount || 0) - (refundAmount))}
|
||||
Net: {Math.round(TotalNetAmount + (TotalPreOrderAmount || 0))}
|
||||
</p>
|
||||
</div>
|
||||
{/* current Time */}
|
||||
|
|
|
|||
|
|
@ -177,9 +177,6 @@ const ItemWiseReportPdf = ({
|
|||
{TotalCharges > 0 && (
|
||||
<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 && (
|
||||
<p className="totaldetails"> Discount(-): { parseFloat(TotalDiscount).toFixed(2)}</p>
|
||||
)}
|
||||
|
|
@ -193,7 +190,7 @@ const ItemWiseReportPdf = ({
|
|||
(TotalTaxAmount || 0) +
|
||||
(TotalCharges || 0) +
|
||||
(TotalPreOrderAmount || 0) -
|
||||
(TotalDiscount || 0) - (itemData?.[0]?.RefundAmount || 0)
|
||||
(TotalDiscount || 0)
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import {
|
|||
getCommonAppPreference,
|
||||
changeWarehouse,
|
||||
} from './Features/BrachLogin/BranchLogin.js';
|
||||
import { clearSession, getSession, sessionStore } from './Services/Others';
|
||||
import { clearSession, getSession } from './Services/Others';
|
||||
import {
|
||||
FeatureAddon,
|
||||
GlobalFeatAddOnData,
|
||||
|
|
@ -43,18 +43,7 @@ const ProtectedRoutes = ({ routesConfig }) => {
|
|||
const [accessCheckComplete, setAccessCheckComplete] = useState(false);
|
||||
const FeatureAddonData = useSelector(GlobalFeatAddOnData);
|
||||
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(() => {
|
||||
getApplicationPreference();
|
||||
}, []);
|
||||
|
|
@ -280,221 +269,221 @@ const ProtectedRoutes = ({ routesConfig }) => {
|
|||
).unwrap();
|
||||
if (response?.data?.statusCode === 1) {
|
||||
if (response?.data?.data?.length == 1) {
|
||||
navigate(`${subDirectory}`);
|
||||
navigate(`${subDirectory}app-page/home`);
|
||||
} else {
|
||||
navigate(`${subDirectory}app-page/branch-login`);
|
||||
}
|
||||
}
|
||||
};
|
||||
// useEffect(() => {
|
||||
// const performAccessChecks = async () => {
|
||||
// if (!hasRedirected) {
|
||||
// let featureAddon;
|
||||
// let featureAddonData;
|
||||
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 = [];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
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;
|
||||
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;
|
||||
// });
|
||||
// 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;
|
||||
// }
|
||||
if (!currentRoute) {
|
||||
// alert("Unauthorized action detected. You have been logged out.")
|
||||
Logout();
|
||||
setHasRedirected(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// const empAccessData = getEmpAccessFromChildren(
|
||||
// currentRoute,
|
||||
// currentPath
|
||||
// );
|
||||
// const accessData = getEmpAccessDataFromChildren(
|
||||
// currentRoute,
|
||||
// currentPath
|
||||
// );
|
||||
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
|
||||
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;
|
||||
// // }
|
||||
// // }
|
||||
// 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;
|
||||
// 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 (checkPreferenceAccessData.includes(empAccessData)) {
|
||||
empPreferenceCheck = checkAccess(empAccessData);
|
||||
} else {
|
||||
empPreferenceCheck = true;
|
||||
}
|
||||
|
||||
// if (checkPlanAccessData.includes(empAccessData)) {
|
||||
// empPlanAccessCheck = checkPlanAccess(
|
||||
// empAccessData,
|
||||
// featureAddonData
|
||||
// );
|
||||
// } else {
|
||||
// empPlanAccessCheck = true;
|
||||
// }
|
||||
if (checkPlanAccessData.includes(empAccessData)) {
|
||||
empPlanAccessCheck = checkPlanAccess(
|
||||
empAccessData,
|
||||
featureAddonData
|
||||
);
|
||||
} else {
|
||||
empPlanAccessCheck = true;
|
||||
}
|
||||
|
||||
// return !empPreferenceCheck || !empPlanAccessCheck;
|
||||
// }
|
||||
// },
|
||||
// Employee: async () => {
|
||||
// if (empAccessData && accessData !== 'Super Admin') {
|
||||
// const empAccessCheck = await checkEmpAccess(
|
||||
// empAccessData,
|
||||
// currentPath
|
||||
// );
|
||||
// let empPreferenceCheck = true;
|
||||
// let empPlanAccessCheck = true;
|
||||
return !empPreferenceCheck || !empPlanAccessCheck;
|
||||
}
|
||||
},
|
||||
Employee: async () => {
|
||||
if (empAccessData && accessData !== 'Super Admin') {
|
||||
const empAccessCheck = await checkEmpAccess(
|
||||
empAccessData,
|
||||
currentPath
|
||||
);
|
||||
let empPreferenceCheck = true;
|
||||
let empPlanAccessCheck = true;
|
||||
|
||||
// if (checkPreferenceAccessData.includes(empAccessData)) {
|
||||
// empPreferenceCheck = checkAccess(empAccessData);
|
||||
// } else {
|
||||
// empPreferenceCheck = true;
|
||||
// }
|
||||
if (checkPreferenceAccessData.includes(empAccessData)) {
|
||||
empPreferenceCheck = checkAccess(empAccessData);
|
||||
} else {
|
||||
empPreferenceCheck = true;
|
||||
}
|
||||
|
||||
// if (checkPlanAccessData.includes(empAccessData)) {
|
||||
// empPlanAccessCheck = checkPlanAccess(
|
||||
// empAccessData,
|
||||
// featureAddonData
|
||||
// );
|
||||
// } else {
|
||||
// empPlanAccessCheck = true;
|
||||
// }
|
||||
// if (location.pathname === '/app-page/relieve-request') {
|
||||
// return false;
|
||||
// }
|
||||
// return (
|
||||
// !empAccessCheck || !empPreferenceCheck || !empPlanAccessCheck
|
||||
// );
|
||||
// } else {
|
||||
// if (accessData === 'Super Admin') {
|
||||
// return true;
|
||||
// } else {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// };
|
||||
if (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.');
|
||||
// }
|
||||
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);
|
||||
// }
|
||||
// };
|
||||
setAccessCheckComplete(true);
|
||||
}
|
||||
};
|
||||
|
||||
// performAccessChecks();
|
||||
// }, [UserType, routesConfig, navigate, hasRedirected, location.pathname]);
|
||||
performAccessChecks();
|
||||
}, [UserType, routesConfig, navigate, hasRedirected, location.pathname]);
|
||||
|
||||
const Logout = async () => {
|
||||
const status = 'N'; // replace with your actual status
|
||||
|
|
@ -542,7 +531,7 @@ const ProtectedRoutes = ({ routesConfig }) => {
|
|||
|
||||
return (
|
||||
<Suspense fallback={<div></div>}>
|
||||
<Routes>{ renderRoutes(routesConfig)}</Routes>
|
||||
<Routes>{accessCheckComplete && renderRoutes(routesConfig)}</Routes>
|
||||
</Suspense>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ const getCapCookieData = (key) => {
|
|||
};
|
||||
|
||||
export const sessionStore = (key, value) => {
|
||||
console.log("Storing session:", key, value);
|
||||
const encryptedValue = key !== "auth"
|
||||
? CryptoJS.AES.encrypt(JSON.stringify(value), SECRET_KEY).toString()
|
||||
: value;
|
||||
|
|
|
|||
266
src/check.html
266
src/check.html
|
|
@ -1,270 +1,38 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<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" />
|
||||
<link rel="icon" href="/fav.ico" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, user-scalable=no"
|
||||
/>
|
||||
<!-- <link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/antd/dist/reset.css"
|
||||
/> -->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
rel="preload"
|
||||
as="font"
|
||||
href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,400;0,500;0,600;0,700;1,200&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&family=Manrope:wght@200;300;400;500;600;700;800&family=Montserrat:wght@400;500;600;700&family=Poppins:ital,wght@1,200&display=swap"
|
||||
/>
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Arimo:ital,wght@0,400..700;1,400..700&family=Crimson+Pro:ital,wght@0,200..900;1,200..900&family=Dhurjati&family=Diplomata+SC&family=Inconsolata:wght@200..900&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&family=Lexend+Zetta:wght@200;300;400;500;700&family=Libre+Franklin:ital,wght@0,100..900;1,100..900&family=Podkova:wght@400..800&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto+Slab:wght@200;300;400;500;600;700&family=VT323&family=Cute+Font&family=Kumar+One&family=Lemon&family=Lily+Script+One&family=M+PLUS+Rounded+1c&family=Maiden+Orange&family=Kode+Mono:wght@400..700&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Fredoka:wght@300..700&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Freeman&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Concert+One&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Calistoga&display=swap"
|
||||
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>
|
||||
<!-- mohan -->
|
||||
<!-- <script>
|
||||
// Disable right-cli ck menu and common hotkeys
|
||||
document.addEventListener("contextmenu", (event) => event.preventDefault());
|
||||
document.addEventListener("keydown", (event) => {
|
||||
if (
|
||||
(event.ctrlKey && event.shiftKey && ["I", "J", "C"].includes(event.key.toUpperCase())) ||
|
||||
(event.ctrlKey && ["U", "S"].includes(event.key.toUpperCase())) ||
|
||||
event.key === "F12"
|
||||
) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
</script> -->
|
||||
<!-- public/index.html -->
|
||||
<script>
|
||||
// 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>
|
||||
(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);
|
||||
// Disable right-click menu and common hotkeys
|
||||
document.addEventListener('contextmenu', (event) =>
|
||||
event.preventDefault()
|
||||
);
|
||||
document.addEventListener('keydown', (event) => {
|
||||
if (
|
||||
(event.ctrlKey &&
|
||||
event.shiftKey &&
|
||||
['I', 'J', 'C'].includes(event.key.toUpperCase())) ||
|
||||
(event.ctrlKey && ['U', 'S'].includes(event.key.toUpperCase())) ||
|
||||
event.key === 'F12'
|
||||
) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<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>
|
||||
|
||||
<!-- <iframe id="ifmcontentstoprint" style="
|
||||
height: 0px;
|
||||
width: 0px;
|
||||
position: absolute;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
/* font-family: 'Poppins', sans-serif; */
|
||||
"></iframe> -->
|
||||
</html>
|
||||
|
|
|
|||
854
src/check.jsx
854
src/check.jsx
|
|
@ -1,387 +1,539 @@
|
|||
// import React, { useRef, useState, useEffect } from "react";
|
||||
// import { BarcodeScanner } from "@capacitor-mlkit/barcode-scanning";
|
||||
// import { BsUpcScan } from "react-icons/bs";
|
||||
// import { BrowserMultiFormatReader } from "@zxing/library";
|
||||
// import { Capacitor } from "@capacitor/core";
|
||||
// import { DefaultModal } from "../Components/Modal/DefaultModal";
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Routes, Route, useNavigate } from 'react-router-dom';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import {
|
||||
getEmpAccesData,
|
||||
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 isMobileApp = Capacitor.getPlatform() !== "web";
|
||||
// const [scanning, setScanning] = useState(false);
|
||||
// const [modalOpen, setModalOpen] = useState(false);
|
||||
// const videoRef = useRef(null);
|
||||
// const codeReaderRef = useRef(null);
|
||||
// const streamRef = useRef(null);
|
||||
const commonUrl = import.meta.env.ENV_COMMON_BASE_URL;
|
||||
const subDirectory = import.meta.env.BASE_URL;
|
||||
|
||||
// const startScan = async () => {
|
||||
// if (scanning) return;
|
||||
// setScanning(true);
|
||||
const ProtectedRoutes = ({ routesConfig }) => {
|
||||
useTemplate(
|
||||
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) {
|
||||
// // Mobile: MLKit scanner
|
||||
// try {
|
||||
// const perm = await BarcodeScanner.requestPermissions();
|
||||
// if (perm.camera !== "granted") {
|
||||
// alert("Camera permission not granted");
|
||||
// setScanning(false);
|
||||
// return;
|
||||
// }
|
||||
useEffect(() => {
|
||||
getApplicationPreference();
|
||||
}, []);
|
||||
//sri
|
||||
useEffect(() => {
|
||||
if (Warehouse) {
|
||||
dispatch(changeWarehouse(true));
|
||||
}
|
||||
}, [Warehouse]);
|
||||
const getApplicationPreference = async () => {
|
||||
await dispatch(getCommonAppPreference(AppId)).unwrap();
|
||||
};
|
||||
|
||||
// const { barcodes } = await BarcodeScanner.scan();
|
||||
// if (barcodes && barcodes.length > 0) {
|
||||
// onScan(barcodes[0].rawValue);
|
||||
// }
|
||||
// } catch (err) {
|
||||
// alert("Error scanning barcode: " + err.message);
|
||||
// } finally {
|
||||
// setScanning(false);
|
||||
// }
|
||||
// } else {
|
||||
// // Web: open modal and start camera
|
||||
// setModalOpen(true);
|
||||
// setTimeout(() => startWebScan(), 50); // wait for modal DOM
|
||||
// }
|
||||
// };
|
||||
const getEmpAccess = async () => {
|
||||
let data = {
|
||||
UserId: UserId,
|
||||
AppId: AppId,
|
||||
CompId: CompId,
|
||||
BranchId: BranchId,
|
||||
};
|
||||
|
||||
// const startWebScan = async () => {
|
||||
// try {
|
||||
// codeReaderRef.current = new BrowserMultiFormatReader();
|
||||
// streamRef.current = await navigator.mediaDevices.getUserMedia({
|
||||
// video: { facingMode: "environment" },
|
||||
// });
|
||||
// if (videoRef.current) {
|
||||
// videoRef.current.srcObject = streamRef.current;
|
||||
// videoRef.current.play();
|
||||
// }
|
||||
const response = await dispatch(getEmpAccesData(data)).unwrap();
|
||||
if (response?.data?.statusCode === 1) {
|
||||
return response?.data?.data?.[0]?.EmpAccessDetails;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
// codeReaderRef.current.decodeFromVideoDevice(
|
||||
// null,
|
||||
// videoRef.current,
|
||||
// (result) => {
|
||||
// if (result) {
|
||||
// onScan(result.getText());
|
||||
// stopWebScan();
|
||||
// setModalOpen(false);
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
// } catch (err) {
|
||||
// alert("Error accessing camera: " + err.message);
|
||||
// setScanning(false);
|
||||
// setModalOpen(false);
|
||||
// }
|
||||
// };
|
||||
const getSadminUserAccess = async () => {
|
||||
let data = {
|
||||
UserId: UserId,
|
||||
AppId: AppId,
|
||||
};
|
||||
const response = await dispatch(getSAdminUserAccesData(data)).unwrap();
|
||||
if (response?.data?.statusCode === 1) {
|
||||
return response?.data?.data?.[0]?.AppMenuAccessDetails;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
// const stopWebScan = () => {
|
||||
// if (streamRef.current) {
|
||||
// streamRef.current.getTracks().forEach((track) => track.stop());
|
||||
// streamRef.current = null;
|
||||
// }
|
||||
// if (codeReaderRef.current) {
|
||||
// codeReaderRef.current.reset();
|
||||
// codeReaderRef.current = null;
|
||||
// }
|
||||
// setScanning(false);
|
||||
// };
|
||||
const Dinein = async () => {
|
||||
if (AppId && CompId && BranchId) {
|
||||
let DineinData = {
|
||||
AppId: AppId,
|
||||
CompId: CompId,
|
||||
BranchId: BranchId,
|
||||
UserId: UserId,
|
||||
};
|
||||
const response = await dispatch(gettableData(DineinData)).unwrap();
|
||||
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 = () => {
|
||||
// stopWebScan();
|
||||
// setModalOpen(false);
|
||||
// };
|
||||
const checkAccess = async (empAccess) => {
|
||||
if (!empAccess) return 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
|
||||
// useEffect(() => () => stopWebScan(), []);
|
||||
const getPricingName = async () => {
|
||||
if (!AppId || !UserId) return;
|
||||
const data = {
|
||||
appId: AppId,
|
||||
userId: UserId,
|
||||
};
|
||||
try {
|
||||
const response = await dispatch(PricingAppPricingName(data)).unwrap();
|
||||
const responseData = response?.data;
|
||||
const pricingData = responseData?.data;
|
||||
const hasAdvance = pricingData?.some(
|
||||
(item) => item.PricingName === 'Premium'
|
||||
);
|
||||
const hasProOrAdvance =
|
||||
hasAdvance ||
|
||||
pricingData.some((item) => item.PricingName === 'Customized');
|
||||
return (hasAdvance, hasProOrAdvance);
|
||||
} catch (error) {
|
||||
console.error('Error fetching pricing name:', error);
|
||||
}
|
||||
};
|
||||
|
||||
// return (
|
||||
// <div style={{ display: "flex", justifyContent: "center", padding: 20 }}>
|
||||
// {!scanning && (
|
||||
// <BsUpcScan
|
||||
// onClick={startScan}
|
||||
// style={{ fontSize: 32, color: "#007bff", cursor: "pointer" }}
|
||||
// />
|
||||
// )}
|
||||
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
|
||||
}
|
||||
};
|
||||
|
||||
// <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",
|
||||
// }}
|
||||
// />
|
||||
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')
|
||||
);
|
||||
|
||||
// <button
|
||||
// onClick={closeModal}
|
||||
// style={{
|
||||
// marginTop: 20,
|
||||
// padding: "10px 20px",
|
||||
// fontSize: 16,
|
||||
// borderRadius: 8,
|
||||
// border: "none",
|
||||
// cursor: "pointer",
|
||||
// }}
|
||||
// >
|
||||
// Close
|
||||
// </button>
|
||||
// </div>
|
||||
// </DefaultModal>
|
||||
return !!config;
|
||||
};
|
||||
|
||||
// </div>
|
||||
// );
|
||||
// }
|
||||
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);
|
||||
|
||||
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';
|
||||
return !!config;
|
||||
};
|
||||
|
||||
QrScanner.WORKER_PATH = new URL(
|
||||
'qr-scanner/qr-scanner-worker.min.js',
|
||||
import.meta.url
|
||||
).toString();
|
||||
const getEmpAccessFromChildren = (route, currentPath) => {
|
||||
if (route.path === currentPath) {
|
||||
return route.empAccess || null;
|
||||
}
|
||||
|
||||
export default function BarCodeScan({ onScan }) {
|
||||
const isMobileApp = Capacitor.getPlatform() !== 'web';
|
||||
const [scanning, setScanning] = useState(false);
|
||||
const [modalOpen, setModalOpen] = useState(false);
|
||||
if (route.children) {
|
||||
for (const child of route.children) {
|
||||
const childPath = `${route.path}/${child.path}`;
|
||||
if (childPath === currentPath) {
|
||||
return child.empAccess || null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const videoRef = useRef(null);
|
||||
const qrScannerRef = useRef(null);
|
||||
const barcodeReaderRef = useRef(null);
|
||||
return null;
|
||||
};
|
||||
|
||||
// -------------------------
|
||||
// START SCAN
|
||||
// -------------------------
|
||||
const startScan = async () => {
|
||||
if (scanning) return;
|
||||
setScanning(true);
|
||||
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;
|
||||
};
|
||||
|
||||
if (isMobileApp) {
|
||||
try {
|
||||
const perm = await BarcodeScanner.requestPermissions();
|
||||
if (perm.camera !== 'granted') {
|
||||
alert('Camera permission not granted');
|
||||
setScanning(false);
|
||||
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;
|
||||
}
|
||||
|
||||
const { barcodes } = await BarcodeScanner.scan();
|
||||
if (barcodes?.length > 0) {
|
||||
onScan(barcodes[0].rawValue);
|
||||
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)) {
|
||||
empPlanAccessCheck = checkPlanAccess(
|
||||
empAccessData,
|
||||
featureAddonData
|
||||
);
|
||||
} else {
|
||||
empPlanAccessCheck = true;
|
||||
}
|
||||
|
||||
return !empPreferenceCheck || !empPlanAccessCheck;
|
||||
}
|
||||
},
|
||||
Employee: async () => {
|
||||
if (empAccessData && accessData !== 'Super Admin') {
|
||||
const empAccessCheck = await checkEmpAccess(
|
||||
empAccessData,
|
||||
currentPath
|
||||
);
|
||||
let empPreferenceCheck = true;
|
||||
let empPlanAccessCheck = true;
|
||||
|
||||
if (checkPreferenceAccessData.includes(empAccessData)) {
|
||||
empPreferenceCheck = checkAccess(empAccessData);
|
||||
} else {
|
||||
empPreferenceCheck = true;
|
||||
}
|
||||
|
||||
if (checkPlanAccessData.includes(empAccessData)) {
|
||||
empPlanAccessCheck = checkPlanAccess(
|
||||
empAccessData,
|
||||
featureAddonData
|
||||
);
|
||||
} else {
|
||||
empPlanAccessCheck = true;
|
||||
}
|
||||
if (location.pathname === '/app-page/relieve-request') {
|
||||
return false;
|
||||
}
|
||||
return (
|
||||
!empAccessCheck || !empPreferenceCheck || !empPlanAccessCheck
|
||||
);
|
||||
} else {
|
||||
if (accessData === 'Super Admin') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
if (userAccessChecks[UserType]) {
|
||||
shouldNavigate = await userAccessChecks[UserType]();
|
||||
} else {
|
||||
shouldNavigate = true;
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
} finally {
|
||||
setScanning(false);
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
setModalOpen(true);
|
||||
};
|
||||
|
||||
performAccessChecks();
|
||||
}, [UserType, routesConfig, navigate, hasRedirected, location.pathname]);
|
||||
|
||||
const Logout = async () => {
|
||||
const status = 'N'; // replace with your actual status
|
||||
const res = await dispatch(GenerateLogout({ UserId, status })).unwrap();
|
||||
if (res?.data?.statusCode === 1) {
|
||||
sessionStorage.clear();
|
||||
window.location.replace(`${commonUrl}`);
|
||||
}
|
||||
};
|
||||
|
||||
// -------------------------
|
||||
// START WEB SCAN (HYBRID)
|
||||
// -------------------------
|
||||
const startWebScan = async () => {
|
||||
if (!videoRef.current) return;
|
||||
const renderRoutes = (routes) => {
|
||||
return routes.map(({ path, component: Component, children }) => {
|
||||
const fullPath = `${path}`;
|
||||
|
||||
// Start QR scanner (fast)
|
||||
qrScannerRef.current = new QrScanner(
|
||||
videoRef.current,
|
||||
(result) => {
|
||||
stopWebScan();
|
||||
onScan(result.data);
|
||||
setModalOpen(false);
|
||||
},
|
||||
{
|
||||
maxScansPerSecond: 25,
|
||||
if (!Component) {
|
||||
console.error(`Component not found for path: ${fullPath}`);
|
||||
return null;
|
||||
}
|
||||
);
|
||||
|
||||
await qrScannerRef.current.start();
|
||||
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>
|
||||
);
|
||||
}
|
||||
|
||||
// Start Barcode scanner (ZXing)
|
||||
barcodeReaderRef.current = new BrowserMultiFormatReader(undefined, {
|
||||
possibleFormats: [
|
||||
BarcodeFormat.CODE_128,
|
||||
BarcodeFormat.EAN_13,
|
||||
BarcodeFormat.UPC_A,
|
||||
BarcodeFormat.UPC_E,
|
||||
],
|
||||
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 (
|
||||
<div
|
||||
className="BarCodeScanMaster"
|
||||
style={{ display: 'flex', justifyContent: 'center', padding: 20 }}
|
||||
>
|
||||
{!scanning && (
|
||||
<BsUpcScan
|
||||
onClick={startScan}
|
||||
style={{
|
||||
fontSize: 32,
|
||||
color: '#007bff',
|
||||
cursor: 'pointer',
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
<DefaultModal
|
||||
title="QR / Barcode Reader"
|
||||
width={500}
|
||||
open={modalOpen}
|
||||
footer={false}
|
||||
handleCancel={closeModal}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
position: 'relative',
|
||||
width: '100%',
|
||||
maxWidth: 400,
|
||||
margin: 'auto',
|
||||
}}
|
||||
>
|
||||
{/* VIDEO */}
|
||||
<video
|
||||
ref={videoRef}
|
||||
style={{
|
||||
width: '100%',
|
||||
borderRadius: 8,
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* DARK OVERLAY */}
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
background: 'rgba(0,0,0,0.5)',
|
||||
borderRadius: 8,
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* SCAN BOX */}
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
top: '50%',
|
||||
left: '50%',
|
||||
width: '70%',
|
||||
height: '60%',
|
||||
transform: 'translate(-50%, -50%)',
|
||||
border: '3px solid #00ff00',
|
||||
borderRadius: 12,
|
||||
boxShadow: '0 0 0 2000px rgba(0,0,0,0.4)',
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* SCAN LINE */}
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
left: '15%',
|
||||
width: '70%',
|
||||
height: 2,
|
||||
background: 'red',
|
||||
animation: 'scanAnimation 2s infinite linear',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<button
|
||||
onClick={closeModal}
|
||||
style={{
|
||||
marginTop: 20,
|
||||
padding: '10px 20px',
|
||||
fontSize: 16,
|
||||
borderRadius: 8,
|
||||
border: 'none',
|
||||
cursor: 'pointer',
|
||||
}}
|
||||
>
|
||||
Close
|
||||
</button>
|
||||
|
||||
{/* Animation */}
|
||||
<style>
|
||||
{`
|
||||
@keyframes scanAnimation {
|
||||
0% { top: 25%; }
|
||||
50% { top: 70%; }
|
||||
100% { top: 25%; }
|
||||
}
|
||||
`}
|
||||
</style>
|
||||
</DefaultModal>
|
||||
</div>
|
||||
<Suspense fallback={<div></div>}>
|
||||
<Routes>{accessCheckComplete && renderRoutes(routesConfig)}</Routes>
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default ProtectedRoutes;
|
||||
|
|
|
|||
2141
src/check.scss
2141
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 {
|
||||
font-size: 12px;
|
||||
font-family: VAR(--PARA_FONT_FAMILY);
|
||||
color: VAR(--ERROR_COLOR);
|
||||
font-family: var(--PARA_FONT_FAMILY);
|
||||
color: var(--ERROR_COLOR);
|
||||
}
|
||||
|
||||
/* Disable all Ant Design table animations and hover effects */
|
||||
|
|
@ -315,54 +315,6 @@ a {
|
|||
|
||||
.ant-modal .ant-modal-content {
|
||||
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,
|
||||
|
|
@ -376,249 +328,3 @@ a {
|
|||
.ant-table-tbody .ant-table-cell {
|
||||
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 { Provider } from 'react-redux';
|
||||
import { BrowserRouter } from 'react-router-dom';
|
||||
|
|
@ -9,217 +8,9 @@ import AppRoutes from './App.jsx';
|
|||
import { AuthProvider } from './AuthContext';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
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();
|
||||
|
||||
/* -------------------------------------------------------
|
||||
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(
|
||||
<StyleProvider
|
||||
hashPriority="high"
|
||||
hashed={false}
|
||||
autoClear={false}
|
||||
container={document.head}
|
||||
transformers={[legacyLogicalPropertiesTransformer]}
|
||||
>
|
||||
<ConfigProvider theme={{ hashed: false }}>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<Provider store={store}>
|
||||
<BrowserRouter>
|
||||
|
|
@ -228,11 +19,8 @@ ReactDOM.createRoot(document.getElementById('root')).render(
|
|||
</AuthProvider>
|
||||
</BrowserRouter>
|
||||
</Provider>
|
||||
|
||||
{process.env.NODE_ENV === 'development' && (
|
||||
{process.env.NODE_ENV == 'development' && (
|
||||
<ReactQueryDevtools initialIsOpen={false} />
|
||||
)}
|
||||
</QueryClientProvider>
|
||||
</ConfigProvider>
|
||||
</StyleProvider>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -676,18 +676,19 @@ const subDirectory = import.meta.env.BASE_URL;
|
|||
const apiCommonUrl = import.meta.env.ENV_API_URL_COMMON;
|
||||
|
||||
const initSession = () => {
|
||||
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'
|
||||
);
|
||||
sessionStore('AppId', 1);
|
||||
sessionStore('BranchId', 121);
|
||||
sessionStore('AppName', 'Bakery');
|
||||
sessionStore('CompId', 72);
|
||||
sessionStore('MobileNo', '8072329153');
|
||||
sessionStore('UserType', 'Admin');
|
||||
sessionStore('UserId', 39);
|
||||
sessionStore('userName', 'Karthiga');
|
||||
|
||||
sessionStorage.setItem(
|
||||
'auth',
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiODA3MjMyOTE1MyIsIlBhc3N3b3JkIjoiWkB6MTIzNCIsImF1ZCI6WyJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTIiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTQiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiXSwiZXhwIjoxNzc0Mzc5NTY2LCJpc3MiOiJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMDEifQ.uTdcz-FHE4GTux7FTtT2pQt9gEe-17_mIrwJWbHdHE8'
|
||||
);
|
||||
};
|
||||
|
||||
const getAppType = async () => {
|
||||
|
|
@ -778,13 +779,13 @@ export const routesConfig = [
|
|||
},
|
||||
|
||||
{
|
||||
path: `${subDirectory}`,
|
||||
path: `${subDirectory}app-page`,
|
||||
component: React.lazy(() =>
|
||||
fetchComponent().then((module) => ({ default: module.default }))
|
||||
),
|
||||
children: [
|
||||
{
|
||||
path: '/',
|
||||
path: 'home',
|
||||
component: React.lazy(() =>
|
||||
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 react from "@vitejs/plugin-react";
|
||||
import legacy from '@vitejs/plugin-legacy';
|
||||
import esbuild from 'esbuild';
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
const isProd = mode === "production";
|
||||
|
||||
return {
|
||||
oxc: {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
plugins: [react()],
|
||||
|
||||
|
||||
base: isProd ? "/" : "/", //for capcitor base: isProd ? "/" : "/",
|
||||
base: isProd ? "/apps/retail/" : "/", //for capcitor base: isProd ? "/" : "/",
|
||||
|
||||
envDir: "src",
|
||||
envPrefix: "ENV_",
|
||||
|
|
|
|||
Loading…
Reference in New Issue