Compare commits

...

12 Commits

Author SHA1 Message Date
Karthikalakshmi ddeed6d14a Initial commit 2026-04-02 11:06:57 +05:30
Karthikalakshmi 1a7870a9ed Fix #334 Vite run lower version 2026-04-01 17:59:05 +05:30
karthikalakshmi 0d570f6c9e Merge pull request 'Fix #330 Missed android functionality' (#331) from CapacitorAndroidfoldermove into main
Reviewed-on: Pozomind/pozo-retail-app#331
2026-03-31 18:55:12 +05:30
karthikalakshmi 1ed7ec2bbb Fix #330 Missed android functionality 2026-03-31 18:54:18 +05:30
karthikalakshmi 02843b1990 Merge pull request 'remove readmefile' (#328) from poorinima_print4_style into main
Reviewed-on: Pozomind/pozo-retail-app#328
2026-03-31 17:14:54 +05:30
karthikalakshmi 01fecaebcf Merge pull request 'Bug Fixing' (#329) from srinath into main
Reviewed-on: Pozomind/pozo-retail-app#329
2026-03-31 17:14:30 +05:30
Srinath 8d07176b38 Bug Fixing 2026-03-31 17:13:50 +05:30
Tamilselvan e308b24728 remove readme file 2026-03-31 11:00:53 +05:30
Tamilselvan a9702c9e57 Merge branch 'main' of http://192.168.1.62:3000/Pozomind/pozo-retail-app into poorinima_print4_style 2026-03-31 10:56:59 +05:30
karthikalakshmi f0b8c20e0a Merge pull request 'Fix #324 Capacitor weightscale Integration' (#327) from CapacitorAndroidfoldermove into main
Reviewed-on: Pozomind/pozo-retail-app#327
2026-03-30 18:41:24 +05:30
karthikalakshmi a976e8956d Fix #324 Capacitor weightscale Integration 2026-03-30 18:40:34 +05:30
Tamilselvan df6f4af53e added phoneumber name address in the preference 2026-03-30 18:36:31 +05:30
38 changed files with 7491 additions and 7933 deletions

BIN
April 2 retail code.zip Normal file

Binary file not shown.

2556
README.md

File diff suppressed because it is too large Load Diff

View File

@ -49,7 +49,7 @@
</provider> </provider>
</application> </application>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.USB_PERMISSION" /> <uses-permission android:name="android.permission.USB_PERMISSION" />
<uses-feature android:name="android.hardware.usb.host" /> <uses-feature android:name="android.hardware.usb.host" />

View File

@ -3,9 +3,14 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" href="/fav.ico" /> <link rel="icon" href="/fav.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=1" /> <meta
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/antd/dist/reset.css" /> name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=no"
/>
<!-- <link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/antd/dist/reset.css"
/> -->
<link rel="preconnect" href="https://fonts.googleapis.com" /> <link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
@ -77,7 +82,18 @@
} }
}); });
</script> --> </script> -->
<!-- <script src="https://cdn.jsdelivr.net/npm/eruda"></script> <!-- public/index.html -->
<script>
// Safety check for older WebViews
try {
document.querySelector(":where(div)");
} catch (e) {
console.warn(
"Old WebView detected - StyleProvider fix should handle this",
);
}
</script>
<script src="https://cdn.jsdelivr.net/npm/eruda"></script>
<script src="https://cdn.jsdelivr.net/npm/eruda-network"></script> <script src="https://cdn.jsdelivr.net/npm/eruda-network"></script>
<script> <script>
(function () { (function () {
@ -125,7 +141,107 @@
} }
}, 2000); }, 2000);
})(); })();
</script> --> </script>
<style>
/* ============================================
Android POS - Global Fixes
Targets Android WebView (Chrome 83 and below)
where flex `gap` is NOT supported
============================================ */
html,
body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
-webkit-user-select: none;
user-select: none;
-webkit-touch-callout: none;
}
/* ============================================
FIX 1: flex gap fallback for Android WebView
`gap` in flexbox needs Chrome 84+.
We use margin-based spacing as a universal fallback.
This targets ALL flex containers globally.
============================================ */
/* Ant Design specific flex gap fixes */
.ant-space-horizontal > .ant-space-item:not(:last-child) {
margin-right: 8px !important;
}
.ant-space-vertical > .ant-space-item:not(:last-child) {
margin-bottom: 8px !important;
}
/* Ant Design Row/Col gap fix */
.ant-row {
display: -webkit-box !important;
display: -webkit-flex !important;
display: flex !important;
-webkit-flex-wrap: wrap !important;
flex-wrap: wrap !important;
}
/* ============================================
FIX 2: :where() selector fallback for Chrome 83
Ant Design v5 uses :where() which breaks on
older Android WebViews
============================================ */
.ant-btn {
display: inline-block;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.ant-form-item {
display: block;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Flex display with webkit prefix for old WebViews */
.ant-flex,
.ant-space,
.ant-row,
.ant-card,
.ant-card-body {
display: -webkit-box !important;
display: -webkit-flex !important;
display: flex !important;
}
/* ============================================
FIX 3: Ant Design Modal Override for Android
============================================ */
.ant-modal-wrap {
position: fixed !important;
top: 0 !important;
left: 0 !important;
width: 100% !important;
height: 100% !important;
/* z-index: 1000 !important; */
}
.ant-modal {
margin: 0 !important;
}
/* ============================================
FIX 4: Safe area support for notch devices
============================================ */
@supports (padding: max(0px)) {
body {
padding-left: env(safe-area-inset-left);
padding-right: env(safe-area-inset-right);
padding-top: env(safe-area-inset-top);
padding-bottom: env(safe-area-inset-bottom);
}
}
</style>
</head> </head>
<body> <body>

3886
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,6 @@
"@tanstack/react-query-devtools": "^5.91.1", "@tanstack/react-query-devtools": "^5.91.1",
"@tanstack/react-virtual": "^3.13.18", "@tanstack/react-virtual": "^3.13.18",
"@types/node": "^25.5.0", "@types/node": "^25.5.0",
"@vitejs/plugin-legacy": "^8.0.1",
"@zxing/library": "^0.21.3", "@zxing/library": "^0.21.3",
"antd": "^5.17.4", "antd": "^5.17.4",
"antd-img-crop": "^4.22.0", "antd-img-crop": "^4.22.0",
@ -90,6 +89,7 @@
"devDependencies": { "devDependencies": {
"@types/react": "^18.3.3", "@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0", "@types/react-dom": "^18.3.0",
"@vitejs/plugin-legacy": "^8.0.0",
"@vitejs/plugin-react": "^6.0.1", "@vitejs/plugin-react": "^6.0.1",
"esbuild": "^0.27.4", "esbuild": "^0.27.4",
"eslint": "^8.57.0", "eslint": "^8.57.0",
@ -98,7 +98,7 @@
"eslint-plugin-react-refresh": "^0.4.7", "eslint-plugin-react-refresh": "^0.4.7",
"prettier": "^3.5.3", "prettier": "^3.5.3",
"rollup-plugin-obfuscator": "^1.1.0", "rollup-plugin-obfuscator": "^1.1.0",
"sass": "^1.98.0", "sass": "^1.77.2",
"terser": "^5.31.3", "terser": "^5.31.3",
"vite": "^8.0.0", "vite": "^8.0.0",
"vite-plugin-obfuscator": "^1.0.5", "vite-plugin-obfuscator": "^1.0.5",

View File

@ -2,13 +2,13 @@ ENV_BASE_URL='/'
ENV_COMMON_BASE_URL='http://192.168.1.16:3000/' ENV_COMMON_BASE_URL='http://192.168.1.16:3000/'
# ENV_API_URL='http://192.168.1.25:8001' # ENV_API_URL='http://192.168.1.25:8001'
# ENV_API_URL='http://api.pozo.co.in/Retailapi_UnderTest' # ENV_API_URL='http://api.pozo.co.in/Retailapi_UnderTest'
# ENV_API_URL='https://api.pozo.dev/pozo-retail-api' ENV_API_URL='https://api.pozo.dev/pozo-retail-api'
# ENV_API_URL_COMMON='https://api.pozo.dev/pozo-common-api' ENV_API_URL_COMMON='https://api.pozo.dev/pozo-common-api'
# ENV_API_URL_TOKEN='https://api.pozo.dev/JwtToken' ENV_API_URL_TOKEN='https://api.pozo.dev/JwtToken'
ENV_API_URL='http://192.168.1.37:8012' # ENV_API_URL='http://192.168.1.37:8012'
ENV_API_URL_COMMON='http://192.168.1.37:8013' # ENV_API_URL_COMMON='http://192.168.1.37:8013'
ENV_API_URL_TOKEN='http://192.168.1.37:8001' # ENV_API_URL_TOKEN='http://192.168.1.37:8001'
ENV_API_URL_OCR='http://192.168.1.37:8070' # ENV_API_URL_OCR='http://192.168.1.37:8070'
# ENV_API_URL='https://api.pozo.app/pozo-retail-api' # ENV_API_URL='https://api.pozo.app/pozo-retail-api'
# ENV_API_URL_COMMON='https://api.pozo.app/pozo-common-api' # ENV_API_URL_COMMON='https://api.pozo.app/pozo-common-api'
# ENV_API_URL_TOKEN='https://api.pozo.app/JwtToken' # ENV_API_URL_TOKEN='https://api.pozo.app/JwtToken'

View File

@ -20,48 +20,48 @@
# live Server (173 server) # live Server (173 server)
ENV_BASE_URL='/apps/retail/' # ENV_BASE_URL='/apps/retail/'
ENV_COMMON_BASE_URL='https://pozo.app' # ENV_COMMON_BASE_URL='https://pozo.app'
ENV_API_URL='https://api.pozo.app/pozo-retail-api' # ENV_API_URL='https://api.pozo.app/pozo-retail-api'
ENV_API_URL_COMMON='https://api.pozo.app/pozo-common-api' # ENV_API_URL_COMMON='https://api.pozo.app/pozo-common-api'
ENV_API_URL_TOKEN='https://api.pozo.app/JwtToken' # ENV_API_URL_TOKEN='https://api.pozo.app/JwtToken'
ENV_API_URL_OCR='http://192.168.1.37:8070' # ENV_API_URL_OCR='http://192.168.1.37:8070'
ENV_IMAGE_UPLOAD_API_URL="https://api.pozo.app/pozo-common-image-api/" # ENV_IMAGE_UPLOAD_API_URL="https://api.pozo.app/pozo-common-image-api/"
ENV_SECRET_KEY="3a939a2eed2cca4b64cd47f51b23b135b2b9b765273f695d47682ea803c8429d" # ENV_SECRET_KEY="3a939a2eed2cca4b64cd47f51b23b135b2b9b765273f695d47682ea803c8429d"
ENV_URL_SECRET_KEY="f2ef79b8b2d4fc1cc569726a5a753552257b4ff2872d6a71cf3119bce3f07c1b" # ENV_URL_SECRET_KEY="f2ef79b8b2d4fc1cc569726a5a753552257b4ff2872d6a71cf3119bce3f07c1b"
ENV_MAIN_BASE_URL='https://pozo.app/apps/retail/' # ENV_MAIN_BASE_URL='https://pozo.app/apps/retail/'
ENV_CUSTOM_PAYMENT_URL='https://pozo.app/CustomPaymentGateway/CustomPaymentGateway' # ENV_CUSTOM_PAYMENT_URL='https://pozo.app/CustomPaymentGateway/CustomPaymentGateway'
ENV_IFSC_API_URL = "https://ifsc.razorpay.com" # ENV_IFSC_API_URL = "https://ifsc.razorpay.com"
ENV_PAYMENT_DEVICE_URL='https://pozo.app/PaymentDevice/PaymentDevice/api/upload-transaction' # ENV_PAYMENT_DEVICE_URL='https://pozo.app/PaymentDevice/PaymentDevice/api/upload-transaction'
ENV_PAYMENT_STATUS_GET_URL='https://pozo.app/PaymentDevice/PaymentDevice/api/get-transaction-status' # ENV_PAYMENT_STATUS_GET_URL='https://pozo.app/PaymentDevice/PaymentDevice/api/get-transaction-status'
ENV_ANDROID_PRINTER= 'https://pozo.app/downloads/resources/POZO%20Printer.apk' # ENV_ANDROID_PRINTER= 'https://pozo.app/downloads/resources/POZO%20Printer.apk'
ENV_ANDROID_KIOSK= 'https://pozo.app/downloads/resources/POZO%20KIOSK.apk' # ENV_ANDROID_KIOSK= 'https://pozo.app/downloads/resources/POZO%20KIOSK.apk'
ENV_ANDROID_HANDHELD= 'https://pozo.app/downloads/resources/Handheld.apk' # ENV_ANDROID_HANDHELD= 'https://pozo.app/downloads/resources/Handheld.apk'
ENV_ANDROID_BILLING= 'https://pozo.app/downloads/resources/PozoApp.apk' # ENV_ANDROID_BILLING= 'https://pozo.app/downloads/resources/PozoApp.apk'
ENV_EMAIL_API='https://api.pozo.app/pozo-sms-email-template-api' # ENV_EMAIL_API='https://api.pozo.app/pozo-sms-email-template-api'
ENV_SIGNALR_SERVER_URL='https://api.pozo.app/' # ENV_SIGNALR_SERVER_URL='https://api.pozo.app/'
#(172 server) #(172 server)
# ENV_BASE_URL='/apps/retail/' ENV_BASE_URL='/'
# ENV_COMMON_BASE_URL='https://pozo.dev' ENV_COMMON_BASE_URL='https://pozo.dev'
# ENV_API_URL='https://api.pozo.dev/pozo-retail-api' ENV_API_URL='https://api.pozo.dev/pozo-retail-api'
# ENV_API_URL_COMMON='https://api.pozo.dev/pozo-common-api' ENV_API_URL_COMMON='https://api.pozo.dev/pozo-common-api'
# ENV_API_URL_TOKEN='https://api.pozo.dev/JwtToken' ENV_API_URL_TOKEN='https://api.pozo.dev/JwtToken'
# ENV_API_URL_OCR='https://api.pozo.dev/pozo-scantext-api' ENV_API_URL_OCR='https://api.pozo.dev/pozo-scantext-api'
# ENV_IMAGE_UPLOAD_API_URL="https://api.pozo.dev/pozo-common-image-api" ENV_IMAGE_UPLOAD_API_URL="https://api.pozo.dev/pozo-common-image-api"
# ENV_SECRET_KEY="3a939a2eed2cca4b64cd47f51b23b135b2b9b765273f695d47682ea803c8429d" ENV_SECRET_KEY="3a939a2eed2cca4b64cd47f51b23b135b2b9b765273f695d47682ea803c8429d"
# ENV_URL_SECRET_KEY="f2ef79b8b2d4fc1cc569726a5a753552257b4ff2872d6a71cf3119bce3f07c1b" ENV_URL_SECRET_KEY="f2ef79b8b2d4fc1cc569726a5a753552257b4ff2872d6a71cf3119bce3f07c1b"
# ENV_MAIN_BASE_URL='https://pozo.dev/apps/retail/' ENV_MAIN_BASE_URL='https://pozo.dev/apps/retail/'
# ENV_SIGNALR_SERVER_URL='https://api.pozo.dev/' ENV_SIGNALR_SERVER_URL='https://api.pozo.dev/'
# ENV_CUSTOM_PAYMENT_URL='https://pozo.app/CustomPaymentGateway/CustomPaymentGateway' ENV_CUSTOM_PAYMENT_URL='https://pozo.app/CustomPaymentGateway/CustomPaymentGateway'
# ENV_IFSC_API_URL = "https://ifsc.razorpay.com" ENV_IFSC_API_URL = "https://ifsc.razorpay.com"
# ENV_PAYMENT_DEVICE_URL='https://pozo.dev/PaymentDevice/PaymentDevice/api/upload-transaction' ENV_PAYMENT_DEVICE_URL='https://pozo.dev/PaymentDevice/PaymentDevice/api/upload-transaction'
# ENV_PAYMENT_STATUS_GET_URL='https://pozo.dev/PaymentDevice/PaymentDevice/api/get-transaction-status' ENV_PAYMENT_STATUS_GET_URL='https://pozo.dev/PaymentDevice/PaymentDevice/api/get-transaction-status'
# # ENV_PAYMENT_DEVICE_URL='https://www.plutuscloudserviceuat.in:8201/API/CloudBasedIntegration/V1/UploadBilledTransaction' # ENV_PAYMENT_DEVICE_URL='https://www.plutuscloudserviceuat.in:8201/API/CloudBasedIntegration/V1/UploadBilledTransaction'
# # ENV_PAYMENT_STATUS_GET_URL='https://www.plutuscloudserviceuat.in:8201/API/CloudBasedIntegration/V1/GetCloudBasedTxnStatus' # ENV_PAYMENT_STATUS_GET_URL='https://www.plutuscloudserviceuat.in:8201/API/CloudBasedIntegration/V1/GetCloudBasedTxnStatus'
# ENV_ANDROID_PRINTER= 'https://pozo.dev/downloads/resources/POZO%20Printer.apk' ENV_ANDROID_PRINTER= 'https://pozo.dev/downloads/resources/POZO%20Printer.apk'
# ENV_ANDROID_KIOSK= 'https://pozo.dev/downloads/resources/POZO%20KIOSK.apk' ENV_ANDROID_KIOSK= 'https://pozo.dev/downloads/resources/POZO%20KIOSK.apk'
# ENV_ANDROID_HANDHELD= 'https://pozo.dev/downloads/resources/Handheld.apk' ENV_ANDROID_HANDHELD= 'https://pozo.dev/downloads/resources/Handheld.apk'
# ENV_ANDROID_BILLING= 'https://pozo.dev/downloads/resources/PozoApp.apk' ENV_ANDROID_BILLING= 'https://pozo.dev/downloads/resources/PozoApp.apk'
# ENV_EMAIL_API='https://api.pozo.dev/pozo-sms-email-template-api' ENV_EMAIL_API='https://api.pozo.dev/pozo-sms-email-template-api'

View File

@ -432,7 +432,7 @@ export const getCustomerForHold = createAsyncThunk(
export const getAllCustomerAndBranch = createAsyncThunk( export const getAllCustomerAndBranch = createAsyncThunk(
'product/getAllCustomerAndBranch', 'product/getAllCustomerAndBranch',
async ({ CompId, AppId, BranchId }) => { async ({ CompId, AppId, BranchId,selectedCustomertype }) => {
if ( if (
CompId != null && CompId != null &&
CompId != undefined && CompId != undefined &&
@ -442,7 +442,7 @@ export const getAllCustomerAndBranch = createAsyncThunk(
AppId != undefined AppId != undefined
) { ) {
return await axiosRetailInstanceData.get( return await axiosRetailInstanceData.get(
`/Customer/AllCustomerBranchDropdown?compId=${CompId}&branchId=${BranchId}&appId=${AppId}` `/Customer/AllCustomerBranchDropdown?compId=${CompId}&branchId=${BranchId}&appId=${AppId}&type=${selectedCustomertype}`
); );
} }
} }

View File

@ -1557,7 +1557,7 @@ const AppPage = () => {
), ),
getItem( getItem(
'HOME', 'HOME',
`${subDirectory}app-page/home`, `${subDirectory}`,
<BiHomeSmile className="iconsize" /> <BiHomeSmile className="iconsize" />
), ),
getItem( getItem(
@ -1607,7 +1607,7 @@ const AppPage = () => {
), ),
getItem( getItem(
'HOME', 'HOME',
`${subDirectory}app-page/home`, `${subDirectory}`,
<BiHomeSmile className="iconsize" /> <BiHomeSmile className="iconsize" />
), ),
getItem( getItem(
@ -1643,7 +1643,7 @@ const AppPage = () => {
getItem( getItem(
'Dashboard', 'Dashboard',
`${subDirectory}app-page/home`, `${subDirectory}`,
<MdInsertChartOutlined className="iconsize" /> <MdInsertChartOutlined className="iconsize" />
), ),
getItem('Master', `${subDirectory}master`, <MdDisplaySettings />, [ getItem('Master', `${subDirectory}master`, <MdDisplaySettings />, [
@ -2117,7 +2117,7 @@ const AppPage = () => {
getItem( getItem(
'Dashboard', 'Dashboard',
`${subDirectory}app-page/home`, `${subDirectory}`,
<MdInsertChartOutlined className="iconsize" /> <MdInsertChartOutlined className="iconsize" />
), ),
SadminUserSettingMenu?.length > 0 && SadminUserSettingMenu?.length > 0 &&
@ -2212,7 +2212,7 @@ const AppPage = () => {
), ),
getItem( getItem(
'Dashboard', 'Dashboard',
`${subDirectory}app-page/home`, `${subDirectory}`,
<MdInsertChartOutlined className="iconsize" /> <MdInsertChartOutlined className="iconsize" />
), ),
getItem('Master', `${subDirectory}master`, <MdDisplaySettings />, [ getItem('Master', `${subDirectory}master`, <MdDisplaySettings />, [
@ -2703,7 +2703,7 @@ const AppPage = () => {
), ),
getItem( getItem(
'Dashboard', 'Dashboard',
`${subDirectory}app-page/home`, `${subDirectory}`,
<MdInsertChartOutlined className="iconsize" /> <MdInsertChartOutlined className="iconsize" />
), ),
@ -2787,7 +2787,7 @@ const AppPage = () => {
// Retail Menu Flow Final END // Retail Menu Flow Final END
// *************************** */ // *************************** */
const isCurrentPath = location.pathname === `${subDirectory}app-page/home`; const isCurrentPath = location.pathname === `${subDirectory}`;
console.log(items, 'itemsitems'); console.log(items, 'itemsitems');
return ( return (
<div className="appPage"> <div className="appPage">

View File

@ -676,13 +676,7 @@ const BSNavbar1 = (props, BookingNavbar) => {
</TooltipWrapper> </TooltipWrapper>
)} )}
</div> </div>
<div
style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
}}
>
<BSNavBarWeightScale />
</div>
<div className="BSBillingNav1div2"> <div className="BSBillingNav1div2">
<div className="NavbarDivForSearch"> <div className="NavbarDivForSearch">
{/* Multiple search */} {/* Multiple search */}
@ -720,7 +714,22 @@ const BSNavbar1 = (props, BookingNavbar) => {
</> </>
)} )}
</div> </div>
{!OtherServicesglobal && (
<>
{FeatureAddonData?.FeatureDtls?.find(
(item) =>
item?.FeatureAddonName?.toLowerCase() === 'weight scale'
) && (
<div
style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
}}
>
<BSNavBarWeightScale />
</div>
)}
</>
)}
{!OtherServicesglobal && ( {!OtherServicesglobal && (
<> <>
{OpenFailData && ( {OpenFailData && (
@ -836,18 +845,7 @@ const BSNavbar1 = (props, BookingNavbar) => {
{!OtherServicesglobal && ( {!OtherServicesglobal && (
<> <>
{FeatureAddonData?.FeatureDtls?.find(
(item) =>
item?.FeatureAddonName?.toLowerCase() === 'weight scale'
) && (
<div
style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
}}
>
<BSNavBarWeightScale />
</div>
)}
{FeatureAddonData?.FeatureDtls?.find( {FeatureAddonData?.FeatureDtls?.find(
(item) => item?.FeatureAddonName?.toLowerCase() === 'preorder' (item) => item?.FeatureAddonName?.toLowerCase() === 'preorder'
) && ( ) && (
@ -1154,20 +1152,7 @@ const BSNavbar1 = (props, BookingNavbar) => {
{!OtherServicesglobal && ( {!OtherServicesglobal && (
<> <>
{/* Weight Scale */}
{FeatureAddonData?.FeatureDtls?.find(
(item) =>
item?.FeatureAddonName?.toLowerCase() === 'weight scale'
) && (
<div
className="ResNavbarIcons"
style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
}}
>
<BSNavBarWeightScale />
</div>
)}
{/* PreOrder */} {/* PreOrder */}
{FeatureAddonData?.FeatureDtls?.find( {FeatureAddonData?.FeatureDtls?.find(
(item) => item?.FeatureAddonName?.toLowerCase() === 'preorder' (item) => item?.FeatureAddonName?.toLowerCase() === 'preorder'

View File

@ -2,6 +2,7 @@ import { blobToBase64,encryptObject, pdfDiv } from "../../../../Services/Others"
import { PrintStyleFunction } from "../../../paymentpdfPage/PrintStyleFunction"; import { PrintStyleFunction } from "../../../paymentpdfPage/PrintStyleFunction";
import { Emailsend } from "../../../../Features/PurchaseOrder/PurchaseOrder"; import { Emailsend } from "../../../../Features/PurchaseOrder/PurchaseOrder";
import { PublicQrCodepost } from "../../../../Features/ConfigMasterPage/ConfigMasterPage"; import { PublicQrCodepost } from "../../../../Features/ConfigMasterPage/ConfigMasterPage";
import { downloadFile } from "../../../../utils/downloadFile";
const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL; const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
export const MobilePdfPrint = async ({ export const MobilePdfPrint = async ({
printerTemplateStyle = 'Style 13', printerTemplateStyle = 'Style 13',
@ -111,14 +112,26 @@ export const MobilePdfPrint = async ({
if (PrintComing === 'download') { if (PrintComing === 'download') {
// 📥 Download PDF // 📥 Download PDF
const link = document.createElement('a'); // const link = document.createElement('a');
link.href = URL.createObjectURL(pdfBlob); // link.href = URL.createObjectURL(pdfBlob);
link.download = `Receipt_${new Date().getTime()}.pdf`; // link.download = `Receipt_${new Date().getTime()}.pdf`;
document.body.appendChild(link); // document.body.appendChild(link);
link.click(); // link.click();
document.body.removeChild(link); // document.body.removeChild(link);
URL.revokeObjectURL(link.href); // URL.revokeObjectURL(link.href);
const buffer = await pdfBlob.arrayBuffer();
downloadFile(
buffer,
`Receipt_${new Date().getTime()}.pdf`,
"application/pdf",
(success) => {
if (!success) {
console.error('Failed to download the file. Please try again.');
}
}
);
// Clear printed orders // Clear printed orders
setPrintOrderDetails([]); setPrintOrderDetails([]);
return; return;

View File

@ -435,7 +435,8 @@ const SalesNetAmountModal = ({
color: '#2e7d32', color: '#2e7d32',
}} }}
> >
{total-RefundAmt} {/* {total-RefundAmt} */}
{total}
</td> </td>
</tr> </tr>
); );

View File

@ -335,6 +335,13 @@ const RetailBookingClosing = (props) => {
{safeRound(PaymentClosingData?.OverAllUpiAmount)} {safeRound(PaymentClosingData?.OverAllUpiAmount)}
</span> </span>
</div> </div>
{PaymentClosingData?.OverAllRefundAmount > 0 && (<div className="ClosepayBTN">
<p>Refund Amount</p>
<div>=</div>
<span style={{ color: '#28AA3A', cursor: 'pointer' }}>
{safeRound(PaymentClosingData?.OverAllRefundAmount)}
</span>
</div>)}
<div className="ClosepayBTN"> <div className="ClosepayBTN">
<p> Total Cash In Hand</p> <p> Total Cash In Hand</p>
<div>=</div> <div>=</div>

View File

@ -82,7 +82,9 @@ const SalesCountComponent = React.memo(
SelfTakeAwayAmount, SelfTakeAwayAmount,
SelfDineInAmount, SelfDineInAmount,
PreOrderAmount, PreOrderAmount,
RefundAmt RefundAmt,
DineInRefundAmount,
TakeAwayRefundAmount
} = GlobalsalesDetailData.length > 0 ? GlobalsalesDetailData[0] : {}; } = GlobalsalesDetailData.length > 0 ? GlobalsalesDetailData[0] : {};
const dispatch = useDispatch(); const dispatch = useDispatch();
@ -172,7 +174,7 @@ const SalesCountComponent = React.memo(
{takeAwayPreference && ( {takeAwayPreference && (
<p> <p>
Take Away:{' '} Take Away:{' '}
{TakeAwayOrderCount + SelfTakeAwayOrderCount || 0} {(TakeAwayOrderCount + SelfTakeAwayOrderCount || 0)}
</p> </p>
)} )}
<p>Dine In: {DineInOrderCount + SelfDineInOrderCount || 0}</p> <p>Dine In: {DineInOrderCount + SelfDineInOrderCount || 0}</p>
@ -528,6 +530,20 @@ const SalesCountComponent = React.memo(
)} )}
</div> </div>
</div> </div>
{ TakeAwayRefundAmount != 0 && <div
style={{
display: 'flex',
gap: '1rem',
justifyContent: 'flex-end',
fontFamily: 'Poppins',
}}
>
<div>Refund (-) :</div>
<div>
{safeRound(TakeAwayRefundAmount)}
</div>
</div>}
<div <div
style={{ style={{
flexGrow: 1, flexGrow: 1,
@ -548,11 +564,12 @@ const SalesCountComponent = React.memo(
<div>Total</div> <div>Total</div>
<div> <div>
{safeRound( {safeRound(
TakeAwayAmount + (TakeAwayAmount ?? 0) +
SelfTakeAwayAmount + (SelfTakeAwayAmount ?? 0) +
PreOrderAmount - (PreOrderAmount ?? 0) -
OverAllTakeAwayOfferAmount (OverAllTakeAwayOfferAmount ?? 0) -
)} (TakeAwayRefundAmount ?? 0)
)}
</div> </div>
</div> </div>
</div> </div>
@ -562,11 +579,12 @@ const SalesCountComponent = React.memo(
{isMobile ? 'TA' : 'Take Away'}:{' '} {isMobile ? 'TA' : 'Take Away'}:{' '}
<span> <span>
{safeRound( {safeRound(
(TakeAwayAmount || ((TakeAwayAmount || 0) +
0 + SelfTakeAwayAmount || (SelfTakeAwayAmount || 0) +
0 + PreOrderAmount || (PreOrderAmount || 0)) -
0) - OverAllTakeAwayOfferAmount (OverAllTakeAwayOfferAmount || 0) -
)} (TakeAwayRefundAmount || 0)
)}
</span> </span>
</p> </p>
@ -603,6 +621,21 @@ const SalesCountComponent = React.memo(
)} )}
</div> </div>
</div> </div>
{ DineInRefundAmount != 0 && <div
style={{
display: 'flex',
gap: '1rem',
justifyContent: 'flex-end',
fontFamily: 'Poppins',
}}
>
<div>Refund (-) :</div>
<div>
{safeRound(DineInRefundAmount)}
</div>
</div>}
<div <div
style={{ style={{
flexGrow: 1, flexGrow: 1,
@ -623,10 +656,11 @@ const SalesCountComponent = React.memo(
<div>Total</div> <div>Total</div>
<div> <div>
{safeRound( {safeRound(
DineInAmount + (DineInAmount ?? 0) +
SelfDineInAmount - (SelfDineInAmount ?? 0) -
OverAllDineInOfferAmount (OverAllDineInOfferAmount ?? 0) -
)} (DineInRefundAmount ?? 0)
)}
</div> </div>
</div> </div>
</div> </div>
@ -636,9 +670,10 @@ const SalesCountComponent = React.memo(
{isMobile ? 'DI' : 'Dine In'}:{' '} {isMobile ? 'DI' : 'Dine In'}:{' '}
<span> <span>
{safeRound( {safeRound(
DineInAmount + (DineInAmount ?? 0) +
SelfDineInAmount - (SelfDineInAmount ?? 0) -
OverAllDineInOfferAmount (OverAllDineInOfferAmount ?? 0) -
(DineInRefundAmount ?? 0)
)} )}
</span> </span>
</p> </p>
@ -663,12 +698,19 @@ const SalesCountComponent = React.memo(
{isMobile ? 'NA' : 'Net Amt'}:{' '} {isMobile ? 'NA' : 'Net Amt'}:{' '}
<span> <span>
{safeRound( {safeRound(
(TakeAwayAmount + (
SelfTakeAwayAmount + (TakeAwayAmount ?? 0) +
PreOrderAmount - (SelfTakeAwayAmount ?? 0) +
OverAllTakeAwayOfferAmount || 0) + (PreOrderAmount ?? 0) -
(DineInAmount + SelfDineInAmount - OverAllDineInOfferAmount) (OverAllTakeAwayOfferAmount ?? 0)
)} ) +
(
(DineInAmount ?? 0) +
(SelfDineInAmount ?? 0) -
(OverAllDineInOfferAmount ?? 0)
) -
(RefundAmt ?? 0)
)}
</span> </span>
</p> </p>
{Customisebillno && <CustomisedInvoiceChange />} {Customisebillno && <CustomisedInvoiceChange />}

View File

@ -777,6 +777,10 @@ const ChangePaymentmode = () => {
dispatch(ChangeSelectedCustDisable(false)); dispatch(ChangeSelectedCustDisable(false));
SelectCanPaymode(null); SelectCanPaymode(null);
} }
else{
setMessageType('error');
setMessageData(response?.data?.response);
}
} catch (error) { } catch (error) {
console.error('Payment mode change failed:', error); console.error('Payment mode change failed:', error);
} }

View File

@ -13,6 +13,7 @@ import {
Tooltip, Tooltip,
Space, Space,
Segmented, Segmented,
Checkbox,
} from 'antd'; } from 'antd';
import { BsUpcScan } from "react-icons/bs"; import { BsUpcScan } from "react-icons/bs";
import { import {
@ -62,7 +63,7 @@ import { getPrintSelectionComponentData } from '../../Features/ThemeChange/Theme
import { DCPDFMobilePrint } from './DCPDFMobilePrint.js'; import { DCPDFMobilePrint } from './DCPDFMobilePrint.js';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import EmailModel from '../BookingScreen/Components/UtillComponents/EmailModel.jsx'; import EmailModel from '../BookingScreen/Components/UtillComponents/EmailModel.jsx';
const DeliveryChellanForm = () => { const DeliveryChellanForm = () => {
const { SadminuserAccess } = useAuth(); const { SadminuserAccess } = useAuth();
@ -115,7 +116,8 @@ const DeliveryChellanForm = () => {
const [segmentValue, setSegmentValue] = useState("N") const [segmentValue, setSegmentValue] = useState("N")
const [selectedOrder, setSelectedOrder] = useState(); const [selectedOrder, setSelectedOrder] = useState();
const [orderTableData, setOrderTableData] = useState([]); const [orderTableData, setOrderTableData] = useState([]);
const [emailSending, setEmailSending] = useState(false); const [emailSending, setEmailSending] = useState(false);
const [selectedCustomertype, setSelectedCustomertype] = useState('N');
const items = [ const items = [
{ {
@ -132,9 +134,11 @@ const DeliveryChellanForm = () => {
useEffect(() => { useEffect(() => {
dispatch(changeBreadCrumb({ items: items })); dispatch(changeBreadCrumb({ items: items }));
getProduct(); getProduct();
fetchdata();
getPrintData(); getPrintData();
}, []); }, []);
useEffect(() => {
fetchdata();
}, [selectedCustomertype]);
useEffect(() => { useEffect(() => {
if (UserType === 'Employee') { if (UserType === 'Employee') {
@ -261,14 +265,14 @@ const DeliveryChellanForm = () => {
console.log(AllCustomer, "AllCustomerAllCustomer") console.log(AllCustomer, "AllCustomerAllCustomer")
const fetchdata = async () => { const fetchdata = async () => {
try { try {
const resCustomer = await dispatch(getAllCustomerAndBranch({ CompId, AppId, BranchId })).unwrap(); const resCustomer = await dispatch(getAllCustomerAndBranch({ CompId, AppId, BranchId, selectedCustomertype })).unwrap();
if (resCustomer?.data?.statusCode === 1) { if (resCustomer?.data?.statusCode === 1) {
setAllCustomer(resCustomer?.data?.data); setAllCustomer(resCustomer?.data?.data);
} else { } else {
setAllCustomer([]); setAllCustomer([]);
setMessageType("error"); // setMessageType("error");
setMessageData(resCustomer?.data?.response); // setMessageData(resCustomer?.data?.response);
} }
const resOrders = await dispatch(PendingOrdersDC({ CompId, AppId, BranchId })).unwrap(); const resOrders = await dispatch(PendingOrdersDC({ CompId, AppId, BranchId })).unwrap();
@ -276,8 +280,8 @@ const DeliveryChellanForm = () => {
setOrdersCustomer(resOrders?.data?.data?.PurchaseOrder); setOrdersCustomer(resOrders?.data?.data?.PurchaseOrder);
} else { } else {
setOrdersCustomer([]); setOrdersCustomer([]);
setMessageType("error"); // setMessageType("error");
setMessageData(resOrders?.data?.response); // setMessageData(resOrders?.data?.response);
} }
} catch (err) { } catch (err) {
@ -1157,7 +1161,7 @@ const DeliveryChellanForm = () => {
}; };
const handlePrint = async () => { const handlePrint = async () => {
setIsSubmitted(false); setIsSubmitted(false);
const DCstyle = await DCPrintStyleFunction( const DCstyle = await DCPrintStyleFunction(
DCPrintTemplateStyle == undefined ? 'Style 13' : DCPrintTemplateStyle); DCPrintTemplateStyle == undefined ? 'Style 13' : DCPrintTemplateStyle);
const stylesMap = { const stylesMap = {
@ -1188,8 +1192,8 @@ const DeliveryChellanForm = () => {
if (isMobile) { if (isMobile) {
DCPDFMobilePrint({ DCPDFMobilePrint({
PrintTempData: DCPrintTemplateDtl, PrintTempData: DCPrintTemplateDtl,
UserId: UserId, UserId: UserId,
dispatch dispatch
}) })
} }
else { else {
@ -1219,7 +1223,7 @@ const DeliveryChellanForm = () => {
// setPrintData(record); // setPrintData(record);
if (orderData?.CustMail) { if (orderData?.CustMail) {
setEmailSending(true); setEmailSending(true);
setTimeout(async () => { setTimeout(async () => {
try { try {
const blob = await pdfDiv('DC-Default-Print', PurchaseOrderStyle); const blob = await pdfDiv('DC-Default-Print', PurchaseOrderStyle);
@ -1242,15 +1246,15 @@ const DeliveryChellanForm = () => {
setMessageData('Email failed to send'); setMessageData('Email failed to send');
setMessageType('error'); setMessageType('error');
} }
finally{ finally {
setEmailSending(false); setEmailSending(false);
} }
}, 300); }, 300);
} else { } else {
setPendingOrderDetails(ProductDetails); setPendingOrderDetails(ProductDetails);
setPendingRecord(record); setPendingRecord(record);
setiSEmail(true); setiSEmail(true);
setIsSubmitted(false); setIsSubmitted(false);
} }
}; };
@ -1303,7 +1307,7 @@ const DeliveryChellanForm = () => {
style={{ style={{
display: 'flex', display: 'flex',
justifyContent: 'space-between', justifyContent: 'space-between',
}}> }}>
<FormHeader title={'Delivery Challan'} /> <FormHeader title={'Delivery Challan'} />
<div <div
style={{ style={{
@ -1345,7 +1349,7 @@ const DeliveryChellanForm = () => {
</div> </div>
<div className="DeliveryChellanDetails"> <div className="DeliveryChellanDetails">
{segmentValue === "N" ? <div> {segmentValue === "N" ? <div style={{ display: "flex", alignItems: "center", gap: "12px" }}>
<Form.Item <Form.Item
name="CustId" name="CustId"
rules={[ rules={[
@ -1368,6 +1372,21 @@ const DeliveryChellanForm = () => {
onChangeFunction={handleAdminUserDropDownChange} onChangeFunction={handleAdminUserDropDownChange}
/> />
</Form.Item> </Form.Item>
{/* <Form.Item> */}
<Tooltip
title="Check to view all branch customers. Uncheck to view only your branch customers.">
<Checkbox
checked={selectedCustomertype === 'Y'}
onChange={(e) => {
setSelectedCustomertype(e.target.checked ? 'Y' : 'N');
}}
> {selectedCustomertype === 'Y'
? 'All Branch'
: 'My Branch'}
</Checkbox>
</Tooltip>
{/* </Form.Item> */}
</div> : <div> </div> : <div>
<Form.Item <Form.Item
name="Order" name="Order"
@ -1722,14 +1741,14 @@ const DeliveryChellanForm = () => {
</div> </div>
} }
/> */} /> */}
{(iSEmail || emailSending )&& ( {(iSEmail || emailSending) && (
<EmailModel <EmailModel
open={iSEmail} open={iSEmail}
emailSending={emailSending} emailSending={emailSending}
handleCancel={() => setiSEmail(false)} handleCancel={() => setiSEmail(false)}
form={form} form={form}
handleSendEmailWithEnteredEmail={handleSendEmailWithEnteredEmail} handleSendEmailWithEnteredEmail={handleSendEmailWithEnteredEmail}
/>)} />)}
{PrintingData?.length > 0 && {PrintingData?.length > 0 &&
<div <div

View File

@ -1,4 +1,4 @@
import { useCallback, useEffect, useRef, useState } from 'react'; import React, { useCallback, useEffect, useRef, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { Form, Checkbox, Radio, Divider, InputNumber } from 'antd'; import { Form, Checkbox, Radio, Divider, InputNumber } from 'antd';
import { ArrowRightOutlined } from '@ant-design/icons'; import { ArrowRightOutlined } from '@ant-design/icons';
@ -30,6 +30,7 @@ const PreferenceList = ({ setting = false }) => {
const { SadminuserAccess, featureaddDetails } = useAuth(); const { SadminuserAccess, featureaddDetails } = useAuth();
const dispatch = useDispatch(); const dispatch = useDispatch();
const formRef = useRef(); const formRef = useRef();
const prevEstimateRef = useRef([]);
const CompId = getSession('CompId'); const CompId = getSession('CompId');
const BranchId = getSession('BranchId'); const BranchId = getSession('BranchId');
const AppId = getSession('AppId'); const AppId = getSession('AppId');
@ -157,6 +158,10 @@ const PreferenceList = ({ setting = false }) => {
...(allSettingsMap['estimatetitle']?.value === 'Y' ...(allSettingsMap['estimatetitle']?.value === 'Y'
? ['estimatetitle'] ? ['estimatetitle']
: []), : []),
...(allSettingsMap['estimatebrname']?.value === 'Y' ? ['estimatebrname'] : []),
...(allSettingsMap['estimatebraddress']?.value === 'Y' ? ['estimatebraddress'] : []),
...(allSettingsMap['estimatebrphone']?.value === 'Y' ? ['estimatebrphone'] : []),
], ],
scanlayout: allSettingsMap['scanlayout']?.value === 'Y', scanlayout: allSettingsMap['scanlayout']?.value === 'Y',
verifyproduct: allSettingsMap['verifyproduct']?.value === 'Y', verifyproduct: allSettingsMap['verifyproduct']?.value === 'Y',
@ -207,9 +212,9 @@ const PreferenceList = ({ setting = false }) => {
} }
}; };
}, []); }, []);
useEffect(()=>{ useEffect(() => {
fetchTableData(); fetchTableData();
},[selectedUserId]) }, [selectedUserId])
useEffect(() => { useEffect(() => {
if (settingsList) { if (settingsList) {
@ -217,6 +222,8 @@ const PreferenceList = ({ setting = false }) => {
setInitialValues(built); setInitialValues(built);
console.log(built, 'built'); console.log(built, 'built');
formRef.current?.setFieldsValue(built); formRef.current?.setFieldsValue(built);
prevEstimateRef.current = built.estimateSettings ?? [];
} }
}, [settingsList]); }, [settingsList]);
@ -311,7 +318,7 @@ const PreferenceList = ({ setting = false }) => {
}; };
const fetchTableData = async () => { const fetchTableData = async () => {
const res = await dispatch(gettableData({ CompId, BranchId, AppId,UserId:selectedUserId })).unwrap(); const res = await dispatch(gettableData({ CompId, BranchId, AppId, UserId: selectedUserId })).unwrap();
const data = { CompId, BranchId, AppId, UserId: selectedUserId }; const data = { CompId, BranchId, AppId, UserId: selectedUserId };
// const res = await dispatch(getPreferenceData(data)).unwrap(); // const res = await dispatch(getPreferenceData(data)).unwrap();
if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) { if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) {
@ -405,8 +412,15 @@ const PreferenceList = ({ setting = false }) => {
dinein: values.enabledModules, dinein: values.enabledModules,
estimation: values.enabledModules, estimation: values.enabledModules,
parking: values.enabledFeatures, parking: values.enabledFeatures,
// estimateprintheader: values.estimateSettings,
// estimatebrname: values.estimatebrname,
// estimatebraddress: values.estimatebraddress,
// estimatebrphone: values.estimatebrphone,
estimateprintheader: values.estimateSettings, estimateprintheader: values.estimateSettings,
estimatetitle: values.estimateSettings, estimatetitle: values.estimateSettings,
estimatebrname: values.estimateSettings,
estimatebraddress: values.estimateSettings,
estimatebrphone: values.estimateSettings,
offer: values.enabledFeatures, offer: values.enabledFeatures,
whatsapp: values.pdfSendOptions, whatsapp: values.pdfSendOptions,
sms: values.pdfSendOptions, sms: values.pdfSendOptions,
@ -481,51 +495,51 @@ const PreferenceList = ({ setting = false }) => {
}; };
useEffect(() => { useEffect(() => {
if (userDropDown?.length > 0 && !formRef.current?.getFieldValue("userId")) { if (userDropDown?.length > 0 && !formRef.current?.getFieldValue("userId")) {
const adminUser = userDropDown.find( const adminUser = userDropDown.find(
(user) => user.UserTypeName === "Admin" (user) => user.UserTypeName === "Admin"
); );
if (adminUser) { if (adminUser) {
formRef.current?.setFieldsValue({ formRef.current?.setFieldsValue({
userId: adminUser.UserId userId: adminUser.UserId
}); });
}
} }
} }, [userDropDown]);
}, [userDropDown]);
const UserDropDownChange = (value) => { const UserDropDownChange = (value) => {
let user = userDropDown?.find((item) => item?.UserId === value); let user = userDropDown?.find((item) => item?.UserId === value);
setSelectedUserId(user?.UserId) setSelectedUserId(user?.UserId)
formRef.current?.setFieldsValue({ formRef.current?.setFieldsValue({
userId: value, userId: value,
}); });
}; };
const userDropData = async () => { const userDropData = async () => {
const data ={ const data = {
branchId:BranchId, branchId: BranchId,
compId:CompId, compId: CompId,
appId:AppId appId: AppId
} }
const gettinguserDropDown = await dispatch(getBranchUsers(data)).unwrap(); const gettinguserDropDown = await dispatch(getBranchUsers(data)).unwrap();
// const gettinguserDropDown = await dispatch(UserDataBasedOnBranchId(BranchId)).unwrap(); // const gettinguserDropDown = await dispatch(UserDataBasedOnBranchId(BranchId)).unwrap();
if (gettinguserDropDown?.data?.statusCode === 1) { if (gettinguserDropDown?.data?.statusCode === 1) {
const finaluserDropDown = gettinguserDropDown?.data?.data?.filter((value) => value.ActiveStatus === "A"); const finaluserDropDown = gettinguserDropDown?.data?.data?.filter((value) => value.ActiveStatus === "A");
setUserDropDown(finaluserDropDown); setUserDropDown(finaluserDropDown);
if (UserType === 'Employee') { if (UserType === 'Employee') {
setSelectedUserId(UserId); setSelectedUserId(UserId);
} else { } else {
const adminUser = finaluserDropDown.find( const adminUser = finaluserDropDown.find(
(user) => user.UserTypeName === "Admin" (user) => user.UserTypeName === "Admin"
); );
if (adminUser) { if (adminUser) {
setSelectedUserId(adminUser.UserId); setSelectedUserId(adminUser.UserId);
}
} }
} }
} };
};
const renderCheckbox = (name, label) => const renderCheckbox = (name, label) =>
allSettingsMap[name] !== undefined && ( allSettingsMap[name] !== undefined && (
@ -533,6 +547,53 @@ const userDropData = async () => {
<Checkbox>Yes</Checkbox> <Checkbox>Yes</Checkbox>
</Form.Item> </Form.Item>
); );
const ESTIMATE_PRINT_SETTINGS = [
{
key: 'estimateprintheader',
label: 'Show shop header',
children: [
{ key: 'estimatebrname', label: 'name' },
{ key: 'estimatebraddress', label: 'address' },
{ key: 'estimatebrphone', label: 'phone number' },
],
},
{
key: 'estimatetitle',
label: 'Show "Estimate" title',
children: [],
},
];
const handleEstimateChange = (checkedValues) => {
const prev = prevEstimateRef.current;
let updated = [...checkedValues];
ESTIMATE_PRINT_SETTINGS.forEach(({ key, children }) => {
if (!children.length) return;
const childKeys = children
.filter((c) => allSettingsMap[c.key] !== undefined)
.map((c) => c.key);
const parentJustChecked = checkedValues.includes(key) && !prev.includes(key);
// Parent just checked add all children
if (parentJustChecked) {
updated = [...new Set([...updated, ...childKeys])];
}
// Calculate AFTER updated may have changed above
const anyChildChecked = childKeys.some((c) => updated.includes(c));
// All children removed remove parent
if (updated.includes(key) && !anyChildChecked) { // uses variable, no duplicate
updated = updated.filter((v) => v !== key);
}
});
prevEstimateRef.current = updated;
formRef.current?.setFieldValue('estimateSettings', updated);
};
return ( return (
<> <>
@ -621,7 +682,7 @@ const userDropData = async () => {
initialValues={initialValues} initialValues={initialValues}
className="preferences-list" className="preferences-list"
> >
{(UserType === 'Admin' || UserType === 'Super Admin' || UserType === 'Super Admin User')&& ( <span> {(UserType === 'Admin' || UserType === 'Super Admin' || UserType === 'Super Admin User') && (<span>
<Form.Item <Form.Item
name="userId" name="userId"
rules={[ rules={[
@ -1164,26 +1225,33 @@ const userDropData = async () => {
'mobilea4', 'mobilea4',
'Prefer printing in A4/A5 on mobile?' 'Prefer printing in A4/A5 on mobile?'
)} )}
{(allSettingsMap['estimateprintheader'] !== undefined || {ESTIMATE_PRINT_SETTINGS.some(({ key }) => allSettingsMap[key] !== undefined) && (
allSettingsMap['estimatetitle'] !== undefined) && ( <Form.Item noStyle shouldUpdate>
<Form.Item {({ getFieldValue }) => (
name="estimateSettings" <Form.Item name="estimateSettings" label="Estimate Print Settings :">
label="Estimate Print Settings :" <Checkbox.Group onChange={(vals) => handleEstimateChange(vals, formRef)}>
> {ESTIMATE_PRINT_SETTINGS
<Checkbox.Group> .filter(({ key }) => allSettingsMap[key] !== undefined)
{allSettingsMap['estimateprintheader'] !== undefined && ( .map(({ key, label, children }) => (
<Checkbox value="estimateprintheader"> <React.Fragment key={key}>
Show shop header (Name, Address, GST) <Checkbox value={key}>{label}</Checkbox>
</Checkbox>
)} {children.length > 0 &&
{allSettingsMap['estimatetitle'] !== undefined && ( getFieldValue('estimateSettings')?.includes(key) &&
<Checkbox value="estimatetitle"> children
Show Estimate (R/W) title .filter((child) => allSettingsMap[child.key] !== undefined)
</Checkbox> .map((child) => (
)} <Checkbox key={child.key} value={child.key}>
</Checkbox.Group> {child.label}
</Form.Item> </Checkbox>
)} ))}
</React.Fragment>
))}
</Checkbox.Group>
</Form.Item>
)}
</Form.Item>
)}
</div> </div>
<div className="PreferencesBTN"> <div className="PreferencesBTN">
<Buttons <Buttons

View File

@ -101,6 +101,7 @@ const ProductForm = ({ formType }) => {
const state = location?.state; const state = location?.state;
const editstate = state?.editstate; const editstate = state?.editstate;
console.log(editstate,'editstate23233232');
const formRef = useRef(null); const formRef = useRef(null);
const formCategoryRef = useRef(null); const formCategoryRef = useRef(null);

View File

@ -177,6 +177,8 @@ const TurboAddForm = () => {
const prodSubCategories = useSelector(prodSubCatDataSelector); const prodSubCategories = useSelector(prodSubCatDataSelector);
const allProdSubCategories = useSelector(allProdSubCatDataSelector); const allProdSubCategories = useSelector(allProdSubCatDataSelector);
const searchText = useSelector(GlobalSearchData); const searchText = useSelector(GlobalSearchData);
console.log(searchText,"GlobalSearchData");
console.log("new console")
// Session data // Session data
const AppId = useMemo(() => getSession('AppId'), []); const AppId = useMemo(() => getSession('AppId'), []);
const CompId = useMemo(() => getSession('CompId'), []); const CompId = useMemo(() => getSession('CompId'), []);
@ -1957,7 +1959,8 @@ const TurboAddForm = () => {
<BarCodeScan <BarCodeScan
style={{ FontSize: '12px', marginLeft: '8px' }} style={{ FontSize: '12px', marginLeft: '8px' }}
onScan={(value) => { onScan={(value) => {
changeSearchedData(value); console.log('Scanned value:', value);
handleQrData(value);
}} }}
/> />
)} )}

View File

@ -64,7 +64,7 @@ const DateWiseReport = () => {
setting?.SettingIdName?.toLowerCase() === 'mobilea4' && setting?.SettingIdName?.toLowerCase() === 'mobilea4' &&
setting?.SettingValue === 'Y' setting?.SettingValue === 'Y'
); );
console.log(MobileA4Print,SettingDataSelector, 'MobileA4PrintMobileA4Print'); console.log(MobileA4Print, SettingDataSelector, 'MobileA4PrintMobileA4Print');
useEffect(() => { useEffect(() => {
if (dataSource?.length > 0) { if (dataSource?.length > 0) {
@ -143,22 +143,22 @@ const DateWiseReport = () => {
const Billamountspace = Math.max( const Billamountspace = Math.max(
0, 0,
6 - 6 -
String( String(
(AppType (AppType
? datewiseData?.[0]?.WholeSaleExpenseNetAmount ? datewiseData?.[0]?.WholeSaleExpenseNetAmount
: datewiseData?.[0]?.TotalBillAmount : datewiseData?.[0]?.TotalBillAmount
)?.toFixed(2) )?.toFixed(2)
).length ).length
); );
const Taxamountspace = Math.max( const Taxamountspace = Math.max(
0, 0,
6 - 6 -
String( String(
(AppType (AppType
? datewiseData?.[0]?.WholeSaleExpenseTaxAmount ? datewiseData?.[0]?.WholeSaleExpenseTaxAmount
: datewiseData?.[0]?.TaxAmount : datewiseData?.[0]?.TaxAmount
)?.toFixed(2) )?.toFixed(2)
).length ).length
); );
const Chargesamountspace = Math.max( const Chargesamountspace = Math.max(
0, 0,
@ -171,22 +171,22 @@ const DateWiseReport = () => {
const Discountamountspace = Math.max( const Discountamountspace = Math.max(
0, 0,
6 - 6 -
String( String(
(AppType (AppType
? datewiseData?.[0]?.WholeSaleExpenseTotalOverallDisc ? datewiseData?.[0]?.WholeSaleExpenseTotalOverallDisc
: datewiseData?.[0]?.TotalOfferAmount : datewiseData?.[0]?.TotalOfferAmount
)?.toFixed(2) )?.toFixed(2)
).length ).length
); );
const Netamountspace = Math.max( const Netamountspace = Math.max(
0, 0,
6 - 6 -
String( String(
(AppType (AppType
? datewiseData?.[0]?.WholeSaleExpenseNetAmount ? datewiseData?.[0]?.WholeSaleExpenseNetAmount
: datewiseData?.[0]?.TotalNetAmount : datewiseData?.[0]?.TotalNetAmount
)?.toFixed(2) )?.toFixed(2)
).length ).length
); );
var data = datewiseData && datewiseData[0] ? datewiseData[0] : {}; var data = datewiseData && datewiseData[0] ? datewiseData[0] : {};
var receiptTextdata = var receiptTextdata =
@ -209,8 +209,8 @@ const DateWiseReport = () => {
parseFloat( parseFloat(
!AppType !AppType
? (data?.TotalBillAmount || 0) - ? (data?.TotalBillAmount || 0) -
(data?.TotalExtraChargeAmount || 0) + (data?.TotalExtraChargeAmount || 0) +
(data?.TotalOfferAmount || 0) (data?.TotalOfferAmount || 0)
: data?.WholeSaleExpenseNetAmount || 0 : data?.WholeSaleExpenseNetAmount || 0
).toFixed(2) + ).toFixed(2) +
' '.repeat(Billamountspace) + ' '.repeat(Billamountspace) +
@ -265,7 +265,7 @@ const DateWiseReport = () => {
AppType AppType
? datewiseData?.[0]?.WholeSaleExpenseNetAmount || 0 ? datewiseData?.[0]?.WholeSaleExpenseNetAmount || 0
: datewiseData?.[0]?.TotalNetAmount + : datewiseData?.[0]?.TotalNetAmount +
(datewiseData?.[0]?.PreOrderNetAmount || 0) || 0 (datewiseData?.[0]?.PreOrderNetAmount || 0) || 0
) )
).toFixed(2) + ).toFixed(2) +
' '.repeat(Netamountspace) + ' '.repeat(Netamountspace) +
@ -369,7 +369,7 @@ const DateWiseReport = () => {
}, []); }, []);
const getPreference = async () => { const getPreference = async () => {
const data = { AppId: AppId, CompId: CompId, BranchId: BranchId,UserId: sessionuserid }; const data = { AppId: AppId, CompId: CompId, BranchId: BranchId, UserId: sessionuserid };
const { data: res } = await dispatch(getPreferenceData(data)).unwrap(); const { data: res } = await dispatch(getPreferenceData(data)).unwrap();
const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find( const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find(
(setting) => (setting) =>
@ -552,33 +552,33 @@ const DateWiseReport = () => {
// printStyle: style, // printStyle: style,
// }); // });
// } else { // } else {
var textEncoded = encodeURI(receiptText); var textEncoded = encodeURI(receiptText);
var TypeCheck = 'PrintReceipt'; var TypeCheck = 'PrintReceipt';
var scheme = 'pozoprinter'; var scheme = 'pozoprinter';
var packageName = 'com.example.pozoprinter'; var packageName = 'com.example.pozoprinter';
window.location.href = window.location.href =
scheme + scheme +
'://' + '://' +
textEncoded + textEncoded +
'#Intent;scheme=' + '#Intent;scheme=' +
scheme + scheme +
';package=' + ';package=' +
packageName + packageName +
'ImgS' + 'ImgS' +
LogoImage + LogoImage +
'ImgE' + 'ImgE' +
TypeCheck + TypeCheck +
'TokenS' + 'TokenS' +
TokenData + TokenData +
'TokenE' + 'TokenE' +
'EstimateS' + 'EstimateS' +
'' + '' +
'EstimateE' + 'EstimateE' +
'HasFooterTextS' + 'HasFooterTextS' +
FooterPrint + FooterPrint +
'HasFooterTextE' + 'HasFooterTextE' +
';end;'; ';end;';
// } // }
} else { } else {
await printDiv('RePrint', style); await printDiv('RePrint', style);
@ -724,7 +724,7 @@ const DateWiseReport = () => {
onChangeFunction={(e) => UserDropDownChange(e)} onChangeFunction={(e) => UserDropDownChange(e)}
isOnchanges={selectedUserData ? true : false} isOnchanges={selectedUserData ? true : false}
valueData={selectedUserData} valueData={selectedUserData}
// defaultValue={LastSelectConfig} // defaultValue={LastSelectConfig}
/> />
</Form.Item> </Form.Item>
)} )}
@ -921,32 +921,38 @@ const DateWiseReport = () => {
<td> <td>
{!AppType {!AppType
? (datewiseData?.[0]?.TotalBillAmount || 0) - ? (datewiseData?.[0]?.TotalBillAmount || 0) -
(datewiseData?.[0]?.TotalExtraChargeAmount || 0) + (datewiseData?.[0]?.TotalExtraChargeAmount || 0) +
(datewiseData?.[0]?.TotalOfferAmount || 0) (datewiseData?.[0]?.TotalOfferAmount || 0)
: datewiseData?.[0]?.WholeSaleExpenseNetAmount} : datewiseData?.[0]?.WholeSaleExpenseNetAmount}
</td> </td>
</tr> </tr>
{!AppType {!AppType
? datewiseData?.[0]?.TaxAmount > 0 && ( ? datewiseData?.[0]?.TaxAmount > 0 && (
<tr> <tr>
<td>Tax</td> <td>Tax</td>
<td>{datewiseData?.[0]?.TaxAmount}</td> <td>{datewiseData?.[0]?.TaxAmount}</td>
</tr> </tr>
) )
: datewiseData?.[0]?.WholeSaleExpenseTaxAmount > 0 && ( : datewiseData?.[0]?.WholeSaleExpenseTaxAmount > 0 && (
<tr> <tr>
<td>Tax</td> <td>Tax</td>
<td> <td>
{datewiseData?.[0]?.WholeSaleExpenseTaxAmount} {datewiseData?.[0]?.WholeSaleExpenseTaxAmount}
</td> </td>
</tr> </tr>
)} )}
{datewiseData?.[0]?.TotalExtraChargeAmount > 0 && ( {datewiseData?.[0]?.TotalExtraChargeAmount > 0 && (
<tr> <tr>
<td>Charges</td> <td>Charges</td>
<td>{datewiseData?.[0]?.TotalExtraChargeAmount}</td> <td>{datewiseData?.[0]?.TotalExtraChargeAmount}</td>
</tr> </tr>
)} )}
{datewiseData?.[0]?.RefundAmount > 0 && (
<tr>
<td>Refund (-)</td>
<td>{datewiseData?.[0]?.RefundAmount}</td>
</tr>
)}
{datewiseData?.[0]?.PreOrderNetAmount > 0 && ( {datewiseData?.[0]?.PreOrderNetAmount > 0 && (
<tr> <tr>
<td>Preorder</td> <td>Preorder</td>
@ -955,23 +961,23 @@ const DateWiseReport = () => {
)} )}
{AppType {AppType
? datewiseData?.[0]?.WholeSaleExpenseTotalOverallDisc > ? datewiseData?.[0]?.WholeSaleExpenseTotalOverallDisc >
0 && ( 0 && (
<tr> <tr>
<td>Discount(-)</td> <td>Discount(-)</td>
<td> <td>
{ {
datewiseData?.[0] datewiseData?.[0]
?.WholeSaleExpenseTotalOverallDisc ?.WholeSaleExpenseTotalOverallDisc
} }
</td> </td>
</tr> </tr>
) )
: datewiseData?.[0]?.TotalOfferAmount > 0 && ( : datewiseData?.[0]?.TotalOfferAmount > 0 && (
<tr> <tr>
<td>Discount(-)</td> <td>Discount(-)</td>
<td>{datewiseData?.[0]?.TotalOfferAmount}</td> <td>{datewiseData?.[0]?.TotalOfferAmount}</td>
</tr> </tr>
)} )}
<p className="DateWiseReport-border-dashed"></p> <p className="DateWiseReport-border-dashed"></p>
<tr> <tr>
@ -979,12 +985,14 @@ const DateWiseReport = () => {
<td className="DateWiseReport-netAmount"> <td className="DateWiseReport-netAmount">
{AppType {AppType
? safeRound( ? safeRound(
datewiseData?.[0]?.WholeSaleExpenseNetAmount datewiseData?.[0]?.WholeSaleExpenseNetAmount
) || 0 ) || 0
: safeRound( : safeRound(
datewiseData?.[0]?.TotalNetAmount + (datewiseData?.[0]?.TotalBillAmount || 0) +
(datewiseData?.[0]?.PreOrderNetAmount || 0) (datewiseData?.[0]?.TaxAmount || 0) +
) || 0} (datewiseData?.[0]?.PreOrderNetAmount || 0) -
(datewiseData?.[0]?.RefundAmount || 0)
) || 0}
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -999,7 +1007,7 @@ const DateWiseReport = () => {
<Denomination onchange={handleDenominationChange} /> <Denomination onchange={handleDenominationChange} />
{TotalCashInHand[0]?.PaymentMethod === 'Cash' && {TotalCashInHand[0]?.PaymentMethod === 'Cash' &&
TotalCashInHand[0]?.NetAmount < TotalCashInHand[0]?.NetAmount <
parseInt(denominationData?.OverAllTotal) && parseInt(denominationData?.OverAllTotal) &&
parseInt(denominationData?.OverAllTotal) > 0 && ( parseInt(denominationData?.OverAllTotal) > 0 && (
<div <div
className="amountMissmatch" className="amountMissmatch"

View File

@ -436,6 +436,7 @@ const ItemWiseReport = () => {
BalanceQty:item?.BalanceQty, BalanceQty:item?.BalanceQty,
Amount: item?.TotalAmt, Amount: item?.TotalAmt,
StockAvailable:item?.StockAvailable, StockAvailable:item?.StockAvailable,
RefundAmount: item?.RefundAmount,
})); }));
const itemData = DateWisTableData; const itemData = DateWisTableData;
@ -1210,6 +1211,14 @@ const ItemWiseReport = () => {
</td> </td>
</tr> </tr>
)} )}
{ItemWiseData?.[0]?.RefundAmount > 0 && (
<tr>
<td>Refund (-) </td>
<td>
{safeRound(ItemWiseData?.[0]?.RefundAmount)}
</td>
</tr>
)}
{ItemWiseData?.[0]?.PreOrderNetAmount > 0 && ( {ItemWiseData?.[0]?.PreOrderNetAmount > 0 && (
<tr> <tr>
<td>Preorder</td> <td>Preorder</td>
@ -1243,7 +1252,7 @@ const ItemWiseReport = () => {
(ItemWiseData?.[0]?.TotalOfferAmount (ItemWiseData?.[0]?.TotalOfferAmount
? ItemWiseData?.[0]?.TotalOfferAmount ? ItemWiseData?.[0]?.TotalOfferAmount
: 0) : 0)
) || 0} ) - (ItemWiseData?.[0]?.RefundAmount || 0) || 0}
</th> </th>
</tr> </tr>
</tbody> </tbody>

View File

@ -34,6 +34,7 @@ import { useSelector } from 'react-redux';
import excelExport from '../../../Images/xls-export.png'; import excelExport from '../../../Images/xls-export.png';
import ExcelJS from 'exceljs'; import ExcelJS from 'exceljs';
import { saveAs } from 'file-saver'; import { saveAs } from 'file-saver';
import { downloadFile } from '../../../utils/downloadFile.js';
dayjs.extend(customParseFormat); dayjs.extend(customParseFormat);
@ -620,8 +621,19 @@ const LedgerReport = () => {
hours = String(hours).padStart(2, '0'); hours = String(hours).padStart(2, '0');
const fileName = `Ledger Report_${day}-${month}-${year}_${hours}-${minutes}-${ampm}.xlsx`; const fileName = `Ledger Report_${day}-${month}-${year}_${hours}-${minutes}-${ampm}.xlsx`;
downloadFile(
saveAs(blob, fileName); 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);
}; };
const FirstOrderLedgerDateRaw = dayjs(FirstOrderLedgerDate); const FirstOrderLedgerDateRaw = dayjs(FirstOrderLedgerDate);

View File

@ -57,7 +57,6 @@ const SalesRemovallist = () => {
const [Tabledata, setTabledata] = useState(); const [Tabledata, setTabledata] = useState();
const [Zero, SetZero] = useState(false); const [Zero, SetZero] = useState(false);
const [OrderProductdata, setOrderProductdata] = useState([]); const [OrderProductdata, setOrderProductdata] = useState([]);
console.log('OrderProductdata', OrderProductdata);
const [OrderDataModel, setOrderDataModal] = useState(false); const [OrderDataModel, setOrderDataModal] = useState(false);
const [PaymentModal, setPaymentModal] = useState(false); const [PaymentModal, setPaymentModal] = useState(false);
const [Paymentdata, setPaymentdata] = useState([]); const [Paymentdata, setPaymentdata] = useState([]);
@ -711,40 +710,31 @@ const SalesRemovallist = () => {
const handleSave = (row) => { const handleSave = (row) => {
const newData = [...OrderProductdata]; const newData = [...OrderProductdata];
const index = newData.findIndex((item) => row.ProdId === item.ProdId); const index = newData.findIndex((item) => row.ProdId === item.ProdId);
if (index > -1) { if (index > -1) {
const item = newData.splice(index, 1, { ...row })[0]; 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);
setOrderProductdata(item); const TotalAmount = newData.reduce(
// Recalculate offer amounts
const updatedTableData = newData.map((item) => {
if (item.ProdId === row.ProdId) {
const updatedTotalAmt = row.SalesQty * Number(row?.Rate || 0);
return {
...item,
SalesQty: item.SalesQty,
OrderQty: item.SalesQty,
TotalAmt: updatedTotalAmt, // Update the recalculated TotalAmt
};
}
const recalculatedTotalAmt = item.SalesQty * Number(item?.Rate || 0);
return {
...item,
TotalAmt: recalculatedTotalAmt, // Ensure all rows' TotalAmt are updated
};
});
const TotalAmount = updatedTableData.reduce(
(sum, item) => sum + Number(item?.TotalAmt || 0), (sum, item) => sum + Number(item?.TotalAmt || 0),
0 0
); );
setTotalAmts(TotalAmount); setTotalAmts(TotalAmount);
setOrderProductdata(updatedTableData); setOrderProductdata(newData);
} }
}; };
@ -919,19 +909,16 @@ const SalesRemovallist = () => {
); );
}); });
console.log( const totalRefundAmount = OrderProductdata.reduce(
SalesQty, (sum, prod) => sum + Number(prod?.RefundAmount || 0),
SalesQty.ProductIdentifierDtls.length, 0
matchingProducts.length,
SalesQty.ProductIdentifierDtls.length >= matchingProducts.length,
'!!!!!!!!!'
); );
if (allQtyMatch) { if (allQtyMatch) {
const postdatas = Proddata.map((item) => ({ const postdatas = Proddata?.map((item) => ({
OrderId: item?.OrderId, OrderId: item?.OrderId,
SalesId: item?.SalesId, SalesId: item?.SalesId,
OrderQty:item?.SalesId, OrderQty:item?.OrderQty,
CompId: item?.CompId, CompId: item?.CompId,
BranchId: item?.BranchId, BranchId: item?.BranchId,
OrderType: item?.OrderType, OrderType: item?.OrderType,
@ -942,7 +929,7 @@ const SalesRemovallist = () => {
ActiveStatus: item?.ActiveStatus, ActiveStatus: item?.ActiveStatus,
UpdatedBy: item?.CreatedBy, UpdatedBy: item?.CreatedBy,
AppId: item?.AppId, AppId: item?.AppId,
RefundAmount: item?.RefundAmount, RefundAmount: totalRefundAmount,
AddlInfo: item?.AddlInfo, AddlInfo: item?.AddlInfo,
BillAmount: item?.BillAmount, BillAmount: item?.BillAmount,
OverallDiscSales: item?.OverallDisc, OverallDiscSales: item?.OverallDisc,
@ -956,7 +943,8 @@ const SalesRemovallist = () => {
PaymentStatus: item?.PaymentStatus, PaymentStatus: item?.PaymentStatus,
OrderDtlDetails: OrderProductdata.map((prod) => ({ OrderDtlDetails: OrderProductdata.map((prod) => ({
ActiveStatus: prod?.ActiveStatus, // ActiveStatus: prod?.ActiveStatus,
ActiveStatus: "D",
ProdId: prod?.ProdId, ProdId: prod?.ProdId,
Type: prod?.Type, Type: prod?.Type,
// OrderQty: prod?.OrderQty, // OrderQty: prod?.OrderQty,
@ -1014,7 +1002,7 @@ const SalesRemovallist = () => {
ActiveStatus: item?.ActiveStatus, ActiveStatus: item?.ActiveStatus,
UpdatedBy: item?.CreatedBy, UpdatedBy: item?.CreatedBy,
AppId: item?.AppId, AppId: item?.AppId,
RefundAmount: item?.RefundAmount, RefundAmount: totalRefundAmount,
AddlInfo: item?.AddlInfo, AddlInfo: item?.AddlInfo,
BillAmount: item?.BillAmount, BillAmount: item?.BillAmount,
OverallDiscSales: item?.OverallDisc, OverallDiscSales: item?.OverallDisc,
@ -1071,7 +1059,7 @@ const SalesRemovallist = () => {
} else if (isIdentifyDetailsValid) { } else if (isIdentifyDetailsValid) {
// else if(isSalesQtyOldSalesQty){ // else if(isSalesQtyOldSalesQty){
const postdatas = Proddata.map((item) => ({ const postdatas = Proddata?.map((item) => ({
OrderId: item?.OrderId, OrderId: item?.OrderId,
SalesId: item?.SalesId, SalesId: item?.SalesId,
CompId: item?.CompId, CompId: item?.CompId,
@ -1084,7 +1072,7 @@ const SalesRemovallist = () => {
ActiveStatus: item?.ActiveStatus, ActiveStatus: item?.ActiveStatus,
UpdatedBy: item?.CreatedBy, UpdatedBy: item?.CreatedBy,
AppId: item?.AppId, AppId: item?.AppId,
RefundAmount: item?.RefundAmount, RefundAmount: totalRefundAmount,
AddlInfo: item?.AddlInfo, AddlInfo: item?.AddlInfo,
BillAmount: item?.BillAmount, BillAmount: item?.BillAmount,
OverallDiscSales: item?.OverallDisc, OverallDiscSales: item?.OverallDisc,

View File

@ -18,6 +18,7 @@ const DateWiseReportPdf = ({
}) => { }) => {
let PrintDetailsdata = datewiseData?.[0]?.AddressDetails?.[0]; let PrintDetailsdata = datewiseData?.[0]?.AddressDetails?.[0];
const refundAmount = datewiseData?.[0]?.RefundAmount || 0;
console.log(PrintDetailsdata, 'hhhhhhhhhhhhhhhj'); console.log(PrintDetailsdata, 'hhhhhhhhhhhhhhhj');
const [currentTime, setCurrentTime] = useState(''); const [currentTime, setCurrentTime] = useState('');
@ -285,14 +286,16 @@ const DateWiseReportPdf = ({
{TotalCharges > 0 && ( {TotalCharges > 0 && (
<p className="totaldetails"> Charges: {TotalCharges}</p> <p className="totaldetails"> Charges: {TotalCharges}</p>
)} )}
{refundAmount > 0 && (
<p className="totaldetails"> Refund: {refundAmount}</p>
)}
{TotalDiscount > 0 && ( {TotalDiscount > 0 && (
<p className="totaldetails"> Discount(-): {TotalDiscount}</p> <p className="totaldetails"> Discount(-): {TotalDiscount}</p>
)} )}
<p className="totaldetails">-------------------------</p> <p className="totaldetails">-------------------------</p>
<p className="totaldetails"> <p className="totaldetails">
{' '} {' '}
Net: {Math.round(TotalNetAmount + (TotalPreOrderAmount || 0))} Net: {Math.round(TotalBillAmount + TaxAmount + (TotalPreOrderAmount || 0) - (refundAmount))}
</p> </p>
</div> </div>
{/* current Time */} {/* current Time */}

View File

@ -177,6 +177,9 @@ const ItemWiseReportPdf = ({
{TotalCharges > 0 && ( {TotalCharges > 0 && (
<p className="totaldetails"> Charges: {parseFloat(TotalCharges).toFixed(2)}</p> <p className="totaldetails"> Charges: {parseFloat(TotalCharges).toFixed(2)}</p>
)} )}
{itemData?.[0]?.RefundAmount > 0 && (
<p className="totaldetails"> Refund: {parseFloat(itemData?.[0]?.RefundAmount).toFixed(2)}</p>
)}
{TotalDiscount > 0 && ( {TotalDiscount > 0 && (
<p className="totaldetails"> Discount(-): { parseFloat(TotalDiscount).toFixed(2)}</p> <p className="totaldetails"> Discount(-): { parseFloat(TotalDiscount).toFixed(2)}</p>
)} )}
@ -190,7 +193,7 @@ const ItemWiseReportPdf = ({
(TotalTaxAmount || 0) + (TotalTaxAmount || 0) +
(TotalCharges || 0) + (TotalCharges || 0) +
(TotalPreOrderAmount || 0) - (TotalPreOrderAmount || 0) -
(TotalDiscount || 0) (TotalDiscount || 0) - (itemData?.[0]?.RefundAmount || 0)
)} )}
</p> </p>
</div> </div>

View File

@ -11,7 +11,7 @@ import {
getCommonAppPreference, getCommonAppPreference,
changeWarehouse, changeWarehouse,
} from './Features/BrachLogin/BranchLogin.js'; } from './Features/BrachLogin/BranchLogin.js';
import { clearSession, getSession } from './Services/Others'; import { clearSession, getSession, sessionStore } from './Services/Others';
import { import {
FeatureAddon, FeatureAddon,
GlobalFeatAddOnData, GlobalFeatAddOnData,
@ -43,7 +43,18 @@ const ProtectedRoutes = ({ routesConfig }) => {
const [accessCheckComplete, setAccessCheckComplete] = useState(false); const [accessCheckComplete, setAccessCheckComplete] = useState(false);
const FeatureAddonData = useSelector(GlobalFeatAddOnData); const FeatureAddonData = useSelector(GlobalFeatAddOnData);
useTemplate(CompId, BranchId, AppId); useTemplate(CompId, BranchId, AppId);
sessionStore('AppId', 6);
sessionStore('BranchId', 556);
sessionStore('AppName', 'Bakery');
sessionStore('CompId', 462);
sessionStore('MobileNo', '6382594417');
sessionStore('UserType', 'Admin');
sessionStore('UserId', 1884);
sessionStore('userName', 'Karthiga');
sessionStore(
'auth',
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiNjM4MjU5NDQxNyIsIlBhc3N3b3JkIjoiWkB6NDEwNDg0IiwiYXVkIjpbImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tcmV0YWlsLWFwaSIsImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tY29tbW9uLWFwaSIsImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tc21zLWVtYWlsLXRlbXBsYXRlLWFwaSIsImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tY29tbW9uLWFwaSJdLCJleHAiOjE3NzUxNTgwNTIsImlzcyI6Imh0dHBzOi8vYXBpLnBvem8uZGV2L0p3dFRva2VuIn0.xPuA6vnS7UdDWAnwMLEPhV0UcqPCwtb7tllpMYjOb-A'
);
useEffect(() => { useEffect(() => {
getApplicationPreference(); getApplicationPreference();
}, []); }, []);
@ -269,221 +280,221 @@ const ProtectedRoutes = ({ routesConfig }) => {
).unwrap(); ).unwrap();
if (response?.data?.statusCode === 1) { if (response?.data?.statusCode === 1) {
if (response?.data?.data?.length == 1) { if (response?.data?.data?.length == 1) {
navigate(`${subDirectory}app-page/home`); navigate(`${subDirectory}`);
} else { } else {
navigate(`${subDirectory}app-page/branch-login`); navigate(`${subDirectory}app-page/branch-login`);
} }
} }
}; };
useEffect(() => { // useEffect(() => {
const performAccessChecks = async () => { // const performAccessChecks = async () => {
if (!hasRedirected) { // if (!hasRedirected) {
let featureAddon; // let featureAddon;
let featureAddonData; // let featureAddonData;
if (UserType !== 'Super Admin' && UserType !== 'Super Admin User') { // if (UserType !== 'Super Admin' && UserType !== 'Super Admin User') {
if (FeatureAddonData?.FeatureDtls?.length > 0) { // if (FeatureAddonData?.FeatureDtls?.length > 0) {
featureAddonData = FeatureAddonData?.FeatureDtls; // featureAddonData = FeatureAddonData?.FeatureDtls;
} else { // } else {
featureAddon = await dispatch( // featureAddon = await dispatch(
FeatureAddon({ AppId: AppId, UserId: UserId }) // FeatureAddon({ AppId: AppId, UserId: UserId })
).unwrap(); // ).unwrap();
if (featureAddon?.data?.statusCode === 1) { // if (featureAddon?.data?.statusCode === 1) {
featureAddonData = // featureAddonData =
featureAddon?.data?.data?.[0]?.FeatAddonHdr?.[0]?.FeatureDtls; // featureAddon?.data?.data?.[0]?.FeatAddonHdr?.[0]?.FeatureDtls;
} else { // } else {
featureAddonData = []; // featureAddonData = [];
} // }
} // }
} // }
const currentPath = location.pathname.replace(/\/$/, ''); // Remove trailing slash // const currentPath = location.pathname.replace(/\/$/, ''); // Remove trailing slash
let shouldNavigate = false; // let shouldNavigate = false;
// Find the current route in routesConfig based on currentPath // // Find the current route in routesConfig based on currentPath
const currentRoute = routesConfig?.find((route) => { // const currentRoute = routesConfig?.find((route) => {
if (route.path === currentPath) return true; // if (route.path === currentPath) return true;
if (route.children) { // if (route.children) {
return route.children.some((child) => { // return route.children.some((child) => {
const childPath = `${route.path}/${child.path}`; // const childPath = `${route.path}/${child.path}`;
return childPath === currentPath; // return childPath === currentPath;
}); // });
} // }
return false; // return false;
}); // });
if (!currentRoute) { // if (!currentRoute) {
// alert("Unauthorized action detected. You have been logged out.") // // alert("Unauthorized action detected. You have been logged out.")
Logout(); // Logout();
setHasRedirected(true); // setHasRedirected(true);
return; // return;
} // }
const empAccessData = getEmpAccessFromChildren( // const empAccessData = getEmpAccessFromChildren(
currentRoute, // currentRoute,
currentPath // currentPath
); // );
const accessData = getEmpAccessDataFromChildren( // const accessData = getEmpAccessDataFromChildren(
currentRoute, // currentRoute,
currentPath // currentPath
); // );
const checkPreferenceAccessData = ['Dine In', 'KOT', 'Estimate']; // const checkPreferenceAccessData = ['Dine In', 'KOT', 'Estimate'];
const checkPlanAccessData = [ // const checkPlanAccessData = [
'Product Catalogue', // 'Product Catalogue',
'Sales Setup', // 'Sales Setup',
'Print Setup', // 'Print Setup',
'Kiosk Setup', // 'Kiosk Setup',
'Kiosk Sales', // 'Kiosk Sales',
]; // ];
// Cmd it start // // Cmd it start
// if (!UserId && empAccessData != 'Public') { // // if (!UserId && empAccessData != 'Public') {
// if (!UserId && (empAccessData === "Kiosk Sales" || empAccessData === "View Bill")) { // // if (!UserId && (empAccessData === "Kiosk Sales" || empAccessData === "View Bill")) {
// // Allow KioskBookingPage to load and set session values // // // Allow KioskBookingPage to load and set session values
// setAccessCheckComplete(true); // // setAccessCheckComplete(true);
// return; // // return;
// }else{ // // }else{
// console.log("UserId is undefined, logging out..."); // // console.log("UserId is undefined, logging out...");
// // alert("User invalid. Redirecting to login...") // // // alert("User invalid. Redirecting to login...")
// sessionStorage.clear(); // // sessionStorage.clear();
// window.location.replace(`${commonUrl}`); // // window.location.replace(`${commonUrl}`);
// setHasRedirected(true); // // setHasRedirected(true);
// return; // // return;
// } // // }
// } // // }
// Cmd it End // // Cmd it End
const userAccessChecks = { // const userAccessChecks = {
'Super Admin': () => { // 'Super Admin': () => {
let empPreferenceCheck = true; // let empPreferenceCheck = true;
if (checkPreferenceAccessData.includes(empAccessData)) { // if (checkPreferenceAccessData.includes(empAccessData)) {
empPreferenceCheck = checkAccess(empAccessData); // empPreferenceCheck = checkAccess(empAccessData);
} else { // } else {
empPreferenceCheck = true; // empPreferenceCheck = true;
} // }
return !empPreferenceCheck; // return !empPreferenceCheck;
}, // },
'Super Admin User': async () => { // 'Super Admin User': async () => {
const SAdminuserPin = await dispatch( // const SAdminuserPin = await dispatch(
checkSession({ UserId, sessionId }) // checkSession({ UserId, sessionId })
).unwrap(); // ).unwrap();
if ( // if (
(SAdminuserPin?.data?.statusCode === 1 && // (SAdminuserPin?.data?.statusCode === 1 &&
SAdminuserPin?.data?.data?.filter( // SAdminuserPin?.data?.data?.filter(
(item) => // (item) =>
item?.AppId == AppId && // item?.AppId == AppId &&
item?.CompId == CompId && // item?.CompId == CompId &&
item?.BranchId == BranchId // item?.BranchId == BranchId
)?.[0]?.Status === 'L') || // )?.[0]?.Status === 'L') ||
BranchId === null || // BranchId === null ||
BranchId === '' || // BranchId === '' ||
BranchId === undefined // BranchId === undefined
) { // ) {
if (sessionStorage.getItem('BranchId') !== null) { // if (sessionStorage.getItem('BranchId') !== null) {
clearSession('BranchId'); // clearSession('BranchId');
} // }
fetchBranchData(); // fetchBranchData();
} else { // } else {
if (empAccessData) { // if (empAccessData) {
const superAdminUserAccessCheck = // const superAdminUserAccessCheck =
await checkSuperAdminUserAccess(empAccessData, currentPath); // await checkSuperAdminUserAccess(empAccessData, currentPath);
let empPreferenceCheck = true; // let empPreferenceCheck = true;
if (checkPreferenceAccessData.includes(empAccessData)) { // if (checkPreferenceAccessData.includes(empAccessData)) {
empPreferenceCheck = checkAccess(empAccessData); // empPreferenceCheck = checkAccess(empAccessData);
} else { // } else {
empPreferenceCheck = true; // empPreferenceCheck = true;
} // }
return !superAdminUserAccessCheck || !empPreferenceCheck; // return !superAdminUserAccessCheck || !empPreferenceCheck;
} else { // } else {
return false; // return false;
} // }
} // }
}, // },
Admin: () => { // Admin: () => {
if (accessData === 'Super Admin') { // if (accessData === 'Super Admin') {
return true; // return true;
} else { // } else {
let empPreferenceCheck = true; // let empPreferenceCheck = true;
let empPlanAccessCheck = true; // let empPlanAccessCheck = true;
if (checkPreferenceAccessData.includes(empAccessData)) { // if (checkPreferenceAccessData.includes(empAccessData)) {
empPreferenceCheck = checkAccess(empAccessData); // empPreferenceCheck = checkAccess(empAccessData);
} else { // } else {
empPreferenceCheck = true; // empPreferenceCheck = true;
} // }
if (checkPlanAccessData.includes(empAccessData)) { // if (checkPlanAccessData.includes(empAccessData)) {
empPlanAccessCheck = checkPlanAccess( // empPlanAccessCheck = checkPlanAccess(
empAccessData, // empAccessData,
featureAddonData // featureAddonData
); // );
} else { // } else {
empPlanAccessCheck = true; // empPlanAccessCheck = true;
} // }
return !empPreferenceCheck || !empPlanAccessCheck; // return !empPreferenceCheck || !empPlanAccessCheck;
} // }
}, // },
Employee: async () => { // Employee: async () => {
if (empAccessData && accessData !== 'Super Admin') { // if (empAccessData && accessData !== 'Super Admin') {
const empAccessCheck = await checkEmpAccess( // const empAccessCheck = await checkEmpAccess(
empAccessData, // empAccessData,
currentPath // currentPath
); // );
let empPreferenceCheck = true; // let empPreferenceCheck = true;
let empPlanAccessCheck = true; // let empPlanAccessCheck = true;
if (checkPreferenceAccessData.includes(empAccessData)) { // if (checkPreferenceAccessData.includes(empAccessData)) {
empPreferenceCheck = checkAccess(empAccessData); // empPreferenceCheck = checkAccess(empAccessData);
} else { // } else {
empPreferenceCheck = true; // empPreferenceCheck = true;
} // }
if (checkPlanAccessData.includes(empAccessData)) { // if (checkPlanAccessData.includes(empAccessData)) {
empPlanAccessCheck = checkPlanAccess( // empPlanAccessCheck = checkPlanAccess(
empAccessData, // empAccessData,
featureAddonData // featureAddonData
); // );
} else { // } else {
empPlanAccessCheck = true; // empPlanAccessCheck = true;
} // }
if (location.pathname === '/app-page/relieve-request') { // if (location.pathname === '/app-page/relieve-request') {
return false; // return false;
} // }
return ( // return (
!empAccessCheck || !empPreferenceCheck || !empPlanAccessCheck // !empAccessCheck || !empPreferenceCheck || !empPlanAccessCheck
); // );
} else { // } else {
if (accessData === 'Super Admin') { // if (accessData === 'Super Admin') {
return true; // return true;
} else { // } else {
return false; // return false;
} // }
} // }
}, // },
}; // };
if (userAccessChecks[UserType]) { // if (userAccessChecks[UserType]) {
shouldNavigate = await userAccessChecks[UserType](); // shouldNavigate = await userAccessChecks[UserType]();
} else { // } else {
shouldNavigate = true; // shouldNavigate = true;
} // }
console.log('shouldNavigate', shouldNavigate); // console.log('shouldNavigate', shouldNavigate);
if (shouldNavigate) { // if (shouldNavigate) {
// alert("Unauthorized action detected. You have been logged out.") // // alert("Unauthorized action detected. You have been logged out.")
Logout(); // Logout();
setHasRedirected(true); // setHasRedirected(true);
} else { // } else {
console.log('Access granted for current route.'); // console.log('Access granted for current route.');
} // }
setAccessCheckComplete(true); // setAccessCheckComplete(true);
} // }
}; // };
performAccessChecks(); // performAccessChecks();
}, [UserType, routesConfig, navigate, hasRedirected, location.pathname]); // }, [UserType, routesConfig, navigate, hasRedirected, location.pathname]);
const Logout = async () => { const Logout = async () => {
const status = 'N'; // replace with your actual status const status = 'N'; // replace with your actual status
@ -531,7 +542,7 @@ const ProtectedRoutes = ({ routesConfig }) => {
return ( return (
<Suspense fallback={<div></div>}> <Suspense fallback={<div></div>}>
<Routes>{accessCheckComplete && renderRoutes(routesConfig)}</Routes> <Routes>{ renderRoutes(routesConfig)}</Routes>
</Suspense> </Suspense>
); );
}; };

View File

@ -148,7 +148,6 @@ const getCapCookieData = (key) => {
}; };
export const sessionStore = (key, value) => { export const sessionStore = (key, value) => {
console.log("Storing session:", key, value);
const encryptedValue = key !== "auth" const encryptedValue = key !== "auth"
? CryptoJS.AES.encrypt(JSON.stringify(value), SECRET_KEY).toString() ? CryptoJS.AES.encrypt(JSON.stringify(value), SECRET_KEY).toString()
: value; : value;

View File

@ -1,38 +1,270 @@
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<script>
(function () {
var loc = window.location;
if (
loc.protocol === "capacitor:" ||
loc.protocol === "file:" ||
loc.href === "about:blank"
) {
var base = document.createElement("base");
base.href = "http://192.168.1.35:3015/";
document.head.appendChild(base);
window.location.replace("http://192.168.1.35:3015/");
}
})();
</script>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" href="/fav.ico" /> <link rel="icon" href="/fav.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta
name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=no"
/>
<!-- <link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/antd/dist/reset.css"
/> -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
rel="preload"
as="font"
href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,400;0,500;0,600;0,700;1,200&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&family=Manrope:wght@200;300;400;500;600;700;800&family=Montserrat:wght@400;500;600;700&family=Poppins:ital,wght@1,200&display=swap"
/>
<link
href="https://fonts.googleapis.com/css2?family=Arimo:ital,wght@0,400..700;1,400..700&family=Crimson+Pro:ital,wght@0,200..900;1,200..900&family=Dhurjati&family=Diplomata+SC&family=Inconsolata:wght@200..900&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&family=Lexend+Zetta:wght@200;300;400;500;700&family=Libre+Franklin:ital,wght@0,100..900;1,100..900&family=Podkova:wght@400..800&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto+Slab:wght@200;300;400;500;600;700&family=VT323&family=Cute+Font&family=Kumar+One&family=Lemon&family=Lily+Script+One&family=M+PLUS+Rounded+1c&family=Maiden+Orange&family=Kode+Mono:wght@400..700&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Fredoka:wght@300..700&display=swap"
rel="stylesheet"
/>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Freeman&display=swap"
rel="stylesheet"
/>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Concert+One&display=swap"
rel="stylesheet"
/>
<link <link
href="https://fonts.googleapis.com/css2?family=Calistoga&display=swap" href="https://fonts.googleapis.com/css2?family=Calistoga&display=swap"
rel="stylesheet" rel="stylesheet"
/> />
<link
href="https://fonts.googleapis.com/css2?family=Calistoga&display=swap"
rel="stylesheet"
/>
<!-- <link href="https://vjs.zencdn.net/8.3.0/video-js.css" rel="stylesheet" /> -->
<!-- <link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet"> -->
<title>Pozo Retail Software</title> <title>Pozo Retail Software</title>
<!-- mohan -->
<!-- <script>
// Disable right-cli ck menu and common hotkeys
document.addEventListener("contextmenu", (event) => event.preventDefault());
document.addEventListener("keydown", (event) => {
if (
(event.ctrlKey && event.shiftKey && ["I", "J", "C"].includes(event.key.toUpperCase())) ||
(event.ctrlKey && ["U", "S"].includes(event.key.toUpperCase())) ||
event.key === "F12"
) {
event.preventDefault();
return false;
}
});
</script> -->
<!-- public/index.html -->
<script> <script>
// Disable right-click menu and common hotkeys // Safety check for older WebViews
document.addEventListener('contextmenu', (event) => try {
event.preventDefault() document.querySelector(":where(div)");
); } catch (e) {
document.addEventListener('keydown', (event) => { console.warn(
if ( "Old WebView detected - StyleProvider fix should handle this",
(event.ctrlKey && );
event.shiftKey && }
['I', 'J', 'C'].includes(event.key.toUpperCase())) ||
(event.ctrlKey && ['U', 'S'].includes(event.key.toUpperCase())) ||
event.key === 'F12'
) {
event.preventDefault();
return false;
}
});
</script> </script>
<script src="https://cdn.jsdelivr.net/npm/eruda"></script>
<script src="https://cdn.jsdelivr.net/npm/eruda-network"></script>
<script>
(function () {
// Always enable Eruda
eruda.init();
eruda.add(erudaNetwork);
eruda.show();
console.log("✅ Eruda Debug Console Loaded (Always On)");
// Axios interceptor for API logs
setTimeout(() => {
if (window.axios) {
axios.interceptors.request.use((config) => {
console.log(
"[API Request]",
config.method?.toUpperCase(),
config.url,
config.data,
);
return config;
});
axios.interceptors.response.use(
(response) => {
console.log(
"[API Response]",
response.config.url,
response.status,
response.data,
);
return response;
},
(error) => {
console.error("[API Error]", error.config?.url, error.message);
return Promise.reject(error);
},
);
console.log("✅ Axios interceptors attached");
} else {
console.warn("⚠️ Axios not found on window");
}
}, 2000);
})();
</script>
<style>
/* ============================================
Android POS - Global Fixes
Targets Android WebView (Chrome 83 and below)
where flex `gap` is NOT supported
============================================ */
html,
body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
-webkit-user-select: none;
user-select: none;
-webkit-touch-callout: none;
}
/* ============================================
FIX 1: flex gap fallback for Android WebView
`gap` in flexbox needs Chrome 84+.
We use margin-based spacing as a universal fallback.
This targets ALL flex containers globally.
============================================ */
/* Ant Design specific flex gap fixes */
.ant-space-horizontal > .ant-space-item:not(:last-child) {
margin-right: 8px !important;
}
.ant-space-vertical > .ant-space-item:not(:last-child) {
margin-bottom: 8px !important;
}
/* Ant Design Row/Col gap fix */
.ant-row {
display: -webkit-box !important;
display: -webkit-flex !important;
display: flex !important;
-webkit-flex-wrap: wrap !important;
flex-wrap: wrap !important;
}
/* ============================================
FIX 2: :where() selector fallback for Chrome 83
Ant Design v5 uses :where() which breaks on
older Android WebViews
============================================ */
.ant-btn {
display: inline-block;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.ant-form-item {
display: block;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Flex display with webkit prefix for old WebViews */
.ant-flex,
.ant-space,
.ant-row,
.ant-card,
.ant-card-body {
display: -webkit-box !important;
display: -webkit-flex !important;
display: flex !important;
}
/* ============================================
FIX 3: Ant Design Modal Override for Android
============================================ */
.ant-modal-wrap {
position: fixed !important;
top: 0 !important;
left: 0 !important;
width: 100% !important;
height: 100% !important;
/* z-index: 1000 !important; */
}
.ant-modal {
margin: 0 !important;
}
/* ============================================
FIX 4: Safe area support for notch devices
============================================ */
@supports (padding: max(0px)) {
body {
padding-left: env(safe-area-inset-left);
padding-right: env(safe-area-inset-right);
padding-top: env(safe-area-inset-top);
padding-bottom: env(safe-area-inset-bottom);
}
}
</style>
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script type="module" src="/src/main.jsx"></script> <script type="module" src="/src/main.jsx"></script>
<script
type="module"
href="@import url('https://fonts.googleapis.com/css2?family=Calistoga&display=swap')"
></script>
<!-- <script src="https://vjs.zencdn.net/8.3.0/video.min.js"></script> -->
<!-- <script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script> -->
</body> </body>
<!-- <iframe id="ifmcontentstoprint" style="
height: 0px;
width: 0px;
position: absolute;
padding: 0px;
margin: 0px;
/* font-family: 'Poppins', sans-serif; */
"></iframe> -->
</html> </html>

View File

@ -1,539 +1,387 @@
import { useEffect, useState } from 'react'; // import React, { useRef, useState, useEffect } from "react";
import { Routes, Route, useNavigate } from 'react-router-dom'; // import { BarcodeScanner } from "@capacitor-mlkit/barcode-scanning";
import { useDispatch } from 'react-redux'; // import { BsUpcScan } from "react-icons/bs";
import { // import { BrowserMultiFormatReader } from "@zxing/library";
getEmpAccesData, // import { Capacitor } from "@capacitor/core";
GenerateLogout, // import { DefaultModal } from "../Components/Modal/DefaultModal";
getSAdminUserAccesData,
PricingAppPricingName,
checkSession,
getCompBranchData,
getCommonAppPreference,
changeWarehouse,
} from './Features/BrachLogin/BranchLogin.js';
import { clearSession, getSession } from './Services/Others';
import {
FeatureAddon,
GlobalFeatAddOnData,
} from './Features/BookingScreen/BookingData/BookingData.js';
import { Suspense } from 'react';
import { gettableData } from './Features/PreferenceMaster/PreferenceMaster.js';
import { useSelector } from 'react-redux';
import { useTemplate } from './utils/useTemplate.js';
const commonUrl = import.meta.env.ENV_COMMON_BASE_URL; // export default function BarCodeScan({ onScan }) {
const subDirectory = import.meta.env.BASE_URL; // const isMobileApp = Capacitor.getPlatform() !== "web";
// const [scanning, setScanning] = useState(false);
// const [modalOpen, setModalOpen] = useState(false);
// const videoRef = useRef(null);
// const codeReaderRef = useRef(null);
// const streamRef = useRef(null);
const ProtectedRoutes = ({ routesConfig }) => { // const startScan = async () => {
useTemplate( // if (scanning) return;
getSession('CompId'), // setScanning(true);
getSession('BranchId'),
getSession('AppId')
);
const navigate = useNavigate();
const dispatch = useDispatch();
const UserType = getSession('UserType');
const [hasRedirected, setHasRedirected] = useState(false);
const AppId = getSession('AppId');
const CompId = getSession('CompId');
const BranchId = getSession('BranchId');
const UserId = getSession('UserId');
const sessionId = getSession('SessionId');
const Warehouse = getSession('Warehouse');
const [accessCheckComplete, setAccessCheckComplete] = useState(false);
const FeatureAddonData = useSelector(GlobalFeatAddOnData);
useTemplate(CompId, BranchId, AppId);
useEffect(() => { // if (isMobileApp) {
getApplicationPreference(); // // Mobile: MLKit scanner
}, []); // try {
//sri // const perm = await BarcodeScanner.requestPermissions();
useEffect(() => { // if (perm.camera !== "granted") {
if (Warehouse) { // alert("Camera permission not granted");
dispatch(changeWarehouse(true)); // setScanning(false);
} // return;
}, [Warehouse]); // }
const getApplicationPreference = async () => {
await dispatch(getCommonAppPreference(AppId)).unwrap();
};
const getEmpAccess = async () => { // const { barcodes } = await BarcodeScanner.scan();
let data = { // if (barcodes && barcodes.length > 0) {
UserId: UserId, // onScan(barcodes[0].rawValue);
AppId: AppId, // }
CompId: CompId, // } catch (err) {
BranchId: BranchId, // alert("Error scanning barcode: " + err.message);
}; // } finally {
// setScanning(false);
// }
// } else {
// // Web: open modal and start camera
// setModalOpen(true);
// setTimeout(() => startWebScan(), 50); // wait for modal DOM
// }
// };
const response = await dispatch(getEmpAccesData(data)).unwrap(); // const startWebScan = async () => {
if (response?.data?.statusCode === 1) { // try {
return response?.data?.data?.[0]?.EmpAccessDetails; // codeReaderRef.current = new BrowserMultiFormatReader();
} // streamRef.current = await navigator.mediaDevices.getUserMedia({
return null; // video: { facingMode: "environment" },
}; // });
// if (videoRef.current) {
// videoRef.current.srcObject = streamRef.current;
// videoRef.current.play();
// }
const getSadminUserAccess = async () => { // codeReaderRef.current.decodeFromVideoDevice(
let data = { // null,
UserId: UserId, // videoRef.current,
AppId: AppId, // (result) => {
}; // if (result) {
const response = await dispatch(getSAdminUserAccesData(data)).unwrap(); // onScan(result.getText());
if (response?.data?.statusCode === 1) { // stopWebScan();
return response?.data?.data?.[0]?.AppMenuAccessDetails; // setModalOpen(false);
} // }
return null; // }
}; // );
// } catch (err) {
// alert("Error accessing camera: " + err.message);
// setScanning(false);
// setModalOpen(false);
// }
// };
const Dinein = async () => { // const stopWebScan = () => {
if (AppId && CompId && BranchId) { // if (streamRef.current) {
let DineinData = { // streamRef.current.getTracks().forEach((track) => track.stop());
AppId: AppId, // streamRef.current = null;
CompId: CompId, // }
BranchId: BranchId, // if (codeReaderRef.current) {
UserId: UserId, // codeReaderRef.current.reset();
}; // codeReaderRef.current = null;
const response = await dispatch(gettableData(DineinData)).unwrap(); // }
if (response?.data?.statusCode === 1) { // setScanning(false);
const SettingValueData = response?.data?.data // };
?.find((e) => e.AppId === AppId)
?.SettingDtlDetails?.some(
(e) => e.SettingIdName === 'DineIn' && e.SettingValue === 'Y'
);
const EstimateValueData = response?.data?.data
?.find((e) => e.AppId === AppId)
?.SettingDtlDetails?.some(
(e) => e.SettingIdName === 'Estimation' && e.SettingValue === 'Y'
);
return (SettingValueData, EstimateValueData);
}
}
};
const checkAccess = async (empAccess) => { // const closeModal = () => {
if (!empAccess) return false; // stopWebScan();
let DineinData, // setModalOpen(false);
EstimateData = await Dinein(); // };
switch (empAccess) {
case 'Dine In':
case 'KOT':
return !!DineinData;
case 'Estimate':
return !!EstimateData;
default:
return false; // Restrict access if no valid match found
}
};
const getPricingName = async () => { // // Stop camera if component unmounts
if (!AppId || !UserId) return; // useEffect(() => () => stopWebScan(), []);
const data = {
appId: AppId,
userId: UserId,
};
try {
const response = await dispatch(PricingAppPricingName(data)).unwrap();
const responseData = response?.data;
const pricingData = responseData?.data;
const hasAdvance = pricingData?.some(
(item) => item.PricingName === 'Premium'
);
const hasProOrAdvance =
hasAdvance ||
pricingData.some((item) => item.PricingName === 'Customized');
return (hasAdvance, hasProOrAdvance);
} catch (error) {
console.error('Error fetching pricing name:', error);
}
};
const checkPlanAccess = async (empAccess, featureAddonData) => { // return (
if (!empAccess) return false; // <div style={{ display: "flex", justifyContent: "center", padding: 20 }}>
let Advance, // {!scanning && (
ProORAdvance = await getPricingName(); // <BsUpcScan
switch (empAccess) { // onClick={startScan}
case 'Product Catalogue': // style={{ fontSize: 32, color: "#007bff", cursor: "pointer" }}
return ( // />
ProORAdvance || // )}
featureAddonData?.some(
(item) => item?.FeatureAddonName?.toLowerCase() === 'catalog'
)
);
case 'Sales Setup':
case 'Print Setup':
return (
Advance ||
featureAddonData?.some(
(item) =>
item?.FeatureAddonName?.toLowerCase() === 'customized template'
)
);
case 'Kiosk Setup':
case 'Kiosk Sales':
return featureAddonData?.some(
(item) => item?.FeatureAddonName?.toLowerCase() === 'kiosk sales'
);
default:
return false; // Restrict access if no valid match found
}
};
const checkEmpAccess = async (empAccess, currentPath) => { // <DefaultModal
if (!empAccess) return false; // title="Barcode Reader"
const Access = await getEmpAccess(); // width={500}
let accessType; // open={modalOpen}
if (currentPath.endsWith('/new')) { // footer={false}
accessType = 'AddAccess'; // handleCancel={() => {
} else if (currentPath.endsWith('/update')) { // closeModal();
accessType = 'UpdateAccess'; // }}
} else { // >
accessType = 'ReadAccess'; // <div
} // style={{
// const config = Access?.find(config => // display: "flex",
// config.ConfigName === empAccess && config[accessType] === 'Y' // flexDirection: "column",
// ); // alignItems: "center",
const config = Access?.find( // justifyContent: "center",
(config) => // }}
(config.ConfigName === empAccess && config[accessType] === 'Y') || // >
(currentPath.includes('supplier-master') && // <video
(config.ConfigName === 'Supplier' || // ref={videoRef}
config.ConfigName === 'Seller') && // style={{
config[accessType] === 'Y') // width: "100%",
); // maxWidth: 400,
// borderRadius: 8,
// border: "2px solid #000",
// }}
// />
return !!config; // <button
}; // onClick={closeModal}
// style={{
// marginTop: 20,
// padding: "10px 20px",
// fontSize: 16,
// borderRadius: 8,
// border: "none",
// cursor: "pointer",
// }}
// >
// Close
// </button>
// </div>
// </DefaultModal>
const checkSuperAdminUserAccess = async (empAccess, currentPath) => { // </div>
console.log('empAccessData1', empAccess, currentPath); // );
if (!empAccess) return false; // }
const Access = await getSadminUserAccess();
let accessType;
if (currentPath.endsWith('/new')) {
accessType = 'AddAccess';
} else if (currentPath.endsWith('/update')) {
accessType = 'UpdateAccess';
} else {
accessType = 'ReadAccess';
}
console.log('empAccessData2', Access, accessType);
// const config = Access?.find(config =>
// config.MenuName === empAccess && config[accessType] === 'Y'
// );
const config = Access?.find(
(config) =>
(config.MenuName === empAccess && config[accessType] === 'Y') ||
(currentPath.includes('supplier-master') &&
(config.MenuName === 'Supplier' || config.MenuName === 'Seller') &&
config[accessType] === 'Y')
);
console.log('empAccessData3', config);
return !!config; import React, { useRef, useState, useEffect } from 'react';
}; import { BarcodeScanner } from '@capacitor-mlkit/barcode-scanning';
import { BsUpcScan } from 'react-icons/bs';
import { Capacitor } from '@capacitor/core';
import { DefaultModal } from '../Components/Modal/DefaultModal';
import QrScanner from 'qr-scanner/qr-scanner.min.js';
import { BrowserMultiFormatReader, BarcodeFormat } from '@zxing/library';
const getEmpAccessFromChildren = (route, currentPath) => { QrScanner.WORKER_PATH = new URL(
if (route.path === currentPath) { 'qr-scanner/qr-scanner-worker.min.js',
return route.empAccess || null; import.meta.url
} ).toString();
if (route.children) { export default function BarCodeScan({ onScan }) {
for (const child of route.children) { const isMobileApp = Capacitor.getPlatform() !== 'web';
const childPath = `${route.path}/${child.path}`; const [scanning, setScanning] = useState(false);
if (childPath === currentPath) { const [modalOpen, setModalOpen] = useState(false);
return child.empAccess || null;
}
}
}
return null; const videoRef = useRef(null);
}; const qrScannerRef = useRef(null);
const barcodeReaderRef = useRef(null);
const getEmpAccessDataFromChildren = (route, currentPath) => { // -------------------------
if (route.path === currentPath) { // START SCAN
return route.access || null; // -------------------------
} const startScan = async () => {
if (route.children) { if (scanning) return;
for (const child of route.children) { setScanning(true);
const childPath = `${route.path}/${child.path}`;
if (childPath === currentPath) {
return child.access || null;
}
}
}
return null;
};
const fetchBranchData = async () => { if (isMobileApp) {
const response = await dispatch( try {
getCompBranchData({ CompId: CompId, AppId: AppId }) const perm = await BarcodeScanner.requestPermissions();
).unwrap(); if (perm.camera !== 'granted') {
if (response?.data?.statusCode === 1) { alert('Camera permission not granted');
if (response?.data?.data?.length == 1) { setScanning(false);
navigate(`${subDirectory}app-page/home`);
} else {
navigate(`${subDirectory}app-page/branch-login`);
}
}
};
useEffect(() => {
const performAccessChecks = async () => {
if (!hasRedirected) {
let featureAddon;
let featureAddonData;
if (UserType !== 'Super Admin' && UserType !== 'Super Admin User') {
if (FeatureAddonData?.FeatureDtls?.length > 0) {
featureAddonData = FeatureAddonData?.FeatureDtls;
} else {
featureAddon = await dispatch(
FeatureAddon({ AppId: AppId, UserId: UserId })
).unwrap();
if (featureAddon?.data?.statusCode === 1) {
featureAddonData =
featureAddon?.data?.data?.[0]?.FeatAddonHdr?.[0]?.FeatureDtls;
} else {
featureAddonData = [];
}
}
}
const currentPath = location.pathname.replace(/\/$/, ''); // Remove trailing slash
let shouldNavigate = false;
// Find the current route in routesConfig based on currentPath
const currentRoute = routesConfig?.find((route) => {
if (route.path === currentPath) return true;
if (route.children) {
return route.children.some((child) => {
const childPath = `${route.path}/${child.path}`;
return childPath === currentPath;
});
}
return false;
});
if (!currentRoute) {
// alert("Unauthorized action detected. You have been logged out.")
Logout();
setHasRedirected(true);
return; return;
} }
const empAccessData = getEmpAccessFromChildren( const { barcodes } = await BarcodeScanner.scan();
currentRoute, if (barcodes?.length > 0) {
currentPath onScan(barcodes[0].rawValue);
);
const accessData = getEmpAccessDataFromChildren(
currentRoute,
currentPath
);
const checkPreferenceAccessData = ['Dine In', 'KOT', 'Estimate'];
const checkPlanAccessData = [
'Product Catalogue',
'Sales Setup',
'Print Setup',
'Kiosk Setup',
'Kiosk Sales',
];
// Cmd it start
// if (!UserId && empAccessData != 'Public') {
// if (!UserId && (empAccessData === "Kiosk Sales" || empAccessData === "View Bill")) {
// // Allow KioskBookingPage to load and set session values
// setAccessCheckComplete(true);
// return;
// }else{
// console.log("UserId is undefined, logging out...");
// // alert("User invalid. Redirecting to login...")
// sessionStorage.clear();
// window.location.replace(`${commonUrl}`);
// setHasRedirected(true);
// return;
// }
// }
// Cmd it End
const userAccessChecks = {
'Super Admin': () => {
let empPreferenceCheck = true;
if (checkPreferenceAccessData.includes(empAccessData)) {
empPreferenceCheck = checkAccess(empAccessData);
} else {
empPreferenceCheck = true;
}
return !empPreferenceCheck;
},
'Super Admin User': async () => {
const SAdminuserPin = await dispatch(
checkSession({ UserId, sessionId })
).unwrap();
if (
(SAdminuserPin?.data?.statusCode === 1 &&
SAdminuserPin?.data?.data?.filter(
(item) =>
item?.AppId == AppId &&
item?.CompId == CompId &&
item?.BranchId == BranchId
)?.[0]?.Status === 'L') ||
BranchId === null ||
BranchId === '' ||
BranchId === undefined
) {
if (sessionStorage.getItem('BranchId') !== null) {
clearSession('BranchId');
}
fetchBranchData();
} else {
if (empAccessData) {
const superAdminUserAccessCheck =
await checkSuperAdminUserAccess(empAccessData, currentPath);
let empPreferenceCheck = true;
if (checkPreferenceAccessData.includes(empAccessData)) {
empPreferenceCheck = checkAccess(empAccessData);
} else {
empPreferenceCheck = true;
}
return !superAdminUserAccessCheck || !empPreferenceCheck;
} else {
return false;
}
}
},
Admin: () => {
if (accessData === 'Super Admin') {
return true;
} else {
let empPreferenceCheck = true;
let empPlanAccessCheck = true;
if (checkPreferenceAccessData.includes(empAccessData)) {
empPreferenceCheck = checkAccess(empAccessData);
} else {
empPreferenceCheck = true;
}
if (checkPlanAccessData.includes(empAccessData)) {
empPlanAccessCheck = checkPlanAccess(
empAccessData,
featureAddonData
);
} else {
empPlanAccessCheck = true;
}
return !empPreferenceCheck || !empPlanAccessCheck;
}
},
Employee: async () => {
if (empAccessData && accessData !== 'Super Admin') {
const empAccessCheck = await checkEmpAccess(
empAccessData,
currentPath
);
let empPreferenceCheck = true;
let empPlanAccessCheck = true;
if (checkPreferenceAccessData.includes(empAccessData)) {
empPreferenceCheck = checkAccess(empAccessData);
} else {
empPreferenceCheck = true;
}
if (checkPlanAccessData.includes(empAccessData)) {
empPlanAccessCheck = checkPlanAccess(
empAccessData,
featureAddonData
);
} else {
empPlanAccessCheck = true;
}
if (location.pathname === '/app-page/relieve-request') {
return false;
}
return (
!empAccessCheck || !empPreferenceCheck || !empPlanAccessCheck
);
} else {
if (accessData === 'Super Admin') {
return true;
} else {
return false;
}
}
},
};
if (userAccessChecks[UserType]) {
shouldNavigate = await userAccessChecks[UserType]();
} else {
shouldNavigate = true;
} }
console.log('shouldNavigate', shouldNavigate); } catch (err) {
if (shouldNavigate) { console.error(err);
// alert("Unauthorized action detected. You have been logged out.") } finally {
Logout(); setScanning(false);
setHasRedirected(true);
} else {
console.log('Access granted for current route.');
}
setAccessCheckComplete(true);
} }
}; } else {
setModalOpen(true);
performAccessChecks();
}, [UserType, routesConfig, navigate, hasRedirected, location.pathname]);
const Logout = async () => {
const status = 'N'; // replace with your actual status
const res = await dispatch(GenerateLogout({ UserId, status })).unwrap();
if (res?.data?.statusCode === 1) {
sessionStorage.clear();
window.location.replace(`${commonUrl}`);
} }
}; };
const renderRoutes = (routes) => { // -------------------------
return routes.map(({ path, component: Component, children }) => { // START WEB SCAN (HYBRID)
const fullPath = `${path}`; // -------------------------
const startWebScan = async () => {
if (!videoRef.current) return;
if (!Component) { // Start QR scanner (fast)
console.error(`Component not found for path: ${fullPath}`); qrScannerRef.current = new QrScanner(
return null; videoRef.current,
(result) => {
stopWebScan();
onScan(result.data);
setModalOpen(false);
},
{
maxScansPerSecond: 25,
} }
);
if (children) { await qrScannerRef.current.start();
return (
<Route key={fullPath} path={fullPath} element={<Component />}>
{children.map(({ path: childPath, component: ChildComponent }) => {
if (!ChildComponent) {
console.error(
`Child component not found for path: ${childPath}`
);
return null;
}
return (
<Route
key={childPath}
path={childPath}
element={<ChildComponent />}
/>
);
})}
</Route>
);
}
return <Route key={fullPath} path={fullPath} element={<Component />} />; // Start Barcode scanner (ZXing)
barcodeReaderRef.current = new BrowserMultiFormatReader(undefined, {
possibleFormats: [
BarcodeFormat.CODE_128,
BarcodeFormat.EAN_13,
BarcodeFormat.UPC_A,
BarcodeFormat.UPC_E,
],
}); });
barcodeReaderRef.current.timeBetweenDecodingAttempts = 50;
barcodeReaderRef.current.decodeFromVideoDevice(
null,
videoRef.current,
(result) => {
if (result) {
stopWebScan();
onScan(result.getText());
setModalOpen(false);
}
}
);
}; };
return ( const stopWebScan = () => {
<Suspense fallback={<div></div>}> if (qrScannerRef.current) {
<Routes>{accessCheckComplete && renderRoutes(routesConfig)}</Routes> qrScannerRef.current.stop();
</Suspense> qrScannerRef.current.destroy();
); qrScannerRef.current = null;
}; }
export default ProtectedRoutes; if (barcodeReaderRef.current) {
barcodeReaderRef.current.reset();
barcodeReaderRef.current = null;
}
setScanning(false);
};
const closeModal = () => {
stopWebScan();
setModalOpen(false);
};
useEffect(() => {
if (modalOpen) {
startWebScan();
}
}, [modalOpen]);
useEffect(() => {
return () => stopWebScan();
}, []);
return (
<div
className="BarCodeScanMaster"
style={{ display: 'flex', justifyContent: 'center', padding: 20 }}
>
{!scanning && (
<BsUpcScan
onClick={startScan}
style={{
fontSize: 32,
color: '#007bff',
cursor: 'pointer',
}}
/>
)}
<DefaultModal
title="QR / Barcode Reader"
width={500}
open={modalOpen}
footer={false}
handleCancel={closeModal}
>
<div
style={{
position: 'relative',
width: '100%',
maxWidth: 400,
margin: 'auto',
}}
>
{/* VIDEO */}
<video
ref={videoRef}
style={{
width: '100%',
borderRadius: 8,
}}
/>
{/* DARK OVERLAY */}
<div
style={{
position: 'absolute',
top: 0,
left: 0,
width: '100%',
height: '100%',
background: 'rgba(0,0,0,0.5)',
borderRadius: 8,
}}
/>
{/* SCAN BOX */}
<div
style={{
position: 'absolute',
top: '50%',
left: '50%',
width: '70%',
height: '60%',
transform: 'translate(-50%, -50%)',
border: '3px solid #00ff00',
borderRadius: 12,
boxShadow: '0 0 0 2000px rgba(0,0,0,0.4)',
}}
/>
{/* SCAN LINE */}
<div
style={{
position: 'absolute',
left: '15%',
width: '70%',
height: 2,
background: 'red',
animation: 'scanAnimation 2s infinite linear',
}}
/>
</div>
<button
onClick={closeModal}
style={{
marginTop: 20,
padding: '10px 20px',
fontSize: 16,
borderRadius: 8,
border: 'none',
cursor: 'pointer',
}}
>
Close
</button>
{/* Animation */}
<style>
{`
@keyframes scanAnimation {
0% { top: 25%; }
50% { top: 70%; }
100% { top: 25%; }
}
`}
</style>
</DefaultModal>
</div>
);
}

File diff suppressed because it is too large Load Diff

View File

@ -288,8 +288,8 @@ a {
.payment-error-msg { .payment-error-msg {
font-size: 12px; font-size: 12px;
font-family: var(--PARA_FONT_FAMILY); font-family: VAR(--PARA_FONT_FAMILY);
color: var(--ERROR_COLOR); color: VAR(--ERROR_COLOR);
} }
/* Disable all Ant Design table animations and hover effects */ /* Disable all Ant Design table animations and hover effects */
@ -315,6 +315,54 @@ a {
.ant-modal .ant-modal-content { .ant-modal .ant-modal-content {
padding: 34px !important; padding: 34px !important;
/* Android WebView 83 fix: ensure positioning context for close button */
position: relative !important;
overflow: visible !important;
}
/* ============================================
ANDROID WEBVIEW 83 - Modal Close Button Fix
On Chrome 83, position:absolute inside a flex
container loses its anchor. Force it to always
sit at top-right of the modal content box.
============================================ */
.ant-modal-close {
position: absolute !important;
top: 0 !important;
right: 0 !important;
z-index: 10 !important;
width: 44px !important;
height: 44px !important;
display: -webkit-box !important;
display: -webkit-flex !important;
display: flex !important;
-webkit-box-align: center !important;
-webkit-align-items: center !important;
align-items: center !important;
-webkit-box-pack: center !important;
-webkit-justify-content: center !important;
justify-content: center !important;
cursor: pointer !important;
background: transparent !important;
border: none !important;
padding: 0 !important;
line-height: 1 !important;
}
.ant-modal-close-x {
display: -webkit-box !important;
display: -webkit-flex !important;
display: flex !important;
-webkit-box-align: center !important;
-webkit-align-items: center !important;
align-items: center !important;
-webkit-box-pack: center !important;
-webkit-justify-content: center !important;
justify-content: center !important;
width: 100% !important;
height: 100% !important;
font-size: 16px !important;
line-height: 1 !important;
} }
.ant-table-wrapper .ant-table-thead > tr > th, .ant-table-wrapper .ant-table-thead > tr > th,
@ -328,3 +376,249 @@ a {
.ant-table-tbody .ant-table-cell { .ant-table-tbody .ant-table-cell {
font-family: 'Poppins' !important; font-family: 'Poppins' !important;
} }
.ant-modal-wrap {
display: flex;
align-items: center;
justify-content: center;
}
.ant-dropdown {
position: absolute !important;
}
/* ============================================
ANDROID WEBVIEW FLEX GAP FIX
Chrome 83 and below does not support gap in flexbox.
Use margin fallbacks instead.
============================================ */
/* Ant Design Space fix */
.ant-space {
display: -webkit-box !important;
display: -webkit-flex !important;
display: flex !important;
}
.ant-space-horizontal > .ant-space-item:not(:last-child) {
margin-right: 8px !important;
margin-bottom: 0 !important;
}
.ant-space-vertical > .ant-space-item:not(:last-child) {
margin-bottom: 8px !important;
margin-right: 0 !important;
}
/* Ant Design Row/Col grid fix */
.ant-row {
display: -webkit-box !important;
display: -webkit-flex !important;
display: flex !important;
-webkit-flex-wrap: wrap !important;
flex-wrap: wrap !important;
margin-left: -8px;
margin-right: -8px;
}
.ant-col {
padding-left: 8px;
padding-right: 8px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Global flex gap fallback for custom components.
If you use gap: Xpx on a flex container, add class
'flex-gap-8', 'flex-gap-12', 'flex-gap-16' instead */
.flex-gap-4 > *:not(:last-child) {
margin-right: 4px;
}
.flex-gap-8 > *:not(:last-child) {
margin-right: 8px;
}
.flex-gap-12 > *:not(:last-child) {
margin-right: 12px;
}
.flex-gap-16 > *:not(:last-child) {
margin-right: 16px;
}
.flex-gap-24 > *:not(:last-child) {
margin-right: 24px;
}
.flex-col-gap-4 > *:not(:last-child) {
margin-bottom: 4px;
}
.flex-col-gap-8 > *:not(:last-child) {
margin-bottom: 8px;
}
.flex-col-gap-12 > *:not(:last-child) {
margin-bottom: 12px;
}
.flex-col-gap-16 > *:not(:last-child) {
margin-bottom: 16px;
}
.flex-col-gap-24 > *:not(:last-child) {
margin-bottom: 24px;
}
/* Global old Android flex gap polyfill.
JS marks gap-using flex containers with [data-old-flex-gap="1"] and
writes --old-row-gap / --old-col-gap values per container. */
/* .old-android-webview [data-old-flex-gap] {
margin-top: calc(var(--old-row-gap) * -0.5);
margin-left: calc(var(--old-col-gap) * -1.6);
}
.old-android-webview [data-old-flex-gap] > * {
margin-top: var(--old-row-gap);
margin-left: var(--old-col-gap);
} */
.old-android-webview [data-old-flex-gap] {
margin-top: calc(var(--old-row-gap) * -0.5);
margin-left: calc(var(--old-row-gap) * -0);
}
.old-android-webview [data-old-flex-gap] > * {
margin-top: var(--old-row-gap);
margin-right: var(--old-col-gap, 0px);
}
.old-android-webview [data-old-flex-gap] > *:last-child {
margin-right: 0px !important;
}
/* Old Android horizontal category margin spacing (gap not working - use margins) */
.old-android-webview .CategoryHorizontal-master-container > * {
margin-right: 1rem !important;
margin-left: 0.3rem !important;
}
.old-android-webview .CategoryHorizontal-master-container > *:last-child {
margin-right: 0 !important;
}
.old-android-webview .CategoryHorizontal-scroll-container > * {
margin-right: 0.5rem !important;
}
.old-android-webview .CategoryHorizontal-scroll-container > *:last-child {
margin-right: 0 !important;
}
/* Table shrink fix */
.old-android-webview .BSCategory1-tablecont,
.old-android-webview [class*="-tablecont"] {
min-width: 420px !important;
width: 420px !important;
max-width: 450px !important;
flex-grow: 1 !important;
}
/* Old Android itemcard rupee ₹ more left space + item name centered */
.old-android-webview .BSItemCard-itemPrice,
.old-android-webview .BSItemCard-itemMRP,
.old-android-webview .qtyUomName-itemCard {
padding-left: 0rem !important;
padding-right: 1.5rem !important;
width: 135px !important;
letter-spacing: 0 !important;
font-size: 13px !important;
}
.old-android-webview .BSItemCard-itemName {
text-align: center !important;
justify-content: center !important;
margin: 0 10px !important;
display: block !important;
padding: 0 1px !important;
}
/* Old Android global layout fix - BSLayout1Master table width like margin locks */
.old-android-webview .BSLayout1Master {
--table-width-fix: 430px;
}
.flex-wrap > * {
margin: 4px;
}
/* gap values map */
[data-gap='2'] > * {
margin: 2px;
}
[data-gap='4'] > * {
margin: 4px;
}
[data-gap='8'] > * {
margin: 8px;
}
[data-gap='10'] > * {
margin: 10px;
}
[data-gap='16'] > * {
margin: 16px;
}
[data-gap='24'] > * {
margin: 24px;
}
[data-gap='34'] > * {
margin: 34px;
}
p {
margin-bottom: 0;
}
/* ==============================================
GLOBAL MARGIN CONTROL - OLD ANDROID DEVICE
Easily control margins globally with CSS vars
Overrides polyfill auto-margins
============================================== */
:root {
/* Global Margin Scale - Easily adjust all at once */
--GLOBAL_MARGIN-XXS: 0.125rem;
--GLOBAL_MARGIN-XS: 0.25rem;
--GLOBAL_MARGIN-SM: 0.5rem;
--GLOBAL_MARGIN-MD: 1rem;
--GLOBAL_MARGIN-LG: 1.5rem;
--GLOBAL_MARGIN-XL: 2rem;
/* Old Android Lock - Force control */
--ANDROID_MARGIN-LOCK: 1px 0.4px !important;
}
/* Lock ALL margins for old Android - Full Control */
.old-android-webview *,
.old-android-webview *:before,
.old-android-webview *:after {
margin: var(--ANDROID_MARGIN-LOCK, inherit) !important;
}
/* Per-element margin classes - Use these everywhere */
.margin-xxs { margin: var(--GLOBAL_MARGIN-XXS) !important; }
.margin-xs { margin: var(--GLOBAL_MARGIN-XS) !important; }
.margin-sm { margin: var(--GLOBAL_MARGIN-SM) !important; }
.margin-md { margin: var(--GLOBAL_MARGIN-MD) !important; }
.margin-lg { margin: var(--GLOBAL_MARGIN-LG) !important; }
.margin-xl { margin: var(--GLOBAL_MARGIN-XL) !important; }
/* Directional control */
.margin-t-sm { margin-top: var(--GLOBAL_MARGIN-SM) !important; }
.margin-r-sm { margin-right: var(--GLOBAL_MARGIN-SM) !important; }
.margin-b-sm { margin-bottom: var(--GLOBAL_MARGIN-SM) !important; }
.margin-l-sm { margin-left: var(--GLOBAL_MARGIN-SM) !important; }
/* OLD ANDROID SUMMARY TABLE FIX - Prevent collapse */
.old-android-webview table,
/* Disable AntD margin interference */
.ant-space-item,
.ant-row > *,
.ant-col > * {
margin: var(--ANDROID_MARGIN-LOCK, 0) !important;
}

View File

@ -1,3 +1,4 @@
import 'antd/dist/reset.css';
import ReactDOM from 'react-dom/client'; import ReactDOM from 'react-dom/client';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { BrowserRouter } from 'react-router-dom'; import { BrowserRouter } from 'react-router-dom';
@ -8,9 +9,217 @@ import AppRoutes from './App.jsx';
import { AuthProvider } from './AuthContext'; import { AuthProvider } from './AuthContext';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import { ConfigProvider } from 'antd';
import {
StyleProvider,
legacyLogicalPropertiesTransformer,
} from '@ant-design/cssinjs';
import 'core-js/stable';
import 'regenerator-runtime/runtime';
import { isOldAndroidWebView } from './utils/isOldAndroidWebView.js';
import './index.css';
import "../src/Components/Forms/main.scss"
// src\Components\Forms\main.scss
const queryClient = new QueryClient(); const queryClient = new QueryClient();
/* -------------------------------------------------------
OLD ANDROID SAFE POLYFILLS
------------------------------------------------------- */
if (typeof window.Element === 'undefined') {
window.Element = function () {};
}
if (typeof window.HTMLElement === 'undefined') {
window.HTMLElement = function () {};
}
if (window.NodeList && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = function (callback, thisArg) {
thisArg = thisArg || window;
for (var i = 0; i < this.length; i++) {
callback.call(thisArg, this[i], i, this);
}
};
}
if (!window.requestAnimationFrame) {
window.requestAnimationFrame = function (callback) {
return setTimeout(callback, 16);
};
}
/* -------------------------------------------------------
Detect Old Android WebView
------------------------------------------------------- */
/* Detect Old Android WebView - line 170 fixed */
const ua2 = navigator.userAgent;
const chromeMatch2 = ua2.match(/Chrome\/(\\d+)/);
const isOldWebView =
chromeMatch2 && parseInt(chromeMatch2[1]) <= 85 && /Android/.test(ua2);
if (isOldWebView) {
const applyGapFix = () => {
document.querySelectorAll('*').forEach((el) => {
const style = window.getComputedStyle(el);
const display = style.display;
if (display !== 'flex' && display !== 'inline-flex') return;
const rowGap = style.rowGap;
const colGap = style.columnGap;
if (!rowGap || rowGap === 'normal' || rowGap === '0px') return;
// Last child fix included
Array.from(el.children).forEach((child, i, arr) => {
child.style.marginBottom = rowGap;
child.style.marginRight = colGap || rowGap;
// Last child margin remove
if (i === arr.length - 1) {
child.style.marginRight = '0px';
}
});
});
};
applyGapFix();
setTimeout(applyGapFix, 500);
setTimeout(applyGapFix, 1500);
new MutationObserver(applyGapFix).observe(document.body, {
childList: true,
subtree: true,
});
}
/* -------------------------------------------------------
FLEX GAP POLYFILL + Table Width Fix for Old Android
------------------------------------------------------- */
/* Table Width Fix - uses existing detection (no duplicate vars) */
if (isOldAndroidWebView) {
document.documentElement.classList.add('old-android-webview');
document.body.classList.add('old-android-webview');
// Force 420px table width immediately
const style = document.createElement('style');
style.textContent = `
.old-android-webview .BSCategory1-tablecont,
.old-android-webview [class*="-tablecont"] {
width: 420px !important;
}
`;
document.head.appendChild(style);
document.documentElement.classList.add('old-android-webview');
document.body.classList.add('old-android-webview');
const shouldApplyGap = (value) =>
!!value && value !== 'normal' && value !== '0px';
const processElement = (element) => {
if (typeof HTMLElement === 'undefined' || !(element instanceof HTMLElement))
return;
const style = window.getComputedStyle(element);
const isFlexContainer =
style.display === 'flex' || style.display === 'inline-flex';
if (!isFlexContainer) return;
const rowGap = style.rowGap;
const columnGap = style.columnGap;
const hasRowGap = shouldApplyGap(rowGap);
const hasColumnGap = shouldApplyGap(columnGap);
if (!hasRowGap && !hasColumnGap) {
element.removeAttribute('data-old-flex-gap');
element.style.removeProperty('--old-row-gap');
element.style.removeProperty('--old-col-gap');
return;
}
element.setAttribute('data-old-flex-gap', '1');
element.style.setProperty('--old-row-gap', hasRowGap ? rowGap : '0px');
element.style.setProperty(
'--old-col-gap',
hasColumnGap ? columnGap : '0px'
);
};
const processTree = (root) => {
if (typeof HTMLElement === 'undefined' || !(root instanceof HTMLElement))
return;
processElement(root);
const nodes = root.querySelectorAll('*');
for (let i = 0; i < nodes.length; i++) {
processElement(nodes[i]);
}
};
const applyGlobalFlexGapPolyfill = () => {
processTree(document.body);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', applyGlobalFlexGapPolyfill, {
once: true,
});
} else {
applyGlobalFlexGapPolyfill();
}
requestAnimationFrame(applyGlobalFlexGapPolyfill);
setTimeout(applyGlobalFlexGapPolyfill, 800);
setTimeout(applyGlobalFlexGapPolyfill, 2000);
let scheduled = false;
const observer = new MutationObserver(() => {
if (!scheduled) {
scheduled = true;
requestAnimationFrame(() => {
applyGlobalFlexGapPolyfill();
scheduled = false;
});
}
});
observer.observe(document.body, {
childList: true,
subtree: true,
});
}
/* -------------------------------------------------------
REACT APP
------------------------------------------------------- */
ReactDOM.createRoot(document.getElementById('root')).render( ReactDOM.createRoot(document.getElementById('root')).render(
<StyleProvider
hashPriority="high"
hashed={false}
autoClear={false}
container={document.head}
transformers={[legacyLogicalPropertiesTransformer]}
>
<ConfigProvider theme={{ hashed: false }}>
<QueryClientProvider client={queryClient}> <QueryClientProvider client={queryClient}>
<Provider store={store}> <Provider store={store}>
<BrowserRouter> <BrowserRouter>
@ -19,8 +228,11 @@ ReactDOM.createRoot(document.getElementById('root')).render(
</AuthProvider> </AuthProvider>
</BrowserRouter> </BrowserRouter>
</Provider> </Provider>
{process.env.NODE_ENV == 'development' && (
{process.env.NODE_ENV === 'development' && (
<ReactQueryDevtools initialIsOpen={false} /> <ReactQueryDevtools initialIsOpen={false} />
)} )}
</QueryClientProvider> </QueryClientProvider>
</ConfigProvider>
</StyleProvider>
); );

View File

@ -676,19 +676,18 @@ const subDirectory = import.meta.env.BASE_URL;
const apiCommonUrl = import.meta.env.ENV_API_URL_COMMON; const apiCommonUrl = import.meta.env.ENV_API_URL_COMMON;
const initSession = () => { const initSession = () => {
sessionStore('AppId', 1); sessionStore('AppId', 6);
sessionStore('BranchId', 121); sessionStore('BranchId', 556);
sessionStore('AppName', 'Bakery'); sessionStore('AppName', 'Bakery');
sessionStore('CompId', 72); sessionStore('CompId', 462);
sessionStore('MobileNo', '8072329153'); sessionStore('MobileNo', '6382594417');
sessionStore('UserType', 'Admin'); sessionStore('UserType', 'Admin');
sessionStore('UserId', 39); sessionStore('UserId', 1884);
sessionStore('userName', 'Karthiga'); sessionStore('userName', 'Karthiga');
sessionStore(
sessionStorage.setItem( 'auth',
'auth', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiNjM4MjU5NDQxNyIsIlBhc3N3b3JkIjoiWkB6NDEwNDg0IiwiYXVkIjpbImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tcmV0YWlsLWFwaSIsImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tY29tbW9uLWFwaSIsImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tc21zLWVtYWlsLXRlbXBsYXRlLWFwaSIsImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tY29tbW9uLWFwaSJdLCJleHAiOjE3NzUxNTgwNTIsImlzcyI6Imh0dHBzOi8vYXBpLnBvem8uZGV2L0p3dFRva2VuIn0.xPuA6vnS7UdDWAnwMLEPhV0UcqPCwtb7tllpMYjOb-A'
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiODA3MjMyOTE1MyIsIlBhc3N3b3JkIjoiWkB6MTIzNCIsImF1ZCI6WyJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTIiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTQiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiXSwiZXhwIjoxNzc0Mzc5NTY2LCJpc3MiOiJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMDEifQ.uTdcz-FHE4GTux7FTtT2pQt9gEe-17_mIrwJWbHdHE8' );
);
}; };
const getAppType = async () => { const getAppType = async () => {
@ -779,13 +778,13 @@ export const routesConfig = [
}, },
{ {
path: `${subDirectory}app-page`, path: `${subDirectory}`,
component: React.lazy(() => component: React.lazy(() =>
fetchComponent().then((module) => ({ default: module.default })) fetchComponent().then((module) => ({ default: module.default }))
), ),
children: [ children: [
{ {
path: 'home', path: '/',
component: React.lazy(() => component: React.lazy(() =>
fetchHomeComponent().then((module) => ({ default: module.default })) fetchHomeComponent().then((module) => ({ default: module.default }))
), ),

12
src/utils/gapStyle.js Normal file
View File

@ -0,0 +1,12 @@
import { isOldAndroidWebView } from './isOldAndroidWebView';
export const gapStyle = (size) => {
size = size || '8px';
if (isOldAndroidWebView()) {
return {
marginRight: size,
marginBottom: size
};
}
return { gap: size };
};

View File

@ -0,0 +1,5 @@
export const isOldAndroidWebView = (() => {
const ua = navigator.userAgent;
const match = ua.match(/Chrome\/(\d+)/);
return match && parseInt(match[1]) <= 85 && /Android/.test(ua);
})();

View File

@ -1,13 +1,41 @@
import { defineConfig } from "vite"; import { defineConfig } from "vite";
import react from "@vitejs/plugin-react"; import react from "@vitejs/plugin-react";
import legacy from '@vitejs/plugin-legacy';
import esbuild from 'esbuild';
export default defineConfig(({ mode }) => { export default defineConfig(({ mode }) => {
const isProd = mode === "production"; const isProd = mode === "production";
return { return {
plugins: [react()], 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;
}
}
}
}
],
base: isProd ? "/apps/retail/" : "/", //for capcitor base: isProd ? "/" : "/",
base: isProd ? "/" : "/", //for capcitor base: isProd ? "/" : "/",
envDir: "src", envDir: "src",
envPrefix: "ENV_", envPrefix: "ENV_",