From e69d2844ff110b89ef26a52ec5e1b28aef019a9a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Mar 2026 14:06:01 +0530 Subject: [PATCH 01/17] tax, layout card, access based menu warehouse bug fix --- src/App.jsx | 85 +++++++----------- .../BookingScreen/BookingData/BookingData.js | 16 ++-- .../BSCategories/BSCategoryHorizontal.jsx | 82 +++++++++--------- .../LayoutSubCategoryFetcher.jsx | 9 ++ src/Pages/OtherServices/OtherServicesForm.jsx | 6 +- src/utils/useDevToolsDetection.js | 86 ------------------- 6 files changed, 95 insertions(+), 189 deletions(-) delete mode 100644 src/utils/useDevToolsDetection.js diff --git a/src/App.jsx b/src/App.jsx index f746608..0aaeab3 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -26,7 +26,6 @@ import useSubscriptionManager from './useSubscriptionManager.js'; import useSessionManager from './useSessionManager.js'; import ExtendSubscriptionModal from './Pages/ExtentedModal/ExtendSubscriptionModal.jsx'; import devtools from 'devtools-detect'; -import { useDevToolsDetection } from './utils/useDevToolsDetection.js'; const isCapacitor = () => !!window.Capacitor?.isNativePlatform?.(); @@ -172,66 +171,46 @@ const AppRoutes = () => { }; }, [navigate, location.pathname, location.search]); // mohan - // useEffect(() => { - // if (isMobile || isIOS) { - // console.log('📱 Mobile/iOS device → skipping DevTools detection'); - // return; - // } - // const checkDevTools = setInterval(() => { - // if (devtools.isOpen && !devToolsOpen) { - // setDevToolsOpen(true); - // document.body.innerHTML = - // "

Close Inspect to continue using the application.

"; - // } else if (!devtools.isOpen && devToolsOpen) { - // setDevToolsOpen(false); + useEffect(() => { + if (isMobile || isIOS) { + console.log('📱 Mobile/iOS device → skipping DevTools detection'); + return; + } + const checkDevTools = setInterval(() => { + if (devtools.isOpen && !devToolsOpen) { + setDevToolsOpen(true); + document.body.innerHTML = + "

Close Inspect to continue using the application.

"; + } else if (!devtools.isOpen && devToolsOpen) { + setDevToolsOpen(false); - // setTimeout(() => { - // window.location.reload(); - // }, 100); + setTimeout(() => { + window.location.reload(); + }, 100); - // clearInterval(checkDevTools); - // } + clearInterval(checkDevTools); + } - // if (!devtools.isOpen) { - // let before = performance.now(); + if (!devtools.isOpen) { + let before = performance.now(); - // let after = performance.now(); + let after = performance.now(); - // let executionDelay = after - before; + let executionDelay = after - before; - // if (executionDelay > 100) { - // setDevToolsOpen(true); - // document.body.innerHTML = - // "

Close Inspect to continue using the application.

"; - // } else { - // setDevToolsOpen(false); - // } - // } - // }, 1000); + if (executionDelay > 100) { + setDevToolsOpen(true); + document.body.innerHTML = + "

Close Inspect to continue using the application.

"; + } else { + setDevToolsOpen(false); + } + } + }, 1000); - // return () => clearInterval(checkDevTools); - // }, [devToolsOpen]); - const isBlocked = useDevToolsDetection(() => { - // optional: log, notify, etc. - console.warn('DevTools detected'); - }); + return () => clearInterval(checkDevTools); + }, [devToolsOpen]); - if (isBlocked) { - return ( -
-

- DevTools detected. Please close it to continue. -

-
- ); - } if (extendModel) { return ( { - if (action?.payload?.data?.statusCode === 1) { - state.AppExpDateData = - action?.payload?.data?.data?.[0]|| {}; - } else { - state.AppExpDateData = {}; - } + builder.addCase(getAppSubscriptionDate.fulfilled, (state, action) => { + if (action?.payload?.data?.statusCode === 1) { + state.AppExpDateData = + action?.payload?.data?.data?.[0] || {}; + } else { + state.AppExpDateData = {}; + } }); - + }, }); diff --git a/src/Pages/BookingScreen/Components/BSCategories/BSCategoryHorizontal.jsx b/src/Pages/BookingScreen/Components/BSCategories/BSCategoryHorizontal.jsx index 459e1ad..60537fc 100644 --- a/src/Pages/BookingScreen/Components/BSCategories/BSCategoryHorizontal.jsx +++ b/src/Pages/BookingScreen/Components/BSCategories/BSCategoryHorizontal.jsx @@ -534,10 +534,14 @@ function BSCategoryHorizontal(props) { } } else { // 2 or more items, always show - setSubCat(true); + if (FavSelected) { + setSubCat(false); + } else { + setSubCat(true); + } } } - }, [SubcategorieData, templateData]); + }, [SubcategorieData, templateData, FavSelected]); useEffect(() => { if (typeof searchData === 'string' && categoryData?.length > 0) { @@ -608,9 +612,9 @@ function BSCategoryHorizontal(props) { AppId: AppId, ...(AvailableDate && selectedDate ? { - fromDate: selectedDate?.[0], - toDate: selectedDate?.[1], - } + fromDate: selectedDate?.[0], + toDate: selectedDate?.[1], + } : {}), }; @@ -647,9 +651,9 @@ function BSCategoryHorizontal(props) { AppId: AppId, ...(AvailableDate && selectedDate ? { - fromDate: selectedDate?.[0], - toDate: selectedDate?.[1], - } + fromDate: selectedDate?.[0], + toDate: selectedDate?.[1], + } : {}), }; let res = await dispatch(getSelectedFavItems(data)).unwrap(); @@ -886,9 +890,9 @@ function BSCategoryHorizontal(props) { backgroundColor: !accessOther && accessToCard ? lightenColor( - SelectedCatgColor?.['BackgroundColor'], - 0.4 - ) + SelectedCatgColor?.['BackgroundColor'], + 0.4 + ) : SelectedCatgColor?.['BackgroundColor'], padding: padding, border: accessToCard ? '1px solid' : undefined, @@ -899,9 +903,9 @@ function BSCategoryHorizontal(props) { : SelectedCatgColor?.['BackgroundColor'] === '#000000' ? '#ffffff' : darkenColor( - SelectedCatgColor?.['BackgroundColor'], - 70 - ) + SelectedCatgColor?.['BackgroundColor'], + 70 + ) : undefined, }} className="sampleCard" @@ -935,9 +939,9 @@ function BSCategoryHorizontal(props) { backgroundColor: !accessOther && !accessToCard && -2 == indexval ? lightenColor( - SelectedCatgColor?.['BackgroundColor'], - 0.4 - ) + SelectedCatgColor?.['BackgroundColor'], + 0.4 + ) : SelectedCatgColor?.['BackgroundColor'], padding: padding, border: @@ -983,9 +987,9 @@ function BSCategoryHorizontal(props) { ? index != indexval ? SelectedCatgColor?.['BackgroundColor'] : lightenColor( - SelectedCatgColor?.['BackgroundColor'], - 0.4 - ) + SelectedCatgColor?.['BackgroundColor'], + 0.4 + ) : SelectedCatgColor?.['BackgroundColor'], padding: padding, border: '1px solid', @@ -1088,11 +1092,11 @@ function BSCategoryHorizontal(props) { ? index !== indexval ? SelectedCatgColor?.['BackgroundColor'] : lightenColor( - SelectedCatgColor?.[ - 'BackgroundColor' - ], - 0.4 - ) + SelectedCatgColor?.[ + 'BackgroundColor' + ], + 0.4 + ) : SelectedCatgColor?.['BackgroundColor'], padding: padding, border: '1px solid', @@ -1100,18 +1104,18 @@ function BSCategoryHorizontal(props) { index !== indexval ? SelectedCatgColor?.['BackgroundColor'] : SelectedCatgColor?.['BackgroundColor'] === - '#ffffff' + '#ffffff' ? '#000000' : SelectedCatgColor?.[ - 'BackgroundColor' - ] === '#000000' + 'BackgroundColor' + ] === '#000000' ? '#ffffff' : darkenColor( - SelectedCatgColor?.[ - 'BackgroundColor' - ], - 70 - ), + SelectedCatgColor?.[ + 'BackgroundColor' + ], + 70 + ), userSelect: 'none', minWidth: 'max-content', // set a width if needed }} @@ -1170,16 +1174,16 @@ function BSCategoryHorizontal(props) { backgroundColor: !accessOther && accessToCard ? lightenColor( - SelectedCatgColor?.['BackgroundColor'], - 0.4 - ) + SelectedCatgColor?.['BackgroundColor'], + 0.4 + ) : SelectedCatgColor?.['BackgroundColor'], padding: padding, border: accessToCard && '1px solid', borderColor: accessToCard && - !accessOther && - SelectedCatgColor?.['BackgroundColor'] == '#ffffff' + !accessOther && + SelectedCatgColor?.['BackgroundColor'] == '#ffffff' ? '#000000' : SelectedCatgColor?.['BackgroundColor'] === '#000000' ? '#ffffff' @@ -1219,7 +1223,7 @@ function BSCategoryHorizontal(props) { border: accessOther && '1px solid', borderColor: accessOther && - SelectedCatgColor?.['BackgroundColor'] == '#ffffff' + SelectedCatgColor?.['BackgroundColor'] == '#ffffff' ? '#000000' : SelectedCatgColor?.['BackgroundColor'] === '#000000' ? '#ffffff' diff --git a/src/Pages/BookingScreen/LayoutSubCategoryFetcher.jsx b/src/Pages/BookingScreen/LayoutSubCategoryFetcher.jsx index ca47f77..7369e40 100644 --- a/src/Pages/BookingScreen/LayoutSubCategoryFetcher.jsx +++ b/src/Pages/BookingScreen/LayoutSubCategoryFetcher.jsx @@ -1,7 +1,9 @@ import { useEffect } from 'react'; import { useSelector, useDispatch, shallowEqual } from 'react-redux'; import { + ChangeSubcategoryData, getLayoutSubCategories, + GlobalisFavClicked, GlobalProductCategorie, } from '../../Features/BookingScreen/BookingData/BookingData'; import { getTemplateData } from '../../Features/ThemeChange/ThemeChange'; @@ -12,6 +14,7 @@ const LayoutSubCategoryFetcher = () => { const ProdCat = useSelector(GlobalProductCategorie, shallowEqual); const templateData = useSelector(getTemplateData, shallowEqual); + const favSelected = useSelector(GlobalisFavClicked); const CompId = getSession('CompId'); const BranchId = getSession('BranchId'); @@ -23,6 +26,11 @@ const LayoutSubCategoryFetcher = () => { const isCategory5 = templateData?.BookingCategory?.[0] === 'Category5'; const isLayout2 = templateData?.BookingLayout?.[0] === 'Layout2'; + if (favSelected) { + dispatch(ChangeSubcategoryData([])); + return + } + if (isCategory5 && isLayout2) { dispatch( getLayoutSubCategories({ @@ -37,6 +45,7 @@ const LayoutSubCategoryFetcher = () => { ProdCat, templateData?.BookingCategory?.[0], templateData?.BookingLayout?.[0], + favSelected ]); return null; // this component renders nothing diff --git a/src/Pages/OtherServices/OtherServicesForm.jsx b/src/Pages/OtherServices/OtherServicesForm.jsx index d6b4493..bd32f2f 100644 --- a/src/Pages/OtherServices/OtherServicesForm.jsx +++ b/src/Pages/OtherServices/OtherServicesForm.jsx @@ -49,7 +49,7 @@ const OtherServices = ({ formType }) => { const AppId = getSession('AppId'); const UserId = getSession('UserId'); - console.log(SelectedCategory, 'SelectedCategory'); + console.log(TaxData, 'TaxData'); const items = [ { name: 'Home', @@ -435,8 +435,8 @@ const OtherServices = ({ formType }) => { ({ - value: option.TaxId, - label: option.TaxIdName, + value: option?.TaxId, + label: `${option?.TaxIdName} - ${option?.TaxPercentage}%`, })), ]} label="Tax" diff --git a/src/utils/useDevToolsDetection.js b/src/utils/useDevToolsDetection.js deleted file mode 100644 index 51265e0..0000000 --- a/src/utils/useDevToolsDetection.js +++ /dev/null @@ -1,86 +0,0 @@ -const DevToolsDetector = { - checkWindowSize() { - const threshold = 160; - return ( - window.outerWidth - window.innerWidth > threshold || - window.outerHeight - window.innerHeight > threshold - ); - }, - - checkConsole() { - let detected = false; - const element = new Image(); - Object.defineProperty(element, 'id', { - get: () => { detected = true; } - }); - console.log('%c', element); - console.clear(); - return detected; - }, - - checkDebugger() { - if (import.meta.env.DEV) return false; - const start = performance.now(); - // eslint-disable-next-line no-debugger - debugger; - const end = performance.now(); - return end - start > 100; - }, - - checkToString() { - let detected = false; - const div = document.createElement('div'); - Object.defineProperty(div, 'id', { - get: function () { - detected = true; - return 'id'; - } - }); - console.log(div); - console.clear(); - return detected; - }, - - detect() { - return ( - this.checkWindowSize() || - this.checkConsole() || - this.checkDebugger() || - this.checkToString() - ); - } -}; - -export default DevToolsDetector; - - - -import { useEffect, useState } from 'react'; - -const isMobileOrIOS = () => - /iPhone|iPad|iPod|Android/i.test(navigator.userAgent); - -export const useDevToolsDetection = (onDetected) => { - const [isBlocked, setIsBlocked] = useState(false); - - useEffect(() => { - if (isMobileOrIOS()) return; - - const interval = setInterval(() => { - const detected = DevToolsDetector.detect(); - - if (detected && !isBlocked) { - setIsBlocked(true); - onDetected?.(); - } else if (!detected && isBlocked) { - setIsBlocked(false); - clearInterval(interval); - setTimeout(() => window.location.reload(), 100); - } - }, 1000); - - return () => clearInterval(interval); - }, [isBlocked]); - - return isBlocked; -}; \ No newline at end of file From 1613525057b36342ddfdeaae40f46d4e89ac4163 Mon Sep 17 00:00:00 2001 From: vignesh Date: Wed, 25 Mar 2026 14:49:37 +0530 Subject: [PATCH 02/17] Issues Solved --- src/Components/PozoAppLoader/PozoLoader2.jsx | 2 +- .../Automated Reorder/AutomatedReorder.scss | 12 +- .../AutomatedReorderList.jsx | 666 +++++------ .../Components/BSItemCards/BSItemCard.jsx | 1027 ++++++++--------- .../Template/BSLayout4/BSLayout4.jsx | 18 +- src/Pages/CustomerMaster/CustMasterList.jsx | 34 +- src/Pages/Product/ExcelUpload.jsx | 369 ++---- src/Pages/Product/ProductList.jsx | 2 +- .../Components/BSItemCards/BSItemCard.scss | 5 +- src/Styles/OverAllStyle/OverAllStyle.scss | 14 + src/Styles/Product/excel.scss | 102 +- 11 files changed, 1117 insertions(+), 1134 deletions(-) diff --git a/src/Components/PozoAppLoader/PozoLoader2.jsx b/src/Components/PozoAppLoader/PozoLoader2.jsx index 0801ef9..6b08056 100644 --- a/src/Components/PozoAppLoader/PozoLoader2.jsx +++ b/src/Components/PozoAppLoader/PozoLoader2.jsx @@ -262,7 +262,7 @@ const styles = { status: { marginTop: '6px', - fontSize: '0.7rem', + fontSize: '0.6rem', fontWeight: 600, letterSpacing: '4px', textTransform: 'uppercase', diff --git a/src/Pages/Automated Reorder/AutomatedReorder.scss b/src/Pages/Automated Reorder/AutomatedReorder.scss index 083b4a9..903a74f 100644 --- a/src/Pages/Automated Reorder/AutomatedReorder.scss +++ b/src/Pages/Automated Reorder/AutomatedReorder.scss @@ -3,7 +3,7 @@ height: 90vh; overflow: auto; scrollbar-width: thin; - font-family: 'Poppins'; + font-family: "Poppins"; .automated-reorder-content { padding-top: 18px; @@ -51,4 +51,12 @@ padding: 6px !important; } } -} \ No newline at end of file +} + +.automated-reorder-list-content { + .eyeopenShow { + display: flex; + align-items: center; + justify-content: center; + } +} diff --git a/src/Pages/Automated Reorder/AutomatedReorderList.jsx b/src/Pages/Automated Reorder/AutomatedReorderList.jsx index 91d43bc..db7e7db 100644 --- a/src/Pages/Automated Reorder/AutomatedReorderList.jsx +++ b/src/Pages/Automated Reorder/AutomatedReorderList.jsx @@ -1,345 +1,359 @@ -import { useCallback, useEffect, useState } from "react"; -import { useDispatch } from "react-redux"; -import { getSession } from "../../Services/Others"; -import { changeBreadCrumb, getEmpAccess } from "../../Features/AppPage/CenterPage"; -import { Messages } from "../../Components/Notifications/Messages"; -import { Tables } from "../../Components/Tables/Table"; -import FormHeader from "../PageComponents/FormHeader"; -import Search from "../../Components/Forms/Search"; -import Buttons from "../../Components/Forms/Buttons"; +import { useCallback, useEffect, useState } from 'react'; +import { useDispatch } from 'react-redux'; +import { getSession } from '../../Services/Others'; import { - EditFilled, - DeleteFilled, - PlusOutlined, - ReloadOutlined, + changeBreadCrumb, + getEmpAccess, +} from '../../Features/AppPage/CenterPage'; +import { Messages } from '../../Components/Notifications/Messages'; +import { Tables } from '../../Components/Tables/Table'; +import FormHeader from '../PageComponents/FormHeader'; +import Search from '../../Components/Forms/Search'; +import Buttons from '../../Components/Forms/Buttons'; +import { + EditFilled, + DeleteFilled, + PlusOutlined, + ReloadOutlined, } from '@ant-design/icons'; -import { useLocation, useNavigate } from "react-router-dom"; -import { Space, Tooltip } from "antd"; -import { deleteAutomatedReorder, getAutomatedReorderList } from "../../Features/PurchaseOrder/PurchaseOrder"; -import { DefaultModal } from "../../Components/Modal/DefaultModal"; -import { FaRegEye } from "react-icons/fa"; -import { render } from "react-dom"; -import { useAuth } from "../../AuthContext"; -import "./AutomatedReorder.scss"; +import { useLocation, useNavigate } from 'react-router-dom'; +import { Space, Tooltip } from 'antd'; +import { + deleteAutomatedReorder, + getAutomatedReorderList, +} from '../../Features/PurchaseOrder/PurchaseOrder'; +import { DefaultModal } from '../../Components/Modal/DefaultModal'; +import { FaRegEye } from 'react-icons/fa'; +import { render } from 'react-dom'; +import { useAuth } from '../../AuthContext'; +import './AutomatedReorder.scss'; const subDirectory = import.meta.env.BASE_URL; const items = [ - { - name: 'Home', - link: `${subDirectory}app-page/home`, - }, - { - name: 'Automated Reorder', - link: `${subDirectory}setting/automated-reorder`, - }, + { + name: 'Home', + link: `${subDirectory}app-page/home`, + }, + { + name: 'Automated Reorder', + link: `${subDirectory}setting/automated-reorder`, + }, ]; - - const AutomatedReorderList = () => { - const dispatch = useDispatch(); - const navigate = useNavigate(); - const location = useLocation(); - const state = location?.state; - const { SadminuserAccess } = useAuth(); - let SAAccessCommonMaster = SadminuserAccess?.find( - (e) => e?.MenuName === 'Product Receipt' + const dispatch = useDispatch(); + const navigate = useNavigate(); + const location = useLocation(); + const state = location?.state; + const { SadminuserAccess } = useAuth(); + let SAAccessCommonMaster = SadminuserAccess?.find( + (e) => e?.MenuName === 'Product Receipt' + ); + + const AppId = getSession('AppId'); + const CompId = getSession('CompId'); + const BranchId = getSession('BranchId'); + const UserId = getSession('UserId'); + const UserType = getSession('UserType'); + const [empData, setEmpData] = useState(); + const [addnewAccess, setaddnewAccess] = useState(true); + + const [messageType, setMessageType] = useState(null); + const [messageData, setMessageData] = useState(null); + const [supplierModalOpen, setSupplierModalOpen] = useState(false); + const [supplierRecords, setSupplierRecords] = useState([]); + const [supplierRecordIndex, setSupplierRecordIndex] = useState(null); + const [page, setPage] = useState(1); + + const [searchedText, setSearchedText] = useState(''); + const [tableData, setTableData] = useState([]); + + const columns = [ + { + title: 'SL.NO', + dataIndex: 'SLNO', + key: 'SLNO', + width: '10%', + render: (_, record, index) => index + 1, + align: 'center', + }, + { + title: 'Product Name', + dataIndex: 'ProdName', + key: 'ProdName', + render: (_, record) => `${record.ProdName} (${record.UOMName})`, + }, + { + title: 'Supplier', + dataIndex: 'Supplier', + key: 'Supplier', + align: 'center', + render: (_, record, index) => ( + //
+ +
+ { + setSupplierModalOpen(true); + setSupplierRecords(record.SupplierDetails); + setSupplierRecordIndex(index); + }} + /> +
+
+ ), + }, + { + title: 'Order Type', + dataIndex: 'OrderType', + key: 'OrderType', + render: (_, record, index) => + record.OrderType === 'E' ? 'End of Day (EOD)' : 'Immediate', + }, + { + title: 'Confirmation Type', + dataIndex: 'OrderProcessing', + key: 'OrderProcessing', + render: (_, record, index) => + record.OrderProcessing === 'Y' ? 'Need Confirmation' : 'Auto', + }, + { + title: 'Reorder Quantity', + dataIndex: 'OrderQty', + key: 'OrderQty', + align: 'center', + }, + { + title: 'Action', + dataIndex: 'Action', + key: 'Action', + width: '100px', + align: 'center', + render: (_, record, index) => + record.ActiveStatus === 'A' ? ( +
+ handleEdit(record)} + /> + handleActiveAndDeactive(record)} + /> +
+ ) : ( + handleActiveAndDeactive(record)} + /> + ), + }, + ]; + + const supplierColumns = [ + { + title: 'SL.NO', + dataIndex: 'SLNO', + key: 'SLNO', + width: '10%', + render: (_, record, index) => index + 1, + }, + { + title: 'Supplier Name', + dataIndex: 'SuppName', + key: 'SuppName', + width: '20%', + }, + ]; + + useEffect(() => { + try { + if (AppId && CompId && BranchId) { + dispatch(changeBreadCrumb({ items: items })); + fetchData(); + if (state?.Notify) { + setMessageType(state?.Notify.messageType); + setMessageData(state?.Notify.messageData); + } + } + } catch (error) { + console.error(error, 'error: changeBreadCrumb'); + } + }, [AppId, CompId, BranchId]); + + useEffect(() => { + if (UserType === 'Employee') { + fetchApi(); + } + }, [UserType]); + + useEffect(() => { + let hasAccess = false; + + if (UserType === 'Admin' || UserType === 'Super Admin') { + hasAccess = true; + } else if (UserType === 'Employee') { + hasAccess = empData?.AddAccess === 'Y'; + } else if (UserType === 'Super Admin User') { + hasAccess = SAAccessCommonMaster?.AddAccess === 'Y'; + } + + setaddnewAccess(!hasAccess); + }, [empData, SAAccessCommonMaster, UserType]); + + const fetchApi = async () => { + let data = { + CompId: CompId, + BranchId: BranchId, + AppId: AppId, + EmpId: UserId, + }; + let response = await dispatch(getEmpAccess(data)).unwrap(); + let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter( + (item) => item.ConfigName === 'Automated Reorder' ); + setEmpData(datas?.[0]); + }; - const AppId = getSession('AppId'); - const CompId = getSession('CompId'); - const BranchId = getSession('BranchId'); - const UserId = getSession('UserId'); - const UserType = getSession('UserType'); - const [empData, setEmpData] = useState(); - const [addnewAccess, setaddnewAccess] = useState(true); - - const [messageType, setMessageType] = useState(null); - const [messageData, setMessageData] = useState(null); - const [supplierModalOpen, setSupplierModalOpen] = useState(false); - const [supplierRecords, setSupplierRecords] = useState([]); - const [supplierRecordIndex, setSupplierRecordIndex] = useState(null); - const [page, setPage] = useState(1); - - - const [searchedText, setSearchedText] = useState(''); - const [tableData, setTableData] = useState([]); - - const columns = [ - { - title: 'SL.NO', - dataIndex: 'SLNO', - key: 'SLNO', - width: '10%', - render: (_, record, index) => index + 1, - align: 'center', - }, - { - title: 'Product Name', - dataIndex: 'ProdName', - key: 'ProdName', - render: (_, record) => ( - `${record.ProdName} (${record.UOMName})` - ) - }, - { - title: 'Supplier', - dataIndex: 'Supplier', - key: 'Supplier', - align: 'center', - render: (_, record, index) => ( - //
- -
- { - setSupplierModalOpen(true); - setSupplierRecords(record.SupplierDetails); - setSupplierRecordIndex(index); - }} - /> -
-
- ), - }, - { - title: 'Order Type', - dataIndex: 'OrderType', - key: 'OrderType', - render: (_, record, index) => ( - record.OrderType === 'E' ? 'End of Day (EOD)' : 'Immediate' - ) - }, - { - title: 'Confirmation Type', - dataIndex: 'OrderProcessing', - key: 'OrderProcessing', - render: (_, record, index) => ( - record.OrderProcessing === 'Y' ? 'Need Confirmation' : 'Auto' - ) - }, - { - title: 'Reorder Quantity', - dataIndex: 'OrderQty', - key: 'OrderQty', - align: 'center', - }, - { - title: 'Action', - dataIndex: 'Action', - key: 'Action', - width: '100px', - align: 'center', - render: (_, record, index) => ( - - record.ActiveStatus === 'A' ? ( -
- handleEdit(record)} - /> - handleActiveAndDeactive(record)} - /> -
- ) : ( - handleActiveAndDeactive(record)} - /> - ) - ), - }, - ]; - - const supplierColumns = [ - { - title: 'SL.NO', - dataIndex: 'SLNO', - key: 'SLNO', - width: '10%', - render: (_, record, index) => index + 1 - }, - { - title: 'Supplier Name', - dataIndex: 'SuppName', - key: 'SuppName', - width: '20%', - } - ]; - - useEffect(() => { - try { - if (AppId && CompId && BranchId) { - dispatch(changeBreadCrumb({ items: items })); - fetchData() - if (state?.Notify) { - setMessageType(state?.Notify.messageType); - setMessageData(state?.Notify.messageData); - } - } - } catch (error) { - console.error(error, 'error: changeBreadCrumb'); - } - }, [AppId, CompId, BranchId]); - - useEffect(() => { - if (UserType === 'Employee') { - fetchApi(); - } - }, [UserType]); - - useEffect(() => { - let hasAccess = false; - - if (UserType === 'Admin' || UserType === 'Super Admin') { - hasAccess = true; - } else if (UserType === 'Employee') { - hasAccess = empData?.AddAccess === 'Y'; - } else if (UserType === 'Super Admin User') { - hasAccess = SAAccessCommonMaster?.AddAccess === 'Y'; - } - - setaddnewAccess(!hasAccess); - }, [empData, SAAccessCommonMaster, UserType]); - - const fetchApi = async () => { - let data = { - CompId: CompId, - BranchId: BranchId, - AppId: AppId, - EmpId: UserId, - }; - let response = await dispatch(getEmpAccess(data)).unwrap(); - let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter( - (item) => item.ConfigName === 'Automated Reorder' - ); - setEmpData(datas?.[0]); - }; - - const fetchData = async () => { - try { - const res = await dispatch(getAutomatedReorderList({ AppId, CompId, BranchId }))?.unwrap(); - if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) { - setTableData(res?.data?.data) - } else { - setTableData([]) - } - } catch (error) { - console.error(error, 'error: getAutomatedReorderList'); - } + const fetchData = async () => { + try { + const res = await dispatch( + getAutomatedReorderList({ AppId, CompId, BranchId }) + )?.unwrap(); + if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) { + setTableData(res?.data?.data); + } else { + setTableData([]); + } + } catch (error) { + console.error(error, 'error: getAutomatedReorderList'); } + }; - const onSearch = (value) => { - setSearchedText(value); - }; - const onSearchChange = (e) => { - setSearchedText(e?.target?.value); - }; + const onSearch = (value) => { + setSearchedText(value); + }; + const onSearchChange = (e) => { + setSearchedText(e?.target?.value); + }; - const handleAdd = () => { - navigate(`${subDirectory}setting/automated-reorder/new`); + const handleAdd = () => { + navigate(`${subDirectory}setting/automated-reorder/new`); + }; + + const handleEdit = (record) => { + navigate(`${subDirectory}setting/automated-reorder/update`, { + state: { + editstate: record, + }, + }); + }; + const handleActiveAndDeactive = async (record) => { + const res = await dispatch( + deleteAutomatedReorder({ + UniqueId: record?.UniqueId, + UpdatedBy: UserId, + ActiveStatus: record?.ActiveStatus === 'A' ? 'D' : 'A', + }) + )?.unwrap(); + if (res?.data?.statusCode === 1) { + setMessageType('success'); + setMessageData( + record?.ActiveStatus === 'A' + ? 'Deactivated Successfully' + : 'Activated Successfully' + ); + fetchData(); + } else { + setMessageType('error'); + setMessageData(res?.data?.message); } + }; - const handleEdit = (record) => { - navigate(`${subDirectory}setting/automated-reorder/update`, { - state: { - editstate: record, - } - }); - } - const handleActiveAndDeactive = async (record) => { - const res = await dispatch(deleteAutomatedReorder({ UniqueId: record?.UniqueId, UpdatedBy: UserId, ActiveStatus: record?.ActiveStatus === 'A' ? 'D' : 'A' }))?.unwrap(); - if (res?.data?.statusCode === 1) { - setMessageType('success'); - setMessageData(record?.ActiveStatus === 'A' ? 'Deactivated Successfully' : 'Activated Successfully'); - fetchData(); - } else { - setMessageType('error'); - setMessageData(res?.data?.message); - } - } + const onComplete = useCallback(() => { + setMessageType(null); + setMessageData(null); + }, []); + const handlePageChange = (current) => { + setPage(current); + }; - const onComplete = useCallback(() => { - setMessageType(null); - setMessageData(null); - }, []); - const handlePageChange = (current) => { - setPage(current); - }; - - return ( -
- -
-
-
-
- -
-
-
- -
- } - /> -
-
-
-
- -
+ return ( +
+ +
+
+
+
+
- { - setSupplierModalOpen(false); - setSupplierRecords(null); - setSupplierRecordIndex(null); - }} - children={ -
- -
- } - /> -
- ) -} +
+
+ +
+ } + /> +
+
+
+
+ +
+
+ { + setSupplierModalOpen(false); + setSupplierRecords(null); + setSupplierRecordIndex(null); + }} + children={ +
+ +
+ } + /> + + ); +}; -export default AutomatedReorderList \ No newline at end of file +export default AutomatedReorderList; diff --git a/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx b/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx index 364d2e3..956573b 100644 --- a/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx +++ b/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx @@ -120,7 +120,10 @@ import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLo import { useDateStore } from '../../../../Features/BookingScreen/BookingData/DateStore.js'; import AddProduct from '../../../../Components/AddProduct/AddProduct.jsx'; import { MdOutlineAddShoppingCart } from 'react-icons/md'; -import { bulkpostdata, getUomData } from '../../../../Features/ProductPage/ProductPage.js'; +import { + bulkpostdata, + getUomData, +} from '../../../../Features/ProductPage/ProductPage.js'; import ProductPriceChange from '../UtillComponents/ProductPriceChange.jsx'; import ExpireConfirmModal from '../BookingFunctionality/ExpireConfirmModal.jsx'; import { calculateOverAllQtyLimit } from '../../../../utils/calculations.js'; @@ -162,7 +165,7 @@ export function SortableCard({ id, children, item }) { const BSItemCard = (props) => { const cardFunction = props?.cardFunctionality; - const { connectingState = null, setConnectingState = () => { } } = props; + const { connectingState = null, setConnectingState = () => {} } = props; console.log(connectingState?.positionChange, 'positionChange'); // const applyOffer = useApplyOfferto_CardDetail(); const preferenceDatas = useSelector(PreferenceData, shallowEqual); @@ -638,7 +641,7 @@ const BSItemCard = (props) => { WithoutTaxRate: availableFreeQty * item.OrderRate - (availableFreeQty * item.OrderRate * item.TaxPercentage) / - 100, + 100, Offer: availableFreeQty * item.OrderRate, }; @@ -687,7 +690,7 @@ const BSItemCard = (props) => { ((existingPaidItem.OrderQty + excessQty) * item.OrderRate * item.TaxPercentage) / - 100, + 100, }; ModifiedData.push(mergedPaidItem); @@ -722,7 +725,7 @@ const BSItemCard = (props) => { data?.InwardDtlId === item?.InwardDtlId && data?.ProdId === item?.ProdId && data?.OfferMessage?.[0]?.OfferId === - item?.OfferMessage?.[0]?.OfferId + item?.OfferMessage?.[0]?.OfferId ); if (isAlreadyExists !== -1) { @@ -742,11 +745,11 @@ const BSItemCard = (props) => { ).toFixed(2), WithoutTaxRate: (ModifiedData[isAlreadyExists].OrderQty + item.OrderQty) * - item.OrderRate - + item.OrderRate - ((ModifiedData[isAlreadyExists].OrderQty + item.OrderQty) * item.OrderRate * item.TaxPercentage) / - 100, + 100, Offer: (ModifiedData[isAlreadyExists].OrderQty + item.OrderQty) * item.OrderRate, @@ -772,10 +775,10 @@ const BSItemCard = (props) => { const appliedOfferAlreadyExists = AppliedOffers.findIndex( (offer) => offer?.FreeProductsList?.FreeProdId === - matchingFreeProduct?.FreeProdId && + matchingFreeProduct?.FreeProdId && offer?.TableName === matchingFreeProduct?.TableName && offer?.TableUniqueName === - matchingFreeProduct?.TableUniqueName && + matchingFreeProduct?.TableUniqueName && offer?.OfferId === matchingFreeProduct?.OfferId && offer?.OfferMode === matchingFreeProduct?.OfferMode && offer?.FreeProductsList?.ProdVariantDetails?.[0] @@ -978,7 +981,6 @@ const BSItemCard = (props) => { await dispatch( getOfferinBooking({ AppId: AppId, CompId: CompId, BranchId: BranchId }) ).unwrap(); - } useEffect(() => { @@ -1022,7 +1024,7 @@ const BSItemCard = (props) => { ? [] : SelectedDatas : ItemCard?.length == 0 || - (ItemCard?.[0]?.AppId === 0 && ItemCard?.[0]?.CompId === 0) + (ItemCard?.[0]?.AppId === 0 && ItemCard?.[0]?.CompId === 0) ? noSubcatCardData : ItemCard : ''; @@ -1056,8 +1058,7 @@ const BSItemCard = (props) => { if (AppId && CompId && BranchId) { fetchedit(); GetmultipleSearchData(); - getUom() - + getUom(); } // dispatch(changepreOrder(false)); Commented to Add Normal Produts After Adding the Combo Pack !!!!!! Dont Touch Without Shifayath Permission @@ -1065,7 +1066,7 @@ const BSItemCard = (props) => { const getUom = () => { dispatch(getUomData()); - } + }; const GetmultipleSearchData = async () => { const data = { @@ -1133,14 +1134,14 @@ const BSItemCard = (props) => { ProdSubCat: ProdSubCat, ...(AvailableDate && selectedDate ? { - date: Array.isArray(selectedDate) - ? selectedDate - .map((d) => (d?.format ? d.format('YYYY-MM-DD') : d)) - .join(',') - : selectedDate?.format - ? selectedDate.format('YYYY-MM-DD') - : selectedDate, - } + date: Array.isArray(selectedDate) + ? selectedDate + .map((d) => (d?.format ? d.format('YYYY-MM-DD') : d)) + .join(',') + : selectedDate?.format + ? selectedDate.format('YYYY-MM-DD') + : selectedDate, + } : {}), }; //mohan @@ -1187,14 +1188,14 @@ const BSItemCard = (props) => { prodCat: ProdCat, ...(AvailableDate && selectedDate ? { - date: Array.isArray(selectedDate) - ? selectedDate - .map((d) => (d?.format ? d.format('YYYY-MM-DD') : d)) - .join(',') - : selectedDate?.format - ? selectedDate.format('YYYY-MM-DD') - : selectedDate, - } + date: Array.isArray(selectedDate) + ? selectedDate + .map((d) => (d?.format ? d.format('YYYY-MM-DD') : d)) + .join(',') + : selectedDate?.format + ? selectedDate.format('YYYY-MM-DD') + : selectedDate, + } : {}), }; @@ -1400,13 +1401,13 @@ const BSItemCard = (props) => { (cartItem) => cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId && cartItem?.InwardDtlId === - item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ - VarientIndex - ]?.StockDetails?.[0]?.InwardDtlId && + item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ + VarientIndex + ]?.StockDetails?.[0]?.InwardDtlId && cartItem?.OrderRate === - item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ - VarientIndex - ]?.StockDetails?.[0]?.SellPrice && + item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ + VarientIndex + ]?.StockDetails?.[0]?.SellPrice && !cartItem?.SalesId ); @@ -1415,9 +1416,9 @@ const BSItemCard = (props) => { (cartItem) => cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId && cartItem?.InwardDtlId === - item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ - VarientIndex - ]?.StockDetails?.[0]?.InwardDtlId && + item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ + VarientIndex + ]?.StockDetails?.[0]?.InwardDtlId && // (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice) !cartItem?.SalesId ); @@ -1459,11 +1460,11 @@ const BSItemCard = (props) => { (cartItem) => cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId && cartItem?.InwardDtlId === - item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] - ?.StockDetails?.[0]?.InwardDtlId && + item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] + ?.StockDetails?.[0]?.InwardDtlId && cartItem?.OrderRate === - item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] - ?.StockDetails?.[0]?.SellPrice && + item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] + ?.StockDetails?.[0]?.SellPrice && !cartItem?.SalesId ); @@ -1472,9 +1473,9 @@ const BSItemCard = (props) => { (cartItem) => cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId && cartItem?.InwardDtlId === - item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ - VarientIndex - ]?.StockDetails?.[0]?.InwardDtlId && + item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ + VarientIndex + ]?.StockDetails?.[0]?.InwardDtlId && // (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice) !cartItem?.SalesId ); @@ -1555,13 +1556,13 @@ const BSItemCard = (props) => { (cartItem) => cartItem?.ProdId === qtydata?.ProductDetail?.[QtyIndex]?.ProdId && cartItem?.InwardDtlId === - qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ - index.key - ]?.StockDetails?.[0]?.InwardDtlId && + qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ + index.key + ]?.StockDetails?.[0]?.InwardDtlId && cartItem?.OrderRate === - qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ - index.key - ]?.StockDetails?.[0]?.SellPrice && + qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ + index.key + ]?.StockDetails?.[0]?.SellPrice && !cartItem?.SalesId ); @@ -1569,11 +1570,11 @@ const BSItemCard = (props) => { let Isincartonepc = CartOrderDetails?.filter( (cartItem) => cartItem?.ProdId === - qtydata?.ProductDetail?.[QtyIndex]?.ProdId && + qtydata?.ProductDetail?.[QtyIndex]?.ProdId && cartItem?.InwardDtlId === - qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ - index.key - ]?.StockDetails?.[0]?.InwardDtlId && + qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ + index.key + ]?.StockDetails?.[0]?.InwardDtlId && // (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice) !cartItem?.SalesId ); @@ -1641,13 +1642,13 @@ const BSItemCard = (props) => { (cartItem) => cartItem?.ProdId === qtydata?.ProductDetail?.[QtyIndex]?.ProdId && cartItem?.InwardDtlId === - qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ - index.key - ]?.StockDetails?.[0]?.InwardDtlId && + qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ + index.key + ]?.StockDetails?.[0]?.InwardDtlId && cartItem?.OrderRate === - qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ - index.key - ]?.StockDetails?.[0]?.SellPrice && + qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ + index.key + ]?.StockDetails?.[0]?.SellPrice && !cartItem?.SalesId ); @@ -1656,9 +1657,9 @@ const BSItemCard = (props) => { (cartItem) => cartItem?.ProdId === qtydata?.ProductDetail?.[QtyIndex]?.ProdId && cartItem?.InwardDtlId === - qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ - index.key - ]?.StockDetails?.[0]?.InwardDtlId && + qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ + index.key + ]?.StockDetails?.[0]?.InwardDtlId && // (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice) !cartItem?.SalesId ); @@ -1826,15 +1827,15 @@ const BSItemCard = (props) => { let Isincart = CartOrderDetails?.find( (cartItem) => cartItem?.ProdId === - qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId && + qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId && cartItem?.InwardDtlId === - qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ - item?.VarientIndex - ]?.StockDetails?.[0]?.InwardDtlId && + qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ + item?.VarientIndex + ]?.StockDetails?.[0]?.InwardDtlId && cartItem?.OrderRate === - qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ - item?.VarientIndex - ]?.StockDetails?.[0]?.SellPrice && + qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ + item?.VarientIndex + ]?.StockDetails?.[0]?.SellPrice && !cartItem?.SalesId ); @@ -1842,11 +1843,11 @@ const BSItemCard = (props) => { let Isincartonepc = CartOrderDetails?.filter( (cartItem) => cartItem?.ProdId === - qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId && + qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId && cartItem?.InwardDtlId === - qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ - item?.VarientIndex - ]?.StockDetails?.[0]?.InwardDtlId && + qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ + item?.VarientIndex + ]?.StockDetails?.[0]?.InwardDtlId && // (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice) !cartItem?.SalesId ); @@ -1925,15 +1926,15 @@ const BSItemCard = (props) => { let Isincart = CartOrderDetails?.find( (cartItem) => cartItem?.ProdId === - qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId && + qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId && cartItem?.InwardDtlId === - qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ - item?.VarientIndex - ]?.StockDetails?.[0]?.InwardDtlId && + qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ + item?.VarientIndex + ]?.StockDetails?.[0]?.InwardDtlId && cartItem?.OrderRate === - qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ - item?.VarientIndex - ]?.StockDetails?.[0]?.SellPrice && + qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ + item?.VarientIndex + ]?.StockDetails?.[0]?.SellPrice && !cartItem?.SalesId ); @@ -1941,11 +1942,11 @@ const BSItemCard = (props) => { let Isincartonepc = CartOrderDetails?.filter( (cartItem) => cartItem?.ProdId === - qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId && + qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId && cartItem?.InwardDtlId === - qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ - item?.VarientIndex - ]?.StockDetails?.[0]?.InwardDtlId && + qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ + item?.VarientIndex + ]?.StockDetails?.[0]?.InwardDtlId && // (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice) !cartItem?.SalesId ); @@ -2237,15 +2238,15 @@ const BSItemCard = (props) => { const isExistsInFreeProdList = hasOffer ? FreeProdList?.filter( - (f) => - f?.FreeProdId === item?.ProdId && - f?.ProdVariantDetails?.some((variant) => - variant?.StockDetails?.some( - (stock) => stock?.FreeInwardDtlId === item?.InwardDtlId - ) - ) && - f?.RemainingQty > 0 - ) + (f) => + f?.FreeProdId === item?.ProdId && + f?.ProdVariantDetails?.some((variant) => + variant?.StockDetails?.some( + (stock) => stock?.FreeInwardDtlId === item?.InwardDtlId + ) + ) && + f?.RemainingQty > 0 + ) : []; const calculateTaxAmounts = (qty, rate, taxPercentage) => { @@ -2312,10 +2313,10 @@ const BSItemCard = (props) => { ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B' ? true : cartItem?.OfferMode !== 'B') && - cartItem?.OfferMode !== 'P' && - cartItem?.OfferMode !== 'C' && - cartItem?.OfferMode !== 'O' && - cartItem?.OfferMode !== 'L' + cartItem?.OfferMode !== 'P' && + cartItem?.OfferMode !== 'C' && + cartItem?.OfferMode !== 'O' && + cartItem?.OfferMode !== 'L' ? true : cartItem?.Offer === 0) ); @@ -2326,10 +2327,10 @@ const BSItemCard = (props) => { ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B' ? true : cartItem?.OfferMode !== 'B') && - cartItem?.OfferMode !== 'P' && - cartItem?.OfferMode !== 'C' && - cartItem?.OfferMode !== 'O' && - cartItem?.OfferMode !== 'L' + cartItem?.OfferMode !== 'P' && + cartItem?.OfferMode !== 'C' && + cartItem?.OfferMode !== 'O' && + cartItem?.OfferMode !== 'L' ? true : cartItem?.Offer === 0) ); @@ -2343,10 +2344,10 @@ const BSItemCard = (props) => { ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B' ? true : cartItem?.OfferMode !== 'B') && - cartItem?.OfferMode !== 'P' && - cartItem?.OfferMode !== 'C' && - cartItem?.OfferMode !== 'O' && - cartItem?.OfferMode !== 'L' + cartItem?.OfferMode !== 'P' && + cartItem?.OfferMode !== 'C' && + cartItem?.OfferMode !== 'O' && + cartItem?.OfferMode !== 'L' ? true : cartItem?.Offer === 0) ) @@ -2359,10 +2360,10 @@ const BSItemCard = (props) => { ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B' ? true : cartItem?.OfferMode !== 'B') && - cartItem?.OfferMode !== 'P' && - cartItem?.OfferMode !== 'C' && - cartItem?.OfferMode !== 'O' && - cartItem?.OfferMode !== 'L' + cartItem?.OfferMode !== 'P' && + cartItem?.OfferMode !== 'C' && + cartItem?.OfferMode !== 'O' && + cartItem?.OfferMode !== 'L' ? true : cartItem?.Offer === 0) ) @@ -2383,8 +2384,8 @@ const BSItemCard = (props) => { isItemInCart, item?.OtherProduct === 'Others' || item?.ScaleType === 'weight' ? ( - (item?.OrderQty || 0) + parseFloat(isItemInCart?.OrderQty) - )?.toFixed(3) + (item?.OrderQty || 0) + parseFloat(isItemInCart?.OrderQty) + )?.toFixed(3) : null ); const updatedData = addFirst @@ -2410,8 +2411,8 @@ const BSItemCard = (props) => { isItemInCartHold, item?.OtherProduct === 'Others' || item?.ScaleType === 'weight' ? ( - (item?.OrderQty || 0) + parseFloat(isItemInCartHold?.OrderQty) - )?.toFixed(3) + (item?.OrderQty || 0) + parseFloat(isItemInCartHold?.OrderQty) + )?.toFixed(3) : null ); const updatedData = addFirst @@ -2638,14 +2639,14 @@ const BSItemCard = (props) => { updatedCartData = cartData.map((item, idx) => idx === indexToCheck ? { - ...item, - Offer: null, - OfferMessage: undefined, - OfferMode: undefined, - OfferModeType: false, - OfferType: undefined, - OfferValue: null, - } + ...item, + Offer: null, + OfferMessage: undefined, + OfferMode: undefined, + OfferModeType: false, + OfferType: undefined, + OfferValue: null, + } : item ); } @@ -2696,8 +2697,8 @@ const BSItemCard = (props) => { ...item, Offer: sameProduct || - bestOffer?.OfferMode === 'I' || - bestOffer?.OfferMode === 'Q' + bestOffer?.OfferMode === 'I' || + bestOffer?.OfferMode === 'Q' ? bestOffer?.OfferAmount || item.Offer : item.Offer || bestOffer?.OfferAmount, OfferType: item?.OfferType || bestOffer?.OfferType, @@ -2714,10 +2715,10 @@ const BSItemCard = (props) => { ((c?.OfferModeType && c?.OfferMode === 'B' ? true : c?.OfferMode !== 'B') && - c?.OfferMode !== 'P' && - c?.OfferMode !== 'C' && - c?.OfferMode !== 'O' && - c?.OfferMode !== 'L' + c?.OfferMode !== 'P' && + c?.OfferMode !== 'C' && + c?.OfferMode !== 'O' && + c?.OfferMode !== 'L' ? true : c?.Offer === 0); @@ -3104,10 +3105,10 @@ const BSItemCard = (props) => { return FreeProdList.map((f, i) => i === index ? { - ...existing, - ...newFreeProd, - ProdVariantDetails: existing.ProdVariantDetails, - } + ...existing, + ...newFreeProd, + ProdVariantDetails: existing.ProdVariantDetails, + } : f ); } else { @@ -3177,7 +3178,7 @@ const BSItemCard = (props) => { const cycleSize = buyQty + getQty; const fullCycles = Math.floor( freeCartItem?.reduce((acc, fc) => acc + (fc?.OrderQty || 0), 0) / - cycleSize + cycleSize ); const totalFreeQty = fullCycles * getQty; @@ -3735,7 +3736,7 @@ const BSItemCard = (props) => { parseInt(totalSelectedProductQty || 0) + parseInt(reorderComboConsumed || 0); } - } catch (_) { } + } catch (_) {} let getCurrentProdDtl = orderDetails?.filter( (a) => a?.ProdName === ProdName ); @@ -3936,7 +3937,7 @@ const BSItemCard = (props) => { parseInt(totalSelectedProductQty || 0) + parseInt(reorderComboConsumed || 0); } - } catch (_) { } + } catch (_) {} let getCurrentProdDtl = orderDetails?.filter((a) => a?.ProdId === ProdId); let totalOrderQty = getCurrentProdDtl?.reduce((accumulator, card) => { return ( @@ -3972,7 +3973,7 @@ const BSItemCard = (props) => { }, 0); totalOrderQty = parseInt(totalOrderQty || 0) + parseInt(comboConsumed || 0); - } catch (_) { } + } catch (_) {} let OverallProdQty = totalOrderQty - totalSelectedProductQty; if ( parseInt(ItemQuantity) > @@ -4058,7 +4059,7 @@ const BSItemCard = (props) => { parseInt(totalSelectedProductQty || 0) + parseInt(reorderComboConsumed || 0); } - } catch (_) { } + } catch (_) {} let getCurrentProdDtl = orderDetails?.filter((a) => a?.ProdId === ProdId); let totalOrderQty = getCurrentProdDtl?.reduce((accumulator, card) => { return ( @@ -4097,7 +4098,7 @@ const BSItemCard = (props) => { }, 0); totalOrderQty = parseInt(totalOrderQty || 0) + parseInt(comboConsumed || 0); - } catch (_) { } + } catch (_) {} let OverallProdQty = totalOrderQty - totalSelectedProductQty; if ( parseInt(ItemQuantity) > @@ -4189,7 +4190,7 @@ const BSItemCard = (props) => { parseInt(totalSelectedProductQty || 0) + parseInt(reorderComboConsumed || 0); } - } catch (_) { } + } catch (_) {} let getCurrentProdDtl = orderDetails?.filter( (a) => a?.ProdId === ProdId && a?.InwardDtlId === InwardDtlId ); @@ -4232,7 +4233,7 @@ const BSItemCard = (props) => { }, 0); totalOrderQty = parseInt(totalOrderQty || 0) + parseInt(comboConsumed || 0); - } catch (_) { } + } catch (_) {} let OverallProdQty = totalOrderQty - totalSelectedProductQty; if ( @@ -4316,7 +4317,7 @@ const BSItemCard = (props) => { parseInt(totalSelectedProductQty || 0) + parseInt(reorderComboConsumed || 0); } - } catch (_) { } + } catch (_) {} let getCurrentProdDtl = orderDetails?.filter( (a) => a?.ProdId === ProdId && a?.InwardDtlId === InwardDtlId ); @@ -4363,7 +4364,7 @@ const BSItemCard = (props) => { }, 0); totalOrderQty = parseInt(totalOrderQty || 0) + parseInt(comboConsumed || 0); - } catch (_) { } + } catch (_) {} let OverallProdQty = totalOrderQty - totalSelectedProductQty; if ( @@ -4541,7 +4542,7 @@ const BSItemCard = (props) => { 0 || - record.StockCount === 'Stock Not Maintained' + record.StockCount === 'Stock Not Maintained' ? { color: '#000', cursor: 'pointer' } : { color: '#f49898', cursor: 'not-allowed' } } @@ -4571,7 +4572,7 @@ const BSItemCard = (props) => { 0 || - record.StockCount === 'Stock Not Maintained' + record.StockCount === 'Stock Not Maintained' ? { color: '#000', cursor: 'pointer' } : { color: '#f49898', cursor: 'not-allowed' } } @@ -4601,7 +4602,7 @@ const BSItemCard = (props) => { 0 || - record.StockCount === 'Stock Not Maintained' + record.StockCount === 'Stock Not Maintained' ? { color: '#000', cursor: 'pointer' } : { color: '#f49898', cursor: 'not-allowed' } } @@ -4776,17 +4777,17 @@ const BSItemCard = (props) => { qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable === 'Y' ? onePeiceFlow ? returnVariantStock( - qtydata?.ProductDetail?.[QtyIndex]?.ProdId, - item?.OverAllPcs, - CartOrderDetails, - item?.ProdVariantName - ) + qtydata?.ProductDetail?.[QtyIndex]?.ProdId, + item?.OverAllPcs, + CartOrderDetails, + item?.ProdVariantName + ) : returnVariantStock( - qtydata?.ProductDetail?.[QtyIndex]?.ProdId, - item?.OverAllQty, - CartOrderDetails, - item?.ProdVariantName - ) + qtydata?.ProductDetail?.[QtyIndex]?.ProdId, + item?.OverAllQty, + CartOrderDetails, + item?.ProdVariantName + ) : 'Stock Not Maintained', VariantAvailableFrom: item?.AvailableFrom, VariantAvailableTo: item?.AvailableTo, @@ -4808,20 +4809,20 @@ const BSItemCard = (props) => { 'Batch No': item?.BatchRef, StockCount: onePeiceFlow ? returnCountStock( - item?.ProdId, - item?.OverAllPcs, - CartOrderDetails, - item?.InwardDtlId, - 'Y' - ) + item?.ProdId, + item?.OverAllPcs, + CartOrderDetails, + item?.InwardDtlId, + 'Y' + ) : returnCountStock( - item?.ProdId, - item?.BalanceQty, - CartOrderDetails, - item?.InwardDtlId, - 'N', - item?.OverAllPcs - ), + item?.ProdId, + item?.BalanceQty, + CartOrderDetails, + item?.InwardDtlId, + 'N', + item?.OverAllPcs + ), 'Stock Date': ExtractDateFormate(item?.InwardDate), Price: onePeiceFlow ? item?.OnePcsPrice : item?.SellPrice, ExpDate: @@ -5998,9 +5999,9 @@ const BSItemCard = (props) => { allProducts.forEach((product) => { const brandName = product.BrandName && - product.BrandName !== 'null' && - product.BrandName !== 'undefined' && - product.BrandName.trim() !== '' + product.BrandName !== 'null' && + product.BrandName !== 'undefined' && + product.BrandName.trim() !== '' ? product.BrandName : 'Others'; @@ -6034,13 +6035,13 @@ const BSItemCard = (props) => { const result = prodname ? (cardData || [])?.filter( - (item) => - normalize(item.ProdName).includes(normalize(prodname)) || - normalize(item.ProdCatName).includes(normalize(prodname)) || - item.ProductDetail?.some((detail) => - normalize(detail.ProdName).includes(normalize(prodname)) - ) - ) + (item) => + normalize(item.ProdName).includes(normalize(prodname)) || + normalize(item.ProdCatName).includes(normalize(prodname)) || + item.ProductDetail?.some((detail) => + normalize(detail.ProdName).includes(normalize(prodname)) + ) + ) : cardData; console.log(prodQty, 'cardDatacardData', result, prodname); @@ -6060,8 +6061,8 @@ const BSItemCard = (props) => { CardOnclick( result?.[0], result?.[0]?.OnePcsAvailable === 'Y' && - preferenceSingleSales && - 'OnePeiceProduct' + preferenceSingleSales && + 'OnePeiceProduct' ); // AddOrderDetails2(result?.[0]) } else if (item?.OverAllQty < prodQty) { @@ -6121,21 +6122,21 @@ const BSItemCard = (props) => { zIndex: connectingState?.positionChange ? '0' : '20', top: templateData?.BookingNavbar?.[0] === 'Navbar3' && - templateData?.BookingLayout?.[0] === 'Layout3' + templateData?.BookingLayout?.[0] === 'Layout3' ? '5px' : templateData?.BookingNavbar?.[0] === 'Navbar3' && - ['Layout1', 'Layout2'].includes( - templateData?.BookingLayout?.[0] - ) + ['Layout1', 'Layout2'].includes( + templateData?.BookingLayout?.[0] + ) ? '3px' : templateData?.BookingNavbar?.[0] === 'Navbar3' && - ['Layout4', 'Layout5', 'Layout6'].includes( - templateData?.BookingLayout?.[0] - ) + ['Layout4', 'Layout5', 'Layout6'].includes( + templateData?.BookingLayout?.[0] + ) ? '3rem' : ['Layout4', 'Layout5', 'Layout6'].includes( - templateData?.BookingLayout?.[0] - ) + templateData?.BookingLayout?.[0] + ) ? '3.1rem' : templateData?.BookingNavbar?.[0] === 'Navbar3' ? '3rem' @@ -6217,21 +6218,21 @@ const BSItemCard = (props) => { }} className={ (item?.OverAllQty !== undefined && - !preferenceSingleSales + !preferenceSingleSales ? returnCount( - item?.ProductDetail?.[0]?.ProdName, - item?.OverAllQty, - CartOrderDetails, - item?.OverAllPcs - ) + item?.ProductDetail?.[0]?.ProdName, + item?.OverAllQty, + CartOrderDetails, + item?.OverAllPcs + ) : returnOnepcCount( - item?.ProductDetail?.[0]?.ProdName, - item?.OverAllPcs, - CartOrderDetails - ) > 0) || - item?.ProductDetail?.some( - (item) => item?.StockAvailable !== 'Y' - ) + item?.ProductDetail?.[0]?.ProdName, + item?.OverAllPcs, + CartOrderDetails + ) > 0) || + item?.ProductDetail?.some( + (item) => item?.StockAvailable !== 'Y' + ) ? 'BkPrdCardActive' : 'BkPrdCardDeActive' } @@ -6269,39 +6270,39 @@ const BSItemCard = (props) => { cardFunction?.Background && (SelectedCardColor ? SelectedCardColor?.[ - 'BackgroundColor' - ] + 'BackgroundColor' + ] : ''), padding: !cardFunction?.ImageUp && - !cardFunction?.ImageDown + !cardFunction?.ImageDown ? cardFunction?.SmallImage && - '5px 9px' + '5px 9px' : '8px 2px', flexDirection: cardFunction?.ImageRight && - 'row-reverse' + 'row-reverse' ? cardFunction?.ImageRight && - 'row-reverse' + 'row-reverse' : cardFunction?.ImageUp && 'column' ? cardFunction?.ImageUp && - 'column' + 'column' : cardFunction?.ImageDown && - 'column-reverse' + 'column-reverse' ? cardFunction?.ImageDown && - 'column-reverse' + 'column-reverse' : cardFunction?.ImageLeft && - 'row', + 'row', borderRadius: cardFunction?.EdgeCurve && '6px', width: !cardFunction?.ImageUp && - !cardFunction?.ImageDown && - !cardFunction?.BigImage && - !cardFunction?.ImageRight && - cardFunction?.SmallImage && - (cardFunction?.ImageUp || - cardFunction?.ImageDown) + !cardFunction?.ImageDown && + !cardFunction?.BigImage && + !cardFunction?.ImageRight && + cardFunction?.SmallImage && + (cardFunction?.ImageUp || + cardFunction?.ImageDown) ? '6rem' : cardFunction?.BigImage && '9rem', height: @@ -6334,19 +6335,19 @@ const BSItemCard = (props) => { if ( !( (item?.OverAllQty !== undefined && - !preferenceSingleSales + !preferenceSingleSales ? returnCount( - item?.ProductDetail?.[0] - ?.ProdName, - item?.OverAllQty, - CartOrderDetails - ) + item?.ProductDetail?.[0] + ?.ProdName, + item?.OverAllQty, + CartOrderDetails + ) : returnOnepcCount( - item?.ProductDetail?.[0] - ?.ProdName, - item?.OverAllPcs, - CartOrderDetails - ) > 0) || + item?.ProductDetail?.[0] + ?.ProdName, + item?.OverAllPcs, + CartOrderDetails + ) > 0) || item?.ProductDetail?.some( (item) => item?.StockAvailable !== 'Y' @@ -6358,8 +6359,8 @@ const BSItemCard = (props) => { CardOnclick( item, item?.OnePcsAvailable === 'Y' && - preferenceSingleSales && - 'OnePeiceProduct' + preferenceSingleSales && + 'OnePeiceProduct' ); } }} @@ -6368,39 +6369,39 @@ const BSItemCard = (props) => { > {(cardFunction?.BigImage || cardFunction?.SmallImage) && ( - - )} + ? item?.ProductDetail?.[0] + ?.ProdLogo + : defaultimage + } + alt="" + /> + )}
{ cardFunction?.Background && (SelectedCardColor ? SelectedCardColor?.[ - 'BackgroundColor' - ] + 'BackgroundColor' + ] : ''), position: !cardFunction?.BigImage @@ -6434,7 +6435,7 @@ const BSItemCard = (props) => { height: cardFunction?.SmallImage ? '5.5rem' : !cardFunction?.BigImage && - '5.5rem', + '5.5rem', alignItems: !cardFunction?.BigImage && !cardFunction?.SmallImage && @@ -6457,11 +6458,11 @@ const BSItemCard = (props) => { 'uppercase', width: !cardFunction?.SmallImage ? cardFunction?.BigImage && - '120px' + '120px' : cardFunction?.SmallImage && - !cardFunction?.ImageUp && - !cardFunction?.ImageDown && - '85px', + !cardFunction?.ImageUp && + !cardFunction?.ImageDown && + '85px', // Width: cardFunction?.BigImage && "70px", fontSize: !cardFunction?.BigImage && @@ -6483,24 +6484,24 @@ const BSItemCard = (props) => { > {item?.ProdName}{' '} {(item?.OverAllQty !== undefined && - !preferenceSingleSales + !preferenceSingleSales ? returnCount( - item?.ProductDetail?.[0] - ?.ProdName, - item?.OverAllQty, - CartOrderDetails, - item - ) + item?.ProductDetail?.[0] + ?.ProdName, + item?.OverAllQty, + CartOrderDetails, + item + ) : returnOnepcCount( - item?.ProductDetail?.[0] - ?.ProdName, - item?.OverAllPcs, - CartOrderDetails - ) > 0) || - item?.ProductDetail?.some( - (item) => - item?.StockAvailable !== 'Y' - ) ? ( + item?.ProductDetail?.[0] + ?.ProdName, + item?.OverAllPcs, + CartOrderDetails + ) > 0) || + item?.ProductDetail?.some( + (item) => + item?.StockAvailable !== 'Y' + ) ? ( '' ) : (

{ fontSize: !cardFunction?.SmallImage ? cardFunction?.BigImage && - '12px' + '12px' : '12px', textAlign: 'center', - lineHeight: '2', fontFamily: SelectedCardFont ? SelectedCardFont : '', color: SelectedCardColor ? SelectedCardColor?.[ - 'FontColor' - ] + 'FontColor' + ] : '', }} > @@ -6565,17 +6565,16 @@ const BSItemCard = (props) => { fontSize: !cardFunction?.SmallImage ? cardFunction?.BigImage && - '12px' + '12px' : '12px', textAlign: 'center', - lineHeight: '2', fontFamily: SelectedCardFont ? SelectedCardFont : '', color: SelectedCardColor ? SelectedCardColor?.[ - 'FontColor' - ] + 'FontColor' + ] : '', }} > @@ -6623,19 +6622,19 @@ const BSItemCard = (props) => { count={ !preferenceSingleSales ? returnCount( - item - ?.ProductDetail?.[0] - ?.ProdName, - item?.OverAllQty, - CartOrderDetails - ) + item + ?.ProductDetail?.[0] + ?.ProdName, + item?.OverAllQty, + CartOrderDetails + ) : returnOnepcCount( - item - ?.ProductDetail?.[0] - ?.ProdName, - item?.OverAllPcs, - CartOrderDetails - ) + item + ?.ProductDetail?.[0] + ?.ProdName, + item?.OverAllPcs, + CartOrderDetails + ) } overflowCount={10000} > @@ -6687,14 +6686,14 @@ const BSItemCard = (props) => { item?.OverAllPcs, CartOrderDetails ) > 0 || - item?.ProductDetail?.some( - (product) => - product?.StockAvailable !== - 'Y' - ) + item?.ProductDetail?.some( + (product) => + product?.StockAvailable !== + 'Y' + ) ? cardFunction?.Background ? SelectedCardColor?.BackgroundColor || - '#000000' + '#000000' : '#fff' : '#ff4d4f', }} @@ -6736,39 +6735,39 @@ const BSItemCard = (props) => { cardFunction?.Background && (SelectedCardColor ? SelectedCardColor?.[ - 'BackgroundColor' - ] + 'BackgroundColor' + ] : ''), padding: !cardFunction?.ImageUp && - !cardFunction?.ImageDown + !cardFunction?.ImageDown ? cardFunction?.SmallImage && - '5px 9px' + '5px 9px' : '8px 2px', flexDirection: cardFunction?.ImageRight && - 'row-reverse' + 'row-reverse' ? cardFunction?.ImageRight && - 'row-reverse' + 'row-reverse' : cardFunction?.ImageUp && 'column' ? cardFunction?.ImageUp && - 'column' + 'column' : cardFunction?.ImageDown && - 'column-reverse' + 'column-reverse' ? cardFunction?.ImageDown && - 'column-reverse' + 'column-reverse' : cardFunction?.ImageLeft && - 'row', + 'row', borderRadius: cardFunction?.EdgeCurve && '6px', width: !cardFunction?.ImageUp && - !cardFunction?.ImageDown && - !cardFunction?.BigImage && - !cardFunction?.ImageRight && - cardFunction?.SmallImage && - (cardFunction?.ImageUp || - cardFunction?.ImageDown) + !cardFunction?.ImageDown && + !cardFunction?.BigImage && + !cardFunction?.ImageRight && + cardFunction?.SmallImage && + (cardFunction?.ImageUp || + cardFunction?.ImageDown) ? '6rem' : cardFunction?.BigImage && '9rem', height: @@ -6786,19 +6785,19 @@ const BSItemCard = (props) => { if ( !( (item?.OverAllQty !== undefined && - !preferenceSingleSales + !preferenceSingleSales ? returnCount( - item?.ProductDetail?.[0] - ?.ProdName, - item?.OverAllQty, - CartOrderDetails - ) + item?.ProductDetail?.[0] + ?.ProdName, + item?.OverAllQty, + CartOrderDetails + ) : returnOnepcCount( - item?.ProductDetail?.[0] - ?.ProdName, - item?.OverAllPcs, - CartOrderDetails - ) > 0) || + item?.ProductDetail?.[0] + ?.ProdName, + item?.OverAllPcs, + CartOrderDetails + ) > 0) || item?.ProductDetail?.some( (item) => item?.StockAvailable !== 'Y' @@ -6810,48 +6809,48 @@ const BSItemCard = (props) => { CardOnclick( item, item?.OnePcsAvailable === 'Y' && - preferenceSingleSales && - 'OnePeiceProduct' + preferenceSingleSales && + 'OnePeiceProduct' ); } }} - // data-aos="zoom-in" data-aos-duration="600" + // data-aos="zoom-in" data-aos-duration="600" > {(cardFunction?.BigImage || cardFunction?.SmallImage) && ( - - )} + ? item?.ProductDetail?.[0] + ?.ProdLogo + : defaultimage + } + alt="" + /> + )}

{ cardFunction?.Background && (SelectedCardColor ? SelectedCardColor?.[ - 'BackgroundColor' - ] + 'BackgroundColor' + ] : ''), position: !cardFunction?.BigImage @@ -6885,7 +6884,7 @@ const BSItemCard = (props) => { height: cardFunction?.SmallImage ? '5.5rem' : !cardFunction?.BigImage && - '4.5rem', + '4.5rem', alignItems: !cardFunction?.BigImage && !cardFunction?.SmallImage && @@ -6905,11 +6904,11 @@ const BSItemCard = (props) => { 'uppercase', width: !cardFunction?.SmallImage ? cardFunction?.BigImage && - '120px' + '120px' : cardFunction?.SmallImage && - !cardFunction?.ImageUp && - !cardFunction?.ImageDown && - '85px', + !cardFunction?.ImageUp && + !cardFunction?.ImageDown && + '85px', // Width: cardFunction?.BigImage && "70px", fontSize: !cardFunction?.BigImage && @@ -6931,24 +6930,24 @@ const BSItemCard = (props) => { > {item?.ProdName}{' '} {(item?.OverAllQty !== undefined && - !preferenceSingleSales + !preferenceSingleSales ? returnCount( - item?.ProductDetail?.[0] - ?.ProdName, - item?.OverAllQty, - CartOrderDetails, - item - ) + item?.ProductDetail?.[0] + ?.ProdName, + item?.OverAllQty, + CartOrderDetails, + item + ) : returnOnepcCount( - item?.ProductDetail?.[0] - ?.ProdName, - item?.OverAllPcs, - CartOrderDetails - ) > 0) || - item?.ProductDetail?.some( - (item) => - item?.StockAvailable !== 'Y' - ) ? ( + item?.ProductDetail?.[0] + ?.ProdName, + item?.OverAllPcs, + CartOrderDetails + ) > 0) || + item?.ProductDetail?.some( + (item) => + item?.StockAvailable !== 'Y' + ) ? ( '' ) : (

{ fontSize: !cardFunction?.SmallImage ? cardFunction?.BigImage && - '12px' + '12px' : '12px', textAlign: 'center', - lineHeight: '2', fontFamily: SelectedCardFont ? SelectedCardFont : '', color: SelectedCardColor ? SelectedCardColor?.[ - 'FontColor' - ] + 'FontColor' + ] : '', }} > @@ -7013,17 +7011,16 @@ const BSItemCard = (props) => { fontSize: !cardFunction?.SmallImage ? cardFunction?.BigImage && - '12px' + '12px' : '12px', textAlign: 'center', - lineHeight: '2', fontFamily: SelectedCardFont ? SelectedCardFont : '', color: SelectedCardColor ? SelectedCardColor?.[ - 'FontColor' - ] + 'FontColor' + ] : '', }} > @@ -7068,19 +7065,19 @@ const BSItemCard = (props) => { count={ !preferenceSingleSales ? returnCount( - item - ?.ProductDetail?.[0] - ?.ProdName, - item?.OverAllQty, - CartOrderDetails - ) + item + ?.ProductDetail?.[0] + ?.ProdName, + item?.OverAllQty, + CartOrderDetails + ) : returnOnepcCount( - item - ?.ProductDetail?.[0] - ?.ProdName, - item?.OverAllPcs, - CartOrderDetails - ) + item + ?.ProductDetail?.[0] + ?.ProdName, + item?.OverAllPcs, + CartOrderDetails + ) } overflowCount={10000} > @@ -7131,14 +7128,14 @@ const BSItemCard = (props) => { item?.OverAllPcs, CartOrderDetails ) > 0 || - item?.ProductDetail?.some( - (product) => - product?.StockAvailable !== - 'Y' - ) + item?.ProductDetail?.some( + (product) => + product?.StockAvailable !== + 'Y' + ) ? cardFunction?.Background ? SelectedCardColor?.BackgroundColor || - '#000000' + '#000000' : '#fff' : '#ff4d4f', }} @@ -7153,21 +7150,21 @@ const BSItemCard = (props) => {

0) || - item?.ProductDetail?.some( - (item) => item?.StockAvailable !== 'Y' - ) + item?.ProductDetail?.[0]?.ProdName, + item?.OverAllPcs, + CartOrderDetails + ) > 0) || + item?.ProductDetail?.some( + (item) => item?.StockAvailable !== 'Y' + ) ? 'card4Main card4Main-active' : 'card4Main card4Main-deactive' } @@ -7190,17 +7187,17 @@ const BSItemCard = (props) => { if ( !( (item?.OverAllQty !== undefined && - !preferenceSingleSales + !preferenceSingleSales ? returnCount( - item?.ProductDetail?.[0]?.ProdName, - item?.OverAllQty, - CartOrderDetails - ) + item?.ProductDetail?.[0]?.ProdName, + item?.OverAllQty, + CartOrderDetails + ) : returnOnepcCount( - item?.ProductDetail?.[0]?.ProdName, - item?.OverAllPcs, - CartOrderDetails - ) > 0) || + item?.ProductDetail?.[0]?.ProdName, + item?.OverAllPcs, + CartOrderDetails + ) > 0) || item?.ProductDetail?.some( (item) => item?.StockAvailable !== 'Y' ) @@ -7215,8 +7212,8 @@ const BSItemCard = (props) => { CardOnclick( item, item?.OnePcsAvailable === 'Y' && - preferenceSingleSales && - 'OnePeiceProduct' + preferenceSingleSales && + 'OnePeiceProduct' ); // This will trigger if you're clicking outside the "One Piece" button } @@ -7258,7 +7255,7 @@ const BSItemCard = (props) => { height={60} src={ item?.ProductDetail?.[0]?.ProdLogo === - '' + '' ? defaultimage : item?.ProductDetail?.[0]?.ProdLogo ? item?.ProductDetail?.[0]?.ProdLogo @@ -7273,21 +7270,21 @@ const BSItemCard = (props) => {
{item?.ProdName} {(item?.OverAllQty !== undefined && - !preferenceSingleSales + !preferenceSingleSales ? returnCount( - item?.ProductDetail?.[0]?.ProdName, - item?.OverAllQty, - CartOrderDetails, - item - ) + item?.ProductDetail?.[0]?.ProdName, + item?.OverAllQty, + CartOrderDetails, + item + ) : returnOnepcCount( - item?.ProductDetail?.[0]?.ProdName, - item?.OverAllPcs, - CartOrderDetails - ) > 0) || - item?.ProductDetail?.some( - (item) => item?.StockAvailable !== 'Y' - ) ? ( + item?.ProductDetail?.[0]?.ProdName, + item?.OverAllPcs, + CartOrderDetails + ) > 0) || + item?.ProductDetail?.some( + (item) => item?.StockAvailable !== 'Y' + ) ? ( '' ) : (

{

{cardFunction?.MRP && ((item?.OverAllQty !== undefined && - !preferenceSingleSales + !preferenceSingleSales ? returnCount( - item?.ProductDetail?.[0]?.ProdName, - item?.OverAllQty, - CartOrderDetails, - item - ) + item?.ProductDetail?.[0]?.ProdName, + item?.OverAllQty, + CartOrderDetails, + item + ) : returnOnepcCount( - item?.ProductDetail?.[0]?.ProdName, - item?.OverAllPcs, - CartOrderDetails - ) > 0) || + item?.ProductDetail?.[0]?.ProdName, + item?.OverAllPcs, + CartOrderDetails + ) > 0) || item?.ProductDetail?.some( (item) => item?.StockAvailable !== 'Y' )) && ( @@ -7327,33 +7324,33 @@ const BSItemCard = (props) => {
)} {((item?.OverAllQty !== undefined && - !preferenceSingleSales + !preferenceSingleSales ? returnCount( - item?.ProductDetail?.[0]?.ProdName, - item?.OverAllQty, - CartOrderDetails, - item - ) + item?.ProductDetail?.[0]?.ProdName, + item?.OverAllQty, + CartOrderDetails, + item + ) : returnOnepcCount( - item?.ProductDetail?.[0]?.ProdName, - item?.OverAllPcs, - CartOrderDetails - ) > 0) || + item?.ProductDetail?.[0]?.ProdName, + item?.OverAllPcs, + CartOrderDetails + ) > 0) || item?.ProductDetail?.some( (item) => item?.StockAvailable !== 'Y' )) && ( -
-
- ₹ {ItemSellingPrice(item)} -
- -
- <> - ({ItemSize(item)} {ItemUomName(item)}) - -
+
+
+ ₹ {ItemSellingPrice(item)}
- )} + +
+ <> + ({ItemSize(item)} {ItemUomName(item)}) + +
+
+ )}
{/* Stock Count Badge */} @@ -7378,17 +7375,17 @@ const BSItemCard = (props) => { count={ !preferenceSingleSales ? returnCount( - item?.ProductDetail?.[0] - ?.ProdName, - item?.OverAllQty, - CartOrderDetails - ) + item?.ProductDetail?.[0] + ?.ProdName, + item?.OverAllQty, + CartOrderDetails + ) : returnOnepcCount( - item?.ProductDetail?.[0] - ?.ProdName, - item?.OverAllPcs, - CartOrderDetails - ) + item?.ProductDetail?.[0] + ?.ProdName, + item?.OverAllPcs, + CartOrderDetails + ) } overflowCount={10000} > @@ -7437,13 +7434,13 @@ const BSItemCard = (props) => { item?.OverAllPcs, CartOrderDetails ) > 0 || - item?.ProductDetail?.some( - (product) => - product?.StockAvailable !== 'Y' - ) + item?.ProductDetail?.some( + (product) => + product?.StockAvailable !== 'Y' + ) ? cardFunction?.Background ? SelectedCardColor?.BackgroundColor || - '#000000' + '#000000' : '#fff' : '#ff4d4f', }} @@ -7825,16 +7822,16 @@ const BSItemCard = (props) => { ]?.ProdVariantName?.toLowerCase()?.includes( 'variant' ) && ( - - ( - { - qtydata?.ProductDetail?.[QtyIndex] - ?.ProdVariantDetails?.[VarientIndex] - ?.ProdVariantName - } - ){' '} - - )} + + ( + { + qtydata?.ProductDetail?.[QtyIndex] + ?.ProdVariantDetails?.[VarientIndex] + ?.ProdVariantName + } + ){' '} + + )}

diff --git a/src/Pages/BookingScreen/Template/BSLayout4/BSLayout4.jsx b/src/Pages/BookingScreen/Template/BSLayout4/BSLayout4.jsx index f43e5fc..2cb1cb5 100644 --- a/src/Pages/BookingScreen/Template/BSLayout4/BSLayout4.jsx +++ b/src/Pages/BookingScreen/Template/BSLayout4/BSLayout4.jsx @@ -5,22 +5,20 @@ import { Tooltip, Badge, Popconfirm } from 'antd'; import { isMobile } from 'react-device-detect'; import BookingCloseIcon from '../../Components/UtillComponents/BookingCloseIcon.jsx'; const BSNavbar1 = lazy(() => import('../../Components/BSNavbar/BSNavbar1')); - const CategoryHorizontal = lazy( +const CategoryHorizontal = lazy( () => import('../../Components/BSCategories/BSCategoryHorizontal') ); const BSItemCard = lazy( () => import('../../Components/BSItemCards/BSItemCard') ); - + const BSBillingTable2 = lazy( () => import('../../Components/BSBillingTables/BSBillingTable2/BSBillingTable2') ); -const BSBillingTable3 = lazy( - () => - import('../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3overall') -); - + +import BSBillingTable3 from '../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3overall'; + import { dynamicComponentProps } from '../DynamicComponentProps.js'; import { getTemplateData, @@ -95,16 +93,10 @@ const BSOtherServicesVerticalcat = lazy( () => import('../../Components/BSCategories/BSOtherServicesVerticalcat.jsx') ); - const SalesCountForStandard = lazy( () => import('../SalesCountForStandard.jsx') ); -const StandardTable = lazy( - () => - import('../../Components/BSBillingTables/StandardTable/StandardTable.jsx') -); - const ComboSalesBillTable = lazy( () => import('../../Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx') diff --git a/src/Pages/CustomerMaster/CustMasterList.jsx b/src/Pages/CustomerMaster/CustMasterList.jsx index cade722..b11113f 100644 --- a/src/Pages/CustomerMaster/CustMasterList.jsx +++ b/src/Pages/CustomerMaster/CustMasterList.jsx @@ -25,8 +25,7 @@ import { Messages } from '../../Components/Notifications/Messages'; import { DefaultModal } from '../../Components/Modal/DefaultModal.jsx'; import { useAuth } from '../../AuthContext.jsx'; import { getPreferenceData } from '../../Features/BookingScreen/BookingData/BookingData.js'; - -const subDirectory = import.meta.env.BASE_URL; +const subDirectory = import.meta.env.ENV_BASE_URL; const items = [ { @@ -71,7 +70,6 @@ const CustomerMaster = () => { const [addnewAccess, setaddnewAccess] = useState(true); const [allowDecimal, setAllowDecimal] = useState(false); - async function fetchData() { if (location?.state?.Notiffy) { setMessageType(location?.state?.Notiffy.messageType); @@ -155,13 +153,22 @@ const CustomerMaster = () => { } }; const getPreference = async () => { - const data = { AppId: AppId, CompId: CompId, BranchId: BranchId, UserId: UserId }; - const { data: res } = await dispatch(getPreferenceData(data)).unwrap() - const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find((setting) => setting?.SettingIdName?.toLowerCase() === "decimal" && setting?.SettingValue === 'Y'); + const data = { + AppId: AppId, + CompId: CompId, + BranchId: BranchId, + UserId: UserId, + }; + const { data: res } = await dispatch(getPreferenceData(data)).unwrap(); + const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'decimal' && + setting?.SettingValue === 'Y' + ); if (decimalSetting) { - setAllowDecimal(true) + setAllowDecimal(true); } - } + }; //Delete const statusFormatter = async (row) => { @@ -251,7 +258,8 @@ const CustomerMaster = () => { width: '100px', render: (text, row) => ( - {(row?.CustName ? (row?.CustName + ' ') : '') + (row?.CustShortName || "") || row?.CustMobile} + {(row?.CustName ? row?.CustName + ' ' : '') + + (row?.CustShortName || '') || row?.CustMobile} ), filteredValue: [searchedText], @@ -260,8 +268,12 @@ const CustomerMaster = () => { String(record.CustShortName) ?.toLowerCase() ?.includes(value?.toLowerCase()) || - String(record.CustName)?.toLowerCase()?.includes(value?.toLowerCase()) || - String(record.CustMobile)?.toLowerCase()?.includes(value?.toLowerCase()) + String(record.CustName) + ?.toLowerCase() + ?.includes(value?.toLowerCase()) || + String(record.CustMobile) + ?.toLowerCase() + ?.includes(value?.toLowerCase()) ); }, sorter: (a, b) => a?.CustName?.length - b?.CustName?.length, diff --git a/src/Pages/Product/ExcelUpload.jsx b/src/Pages/Product/ExcelUpload.jsx index 08040aa..b7ab7f0 100644 --- a/src/Pages/Product/ExcelUpload.jsx +++ b/src/Pages/Product/ExcelUpload.jsx @@ -1,6 +1,5 @@ import React, { useState, useRef, useEffect, useContext } from 'react'; import { useDispatch, useSelector } from 'react-redux'; -// import { read, utils } from 'xlsx'; import ExcelJS from 'exceljs'; import { Table, Form, Input, Tooltip, Modal, Select } from 'antd'; import { @@ -18,7 +17,6 @@ import { getFieldSetupData, } from '../../Features/ProductPage/ProductPage.js'; import Imageupload from '../../Components/Forms/Upload.jsx'; -import { BiSolidFileExport } from 'react-icons/bi'; import { CiExport } from 'react-icons/ci'; import { uploadImage } from '../../Features/upload/upload.js'; @@ -617,15 +615,20 @@ const ProductExcel = ({ }; console.log(tableFieldPreferences, 'tableFieldPreferences'); + useEffect(() => { if (excelData && excelData?.length > 0) { let ExecelToJsConvertion = []; let slicedData = excelData?.slice(1); - let filteredData = slicedData?.filter( - (item) => item?.[item?.length - 1]?.trim() !== 'sample row' - ); + let filteredData = slicedData?.filter((item) => { + const values = Object.values(item || {}); + const lastVal = values[values.length - 1]; + return typeof lastVal === 'string' + ? lastVal.trim() !== 'sample row' + : true; + }); filteredData?.map((item, index) => { - ExecelToJsConvertion.push({ + ExecelToJsConvertion?.push({ key: index, ProductName: item?.['0'], Quantity: item?.['1'], @@ -1005,112 +1008,6 @@ const ProductExcel = ({ reader.readAsArrayBuffer(file); }; - // const uploadAndProcessExcel = (file) => { - // const reader = new FileReader(); - - // reader.onload = (e) => { - // const data = new Uint8Array(e.target.result); - - // const workbook = read(data, { type: 'array' }); - // const worksheet = workbook.Sheets[workbook.SheetNames[0]]; - - // const jsonData = utils.sheet_to_json(worksheet, { - // header: 1, - // raw: false, - // dateNF: 'DD/MM/YY', - // }); - - // const nonEmptyRows = jsonData.filter((row) => - // row.some((cell) => cell !== '') - // ); - - // const header = nonEmptyRows[0]; - // const rows = nonEmptyRows.slice(1); - - // const dateFields = [ - // 'Available From', - // 'Available To', - // 'Manufacture Date', - // 'Expire Date', - // 'Stock Date', - // ]; - - // function convertToDisplayFormat(dateString) { - // const date = new Date(dateString); - // const day = date.getDate().toString().padStart(2, '0'); - // const month = (date.getMonth() + 1).toString().padStart(2, '0'); - // const year = date.getFullYear().toString(); - // return `${day}-${month}-${year}`; - // } - - // const formattedData = rows.map((row) => { - // let rowData = header.reduce((acc, col, columnIndex) => { - // if (dateFields?.includes(col)) { - // acc[col] = convertToDisplayFormat(row[columnIndex]); - // } else { - // acc[col] = row[columnIndex]; - // } - // return acc; - // }, {}); - - // return rowData; - // }); - - // if (jsonData.length > 0) { - // const extractedHeaders = Object.keys(formattedData[0]); - - // const filteredData = formattedData.filter( - // (item) => !Object.values(item)?.includes('sample row') - // ); - - // // ✅ Add default variant name if missing - // const updatedData = filteredData.map((item) => ({ - // ...item, - // 'Product Varient Name': - // item['Product Varient Name'] === undefined - // ? 'Variant 1' - // : item['Product Varient Name'], - // 'Available To': - // item['Available To'] == 'NaN-NaN-NaN' ? '' : item['Available To'], - // ProdId: item['ProdId'] || null, - // })); - - // // Detect modified products - - // const modifiedProducts = findModifiedProducts(OrginalData, updatedData); - // const modifiedIds = new Set(modifiedProducts.map((p) => p.ProdId)); - // const originalIds = new Set(OrginalData?.map((p) => p.ProdId) || []); - // const markedData = updatedData - // .map((item) => ({ - // ...item, - // isModified: - // modifiedIds.has(item.ProdId) || !originalIds.has(item.ProdId), - // })) - // .sort((a, b) => b.isModified - a.isModified); - // setUploadedRawData(markedData); - // console.log(modifiedProducts, 'modifiedProducts'); - - // // ✅ Set only once with final data - // setHeaders(extractedHeaders); - - // autoMapFields(extractedHeaders); - // dispatch(uploadExcel({ file, jsonData: nonEmptyRows })); - // setWorksheet(worksheet); - // setDatas([]); // Clear mapped state initially - // setExcelData([]); - // } - - // // setMappingOpen(true); - // dispatch(uploadExcel({ file, jsonData: nonEmptyRows })); - // setWorksheet(worksheet); - // setWorksheet1(worksheet1); - // setDatas(formattedData); // Update Datas state here - // // setExcelData(formattedData); - // }; - - // reader.readAsArrayBuffer(file); - // }; - useEffect(() => { imagecall(); addOnlineImage(); @@ -1875,24 +1772,6 @@ const ProductExcel = ({ } }); - // // Now set protection for all rows - // // First, unlock ALL cells in the worksheet - // for (let rowNum = 1; rowNum <= worksheet.rowCount; rowNum++) { - // const row = worksheet.getRow(rowNum); - // row.eachCell({ includeEmpty: true }, (cell, colNumber) => { - // const config = selectedColumns[colNumber - 1]; - // cell.protection = { locked: config?.locked || false }; - // }); - // } - - // // Then lock ONLY the header row (row 1) and sample row (row 2) - // worksheet.getRow(1).eachCell({ includeEmpty: true }, (cell) => { - // cell.protection = { locked: true }; - // }); - - // worksheet.getRow(2).eachCell({ includeEmpty: true }, (cell) => { - // cell.protection = { locked: true }; - // }); // Add empty rows for data entry for (let i = 1; i <= 1000; i++) { worksheet.addRow({}); @@ -2497,18 +2376,6 @@ const ProductExcel = ({ } }; - // Usage examples: - // Download only specific fields: - // handleDownload(['ProdName', 'Size']); // Only Product Name and Quantity - // handleDownload(['ProdName', 'Size', 'UOM', 'SellPrice']); // Multiple fields - // handleDownload(['ProdName', 'Size', 'UOM', 'SellPrice', 'ProdCat', 'Brand']); // More fields - - // Available field names: - // 'ProdName', 'Size', 'UOM', 'SellPrice', 'ProdCat', 'ProdSubCat', 'Brand', - // 'ProdVarientName', 'MRP', 'StockAvailable', 'OfferPrice', 'Supplier', 'TaxId', - // 'AutoGenerateQr', 'AddQrCode', 'SpecialPrice', 'OnePiecePrice', 'AutoGenOnePieceQr', - // 'AutoGenOnePieceQrNum', 'CESS', 'HSNCode', 'PartNumber', 'Rack', 'ManufDate', - // 'ExpDate', 'AvailableFrom', 'AvailableTo' const handleFileSubmit = (e) => { e.preventDefault(); if (excelFile === null) { @@ -2883,7 +2750,7 @@ const ProductExcel = ({
@@ -3162,13 +3029,24 @@ const ProductExcel = ({ display: 'flex', flexDirection: 'column', justifyContent: 'space-between', - height: '80%', + alignItems: 'center', + height: '60%', }} >
- {col.title} + + {col.title} + {!isMapped && ( - Not mapped + + Not mapped + )}
@@ -3217,7 +3095,7 @@ const ProductExcel = ({ style={{ position: 'absolute', right: '-17px', - top: '80%', + top: '90%', transform: 'translateY(-50%)', color: 'red', fontSize: 14, @@ -3347,111 +3225,102 @@ const ProductExcel = ({ autoComplete="off" onSubmit={handleFileSubmit} > -
-

- Upload Your Excel -

+
+
+

+ Upload Your Excel +

+
+ +
+ +
+
+
handleExportData()} + > +
+ +
+
+ Export Excel +
+
+ + {message && ( +
No Data Found
+ )} +
+ + {excelData?.length > 0 && excelData && ( +
+ + + +
+ )} +
0 ? 'space-between' : 'flex-end', + gap: '1rem', }} > - -
- + {excelData?.length > 0 && ( +
+
+

+ Modified +
+
+

+ Not Modified +
+ )} + + + -
handleExportData()} - > -
- -
-
- Export Excel -
-
- {/* {excelData?.length > 0 && excelData && -
setMappingOpen(true)}> -
- -
-
- Map Your Fields -
-
- } */} - {loading &&
Loading...
} - {message &&
No Data Found
}
- - {excelData?.length > 0 && excelData && ( -
- - - -
- )} -
-
0 ? 'space-between' : 'flex-end', - width: '100%', - }} - > - {excelData?.length > 0 && ( -
-
-

- Modified -
-
-

- Not Modified -
-
- )} - - - -
{(!excelData || excelData?.length === 0) && ( @@ -3542,13 +3411,6 @@ const ProductExcel = ({ margin: '1rem 0rem', }} > - {/* -
- - Download -
-
*/} - {excelData && excelData?.length > 0 && (
-
+ setMappingOpen(false)} > {requiredFields.map((field) => { diff --git a/src/Pages/Product/ProductList.jsx b/src/Pages/Product/ProductList.jsx index 98d0b0e..a2edd1c 100644 --- a/src/Pages/Product/ProductList.jsx +++ b/src/Pages/Product/ProductList.jsx @@ -2714,7 +2714,7 @@ const ProductList = () => { open={openExcel} title="Bulk Upload" footer={true} - width={excelDataValues?.length > 0 ? 2500 : 600} + width={excelDataValues?.length > 0 ? 2500 : 700} className={'bulkuploadmodal'} children={ <> diff --git a/src/Styles/BookingScreen/Components/BSItemCards/BSItemCard.scss b/src/Styles/BookingScreen/Components/BSItemCards/BSItemCard.scss index 3cc2a73..5f386db 100644 --- a/src/Styles/BookingScreen/Components/BSItemCards/BSItemCard.scss +++ b/src/Styles/BookingScreen/Components/BSItemCards/BSItemCard.scss @@ -78,7 +78,7 @@ } .BSItemCard-content { - padding: 1px 0; + padding: 3px 0; background-color: rgba(255, 255, 255, 0.8); position: absolute; display: flex; @@ -96,7 +96,8 @@ font-weight: 500; max-width: 130px; display: -webkit-box; - -webkit-line-clamp: 3; + -webkit-line-clamp: 2; + line-height: 1; -webkit-box-orient: vertical; overflow: hidden; } diff --git a/src/Styles/OverAllStyle/OverAllStyle.scss b/src/Styles/OverAllStyle/OverAllStyle.scss index 841b020..bfd5707 100644 --- a/src/Styles/OverAllStyle/OverAllStyle.scss +++ b/src/Styles/OverAllStyle/OverAllStyle.scss @@ -1721,3 +1721,17 @@ table { right: 2rem; } } + +.addVariant { + background: #23378a29; + color: #23378a; + padding: 12px 24px; + border: none; + font-family: "Poppins", sans-serif; + font-size: 14px; + font-weight: 500; + cursor: pointer; + border-radius: 6px; + outline: none; + height: max-content; +} diff --git a/src/Styles/Product/excel.scss b/src/Styles/Product/excel.scss index 00a9214..a964f20 100644 --- a/src/Styles/Product/excel.scss +++ b/src/Styles/Product/excel.scss @@ -8,12 +8,7 @@ font-weight: bold !important; } -// .viewerExcelupload table { -// // table-layout: auto !important; -// } - .viewerExcelupload::-webkit-scrollbar { - // display: block !important; width: 0rem; height: 0.5rem; } @@ -28,7 +23,7 @@ background-color: #1292ee; color: #fff; border-radius: 4px; - font-family: 'Poppins'; + font-family: "Poppins"; font-size: 16px; svg { @@ -48,6 +43,8 @@ .tableExcelUpload { .ant-table-cell { padding: 0 8px !important; + font-family: "Poppins"; + font-weight: 500 !important; } .ant-select-selection-placeholder { @@ -129,16 +126,16 @@ } .mdsheet { - width: 25px; - height: 25px; + width: 20px; + height: 20px; border: 1px solid #5bff73; background-color: #b3ffbf; border-radius: 4px; } .mdsheet2 { - width: 25px; + width: 20px; + height: 20px; border-radius: 4px; - height: 25px; background-color: #ffc7f8; border: 1px solid #ff74ec; } @@ -148,5 +145,88 @@ font-family: "Poppins"; font-size: 14px; font-weight: 500; + @media (max-width: 500px) { + font-size: 10px; + } } -} \ No newline at end of file +} + +.field-setup-selected-fields { + display: flex; + flex-wrap: wrap; + gap: 4px; + margin-bottom: 50px; + height: max-content; + max-height: 50vh; + overflow: auto; + + .selected-field { + display: flex; + align-items: center; + gap: 4px; + background: #0bad77; + padding: 6px 10px; + border-radius: 6px; + font-size: 13px; + font-weight: 600; + color: #fff; + + .close-icon { + display: flex; + align-items: center; + cursor: pointer; + + > svg { + color: #ffffffff !important; + } + } + } +} + +.HeadingUploadExl { + display: flex; + align-items: center; + justify-content: space-between; + gap: 1rem; + width: 50%; + @media (max-width: 950px) { + width: 100%; + } +} +.download-linkMain { + display: flex; + align-items: center; + gap: 1rem; + justify-content: space-between; + margin-bottom: 10px; + @media (max-width: 950px) { + flex-wrap: wrap; + } +} + +.download-link { + width: 50%; + justify-content: space-between; + align-items: center; + @media (max-width: 950px) { + width: 100%; + } +} + +.viewerExcelupload { + .ant-select-selection-item { + margin-top: 0 !important ; + padding-top: 0 !important; + } +} + +.download-link span { + font-size: 12px; + font-weight: 400; +} +.imgUpldr { + display: flex; + flex-direction: column; + align-items: center; + gap: 2px; +} From 7f0f1112f8b07cfe39eb4f1e71bf7a23b6071b83 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Mar 2026 09:35:26 +0530 Subject: [PATCH 03/17] same product offer message display --- .../BSBillingEditQuantity.jsx | 262 ++++++----- .../BSBillingTable3/BSBillingTable3.jsx | 436 +++++++++--------- .../Components/BSItemCards/BSItemCard.jsx | 58 ++- 3 files changed, 412 insertions(+), 344 deletions(-) diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx index 9c84e49..b0ea151 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx @@ -54,7 +54,7 @@ const BSBillingEditQuantity = (props) => { const quantityInputRef = useRef(null); const priceChangeInputRef = useRef(null); const reductionInputRef = useRef(null); - const { setIndex = () => {} } = props; + const { setIndex = () => { } } = props; const [disableSubmitButton, setDisableSubmitButton] = useState(false); console.log(disableSubmitButton, 'disableSubmitButton'); @@ -522,7 +522,15 @@ const BSBillingEditQuantity = (props) => { cartItem?.InwardDtlId === editedProduct?.InwardDtlId && cartItem?.OrderRate === editedProduct?.OrderRate && cartItem?.BookingTypeName === editedProduct?.BookingTypeName && - !cartItem?.SalesId + !cartItem?.SalesId && ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B' + ? true + : cartItem?.OfferMode !== 'B') && + cartItem?.OfferMode !== 'P' && + cartItem?.OfferMode !== 'C' && + cartItem?.OfferMode !== 'O' && + cartItem?.OfferMode !== 'L' + ? true + : cartItem?.Offer === 0) ); // changing for one piece stock checking const isItemInCartfilter = CartOrderDetails?.filter( @@ -530,7 +538,15 @@ const BSBillingEditQuantity = (props) => { cartItem?.ProdId === editedProduct?.ProdId && cartItem?.InwardDtlId === editedProduct?.InwardDtlId && cartItem?.OrderRate !== editedProduct?.OrderRate && - !cartItem?.SalesId + !cartItem?.SalesId && ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B' + ? true + : cartItem?.OfferMode !== 'B') && + cartItem?.OfferMode !== 'P' && + cartItem?.OfferMode !== 'C' && + cartItem?.OfferMode !== 'O' && + cartItem?.OfferMode !== 'L' + ? true + : cartItem?.Offer === 0) ); const isItemInCartHold = CartOrderDetails?.find( @@ -538,7 +554,15 @@ const BSBillingEditQuantity = (props) => { cartItem?.ProdId === editedProduct?.ProdId && cartItem?.InwardDtlId === editedProduct.InwardDtlId && cartItem?.OrderRate === editedProduct?.OrderRate && - cartItem?.BookingTypeName === editedProduct?.BookingTypeName + cartItem?.BookingTypeName === editedProduct?.BookingTypeName && ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B' + ? true + : cartItem?.OfferMode !== 'B') && + cartItem?.OfferMode !== 'P' && + cartItem?.OfferMode !== 'C' && + cartItem?.OfferMode !== 'O' && + cartItem?.OfferMode !== 'L' + ? true + : cartItem?.Offer === 0) ); // check if the item is already in the cart const isItemInCartHoldfilter = CartOrderDetails?.filter( (cartItem) => @@ -547,7 +571,15 @@ const BSBillingEditQuantity = (props) => { !( (cartItem?.OrderRate === editedProduct?.OrderRate) // && cartItem?.BookingTypeName === editedProduct?.BookingTypeName - ) + ) && ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B' + ? true + : cartItem?.OfferMode !== 'B') && + cartItem?.OfferMode !== 'P' && + cartItem?.OfferMode !== 'C' && + cartItem?.OfferMode !== 'O' && + cartItem?.OfferMode !== 'L' + ? true + : cartItem?.Offer === 0) ); if ( @@ -809,7 +841,7 @@ const BSBillingEditQuantity = (props) => { return ( cartItem?.InwardDtlId === editedProduct?.InwardDtlId && cartItem?.OfferMessage?.[0]?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && cartItem?.OfferMode === editedProduct?.OfferMode && cartItem?.BookingTypeName !== editedProduct?.BookingTypeName ); @@ -943,7 +975,7 @@ const BSBillingEditQuantity = (props) => { cartItem?.InwardDtlId === editedProduct?.InwardDtlId && cartItem?.OrderRate === editedProduct?.OrderRate && cartItem?.BookingTypeName !== - editedProduct?.BookingTypeName && + editedProduct?.BookingTypeName && !cartItem?.OfferMode && cartItem?.Offer === 0 ); @@ -957,7 +989,7 @@ const BSBillingEditQuantity = (props) => { cartItem?.InwardDtlId === editedProduct?.InwardDtlId && cartItem?.OrderRate === editedProduct?.OrderRate && cartItem?.BookingTypeName !== - editedProduct?.BookingTypeName && + editedProduct?.BookingTypeName && cartItem?.OfferMode === editedProduct?.OfferMode && cartItem?.Offer > 0 ); @@ -1090,7 +1122,7 @@ const BSBillingEditQuantity = (props) => { ) ) && product?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && product?.OfferMode === editedProduct?.OfferMode ) { const freeQty = @@ -1123,7 +1155,7 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && offerProduct?.OfferMode === editedProduct?.OfferMode; if (hasMatchingFreeProduct && isMatchingOffer) { @@ -1206,7 +1238,7 @@ const BSBillingEditQuantity = (props) => { ) ) && product?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && product?.OfferMode === editedProduct?.OfferMode ) { return { @@ -1236,7 +1268,7 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && offerProduct?.OfferMode === editedProduct?.OfferMode; if (hasMatchingFreeProduct && isMatchingOffer) { @@ -1423,7 +1455,7 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && offerProduct?.OfferMode === editedProduct?.OfferMode; if (hasMatchingFreeProduct && isMatchingOffer) { @@ -1525,7 +1557,7 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && offerProduct?.OfferMode === editedProduct?.OfferMode; if (hasMatchingFreeProduct && isMatchingOffer) { @@ -1679,7 +1711,7 @@ const BSBillingEditQuantity = (props) => { ) && cartItem?.Offer && isFreeProductApplicable?.OfferId === - cartItem?.OfferMessage?.[0]?.OfferId + cartItem?.OfferMessage?.[0]?.OfferId ); } ); @@ -1968,11 +2000,11 @@ const BSBillingEditQuantity = (props) => { product?.ProdId === editedProduct?.ProdId && product?.InwardDtlId === editedProduct?.InwardDtlId && product?.OfferId === - (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) && + (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) && product?.OfferMode === - (sameBookingTypeProduct?.OfferMode || - otherBookingTypeProduct?.OfferMode) + (sameBookingTypeProduct?.OfferMode || + otherBookingTypeProduct?.OfferMode) ) { return { ...product, @@ -2006,11 +2038,11 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) && + (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) && offerProduct?.OfferMode === - (sameBookingTypeProduct?.OfferMode || - otherBookingTypeProduct?.OfferMode); + (sameBookingTypeProduct?.OfferMode || + otherBookingTypeProduct?.OfferMode); if (hasMatchingFreeProduct && isMatchingOffer) { // Get loyalty points from the matching free product @@ -2151,7 +2183,7 @@ const BSBillingEditQuantity = (props) => { cartItem?.Offer > 0 && isFreeProductApplicable?.OfferMode === cartItem?.OfferMode && isFreeProductApplicable?.OfferId === - cartItem?.OfferMessage?.[0]?.OfferId + cartItem?.OfferMessage?.[0]?.OfferId ); } ); @@ -2254,11 +2286,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.InwardDtlId === - otherBookingTypeProduct.InwardDtlId && + otherBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - otherBookingTypeProduct.BookingTypeName && + otherBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - otherBookingTypeProduct.OrderRate && + otherBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2329,12 +2361,12 @@ const BSBillingEditQuantity = (props) => { product?.ProdId === editedProduct?.ProdId && product?.InwardDtlId === editedProduct?.InwardDtlId && product?.OfferId === - (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeFreeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeFreeProduct?.OfferMessage?.[0] + ?.OfferId) && product?.OfferMode === - (sameBookingTypeFreeProduct?.OfferMode || - otherBookingTypeFreeProduct?.OfferMode) + (sameBookingTypeFreeProduct?.OfferMode || + otherBookingTypeFreeProduct?.OfferMode) ) { return { ...product, @@ -2368,13 +2400,13 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - (sameBookingTypeFreeProduct?.OfferMessage?.[0] - ?.OfferId || - otherBookingTypeFreeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeFreeProduct?.OfferMessage?.[0] + ?.OfferId || + otherBookingTypeFreeProduct?.OfferMessage?.[0] + ?.OfferId) && offerProduct?.OfferMode === - (sameBookingTypeFreeProduct?.OfferMode || - otherBookingTypeFreeProduct?.OfferMode); + (sameBookingTypeFreeProduct?.OfferMode || + otherBookingTypeFreeProduct?.OfferMode); if (hasMatchingFreeProduct && isMatchingOffer) { // Get loyalty points from the matching free product @@ -2456,11 +2488,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === sameBookingTypeProduct.ProdId && cartItem.InwardDtlId === - sameBookingTypeProduct.InwardDtlId && + sameBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - sameBookingTypeProduct.BookingTypeName && + sameBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - sameBookingTypeProduct.OrderRate && + sameBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2513,11 +2545,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === sameBookingTypeProduct.ProdId && cartItem.InwardDtlId === - sameBookingTypeProduct.InwardDtlId && + sameBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - sameBookingTypeProduct.BookingTypeName && + sameBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - sameBookingTypeProduct.OrderRate && + sameBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2606,11 +2638,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem?.InwardDtlId === - otherBookingTypeProduct.InwardDtlId && + otherBookingTypeProduct.InwardDtlId && cartItem?.BookingTypeName === - otherBookingTypeProduct.BookingTypeName && + otherBookingTypeProduct.BookingTypeName && cartItem?.OrderRate === - otherBookingTypeProduct.OrderRate && + otherBookingTypeProduct.OrderRate && cartItem?.OfferMode && cartItem?.Offer > 0 ) { @@ -2639,11 +2671,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.InwardDtlId === - otherBookingTypeProduct.InwardDtlId && + otherBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - otherBookingTypeProduct.BookingTypeName && + otherBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - otherBookingTypeProduct.OrderRate && + otherBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2673,11 +2705,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.InwardDtlId === - otherBookingTypeProduct.InwardDtlId && + otherBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - otherBookingTypeProduct.BookingTypeName && + otherBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - otherBookingTypeProduct.OrderRate && + otherBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2776,12 +2808,12 @@ const BSBillingEditQuantity = (props) => { product?.ProdId === editedProduct?.ProdId && product?.InwardDtlId === editedProduct?.InwardDtlId && product?.OfferId === - (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeFreeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeFreeProduct?.OfferMessage?.[0] + ?.OfferId) && product?.OfferMode === - (sameBookingTypeFreeProduct?.OfferMode || - otherBookingTypeFreeProduct?.OfferMode) + (sameBookingTypeFreeProduct?.OfferMode || + otherBookingTypeFreeProduct?.OfferMode) ) { return { ...product, @@ -2815,12 +2847,12 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeProduct?.OfferMessage?.[0] + ?.OfferId) && offerProduct?.OfferMode === - (sameBookingTypeProduct?.OfferMode || - otherBookingTypeProduct?.OfferMode); + (sameBookingTypeProduct?.OfferMode || + otherBookingTypeProduct?.OfferMode); if (hasMatchingFreeProduct && isMatchingOffer) { // Get loyalty points from the matching free product @@ -2899,11 +2931,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === sameBookingTypeProduct.ProdId && cartItem.InwardDtlId === - sameBookingTypeProduct.InwardDtlId && + sameBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - sameBookingTypeProduct.BookingTypeName && + sameBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - sameBookingTypeProduct.OrderRate && + sameBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2962,11 +2994,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.InwardDtlId === - otherBookingTypeProduct.InwardDtlId && + otherBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - otherBookingTypeProduct.BookingTypeName && + otherBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - otherBookingTypeProduct.OrderRate && + otherBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -3038,12 +3070,12 @@ const BSBillingEditQuantity = (props) => { product?.ProdId === editedProduct?.ProdId && product?.InwardDtlId === editedProduct?.InwardDtlId && product?.OfferId === - (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeFreeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeFreeProduct?.OfferMessage?.[0] + ?.OfferId) && product?.OfferMode === - (sameBookingTypeFreeProduct?.OfferMode || - otherBookingTypeFreeProduct?.OfferMode) + (sameBookingTypeFreeProduct?.OfferMode || + otherBookingTypeFreeProduct?.OfferMode) ) { return { ...product, @@ -3077,12 +3109,12 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeProduct?.OfferMessage?.[0] + ?.OfferId) && offerProduct?.OfferMode === - (sameBookingTypeProduct?.OfferMode || - otherBookingTypeProduct?.OfferMode); + (sameBookingTypeProduct?.OfferMode || + otherBookingTypeProduct?.OfferMode); if (hasMatchingFreeProduct && isMatchingOffer) { // Get loyalty points from the matching free product @@ -3217,21 +3249,21 @@ const BSBillingEditQuantity = (props) => { }), ...(!offerApply && itemDiscountPrice > 0 ? { - DiscountAmt: safeRound(itemDiscountPrice * fixedQty), - DiscountType: - itemDiscountPercentageSelection === 'Fixed' ? 'F' : 'P', - DiscountValue: - itemDiscountPercentageSelection === 'Fixed' - ? itemDiscountPrice * fixedQty - : ((itemDiscountPrice * fixedQty) / - (newPrice > 0 ? newPrice : editedProduct?.OrderRate)) * - 100, - } + DiscountAmt: safeRound(itemDiscountPrice * fixedQty), + DiscountType: + itemDiscountPercentageSelection === 'Fixed' ? 'F' : 'P', + DiscountValue: + itemDiscountPercentageSelection === 'Fixed' + ? itemDiscountPrice * fixedQty + : ((itemDiscountPrice * fixedQty) / + (newPrice > 0 ? newPrice : editedProduct?.OrderRate)) * + 100, + } : { - DiscountAmt: null, - DiscountType: null, - DiscountValue: null, - }), + DiscountAmt: null, + DiscountType: null, + DiscountValue: null, + }), }; if (hasOffer) { @@ -3256,17 +3288,17 @@ const BSBillingEditQuantity = (props) => { changeOrderCardDetails( CartOrderDetails?.map((i) => i?.InwardDtlId == updatedProduct?.InwardDtlId && - i?.BookingTypeName == updatedProduct?.BookingTypeName && - i?.localId === updatedProduct?.localId + i?.BookingTypeName == updatedProduct?.BookingTypeName && + i?.localId === updatedProduct?.localId ? { - ...updatedProduct, - Offer: 0, - OfferType: - updatedProduct?.Type === 'C' - ? updatedProduct?.OfferType - : null, - OfferMessage: null, - } + ...updatedProduct, + Offer: 0, + OfferType: + updatedProduct?.Type === 'C' + ? updatedProduct?.OfferType + : null, + OfferMessage: null, + } : i ) ) @@ -3302,10 +3334,10 @@ const BSBillingEditQuantity = (props) => { ((c?.OfferModeType && c?.OfferMode === 'B' ? true : c?.OfferMode !== 'B') && - c?.OfferMode !== 'P' && - c?.OfferMode !== 'C' && - c?.OfferMode !== 'O' && - c?.OfferMode !== 'L' + c?.OfferMode !== 'P' && + c?.OfferMode !== 'C' && + c?.OfferMode !== 'O' && + c?.OfferMode !== 'L' ? true : c?.Offer === 0); @@ -4040,14 +4072,14 @@ const BSBillingEditQuantity = (props) => {
{((RadioBtnSelection == 'Price' && disableSubmitButton) || RadioBtnSelection == 'Quantity') && ( - } - > - )} + } + > + )}
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3.jsx index 7e8b8cc..dd60bf0 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3.jsx @@ -217,16 +217,16 @@ const BSBillingTable3 = (Props) => { OrderType === 'Hold' ? tableData?.filter((a, b) => a.BookingTypeName === 'TakeAway') : tableData?.filter( - (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId - ); + (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId + ); const OldtableDataDinein = tableData?.filter( (a, b) => a.BookingTypeName === 'Dine In' && a?.SalesId ); const OldtableDataTakeAway = OrderType != 'Hold' ? tableData?.filter( - (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId - ) + (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId + ) : []; const [EditQuantity, setEditQuantity] = useState(false); const [Modaldata, setModaldata] = useState([]); @@ -473,27 +473,27 @@ const BSBillingTable3 = (Props) => { ) { if (BillOrderPre === 'Y') { const UpdatedCartItem = - // if the item is already in the cart, increase the quantity of the item - { - ...isItemInCart, - OrderQty: isItemInCart?.OrderQty - 1, - TotalAmt: - (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate, - TaxAmt: ( + // if the item is already in the cart, increase the quantity of the item + { + ...isItemInCart, + OrderQty: isItemInCart?.OrderQty - 1, + TotalAmt: + (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate, + TaxAmt: ( + ((isItemInCart?.OrderQty - 1) * + isItemInCart?.OrderRate * + isItemInCart?.TaxPercentage) / + (100 + isItemInCart?.TaxPercentage) + ).toFixed(2), + WithoutTaxRate: + (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate - + ( ((isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate * isItemInCart?.TaxPercentage) / (100 + isItemInCart?.TaxPercentage) ).toFixed(2), - WithoutTaxRate: - (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate - - ( - ((isItemInCart?.OrderQty - 1) * - isItemInCart?.OrderRate * - isItemInCart?.TaxPercentage) / - (100 + isItemInCart?.TaxPercentage) - ).toFixed(2), - }; + }; const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal]; @@ -504,27 +504,27 @@ const BSBillingTable3 = (Props) => { // } } else { const UpdatedCartItem = - // if the item is already in the cart, increase the quantity of the item - { - ...isItemInCart, - OrderQty: isItemInCart?.OrderQty - 1, - TotalAmt: - (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate, - TaxAmt: ( + // if the item is already in the cart, increase the quantity of the item + { + ...isItemInCart, + OrderQty: isItemInCart?.OrderQty - 1, + TotalAmt: + (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate, + TaxAmt: ( + ((isItemInCart?.OrderQty - 1) * + isItemInCart?.OrderRate * + isItemInCart?.TaxPercentage) / + (100 + isItemInCart?.TaxPercentage) + ).toFixed(2), + WithoutTaxRate: + (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate - + ( ((isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate * isItemInCart?.TaxPercentage) / (100 + isItemInCart?.TaxPercentage) ).toFixed(2), - WithoutTaxRate: - (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate - - ( - ((isItemInCart?.OrderQty - 1) * - isItemInCart?.OrderRate * - isItemInCart?.TaxPercentage) / - (100 + isItemInCart?.TaxPercentage) - ).toFixed(2), - }; + }; const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem]; @@ -543,27 +543,27 @@ const BSBillingTable3 = (Props) => { ) { if (BillOrderPre === 'Y') { const UpdatedCartItem = - // if the item is already in the cart, increase the quantity of the item - { - ...isItemInCart, - OrderQty: isItemInCart?.OrderQty - 1, - TotalAmt: - (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate, - TaxAmt: ( + // if the item is already in the cart, increase the quantity of the item + { + ...isItemInCart, + OrderQty: isItemInCart?.OrderQty - 1, + TotalAmt: + (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate, + TaxAmt: ( + ((isItemInCart?.OrderQty - 1) * + isItemInCart?.OrderRate * + isItemInCart?.TaxPercentage) / + (100 + isItemInCart?.TaxPercentage) + ).toFixed(2), + WithoutTaxRate: + (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate - + ( ((isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate * isItemInCart?.TaxPercentage) / (100 + isItemInCart?.TaxPercentage) ).toFixed(2), - WithoutTaxRate: - (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate - - ( - ((isItemInCart?.OrderQty - 1) * - isItemInCart?.OrderRate * - isItemInCart?.TaxPercentage) / - (100 + isItemInCart?.TaxPercentage) - ).toFixed(2), - }; + }; const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal]; // if (OfferCheckedInSetup && preferenceOffer) { @@ -573,27 +573,27 @@ const BSBillingTable3 = (Props) => { // } } else { const UpdatedCartItem = - // if the item is already in the cart, increase the quantity of the item - { - ...isItemInCart, - OrderQty: isItemInCart?.OrderQty - 1, - TotalAmt: - (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate, - TaxAmt: ( + // if the item is already in the cart, increase the quantity of the item + { + ...isItemInCart, + OrderQty: isItemInCart?.OrderQty - 1, + TotalAmt: + (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate, + TaxAmt: ( + ((isItemInCart?.OrderQty - 1) * + isItemInCart?.OrderRate * + isItemInCart?.TaxPercentage) / + (100 + isItemInCart?.TaxPercentage) + ).toFixed(2), + WithoutTaxRate: + (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate - + ( ((isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate * isItemInCart?.TaxPercentage) / (100 + isItemInCart?.TaxPercentage) ).toFixed(2), - WithoutTaxRate: - (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate - - ( - ((isItemInCart?.OrderQty - 1) * - isItemInCart?.OrderRate * - isItemInCart?.TaxPercentage) / - (100 + isItemInCart?.TaxPercentage) - ).toFixed(2), - }; + }; const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem]; @@ -606,29 +606,29 @@ const BSBillingTable3 = (Props) => { } else if (isItemInCartHold && OrderType === 'Hold') { if (BillOrderPre === 'Y') { const UpdatedCartItem = - // if the item is already in the cart, increase the quantity of the item - { - ...isItemInCartHold, - OrderQty: isItemInCartHold?.OrderQty - 1, - TotalAmt: - (isItemInCartHold?.OrderQty - 1) * - isItemInCartHold?.OrderRate, - TaxAmt: ( + // if the item is already in the cart, increase the quantity of the item + { + ...isItemInCartHold, + OrderQty: isItemInCartHold?.OrderQty - 1, + TotalAmt: + (isItemInCartHold?.OrderQty - 1) * + isItemInCartHold?.OrderRate, + TaxAmt: ( + ((isItemInCartHold?.OrderQty - 1) * + isItemInCartHold?.OrderRate * + isItemInCartHold?.TaxPercentage) / + (100 + isItemInCartHold?.TaxPercentage) + ).toFixed(2), + WithoutTaxRate: + (isItemInCartHold?.OrderQty - 1) * + isItemInCartHold?.OrderRate - + ( ((isItemInCartHold?.OrderQty - 1) * isItemInCartHold?.OrderRate * isItemInCartHold?.TaxPercentage) / (100 + isItemInCartHold?.TaxPercentage) ).toFixed(2), - WithoutTaxRate: - (isItemInCartHold?.OrderQty - 1) * - isItemInCartHold?.OrderRate - - ( - ((isItemInCartHold?.OrderQty - 1) * - isItemInCartHold?.OrderRate * - isItemInCartHold?.TaxPercentage) / - (100 + isItemInCartHold?.TaxPercentage) - ).toFixed(2), - }; + }; const UpdatedData = [ UpdatedCartItem, @@ -642,29 +642,29 @@ const BSBillingTable3 = (Props) => { // } } else { const UpdatedCartItem = - // if the item is already in the cart, increase the quantity of the item - { - ...isItemInCartHold, - OrderQty: isItemInCartHold?.OrderQty - 1, - TotalAmt: - (isItemInCartHold?.OrderQty - 1) * - isItemInCartHold?.OrderRate, - TaxAmt: ( + // if the item is already in the cart, increase the quantity of the item + { + ...isItemInCartHold, + OrderQty: isItemInCartHold?.OrderQty - 1, + TotalAmt: + (isItemInCartHold?.OrderQty - 1) * + isItemInCartHold?.OrderRate, + TaxAmt: ( + ((isItemInCartHold?.OrderQty - 1) * + isItemInCartHold?.OrderRate * + isItemInCartHold?.TaxPercentage) / + (100 + isItemInCartHold?.TaxPercentage) + ).toFixed(2), + WithoutTaxRate: + (isItemInCartHold?.OrderQty - 1) * + isItemInCartHold?.OrderRate - + ( ((isItemInCartHold?.OrderQty - 1) * isItemInCartHold?.OrderRate * isItemInCartHold?.TaxPercentage) / (100 + isItemInCartHold?.TaxPercentage) ).toFixed(2), - WithoutTaxRate: - (isItemInCartHold?.OrderQty - 1) * - isItemInCartHold?.OrderRate - - ( - ((isItemInCartHold?.OrderQty - 1) * - isItemInCartHold?.OrderRate * - isItemInCartHold?.TaxPercentage) / - (100 + isItemInCartHold?.TaxPercentage) - ).toFixed(2), - }; + }; const UpdatedData = [ ...OtherorderDataforNormalWithoutSalesId, @@ -968,26 +968,26 @@ const BSBillingTable3 = (Props) => { if (isItemInCart && BookingTypeProd != 'Dine In' && OrderType != 'Hold') { if (BillOrderPre === 'Y') { const UpdatedCartItem = - // if the item is already in the cart, increase the quantity of the item - { - ...isItemInCart, - OrderQty: isItemInCart?.OrderQty + 1, - TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate, - TaxAmt: ( + // if the item is already in the cart, increase the quantity of the item + { + ...isItemInCart, + OrderQty: isItemInCart?.OrderQty + 1, + TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate, + TaxAmt: ( + ((isItemInCart?.OrderQty + 1) * + isItemInCart?.OrderRate * + isItemInCart?.TaxPercentage) / + (100 + isItemInCart?.TaxPercentage) + ).toFixed(2), + WithoutTaxRate: + (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate - + ( ((isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate * isItemInCart?.TaxPercentage) / (100 + isItemInCart?.TaxPercentage) ).toFixed(2), - WithoutTaxRate: - (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate - - ( - ((isItemInCart?.OrderQty + 1) * - isItemInCart?.OrderRate * - isItemInCart?.TaxPercentage) / - (100 + isItemInCart?.TaxPercentage) - ).toFixed(2), - }; + }; const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal]; @@ -998,26 +998,26 @@ const BSBillingTable3 = (Props) => { // } } else { const UpdatedCartItem = - // if the item is already in the cart, increase the quantity of the item - { - ...isItemInCart, - OrderQty: isItemInCart?.OrderQty + 1, - TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate, - TaxAmt: ( + // if the item is already in the cart, increase the quantity of the item + { + ...isItemInCart, + OrderQty: isItemInCart?.OrderQty + 1, + TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate, + TaxAmt: ( + ((isItemInCart?.OrderQty + 1) * + isItemInCart?.OrderRate * + isItemInCart?.TaxPercentage) / + (100 + isItemInCart?.TaxPercentage) + ).toFixed(2), + WithoutTaxRate: + (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate - + ( ((isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate * isItemInCart?.TaxPercentage) / (100 + isItemInCart?.TaxPercentage) ).toFixed(2), - WithoutTaxRate: - (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate - - ( - ((isItemInCart?.OrderQty + 1) * - isItemInCart?.OrderRate * - isItemInCart?.TaxPercentage) / - (100 + isItemInCart?.TaxPercentage) - ).toFixed(2), - }; + }; const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem]; @@ -1036,26 +1036,26 @@ const BSBillingTable3 = (Props) => { ) { if (BillOrderPre === 'Y') { const UpdatedCartItem = - // if the item is already in the cart, increase the quantity of the item - { - ...isItemInCart, - OrderQty: isItemInCart?.OrderQty + 1, - TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate, - TaxAmt: ( + // if the item is already in the cart, increase the quantity of the item + { + ...isItemInCart, + OrderQty: isItemInCart?.OrderQty + 1, + TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate, + TaxAmt: ( + ((isItemInCart?.OrderQty + 1) * + isItemInCart?.OrderRate * + isItemInCart?.TaxPercentage) / + (100 + isItemInCart?.TaxPercentage) + ).toFixed(2), + WithoutTaxRate: + (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate - + ( ((isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate * isItemInCart?.TaxPercentage) / (100 + isItemInCart?.TaxPercentage) ).toFixed(2), - WithoutTaxRate: - (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate - - ( - ((isItemInCart?.OrderQty + 1) * - isItemInCart?.OrderRate * - isItemInCart?.TaxPercentage) / - (100 + isItemInCart?.TaxPercentage) - ).toFixed(2), - }; + }; const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal]; @@ -1066,26 +1066,26 @@ const BSBillingTable3 = (Props) => { // } } else { const UpdatedCartItem = - // if the item is already in the cart, increase the quantity of the item - { - ...isItemInCart, - OrderQty: isItemInCart?.OrderQty + 1, - TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate, - TaxAmt: ( + // if the item is already in the cart, increase the quantity of the item + { + ...isItemInCart, + OrderQty: isItemInCart?.OrderQty + 1, + TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate, + TaxAmt: ( + ((isItemInCart?.OrderQty + 1) * + isItemInCart?.OrderRate * + isItemInCart?.TaxPercentage) / + (100 + isItemInCart?.TaxPercentage) + ).toFixed(2), + WithoutTaxRate: + (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate - + ( ((isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate * isItemInCart?.TaxPercentage) / (100 + isItemInCart?.TaxPercentage) ).toFixed(2), - WithoutTaxRate: - (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate - - ( - ((isItemInCart?.OrderQty + 1) * - isItemInCart?.OrderRate * - isItemInCart?.TaxPercentage) / - (100 + isItemInCart?.TaxPercentage) - ).toFixed(2), - }; + }; const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem]; @@ -1098,27 +1098,27 @@ const BSBillingTable3 = (Props) => { } else if (isItemInCartHold && OrderType === 'Hold') { if (BillOrderPre === 'Y') { const UpdatedCartItem = - // if the item is already in the cart, increase the quantity of the item - { - ...isItemInCartHold, - OrderQty: isItemInCartHold?.OrderQty + 1, - TotalAmt: - (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate, - TaxAmt: ( + // if the item is already in the cart, increase the quantity of the item + { + ...isItemInCartHold, + OrderQty: isItemInCartHold?.OrderQty + 1, + TotalAmt: + (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate, + TaxAmt: ( + ((isItemInCartHold?.OrderQty + 1) * + isItemInCartHold?.OrderRate * + isItemInCartHold?.TaxPercentage) / + (100 + isItemInCartHold?.TaxPercentage) + ).toFixed(2), + WithoutTaxRate: + (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate - + ( ((isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate * isItemInCartHold?.TaxPercentage) / (100 + isItemInCartHold?.TaxPercentage) ).toFixed(2), - WithoutTaxRate: - (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate - - ( - ((isItemInCartHold?.OrderQty + 1) * - isItemInCartHold?.OrderRate * - isItemInCartHold?.TaxPercentage) / - (100 + isItemInCartHold?.TaxPercentage) - ).toFixed(2), - }; + }; const UpdatedData = [ UpdatedCartItem, @@ -1132,27 +1132,27 @@ const BSBillingTable3 = (Props) => { // } } else { const UpdatedCartItem = - // if the item is already in the cart, increase the quantity of the item - { - ...isItemInCartHold, - OrderQty: isItemInCartHold?.OrderQty + 1, - TotalAmt: - (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate, - TaxAmt: ( + // if the item is already in the cart, increase the quantity of the item + { + ...isItemInCartHold, + OrderQty: isItemInCartHold?.OrderQty + 1, + TotalAmt: + (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate, + TaxAmt: ( + ((isItemInCartHold?.OrderQty + 1) * + isItemInCartHold?.OrderRate * + isItemInCartHold?.TaxPercentage) / + (100 + isItemInCartHold?.TaxPercentage) + ).toFixed(2), + WithoutTaxRate: + (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate - + ( ((isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate * isItemInCartHold?.TaxPercentage) / (100 + isItemInCartHold?.TaxPercentage) ).toFixed(2), - WithoutTaxRate: - (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate - - ( - ((isItemInCartHold?.OrderQty + 1) * - isItemInCartHold?.OrderRate * - isItemInCartHold?.TaxPercentage) / - (100 + isItemInCartHold?.TaxPercentage) - ).toFixed(2), - }; + }; const UpdatedData = [ ...OtherorderDataforNormalWithoutSalesId, @@ -1990,9 +1990,9 @@ const BSBillingTable3 = (Props) => { )?.map((item, idx) => idx === 0 ? { - ...item, - FreeQty, - } + ...item, + FreeQty, + } : item ), }; @@ -3155,7 +3155,7 @@ const BSBillingTable3 = (Props) => { } = section; if (!data?.length) return null; - + console.log(data, "OrderCart") // ── Disabled check ────────────────────────────────────────────────────────── const isDisabled = (item) => { if (isOld) { @@ -3395,8 +3395,8 @@ const BSBillingTable3 = (Props) => { style={{ fontFamily: 'Poppins' }} onClick={() => item.FullProductIdentifierDtls?.length > 0 || - item.ProductIdentifierDtls?.length > 0 || - imeiModal + item.ProductIdentifierDtls?.length > 0 || + imeiModal ? handleImeiDetails(item) : editField && handleEditQuantity(item, index) } @@ -3427,7 +3427,7 @@ const BSBillingTable3 = (Props) => {

- {item.OfferMessage?.split('>')?.[0] + + {item?.OfferModeType === true ? item.OfferMessage : item.OfferMessage?.split('>')?.[0] + `> ${item?.OrderQty} Eligible Free`}

)} @@ -3448,21 +3448,21 @@ const BSBillingTable3 = (Props) => { {productBasedExtraCharges?.find( (f) => f.ProdId === item.ProdId ) !== undefined && ( -
- Extra Charges :{' '} - { - productBasedExtraCharges.find( - (f) => f.ProdId === item.ProdId - )?.TotalAmt - } -
- )} +
+ Extra Charges :{' '} + { + productBasedExtraCharges.find( + (f) => f.ProdId === item.ProdId + )?.TotalAmt + } +
+ )} )} diff --git a/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx b/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx index 364d2e3..02957fd 100644 --- a/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx +++ b/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx @@ -2671,6 +2671,7 @@ const BSItemCard = (props) => { let OfferNeedToApply = true; let updatedFreeProductList = []; let sameProduct = false; + let TotalDiscount = 0; for (const offer of offers) { if (offer.OfferMode === 'B') { const { @@ -2679,6 +2680,7 @@ const BSItemCard = (props) => { OfferApply, updatedFreeProdList, ProductOfferType, + otherTotalDiscount } = applyBuyNGetFreeOffer(cartData, offer, item); offer.OfferAmount = OfferAmount; @@ -2686,6 +2688,7 @@ const BSItemCard = (props) => { OfferNeedToApply = OfferApply; updatedFreeProductList = updatedFreeProdList; sameProduct = ProductOfferType; + TotalDiscount = otherTotalDiscount; } if (!bestOffer || offer.OfferAmount > bestOffer.OfferAmount) { bestOffer = offer; @@ -2701,9 +2704,9 @@ const BSItemCard = (props) => { ? bestOffer?.OfferAmount || item.Offer : item.Offer || bestOffer?.OfferAmount, OfferType: item?.OfferType || bestOffer?.OfferType, - OfferMessage: item?.OfferMessage || bestOffer?.OfferMessage, + OfferMessage: sameProduct ? (bestOffer?.OfferMessage || item?.OfferMessage) : (item?.OfferMessage || bestOffer?.OfferMessage), OfferMode: item?.OfferMode || bestOffer?.OfferMode, - OfferModeType: sameProduct, + OfferModeType: sameProduct }; const shouldRemove = (c) => @@ -2728,6 +2731,12 @@ const BSItemCard = (props) => { : [...filteredCart, UpdatedCartItemWithOffer]; if (bestOffer && OfferNeedToApply) { + if (TotalDiscount > 0) { + bestOffer = { + ...bestOffer, + OfferAmount: TotalDiscount + } + } dispatch(ChangeOfferAppliedProducts(bestOffer)); } @@ -3117,6 +3126,7 @@ const BSItemCard = (props) => { function applyBuyNGetFreeOffer(cartItem, offer, item) { const freeList = offer.FreeProductsList || []; + let otherTotalDiscount = 0; let totalDiscount = 0; let offerMessage = ''; let OfferApply = true; @@ -3170,20 +3180,45 @@ const BSItemCard = (props) => { 0.5; sameProductOffer = true; } else if (isSameProduct) { - // 🔥 Buy N Get M (same product) - const buyQty = offer.BuyQty || 1; + // 🔥 Buy N Get N (same product) + const totalQty = freeCartItem?.reduce( + (acc, fc) => acc + (fc?.OrderQty || 0), + 0 + ); + + const buyQty = offer.MinQty || 1; const getQty = freeProd.FreeQty || 0; - const cycleSize = buyQty + getQty; - const fullCycles = Math.floor( - freeCartItem?.reduce((acc, fc) => acc + (fc?.OrderQty || 0), 0) / - cycleSize - ); - const totalFreeQty = fullCycles * getQty; + const groupSize = buyQty + getQty; + + // ✅ Discount logic (your existing correct logic) + const paidQty = Math.ceil(totalQty / groupSize); + const totalFreeQty = totalQty - paidQty; totalDiscount += totalFreeQty * freeCartItem?.[0].OrderRate; + + // check the offer applied for same product in different booking type + const differentBookTypeProd = freeCartItem?.filter((prod) => prod?.BookingTypeName !== item?.BookingTypeName && (prod?.Offer || 0) > 0 && prod?.OfferMode === offer?.OfferMode); + if (differentBookTypeProd?.length > 0) { + const diffBookTypeDis = differentBookTypeProd?.reduce( + (acc, fc) => acc + (fc?.Offer || 0), + 0 + ); + otherTotalDiscount = totalDiscount; + totalDiscount = totalDiscount - diffBookTypeDis; + } + sameProductOffer = true; - // offerMessage = `${freeProd.FreeProdName} -> ${Math.ceil(totalFreeQty / 2)} qty Free Eligible`; + + // ✅ Message logic (NEW) + const messageGroups = Math.ceil(totalQty / groupSize); + const eligibleFreeQty = messageGroups * getQty; + + + offerMessage = `${freeProd.FreeProdName} -> ${eligibleFreeQty} Eligible Free`; +// offerMessage = `${freeProd.FreeProdName} -> +// ( ${paidQty} Paid + ${eligibleFreeQty} Free Eligible ). \n +// saved ₹${otherTotalDiscount > 0 ? otherTotalDiscount : totalDiscount}`; } else { // 🔥 Different product free const buyQty = offer.BuyQty || 1; @@ -3283,6 +3318,7 @@ const BSItemCard = (props) => { OfferApply: OfferApply, updatedFreeProdList: updatedFreeProdList, ProductOfferType: sameProductOffer ? true : false, + otherTotalDiscount: otherTotalDiscount, }; } From 8025b74ca17d0be97c9a6cdf711cb4dfa7a96242 Mon Sep 17 00:00:00 2001 From: Srinath Date: Thu, 26 Mar 2026 11:36:35 +0530 Subject: [PATCH 04/17] Added model Close Funtionalies --- src/Features/BookingScreen/BookingData/BookingData.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Features/BookingScreen/BookingData/BookingData.js b/src/Features/BookingScreen/BookingData/BookingData.js index 1e02bcc..2c45c72 100644 --- a/src/Features/BookingScreen/BookingData/BookingData.js +++ b/src/Features/BookingScreen/BookingData/BookingData.js @@ -1416,6 +1416,13 @@ export const getOtherServiceTicket = createAsyncThunk( } } ); +// post /cancelPayment +export const PostCancelPayment = createAsyncThunk( + 'BookingData/cancelPayment', + async (postData) => { + return await axiosRetailInstanceData.post(`/cancelPayment`, postData); + } +); export const PostBlockSlots = createAsyncThunk( 'BookingData/PostBlockSlots', async (postData) => { @@ -1444,6 +1451,7 @@ export const getPaymentStatusForBusinessUPI = createAsyncThunk( } ); + export const getCurrentOrderid = createAsyncThunk( 'BookingData/getcurrentorderid', From 2ad325327be7c85973da0bee3d8fa695e303595d Mon Sep 17 00:00:00 2001 From: Srinath Date: Thu, 26 Mar 2026 11:36:55 +0530 Subject: [PATCH 05/17] Added model Close Funtionalies --- .../BSBillingTable3/BSBillingTable3pay.jsx | 359 ++++++++++-------- 1 file changed, 191 insertions(+), 168 deletions(-) diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx index 02f93fb..cc2e55b 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx @@ -141,6 +141,7 @@ import { changePreviousOrderOfferDetail, GlobalAllBookingType, changeSearchedData, + PostCancelPayment, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js'; import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities'; @@ -1035,7 +1036,7 @@ const BSBillingTable3Pay = () => { const selectedStyle = stylesMap[ - printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle + printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle ]; if (selectedStyle) { @@ -1574,7 +1575,15 @@ const BSBillingTable3Pay = () => { : AddBookingDetails(BookingType, true); } }; - + // PostCancelPayment + const CancelPayment = async () => { + const response = await dispatch(PostCancelPayment({OrderId: businessUPIOrderId})).unwrap() + if (response?.data?.statusCode) { + ClearAllGlobalStateDatas(); + CustomerDisplay(); + setBusinessUPI(false); + } + } const financialYearError = async () => { setMessageType('error'); setMessageData('Financial Year-Based Sales Not Yet Started'); @@ -2261,15 +2270,15 @@ const BSBillingTable3Pay = () => { OrderStatus: 'O', OrderType: BookingType === 'Dine In' || - BookingTypeBoth || - Estimation?.SettingValue == 'N' + BookingTypeBoth || + Estimation?.SettingValue == 'N' ? 'S' : GlobEstBooking === 'OvrAllEst' ? 'E' : GlobEstBooking === 'ParEst' ? GlobProdwisedata?.includes( - a.InwardDtlId + ' ' + a?.BookingTypeName - ) + a.InwardDtlId + ' ' + a?.BookingTypeName + ) ? 'E' : 'S' : 'S', @@ -2364,7 +2373,7 @@ const BSBillingTable3Pay = () => { : Paybtnnameselected?.toLowerCase() === 'credit' ? 'S' : Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'default' + SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', OrderDtlDetails: @@ -2381,9 +2390,9 @@ const BSBillingTable3Pay = () => { ? globalTipAmount === 0 ? SelectedTableDetails : SelectedTableDetails?.map((item) => ({ - ...item, - TipsAmount: globalTipAmount, - })) + ...item, + TipsAmount: globalTipAmount, + })) : null, SalesPaymentType: 'normal', PaymentDetail: [ @@ -2398,8 +2407,8 @@ const BSBillingTable3Pay = () => { ? PaymentgatewayUPI?.[0]?.ModeId : SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find( - (busupi) => busupi?.ModeId === UpiId - )?.ModeId + (busupi) => busupi?.ModeId === UpiId + )?.ModeId : paybtnselected : paybtnselected ? paybtnselected @@ -2412,15 +2421,15 @@ const BSBillingTable3Pay = () => { salesBillEdit && currentOrderNetAmount < previousNetAmount ? null : Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'business' + SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) - ?.MerchantId + ?.MerchantId : null, PaymentOptionType: salesBillEdit && - currentOrderNetAmount < previousNetAmount && - (refundPaySelectedName?.toLowerCase() === 'cash' || - refundPaySelectedName?.toLowerCase() === 'credit') + currentOrderNetAmount < previousNetAmount && + (refundPaySelectedName?.toLowerCase() === 'cash' || + refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' @@ -2440,29 +2449,29 @@ const BSBillingTable3Pay = () => { ? null : SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) - ?.UPIDetailId + ?.UPIDetailId : SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find( - (busupi) => busupi?.ModeId === UpiId - )?.MerchantUPIId + (busupi) => busupi?.ModeId === UpiId + )?.MerchantUPIId : null, AccountDtl: salesBillEdit && currentOrderNetAmount < previousNetAmount ? [] : Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'default' + SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( - (upipay) => upipay?.UPIId === UpiId - ) + (upipay) => upipay?.UPIId === UpiId + ) : (Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'pd') || - (Paybtnnameselected?.toLowerCase() === 'card' && - SelectedCardOption?.toLowerCase() === 'pd') + SelectedUPIPayOption?.toLowerCase() === 'pd') || + (Paybtnnameselected?.toLowerCase() === 'card' && + SelectedCardOption?.toLowerCase() === 'pd') ? useOptions?.[0]?.PaymentDetails?.PaymentDevice : (Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'pg') || - (Paybtnnameselected?.toLowerCase() === 'card' && - SelectedCardOption?.toLowerCase() === 'pg') + SelectedUPIPayOption?.toLowerCase() === 'pg') || + (Paybtnnameselected?.toLowerCase() === 'card' && + SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], PaymentStatus: @@ -2473,13 +2482,13 @@ const BSBillingTable3Pay = () => { : Paybtnnameselected?.toLowerCase() === 'credit' ? 'S' : Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'default' + SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', Debit: salesBillEdit && - currentOrderNetAmount < previousNetAmount && - refundPaySelectedName?.toLowerCase() === 'credit' + currentOrderNetAmount < previousNetAmount && + refundPaySelectedName?.toLowerCase() === 'credit' ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, Credit: salesBillEdit @@ -2557,14 +2566,14 @@ const BSBillingTable3Pay = () => { setMessageType('success'); setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); response?.data?.OrderDetails?.length > 0 && setPrintOrderDetails([response?.data]); @@ -2724,14 +2733,14 @@ const BSBillingTable3Pay = () => { setMessageType('success'); setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); response?.data?.OrderDetails?.length > 0 && setPrintOrderDetails([response?.data]); @@ -2834,14 +2843,14 @@ const BSBillingTable3Pay = () => { } setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); if (response?.data?.OrderDetails?.length > 0) { setPrintOrderDetails([response?.data]); @@ -3018,14 +3027,14 @@ const BSBillingTable3Pay = () => { setMessageType('success'); setMessageData( bookingpaymentupdate?.data?.response + - ' ' + - (bookingpaymentupdate?.data?.OrderDetails?.length > 0 - ? bookingpaymentupdate?.data?.OrderId && - extractLastNumberOrderId( - bookingpaymentupdate?.data?.OrderId, - bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus - ) - : '') + ' ' + + (bookingpaymentupdate?.data?.OrderDetails?.length > 0 + ? bookingpaymentupdate?.data?.OrderId && + extractLastNumberOrderId( + bookingpaymentupdate?.data?.OrderId, + bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus + ) + : '') ); bookingpaymentupdate?.data?.OrderDetails?.length > 0 && setPrintOrderDetails([bookingpaymentupdate?.data]); @@ -3044,7 +3053,7 @@ const BSBillingTable3Pay = () => { if ( Date.now() - startTime > useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes * - 60000 + 60000 ) { // 60,000 ms = 1 minute @@ -3751,9 +3760,9 @@ const BSBillingTable3Pay = () => { 'not-allowed', color: OrderCardDetail?.length > 0 || - (selOption?.value === undefined && - GlobalAddCustomerDetails1?.length === 0 && - GetCustId?.CustMobile === undefined) + (selOption?.value === undefined && + GlobalAddCustomerDetails1?.length === 0 && + GetCustId?.CustMobile === undefined) ? 'gray' : 'rgb(18, 146, 238)', fontSize: '28px', @@ -3775,16 +3784,16 @@ const BSBillingTable3Pay = () => { (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 'none' : 'auto', opacity: (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 0.5 : 1, width: '2rem', @@ -3807,14 +3816,14 @@ const BSBillingTable3Pay = () => { width: '1.5rem', cursor: OrderCardDetail?.length === 0 || - CheckBookingStatus == 'Close' || - addnewAccess + CheckBookingStatus == 'Close' || + addnewAccess ? 'not-allowed' : 'pointer', color: OrderCardDetail?.length === 0 || - CheckBookingStatus == 'Close' || - addnewAccess + CheckBookingStatus == 'Close' || + addnewAccess ? 'gray' : 'rgb(18, 146, 238)', display: 'flex', @@ -3850,8 +3859,8 @@ const BSBillingTable3Pay = () => { cursor: OrderCardDetail?.length > 0 && 'not-allowed', color: OrderCardDetail?.length > 0 || - (OrderCardDetail?.length > 0 && - GetCustId?.CustMobile === undefined) + (OrderCardDetail?.length > 0 && + GetCustId?.CustMobile === undefined) ? 'gray' : 'rgb(18, 146, 238)', fontSize: '25px', @@ -3938,65 +3947,65 @@ const BSBillingTable3Pay = () => { <> {unpaidFlow == false ? item?.OptionName == 'Hold' && - BookingType !== 'Dine In' && - !BookingTypeBoth && - OrderCardDetail?.length != 0 && - CheckOrderType?.length === 0 && - OrderType != 'Failed' && - CheckBookingStatus != 'Close' && - paybtns?.length > 0 && - !addnewAccess && ( - - {' '} - AddBookingDetails('Hold', false)} - style={{ - fontSize: '30px', - cursor: 'pointer', - color: '' ? '#52c41a' : '#1292EE', - }} - /> - - ) + BookingType !== 'Dine In' && + !BookingTypeBoth && + OrderCardDetail?.length != 0 && + CheckOrderType?.length === 0 && + OrderType != 'Failed' && + CheckBookingStatus != 'Close' && + paybtns?.length > 0 && + !addnewAccess && ( + + {' '} + AddBookingDetails('Hold', false)} + style={{ + fontSize: '30px', + cursor: 'pointer', + color: '' ? '#52c41a' : '#1292EE', + }} + /> + + ) : ''} {unpaidFlow == false ? item?.OptionName == 'Hold' && - paybtns?.length > 0 && - BookingType !== 'Dine In' && - !BookingTypeBoth && - Holddata?.length > 0 && - OrderCardDetail?.length == 0 && - CheckBookingStatus != 'Close' && - !addnewAccess && ( - 0 && + BookingType !== 'Dine In' && + !BookingTypeBoth && + Holddata?.length > 0 && + OrderCardDetail?.length == 0 && + CheckBookingStatus != 'Close' && + !addnewAccess && ( + + {' '} + - {' '} - - HandleholdModelOpen()} - style={{ - fontSize: '28px', - cursor: 'pointer', - color: Holddata ? '#52c41a' : 'default', - pointerEvents: - OrderType === 'Failed' ? 'none' : 'auto', - }} - /> - - - ) + HandleholdModelOpen()} + style={{ + fontSize: '28px', + cursor: 'pointer', + color: Holddata ? '#52c41a' : 'default', + pointerEvents: + OrderType === 'Failed' ? 'none' : 'auto', + }} + /> + + + ) : ''} ))} @@ -4042,14 +4051,14 @@ const BSBillingTable3Pay = () => { width: '1.5rem', cursor: OrderCardDetail?.length === 0 || - CheckBookingStatus == 'Close' || - addnewAccess + CheckBookingStatus == 'Close' || + addnewAccess ? 'not-allowed' : 'pointer', color: OrderCardDetail?.length === 0 || - CheckBookingStatus == 'Close' || - addnewAccess + CheckBookingStatus == 'Close' || + addnewAccess ? 'gray' : 'rgb(18, 146, 238)', display: 'flex', @@ -4148,31 +4157,31 @@ const BSBillingTable3Pay = () => { (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 'none' : 'auto', opacity: (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 0.5 : 1, }} > {paybtns?.length > 0 && - currentOrderNetAmount >= previousNetAmount ? ( + currentOrderNetAmount >= previousNetAmount ? ( paybtns?.map((payment) => (
@@ -3735,31 +3745,31 @@ export default function BST1Payment() { (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 'none' : 'auto', opacity: (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 0.5 : 1, }} > {paybtns?.length > 0 && - currentOrderNetAmount >= previousNetAmount ? ( + currentOrderNetAmount >= previousNetAmount ? ( paybtns?.map((payment) => (
)} + {showCancelConfirm && ( + { + setShowCancelConfirm(false); + CancelPayment() + }} + onCancel={() => setShowCancelConfirm(false)} + okText="Yes" + cancelText="No" + > + Do you want to cancel the payment? + + )}
); }; From 59dab4d1753f65bf52dda8d4bad152f913220107 Mon Sep 17 00:00:00 2001 From: Srinath Date: Thu, 26 Mar 2026 11:38:54 +0530 Subject: [PATCH 11/17] Added Payment QR Code model Close Funtionalies --- .../Components/UtillComponents/PaymentGatewayEmbedded.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Pages/BookingScreen/Components/UtillComponents/PaymentGatewayEmbedded.jsx b/src/Pages/BookingScreen/Components/UtillComponents/PaymentGatewayEmbedded.jsx index a72f095..a8ec70a 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/PaymentGatewayEmbedded.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/PaymentGatewayEmbedded.jsx @@ -1,6 +1,6 @@ import { useEffect, useRef, useState, useImperativeHandle, forwardRef } from 'react'; import { useDispatch } from 'react-redux'; -import { getPaymentStatusForBusinessUPI } from '../../../../Features/BookingScreen/BookingData/BookingData'; +import { getPaymentStatusForBusinessUPI, PostCancelPayment } from '../../../../Features/BookingScreen/BookingData/BookingData'; const PaymentGatewayEmbedded = forwardRef(({ orderId, @@ -65,6 +65,7 @@ const PaymentGatewayEmbedded = forwardRef(({ if (data.status === 'TIMEOUT') { // Stop polling and mark as timed out + dispatch(PostCancelPayment({OrderId: orderId})).unwrap() setTimedOut(true); setShowTimeout(true); if (intervalRef.current) { From b52f4f8521b3aadafcce73435fb08172505ce11f Mon Sep 17 00:00:00 2001 From: Srinath Date: Thu, 26 Mar 2026 14:43:10 +0530 Subject: [PATCH 12/17] Added Policy Details --- .../SalesBillProductsReturn.jsx | 76 ++++++++++++++++--- 1 file changed, 65 insertions(+), 11 deletions(-) diff --git a/src/Pages/CancelReschedule/SalesBillProductsReturn.jsx b/src/Pages/CancelReschedule/SalesBillProductsReturn.jsx index 7d450b4..2f897d5 100644 --- a/src/Pages/CancelReschedule/SalesBillProductsReturn.jsx +++ b/src/Pages/CancelReschedule/SalesBillProductsReturn.jsx @@ -17,6 +17,7 @@ import { DatePicProd } from "../../Components/Forms/DatePickerProduct"; import { useNavigate } from "react-router-dom"; import { FaEye, FaPlus } from "react-icons/fa"; import { DefaultModal } from "../../Components/Modal/DefaultModal"; +import { IoEye } from "react-icons/io5"; const { RangePicker } = DatePicker; const SEARCH_OPTIONS = [ @@ -70,6 +71,8 @@ const SalesBillProductsReturn = () => { const [currentEditingItem, setCurrentEditingItem] = useState(null); const [modalDescription, setModalDescription] = useState(''); const [modalImageUrl, setModalImageUrl] = useState(''); + const [policyDeatilModal, setPolicyDeatilModal] = useState(false); + const [selectedPolicyDetails, setSelectedPolicyDetails] = useState(null); console.log(selectedItems, "selectedItemsselectedItemsselectedItems") @@ -77,7 +80,7 @@ const SalesBillProductsReturn = () => { navigateTo(`${subDirectory}setting/sales-bill-product-return/list`); }; const handleCheckboxChange = (item, checked) => { - const { ProdId, InwardDtlId, Type, SalesQty, Rate, TotalAmt, TaxAmt, SinglePc, ProdNameQty,IsWarrantyEligible } = item; + const { ProdId, InwardDtlId, Type, SalesQty, Rate, TotalAmt, TaxAmt, SinglePc, ProdNameQty, IsWarrantyEligible } = item; if (checked) { const data = { ProdId, @@ -108,7 +111,15 @@ const SalesBillProductsReturn = () => { const description = product?.Description || "" return { ReturnEligible: eligible, Description: description }; }; - + const handleOrdermodalCancel = () => { + setPolicyDeatilModal(false); + setSelectedPolicyDetails(null); + }; + const Viewdetails = (item) => { + const policy = policybasedprodcuts?.find(p => p.ProdId === item.ProdId) || null; + setSelectedPolicyDetails(policy); + setPolicyDeatilModal(true); + }; useEffect(() => { const fetchPaymentOptions = async () => { try { @@ -192,12 +203,11 @@ const SalesBillProductsReturn = () => { try { const res = await dispatch(getReturnBill(data)).unwrap(); - if (res?.data?.statusCode === 1) { const modifiedData = res?.data?.data?.map(item => { return { ...item, - productDetails: item?.productDetails.map(product => { + productDetails: item?.productDetails?.map(product => { return { ...product, ExchangeQty: 0, @@ -577,8 +587,9 @@ const SalesBillProductsReturn = () => { - + + @@ -597,17 +608,23 @@ const SalesBillProductsReturn = () => { disabled={!ReturnEligible} onChange={(e) => handleCheckboxChange(item, e.target.checked)} /> - {!ReturnEligible && ( + {/* {( - {/* */} - - {/* */} + Viewdetails(item)} + /> - )} + )} */} + @@ -638,7 +655,7 @@ const SalesBillProductsReturn = () => { - {selectedItems.map((item, index) => { + {selectedItems?.map((item, index) => { return ( @@ -816,6 +833,43 @@ const SalesBillProductsReturn = () => { handleCancel={handleCancel} handleSubmit={handleModalSubmit} /> + + + {selectedPolicyDetails?.ProdName ? ( +
Select Sl.NoPolicy Details Product Name Sales-Qty Rate {index + 1} + Viewdetails(item)} + /> {item.ProdNameQty} {item.SalesQty} ₹{item.Rate}
{index + 1}
+ + {[ + ['Product Name', selectedPolicyDetails.ProdName], + ['Policy Name', selectedPolicyDetails.PolicyName], + ['Description', selectedPolicyDetails.Description], + ['Return Allowed', selectedPolicyDetails.IsReturnAllowed === 'Y' ? 'Yes' : 'No'], + ['Exchange Allowed', selectedPolicyDetails.IsExchangeAllowed === 'Y' ? 'Yes' : 'No'], + ['Return Window (Days)', selectedPolicyDetails.ReturnWindowDays], + ['Exchange Window (Days)', selectedPolicyDetails.ExchangeWindowDays], + ['Exchange Limit Count', selectedPolicyDetails.ExchangeLimitCount ?? 'N/A'], + ['Return Eligible', selectedPolicyDetails.ReturnEligible ? 'Yes' : 'No'], + // ['Effective From', selectedPolicyDetails.EffectiveFrom ? dayjs(selectedPolicyDetails.EffectiveFrom).format('DD-MM-YYYY') : 'N/A'], + // ['Effective To', selectedPolicyDetails.EffectiveTo ? dayjs(selectedPolicyDetails.EffectiveTo).format('DD-MM-YYYY') : 'N/A'], + ].map(([label, value]) => ( + + + + + ))} + +
{label}{value}
+ ) : ( +

No policy found for this product.

+ )} + + } + /> From 03517b950b741941401b5587fed66341d7c0daae Mon Sep 17 00:00:00 2001 From: vignesh Date: Thu, 26 Mar 2026 15:04:15 +0530 Subject: [PATCH 13/17] Oreintation fixing --- src/Components/Menu/SideMenuPozo.jsx | 17 +- .../BSBillingTable3overall.jsx | 14 +- .../Components/BSNavbar/BSNavbar1.jsx | 2 +- .../Components/MainPage/MainPage.jsx | 202 ++++++++++-------- .../PreviewLayouts/PreviewLayout1.jsx | 2 +- .../UtillComponents/BSNavBarFavItems.jsx | 9 +- .../UtillComponents/BSNavBarFavItems.scss | 6 +- src/Pages/DashBoard/RetailDashboard.jsx | 5 - .../BSBillingTable1/BSBPayment.scss | 1 + .../Components/BSNavbar/BSNavbar1.scss | 7 +- .../UtillComponents/BSNavBarDragItems.scss | 2 +- 11 files changed, 163 insertions(+), 104 deletions(-) diff --git a/src/Components/Menu/SideMenuPozo.jsx b/src/Components/Menu/SideMenuPozo.jsx index c12b0c7..477e828 100644 --- a/src/Components/Menu/SideMenuPozo.jsx +++ b/src/Components/Menu/SideMenuPozo.jsx @@ -139,6 +139,18 @@ const SideMenuPozo = ({ items = [] }) => { const DineinDefault = useSelector(GlobalDineinDefault); const [collapse, setCollapse] = useState(false); + const [isLandscape, setIsLandscape] = useState( + window.matchMedia('(orientation: landscape)').matches + ); + useEffect(() => { + const handleResize = () => { + setIsLandscape(window.matchMedia('(orientation: landscape)').matches); + }; + + window.addEventListener('resize', handleResize); + return () => window.removeEventListener('resize', handleResize); + }, []); + useEffect(() => { const handleResize = () => { setCollapse(window.innerWidth < 768); @@ -368,7 +380,10 @@ const SideMenuPozo = ({ items = [] }) => {
{ const [isSmallScreen, setIsSmallScreen] = useState(window.innerWidth <= 768); const [isCartOpen, setIsCartOpen] = useState(window.innerWidth > 768); + const [isLandscape, setIsLandscape] = useState( + window.matchMedia('(orientation: landscape)').matches + ); + useEffect(() => { + const handleResize = () => { + setIsLandscape(window.matchMedia('(orientation: landscape)').matches); + }; + + window.addEventListener('resize', handleResize); + return () => window.removeEventListener('resize', handleResize); + }, []); + // ✅ Handle resize properly useEffect(() => { const handleResize = () => { @@ -106,7 +118,7 @@ const BSBillingTable3overall = () => { } // style={{ height: containerHeight }} style={{ - height: isMobile ? '75vh' : '85vh', + height: isMobile ? (isLandscape ? '75vh' : '83vh') : '85vh', }} > {/* ✅ Cart/Table */} diff --git a/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar1.jsx b/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar1.jsx index 17446bb..6122b21 100644 --- a/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar1.jsx +++ b/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar1.jsx @@ -1223,7 +1223,7 @@ const BSNavbar1 = (props, BookingNavbar) => { pointerEvents: OrderType === 'Failed' ? 'none' : 'auto', }} > - +
)} {/* DragItem */} diff --git a/src/Pages/BookingScreen/Components/MainPage/MainPage.jsx b/src/Pages/BookingScreen/Components/MainPage/MainPage.jsx index 92a4d81..6bc3574 100644 --- a/src/Pages/BookingScreen/Components/MainPage/MainPage.jsx +++ b/src/Pages/BookingScreen/Components/MainPage/MainPage.jsx @@ -1,7 +1,11 @@ import { useEffect, useRef, useState } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import { Button, Carousel, Skeleton } from 'antd'; -import { ArrowRightOutlined, LeftOutlined, RightOutlined } from '@ant-design/icons'; +import { + ArrowRightOutlined, + LeftOutlined, + RightOutlined, +} from '@ant-design/icons'; import SelectionComponent from './SelectionComponent'; import PreviewLayout1 from '../PreviewLayouts/PreviewLayout1'; import PreviewLayout2 from '../PreviewLayouts/PreviewLayout2'; @@ -10,19 +14,30 @@ import PreViewLayout4 from '../PreviewLayouts/PreViewLayout4'; import PreviewLayout5 from '../PreviewLayouts/PreviewLayout5'; import PreViewLayout6 from '../PreviewLayouts/PreViewLayout6'; import ComboLayout1 from '../PreviewLayouts/ComboLayout1'; -import { changeActiveTheme, changeOthersTheme, changeSelectedTheme, changeThemeCreation, getOthersTemplate, getPreviewData, getTemplate, GlobalActiveTheme, GlobalDefaultTheme, GlobalOthersTheme, GlobalSelectedTheme } from '../../../../Features/ThemeChange/ThemeChange'; +import { + changeActiveTheme, + changeOthersTheme, + changeSelectedTheme, + changeThemeCreation, + getOthersTemplate, + getPreviewData, + getTemplate, + GlobalActiveTheme, + GlobalDefaultTheme, + GlobalOthersTheme, + GlobalSelectedTheme, +} from '../../../../Features/ThemeChange/ThemeChange'; import '../../../../Styles/BookingScreen/Components/SelectionComponent/MainPage.scss'; import { HiOutlineSquares2X2, HiSquaresPlus } from 'react-icons/hi2'; import { getSession } from '../../../../Services/Others'; import Buttons from '../../../../Components/Forms/Buttons'; import { BiSkipNext, BiSkipPrevious } from 'react-icons/bi'; -import { MdOutlineDisplaySettings } from "react-icons/md"; +import { MdOutlineDisplaySettings } from 'react-icons/md'; import { useAuth } from '../../../../AuthContext'; import { getEmpAccess } from '../../../../Features/AppPage/CenterPage'; - const BookingSelectionPage = (props) => { - const { SadminuserAccess } = useAuth(); + const { SadminuserAccess } = useAuth(); let SAAccessCommonMaster = SadminuserAccess?.find( (e) => e?.MenuName === 'Sales Screen' ); @@ -39,16 +54,16 @@ const BookingSelectionPage = (props) => { // const [activeTheme, setActiveTheme] = useState( // 'default' // ); - const activeTheme = useSelector(GlobalActiveTheme) - const SelectedTheme = useSelector(GlobalSelectedTheme) + const activeTheme = useSelector(GlobalActiveTheme); + const SelectedTheme = useSelector(GlobalSelectedTheme); - const mergedThemes = DefaultThemes.concat(OthersTheme) + const mergedThemes = DefaultThemes.concat(OthersTheme); const [currentSlide, setCurrentSlide] = useState(0); - console.log(SelectedTheme, "currentSlide") + console.log(SelectedTheme, 'currentSlide'); const [OthersCount, setOthersCount] = useState(1); const [isNext, isSetNext] = useState(true); - const [empData, setEmpData] = useState(); - const [addnewAccess, setaddnewAccess] = useState(true); + const [empData, setEmpData] = useState(); + const [addnewAccess, setaddnewAccess] = useState(true); const rightIsLastSlide = currentSlide === mergedThemes.length - 1; const leftIsFirstSlide = currentSlide === 0 && OthersCount > 1; const [pendingSlide, setPendingSlide] = useState(null); @@ -68,50 +83,50 @@ const BookingSelectionPage = (props) => { : useSelector(getPreviewData); console.log(previewData, 'previewDatapreviewData'); useEffect(() => { - GetOthersTemplate() + GetOthersTemplate(); // gettemplatedetail() - }, []) - useEffect(() => { - if (UserType === 'Employee') { - fetchApi(); - } - }, [UserType]); - - useEffect(() => { - let hasAccess = false; - - if (UserType === 'Admin' || UserType === 'Super Admin') { - hasAccess = true; - } else if (UserType === 'Employee') { - hasAccess = empData?.AddAccess === 'Y'; - } else if (UserType === 'Super Admin User') { - hasAccess = SAAccessCommonMaster?.AddAccess === 'Y'; - } - - setaddnewAccess(!hasAccess); - }, [empData, SAAccessCommonMaster, UserType]); - - const fetchApi = async () => { - let data = { - CompId: CompId, - BranchId: BranchId, - AppId: AppId, - EmpId: UserId, - }; - let response = await dispatch(getEmpAccess(data)).unwrap(); - let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter( - (item) => item.ConfigName === 'Sales Screen' - ); - setEmpData(datas?.[0]); + }, []); + useEffect(() => { + if (UserType === 'Employee') { + fetchApi(); + } + }, [UserType]); + + useEffect(() => { + let hasAccess = false; + + if (UserType === 'Admin' || UserType === 'Super Admin') { + hasAccess = true; + } else if (UserType === 'Employee') { + hasAccess = empData?.AddAccess === 'Y'; + } else if (UserType === 'Super Admin User') { + hasAccess = SAAccessCommonMaster?.AddAccess === 'Y'; + } + + setaddnewAccess(!hasAccess); + }, [empData, SAAccessCommonMaster, UserType]); + + const fetchApi = async () => { + let data = { + CompId: CompId, + BranchId: BranchId, + AppId: AppId, + EmpId: UserId, }; - + let response = await dispatch(getEmpAccess(data)).unwrap(); + let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter( + (item) => item.ConfigName === 'Sales Screen' + ); + setEmpData(datas?.[0]); + }; + const gettemplatedetail = async () => { let tempdetail = await dispatch( getTemplate({ CompId: CompId, BranchId: BranchId, AppId: AppId }) ).unwrap(); if (tempdetail?.data?.statusCode == 1) { - dispatch(changeActiveTheme("customised")); + dispatch(changeActiveTheme('customised')); } }; @@ -149,7 +164,12 @@ const BookingSelectionPage = (props) => { setCurrentSlide(pendingSlide); let seltheme = updatedThemes[pendingSlide]; dispatch(changeThemeCreation({ formtype: 'edit', editdata: seltheme })); - dispatch(changeSelectedTheme({ ThemeId: seltheme?.TemplatePreferenceId, ThemeName: seltheme?.ThemeName })); + dispatch( + changeSelectedTheme({ + ThemeId: seltheme?.TemplatePreferenceId, + ThemeName: seltheme?.ThemeName, + }) + ); } setPendingSlide(null); // Reset } @@ -180,7 +200,7 @@ const BookingSelectionPage = (props) => { // // } // }; // const RightOnclick = async () => { - // // let Allthemes = + // // let Allthemes = // // alert('Right Clicked'); // const newIndex = (currentSlide + 1) % mergedThemes.length; // carouselRef.current.goTo(newIndex); @@ -205,7 +225,12 @@ const BookingSelectionPage = (props) => { setCurrentSlide(newIndex); let seltheme = mergedThemes[newIndex]; dispatch(changeThemeCreation({ formtype: 'edit', editdata: seltheme })); - dispatch(changeSelectedTheme({ ThemeId: seltheme?.TemplatePreferenceId, ThemeName: seltheme?.ThemeName })); + dispatch( + changeSelectedTheme({ + ThemeId: seltheme?.TemplatePreferenceId, + ThemeName: seltheme?.ThemeName, + }) + ); } }; @@ -214,12 +239,18 @@ const BookingSelectionPage = (props) => { await GetLessTemplate(); setPendingSlide(DefaultThemes.concat(OthersTheme).length - 1); // Ask to jump to last slide after fetch } else { - const newIndex = (currentSlide - 1 + mergedThemes.length) % mergedThemes.length; + const newIndex = + (currentSlide - 1 + mergedThemes.length) % mergedThemes.length; carouselRef.current.goTo(newIndex); setCurrentSlide(newIndex); let seltheme = mergedThemes[newIndex]; dispatch(changeThemeCreation({ formtype: 'edit', editdata: seltheme })); - dispatch(changeSelectedTheme({ ThemeId: seltheme?.TemplatePreferenceId, ThemeName: seltheme?.ThemeName })); + dispatch( + changeSelectedTheme({ + ThemeId: seltheme?.TemplatePreferenceId, + ThemeName: seltheme?.ThemeName, + }) + ); } }; const CustomisedthemeSelection = async (seltheme) => { @@ -236,16 +267,25 @@ const BookingSelectionPage = (props) => { } } else { if (Object.keys(DefaultThemes)?.length > 0) { - dispatch(changeSelectedTheme({ ThemeId: DefaultThemes?.[0]?.TemplatePreferenceId, ThemeName: DefaultThemes?.[0]?.ThemeName })); + dispatch( + changeSelectedTheme({ + ThemeId: DefaultThemes?.[0]?.TemplatePreferenceId, + ThemeName: DefaultThemes?.[0]?.ThemeName, + }) + ); // settemplateData(DefaultThemes?.[0]); - dispatch(changeThemeCreation({ formtype: 'edit', editdata: DefaultThemes?.[0] })); + dispatch( + changeThemeCreation({ + formtype: 'edit', + editdata: DefaultThemes?.[0], + }) + ); } else { dispatch(changeSelectedTheme({})); dispatch(changeThemeCreation({ formtype: 'new' })); - } } - } + }; const handlesubmit = () => { const PostData = {}; @@ -256,7 +296,7 @@ const BookingSelectionPage = (props) => { PostData['ColorId'] = colorFilteredArray; PostData['FontId'] = fontFilteredArray; PostData['CreatedBy'] = UserId; - } + }; const GetOthersTemplate = async () => { let OtherTemp = await dispatch( getOthersTemplate({ pagenumber: OthersCount }) @@ -266,7 +306,7 @@ const BookingSelectionPage = (props) => { ...temp, ThemeName: `Theme ${index + 1 + OthersCount * 10 - 10}`, })); - dispatch(changeOthersTheme(withname)) + dispatch(changeOthersTheme(withname)); } else { } }; @@ -288,8 +328,7 @@ const BookingSelectionPage = (props) => { ...temp, ThemeName: `Theme ${index + 1 + (tempcount - 1) * 10}`, })); - dispatch(changeOthersTheme(withname)) - + dispatch(changeOthersTheme(withname)); } else { setMessageType('warning'); setMessageData('No more templates'); @@ -306,22 +345,24 @@ const BookingSelectionPage = (props) => { ...temp, ThemeName: `Theme ${index + 1 + (tempcount - 1) * 10}`, })); - dispatch(changeOthersTheme(withname)) + dispatch(changeOthersTheme(withname)); isSetNext(true); } else { } }; const clearOtherTemplate = async () => { - dispatch(changeOthersTheme([])) + dispatch(changeOthersTheme([])); setOthersCount(1); }; return ( -
- +

-

Sales Setup

+

+ {' '} + Sales Setup +

Customize your sales screen here

@@ -338,29 +379,24 @@ const BookingSelectionPage = (props) => { > Customized Theme
-
- {activeTheme === 'default' && + {activeTheme === 'default' && (
} />
- } + )}
-
- {activeTheme === 'default' ? +
+ {activeTheme === 'default' ? ( <> -
- +
)} -
- : + ) : ( <>
- {Object.keys(previewData)?.length > 0 ? ( renderPreviewLayout() @@ -436,16 +470,14 @@ const BookingSelectionPage = (props) => { )}
-
+
- } + )}
-
); }; - export default BookingSelectionPage; diff --git a/src/Pages/BookingScreen/Components/PreviewLayouts/PreviewLayout1.jsx b/src/Pages/BookingScreen/Components/PreviewLayouts/PreviewLayout1.jsx index c4b0844..f29e98b 100644 --- a/src/Pages/BookingScreen/Components/PreviewLayouts/PreviewLayout1.jsx +++ b/src/Pages/BookingScreen/Components/PreviewLayouts/PreviewLayout1.jsx @@ -118,7 +118,7 @@ const PreviewLayout1 = (props) => { )} />{' '}
-
+
{Preview1Data?.BookingLayout?.[1] && Preview1Data?.BookingBilling?.[0] != 'Billing1' && Preview1Data?.BookingBilling?.[0] != 'Billing2' && diff --git a/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarFavItems.jsx b/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarFavItems.jsx index 66277f6..d8ecb74 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarFavItems.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarFavItems.jsx @@ -26,9 +26,14 @@ import { SlArrowDown } from 'react-icons/sl'; import { IoCloseSharp } from 'react-icons/io5'; import TooltipWrapper from '../../../../Components/Tooltip/Tooltip'; import { isMobile } from 'react-device-detect'; -import "./BSNavBarFavItems.scss" +import './BSNavBarFavItems.scss'; -const BSNavBarFavItems = ({ type, fill, drawerOpen = false }) => { +const BSNavBarFavItems = ({ + type, + fill, + drawerOpen = false, + setNavmenu = () => {}, +}) => { const [open, setOpen] = useState(false); const [favopen, setFavopen] = useState(false); const globalAllItemdata = useSelector(GlobalAllItemData); diff --git a/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarFavItems.scss b/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarFavItems.scss index 1e99ba9..3e6de51 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarFavItems.scss +++ b/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarFavItems.scss @@ -85,13 +85,13 @@ .AddFavList { position: fixed; left: 0; - top: 17rem; + top: 15rem; width: 100vw !important; padding: 1rem 1rem !important; } .AddFavItemListCont { - height: 34vh; + height: 30vh; overflow: auto; } @@ -104,7 +104,7 @@ .AddFavList { position: fixed; left: 0; - top: 17rem; + top: 15rem; width: 100vw !important; padding: 1rem 1rem !important; } diff --git a/src/Pages/DashBoard/RetailDashboard.jsx b/src/Pages/DashBoard/RetailDashboard.jsx index 8b52761..f42080e 100644 --- a/src/Pages/DashBoard/RetailDashboard.jsx +++ b/src/Pages/DashBoard/RetailDashboard.jsx @@ -1775,11 +1775,6 @@ const RetailDashboard = () => { UserType === 'Super Admin' || UserType === 'Super Admin User' ) { - if (!document.fullscreenElement) { - document.documentElement.requestFullscreen().catch((err) => { - console.error('Error attempting to enable fullscreen:', err); - }); - } navigate(`${subDirectory}sales`); } }} diff --git a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBPayment.scss b/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBPayment.scss index 9c2d2c5..c973f1b 100644 --- a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBPayment.scss +++ b/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBPayment.scss @@ -4,6 +4,7 @@ flex-wrap: wrap; justify-content: center; gap: 10px; + margin-top: 4px; } .BST1-Payment-onlypay { diff --git a/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar1.scss b/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar1.scss index 4972fdf..553088f 100644 --- a/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar1.scss +++ b/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar1.scss @@ -635,11 +635,10 @@ // .resNavbarMain { - width: 100vw; + width: max-content; + max-width: 250px; height: 100vh; - background-color: #00000056; position: fixed; - left: 0; top: 0; bottom: 0; right: 0; @@ -648,7 +647,7 @@ align-items: flex-start; justify-content: flex-end; overflow: visible; - backdrop-filter: blur(6px); + box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px; animation: fadeInRes 0.3s ease; &.closing { diff --git a/src/Styles/BookingScreen/Components/UtillComponents/BSNavBarDragItems.scss b/src/Styles/BookingScreen/Components/UtillComponents/BSNavBarDragItems.scss index f661693..6652c99 100644 --- a/src/Styles/BookingScreen/Components/UtillComponents/BSNavBarDragItems.scss +++ b/src/Styles/BookingScreen/Components/UtillComponents/BSNavBarDragItems.scss @@ -85,7 +85,7 @@ } .AddFavItemListCont { - height: 34vh; + height: 30vh; padding-bottom: 4rem; } } From 22e538d9ae0224f2616202abb263601f359864cd Mon Sep 17 00:00:00 2001 From: Srinath Date: Thu, 26 Mar 2026 15:04:40 +0530 Subject: [PATCH 14/17] Added Policy Details --- src/Pages/CancelReschedule/SalesBillProductsReturn.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Pages/CancelReschedule/SalesBillProductsReturn.jsx b/src/Pages/CancelReschedule/SalesBillProductsReturn.jsx index 2f897d5..86304cc 100644 --- a/src/Pages/CancelReschedule/SalesBillProductsReturn.jsx +++ b/src/Pages/CancelReschedule/SalesBillProductsReturn.jsx @@ -651,7 +651,7 @@ const SalesBillProductsReturn = () => { Sales-Qty Return-Qty More - Details + {/* Details */} @@ -723,7 +723,7 @@ const SalesBillProductsReturn = () => { - + {/* {item.description && (
{
🖼️
)} - + */} ); })} @@ -841,7 +841,7 @@ const SalesBillProductsReturn = () => { footer={false} children={
- {selectedPolicyDetails?.ProdName ? ( + {selectedPolicyDetails ? ( {[ From 5c0f168a37b1c90597305a7a6a3d44235a3b2d00 Mon Sep 17 00:00:00 2001 From: karthikalakshmi Date: Fri, 27 Mar 2026 09:41:11 +0530 Subject: [PATCH 15/17] Fix #317 Reports Intent Print changes --- src/App.jsx | 150 ++++++++---------- .../AuthenicationToken/AuthenticationToken.js | 7 +- src/Pages/RedirectApps.jsx | 8 +- .../Reports/DateWiseReport/DateWiseReport.jsx | 19 +-- .../Reports/ItemWiseReport/ItemWiseReport.jsx | 19 +-- src/Styles/Tablebooking/TableBooking.scss | 2 +- 6 files changed, 96 insertions(+), 109 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index f746608..9d5c4da 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -8,7 +8,7 @@ import SelfBooking from './Pages/SelfBooking/SelfBooking.jsx'; import { isMobile, isIOS } from 'react-device-detect'; import { routesConfig } from './routesConfig'; import { GlobalItemCard } from './Features/BookingScreen/BookingData/BookingData.js'; -import { clearSession, getSession } from './Services/Others.js'; +import { clearSession, getSession, sessionStore } from './Services/Others.js'; const KisokSelBooking = lazy( () => import('./Pages/SelfBooking/KisokSelBooking') @@ -27,9 +27,10 @@ import useSessionManager from './useSessionManager.js'; import ExtendSubscriptionModal from './Pages/ExtentedModal/ExtendSubscriptionModal.jsx'; import devtools from 'devtools-detect'; import { useDevToolsDetection } from './utils/useDevToolsDetection.js'; +import { Capacitor } from '@capacitor/core'; -const isCapacitor = () => !!window.Capacitor?.isNativePlatform?.(); - +// const isCapacitor = () => !!window.Capacitor?.isNativePlatform?.(); +const isCapacitor = () => Capacitor.isNativePlatform(); // ✅ Define your home/exit pages here const HOME_PAGES = [ '/app-page/home', // android minimize @@ -55,7 +56,7 @@ const AppRoutes = () => { const [devToolsOpen, setDevToolsOpen] = useState(false); // ✅ Flag to prevent stack push when back button navigates const isBackNav = useRef(false); - + console.log(isCapacitor(), 'Is Capacitor'); // ✅ Build navigation stack useEffect(() => { // Skip pushing to stack when back button caused this navigation @@ -70,13 +71,14 @@ const AppRoutes = () => { // Don't track login pages if (LOGIN_PAGES.some((p) => path.includes(p))) return; - const raw = sessionStorage.getItem('navStack'); + const raw = getSession('navStack'); + console.log('🎯 Current path:', path); let stack = raw ? JSON.parse(raw) : []; if (stack.length === 0 || stack[stack.length - 1] !== path) { stack.push(path); if (stack.length > 50) stack = stack.slice(-50); - sessionStorage.setItem('navStack', JSON.stringify(stack)); + sessionStore('navStack', JSON.stringify(stack)); console.log('📍 Stack:', stack); } } catch (e) { } @@ -90,7 +92,7 @@ const AppRoutes = () => { const currentPath = location.pathname; const SessionId = getSession('SessionId'); - + console.log('SessionId:', SessionId, 'CurrentPath:', currentPath) // 🟢 If session exists → allow navigation if (SessionId) { console.log('Browser back allowed'); @@ -112,65 +114,53 @@ const AppRoutes = () => { }, [location.pathname]); // ✅ Android — Capacitor back button - useEffect(() => { - if (!isCapacitor()) return; + useEffect(() => { + if (!isCapacitor()) return; - const handler = async () => { - try { - const currentPath = location.pathname + (location.search || ''); - console.log('🔙 Back pressed:', currentPath); + const handler = async () => { + try { + const currentPath = window.location.pathname + window.location.search; // Bug 2 fix - const raw = sessionStorage.getItem('navStack'); - let stack = raw ? JSON.parse(raw) : []; + const raw = getSession('navStack'); + let stack = raw ? JSON.parse(raw) : []; - // Remove current path from stack if it's at the end - while (stack.length && stack[stack.length - 1] === currentPath) { - stack.pop(); - } - - // If there are pages in history, go back to previous page - if (stack.length > 0) { - const previous = stack[stack.length - 1]; - sessionStorage.setItem('navStack', JSON.stringify(stack)); - isBackNav.current = true; - navigate(previous); - console.log('Navigate to previous:', previous); - return; - } - - // Stack is empty - check where we are - // 🏠 Home page → minimize - if (HOME_PAGES?.some((p) => currentPath?.includes(p))) { - console.log('Home page & empty stack → minimizing app'); - await CapacitorApp.minimizeApp(); - return; - } - - // 🚪 Login page → minimize - if (LOGIN_PAGES?.some((p) => currentPath?.includes(p))) { - console.log('Login page & empty stack → minimizing app'); - await CapacitorApp.minimizeApp(); - return; - } - - // Anywhere else with empty stack → go to home - const home = '/app-page/home'; - sessionStorage.setItem('navStack', JSON.stringify([home])); - isBackNav.current = true; - navigate(home); - console.log('Empty stack, navigate to home'); - } catch (e) { - console.error('Back handler error:', e); - await CapacitorApp.minimizeApp(); + while (stack.length && stack[stack.length - 1] === currentPath) { + stack.pop(); } - }; - const listener = CapacitorApp.addListener('backButton', handler); + if (stack.length > 0) { + const previous = stack[stack.length - 1]; + sessionStore('navStack', JSON.stringify(stack)); + isBackNav.current = true; // Bug 3 fix — BEFORE navigate + navigate(previous); + return; + } - return () => { - listener.remove(); - }; - }, [navigate, location.pathname, location.search]); + if (HOME_PAGES?.some((p) => currentPath?.includes(p))) { + await CapacitorApp.minimizeApp(); + return; + } + + if (LOGIN_PAGES?.some((p) => currentPath?.includes(p))) { + await CapacitorApp.minimizeApp(); + return; + } + + const home = '/app-page/home'; + isBackNav.current = true; // Bug 3 fix here too + sessionStore('navStack', JSON.stringify([home])); + navigate(home); + } catch (e) { + console.error('Back handler error:', e); + await CapacitorApp.minimizeApp(); + } + }; + + const listenerPromise = CapacitorApp.addListener('backButton', handler); // Bug 1 fix + return () => { + listenerPromise.then(({ remove }) => remove()); + }; +}, [navigate,location.pathname, location.search]); // mohan // useEffect(() => { // if (isMobile || isIOS) { @@ -211,27 +201,27 @@ const AppRoutes = () => { // return () => clearInterval(checkDevTools); // }, [devToolsOpen]); - const isBlocked = useDevToolsDetection(() => { - // optional: log, notify, etc. - console.warn('DevTools detected'); - }); + // const isBlocked = useDevToolsDetection(() => { + // // optional: log, notify, etc. + // console.warn('DevTools detected'); + // }); - if (isBlocked) { - return ( -
-

- DevTools detected. Please close it to continue. -

-
- ); - } + // if (isBlocked) { + // return ( + //
+ //

+ // DevTools detected. Please close it to continue. + //

+ //
+ // ); + // } if (extendModel) { return ( { let encryptedLoginType = getSession('LoginType') - console.log( - 'encryptedLoginType', - encryptedLoginType, - TokendecryptedValuesFun(encryptedMobileno) - ); - + // let Mobileno = encryptedUserId && encryptedLoginType != "Kiosk" ? TokendecryptedValuesFun(encryptedMobileno) : '1000000001'; let Mobileno = encryptedUserId ? encryptedMobileno diff --git a/src/Pages/RedirectApps.jsx b/src/Pages/RedirectApps.jsx index 5ec400c..5a4a76e 100644 --- a/src/Pages/RedirectApps.jsx +++ b/src/Pages/RedirectApps.jsx @@ -18,14 +18,14 @@ function RedirectApps() { const SessionId = encryptedValuesUrlFun(getSession('SessionId')); // const AuthToken = sessionStorage.getItem('auth'); - if (sessionStorage.getItem('BranchId') !== null) { + if (getSession('BranchId') !== null) { clearSession('BranchId'); } - if (sessionStorage.getItem('AppId') !== null) { + if (getSession('AppId') !== null) { clearSession('AppId'); } - if (sessionStorage.getItem('hasRefreshed') !== null) { - sessionStorage.removeItem('hasRefreshed'); + if (getSession('hasRefreshed') !== null) { + clearSession('hasRefreshed'); } const param = { MN: MobileNo, diff --git a/src/Pages/Reports/DateWiseReport/DateWiseReport.jsx b/src/Pages/Reports/DateWiseReport/DateWiseReport.jsx index c424dc6..a3fa7fa 100644 --- a/src/Pages/Reports/DateWiseReport/DateWiseReport.jsx +++ b/src/Pages/Reports/DateWiseReport/DateWiseReport.jsx @@ -41,6 +41,7 @@ const DateWiseReport = () => { getSession('AppType')?.toLowerCase() == 'wholesale' ? true : false; const [OrderFromDate, setOrderFromDate] = useState(); const [OrderToDate, setOrderToDate] = useState(); + const sessionuserid = getSession('UserId') const [UserId, setUserId] = useState( UserRole != 'Employee' ? 0 : getSession('UserId') ); @@ -63,7 +64,7 @@ const DateWiseReport = () => { setting?.SettingIdName?.toLowerCase() === 'mobilea4' && setting?.SettingValue === 'Y' ); - console.log(MobileA4Print, 'MobileA4PrintMobileA4Print'); + console.log(MobileA4Print,SettingDataSelector, 'MobileA4PrintMobileA4Print'); useEffect(() => { if (dataSource?.length > 0) { @@ -368,7 +369,7 @@ const DateWiseReport = () => { }, []); const getPreference = async () => { - const data = { AppId: AppId, CompId: CompId, BranchId: BranchId,UserId: UserId }; + const data = { AppId: AppId, CompId: CompId, BranchId: BranchId,UserId: sessionuserid }; const { data: res } = await dispatch(getPreferenceData(data)).unwrap(); const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find( (setting) => @@ -545,12 +546,12 @@ const DateWiseReport = () => { let TokenData = ''; let FooterPrint = ''; if (isMobile) { - if (MobileA4Print) { - ReportMobilePDFPrint({ - printId: 'RePrint', - printStyle: style, - }); - } else { + // if (MobileA4Print) { + // ReportMobilePDFPrint({ + // printId: 'RePrint', + // printStyle: style, + // }); + // } else { var textEncoded = encodeURI(receiptText); var TypeCheck = 'PrintReceipt'; var scheme = 'pozoprinter'; @@ -578,7 +579,7 @@ const DateWiseReport = () => { FooterPrint + 'HasFooterTextE' + ';end;'; - } + // } } else { await printDiv('RePrint', style); } diff --git a/src/Pages/Reports/ItemWiseReport/ItemWiseReport.jsx b/src/Pages/Reports/ItemWiseReport/ItemWiseReport.jsx index 8d6e824..03bb062 100644 --- a/src/Pages/Reports/ItemWiseReport/ItemWiseReport.jsx +++ b/src/Pages/Reports/ItemWiseReport/ItemWiseReport.jsx @@ -69,6 +69,7 @@ const ItemWiseReport = () => { const BranchId = getSession('BranchId'); const AppId = getSession('AppId'); const UserRole = getSession('UserType'); + const sessionuserid = getSession('UserId') const [UserId, setUserId] = useState( UserRole != 'Employee' ? 0 : getSession('UserId') ); @@ -79,7 +80,7 @@ const ItemWiseReport = () => { setting?.SettingIdName?.toLowerCase() === 'mobilea4' && setting?.SettingValue === 'Y' ); - + console.log(MobileA4Print,SettingDataSelector, 'MobileA4PrintMobileA4Print') useEffect(() => { getPreference(); }, []); @@ -210,7 +211,7 @@ const ItemWiseReport = () => { } }, [apiCall]); const getPreference = async () => { - const data = { AppId: AppId, CompId: CompId, BranchId: BranchId,UserId: UserId }; + const data = { AppId: AppId, CompId: CompId, BranchId: BranchId,UserId: sessionuserid }; const { data: res } = await dispatch(getPreferenceData(data)).unwrap(); const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find( (setting) => @@ -310,12 +311,12 @@ const ItemWiseReport = () => { }; const Print = async () => { if (isMobile) { - if (MobileA4Print) { - ReportMobilePDFPrint({ - printId: 'RePrint', - printStyle: style, - }); - } else { + // if (MobileA4Print) { + // ReportMobilePDFPrint({ + // printId: 'RePrint', + // printStyle: style, + // }); + // } else { let LogoImage = ''; let TokenData = ''; let FooterPrint = ''; @@ -346,7 +347,7 @@ const ItemWiseReport = () => { FooterPrint + 'HasFooterTextE' + ';end;'; - } + // } } else { await printDiv('RePrint', style); } diff --git a/src/Styles/Tablebooking/TableBooking.scss b/src/Styles/Tablebooking/TableBooking.scss index 2c80958..58f6e93 100644 --- a/src/Styles/Tablebooking/TableBooking.scss +++ b/src/Styles/Tablebooking/TableBooking.scss @@ -705,7 +705,7 @@ color: #fff; top: 0; } -.optionnew:selection { +.optionnew::selection { background-color: #ff4d4f; } .ovrly-icos { From f342b5f70ae549682fc1b55d10adf79d2ca1dd17 Mon Sep 17 00:00:00 2001 From: karthikalakshmi Date: Fri, 27 Mar 2026 09:48:25 +0530 Subject: [PATCH 16/17] Update src/App.jsx --- src/App.jsx | 189 +++++++++++++++++++++++++--------------------------- 1 file changed, 89 insertions(+), 100 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 9d5c4da..0aaeab3 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -8,7 +8,7 @@ import SelfBooking from './Pages/SelfBooking/SelfBooking.jsx'; import { isMobile, isIOS } from 'react-device-detect'; import { routesConfig } from './routesConfig'; import { GlobalItemCard } from './Features/BookingScreen/BookingData/BookingData.js'; -import { clearSession, getSession, sessionStore } from './Services/Others.js'; +import { clearSession, getSession } from './Services/Others.js'; const KisokSelBooking = lazy( () => import('./Pages/SelfBooking/KisokSelBooking') @@ -26,11 +26,9 @@ import useSubscriptionManager from './useSubscriptionManager.js'; import useSessionManager from './useSessionManager.js'; import ExtendSubscriptionModal from './Pages/ExtentedModal/ExtendSubscriptionModal.jsx'; import devtools from 'devtools-detect'; -import { useDevToolsDetection } from './utils/useDevToolsDetection.js'; -import { Capacitor } from '@capacitor/core'; -// const isCapacitor = () => !!window.Capacitor?.isNativePlatform?.(); -const isCapacitor = () => Capacitor.isNativePlatform(); +const isCapacitor = () => !!window.Capacitor?.isNativePlatform?.(); + // ✅ Define your home/exit pages here const HOME_PAGES = [ '/app-page/home', // android minimize @@ -56,7 +54,7 @@ const AppRoutes = () => { const [devToolsOpen, setDevToolsOpen] = useState(false); // ✅ Flag to prevent stack push when back button navigates const isBackNav = useRef(false); - console.log(isCapacitor(), 'Is Capacitor'); + // ✅ Build navigation stack useEffect(() => { // Skip pushing to stack when back button caused this navigation @@ -71,14 +69,13 @@ const AppRoutes = () => { // Don't track login pages if (LOGIN_PAGES.some((p) => path.includes(p))) return; - const raw = getSession('navStack'); - console.log('🎯 Current path:', path); + const raw = sessionStorage.getItem('navStack'); let stack = raw ? JSON.parse(raw) : []; if (stack.length === 0 || stack[stack.length - 1] !== path) { stack.push(path); if (stack.length > 50) stack = stack.slice(-50); - sessionStore('navStack', JSON.stringify(stack)); + sessionStorage.setItem('navStack', JSON.stringify(stack)); console.log('📍 Stack:', stack); } } catch (e) { } @@ -92,7 +89,7 @@ const AppRoutes = () => { const currentPath = location.pathname; const SessionId = getSession('SessionId'); - console.log('SessionId:', SessionId, 'CurrentPath:', currentPath) + // 🟢 If session exists → allow navigation if (SessionId) { console.log('Browser back allowed'); @@ -114,114 +111,106 @@ const AppRoutes = () => { }, [location.pathname]); // ✅ Android — Capacitor back button - useEffect(() => { - if (!isCapacitor()) return; + useEffect(() => { + if (!isCapacitor()) return; - const handler = async () => { - try { - const currentPath = window.location.pathname + window.location.search; // Bug 2 fix + const handler = async () => { + try { + const currentPath = location.pathname + (location.search || ''); + console.log('🔙 Back pressed:', currentPath); - const raw = getSession('navStack'); - let stack = raw ? JSON.parse(raw) : []; + const raw = sessionStorage.getItem('navStack'); + let stack = raw ? JSON.parse(raw) : []; - while (stack.length && stack[stack.length - 1] === currentPath) { - stack.pop(); - } + // Remove current path from stack if it's at the end + while (stack.length && stack[stack.length - 1] === currentPath) { + stack.pop(); + } - if (stack.length > 0) { - const previous = stack[stack.length - 1]; - sessionStore('navStack', JSON.stringify(stack)); - isBackNav.current = true; // Bug 3 fix — BEFORE navigate - navigate(previous); - return; - } + // If there are pages in history, go back to previous page + if (stack.length > 0) { + const previous = stack[stack.length - 1]; + sessionStorage.setItem('navStack', JSON.stringify(stack)); + isBackNav.current = true; + navigate(previous); + console.log('Navigate to previous:', previous); + return; + } - if (HOME_PAGES?.some((p) => currentPath?.includes(p))) { + // Stack is empty - check where we are + // 🏠 Home page → minimize + if (HOME_PAGES?.some((p) => currentPath?.includes(p))) { + console.log('Home page & empty stack → minimizing app'); + await CapacitorApp.minimizeApp(); + return; + } + + // 🚪 Login page → minimize + if (LOGIN_PAGES?.some((p) => currentPath?.includes(p))) { + console.log('Login page & empty stack → minimizing app'); + await CapacitorApp.minimizeApp(); + return; + } + + // Anywhere else with empty stack → go to home + const home = '/app-page/home'; + sessionStorage.setItem('navStack', JSON.stringify([home])); + isBackNav.current = true; + navigate(home); + console.log('Empty stack, navigate to home'); + } catch (e) { + console.error('Back handler error:', e); await CapacitorApp.minimizeApp(); - return; } + }; - if (LOGIN_PAGES?.some((p) => currentPath?.includes(p))) { - await CapacitorApp.minimizeApp(); - return; - } + const listener = CapacitorApp.addListener('backButton', handler); - const home = '/app-page/home'; - isBackNav.current = true; // Bug 3 fix here too - sessionStore('navStack', JSON.stringify([home])); - navigate(home); - } catch (e) { - console.error('Back handler error:', e); - await CapacitorApp.minimizeApp(); - } - }; - - const listenerPromise = CapacitorApp.addListener('backButton', handler); // Bug 1 fix - return () => { - listenerPromise.then(({ remove }) => remove()); - }; -}, [navigate,location.pathname, location.search]); + return () => { + listener.remove(); + }; + }, [navigate, location.pathname, location.search]); // mohan - // useEffect(() => { - // if (isMobile || isIOS) { - // console.log('📱 Mobile/iOS device → skipping DevTools detection'); - // return; - // } - // const checkDevTools = setInterval(() => { - // if (devtools.isOpen && !devToolsOpen) { - // setDevToolsOpen(true); - // document.body.innerHTML = - // "

Close Inspect to continue using the application.

"; - // } else if (!devtools.isOpen && devToolsOpen) { - // setDevToolsOpen(false); + useEffect(() => { + if (isMobile || isIOS) { + console.log('📱 Mobile/iOS device → skipping DevTools detection'); + return; + } + const checkDevTools = setInterval(() => { + if (devtools.isOpen && !devToolsOpen) { + setDevToolsOpen(true); + document.body.innerHTML = + "

Close Inspect to continue using the application.

"; + } else if (!devtools.isOpen && devToolsOpen) { + setDevToolsOpen(false); - // setTimeout(() => { - // window.location.reload(); - // }, 100); + setTimeout(() => { + window.location.reload(); + }, 100); - // clearInterval(checkDevTools); - // } + clearInterval(checkDevTools); + } - // if (!devtools.isOpen) { - // let before = performance.now(); + if (!devtools.isOpen) { + let before = performance.now(); - // let after = performance.now(); + let after = performance.now(); - // let executionDelay = after - before; + let executionDelay = after - before; - // if (executionDelay > 100) { - // setDevToolsOpen(true); - // document.body.innerHTML = - // "

Close Inspect to continue using the application.

"; - // } else { - // setDevToolsOpen(false); - // } - // } - // }, 1000); + if (executionDelay > 100) { + setDevToolsOpen(true); + document.body.innerHTML = + "

Close Inspect to continue using the application.

"; + } else { + setDevToolsOpen(false); + } + } + }, 1000); - // return () => clearInterval(checkDevTools); - // }, [devToolsOpen]); - // const isBlocked = useDevToolsDetection(() => { - // // optional: log, notify, etc. - // console.warn('DevTools detected'); - // }); + return () => clearInterval(checkDevTools); + }, [devToolsOpen]); - // if (isBlocked) { - // return ( - //
- //

- // DevTools detected. Please close it to continue. - //

- //
- // ); - // } if (extendModel) { return ( Date: Fri, 27 Mar 2026 09:52:12 +0530 Subject: [PATCH 17/17] Change conflict file app.jsx --- src/App.jsx | 189 +++++++++++++++++++++++++++------------------------- 1 file changed, 100 insertions(+), 89 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 0aaeab3..9d5c4da 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -8,7 +8,7 @@ import SelfBooking from './Pages/SelfBooking/SelfBooking.jsx'; import { isMobile, isIOS } from 'react-device-detect'; import { routesConfig } from './routesConfig'; import { GlobalItemCard } from './Features/BookingScreen/BookingData/BookingData.js'; -import { clearSession, getSession } from './Services/Others.js'; +import { clearSession, getSession, sessionStore } from './Services/Others.js'; const KisokSelBooking = lazy( () => import('./Pages/SelfBooking/KisokSelBooking') @@ -26,9 +26,11 @@ import useSubscriptionManager from './useSubscriptionManager.js'; import useSessionManager from './useSessionManager.js'; import ExtendSubscriptionModal from './Pages/ExtentedModal/ExtendSubscriptionModal.jsx'; import devtools from 'devtools-detect'; +import { useDevToolsDetection } from './utils/useDevToolsDetection.js'; +import { Capacitor } from '@capacitor/core'; -const isCapacitor = () => !!window.Capacitor?.isNativePlatform?.(); - +// const isCapacitor = () => !!window.Capacitor?.isNativePlatform?.(); +const isCapacitor = () => Capacitor.isNativePlatform(); // ✅ Define your home/exit pages here const HOME_PAGES = [ '/app-page/home', // android minimize @@ -54,7 +56,7 @@ const AppRoutes = () => { const [devToolsOpen, setDevToolsOpen] = useState(false); // ✅ Flag to prevent stack push when back button navigates const isBackNav = useRef(false); - + console.log(isCapacitor(), 'Is Capacitor'); // ✅ Build navigation stack useEffect(() => { // Skip pushing to stack when back button caused this navigation @@ -69,13 +71,14 @@ const AppRoutes = () => { // Don't track login pages if (LOGIN_PAGES.some((p) => path.includes(p))) return; - const raw = sessionStorage.getItem('navStack'); + const raw = getSession('navStack'); + console.log('🎯 Current path:', path); let stack = raw ? JSON.parse(raw) : []; if (stack.length === 0 || stack[stack.length - 1] !== path) { stack.push(path); if (stack.length > 50) stack = stack.slice(-50); - sessionStorage.setItem('navStack', JSON.stringify(stack)); + sessionStore('navStack', JSON.stringify(stack)); console.log('📍 Stack:', stack); } } catch (e) { } @@ -89,7 +92,7 @@ const AppRoutes = () => { const currentPath = location.pathname; const SessionId = getSession('SessionId'); - + console.log('SessionId:', SessionId, 'CurrentPath:', currentPath) // 🟢 If session exists → allow navigation if (SessionId) { console.log('Browser back allowed'); @@ -111,106 +114,114 @@ const AppRoutes = () => { }, [location.pathname]); // ✅ Android — Capacitor back button - useEffect(() => { - if (!isCapacitor()) return; + useEffect(() => { + if (!isCapacitor()) return; - const handler = async () => { - try { - const currentPath = location.pathname + (location.search || ''); - console.log('🔙 Back pressed:', currentPath); + const handler = async () => { + try { + const currentPath = window.location.pathname + window.location.search; // Bug 2 fix - const raw = sessionStorage.getItem('navStack'); - let stack = raw ? JSON.parse(raw) : []; + const raw = getSession('navStack'); + let stack = raw ? JSON.parse(raw) : []; - // Remove current path from stack if it's at the end - while (stack.length && stack[stack.length - 1] === currentPath) { - stack.pop(); - } + while (stack.length && stack[stack.length - 1] === currentPath) { + stack.pop(); + } - // If there are pages in history, go back to previous page - if (stack.length > 0) { - const previous = stack[stack.length - 1]; - sessionStorage.setItem('navStack', JSON.stringify(stack)); - isBackNav.current = true; - navigate(previous); - console.log('Navigate to previous:', previous); - return; - } + if (stack.length > 0) { + const previous = stack[stack.length - 1]; + sessionStore('navStack', JSON.stringify(stack)); + isBackNav.current = true; // Bug 3 fix — BEFORE navigate + navigate(previous); + return; + } - // Stack is empty - check where we are - // 🏠 Home page → minimize - if (HOME_PAGES?.some((p) => currentPath?.includes(p))) { - console.log('Home page & empty stack → minimizing app'); - await CapacitorApp.minimizeApp(); - return; - } - - // 🚪 Login page → minimize - if (LOGIN_PAGES?.some((p) => currentPath?.includes(p))) { - console.log('Login page & empty stack → minimizing app'); - await CapacitorApp.minimizeApp(); - return; - } - - // Anywhere else with empty stack → go to home - const home = '/app-page/home'; - sessionStorage.setItem('navStack', JSON.stringify([home])); - isBackNav.current = true; - navigate(home); - console.log('Empty stack, navigate to home'); - } catch (e) { - console.error('Back handler error:', e); + if (HOME_PAGES?.some((p) => currentPath?.includes(p))) { await CapacitorApp.minimizeApp(); + return; } - }; - const listener = CapacitorApp.addListener('backButton', handler); + if (LOGIN_PAGES?.some((p) => currentPath?.includes(p))) { + await CapacitorApp.minimizeApp(); + return; + } - return () => { - listener.remove(); - }; - }, [navigate, location.pathname, location.search]); - // mohan - useEffect(() => { - if (isMobile || isIOS) { - console.log('📱 Mobile/iOS device → skipping DevTools detection'); - return; + const home = '/app-page/home'; + isBackNav.current = true; // Bug 3 fix here too + sessionStore('navStack', JSON.stringify([home])); + navigate(home); + } catch (e) { + console.error('Back handler error:', e); + await CapacitorApp.minimizeApp(); } - const checkDevTools = setInterval(() => { - if (devtools.isOpen && !devToolsOpen) { - setDevToolsOpen(true); - document.body.innerHTML = - "

Close Inspect to continue using the application.

"; - } else if (!devtools.isOpen && devToolsOpen) { - setDevToolsOpen(false); + }; - setTimeout(() => { - window.location.reload(); - }, 100); + const listenerPromise = CapacitorApp.addListener('backButton', handler); // Bug 1 fix + return () => { + listenerPromise.then(({ remove }) => remove()); + }; +}, [navigate,location.pathname, location.search]); + // mohan + // useEffect(() => { + // if (isMobile || isIOS) { + // console.log('📱 Mobile/iOS device → skipping DevTools detection'); + // return; + // } + // const checkDevTools = setInterval(() => { + // if (devtools.isOpen && !devToolsOpen) { + // setDevToolsOpen(true); + // document.body.innerHTML = + // "

Close Inspect to continue using the application.

"; + // } else if (!devtools.isOpen && devToolsOpen) { + // setDevToolsOpen(false); - clearInterval(checkDevTools); - } + // setTimeout(() => { + // window.location.reload(); + // }, 100); - if (!devtools.isOpen) { - let before = performance.now(); + // clearInterval(checkDevTools); + // } - let after = performance.now(); + // if (!devtools.isOpen) { + // let before = performance.now(); - let executionDelay = after - before; + // let after = performance.now(); - if (executionDelay > 100) { - setDevToolsOpen(true); - document.body.innerHTML = - "

Close Inspect to continue using the application.

"; - } else { - setDevToolsOpen(false); - } - } - }, 1000); + // let executionDelay = after - before; - return () => clearInterval(checkDevTools); - }, [devToolsOpen]); + // if (executionDelay > 100) { + // setDevToolsOpen(true); + // document.body.innerHTML = + // "

Close Inspect to continue using the application.

"; + // } else { + // setDevToolsOpen(false); + // } + // } + // }, 1000); + // return () => clearInterval(checkDevTools); + // }, [devToolsOpen]); + // const isBlocked = useDevToolsDetection(() => { + // // optional: log, notify, etc. + // console.warn('DevTools detected'); + // }); + + // if (isBlocked) { + // return ( + //
+ //

+ // DevTools detected. Please close it to continue. + //

+ //
+ // ); + // } if (extendModel) { return (