conflict Fixed

This commit is contained in:
Tamilselvan 2026-03-27 02:00:54 +05:30
commit 592098e672
43 changed files with 5732 additions and 5516 deletions

View File

@ -8,7 +8,7 @@ import SelfBooking from './Pages/SelfBooking/SelfBooking.jsx';
import { isMobile, isIOS } from 'react-device-detect';
import { routesConfig } from './routesConfig';
import { GlobalItemCard } from './Features/BookingScreen/BookingData/BookingData.js';
import { clearSession, getSession } from './Services/Others.js';
import { clearSession, getSession, sessionStore } from './Services/Others.js';
const KisokSelBooking = lazy(
() => import('./Pages/SelfBooking/KisokSelBooking')
@ -27,9 +27,10 @@ import useSessionManager from './useSessionManager.js';
import ExtendSubscriptionModal from './Pages/ExtentedModal/ExtendSubscriptionModal.jsx';
import devtools from 'devtools-detect';
import { useDevToolsDetection } from './utils/useDevToolsDetection.js';
import { Capacitor } from '@capacitor/core';
const isCapacitor = () => !!window.Capacitor?.isNativePlatform?.();
// const isCapacitor = () => !!window.Capacitor?.isNativePlatform?.();
const isCapacitor = () => Capacitor.isNativePlatform();
// Define your home/exit pages here
const HOME_PAGES = [
'/app-page/home', // android minimize
@ -55,7 +56,7 @@ const AppRoutes = () => {
const [devToolsOpen, setDevToolsOpen] = useState(false);
// Flag to prevent stack push when back button navigates
const isBackNav = useRef(false);
console.log(isCapacitor(), 'Is Capacitor');
// Build navigation stack
useEffect(() => {
// Skip pushing to stack when back button caused this navigation
@ -70,13 +71,14 @@ const AppRoutes = () => {
// Don't track login pages
if (LOGIN_PAGES.some((p) => path.includes(p))) return;
const raw = sessionStorage.getItem('navStack');
const raw = getSession('navStack');
console.log('🎯 Current path:', path);
let stack = raw ? JSON.parse(raw) : [];
if (stack.length === 0 || stack[stack.length - 1] !== path) {
stack.push(path);
if (stack.length > 50) stack = stack.slice(-50);
sessionStorage.setItem('navStack', JSON.stringify(stack));
sessionStore('navStack', JSON.stringify(stack));
console.log('📍 Stack:', stack);
}
} catch (e) { }
@ -90,7 +92,7 @@ const AppRoutes = () => {
const currentPath = location.pathname;
const SessionId = getSession('SessionId');
console.log('SessionId:', SessionId, 'CurrentPath:', currentPath)
// 🟢 If session exists allow navigation
if (SessionId) {
console.log('Browser back allowed');
@ -112,65 +114,53 @@ const AppRoutes = () => {
}, [location.pathname]);
// Android Capacitor back button
useEffect(() => {
if (!isCapacitor()) return;
useEffect(() => {
if (!isCapacitor()) return;
const handler = async () => {
try {
const currentPath = location.pathname + (location.search || '');
console.log('🔙 Back pressed:', currentPath);
const handler = async () => {
try {
const currentPath = window.location.pathname + window.location.search; // Bug 2 fix
const raw = sessionStorage.getItem('navStack');
let stack = raw ? JSON.parse(raw) : [];
const raw = getSession('navStack');
let stack = raw ? JSON.parse(raw) : [];
// Remove current path from stack if it's at the end
while (stack.length && stack[stack.length - 1] === currentPath) {
stack.pop();
}
// If there are pages in history, go back to previous page
if (stack.length > 0) {
const previous = stack[stack.length - 1];
sessionStorage.setItem('navStack', JSON.stringify(stack));
isBackNav.current = true;
navigate(previous);
console.log('Navigate to previous:', previous);
return;
}
// Stack is empty - check where we are
// 🏠 Home page minimize
if (HOME_PAGES?.some((p) => currentPath?.includes(p))) {
console.log('Home page & empty stack → minimizing app');
await CapacitorApp.minimizeApp();
return;
}
// 🚪 Login page minimize
if (LOGIN_PAGES?.some((p) => currentPath?.includes(p))) {
console.log('Login page & empty stack → minimizing app');
await CapacitorApp.minimizeApp();
return;
}
// Anywhere else with empty stack go to home
const home = '/app-page/home';
sessionStorage.setItem('navStack', JSON.stringify([home]));
isBackNav.current = true;
navigate(home);
console.log('Empty stack, navigate to home');
} catch (e) {
console.error('Back handler error:', e);
await CapacitorApp.minimizeApp();
while (stack.length && stack[stack.length - 1] === currentPath) {
stack.pop();
}
};
const listener = CapacitorApp.addListener('backButton', handler);
if (stack.length > 0) {
const previous = stack[stack.length - 1];
sessionStore('navStack', JSON.stringify(stack));
isBackNav.current = true; // Bug 3 fix BEFORE navigate
navigate(previous);
return;
}
return () => {
listener.remove();
};
}, [navigate, location.pathname, location.search]);
if (HOME_PAGES?.some((p) => currentPath?.includes(p))) {
await CapacitorApp.minimizeApp();
return;
}
if (LOGIN_PAGES?.some((p) => currentPath?.includes(p))) {
await CapacitorApp.minimizeApp();
return;
}
const home = '/app-page/home';
isBackNav.current = true; // Bug 3 fix here too
sessionStore('navStack', JSON.stringify([home]));
navigate(home);
} catch (e) {
console.error('Back handler error:', e);
await CapacitorApp.minimizeApp();
}
};
const listenerPromise = CapacitorApp.addListener('backButton', handler); // Bug 1 fix
return () => {
listenerPromise.then(({ remove }) => remove());
};
}, [navigate,location.pathname, location.search]);
// mohan
// useEffect(() => {
// if (isMobile || isIOS) {
@ -211,27 +201,27 @@ const AppRoutes = () => {
// return () => clearInterval(checkDevTools);
// }, [devToolsOpen]);
const isBlocked = useDevToolsDetection(() => {
// optional: log, notify, etc.
console.warn('DevTools detected');
});
// const isBlocked = useDevToolsDetection(() => {
// // optional: log, notify, etc.
// console.warn('DevTools detected');
// });
if (isBlocked) {
return (
<div style={{
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
height: '100vh',
flexDirection: 'column',
gap: '1rem'
}}>
<h1 style={{ color: 'red' }}>
DevTools detected. Please close it to continue.
</h1>
</div>
);
}
// if (isBlocked) {
// return (
// <div style={{
// display: 'flex',
// justifyContent: 'center',
// alignItems: 'center',
// height: '100vh',
// flexDirection: 'column',
// gap: '1rem'
// }}>
// <h1 style={{ color: 'red' }}>
// DevTools detected. Please close it to continue.
// </h1>
// </div>
// );
// }
if (extendModel) {
return (
<ExtendSubscriptionModal

View File

@ -139,6 +139,18 @@ const SideMenuPozo = ({ items = [] }) => {
const DineinDefault = useSelector(GlobalDineinDefault);
const [collapse, setCollapse] = useState(false);
const [isLandscape, setIsLandscape] = useState(
window.matchMedia('(orientation: landscape)').matches
);
useEffect(() => {
const handleResize = () => {
setIsLandscape(window.matchMedia('(orientation: landscape)').matches);
};
window.addEventListener('resize', handleResize);
return () => window.removeEventListener('resize', handleResize);
}, []);
useEffect(() => {
const handleResize = () => {
setCollapse(window.innerWidth < 768);
@ -368,7 +380,10 @@ const SideMenuPozo = ({ items = [] }) => {
<div
className={`SideMenuPozo-Master${collapse ? ' collapsed' : ''}`}
ref={menuRef}
style={{ height: isMobile ? '88%' : '' }}
// style={{ height: isMobile ? '88%' : '' }}
style={{
height: isMobile ? (isLandscape ? '100%' : '100%') : '100%',
}}
>
<div
style={{

View File

@ -262,7 +262,7 @@ const styles = {
status: {
marginTop: '6px',
fontSize: '0.7rem',
fontSize: '0.6rem',
fontWeight: 600,
letterSpacing: '4px',
textTransform: 'uppercase',

View File

@ -56,12 +56,7 @@ const addAuthHeader = async (config) => {
let encryptedLoginType =
getSession('LoginType')
console.log(
'encryptedLoginType',
encryptedLoginType,
TokendecryptedValuesFun(encryptedMobileno)
);
// let Mobileno = encryptedUserId && encryptedLoginType != "Kiosk" ? TokendecryptedValuesFun(encryptedMobileno) : '1000000001';
let Mobileno = encryptedUserId
? encryptedMobileno

View File

@ -1416,6 +1416,13 @@ export const getOtherServiceTicket = createAsyncThunk(
}
}
);
// post /cancelPayment
export const PostCancelPayment = createAsyncThunk(
'BookingData/cancelPayment',
async (postData) => {
return await axiosRetailInstanceData.post(`/cancelPayment`, postData);
}
);
export const PostBlockSlots = createAsyncThunk(
'BookingData/PostBlockSlots',
async (postData) => {
@ -1444,6 +1451,7 @@ export const getPaymentStatusForBusinessUPI = createAsyncThunk(
}
);
export const getCurrentOrderid = createAsyncThunk(
'BookingData/getcurrentorderid',
@ -2160,15 +2168,15 @@ const BookingData = createSlice({
state.getmultipleSearchDatas = [];
}
});
builder.addCase(getAppSubscriptionDate.fulfilled, (state, action) => {
if (action?.payload?.data?.statusCode === 1) {
state.AppExpDateData =
action?.payload?.data?.data?.[0]|| {};
} else {
state.AppExpDateData = {};
}
builder.addCase(getAppSubscriptionDate.fulfilled, (state, action) => {
if (action?.payload?.data?.statusCode === 1) {
state.AppExpDateData =
action?.payload?.data?.data?.[0] || {};
} else {
state.AppExpDateData = {};
}
});
},
});

View File

@ -3,7 +3,7 @@
height: 90vh;
overflow: auto;
scrollbar-width: thin;
font-family: 'Poppins';
font-family: "Poppins";
.automated-reorder-content {
padding-top: 18px;
@ -51,4 +51,12 @@
padding: 6px !important;
}
}
}
}
.automated-reorder-list-content {
.eyeopenShow {
display: flex;
align-items: center;
justify-content: center;
}
}

View File

@ -1,345 +1,359 @@
import { useCallback, useEffect, useState } from "react";
import { useDispatch } from "react-redux";
import { getSession } from "../../Services/Others";
import { changeBreadCrumb, getEmpAccess } from "../../Features/AppPage/CenterPage";
import { Messages } from "../../Components/Notifications/Messages";
import { Tables } from "../../Components/Tables/Table";
import FormHeader from "../PageComponents/FormHeader";
import Search from "../../Components/Forms/Search";
import Buttons from "../../Components/Forms/Buttons";
import { useCallback, useEffect, useState } from 'react';
import { useDispatch } from 'react-redux';
import { getSession } from '../../Services/Others';
import {
EditFilled,
DeleteFilled,
PlusOutlined,
ReloadOutlined,
changeBreadCrumb,
getEmpAccess,
} from '../../Features/AppPage/CenterPage';
import { Messages } from '../../Components/Notifications/Messages';
import { Tables } from '../../Components/Tables/Table';
import FormHeader from '../PageComponents/FormHeader';
import Search from '../../Components/Forms/Search';
import Buttons from '../../Components/Forms/Buttons';
import {
EditFilled,
DeleteFilled,
PlusOutlined,
ReloadOutlined,
} from '@ant-design/icons';
import { useLocation, useNavigate } from "react-router-dom";
import { Space, Tooltip } from "antd";
import { deleteAutomatedReorder, getAutomatedReorderList } from "../../Features/PurchaseOrder/PurchaseOrder";
import { DefaultModal } from "../../Components/Modal/DefaultModal";
import { FaRegEye } from "react-icons/fa";
import { render } from "react-dom";
import { useAuth } from "../../AuthContext";
import "./AutomatedReorder.scss";
import { useLocation, useNavigate } from 'react-router-dom';
import { Space, Tooltip } from 'antd';
import {
deleteAutomatedReorder,
getAutomatedReorderList,
} from '../../Features/PurchaseOrder/PurchaseOrder';
import { DefaultModal } from '../../Components/Modal/DefaultModal';
import { FaRegEye } from 'react-icons/fa';
import { render } from 'react-dom';
import { useAuth } from '../../AuthContext';
import './AutomatedReorder.scss';
const subDirectory = import.meta.env.BASE_URL;
const items = [
{
name: 'Home',
link: `${subDirectory}app-page/home`,
},
{
name: 'Automated Reorder',
link: `${subDirectory}setting/automated-reorder`,
},
{
name: 'Home',
link: `${subDirectory}app-page/home`,
},
{
name: 'Automated Reorder',
link: `${subDirectory}setting/automated-reorder`,
},
];
const AutomatedReorderList = () => {
const dispatch = useDispatch();
const navigate = useNavigate();
const location = useLocation();
const state = location?.state;
const { SadminuserAccess } = useAuth();
let SAAccessCommonMaster = SadminuserAccess?.find(
(e) => e?.MenuName === 'Product Receipt'
const dispatch = useDispatch();
const navigate = useNavigate();
const location = useLocation();
const state = location?.state;
const { SadminuserAccess } = useAuth();
let SAAccessCommonMaster = SadminuserAccess?.find(
(e) => e?.MenuName === 'Product Receipt'
);
const AppId = getSession('AppId');
const CompId = getSession('CompId');
const BranchId = getSession('BranchId');
const UserId = getSession('UserId');
const UserType = getSession('UserType');
const [empData, setEmpData] = useState();
const [addnewAccess, setaddnewAccess] = useState(true);
const [messageType, setMessageType] = useState(null);
const [messageData, setMessageData] = useState(null);
const [supplierModalOpen, setSupplierModalOpen] = useState(false);
const [supplierRecords, setSupplierRecords] = useState([]);
const [supplierRecordIndex, setSupplierRecordIndex] = useState(null);
const [page, setPage] = useState(1);
const [searchedText, setSearchedText] = useState('');
const [tableData, setTableData] = useState([]);
const columns = [
{
title: 'SL.NO',
dataIndex: 'SLNO',
key: 'SLNO',
width: '10%',
render: (_, record, index) => index + 1,
align: 'center',
},
{
title: 'Product Name',
dataIndex: 'ProdName',
key: 'ProdName',
render: (_, record) => `${record.ProdName} (${record.UOMName})`,
},
{
title: 'Supplier',
dataIndex: 'Supplier',
key: 'Supplier',
align: 'center',
render: (_, record, index) => (
// <div className="productMasterImageUpload">
<Tooltip title={record.SupplierDetails ? 'View Image' : 'Upload Image'}>
<div className="eyeopenShow">
<FaRegEye
style={{ background: 'none', cursor: 'pointer' }}
size={22}
color={record.SupplierDetails && '#1F9B3A'}
onClick={() => {
setSupplierModalOpen(true);
setSupplierRecords(record.SupplierDetails);
setSupplierRecordIndex(index);
}}
/>
</div>
</Tooltip>
),
},
{
title: 'Order Type',
dataIndex: 'OrderType',
key: 'OrderType',
render: (_, record, index) =>
record.OrderType === 'E' ? 'End of Day (EOD)' : 'Immediate',
},
{
title: 'Confirmation Type',
dataIndex: 'OrderProcessing',
key: 'OrderProcessing',
render: (_, record, index) =>
record.OrderProcessing === 'Y' ? 'Need Confirmation' : 'Auto',
},
{
title: 'Reorder Quantity',
dataIndex: 'OrderQty',
key: 'OrderQty',
align: 'center',
},
{
title: 'Action',
dataIndex: 'Action',
key: 'Action',
width: '100px',
align: 'center',
render: (_, record, index) =>
record.ActiveStatus === 'A' ? (
<div
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
width: '100%',
gap: '10px',
}}
>
<EditFilled
style={{ color: '#1292EE' }}
onClick={() => handleEdit(record)}
/>
<DeleteFilled
style={{ color: '#FF4D4F' }}
onClick={() => handleActiveAndDeactive(record)}
/>
</div>
) : (
<ReloadOutlined
style={{ color: '#52C41A' }}
onClick={() => handleActiveAndDeactive(record)}
/>
),
},
];
const supplierColumns = [
{
title: 'SL.NO',
dataIndex: 'SLNO',
key: 'SLNO',
width: '10%',
render: (_, record, index) => index + 1,
},
{
title: 'Supplier Name',
dataIndex: 'SuppName',
key: 'SuppName',
width: '20%',
},
];
useEffect(() => {
try {
if (AppId && CompId && BranchId) {
dispatch(changeBreadCrumb({ items: items }));
fetchData();
if (state?.Notify) {
setMessageType(state?.Notify.messageType);
setMessageData(state?.Notify.messageData);
}
}
} catch (error) {
console.error(error, 'error: changeBreadCrumb');
}
}, [AppId, CompId, BranchId]);
useEffect(() => {
if (UserType === 'Employee') {
fetchApi();
}
}, [UserType]);
useEffect(() => {
let hasAccess = false;
if (UserType === 'Admin' || UserType === 'Super Admin') {
hasAccess = true;
} else if (UserType === 'Employee') {
hasAccess = empData?.AddAccess === 'Y';
} else if (UserType === 'Super Admin User') {
hasAccess = SAAccessCommonMaster?.AddAccess === 'Y';
}
setaddnewAccess(!hasAccess);
}, [empData, SAAccessCommonMaster, UserType]);
const fetchApi = async () => {
let data = {
CompId: CompId,
BranchId: BranchId,
AppId: AppId,
EmpId: UserId,
};
let response = await dispatch(getEmpAccess(data)).unwrap();
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
(item) => item.ConfigName === 'Automated Reorder'
);
setEmpData(datas?.[0]);
};
const AppId = getSession('AppId');
const CompId = getSession('CompId');
const BranchId = getSession('BranchId');
const UserId = getSession('UserId');
const UserType = getSession('UserType');
const [empData, setEmpData] = useState();
const [addnewAccess, setaddnewAccess] = useState(true);
const [messageType, setMessageType] = useState(null);
const [messageData, setMessageData] = useState(null);
const [supplierModalOpen, setSupplierModalOpen] = useState(false);
const [supplierRecords, setSupplierRecords] = useState([]);
const [supplierRecordIndex, setSupplierRecordIndex] = useState(null);
const [page, setPage] = useState(1);
const [searchedText, setSearchedText] = useState('');
const [tableData, setTableData] = useState([]);
const columns = [
{
title: 'SL.NO',
dataIndex: 'SLNO',
key: 'SLNO',
width: '10%',
render: (_, record, index) => index + 1,
align: 'center',
},
{
title: 'Product Name',
dataIndex: 'ProdName',
key: 'ProdName',
render: (_, record) => (
`${record.ProdName} (${record.UOMName})`
)
},
{
title: 'Supplier',
dataIndex: 'Supplier',
key: 'Supplier',
align: 'center',
render: (_, record, index) => (
// <div className="productMasterImageUpload">
<Tooltip title={record.SupplierDetails ? 'View Image' : 'Upload Image'}>
<div>
<FaRegEye
style={{ background: 'none', cursor: 'pointer' }}
size={22}
color={record.SupplierDetails && '#1F9B3A'}
onClick={() => {
setSupplierModalOpen(true);
setSupplierRecords(record.SupplierDetails);
setSupplierRecordIndex(index);
}}
/>
</div>
</Tooltip>
),
},
{
title: 'Order Type',
dataIndex: 'OrderType',
key: 'OrderType',
render: (_, record, index) => (
record.OrderType === 'E' ? 'End of Day (EOD)' : 'Immediate'
)
},
{
title: 'Confirmation Type',
dataIndex: 'OrderProcessing',
key: 'OrderProcessing',
render: (_, record, index) => (
record.OrderProcessing === 'Y' ? 'Need Confirmation' : 'Auto'
)
},
{
title: 'Reorder Quantity',
dataIndex: 'OrderQty',
key: 'OrderQty',
align: 'center',
},
{
title: 'Action',
dataIndex: 'Action',
key: 'Action',
width: '100px',
align: 'center',
render: (_, record, index) => (
record.ActiveStatus === 'A' ? (
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', width: '100%', gap: '10px' }}>
<EditFilled
style={{ color: '#1292EE' }}
onClick={() => handleEdit(record)}
/>
<DeleteFilled
style={{ color: '#FF4D4F' }}
onClick={() => handleActiveAndDeactive(record)}
/>
</div>
) : (
<ReloadOutlined
style={{ color: '#52C41A' }}
onClick={() => handleActiveAndDeactive(record)}
/>
)
),
},
];
const supplierColumns = [
{
title: 'SL.NO',
dataIndex: 'SLNO',
key: 'SLNO',
width: '10%',
render: (_, record, index) => index + 1
},
{
title: 'Supplier Name',
dataIndex: 'SuppName',
key: 'SuppName',
width: '20%',
}
];
useEffect(() => {
try {
if (AppId && CompId && BranchId) {
dispatch(changeBreadCrumb({ items: items }));
fetchData()
if (state?.Notify) {
setMessageType(state?.Notify.messageType);
setMessageData(state?.Notify.messageData);
}
}
} catch (error) {
console.error(error, 'error: changeBreadCrumb');
}
}, [AppId, CompId, BranchId]);
useEffect(() => {
if (UserType === 'Employee') {
fetchApi();
}
}, [UserType]);
useEffect(() => {
let hasAccess = false;
if (UserType === 'Admin' || UserType === 'Super Admin') {
hasAccess = true;
} else if (UserType === 'Employee') {
hasAccess = empData?.AddAccess === 'Y';
} else if (UserType === 'Super Admin User') {
hasAccess = SAAccessCommonMaster?.AddAccess === 'Y';
}
setaddnewAccess(!hasAccess);
}, [empData, SAAccessCommonMaster, UserType]);
const fetchApi = async () => {
let data = {
CompId: CompId,
BranchId: BranchId,
AppId: AppId,
EmpId: UserId,
};
let response = await dispatch(getEmpAccess(data)).unwrap();
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
(item) => item.ConfigName === 'Automated Reorder'
);
setEmpData(datas?.[0]);
};
const fetchData = async () => {
try {
const res = await dispatch(getAutomatedReorderList({ AppId, CompId, BranchId }))?.unwrap();
if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) {
setTableData(res?.data?.data)
} else {
setTableData([])
}
} catch (error) {
console.error(error, 'error: getAutomatedReorderList');
}
const fetchData = async () => {
try {
const res = await dispatch(
getAutomatedReorderList({ AppId, CompId, BranchId })
)?.unwrap();
if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) {
setTableData(res?.data?.data);
} else {
setTableData([]);
}
} catch (error) {
console.error(error, 'error: getAutomatedReorderList');
}
};
const onSearch = (value) => {
setSearchedText(value);
};
const onSearchChange = (e) => {
setSearchedText(e?.target?.value);
};
const onSearch = (value) => {
setSearchedText(value);
};
const onSearchChange = (e) => {
setSearchedText(e?.target?.value);
};
const handleAdd = () => {
navigate(`${subDirectory}setting/automated-reorder/new`);
const handleAdd = () => {
navigate(`${subDirectory}setting/automated-reorder/new`);
};
const handleEdit = (record) => {
navigate(`${subDirectory}setting/automated-reorder/update`, {
state: {
editstate: record,
},
});
};
const handleActiveAndDeactive = async (record) => {
const res = await dispatch(
deleteAutomatedReorder({
UniqueId: record?.UniqueId,
UpdatedBy: UserId,
ActiveStatus: record?.ActiveStatus === 'A' ? 'D' : 'A',
})
)?.unwrap();
if (res?.data?.statusCode === 1) {
setMessageType('success');
setMessageData(
record?.ActiveStatus === 'A'
? 'Deactivated Successfully'
: 'Activated Successfully'
);
fetchData();
} else {
setMessageType('error');
setMessageData(res?.data?.message);
}
};
const handleEdit = (record) => {
navigate(`${subDirectory}setting/automated-reorder/update`, {
state: {
editstate: record,
}
});
}
const handleActiveAndDeactive = async (record) => {
const res = await dispatch(deleteAutomatedReorder({ UniqueId: record?.UniqueId, UpdatedBy: UserId, ActiveStatus: record?.ActiveStatus === 'A' ? 'D' : 'A' }))?.unwrap();
if (res?.data?.statusCode === 1) {
setMessageType('success');
setMessageData(record?.ActiveStatus === 'A' ? 'Deactivated Successfully' : 'Activated Successfully');
fetchData();
} else {
setMessageType('error');
setMessageData(res?.data?.message);
}
}
const onComplete = useCallback(() => {
setMessageType(null);
setMessageData(null);
}, []);
const handlePageChange = (current) => {
setPage(current);
};
const onComplete = useCallback(() => {
setMessageType(null);
setMessageData(null);
}, []);
const handlePageChange = (current) => {
setPage(current);
};
return (
<section className="automated-reorder-list-container">
<Messages
messageType={messageType}
messageData={messageData}
onComplete={onComplete}
/>
<div className="automated-reorder-list-wrapper">
<div className="automated-reorder-list-header">
<div className="formAddNew">
<div>
<FormHeader title={'Automated Reorder'} />
</div>
<div className="searchAddDiv">
<div className="formSearch">
<Search
placeholder="Search"
onSearch={onSearch}
onSearchChange={onSearchChange}
/>
</div>
<Buttons
buttonText={'Add New'}
handleSubmit={handleAdd}
disabled={addnewAccess}
color="901D77"
icon={<PlusOutlined />}
/>
</div>
</div>
</div>
<div className="automated-reorder-list-content">
<Tables
columns={columns}
data={tableData}
ownPagination={true}
pagination={{
current: page,
onChange: handlePageChange,
defaultPageSize: 10,
showSizeChanger: false,
hideOnSinglePage: true
}}
/>
</div>
return (
<section className="automated-reorder-list-container">
<Messages
messageType={messageType}
messageData={messageData}
onComplete={onComplete}
/>
<div className="automated-reorder-list-wrapper">
<div className="automated-reorder-list-header">
<div className="formAddNew">
<div>
<FormHeader title={'Automated Reorder'} />
</div>
<DefaultModal
open={supplierModalOpen}
title={'Suppliers'}
width={500}
footer={false}
handleCancel={() => {
setSupplierModalOpen(false);
setSupplierRecords(null);
setSupplierRecordIndex(null);
}}
children={
<div className="automated-reorder-list-content">
<Tables
columns={supplierColumns}
data={supplierRecords}
/>
</div>
}
/>
</section>
)
}
<div className="searchAddDiv">
<div className="formSearch">
<Search
placeholder="Search"
onSearch={onSearch}
onSearchChange={onSearchChange}
/>
</div>
<Buttons
buttonText={'Add New'}
handleSubmit={handleAdd}
disabled={addnewAccess}
color="901D77"
icon={<PlusOutlined />}
/>
</div>
</div>
</div>
<div className="automated-reorder-list-content">
<Tables
columns={columns}
data={tableData}
ownPagination={true}
pagination={{
current: page,
onChange: handlePageChange,
defaultPageSize: 10,
showSizeChanger: false,
hideOnSinglePage: true,
}}
/>
</div>
</div>
<DefaultModal
open={supplierModalOpen}
title={'Suppliers'}
width={500}
footer={false}
handleCancel={() => {
setSupplierModalOpen(false);
setSupplierRecords(null);
setSupplierRecordIndex(null);
}}
children={
<div className="automated-reorder-list-content">
<Tables columns={supplierColumns} data={supplierRecords} />
</div>
}
/>
</section>
);
};
export default AutomatedReorderList
export default AutomatedReorderList;

View File

@ -54,7 +54,7 @@ const BSBillingEditQuantity = (props) => {
const quantityInputRef = useRef(null);
const priceChangeInputRef = useRef(null);
const reductionInputRef = useRef(null);
const { setIndex = () => {} } = props;
const { setIndex = () => { } } = props;
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
console.log(disableSubmitButton, 'disableSubmitButton');
@ -522,7 +522,15 @@ const BSBillingEditQuantity = (props) => {
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
cartItem?.OrderRate === editedProduct?.OrderRate &&
cartItem?.BookingTypeName === editedProduct?.BookingTypeName &&
!cartItem?.SalesId
!cartItem?.SalesId && ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
? true
: cartItem?.OfferMode !== 'B') &&
cartItem?.OfferMode !== 'P' &&
cartItem?.OfferMode !== 'C' &&
cartItem?.OfferMode !== 'O' &&
cartItem?.OfferMode !== 'L'
? true
: cartItem?.Offer === 0)
);
// changing for one piece stock checking
const isItemInCartfilter = CartOrderDetails?.filter(
@ -530,7 +538,15 @@ const BSBillingEditQuantity = (props) => {
cartItem?.ProdId === editedProduct?.ProdId &&
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
cartItem?.OrderRate !== editedProduct?.OrderRate &&
!cartItem?.SalesId
!cartItem?.SalesId && ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
? true
: cartItem?.OfferMode !== 'B') &&
cartItem?.OfferMode !== 'P' &&
cartItem?.OfferMode !== 'C' &&
cartItem?.OfferMode !== 'O' &&
cartItem?.OfferMode !== 'L'
? true
: cartItem?.Offer === 0)
);
const isItemInCartHold = CartOrderDetails?.find(
@ -538,7 +554,15 @@ const BSBillingEditQuantity = (props) => {
cartItem?.ProdId === editedProduct?.ProdId &&
cartItem?.InwardDtlId === editedProduct.InwardDtlId &&
cartItem?.OrderRate === editedProduct?.OrderRate &&
cartItem?.BookingTypeName === editedProduct?.BookingTypeName
cartItem?.BookingTypeName === editedProduct?.BookingTypeName && ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
? true
: cartItem?.OfferMode !== 'B') &&
cartItem?.OfferMode !== 'P' &&
cartItem?.OfferMode !== 'C' &&
cartItem?.OfferMode !== 'O' &&
cartItem?.OfferMode !== 'L'
? true
: cartItem?.Offer === 0)
); // check if the item is already in the cart
const isItemInCartHoldfilter = CartOrderDetails?.filter(
(cartItem) =>
@ -547,7 +571,15 @@ const BSBillingEditQuantity = (props) => {
!(
(cartItem?.OrderRate === editedProduct?.OrderRate)
// && cartItem?.BookingTypeName === editedProduct?.BookingTypeName
)
) && ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
? true
: cartItem?.OfferMode !== 'B') &&
cartItem?.OfferMode !== 'P' &&
cartItem?.OfferMode !== 'C' &&
cartItem?.OfferMode !== 'O' &&
cartItem?.OfferMode !== 'L'
? true
: cartItem?.Offer === 0)
);
if (
@ -809,7 +841,7 @@ const BSBillingEditQuantity = (props) => {
return (
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
cartItem?.OfferMessage?.[0]?.OfferId ===
editedProduct?.OfferMessage?.[0]?.OfferId &&
editedProduct?.OfferMessage?.[0]?.OfferId &&
cartItem?.OfferMode === editedProduct?.OfferMode &&
cartItem?.BookingTypeName !== editedProduct?.BookingTypeName
);
@ -943,7 +975,7 @@ const BSBillingEditQuantity = (props) => {
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
cartItem?.OrderRate === editedProduct?.OrderRate &&
cartItem?.BookingTypeName !==
editedProduct?.BookingTypeName &&
editedProduct?.BookingTypeName &&
!cartItem?.OfferMode &&
cartItem?.Offer === 0
);
@ -957,7 +989,7 @@ const BSBillingEditQuantity = (props) => {
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
cartItem?.OrderRate === editedProduct?.OrderRate &&
cartItem?.BookingTypeName !==
editedProduct?.BookingTypeName &&
editedProduct?.BookingTypeName &&
cartItem?.OfferMode === editedProduct?.OfferMode &&
cartItem?.Offer > 0
);
@ -1090,7 +1122,7 @@ const BSBillingEditQuantity = (props) => {
)
) &&
product?.OfferId ===
editedProduct?.OfferMessage?.[0]?.OfferId &&
editedProduct?.OfferMessage?.[0]?.OfferId &&
product?.OfferMode === editedProduct?.OfferMode
) {
const freeQty =
@ -1123,7 +1155,7 @@ const BSBillingEditQuantity = (props) => {
// Also check main offer conditions
const isMatchingOffer =
offerProduct?.OfferId ===
editedProduct?.OfferMessage?.[0]?.OfferId &&
editedProduct?.OfferMessage?.[0]?.OfferId &&
offerProduct?.OfferMode === editedProduct?.OfferMode;
if (hasMatchingFreeProduct && isMatchingOffer) {
@ -1206,7 +1238,7 @@ const BSBillingEditQuantity = (props) => {
)
) &&
product?.OfferId ===
editedProduct?.OfferMessage?.[0]?.OfferId &&
editedProduct?.OfferMessage?.[0]?.OfferId &&
product?.OfferMode === editedProduct?.OfferMode
) {
return {
@ -1236,7 +1268,7 @@ const BSBillingEditQuantity = (props) => {
// Also check main offer conditions
const isMatchingOffer =
offerProduct?.OfferId ===
editedProduct?.OfferMessage?.[0]?.OfferId &&
editedProduct?.OfferMessage?.[0]?.OfferId &&
offerProduct?.OfferMode === editedProduct?.OfferMode;
if (hasMatchingFreeProduct && isMatchingOffer) {
@ -1423,7 +1455,7 @@ const BSBillingEditQuantity = (props) => {
// Also check main offer conditions
const isMatchingOffer =
offerProduct?.OfferId ===
editedProduct?.OfferMessage?.[0]?.OfferId &&
editedProduct?.OfferMessage?.[0]?.OfferId &&
offerProduct?.OfferMode === editedProduct?.OfferMode;
if (hasMatchingFreeProduct && isMatchingOffer) {
@ -1525,7 +1557,7 @@ const BSBillingEditQuantity = (props) => {
// Also check main offer conditions
const isMatchingOffer =
offerProduct?.OfferId ===
editedProduct?.OfferMessage?.[0]?.OfferId &&
editedProduct?.OfferMessage?.[0]?.OfferId &&
offerProduct?.OfferMode === editedProduct?.OfferMode;
if (hasMatchingFreeProduct && isMatchingOffer) {
@ -1679,7 +1711,7 @@ const BSBillingEditQuantity = (props) => {
) &&
cartItem?.Offer &&
isFreeProductApplicable?.OfferId ===
cartItem?.OfferMessage?.[0]?.OfferId
cartItem?.OfferMessage?.[0]?.OfferId
);
}
);
@ -1968,11 +2000,11 @@ const BSBillingEditQuantity = (props) => {
product?.ProdId === editedProduct?.ProdId &&
product?.InwardDtlId === editedProduct?.InwardDtlId &&
product?.OfferId ===
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
product?.OfferMode ===
(sameBookingTypeProduct?.OfferMode ||
otherBookingTypeProduct?.OfferMode)
(sameBookingTypeProduct?.OfferMode ||
otherBookingTypeProduct?.OfferMode)
) {
return {
...product,
@ -2006,11 +2038,11 @@ const BSBillingEditQuantity = (props) => {
// Also check main offer conditions
const isMatchingOffer =
offerProduct?.OfferId ===
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
offerProduct?.OfferMode ===
(sameBookingTypeProduct?.OfferMode ||
otherBookingTypeProduct?.OfferMode);
(sameBookingTypeProduct?.OfferMode ||
otherBookingTypeProduct?.OfferMode);
if (hasMatchingFreeProduct && isMatchingOffer) {
// Get loyalty points from the matching free product
@ -2151,7 +2183,7 @@ const BSBillingEditQuantity = (props) => {
cartItem?.Offer > 0 &&
isFreeProductApplicable?.OfferMode === cartItem?.OfferMode &&
isFreeProductApplicable?.OfferId ===
cartItem?.OfferMessage?.[0]?.OfferId
cartItem?.OfferMessage?.[0]?.OfferId
);
}
);
@ -2254,11 +2286,11 @@ const BSBillingEditQuantity = (props) => {
if (
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
cartItem.InwardDtlId ===
otherBookingTypeProduct.InwardDtlId &&
otherBookingTypeProduct.InwardDtlId &&
cartItem.BookingTypeName ===
otherBookingTypeProduct.BookingTypeName &&
otherBookingTypeProduct.BookingTypeName &&
cartItem.OrderRate ===
otherBookingTypeProduct.OrderRate &&
otherBookingTypeProduct.OrderRate &&
cartItem.OfferMode &&
cartItem.Offer > 0
) {
@ -2329,12 +2361,12 @@ const BSBillingEditQuantity = (props) => {
product?.ProdId === editedProduct?.ProdId &&
product?.InwardDtlId === editedProduct?.InwardDtlId &&
product?.OfferId ===
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
?.OfferId) &&
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
?.OfferId) &&
product?.OfferMode ===
(sameBookingTypeFreeProduct?.OfferMode ||
otherBookingTypeFreeProduct?.OfferMode)
(sameBookingTypeFreeProduct?.OfferMode ||
otherBookingTypeFreeProduct?.OfferMode)
) {
return {
...product,
@ -2368,13 +2400,13 @@ const BSBillingEditQuantity = (props) => {
// Also check main offer conditions
const isMatchingOffer =
offerProduct?.OfferId ===
(sameBookingTypeFreeProduct?.OfferMessage?.[0]
?.OfferId ||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
?.OfferId) &&
(sameBookingTypeFreeProduct?.OfferMessage?.[0]
?.OfferId ||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
?.OfferId) &&
offerProduct?.OfferMode ===
(sameBookingTypeFreeProduct?.OfferMode ||
otherBookingTypeFreeProduct?.OfferMode);
(sameBookingTypeFreeProduct?.OfferMode ||
otherBookingTypeFreeProduct?.OfferMode);
if (hasMatchingFreeProduct && isMatchingOffer) {
// Get loyalty points from the matching free product
@ -2456,11 +2488,11 @@ const BSBillingEditQuantity = (props) => {
if (
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
cartItem.InwardDtlId ===
sameBookingTypeProduct.InwardDtlId &&
sameBookingTypeProduct.InwardDtlId &&
cartItem.BookingTypeName ===
sameBookingTypeProduct.BookingTypeName &&
sameBookingTypeProduct.BookingTypeName &&
cartItem.OrderRate ===
sameBookingTypeProduct.OrderRate &&
sameBookingTypeProduct.OrderRate &&
cartItem.OfferMode &&
cartItem.Offer > 0
) {
@ -2513,11 +2545,11 @@ const BSBillingEditQuantity = (props) => {
if (
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
cartItem.InwardDtlId ===
sameBookingTypeProduct.InwardDtlId &&
sameBookingTypeProduct.InwardDtlId &&
cartItem.BookingTypeName ===
sameBookingTypeProduct.BookingTypeName &&
sameBookingTypeProduct.BookingTypeName &&
cartItem.OrderRate ===
sameBookingTypeProduct.OrderRate &&
sameBookingTypeProduct.OrderRate &&
cartItem.OfferMode &&
cartItem.Offer > 0
) {
@ -2606,11 +2638,11 @@ const BSBillingEditQuantity = (props) => {
if (
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
cartItem?.InwardDtlId ===
otherBookingTypeProduct.InwardDtlId &&
otherBookingTypeProduct.InwardDtlId &&
cartItem?.BookingTypeName ===
otherBookingTypeProduct.BookingTypeName &&
otherBookingTypeProduct.BookingTypeName &&
cartItem?.OrderRate ===
otherBookingTypeProduct.OrderRate &&
otherBookingTypeProduct.OrderRate &&
cartItem?.OfferMode &&
cartItem?.Offer > 0
) {
@ -2639,11 +2671,11 @@ const BSBillingEditQuantity = (props) => {
if (
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
cartItem.InwardDtlId ===
otherBookingTypeProduct.InwardDtlId &&
otherBookingTypeProduct.InwardDtlId &&
cartItem.BookingTypeName ===
otherBookingTypeProduct.BookingTypeName &&
otherBookingTypeProduct.BookingTypeName &&
cartItem.OrderRate ===
otherBookingTypeProduct.OrderRate &&
otherBookingTypeProduct.OrderRate &&
cartItem.OfferMode &&
cartItem.Offer > 0
) {
@ -2673,11 +2705,11 @@ const BSBillingEditQuantity = (props) => {
if (
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
cartItem.InwardDtlId ===
otherBookingTypeProduct.InwardDtlId &&
otherBookingTypeProduct.InwardDtlId &&
cartItem.BookingTypeName ===
otherBookingTypeProduct.BookingTypeName &&
otherBookingTypeProduct.BookingTypeName &&
cartItem.OrderRate ===
otherBookingTypeProduct.OrderRate &&
otherBookingTypeProduct.OrderRate &&
cartItem.OfferMode &&
cartItem.Offer > 0
) {
@ -2776,12 +2808,12 @@ const BSBillingEditQuantity = (props) => {
product?.ProdId === editedProduct?.ProdId &&
product?.InwardDtlId === editedProduct?.InwardDtlId &&
product?.OfferId ===
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
?.OfferId) &&
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
?.OfferId) &&
product?.OfferMode ===
(sameBookingTypeFreeProduct?.OfferMode ||
otherBookingTypeFreeProduct?.OfferMode)
(sameBookingTypeFreeProduct?.OfferMode ||
otherBookingTypeFreeProduct?.OfferMode)
) {
return {
...product,
@ -2815,12 +2847,12 @@ const BSBillingEditQuantity = (props) => {
// Also check main offer conditions
const isMatchingOffer =
offerProduct?.OfferId ===
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeProduct?.OfferMessage?.[0]
?.OfferId) &&
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeProduct?.OfferMessage?.[0]
?.OfferId) &&
offerProduct?.OfferMode ===
(sameBookingTypeProduct?.OfferMode ||
otherBookingTypeProduct?.OfferMode);
(sameBookingTypeProduct?.OfferMode ||
otherBookingTypeProduct?.OfferMode);
if (hasMatchingFreeProduct && isMatchingOffer) {
// Get loyalty points from the matching free product
@ -2899,11 +2931,11 @@ const BSBillingEditQuantity = (props) => {
if (
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
cartItem.InwardDtlId ===
sameBookingTypeProduct.InwardDtlId &&
sameBookingTypeProduct.InwardDtlId &&
cartItem.BookingTypeName ===
sameBookingTypeProduct.BookingTypeName &&
sameBookingTypeProduct.BookingTypeName &&
cartItem.OrderRate ===
sameBookingTypeProduct.OrderRate &&
sameBookingTypeProduct.OrderRate &&
cartItem.OfferMode &&
cartItem.Offer > 0
) {
@ -2962,11 +2994,11 @@ const BSBillingEditQuantity = (props) => {
if (
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
cartItem.InwardDtlId ===
otherBookingTypeProduct.InwardDtlId &&
otherBookingTypeProduct.InwardDtlId &&
cartItem.BookingTypeName ===
otherBookingTypeProduct.BookingTypeName &&
otherBookingTypeProduct.BookingTypeName &&
cartItem.OrderRate ===
otherBookingTypeProduct.OrderRate &&
otherBookingTypeProduct.OrderRate &&
cartItem.OfferMode &&
cartItem.Offer > 0
) {
@ -3038,12 +3070,12 @@ const BSBillingEditQuantity = (props) => {
product?.ProdId === editedProduct?.ProdId &&
product?.InwardDtlId === editedProduct?.InwardDtlId &&
product?.OfferId ===
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
?.OfferId) &&
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
?.OfferId) &&
product?.OfferMode ===
(sameBookingTypeFreeProduct?.OfferMode ||
otherBookingTypeFreeProduct?.OfferMode)
(sameBookingTypeFreeProduct?.OfferMode ||
otherBookingTypeFreeProduct?.OfferMode)
) {
return {
...product,
@ -3077,12 +3109,12 @@ const BSBillingEditQuantity = (props) => {
// Also check main offer conditions
const isMatchingOffer =
offerProduct?.OfferId ===
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeProduct?.OfferMessage?.[0]
?.OfferId) &&
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeProduct?.OfferMessage?.[0]
?.OfferId) &&
offerProduct?.OfferMode ===
(sameBookingTypeProduct?.OfferMode ||
otherBookingTypeProduct?.OfferMode);
(sameBookingTypeProduct?.OfferMode ||
otherBookingTypeProduct?.OfferMode);
if (hasMatchingFreeProduct && isMatchingOffer) {
// Get loyalty points from the matching free product
@ -3217,21 +3249,21 @@ const BSBillingEditQuantity = (props) => {
}),
...(!offerApply && itemDiscountPrice > 0
? {
DiscountAmt: safeRound(itemDiscountPrice * fixedQty),
DiscountType:
itemDiscountPercentageSelection === 'Fixed' ? 'F' : 'P',
DiscountValue:
itemDiscountPercentageSelection === 'Fixed'
? itemDiscountPrice * fixedQty
: ((itemDiscountPrice * fixedQty) /
(newPrice > 0 ? newPrice : editedProduct?.OrderRate)) *
100,
}
DiscountAmt: safeRound(itemDiscountPrice * fixedQty),
DiscountType:
itemDiscountPercentageSelection === 'Fixed' ? 'F' : 'P',
DiscountValue:
itemDiscountPercentageSelection === 'Fixed'
? itemDiscountPrice * fixedQty
: ((itemDiscountPrice * fixedQty) /
(newPrice > 0 ? newPrice : editedProduct?.OrderRate)) *
100,
}
: {
DiscountAmt: null,
DiscountType: null,
DiscountValue: null,
}),
DiscountAmt: null,
DiscountType: null,
DiscountValue: null,
}),
};
if (hasOffer) {
@ -3256,17 +3288,17 @@ const BSBillingEditQuantity = (props) => {
changeOrderCardDetails(
CartOrderDetails?.map((i) =>
i?.InwardDtlId == updatedProduct?.InwardDtlId &&
i?.BookingTypeName == updatedProduct?.BookingTypeName &&
i?.localId === updatedProduct?.localId
i?.BookingTypeName == updatedProduct?.BookingTypeName &&
i?.localId === updatedProduct?.localId
? {
...updatedProduct,
Offer: 0,
OfferType:
updatedProduct?.Type === 'C'
? updatedProduct?.OfferType
: null,
OfferMessage: null,
}
...updatedProduct,
Offer: 0,
OfferType:
updatedProduct?.Type === 'C'
? updatedProduct?.OfferType
: null,
OfferMessage: null,
}
: i
)
)
@ -3302,10 +3334,10 @@ const BSBillingEditQuantity = (props) => {
((c?.OfferModeType && c?.OfferMode === 'B'
? true
: c?.OfferMode !== 'B') &&
c?.OfferMode !== 'P' &&
c?.OfferMode !== 'C' &&
c?.OfferMode !== 'O' &&
c?.OfferMode !== 'L'
c?.OfferMode !== 'P' &&
c?.OfferMode !== 'C' &&
c?.OfferMode !== 'O' &&
c?.OfferMode !== 'L'
? true
: c?.Offer === 0);
@ -4040,14 +4072,14 @@ const BSBillingEditQuantity = (props) => {
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
{((RadioBtnSelection == 'Price' && disableSubmitButton) ||
RadioBtnSelection == 'Quantity') && (
<Buttons
buttonText="Submit"
color="901D77"
htmlType
// handleSubmit={AddProductQuantity}
icon={<ArrowRightOutlined />}
></Buttons>
)}
<Buttons
buttonText="Submit"
color="901D77"
htmlType
// handleSubmit={AddProductQuantity}
icon={<ArrowRightOutlined />}
></Buttons>
)}
</div>
</Form>
</div>

View File

@ -127,6 +127,7 @@ import {
changeSearchedData,
GlobalSelectedCustDisable,
GlobalOrderStatus,
PostCancelPayment,
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities';
import {
@ -944,7 +945,7 @@ export default function BST1Payment() {
const selectedStyle =
stylesMap[
printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle
printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle
];
if (selectedStyle) {
@ -1392,6 +1393,15 @@ export default function BST1Payment() {
: AddBookingDetails(BookingType, true);
}
};
// PostCancelPayment
const CancelPayment = async () => {
const response = await dispatch(PostCancelPayment({OrderId: businessUPIOrderId})).unwrap()
if (response?.data?.statusCode) {
ClearAllGlobalStateDatas();
CustomerDisplay();
setBusinessUPI(false);
}
}
const financialYearError = async () => {
setMessageType('error');
setMessageData('Financial Year-Based Sales Not Yet Started');
@ -2069,15 +2079,15 @@ export default function BST1Payment() {
OrderStatus: 'O',
OrderType:
BookingType === 'Dine In' ||
BookingTypeBoth ||
Estimation?.SettingValue == 'N'
BookingTypeBoth ||
Estimation?.SettingValue == 'N'
? 'S'
: GlobEstBooking === 'OvrAllEst'
? 'E'
: GlobEstBooking === 'ParEst'
? GlobProdwisedata?.includes(
a.InwardDtlId + ' ' + a?.BookingTypeName
)
a.InwardDtlId + ' ' + a?.BookingTypeName
)
? 'E'
: 'S'
: 'S',
@ -2170,7 +2180,7 @@ export default function BST1Payment() {
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'S'
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default'
SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S'
: 'P',
OrderDtlDetails:
@ -2187,9 +2197,9 @@ export default function BST1Payment() {
? globalTipAmount === 0
? SelectedTableDetails
: SelectedTableDetails?.map((item) => ({
...item,
TipsAmount: globalTipAmount,
}))
...item,
TipsAmount: globalTipAmount,
}))
: null,
SalesPaymentType: 'normal',
@ -2205,8 +2215,8 @@ export default function BST1Payment() {
? PaymentgatewayUPI?.[0]?.ModeId
: SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find(
(busupi) => busupi?.ModeId === UpiId
)?.ModeId
(busupi) => busupi?.ModeId === UpiId
)?.ModeId
: paybtnselected
: paybtnselected
? paybtnselected
@ -2219,15 +2229,15 @@ export default function BST1Payment() {
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'business'
SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantId
?.MerchantId
: null,
PaymentOptionType:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'PC'
@ -2247,29 +2257,29 @@ export default function BST1Payment() {
? null
: SelectedUPIPayOption?.toLowerCase() === 'default'
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
?.UPIDetailId
?.UPIDetailId
: SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find(
(busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
(busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
: null,
AccountDtl:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? []
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default'
SelectedUPIPayOption?.toLowerCase() === 'default'
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
(upipay) => upipay?.UPIId === UpiId
)
(upipay) => upipay?.UPIId === UpiId
)
: (Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'pd') ||
(Paybtnnameselected?.toLowerCase() === 'card' &&
SelectedCardOption?.toLowerCase() === 'pd')
SelectedUPIPayOption?.toLowerCase() === 'pd') ||
(Paybtnnameselected?.toLowerCase() === 'card' &&
SelectedCardOption?.toLowerCase() === 'pd')
? useOptions?.[0]?.PaymentDetails?.PaymentDevice
: (Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'pg') ||
(Paybtnnameselected?.toLowerCase() === 'card' &&
SelectedCardOption?.toLowerCase() === 'pg')
SelectedUPIPayOption?.toLowerCase() === 'pg') ||
(Paybtnnameselected?.toLowerCase() === 'card' &&
SelectedCardOption?.toLowerCase() === 'pg')
? useOptions?.[0]?.PaymentDetails?.PaymentGateway
: [],
PaymentStatus:
@ -2280,13 +2290,13 @@ export default function BST1Payment() {
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'S'
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default'
SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S'
: 'P',
Debit:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
? Math.round(previousNetAmount - currentOrderNetAmount)
: 0,
Credit: salesBillEdit
@ -2362,14 +2372,14 @@ export default function BST1Payment() {
setMessageType('success');
setMessageData(
response?.data?.response +
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
);
response?.data?.OrderDetails?.length > 0 &&
setPrintOrderDetails([response?.data]);
@ -2526,14 +2536,14 @@ export default function BST1Payment() {
setMessageType('success');
setMessageData(
response?.data?.response +
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
);
response?.data?.OrderDetails?.length > 0 &&
setPrintOrderDetails([response?.data]);
@ -2634,14 +2644,14 @@ export default function BST1Payment() {
}
setMessageData(
response?.data?.response +
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
);
if (response?.data?.OrderDetails?.length > 0) {
setPrintOrderDetails([response?.data]);
@ -2816,14 +2826,14 @@ export default function BST1Payment() {
setMessageType('success');
setMessageData(
bookingpaymentupdate?.data?.response +
' ' +
(bookingpaymentupdate?.data?.OrderDetails?.length > 0
? bookingpaymentupdate?.data?.OrderId &&
extractLastNumberOrderId(
bookingpaymentupdate?.data?.OrderId,
bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus
)
: '')
' ' +
(bookingpaymentupdate?.data?.OrderDetails?.length > 0
? bookingpaymentupdate?.data?.OrderId &&
extractLastNumberOrderId(
bookingpaymentupdate?.data?.OrderId,
bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus
)
: '')
);
bookingpaymentupdate?.data?.OrderDetails?.length > 0 &&
setPrintOrderDetails([bookingpaymentupdate?.data]);
@ -2841,7 +2851,7 @@ export default function BST1Payment() {
if (
Date.now() - startTime >
useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes *
60000
60000
) {
// 60,000 ms = 1 minute
@ -3650,29 +3660,29 @@ export default function BST1Payment() {
{tableOptions.find(
(item) => item.OptionName === 'AddCustomer'
) && (
<div
style={{
display: 'flex',
alignItems: 'center',
columnGap: '0.5rem',
}}
>
<BSCustomerSelect />
<div
style={{
display: 'flex',
alignItems: 'center',
columnGap: '0.5rem',
}}
>
<BSCustomerSelect />
<TooltipWrapper title={'Add Customer'} isMobile={isMobile}>
{' '}
<PozoAddCustomerIcon
className="BSBillingNav-icon-table-icon"
onClick={handleAddCustomer}
style={{
fontSize: '25px',
color: selOption || GetCustId ? '#52c41a' : '#1292EE',
cursor: Custdisable ? 'not-allowed' : 'pointer',
}}
/>
</TooltipWrapper>
</div>
)}
<TooltipWrapper title={'Add Customer'} isMobile={isMobile}>
{' '}
<PozoAddCustomerIcon
className="BSBillingNav-icon-table-icon"
onClick={handleAddCustomer}
style={{
fontSize: '25px',
color: selOption || GetCustId ? '#52c41a' : '#1292EE',
cursor: Custdisable ? 'not-allowed' : 'pointer',
}}
/>
</TooltipWrapper>
</div>
)}
</div>
</div>
</div>
@ -3735,31 +3745,31 @@ export default function BST1Payment() {
(BookingType === 'Dine In' ||
BookingTypeBoth ||
CheckOrderType?.length > 0) &&
!unpaidFlow &&
OrderStatus
!unpaidFlow &&
OrderStatus
? 'none'
: 'auto',
opacity:
(BookingType === 'Dine In' ||
BookingTypeBoth ||
CheckOrderType?.length > 0) &&
!unpaidFlow &&
OrderStatus
!unpaidFlow &&
OrderStatus
? 0.5
: 1,
}}
>
{paybtns?.length > 0 &&
currentOrderNetAmount >= previousNetAmount ? (
currentOrderNetAmount >= previousNetAmount ? (
paybtns?.map((payment) => (
<div className="Table3-cash">
<button
className={
paybtnselected === payment.ModeId &&
(UpinotSelected || CardoptionnotSelected)
(UpinotSelected || CardoptionnotSelected)
? 'Btn-payment-mode-notupisel'
: paybtnselected === payment.ModeId &&
(!UpinotSelected || !CardoptionnotSelected)
(!UpinotSelected || !CardoptionnotSelected)
? 'Btn-payment-mode'
: 'Btn-payment-mode-sel'
}
@ -3773,13 +3783,13 @@ export default function BST1Payment() {
onClick={() =>
payment?.ModeName?.toLowerCase() === 'upi' // Change the condition to payment.Id
? handleUPIButtonClick(
payment.ModeId,
payment.ModeName
)
payment.ModeId,
payment.ModeName
)
: handlePaymentMode(
payment.ModeId,
payment.ModeName
)
payment.ModeId,
payment.ModeName
)
}
>
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
@ -3838,10 +3848,10 @@ export default function BST1Payment() {
<button
className={
refundPaySelected === payment.ConfigId &&
(UpinotSelected || CardoptionnotSelected)
(UpinotSelected || CardoptionnotSelected)
? 'Btn-payment-mode-notupisel'
: refundPaySelected === payment.ConfigId &&
(!UpinotSelected || !CardoptionnotSelected)
(!UpinotSelected || !CardoptionnotSelected)
? 'Btn-payment-mode'
: 'Btn-payment-mode-sel'
}
@ -3916,9 +3926,9 @@ export default function BST1Payment() {
OrderCardDetail?.length > 0 && 'not-allowed',
color:
OrderCardDetail?.length > 0 ||
(selOption?.value === undefined &&
GlobalAddCustomerDetails1?.length === 0 &&
GetCustId?.CustMobile === undefined)
(selOption?.value === undefined &&
GlobalAddCustomerDetails1?.length === 0 &&
GetCustId?.CustMobile === undefined)
? 'gray'
: 'rgb(18, 146, 238)',
fontSize: '28px',
@ -3968,16 +3978,16 @@ export default function BST1Payment() {
(BookingType === 'Dine In' ||
BookingTypeBoth ||
CheckOrderType?.length > 0) &&
!unpaidFlow &&
OrderStatus
!unpaidFlow &&
OrderStatus
? 'none'
: 'auto',
opacity:
(BookingType === 'Dine In' ||
BookingTypeBoth ||
CheckOrderType?.length > 0) &&
!unpaidFlow &&
OrderStatus
!unpaidFlow &&
OrderStatus
? 0.5
: 1,
}}
@ -3996,14 +4006,14 @@ export default function BST1Payment() {
width: '1.5rem',
cursor:
OrderCardDetail?.length === 0 ||
CheckBookingStatus == 'Close' ||
addnewAccess
CheckBookingStatus == 'Close' ||
addnewAccess
? 'not-allowed'
: 'pointer',
color:
OrderCardDetail?.length === 0 ||
CheckBookingStatus == 'Close' ||
addnewAccess
CheckBookingStatus == 'Close' ||
addnewAccess
? 'gray'
: 'rgb(18, 146, 238)',
display: 'flex',
@ -4040,8 +4050,8 @@ export default function BST1Payment() {
cursor: OrderCardDetail?.length > 0 && 'not-allowed',
color:
OrderCardDetail?.length > 0 ||
(OrderCardDetail?.length > 0 &&
GetCustId?.CustMobile === undefined)
(OrderCardDetail?.length > 0 &&
GetCustId?.CustMobile === undefined)
? 'gray'
: 'rgb(18, 146, 238)',
fontSize: '25px',
@ -4070,14 +4080,14 @@ export default function BST1Payment() {
width: '1.5rem',
cursor:
OrderCardDetail?.length === 0 ||
CheckBookingStatus == 'Close' ||
addnewAccess
CheckBookingStatus == 'Close' ||
addnewAccess
? 'not-allowed'
: 'pointer',
color:
OrderCardDetail?.length === 0 ||
CheckBookingStatus == 'Close' ||
addnewAccess
CheckBookingStatus == 'Close' ||
addnewAccess
? 'gray'
: 'rgb(18, 146, 238)',
display: 'flex',
@ -4159,58 +4169,58 @@ export default function BST1Payment() {
<div>
{unpaidFlow == false
? holdCheckedSalesSetup &&
BookingType !== 'Dine In' &&
!BookingTypeBoth &&
OrderCardDetail?.length != 0 &&
CheckOrderType?.length === 0 &&
OrderType != 'Failed' &&
CheckBookingStatus != 'Close' &&
paybtns?.length > 0 &&
!addnewAccess && (
<TooltipWrapper title={'Hold'} isMobile={isMobile}>
{' '}
<PozoHoldIcon
className="BSBillingNav-icon-table-icon"
onClick={() => AddBookingDetails('Hold')}
style={{
fontSize: '30px',
cursor: 'pointer',
color: '' ? '#52c41a' : '#1292EE',
}}
/>
</TooltipWrapper>
)
BookingType !== 'Dine In' &&
!BookingTypeBoth &&
OrderCardDetail?.length != 0 &&
CheckOrderType?.length === 0 &&
OrderType != 'Failed' &&
CheckBookingStatus != 'Close' &&
paybtns?.length > 0 &&
!addnewAccess && (
<TooltipWrapper title={'Hold'} isMobile={isMobile}>
{' '}
<PozoHoldIcon
className="BSBillingNav-icon-table-icon"
onClick={() => AddBookingDetails('Hold')}
style={{
fontSize: '30px',
cursor: 'pointer',
color: '' ? '#52c41a' : '#1292EE',
}}
/>
</TooltipWrapper>
)
: ''}
{unpaidFlow == false
? holdCheckedSalesSetup &&
paybtns?.length > 0 &&
BookingType !== 'Dine In' &&
!BookingTypeBoth &&
Holddata?.length > 0 &&
OrderCardDetail?.length == 0 &&
CheckBookingStatus != 'Close' &&
!addnewAccess && (
<TooltipWrapper title={'Recall'} isMobile={isMobile}>
{' '}
<Badge
count={Holddata?.length}
size={'small'}
offset={[0, 7]}
>
<PozoHoldIcon
className="BSBillingNav-icon-table-icon"
onClick={() => HandleholdModelOpen()}
style={{
fontSize: '28px',
cursor: 'pointer',
color: Holddata ? '#52c41a' : 'default',
pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}}
/>
</Badge>
</TooltipWrapper>
)
paybtns?.length > 0 &&
BookingType !== 'Dine In' &&
!BookingTypeBoth &&
Holddata?.length > 0 &&
OrderCardDetail?.length == 0 &&
CheckBookingStatus != 'Close' &&
!addnewAccess && (
<TooltipWrapper title={'Recall'} isMobile={isMobile}>
{' '}
<Badge
count={Holddata?.length}
size={'small'}
offset={[0, 7]}
>
<PozoHoldIcon
className="BSBillingNav-icon-table-icon"
onClick={() => HandleholdModelOpen()}
style={{
fontSize: '28px',
cursor: 'pointer',
color: Holddata ? '#52c41a' : 'default',
pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}}
/>
</Badge>
</TooltipWrapper>
)
: ''}
</div>
)}
@ -4253,9 +4263,9 @@ export default function BST1Payment() {
addnewAccess
? 'price-button-disabled'
: FirstPaymentclick === false &&
OrderCardDetail?.length > 0 &&
paybtnselected &&
CheckBookingStatus != 'Close'
OrderCardDetail?.length > 0 &&
paybtnselected &&
CheckBookingStatus != 'Close'
? !OrderStatus
? salesBillEdit &&
currentOrderNetAmount < previousNetAmount
@ -4277,7 +4287,7 @@ export default function BST1Payment() {
{isMobile ? (
!OrderStatus ? (
salesBillEdit &&
currentOrderNetAmount < previousNetAmount ? (
currentOrderNetAmount < previousNetAmount ? (
<div>
Refund:
{(previousNetAmount || 0) -
@ -4503,14 +4513,14 @@ export default function BST1Payment() {
OrderType === 'Failed'
? FailedTotalAmt
: Math.round(
OrderCardDetail?.reduce(
(acc, data) => data?.TotalAmt + acc,
0
) -
((OverAllSales > 0 ? OverAllSales : 0) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0))
)
OrderCardDetail?.reduce(
(acc, data) => data?.TotalAmt + acc,
0
) -
((OverAllSales > 0 ? OverAllSales : 0) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0))
)
}
failedOrderData={failedOrderData}
/>
@ -4643,9 +4653,9 @@ export default function BST1Payment() {
const qty = isGroup
? OrderCardDetail.filter((o) => o.id === groupKey).reduce(
(sum, o) => sum + (o.OrderQty || 1),
0
)
(sum, o) => sum + (o.OrderQty || 1),
0
)
: item.OrderQty || 1;
return (
@ -4728,6 +4738,7 @@ export default function BST1Payment() {
handleCancel={() => setShowCancelConfirm(true)}
footer={false}
width={500}
destroyOnClose={true}
children={
<>
<PaymentGatewayEmbedded
@ -4744,14 +4755,27 @@ export default function BST1Payment() {
}
/>
{showCancelConfirm && (
// <Modal
// open={showCancelConfirm}
// title="Cancel Payment"
// onOk={() => {
// setBusinessUPI(false);
// setShowCancelConfirm(false);
// ClearAllGlobalStateDatas();
// CustomerDisplay();
// }}
// onCancel={() => setShowCancelConfirm(false)}
// okText="Yes"
// cancelText="No"
// >
// Do you want to cancel the payment?
// </Modal>
<Modal
open={showCancelConfirm}
title="Cancel Payment"
onOk={() => {
setBusinessUPI(false);
setShowCancelConfirm(false);
ClearAllGlobalStateDatas();
CustomerDisplay();
CancelPayment()
}}
onCancel={() => setShowCancelConfirm(false)}
okText="Yes"

View File

@ -217,16 +217,16 @@ const BSBillingTable3 = (Props) => {
OrderType === 'Hold'
? tableData?.filter((a, b) => a.BookingTypeName === 'TakeAway')
: tableData?.filter(
(a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
);
(a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
);
const OldtableDataDinein = tableData?.filter(
(a, b) => a.BookingTypeName === 'Dine In' && a?.SalesId
);
const OldtableDataTakeAway =
OrderType != 'Hold'
? tableData?.filter(
(a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
)
(a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
)
: [];
const [EditQuantity, setEditQuantity] = useState(false);
const [Modaldata, setModaldata] = useState([]);
@ -473,27 +473,27 @@ const BSBillingTable3 = (Props) => {
) {
if (BillOrderPre === 'Y') {
const UpdatedCartItem =
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCart,
OrderQty: isItemInCart?.OrderQty - 1,
TotalAmt:
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
TaxAmt: (
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCart,
OrderQty: isItemInCart?.OrderQty - 1,
TotalAmt:
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
TaxAmt: (
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
(
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
(
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
};
};
const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal];
@ -504,27 +504,27 @@ const BSBillingTable3 = (Props) => {
// }
} else {
const UpdatedCartItem =
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCart,
OrderQty: isItemInCart?.OrderQty - 1,
TotalAmt:
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
TaxAmt: (
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCart,
OrderQty: isItemInCart?.OrderQty - 1,
TotalAmt:
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
TaxAmt: (
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
(
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
(
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
};
};
const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem];
@ -543,27 +543,27 @@ const BSBillingTable3 = (Props) => {
) {
if (BillOrderPre === 'Y') {
const UpdatedCartItem =
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCart,
OrderQty: isItemInCart?.OrderQty - 1,
TotalAmt:
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
TaxAmt: (
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCart,
OrderQty: isItemInCart?.OrderQty - 1,
TotalAmt:
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
TaxAmt: (
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
(
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
(
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
};
};
const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal];
// if (OfferCheckedInSetup && preferenceOffer) {
@ -573,27 +573,27 @@ const BSBillingTable3 = (Props) => {
// }
} else {
const UpdatedCartItem =
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCart,
OrderQty: isItemInCart?.OrderQty - 1,
TotalAmt:
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
TaxAmt: (
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCart,
OrderQty: isItemInCart?.OrderQty - 1,
TotalAmt:
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
TaxAmt: (
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
(
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
(
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
};
};
const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem];
@ -606,29 +606,29 @@ const BSBillingTable3 = (Props) => {
} else if (isItemInCartHold && OrderType === 'Hold') {
if (BillOrderPre === 'Y') {
const UpdatedCartItem =
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCartHold,
OrderQty: isItemInCartHold?.OrderQty - 1,
TotalAmt:
(isItemInCartHold?.OrderQty - 1) *
isItemInCartHold?.OrderRate,
TaxAmt: (
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCartHold,
OrderQty: isItemInCartHold?.OrderQty - 1,
TotalAmt:
(isItemInCartHold?.OrderQty - 1) *
isItemInCartHold?.OrderRate,
TaxAmt: (
((isItemInCartHold?.OrderQty - 1) *
isItemInCartHold?.OrderRate *
isItemInCartHold?.TaxPercentage) /
(100 + isItemInCartHold?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCartHold?.OrderQty - 1) *
isItemInCartHold?.OrderRate -
(
((isItemInCartHold?.OrderQty - 1) *
isItemInCartHold?.OrderRate *
isItemInCartHold?.TaxPercentage) /
(100 + isItemInCartHold?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCartHold?.OrderQty - 1) *
isItemInCartHold?.OrderRate -
(
((isItemInCartHold?.OrderQty - 1) *
isItemInCartHold?.OrderRate *
isItemInCartHold?.TaxPercentage) /
(100 + isItemInCartHold?.TaxPercentage)
).toFixed(2),
};
};
const UpdatedData = [
UpdatedCartItem,
@ -642,29 +642,29 @@ const BSBillingTable3 = (Props) => {
// }
} else {
const UpdatedCartItem =
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCartHold,
OrderQty: isItemInCartHold?.OrderQty - 1,
TotalAmt:
(isItemInCartHold?.OrderQty - 1) *
isItemInCartHold?.OrderRate,
TaxAmt: (
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCartHold,
OrderQty: isItemInCartHold?.OrderQty - 1,
TotalAmt:
(isItemInCartHold?.OrderQty - 1) *
isItemInCartHold?.OrderRate,
TaxAmt: (
((isItemInCartHold?.OrderQty - 1) *
isItemInCartHold?.OrderRate *
isItemInCartHold?.TaxPercentage) /
(100 + isItemInCartHold?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCartHold?.OrderQty - 1) *
isItemInCartHold?.OrderRate -
(
((isItemInCartHold?.OrderQty - 1) *
isItemInCartHold?.OrderRate *
isItemInCartHold?.TaxPercentage) /
(100 + isItemInCartHold?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCartHold?.OrderQty - 1) *
isItemInCartHold?.OrderRate -
(
((isItemInCartHold?.OrderQty - 1) *
isItemInCartHold?.OrderRate *
isItemInCartHold?.TaxPercentage) /
(100 + isItemInCartHold?.TaxPercentage)
).toFixed(2),
};
};
const UpdatedData = [
...OtherorderDataforNormalWithoutSalesId,
@ -968,26 +968,26 @@ const BSBillingTable3 = (Props) => {
if (isItemInCart && BookingTypeProd != 'Dine In' && OrderType != 'Hold') {
if (BillOrderPre === 'Y') {
const UpdatedCartItem =
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCart,
OrderQty: isItemInCart?.OrderQty + 1,
TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
TaxAmt: (
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCart,
OrderQty: isItemInCart?.OrderQty + 1,
TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
TaxAmt: (
((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
(
((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
(
((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
};
};
const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal];
@ -998,26 +998,26 @@ const BSBillingTable3 = (Props) => {
// }
} else {
const UpdatedCartItem =
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCart,
OrderQty: isItemInCart?.OrderQty + 1,
TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
TaxAmt: (
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCart,
OrderQty: isItemInCart?.OrderQty + 1,
TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
TaxAmt: (
((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
(
((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
(
((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
};
};
const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem];
@ -1036,26 +1036,26 @@ const BSBillingTable3 = (Props) => {
) {
if (BillOrderPre === 'Y') {
const UpdatedCartItem =
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCart,
OrderQty: isItemInCart?.OrderQty + 1,
TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
TaxAmt: (
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCart,
OrderQty: isItemInCart?.OrderQty + 1,
TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
TaxAmt: (
((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
(
((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
(
((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
};
};
const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal];
@ -1066,26 +1066,26 @@ const BSBillingTable3 = (Props) => {
// }
} else {
const UpdatedCartItem =
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCart,
OrderQty: isItemInCart?.OrderQty + 1,
TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
TaxAmt: (
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCart,
OrderQty: isItemInCart?.OrderQty + 1,
TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
TaxAmt: (
((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
(
((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
(
((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
};
};
const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem];
@ -1098,27 +1098,27 @@ const BSBillingTable3 = (Props) => {
} else if (isItemInCartHold && OrderType === 'Hold') {
if (BillOrderPre === 'Y') {
const UpdatedCartItem =
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCartHold,
OrderQty: isItemInCartHold?.OrderQty + 1,
TotalAmt:
(isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate,
TaxAmt: (
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCartHold,
OrderQty: isItemInCartHold?.OrderQty + 1,
TotalAmt:
(isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate,
TaxAmt: (
((isItemInCartHold?.OrderQty + 1) *
isItemInCartHold?.OrderRate *
isItemInCartHold?.TaxPercentage) /
(100 + isItemInCartHold?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate -
(
((isItemInCartHold?.OrderQty + 1) *
isItemInCartHold?.OrderRate *
isItemInCartHold?.TaxPercentage) /
(100 + isItemInCartHold?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate -
(
((isItemInCartHold?.OrderQty + 1) *
isItemInCartHold?.OrderRate *
isItemInCartHold?.TaxPercentage) /
(100 + isItemInCartHold?.TaxPercentage)
).toFixed(2),
};
};
const UpdatedData = [
UpdatedCartItem,
@ -1132,27 +1132,27 @@ const BSBillingTable3 = (Props) => {
// }
} else {
const UpdatedCartItem =
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCartHold,
OrderQty: isItemInCartHold?.OrderQty + 1,
TotalAmt:
(isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate,
TaxAmt: (
// if the item is already in the cart, increase the quantity of the item
{
...isItemInCartHold,
OrderQty: isItemInCartHold?.OrderQty + 1,
TotalAmt:
(isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate,
TaxAmt: (
((isItemInCartHold?.OrderQty + 1) *
isItemInCartHold?.OrderRate *
isItemInCartHold?.TaxPercentage) /
(100 + isItemInCartHold?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate -
(
((isItemInCartHold?.OrderQty + 1) *
isItemInCartHold?.OrderRate *
isItemInCartHold?.TaxPercentage) /
(100 + isItemInCartHold?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate -
(
((isItemInCartHold?.OrderQty + 1) *
isItemInCartHold?.OrderRate *
isItemInCartHold?.TaxPercentage) /
(100 + isItemInCartHold?.TaxPercentage)
).toFixed(2),
};
};
const UpdatedData = [
...OtherorderDataforNormalWithoutSalesId,
@ -1990,9 +1990,9 @@ const BSBillingTable3 = (Props) => {
)?.map((item, idx) =>
idx === 0
? {
...item,
FreeQty,
}
...item,
FreeQty,
}
: item
),
};
@ -3155,7 +3155,7 @@ const BSBillingTable3 = (Props) => {
} = section;
if (!data?.length) return null;
console.log(data, "OrderCart")
// Disabled check
const isDisabled = (item) => {
if (isOld) {
@ -3395,8 +3395,8 @@ const BSBillingTable3 = (Props) => {
style={{ fontFamily: 'Poppins' }}
onClick={() =>
item.FullProductIdentifierDtls?.length > 0 ||
item.ProductIdentifierDtls?.length > 0 ||
imeiModal
item.ProductIdentifierDtls?.length > 0 ||
imeiModal
? handleImeiDetails(item)
: editField && handleEditQuantity(item, index)
}
@ -3427,7 +3427,7 @@ const BSBillingTable3 = (Props) => {
<p
className={`offermessageTag ${!isMobile ? 'desktop' : ''}`}
>
{item.OfferMessage?.split('>')?.[0] +
{item?.OfferModeType === true ? item.OfferMessage : item.OfferMessage?.split('>')?.[0] +
`> ${item?.OrderQty} Eligible Free`}
</p>
)}
@ -3448,21 +3448,21 @@ const BSBillingTable3 = (Props) => {
{productBasedExtraCharges?.find(
(f) => f.ProdId === item.ProdId
) !== undefined && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges.find(
(f) => f.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges.find(
(f) => f.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
)}

View File

@ -21,6 +21,18 @@ const BSBillingTable3overall = () => {
const [isSmallScreen, setIsSmallScreen] = useState(window.innerWidth <= 768);
const [isCartOpen, setIsCartOpen] = useState(window.innerWidth > 768);
const [isLandscape, setIsLandscape] = useState(
window.matchMedia('(orientation: landscape)').matches
);
useEffect(() => {
const handleResize = () => {
setIsLandscape(window.matchMedia('(orientation: landscape)').matches);
};
window.addEventListener('resize', handleResize);
return () => window.removeEventListener('resize', handleResize);
}, []);
// Handle resize properly
useEffect(() => {
const handleResize = () => {
@ -106,7 +118,7 @@ const BSBillingTable3overall = () => {
}
// style={{ height: containerHeight }}
style={{
height: isMobile ? '75vh' : '85vh',
height: isMobile ? (isLandscape ? '75vh' : '83vh') : '85vh',
}}
>
{/* ✅ Cart/Table */}

View File

@ -141,6 +141,7 @@ import {
changePreviousOrderOfferDetail,
GlobalAllBookingType,
changeSearchedData,
PostCancelPayment,
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js';
import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities';
@ -1035,7 +1036,7 @@ const BSBillingTable3Pay = () => {
const selectedStyle =
stylesMap[
printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle
printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle
];
if (selectedStyle) {
@ -1574,7 +1575,15 @@ const BSBillingTable3Pay = () => {
: AddBookingDetails(BookingType, true);
}
};
// PostCancelPayment
const CancelPayment = async () => {
const response = await dispatch(PostCancelPayment({OrderId: businessUPIOrderId})).unwrap()
if (response?.data?.statusCode) {
ClearAllGlobalStateDatas();
CustomerDisplay();
setBusinessUPI(false);
}
}
const financialYearError = async () => {
setMessageType('error');
setMessageData('Financial Year-Based Sales Not Yet Started');
@ -2261,15 +2270,15 @@ const BSBillingTable3Pay = () => {
OrderStatus: 'O',
OrderType:
BookingType === 'Dine In' ||
BookingTypeBoth ||
Estimation?.SettingValue == 'N'
BookingTypeBoth ||
Estimation?.SettingValue == 'N'
? 'S'
: GlobEstBooking === 'OvrAllEst'
? 'E'
: GlobEstBooking === 'ParEst'
? GlobProdwisedata?.includes(
a.InwardDtlId + ' ' + a?.BookingTypeName
)
a.InwardDtlId + ' ' + a?.BookingTypeName
)
? 'E'
: 'S'
: 'S',
@ -2364,7 +2373,7 @@ const BSBillingTable3Pay = () => {
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'S'
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default'
SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S'
: 'P',
OrderDtlDetails:
@ -2381,9 +2390,9 @@ const BSBillingTable3Pay = () => {
? globalTipAmount === 0
? SelectedTableDetails
: SelectedTableDetails?.map((item) => ({
...item,
TipsAmount: globalTipAmount,
}))
...item,
TipsAmount: globalTipAmount,
}))
: null,
SalesPaymentType: 'normal',
PaymentDetail: [
@ -2398,8 +2407,8 @@ const BSBillingTable3Pay = () => {
? PaymentgatewayUPI?.[0]?.ModeId
: SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find(
(busupi) => busupi?.ModeId === UpiId
)?.ModeId
(busupi) => busupi?.ModeId === UpiId
)?.ModeId
: paybtnselected
: paybtnselected
? paybtnselected
@ -2412,15 +2421,15 @@ const BSBillingTable3Pay = () => {
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'business'
SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantId
?.MerchantId
: null,
PaymentOptionType:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'PC'
@ -2440,29 +2449,29 @@ const BSBillingTable3Pay = () => {
? null
: SelectedUPIPayOption?.toLowerCase() === 'default'
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
?.UPIDetailId
?.UPIDetailId
: SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find(
(busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
(busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
: null,
AccountDtl:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? []
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default'
SelectedUPIPayOption?.toLowerCase() === 'default'
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
(upipay) => upipay?.UPIId === UpiId
)
(upipay) => upipay?.UPIId === UpiId
)
: (Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'pd') ||
(Paybtnnameselected?.toLowerCase() === 'card' &&
SelectedCardOption?.toLowerCase() === 'pd')
SelectedUPIPayOption?.toLowerCase() === 'pd') ||
(Paybtnnameselected?.toLowerCase() === 'card' &&
SelectedCardOption?.toLowerCase() === 'pd')
? useOptions?.[0]?.PaymentDetails?.PaymentDevice
: (Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'pg') ||
(Paybtnnameselected?.toLowerCase() === 'card' &&
SelectedCardOption?.toLowerCase() === 'pg')
SelectedUPIPayOption?.toLowerCase() === 'pg') ||
(Paybtnnameselected?.toLowerCase() === 'card' &&
SelectedCardOption?.toLowerCase() === 'pg')
? useOptions?.[0]?.PaymentDetails?.PaymentGateway
: [],
PaymentStatus:
@ -2473,13 +2482,13 @@ const BSBillingTable3Pay = () => {
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'S'
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default'
SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S'
: 'P',
Debit:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
? Math.round(previousNetAmount - currentOrderNetAmount)
: 0,
Credit: salesBillEdit
@ -2557,14 +2566,14 @@ const BSBillingTable3Pay = () => {
setMessageType('success');
setMessageData(
response?.data?.response +
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
);
response?.data?.OrderDetails?.length > 0 &&
setPrintOrderDetails([response?.data]);
@ -2724,14 +2733,14 @@ const BSBillingTable3Pay = () => {
setMessageType('success');
setMessageData(
response?.data?.response +
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
);
response?.data?.OrderDetails?.length > 0 &&
setPrintOrderDetails([response?.data]);
@ -2834,14 +2843,14 @@ const BSBillingTable3Pay = () => {
}
setMessageData(
response?.data?.response +
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
);
if (response?.data?.OrderDetails?.length > 0) {
setPrintOrderDetails([response?.data]);
@ -3018,14 +3027,14 @@ const BSBillingTable3Pay = () => {
setMessageType('success');
setMessageData(
bookingpaymentupdate?.data?.response +
' ' +
(bookingpaymentupdate?.data?.OrderDetails?.length > 0
? bookingpaymentupdate?.data?.OrderId &&
extractLastNumberOrderId(
bookingpaymentupdate?.data?.OrderId,
bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus
)
: '')
' ' +
(bookingpaymentupdate?.data?.OrderDetails?.length > 0
? bookingpaymentupdate?.data?.OrderId &&
extractLastNumberOrderId(
bookingpaymentupdate?.data?.OrderId,
bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus
)
: '')
);
bookingpaymentupdate?.data?.OrderDetails?.length > 0 &&
setPrintOrderDetails([bookingpaymentupdate?.data]);
@ -3044,7 +3053,7 @@ const BSBillingTable3Pay = () => {
if (
Date.now() - startTime >
useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes *
60000
60000
) {
// 60,000 ms = 1 minute
@ -3751,9 +3760,9 @@ const BSBillingTable3Pay = () => {
'not-allowed',
color:
OrderCardDetail?.length > 0 ||
(selOption?.value === undefined &&
GlobalAddCustomerDetails1?.length === 0 &&
GetCustId?.CustMobile === undefined)
(selOption?.value === undefined &&
GlobalAddCustomerDetails1?.length === 0 &&
GetCustId?.CustMobile === undefined)
? 'gray'
: 'rgb(18, 146, 238)',
fontSize: '28px',
@ -3775,16 +3784,16 @@ const BSBillingTable3Pay = () => {
(BookingType === 'Dine In' ||
BookingTypeBoth ||
CheckOrderType?.length > 0) &&
!unpaidFlow &&
OrderStatus
!unpaidFlow &&
OrderStatus
? 'none'
: 'auto',
opacity:
(BookingType === 'Dine In' ||
BookingTypeBoth ||
CheckOrderType?.length > 0) &&
!unpaidFlow &&
OrderStatus
!unpaidFlow &&
OrderStatus
? 0.5
: 1,
width: '2rem',
@ -3807,14 +3816,14 @@ const BSBillingTable3Pay = () => {
width: '1.5rem',
cursor:
OrderCardDetail?.length === 0 ||
CheckBookingStatus == 'Close' ||
addnewAccess
CheckBookingStatus == 'Close' ||
addnewAccess
? 'not-allowed'
: 'pointer',
color:
OrderCardDetail?.length === 0 ||
CheckBookingStatus == 'Close' ||
addnewAccess
CheckBookingStatus == 'Close' ||
addnewAccess
? 'gray'
: 'rgb(18, 146, 238)',
display: 'flex',
@ -3850,8 +3859,8 @@ const BSBillingTable3Pay = () => {
cursor: OrderCardDetail?.length > 0 && 'not-allowed',
color:
OrderCardDetail?.length > 0 ||
(OrderCardDetail?.length > 0 &&
GetCustId?.CustMobile === undefined)
(OrderCardDetail?.length > 0 &&
GetCustId?.CustMobile === undefined)
? 'gray'
: 'rgb(18, 146, 238)',
fontSize: '25px',
@ -3938,65 +3947,65 @@ const BSBillingTable3Pay = () => {
<>
{unpaidFlow == false
? item?.OptionName == 'Hold' &&
BookingType !== 'Dine In' &&
!BookingTypeBoth &&
OrderCardDetail?.length != 0 &&
CheckOrderType?.length === 0 &&
OrderType != 'Failed' &&
CheckBookingStatus != 'Close' &&
paybtns?.length > 0 &&
!addnewAccess && (
<TooltipWrapper
title={'Hold (Alt+W)'}
isMobile={isMobile}
>
{' '}
<PozoHoldIcon
className="BSBillingNav-icon-table-icon"
onClick={() => AddBookingDetails('Hold', false)}
style={{
fontSize: '30px',
cursor: 'pointer',
color: '' ? '#52c41a' : '#1292EE',
}}
/>
</TooltipWrapper>
)
BookingType !== 'Dine In' &&
!BookingTypeBoth &&
OrderCardDetail?.length != 0 &&
CheckOrderType?.length === 0 &&
OrderType != 'Failed' &&
CheckBookingStatus != 'Close' &&
paybtns?.length > 0 &&
!addnewAccess && (
<TooltipWrapper
title={'Hold (Alt+W)'}
isMobile={isMobile}
>
{' '}
<PozoHoldIcon
className="BSBillingNav-icon-table-icon"
onClick={() => AddBookingDetails('Hold', false)}
style={{
fontSize: '30px',
cursor: 'pointer',
color: '' ? '#52c41a' : '#1292EE',
}}
/>
</TooltipWrapper>
)
: ''}
{unpaidFlow == false
? item?.OptionName == 'Hold' &&
paybtns?.length > 0 &&
BookingType !== 'Dine In' &&
!BookingTypeBoth &&
Holddata?.length > 0 &&
OrderCardDetail?.length == 0 &&
CheckBookingStatus != 'Close' &&
!addnewAccess && (
<TooltipWrapper
title={'Recall (Alt+W)'}
isMobile={isMobile}
paybtns?.length > 0 &&
BookingType !== 'Dine In' &&
!BookingTypeBoth &&
Holddata?.length > 0 &&
OrderCardDetail?.length == 0 &&
CheckBookingStatus != 'Close' &&
!addnewAccess && (
<TooltipWrapper
title={'Recall (Alt+W)'}
isMobile={isMobile}
>
{' '}
<Badge
count={Holddata?.length}
size={'small'}
offset={[0, 7]}
>
{' '}
<Badge
count={Holddata?.length}
size={'small'}
offset={[0, 7]}
>
<PozoHoldIcon
className="BSBillingNav-icon-table-icon"
onClick={() => HandleholdModelOpen()}
style={{
fontSize: '28px',
cursor: 'pointer',
color: Holddata ? '#52c41a' : 'default',
pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}}
/>
</Badge>
</TooltipWrapper>
)
<PozoHoldIcon
className="BSBillingNav-icon-table-icon"
onClick={() => HandleholdModelOpen()}
style={{
fontSize: '28px',
cursor: 'pointer',
color: Holddata ? '#52c41a' : 'default',
pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}}
/>
</Badge>
</TooltipWrapper>
)
: ''}
</>
))}
@ -4042,14 +4051,14 @@ const BSBillingTable3Pay = () => {
width: '1.5rem',
cursor:
OrderCardDetail?.length === 0 ||
CheckBookingStatus == 'Close' ||
addnewAccess
CheckBookingStatus == 'Close' ||
addnewAccess
? 'not-allowed'
: 'pointer',
color:
OrderCardDetail?.length === 0 ||
CheckBookingStatus == 'Close' ||
addnewAccess
CheckBookingStatus == 'Close' ||
addnewAccess
? 'gray'
: 'rgb(18, 146, 238)',
display: 'flex',
@ -4148,31 +4157,31 @@ const BSBillingTable3Pay = () => {
(BookingType === 'Dine In' ||
BookingTypeBoth ||
CheckOrderType?.length > 0) &&
!unpaidFlow &&
OrderStatus
!unpaidFlow &&
OrderStatus
? 'none'
: 'auto',
opacity:
(BookingType === 'Dine In' ||
BookingTypeBoth ||
CheckOrderType?.length > 0) &&
!unpaidFlow &&
OrderStatus
!unpaidFlow &&
OrderStatus
? 0.5
: 1,
}}
>
{paybtns?.length > 0 &&
currentOrderNetAmount >= previousNetAmount ? (
currentOrderNetAmount >= previousNetAmount ? (
paybtns?.map((payment) => (
<div className="Table3-cash">
<button
className={
paybtnselected === payment.ModeId &&
(UpinotSelected || CardoptionnotSelected)
(UpinotSelected || CardoptionnotSelected)
? 'Btn-payment-mode-notupisel'
: paybtnselected === payment.ModeId &&
(!UpinotSelected || !CardoptionnotSelected)
(!UpinotSelected || !CardoptionnotSelected)
? 'Btn-payment-mode'
: 'Btn-payment-mode-sel'
}
@ -4186,13 +4195,13 @@ const BSBillingTable3Pay = () => {
onClick={() =>
payment?.ModeName?.toLowerCase() === 'upi' // Change the condition to payment.Id
? handleUPIButtonClick(
payment.ModeId,
payment.ModeName
)
payment.ModeId,
payment.ModeName
)
: handlePaymentMode(
payment.ModeId,
payment.ModeName
)
payment.ModeId,
payment.ModeName
)
}
>
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
@ -4252,10 +4261,10 @@ const BSBillingTable3Pay = () => {
<button
className={
refundPaySelected === payment.ConfigId &&
(UpinotSelected || CardoptionnotSelected)
(UpinotSelected || CardoptionnotSelected)
? 'Btn-payment-mode-notupisel'
: refundPaySelected === payment.ConfigId &&
(!UpinotSelected || !CardoptionnotSelected)
(!UpinotSelected || !CardoptionnotSelected)
? 'Btn-payment-mode'
: 'Btn-payment-mode-sel'
}
@ -4516,9 +4525,9 @@ const BSBillingTable3Pay = () => {
addnewAccess
? 'BSBillingTable3-paybtn-deactive'
: FirstPaymentclick === false &&
OrderCardDetail?.length > 0 &&
paybtnselected &&
CheckBookingStatus != 'Close'
OrderCardDetail?.length > 0 &&
paybtnselected &&
CheckBookingStatus != 'Close'
? !OrderStatus
? salesBillEdit &&
currentOrderNetAmount < previousNetAmount
@ -4752,14 +4761,14 @@ const BSBillingTable3Pay = () => {
OrderType === 'Failed'
? FailedTotalAmt
: Math.round(
OrderCardDetail?.reduce(
(acc, data) => data?.TotalAmt + acc,
0
) -
((OverAllSales > 0 ? OverAllSales : 0) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0))
)
OrderCardDetail?.reduce(
(acc, data) => data?.TotalAmt + acc,
0
) -
((OverAllSales > 0 ? OverAllSales : 0) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0))
)
}
failedOrderData={failedOrderData}
/>
@ -4835,9 +4844,9 @@ const BSBillingTable3Pay = () => {
const qty = isGroup
? OrderCardDetail.filter((o) => o.id === groupKey).reduce(
(sum, o) => sum + (o.OrderQty || 1),
0
)
(sum, o) => sum + (o.OrderQty || 1),
0
)
: item.OrderQty || 1;
return (
@ -4919,6 +4928,7 @@ const BSBillingTable3Pay = () => {
open={businessUPI}
handleCancel={() => setShowCancelConfirm(true)}
footer={false}
destroyOnClose={true}
width={500}
children={
<>
@ -4936,14 +4946,27 @@ const BSBillingTable3Pay = () => {
}
/>
{showCancelConfirm && (
// <Modal
// open={showCancelConfirm}
// title="Cancel Payment"
// onOk={() => {
// setBusinessUPI(false);
// setShowCancelConfirm(false);
// ClearAllGlobalStateDatas();
// CustomerDisplay();
// }}
// onCancel={() => setShowCancelConfirm(false)}
// okText="Yes"
// cancelText="No"
// >
// Do you want to cancel the payment?
// </Modal>
<Modal
open={showCancelConfirm}
title="Cancel Payment"
onOk={() => {
setBusinessUPI(false);
setShowCancelConfirm(false);
ClearAllGlobalStateDatas();
CustomerDisplay();
CancelPayment()
}}
onCancel={() => setShowCancelConfirm(false)}
okText="Yes"

View File

@ -109,6 +109,7 @@ import {
GlobalUnpaidListData,
PaymentGatewayGetdetail,
PostBookingData,
PostCancelPayment,
PostPaymentdevice,
PreferenceData,
PutBookingData,
@ -1214,6 +1215,15 @@ const StandardTablePayment = () => {
}
};
// PostCancelPayment
const CancelPayment = async () => {
const response = await dispatch(PostCancelPayment({OrderId: businessUPIOrderId})).unwrap()
if (response?.data?.statusCode) {
ClearAllGlobalStateDatas();
CustomerDisplay();
setBusinessUPI(false);
}
}
const Otherserviceprint = async () => {
if (OtherServicesPrintDetails?.length > 0) {
const style = await PrintStyleFunction('OtherServices1');
@ -4191,6 +4201,7 @@ const StandardTablePayment = () => {
handleCancel={() => setShowCancelConfirm(true)}
footer={false}
width={600}
destroyOnClose={true}
className={'ModalPaymentGatewayEmbedded'}
children={
<>
@ -4209,22 +4220,35 @@ const StandardTablePayment = () => {
}
/>
{showCancelConfirm && (
<Modal
open={showCancelConfirm}
title="Cancel Payment"
onOk={() => {
paymentGatewayRef.current?.clearPolling();
setBusinessUPI(false);
setShowCancelConfirm(false);
ClearAllGlobalStateDatas();
CustomerDisplay();
}}
onCancel={() => setShowCancelConfirm(false)}
okText="Yes"
cancelText="No"
>
Do you want to cancel the payment?
</Modal>
// <Modal
// open={showCancelConfirm}
// title="Cancel Payment"
// onOk={() => {
// paymentGatewayRef.current?.clearPolling();
// setBusinessUPI(false);
// setShowCancelConfirm(false);
// ClearAllGlobalStateDatas();
// CustomerDisplay();
// }}
// onCancel={() => setShowCancelConfirm(false)}
// okText="Yes"
// cancelText="No"
// >
// Do you want to cancel the payment?
// </Modal>
<Modal
open={showCancelConfirm}
title="Cancel Payment"
onOk={() => {
setShowCancelConfirm(false);
CancelPayment()
}}
onCancel={() => setShowCancelConfirm(false)}
okText="Yes"
cancelText="No"
>
Do you want to cancel the payment?
</Modal>
)}
{customerPreviesOrders && (
<DefaultModal

View File

@ -534,10 +534,14 @@ function BSCategoryHorizontal(props) {
}
} else {
// 2 or more items, always show
setSubCat(true);
if (FavSelected) {
setSubCat(false);
} else {
setSubCat(true);
}
}
}
}, [SubcategorieData, templateData]);
}, [SubcategorieData, templateData, FavSelected]);
useEffect(() => {
if (typeof searchData === 'string' && categoryData?.length > 0) {
@ -608,9 +612,9 @@ function BSCategoryHorizontal(props) {
AppId: AppId,
...(AvailableDate && selectedDate
? {
fromDate: selectedDate?.[0],
toDate: selectedDate?.[1],
}
fromDate: selectedDate?.[0],
toDate: selectedDate?.[1],
}
: {}),
};
@ -647,9 +651,9 @@ function BSCategoryHorizontal(props) {
AppId: AppId,
...(AvailableDate && selectedDate
? {
fromDate: selectedDate?.[0],
toDate: selectedDate?.[1],
}
fromDate: selectedDate?.[0],
toDate: selectedDate?.[1],
}
: {}),
};
let res = await dispatch(getSelectedFavItems(data)).unwrap();
@ -886,9 +890,9 @@ function BSCategoryHorizontal(props) {
backgroundColor:
!accessOther && accessToCard
? lightenColor(
SelectedCatgColor?.['BackgroundColor'],
0.4
)
SelectedCatgColor?.['BackgroundColor'],
0.4
)
: SelectedCatgColor?.['BackgroundColor'],
padding: padding,
border: accessToCard ? '1px solid' : undefined,
@ -899,9 +903,9 @@ function BSCategoryHorizontal(props) {
: SelectedCatgColor?.['BackgroundColor'] === '#000000'
? '#ffffff'
: darkenColor(
SelectedCatgColor?.['BackgroundColor'],
70
)
SelectedCatgColor?.['BackgroundColor'],
70
)
: undefined,
}}
className="sampleCard"
@ -935,9 +939,9 @@ function BSCategoryHorizontal(props) {
backgroundColor:
!accessOther && !accessToCard && -2 == indexval
? lightenColor(
SelectedCatgColor?.['BackgroundColor'],
0.4
)
SelectedCatgColor?.['BackgroundColor'],
0.4
)
: SelectedCatgColor?.['BackgroundColor'],
padding: padding,
border:
@ -983,9 +987,9 @@ function BSCategoryHorizontal(props) {
? index != indexval
? SelectedCatgColor?.['BackgroundColor']
: lightenColor(
SelectedCatgColor?.['BackgroundColor'],
0.4
)
SelectedCatgColor?.['BackgroundColor'],
0.4
)
: SelectedCatgColor?.['BackgroundColor'],
padding: padding,
border: '1px solid',
@ -1088,11 +1092,11 @@ function BSCategoryHorizontal(props) {
? index !== indexval
? SelectedCatgColor?.['BackgroundColor']
: lightenColor(
SelectedCatgColor?.[
'BackgroundColor'
],
0.4
)
SelectedCatgColor?.[
'BackgroundColor'
],
0.4
)
: SelectedCatgColor?.['BackgroundColor'],
padding: padding,
border: '1px solid',
@ -1100,18 +1104,18 @@ function BSCategoryHorizontal(props) {
index !== indexval
? SelectedCatgColor?.['BackgroundColor']
: SelectedCatgColor?.['BackgroundColor'] ===
'#ffffff'
'#ffffff'
? '#000000'
: SelectedCatgColor?.[
'BackgroundColor'
] === '#000000'
'BackgroundColor'
] === '#000000'
? '#ffffff'
: darkenColor(
SelectedCatgColor?.[
'BackgroundColor'
],
70
),
SelectedCatgColor?.[
'BackgroundColor'
],
70
),
userSelect: 'none',
minWidth: 'max-content', // set a width if needed
}}
@ -1170,16 +1174,16 @@ function BSCategoryHorizontal(props) {
backgroundColor:
!accessOther && accessToCard
? lightenColor(
SelectedCatgColor?.['BackgroundColor'],
0.4
)
SelectedCatgColor?.['BackgroundColor'],
0.4
)
: SelectedCatgColor?.['BackgroundColor'],
padding: padding,
border: accessToCard && '1px solid',
borderColor:
accessToCard &&
!accessOther &&
SelectedCatgColor?.['BackgroundColor'] == '#ffffff'
!accessOther &&
SelectedCatgColor?.['BackgroundColor'] == '#ffffff'
? '#000000'
: SelectedCatgColor?.['BackgroundColor'] === '#000000'
? '#ffffff'
@ -1219,7 +1223,7 @@ function BSCategoryHorizontal(props) {
border: accessOther && '1px solid',
borderColor:
accessOther &&
SelectedCatgColor?.['BackgroundColor'] == '#ffffff'
SelectedCatgColor?.['BackgroundColor'] == '#ffffff'
? '#000000'
: SelectedCatgColor?.['BackgroundColor'] === '#000000'
? '#ffffff'

View File

@ -128,6 +128,7 @@ import {
changePreviousOrderOfferDetail,
GlobalPaymentTrigger,
changeSearchedData,
PostCancelPayment,
} from '../../../../Features/BookingScreen/BookingData/BookingData';
import { PrintStyleFunction } from '../../../paymentpdfPage/PrintStyleFunction.js';
import {
@ -1294,6 +1295,16 @@ const BSC1Payment = (props) => {
}
};
// PostCancelPayment
const CancelPayment = async () => {
const response = await dispatch(PostCancelPayment({OrderId: businessUPIOrderId})).unwrap()
if (response?.data?.statusCode) {
ClearAllGlobalStateDatas();
CustomerDisplay();
setBusinessUPI(false);
}
}
useEffect(() => {
const handleKeyPress = (event) => {
if (event.key === 'F4' && isButtonActive() && !isF4Pressed.current) {
@ -4993,6 +5004,7 @@ const BSC1Payment = (props) => {
handleCancel={() => setShowCancelConfirm(true)}
footer={false}
width={500}
destroyOnClose={true}
children={
<>
<PaymentGatewayEmbedded
@ -5009,21 +5021,34 @@ const BSC1Payment = (props) => {
}
/>
{showCancelConfirm && (
// <Modal
// open={showCancelConfirm}
// title="Cancel Payment"
// onOk={() => {
// setBusinessUPI(false);
// setShowCancelConfirm(false);
// ClearAllGlobalStateDatas();
// CustomerDisplay();
// }}
// onCancel={() => setShowCancelConfirm(false)}
// okText="Yes"
// cancelText="No"
// >
// Do you want to cancel the payment?
// </Modal>
<Modal
open={showCancelConfirm}
title="Cancel Payment"
onOk={() => {
setBusinessUPI(false);
setShowCancelConfirm(false);
ClearAllGlobalStateDatas();
CustomerDisplay();
}}
onCancel={() => setShowCancelConfirm(false)}
okText="Yes"
cancelText="No"
>
Do you want to cancel the payment?
</Modal>
open={showCancelConfirm}
title="Cancel Payment"
onOk={() => {
setShowCancelConfirm(false);
CancelPayment()
}}
onCancel={() => setShowCancelConfirm(false)}
okText="Yes"
cancelText="No"
>
Do you want to cancel the payment?
</Modal>
)}
{customerPreviesOrders && (

File diff suppressed because it is too large Load Diff

View File

@ -1223,7 +1223,7 @@ const BSNavbar1 = (props, BookingNavbar) => {
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
}}
>
<BSNavBarFavItems />
<BSNavBarFavItems setNavmenu={setNavmenu} />
</div>
)}
{/* DragItem */}

View File

@ -1,7 +1,11 @@
import { useEffect, useRef, useState } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { Button, Carousel, Skeleton } from 'antd';
import { ArrowRightOutlined, LeftOutlined, RightOutlined } from '@ant-design/icons';
import {
ArrowRightOutlined,
LeftOutlined,
RightOutlined,
} from '@ant-design/icons';
import SelectionComponent from './SelectionComponent';
import PreviewLayout1 from '../PreviewLayouts/PreviewLayout1';
import PreviewLayout2 from '../PreviewLayouts/PreviewLayout2';
@ -10,19 +14,30 @@ import PreViewLayout4 from '../PreviewLayouts/PreViewLayout4';
import PreviewLayout5 from '../PreviewLayouts/PreviewLayout5';
import PreViewLayout6 from '../PreviewLayouts/PreViewLayout6';
import ComboLayout1 from '../PreviewLayouts/ComboLayout1';
import { changeActiveTheme, changeOthersTheme, changeSelectedTheme, changeThemeCreation, getOthersTemplate, getPreviewData, getTemplate, GlobalActiveTheme, GlobalDefaultTheme, GlobalOthersTheme, GlobalSelectedTheme } from '../../../../Features/ThemeChange/ThemeChange';
import {
changeActiveTheme,
changeOthersTheme,
changeSelectedTheme,
changeThemeCreation,
getOthersTemplate,
getPreviewData,
getTemplate,
GlobalActiveTheme,
GlobalDefaultTheme,
GlobalOthersTheme,
GlobalSelectedTheme,
} from '../../../../Features/ThemeChange/ThemeChange';
import '../../../../Styles/BookingScreen/Components/SelectionComponent/MainPage.scss';
import { HiOutlineSquares2X2, HiSquaresPlus } from 'react-icons/hi2';
import { getSession } from '../../../../Services/Others';
import Buttons from '../../../../Components/Forms/Buttons';
import { BiSkipNext, BiSkipPrevious } from 'react-icons/bi';
import { MdOutlineDisplaySettings } from "react-icons/md";
import { MdOutlineDisplaySettings } from 'react-icons/md';
import { useAuth } from '../../../../AuthContext';
import { getEmpAccess } from '../../../../Features/AppPage/CenterPage';
const BookingSelectionPage = (props) => {
const { SadminuserAccess } = useAuth();
const { SadminuserAccess } = useAuth();
let SAAccessCommonMaster = SadminuserAccess?.find(
(e) => e?.MenuName === 'Sales Screen'
);
@ -39,16 +54,16 @@ const BookingSelectionPage = (props) => {
// const [activeTheme, setActiveTheme] = useState(
// 'default'
// );
const activeTheme = useSelector(GlobalActiveTheme)
const SelectedTheme = useSelector(GlobalSelectedTheme)
const activeTheme = useSelector(GlobalActiveTheme);
const SelectedTheme = useSelector(GlobalSelectedTheme);
const mergedThemes = DefaultThemes.concat(OthersTheme)
const mergedThemes = DefaultThemes.concat(OthersTheme);
const [currentSlide, setCurrentSlide] = useState(0);
console.log(SelectedTheme, "currentSlide")
console.log(SelectedTheme, 'currentSlide');
const [OthersCount, setOthersCount] = useState(1);
const [isNext, isSetNext] = useState(true);
const [empData, setEmpData] = useState();
const [addnewAccess, setaddnewAccess] = useState(true);
const [empData, setEmpData] = useState();
const [addnewAccess, setaddnewAccess] = useState(true);
const rightIsLastSlide = currentSlide === mergedThemes.length - 1;
const leftIsFirstSlide = currentSlide === 0 && OthersCount > 1;
const [pendingSlide, setPendingSlide] = useState(null);
@ -68,50 +83,50 @@ const BookingSelectionPage = (props) => {
: useSelector(getPreviewData);
console.log(previewData, 'previewDatapreviewData');
useEffect(() => {
GetOthersTemplate()
GetOthersTemplate();
// gettemplatedetail()
}, [])
useEffect(() => {
if (UserType === 'Employee') {
fetchApi();
}
}, [UserType]);
useEffect(() => {
let hasAccess = false;
if (UserType === 'Admin' || UserType === 'Super Admin') {
hasAccess = true;
} else if (UserType === 'Employee') {
hasAccess = empData?.AddAccess === 'Y';
} else if (UserType === 'Super Admin User') {
hasAccess = SAAccessCommonMaster?.AddAccess === 'Y';
}
setaddnewAccess(!hasAccess);
}, [empData, SAAccessCommonMaster, UserType]);
const fetchApi = async () => {
let data = {
CompId: CompId,
BranchId: BranchId,
AppId: AppId,
EmpId: UserId,
};
let response = await dispatch(getEmpAccess(data)).unwrap();
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
(item) => item.ConfigName === 'Sales Screen'
);
setEmpData(datas?.[0]);
}, []);
useEffect(() => {
if (UserType === 'Employee') {
fetchApi();
}
}, [UserType]);
useEffect(() => {
let hasAccess = false;
if (UserType === 'Admin' || UserType === 'Super Admin') {
hasAccess = true;
} else if (UserType === 'Employee') {
hasAccess = empData?.AddAccess === 'Y';
} else if (UserType === 'Super Admin User') {
hasAccess = SAAccessCommonMaster?.AddAccess === 'Y';
}
setaddnewAccess(!hasAccess);
}, [empData, SAAccessCommonMaster, UserType]);
const fetchApi = async () => {
let data = {
CompId: CompId,
BranchId: BranchId,
AppId: AppId,
EmpId: UserId,
};
let response = await dispatch(getEmpAccess(data)).unwrap();
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
(item) => item.ConfigName === 'Sales Screen'
);
setEmpData(datas?.[0]);
};
const gettemplatedetail = async () => {
let tempdetail = await dispatch(
getTemplate({ CompId: CompId, BranchId: BranchId, AppId: AppId })
).unwrap();
if (tempdetail?.data?.statusCode == 1) {
dispatch(changeActiveTheme("customised"));
dispatch(changeActiveTheme('customised'));
}
};
@ -149,7 +164,12 @@ const BookingSelectionPage = (props) => {
setCurrentSlide(pendingSlide);
let seltheme = updatedThemes[pendingSlide];
dispatch(changeThemeCreation({ formtype: 'edit', editdata: seltheme }));
dispatch(changeSelectedTheme({ ThemeId: seltheme?.TemplatePreferenceId, ThemeName: seltheme?.ThemeName }));
dispatch(
changeSelectedTheme({
ThemeId: seltheme?.TemplatePreferenceId,
ThemeName: seltheme?.ThemeName,
})
);
}
setPendingSlide(null); // Reset
}
@ -180,7 +200,7 @@ const BookingSelectionPage = (props) => {
// // }
// };
// const RightOnclick = async () => {
// // let Allthemes =
// // let Allthemes =
// // alert('Right Clicked');
// const newIndex = (currentSlide + 1) % mergedThemes.length;
// carouselRef.current.goTo(newIndex);
@ -205,7 +225,12 @@ const BookingSelectionPage = (props) => {
setCurrentSlide(newIndex);
let seltheme = mergedThemes[newIndex];
dispatch(changeThemeCreation({ formtype: 'edit', editdata: seltheme }));
dispatch(changeSelectedTheme({ ThemeId: seltheme?.TemplatePreferenceId, ThemeName: seltheme?.ThemeName }));
dispatch(
changeSelectedTheme({
ThemeId: seltheme?.TemplatePreferenceId,
ThemeName: seltheme?.ThemeName,
})
);
}
};
@ -214,12 +239,18 @@ const BookingSelectionPage = (props) => {
await GetLessTemplate();
setPendingSlide(DefaultThemes.concat(OthersTheme).length - 1); // Ask to jump to last slide after fetch
} else {
const newIndex = (currentSlide - 1 + mergedThemes.length) % mergedThemes.length;
const newIndex =
(currentSlide - 1 + mergedThemes.length) % mergedThemes.length;
carouselRef.current.goTo(newIndex);
setCurrentSlide(newIndex);
let seltheme = mergedThemes[newIndex];
dispatch(changeThemeCreation({ formtype: 'edit', editdata: seltheme }));
dispatch(changeSelectedTheme({ ThemeId: seltheme?.TemplatePreferenceId, ThemeName: seltheme?.ThemeName }));
dispatch(
changeSelectedTheme({
ThemeId: seltheme?.TemplatePreferenceId,
ThemeName: seltheme?.ThemeName,
})
);
}
};
const CustomisedthemeSelection = async (seltheme) => {
@ -236,16 +267,25 @@ const BookingSelectionPage = (props) => {
}
} else {
if (Object.keys(DefaultThemes)?.length > 0) {
dispatch(changeSelectedTheme({ ThemeId: DefaultThemes?.[0]?.TemplatePreferenceId, ThemeName: DefaultThemes?.[0]?.ThemeName }));
dispatch(
changeSelectedTheme({
ThemeId: DefaultThemes?.[0]?.TemplatePreferenceId,
ThemeName: DefaultThemes?.[0]?.ThemeName,
})
);
// settemplateData(DefaultThemes?.[0]);
dispatch(changeThemeCreation({ formtype: 'edit', editdata: DefaultThemes?.[0] }));
dispatch(
changeThemeCreation({
formtype: 'edit',
editdata: DefaultThemes?.[0],
})
);
} else {
dispatch(changeSelectedTheme({}));
dispatch(changeThemeCreation({ formtype: 'new' }));
}
}
}
};
const handlesubmit = () => {
const PostData = {};
@ -256,7 +296,7 @@ const BookingSelectionPage = (props) => {
PostData['ColorId'] = colorFilteredArray;
PostData['FontId'] = fontFilteredArray;
PostData['CreatedBy'] = UserId;
}
};
const GetOthersTemplate = async () => {
let OtherTemp = await dispatch(
getOthersTemplate({ pagenumber: OthersCount })
@ -266,7 +306,7 @@ const BookingSelectionPage = (props) => {
...temp,
ThemeName: `Theme ${index + 1 + OthersCount * 10 - 10}`,
}));
dispatch(changeOthersTheme(withname))
dispatch(changeOthersTheme(withname));
} else {
}
};
@ -288,8 +328,7 @@ const BookingSelectionPage = (props) => {
...temp,
ThemeName: `Theme ${index + 1 + (tempcount - 1) * 10}`,
}));
dispatch(changeOthersTheme(withname))
dispatch(changeOthersTheme(withname));
} else {
setMessageType('warning');
setMessageData('No more templates');
@ -306,22 +345,24 @@ const BookingSelectionPage = (props) => {
...temp,
ThemeName: `Theme ${index + 1 + (tempcount - 1) * 10}`,
}));
dispatch(changeOthersTheme(withname))
dispatch(changeOthersTheme(withname));
isSetNext(true);
} else {
}
};
const clearOtherTemplate = async () => {
dispatch(changeOthersTheme([]))
dispatch(changeOthersTheme([]));
setOthersCount(1);
};
return (
<div className='SalesSetupMaster'>
<div className="SalesSetupMaster">
<div className="Salessetup-header">
<h1 className="formHeader">
<p> <MdOutlineDisplaySettings size={30} color='#2563eb' /> Sales Setup</p>
<p>
{' '}
<MdOutlineDisplaySettings size={30} color="#2563eb" /> Sales Setup
</p>
<div>Customize your sales screen here </div>
</h1>
<div className="defaultandCustomisedThemeSales">
@ -338,29 +379,24 @@ const BookingSelectionPage = (props) => {
>
<HiSquaresPlus size={16} /> Customized Theme
</div>
</div>
{activeTheme === 'default' &&
{activeTheme === 'default' && (
<div className="Default-SubmitButton">
<Buttons
buttonText="Save"
color="901D77"
disabled = {addnewAccess}
disabled={addnewAccess}
handleSubmit={handleMainSubmit}
icon={<ArrowRightOutlined />}
/>
</div>
}
)}
</div>
<div className='salesScreenView'
>
{activeTheme === 'default' ?
<div className="salesScreenView">
{activeTheme === 'default' ? (
<>
<div
className="default-Sales-dotted-box"
>
<div className="default-Sales-dotted-box">
<Button
icon={<LeftOutlined />}
onClick={() => leftOnclick()}
@ -396,7 +432,7 @@ const BookingSelectionPage = (props) => {
dots={false}
draggable={true}
style={{ width: '100%', height: '100%', position: 'relative' }}
// afterChange={handleCarouselChange}
// afterChange={handleCarouselChange}
>
{Object.keys(previewData)?.length > 0 ? (
renderPreviewLayout()
@ -406,26 +442,24 @@ const BookingSelectionPage = (props) => {
</div>
)}
</Carousel>
</div>
<div style={{ display: 'none' }}>
<SelectionComponent ref={childRef} />
</div>
</>
:
) : (
<>
<div
className="Sales-dotted-box"
style={{ width: '55%', height: '85%', position: 'relative' }}
>
<Carousel
ref={carouselRef}
dots={false}
draggable={true}
style={{ width: '100%', height: '100%', position: 'relative' }}
// afterChange={handleCarouselChange}
// afterChange={handleCarouselChange}
>
{Object.keys(previewData)?.length > 0 ? (
renderPreviewLayout()
@ -436,16 +470,14 @@ const BookingSelectionPage = (props) => {
)}
</Carousel>
</div>
<div className='SelectionComponentImport'>
<div className="SelectionComponentImport">
<SelectionComponent ref={childRef} />
</div>
</>
}
)}
</div>
</div>
);
};
export default BookingSelectionPage;

View File

@ -118,7 +118,7 @@ const PreviewLayout1 = (props) => {
)}
/>{' '}
</div>
<div style={{ backgroundColor: '#fff'}}>
<div style={{ backgroundColor: '#fff' }}>
{Preview1Data?.BookingLayout?.[1] &&
Preview1Data?.BookingBilling?.[0] != 'Billing1' &&
Preview1Data?.BookingBilling?.[0] != 'Billing2' &&

View File

@ -26,9 +26,14 @@ import { SlArrowDown } from 'react-icons/sl';
import { IoCloseSharp } from 'react-icons/io5';
import TooltipWrapper from '../../../../Components/Tooltip/Tooltip';
import { isMobile } from 'react-device-detect';
import "./BSNavBarFavItems.scss"
import './BSNavBarFavItems.scss';
const BSNavBarFavItems = ({ type, fill, drawerOpen = false }) => {
const BSNavBarFavItems = ({
type,
fill,
drawerOpen = false,
setNavmenu = () => {},
}) => {
const [open, setOpen] = useState(false);
const [favopen, setFavopen] = useState(false);
const globalAllItemdata = useSelector(GlobalAllItemData);

View File

@ -85,13 +85,13 @@
.AddFavList {
position: fixed;
left: 0;
top: 17rem;
top: 15rem;
width: 100vw !important;
padding: 1rem 1rem !important;
}
.AddFavItemListCont {
height: 34vh;
height: 30vh;
overflow: auto;
}
@ -104,7 +104,7 @@
.AddFavList {
position: fixed;
left: 0;
top: 17rem;
top: 15rem;
width: 100vw !important;
padding: 1rem 1rem !important;
}

View File

@ -1,6 +1,6 @@
import { useEffect, useRef, useState, useImperativeHandle, forwardRef } from 'react';
import { useDispatch } from 'react-redux';
import { getPaymentStatusForBusinessUPI } from '../../../../Features/BookingScreen/BookingData/BookingData';
import { getPaymentStatusForBusinessUPI, PostCancelPayment } from '../../../../Features/BookingScreen/BookingData/BookingData';
const PaymentGatewayEmbedded = forwardRef(({
orderId,
@ -65,6 +65,7 @@ const PaymentGatewayEmbedded = forwardRef(({
if (data.status === 'TIMEOUT') {
// Stop polling and mark as timed out
dispatch(PostCancelPayment({OrderId: orderId})).unwrap()
setTimedOut(true);
setShowTimeout(true);
if (intervalRef.current) {

View File

@ -1,7 +1,9 @@
import { useEffect } from 'react';
import { useSelector, useDispatch, shallowEqual } from 'react-redux';
import {
ChangeSubcategoryData,
getLayoutSubCategories,
GlobalisFavClicked,
GlobalProductCategorie,
} from '../../Features/BookingScreen/BookingData/BookingData';
import { getTemplateData } from '../../Features/ThemeChange/ThemeChange';
@ -12,6 +14,7 @@ const LayoutSubCategoryFetcher = () => {
const ProdCat = useSelector(GlobalProductCategorie, shallowEqual);
const templateData = useSelector(getTemplateData, shallowEqual);
const favSelected = useSelector(GlobalisFavClicked);
const CompId = getSession('CompId');
const BranchId = getSession('BranchId');
@ -23,6 +26,11 @@ const LayoutSubCategoryFetcher = () => {
const isCategory5 = templateData?.BookingCategory?.[0] === 'Category5';
const isLayout2 = templateData?.BookingLayout?.[0] === 'Layout2';
if (favSelected) {
dispatch(ChangeSubcategoryData([]));
return
}
if (isCategory5 && isLayout2) {
dispatch(
getLayoutSubCategories({
@ -37,6 +45,7 @@ const LayoutSubCategoryFetcher = () => {
ProdCat,
templateData?.BookingCategory?.[0],
templateData?.BookingLayout?.[0],
favSelected
]);
return null; // this component renders nothing

View File

@ -5,22 +5,20 @@ import { Tooltip, Badge, Popconfirm } from 'antd';
import { isMobile } from 'react-device-detect';
import BookingCloseIcon from '../../Components/UtillComponents/BookingCloseIcon.jsx';
const BSNavbar1 = lazy(() => import('../../Components/BSNavbar/BSNavbar1'));
const CategoryHorizontal = lazy(
const CategoryHorizontal = lazy(
() => import('../../Components/BSCategories/BSCategoryHorizontal')
);
const BSItemCard = lazy(
() => import('../../Components/BSItemCards/BSItemCard')
);
const BSBillingTable2 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable2/BSBillingTable2')
);
const BSBillingTable3 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3overall')
);
import BSBillingTable3 from '../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3overall';
import { dynamicComponentProps } from '../DynamicComponentProps.js';
import {
getTemplateData,
@ -95,16 +93,10 @@ const BSOtherServicesVerticalcat = lazy(
() => import('../../Components/BSCategories/BSOtherServicesVerticalcat.jsx')
);
const SalesCountForStandard = lazy(
() => import('../SalesCountForStandard.jsx')
);
const StandardTable = lazy(
() =>
import('../../Components/BSBillingTables/StandardTable/StandardTable.jsx')
);
const ComboSalesBillTable = lazy(
() =>
import('../../Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx')

View File

@ -17,6 +17,7 @@ import { DatePicProd } from "../../Components/Forms/DatePickerProduct";
import { useNavigate } from "react-router-dom";
import { FaEye, FaPlus } from "react-icons/fa";
import { DefaultModal } from "../../Components/Modal/DefaultModal";
import { IoEye } from "react-icons/io5";
const { RangePicker } = DatePicker;
const SEARCH_OPTIONS = [
@ -70,6 +71,8 @@ const SalesBillProductsReturn = () => {
const [currentEditingItem, setCurrentEditingItem] = useState(null);
const [modalDescription, setModalDescription] = useState('');
const [modalImageUrl, setModalImageUrl] = useState('');
const [policyDeatilModal, setPolicyDeatilModal] = useState(false);
const [selectedPolicyDetails, setSelectedPolicyDetails] = useState(null);
console.log(selectedItems, "selectedItemsselectedItemsselectedItems")
@ -77,7 +80,7 @@ const SalesBillProductsReturn = () => {
navigateTo(`${subDirectory}setting/sales-bill-product-return/list`);
};
const handleCheckboxChange = (item, checked) => {
const { ProdId, InwardDtlId, Type, SalesQty, Rate, TotalAmt, TaxAmt, SinglePc, ProdNameQty,IsWarrantyEligible } = item;
const { ProdId, InwardDtlId, Type, SalesQty, Rate, TotalAmt, TaxAmt, SinglePc, ProdNameQty, IsWarrantyEligible } = item;
if (checked) {
const data = {
ProdId,
@ -108,7 +111,15 @@ const SalesBillProductsReturn = () => {
const description = product?.Description || ""
return { ReturnEligible: eligible, Description: description };
};
const handleOrdermodalCancel = () => {
setPolicyDeatilModal(false);
setSelectedPolicyDetails(null);
};
const Viewdetails = (item) => {
const policy = policybasedprodcuts?.find(p => p.ProdId === item.ProdId) || null;
setSelectedPolicyDetails(policy);
setPolicyDeatilModal(true);
};
useEffect(() => {
const fetchPaymentOptions = async () => {
try {
@ -192,12 +203,11 @@ const SalesBillProductsReturn = () => {
try {
const res = await dispatch(getReturnBill(data)).unwrap();
if (res?.data?.statusCode === 1) {
const modifiedData = res?.data?.data?.map(item => {
return {
...item,
productDetails: item?.productDetails.map(product => {
productDetails: item?.productDetails?.map(product => {
return {
...product,
ExchangeQty: 0,
@ -577,8 +587,9 @@ const SalesBillProductsReturn = () => {
<table className="custom-product-table">
<thead>
<tr>
<th></th>
<th>Select</th>
<th style={{ width: "30px", whiteSpace: "normal", wordWrap: "break-word" }}>Sl.No</th>
<th style={{ width: "100px", whiteSpace: "normal", wordWrap: "break-word" }}>Policy Details</th>
<th style={{ width: "100px", whiteSpace: "normal", wordWrap: "break-word" }}>Product Name</th>
<th style={{ width: "70px", whiteSpace: "normal", wordWrap: "break-word" }}>Sales-Qty</th>
<th style={{ width: "80px", whiteSpace: "normal", wordWrap: "break-word" }}>Rate</th>
@ -597,17 +608,23 @@ const SalesBillProductsReturn = () => {
disabled={!ReturnEligible}
onChange={(e) => handleCheckboxChange(item, e.target.checked)}
/>
{!ReturnEligible && (
{/* {(
<span style={{ marginLeft: 4 }}>
<Tooltip title={Description}>
{/* <span style={{ color: '#faad14', cursor: 'pointer', fontSize: 18, verticalAlign: 'middle' }}> */}
<RiErrorWarningLine />
{/* </span> */}
<IoEye
style={{ color: '#1292EE', fontSize: '25px', cursor: 'pointer' }}
onClick={() => Viewdetails(item)}
/>
</Tooltip>
</span>
)}
)} */}
</td>
<td style={{ textAlignLast: "center", width: "30px", whiteSpace: "normal", wordWrap: "break-word" }}>{index + 1}</td>
<td style={{ width: "100px", wordWrap: "break-word" }}>
<IoEye
style={{ color: '#1292EE', fontSize: '25px', cursor: 'pointer' }}
onClick={() => Viewdetails(item)}
/></td>
<td style={{ width: "100px", wordWrap: "break-word" }}>{item.ProdNameQty}</td>
<td style={{ textAlignLast: "center" }}>{item.SalesQty}</td>
<td style={{ textAlignLast: "end" }}>{item.Rate}</td>
@ -634,11 +651,11 @@ const SalesBillProductsReturn = () => {
<th>Sales-Qty</th>
<th>Return-Qty</th>
<th>More</th>
<th>Details</th>
{/* <th>Details</th> */}
</tr>
</thead>
<tbody>
{selectedItems.map((item, index) => {
{selectedItems?.map((item, index) => {
return (
<tr key={item.ProdId} >
<td>{index + 1}</td>
@ -706,7 +723,7 @@ const SalesBillProductsReturn = () => {
<FaPlus />
</button>
</td>
<td style={{ textAlign: "center", maxWidth: "150px" }}>
{/* <td style={{ textAlign: "center", maxWidth: "150px" }}>
{item.description && (
<Tooltip title={item.description}>
<div style={{
@ -724,7 +741,7 @@ const SalesBillProductsReturn = () => {
<div>🖼</div>
</Tooltip>
)}
</td>
</td> */}
</tr>
);
})}
@ -816,6 +833,43 @@ const SalesBillProductsReturn = () => {
handleCancel={handleCancel}
handleSubmit={handleModalSubmit}
/>
<DefaultModal
open={policyDeatilModal}
title="Product Policy Details"
handleCancel={handleOrdermodalCancel}
footer={false}
children={
<div style={{ padding: '8px' }}>
{selectedPolicyDetails ? (
<table style={{ width: '100%', borderCollapse: 'collapse', fontSize: '14px' }}>
<tbody>
{[
['Product Name', selectedPolicyDetails.ProdName],
['Policy Name', selectedPolicyDetails.PolicyName],
['Description', selectedPolicyDetails.Description],
['Return Allowed', selectedPolicyDetails.IsReturnAllowed === 'Y' ? 'Yes' : 'No'],
['Exchange Allowed', selectedPolicyDetails.IsExchangeAllowed === 'Y' ? 'Yes' : 'No'],
['Return Window (Days)', selectedPolicyDetails.ReturnWindowDays],
['Exchange Window (Days)', selectedPolicyDetails.ExchangeWindowDays],
['Exchange Limit Count', selectedPolicyDetails.ExchangeLimitCount ?? 'N/A'],
['Return Eligible', selectedPolicyDetails.ReturnEligible ? 'Yes' : 'No'],
// ['Effective From', selectedPolicyDetails.EffectiveFrom ? dayjs(selectedPolicyDetails.EffectiveFrom).format('DD-MM-YYYY') : 'N/A'],
// ['Effective To', selectedPolicyDetails.EffectiveTo ? dayjs(selectedPolicyDetails.EffectiveTo).format('DD-MM-YYYY') : 'N/A'],
].map(([label, value]) => (
<tr key={label} style={{ borderBottom: '1px solid #f0f0f0' }}>
<td style={{ padding: '8px', fontWeight: 600, color: '#555', width: '45%' }}>{label}</td>
<td style={{ padding: '8px', color: '#222' }}>{value}</td>
</tr>
))}
</tbody>
</table>
) : (
<p style={{ textAlign: 'center', color: '#888' }}>No policy found for this product.</p>
)}
</div>
}
/>
</div>
</div>
</div>

View File

@ -25,8 +25,7 @@ import { Messages } from '../../Components/Notifications/Messages';
import { DefaultModal } from '../../Components/Modal/DefaultModal.jsx';
import { useAuth } from '../../AuthContext.jsx';
import { getPreferenceData } from '../../Features/BookingScreen/BookingData/BookingData.js';
const subDirectory = import.meta.env.BASE_URL;
const subDirectory = import.meta.env.ENV_BASE_URL;
const items = [
{
@ -71,7 +70,6 @@ const CustomerMaster = () => {
const [addnewAccess, setaddnewAccess] = useState(true);
const [allowDecimal, setAllowDecimal] = useState(false);
async function fetchData() {
if (location?.state?.Notiffy) {
setMessageType(location?.state?.Notiffy.messageType);
@ -155,13 +153,22 @@ const CustomerMaster = () => {
}
};
const getPreference = async () => {
const data = { AppId: AppId, CompId: CompId, BranchId: BranchId, UserId: UserId };
const { data: res } = await dispatch(getPreferenceData(data)).unwrap()
const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find((setting) => setting?.SettingIdName?.toLowerCase() === "decimal" && setting?.SettingValue === 'Y');
const data = {
AppId: AppId,
CompId: CompId,
BranchId: BranchId,
UserId: UserId,
};
const { data: res } = await dispatch(getPreferenceData(data)).unwrap();
const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find(
(setting) =>
setting?.SettingIdName?.toLowerCase() === 'decimal' &&
setting?.SettingValue === 'Y'
);
if (decimalSetting) {
setAllowDecimal(true)
setAllowDecimal(true);
}
}
};
//Delete
const statusFormatter = async (row) => {
@ -251,7 +258,8 @@ const CustomerMaster = () => {
width: '100px',
render: (text, row) => (
<a style={{ color: 'black', width: '200px' }}>
{(row?.CustName ? (row?.CustName + ' ') : '') + (row?.CustShortName || "") || row?.CustMobile}
{(row?.CustName ? row?.CustName + ' ' : '') +
(row?.CustShortName || '') || row?.CustMobile}
</a>
),
filteredValue: [searchedText],
@ -260,8 +268,12 @@ const CustomerMaster = () => {
String(record.CustShortName)
?.toLowerCase()
?.includes(value?.toLowerCase()) ||
String(record.CustName)?.toLowerCase()?.includes(value?.toLowerCase()) ||
String(record.CustMobile)?.toLowerCase()?.includes(value?.toLowerCase())
String(record.CustName)
?.toLowerCase()
?.includes(value?.toLowerCase()) ||
String(record.CustMobile)
?.toLowerCase()
?.includes(value?.toLowerCase())
);
},
sorter: (a, b) => a?.CustName?.length - b?.CustName?.length,

View File

@ -1775,11 +1775,6 @@ const RetailDashboard = () => {
UserType === 'Super Admin' ||
UserType === 'Super Admin User'
) {
if (!document.fullscreenElement) {
document.documentElement.requestFullscreen().catch((err) => {
console.error('Error attempting to enable fullscreen:', err);
});
}
navigate(`${subDirectory}sales`);
}
}}

View File

@ -1,5 +1,5 @@
import React, { useCallback, useEffect, useState } from 'react';
import { Popconfirm, Drawer, Badge } from 'antd';
import { Popconfirm, Drawer, Badge, Modal } from 'antd';
import { QuestionCircleOutlined } from '@ant-design/icons';
import { useDispatch, useSelector } from 'react-redux';
import { IoIosArrowForward } from 'react-icons/io';
@ -43,7 +43,7 @@ import KioskPayment from '../Payment/KioskPaymentWithModal';
import { ApplicationPreferences } from '../../../Features/BrachLogin/BranchLogin';
import { FaAngleUp, FaCircleCheck } from 'react-icons/fa6';
import { FaAngleDown } from 'react-icons/fa';
import { PostBookingData } from '../../../Features/BookingScreen/BookingData/BookingData';
import { PostBookingData, PostCancelPayment } from '../../../Features/BookingScreen/BookingData/BookingData';
import {
generateRandomKey,
getSession,
@ -129,6 +129,7 @@ const selfKioskFooter = (props) => {
const [chairInformation, setChairInformation] = useState();
const [TableINformation, setTableINformation] = useState();
const [paymentUrl, setpaymentUrl] = useState(null);
const [showCancelConfirm, setShowCancelConfirm] = useState(null);
const [TransctionId, setTransctionId] = useState(null);
const [paymentGatewayAccess, setPaymentGatewayAccess] = useState([]);
// let chairInformation = getSession('table');
@ -939,6 +940,15 @@ const selfKioskFooter = (props) => {
setMessageType(null);
}, []);
// PostCancelPayment
const CancelPayment = async () => {
const response = await dispatch(PostCancelPayment({OrderId: TransctionId})).unwrap()
if (response?.data?.statusCode) {
// setBusinessUPI(false);
setpaymentUrl(null)
}
}
return (
<div>
<Messages
@ -1462,7 +1472,8 @@ const selfKioskFooter = (props) => {
<button
className="paymentclose-btn"
onClick={() => {
setpaymentUrl(null);
// setpaymentUrl(null);
setShowCancelConfirm(true);
}}
>
@ -1476,6 +1487,21 @@ const selfKioskFooter = (props) => {
></iframe>
</div>
)}
{showCancelConfirm && (
<Modal
open={showCancelConfirm}
title="Cancel Payment"
onOk={() => {
setShowCancelConfirm(false);
CancelPayment()
}}
onCancel={() => setShowCancelConfirm(false)}
okText="Yes"
cancelText="No"
>
Do you want to cancel the payment?
</Modal>
)}
</div>
);
};

View File

@ -61,6 +61,7 @@ import {
import {
getConfigType,
getPreferenceData,
PostCancelPayment,
PreferenceData,
PutPendingPaymentList,
} from '../../../Features/BookingScreen/BookingData/BookingData';
@ -1092,6 +1093,15 @@ const KioskPayment = (props) => {
}, 2000);
}
};
// PostCancelPayment
const CancelPayment = async () => {
const response = await dispatch(PostCancelPayment({OrderId: businessUPIOrderId})).unwrap()
if (response?.data?.statusCode) {
ClearAllGlobalStateDatas();
CustomerDisplay();
setBusinessUPI(false);
}
}
const handleDevice = async (paymentDetails, option) => {
const paymentDeviceDetails = await dispatch(
@ -2342,6 +2352,7 @@ const KioskPayment = (props) => {
handleCancel={() => setShowCancelConfirm(true)}
footer={false}
width={500}
destroyOnClose={true}
children={
<>
<PaymentGatewayEmbedded
@ -2359,21 +2370,34 @@ const KioskPayment = (props) => {
}
/>
{showCancelConfirm && (
<Modal
open={showCancelConfirm}
title="Cancel Payment"
onOk={() => {
paymentGatewayRef.current?.clearPolling();
setBusinessUPI(false);
setShowCancelConfirm(false);
ClearAllGlobalStateDatas();
}}
onCancel={() => setShowCancelConfirm(false)}
okText="Yes"
cancelText="No"
>
Do you want to cancel the payment?
</Modal>
// <Modal
// open={showCancelConfirm}
// title="Cancel Payment"
// onOk={() => {
// paymentGatewayRef.current?.clearPolling();
// setBusinessUPI(false);
// setShowCancelConfirm(false);
// ClearAllGlobalStateDatas();
// }}
// onCancel={() => setShowCancelConfirm(false)}
// okText="Yes"
// cancelText="No"
// >
// Do you want to cancel the payment?
// </Modal>
<Modal
open={showCancelConfirm}
title="Cancel Payment"
onOk={() => {
setShowCancelConfirm(false);
CancelPayment()
}}
onCancel={() => setShowCancelConfirm(false)}
okText="Yes"
cancelText="No"
>
Do you want to cancel the payment?
</Modal>
)}
</div>
);

View File

@ -49,7 +49,7 @@ const OtherServices = ({ formType }) => {
const AppId = getSession('AppId');
const UserId = getSession('UserId');
console.log(SelectedCategory, 'SelectedCategory');
console.log(TaxData, 'TaxData');
const items = [
{
name: 'Home',
@ -435,8 +435,8 @@ const OtherServices = ({ formType }) => {
<DropDowns
options={[
...TaxData?.map((option) => ({
value: option.TaxId,
label: option.TaxIdName,
value: option?.TaxId,
label: `${option?.TaxIdName} - ${option?.TaxPercentage}%`,
})),
]}
label="Tax"

File diff suppressed because it is too large Load Diff

View File

@ -2714,7 +2714,7 @@ const ProductList = () => {
open={openExcel}
title="Bulk Upload"
footer={true}
width={excelDataValues?.length > 0 ? 2500 : 600}
width={excelDataValues?.length > 0 ? 2500 : 700}
className={'bulkuploadmodal'}
children={
<>

View File

@ -18,14 +18,14 @@ function RedirectApps() {
const SessionId = encryptedValuesUrlFun(getSession('SessionId'));
// const AuthToken = sessionStorage.getItem('auth');
if (sessionStorage.getItem('BranchId') !== null) {
if (getSession('BranchId') !== null) {
clearSession('BranchId');
}
if (sessionStorage.getItem('AppId') !== null) {
if (getSession('AppId') !== null) {
clearSession('AppId');
}
if (sessionStorage.getItem('hasRefreshed') !== null) {
sessionStorage.removeItem('hasRefreshed');
if (getSession('hasRefreshed') !== null) {
clearSession('hasRefreshed');
}
const param = {
MN: MobileNo,

View File

@ -41,6 +41,7 @@ const DateWiseReport = () => {
getSession('AppType')?.toLowerCase() == 'wholesale' ? true : false;
const [OrderFromDate, setOrderFromDate] = useState();
const [OrderToDate, setOrderToDate] = useState();
const sessionuserid = getSession('UserId')
const [UserId, setUserId] = useState(
UserRole != 'Employee' ? 0 : getSession('UserId')
);
@ -63,7 +64,7 @@ const DateWiseReport = () => {
setting?.SettingIdName?.toLowerCase() === 'mobilea4' &&
setting?.SettingValue === 'Y'
);
console.log(MobileA4Print, 'MobileA4PrintMobileA4Print');
console.log(MobileA4Print,SettingDataSelector, 'MobileA4PrintMobileA4Print');
useEffect(() => {
if (dataSource?.length > 0) {
@ -368,7 +369,7 @@ const DateWiseReport = () => {
}, []);
const getPreference = async () => {
const data = { AppId: AppId, CompId: CompId, BranchId: BranchId,UserId: UserId };
const data = { AppId: AppId, CompId: CompId, BranchId: BranchId,UserId: sessionuserid };
const { data: res } = await dispatch(getPreferenceData(data)).unwrap();
const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find(
(setting) =>
@ -545,12 +546,12 @@ const DateWiseReport = () => {
let TokenData = '';
let FooterPrint = '';
if (isMobile) {
if (MobileA4Print) {
ReportMobilePDFPrint({
printId: 'RePrint',
printStyle: style,
});
} else {
// if (MobileA4Print) {
// ReportMobilePDFPrint({
// printId: 'RePrint',
// printStyle: style,
// });
// } else {
var textEncoded = encodeURI(receiptText);
var TypeCheck = 'PrintReceipt';
var scheme = 'pozoprinter';
@ -578,7 +579,7 @@ const DateWiseReport = () => {
FooterPrint +
'HasFooterTextE' +
';end;';
}
// }
} else {
await printDiv('RePrint', style);
}

View File

@ -69,6 +69,7 @@ const ItemWiseReport = () => {
const BranchId = getSession('BranchId');
const AppId = getSession('AppId');
const UserRole = getSession('UserType');
const sessionuserid = getSession('UserId')
const [UserId, setUserId] = useState(
UserRole != 'Employee' ? 0 : getSession('UserId')
);
@ -79,7 +80,7 @@ const ItemWiseReport = () => {
setting?.SettingIdName?.toLowerCase() === 'mobilea4' &&
setting?.SettingValue === 'Y'
);
console.log(MobileA4Print,SettingDataSelector, 'MobileA4PrintMobileA4Print')
useEffect(() => {
getPreference();
}, []);
@ -210,7 +211,7 @@ const ItemWiseReport = () => {
}
}, [apiCall]);
const getPreference = async () => {
const data = { AppId: AppId, CompId: CompId, BranchId: BranchId,UserId: UserId };
const data = { AppId: AppId, CompId: CompId, BranchId: BranchId,UserId: sessionuserid };
const { data: res } = await dispatch(getPreferenceData(data)).unwrap();
const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find(
(setting) =>
@ -310,12 +311,12 @@ const ItemWiseReport = () => {
};
const Print = async () => {
if (isMobile) {
if (MobileA4Print) {
ReportMobilePDFPrint({
printId: 'RePrint',
printStyle: style,
});
} else {
// if (MobileA4Print) {
// ReportMobilePDFPrint({
// printId: 'RePrint',
// printStyle: style,
// });
// } else {
let LogoImage = '';
let TokenData = '';
let FooterPrint = '';
@ -346,7 +347,7 @@ const ItemWiseReport = () => {
FooterPrint +
'HasFooterTextE' +
';end;';
}
// }
} else {
await printDiv('RePrint', style);
}

View File

@ -4,6 +4,7 @@
flex-wrap: wrap;
justify-content: center;
gap: 10px;
margin-top: 4px;
}
.BST1-Payment-onlypay {

View File

@ -78,7 +78,7 @@
}
.BSItemCard-content {
padding: 1px 0;
padding: 3px 0;
background-color: rgba(255, 255, 255, 0.8);
position: absolute;
display: flex;
@ -96,7 +96,8 @@
font-weight: 500;
max-width: 130px;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-line-clamp: 2;
line-height: 1;
-webkit-box-orient: vertical;
overflow: hidden;
}

View File

@ -635,11 +635,10 @@
//
.resNavbarMain {
width: 100vw;
width: max-content;
max-width: 250px;
height: 100vh;
background-color: #00000056;
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
@ -648,7 +647,7 @@
align-items: flex-start;
justify-content: flex-end;
overflow: visible;
backdrop-filter: blur(6px);
box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;
animation: fadeInRes 0.3s ease;
&.closing {

View File

@ -85,7 +85,7 @@
}
.AddFavItemListCont {
height: 34vh;
height: 30vh;
padding-bottom: 4rem;
}
}

View File

@ -1721,3 +1721,17 @@ table {
right: 2rem;
}
}
.addVariant {
background: #23378a29;
color: #23378a;
padding: 12px 24px;
border: none;
font-family: "Poppins", sans-serif;
font-size: 14px;
font-weight: 500;
cursor: pointer;
border-radius: 6px;
outline: none;
height: max-content;
}

View File

@ -8,12 +8,7 @@
font-weight: bold !important;
}
// .viewerExcelupload table {
// // table-layout: auto !important;
// }
.viewerExcelupload::-webkit-scrollbar {
// display: block !important;
width: 0rem;
height: 0.5rem;
}
@ -28,7 +23,7 @@
background-color: #1292ee;
color: #fff;
border-radius: 4px;
font-family: 'Poppins';
font-family: "Poppins";
font-size: 16px;
svg {
@ -48,6 +43,8 @@
.tableExcelUpload {
.ant-table-cell {
padding: 0 8px !important;
font-family: "Poppins";
font-weight: 500 !important;
}
.ant-select-selection-placeholder {
@ -129,16 +126,16 @@
}
.mdsheet {
width: 25px;
height: 25px;
width: 20px;
height: 20px;
border: 1px solid #5bff73;
background-color: #b3ffbf;
border-radius: 4px;
}
.mdsheet2 {
width: 25px;
width: 20px;
height: 20px;
border-radius: 4px;
height: 25px;
background-color: #ffc7f8;
border: 1px solid #ff74ec;
}
@ -148,5 +145,88 @@
font-family: "Poppins";
font-size: 14px;
font-weight: 500;
@media (max-width: 500px) {
font-size: 10px;
}
}
}
}
.field-setup-selected-fields {
display: flex;
flex-wrap: wrap;
gap: 4px;
margin-bottom: 50px;
height: max-content;
max-height: 50vh;
overflow: auto;
.selected-field {
display: flex;
align-items: center;
gap: 4px;
background: #0bad77;
padding: 6px 10px;
border-radius: 6px;
font-size: 13px;
font-weight: 600;
color: #fff;
.close-icon {
display: flex;
align-items: center;
cursor: pointer;
> svg {
color: #ffffffff !important;
}
}
}
}
.HeadingUploadExl {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
width: 50%;
@media (max-width: 950px) {
width: 100%;
}
}
.download-linkMain {
display: flex;
align-items: center;
gap: 1rem;
justify-content: space-between;
margin-bottom: 10px;
@media (max-width: 950px) {
flex-wrap: wrap;
}
}
.download-link {
width: 50%;
justify-content: space-between;
align-items: center;
@media (max-width: 950px) {
width: 100%;
}
}
.viewerExcelupload {
.ant-select-selection-item {
margin-top: 0 !important ;
padding-top: 0 !important;
}
}
.download-link span {
font-size: 12px;
font-weight: 400;
}
.imgUpldr {
display: flex;
flex-direction: column;
align-items: center;
gap: 2px;
}

View File

@ -705,7 +705,7 @@
color: #fff;
top: 0;
}
.optionnew:selection {
.optionnew::selection {
background-color: #ff4d4f;
}
.ovrly-icos {

View File

@ -1,86 +0,0 @@
const DevToolsDetector = {
checkWindowSize() {
const threshold = 160;
return (
window.outerWidth - window.innerWidth > threshold ||
window.outerHeight - window.innerHeight > threshold
);
},
checkConsole() {
let detected = false;
const element = new Image();
Object.defineProperty(element, 'id', {
get: () => { detected = true; }
});
console.log('%c', element);
console.clear();
return detected;
},
checkDebugger() {
if (import.meta.env.DEV) return false;
const start = performance.now();
// eslint-disable-next-line no-debugger
debugger;
const end = performance.now();
return end - start > 100;
},
checkToString() {
let detected = false;
const div = document.createElement('div');
Object.defineProperty(div, 'id', {
get: function () {
detected = true;
return 'id';
}
});
console.log(div);
console.clear();
return detected;
},
detect() {
return (
this.checkWindowSize() ||
this.checkConsole() ||
this.checkDebugger() ||
this.checkToString()
);
}
};
export default DevToolsDetector;
import { useEffect, useState } from 'react';
const isMobileOrIOS = () =>
/iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
export const useDevToolsDetection = (onDetected) => {
const [isBlocked, setIsBlocked] = useState(false);
useEffect(() => {
if (isMobileOrIOS()) return;
const interval = setInterval(() => {
const detected = DevToolsDetector.detect();
if (detected && !isBlocked) {
setIsBlocked(true);
onDetected?.();
} else if (!detected && isBlocked) {
setIsBlocked(false);
clearInterval(interval);
setTimeout(() => window.location.reload(), 100);
}
}, 1000);
return () => clearInterval(interval);
}, [isBlocked]);
return isBlocked;
};