second half optimization

This commit is contained in:
mohan 2026-02-23 12:18:31 +05:30
parent 8d19d901b9
commit babb471266
30 changed files with 6990 additions and 6172 deletions

View File

@ -2,7 +2,6 @@ import { useEffect, lazy, Suspense } from 'react';
import { Routes, Route } from 'react-router-dom'; import { Routes, Route } from 'react-router-dom';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import ProtectedRoutes from './ProtectedRoutes'; import ProtectedRoutes from './ProtectedRoutes';
import SelfBooking from './Pages/SelfBooking/SelfBooking.jsx';
import { isMobile, isIOS } from 'react-device-detect'; import { isMobile, isIOS } from 'react-device-detect';
import { routesConfig } from './routesConfig'; import { routesConfig } from './routesConfig';
import { GlobalItemCard } from './Features/BookingScreen/BookingData/BookingData.js'; import { GlobalItemCard } from './Features/BookingScreen/BookingData/BookingData.js';
@ -15,19 +14,30 @@ const KisokSelBooking = lazy(
const IndividualBooking = lazy( const IndividualBooking = lazy(
() => import('./Pages/SelfBooking/IndividualBooking') () => import('./Pages/SelfBooking/IndividualBooking')
); );
const CustomerMenuPage = lazy(
() => import('./Pages/Reports/MenuQRCode/CustomerMenuPage.jsx')
);
const WeightScaleApp = lazy(
() => import('./Pages/BookingScreen/WeightscaleApp.jsx')
);
const SelfBooking = lazy(() => import('./Pages/SelfBooking/SelfBooking.jsx'));
import useSessionManager from './useSessionManager.js';
import useSubscriptionManager from './useSubscriptionManager.js';
const ExtendSubscriptionModal = lazy(
() => import('./Pages/ExtentedModal/ExtendSubscriptionModal.jsx')
);
const commonSubDir = import.meta.env.ENV_COMMON_BASE_URL; const commonSubDir = import.meta.env.ENV_COMMON_BASE_URL;
const subDirectory = import.meta.env.ENV_BASE_URL; const subDirectory = import.meta.env.ENV_BASE_URL;
import '../ownLib/my-ui-lib.css'; import '../ownLib/my-ui-lib.css';
import CustomerMenuPage from './Pages/Reports/MenuQRCode/CustomerMenuPage.jsx';
import WeightScaleApp from './Pages/BookingScreen/WeightscaleApp.jsx';
import useSubscriptionManager from './useSubscriptionManager.js';
import useSessionManager from './useSessionManager.js';
import ExtendSubscriptionModal from './Pages/ExtentedModal/ExtendSubscriptionModal.jsx';
const AppRoutes = () => { const AppRoutes = () => {
const ItemCard = useSelector(GlobalItemCard); const ItemCard = useSelector(GlobalItemCard);
const { sessionData, logout } = useSessionManager(ItemCard); const { sessionData, logout } = useSessionManager(ItemCard);
const { remainingDays, handleCancel, freeExtend, extendModel,setExtendModel } = useSubscriptionManager(sessionData, logout); const { remainingDays, handleCancel, handlePay, freeExtend, extendModel } =
useSubscriptionManager(sessionData, logout);
useEffect(() => { useEffect(() => {
const handlePopState = () => { const handlePopState = () => {
@ -64,12 +74,12 @@ const AppRoutes = () => {
// return () => clearInterval(timer); // return () => clearInterval(timer);
// }, []); // }, []);
if (extendModel) { if (extendModel) {
return ( return (
<ExtendSubscriptionModal <ExtendSubscriptionModal
onClose={handleCancel} onClose={handleCancel}
setExtendModel={setExtendModel} onPayNow={handlePay}
onContinueWithCredits={freeExtend}
/> />
); );
} }

View File

@ -5,13 +5,9 @@ import { getSession } from './Services/Others';
import { import {
getEmpAccesData, getEmpAccesData,
getSAdminUserAccesData, getSAdminUserAccesData,
PricingAppPricingName,
} from './Features/BrachLogin/BranchLogin.js'; } from './Features/BrachLogin/BranchLogin.js';
import { changePricingAppPricingName } from './Features/ThemeChange/ThemeChange.js'; import { PricingAppPricingNameData } from './Features/ThemeChange/ThemeChange.js';
import { import { GlobalFeatAddOnData } from './Features/BookingScreen/BookingData/BookingData.js';
FeatureAddon,
GlobalFeatAddOnData,
} from './Features/BookingScreen/BookingData/BookingData.js';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
export const AuthContext = createContext(); export const AuthContext = createContext();
@ -50,16 +46,24 @@ export const AuthProvider = ({ children }) => {
const getPricingName = async () => { const getPricingName = async () => {
if (!AppId || !UserId) return; if (!AppId || !UserId) return;
const data = { let data;
if (UserType === 'Super Admin' || UserType === 'Super Admin User') {
data = {
appId: AppId,
compId: CompId,
branchId: BranchId,
};
} else {
data = {
appId: AppId, appId: AppId,
userId: UserId, userId: UserId,
}; };
}
try { try {
const response = await dispatch(PricingAppPricingName(data)).unwrap(); const response = await dispatch(PricingAppPricingNameData(data)).unwrap();
const responseData = response?.data; const responseData = response?.data;
if (responseData?.statusCode !== 1) return setAdvance(false); if (responseData?.statusCode !== 1) return setAdvance(false);
const pricingData = responseData?.data; const pricingData = responseData?.data;
await dispatch(changePricingAppPricingName(pricingData));
const hasAdvance = pricingData.some( const hasAdvance = pricingData.some(
(item) => item.PricingName === 'Premium' (item) => item.PricingName === 'Premium'
); );

View File

@ -1,5 +1,6 @@
import { useEffect, useState, lazy, Suspense } from 'react'; import { useEffect, useRef, lazy, Suspense, memo } from 'react';
import { useSelector, useDispatch } from 'react-redux'; import { useSelector, useDispatch, shallowEqual } from 'react-redux';
import { batch } from 'react-redux';
const BSLayout1 = lazy( const BSLayout1 = lazy(
() => import('../../Pages/BookingScreen/Template/BSLayout1/BSLayout1.jsx') () => import('../../Pages/BookingScreen/Template/BSLayout1/BSLayout1.jsx')
@ -29,7 +30,6 @@ import {
getTemplateData, getTemplateData,
GlobalPricingAppPricingName, GlobalPricingAppPricingName,
changetemplateData, changetemplateData,
PricingAppPricingNameData,
changeSessionData, changeSessionData,
GlobalScanTemplate, GlobalScanTemplate,
changeScanTemplate, changeScanTemplate,
@ -37,12 +37,12 @@ import {
import { import {
changeProductSubCategorie, changeProductSubCategorie,
ChangeScreenSize, ChangeScreenSize,
getConfigType, getConfigTypeBookingType,
getLayoutCategories, getLayoutCategories,
getLayoutSubCategories, // getLayoutSubCategories,
getUnpaidData, getUnpaidData,
GlobalFeatAddOnData, GlobalFeatAddOnData,
GlobalProductCategorie, // GlobalProductCategorie,
} from '../../Features/BookingScreen/BookingData/BookingData.js'; } from '../../Features/BookingScreen/BookingData/BookingData.js';
import { getSession } from '../../Services/Others'; import { getSession } from '../../Services/Others';
import { usePaymentOptions } from '../../Pages/BookingScreen/Template/PaymentOptions.js'; import { usePaymentOptions } from '../../Pages/BookingScreen/Template/PaymentOptions.js';
@ -56,13 +56,16 @@ import Loader from '../../Components/Loader/Loader.jsx';
const BookingPage = () => { const BookingPage = () => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const templateData = useSelector(getTemplateData); const templateData = useSelector(getTemplateData, shallowEqual);
const ProdCat = useSelector(GlobalProductCategorie);
console.log(templateData, 'templateData');
const BookingLayout = templateData?.BookingLayout?.[0]; const BookingLayout = templateData?.BookingLayout?.[0];
const [ismounted, setIsmounted] = useState(false);
const [templateLoaded, setTemplateLoaded] = useState(false); const templateLoadedRef = useRef(
const PricingAppPricingName = useSelector(GlobalPricingAppPricingName); Object.keys(templateData)?.length > 0 ? true : false
);
const PricingAppPricingName = useSelector(
GlobalPricingAppPricingName,
shallowEqual
);
const CompId = getSession('CompId'); const CompId = getSession('CompId');
const BranchId = getSession('BranchId'); const BranchId = getSession('BranchId');
@ -72,10 +75,8 @@ const BookingPage = () => {
const UserType = getSession('UserType'); const UserType = getSession('UserType');
const AuthToken = sessionStorage.getItem('auth'); const AuthToken = sessionStorage.getItem('auth');
const SessionMobileNo = getSession('MobileNo'); const SessionMobileNo = getSession('MobileNo');
const UserName = getSession("UserName"); const FeatureAddonData = useSelector(GlobalFeatAddOnData, shallowEqual);
const SessionId =getSession("SessionId") const Scantemplatedata = useSelector(GlobalScanTemplate, shallowEqual);
const FeatureAddonData = useSelector(GlobalFeatAddOnData);
const Scantemplatedata = useSelector(GlobalScanTemplate);
useEffect(() => { useEffect(() => {
if (BranchId) { if (BranchId) {
@ -112,10 +113,8 @@ const BookingPage = () => {
} else { } else {
dispatch(changeholddata([])); dispatch(changeholddata([]));
} }
} catch { } catch (err) {
(err) => {
console.log(err); console.log(err);
};
} }
}; };
@ -130,8 +129,6 @@ const BookingPage = () => {
AuthToken, AuthToken,
SessionMobileNo, SessionMobileNo,
FeatureAddonData, FeatureAddonData,
UserName,
SessionId
}; };
dispatch(changeSessionData(SessionData)); dispatch(changeSessionData(SessionData));
}, [BranchId, FeatureAddonData]); }, [BranchId, FeatureAddonData]);
@ -143,45 +140,64 @@ const BookingPage = () => {
UserId: UserId, UserId: UserId,
}); });
useEffect(() => { const initializeBookingPage = () => {
ProdCat && batch(() => {
dispatch( dispatch(getConfigTypeBookingType({ TypeName: 'Booking Type' }));
getLayoutSubCategories({
CompId: CompId,
BranchId: BranchId,
AppId: AppId,
ProdCat: ProdCat,
})
).unwrap();
}, [ProdCat]);
useEffect(() => {
dispatch(getConfigType({ TypeName: 'Booking Type' })).unwrap();
dispatch(ChangeRedirectStatus(true)); dispatch(ChangeRedirectStatus(true));
dispatch(changeProductSubCategorie('NaN')); dispatch(changeProductSubCategorie('NaN'));
dispatch( dispatch(getLayoutCategories({ CompId, BranchId, AppId }));
getLayoutCategories({ CompId: CompId, BranchId: BranchId, AppId: AppId }) });
).unwrap();
let data;
if (UserType === 'Super Admin' || UserType === 'Super Admin User') {
data = {
appId: AppId,
compId: CompId,
branchId: BranchId,
}; };
} else {
data = {
appId: AppId,
userId: UserId,
};
}
dispatch(PricingAppPricingNameData(data)).unwrap(); useEffect(() => {
initializeBookingPage();
}, [CompId, BranchId, AppId]);
useEffect(() => {
const handleUnload = () => {
const customerDisplayWindow = getCustomerDisplayWindow();
if (customerDisplayWindow && !customerDisplayWindow.closed) {
customerDisplayWindow.postMessage({ type: 'refresh' }, '*');
}
};
window.addEventListener('beforeunload', handleUnload);
return () => {
window.removeEventListener('beforeunload', handleUnload);
};
}, []); }, []);
useEffect(() => { useEffect(() => {
const Advance = PricingAppPricingName?.some(
(item) => item.PricingName === 'Premium'
);
const Pro = PricingAppPricingName?.some(
(item) => item.PricingName === 'Pro'
);
const hasCustomizedTemplate = FeatureAddonData?.FeatureDtls?.some(
(item) => item?.FeatureAddonName?.toLowerCase() === 'customized template'
);
if (PricingAppPricingName?.length === 0) return;
if (PricingAppPricingName?.length > 0) {
if (Advance) {
fetchData('Advance');
// Professional('Advance');
} else if (Pro) {
if (hasCustomizedTemplate) {
fetchData();
} else {
Professional('Pro');
// setIsmounted(false)
}
} else {
fetchData('Standard');
}
}
}, [PricingAppPricingName]);
const fetchData = async (Plan) => { const fetchData = async (Plan) => {
if (templateLoaded) return; // STOP duplicate calls if (templateLoadedRef.current) return; // STOP duplicate calls
const Data = { AppId, CompId, BranchId }; const Data = { AppId, CompId, BranchId };
if ( if (
@ -381,64 +397,16 @@ const BookingPage = () => {
getTemplate({ CompId, BranchId, AppId }) getTemplate({ CompId, BranchId, AppId })
).unwrap(); ).unwrap();
dispatch(getPrintSelectionComponentData(Data)).unwrap(); dispatch(getPrintSelectionComponentData(Data)).unwrap();
setTemplateLoaded(true); templateLoadedRef.current = true;
if ( if (
!templateResponse?.data?.data || !templateResponse?.data?.data ||
templateResponse.data.data.length === 0 templateResponse.data.data.length === 0
) { ) {
Professional(Plan); //Professional(Plan);
} }
} }
// Check if template data is empty or not // Check if template data is empty or not
}; };
const Advance = PricingAppPricingName?.some(
(item) => item.PricingName === 'Premium'
);
const Pro = PricingAppPricingName?.some(
(item) => item.PricingName === 'Pro'
);
const hasCustomizedTemplate = FeatureAddonData?.FeatureDtls?.some(
(item) => item?.FeatureAddonName?.toLowerCase() === 'customized template'
);
if (PricingAppPricingName?.length === 0) return;
console.log(
PricingAppPricingName,
FeatureAddonData,
'FeatureAddonDataFeatureAddonData'
);
if (PricingAppPricingName?.length > 0) {
if (Advance) {
fetchData('Advance');
// Professional('Advance');
} else if (Pro) {
if (hasCustomizedTemplate) {
fetchData();
} else {
Professional('Pro');
// setIsmounted(false)
}
} else {
fetchData('Standard');
}
}
}, [PricingAppPricingName]);
useEffect(() => {
const handleUnload = () => {
const customerDisplayWindow = getCustomerDisplayWindow(); // Retrieve from your state/redux
if (customerDisplayWindow && !customerDisplayWindow.closed) {
customerDisplayWindow.postMessage({ type: 'refresh' }, '*');
}
};
// Add beforeunload listener when the component mounts
window.addEventListener('beforeunload', handleUnload);
// Clean up the event listener when the component unmounts
return () => {
window.removeEventListener('beforeunload', handleUnload);
};
}, []);
const Professional = async (data) => { const Professional = async (data) => {
const tempData = { const tempData = {
SelectedApplication: AppId, SelectedApplication: AppId,
@ -449,23 +417,6 @@ const BookingPage = () => {
dispatch(changetemplateData(tempData)); dispatch(changetemplateData(tempData));
}; };
if (ismounted)
return (
<div
style={{
position: 'fixed',
top: '0',
left: '0',
right: '0',
bottom: '0',
height: '100vh',
width: '100vw',
backgroundColor: '#fff',
}}
>
<Loader />
</div>
);
return ( return (
<div style={{ backgroundColor: '#fff !important' }}> <div style={{ backgroundColor: '#fff !important' }}>
{Object.keys(templateData)?.length > 0 ? ( {Object.keys(templateData)?.length > 0 ? (
@ -484,6 +435,7 @@ const BookingPage = () => {
overflow: 'hidden', overflow: 'hidden',
flexDirection: 'column', flexDirection: 'column',
fontWeight: '500', fontWeight: '500',
bottom: '3rem',
}} }}
> >
Loading Layout... Loading Layout...
@ -503,10 +455,10 @@ const BookingPage = () => {
</Suspense> </Suspense>
</> </>
) : ( ) : (
<>{/* {Advance ? <div>Loading...</div> : null} */}</> <Loader />
)} )}
</div> </div>
); );
}; };
export default BookingPage; export default memo(BookingPage);

View File

@ -1,14 +1,17 @@
import React, { useEffect, useRef, useState, useCallback, forwardRef, useImperativeHandle } from 'react'; import React, {
useEffect,
useRef,
useState,
useCallback,
forwardRef,
useImperativeHandle,
} from 'react';
import { useSelector, useDispatch } from 'react-redux'; import { useSelector, useDispatch } from 'react-redux';
import WebFont from 'webfontloader'; import WebFont from 'webfontloader';
import { SwatchesPicker } from 'react-color'; import { SwatchesPicker } from 'react-color';
import { DefaultModal } from '../../../../Components/Modal/DefaultModal'; import { DefaultModal } from '../../../../Components/Modal/DefaultModal';
import { RadioGrpButton } from '../../../../Components/Forms/RadioGroup.jsx'; import { RadioGrpButton } from '../../../../Components/Forms/RadioGroup.jsx';
import { import { CloseOutlined, ArrowRightOutlined } from '@ant-design/icons';
CloseOutlined,
ArrowRightOutlined,
} from '@ant-design/icons';
import { BiSkipPrevious } from 'react-icons/bi'; import { BiSkipPrevious } from 'react-icons/bi';
import { BiSkipNext } from 'react-icons/bi'; import { BiSkipNext } from 'react-icons/bi';
import { Modal, Form } from 'antd'; import { Modal, Form } from 'antd';
@ -113,12 +116,15 @@ import {
import { getPreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData.js'; import { getPreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData.js';
import { useAuth } from '../../../../AuthContext.jsx'; import { useAuth } from '../../../../AuthContext.jsx';
import { HiOutlineSquares2X2, HiSquaresPlus } from 'react-icons/hi2'; import { HiOutlineSquares2X2, HiSquaresPlus } from 'react-icons/hi2';
import { ApplicationPreferences, getCommonAppPreference } from '../../../../Features/BrachLogin/BranchLogin.js'; import {
ApplicationPreferences,
getCommonAppPreference,
} from '../../../../Features/BrachLogin/BranchLogin.js';
import { TbLayoutNavbar } from 'react-icons/tb'; import { TbLayoutNavbar } from 'react-icons/tb';
import { HiMenuAlt1 } from 'react-icons/hi'; import { HiMenuAlt1 } from 'react-icons/hi';
import { IoMdAdd } from "react-icons/io"; import { IoMdAdd } from 'react-icons/io';
import { LuCreditCard } from "react-icons/lu"; import { LuCreditCard } from 'react-icons/lu';
import { IoReceiptOutline } from "react-icons/io5"; import { IoReceiptOutline } from 'react-icons/io5';
const subDirectory = import.meta.env.BASE_URL; const subDirectory = import.meta.env.BASE_URL;
const SelectionComponent = forwardRef((props, ref) => { const SelectionComponent = forwardRef((props, ref) => {
@ -175,12 +181,22 @@ const SelectionComponent = forwardRef((props, ref) => {
SelectedGlobalSubCatgColorDetail SelectedGlobalSubCatgColorDetail
); );
const DefaultThemes = useSelector(GlobalDefaultTheme); const DefaultThemes = useSelector(GlobalDefaultTheme);
const SelectedTheme = useSelector(GlobalSelectedTheme) const SelectedTheme = useSelector(GlobalSelectedTheme);
const activeTheme = useSelector(GlobalActiveTheme); const activeTheme = useSelector(GlobalActiveTheme);
const appPreferences = useSelector(ApplicationPreferences); const appPreferences = useSelector(ApplicationPreferences);
const bookingTypePreference = appPreferences?.find((preference) => preference?.PreferredCatName === 'Booking Type')?.PreferenceCatDetails const bookingTypePreference = appPreferences?.find(
const dinePreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "dine in" && type?.PreferredStatus === 'Y') (preference) => preference?.PreferredCatName === 'Booking Type'
const takeAwayPreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "take away" && type?.PreferredStatus === 'Y') )?.PreferenceCatDetails;
const dinePreference = bookingTypePreference?.find(
(type) =>
type?.PreferredSubCatName?.toLowerCase() === 'dine in' &&
type?.PreferredStatus === 'Y'
);
const takeAwayPreference = bookingTypePreference?.find(
(type) =>
type?.PreferredSubCatName?.toLowerCase() === 'take away' &&
type?.PreferredStatus === 'Y'
);
const AppId = getSession('AppId'); const AppId = getSession('AppId');
const UserId = getSession('UserId'); const UserId = getSession('UserId');
const CompId = getSession('CompId'); const CompId = getSession('CompId');
@ -230,7 +246,6 @@ const SelectionComponent = forwardRef((props, ref) => {
const [SelectedBillingTableId, setSelectedBillingTableId] = useState(null); const [SelectedBillingTableId, setSelectedBillingTableId] = useState(null);
const [ShowDropDownData, SetShowDropDownData] = useState([]); const [ShowDropDownData, SetShowDropDownData] = useState([]);
//navbarcheck boxes //navbarcheck boxes
const [NavBarCheckList, setNavBarCheckList] = useState([]); const [NavBarCheckList, setNavBarCheckList] = useState([]);
const [SelectedNavCheckValues, setSelectedNavCheckValues] = useState([]); const [SelectedNavCheckValues, setSelectedNavCheckValues] = useState([]);
@ -399,9 +414,19 @@ const SelectionComponent = forwardRef((props, ref) => {
useEffect(() => { useEffect(() => {
if (activeTheme == 'default') { if (activeTheme == 'default') {
if (Object.keys(DefaultThemes)?.length > 0) { 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]); settemplateData(DefaultThemes?.[0]);
dispatch(changeThemeCreation({ formtype: 'edit', editdata: DefaultThemes?.[0] })); dispatch(
changeThemeCreation({
formtype: 'edit',
editdata: DefaultThemes?.[0],
})
);
} else { } else {
dispatch(changeSelectedTheme({})); dispatch(changeSelectedTheme({}));
settemplateData({}); settemplateData({});
@ -438,7 +463,7 @@ const SelectionComponent = forwardRef((props, ref) => {
).unwrap(); ).unwrap();
if (tempdetail?.data?.statusCode == 1) { if (tempdetail?.data?.statusCode == 1) {
dispatch(changeActiveTheme("customised")); dispatch(changeActiveTheme('customised'));
} else { } else {
setTemptemplatedata(true); setTemptemplatedata(true);
} }
@ -496,7 +521,6 @@ const SelectionComponent = forwardRef((props, ref) => {
}, [templateData1, selthemeData, activeTheme]); }, [templateData1, selthemeData, activeTheme]);
useEffect(() => { useEffect(() => {
if (Object.keys(templateData)?.length > 0) { if (Object.keys(templateData)?.length > 0) {
setEditTemplateData(); setEditTemplateData();
} else { } else {
ClearAllComponentStates(); ClearAllComponentStates();
@ -764,7 +788,7 @@ const SelectionComponent = forwardRef((props, ref) => {
useEffect(() => { useEffect(() => {
if (templateData && BillingTableData?.length > 0) { if (templateData && BillingTableData?.length > 0) {
console.log(BillingTableData?.length, "BillingTableData?.length") console.log(BillingTableData?.length, 'BillingTableData?.length');
const editCardVal = BillingTableData?.filter( const editCardVal = BillingTableData?.filter(
(item) => item.ComponentName == templateData?.['BookingBilling']?.[0] (item) => item.ComponentName == templateData?.['BookingBilling']?.[0]
); );
@ -1062,16 +1086,22 @@ const SelectionComponent = forwardRef((props, ref) => {
const GetNavbarFun = async () => { const GetNavbarFun = async () => {
const gettingNavbarData = await dispatch(getNavbar()).unwrap(); const gettingNavbarData = await dispatch(getNavbar()).unwrap();
if (gettingNavbarData?.data?.statusCode === 1) { if (gettingNavbarData?.data?.statusCode === 1) {
setNavbarData(gettingNavbarData.data?.data?.map((navbar) => { setNavbarData(
gettingNavbarData.data?.data?.map((navbar) => {
return { return {
...navbar, ...navbar,
ComponentOptionsDetails: navbar?.ComponentOptionsDetails ComponentOptionsDetails: navbar?.ComponentOptionsDetails?.filter(
?.filter((component) => (component) =>
!((component?.OptionName === 'DineIn' && dinePreference === undefined) || !(
(component?.OptionName === 'TakeAway' && takeAwayPreference === undefined)) (component?.OptionName === 'DineIn' &&
dinePreference === undefined) ||
(component?.OptionName === 'TakeAway' &&
takeAwayPreference === undefined)
) )
} ),
})); };
})
);
} }
}; };
const GetCategoryFun = async () => { const GetCategoryFun = async () => {
@ -1122,31 +1152,43 @@ const SelectionComponent = forwardRef((props, ref) => {
const GetCombo1Navbar = async () => { const GetCombo1Navbar = async () => {
const gettingCombo1NavbarData = await dispatch(getCombo1Navbar()).unwrap(); const gettingCombo1NavbarData = await dispatch(getCombo1Navbar()).unwrap();
if (gettingCombo1NavbarData?.data?.statusCode === 1) { if (gettingCombo1NavbarData?.data?.statusCode === 1) {
setNavbarData(gettingCombo1NavbarData?.data?.data?.map((navbar) => { setNavbarData(
gettingCombo1NavbarData?.data?.data?.map((navbar) => {
return { return {
...navbar, ...navbar,
ComponentOptionsDetails: navbar?.ComponentOptionsDetails ComponentOptionsDetails: navbar?.ComponentOptionsDetails?.filter(
?.filter((component) => (component) =>
!((component?.OptionName === 'DineIn' && dinePreference === undefined) || !(
(component?.OptionName === 'TakeAway' && takeAwayPreference === undefined)) (component?.OptionName === 'DineIn' &&
dinePreference === undefined) ||
(component?.OptionName === 'TakeAway' &&
takeAwayPreference === undefined)
) )
} ),
})); };
})
);
} }
}; };
const GetCombo2Navbar = async () => { const GetCombo2Navbar = async () => {
const gettingCombo2NavbarData = await dispatch(getCombo2Navbar()).unwrap(); const gettingCombo2NavbarData = await dispatch(getCombo2Navbar()).unwrap();
if (gettingCombo2NavbarData?.data?.statusCode === 1) { if (gettingCombo2NavbarData?.data?.statusCode === 1) {
setNavbarData(gettingCombo2NavbarData?.data?.data?.map((navbar) => { setNavbarData(
gettingCombo2NavbarData?.data?.data?.map((navbar) => {
return { return {
...navbar, ...navbar,
ComponentOptionsDetails: navbar?.ComponentOptionsDetails ComponentOptionsDetails: navbar?.ComponentOptionsDetails?.filter(
?.filter((component) => (component) =>
!((component?.OptionName === 'DineIn' && dinePreference === undefined) || !(
(component?.OptionName === 'TakeAway' && takeAwayPreference === undefined)) (component?.OptionName === 'DineIn' &&
dinePreference === undefined) ||
(component?.OptionName === 'TakeAway' &&
takeAwayPreference === undefined)
) )
} ),
})); };
})
);
} }
}; };
@ -1318,15 +1360,20 @@ const SelectionComponent = forwardRef((props, ref) => {
], ],
}) })
); );
setBillTableCheckList(BillTableItems?.map((billItem) => { setBillTableCheckList(
BillTableItems?.map((billItem) => {
return { return {
...billItem, ...billItem,
ComponentOptionsDetails: billItem?.ComponentOptionsDetails ComponentOptionsDetails: billItem?.ComponentOptionsDetails?.filter(
?.filter((component) => (component) =>
!(component?.OptionName === 'UnpaidBill' && dinePreference === undefined) !(
component?.OptionName === 'UnpaidBill' &&
dinePreference === undefined
) )
} ),
})); };
})
);
const itemOption = BillTableItems[0]?.ComponentOptionsDetails?.find( const itemOption = BillTableItems[0]?.ComponentOptionsDetails?.find(
(option) => option.OptionName === 'Item' (option) => option.OptionName === 'Item'
@ -2278,7 +2325,7 @@ const SelectionComponent = forwardRef((props, ref) => {
}); });
}; };
const validateFontsTable = async (values) => { const validateFontsTable = async (values) => {
console.log(values,"table font") console.log(values, 'table font');
const apiUrl = `https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyDP1HqNkLI53iIAH-SB9_mt_24QdkUZ_24`; const apiUrl = `https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyDP1HqNkLI53iIAH-SB9_mt_24QdkUZ_24`;
fetch(apiUrl) fetch(apiUrl)
.then((response) => response.json()) .then((response) => response.json())
@ -2674,7 +2721,7 @@ const SelectionComponent = forwardRef((props, ref) => {
// onfinish function // onfinish function
const onfinish = async (values) => { const onfinish = async (values) => {
console.log(values, "valuesvalues") console.log(values, 'valuesvalues');
setFirstOnClick(true); setFirstOnClick(true);
let colorOriginalArray = [ let colorOriginalArray = [
values.CatColor, values.CatColor,
@ -2793,8 +2840,10 @@ const SelectionComponent = forwardRef((props, ref) => {
setMessageData('Template Details Added Successfully'); setMessageData('Template Details Added Successfully');
setFirstOnClick(false); setFirstOnClick(false);
} }
dispatch(changeScanTemplate({})) dispatch(changeScanTemplate({}));
await dispatch(
getTemplate({ CompId: CompId, BranchId: BranchId, AppId: AppId })
);
} else { } else {
setMessageType('error'); setMessageType('error');
setMessageData(response?.data?.response); setMessageData(response?.data?.response);
@ -2963,7 +3012,12 @@ const SelectionComponent = forwardRef((props, ref) => {
onComplete={onComplete} onComplete={onComplete}
/> />
<div className="Selection-Component-OverallDiv"> <div className="Selection-Component-OverallDiv">
<Form form={form} ref={formRef} onFinish={onfinish} onValuesChange={onValuesChange}> <Form
form={form}
ref={formRef}
onFinish={onfinish}
onValuesChange={onValuesChange}
>
{/* <div className="defaultandCustomisedTheme"> {/* <div className="defaultandCustomisedTheme">
<div <div
className={activeTheme === 'default' ? 'selected' : ''} className={activeTheme === 'default' ? 'selected' : ''}
@ -3067,13 +3121,10 @@ const SelectionComponent = forwardRef((props, ref) => {
Layout and Feature Settings Layout and Feature Settings
</div> </div>
<div className="Selection-Component-InputDiv"> <div className="Selection-Component-InputDiv">
{!( {!(Object.keys(templateData)?.length == 0) && (
Object.keys(templateData)?.length == 0
) && (
<div> <div>
<p className="Selection-Component-SubHeading">Layout</p> <p className="Selection-Component-SubHeading">Layout</p>
<Form.Item <Form.Item
name="LayoutId" name="LayoutId"
rules={[ rules={[
@ -3192,7 +3243,6 @@ const SelectionComponent = forwardRef((props, ref) => {
</div> </div>
</div> </div>
<SwatchesPicker onChange={handleColorChange} /> <SwatchesPicker onChange={handleColorChange} />
<div> <div>
<button className="colorBtn" onClick={handleColorSubmit1}> <button className="colorBtn" onClick={handleColorSubmit1}>
@ -3316,7 +3366,6 @@ const SelectionComponent = forwardRef((props, ref) => {
<div> <div>
<p className="Selection-Component-SubHeading">Bill Table</p> <p className="Selection-Component-SubHeading">Bill Table</p>
{/* <Form.Item {/* <Form.Item
name="BillingTableId" name="BillingTableId"
rules={[ rules={[
@ -3339,8 +3388,16 @@ const SelectionComponent = forwardRef((props, ref) => {
/> />
</Form.Item> */} </Form.Item> */}
{(() => { {(() => {
const selectedLayoutName = LayoutData?.find(l => l.ComponentId === SelectedLayoutId)?.ComponentName; const selectedLayoutName = LayoutData?.find(
const filteredBillingTableData = (selectedLayoutName === 'Combo1' || selectedLayoutName === 'Combo2') ? BillingTableData : BillingTableData?.filter(b => b.ComponentName !== 'Billing8'); (l) => l.ComponentId === SelectedLayoutId
)?.ComponentName;
const filteredBillingTableData =
selectedLayoutName === 'Combo1' ||
selectedLayoutName === 'Combo2'
? BillingTableData
: BillingTableData?.filter(
(b) => b.ComponentName !== 'Billing8'
);
return ( return (
<Form.Item <Form.Item
name="BillingTableId" name="BillingTableId"
@ -3433,7 +3490,6 @@ const SelectionComponent = forwardRef((props, ref) => {
</div> </div>
</div> </div>
<SwatchesPicker <SwatchesPicker
onChange={handleLayoutOverallColorChange} onChange={handleLayoutOverallColorChange}
/> />
@ -3453,7 +3509,7 @@ const SelectionComponent = forwardRef((props, ref) => {
display: 'flex', display: 'flex',
gap: '1rem', gap: '1rem',
flexWrap: 'nowrap', flexWrap: 'nowrap',
alignItems: "center" alignItems: 'center',
}} }}
> >
<div className="colorDropdown"> <div className="colorDropdown">
@ -3507,11 +3563,12 @@ const SelectionComponent = forwardRef((props, ref) => {
/> />
</Form.Item> </Form.Item>
</div> </div>
<div className='addNewSalesFiledBTN' onClick={handleUploadLayoutOverallBackground}> <div
className="addNewSalesFiledBTN"
onClick={handleUploadLayoutOverallBackground}
>
Add Add
<IoMdAdd <IoMdAdd className="plusOutlinedIcon" />
className="plusOutlinedIcon"
/>
</div> </div>
</div> </div>
)} )}
@ -3616,14 +3673,14 @@ const SelectionComponent = forwardRef((props, ref) => {
)} )}
</Row> </Row>
</Checkbox.Group> </Checkbox.Group>
<div className='SlecteCatDiv'> <div className="SlecteCatDiv">
<div <div
style={{ style={{
display: 'flex', display: 'flex',
flexWrap: 'wrap', flexWrap: 'wrap',
flexDirection: 'row', flexDirection: 'row',
alignItems: "center", alignItems: 'center',
gap: "1rem" gap: '1rem',
}} }}
> >
<div> <div>
@ -3636,7 +3693,7 @@ const SelectionComponent = forwardRef((props, ref) => {
}, },
]} ]}
> >
<p className='Selection-Component-SubHeading'> <p className="Selection-Component-SubHeading">
Category Font Category Font
</p> </p>
<DropDowns <DropDowns
@ -3652,12 +3709,12 @@ const SelectionComponent = forwardRef((props, ref) => {
/> />
</Form.Item> </Form.Item>
</div> </div>
<div className='addNewSalesFiledBTN' onClick={CathandleUploadFonts}> <div
className="addNewSalesFiledBTN"
onClick={CathandleUploadFonts}
>
Add Add
<IoMdAdd <IoMdAdd className="plusOutlinedIcon" />
className="plusOutlinedIcon"
/>
<DefaultModal <DefaultModal
open={catModelOpen} open={catModelOpen}
title="Fonts" title="Fonts"
@ -3717,7 +3774,7 @@ const SelectionComponent = forwardRef((props, ref) => {
display: 'flex', display: 'flex',
gap: '1rem', gap: '1rem',
flexWrap: 'nowrap', flexWrap: 'nowrap',
alignItems: "center" alignItems: 'center',
}} }}
> >
<div className="colorDropdown"> <div className="colorDropdown">
@ -3730,7 +3787,7 @@ const SelectionComponent = forwardRef((props, ref) => {
}, },
]} ]}
> >
<p className='Selection-Component-SubHeading'> <p className="Selection-Component-SubHeading">
Category Background Color Category Background Color
</p> </p>
<DropDowns <DropDowns
@ -3778,12 +3835,12 @@ const SelectionComponent = forwardRef((props, ref) => {
/> />
</Form.Item> </Form.Item>
</div> </div>
<div className='addNewSalesFiledBTN' onClick={handleUploadColor}> <div
className="addNewSalesFiledBTN"
onClick={handleUploadColor}
>
Add Add
<IoMdAdd <IoMdAdd className="plusOutlinedIcon" />
className="plusOutlinedIcon"
/>
</div> </div>
</div> </div>
</div> </div>
@ -3878,7 +3935,7 @@ const SelectionComponent = forwardRef((props, ref) => {
}, },
]} ]}
> >
<p className='Selection-Component-SubHeading'> <p className="Selection-Component-SubHeading">
Category Overall-Background Category Overall-Background
</p> </p>
@ -3936,12 +3993,12 @@ const SelectionComponent = forwardRef((props, ref) => {
/> />
</Form.Item> </Form.Item>
</div> </div>
<div className='addNewSalesFiledBTN' onClick={handlecategoryUploadOverallColor}> <div
className="addNewSalesFiledBTN"
onClick={handlecategoryUploadOverallColor}
>
Add Add
<IoMdAdd <IoMdAdd className="plusOutlinedIcon" />
className="plusOutlinedIcon"
/>
</div> </div>
</div> </div>
</div> </div>
@ -3956,7 +4013,8 @@ const SelectionComponent = forwardRef((props, ref) => {
<span className="Selection-Component-selectheading"> <span className="Selection-Component-selectheading">
Selected SubCategory: Selected SubCategory:
<span style={{ color: '#009b00' }}> <span style={{ color: '#009b00' }}>
<HiMenuAlt1 /> {SubCategoryCheckList[0]?.ComponentName} <HiMenuAlt1 />{' '}
{SubCategoryCheckList[0]?.ComponentName}
</span> </span>
</span> </span>
</div> </div>
@ -3982,12 +4040,8 @@ const SelectionComponent = forwardRef((props, ref) => {
)} )}
</Row> </Row>
</Checkbox.Group> </Checkbox.Group>
<div <div className="SlecteCatDiv">
className='SlecteCatDiv' <div className="SlecteCatDivSub2">
>
<div
className='SlecteCatDivSub2'
>
<div> <div>
<Form.Item <Form.Item
name="FontSubcat" name="FontSubcat"
@ -4011,7 +4065,10 @@ const SelectionComponent = forwardRef((props, ref) => {
/> />
</Form.Item> </Form.Item>
</div> </div>
<div className='addNewSalesFiledBTN' onClick={SubcathandleUploadFonts}> <div
className="addNewSalesFiledBTN"
onClick={SubcathandleUploadFonts}
>
Add Add
<IoMdAdd <IoMdAdd
className="plusOutlinedIcon" className="plusOutlinedIcon"
@ -4135,7 +4192,10 @@ const SelectionComponent = forwardRef((props, ref) => {
/> />
</Form.Item> </Form.Item>
</div> </div>
<div className='addNewSalesFiledBTN' onClick={SubhandleUploadColor}> <div
className="addNewSalesFiledBTN"
onClick={SubhandleUploadColor}
>
Add Add
<IoMdAdd <IoMdAdd
className="plusOutlinedIcon" className="plusOutlinedIcon"
@ -4293,7 +4353,10 @@ const SelectionComponent = forwardRef((props, ref) => {
/> />
</Form.Item> </Form.Item>
</div> </div>
<div className='addNewSalesFiledBTN' onClick={handleSubcategoryUploadOverallColor}> <div
className="addNewSalesFiledBTN"
onClick={handleSubcategoryUploadOverallColor}
>
Add Add
<IoMdAdd <IoMdAdd
className="plusOutlinedIcon" className="plusOutlinedIcon"
@ -4464,12 +4527,8 @@ const SelectionComponent = forwardRef((props, ref) => {
)} )}
</Row> </Row>
</Checkbox.Group> </Checkbox.Group>
<div <div className="SlecteCatDiv">
className='SlecteCatDiv' <div className="SlecteCatDivSub2">
>
<div
className='SlecteCatDivSub2'
>
<div> <div>
<Form.Item <Form.Item
name="FontCard" name="FontCard"
@ -4480,7 +4539,7 @@ const SelectionComponent = forwardRef((props, ref) => {
}, },
]} ]}
> >
<p className='Selection-Component-SubHeading'> <p className="Selection-Component-SubHeading">
Card Font Card Font
</p> </p>
<DropDowns <DropDowns
@ -4496,7 +4555,10 @@ const SelectionComponent = forwardRef((props, ref) => {
/> />
</Form.Item> </Form.Item>
</div> </div>
<div className='addNewSalesFiledBTN' onClick={CardhandleUploadFonts}> <div
className="addNewSalesFiledBTN"
onClick={CardhandleUploadFonts}
>
Add Add
<IoMdAdd <IoMdAdd
className="plusOutlinedIcon" className="plusOutlinedIcon"
@ -4562,7 +4624,7 @@ const SelectionComponent = forwardRef((props, ref) => {
display: 'flex', display: 'flex',
gap: '1rem', gap: '1rem',
flexWrap: 'nowrap', flexWrap: 'nowrap',
alignItems: "center" alignItems: 'center',
}} }}
> >
<div className="colorDropdown"> <div className="colorDropdown">
@ -4575,7 +4637,7 @@ const SelectionComponent = forwardRef((props, ref) => {
}, },
]} ]}
> >
<p className='Selection-Component-SubHeading'> <p className="Selection-Component-SubHeading">
Card Background Color Card Background Color
</p> </p>
<DropDowns <DropDowns
@ -4623,12 +4685,12 @@ const SelectionComponent = forwardRef((props, ref) => {
/> />
</Form.Item> </Form.Item>
</div> </div>
<div className='addNewSalesFiledBTN' onClick={handleUploadColorselectCard}> <div
className="addNewSalesFiledBTN"
onClick={handleUploadColorselectCard}
>
Add Add
<IoMdAdd <IoMdAdd className="plusOutlinedIcon" />
className="plusOutlinedIcon"
/>
</div> </div>
</div> </div>
</div> </div>
@ -4724,7 +4786,7 @@ const SelectionComponent = forwardRef((props, ref) => {
}, },
]} ]}
> >
<p className='Selection-Component-SubHeading'> <p className="Selection-Component-SubHeading">
Card Overall-Background Card Overall-Background
</p> </p>
<DropDowns <DropDowns
@ -4781,12 +4843,12 @@ const SelectionComponent = forwardRef((props, ref) => {
/> />
</Form.Item> </Form.Item>
</div> </div>
<div className='addNewSalesFiledBTN' onClick={handlecardUploadOverallColor}> <div
className="addNewSalesFiledBTN"
onClick={handlecardUploadOverallColor}
>
Add Add
<IoMdAdd <IoMdAdd className="plusOutlinedIcon" />
className="plusOutlinedIcon"
/>
</div> </div>
</div> </div>
</div> </div>
@ -4905,7 +4967,8 @@ const SelectionComponent = forwardRef((props, ref) => {
<span className="Selection-Component-selectheading"> <span className="Selection-Component-selectheading">
Selected BillTable:{' '} Selected BillTable:{' '}
<span style={{ color: '#009b00' }}> <span style={{ color: '#009b00' }}>
<IoReceiptOutline /> {BillTableCheckList[0]?.ComponentName} <IoReceiptOutline />{' '}
{BillTableCheckList[0]?.ComponentName}
</span> </span>
</span> </span>
</div> </div>
@ -4945,12 +5008,8 @@ const SelectionComponent = forwardRef((props, ref) => {
)} )}
</Row> </Row>
</Checkbox.Group> </Checkbox.Group>
<div <div className="SlecteCatDiv">
className='SlecteCatDiv' <div className="SlecteCatDivSub2">
>
<div
className='SlecteCatDivSub2'
>
<div> <div>
<Form.Item <Form.Item
name="FontTable" name="FontTable"
@ -4961,7 +5020,7 @@ const SelectionComponent = forwardRef((props, ref) => {
}, },
]} ]}
> >
<p className='Selection-Component-SubHeading'> <p className="Selection-Component-SubHeading">
BillTable Font BillTable Font
</p> </p>
<DropDowns <DropDowns
@ -4977,13 +5036,12 @@ const SelectionComponent = forwardRef((props, ref) => {
/> />
</Form.Item> </Form.Item>
</div> </div>
<div className='addNewSalesFiledBTN' onClick={TablehandleUploadFonts}> <div
className="addNewSalesFiledBTN"
onClick={TablehandleUploadFonts}
>
Add Add
<IoMdAdd <IoMdAdd className="plusOutlinedIcon" />
className="plusOutlinedIcon"
/>
</div> </div>
<DefaultModal <DefaultModal
open={TableModelopen} open={TableModelopen}
@ -5043,7 +5101,7 @@ const SelectionComponent = forwardRef((props, ref) => {
display: 'flex', display: 'flex',
gap: '1rem', gap: '1rem',
flexWrap: 'nowrap', flexWrap: 'nowrap',
alignItems: "center" alignItems: 'center',
}} }}
> >
<div className="colorDropdown"> <div className="colorDropdown">
@ -5056,7 +5114,7 @@ const SelectionComponent = forwardRef((props, ref) => {
}, },
]} ]}
> >
<p className='Selection-Component-SubHeading'> <p className="Selection-Component-SubHeading">
BillTable Background Color BillTable Background Color
</p> </p>
<DropDowns <DropDowns
@ -5106,12 +5164,12 @@ const SelectionComponent = forwardRef((props, ref) => {
/> />
</Form.Item> </Form.Item>
</div> </div>
<div className='addNewSalesFiledBTN' onClick={BillhandleUploadColor}> <div
className="addNewSalesFiledBTN"
onClick={BillhandleUploadColor}
>
Add Add
<IoMdAdd <IoMdAdd className="plusOutlinedIcon" />
className="plusOutlinedIcon"
/>
</div> </div>
</div> </div>
</div> </div>
@ -5194,7 +5252,7 @@ const SelectionComponent = forwardRef((props, ref) => {
display: 'flex', display: 'flex',
gap: '1rem', gap: '1rem',
flexWrap: 'nowrap', flexWrap: 'nowrap',
alignItems: "center" alignItems: 'center',
}} }}
> >
<div className="colorDropdown"> <div className="colorDropdown">
@ -5207,7 +5265,7 @@ const SelectionComponent = forwardRef((props, ref) => {
}, },
]} ]}
> >
<p className='Selection-Component-SubHeading'> <p className="Selection-Component-SubHeading">
BillTable Overall-Background BillTable Overall-Background
</p> </p>
<DropDowns <DropDowns
@ -5264,7 +5322,10 @@ const SelectionComponent = forwardRef((props, ref) => {
/> />
</Form.Item> </Form.Item>
</div> </div>
<div className='addNewSalesFiledBTN' onClick={handleBillingUploadOverallColor}> <div
className="addNewSalesFiledBTN"
onClick={handleBillingUploadOverallColor}
>
Add Add
<IoMdAdd <IoMdAdd
className="plusOutlinedIcon" className="plusOutlinedIcon"
@ -5405,7 +5466,7 @@ const SelectionComponent = forwardRef((props, ref) => {
// (empData?.UpdateAccess === "Y" || SAAccessCommonMaster?.UpdateAccess === "Y") && // (empData?.UpdateAccess === "Y" || SAAccessCommonMaster?.UpdateAccess === "Y") &&
// Object.keys(templateData)?.length > 0 // Object.keys(templateData)?.length > 0
// ))} // ))}
icon={<ArrowRightOutlined color='#fff' />} icon={<ArrowRightOutlined color="#fff" />}
htmlType={true} htmlType={true}
/> />
</div> </div>

View File

@ -30,7 +30,7 @@ import {
SelectedPrintTemplate, SelectedPrintTemplate,
GlobalPrinterMappingDtls, GlobalPrinterMappingDtls,
getPrinterMappingDetails, getPrinterMappingDetails,
getPrintSelectionComponentData, // getPrintSelectionComponentData,
} from '../../../../../Features/ThemeChange/ThemeChange'; } from '../../../../../Features/ThemeChange/ThemeChange';
import FormHeader from '../../../../../Pages/PageComponents/FormHeader'; import FormHeader from '../../../../../Pages/PageComponents/FormHeader';
import { ArrowRightOutlined } from '@ant-design/icons'; import { ArrowRightOutlined } from '@ant-design/icons';
@ -82,10 +82,14 @@ import {
import { TbSettingsCog } from 'react-icons/tb'; import { TbSettingsCog } from 'react-icons/tb';
import { useQuery, useQueryClient } from '@tanstack/react-query'; import { useQuery, useQueryClient } from '@tanstack/react-query';
import { axiosRetailInstanceData } from '../../../../../Features/AuthenicationToken/AuthenticationToken.js'; import { axiosRetailInstanceData } from '../../../../../Features/AuthenicationToken/AuthenticationToken.js';
import { MdEdit } from "react-icons/md"; import { MdEdit } from 'react-icons/md';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import { changeOrderOfferDetail } from '../../../../../Features/Offer/Offer.js'; import { changeOrderOfferDetail } from '../../../../../Features/Offer/Offer.js';
import { ChangeFullFreeProductList, changeFullOfferAppliedProducts, changeLoyaltyConsumedQuantities } from '../../../../../Features/Offer/Offernew/BookingOffernew.js'; import {
ChangeFullFreeProductList,
changeFullOfferAppliedProducts,
changeLoyaltyConsumedQuantities,
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import { ChangeTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges.js'; import { ChangeTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges.js';
import { Radio } from 'antd'; import { Radio } from 'antd';
import ReprintPDFDataShare from './ReprintPDFDataShare.jsx'; import ReprintPDFDataShare from './ReprintPDFDataShare.jsx';
@ -167,7 +171,7 @@ function BSReprint({ setOpenModel = () => { } }) {
const AuthToken = sessionStorage.getItem('auth'); const AuthToken = sessionStorage.getItem('auth');
const SessionMobileNo = getSession('MobileNo'); const SessionMobileNo = getSession('MobileNo');
const [dateStrings, setDateStrings] = useState([]); const [dateStrings, setDateStrings] = useState([]);
const [type, setType] = useState("Sales"); const [type, setType] = useState('Sales');
const [showShareModal, setShowShareModal] = useState(false); const [showShareModal, setShowShareModal] = useState(false);
// ---- 1. Fetch Function ---- // ---- 1. Fetch Function ----
const fetchData = async ({ queryKey }) => { const fetchData = async ({ queryKey }) => {
@ -180,7 +184,7 @@ function BSReprint({ setOpenModel = () => { } }) {
OrderFromDate: dates?.[0] ?? '', OrderFromDate: dates?.[0] ?? '',
OrderToDate: dates?.[1] ?? '', OrderToDate: dates?.[1] ?? '',
PageNumber: page, PageNumber: page,
Type: type Type: type,
}) })
).unwrap(); ).unwrap();
if (Response?.data?.statusCode === 1) { if (Response?.data?.statusCode === 1) {
@ -263,9 +267,8 @@ function BSReprint({ setOpenModel = () => { } }) {
// UserId: UserId, // UserId: UserId,
}; };
dispatch(getPrinterMappingDetails(data)).unwrap(); dispatch(getPrinterMappingDetails(data)).unwrap();
const Data1 = { AppId, CompId, BranchId }; // const Data1 = { AppId, CompId, BranchId };
dispatch(getPrintSelectionComponentData(Data1)).unwrap(); // dispatch(getPrintSelectionComponentData(Data1)).unwrap();
}, []); }, []);
const handleDateChange = (dates, dateStrings) => { const handleDateChange = (dates, dateStrings) => {
@ -950,9 +953,8 @@ function BSReprint({ setOpenModel = () => { } }) {
onClick={async (e) => await handleEditBill(e, row)} onClick={async (e) => await handleEditBill(e, row)}
/> />
), ),
} },
// ] : []) // ] : [])
,
{ {
title: () => ( title: () => (
<div <div
@ -1195,6 +1197,7 @@ function BSReprint({ setOpenModel = () => { } }) {
const mutiplePrint = async (printType) => { const mutiplePrint = async (printType) => {
setIsProcessing(true); setIsProcessing(true);
setProcessingProgress(0); setProcessingProgress(0);
const result = await MobileMultiPdfPrint({ const result = await MobileMultiPdfPrint({
printerTemplateStyle, printerTemplateStyle,
printDatas, printDatas,
@ -1252,15 +1255,16 @@ function BSReprint({ setOpenModel = () => { } }) {
const isWeightScale = item?.ScaleType === 'weight'; const isWeightScale = item?.ScaleType === 'weight';
if (isWeightScale) { if (isWeightScale) {
return acc + ( return (
Weightasquantity acc +
(Weightasquantity
? Math.round(Number(item?.SalesQty || item?.OrderQty || 0)) ? Math.round(Number(item?.SalesQty || item?.OrderQty || 0))
: 1 : 1)
); );
} }
return acc + Math.round(Number(item?.SalesQty || item?.OrderQty || 0)); return acc + Math.round(Number(item?.SalesQty || item?.OrderQty || 0));
}, 0) }, 0);
const widthOutTexAmt = table2Data?.[0]?.TaxDetails?.reduce( const widthOutTexAmt = table2Data?.[0]?.TaxDetails?.reduce(
(sum, item) => sum + (item?.WithOutTaxAmount || 0), (sum, item) => sum + (item?.WithOutTaxAmount || 0),
@ -1292,7 +1296,7 @@ function BSReprint({ setOpenModel = () => { } }) {
OrderQty: item?.SalesQty, OrderQty: item?.SalesQty,
OrderRate: item?.Rate, OrderRate: item?.Rate,
SellingPrice: item?.Rate, SellingPrice: item?.Rate,
TaxPercentage: (item?.ProdTaxPercentage || 0) TaxPercentage: item?.ProdTaxPercentage || 0,
// TotalAmt: formatAmount((item.TotalAmt - item.OfferValue)), // TotalAmt: formatAmount((item.TotalAmt - item.OfferValue)),
})); }));
@ -1302,14 +1306,10 @@ function BSReprint({ setOpenModel = () => { } }) {
if (RefDetails?.[0]?.OfferAppliedProductList) { if (RefDetails?.[0]?.OfferAppliedProductList) {
dispatch( dispatch(
changeFullOfferAppliedProducts( changeFullOfferAppliedProducts(RefDetails[0]?.OfferAppliedProductList)
RefDetails[0]?.OfferAppliedProductList
)
); );
} }
if (CustSuppId) { if (CustSuppId) {
let res = await dispatch( let res = await dispatch(
getCustomerForHold({ getCustomerForHold({
@ -1331,8 +1331,9 @@ function BSReprint({ setOpenModel = () => { } }) {
} }
if (res?.data?.statusCode === 1) { if (res?.data?.statusCode === 1) {
const loyaltyFreeProductOfferApplied = (
const loyaltyFreeProductOfferApplied = (RefDetails?.[0]?.OfferAppliedProductList || [])?.filter( RefDetails?.[0]?.OfferAppliedProductList || []
)?.filter(
(off) => (off) =>
off?.FreeProductsList?.OfferMode === 'L' && off?.FreeProductsList?.OfferMode === 'L' &&
off?.TableUniqueName === 'FreeProduct' off?.TableUniqueName === 'FreeProduct'
@ -1343,14 +1344,20 @@ function BSReprint({ setOpenModel = () => { } }) {
); );
if (customerDetails) { if (customerDetails) {
const { CustId, CustName, CustMobile, LoyaltyPointsDetail, TotalLoyaltyPoints } = customerDetails; const {
CustId,
CustName,
CustMobile,
LoyaltyPointsDetail,
TotalLoyaltyPoints,
} = customerDetails;
const data = { const data = {
CustId: CustId, CustId: CustId,
CustName: CustName, CustName: CustName,
label: CustName ? CustName : CustMobile, label: CustName ? CustName : CustMobile,
value: CustMobile, value: CustMobile,
LoyaltyPointsDetail: LoyaltyPointsDetail, LoyaltyPointsDetail: LoyaltyPointsDetail,
TotalLoyaltyPoints: TotalLoyaltyPoints TotalLoyaltyPoints: TotalLoyaltyPoints,
}; };
dispatch(changeOrderOfferDetail([...OrderOfferDetails])); dispatch(changeOrderOfferDetail([...OrderOfferDetails]));
@ -1383,7 +1390,6 @@ function BSReprint({ setOpenModel = () => { } }) {
console.log(loyaltyProdQuantities, 'loyaltyProdQuantities'); console.log(loyaltyProdQuantities, 'loyaltyProdQuantities');
} }
} }
} }
} }
await dispatch(changeOrderType('Hold')); await dispatch(changeOrderType('Hold'));
@ -1395,7 +1401,8 @@ function BSReprint({ setOpenModel = () => { } }) {
await dispatch(changePreviousOrderPayment(OrderPaymentDtl)); await dispatch(changePreviousOrderPayment(OrderPaymentDtl));
await dispatch(changePreviousOrderOfferDetail(OrderOfferDetails)); await dispatch(changePreviousOrderOfferDetail(OrderOfferDetails));
dispatch(changeOrderCardDetails(updated)); dispatch(changeOrderCardDetails(updated));
let temp = updated?.filter((item) => item.OrderType === 'E') let temp = updated
?.filter((item) => item.OrderType === 'E')
.map((item) => item.InwardDtlId + ' ' + item.BookingTypeName); .map((item) => item.InwardDtlId + ' ' + item.BookingTypeName);
await dispatch(changeSelProdWiseEst(temp)); await dispatch(changeSelProdWiseEst(temp));
@ -1406,11 +1413,11 @@ function BSReprint({ setOpenModel = () => { } }) {
await dispatch(changeEstimateBooking('Sales')); await dispatch(changeEstimateBooking('Sales'));
await dispatch(ChangeOverAllDiscSales(parseFloat(OverallDisc))); await dispatch(ChangeOverAllDiscSales(parseFloat(OverallDisc)));
} }
} };
const typeOptions = [ const typeOptions = [
{ label: "Sales", value: "Sales" }, { label: 'Sales', value: 'Sales' },
{ label: "Estimate", value: "Est" }, { label: 'Estimate', value: 'Est' },
]; ];
const typeChange = (e) => { const typeChange = (e) => {
@ -1455,7 +1462,8 @@ function BSReprint({ setOpenModel = () => { } }) {
/> />
<div style={{ width: '100%' }}> <div style={{ width: '100%' }}>
<div className="bsreprintmodaltable-flex"> <div className="bsreprintmodaltable-flex">
{preferenceEstimate && <div> {preferenceEstimate && (
<div>
<Radio.Group <Radio.Group
options={typeOptions} options={typeOptions}
onChange={typeChange} onChange={typeChange}
@ -1463,7 +1471,8 @@ function BSReprint({ setOpenModel = () => { } }) {
optionType="button" optionType="button"
buttonStyle="solid" // optional buttonStyle="solid" // optional
/> />
</div>} </div>
)}
<div> <div>
<RangePicker <RangePicker
placeholder={['Start Date', 'End Date']} placeholder={['Start Date', 'End Date']}
@ -1493,7 +1502,11 @@ function BSReprint({ setOpenModel = () => { } }) {
}} }}
/> />
<div> <div>
<ImShare fontSize={22} onClick={() => setShowShareModal(true)} style={{ cursor: 'pointer' }} /> <ImShare
fontSize={22}
onClick={() => setShowShareModal(true)}
style={{ cursor: 'pointer' }}
/>
</div> </div>
<div> <div>
{selectedRows.length > 0 && ( {selectedRows.length > 0 && (
@ -1507,9 +1520,6 @@ function BSReprint({ setOpenModel = () => { } }) {
onClick={() => mutiplePrint('whatsapp')} onClick={() => mutiplePrint('whatsapp')}
className="icon-whatsapp" className="icon-whatsapp"
/> />
{/* <ReprintPDFDataShare
printData={selectedRows}
/> */}
</div> </div>
)} )}
</div> </div>
@ -1856,13 +1866,15 @@ function BSReprint({ setOpenModel = () => { } }) {
</div> </div>
))} ))}
{showShareModal && <ReprintPDFDataShare {showShareModal && (
<ReprintPDFDataShare
printerTemplateStyle={printerTemplateStyle} printerTemplateStyle={printerTemplateStyle}
printDatas={printDatas} printDatas={printDatas}
SettingDataSelector={SettingDataSelector} SettingDataSelector={SettingDataSelector}
open={showShareModal} open={showShareModal}
onClose={() => setShowShareModal(false)} onClose={() => setShowShareModal(false)}
/>} />
)}
</> </>
); );
} }

View File

@ -1,22 +1,58 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import {
import { Table, Input, Select, Button } from 'antd'; lazy,
import { PlusOutlined, DeleteOutlined, SaveOutlined, PrinterOutlined } from '@ant-design/icons'; Suspense,
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from 'react';
import { Input, Select, Button } from 'antd';
import {
DeleteOutlined,
SaveOutlined,
PrinterOutlined,
} from '@ant-design/icons';
import { Tables } from '../../../../Components/Tables/Table.jsx'; import { Tables } from '../../../../Components/Tables/Table.jsx';
import { useDispatch } from 'react-redux'; import { useDispatch } from 'react-redux';
import { postProductData, getDirectSaleProducts, getAllProductShortCodes, deleteProductData, getDirectSaleSearchedProduct } from '../../../../Features/ProductPage/ProductPage.js'; import {
postProductData,
getDirectSaleProducts,
getAllProductShortCodes,
deleteProductData,
getDirectSaleSearchedProduct,
} from '../../../../Features/ProductPage/ProductPage.js';
import { getSession, printDiv } from '../../../../Services/Others.js'; import { getSession, printDiv } from '../../../../Services/Others.js';
import { Messages } from '../../../../Components/Notifications/Messages.jsx'; import { Messages } from '../../../../Components/Notifications/Messages.jsx';
import { FaStarOfLife } from "react-icons/fa6"; import { FaStarOfLife } from 'react-icons/fa6';
import { IoMdRefresh } from "react-icons/io"; import { IoMdRefresh } from 'react-icons/io';
import StickerPrintModel from '../../../Product/StickerPrintModal.jsx'; import StickerPrintModel from '../../../Product/StickerPrintModal.jsx';
import { getPageStyle, style } from '../../../Product/Printstyles.js'; import { getPageStyle, style } from '../../../Product/Printstyles.js';
import { getBarcodeSessionsIDs, getBarcodeTemplate } from '../../../../Features/Barcode/Barcode.js'; import {
import { generateBarcode, generateQRCode, generateQRCodeCopy } from '../../../../Services/utils.js'; getBarcodeSessionsIDs,
import StickerPrintTemplates from '../../../Product/StickerTemplates.jsx'; getBarcodeTemplate,
} from '../../../../Features/Barcode/Barcode.js';
import {
generateBarcode,
generateQRCode,
generateQRCodeCopy,
} from '../../../../Services/utils.js';
import useBarcodeGenerator from './useBarcodeQRGenerator.js'; import useBarcodeGenerator from './useBarcodeQRGenerator.js';
// Jsx File
const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatData = [], ProdSubCatData = [], SupplierData = [], activeTab = null }) => { const StickerPrintTemplates = lazy(
() => import('../../../Product/StickerTemplates.jsx')
);
// SCss
import '../../../../Styles/BookingScreen/Components/OtherConponents/Reprint/BSReprint.scss';
const DirectSale = ({
UomData = [],
TaxData = [],
ProductTypeData = [],
ProdCatData = [],
ProdSubCatData = [],
SupplierData = [],
activeTab = null,
}) => {
const formRef = useRef(); const formRef = useRef();
const tableRef = useRef(); const tableRef = useRef();
const searchInputRef = useRef(); const searchInputRef = useRef();
@ -40,7 +76,7 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
const [printProductName, setPrintProductName] = useState(false); const [printProductName, setPrintProductName] = useState(false);
const [productShortCodes, setAllProductShortCodes] = useState([]); const [productShortCodes, setAllProductShortCodes] = useState([]);
const [searchText, setSearchText] = useState(''); const [searchText, setSearchText] = useState('');
console.log(searchText, "searchText") console.log(searchText, 'searchText');
const [stickerPrintModalOpen, setStickerPrintModalOpen] = useState(false); const [stickerPrintModalOpen, setStickerPrintModalOpen] = useState(false);
const [barcodeTemplateDetails, setBarcodeTemplateDetails] = useState([]); const [barcodeTemplateDetails, setBarcodeTemplateDetails] = useState([]);
const [filteredProducts, setFilteredProducts] = useState([]); const [filteredProducts, setFilteredProducts] = useState([]);
@ -63,12 +99,13 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
codeType: '', codeType: '',
}); });
console.log((searchText != null && searchText != ''), "filteredProducts") console.log(searchText != null && searchText != '', 'filteredProducts');
const { qrBase64, barcodeBase64 } = useBarcodeGenerator(prodId); const { qrBase64, barcodeBase64 } = useBarcodeGenerator(prodId);
const handleAdd = () => { const handleAdd = () => {
setDataSource([{ setDataSource([
{
key: dataSource.length + 1, key: dataSource.length + 1,
productName: '', productName: '',
shortCode: '', shortCode: '',
@ -78,14 +115,16 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
prodId: null, prodId: null,
size: null, size: null,
uomName: null, uomName: null,
activeStatus: 'A' activeStatus: 'A',
}, ...dataSource]); },
...dataSource,
]);
}; };
const handleDelete = async (record) => { const handleDelete = async (record) => {
if (record?.prodId) { if (record?.prodId) {
if (searchText != null && searchText !== '') { if (searchText != null && searchText !== '') {
setSearchText('') setSearchText('');
setCurrentPage(1); setCurrentPage(1);
if (searchInputRef.current) { if (searchInputRef.current) {
searchInputRef.current.value = ''; searchInputRef.current.value = '';
@ -98,7 +137,11 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
}; };
const response = await dispatch(deleteProductData(deleteData))?.unwrap(); const response = await dispatch(deleteProductData(deleteData))?.unwrap();
if (response?.data?.statusCode === 1) { if (response?.data?.statusCode === 1) {
setMessageData(record.activeStatus === 'A' ? 'Product De-Activated Successfully' : 'Product Activated Successfully'); setMessageData(
record.activeStatus === 'A'
? 'Product De-Activated Successfully'
: 'Product Activated Successfully'
);
setMessageType('success'); setMessageType('success');
await fetchDirectSaleProducts(); await fetchDirectSaleProducts();
} else { } else {
@ -112,28 +155,35 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
setMessageData('Atleast one empty row should be in table.'); setMessageData('Atleast one empty row should be in table.');
setMessageType('warning'); setMessageType('warning');
} }
}; };
const handleChange = useCallback((key, field, value) => { const handleChange = useCallback(
(key, field, value) => {
if (searchText) { if (searchText) {
setFilteredProducts(prev => setFilteredProducts((prev) =>
prev.map(item => prev.map((item) =>
item.key === key ? { ...item, [field]: value } : item item.key === key ? { ...item, [field]: value } : item
) )
); );
} else { } else {
setDataSource(prev => setDataSource((prev) =>
prev.map(item => prev.map((item) =>
item.key === key ? { ...item, [field]: value } : item item.key === key ? { ...item, [field]: value } : item
) )
); );
} }
}, [searchText]); },
[searchText]
);
const handleSave = async (record) => { const handleSave = async (record) => {
if (
if (!record.productName || !record.sellingPrice || !record.uom || !record.tax || !record?.shortCode) { !record.productName ||
!record.sellingPrice ||
!record.uom ||
!record.tax ||
!record?.shortCode
) {
setMessageData('Please fill all the required fields!'); setMessageData('Please fill all the required fields!');
setMessageType('warning'); setMessageType('warning');
return; return;
@ -157,26 +207,31 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
CompId: CompId, CompId: CompId,
BranchId: BranchId, BranchId: BranchId,
AppId: AppId, AppId: AppId,
ProdType: ProductTypeData?.find(item => item.ConfigName === 'Product')?.ConfigId, ProdType: ProductTypeData?.find((item) => item.ConfigName === 'Product')
ProdCat: ProdCatData?.find(item => item.ConfigName === 'General')?.ConfigId, ?.ConfigId,
ProdSubCat: ProdSubCatData?.find(item => item.ConfigName === 'General')?.ConfigId, ProdCat: ProdCatData?.find((item) => item.ConfigName === 'General')
?.ConfigId,
ProdSubCat: ProdSubCatData?.find((item) => item.ConfigName === 'General')
?.ConfigId,
QtyBasedPrice: 'N', QtyBasedPrice: 'N',
ProdQtywisePriceDetails: [], ProdQtywisePriceDetails: [],
StockAvailable: 'N', StockAvailable: 'N',
TokenAvailable: 'N', TokenAvailable: 'N',
InwardDate: new Date().toJSON(), InwardDate: new Date().toJSON(),
SuppId: SupplierData?.find(item => item.SuppName?.toLowerCase() === 'self')?.SuppId, SuppId: SupplierData?.find(
(item) => item.SuppName?.toLowerCase() === 'self'
)?.SuppId,
AutoGenerateQr: 'N', AutoGenerateQr: 'N',
QRCode: null, QRCode: null,
CreatedBy: UserId, CreatedBy: UserId,
ProdLogo: '', ProdLogo: '',
Cess: 0, Cess: 0,
ProdShortCode: record?.shortCode ProdShortCode: record?.shortCode,
}; };
try { try {
if (record?.prodId) { if (record?.prodId) {
console.log('Updating Product') console.log('Updating Product');
} else { } else {
const response = await dispatch(postProductData(postData)).unwrap(); const response = await dispatch(postProductData(postData)).unwrap();
if (response?.data?.statusCode === 1) { if (response?.data?.statusCode === 1) {
@ -184,18 +239,22 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
const size = response?.data?.ProductDetails?.[0]?.Size; const size = response?.data?.ProductDetails?.[0]?.Size;
const uomName = response?.data?.ProductDetails?.[0]?.UomName; const uomName = response?.data?.ProductDetails?.[0]?.UomName;
const totalProducts = response?.data?.ProductDetails?.[0]?.TotalCount; const totalProducts = response?.data?.ProductDetails?.[0]?.TotalCount;
setSearchText(currentSearchText => { setSearchText((currentSearchText) => {
if (currentSearchText != null && currentSearchText !== '') { if (currentSearchText != null && currentSearchText !== '') {
setCurrentPage(1); setCurrentPage(1);
setTriggerState(prev => prev + 1); setTriggerState((prev) => prev + 1);
if (searchInputRef.current) { if (searchInputRef.current) {
searchInputRef.current.value = ''; searchInputRef.current.value = '';
} }
return ''; return '';
} else { } else {
setDataSource(prev => prev.map(item => setDataSource((prev) =>
item.key === record.key ? { ...item, prodId, size, uomName, totalProducts } : { ...item, totalProducts } prev.map((item) =>
)); item.key === record.key
? { ...item, prodId, size, uomName, totalProducts }
: { ...item, totalProducts }
)
);
} }
return currentSearchText; return currentSearchText;
}); });
@ -204,7 +263,6 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
return; return;
} }
} }
} catch (error) { } catch (error) {
console.error('Error saving product:', error); console.error('Error saving product:', error);
} }
@ -213,51 +271,68 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
const handlePrint = async (record) => { const handlePrint = async (record) => {
const exists = isShortCodeDuplicate(record?.shortCode, record?.prodId); const exists = isShortCodeDuplicate(record?.shortCode, record?.prodId);
if (exists) { if (exists) {
setMessageData('Short code already exists for another product. Cannot print.'); setMessageData(
'Short code already exists for another product. Cannot print.'
);
setMessageType('error'); setMessageType('error');
return; return;
} }
setStickerPrintModalOpen(true); setStickerPrintModalOpen(true);
setLabelPrintData({ ...record, MRP: record?.sellingPrice || 0, SellPrice: record?.sellingPrice || 0 }); setLabelPrintData({
setProdId(record?.shortCode + '' + record?.sellingPrice) ...record,
} MRP: record?.sellingPrice || 0,
SellPrice: record?.sellingPrice || 0,
});
setProdId(record?.shortCode + '' + record?.sellingPrice);
};
const columns = useMemo(() => [ const columns = useMemo(
() => [
{ {
title: 'SL.No', title: 'SL.No',
width: 50, width: 50,
align: 'center', align: 'center',
render: (_, __, index) => (currentPage - 1) * 10 + index + 1 render: (_, __, index) => (currentPage - 1) * 10 + index + 1,
}, },
{ {
title: () => <div style={{ textWrap: 'nowrap', display: "flex", gap: "4px " }}>Product Name title: () => (
<div style={{ textWrap: 'nowrap', display: 'flex', gap: '4px ' }}>
Product Name
<span> <span>
<FaStarOfLife size={10} color='red' className='requiredIcons' /> <FaStarOfLife size={10} color="red" className="requiredIcons" />
</span> </span>
</div>, </div>
),
dataIndex: 'productName', dataIndex: 'productName',
width: 150, width: 150,
render: (text, record) => ( render: (text, record) =>
record.prodId && editingKey !== record.key ? record.prodId && editingKey !== record.key ? (
<div>{text}</div> : <div>{text}</div>
) : (
<Input <Input
value={text} value={text}
onChange={(e) => handleChange(record.key, 'productName', e.target.value)} onChange={(e) =>
handleChange(record.key, 'productName', e.target.value)
}
placeholder="Enter product name" placeholder="Enter product name"
/> />
) ),
}, },
{ {
title: () => <div style={{ textWrap: 'nowrap', display: "flex", gap: "4px " }}>Short Code title: () => (
<div style={{ textWrap: 'nowrap', display: 'flex', gap: '4px ' }}>
Short Code
<span> <span>
<FaStarOfLife size={10} color='red' className='requiredIcons' /> <FaStarOfLife size={10} color="red" className="requiredIcons" />
</span> </span>
</div>, </div>
),
dataIndex: 'shortCode', dataIndex: 'shortCode',
width: 100, width: 100,
render: (text, record) => ( render: (text, record) =>
record.prodId && editingKey !== record.key ? record.prodId && editingKey !== record.key ? (
<div>{text}</div> : <div>{text}</div>
) : (
<Input <Input
value={text} value={text}
onInput={(e) => { onInput={(e) => {
@ -269,95 +344,120 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
} }
}} }}
onChange={(e) => { onChange={(e) => {
const value = e.target.value.replace(/[^a-zA-Z]/g, '').toUpperCase(); const value = e.target.value
.replace(/[^a-zA-Z]/g, '')
.toUpperCase();
const exists = isShortCodeDuplicate(value, record?.prodId); const exists = isShortCodeDuplicate(value, record?.prodId);
if (exists && value) { if (exists && value) {
setMessageData('Short code already exists for another product'); setMessageData(
'Short code already exists for another product'
);
setMessageType('error'); setMessageType('error');
} }
handleChange(record.key, 'shortCode', value); handleChange(record.key, 'shortCode', value);
}} }}
placeholder="Short Code" placeholder="Short Code"
/> />
) ),
}, },
{ {
title: () => <div style={{ textWrap: 'nowrap', display: "flex", gap: "4px " }}>Selling Price title: () => (
<div style={{ textWrap: 'nowrap', display: 'flex', gap: '4px ' }}>
Selling Price
<span> <span>
<FaStarOfLife size={10} color='red' className='requiredIcons' /> <FaStarOfLife size={10} color="red" className="requiredIcons" />
</span> </span>
</div>, </div>
),
dataIndex: 'sellingPrice', dataIndex: 'sellingPrice',
width: 120, width: 120,
render: (text, record) => ( render: (text, record) =>
record.prodId && editingKey !== record.key ? record.prodId && editingKey !== record.key ? (
<div>{text}</div> : <div>{text}</div>
) : (
<Input <Input
value={text} value={text}
onChange={(e) => { onChange={(e) => {
const value = e.target.value.replace(/[^0-9.]/g, ''); const value = e.target.value.replace(/[^0-9.]/g, '');
const parts = value.split('.'); const parts = value.split('.');
const formatted = parts.length > 2 ? `${parts[0]}.${parts.slice(1).join('')}` : value; const formatted =
parts.length > 2
? `${parts[0]}.${parts.slice(1).join('')}`
: value;
handleChange(record.key, 'sellingPrice', formatted); handleChange(record.key, 'sellingPrice', formatted);
}} }}
placeholder="0.00" placeholder="0.00"
/> />
) ),
}, },
{ {
title: () => <div style={{ textWrap: 'nowrap', display: "flex", gap: "4px " }}>UOM title: () => (
<div style={{ textWrap: 'nowrap', display: 'flex', gap: '4px ' }}>
UOM
<span> <span>
<FaStarOfLife size={10} color='red' className='requiredIcons' /> <FaStarOfLife size={10} color="red" className="requiredIcons" />
</span> </span>
</div>, </div>
),
dataIndex: 'uom', dataIndex: 'uom',
width: 60, width: 60,
render: (text, record) => ( render: (text, record) =>
record.prodId && editingKey !== record.key ? record.prodId && editingKey !== record.key ? (
<div>{UomData?.find(item => item.ConfigId === text)?.ConfigName || '-'}</div> : <div>
{UomData?.find((item) => item.ConfigId === text)?.ConfigName ||
'-'}
</div>
) : (
<Select <Select
disabled={record?.prodId} disabled={record?.prodId}
className='uom-select' className="uom-select"
value={text} value={text}
onChange={(value) => handleChange(record.key, 'uom', value)} onChange={(value) => handleChange(record.key, 'uom', value)}
placeholder="UOM" placeholder="UOM"
style={{ width: '100%' }} style={{ width: '100%' }}
options={UomData?.map(item => ({ options={UomData?.map((item) => ({
value: item.ConfigId, value: item.ConfigId,
label: item.ConfigName label: item.ConfigName,
}))} }))}
/> />
) ),
}, },
{ {
title: () => <div style={{ textWrap: 'nowrap', display: "flex", gap: "4px " }}>Tax title: () => (
<div style={{ textWrap: 'nowrap', display: 'flex', gap: '4px ' }}>
Tax
<span> <span>
<FaStarOfLife size={10} color='red' className='requiredIcons' /> <FaStarOfLife size={10} color="red" className="requiredIcons" />
</span> </span>
</div>, </div>
),
dataIndex: 'tax', dataIndex: 'tax',
width: 70, width: 70,
render: (text, record) => { render: (text, record) => {
if (record.prodId && editingKey !== record.key) { if (record.prodId && editingKey !== record.key) {
const tax = TaxData?.find(item => item.TaxId === text); const tax = TaxData?.find((item) => item.TaxId === text);
return <div>{tax ? tax?.TaxIdName + ' - ' + `${tax?.TaxPercentage}%` : '-'}</div>; return (
<div>
{tax ? tax?.TaxIdName + ' - ' + `${tax?.TaxPercentage}%` : '-'}
</div>
);
} }
return ( return (
<Select <Select
className='tax-select' className="tax-select"
value={text} value={text}
disabled={record?.prodId} disabled={record?.prodId}
onChange={(value) => handleChange(record.key, 'tax', value)} onChange={(value) => handleChange(record.key, 'tax', value)}
placeholder="Tax" placeholder="Tax"
style={{ width: '100%' }} style={{ width: '100%' }}
options={TaxData?.map(item => ({ options={TaxData?.map((item) => ({
value: item.TaxId, value: item.TaxId,
label: `${item.TaxIdName} - ${item.TaxPercentage}%` label: `${item.TaxIdName} - ${item.TaxPercentage}%`,
}))} }))}
/> />
); );
} },
}, },
{ {
title: 'Save / Print', title: 'Save / Print',
@ -367,55 +467,61 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
const existingProduct = record?.prodId; const existingProduct = record?.prodId;
return ( return (
<div className='directsaleBTN' style={{ display: 'flex', gap: '8px', justifyContent: 'center' }}> <div
{!existingProduct && <Button className="directsaleBTN"
style={{ display: 'flex', gap: '8px', justifyContent: 'center' }}
>
{!existingProduct && (
<Button
icon={<SaveOutlined />} icon={<SaveOutlined />}
size="small" size="small"
disabled={existingProduct} disabled={existingProduct}
className='save-btn' className="save-btn"
onClick={() => handleSave(record)} onClick={() => handleSave(record)}
> >
Save Save
{/* {!existingProduct ? 'Save' : 'Update'} */} {/* {!existingProduct ? 'Save' : 'Update'} */}
</Button>} </Button>
{existingProduct && <Button )}
{existingProduct && (
<Button
icon={<PrinterOutlined />} icon={<PrinterOutlined />}
size="small" size="small"
disabled={!existingProduct} disabled={!existingProduct}
onClick={() => handlePrint(record)} onClick={() => handlePrint(record)}
> >
Print Print
</Button>} </Button>
)}
</div> </div>
); );
} },
}, },
{ {
title: 'Action', title: 'Action',
width: 60, width: 60,
align: "center", align: 'center',
render: (_, record) => { render: (_, record) => {
if (record?.activeStatus === 'A') { if (record?.activeStatus === 'A') {
return <DeleteOutlined return (
<DeleteOutlined
onClick={() => handleDelete(record)} onClick={() => handleDelete(record)}
style={{ color: 'red', cursor: 'pointer', fontSize: '18px' }} style={{ color: 'red', cursor: 'pointer', fontSize: '18px' }}
/> />
);
} else { } else {
return <IoMdRefresh return (
<IoMdRefresh
style={{ color: 'blue', cursor: 'pointer', fontSize: '18px' }} style={{ color: 'blue', cursor: 'pointer', fontSize: '18px' }}
onClick={() => handleDelete(record)} onClick={() => handleDelete(record)}
/> />
);
} }
},
} },
} ],
], [ [searchText, editingKey, productShortCodes, UomData, TaxData]
searchText, );
editingKey,
productShortCodes,
UomData,
TaxData
]);
useEffect(() => { useEffect(() => {
if (activeTab === 'directSale' && AppId && CompId && BranchId) { if (activeTab === 'directSale' && AppId && CompId && BranchId) {
@ -425,7 +531,7 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
}, [activeTab, AppId, BranchId, CompId, currentPage, triggerState]); }, [activeTab, AppId, BranchId, CompId, currentPage, triggerState]);
useEffect(() => { useEffect(() => {
if (dataSource.every(row => row.prodId)) { if (dataSource.every((row) => row.prodId)) {
handleAdd(); handleAdd();
} }
}, [dataSource]); }, [dataSource]);
@ -435,7 +541,8 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
if (searchText) { if (searchText) {
fetchSearchedProducts(); fetchSearchedProducts();
} else { } else {
setFilteredProducts([{ setFilteredProducts([
{
key: 1, key: 1,
productName: '', productName: '',
shortCode: '', shortCode: '',
@ -445,8 +552,9 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
prodId: null, prodId: null,
size: null, size: null,
uomName: null, uomName: null,
activeStatus: 'A' activeStatus: 'A',
}]); },
]);
} }
}, 500); }, 500);
@ -455,7 +563,11 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
useEffect(() => { useEffect(() => {
const handleClickOutside = (event) => { const handleClickOutside = (event) => {
if (tableRef.current && !tableRef.current.contains(event.target) && !event.target.closest('.ant-select-dropdown')) { if (
tableRef.current &&
!tableRef.current.contains(event.target) &&
!event.target.closest('.ant-select-dropdown')
) {
setEditingKey(null); setEditingKey(null);
} }
}; };
@ -464,7 +576,13 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
}, []); }, []);
useEffect(() => { useEffect(() => {
if (activeTab === 'directSale' && AppId && CompId && BranchId && stickerPrintModalOpen) { if (
activeTab === 'directSale' &&
AppId &&
CompId &&
BranchId &&
stickerPrintModalOpen
) {
getBarcodeSessionData(); getBarcodeSessionData();
fetchBarcodeTemplateDetails(); fetchBarcodeTemplateDetails();
} }
@ -476,10 +594,15 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
AppId: AppId, AppId: AppId,
CompId: CompId, CompId: CompId,
BranchId: BranchId, BranchId: BranchId,
prodName: searchText prodName: searchText,
} };
const response = await dispatch(getDirectSaleSearchedProduct(data))?.unwrap(); const response = await dispatch(
if (response?.data?.data?.length > 0 && response?.data?.statusCode === 1) { getDirectSaleSearchedProduct(data)
)?.unwrap();
if (
response?.data?.data?.length > 0 &&
response?.data?.statusCode === 1
) {
const products = response?.data?.data?.map((item, index) => ({ const products = response?.data?.data?.map((item, index) => ({
key: index + 1, key: index + 1,
productName: item.ProdName, productName: item.ProdName,
@ -491,9 +614,10 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
activeStatus: item?.ActiveStatus, activeStatus: item?.ActiveStatus,
size: item.Size || 1, size: item.Size || 1,
uomName: item.UomName || 'PCS', uomName: item.UomName || 'PCS',
totalProducts: item?.TotalCount totalProducts: item?.TotalCount,
})) }));
setFilteredProducts([{ setFilteredProducts([
{
key: products.length + 1, key: products.length + 1,
productName: '', productName: '',
shortCode: '', shortCode: '',
@ -503,10 +627,13 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
prodId: null, prodId: null,
size: null, size: null,
uomName: null, uomName: null,
activeStatus: 'A' activeStatus: 'A',
}, ...products]); },
...products,
]);
} else { } else {
setFilteredProducts([{ setFilteredProducts([
{
key: 1, key: 1,
productName: '', productName: '',
shortCode: '', shortCode: '',
@ -516,22 +643,25 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
prodId: null, prodId: null,
size: null, size: null,
uomName: null, uomName: null,
activeStatus: 'A' activeStatus: 'A',
}]); },
]);
} }
} catch (error) { } catch (error) {
console.error(error?.message) console.error(error?.message);
} }
};
} const isShortCodeDuplicate = useCallback(
(code, prodId) => {
const isShortCodeDuplicate = useCallback((code, prodId) => {
return productShortCodes.some( return productShortCodes.some(
item => (item) =>
item.ProdShortCode.toUpperCase() === code.toUpperCase() && item.ProdShortCode.toUpperCase() === code.toUpperCase() &&
item.ProdId !== prodId item.ProdId !== prodId
); );
}, [productShortCodes]); },
[productShortCodes]
);
const fetchBarcodeTemplateDetails = async () => { const fetchBarcodeTemplateDetails = async () => {
const response = await dispatch( const response = await dispatch(
@ -548,7 +678,10 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
const getBarcodeSessionData = async () => { const getBarcodeSessionData = async () => {
try { try {
let response = await dispatch(getBarcodeSessionsIDs()).unwrap(); let response = await dispatch(getBarcodeSessionsIDs()).unwrap();
if (response?.data?.statusCode === 1 && response?.data?.data?.length > 0) { if (
response?.data?.statusCode === 1 &&
response?.data?.data?.length > 0
) {
setCrossData( setCrossData(
response?.data?.data?.filter( response?.data?.data?.filter(
(item) => !item.ConfigName?.includes('100X13 (55MM Printable Gold)') (item) => !item.ConfigName?.includes('100X13 (55MM Printable Gold)')
@ -568,11 +701,14 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
AppId: AppId, AppId: AppId,
CompId: CompId, CompId: CompId,
BranchId: BranchId, BranchId: BranchId,
page: currentPage page: currentPage,
} };
const response = await dispatch(getDirectSaleProducts(data))?.unwrap(); const response = await dispatch(getDirectSaleProducts(data))?.unwrap();
if (response?.data?.statusCode === 1 && response?.data?.data?.length > 0) { if (
response?.data?.statusCode === 1 &&
response?.data?.data?.length > 0
) {
const products = response?.data?.data?.map((item, index) => ({ const products = response?.data?.data?.map((item, index) => ({
key: index + 1, key: index + 1,
productName: item.ProdName, productName: item.ProdName,
@ -584,9 +720,10 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
activeStatus: item?.ActiveStatus, activeStatus: item?.ActiveStatus,
size: item.Size || 1, size: item.Size || 1,
uomName: item.UomName || 'PCS', uomName: item.UomName || 'PCS',
totalProducts: item?.TotalCount totalProducts: item?.TotalCount,
})); }));
setDataSource([{ setDataSource([
{
key: products.length + 1, key: products.length + 1,
productName: '', productName: '',
shortCode: '', shortCode: '',
@ -596,16 +733,17 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
prodId: null, prodId: null,
size: null, size: null,
uomName: null, uomName: null,
activeStatus: 'A' activeStatus: 'A',
}, ...products]); },
...products,
]);
} else { } else {
setDataSource([]) setDataSource([]);
} }
} catch (error) { } catch (error) {
console.error('Error fetching direct sale products:', error); console.error('Error fetching direct sale products:', error);
} }
} };
const fetchAllProductShortCodes = async () => { const fetchAllProductShortCodes = async () => {
try { try {
@ -613,21 +751,23 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
AppId: AppId, AppId: AppId,
CompId: CompId, CompId: CompId,
BranchId: BranchId, BranchId: BranchId,
} };
const response = await dispatch(getAllProductShortCodes(data))?.unwrap(); const response = await dispatch(getAllProductShortCodes(data))?.unwrap();
if (response?.data?.statusCode === 1 && response?.data?.data?.length > 0) { if (
response?.data?.statusCode === 1 &&
response?.data?.data?.length > 0
) {
setAllProductShortCodes(response?.data?.data); setAllProductShortCodes(response?.data?.data);
} else { } else {
setAllProductShortCodes([]); setAllProductShortCodes([]);
} }
console.log(response); console.log(response);
} catch (error) { } catch (error) {
console.error('Error fetching product short codes:', error); console.error('Error fetching product short codes:', error);
} }
} };
const handlePageChange = (current) => { const handlePageChange = (current) => {
setCurrentPage(current); setCurrentPage(current);
@ -762,12 +902,12 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
}; };
const handleModalClose = () => { const handleModalClose = () => {
setCopies(null) setCopies(null);
setDropdownValue('') setDropdownValue('');
setStickerPrintModalOpen(false); setStickerPrintModalOpen(false);
setLabelPrintData(null); setLabelPrintData(null);
setNickName(null); setNickName(null);
setProdId(null) setProdId(null);
setMultiProduct(false); setMultiProduct(false);
formRef?.current?.resetFields(); formRef?.current?.resetFields();
setPrintReady(false); setPrintReady(false);
@ -810,7 +950,8 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
}, []); }, []);
return ( return (
<div className='direct-sale-container'> <Suspense fallback={<span>Loading ...</span>}>
<div className="direct-sale-container">
<Messages <Messages
messageType={messageType} messageType={messageType}
messageData={messageData} messageData={messageData}
@ -823,27 +964,45 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
placeholder="Search Product / Short Code..." placeholder="Search Product / Short Code..."
onChange={(e) => { onChange={(e) => {
setSearchText(e.target.value); setSearchText(e.target.value);
setCurrentPage(1) setCurrentPage(1);
}} }}
/> />
</div> </div>
<div style={{ marginBottom: '10px', color: '#666', fontSize: '14px', fontStyle: 'italic' }}> <div
style={{
marginBottom: '10px',
color: '#666',
fontSize: '14px',
fontStyle: 'italic',
}}
>
Note: Click on a row to modify the product details Note: Click on a row to modify the product details
</div> </div>
<div className='DirectSaleTable' ref={tableRef}> <div className="DirectSaleTable" ref={tableRef}>
<Tables <Tables
rowKey="prodId" rowKey="prodId"
data={(searchText != null && searchText != '') ? filteredProducts : dataSource} data={
dataSource={(searchText != null && searchText != '') ? filteredProducts : dataSource} searchText != null && searchText != ''
? filteredProducts
: dataSource
}
dataSource={
searchText != null && searchText != ''
? filteredProducts
: dataSource
}
columns={columns} columns={columns}
onRow={(record) => ({ onRow={(record) => ({
onClick: () => record.prodId && setEditingKey(record.key) onClick: () => record.prodId && setEditingKey(record.key),
})} })}
ownPagination={true} ownPagination={true}
pagination={{ pagination={{
current: currentPage, current: currentPage,
onChange: handlePageChange, onChange: handlePageChange,
total: (searchText != null && searchText != '') ? filteredProducts?.length : ((dataSource[dataSource.length - 1]?.totalProducts || 0) + 1), total:
searchText != null && searchText != ''
? filteredProducts?.length
: (dataSource[dataSource.length - 1]?.totalProducts || 0) + 1,
pageSize: 11, pageSize: 11,
showSizeChanger: false, showSizeChanger: false,
hideOnSinglePage: true, hideOnSinglePage: true,
@ -852,7 +1011,8 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
/> />
</div> </div>
{stickerPrintModalOpen && <StickerPrintModel {stickerPrintModalOpen && (
<StickerPrintModel
open={stickerPrintModalOpen} open={stickerPrintModalOpen}
handleCancel={handleModalClose} handleCancel={handleModalClose}
formRef={formRef} formRef={formRef}
@ -868,7 +1028,9 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
detail={labelPrintData} detail={labelPrintData}
proName={labelPrintData?.productName} proName={labelPrintData?.productName}
nickName={nickName} nickName={nickName}
ProdId={labelPrintData?.shortCode + '' + labelPrintData?.sellingPrice} ProdId={
labelPrintData?.shortCode + '' + labelPrintData?.sellingPrice
}
size={labelPrintData?.size} size={labelPrintData?.size}
// valueStyleColumn={valueStyleColumn} // valueStyleColumn={valueStyleColumn}
// secondValueStyle={secondValueStyle} // secondValueStyle={secondValueStyle}
@ -880,7 +1042,8 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
setProductWiseQrcode={null} setProductWiseQrcode={null}
setNickName={setNickName} setNickName={setNickName}
templateOptions={templateOptions} templateOptions={templateOptions}
/>} />
)}
{printReady && ( {printReady && (
<StickerPrintTemplates <StickerPrintTemplates
@ -888,23 +1051,26 @@ const DirectSale = ({ UomData = [], TaxData = [], ProductTypeData = [], ProdCatD
copies={copies} copies={copies}
nickName={nickName} nickName={nickName}
proName={labelPrintData?.productName} proName={labelPrintData?.productName}
ProdId={labelPrintData?.shortCode + '' + labelPrintData?.sellingPrice} ProdId={
labelPrintData?.shortCode + '' + labelPrintData?.sellingPrice
}
size={labelPrintData?.size + ' ' + labelPrintData?.uomName} size={labelPrintData?.size + ' ' + labelPrintData?.uomName}
detail={labelPrintData} detail={labelPrintData}
templateOptions={templateOptions} templateOptions={templateOptions}
base64Image={qrBase64} base64Image={qrBase64}
QrandbarcodeDatas={null} QrandbarcodeDatas={null}
MultiCode={multiProduct} MultiCode={multiProduct}
generateQRCodeCopy={(code) => generateQRCodeCopy={(code) => generateQRCodeCopy(null, code)}
generateQRCodeCopy(null, code) generateCodeImage={(code, codeType = 'Q') =>
generateCodeImage(code, codeType, null)
} }
generateCodeImage={(code, codeType = 'Q') => generateCodeImage(code, codeType, null)}
imageTagBarcodeAndQR={imageTagBarcodeAndQR} imageTagBarcodeAndQR={imageTagBarcodeAndQR}
dropdownValue={dropdownValue} dropdownValue={dropdownValue}
barcodeTemplateDetails={barcodeTemplateDetails} barcodeTemplateDetails={barcodeTemplateDetails}
/> />
)} )}
</div> </div>
</Suspense>
); );
}; };

View File

@ -0,0 +1,45 @@
import { useEffect } from 'react';
import { useSelector, useDispatch, shallowEqual } from 'react-redux';
import {
getLayoutSubCategories,
GlobalProductCategorie,
} from '../../Features/BookingScreen/BookingData/BookingData';
import { getTemplateData } from '../../Features/ThemeChange/ThemeChange';
import { getSession } from '../../Services/Others';
const LayoutSubCategoryFetcher = () => {
const dispatch = useDispatch();
const ProdCat = useSelector(GlobalProductCategorie, shallowEqual);
const templateData = useSelector(getTemplateData, shallowEqual);
const CompId = getSession('CompId');
const BranchId = getSession('BranchId');
const AppId = getSession('AppId');
useEffect(() => {
if (!ProdCat) return;
const isCategory5 = templateData?.BookingCategory?.[0] === 'Category5';
const isLayout2 = templateData?.BookingLayout?.[0] === 'Layout2';
if (isCategory5 && isLayout2) {
dispatch(
getLayoutSubCategories({
CompId,
BranchId,
AppId,
ProdCat,
})
);
}
}, [
ProdCat,
templateData?.BookingCategory?.[0],
templateData?.BookingLayout?.[0],
]);
return null; // this component renders nothing
};
export default LayoutSubCategoryFetcher;

View File

@ -1,7 +1,9 @@
import React, { useCallback, useEffect, useState } from 'react'; import React, { lazy, Suspense, useCallback, useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { Tooltip, Badge, Popconfirm, DatePicker } from 'antd'; import { Tooltip, Badge, Popconfirm, DatePicker } from 'antd';
import dayjs from 'dayjs';
import moment from 'moment'; import moment from 'moment';
import { Messages } from '../../../../Components/Notifications/Messages.jsx';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import BSNavbar1 from '../../Components/BSNavbar/BSNavbar1'; import BSNavbar1 from '../../Components/BSNavbar/BSNavbar1';
import BSNavbar2 from '../../Components/BSNavbar/BSNavbar2'; import BSNavbar2 from '../../Components/BSNavbar/BSNavbar2';
@ -12,7 +14,6 @@ import BSBillingTable4 from '../../Components/BSBillingTables/BSBillingTable4/BS
import BSBillingTable5 from '../../Components/BSBillingTables/BSBillingTable5/BSBillingTable5'; import BSBillingTable5 from '../../Components/BSBillingTables/BSBillingTable5/BSBillingTable5';
import BSBillingTable6 from '../../Components/BSBillingTables/BSBillingTable6/BSBTOverall6'; import BSBillingTable6 from '../../Components/BSBillingTables/BSBillingTable6/BSBTOverall6';
import BSBillingTable7 from '../../Components/BSBillingTables/BSBillingTable7/BSBillingTable7Overall.jsx'; import BSBillingTable7 from '../../Components/BSBillingTables/BSBillingTable7/BSBillingTable7Overall.jsx';
import { ArrowUpOutlined } from '@ant-design/icons';
import BSItemCard from '../../Components/BSItemCards/BSItemCard'; import BSItemCard from '../../Components/BSItemCards/BSItemCard';
import CategoryHorizontal from '../../Components/BSCategories/BSCategoryHorizontal'; import CategoryHorizontal from '../../Components/BSCategories/BSCategoryHorizontal';
import SubCategoryVertical from '../../Components/BSSubCategories/BSSubCategoryVertical'; import SubCategoryVertical from '../../Components/BSSubCategories/BSSubCategoryVertical';
@ -39,14 +40,12 @@ import {
GlobalBtoBQuickProductTransfer, GlobalBtoBQuickProductTransfer,
GlobalOtherSevices, GlobalOtherSevices,
} from '../../../../Features/BookingScreen/BookingData/BookingData.js'; } from '../../../../Features/BookingScreen/BookingData/BookingData.js';
import { useDateStore } from '../../../../Features/BookingScreen/BookingData/DateStore.js';
import { getSession } from '../../../../Services/Others.js'; import { getSession } from '../../../../Services/Others.js';
import { Messages } from '../../../../Components/Notifications/Messages.jsx';
import BSKioskCounterPayment from '../../Components/UtillComponents/BSKioskCounterPayment.jsx';
import { import {
getKioskDatas, getKioskDatas,
globalKioskSalesCount, globalKioskSalesCount,
} from '../../../../Features/Kiosk/kiosk.js'; } from '../../../../Features/Kiosk/kiosk.js';
import SalesCountComponent from '../SalesCountComponent.jsx';
import PozoKioskIcon from '../../Components/UtillComponents/Pozo retail icons/PozoKioskIcon.jsx'; import PozoKioskIcon from '../../Components/UtillComponents/Pozo retail icons/PozoKioskIcon.jsx';
import { import {
GLobalSadminUserPin, GLobalSadminUserPin,
@ -54,33 +53,57 @@ import {
checkSession, checkSession,
ApplicationPreferences, ApplicationPreferences,
} from '../../../../Features/BrachLogin/BranchLogin'; } from '../../../../Features/BrachLogin/BranchLogin';
import SAdminUserNotification from '../../Components/BookingFunctionality/SAdminUserNotification.jsx';
import { import {
getBookingStatus, getBookingStatus,
GlobalBookingStatus, GlobalBookingStatus,
} from '../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js'; } from '../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js';
import TooltipWrapper from '../../../../Components/Tooltip/Tooltip.jsx';
import RetailBookingClosing from '../RetailBookingClose.jsx';
import { PutBookingClose } from '../../../../Features/BookingScreen/RetailBookingClose.js';
import BookingCloseIcon from '../../Components/UtillComponents/BookingCloseIcon.jsx';
import ListOfSalesInvoices from '../../Components/BSBillingTables/ListofInvoices/ListOfSalesInvoices.jsx';
import BSEwayBillicon from '../../Components/UtillComponents/BSEwayBillicon.jsx';
import BSComboItemCard from '../../Components/BSItemCards/BSComboItemCard.jsx';
import BranchTransferComponent from '../../Components/UtillComponents/BSQuickBranchToBranchTransferComponent.jsx';
import BSExpireProductsList from '../../Components/UtillComponents/BSExpireProductsList.jsx';
import BSOtherServiceItemCard from '../../Components/BSItemCards/BSOtherServiceItemCard.jsx';
import BSOtherServicesHorizontalcat from '../../Components/BSCategories/BSOtherServicesHorizontalcat'; import BSOtherServicesHorizontalcat from '../../Components/BSCategories/BSOtherServicesHorizontalcat';
import BSNavbar3 from '../../Components/BSNavbar/BSNavbar3.jsx'; import { PutBookingClose } from '../../../../Features/BookingScreen/RetailBookingClose.js';
import SalesCountForStandard from '../SalesCountForStandard.jsx'; import TooltipWrapper from '../../../../Components/Tooltip/Tooltip.jsx';
import StandardTable from '../../Components/BSBillingTables/StandardTable/StandardTable.jsx'; import BookingCloseIcon from '../../Components/UtillComponents/BookingCloseIcon.jsx';
import { useDateStore } from '../../../../Features/BookingScreen/BookingData/DateStore.js'; import BSEwayBillicon from '../../Components/UtillComponents/BSEwayBillicon.jsx';
import dayjs from 'dayjs'; import SAdminUserNotification from '../../Components/BookingFunctionality/SAdminUserNotification.jsx';
import BsBookingitemCard from '../../Components/BSItemCards/BsBookingitemCard.jsx'; // Jsx Files
import { CiShop } from 'react-icons/ci'; const BSKioskCounterPayment = lazy(
import BranchName from '../BranchName.jsx'; () => import('../../Components/UtillComponents/BSKioskCounterPayment.jsx')
import ComboSalesBillTable from '../../Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx'; );
import PlanExpireNotification from '../PlanExpireNotification.jsx'; const RetailBookingClosing = lazy(() => import('../RetailBookingClose.jsx'));
const ListOfSalesInvoices = lazy(
() =>
import('../../Components/BSBillingTables/ListofInvoices/ListOfSalesInvoices.jsx')
);
const BSComboItemCard = lazy(
() => import('../../Components/BSItemCards/BSComboItemCard.jsx')
);
const BranchTransferComponent = lazy(
() =>
import('../../Components/UtillComponents/BSQuickBranchToBranchTransferComponent.jsx')
);
const BSExpireProductsList = lazy(
() => import('../../Components/UtillComponents/BSExpireProductsList.jsx')
);
const BSOtherServiceItemCard = lazy(
() => import('../../Components/BSItemCards/BSOtherServiceItemCard.jsx')
);
const BSNavbar3 = lazy(() => import('../../Components/BSNavbar/BSNavbar3.jsx'));
const SalesCountForStandard = lazy(
() => import('../SalesCountForStandard.jsx')
);
const StandardTable = lazy(
() =>
import('../../Components/BSBillingTables/StandardTable/StandardTable.jsx')
);
const BsBookingitemCard = lazy(
() => import('../../Components/BSItemCards/BsBookingitemCard.jsx')
);
const ComboSalesBillTable = lazy(
() =>
import('../../Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx')
);
const SalesCountComponent = lazy(() => import('../SalesCountComponent.jsx'));
const PlanExpireNotification = lazy(
() => import('../PlanExpireNotification.jsx')
);
const BSLayout1 = () => { const BSLayout1 = () => {
const dispatch = useDispatch(); const dispatch = useDispatch();
@ -157,16 +180,17 @@ const BSLayout1 = () => {
(i) => i.SettingIdName === 'DineIn' (i) => i.SettingIdName === 'DineIn'
)?.[0]; )?.[0];
let containerHeight = isMobile let containerHeight = isMobile
? AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend' ? AppExpDate?.RemainingDays <= 7 ||
AppExpDate?.PlanType?.toLowerCase() === 'extend'
? '575px' ? '575px'
: '595px' : '595px'
: UserType != 'Super Admin' && : (UserType != 'Super Admin' &&
UserType != 'Super Admin User' && UserType != 'Super Admin User' &&
AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend' AppExpDate?.RemainingDays <= 7) ||
AppExpDate?.PlanType?.toLowerCase() === 'extend'
? '96vh' ? '96vh'
: '99vh'; : '99vh';
useEffect(() => { useEffect(() => {
if (AppId && CompId && BranchId && UserId) { if (AppId && CompId && BranchId && UserId) {
fetchBookingStatus(); fetchBookingStatus();
@ -224,8 +248,6 @@ const BSLayout1 = () => {
// setBadgeCount(length); // setBadgeCount(length);
}; };
const onComplete = useCallback(() => { const onComplete = useCallback(() => {
setMessageData(null); setMessageData(null);
setMessageType(null); setMessageType(null);
@ -298,6 +320,8 @@ const BSLayout1 = () => {
}; };
// BSLayout1Data?.BookingNavbar?.[1]?.some((item) => item?.OptionName === "AddCustomer") // BSLayout1Data?.BookingNavbar?.[1]?.some((item) => item?.OptionName === "AddCustomer")
return ( return (
<Suspense fallback={<div>Loading</div>}>
{' '}
<> <>
<Messages <Messages
messageType={messageType} messageType={messageType}
@ -306,7 +330,9 @@ const BSLayout1 = () => {
/> />
{UserType != 'Super Admin' && {UserType != 'Super Admin' &&
UserType != 'Super Admin User' && UserType != 'Super Admin User' &&
(AppExpDate?.RemainingDays <= 7 || AppExpDate === 'undefined' || AppExpDate?.PlanType?.toLowerCase() === 'extend') && ( (AppExpDate?.RemainingDays <= 7 ||
AppExpDate === 'undefined' ||
AppExpDate?.PlanType?.toLowerCase() === 'extend') && (
<PlanExpireNotification /> <PlanExpireNotification />
)} )}
<div <div
@ -327,7 +353,10 @@ const BSLayout1 = () => {
}} }}
> >
{BookingNavbar != 'Navbar3' ? ( {BookingNavbar != 'Navbar3' ? (
<div className="Layout-bill-container" style={{ marginTop: '9px' }}> <div
className="Layout-bill-container"
style={{ marginTop: '9px' }}
>
<div <div
className="Layout-bill-Subcontainer" className="Layout-bill-Subcontainer"
style={{ width: OtherServicesglobal ? '10%' : '100%' }} style={{ width: OtherServicesglobal ? '10%' : '100%' }}
@ -381,7 +410,10 @@ const BSLayout1 = () => {
> >
<PozoKioskIcon <PozoKioskIcon
onClick={() => openModalKiosk()} onClick={() => openModalKiosk()}
style={{ cursor: 'pointer', fontSize: '1.5rem' }} style={{
cursor: 'pointer',
fontSize: '1.5rem',
}}
className="iconsize" className="iconsize"
/> />
</Badge> </Badge>
@ -468,7 +500,10 @@ const BSLayout1 = () => {
)} )}
</div> </div>
<div style={{ marginLeft: '10px' }}> <div style={{ marginLeft: '10px' }}>
<TooltipWrapper title={'E-way Bill'} isMobile={isMobile}> <TooltipWrapper
title={'E-way Bill'}
isMobile={isMobile}
>
{''} {''}
<BSEwayBillicon <BSEwayBillicon
style={{ cursor: 'pointer', marginTop: '5px' }} style={{ cursor: 'pointer', marginTop: '5px' }}
@ -613,20 +648,14 @@ const BSLayout1 = () => {
<BSBillingTable7 /> <BSBillingTable7 />
)} )}
{BookingBilling == 'Billing8' && <ComboSalesBillTable />} {BookingBilling == 'Billing8' && <ComboSalesBillTable />}
{BSLayout1Data?.BookingBilling?.[0] == 'StandardBilling' && ( {BSLayout1Data?.BookingBilling?.[0] ==
'StandardBilling' && (
<div className="BSCategory2New"> <div className="BSCategory2New">
<StandardTable /> <StandardTable />
</div> </div>
)} )}
</> </>
)} )}
{/* <div className="salesStoreName"
style={{
color: SelectedBillColor?.['FontColor'],
backgroundColor: SelectedBillColor?.['BackgroundColor'],
}}>
<BranchName/>
</div> */}
</div> </div>
</div> </div>
</div> </div>
@ -644,6 +673,7 @@ const BSLayout1 = () => {
/> />
)} )}
</> </>
</Suspense>
); );
}; };

View File

@ -110,6 +110,7 @@ const SalesCountForStandard = lazy(
() => import('../SalesCountForStandard.jsx') () => import('../SalesCountForStandard.jsx')
); );
import BsBookingitemCard from '../../Components/BSItemCards/BsBookingitemCard.jsx'; import BsBookingitemCard from '../../Components/BSItemCards/BsBookingitemCard.jsx';
import LayoutSubCategoryFetcher from '../../LayoutSubCategoryFetcher.jsx';
const ListOfSalesInvoices = lazy( const ListOfSalesInvoices = lazy(
() => () =>
import('../../Components/BSBillingTables/ListofInvoices/ListOfSalesInvoices.jsx') import('../../Components/BSBillingTables/ListofInvoices/ListOfSalesInvoices.jsx')
@ -182,12 +183,14 @@ const BSLayout2 = () => {
(i) => i.SettingIdName === 'DineIn' (i) => i.SettingIdName === 'DineIn'
)?.[0]; )?.[0];
let containerHeight = isMobile let containerHeight = isMobile
? AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend' ? AppExpDate?.RemainingDays <= 7 ||
AppExpDate?.PlanType?.toLowerCase() === 'extend'
? '575px' ? '575px'
: '' : ''
: UserType != 'Super Admin' && : (UserType != 'Super Admin' &&
UserType != 'Super Admin User' && UserType != 'Super Admin User' &&
AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend' AppExpDate?.RemainingDays <= 7) ||
AppExpDate?.PlanType?.toLowerCase() === 'extend'
? '96vh' ? '96vh'
: '99vh'; : '99vh';
@ -210,7 +213,6 @@ const BSLayout2 = () => {
preference?.PreferredStatus == 'Y' preference?.PreferredStatus == 'Y'
); );
useEffect(() => { useEffect(() => {
fetchAmount(); fetchAmount();
if ( if (
@ -334,7 +336,9 @@ const BSLayout2 = () => {
<div ref={elementRef} style={{ backgroundColor: '#fff' }}> <div ref={elementRef} style={{ backgroundColor: '#fff' }}>
{UserType != 'Super Admin' && {UserType != 'Super Admin' &&
UserType != 'Super Admin User' && UserType != 'Super Admin User' &&
(AppExpDate?.RemainingDays <= 7 || AppExpDate === 'undefined' || AppExpDate?.PlanType?.toLowerCase() === 'extend') && ( (AppExpDate?.RemainingDays <= 7 ||
AppExpDate === 'undefined' ||
AppExpDate?.PlanType?.toLowerCase() === 'extend') && (
<Suspense fallback={<div>Loading...</div>}> <Suspense fallback={<div>Loading...</div>}>
<PlanExpireNotification /> <PlanExpireNotification />
</Suspense> </Suspense>
@ -679,6 +683,8 @@ const BSLayout2 = () => {
/> />
</Suspense> </Suspense>
)} )}
<LayoutSubCategoryFetcher />
</> </>
); );
}; };

View File

@ -1,10 +1,15 @@
import React, { useEffect, useState, useCallback } from 'react'; import React, {
useEffect,
useState,
useCallback,
lazy,
Suspense,
useMemo,
} from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import moment from 'moment'; import moment from 'moment';
import { Tooltip, Badge, Popconfirm } from 'antd'; import { Tooltip, Badge, Popconfirm } from 'antd';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import BSNavbar1 from '../../Components/BSNavbar/BSNavbar1';
import BSNavbar2 from '../../Components/BSNavbar/BSNavbar2';
import CategoryHorizontal from '../../Components/BSCategories/BSCategoryHorizontal'; import CategoryHorizontal from '../../Components/BSCategories/BSCategoryHorizontal';
import SubCategoryHorizontal from '../../Components/BSSubCategories/BSSubCategoryHorizontal'; import SubCategoryHorizontal from '../../Components/BSSubCategories/BSSubCategoryHorizontal';
import BSItemCard from '../../Components/BSItemCards/BSItemCard'; import BSItemCard from '../../Components/BSItemCards/BSItemCard';
@ -12,8 +17,8 @@ import BSBillingTable1 from '../../Components/BSBillingTables/BSBillingTable1/BS
import BSBillingTable2 from '../../Components/BSBillingTables/BSBillingTable2/BSBillingTable2'; import BSBillingTable2 from '../../Components/BSBillingTables/BSBillingTable2/BSBillingTable2';
import BSBillingTable3 from '../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3overall'; import BSBillingTable3 from '../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3overall';
import BSBillingTable4 from '../../Components/BSBillingTables/BSBillingTable4/BSBillingTable4Full'; import BSBillingTable4 from '../../Components/BSBillingTables/BSBillingTable4/BSBillingTable4Full';
import BSBillingTable5 from '../../Components/BSBillingTables/BSBillingTable5/BSBillingTable5';
import BSBillingTable6 from '../../Components/BSBillingTables/BSBillingTable6/BSBTOverall6'; import BSBillingTable6 from '../../Components/BSBillingTables/BSBillingTable6/BSBTOverall6';
import BSBillingTable5 from '../../Components/BSBillingTables/BSBillingTable5/BSBillingTable5';
import BSBillingTable7 from '../../Components/BSBillingTables/BSBillingTable7/BSBillingTable7Overall.jsx'; import BSBillingTable7 from '../../Components/BSBillingTables/BSBillingTable7/BSBillingTable7Overall.jsx';
import { dynamicComponentProps } from '../DynamicComponentProps.js'; import { dynamicComponentProps } from '../DynamicComponentProps.js';
import { import {
@ -26,13 +31,10 @@ import {
SelectedGlobalSubCatgColorDetail, SelectedGlobalSubCatgColorDetail,
StoredSessionData, StoredSessionData,
} from '../../../../Features/ThemeChange/ThemeChange'; } from '../../../../Features/ThemeChange/ThemeChange';
import { ArrowUpOutlined } from '@ant-design/icons';
import { settingDataSelector } from '../../../../Features/PreferenceMaster/PreferenceMaster.js';
import { import {
GlobalSalesDetailData, GlobalSalesDetailData,
getSalesDetailData, getSalesDetailData,
GlobalCombosearch, GlobalCombosearch,
GlobalOrderCardDetails,
PreferenceData, PreferenceData,
GlobalOrderStatus, GlobalOrderStatus,
GlobalAppExpDateData, GlobalAppExpDateData,
@ -40,46 +42,77 @@ import {
GlobalOtherSevices, GlobalOtherSevices,
} from '../../../../Features/BookingScreen/BookingData/BookingData.js'; } from '../../../../Features/BookingScreen/BookingData/BookingData.js';
import { getSession } from '../../../../Services/Others.js'; import { getSession } from '../../../../Services/Others.js';
import BSKioskCounterPayment from '../../Components/UtillComponents/BSKioskCounterPayment.jsx'; import { PutBookingClose } from '../../../../Features/BookingScreen/RetailBookingClose.js';
import { import {
getKioskDatas, getKioskDatas,
globalKioskSalesCount, globalKioskSalesCount,
} from '../../../../Features/Kiosk/kiosk.js'; } from '../../../../Features/Kiosk/kiosk.js';
import PozoKioskIcon from '../../Components/UtillComponents/Pozo retail icons/PozoKioskIcon.jsx';
import { import {
GLobalSadminUserPin, GLobalSadminUserPin,
putSadminUserExit, putSadminUserExit,
checkSession, checkSession,
ApplicationPreferences, ApplicationPreferences,
} from '../../../../Features/BrachLogin/BranchLogin'; } from '../../../../Features/BrachLogin/BranchLogin.js';
// Icons
import PozoKioskIcon from '../../Components/UtillComponents/Pozo retail icons/PozoKioskIcon.jsx';
import BookingCloseIcon from '../../Components/UtillComponents/BookingCloseIcon.jsx';
import BSEwayBillicon from '../../Components/UtillComponents/BSEwayBillicon.jsx';
import { Messages } from '../../../../Components/Notifications/Messages.jsx'; import { Messages } from '../../../../Components/Notifications/Messages.jsx';
import SAdminUserNotification from '../../Components/BookingFunctionality/SAdminUserNotification.jsx'; import SAdminUserNotification from '../../Components/BookingFunctionality/SAdminUserNotification.jsx';
import '../../../../Styles/BookingScreen/Template/BSLayout3/BSLayout3.scss';
import SalesCountComponent from '../SalesCountComponent.jsx';
import { import {
getBookingStatus, getBookingStatus,
GlobalBookingStatus, GlobalBookingStatus,
} from '../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js'; } from '../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js';
import TooltipWrapper from '../../../../Components/Tooltip/Tooltip.jsx'; import TooltipWrapper from '../../../../Components/Tooltip/Tooltip.jsx';
import RetailBookingClosing from '../RetailBookingClose.jsx'; import RetailBookingClosing from '../RetailBookingClose.jsx';
import { PutBookingClose } from '../../../../Features/BookingScreen/RetailBookingClose.js'; // Jsx Files
import BookingCloseIcon from '../../Components/UtillComponents/BookingCloseIcon.jsx'; const SalesCountComponent = lazy(() => import('../SalesCountComponent.jsx'));
import ListOfSalesInvoices from '../../Components/BSBillingTables/ListofInvoices/ListOfSalesInvoices.jsx'; const BSKioskCounterPayment = lazy(
import BSEwayBillicon from '../../Components/UtillComponents/BSEwayBillicon.jsx'; () => import('../../Components/UtillComponents/BSKioskCounterPayment.jsx')
import BSComboItemCard from '../../Components/BSItemCards/BSComboItemCard.jsx'; );
import BranchTransferComponent from '../../Components/UtillComponents/BSQuickBranchToBranchTransferComponent.jsx'; const ListOfSalesInvoices = lazy(
import BSExpireProductsList from '../../Components/UtillComponents/BSExpireProductsList.jsx'; () =>
import('../../Components/BSBillingTables/ListofInvoices/ListOfSalesInvoices.jsx')
);
const BSComboItemCard = lazy(
() => import('../../Components/BSItemCards/BSComboItemCard.jsx')
);
const BranchTransferComponent = lazy(
() =>
import('../../Components/UtillComponents/BSQuickBranchToBranchTransferComponent.jsx')
);
const BSExpireProductsList = lazy(
() => import('../../Components/UtillComponents/BSExpireProductsList.jsx')
);
const BSOtherServiceItemCard = lazy(
() => import('../../Components/BSItemCards/BSOtherServiceItemCard.jsx')
);
const BSOtherServicesHorizontalcat = lazy(
() => import('../../Components/BSCategories/BSOtherServicesHorizontalcat')
);
const BSNavbar3 = lazy(() => import('../../Components/BSNavbar/BSNavbar3.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')
);
const PlanExpireNotification = lazy(
() => import('../PlanExpireNotification.jsx')
);
const BSNavbar1 = lazy(() => import('../../Components/BSNavbar/BSNavbar1'));
const BSNavbar2 = lazy(() => import('../../Components/BSNavbar/BSNavbar2'));
// Scss
import '../../../../Styles/BookingScreen/Template/BSLayout3/BSLayout3.scss';
const subDirectory = import.meta.env.BASE_URL; const subDirectory = import.meta.env.BASE_URL;
const commonDirectory = import.meta.env.COMMON_BASE_URL; const commonDirectory = import.meta.env.COMMON_BASE_URL;
import BSOtherServiceItemCard from '../../Components/BSItemCards/BSOtherServiceItemCard.jsx';
import BSOtherServicesHorizontalcat from '../../Components/BSCategories/BSOtherServicesHorizontalcat';
import BSNavbar3 from '../../Components/BSNavbar/BSNavbar3.jsx';
import SalesCountForStandard from '../SalesCountForStandard.jsx';
import StandardTable from '../../Components/BSBillingTables/StandardTable/StandardTable.jsx';
import { CiShop } from 'react-icons/ci';
import BranchName from '../BranchName.jsx';
import ComboSalesBillTable from '../../Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx';
import PlanExpireNotification from '../PlanExpireNotification.jsx';
const BSLayout3 = () => { const BSLayout3 = () => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const { action, selectedProducts } = useSelector( const { action, selectedProducts } = useSelector(
@ -106,10 +139,12 @@ const BSLayout3 = () => {
const BookingStatus = useSelector(GlobalBookingStatus); const BookingStatus = useSelector(GlobalBookingStatus);
const appPreferences = useSelector(ApplicationPreferences); const appPreferences = useSelector(ApplicationPreferences);
const commonModulePreference = appPreferences?.find( const commonModulePreference = appPreferences?.find(
(preference) => preference?.PreferredCatName === "Common Module" (preference) => preference?.PreferredCatName === 'Common Module'
)?.PreferenceCatDetails; )?.PreferenceCatDetails;
const sportsAppPreference = commonModulePreference?.find( const sportsAppPreference = commonModulePreference?.find(
(preference) => preference?.PreferredSubCatName === "SportsApp" && preference?.PreferredStatus == 'Y' (preference) =>
preference?.PreferredSubCatName === 'SportsApp' &&
preference?.PreferredStatus == 'Y'
); );
const CheckBookingStatus = const CheckBookingStatus =
BookingStatus?.find((item) => item.ScreenType === 'Booking') BookingStatus?.find((item) => item.ScreenType === 'Booking')
@ -124,10 +159,13 @@ const BSLayout3 = () => {
const BookingSubCategory = BSLayout3Data?.BookingSubCategory; const BookingSubCategory = BSLayout3Data?.BookingSubCategory;
const BookingCard = BSLayout3Data?.BookingCard; const BookingCard = BSLayout3Data?.BookingCard;
const BookingBilling = BSLayout3Data?.BookingBilling?.[0]; const BookingBilling = BSLayout3Data?.BookingBilling?.[0];
const animations = ['example1', 'example2', 'example3'];
const DineInAccess = SettingDataSelector?.[0]?.SettingDtlDetails.filter( let ss = animations[count];
const DineInAccess = useMemo(() => {
return SettingDataSelector?.[0]?.SettingDtlDetails.filter(
(i) => i.SettingIdName === 'DineIn' (i) => i.SettingIdName === 'DineIn'
)?.[0]; )?.[0];
}, [SettingDataSelector]);
const [ListOfInvoices, setListOfInvoices] = useState(false); const [ListOfInvoices, setListOfInvoices] = useState(false);
const AppId = SessionData?.AppId; const AppId = SessionData?.AppId;
const CompId = SessionData?.CompId; const CompId = SessionData?.CompId;
@ -136,12 +174,14 @@ const BSLayout3 = () => {
const UserType = SessionData?.UserType; const UserType = SessionData?.UserType;
const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss'); const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
let containerHeight = isMobile let containerHeight = isMobile
? AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend' ? AppExpDate?.RemainingDays <= 7 ||
AppExpDate?.PlanType?.toLowerCase() === 'extend'
? '576px' ? '576px'
: '590px' : '590px'
: UserType != 'Super Admin' && : (UserType != 'Super Admin' &&
UserType != 'Super Admin User' && UserType != 'Super Admin User' &&
AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend' AppExpDate?.RemainingDays <= 7) ||
AppExpDate?.PlanType?.toLowerCase() === 'extend'
? '95vh' ? '95vh'
: '99vh'; : '99vh';
const SAdminuserPin = useSelector(GLobalSadminUserPin); const SAdminuserPin = useSelector(GLobalSadminUserPin);
@ -162,7 +202,6 @@ const BSLayout3 = () => {
} }
}, [SessionData]); }, [SessionData]);
const fetchKioskDatas = async () => { const fetchKioskDatas = async () => {
let data = { let data = {
CompId: CompId, CompId: CompId,
@ -261,6 +300,7 @@ const BSLayout3 = () => {
setListOfInvoices(false); setListOfInvoices(false);
}; };
return ( return (
<Suspense fallback={<div>Suspense Loading...</div>}>
<> <>
<Messages <Messages
messageType={messageType} messageType={messageType}
@ -269,7 +309,9 @@ const BSLayout3 = () => {
/> />
{UserType != 'Super Admin' && {UserType != 'Super Admin' &&
UserType != 'Super Admin User' && UserType != 'Super Admin User' &&
(AppExpDate?.RemainingDays <= 7 || AppExpDate === 'undefined' || AppExpDate?.PlanType?.toLowerCase() === 'extend') && ( (AppExpDate?.RemainingDays <= 7 ||
AppExpDate === 'undefined' ||
AppExpDate?.PlanType?.toLowerCase() === 'extend') && (
<PlanExpireNotification /> <PlanExpireNotification />
)} )}
<div <div
@ -282,29 +324,41 @@ const BSLayout3 = () => {
{BookingNavbar == 'Navbar3' && <BSNavbar3 />} {BookingNavbar == 'Navbar3' && <BSNavbar3 />}
</div> </div>
<div <div
className={BookingNavbar != 'Navbar3' ? "BSLayout3" : "BSLayout3Standard"} className={
BookingNavbar != 'Navbar3' ? 'BSLayout3' : 'BSLayout3Standard'
}
style={{ style={{
backgroundColor: GlobalLayoutColorDetail?.OverallBackgroundColor, backgroundColor: GlobalLayoutColorDetail?.OverallBackgroundColor,
}} }}
> >
{BookingNavbar != 'Navbar3' ? ( {BookingNavbar != 'Navbar3' ? (
<div className="Layout-bill-container" style={{ marginTop: '9px' }}> <div
<div className="Layout-bill-Subcontainer" style={{ width: OtherServicesglobal ? "10%" : "100%" }}> className="Layout-bill-container"
{UserType !== 'Employee' && style={{ marginTop: '9px' }}
>
<div
className="Layout-bill-Subcontainer"
style={{ width: OtherServicesglobal ? '10%' : '100%' }}
>
{UserType !== 'Employee' && (
<div className="pricing-name-details"> <div className="pricing-name-details">
{PricingAppPricingName?.[0]?.PricingName + {PricingAppPricingName?.[0]?.PricingName +
' / ' + ' / ' +
PricingAppPricingName?.[0]?.Type} PricingAppPricingName?.[0]?.Type}
</div> </div>
} )}
{!OtherServicesglobal && <SalesCountComponent {!OtherServicesglobal && (
<SalesCountComponent
DineInAccess={DineInAccess} DineInAccess={DineInAccess}
GlobalsalesDetailData={GlobalsalesDetailData} GlobalsalesDetailData={GlobalsalesDetailData}
/>} />
{!OtherServicesglobal && SessionData?.FeatureAddonData?.FeatureDtls?.find( )}
{!OtherServicesglobal &&
SessionData?.FeatureAddonData?.FeatureDtls?.find(
(item) => (item) =>
item?.FeatureAddonName?.toLowerCase() === 'kiosk sales' item?.FeatureAddonName?.toLowerCase() === 'kiosk sales'
) && !sportsAppPreference && ( ) &&
!sportsAppPreference && (
<div <div
style={{ style={{
pointerEvents: OrderStatus > 0 ? 'none' : 'auto', pointerEvents: OrderStatus > 0 ? 'none' : 'auto',
@ -313,7 +367,11 @@ const BSLayout3 = () => {
> >
<Tooltip title={'Kiosk Sales'}> <Tooltip title={'Kiosk Sales'}>
{''} {''}
<Badge count={badgeCount} offset={[-10, 3]} size="small"> <Badge
count={badgeCount}
offset={[-10, 3]}
size="small"
>
<PozoKioskIcon <PozoKioskIcon
onClick={() => openModalKiosk()} onClick={() => openModalKiosk()}
style={{ cursor: 'pointer', fontSize: '1.5rem' }} style={{ cursor: 'pointer', fontSize: '1.5rem' }}
@ -324,7 +382,10 @@ const BSLayout3 = () => {
</div> </div>
)} )}
{!OtherServicesglobal && ( {!OtherServicesglobal && (
<TooltipWrapper title={'Low Stock Alerts'} isMobile={isMobile}> <TooltipWrapper
title={'Low Stock Alerts'}
isMobile={isMobile}
>
{' '} {' '}
<BSExpireProductsList /> <BSExpireProductsList />
</TooltipWrapper> </TooltipWrapper>
@ -335,7 +396,8 @@ const BSLayout3 = () => {
closeKioskModal={closeModalKiosk} closeKioskModal={closeModalKiosk}
/> />
)} )}
{SAdminuserPin?.length > 0 && UserType != 'Super Admin User' && ( {SAdminuserPin?.length > 0 &&
UserType != 'Super Admin User' && (
<div> <div>
<SAdminUserNotification <SAdminUserNotification
SAdminuserPin={SAdminuserPin} SAdminuserPin={SAdminuserPin}
@ -346,9 +408,15 @@ const BSLayout3 = () => {
</div> </div>
)} )}
{!OtherServicesglobal && <> {CheckBookingStatus == 'Open' ? ( {!OtherServicesglobal && (
<div style={{ marginLeft: "10px" }}> <>
<TooltipWrapper title={'Booking Close'} isMobile={isMobile}> {' '}
{CheckBookingStatus == 'Open' ? (
<div style={{ marginLeft: '10px' }}>
<TooltipWrapper
title={'Booking Close'}
isMobile={isMobile}
>
{' '} {' '}
<BookingCloseIcon <BookingCloseIcon
onClick={OpenBookingModal} onClick={OpenBookingModal}
@ -365,8 +433,11 @@ const BSLayout3 = () => {
</TooltipWrapper> </TooltipWrapper>
</div> </div>
) : ( ) : (
<div style={{ marginLeft: "10px" }}> <div style={{ marginLeft: '10px' }}>
<TooltipWrapper title="Booking Open" isMobile={isMobile}> <TooltipWrapper
title="Booking Open"
isMobile={isMobile}
>
<Popconfirm <Popconfirm
placement="leftTop" placement="leftTop"
title="Booking Open" title="Booking Open"
@ -387,12 +458,13 @@ const BSLayout3 = () => {
/> />
</span> </span>
</Popconfirm> </Popconfirm>
</TooltipWrapper> </TooltipWrapper>
</div> </div>
)} </>} )}{' '}
{!OtherServicesglobal && </>
<div style={{ marginLeft: "10px" }}> )}
{!OtherServicesglobal && (
<div style={{ marginLeft: '10px' }}>
<TooltipWrapper title={'E-way Bill'} isMobile={isMobile}> <TooltipWrapper title={'E-way Bill'} isMobile={isMobile}>
{''} {''}
<BSEwayBillicon <BSEwayBillicon
@ -400,20 +472,20 @@ const BSLayout3 = () => {
onClick={OpenListOfInvoices} onClick={OpenListOfInvoices}
/> />
</TooltipWrapper> </TooltipWrapper>
</div>} </div>
)}
</div> </div>
</div> </div>
) : ) : (
<SalesCountForStandard <>
PricingAppPricingName={PricingAppPricingName} <SalesCountForStandard />
DineInAccess={DineInAccess} </>
GlobalsalesDetailData={GlobalsalesDetailData} )}
/>
}
<div <div
className="BsLayout3-ContentDiv" className="BsLayout3-ContentDiv"
style={{ style={{
backgroundColor: GlobalLayoutColorDetail?.OverallBackgroundColor, backgroundColor:
GlobalLayoutColorDetail?.OverallBackgroundColor,
}} }}
> >
<div className="BSCategory3-Contentcont"> <div className="BSCategory3-Contentcont">
@ -526,20 +598,14 @@ const BSLayout3 = () => {
<BSBillingTable7 /> <BSBillingTable7 />
)} )}
{BookingBilling == 'Billing8' && <ComboSalesBillTable />} {BookingBilling == 'Billing8' && <ComboSalesBillTable />}
{BSLayout3Data?.BookingBilling?.[0] == 'StandardBilling' && ( {BSLayout3Data?.BookingBilling?.[0] ==
'StandardBilling' && (
<div className="BSCategory2New"> <div className="BSCategory2New">
<StandardTable /> <StandardTable />
</div> </div>
)} )}
</> </>
)} )}
{/* <div className="salesStoreName"
style={{
color: SelectedBillColor?.['FontColor'],
backgroundColor: SelectedBillColor?.['BackgroundColor'],
}}>
<BranchName/>
</div> */}
</div> </div>
</div> </div>
</div> </div>
@ -557,6 +623,7 @@ const BSLayout3 = () => {
/> />
)} )}
</> </>
</Suspense>
); );
}; };

View File

@ -1,21 +1,43 @@
import React, { useCallback, useEffect, useState } from 'react'; import {lazy, Suspense, useCallback, useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import moment from 'moment'; import moment from 'moment';
import { Tooltip, Badge, Popconfirm } from 'antd'; import { Tooltip, Badge, Popconfirm } from 'antd';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import { ArrowUpOutlined } from '@ant-design/icons';
import BookingCloseIcon from '../../Components/UtillComponents/BookingCloseIcon.jsx'; import BookingCloseIcon from '../../Components/UtillComponents/BookingCloseIcon.jsx';
import BSNavbar1 from '../../Components/BSNavbar/BSNavbar1'; const BSNavbar1 = lazy(() => import('../../Components/BSNavbar/BSNavbar1'));
import BSNavbar2 from '../../Components/BSNavbar/BSNavbar2'; const BSNavbar2 = lazy(() => import('../../Components/BSNavbar/BSNavbar2'));
import CategoryVertical from '../../Components/BSCategories/BSCategoryVertical'; const CategoryVertical = lazy(
import BSItemCard from '../../Components/BSItemCards/BSItemCard'; () => import('../../Components/BSCategories/BSCategoryVertical')
import BSBillingTable1 from '../../Components/BSBillingTables/BSBillingTable1/BSBTOverall1'; );
import BSBillingTable2 from '../../Components/BSBillingTables/BSBillingTable2/BSBillingTable2'; const BSItemCard = lazy(
import BSBillingTable3 from '../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3overall'; () => import('../../Components/BSItemCards/BSItemCard')
import BSBillingTable4 from '../../Components/BSBillingTables/BSBillingTable4/BSBillingTable4Full'; );
import BSBillingTable5 from '../../Components/BSBillingTables/BSBillingTable5/BSBillingTable5'; const BSBillingTable1 = lazy(
import BSBillingTable6 from '../../Components/BSBillingTables/BSBillingTable6/BSBTOverall6'; () => import('../../Components/BSBillingTables/BSBillingTable1/BSBTOverall1')
import BSBillingTable7 from '../../Components/BSBillingTables/BSBillingTable7/BSBillingTable7Overall.jsx'; );
const BSBillingTable2 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable2/BSBillingTable2')
);
const BSBillingTable3 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3overall')
);
const BSBillingTable4 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable4/BSBillingTable4Full')
);
const BSBillingTable5 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable5/BSBillingTable5')
);
const BSBillingTable6 = lazy(
() => import('../../Components/BSBillingTables/BSBillingTable6/BSBTOverall6')
);
const BSBillingTable7 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable7/BSBillingTable7Overall.jsx')
);
import { dynamicComponentProps } from '../DynamicComponentProps.js'; import { dynamicComponentProps } from '../DynamicComponentProps.js';
import { import {
getTemplateData, getTemplateData,
@ -51,31 +73,66 @@ import {
} from '../../../../Features/BrachLogin/BranchLogin'; } from '../../../../Features/BrachLogin/BranchLogin';
import { Messages } from '../../../../Components/Notifications/Messages.jsx'; import { Messages } from '../../../../Components/Notifications/Messages.jsx';
import SAdminUserNotification from '../../Components/BookingFunctionality/SAdminUserNotification.jsx'; import SAdminUserNotification from '../../Components/BookingFunctionality/SAdminUserNotification.jsx';
import '../../../../Styles/BookingScreen/Template/BSLayout4/BSLayout4.scss'; const SalesCountComponent = lazy(() => import('../SalesCountComponent.jsx'));
import SalesCountComponent from '../SalesCountComponent.jsx';
import { import {
getBookingStatus, getBookingStatus,
GlobalBookingStatus, GlobalBookingStatus,
} from '../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js'; } from '../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js';
import { PutBookingClose } from '../../../../Features/BookingScreen/RetailBookingClose.js'; import { PutBookingClose } from '../../../../Features/BookingScreen/RetailBookingClose.js';
import TooltipWrapper from '../../../../Components/Tooltip/Tooltip.jsx'; import TooltipWrapper from '../../../../Components/Tooltip/Tooltip.jsx';
import RetailBookingClosing from '../RetailBookingClose.jsx'; const RetailBookingClosing = lazy(() => import('../RetailBookingClose.jsx'));
import ListOfSalesInvoices from '../../Components/BSBillingTables/ListofInvoices/ListOfSalesInvoices.jsx';
import BSEwayBillicon from '../../Components/UtillComponents/BSEwayBillicon.jsx';
import BSComboItemCard from '../../Components/BSItemCards/BSComboItemCard.jsx';
import BranchTransferComponent from '../../Components/UtillComponents/BSQuickBranchToBranchTransferComponent.jsx';
import BSExpireProductsList from '../../Components/UtillComponents/BSExpireProductsList.jsx';
import BSOtherServiceItemCard from '../../Components/BSItemCards/BSOtherServiceItemCard.jsx';
import BSOtherServicesHorizontalcat from '../../Components/BSCategories/BSOtherServicesHorizontalcat';
import BSOtherServicesVerticalcat from '../../Components/BSCategories/BSOtherServicesVerticalcat.jsx';
import BSNavbar3 from '../../Components/BSNavbar/BSNavbar3.jsx';
import SalesCountForStandard from '../SalesCountForStandard.jsx';
import StandardTable from '../../Components/BSBillingTables/StandardTable/StandardTable.jsx';
import { CiShop } from 'react-icons/ci';
import BranchName from '../BranchName.jsx';
import ComboSalesBillTable from '../../Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx';
import PlanExpireNotification from '../PlanExpireNotification.jsx';
const ListOfSalesInvoices = lazy(
() =>
import('../../Components/BSBillingTables/ListofInvoices/ListOfSalesInvoices.jsx')
);
const BSEwayBillicon = lazy(
() => import('../../Components/UtillComponents/BSEwayBillicon.jsx')
);
const BSComboItemCard = lazy(
() => import('../../Components/BSItemCards/BSComboItemCard.jsx')
);
const BranchTransferComponent = lazy(
() =>
import('../../Components/UtillComponents/BSQuickBranchToBranchTransferComponent.jsx')
);
const BSExpireProductsList = lazy(
() => import('../../Components/UtillComponents/BSExpireProductsList.jsx')
);
const BSOtherServiceItemCard = lazy(
() => import('../../Components/BSItemCards/BSOtherServiceItemCard.jsx')
);
const BSOtherServicesVerticalcat = lazy(
() => import('../../Components/BSCategories/BSOtherServicesVerticalcat.jsx')
);
const BSNavbar3 = lazy(() => import('../../Components/BSNavbar/BSNavbar3.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')
);
import PlanExpireNotification from '../PlanExpireNotification.jsx';
// Scss
import '../../../../Styles/BookingScreen/Template/BSLayout4/BSLayout4.scss';
const subDirectory = import.meta.env.BASE_URL;
const commonDirectory = import.meta.env.COMMON_BASE_URL;
const BSLayout4 = () => { const BSLayout4 = () => {
const dispatch = useDispatch(); const dispatch = useDispatch();
@ -103,10 +160,12 @@ const BSLayout4 = () => {
const SelectedBillColor = useSelector(SelectedGlobalBillingColorDetail); const SelectedBillColor = useSelector(SelectedGlobalBillingColorDetail);
const appPreferences = useSelector(ApplicationPreferences); const appPreferences = useSelector(ApplicationPreferences);
const commonModulePreference = appPreferences?.find( const commonModulePreference = appPreferences?.find(
(preference) => preference?.PreferredCatName === "Common Module" (preference) => preference?.PreferredCatName === 'Common Module'
)?.PreferenceCatDetails; )?.PreferenceCatDetails;
const sportsAppPreference = commonModulePreference?.find( const sportsAppPreference = commonModulePreference?.find(
(preference) => preference?.PreferredSubCatName === "SportsApp" && preference?.PreferredStatus == 'Y' (preference) =>
preference?.PreferredSubCatName === 'SportsApp' &&
preference?.PreferredStatus == 'Y'
); );
// const [AppExpDate, setAppExpDate] = useState(0); // const [AppExpDate, setAppExpDate] = useState(0);
const [Kioskopen, setKioskopen] = useState(false); const [Kioskopen, setKioskopen] = useState(false);
@ -130,12 +189,14 @@ const BSLayout4 = () => {
const UserType = SessionData?.UserType; const UserType = SessionData?.UserType;
const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss'); const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
let containerHeight = isMobile let containerHeight = isMobile
? AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend' ? AppExpDate?.RemainingDays <= 7 ||
AppExpDate?.PlanType?.toLowerCase() === 'extend'
? '575px' ? '575px'
: '590px' : '590px'
: UserType != 'Super Admin' && : (UserType != 'Super Admin' &&
UserType != 'Super Admin User' && UserType != 'Super Admin User' &&
AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend' AppExpDate?.RemainingDays <= 7) ||
AppExpDate?.PlanType?.toLowerCase() === 'extend'
? '96vh' ? '96vh'
: '99vh'; : '99vh';
const [ListOfInvoices, setListOfInvoices] = useState(false); const [ListOfInvoices, setListOfInvoices] = useState(false);
@ -203,7 +264,6 @@ const BSLayout4 = () => {
setKioskopen(false); setKioskopen(false);
}; };
const handlePopOverOpen = () => { const handlePopOverOpen = () => {
setPopOverOpen(!popOverOpen); setPopOverOpen(!popOverOpen);
}; };
@ -257,6 +317,7 @@ const BSLayout4 = () => {
setBookingModalOpen(false); setBookingModalOpen(false);
}; };
return ( return (
<Suspense fallback={<div>Loading...</div>}>
<> <>
<Messages <Messages
messageType={messageType} messageType={messageType}
@ -265,7 +326,9 @@ const BSLayout4 = () => {
/> />
{UserType != 'Super Admin' && {UserType != 'Super Admin' &&
UserType != 'Super Admin User' && UserType != 'Super Admin User' &&
(AppExpDate?.RemainingDays <= 7 || AppExpDate === 'undefined' || AppExpDate?.PlanType?.toLowerCase() === 'extend') && ( (AppExpDate?.RemainingDays <= 7 ||
AppExpDate === 'undefined' ||
AppExpDate?.PlanType?.toLowerCase() === 'extend') && (
<PlanExpireNotification /> <PlanExpireNotification />
)} )}
<div <div
@ -279,21 +342,29 @@ const BSLayout4 = () => {
</div> </div>
{BookingNavbar != 'Navbar3' ? ( {BookingNavbar != 'Navbar3' ? (
<div className="Layout-bill-container" style={{ margin: '0' }}> <div className="Layout-bill-container" style={{ margin: '0' }}>
<div className="Layout-bill-Subcontainer" style={{ width: OtherServicesglobal ? "10%" : "100%" }}> <div
{UserType !== 'Employee' && className="Layout-bill-Subcontainer"
style={{ width: OtherServicesglobal ? '10%' : '100%' }}
>
{UserType !== 'Employee' && (
<div className="pricing-name-details"> <div className="pricing-name-details">
{PricingAppPricingName?.[0]?.PricingName + {PricingAppPricingName?.[0]?.PricingName +
' / ' + ' / ' +
PricingAppPricingName?.[0]?.Type} PricingAppPricingName?.[0]?.Type}
</div> </div>
} )}
{!OtherServicesglobal && <SalesCountComponent {!OtherServicesglobal && (
<SalesCountComponent
DineInAccess={DineInAccess} DineInAccess={DineInAccess}
GlobalsalesDetailData={GlobalsalesDetailData} GlobalsalesDetailData={GlobalsalesDetailData}
/>} />
{!OtherServicesglobal && SessionData?.FeatureAddonData?.FeatureDtls?.find( )}
(item) => item?.FeatureAddonName?.toLowerCase() === 'kiosk sales' {!OtherServicesglobal &&
) && !sportsAppPreference && ( SessionData?.FeatureAddonData?.FeatureDtls?.find(
(item) =>
item?.FeatureAddonName?.toLowerCase() === 'kiosk sales'
) &&
!sportsAppPreference && (
<div <div
style={{ style={{
pointerEvents: OrderStatus > 0 ? 'none' : 'auto', pointerEvents: OrderStatus > 0 ? 'none' : 'auto',
@ -301,7 +372,11 @@ const BSLayout4 = () => {
}} }}
> >
<Tooltip title={'Kiosk Sales'}> <Tooltip title={'Kiosk Sales'}>
<Badge count={badgeCount} offset={[-10, 3]} size="small"> <Badge
count={badgeCount}
offset={[-10, 3]}
size="small"
>
<PozoKioskIcon <PozoKioskIcon
onClick={() => openModalKiosk()} onClick={() => openModalKiosk()}
style={{ cursor: 'pointer', fontSize: '1.5rem' }} style={{ cursor: 'pointer', fontSize: '1.5rem' }}
@ -312,7 +387,10 @@ const BSLayout4 = () => {
</div> </div>
)} )}
{!OtherServicesglobal && ( {!OtherServicesglobal && (
<TooltipWrapper title={'Low Stock Alerts'} isMobile={isMobile}> <TooltipWrapper
title={'Low Stock Alerts'}
isMobile={isMobile}
>
{' '} {' '}
<BSExpireProductsList /> <BSExpireProductsList />
</TooltipWrapper> </TooltipWrapper>
@ -323,7 +401,8 @@ const BSLayout4 = () => {
closeKioskModal={closeModalKiosk} closeKioskModal={closeModalKiosk}
/> />
)} )}
{SAdminuserPin?.length > 0 && UserType != 'Super Admin User' && ( {SAdminuserPin?.length > 0 &&
UserType != 'Super Admin User' && (
<div> <div>
<SAdminUserNotification <SAdminUserNotification
SAdminuserPin={SAdminuserPin} SAdminuserPin={SAdminuserPin}
@ -333,9 +412,13 @@ const BSLayout4 = () => {
/> />
</div> </div>
)} )}
{CheckBookingStatus == 'Open' ? !OtherServicesglobal && ( {CheckBookingStatus == 'Open' ? (
<div style={{ marginLeft: "10px" }}> !OtherServicesglobal && (
<TooltipWrapper title={'Booking Close'} isMobile={isMobile}> <div style={{ marginLeft: '10px' }}>
<TooltipWrapper
title={'Booking Close'}
isMobile={isMobile}
>
{' '} {' '}
<BookingCloseIcon <BookingCloseIcon
onClick={OpenBookingModal} onClick={OpenBookingModal}
@ -351,8 +434,9 @@ const BSLayout4 = () => {
>Booking Close</button> */} >Booking Close</button> */}
</TooltipWrapper> </TooltipWrapper>
</div> </div>
)
) : ( ) : (
<div style={{ marginLeft: "10px" }}> <div style={{ marginLeft: '10px' }}>
<TooltipWrapper title="Booking Open" isMobile={isMobile}> <TooltipWrapper title="Booking Open" isMobile={isMobile}>
<Popconfirm <Popconfirm
placement="leftTop" placement="leftTop"
@ -374,12 +458,11 @@ const BSLayout4 = () => {
/> />
</span> </span>
</Popconfirm> </Popconfirm>
</TooltipWrapper> </TooltipWrapper>
</div> </div>
)} )}
{!OtherServicesglobal && {!OtherServicesglobal && (
<div style={{ marginLeft: "10px" }}> <div style={{ marginLeft: '10px' }}>
<TooltipWrapper title={'E-way Bill'} isMobile={isMobile}> <TooltipWrapper title={'E-way Bill'} isMobile={isMobile}>
{''} {''}
<BSEwayBillicon <BSEwayBillicon
@ -387,16 +470,17 @@ const BSLayout4 = () => {
onClick={OpenListOfInvoices} onClick={OpenListOfInvoices}
/> />
</TooltipWrapper> </TooltipWrapper>
</div>} </div>
)}
</div> </div>
</div> </div>
) : ) : (
<SalesCountForStandard <SalesCountForStandard
PricingAppPricingName={PricingAppPricingName} PricingAppPricingName={PricingAppPricingName}
DineInAccess={DineInAccess} DineInAccess={DineInAccess}
GlobalsalesDetailData={GlobalsalesDetailData} GlobalsalesDetailData={GlobalsalesDetailData}
/> />
} )}
<div <div
className="Bslayout4_overall" className="Bslayout4_overall"
style={{ style={{
@ -407,7 +491,8 @@ const BSLayout4 = () => {
<div <div
className="Bslayout4_ctg" className="Bslayout4_ctg"
style={{ style={{
backgroundColor: SelectedCatgColor?.['OverallBackgroundColor'], backgroundColor:
SelectedCatgColor?.['OverallBackgroundColor'],
}} }}
> >
{!OtherServicesglobal && ( {!OtherServicesglobal && (
@ -432,7 +517,8 @@ const BSLayout4 = () => {
<div <div
className="Bslayout4_card" className="Bslayout4_card"
style={{ style={{
backgroundColor: SelectedCardColor?.['OverallBackgroundColor'], backgroundColor:
SelectedCardColor?.['OverallBackgroundColor'],
width: '100vw', width: '100vw',
display: 'flex', display: 'flex',
}} }}
@ -525,6 +611,7 @@ const BSLayout4 = () => {
/> />
)} )}
</> </>
</Suspense>
); );
}; };

View File

@ -1,17 +1,42 @@
import { React, useCallback, useEffect, useState } from 'react'; import {lazy,useCallback, useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import moment from 'moment'; import moment from 'moment';
import { Tooltip, Badge, Popconfirm } from 'antd'; import { Tooltip, Badge, Popconfirm } from 'antd';
import BSNavbar1 from '../../Components/BSNavbar/BSNavbar1';
import BSNavbar2 from '../../Components/BSNavbar/BSNavbar2'; const BSNavbar1 = lazy(() => import('../../Components/BSNavbar/BSNavbar1'));
import BSBillingTable1 from '../../Components/BSBillingTables/BSBillingTable1/BSBTOverall1';
import BSBillingTable2 from '../../Components/BSBillingTables/BSBillingTable2/BSBillingTable2'; const BSNavbar2 = lazy(() => import('../../Components/BSNavbar/BSNavbar2'));
import BSBillingTable3 from '../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3overall';
const BSBillingTable1 = lazy(
() => import('../../Components/BSBillingTables/BSBillingTable1/BSBTOverall1')
);
const BSBillingTable2 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable2/BSBillingTable2')
);
const BSBillingTable3 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3overall')
);
import BSBillingTable4 from '../../Components/BSBillingTables/BSBillingTable4/BSBillingTable4Full'; import BSBillingTable4 from '../../Components/BSBillingTables/BSBillingTable4/BSBillingTable4Full';
import BSBillingTable5 from '../../Components/BSBillingTables/BSBillingTable5/BSBillingTable5';
import BSBillingTable6 from '../../Components/BSBillingTables/BSBillingTable6/BSBTOverall6'; const BSBillingTable5 = lazy(
import BSBillingTable7 from '../../Components/BSBillingTables/BSBillingTable7/BSBillingTable7Overall.jsx'; () =>
import('../../Components/BSBillingTables/BSBillingTable5/BSBillingTable5')
);
const BSBillingTable6 = lazy(
() => import('../../Components/BSBillingTables/BSBillingTable6/BSBTOverall6')
);
const BSBillingTable7 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable7/BSBillingTable7Overall.jsx')
);
import BSItemCard from '../../Components/BSItemCards/BSItemCard'; import BSItemCard from '../../Components/BSItemCards/BSItemCard';
import CategoryVertical from '../../Components/BSCategories/BSCategoryVertical'; import CategoryVertical from '../../Components/BSCategories/BSCategoryVertical';
import { dynamicComponentProps } from '../DynamicComponentProps.js'; import { dynamicComponentProps } from '../DynamicComponentProps.js';
@ -45,7 +70,6 @@ import {
globalKioskSalesCount, globalKioskSalesCount,
} from '../../../../Features/Kiosk/kiosk.js'; } from '../../../../Features/Kiosk/kiosk.js';
import SalesCountComponent from '../SalesCountComponent.jsx'; import SalesCountComponent from '../SalesCountComponent.jsx';
import '../../../../Styles/BookingScreen/Template/BSLayout5/BSLayout5.scss';
import PozoKioskIcon from '../../Components/UtillComponents/Pozo retail icons/PozoKioskIcon.jsx'; import PozoKioskIcon from '../../Components/UtillComponents/Pozo retail icons/PozoKioskIcon.jsx';
import { import {
GLobalSadminUserPin, GLobalSadminUserPin,
@ -66,9 +90,11 @@ import RetailBookingClosing from '../RetailBookingClose.jsx';
import ListOfSalesInvoices from '../../Components/BSBillingTables/ListofInvoices/ListOfSalesInvoices.jsx'; import ListOfSalesInvoices from '../../Components/BSBillingTables/ListofInvoices/ListOfSalesInvoices.jsx';
import BSEwayBillicon from '../../Components/UtillComponents/BSEwayBillicon.jsx'; import BSEwayBillicon from '../../Components/UtillComponents/BSEwayBillicon.jsx';
import BSComboItemCard from '../../Components/BSItemCards/BSComboItemCard.jsx'; import BSComboItemCard from '../../Components/BSItemCards/BSComboItemCard.jsx';
import BranchTransferComponent from '../../Components/UtillComponents/BSQuickBranchToBranchTransferComponent.jsx'; const BranchTransferComponent = lazy(
() =>
import('../../Components/UtillComponents/BSQuickBranchToBranchTransferComponent.jsx')
);
import BSExpireProductsList from '../../Components/UtillComponents/BSExpireProductsList.jsx'; import BSExpireProductsList from '../../Components/UtillComponents/BSExpireProductsList.jsx';
import BSOtherServiceItemCard from '../../Components/BSItemCards/BSOtherServiceItemCard.jsx'; import BSOtherServiceItemCard from '../../Components/BSItemCards/BSOtherServiceItemCard.jsx';
import BSOtherServicesHorizontalcat from '../../Components/BSCategories/BSOtherServicesHorizontalcat'; import BSOtherServicesHorizontalcat from '../../Components/BSCategories/BSOtherServicesHorizontalcat';
import BSOtherServicesVerticalcat from '../../Components/BSCategories/BSOtherServicesVerticalcat.jsx'; import BSOtherServicesVerticalcat from '../../Components/BSCategories/BSOtherServicesVerticalcat.jsx';
@ -79,6 +105,8 @@ import { CiShop } from 'react-icons/ci';
import BranchName from '../BranchName.jsx'; import BranchName from '../BranchName.jsx';
import ComboSalesBillTable from '../../Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx'; import ComboSalesBillTable from '../../Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx';
import PlanExpireNotification from '../PlanExpireNotification.jsx'; import PlanExpireNotification from '../PlanExpireNotification.jsx';
const subDirectory = import.meta.env.BASE_URL;
const commonDirectory = import.meta.env.COMMON_BASE_URL;
const BSLayout5 = () => { const BSLayout5 = () => {
const dispatch = useDispatch(); const dispatch = useDispatch();
@ -115,13 +143,15 @@ const BSLayout5 = () => {
const DineInAccess = SettingDataSelector?.[0]?.SettingDtlDetails.filter( const DineInAccess = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
(i) => i.SettingIdName === 'DineIn' (i) => i.SettingIdName === 'DineIn'
)?.[0]; )?.[0];
const AppName = SessionData?.AppName;
const AppId = SessionData?.AppId; const AppId = SessionData?.AppId;
const CompId = SessionData?.CompId; const CompId = SessionData?.CompId;
const BranchId = SessionData?.BranchId; const BranchId = SessionData?.BranchId;
const UserId = SessionData?.UserId; const UserId = SessionData?.UserId;
const UserType = SessionData?.UserType; const UserType = SessionData?.UserType;
const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss'); const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
const animations = ['example1', 'example2', 'example3'];
let ss = animations[count];
let containerHeight = isMobile let containerHeight = isMobile
? AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend' ? AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend'
? '580px' ? '580px'

View File

@ -1,19 +1,48 @@
import React, { useEffect, useState, useCallback } from 'react'; import React, { useEffect, useState, useCallback, lazy, Suspense } from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import moment from 'moment'; import moment from 'moment';
import { Tooltip, Badge, Popconfirm } from 'antd'; import { Tooltip, Badge, Popconfirm } from 'antd';
import BSNavbar1 from '../../Components/BSNavbar/BSNavbar1'; const BSNavbar1 = lazy(() => import('../../Components/BSNavbar/BSNavbar1'));
import BSNavbar2 from '../../Components/BSNavbar/BSNavbar2';
import BSBillingTable1 from '../../Components/BSBillingTables/BSBillingTable1/BSBTOverall1'; const BSNavbar2 = lazy(() => import('../../Components/BSNavbar/BSNavbar2'));
import BSBillingTable2 from '../../Components/BSBillingTables/BSBillingTable2/BSBillingTable2';
import BSBillingTable3 from '../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3overall'; const BSBillingTable1 = lazy(
import BSBillingTable4 from '../../Components/BSBillingTables/BSBillingTable4/BSBillingTable4Full'; () => import('../../Components/BSBillingTables/BSBillingTable1/BSBTOverall1')
import BSBillingTable5 from '../../Components/BSBillingTables/BSBillingTable5/BSBillingTable5'; );
import BSBillingTable6 from '../../Components/BSBillingTables/BSBillingTable6/BSBTOverall6';
import BSBillingTable7 from '../../Components/BSBillingTables/BSBillingTable7/BSBillingTable7Overall.jsx'; const BSBillingTable2 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable2/BSBillingTable2')
);
const BSBillingTable3 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3overall')
);
const BSBillingTable4 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable4/BSBillingTable4Full')
);
const BSBillingTable5 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable5/BSBillingTable5')
);
const BSBillingTable6 = lazy(
() => import('../../Components/BSBillingTables/BSBillingTable6/BSBTOverall6')
);
const BSBillingTable7 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable7/BSBillingTable7Overall.jsx')
);
import BSItemCard from '../../Components/BSItemCards/BSItemCard'; import BSItemCard from '../../Components/BSItemCards/BSItemCard';
import CategoryHorizontal from '../../Components/BSCategories/BSCategoryHorizontal'; const CategoryHorizontal = lazy(
() => import('../../Components/BSCategories/BSCategoryHorizontal')
);
import { dynamicComponentProps } from '../DynamicComponentProps.js'; import { dynamicComponentProps } from '../DynamicComponentProps.js';
import { import {
GlobalPricingAppPricingName, GlobalPricingAppPricingName,
@ -55,7 +84,6 @@ import {
import { Messages } from '../../../../Components/Notifications/Messages.jsx'; import { Messages } from '../../../../Components/Notifications/Messages.jsx';
import SAdminUserNotification from '../../Components/BookingFunctionality/SAdminUserNotification.jsx'; import SAdminUserNotification from '../../Components/BookingFunctionality/SAdminUserNotification.jsx';
import SalesCountComponent from '../SalesCountComponent.jsx'; import SalesCountComponent from '../SalesCountComponent.jsx';
import '../../../../Styles/BookingScreen/Template/BSLayout6/BSLayout6.scss';
import { import {
getBookingStatus, getBookingStatus,
GlobalBookingStatus, GlobalBookingStatus,
@ -64,18 +92,29 @@ import { PutBookingClose } from '../../../../Features/BookingScreen/RetailBookin
import TooltipWrapper from '../../../../Components/Tooltip/Tooltip.jsx'; import TooltipWrapper from '../../../../Components/Tooltip/Tooltip.jsx';
import BookingCloseIcon from '../../Components/UtillComponents/BookingCloseIcon.jsx'; import BookingCloseIcon from '../../Components/UtillComponents/BookingCloseIcon.jsx';
import RetailBookingClosing from '../RetailBookingClose.jsx'; import RetailBookingClosing from '../RetailBookingClose.jsx';
import ListOfSalesInvoices from '../../Components/BSBillingTables/ListofInvoices/ListOfSalesInvoices.jsx'; const ListOfSalesInvoices = lazy(
import BSEwayBillicon from '../../Components/UtillComponents/BSEwayBillicon.jsx'; () =>
import BSComboItemCard from '../../Components/BSItemCards/BSComboItemCard.jsx'; import('../../Components/BSBillingTables/ListofInvoices/ListOfSalesInvoices.jsx')
import BranchTransferComponent from '../../Components/UtillComponents/BSQuickBranchToBranchTransferComponent.jsx'; );
import BSExpireProductsList from '../../Components/UtillComponents/BSExpireProductsList.jsx'; const BSEwayBillicon = lazy(
() => import('../../Components/UtillComponents/BSEwayBillicon.jsx')
);
const BSComboItemCard = lazy(
() => import('../../Components/BSItemCards/BSComboItemCard.jsx')
);
const BranchTransferComponent = lazy(
() =>
import('../../Components/UtillComponents/BSQuickBranchToBranchTransferComponent.jsx')
);
const BSExpireProductsList = lazy(
() => import('../../Components/UtillComponents/BSExpireProductsList.jsx')
);
import BSOtherServiceItemCard from '../../Components/BSItemCards/BSOtherServiceItemCard.jsx'; import BSOtherServiceItemCard from '../../Components/BSItemCards/BSOtherServiceItemCard.jsx';
import BSOtherServicesHorizontalcat from '../../Components/BSCategories/BSOtherServicesHorizontalcat'; import BSOtherServicesHorizontalcat from '../../Components/BSCategories/BSOtherServicesHorizontalcat';
import BSNavbar3 from '../../Components/BSNavbar/BSNavbar3.jsx'; import BSNavbar3 from '../../Components/BSNavbar/BSNavbar3.jsx';
import SalesCountForStandard from '../SalesCountForStandard.jsx'; import SalesCountForStandard from '../SalesCountForStandard.jsx';
import StandardTable from '../../Components/BSBillingTables/StandardTable/StandardTable.jsx'; import StandardTable from '../../Components/BSBillingTables/StandardTable/StandardTable.jsx';
import { CiShop } from 'react-icons/ci';
import BranchName from '../BranchName.jsx';
import ComboSalesBillTable from '../../Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx'; import ComboSalesBillTable from '../../Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx';
import PlanExpireNotification from '../PlanExpireNotification.jsx'; import PlanExpireNotification from '../PlanExpireNotification.jsx';
const BSLayout6 = () => { const BSLayout6 = () => {
@ -112,10 +151,12 @@ const BSLayout6 = () => {
const AppExpDate = useSelector(GlobalAppExpDateData); const AppExpDate = useSelector(GlobalAppExpDateData);
const [screenHeight, setScreenHeight] = useState(window?.innerHeight); const [screenHeight, setScreenHeight] = useState(window?.innerHeight);
// const [AppExpDate, setAppExpDate] = useState(0); // const [AppExpDate, setAppExpDate] = useState(0);
const [count, setcount] = useState(0);
const BookingNavbar = BSLayout6Data?.BookingNavbar?.[0]; const BookingNavbar = BSLayout6Data?.BookingNavbar?.[0];
const BookingCategory = BSLayout6Data?.BookingCategory; const BookingCategory = BSLayout6Data?.BookingCategory;
const BookingCard = BSLayout6Data?.BookingCard; const BookingCard = BSLayout6Data?.BookingCard;
const BookingBilling = BSLayout6Data?.BookingBilling?.[0]; const BookingBilling = BSLayout6Data?.BookingBilling?.[0];
const AppName = SessionData?.AppName;
const AppId = SessionData?.AppId; const AppId = SessionData?.AppId;
const CompId = SessionData?.CompId; const CompId = SessionData?.CompId;
const BranchId = SessionData?.BranchId; const BranchId = SessionData?.BranchId;
@ -128,12 +169,9 @@ const BSLayout6 = () => {
)?.[0]; )?.[0];
const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss'); const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
const tableData = useSelector(GlobalOrderCardDetails);
const PricingAppPricingName = useSelector(GlobalPricingAppPricingName); const PricingAppPricingName = useSelector(GlobalPricingAppPricingName);
const SAdminuserPin = useSelector(GLobalSadminUserPin); const SAdminuserPin = useSelector(GLobalSadminUserPin);
const SelectedBillColor = useSelector(SelectedGlobalBillingColorDetail);
const [messageType, setMessageType] = useState(null); const [messageType, setMessageType] = useState(null);
const [messageData, setMessageData] = useState(null); const [messageData, setMessageData] = useState(null);
const [popOverOpen, setPopOverOpen] = useState(false); const [popOverOpen, setPopOverOpen] = useState(false);
@ -149,7 +187,6 @@ const BSLayout6 = () => {
} }
}, [SessionData]); }, [SessionData]);
useEffect(() => { useEffect(() => {
if (AppId && CompId && BranchId && UserId) { if (AppId && CompId && BranchId && UserId) {
fetchBookingStatus(); fetchBookingStatus();
@ -185,16 +222,17 @@ const BSLayout6 = () => {
}; };
let containerHeight = isMobile let containerHeight = isMobile
? AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend' ? AppExpDate?.RemainingDays <= 7 ||
AppExpDate?.PlanType?.toLowerCase() === 'extend'
? '577px' ? '577px'
: '595px' : '595px'
: UserType != 'Super Admin' && : (UserType != 'Super Admin' &&
UserType != 'Super Admin User' && UserType != 'Super Admin User' &&
AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend' AppExpDate?.RemainingDays <= 7) ||
AppExpDate?.PlanType?.toLowerCase() === 'extend'
? '96vh' ? '96vh'
: '99vh'; : '99vh';
useEffect(() => { useEffect(() => {
function handleResize() { function handleResize() {
setScreenHeight(window.innerHeight); setScreenHeight(window.innerHeight);
@ -207,7 +245,6 @@ const BSLayout6 = () => {
}; };
}, []); }, []);
const openModalKiosk = () => { const openModalKiosk = () => {
setKioskopen(true); setKioskopen(true);
}; };
@ -277,6 +314,7 @@ const BSLayout6 = () => {
setBookingModalOpen(false); setBookingModalOpen(false);
}; };
return ( return (
<Suspense fallback={<div>Loading components...</div>}>
<> <>
<Messages <Messages
messageType={messageType} messageType={messageType}
@ -285,7 +323,9 @@ const BSLayout6 = () => {
/> />
{UserType != 'Super Admin' && {UserType != 'Super Admin' &&
UserType != 'Super Admin User' && UserType != 'Super Admin User' &&
(AppExpDate?.RemainingDays <= 30 || AppExpDate === 'undefined' || AppExpDate?.PlanType?.toLowerCase() === 'extend') && ( (AppExpDate?.RemainingDays <= 30 ||
AppExpDate === 'undefined' ||
AppExpDate?.PlanType?.toLowerCase() === 'extend') && (
<PlanExpireNotification /> <PlanExpireNotification />
)} )}
@ -547,7 +587,8 @@ const BSLayout6 = () => {
<BSBillingTable7 /> <BSBillingTable7 />
)} )}
{BookingBilling == 'Billing8' && <ComboSalesBillTable />} {BookingBilling == 'Billing8' && <ComboSalesBillTable />}
{BSLayout6Data?.BookingBilling?.[0] == 'StandardBilling' && ( {BSLayout6Data?.BookingBilling?.[0] ==
'StandardBilling' && (
<div <div
className="BSCategory2New" className="BSCategory2New"
style={{ style={{
@ -583,6 +624,7 @@ const BSLayout6 = () => {
)} )}
</div> </div>
</> </>
</Suspense>
); );
}; };
export default BSLayout6; export default BSLayout6;

View File

@ -1,17 +1,38 @@
import React, { useEffect, useState, useCallback } from 'react'; import React, { useEffect, useState, useCallback, lazy, Suspense } from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import moment from 'moment'; import moment from 'moment';
import { Tooltip, Badge, Popconfirm } from 'antd'; import { Tooltip, Badge, Popconfirm } from 'antd';
import BSBillingTable1 from '../../Components/BSBillingTables/BSBillingTable1/BSBillingTable1'; const BSBillingTable1 = lazy(
import BSBillingTable2 from '../../Components/BSBillingTables/BSBillingTable2/BsBill2'; () =>
import BSBillingTable3 from '../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3'; import('../../Components/BSBillingTables/BSBillingTable1/BSBillingTable1')
import BSBillingTable4 from '../../Components/BSBillingTables/BSBillingTable4/BSBillingTable4'; );
import BSBillingTable5 from '../../Components/BSBillingTables/BSBillingTable5/BsBill'; const BSBillingTable2 = lazy(
import BSBillingTable6 from '../../Components/BSBillingTables/BSBillingTable6/BSBillingTable6'; () => import('../../Components/BSBillingTables/BSBillingTable2/BsBill2')
import BSBillingTable7 from '../../Components/BSBillingTables/BSBillingTable7/BSBillingTable7'; );
import BSC1Payment from '../../Components/BSCombo/BSC1Payment'; const BSBillingTable3 = lazy(
import BSC1NavBar from '../../Components/BSCombo/BSC1NavBar'; () =>
import BSC1Search from '../../Components/BSCombo/BSC1Search'; import('../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3')
);
const BSBillingTable4 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable4/BSBillingTable4')
);
const BSBillingTable5 = lazy(
() => import('../../Components/BSBillingTables/BSBillingTable5/BsBill')
);
const BSBillingTable6 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable6/BSBillingTable6')
);
const BSBillingTable7 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable7/BSBillingTable7')
);
// Combo components (lazy)
const BSC1Payment = lazy(() => import('../../Components/BSCombo/BSC1Payment'));
const BSC1NavBar = lazy(() => import('../../Components/BSCombo/BSC1NavBar'));
const BSC1Search = lazy(() => import('../../Components/BSCombo/BSC1Search'));
import { import {
GlobalCombosearch, GlobalCombosearch,
GlobalPayementloader, GlobalPayementloader,
@ -29,8 +50,13 @@ import {
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import { ArrowUpOutlined } from '@ant-design/icons'; import { ArrowUpOutlined } from '@ant-design/icons';
import { getSession } from '../../../../Services/Others.js'; import { getSession } from '../../../../Services/Others.js';
import BSNavBarComboSearch from '../../Components/UtillComponents/BSNavBarComboSearch.jsx'; const BSNavBarComboSearch = lazy(
import BSKioskCounterPayment from '../../Components/UtillComponents/BSKioskCounterPayment.jsx'; () => import('../../Components/UtillComponents/BSNavBarComboSearch.jsx')
);
const BSKioskCounterPayment = lazy(
() => import('../../Components/UtillComponents/BSKioskCounterPayment.jsx')
);
import { import {
getKioskDatas, getKioskDatas,
globalKioskSalesCount, globalKioskSalesCount,
@ -58,21 +84,43 @@ import {
import { PutBookingClose } from '../../../../Features/BookingScreen/RetailBookingClose.js'; import { PutBookingClose } from '../../../../Features/BookingScreen/RetailBookingClose.js';
import TooltipWrapper from '../../../../Components/Tooltip/Tooltip.jsx'; import TooltipWrapper from '../../../../Components/Tooltip/Tooltip.jsx';
import BookingCloseIcon from '../../Components/UtillComponents/BookingCloseIcon.jsx'; import BookingCloseIcon from '../../Components/UtillComponents/BookingCloseIcon.jsx';
import RetailBookingClosing from '../RetailBookingClose.jsx'; const RetailBookingClosing = lazy(() => import('../RetailBookingClose.jsx'));
import ListOfSalesInvoices from '../../Components/BSBillingTables/ListofInvoices/ListOfSalesInvoices.jsx';
import BSEwayBillicon from '../../Components/UtillComponents/BSEwayBillicon.jsx'; const ListOfSalesInvoices = lazy(
import BranchTransferComponent from '../../Components/UtillComponents/BSQuickBranchToBranchTransferComponent.jsx'; () =>
import BSExpireProductsList from '../../Components/UtillComponents/BSExpireProductsList.jsx'; import('../../Components/BSBillingTables/ListofInvoices/ListOfSalesInvoices.jsx')
import ComboSalesBillTable from '../../Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx'; );
const BranchTransferComponent = lazy(
() =>
import('../../Components/UtillComponents/BSQuickBranchToBranchTransferComponent.jsx')
);
const BSExpireProductsList = lazy(
() => import('../../Components/UtillComponents/BSExpireProductsList.jsx')
);
const ComboSalesBillTable = lazy(
() =>
import('../../Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx')
);
import { GiBasket } from 'react-icons/gi'; import { GiBasket } from 'react-icons/gi';
import { FaRegKeyboard } from 'react-icons/fa'; import { FaRegKeyboard } from 'react-icons/fa';
import { CgSearchLoading } from 'react-icons/cg'; import { CgSearchLoading } from 'react-icons/cg';
import { DefaultModal } from '../../../../Components/Modal/DefaultModal.jsx'; import { DefaultModal } from '../../../../Components/Modal/DefaultModal.jsx';
import MultipleSearch from '../../Components/UtillComponents/MultipleSearch.jsx'; const MultipleSearch = lazy(
import VerfiedProducts from '../../Components/BSNavbar/verfiedProduct/VerfiedProducts.jsx'; () => import('../../Components/UtillComponents/MultipleSearch.jsx')
);
const VerfiedProducts = lazy(
() => import('../../Components/BSNavbar/verfiedProduct/VerfiedProducts.jsx')
);
import ShortcutKeyHelper from '../../Components/UtillComponents/ShortcutKeyHelper.jsx'; import ShortcutKeyHelper from '../../Components/UtillComponents/ShortcutKeyHelper.jsx';
import PlanExpireNotification from '../PlanExpireNotification.jsx'; import PlanExpireNotification from '../PlanExpireNotification.jsx';
const subDirectory = import.meta.env.BASE_URL;
const commonDirectory = import.meta.env.COMMON_BASE_URL;
export default function BSCombo1() { export default function BSCombo1() {
const dispatch = useDispatch(); const dispatch = useDispatch();
const { action, selectedProducts } = useSelector( const { action, selectedProducts } = useSelector(
@ -123,6 +171,7 @@ export default function BSCombo1() {
item.SettingIdName === 'VerifyProduct' && item?.SettingValue === 'Y' item.SettingIdName === 'VerifyProduct' && item?.SettingValue === 'Y'
); );
const AppName = SessionData?.AppName;
const AppId = SessionData?.AppId; const AppId = SessionData?.AppId;
const CompId = SessionData?.CompId; const CompId = SessionData?.CompId;
const BranchId = SessionData?.BranchId; const BranchId = SessionData?.BranchId;
@ -134,30 +183,11 @@ export default function BSCombo1() {
?.ScreenStatus ?? 'Open'; ?.ScreenStatus ?? 'Open';
const [BookingModalOpen, setBookingModalOpen] = useState(false); const [BookingModalOpen, setBookingModalOpen] = useState(false);
const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss'); const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
const animations = ['example1', 'example2', 'example3'];
let ss = animations[count];
const [ListOfInvoices, setListOfInvoices] = useState(false); const [ListOfInvoices, setListOfInvoices] = useState(false);
const [ComboDropDown, setComboDropDown] = useState(); const [ComboDropDown, setComboDropDown] = useState();
const [isAltPressed, setIsAltPressed] = useState(false);
useEffect(() => {
const handleKeyDown = (e) => {
if (e.key === 'F2') setIsAltPressed(true);
};
const handleKeyUp = (e) => {
if (e.key === 'F2') setIsAltPressed(false);
};
window.addEventListener('keydown', handleKeyDown);
window.addEventListener('keyup', handleKeyUp);
return () => {
window.removeEventListener('keydown', handleKeyDown);
window.removeEventListener('keyup', handleKeyUp);
};
}, []);
useEffect(() => { useEffect(() => {
fetchAmount(); fetchAmount();
if ( if (
@ -169,6 +199,15 @@ export default function BSCombo1() {
} }
}, [SessionData]); }, [SessionData]);
useEffect(() => {
if (AppExpDate?.RemainingDays <= 7) {
const interval = setInterval(() => {
setcount((prevCount) => (prevCount >= 2 ? 0 : prevCount + 1));
}, 22000);
return () => clearInterval(interval);
}
}, [count == 2]);
useEffect(() => { useEffect(() => {
Combodata(); Combodata();
if (AppId && CompId && BranchId && UserId) { if (AppId && CompId && BranchId && UserId) {
@ -294,6 +333,7 @@ export default function BSCombo1() {
} }
}; };
return ( return (
<Suspense fallback={<div>Loading...</div>}>
<> <>
<Messages <Messages
messageType={messageType} messageType={messageType}
@ -374,7 +414,11 @@ export default function BSCombo1() {
> >
<Tooltip title={'Kiosk Sales'}> <Tooltip title={'Kiosk Sales'}>
{''} {''}
<Badge count={badgeCount} offset={[-10, 3]} size="small"> <Badge
count={badgeCount}
offset={[-10, 3]}
size="small"
>
<PozoKioskIcon <PozoKioskIcon
onClick={() => openModalKiosk()} onClick={() => openModalKiosk()}
style={{ cursor: 'pointer', fontSize: '1.5rem' }} style={{ cursor: 'pointer', fontSize: '1.5rem' }}
@ -391,7 +435,8 @@ export default function BSCombo1() {
closeKioskModal={closeModalKiosk} closeKioskModal={closeModalKiosk}
/> />
)} )}
{SAdminuserPin?.length > 0 && UserType != 'Super Admin User' && ( {SAdminuserPin?.length > 0 &&
UserType != 'Super Admin User' && (
<div> <div>
<SAdminUserNotification <SAdminUserNotification
SAdminuserPin={SAdminuserPin} SAdminuserPin={SAdminuserPin}
@ -423,7 +468,10 @@ export default function BSCombo1() {
style={{ marginLeft: '2px' }} style={{ marginLeft: '2px' }}
className="BookingCloseCombo" className="BookingCloseCombo"
> >
<TooltipWrapper title={'Booking Close'} isMobile={isMobile}> <TooltipWrapper
title={'Booking Close'}
isMobile={isMobile}
>
{' '} {' '}
<BookingCloseIcon <BookingCloseIcon
onClick={OpenBookingModal} onClick={OpenBookingModal}
@ -486,7 +534,10 @@ export default function BSCombo1() {
fontSize: '1.5rem', fontSize: '1.5rem',
}} }}
> >
<TooltipWrapper title="Combo Product" isMobile={isMobile}> <TooltipWrapper
title="Combo Product"
isMobile={isMobile}
>
<GiBasket <GiBasket
fill={Comboglobal === true ? '#52C41A' : '#1292EE'} fill={Comboglobal === true ? '#52C41A' : '#1292EE'}
enableBackground={ enableBackground={
@ -603,5 +654,6 @@ export default function BSCombo1() {
} }
/> />
</> </>
</Suspense>
); );
} }

View File

@ -19,7 +19,7 @@ import "../../../Styles/BookingScreen/Template/BSLayout3/BSLayout3.scss";
const subDirectory = import.meta.env.ENV_BASE_URL; const subDirectory = import.meta.env.ENV_BASE_URL;
const commonDirectory = import.meta.env.ENV_COMMON_BASE_URL; const commonDirectory = import.meta.env.ENV_COMMON_BASE_URL;
console.log('commonDirectory', commonDirectory);
const PlanExpireNotification = () => { const PlanExpireNotification = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const dispatch = useDispatch(); const dispatch = useDispatch();

View File

@ -4,6 +4,8 @@ import React, {
useEffect, useEffect,
useRef, useRef,
useCallback, useCallback,
lazy,
Suspense,
} from 'react'; } from 'react';
import { Tooltip } from 'antd'; import { Tooltip } from 'antd';
import { import {
@ -12,38 +14,48 @@ import {
getSession, getSession,
} from '../../../Services/Others'; } from '../../../Services/Others';
import { useDispatch } from 'react-redux'; import { useDispatch } from 'react-redux';
import { MdOutlineCallReceived } from 'react-icons/md';
import { GoPackageDependencies } from 'react-icons/go';
import { Messages } from '../../../Components/Notifications/Messages';
import { useSelector } from 'react-redux';
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
import { import {
getCardDataWithoutSub, getCardDataWithoutSub,
getCardDataWithoutSubmodule, getCardDataWithoutSubmodule,
getLayoutproductCard, getLayoutproductCard,
getPreferenceData,
getSelectedFavItems, getSelectedFavItems,
GlobalProductCategorie, GlobalProductCategorie,
GlobalProductSubCategorie, GlobalProductSubCategorie,
GlobalSalesDetailData, GlobalSalesDetailData,
PreferenceData, PreferenceData,
} from '../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../Features/BookingScreen/BookingData/BookingData';
import './SalesCountComponent.scss';
import { Messages } from '../../../Components/Notifications/Messages';
import { useSelector } from 'react-redux';
import { ApplicationPreferences } from '../../../Features/BrachLogin/BranchLogin'; import { ApplicationPreferences } from '../../../Features/BrachLogin/BranchLogin';
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
import { Tables } from '../../../Components/Tables/Table';
import CustomisedInvoiceChange from '../Components/UtillComponents/CustomisedInvoiceChange.jsx';
import ProductPriceChange from '../Components/UtillComponents/ProductPriceChange.jsx';
import ReceivedStocksModal from '../../../Components/Modal/ReceivedStocksModal.jsx';
import ProductDetailsModal from '../../../Components/Modal/ProductDetailsModal.jsx';
import { MdOutlineCallReceived } from 'react-icons/md';
import { IoEye } from 'react-icons/io5';
import { TiTickOutline } from 'react-icons/ti';
import { import {
getReceivedStocks, getReceivedStocks,
PostReceiveStocks, PostReceiveStocks,
} from '../../../Features/stockReceivedGodown/ReceivedStock.js'; } from '../../../Features/stockReceivedGodown/ReceivedStock.js';
import { GoPackageDependencies } from 'react-icons/go';
import { getTemplateData } from '../../../Features/ThemeChange/ThemeChange.js'; import { getTemplateData } from '../../../Features/ThemeChange/ThemeChange.js';
import ShortcutKeyHelper from '../Components/UtillComponents/ShortcutKeyHelper.jsx'; // Jsx Files
import AllSalesPageSettings from '../Components/UtillComponents/AllSalesPageSettings.jsx'; const CustomisedInvoiceChange = lazy(
() => import('../Components/UtillComponents/CustomisedInvoiceChange.jsx')
);
const AllSalesPageSettings = lazy(
() => import('../Components/UtillComponents/AllSalesPageSettings.jsx')
);
const ProductPriceChange = lazy(
() => import('../Components/UtillComponents/ProductPriceChange.jsx')
);
const ReceivedStocksModal = lazy(
() => import('../../../Components/Modal/ReceivedStocksModal.jsx')
);
const ProductDetailsModal = lazy(
() => import('../../../Components/Modal/ProductDetailsModal.jsx')
);
const ShortcutKeyHelper = lazy(
() => import('../Components/UtillComponents/ShortcutKeyHelper.jsx')
);
// Scss
import './SalesCountComponent.scss';
const SalesCountComponent = React.memo( const SalesCountComponent = React.memo(
({ DineInAccess, GlobalsalesDetailData }) => { ({ DineInAccess, GlobalsalesDetailData }) => {
@ -121,26 +133,6 @@ const SalesCountComponent = React.memo(
const startIndex = (currentPage - 1) * rowsPerPage; const startIndex = (currentPage - 1) * rowsPerPage;
const currentData = bookings?.slice(startIndex, startIndex + rowsPerPage); const currentData = bookings?.slice(startIndex, startIndex + rowsPerPage);
const [isAltPressed, setIsAltPressed] = useState(false);
useEffect(() => {
const handleKeyDown = (e) => {
if (e.key === 'F2') setIsAltPressed(true);
};
const handleKeyUp = (e) => {
if (e.key === 'F2') setIsAltPressed(false);
};
window.addEventListener('keydown', handleKeyDown);
window.addEventListener('keyup', handleKeyUp);
return () => {
window.removeEventListener('keydown', handleKeyDown);
window.removeEventListener('keyup', handleKeyUp);
};
}, []);
console.log(dailySalesData, 'dailySalesDatadailySalesData', bookings); console.log(dailySalesData, 'dailySalesDatadailySalesData', bookings);
function safeRound(amountStr) { function safeRound(amountStr) {
@ -206,8 +198,8 @@ const SalesCountComponent = React.memo(
isMobile, isMobile,
]); ]);
useEffect(() => { useEffect(() => {
if (preferencedata?.length > 0) {
getPreference(); getPreference();
getReceivedStock();
let AutoReceiveStock = preferencedata?.[0]?.SettingDtlDetails?.some( let AutoReceiveStock = preferencedata?.[0]?.SettingDtlDetails?.some(
(s) => (s) =>
@ -215,11 +207,13 @@ const SalesCountComponent = React.memo(
s?.SettingValue === 'Y' s?.SettingValue === 'Y'
); );
setAutoReceiveStock(!AutoReceiveStock); setAutoReceiveStock(!AutoReceiveStock);
if (AutoReceiveStock) {
getReceivedStock();
}
}
}, [preferencedata]); }, [preferencedata]);
const getPreference = async () => { const getPreference = async () => {
// const data = { AppId: AppId, CompId: CompId, BranchId: BranchId };
// const { data: res } = await dispatch(getPreferenceData(data)).unwrap();
const decimalSetting = preferencedata?.[0]?.SettingDtlDetails?.find( const decimalSetting = preferencedata?.[0]?.SettingDtlDetails?.find(
(setting) => (setting) =>
setting?.SettingIdName?.toLowerCase() === 'decimal' && setting?.SettingIdName?.toLowerCase() === 'decimal' &&
@ -341,26 +335,6 @@ const SalesCountComponent = React.memo(
align: 'center', align: 'center',
width: '120px', width: '120px',
}, },
// {
// title: 'Product Details',
// dataIndex: 'ProductDetails',
// key: 'ProductDetails',
// width: '120px',
// align: 'center',
// render: (text, record, index) => (
// <span
// style={{ cursor: 'pointer', color: '#1890ff', textAlign: "center" }}
// onClick={() => {
// handleModalOpen(index)
// }}
// >
// <IoEye style={{ fontSize: 18, verticalAlign: 'middle' }} />
// </span>
// ),
// },
{ {
title: 'Actions', title: 'Actions',
dataIndex: 'fromBranch', dataIndex: 'fromBranch',
@ -500,6 +474,7 @@ const SalesCountComponent = React.memo(
setModalProductDetails([]); setModalProductDetails([]);
}; };
return ( return (
<Suspense fallback={<div>Loading</div>}>
<> <>
<Messages <Messages
messageType={messageType} messageType={messageType}
@ -527,7 +502,9 @@ const SalesCountComponent = React.memo(
<p>Admin + Staff : </p> <p>Admin + Staff : </p>
{SelfTakeAwayAmount != 0 && <p>Self Booking : </p>} {SelfTakeAwayAmount != 0 && <p>Self Booking : </p>}
{PreOrderAmount != 0 && <p>Preorder : </p>} {PreOrderAmount != 0 && <p>Preorder : </p>}
{OverAllTakeAwayOfferAmount != 0 && <p>Offer(-) : </p>} {OverAllTakeAwayOfferAmount != 0 && (
<p>Offer(-) : </p>
)}
</div> </div>
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
<p>{safeRound(TakeAwayAmount)}</p> <p>{safeRound(TakeAwayAmount)}</p>
@ -650,7 +627,9 @@ const SalesCountComponent = React.memo(
{isMobile ? 'DI' : 'Dine In'}:{' '} {isMobile ? 'DI' : 'Dine In'}:{' '}
<span> <span>
{safeRound( {safeRound(
DineInAmount + SelfDineInAmount - OverAllDineInOfferAmount DineInAmount +
SelfDineInAmount -
OverAllDineInOfferAmount
)} )}
</span> </span>
</p> </p>
@ -822,7 +801,9 @@ const SalesCountComponent = React.memo(
'' ''
) : ( ) : (
<button <button
onClick={() => setCurrentPage((p) => Math.max(p - 1, 1))} onClick={() =>
setCurrentPage((p) => Math.max(p - 1, 1))
}
disabled={currentPage === 1} disabled={currentPage === 1}
style={{ style={{
padding: '5px 10px', padding: '5px 10px',
@ -854,7 +835,9 @@ const SalesCountComponent = React.memo(
border: 'none', border: 'none',
borderRadius: '4px', borderRadius: '4px',
cursor: cursor:
currentPage === totalPages ? 'not-allowed' : 'pointer', currentPage === totalPages
? 'not-allowed'
: 'pointer',
opacity: currentPage === totalPages ? 0.5 : 1, opacity: currentPage === totalPages ? 0.5 : 1,
}} }}
> >
@ -1110,21 +1093,13 @@ const SalesCountComponent = React.memo(
)} )}
</Tooltip> </Tooltip>
</div> </div>
{/* {preferenceshortcutkey && <ShortcutKeyHelper />} */}
{preferenceshortcutkey && ( {preferenceshortcutkey && (
<div className="keyboardShortcut"> <div className="keyboardShortcut">
<ShortcutKeyHelper /> <ShortcutKeyHelper />
</div> </div>
)} )}
<AllSalesPageSettings /> <AllSalesPageSettings />
<Tooltip
placement="bottom"
trigger={[]}
title="CTRL + E"
open={isAltPressed}
>
<ProductPriceChange /> <ProductPriceChange />
</Tooltip>
<ReceivedStocksModal <ReceivedStocksModal
open={isReceivedModelOpen} open={isReceivedModelOpen}
onClose={() => { onClose={() => {
@ -1152,6 +1127,7 @@ const SalesCountComponent = React.memo(
onSubmit={handleModalSubmit} onSubmit={handleModalSubmit}
/> />
</> </>
</Suspense>
); );
} }
); );

View File

@ -1,7 +1,15 @@
import { useEffect, useState, useMemo, useCallback } from 'react'; import {
useEffect,
useState,
useMemo,
useCallback,
lazy,
Suspense,
useRef,
} from 'react';
import { useSelector, useDispatch } from 'react-redux'; import { useSelector, useDispatch } from 'react-redux';
import { FaChartLine, FaRupeeSign } from 'react-icons/fa'; import { FaChartLine, FaRupeeSign } from 'react-icons/fa';
import { Badge, DatePicker, Popconfirm, Tooltip } from 'antd'; import { Badge, Popconfirm, Tooltip } from 'antd';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import { ApplicationPreferences } from '../../../Features/BrachLogin/BranchLogin'; import { ApplicationPreferences } from '../../../Features/BrachLogin/BranchLogin';
import { import {
@ -25,12 +33,9 @@ import {
import { useDateStore } from '../../../Features/BookingScreen/BookingData/DateStore'; import { useDateStore } from '../../../Features/BookingScreen/BookingData/DateStore';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import moment from 'moment'; import moment from 'moment';
import { BsUiChecks } from 'react-icons/bs';
import { FaCheckToSlot } from 'react-icons/fa6';
import PozoKioskIcon from '../Components/UtillComponents/Pozo retail icons/PozoKioskIcon'; import PozoKioskIcon from '../Components/UtillComponents/Pozo retail icons/PozoKioskIcon';
import { globalKioskSalesCount } from '../../../Features/Kiosk/kiosk'; import { globalKioskSalesCount } from '../../../Features/Kiosk/kiosk';
import BSKioskCounterPayment from '../Components/UtillComponents/BSKioskCounterPayment'; import BSKioskCounterPayment from '../Components/UtillComponents/BSKioskCounterPayment';
import BSExpireProductsList from '../Components/UtillComponents/BSExpireProductsList';
import TooltipWrapper from '../../../Components/Tooltip/Tooltip'; import TooltipWrapper from '../../../Components/Tooltip/Tooltip';
import { import {
getTemplateData, getTemplateData,
@ -44,43 +49,68 @@ import {
} from '../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail'; } from '../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail';
import { PutBookingClose } from '../../../Features/BookingScreen/RetailBookingClose'; import { PutBookingClose } from '../../../Features/BookingScreen/RetailBookingClose';
import BSEwayBillicon from '../../BookingScreen/Components/UtillComponents/BSEwayBillicon.jsx'; import BSEwayBillicon from '../../BookingScreen/Components/UtillComponents/BSEwayBillicon.jsx';
import ListOfSalesInvoices from '../Components/BSBillingTables/ListofInvoices/ListOfSalesInvoices.jsx';
import { DefaultModal } from '../../../Components/Modal/DefaultModal.jsx'; import { DefaultModal } from '../../../Components/Modal/DefaultModal.jsx';
import CustomisedInvoiceChange from '../Components/UtillComponents/CustomisedInvoiceChange.jsx';
import ProductPriceChange from '../Components/UtillComponents/ProductPriceChange.jsx';
import { MdOutlineCallReceived } from 'react-icons/md'; import { MdOutlineCallReceived } from 'react-icons/md';
import { import {
getReceivedStocks, getReceivedStocks,
PostReceiveStocks, PostReceiveStocks,
} from '../../../Features/stockReceivedGodown/ReceivedStock.js'; } from '../../../Features/stockReceivedGodown/ReceivedStock.js';
import ReceivedStocksModal from '../../../Components/Modal/ReceivedStocksModal.jsx';
import ProductDetailsModal from '../../../Components/Modal/ProductDetailsModal.jsx';
import { GoPackageDependencies } from 'react-icons/go'; import { GoPackageDependencies } from 'react-icons/go';
import { Messages } from '../../../../ownLib/my-ui-lib.js'; import { Messages } from '../../../../ownLib/my-ui-lib.js';
// Jsx File
const BSExpireProductsList = lazy(
() => import('../Components/UtillComponents/BSExpireProductsList')
);
import ShortcutKeyHelper from '../Components/UtillComponents/ShortcutKeyHelper.jsx'; const ListOfSalesInvoices = lazy(
import AllSalesPageSettings from '../Components/UtillComponents/AllSalesPageSettings.jsx'; () =>
import('../Components/BSBillingTables/ListofInvoices/ListOfSalesInvoices.jsx')
);
const CustomisedInvoiceChange = lazy(
() => import('../Components/UtillComponents/CustomisedInvoiceChange.jsx')
);
const ProductPriceChange = lazy(
() => import('../Components/UtillComponents/ProductPriceChange.jsx')
);
const ReceivedStocksModal = lazy(
() => import('../../../Components/Modal/ReceivedStocksModal.jsx')
);
const ProductDetailsModal = lazy(
() => import('../../../Components/Modal/ProductDetailsModal.jsx')
);
const ShortcutKeyHelper = lazy(
() => import('../Components/UtillComponents/ShortcutKeyHelper.jsx')
);
const AllSalesPageSettings = lazy(
() => import('../Components/UtillComponents/AllSalesPageSettings.jsx')
);
// Scss
import '../../../Styles/BookingScreen/Template/BSLayout2/BSLayout2.scss'; import '../../../Styles/BookingScreen/Template/BSLayout2/BSLayout2.scss';
import useWhyDidYouUpdate from '../../../Services/findrerender.js';
import React from 'react';
const SalesCountForStandard = ({ const SalesCountForStandard = React.memo(() => {
DineInAccess,
GlobalsalesDetailData,
PricingAppPricingName,
}) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const AppId = getSession('AppId'); const AppId = getSession('AppId');
const CompId = getSession('CompId'); const CompId = getSession('CompId');
const BranchId = getSession('BranchId'); const BranchId = getSession('BranchId');
const UserId = getSession('UserId'); const UserId = getSession('UserId');
const ProdSubCat = useSelector(GlobalProductSubCategorie); const ProdSubCat = useSelector(GlobalProductSubCategorie);
const prodCat = useSelector(GlobalProductCategorie); const prodCat = useSelector(GlobalProductCategorie);
const templateData = useSelector(getTemplateData); const templateData = useSelector(getTemplateData);
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
const [allowDecimal, setAllowDecimal] = useState(false); const [allowDecimal, setAllowDecimal] = useState(false);
const [BookingModalOpen, setBookingModalOpen] = useState(false); const [BookingModalOpen, setBookingModalOpen] = useState(false);
const [ListOfInvoices, setListOfInvoices] = useState(false); const [ListOfInvoices, setListOfInvoices] = useState(false);
const { selectedDate, setSelectedDate } = useDateStore();
const [Kioskopen, setKioskopen] = useState(false); const [Kioskopen, setKioskopen] = useState(false);
const badgeCount = useSelector(globalKioskSalesCount); const badgeCount = useSelector(globalKioskSalesCount);
const OtherServicesglobal = useSelector(GlobalOtherSevices); const OtherServicesglobal = useSelector(GlobalOtherSevices);
@ -88,6 +118,7 @@ const SalesCountForStandard = ({
const SessionData = useSelector(StoredSessionData); const SessionData = useSelector(StoredSessionData);
const OrderStatus = useSelector(GlobalOrderStatus); const OrderStatus = useSelector(GlobalOrderStatus);
const dailySalesData = useSelector(GlobalSalesDetailData); const dailySalesData = useSelector(GlobalSalesDetailData);
const [page, setpage] = useState(1); const [page, setpage] = useState(1);
const [isModalOpen, setIsModalOpen] = useState(false); const [isModalOpen, setIsModalOpen] = useState(false);
const [isNetAmtModalOpen, setIsNetAmtModalOpen] = useState(false); const [isNetAmtModalOpen, setIsNetAmtModalOpen] = useState(false);
@ -110,6 +141,11 @@ const SalesCountForStandard = ({
const currentData = bookings?.slice(startIndex, startIndex + rowsPerPage); const currentData = bookings?.slice(startIndex, startIndex + rowsPerPage);
const preferencedata = useSelector(PreferenceData); const preferencedata = useSelector(PreferenceData);
const DineInAccess = useMemo(() => {
return preferencedata?.[0]?.SettingDtlDetails?.filter(
(i) => i.SettingIdName === 'DineIn'
)?.[0];
}, [preferencedata]);
console.log(dailySalesData, 'dailySalesDatadailySalesData', bookings); console.log(dailySalesData, 'dailySalesDatadailySalesData', bookings);
const bookingTypePreference = const bookingTypePreference =
@ -137,12 +173,7 @@ const SalesCountForStandard = ({
const salespagefields = appPreferences?.find( const salespagefields = appPreferences?.find(
(pref) => pref?.PreferredCatName === 'Sales Page Fields' (pref) => pref?.PreferredCatName === 'Sales Page Fields'
)?.PreferenceCatDetails; )?.PreferenceCatDetails;
const AvailableDate = salespagefields?.find(
(type) =>
type?.PreferredSubCatName?.toLowerCase() === 'available date' &&
type?.PreferredStatus === 'Y'
);
const { isBulk, setIsBulk } = useDateStore();
const BookingStatus = useSelector(GlobalBookingStatus); const BookingStatus = useSelector(GlobalBookingStatus);
const CheckBookingStatus = const CheckBookingStatus =
BookingStatus?.find((item) => item.ScreenType === 'Booking') BookingStatus?.find((item) => item.ScreenType === 'Booking')
@ -154,7 +185,7 @@ const SalesCountForStandard = ({
item.SettingIdName.toLowerCase() === 'shortcutkeys' && item.SettingIdName.toLowerCase() === 'shortcutkeys' &&
item.SettingValue === 'Y' item.SettingValue === 'Y'
); );
const sales = GlobalsalesDetailData?.[0] || {}; const sales = dailySalesData?.[0] || {};
const { const {
DineInOrderCount = 0, DineInOrderCount = 0,
TakeAwayOrderCount = 0, TakeAwayOrderCount = 0,
@ -169,14 +200,12 @@ const SalesCountForStandard = ({
SelfDineInAmount = 0, SelfDineInAmount = 0,
PreOrderAmount = 0, PreOrderAmount = 0,
} = sales; } = sales;
useEffect(() => { useEffect(() => {
// const { data: res } = await dispatch( if (preferencedata?.length > 0) {
// getPreferenceData({ AppId, CompId, BranchId })
// ).unwrap();
const decimalSetting = preferencedata?.[0]?.SettingDtlDetails?.find( const decimalSetting = preferencedata?.[0]?.SettingDtlDetails?.find(
(s) => (s) =>
s?.SettingIdName?.toLowerCase() === 'decimal' && s?.SettingValue === 'Y' s?.SettingIdName?.toLowerCase() === 'decimal' &&
s?.SettingValue === 'Y'
); );
setAllowDecimal(!!decimalSetting); setAllowDecimal(!!decimalSetting);
let custombillsetting = preferencedata?.[0]?.SettingDtlDetails?.some( let custombillsetting = preferencedata?.[0]?.SettingDtlDetails?.some(
@ -193,17 +222,14 @@ const SalesCountForStandard = ({
); );
setAutoReceiveStock(!AutoReceiveStock); setAutoReceiveStock(!AutoReceiveStock);
}
}, [preferencedata]); }, [preferencedata]);
// useEffect(() => {
// if (!selectedDate || (Array.isArray(selectedDate) && selectedDate.length === 0)) {
// setSelectedDate(dayjs());
// }
// }, [selectedDate, setSelectedDate]);
useEffect(() => { useEffect(() => {
if (AppId && CompId && BranchId && UserId) { if (AppId && CompId && BranchId && UserId) {
fetchBookingStatus(); fetchBookingStatus();
}
getReceivedStock(); getReceivedStock();
}
}, [AppId, CompId, BranchId, UserId]); }, [AppId, CompId, BranchId, UserId]);
const getReceivedStock = async () => { const getReceivedStock = async () => {
@ -304,24 +330,6 @@ const SalesCountForStandard = ({
width: '120px', width: '120px',
}, },
// {
// title: 'Product Details',
// dataIndex: 'ProductDetails',
// key: 'ProductDetails',
// width: '120px',
// render: (text, record, index) => (
// <span
// style={{ cursor: 'pointer', color: '#1890ff', textAlign: "center" }}
// onClick={() => {
// handleModalOpen(index)
// }}
// >
// <IoEye style={{ fontSize: 18, verticalAlign: 'middle' }} />
// </span>
// ),
// },
{ {
title: 'Actions', title: 'Actions',
dataIndex: 'fromBranch', dataIndex: 'fromBranch',
@ -469,9 +477,7 @@ const SalesCountForStandard = ({
if (isNaN(num)) return allowDecimal ? '0.00' : '0'; if (isNaN(num)) return allowDecimal ? '0.00' : '0';
return allowDecimal ? num.toFixed(2) : Math.round(num).toString(); return allowDecimal ? num.toFixed(2) : Math.round(num).toString();
}; };
const disablePastDates = (current) => {
return current && current < moment().startOf('day');
};
const totalTakeAway = const totalTakeAway =
TakeAwayAmount + TakeAwayAmount +
SelfTakeAwayAmount + SelfTakeAwayAmount +
@ -534,41 +540,6 @@ const SalesCountForStandard = ({
</div> </div>
); );
// Fix: Convert string dates to dayjs objects for the DatePicker
const getDatePickerValue = () => {
if (!selectedDate) return isBulk ? [] : null;
console.log(selectedDate, 'selectedDate');
if (isBulk) {
// For bulk mode, convert string array to dayjs objects array
if (Array.isArray(selectedDate)) {
return selectedDate.map((date) => dayjs(date));
}
return [];
} else {
// For single date mode, handle both string and dayjs object
if (Array.isArray(selectedDate) && selectedDate.length > 0) {
return dayjs(selectedDate[0]);
}
return dayjs(selectedDate);
}
};
const handleDateChange = (dateOrDates) => {
if (isBulk) {
// For bulk mode, convert dayjs objects to string format
const formattedDates = dateOrDates
? dateOrDates.map((d) => d.format('YYYY-MM-DD'))
: [];
setSelectedDate(formattedDates);
} else {
// For single date mode
if (dateOrDates) {
setSelectedDate(dateOrDates);
} else {
setSelectedDate([]);
}
}
};
const fetchBookingStatus = async () => { const fetchBookingStatus = async () => {
let data = { let data = {
CompId: CompId, CompId: CompId,
@ -615,22 +586,9 @@ const SalesCountForStandard = ({
const handleInvoiceClose = () => { const handleInvoiceClose = () => {
setListOfInvoices(false); setListOfInvoices(false);
}; };
// Table row selection state and handlers
const onSelectChange = (newSelectedRowKeys) => {
setSelectedRowKeys(newSelectedRowKeys);
};
const handleSubmitSelectedRows = () => {
// TODO: replace this with real submit logic
console.log('Submitting selected rows:', selectedRowKeys);
setIsReceivedModelOpen(false);
setSelectedRowKeys([]);
};
const rowSelection = {
selectedRowKeys,
onChange: onSelectChange,
};
return ( return (
<Suspense fallback={<div>Loading...</div>}>
<div className="NewLayoutBillContainer"> <div className="NewLayoutBillContainer">
<Messages <Messages
messageType={messageType} messageType={messageType}
@ -795,7 +753,7 @@ const SalesCountForStandard = ({
</button> </button>
)} )}
{preferenceshortcutkey && ( {preferenceshortcutkey && (
<div className='KeyshortCutNav3'> <div className="KeyshortCutNav3">
<ShortcutKeyHelper /> <ShortcutKeyHelper />
</div> </div>
)} )}
@ -855,8 +813,6 @@ const SalesCountForStandard = ({
cursor: 'pointer', cursor: 'pointer',
}} }}
/> />
{/* <button className="BookingCloseButton"
onClick={OpenBookingModal}>Booking Close</button> */}
</TooltipWrapper> </TooltipWrapper>
</div> </div>
) : ( ) : (
@ -965,7 +921,8 @@ const SalesCountForStandard = ({
<tr <tr
key={item.OrderId} key={item.OrderId}
style={{ style={{
backgroundColor: index % 2 === 0 ? '#f7faff' : '#e9f1ff', backgroundColor:
index % 2 === 0 ? '#f7faff' : '#e9f1ff',
textAlign: 'center', textAlign: 'center',
transition: 'background 0.3s', transition: 'background 0.3s',
}} }}
@ -1197,7 +1154,8 @@ const SalesCountForStandard = ({
<tr <tr
key={index} key={index}
style={{ style={{
backgroundColor: index % 2 === 0 ? '#f7faff' : '#ffffff', backgroundColor:
index % 2 === 0 ? '#f7faff' : '#ffffff',
transition: 'background 0.3s', transition: 'background 0.3s',
}} }}
onMouseEnter={(e) => onMouseEnter={(e) =>
@ -1321,7 +1279,6 @@ const SalesCountForStandard = ({
open={isReceivedModelOpen} open={isReceivedModelOpen}
onClose={() => { onClose={() => {
setIsReceivedModelOpen(false); setIsReceivedModelOpen(false);
setSelectedRowKeys([]);
}} }}
columns={columns} columns={columns}
tableData={TableData} tableData={TableData}
@ -1334,7 +1291,9 @@ const SalesCountForStandard = ({
onClose={handleModalCancel} onClose={handleModalCancel}
productDetails={modalProductDetails} productDetails={modalProductDetails}
headerData={{ headerData={{
dateTime: dateFormatChange1(TableData?.[SelectedIndex]?.CreatedDate), dateTime: dateFormatChange1(
TableData?.[SelectedIndex]?.CreatedDate
),
fromBranch: TableData?.[SelectedIndex]?.FromBranchName, fromBranch: TableData?.[SelectedIndex]?.FromBranchName,
Dispatch_Id: TableData?.[SelectedIndex]?.DispatchId, Dispatch_Id: TableData?.[SelectedIndex]?.DispatchId,
Created_By: TableData?.[SelectedIndex]?.Created_By, Created_By: TableData?.[SelectedIndex]?.Created_By,
@ -1343,7 +1302,8 @@ const SalesCountForStandard = ({
onSubmit={handleModalSubmit} onSubmit={handleModalSubmit}
/> />
</div> </div>
</Suspense>
); );
}; });
export default SalesCountForStandard; export default SalesCountForStandard;

View File

@ -14,7 +14,6 @@ import { InputField } from '../../Components/Forms/InputField';
import Buttons from '../../Components/Forms/Buttons'; import Buttons from '../../Components/Forms/Buttons';
import { ArrowRightOutlined } from '@ant-design/icons'; import { ArrowRightOutlined } from '@ant-design/icons';
import { DropDowns } from '../../Components/Forms/DropDown'; import { DropDowns } from '../../Components/Forms/DropDown';
import { RadioGrpButton } from '../../Components/Forms/RadioGroup.jsx';
import '../../Styles/CancelReschedule/ChangePaymentMode.scss'; import '../../Styles/CancelReschedule/ChangePaymentMode.scss';
import { import {
ChangeSelectedCustDisable, ChangeSelectedCustDisable,
@ -93,13 +92,14 @@ const ChangePaymentmode = () => {
const appPreferences = useSelector(ApplicationPreferences); const appPreferences = useSelector(ApplicationPreferences);
const commonModulePreference = appPreferences?.find( const commonModulePreference = appPreferences?.find(
(preference) => preference?.PreferredCatName === "Common Module" (preference) => preference?.PreferredCatName === 'Common Module'
)?.PreferenceCatDetails; )?.PreferenceCatDetails;
const sportsAppPreference = commonModulePreference?.find( const sportsAppPreference = commonModulePreference?.find(
(preference) => preference?.PreferredSubCatName === "SportsApp" && preference?.PreferredStatus == 'Y' (preference) =>
preference?.PreferredSubCatName === 'SportsApp' &&
preference?.PreferredStatus == 'Y'
); );
const [messageType, setMessageType] = useState(null); const [messageType, setMessageType] = useState(null);
const [messageData, setMessageData] = useState(null); const [messageData, setMessageData] = useState(null);
const [selCancelPay, setselCancelPay] = useState('CR'); const [selCancelPay, setselCancelPay] = useState('CR');
@ -151,7 +151,6 @@ const ChangePaymentmode = () => {
name: ' Cancel/Payment Change', name: ' Cancel/Payment Change',
link: `${subDirectory}setting/cancel-paymentchange`, link: `${subDirectory}setting/cancel-paymentchange`,
}, },
]; ];
useEffect(() => { useEffect(() => {
@ -212,8 +211,6 @@ const ChangePaymentmode = () => {
// third; // third;
}; };
const disabledDate = (current) => current && current > dayjs().endOf('day'); const disabledDate = (current) => current && current > dayjs().endOf('day');
const disabledFeatureDate = (current) =>
current && current < dayjs().endOf('day');
const getCreditcustDetail = async () => { const getCreditcustDetail = async () => {
let Credata = { let Credata = {
@ -326,15 +323,13 @@ const ChangePaymentmode = () => {
setSalesDetail([]); setSalesDetail([]);
setFullSalesDetail([]); setFullSalesDetail([]);
if (segmentValue == "Mobile" && billormobile && fromDate && toDate) { if (segmentValue == 'Mobile' && billormobile && fromDate && toDate) {
setMessageType('error');
setMessageData(res?.data?.response);
} else {
setMessageType('error'); setMessageType('error');
setMessageData(res?.data?.response); setMessageData(res?.data?.response);
} }
else {
setMessageType('error');
setMessageData(res?.data?.response);
}
} }
setisdisabled(true); setisdisabled(true);
}; };
@ -384,7 +379,6 @@ const ChangePaymentmode = () => {
setFullSalesDetail([]); setFullSalesDetail([]);
}; };
// Debounce utility // Debounce utility
const debounce = (func, delay) => { const debounce = (func, delay) => {
let timer; let timer;
@ -781,7 +775,7 @@ const ChangePaymentmode = () => {
dispatch(changeSelectedCustId(null)); dispatch(changeSelectedCustId(null));
dispatch(changeSelectedOption({})); dispatch(changeSelectedOption({}));
dispatch(ChangeSelectedCustDisable(false)); dispatch(ChangeSelectedCustDisable(false));
SelectCanPaymode(null) SelectCanPaymode(null);
} }
} catch (error) { } catch (error) {
console.error('Payment mode change failed:', error); console.error('Payment mode change failed:', error);
@ -790,8 +784,7 @@ const ChangePaymentmode = () => {
if (selCancelPay === 'CR' && selActivityType === 'Cancel') { if (selCancelPay === 'CR' && selActivityType === 'Cancel') {
if (SelCancelType === 'OverAll') { if (SelCancelType === 'OverAll') {
const { NetAmount } = FullSalesDetail?.[0]; const { NetAmount } = FullSalesDetail?.[0];
const { ChargeType, ChargesFixed } = const { ChargeType, ChargesFixed } = SelCanReason?.[0];
SelCanReason?.[0];
if (ChargeType === 'P') { if (ChargeType === 'P') {
const temCanCharge = (NetAmount * ChargesFixed) / 100; const temCanCharge = (NetAmount * ChargesFixed) / 100;
@ -804,24 +797,44 @@ const ChangePaymentmode = () => {
try { try {
const prodDtl = (FullSalesDetail || [])?.find( const prodDtl = (FullSalesDetail || [])?.find(
(f) => f.OrderId === selectedRowKey (f) => f.OrderId === selectedRowKey
)?.productDetails )?.productDetails;
const SalesId = prodDtl?.[0]?.SalesId; const SalesId = prodDtl?.[0]?.SalesId;
const ProductDetails = (prodDtl || []).map(({ ProdId, InwardDtlId, Type, SalesQty, Rate, TaxAmt, SinglePc }) => ({ const ProductDetails = (prodDtl || []).map(
ProdId, InwardDtlId, Type, Qty: SalesQty, Rate, TotalAmt: SalesQty * Rate, TaxAmt, SinglePc, ({
})); ProdId,
InwardDtlId,
Type,
SalesQty,
Rate,
TaxAmt,
SinglePc,
}) => ({
ProdId,
InwardDtlId,
Type,
Qty: SalesQty,
Rate,
TotalAmt: SalesQty * Rate,
TaxAmt,
SinglePc,
})
);
if (ProductDetails?.length === 0) { if (ProductDetails?.length === 0) {
throw new Error('No orders selected'); throw new Error('No orders selected');
} }
const Amount = ProductDetails.reduce((acc, item) => acc + (item.TotalAmt || 0), 0); const Amount = ProductDetails.reduce(
(acc, item) => acc + (item.TotalAmt || 0),
0
);
const payload = { const payload = {
AppId, AppId,
CompId, CompId,
BranchId, BranchId,
SalesId, SalesId,
ProductDetails, ProductDetails,
SalesType: "C", SalesType: 'C',
OrderId: selectedRowKey, OrderId: selectedRowKey,
CreatedBy: UserId, CreatedBy: UserId,
CreatedDate: dayjs()?.format('YYYY-MM-DD'), CreatedDate: dayjs()?.format('YYYY-MM-DD'),
@ -829,27 +842,27 @@ const ChangePaymentmode = () => {
{ {
PaymentType: SelCanPaymode, PaymentType: SelCanPaymode,
Amount, Amount,
PaymentStatus: "S" PaymentStatus: 'S',
} },
] ],
}; };
const res = await dispatch(PostSalesCancellation(payload)).unwrap(); const res = await dispatch(PostSalesCancellation(payload)).unwrap();
if (res?.data?.statusCode === 1) { if (res?.data?.statusCode === 1) {
setMessageType('success'); setMessageType('success');
setMessageData(res?.data?.response || "Posted successfully"); setMessageData(res?.data?.response || 'Posted successfully');
setSelectedRowKey() setSelectedRowKey();
formRef.current?.resetFields() formRef.current?.resetFields();
setFullSalesDetail([]); setFullSalesDetail([]);
SelectCanPaymode(null) SelectCanPaymode(null);
setSegmentValue('Bill No') setSegmentValue('Bill No');
} else { } else {
setMessageType('success'); setMessageType('success');
setMessageData(res?.data?.response || "Posted successfully"); setMessageData(res?.data?.response || 'Posted successfully');
} }
} catch (error) { } catch (error) {
setMessageType("error"); setMessageType('error');
setMessageData(error?.message || "An error occurred"); setMessageData(error?.message || 'An error occurred');
} finally { } finally {
setIsPosting(false); // enable button setIsPosting(false); // enable button
} }
@ -930,14 +943,10 @@ const ChangePaymentmode = () => {
toDate = formRef.current?.getFieldsValue()?.ReschedulToDate; toDate = formRef.current?.getFieldsValue()?.ReschedulToDate;
} }
} else if (selCancelPay === 'CP') { } else if (selCancelPay === 'CP') {
toDate = formRef.current?.getFieldsValue()?.["Change- PaymentToDate"]; toDate = formRef.current?.getFieldsValue()?.['Change- PaymentToDate'];
} }
if ( if (segmentValue === 'Mobile' && formatted && toDate !== undefined) {
segmentValue === 'Mobile' &&
formatted &&
toDate !== undefined
) {
if (billormobile === undefined) { if (billormobile === undefined) {
setMessageType('error'); setMessageType('error');
setMessageData('Please enter the mobile number.'); setMessageData('Please enter the mobile number.');
@ -968,11 +977,7 @@ const ChangePaymentmode = () => {
fromDate = fromDate =
formRef.current?.getFieldsValue()?.['Change-PaymentFromDate']; formRef.current?.getFieldsValue()?.['Change-PaymentFromDate'];
} }
if ( if (segmentValue === 'Mobile' && fromDate != undefined && formatted) {
segmentValue === 'Mobile' &&
fromDate != undefined &&
formatted
) {
if (billormobile === undefined) { if (billormobile === undefined) {
setMessageType('error'); setMessageType('error');
setMessageData('Please enter the mobile number.'); setMessageData('Please enter the mobile number.');
@ -1340,7 +1345,7 @@ const ChangePaymentmode = () => {
display: 'flex', display: 'flex',
gap: '0.5rem', gap: '0.5rem',
alignItems: 'center', alignItems: 'center',
flexWrap: "wrap" flexWrap: 'wrap',
}} }}
> >
<div style={{ fontWeight: 500 }}>Mode Type :</div> <div style={{ fontWeight: 500 }}>Mode Type :</div>
@ -1381,8 +1386,6 @@ const ChangePaymentmode = () => {
onChange={segmentOnChange} onChange={segmentOnChange}
/> />
</div> */} </div> */}
</div> </div>
</div> </div>
{selCancelPay === 'CR' && ( {selCancelPay === 'CR' && (
@ -1423,15 +1426,10 @@ const ChangePaymentmode = () => {
gap: '0.5rem', gap: '0.5rem',
alignItems: 'center', alignItems: 'center',
}} }}
> ></div>
</div>
{selActivityType === 'Cancel' && ( {selActivityType === 'Cancel' && (
<div className="Cancellation-div"> <div className="Cancellation-div">
<div style={{ marginBottom: '10px' }}> <div style={{ marginBottom: '10px' }}>
<DropDowns <DropDowns
options={[ options={[
{ value: 'Bill No', label: 'Bill No' }, { value: 'Bill No', label: 'Bill No' },
@ -1451,7 +1449,7 @@ const ChangePaymentmode = () => {
alignItems: 'center', alignItems: 'center',
gap: '10px', gap: '10px',
// marginTop: '10px', // marginTop: '10px',
flexWrap: 'wrap' flexWrap: 'wrap',
}} }}
> >
{segmentValue === 'Date' ? ( {segmentValue === 'Date' ? (
@ -1479,17 +1477,23 @@ const ChangePaymentmode = () => {
await validateSafeInput(value); // Your existing input sanitization await validateSafeInput(value); // Your existing input sanitization
if (!value) { if (!value) {
return Promise.reject(`Please enter ${segmentValue}`); return Promise.reject(
`Please enter ${segmentValue}`
);
} }
const digitOnlyRegex = /^[0-9]+$/; const digitOnlyRegex = /^[0-9]+$/;
if (!digitOnlyRegex.test(value)) { if (!digitOnlyRegex.test(value)) {
return Promise.reject(`${segmentValue} should contain digits only`); return Promise.reject(
`${segmentValue} should contain digits only`
);
} }
if (segmentValue === 'Bill No') { if (segmentValue === 'Bill No') {
if (value.length > 30) { if (value.length > 30) {
return Promise.reject('Bill No should not exceed 30 characters'); return Promise.reject(
'Bill No should not exceed 30 characters'
);
} }
} }
@ -1497,29 +1501,37 @@ const ChangePaymentmode = () => {
const mobileRegex = /^[6-9]\d{9}$/; const mobileRegex = /^[6-9]\d{9}$/;
if (!value || value.length !== 10) { if (!value || value.length !== 10) {
return Promise.reject('Mobile Number must be exactly 10 digits'); return Promise.reject(
'Mobile Number must be exactly 10 digits'
);
} }
if (!mobileRegex.test(value)) { if (!mobileRegex.test(value)) {
return Promise.reject('Mobile number must start with 6, 7, 8, or 9'); return Promise.reject(
'Mobile number must start with 6, 7, 8, or 9'
);
} }
await getSalesDetailapi(value); await getSalesDetailapi(value);
} }
await getSalesDetailapi(value); await getSalesDetailapi(value);
return Promise.resolve(); return Promise.resolve();
} },
} },
]} ]}
> >
<InputField <InputField
field="OrderId" field="OrderId"
autoComplete="off" autoComplete="off"
inputMode="numeric" inputMode="numeric"
maxLength={segmentValue === 'Mobile' ? 10 : 30} maxLength={
segmentValue === 'Mobile' ? 10 : 30
}
onInput={(e) => onInput={(e) =>
(e.target.value = e.target.value.replace(/[^0-9]/g, '')) (e.target.value = e.target.value.replace(
/[^0-9]/g,
''
))
} }
label={ label={
<label class="required"> <label class="required">
@ -1536,7 +1548,7 @@ const ChangePaymentmode = () => {
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
gap: '10px', gap: '10px',
flexWrap: 'wrap' flexWrap: 'wrap',
}} }}
> >
<Form.Item <Form.Item
@ -1937,17 +1949,23 @@ const ChangePaymentmode = () => {
await validateSafeInput(value); // Your existing input sanitization await validateSafeInput(value); // Your existing input sanitization
if (!value) { if (!value) {
return Promise.reject(`Please enter ${segmentValue}`); return Promise.reject(
`Please enter ${segmentValue}`
);
} }
const digitOnlyRegex = /^[0-9]+$/; const digitOnlyRegex = /^[0-9]+$/;
if (!digitOnlyRegex.test(value)) { if (!digitOnlyRegex.test(value)) {
return Promise.reject(`${segmentValue} should contain digits only`); return Promise.reject(
`${segmentValue} should contain digits only`
);
} }
if (segmentValue === 'Bill No') { if (segmentValue === 'Bill No') {
if (value.length > 30) { if (value.length > 30) {
return Promise.reject('Bill No should not exceed 30 characters'); return Promise.reject(
'Bill No should not exceed 30 characters'
);
} }
} }
@ -1955,19 +1973,23 @@ const ChangePaymentmode = () => {
const mobileRegex = /^[6-9]\d{9}$/; const mobileRegex = /^[6-9]\d{9}$/;
if (!value || value.length !== 10) { if (!value || value.length !== 10) {
return Promise.reject('Mobile Number must be exactly 10 digits'); return Promise.reject(
'Mobile Number must be exactly 10 digits'
);
} }
if (!mobileRegex.test(value)) { if (!mobileRegex.test(value)) {
return Promise.reject('Mobile number must start with 6, 7, 8, or 9'); return Promise.reject(
'Mobile number must start with 6, 7, 8, or 9'
);
} }
await getSalesDetailapi(value); await getSalesDetailapi(value);
} }
await getSalesDetailapi(value); await getSalesDetailapi(value);
return Promise.resolve(); return Promise.resolve();
} },
} },
]} ]}
> >
<InputField <InputField
@ -2091,7 +2113,8 @@ const ChangePaymentmode = () => {
<div <div
style={{ display: 'flex', flexDirection: 'column' }} style={{ display: 'flex', flexDirection: 'column' }}
> >
{selectedRowKey !== null && (<> {selectedRowKey !== null && (
<>
<Table <Table
columns={paymentRowRadiocolumns} columns={paymentRowRadiocolumns}
rowKey="PaymentType" rowKey="PaymentType"
@ -2100,12 +2123,16 @@ const ChangePaymentmode = () => {
(f) => f.OrderId === selectedRowKey (f) => f.OrderId === selectedRowKey
)?.OrderPaymentDtls )?.OrderPaymentDtls
} }
/></> />
</>
)} )}
{FullSalesDetail?.length > 0 && ( {FullSalesDetail?.length > 0 && (
<div style={{ <div
height: "60vh", overflow: "auto" style={{
}}> height: '60vh',
overflow: 'auto',
}}
>
<Table <Table
rowSelection={rowSelection} rowSelection={rowSelection}
columns={rowradiocolumns} columns={rowradiocolumns}
@ -2160,7 +2187,11 @@ const ChangePaymentmode = () => {
/> />
<Modal <Modal
open={viewProductDetails?.view} open={viewProductDetails?.view}
title={<FormHeader title={sportsAppPreference ? 'Slot Details' : 'Product Details'} />} title={
<FormHeader
title={sportsAppPreference ? 'Slot Details' : 'Product Details'}
/>
}
width={900} width={900}
footer={false} footer={false}
onCancel={() => { onCancel={() => {

View File

@ -826,17 +826,17 @@ const CustomerForm = ({ formType }) => {
const handleRemoveAddress = (index) => { const handleRemoveAddress = (index) => {
setAddressPreview((prev) => setAddressPreview((prev) =>
prev.map((item, i) => prev.map((item, i) =>
i === index ? { ...item, ActiveStatus: "D" } : item i === index ? { ...item, ActiveStatus: 'D' } : item
) )
); );
setAddressesList((prev) => setAddressesList((prev) =>
prev.map((item, i) => prev.map((item, i) =>
i === index ? { ...item, ActiveStatus: "D" } : item i === index ? { ...item, ActiveStatus: 'D' } : item
) )
); );
setNewAddress((prev) => setNewAddress((prev) =>
prev.map((item, i) => prev.map((item, i) =>
i === index ? { ...item, ActiveStatus: "D" } : item i === index ? { ...item, ActiveStatus: 'D' } : item
) )
); );
}; };
@ -1616,7 +1616,9 @@ const CustomerForm = ({ formType }) => {
<div className="customer-address-details-list"> <div className="customer-address-details-list">
{addressPreview?.length > 0 ? ( {addressPreview?.length > 0 ? (
addressPreview?.filter((addr) => addr.ActiveStatus !== "D")?.map((addr, idx) => ( addressPreview
?.filter((addr) => addr.ActiveStatus !== 'D')
?.map((addr, idx) => (
<div key={idx} className="address-card"> <div key={idx} className="address-card">
<div className="address-header"> <div className="address-header">
<div className="header-left"> <div className="header-left">
@ -1634,9 +1636,9 @@ const CustomerForm = ({ formType }) => {
}} }}
> >
<Checkbox <Checkbox
checked={(addressTypes[idx] || []).includes( checked={(
'Delivery Address' addressTypes[idx] || []
)} ).includes('Delivery Address')}
onChange={(e) => onChange={(e) =>
handleAddressTypeChange( handleAddressTypeChange(
idx, idx,
@ -1648,9 +1650,9 @@ const CustomerForm = ({ formType }) => {
Delivery Address Delivery Address
</Checkbox> </Checkbox>
<Checkbox <Checkbox
checked={(addressTypes[idx] || []).includes( checked={(
'Billing Address' addressTypes[idx] || []
)} ).includes('Billing Address')}
onChange={(e) => onChange={(e) =>
handleAddressTypeChange( handleAddressTypeChange(
idx, idx,
@ -1662,9 +1664,9 @@ const CustomerForm = ({ formType }) => {
Billing Address Billing Address
</Checkbox> </Checkbox>
<Checkbox <Checkbox
checked={(addressTypes[idx] || []).includes( checked={(
'Both Address' addressTypes[idx] || []
)} ).includes('Both Address')}
onChange={(e) => onChange={(e) =>
handleAddressTypeChange( handleAddressTypeChange(
idx, idx,
@ -1692,7 +1694,9 @@ const CustomerForm = ({ formType }) => {
</div> </div>
<div className="address-detail-item zip"> <div className="address-detail-item zip">
<div className="value">{addr?.Zip || ''}</div> <div className="value">
{addr?.Zip || ''}
</div>
</div> </div>
<div className="address-detail-item city"> <div className="address-detail-item city">
@ -1739,7 +1743,10 @@ const CustomerForm = ({ formType }) => {
cancelText="Cancel" cancelText="Cancel"
okType="danger" okType="danger"
> >
<button className="remove-btn" type="button"> <button
className="remove-btn"
type="button"
>
<FaTrash /> Remove <FaTrash /> Remove
</button> </button>
</Popconfirm> </Popconfirm>
@ -2007,16 +2014,7 @@ const CustomerForm = ({ formType }) => {
<button <button
type="button" type="button"
onClick={handleAddOrUpdateAddress} onClick={handleAddOrUpdateAddress}
style={{ className="CusAddressAddBtn"
backgroundColor: '#1677ff',
color: '#fff',
padding: '6px 12px',
border: 'none',
borderRadius: '6px',
cursor: 'pointer',
marginTop: '8px',
fontWeight: '500',
}}
> >
{editingIndex !== null {editingIndex !== null
? 'Update Address' ? 'Update Address'

View File

@ -1408,7 +1408,7 @@ const RetailDashboard = () => {
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
gap: '5px', gap: '5px',
lineHeight:"1.1" lineHeight: '1.1',
}} }}
> >
<img src={sandClock} alt="" width={25} /> <img src={sandClock} alt="" width={25} />

View File

@ -1,4 +1,4 @@
import React, { useEffect, useState, useCallback } from 'react'; import { useEffect, useState, useCallback } from 'react';
import { useNavigate, useLocation } from 'react-router-dom'; import { useNavigate, useLocation } from 'react-router-dom';
import { useDispatch } from 'react-redux'; import { useDispatch } from 'react-redux';
import { import {
@ -25,10 +25,16 @@ import {
deleteOfferCode, deleteOfferCode,
} from '../../../Features/Offer/OfferCode/OfferCode.js'; } from '../../../Features/Offer/OfferCode/OfferCode.js';
import { useAuth } from '../../../AuthContext.jsx'; import { useAuth } from '../../../AuthContext.jsx';
import { getAllCustomer, getPreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData.js'; import {
getAllCustomer,
getPreferenceData,
} from '../../../Features/BookingScreen/BookingData/BookingData.js';
import { DefaultModal } from '../../../Components/Modal/DefaultModal.jsx'; import { DefaultModal } from '../../../Components/Modal/DefaultModal.jsx';
import { BiSolidCoupon } from 'react-icons/bi'; import { BiSolidCoupon } from 'react-icons/bi';
import { postCustomerOfferMail, postSMSOffer } from '../../../Features/Payment/PaymentDetails/PaymentDetails.js'; import {
postCustomerOfferMail,
postSMSOffer,
} from '../../../Features/Payment/PaymentDetails/PaymentDetails.js';
const CheckboxGroup = Checkbox.Group; const CheckboxGroup = Checkbox.Group;
const subDirectory = import.meta.env.ENV_BASE_URL; const subDirectory = import.meta.env.ENV_BASE_URL;
@ -46,11 +52,25 @@ const items = [
const plainOptions = [ const plainOptions = [
{ {
label: (<div style={{ display: "flex", alignItems: "center", marginTop: "0.2rem" }}><AiOutlineMail size={18} style={{ marginRight: 5 }} />Mail</div>), label: (
<div
style={{ display: 'flex', alignItems: 'center', marginTop: '0.2rem' }}
>
<AiOutlineMail size={18} style={{ marginRight: 5 }} />
Mail
</div>
),
value: 'Mail', value: 'Mail',
}, },
{ {
label: (<div style={{ display: "flex", alignItems: "center", marginTop: "0.2rem" }}><MdOutlineTextsms size={18} style={{ marginRight: 5 }} />SMS</div>), label: (
<div
style={{ display: 'flex', alignItems: 'center', marginTop: '0.2rem' }}
>
<MdOutlineTextsms size={18} style={{ marginRight: 5 }} />
SMS
</div>
),
value: 'SMS', value: 'SMS',
}, },
// { // {
@ -94,15 +114,20 @@ const OfferCodeList = () => {
const [selectedRowKeys, setSelectedRowKeys] = useState([]); const [selectedRowKeys, setSelectedRowKeys] = useState([]);
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const checkAll = plainOptions.length === checkedList.length; const checkAll = plainOptions.length === checkedList.length;
const indeterminate = checkedList.length > 0 && checkedList.length < plainOptions.length; const indeterminate =
checkedList.length > 0 && checkedList.length < plainOptions.length;
const getPreference = async () => { const getPreference = async () => {
const data = { AppId: AppId, CompId: CompId, BranchId: BranchId }; const data = { AppId: AppId, CompId: CompId, BranchId: BranchId };
const { data: res } = await dispatch(getPreferenceData(data)).unwrap() const { data: res } = await dispatch(getPreferenceData(data)).unwrap();
const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find((setting) => setting?.SettingIdName?.toLowerCase() === "decimal" && setting?.SettingValue === 'Y'); const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find(
(setting) =>
setting?.SettingIdName?.toLowerCase() === 'decimal' &&
setting?.SettingValue === 'Y'
);
if (decimalSetting) { if (decimalSetting) {
setAllowDecimal(true) setAllowDecimal(true);
}
} }
};
const onComplete = useCallback(() => { const onComplete = useCallback(() => {
setMessageData(null); setMessageData(null);
@ -116,8 +141,8 @@ const OfferCodeList = () => {
setMessageData(location?.state?.Notiffy.messageData); setMessageData(location?.state?.Notiffy.messageData);
} }
TableData(); TableData();
getPreference() getPreference();
fetchCustomerApi() fetchCustomerApi();
// if (UserType === "Employee") { // if (UserType === "Employee") {
// fetchApi() // fetchApi()
// } // }
@ -142,11 +167,14 @@ const OfferCodeList = () => {
setaddnewAccess(!hasAccess); setaddnewAccess(!hasAccess);
}, [empData, SAAccessCommonMaster, UserType]); }, [empData, SAAccessCommonMaster, UserType]);
const fetchCustomerApi = async () => { const fetchCustomerApi = async () => {
let res = await dispatch(getAllCustomer({ CompId, AppId, branchId: BranchId })).unwrap(); let res = await dispatch(
getAllCustomer({ CompId, AppId, branchId: BranchId })
).unwrap();
if (res?.data?.statusCode === 1) { if (res?.data?.statusCode === 1) {
setCustomerData(res?.data?.data?.map((item, index) => ({ ...item, key: index + 1 }))); setCustomerData(
res?.data?.data?.map((item, index) => ({ ...item, key: index + 1 }))
);
} else { } else {
setCustomerData([]); setCustomerData([]);
} }
@ -257,7 +285,9 @@ const OfferCodeList = () => {
String(record.OfferName) String(record.OfferName)
?.toLowerCase() ?.toLowerCase()
?.includes(value?.toLowerCase()) || ?.includes(value?.toLowerCase()) ||
String(record.MinQty)?.toLowerCase()?.includes(value?.toLowerCase()) || String(record.MinQty)
?.toLowerCase()
?.includes(value?.toLowerCase()) ||
String(record.MinPurchase) String(record.MinPurchase)
?.toLowerCase() ?.toLowerCase()
?.includes(value?.toLowerCase()) || ?.includes(value?.toLowerCase()) ||
@ -464,7 +494,9 @@ const OfferCodeList = () => {
String(record.OfferName) String(record.OfferName)
?.toLowerCase() ?.toLowerCase()
?.includes(value?.toLowerCase()) || ?.includes(value?.toLowerCase()) ||
String(record.MinQty)?.toLowerCase()?.includes(value?.toLowerCase()) || String(record.MinQty)
?.toLowerCase()
?.includes(value?.toLowerCase()) ||
String(record.MinPurchase) String(record.MinPurchase)
?.toLowerCase() ?.toLowerCase()
?.includes(value?.toLowerCase()) || ?.includes(value?.toLowerCase()) ||
@ -475,7 +507,8 @@ const OfferCodeList = () => {
); );
}, },
sorter: (a, b) => a?.OfferName?.length - b?.OfferName?.length, sorter: (a, b) => a?.OfferName?.length - b?.OfferName?.length,
sortOrder: sortedInfo1.columnKey === 'OfferName' ? sortedInfo1.order : null, sortOrder:
sortedInfo1.columnKey === 'OfferName' ? sortedInfo1.order : null,
ellipsis: true, ellipsis: true,
}, },
{ {
@ -502,15 +535,17 @@ const OfferCodeList = () => {
]; ];
const handleShareOfferCode = async (record) => { const handleShareOfferCode = async (record) => {
setSelectedOfferCode(record) setSelectedOfferCode(record);
setOpen(prev => !prev); setOpen((prev) => !prev);
}
const onCheckAllChange = e => {
setCheckedList(e.target.checked ? plainOptions?.map(({ value }) => value) : []);
}; };
const onChange = list => { const onCheckAllChange = (e) => {
setCheckedList(
e.target.checked ? plainOptions?.map(({ value }) => value) : []
);
};
const onChange = (list) => {
setCheckedList(list); setCheckedList(list);
}; };
@ -522,7 +557,7 @@ const OfferCodeList = () => {
setSortedInfo1(sorter); setSortedInfo1(sorter);
}; };
const onSelectChange = newSelectedRowKeys => { const onSelectChange = (newSelectedRowKeys) => {
setSelectedRowKeys(newSelectedRowKeys); setSelectedRowKeys(newSelectedRowKeys);
}; };
@ -532,8 +567,10 @@ const OfferCodeList = () => {
}; };
const handleSubmit = async () => { const handleSubmit = async () => {
if (checkedList?.includes("Mail") || checkedList?.includes("SMS")) { if (checkedList?.includes('Mail') || checkedList?.includes('SMS')) {
const selectedCustomers = customerData?.filter((_, index) => selectedRowKeys.includes(index)) const selectedCustomers = customerData?.filter((_, index) =>
selectedRowKeys.includes(index)
);
if (selectedCustomers?.length > 0) { if (selectedCustomers?.length > 0) {
const { BrName, BrEmail } = selectedCustomers?.[0] || {}; const { BrName, BrEmail } = selectedCustomers?.[0] || {};
const { const {
@ -547,49 +584,114 @@ const OfferCodeList = () => {
ProdCount, ProdCount,
RewardOrderTypeDetails, RewardOrderTypeDetails,
RewardTypeDetails, RewardTypeDetails,
RewardFreeTypeDetails } = selectedOfferCode; RewardFreeTypeDetails,
let response = { mail: "", sms: "" }; } = selectedOfferCode;
let response = { mail: '', sms: '' };
setIsLoading(true); setIsLoading(true);
if (checkedList?.includes("Mail")) { if (checkedList?.includes('Mail')) {
const applicableEmailCustomers = selectedCustomers?.filter(({ CustEmail }) => CustEmail !== null)?.map(({ CustId, CustName, CustMobile, CustEmail }) => ({ const applicableEmailCustomers =
CustId, CustName, CustMobile, CustEmail, selectedCustomers
?.filter(({ CustEmail }) => CustEmail !== null)
?.map(({ CustId, CustName, CustMobile, CustEmail }) => ({
CustId,
CustName,
CustMobile,
CustEmail,
})) || []; })) || [];
if (applicableEmailCustomers?.length > 0) { if (applicableEmailCustomers?.length > 0) {
let Categories = '' let Categories = '';
let Products = '' let Products = '';
if (RewardTypeName === 'Discount' && AppliesTo === 'S') { if (RewardTypeName === 'Discount' && AppliesTo === 'S') {
Categories = RewardOrderTypeDetails?.filter(({ ProdCat }) => ProdCat !== 0 || ProdCat !== null)?.map(({ ProdCatName }) => ProdCatName)?.filter(Boolean).join() Categories = RewardOrderTypeDetails?.filter(
Products = RewardOrderTypeDetails?.filter(({ ProdCat }) => ProdCat === 0 || ProdCat === null)?.map(({ ProdName }) => ProdName)?.filter(Boolean).join() ({ ProdCat }) => ProdCat !== 0 || ProdCat !== null
)
?.map(({ ProdCatName }) => ProdCatName)
?.filter(Boolean)
.join();
Products = RewardOrderTypeDetails?.filter(
({ ProdCat }) => ProdCat === 0 || ProdCat === null
)
?.map(({ ProdName }) => ProdName)
?.filter(Boolean)
.join();
} else if (RewardTypeName === 'Free Products') { } else if (RewardTypeName === 'Free Products') {
Products = [...RewardTypeDetails?.map(({ ProdName }) => ProdName), ...RewardFreeTypeDetails?.map(({ ProdName }) => ProdName)]?.filter(Boolean).join() Products = [
...RewardTypeDetails?.map(({ ProdName }) => ProdName),
...RewardFreeTypeDetails?.map(({ ProdName }) => ProdName),
]
?.filter(Boolean)
.join();
} }
const postEmailData = { const postEmailData = {
BrName, BrEmail, Description, MinQty, MinPurchase, OfferCode, BrName,
CustomerDtl: applicableEmailCustomers, RewardTypeName, AppliesTo, Categories, Products, Amount: OfferAmt, BrEmail,
Qty: ProdCount Description,
MinQty,
MinPurchase,
OfferCode,
CustomerDtl: applicableEmailCustomers,
RewardTypeName,
AppliesTo,
Categories,
Products,
Amount: OfferAmt,
Qty: ProdCount,
}; };
response.mail = await dispatch(postCustomerOfferMail(postEmailData)).unwrap(); response.mail = await dispatch(
postCustomerOfferMail(postEmailData)
).unwrap();
} }
} }
if (checkedList?.includes("SMS")) { if (checkedList?.includes('SMS')) {
const applicableSMSCustomers = selectedCustomers?.filter(({ CustMobile }) => CustMobile !== null)?.map(({ CustId, CustName, CustMobile, CustEmail }) => ({ const applicableSMSCustomers =
CustId, CustName, CustMobile, CustEmail, selectedCustomers
?.filter(({ CustMobile }) => CustMobile !== null)
?.map(({ CustId, CustName, CustMobile, CustEmail }) => ({
CustId,
CustName,
CustMobile,
CustEmail,
})) || []; })) || [];
if (applicableSMSCustomers?.length > 0) { if (applicableSMSCustomers?.length > 0) {
let Categories = '' let Categories = '';
let Products = '' let Products = '';
if (RewardTypeName === 'Discount' && AppliesTo === 'S') { if (RewardTypeName === 'Discount' && AppliesTo === 'S') {
Categories = RewardOrderTypeDetails?.filter(({ ProdCat }) => ProdCat !== 0 || ProdCat !== null)?.map(({ ProdCatName }) => ProdCatName)?.filter(Boolean).join() Categories = RewardOrderTypeDetails?.filter(
Products = RewardOrderTypeDetails?.filter(({ ProdCat }) => ProdCat === 0 || ProdCat === null)?.map(({ ProdName }) => ProdName)?.filter(Boolean).join() ({ ProdCat }) => ProdCat !== 0 || ProdCat !== null
)
?.map(({ ProdCatName }) => ProdCatName)
?.filter(Boolean)
.join();
Products = RewardOrderTypeDetails?.filter(
({ ProdCat }) => ProdCat === 0 || ProdCat === null
)
?.map(({ ProdName }) => ProdName)
?.filter(Boolean)
.join();
} else if (RewardTypeName === 'Free Products') { } else if (RewardTypeName === 'Free Products') {
Products = [...RewardTypeDetails?.map(({ ProdName }) => ProdName), ...RewardFreeTypeDetails?.map(({ ProdName }) => ProdName)]?.filter(Boolean).join() Products = [
...RewardTypeDetails?.map(({ ProdName }) => ProdName),
...RewardFreeTypeDetails?.map(({ ProdName }) => ProdName),
]
?.filter(Boolean)
.join();
} }
const postSMSData = { const postSMSData = {
BrName, BrEmail, Description, MinQty, MinPurchase, OfferCode, BrName,
CustomerDtl: applicableSMSCustomers, RewardTypeName, AppliesTo, Categories, Products, Amount: OfferAmt, BrEmail,
Qty: ProdCount Description,
MinQty,
MinPurchase,
OfferCode,
CustomerDtl: applicableSMSCustomers,
RewardTypeName,
AppliesTo,
Categories,
Products,
Amount: OfferAmt,
Qty: ProdCount,
}; };
response.sms = await dispatch(postSMSOffer(postSMSData)).unwrap(); response.sms = await dispatch(postSMSOffer(postSMSData)).unwrap();
@ -597,12 +699,17 @@ const OfferCodeList = () => {
} }
setIsLoading(false); setIsLoading(false);
setOpen(prev => !prev); setOpen((prev) => !prev);
setSelectedRowKeys([]); setSelectedRowKeys([]);
setCheckedList([]) setCheckedList([]);
if (response?.mail?.data?.statusCode === 1 || response?.sms?.data?.statusCode === 1) { if (
response?.mail?.data?.statusCode === 1 ||
response?.sms?.data?.statusCode === 1
) {
setMessageType('success'); setMessageType('success');
setMessageData(`${response?.mail?.data?.response} & ${response?.sms?.data?.response}`); setMessageData(
`${response?.mail?.data?.response} & ${response?.sms?.data?.response}`
);
return; return;
} else { } else {
setMessageType('error'); setMessageType('error');
@ -615,14 +722,16 @@ const OfferCodeList = () => {
} }
} else { } else {
setMessageType('error'); setMessageType('error');
setMessageData('Please select at least one communication method (Mail/SMS)'); setMessageData(
'Please select at least one communication method (Mail/SMS)'
);
} }
}; };
const handleCancel = () => { const handleCancel = () => {
setOpen(prev => !prev) setOpen((prev) => !prev);
setSelectedRowKeys([]); setSelectedRowKeys([]);
} };
return ( return (
<> <>
@ -674,12 +783,31 @@ const OfferCodeList = () => {
children={ children={
<> <>
<Spin spinning={isLoading} tip="Sending..."> <Spin spinning={isLoading} tip="Sending...">
<div style={{ display: 'flex', flexDirection: "column", gap: "0.5rem", border: "1px solid #d9d9d9", padding: "0.5rem", borderRadius: "0.50rem" }}> <div
<p style={{ fontSize: '14px', fontWeight: '500' }}>Share Codes via :</p> style={{
<Checkbox indeterminate={indeterminate} onChange={onCheckAllChange} checked={checkAll}> display: 'flex',
flexDirection: 'column',
gap: '0.5rem',
border: '1px solid #d9d9d9',
padding: '0.5rem',
borderRadius: '0.50rem',
}}
>
<p style={{ fontSize: '14px', fontWeight: '500' }}>
Share Codes via :
</p>
<Checkbox
indeterminate={indeterminate}
onChange={onCheckAllChange}
checked={checkAll}
>
Check All Check All
</Checkbox> </Checkbox>
<CheckboxGroup options={plainOptions} value={checkedList} onChange={onChange} /> <CheckboxGroup
options={plainOptions}
value={checkedList}
onChange={onChange}
/>
</div> </div>
<Table <Table
rowSelection={rowSelection} rowSelection={rowSelection}

View File

@ -783,27 +783,16 @@ const PaymentFailedSales = ({ paymentFailedStatusFun, OpenFailData }) => {
gateWaySubmit(); gateWaySubmit();
}, []); }, []);
const AllProductTokenFunction = () => { };
// useEffect(() => {
// if (PrintOrderDetails?.length > 0) {
// if (isMobile) {
// MobilePrint(PrintOrderDetails, UpiId, "Booking")
// }
// else {
// Print()
// }
// // setPrintOrderDetails([])
// } //change by karthiga
// }, [PrintOrderDetails])
//
//function
const PrintFun = () => { const PrintFun = () => {
if (PrintOrderDetails?.length > 0) { if (PrintOrderDetails?.length > 0) {
if (isMobile) { if (isMobile) {
MobilePrint(appPreferences, PrintOrderDetails, UpiId, 'Booking', SettingDataSelector); MobilePrint(
appPreferences,
PrintOrderDetails,
UpiId,
'Booking',
SettingDataSelector
);
} else { } else {
Print(); Print();
} }
@ -1063,9 +1052,9 @@ const PaymentFailedSales = ({ paymentFailedStatusFun, OpenFailData }) => {
'Style 11': 'PrintStyle11', 'Style 11': 'PrintStyle11',
'Style 12': 'PrintStyle12', 'Style 12': 'PrintStyle12',
'Style 13': 'RePrint', 'Style 13': 'RePrint',
"A4": "PrintStyleA4", A4: 'PrintStyleA4',
"A5": "PrintStyleA5", A5: 'PrintStyleA5',
"A4Standard": "A4Standard" A4Standard: 'A4Standard',
}; };
const selectedStyle = const selectedStyle =

View File

@ -1,5 +1,5 @@
import { useEffect, useState, useCallback } from 'react'; import { useEffect, useState, useCallback } from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch } from 'react-redux';
import { ArrowRightOutlined } from '@ant-design/icons'; import { ArrowRightOutlined } from '@ant-design/icons';
import { Radio } from 'antd'; import { Radio } from 'antd';
import { Messages } from '../../../Components/Notifications/Messages'; import { Messages } from '../../../Components/Notifications/Messages';
@ -12,13 +12,7 @@ import {
import { getSession } from '../../../Services/Others.js'; import { getSession } from '../../../Services/Others.js';
import '../../../Styles/Payment/PaymentOptions/PaymentOptions.scss'; import '../../../Styles/Payment/PaymentOptions/PaymentOptions.scss';
import { useAuth } from '../../../AuthContext.jsx'; import { useAuth } from '../../../AuthContext.jsx';
// import {getPaymentOptionFeature} from '../../BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx' import { changeCommonPaymentOptions } from '../../../Features/BookingScreen/BookingData/BookingData.js';
import {
changeCommonPaymentOptions,
getPaymentOptionFeatureApi,
GlobalCommonPaymentOptions,
} from '../../../Features/BookingScreen/BookingData/BookingData.js';
import BST1Payment from '../../BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx';
import { fetchAndSetPaymentOptions } from '../../BookingScreen/Template/PaymentOptions.js'; import { fetchAndSetPaymentOptions } from '../../BookingScreen/Template/PaymentOptions.js';
import { import {
getPaymentConfigData, getPaymentConfigData,
@ -41,7 +35,6 @@ function PaymentOptions({ setModalOpen }) {
); );
const dispatch = useDispatch(); const dispatch = useDispatch();
const AppId = getSession('AppId'); const AppId = getSession('AppId');
const UserId = getSession('UserId'); const UserId = getSession('UserId');
const CompId = getSession('CompId'); const CompId = getSession('CompId');
@ -83,7 +76,6 @@ function PaymentOptions({ setModalOpen }) {
(item) => (item) =>
item.FlowName === 'sales' && item.Option === 'Pay at the counter' item.FlowName === 'sales' && item.Option === 'Pay at the counter'
); );
console.log(salesPayAtCounter);
const modeSet = new Set(); const modeSet = new Set();
@ -354,10 +346,7 @@ function PaymentOptions({ setModalOpen }) {
const paymentOptionResponse = await dispatch( const paymentOptionResponse = await dispatch(
getPaymentConfigData({ typeName: 'Payment Option' }) getPaymentConfigData({ typeName: 'Payment Option' })
).unwrap(); ).unwrap();
console.log(
paymentOptionResponse?.data?.data,
' paymentOptionResponse?.data?.data'
);
if (paymentOptionResponse?.data?.statusCode == 1) { if (paymentOptionResponse?.data?.statusCode == 1) {
const requiredFeatureNames = ['Payment Gateway', 'Payment Device']; const requiredFeatureNames = ['Payment Gateway', 'Payment Device'];
const featureNames = checkPaymentFeatures?.data?.data?.flatMap((app) => const featureNames = checkPaymentFeatures?.data?.data?.flatMap((app) =>
@ -432,6 +421,7 @@ function PaymentOptions({ setModalOpen }) {
BranchId: BranchId, BranchId: BranchId,
DetailType: 'BU', DetailType: 'BU',
}; };
ALERT('HIH');
const Businessupidetails = await dispatch( const Businessupidetails = await dispatch(
getPaymentUPIDetails(BusiData) getPaymentUPIDetails(BusiData)
).unwrap(); ).unwrap();
@ -1259,7 +1249,7 @@ function PaymentOptions({ setModalOpen }) {
const result = {}; const result = {};
data?.forEach((item) => { data?.forEach((item) => {
const { FlowId, FlowName, Option, OptionDetails } = item; const { FlowId, FlowName, OptionDetails } = item;
if (!result[FlowId]) { if (!result[FlowId]) {
result[FlowId] = { result[FlowId] = {
@ -1590,7 +1580,7 @@ function PaymentOptions({ setModalOpen }) {
</> </>
)} )}
<div className="SBTNPaymentOptions"> <div className=" submitButtonDiv">
<Buttons <Buttons
buttonText="SUBMIT" buttonText="SUBMIT"
color="901D77" color="901D77"

View File

@ -1,4 +1,4 @@
import React, { useState, useEffect, useRef, useCallback } from 'react'; import { useState, useEffect, useRef, useCallback } from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { import {
getSession, getSession,
@ -9,7 +9,6 @@ import { Tables } from '../../../Components/Tables/Table';
import { Form } from 'antd'; import { Form } from 'antd';
import { InputField } from '../../../Components/Forms/InputField.jsx'; import { InputField } from '../../../Components/Forms/InputField.jsx';
import Buttons from '../../../Components/Forms/Buttons.jsx'; import Buttons from '../../../Components/Forms/Buttons.jsx';
import { PlusOutlined } from '@ant-design/icons';
import { DropDowns } from '../../../Components/Forms/DropDown.jsx'; import { DropDowns } from '../../../Components/Forms/DropDown.jsx';
import { getWholeSalePayments } from '../../../Features/WSTransaction/WSTransaction.js'; import { getWholeSalePayments } from '../../../Features/WSTransaction/WSTransaction.js';
import { Messages } from '../../../Components/Notifications/Messages.jsx'; import { Messages } from '../../../Components/Notifications/Messages.jsx';
@ -17,7 +16,10 @@ import { DatePicProd } from '../../../Components/Forms/DatePickerProduct.jsx';
import moment from 'moment'; import moment from 'moment';
import { GlobalLastEntryDateDtl } from '../../../Features/WholeSale/WholesaleData.js'; import { GlobalLastEntryDateDtl } from '../../../Features/WholeSale/WholesaleData.js';
import { useAuth } from '../../../AuthContext.jsx'; import { useAuth } from '../../../AuthContext.jsx';
import { changeBreadCrumb, getEmpAccess } from '../../../Features/AppPage/CenterPage.js'; import {
changeBreadCrumb,
getEmpAccess,
} from '../../../Features/AppPage/CenterPage.js';
import '../../../Styles/Payment/PaymentReceivedRetail/PaymentReceivedRetail.scss'; import '../../../Styles/Payment/PaymentReceivedRetail/PaymentReceivedRetail.scss';
import FormHeader from '../../PageComponents/FormHeader.jsx'; import FormHeader from '../../PageComponents/FormHeader.jsx';
import { import {
@ -43,7 +45,6 @@ const PaymentReceivedRetail = () => {
const [page, setpage] = useState(1); const [page, setpage] = useState(1);
const [SelectedCustomer, setSelectedCustomer] = useState(); const [SelectedCustomer, setSelectedCustomer] = useState();
console.log(SelectedCustomer, 'SelectedCustomerSelectedCustomer');
const [SelectedCustomerRole, setSelectedCustomerRole] = useState(); const [SelectedCustomerRole, setSelectedCustomerRole] = useState();
const [customer, setCustomer] = useState(); const [customer, setCustomer] = useState();
const [CustPaymentModes, setPaymentModesCust] = useState([]); const [CustPaymentModes, setPaymentModesCust] = useState([]);
@ -77,7 +78,6 @@ const PaymentReceivedRetail = () => {
dispatch(changeBreadCrumb({ items: items })); dispatch(changeBreadCrumb({ items: items }));
}, []); }, []);
useEffect(() => { useEffect(() => {
const PaymentCredit = const PaymentCredit =
CustPaymentModes?.find((a) => a?.ConfigId === selectedPaymentMode) CustPaymentModes?.find((a) => a?.ConfigId === selectedPaymentMode)
@ -288,28 +288,6 @@ const PaymentReceivedRetail = () => {
useEffect(() => { useEffect(() => {
fetchWholeSaleEmployee(); fetchWholeSaleEmployee();
}, [EmployeePaymentModes]); }, [EmployeePaymentModes]);
// const fetchWholeSaleCustomer = async () => {
// const Data = {
// "CompId": CompId,
// "BranchId": BranchId,
// "AppId": AppId
// }
// const gettingTableData = await dispatch(
// getCustmentWholeSaleTran(Data)
// ).unwrap();
// if (gettingTableData?.data?.statusCode === 1) {
// setCustomer(gettingTableData?.data?.data);
// let cutDefaultValue = CustPaymentModes?.[0]
// setSelectedPaymentMode(cutDefaultValue?.ConfigId)
// }
// else {
// setCustomer([])
// setSelectedPaymentMode('')
// }
// };
const fetchWholeSaleEmployee = async () => { const fetchWholeSaleEmployee = async () => {
const Data = { const Data = {
CompId: CompId, CompId: CompId,
@ -328,12 +306,16 @@ const PaymentReceivedRetail = () => {
}; };
const getPreference = async () => { const getPreference = async () => {
const data = { AppId: AppId, CompId: CompId, BranchId: BranchId }; const data = { AppId: AppId, CompId: CompId, BranchId: BranchId };
const { data: res } = await dispatch(getPreferenceData(data)).unwrap() const { data: res } = await dispatch(getPreferenceData(data)).unwrap();
const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find((setting) => setting?.SettingIdName?.toLowerCase() === "decimal" && setting?.SettingValue === 'Y'); const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find(
(setting) =>
setting?.SettingIdName?.toLowerCase() === 'decimal' &&
setting?.SettingValue === 'Y'
);
if (decimalSetting) { if (decimalSetting) {
setAllowDecimal(true) setAllowDecimal(true);
}
} }
};
const onFinish = async (values) => { const onFinish = async (values) => {
setButtonDisabled(true); setButtonDisabled(true);
const postData = { const postData = {
@ -607,14 +589,11 @@ const PaymentReceivedRetail = () => {
}} }}
> >
<p className="TransactionList-title">Transaction List</p> <p className="TransactionList-title">Transaction List</p>
{/* {PaymentType != 'O' &&
<p className='TransactionList-title' style={{ fontSize: "14px", cursor: "pointer" }}>Total Amount : <span style={{ color: FilterAmount < 0 ? "red" : "green" }}>{
// PaidListData?.[0]?.OverAllTotalAmount || 0
Math.abs(FilterAmount)
}</span></p>
} */}
</div> </div>
<div className="AllEntryShowList" style={{ overflow: 'scroll' }}> <div
className="AllEntryShowList"
style={{ overflow: 'scroll', scrollbarWidth: 'none' }}
>
<div className="Re-Print-table"> <div className="Re-Print-table">
<Tables <Tables
columns={columns} columns={columns}

View File

@ -1,13 +1,10 @@
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef } from 'react';
import { useDispatch } from 'react-redux'; import { useDispatch } from 'react-redux';
import { Switch, Tooltip, Form, DatePicker } from 'antd'; import { Switch, Tooltip, Form, DatePicker } from 'antd';
import moment from 'moment';
import { DatePicProd } from '../../../Components/Forms/DatePickerProduct.jsx';
import { Tables } from '../../../Components/Tables/Table';
import { BiSolidPrinter, BiUpArrowCircle } from 'react-icons/bi'; import { BiSolidPrinter, BiUpArrowCircle } from 'react-icons/bi';
import Denomination from '../Denomination/Denomination'; import Denomination from '../Denomination/Denomination';
import { Popover } from 'antd';
import '../../../Styles/Reports/DateWiseReport/DateWiseReport.scss'; import '../../../Styles/Reports/DateWiseReport/DateWiseReport.scss';
import '../../../Styles/Reports/ItemWiseReport/ItemWiseReport.scss';
import { changeBreadCrumb } from '../../../Features/AppPage/CenterPage'; import { changeBreadCrumb } from '../../../Features/AppPage/CenterPage';
import { import {
getDatewiseReport, getDatewiseReport,
@ -20,7 +17,6 @@ import { getSession, printDiv } from '../../../Services/WSOthers';
import DatewiseReportPdf from '../../paymentpdfPage/DateWiseReportPdf'; import DatewiseReportPdf from '../../paymentpdfPage/DateWiseReportPdf';
import { DropDowns } from '../../../Components/Forms/DropDown.jsx'; import { DropDowns } from '../../../Components/Forms/DropDown.jsx';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import logo from '../../../Images/pozologoimg.png';
import { RadioGrpButton } from '../../../Components/Forms/RadioGroup.jsx'; import { RadioGrpButton } from '../../../Components/Forms/RadioGroup.jsx';
import { IoSearch } from 'react-icons/io5'; import { IoSearch } from 'react-icons/io5';
import { ExtractDateFormate } from '../../../Services/Others.js'; import { ExtractDateFormate } from '../../../Services/Others.js';
@ -62,7 +58,11 @@ const DateWiseReport = () => {
Amounts: {}, Amounts: {},
OverAllTotal: 0, OverAllTotal: 0,
}); });
const MobileA4Print = SettingDataSelector?.[0]?.SettingDtlDetails?.find((setting) => setting?.SettingIdName?.toLowerCase() === "mobilea4" && setting?.SettingValue === 'Y'); const MobileA4Print = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
(setting) =>
setting?.SettingIdName?.toLowerCase() === 'mobilea4' &&
setting?.SettingValue === 'Y'
);
console.log(MobileA4Print, 'MobileA4PrintMobileA4Print'); console.log(MobileA4Print, 'MobileA4PrintMobileA4Print');
useEffect(() => { useEffect(() => {
@ -85,28 +85,29 @@ const DateWiseReport = () => {
}); });
return formattedDate; return formattedDate;
}; };
const formatAmount = (value) => {
return allowDecimal ? parseFloat(value || 0).toFixed(2) : Math.round(value || 0);
};
const mobileDateWisePrintFun = async (data) => { const mobileDateWisePrintFun = async (data) => {
const Dataa = ['Cash', 'Upi', 'Card', 'Credit']
?.map((method) => {
const Dataa = ["Cash", "Upi", "Card", "Credit"]?.map(method => {
const amountKey = `${method}Amount`; const amountKey = `${method}Amount`;
const countKey = `${method}Count`; const countKey = `${method}Count`;
let TableData = AppType ? WholeDataSource : dataSource; let TableData = AppType ? WholeDataSource : dataSource;
const total = TableData?.reduce((acc, entry) => { const total = TableData?.reduce(
(acc, entry) => {
acc.amount += entry[amountKey] || 0; acc.amount += entry[amountKey] || 0;
acc.count += entry[countKey] || 0; acc.count += entry[countKey] || 0;
return acc; return acc;
}, { amount: 0, count: 0 }); },
{ amount: 0, count: 0 }
);
return { return {
PaymentMethod: method, PaymentMethod: method,
CountOfPaymentType: total.count, CountOfPaymentType: total.count,
NetAmount: total.amount NetAmount: total.amount,
}; };
})?.filter(entry => entry.NetAmount > 0); })
?.filter((entry) => entry.NetAmount > 0);
let Tabledata = Dataa?.map((data, index) => { let Tabledata = Dataa?.map((data, index) => {
const snoSpacing = Math.max(0, 3 - String(index + 1).length); const snoSpacing = Math.max(0, 3 - String(index + 1).length);
@ -358,7 +359,7 @@ const DateWiseReport = () => {
</style>`; </style>`;
useEffect(() => { useEffect(() => {
getPreference() getPreference();
dispatch(changeBreadCrumb({ items: items })); dispatch(changeBreadCrumb({ items: items }));
fetchInitialData(); fetchInitialData();
if (UserRole != 'Employee') { if (UserRole != 'Employee') {
@ -368,12 +369,16 @@ const DateWiseReport = () => {
const getPreference = async () => { const getPreference = async () => {
const data = { AppId: AppId, CompId: CompId, BranchId: BranchId }; const data = { AppId: AppId, CompId: CompId, BranchId: BranchId };
const { data: res } = await dispatch(getPreferenceData(data)).unwrap() const { data: res } = await dispatch(getPreferenceData(data)).unwrap();
const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find((setting) => setting?.SettingIdName?.toLowerCase() === "decimal" && setting?.SettingValue === 'Y'); const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find(
(setting) =>
setting?.SettingIdName?.toLowerCase() === 'decimal' &&
setting?.SettingValue === 'Y'
);
if (decimalSetting) { if (decimalSetting) {
setAllowDecimal(true) setAllowDecimal(true);
}
} }
};
const userDropData = async () => { const userDropData = async () => {
const gettinguserDropDown = await dispatch( const gettinguserDropDown = await dispatch(
@ -400,7 +405,10 @@ const DateWiseReport = () => {
const fetchInitialData = async () => { const fetchInitialData = async () => {
let currentDate = new Date().toJSON().slice(0, 10); let currentDate = new Date().toJSON().slice(0, 10);
formRef?.current?.setFieldsValue({ formRef?.current?.setFieldsValue({
dateRange: [dayjs(currentDate, 'YYYY-MM-DD'), dayjs(currentDate, 'YYYY-MM-DD')], dateRange: [
dayjs(currentDate, 'YYYY-MM-DD'),
dayjs(currentDate, 'YYYY-MM-DD'),
],
}); });
setOrderFromDate(currentDate + 'T00:00:00'); setOrderFromDate(currentDate + 'T00:00:00');
setOrderToDate(currentDate + 'T23:59:59'); setOrderToDate(currentDate + 'T23:59:59');
@ -495,18 +503,6 @@ const DateWiseReport = () => {
// }, // },
// ]; // ];
const onChange = (checked) => {
setOpenDenomination(checked);
};
const hide = () => {
setOpen(false);
};
const handleOpenChange = (newOpen) => {
setOpen(newOpen);
};
const UserDropDownChange = async (e) => { const UserDropDownChange = async (e) => {
setUserId(e); setUserId(e);
let mob = userDropDown?.filter((item) => item?.UserId === e); let mob = userDropDown?.filter((item) => item?.UserId === e);
@ -554,8 +550,7 @@ const DateWiseReport = () => {
printId: 'RePrint', printId: 'RePrint',
printStyle: style, printStyle: style,
}); });
} } else {
else {
var textEncoded = encodeURI(receiptText); var textEncoded = encodeURI(receiptText);
var TypeCheck = 'PrintReceipt'; var TypeCheck = 'PrintReceipt';
var scheme = 'pozoprinter'; var scheme = 'pozoprinter';
@ -798,9 +793,11 @@ const DateWiseReport = () => {
<th rowSpan="2" style={{ textAlign: 'center' }}> <th rowSpan="2" style={{ textAlign: 'center' }}>
S.No S.No
</th> </th>
{dataSource?.[0]?.Date && <th rowSpan="2" style={{ textAlign: 'center' }}> {dataSource?.[0]?.Date && (
<th rowSpan="2" style={{ textAlign: 'center' }}>
Date Date
</th>} </th>
)}
<th colSpan="2" style={{ textAlign: 'center' }}> <th colSpan="2" style={{ textAlign: 'center' }}>
Cash Cash
</th> </th>
@ -853,7 +850,9 @@ const DateWiseReport = () => {
return ( return (
<tr key={Date + idx}> <tr key={Date + idx}>
<td style={{ textAlign: 'center' }}>{idx + 1}</td> <td style={{ textAlign: 'center' }}>{idx + 1}</td>
{dataSource?.[0]?.Date && <td style={{ textAlign: 'center' }}>{date}</td>} {dataSource?.[0]?.Date && (
<td style={{ textAlign: 'center' }}>{date}</td>
)}
<td style={{ textAlign: 'right' }}>{CashCount ?? 0}</td> <td style={{ textAlign: 'right' }}>{CashCount ?? 0}</td>
<td style={{ textAlign: 'right' }}> <td style={{ textAlign: 'right' }}>
{safeRound(CashAmount)} {safeRound(CashAmount)}
@ -866,7 +865,9 @@ const DateWiseReport = () => {
<td style={{ textAlign: 'right' }}> <td style={{ textAlign: 'right' }}>
{safeRound(CardAmount)} {safeRound(CardAmount)}
</td> </td>
<td style={{ textAlign: 'right' }}>{CreditCount ?? 0}</td> <td style={{ textAlign: 'right' }}>
{CreditCount ?? 0}
</td>
<td style={{ textAlign: 'right' }}> <td style={{ textAlign: 'right' }}>
{safeRound(CreditAmount)} {safeRound(CreditAmount)}
</td> </td>

View File

@ -1,4 +1,11 @@
import { useState, useEffect, useRef, useCallback } from 'react'; import {
useState,
useEffect,
useRef,
useCallback,
lazy,
Suspense,
} from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { InputField } from '../../Components/Forms/InputField.jsx'; import { InputField } from '../../Components/Forms/InputField.jsx';
import Buttons from '../../Components/Forms/Buttons.jsx'; import Buttons from '../../Components/Forms/Buttons.jsx';
@ -47,8 +54,10 @@ import {
GlobalWSDate, GlobalWSDate,
} from '../../Features/WholeSale/WholesaleData.js'; } from '../../Features/WholeSale/WholesaleData.js';
import { IoMdAdd, IoMdAddCircle } from 'react-icons/io'; import { IoMdAdd, IoMdAddCircle } from 'react-icons/io';
import AddUOMPreorder from '../PurchaseScreen/WholeSaleComponent/AddUomPreorder.jsx'; const AddUOMPreorder = lazy(
import Search from '../../Components/Forms/Search.jsx'; () => import('../PurchaseScreen/WholeSaleComponent/AddUomPreorder.jsx')
);
const Search = lazy(() => import('../../Components/Forms/Search.jsx'));
const subDirectory = import.meta.env.BASE_URL; const subDirectory = import.meta.env.BASE_URL;
@ -535,8 +544,12 @@ const WsPreOrderForm = ({
String(record.CustShortName) String(record.CustShortName)
?.toLowerCase() ?.toLowerCase()
?.includes(value?.toLowerCase()) || ?.includes(value?.toLowerCase()) ||
String(record.CustName)?.toLowerCase()?.includes(value?.toLowerCase()) || String(record.CustName)
String(record.CustMobile)?.toLowerCase()?.includes(value?.toLowerCase()) ?.toLowerCase()
?.includes(value?.toLowerCase()) ||
String(record.CustMobile)
?.toLowerCase()
?.includes(value?.toLowerCase())
); );
}, },
render: (text, record, row) => ( render: (text, record, row) => (
@ -767,6 +780,7 @@ const WsPreOrderForm = ({
setSearchedText(e?.target?.value); setSearchedText(e?.target?.value);
}; };
return ( return (
<Suspense fallback={<div>Loading</div>}>
<div className="WsPreOrderForm-Master"> <div className="WsPreOrderForm-Master">
<div className="pageOverAll" style={{ height: Mode == 'Y' && '100%' }}> <div className="pageOverAll" style={{ height: Mode == 'Y' && '100%' }}>
{(addcustomer || hold) && ( {(addcustomer || hold) && (
@ -954,7 +968,9 @@ const WsPreOrderForm = ({
}, },
]} ]}
> >
<label style={{ fontWeight: '600' }}>Date : </label> <label style={{ fontWeight: '600' }}>
Date :{' '}
</label>
<br /> <br />
<br /> <br />
<DatePicProd <DatePicProd
@ -1046,7 +1062,10 @@ const WsPreOrderForm = ({
/> />
</Form.Item> </Form.Item>
<IoMdAddCircle <IoMdAddCircle
style={{ fontSize: '1.5rem', paddingTop: '8px' }} style={{
fontSize: '1.5rem',
paddingTop: '8px',
}}
onClick={() => { onClick={() => {
AddUomModalFun(true); AddUomModalFun(true);
}} }}
@ -1172,6 +1191,7 @@ const WsPreOrderForm = ({
</div> </div>
</div> </div>
</div> </div>
</Suspense>
); );
}; };

View File

@ -1,37 +1,67 @@
import React, { useEffect, useState } from 'react'; import React, { lazy, useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import moment from 'moment';
import { import {
dateFormatChange,
dateFormatChange1, dateFormatChange1,
extractLastNumber, extractLastNumber,
extractLastNumberOrderId, extractLastNumberOrderId,
getSession, getSession,
} from '../../Services/Others'; } from '../../Services/Others';
import { import { ApplicationPreferences } from '../../Features/BrachLogin/BranchLogin.js';
ApplicationPreferences,
getBranchDetail,
} from '../../Features/BrachLogin/BranchLogin';
import PrintStyle1 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1';
import PrintStyle2 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2';
import PrintStyle3 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3';
import PrintStyle4 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4';
import PrintStyle5 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5';
import PrintStyle6 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6';
import PrintStyle7 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7';
import PrintStyle8 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8';
import PrintStyle9 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9';
import PrintStyle10 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10';
import PrintStyle11 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11';
import PrintStyle12 from '../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12';
import { SelectedPrintTemplate } from '../../Features/ThemeChange/ThemeChange'; import { SelectedPrintTemplate } from '../../Features/ThemeChange/ThemeChange';
import PrintA4Style11 from '../BookingScreen/PrintTemplates/A4/PrintA4Style11'; import { PreferenceData } from '../../Features/BookingScreen/BookingData/BookingData.js';
import PrintA5Style11 from '../BookingScreen/PrintTemplates/A4/PrintStyleA5';
import A4Standard from '../BookingScreen/PrintTemplates/A4/A4Standard';
import TaxInvoice from '../BookingScreen/PrintTemplates/A4/TaxInvoice';
import { settingDataSelector } from '../../Features/PreferenceMaster/PreferenceMaster';
import { PreferenceData } from '../../Features/BookingScreen/BookingData/BookingData';
// js Files
const PrintStyle1 = lazy(
() => import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.jsx')
);
const PrintStyle2 = lazy(
() => import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.jsx')
);
const PrintStyle3 = lazy(
() => import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.jsx')
);
const PrintStyle4 = lazy(
() => import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.jsx')
);
const PrintStyle5 = lazy(
() => import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.jsx')
);
const PrintStyle6 = lazy(
() => import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx')
);
const PrintStyle7 = lazy(
() => import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.jsx')
);
const PrintStyle8 = lazy(
() => import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.jsx')
);
const PrintStyle9 = lazy(
() => import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.jsx')
);
const PrintStyle10 = lazy(
() =>
import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.jsx')
);
const PrintStyle11 = lazy(
() =>
import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.jsx')
);
const PrintStyle12 = lazy(
() =>
import('../BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx')
);
const PrintA4Style11 = lazy(
() => import('../BookingScreen/PrintTemplates/A4/PrintA4Style11.jsx')
);
const PrintA5Style11 = lazy(
() => import('../BookingScreen/PrintTemplates/A4/PrintStyleA5.jsx')
);
const A4Standard = lazy(
() => import('../BookingScreen/PrintTemplates/A4/A4Standard.jsx')
);
const TaxInvoice = lazy(
() => import('../BookingScreen/PrintTemplates/A4/TaxInvoice.jsx')
);
const PaymentPdfBooking = ({ const PaymentPdfBooking = ({
index, index,
orderId, orderId,
@ -49,7 +79,7 @@ const PaymentPdfBooking = ({
let PaymentStatusSuccess = PaymentStatus?.filter( let PaymentStatusSuccess = PaymentStatus?.filter(
(ps) => ps.PaymentStatus === 'S' (ps) => ps.PaymentStatus === 'S'
); );
const isEditedBill = PaymentStatus?.some(payment => { const isEditedBill = PaymentStatus?.some((payment) => {
const type = payment?.AdjustmentType?.toLowerCase(); const type = payment?.AdjustmentType?.toLowerCase();
return ( return (
(type === 'extra' || type === 'refund') && (type === 'extra' || type === 'refund') &&
@ -59,8 +89,11 @@ const PaymentPdfBooking = ({
}); });
const lastTransaction = PaymentStatus?.find( const lastTransaction = PaymentStatus?.find(
(ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y'
) );
console.log(singleData2?.filter(data => data?.EditTokenAvailable !== 'N'), "singleData2") console.log(
singleData2?.filter((data) => data?.EditTokenAvailable !== 'N'),
'singleData2'
);
const ExtraChargeTotal = table2Data?.ExtraChargeDetails?.reduce( const ExtraChargeTotal = table2Data?.ExtraChargeDetails?.reduce(
(accumulator, currentObject) => { (accumulator, currentObject) => {
return accumulator + currentObject.TotalAmt; return accumulator + currentObject.TotalAmt;
@ -92,7 +125,7 @@ const PaymentPdfBooking = ({
const [BranchZip, setBranchZip] = useState(); const [BranchZip, setBranchZip] = useState();
const CashierName = getSession('userName'); const CashierName = getSession('userName');
const printerTemplateStyle = useSelector(SelectedPrintTemplate); const printerTemplateStyle = useSelector(SelectedPrintTemplate);
console.log(printerTemplateStyle, "printerTemplateStyle") console.log(printerTemplateStyle, 'printerTemplateStyle');
const appPreferences = useSelector(ApplicationPreferences); const appPreferences = useSelector(ApplicationPreferences);
const SettingData = useSelector(PreferenceData); const SettingData = useSelector(PreferenceData);
const estimatePrintHeader = const estimatePrintHeader =
@ -386,9 +419,17 @@ const PaymentPdfBooking = ({
GSTIN: {table2Data?.BrGSTIN} GSTIN: {table2Data?.BrGSTIN}
</p> </p>
)} )}
{table2Data?.BrMobile && <p style={{ fontSize: '9px', margin: '7px 0 0 0', padding: 0 }}> {table2Data?.BrMobile && (
<p
style={{
fontSize: '9px',
margin: '7px 0 0 0',
padding: 0,
}}
>
Mobile:+91 {table2Data?.BrMobile} Mobile:+91 {table2Data?.BrMobile}
</p>} </p>
)}
</div> </div>
</div> </div>
</div> </div>
@ -819,25 +860,40 @@ const PaymentPdfBooking = ({
<table style={{ width: '90%' }}> <table style={{ width: '90%' }}>
<tr> <tr>
<td <td
style={{ fontSize: '10px', textAlign: 'center' }} style={{
fontSize: '10px',
textAlign: 'center',
}}
></td> ></td>
<td <td
style={{ fontSize: '10px', textAlign: 'center' }} style={{
fontSize: '10px',
textAlign: 'center',
}}
> >
Taxable Amount Taxable Amount
</td> </td>
<td <td
style={{ fontSize: '10px', textAlign: 'center' }} style={{
fontSize: '10px',
textAlign: 'center',
}}
> >
CGST CGST
</td> </td>
<td <td
style={{ fontSize: '10px', textAlign: 'center' }} style={{
fontSize: '10px',
textAlign: 'center',
}}
> >
SGST SGST
</td> </td>
<td <td
style={{ fontSize: '10px', textAlign: 'center' }} style={{
fontSize: '10px',
textAlign: 'center',
}}
> >
Total Amount Total Amount
</td> </td>
@ -845,7 +901,10 @@ const PaymentPdfBooking = ({
{OrderDetailGST?.map((item) => ( {OrderDetailGST?.map((item) => (
<tr> <tr>
<td <td
style={{ fontSize: '10px', textAlign: 'right' }} style={{
fontSize: '10px',
textAlign: 'right',
}}
> >
{item?.TaxPercentage} % {item?.TaxPercentage} %
</td> </td>
@ -1137,7 +1196,7 @@ const PaymentPdfBooking = ({
></div> ></div>
)} )}
{(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( {PaymentStatusSuccess?.length > 1 && !isEditedBill && (
<> <>
{/* <p>Split Payment:</p> */} {/* <p>Split Payment:</p> */}
{Object.keys(aggregatedPayments)?.map((paymentType) => ( {Object.keys(aggregatedPayments)?.map((paymentType) => (
@ -1151,21 +1210,30 @@ const PaymentPdfBooking = ({
</> </>
)} )}
{isEditedBill && lastTransaction && ( {isEditedBill && lastTransaction && (
<div style={{ <div
width: '90%', marginTop: '2px', style={{
width: '90%',
marginTop: '2px',
marginLeft: '10px', marginLeft: '10px',
paddingTop: '2px', display: 'flex', justifyContent: 'center', alignItems: 'center', paddingTop: '2px',
flexDirection: 'column', borderTop: '1px dashed #ccc' display: 'flex',
}}> justifyContent: 'center',
alignItems: 'center',
flexDirection: 'column',
borderTop: '1px dashed #ccc',
}}
>
<div <div
style={{ style={{
fontSize: '12px', fontSize: '12px',
width: '70%' width: '70%',
}} }}
> >
<div style={{ display: 'flex', justifyContent: 'space-between' }}> <div style={{ display: 'flex', justifyContent: 'space-between' }}>
<span style={{ color: '#333' }}>Bill Gross Amount</span> <span style={{ color: '#333' }}>Bill Gross Amount</span>
<strong>{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}</strong> <strong>
{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}
</strong>
</div> </div>
<div <div
style={{ style={{
@ -1182,13 +1250,17 @@ const PaymentPdfBooking = ({
<span>{'Adjustment Amount'}</span> <span>{'Adjustment Amount'}</span>
<span> <span>
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
{Math.abs((lastTransaction?.BeforeAdjustment ?? 0) - {Math.abs(
(lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)} (lastTransaction?.BeforeAdjustment ?? 0) -
(lastTransaction?.AfterAdjustment ?? 0)
).toFixed(2)}
</span> </span>
</div> </div>
<div style={{ display: 'flex', justifyContent: 'space-between' }}> <div style={{ display: 'flex', justifyContent: 'space-between' }}>
<span style={{ color: '#333' }}>Net Bill Amount</span> <span style={{ color: '#333' }}>Net Bill Amount</span>
<strong>{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}</strong> <strong>
{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}
</strong>
</div> </div>
</div> </div>
</div> </div>
@ -1653,7 +1725,9 @@ const PaymentPdfBooking = ({
{/* Token print */} {/* Token print */}
{Object.entries( {Object.entries(
singleData2?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce((acc, item, idx) => { singleData2
?.filter((data) => data?.EditTokenAvailable !== 'N')
?.reduce((acc, item, idx) => {
if (item.TokenAvailable === 'Y') { if (item.TokenAvailable === 'Y') {
if (!item.CounterName) { if (!item.CounterName) {
// For null or empty CounterName, print each item individually // For null or empty CounterName, print each item individually
@ -1696,9 +1770,21 @@ const PaymentPdfBooking = ({
<tr className="Re-print-body-Tr" key={idx}> <tr className="Re-print-body-Tr" key={idx}>
<td className="Re-print-td">{idx + 1}</td> <td className="Re-print-td">{idx + 1}</td>
<td className="Re-print-body-Product">{item.ProdName}</td> <td className="Re-print-body-Product">{item.ProdName}</td>
<td className="Re-print-body-Rate">{item?.EditTokenAvailable === 'Y' ? item?.EditTokenQty : item.SalesQty}</td> <td className="Re-print-body-Rate">
{item?.EditTokenAvailable === 'Y'
? item?.EditTokenQty
: item.SalesQty}
</td>
<td className="Re-print-body-Rate">{item.Rate}</td> <td className="Re-print-body-Rate">{item.Rate}</td>
<td className="Re-print-body-Rate">{((item?.EditTokenAvailable === 'Y' ? item?.EditTokenQty : item.SalesQty) * item.Rate) - ((item?.EditTokenAvailable === 'Y' ? (item?.OfferAmt / item?.EditTokenQty) : item?.OfferAmt))}</td> <td className="Re-print-body-Rate">
{(item?.EditTokenAvailable === 'Y'
? item?.EditTokenQty
: item.SalesQty) *
item.Rate -
(item?.EditTokenAvailable === 'Y'
? item?.OfferAmt / item?.EditTokenQty
: item?.OfferAmt)}
</td>
</tr> </tr>
))} ))}
</tbody> </tbody>

View File

@ -11,9 +11,14 @@ import {
getCommonAppPreference, getCommonAppPreference,
} from './Features/BrachLogin/BranchLogin.js'; } from './Features/BrachLogin/BranchLogin.js';
import { clearSession, getSession } from './Services/Others'; import { clearSession, getSession } from './Services/Others';
import { FeatureAddon } from './Features/BookingScreen/BookingData/BookingData.js'; import {
FeatureAddon,
GlobalFeatAddOnData,
} from './Features/BookingScreen/BookingData/BookingData.js';
import { Suspense } from 'react'; import { Suspense } from 'react';
import { gettableData } from './Features/PreferenceMaster/PreferenceMaster.js'; import { gettableData } from './Features/PreferenceMaster/PreferenceMaster.js';
import { useSelector } from 'react-redux';
import { useTemplate } from './utils/useTemplate.js';
const commonUrl = import.meta.env.ENV_COMMON_BASE_URL; const commonUrl = import.meta.env.ENV_COMMON_BASE_URL;
const subDirectory = import.meta.env.BASE_URL; const subDirectory = import.meta.env.BASE_URL;
@ -29,6 +34,8 @@ const ProtectedRoutes = ({ routesConfig }) => {
const UserId = getSession('UserId'); const UserId = getSession('UserId');
const sessionId = getSession('SessionId'); const sessionId = getSession('SessionId');
const [accessCheckComplete, setAccessCheckComplete] = useState(false); const [accessCheckComplete, setAccessCheckComplete] = useState(false);
const FeatureAddonData = useSelector(GlobalFeatAddOnData);
useTemplate(CompId, BranchId, AppId);
useEffect(() => { useEffect(() => {
getApplicationPreference(); getApplicationPreference();
@ -262,6 +269,9 @@ const ProtectedRoutes = ({ routesConfig }) => {
let featureAddonData; let featureAddonData;
if (UserType !== 'Super Admin' && UserType !== 'Super Admin User') { if (UserType !== 'Super Admin' && UserType !== 'Super Admin User') {
if (FeatureAddonData?.FeatureDtls?.length > 0) {
featureAddonData = FeatureAddonData?.FeatureDtls;
} else {
featureAddon = await dispatch( featureAddon = await dispatch(
FeatureAddon({ AppId: AppId, UserId: UserId }) FeatureAddon({ AppId: AppId, UserId: UserId })
).unwrap(); ).unwrap();
@ -272,12 +282,13 @@ const ProtectedRoutes = ({ routesConfig }) => {
featureAddonData = []; featureAddonData = [];
} }
} }
}
const currentPath = location.pathname.replace(/\/$/, ''); // Remove trailing slash const currentPath = location.pathname.replace(/\/$/, ''); // Remove trailing slash
let shouldNavigate = false; let shouldNavigate = false;
// Find the current route in routesConfig based on currentPath // Find the current route in routesConfig based on currentPath
const currentRoute = routesConfig.find((route) => { const currentRoute = routesConfig?.find((route) => {
if (route.path === currentPath) return true; if (route.path === currentPath) return true;
if (route.children) { if (route.children) {
return route.children.some((child) => { return route.children.some((child) => {
@ -303,7 +314,7 @@ const ProtectedRoutes = ({ routesConfig }) => {
currentRoute, currentRoute,
currentPath currentPath
); );
console.log('empAccessData', empAccessData);
const checkPreferenceAccessData = ['Dine In', 'KOT', 'Estimate']; const checkPreferenceAccessData = ['Dine In', 'KOT', 'Estimate'];
const checkPlanAccessData = [ const checkPlanAccessData = [
'Product Catalogue', 'Product Catalogue',

View File

@ -6,9 +6,13 @@ import {
getAppSubscriptionDate, getAppSubscriptionDate,
} from './Features/BookingScreen/BookingData/BookingData.js'; } from './Features/BookingScreen/BookingData/BookingData.js';
import { sendSms } from './Features/Payment/PaymentDetails/PaymentDetails.js'; import { sendSms } from './Features/Payment/PaymentDetails/PaymentDetails.js';
import {
getPurchasedAppDetails,
postInvoice,
} from './Features/BookingScreen/Pricing/Pricing.js';
import { getSession } from './Services/Others.js'; import { getSession } from './Services/Others.js';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
const subDirectory = import.meta.env.ENV_BASE_URL;
const useSubscriptionManager = (sessionData, logout) => { const useSubscriptionManager = (sessionData, logout) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const navigate = useNavigate(); const navigate = useNavigate();
@ -17,10 +21,13 @@ const useSubscriptionManager = (sessionData, logout) => {
const [extendModel, setExtendModel] = useState(false); const [extendModel, setExtendModel] = useState(false);
const handleCancel = () => { const handleCancel = () => {
logout(); logout();
setExtendModel(false) setExtendModel(false);
};
} const handlePay = () => {
setExtendModel(false);
let AppName = getSession('AppName');
navigate(`${subDirectory}PricingPage`, { state: { AppName: AppName } });
};
function formatDate(date) { function formatDate(date) {
const year = date.getFullYear(); const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); const month = String(date.getMonth() + 1).padStart(2, '0');
@ -33,8 +40,71 @@ const useSubscriptionManager = (sessionData, logout) => {
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}.${milliseconds}`; return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}.${milliseconds}`;
} }
function addDays(dateString, days) {
// Make it ISO-safe for iOS / WebView
const isoDate = dateString.replace(' ', 'T');
const currentDate = new Date(isoDate);
currentDate.setDate(currentDate.getDate() + Number(days));
return formatDate(currentDate);
}
// ---------------- MAIN FUNCTION ----------------
const freeExtend = async () => {
try {
const UserId = getSession('UserId');
const AppId = getSession('AppId');
// Current date
const now = new Date();
const currentDate = formatDate(now);
// 1⃣ Get purchased app details
const response1 = await dispatch(
getPurchasedAppDetails({ AppId, UserId })
).unwrap();
const PurchasedDetails = response1?.data?.data;
if (!PurchasedDetails || !PurchasedDetails.length) {
console.error('No purchased details found');
return;
}
// 2⃣ Prepare post data
const postData = {
UserId: UserId,
AppId: AppId,
PricingId: PurchasedDetails[0]?.PricingId,
PurDate: currentDate,
NoofDays: 30,
PaymentMode: 27,
PaymentStatus: 'S',
LicenseStatus: PurchasedDetails[0]?.LicenseStatus,
Price: PurchasedDetails[0]?.Price ?? 0,
TaxId: PurchasedDetails[0]?.TaxId ?? 0,
NetPrice: PurchasedDetails[0]?.ExistingPlanNetPrice ?? 0,
ValidityStart: currentDate,
ValidityEnd: addDays(currentDate, PurchasedDetails[0]?.NoOfDays),
CreatedBy: UserId,
TaxAmount: PurchasedDetails[0]?.TaxAmount ?? 0,
MobileNo: getSession('MobileNo'),
MailId: 'ts@gmmail.com',
Type: 'FreeExtend',
};
// 3⃣ Post invoice
const response = await dispatch(postInvoice(postData)).unwrap();
// 4⃣ Send SMS if required
if (response?.data?.statusCode === 1 && response?.data?.SMSbody) {
await dispatch(sendSms({ body: response.data.SMSbody }));
setExtendModel(false);
}
} catch (error) {
console.error('freeExtend error:', error);
}
};
useEffect(() => { useEffect(() => {
if (!sessionData) return; if (!sessionData) return;
@ -62,23 +132,20 @@ const useSubscriptionManager = (sessionData, logout) => {
expData.RemainingSeconds < 1 && expData.RemainingSeconds < 1 &&
UserType !== 'Super Admin' UserType !== 'Super Admin'
) { ) {
if ( if (
(UserType !== 'Super Admin' || (UserType !== 'Super Admin' || UserType !== 'Super Admin User') &&
UserType !== 'Super Admin User') && (expData?.PlanType?.toLowerCase() == "extend expired") expData?.PlanType?.toLowerCase() == 'extend expired'
) { ) {
console.log('Subscription expired, logging out...'); console.log('Subscription expired, logging out...');
alert('Subscription expired'); alert('Subscription expired');
logout(); logout();
} } else if (
else if ( (UserType !== 'Super Admin' || UserType !== 'Super Admin User') &&
(UserType !== 'Super Admin' || expData?.PlanType?.toLowerCase() == 'plan expired'
UserType !== 'Super Admin User') && (expData?.PlanType?.toLowerCase() == "plan expired")
) { ) {
setExtendModel(true) setExtendModel(true);
} }
} }
} }
}; };
@ -87,7 +154,7 @@ const useSubscriptionManager = (sessionData, logout) => {
return () => clearInterval(interval); return () => clearInterval(interval);
}, [sessionData]); }, [sessionData]);
return { remainingDays, handleCancel,extendModel,setExtendModel }; return { remainingDays, handleCancel, handlePay, freeExtend, extendModel };
}; };
export default useSubscriptionManager; export default useSubscriptionManager;

18
src/utils/useTemplate.js Normal file
View File

@ -0,0 +1,18 @@
import { useEffect } from 'react';
import { useDispatch } from 'react-redux';
import { getTemplate } from '../Features/ThemeChange/ThemeChange.js';
export const useTemplate = (CompId, BranchId, AppId) => {
const dispatch = useDispatch();
useEffect(() => {
const fetchTemplate = async () => {
try {
await dispatch(getTemplate({ CompId, BranchId, AppId })).unwrap();
} catch (error) {
console.error('Failed to fetch template:', error);
}
};
fetchTemplate();
}, [dispatch, CompId, BranchId, AppId]);
};