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>
</application>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.USB_PERMISSION" />
<uses-feature android:name="android.hardware.usb.host" />

View File

@ -3,9 +3,14 @@
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/fav.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=1" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/antd/dist/reset.css" />
<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 />
@ -77,7 +82,18 @@
}
});
</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>
(function () {
@ -125,7 +141,107 @@
}
}, 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>
<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-virtual": "^3.13.18",
"@types/node": "^25.5.0",
"@vitejs/plugin-legacy": "^8.0.1",
"@zxing/library": "^0.21.3",
"antd": "^5.17.4",
"antd-img-crop": "^4.22.0",
@ -90,6 +89,7 @@
"devDependencies": {
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-legacy": "^8.0.0",
"@vitejs/plugin-react": "^6.0.1",
"esbuild": "^0.27.4",
"eslint": "^8.57.0",
@ -98,7 +98,7 @@
"eslint-plugin-react-refresh": "^0.4.7",
"prettier": "^3.5.3",
"rollup-plugin-obfuscator": "^1.1.0",
"sass": "^1.98.0",
"sass": "^1.77.2",
"terser": "^5.31.3",
"vite": "^8.0.0",
"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_API_URL='http://192.168.1.25:8001'
# ENV_API_URL='http://api.pozo.co.in/Retailapi_UnderTest'
# ENV_API_URL='https://api.pozo.dev/pozo-retail-api'
# ENV_API_URL_COMMON='https://api.pozo.dev/pozo-common-api'
# ENV_API_URL_TOKEN='https://api.pozo.dev/JwtToken'
ENV_API_URL='http://192.168.1.37:8012'
ENV_API_URL_COMMON='http://192.168.1.37:8013'
ENV_API_URL_TOKEN='http://192.168.1.37:8001'
ENV_API_URL_OCR='http://192.168.1.37:8070'
ENV_API_URL='https://api.pozo.dev/pozo-retail-api'
ENV_API_URL_COMMON='https://api.pozo.dev/pozo-common-api'
ENV_API_URL_TOKEN='https://api.pozo.dev/JwtToken'
# ENV_API_URL='http://192.168.1.37:8012'
# ENV_API_URL_COMMON='http://192.168.1.37:8013'
# ENV_API_URL_TOKEN='http://192.168.1.37:8001'
# ENV_API_URL_OCR='http://192.168.1.37:8070'
# ENV_API_URL='https://api.pozo.app/pozo-retail-api'
# ENV_API_URL_COMMON='https://api.pozo.app/pozo-common-api'
# ENV_API_URL_TOKEN='https://api.pozo.app/JwtToken'

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -175,6 +175,21 @@ const Printstyle4 = ({
(setting) =>
setting?.SettingIdName?.toLowerCase() === 'estimateprintheader'
)?.SettingValue === 'Y';
const estimatebrname =
SettingData?.[0]?.SettingDtlDetails?.find(
(setting) =>
setting?.SettingIdName?.toLowerCase() === 'estimatebrname'
)?.SettingValue === 'Y';
const estimatebraddress =
SettingData?.[0]?.SettingDtlDetails?.find(
(setting) =>
setting?.SettingIdName?.toLowerCase() === 'estimatebraddress'
)?.SettingValue === 'Y';
const estimatebrphone =
SettingData?.[0]?.SettingDtlDetails?.find(
(setting) =>
setting?.SettingIdName?.toLowerCase() === 'estimatebrphone'
)?.SettingValue === 'Y';
const estimateTitle =
SettingData?.[0]?.SettingDtlDetails?.find(
(setting) => setting?.SettingIdName?.toLowerCase() === 'estimatetitle'
@ -3347,7 +3362,7 @@ const Printstyle4 = ({
width={100}
/>
) : null}
<div
{estimatebrname && <div
style={{
fontSize: '16px',
fontWeight: '600',
@ -3359,10 +3374,10 @@ const Printstyle4 = ({
}}
>
{GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
</div>
</div>}
</div>
<div
{estimatebraddress && <div
style={{
display: 'flex',
justifyContent: 'center',
@ -3386,12 +3401,14 @@ const Printstyle4 = ({
? '-'
: '') + table2Data?.AddressDetails?.[0]?.Zip
: '')}
</div>
</div>}
{estimatebrphone && (
<div style={{ fontWeight: '500', fontSize: '10px' }}>
{' '}
Mobile : +91{' '}
{GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
</div>
)}
</div>
)}
{/* <div>

View File

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

View File

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

View File

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

View File

@ -13,6 +13,7 @@ import {
Tooltip,
Space,
Segmented,
Checkbox,
} from 'antd';
import { BsUpcScan } from "react-icons/bs";
import {
@ -116,6 +117,7 @@ const DeliveryChellanForm = () => {
const [selectedOrder, setSelectedOrder] = useState();
const [orderTableData, setOrderTableData] = useState([]);
const [emailSending, setEmailSending] = useState(false);
const [selectedCustomertype, setSelectedCustomertype] = useState('N');
const items = [
{
@ -132,9 +134,11 @@ const DeliveryChellanForm = () => {
useEffect(() => {
dispatch(changeBreadCrumb({ items: items }));
getProduct();
fetchdata();
getPrintData();
}, []);
useEffect(() => {
fetchdata();
}, [selectedCustomertype]);
useEffect(() => {
if (UserType === 'Employee') {
@ -261,14 +265,14 @@ const DeliveryChellanForm = () => {
console.log(AllCustomer, "AllCustomerAllCustomer")
const fetchdata = async () => {
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) {
setAllCustomer(resCustomer?.data?.data);
} else {
setAllCustomer([]);
setMessageType("error");
setMessageData(resCustomer?.data?.response);
// setMessageType("error");
// setMessageData(resCustomer?.data?.response);
}
const resOrders = await dispatch(PendingOrdersDC({ CompId, AppId, BranchId })).unwrap();
@ -276,8 +280,8 @@ const DeliveryChellanForm = () => {
setOrdersCustomer(resOrders?.data?.data?.PurchaseOrder);
} else {
setOrdersCustomer([]);
setMessageType("error");
setMessageData(resOrders?.data?.response);
// setMessageType("error");
// setMessageData(resOrders?.data?.response);
}
} catch (err) {
@ -1345,7 +1349,7 @@ const DeliveryChellanForm = () => {
</div>
<div className="DeliveryChellanDetails">
{segmentValue === "N" ? <div>
{segmentValue === "N" ? <div style={{ display: "flex", alignItems: "center", gap: "12px" }}>
<Form.Item
name="CustId"
rules={[
@ -1368,6 +1372,21 @@ const DeliveryChellanForm = () => {
onChangeFunction={handleAdminUserDropDownChange}
/>
</Form.Item>
{/* <Form.Item> */}
<Tooltip
title="Check to view all branch customers. Uncheck to view only your branch customers.">
<Checkbox
checked={selectedCustomertype === 'Y'}
onChange={(e) => {
setSelectedCustomertype(e.target.checked ? 'Y' : 'N');
}}
> {selectedCustomertype === 'Y'
? 'All Branch'
: 'My Branch'}
</Checkbox>
</Tooltip>
{/* </Form.Item> */}
</div> : <div>
<Form.Item
name="Order"

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 { Form, Checkbox, Radio, Divider, InputNumber } from 'antd';
import { ArrowRightOutlined } from '@ant-design/icons';
@ -30,6 +30,7 @@ const PreferenceList = ({ setting = false }) => {
const { SadminuserAccess, featureaddDetails } = useAuth();
const dispatch = useDispatch();
const formRef = useRef();
const prevEstimateRef = useRef([]);
const CompId = getSession('CompId');
const BranchId = getSession('BranchId');
const AppId = getSession('AppId');
@ -157,6 +158,10 @@ const PreferenceList = ({ setting = false }) => {
...(allSettingsMap['estimatetitle']?.value === 'Y'
? ['estimatetitle']
: []),
...(allSettingsMap['estimatebrname']?.value === 'Y' ? ['estimatebrname'] : []),
...(allSettingsMap['estimatebraddress']?.value === 'Y' ? ['estimatebraddress'] : []),
...(allSettingsMap['estimatebrphone']?.value === 'Y' ? ['estimatebrphone'] : []),
],
scanlayout: allSettingsMap['scanlayout']?.value === 'Y',
verifyproduct: allSettingsMap['verifyproduct']?.value === 'Y',
@ -217,6 +222,8 @@ const PreferenceList = ({ setting = false }) => {
setInitialValues(built);
console.log(built, 'built');
formRef.current?.setFieldsValue(built);
prevEstimateRef.current = built.estimateSettings ?? [];
}
}, [settingsList]);
@ -405,8 +412,15 @@ const PreferenceList = ({ setting = false }) => {
dinein: values.enabledModules,
estimation: values.enabledModules,
parking: values.enabledFeatures,
// estimateprintheader: values.estimateSettings,
// estimatebrname: values.estimatebrname,
// estimatebraddress: values.estimatebraddress,
// estimatebrphone: values.estimatebrphone,
estimateprintheader: values.estimateSettings,
estimatetitle: values.estimateSettings,
estimatebrname: values.estimateSettings,
estimatebraddress: values.estimateSettings,
estimatebrphone: values.estimateSettings,
offer: values.enabledFeatures,
whatsapp: values.pdfSendOptions,
sms: values.pdfSendOptions,
@ -533,6 +547,53 @@ const userDropData = async () => {
<Checkbox>Yes</Checkbox>
</Form.Item>
);
const ESTIMATE_PRINT_SETTINGS = [
{
key: 'estimateprintheader',
label: 'Show shop header',
children: [
{ key: 'estimatebrname', label: 'name' },
{ key: 'estimatebraddress', label: 'address' },
{ key: 'estimatebrphone', label: 'phone number' },
],
},
{
key: 'estimatetitle',
label: 'Show "Estimate" title',
children: [],
},
];
const handleEstimateChange = (checkedValues) => {
const prev = prevEstimateRef.current;
let updated = [...checkedValues];
ESTIMATE_PRINT_SETTINGS.forEach(({ key, children }) => {
if (!children.length) return;
const childKeys = children
.filter((c) => allSettingsMap[c.key] !== undefined)
.map((c) => c.key);
const parentJustChecked = checkedValues.includes(key) && !prev.includes(key);
// Parent just checked add all children
if (parentJustChecked) {
updated = [...new Set([...updated, ...childKeys])];
}
// Calculate AFTER updated may have changed above
const anyChildChecked = childKeys.some((c) => updated.includes(c));
// All children removed remove parent
if (updated.includes(key) && !anyChildChecked) { // uses variable, no duplicate
updated = updated.filter((v) => v !== key);
}
});
prevEstimateRef.current = updated;
formRef.current?.setFieldValue('estimateSettings', updated);
};
return (
<>
@ -1164,26 +1225,33 @@ const userDropData = async () => {
'mobilea4',
'Prefer printing in A4/A5 on mobile?'
)}
{(allSettingsMap['estimateprintheader'] !== undefined ||
allSettingsMap['estimatetitle'] !== undefined) && (
<Form.Item
name="estimateSettings"
label="Estimate Print Settings :"
>
<Checkbox.Group>
{allSettingsMap['estimateprintheader'] !== undefined && (
<Checkbox value="estimateprintheader">
Show shop header (Name, Address, GST)
{ESTIMATE_PRINT_SETTINGS.some(({ key }) => allSettingsMap[key] !== undefined) && (
<Form.Item noStyle shouldUpdate>
{({ getFieldValue }) => (
<Form.Item name="estimateSettings" label="Estimate Print Settings :">
<Checkbox.Group onChange={(vals) => handleEstimateChange(vals, formRef)}>
{ESTIMATE_PRINT_SETTINGS
.filter(({ key }) => allSettingsMap[key] !== undefined)
.map(({ key, label, children }) => (
<React.Fragment key={key}>
<Checkbox value={key}>{label}</Checkbox>
{children.length > 0 &&
getFieldValue('estimateSettings')?.includes(key) &&
children
.filter((child) => allSettingsMap[child.key] !== undefined)
.map((child) => (
<Checkbox key={child.key} value={child.key}>
{child.label}
</Checkbox>
)}
{allSettingsMap['estimatetitle'] !== undefined && (
<Checkbox value="estimatetitle">
Show Estimate (R/W) title
</Checkbox>
)}
))}
</React.Fragment>
))}
</Checkbox.Group>
</Form.Item>
)}
</Form.Item>
)}
</div>
<div className="PreferencesBTN">
<Buttons

View File

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

View File

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

View File

@ -947,6 +947,12 @@ const DateWiseReport = () => {
<td>{datewiseData?.[0]?.TotalExtraChargeAmount}</td>
</tr>
)}
{datewiseData?.[0]?.RefundAmount > 0 && (
<tr>
<td>Refund (-)</td>
<td>{datewiseData?.[0]?.RefundAmount}</td>
</tr>
)}
{datewiseData?.[0]?.PreOrderNetAmount > 0 && (
<tr>
<td>Preorder</td>
@ -982,8 +988,10 @@ const DateWiseReport = () => {
datewiseData?.[0]?.WholeSaleExpenseNetAmount
) || 0
: safeRound(
datewiseData?.[0]?.TotalNetAmount +
(datewiseData?.[0]?.PreOrderNetAmount || 0)
(datewiseData?.[0]?.TotalBillAmount || 0) +
(datewiseData?.[0]?.TaxAmount || 0) +
(datewiseData?.[0]?.PreOrderNetAmount || 0) -
(datewiseData?.[0]?.RefundAmount || 0)
) || 0}
</td>
</tr>

View File

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

View File

@ -34,6 +34,7 @@ import { useSelector } from 'react-redux';
import excelExport from '../../../Images/xls-export.png';
import ExcelJS from 'exceljs';
import { saveAs } from 'file-saver';
import { downloadFile } from '../../../utils/downloadFile.js';
dayjs.extend(customParseFormat);
@ -620,8 +621,19 @@ const LedgerReport = () => {
hours = String(hours).padStart(2, '0');
const fileName = `Ledger Report_${day}-${month}-${year}_${hours}-${minutes}-${ampm}.xlsx`;
saveAs(blob, fileName);
downloadFile(
buffer,
fileName,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
(success) => {
if (success) {
console.log("File downloaded and opened successfully!");
} else {
console.log("Failed to download/open file.");
}
}
);
// saveAs(blob, fileName);
};
const FirstOrderLedgerDateRaw = dayjs(FirstOrderLedgerDate);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@ -676,18 +676,17 @@ const subDirectory = import.meta.env.BASE_URL;
const apiCommonUrl = import.meta.env.ENV_API_URL_COMMON;
const initSession = () => {
sessionStore('AppId', 1);
sessionStore('BranchId', 121);
sessionStore('AppId', 6);
sessionStore('BranchId', 556);
sessionStore('AppName', 'Bakery');
sessionStore('CompId', 72);
sessionStore('MobileNo', '8072329153');
sessionStore('CompId', 462);
sessionStore('MobileNo', '6382594417');
sessionStore('UserType', 'Admin');
sessionStore('UserId', 39);
sessionStore('UserId', 1884);
sessionStore('userName', 'Karthiga');
sessionStorage.setItem(
sessionStore(
'auth',
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiODA3MjMyOTE1MyIsIlBhc3N3b3JkIjoiWkB6MTIzNCIsImF1ZCI6WyJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTIiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTQiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiXSwiZXhwIjoxNzc0Mzc5NTY2LCJpc3MiOiJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMDEifQ.uTdcz-FHE4GTux7FTtT2pQt9gEe-17_mIrwJWbHdHE8'
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiNjM4MjU5NDQxNyIsIlBhc3N3b3JkIjoiWkB6NDEwNDg0IiwiYXVkIjpbImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tcmV0YWlsLWFwaSIsImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tY29tbW9uLWFwaSIsImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tc21zLWVtYWlsLXRlbXBsYXRlLWFwaSIsImh0dHBzOi8vYXBpLnBvem8uZGV2L3Bvem8tY29tbW9uLWFwaSJdLCJleHAiOjE3NzUxNTgwNTIsImlzcyI6Imh0dHBzOi8vYXBpLnBvem8uZGV2L0p3dFRva2VuIn0.xPuA6vnS7UdDWAnwMLEPhV0UcqPCwtb7tllpMYjOb-A'
);
};
@ -779,13 +778,13 @@ export const routesConfig = [
},
{
path: `${subDirectory}app-page`,
path: `${subDirectory}`,
component: React.lazy(() =>
fetchComponent().then((module) => ({ default: module.default }))
),
children: [
{
path: 'home',
path: '/',
component: React.lazy(() =>
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 react from "@vitejs/plugin-react";
import legacy from '@vitejs/plugin-legacy';
import esbuild from 'esbuild';
export default defineConfig(({ mode }) => {
const isProd = mode === "production";
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",
envPrefix: "ENV_",