diff --git a/package-lock.json b/package-lock.json
index 37f1ddb..cc75fd1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -49,6 +49,7 @@
"js-cookie": "^3.0.5",
"jsbarcode": "^3.11.6",
"jspdf": "^2.5.1",
+ "lucide": "^0.577.0",
"lucide-react": "^0.536.0",
"material-ui": "^0.20.2",
"moment": "^2.30.1",
@@ -8789,6 +8790,12 @@
"yallist": "^2.1.2"
}
},
+ "node_modules/lucide": {
+ "version": "0.577.0",
+ "resolved": "https://registry.npmjs.org/lucide/-/lucide-0.577.0.tgz",
+ "integrity": "sha512-PpC/m5eOItp/WU/GlQPFBXDOhq6HibL73KzYP37OX3LM7VmzWQF8voEj8QRWUFvy9FIKfeDQkWYoyS1D/MdWFA==",
+ "license": "ISC"
+ },
"node_modules/lucide-react": {
"version": "0.536.0",
"resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.536.0.tgz",
diff --git a/package.json b/package.json
index 28f63d4..9ea6e28 100644
--- a/package.json
+++ b/package.json
@@ -52,6 +52,7 @@
"js-cookie": "^3.0.5",
"jsbarcode": "^3.11.6",
"jspdf": "^2.5.1",
+ "lucide": "^0.577.0",
"lucide-react": "^0.536.0",
"material-ui": "^0.20.2",
"moment": "^2.30.1",
diff --git a/src/Components/PozoAppLoader/PozoAppwithcolor.png b/src/Components/PozoAppLoader/PozoAppwithcolor.png
new file mode 100644
index 0000000..802aff6
Binary files /dev/null and b/src/Components/PozoAppLoader/PozoAppwithcolor.png differ
diff --git a/src/Components/PozoAppLoader/PozoLoader1.jsx b/src/Components/PozoAppLoader/PozoLoader1.jsx
new file mode 100644
index 0000000..04a53da
--- /dev/null
+++ b/src/Components/PozoAppLoader/PozoLoader1.jsx
@@ -0,0 +1,220 @@
+import { useEffect, useRef, useState } from 'react';
+import { createIcons, icons } from 'lucide';
+
+export default function PozoLoader1() {
+ const iconRef = useRef(null);
+ const [percent, setPercent] = useState(0);
+ const [bottom, setBottom] = useState('5%');
+ const [status] = useState('Loading');
+
+ const allIndustries = [
+ 'utensils',
+ 'chef-hat',
+ 'croissant',
+ 'cake',
+ 'coffee',
+ 'ice-cream',
+ 'scissors',
+ 'sparkles',
+ 'dumbbell',
+ 'activity',
+ 'heart-pulse',
+ 'shirt',
+ 'shopping-bag',
+ 'watch',
+ 'gem',
+ 'footprints',
+ 'monitor',
+ 'cpu',
+ 'tv',
+ 'smartphone',
+ 'plug',
+ 'fan',
+ 'store',
+ 'building',
+ 'shopping-cart',
+ 'boxes',
+ 'truck',
+ 'package',
+ 'hard-hat',
+ 'hammer',
+ 'pen-tool',
+ 'paperclip',
+ 'pencil',
+ 'copy',
+ 'file-text',
+ 'printer',
+ 'gift',
+ 'party-popper',
+ 'paint-roller',
+ 'palette',
+ 'wrench',
+ 'layout-grid',
+ 'sofa',
+ 'armchair',
+ 'wine',
+ 'beer',
+ 'martini',
+ 'flower',
+ 'leaf',
+ 'stethoscope',
+ 'pill',
+ 'cross',
+ 'glasses',
+ 'factory',
+ 'settings',
+ 'calculator',
+ 'receipt',
+ 'wallet',
+ 'indian-rupee',
+ 'sailboat',
+ 'anchor',
+ 'circle-parking',
+ 'car',
+ 'trophy',
+ 'medal',
+ 'target',
+ 'bike',
+ ];
+
+ useEffect(() => {
+ if (!iconRef.current) return;
+
+ const container = iconRef.current;
+ container.innerHTML = '';
+
+ // Create icons
+ allIndustries.forEach((name) => {
+ const i = document.createElement('i');
+ i.setAttribute('data-lucide', name);
+ container.appendChild(i);
+ });
+
+ createIcons({ icons });
+
+ const svgs = container.querySelectorAll('svg');
+ if (!svgs.length) return;
+
+ let current = 0;
+ svgs[0].classList.add('active');
+
+ // 🔁 ICON LOOP
+ const iconInterval = setInterval(() => {
+ svgs[current].classList.remove('active');
+ current = Math.floor(Math.random() * svgs.length);
+ svgs[current].classList.add('active');
+ }, 80);
+
+ // 🔁 PERCENT LOOP
+ let currentPercent = 0;
+
+ const percentInterval = setInterval(() => {
+ currentPercent++;
+
+ if (currentPercent > 100) {
+ currentPercent = 0;
+ }
+
+ setPercent(currentPercent);
+
+ // smooth vertical movement
+ const newBottom = 5 + currentPercent * 0.8;
+ setBottom(`${newBottom}%`);
+ }, 60);
+
+ return () => {
+ clearInterval(iconInterval);
+ clearInterval(percentInterval);
+ };
+ }, []);
+
+ return (
+
+
+
+ {/* Percentage Display */}
+ {/*
+ {percent}%
+
*/}
+
+
+
+ );
+}
+
+const styles = {
+ body: {
+ margin: 0,
+ height: '100vh',
+ display: 'flex',
+ justifyContent: 'center',
+ alignItems: 'center',
+ backgroundColor: '#fff',
+ color: '#000',
+ overflow: 'hidden',
+ position: 'relative',
+ },
+ centerWrapper: {
+ position: 'absolute',
+ top: '50%',
+ left: '50%',
+ transform: 'translate(-50%, -50%)',
+ display: 'flex',
+ flexDirection: 'column',
+ alignItems: 'center',
+ },
+ iconDisplay: {
+ position: 'relative',
+ width: '80px',
+ height: '80px',
+ display: 'flex',
+ justifyContent: 'center',
+ alignItems: 'center',
+ },
+ tinyText: {
+ marginTop: '10px',
+ fontFamily: 'Inter, sans-serif',
+ fontSize: '8px',
+ letterSpacing: '4px',
+ textTransform: 'uppercase',
+ animation: 'subtlePulse 1.5s infinite',
+ fontWeight: '500',
+ },
+ percentage: {
+ position: 'absolute',
+ left: '8%',
+ fontSize: '2.5rem',
+ fontFamily: 'monospace',
+ letterSpacing: '-2px',
+ },
+};
diff --git a/src/Components/PozoAppLoader/PozoLoader2.jsx b/src/Components/PozoAppLoader/PozoLoader2.jsx
new file mode 100644
index 0000000..0801ef9
--- /dev/null
+++ b/src/Components/PozoAppLoader/PozoLoader2.jsx
@@ -0,0 +1,272 @@
+import { useEffect, useRef } from 'react';
+import { createIcons, icons } from 'lucide';
+import PozoAppwithcolor from './PozoAppwithcolor.png';
+
+export default function PozoLoader2() {
+ const orbitRef = useRef(null);
+ const orbit2Ref = useRef(null);
+
+ const industries = [
+ 'shopping-cart',
+ 'utensils',
+ 'shirt',
+ 'smartphone',
+ 'pill',
+ 'wrench',
+ 'car',
+ 'coffee',
+ 'heart',
+ 'briefcase',
+ ];
+
+ const industries2 = [
+ 'utensils',
+ 'chef-hat',
+ 'croissant',
+ 'cake',
+ 'coffee',
+ 'ice-cream',
+ 'scissors',
+ 'sparkles',
+ 'dumbbell',
+ 'activity',
+ 'heart-pulse',
+ 'shirt',
+ 'shopping-bag',
+ 'watch',
+ 'gem',
+ 'monitor',
+ 'cpu',
+ 'tv',
+ 'store',
+ 'boxes',
+ 'truck',
+ 'hammer',
+ 'palette',
+ 'wine',
+ 'leaf',
+ 'stethoscope',
+ 'pill',
+ 'factory',
+ 'calculator',
+ 'wallet',
+ 'car',
+ ];
+
+ useEffect(() => {
+ const orbit = orbitRef.current;
+ const orbit2 = orbit2Ref.current;
+
+ if (!orbit || !orbit2) return;
+
+ orbit.innerHTML = '';
+ orbit2.innerHTML = '';
+
+ // INNER ORBIT
+ const radius = 150;
+ const center = 150;
+
+ industries.forEach((name, i) => {
+ const angle = (i / industries.length) * (Math.PI * 2);
+ const x = Math.cos(angle) * radius + center - 15;
+ const y = Math.sin(angle) * radius + center - 15;
+
+ const div = document.createElement('div');
+ div.className = 'floating-icon';
+ div.style.left = `${x}px`;
+ div.style.top = `${y}px`;
+
+ const inner = document.createElement('div');
+ inner.setAttribute('data-lucide', name);
+
+ div.appendChild(inner);
+ orbit.appendChild(div);
+ });
+
+ // OUTER ORBIT
+ const radius2 = 300;
+ const center2 = 350;
+
+ industries2.forEach((name, i) => {
+ const angle = (i / industries2.length) * (Math.PI * 2);
+ const x = Math.cos(angle) * radius2 + center2 - 15;
+ const y = Math.sin(angle) * radius2 + center2 - 15;
+
+ const div = document.createElement('div');
+ div.className = 'floating-icon';
+ div.style.left = `${x}px`;
+ div.style.top = `${y}px`;
+
+ const inner = document.createElement('div');
+ inner.setAttribute('data-lucide', name);
+
+ div.appendChild(inner);
+ orbit2.appendChild(div);
+ });
+
+ createIcons({ icons });
+ }, []);
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
Aligning Business
+
+
+
+ {/* GLOBAL STYLES */}
+
+
+ );
+}
+
+const styles = {
+ body: {
+ margin: 0,
+ height: '100vh',
+ background: '#fff',
+ fontFamily: 'Inter, sans-serif',
+ overflow: 'hidden',
+ },
+
+ center: {
+ position: 'fixed',
+ top: '50%',
+ left: '50%',
+ transform: 'translate(-50%, -50%)',
+ },
+
+ wrapperInner: {
+ position: 'absolute',
+ animation: 'zoomInner 4s ease-in-out infinite',
+ },
+
+ wrapperOuter: {
+ position: 'absolute',
+ animation: 'zoomOuter 6s ease-in-out infinite',
+ },
+
+ orbitInner: {
+ width: '300px',
+ height: '300px',
+ borderRadius: '50%',
+ border: '0.5px solid rgba(0,0,0,0.06)',
+ marginLeft: '-70px',
+ marginTop: '-120px',
+ animation: 'rotate 15s linear infinite',
+ position: 'absolute',
+ },
+
+ orbitOuter: {
+ width: '700px',
+ height: '700px',
+ borderRadius: '50%',
+ border: '0.5px solid rgba(0,0,0,0.06)',
+ marginLeft: '-270px',
+ marginTop: '-320px',
+ animation: 'rotateReverse 22s linear infinite',
+ position: 'absolute',
+ },
+
+ logoAxis: {
+ position: 'relative',
+ zIndex: 10,
+ textAlign: 'center',
+ },
+
+ logoWrapper: {
+ position: 'relative',
+ width: '160px',
+ overflow: 'hidden',
+ },
+
+ logo: {
+ width: '160px',
+ display: 'block',
+ },
+
+ shimmer: {
+ position: 'absolute',
+ top: 0,
+ left: '-120%',
+ width: '60%',
+ height: '100%',
+ background:
+ 'linear-gradient(120deg, transparent, rgba(255,255,255,0.7), transparent)',
+ animation: 'shimmerMove 3s linear infinite',
+ },
+
+ status: {
+ marginTop: '6px',
+ fontSize: '0.7rem',
+ fontWeight: 600,
+ letterSpacing: '4px',
+ textTransform: 'uppercase',
+ color: '#777',
+ animation: 'pulse 2s infinite',
+ },
+};
diff --git a/src/Pages/BookingScreen/BookingPage.jsx b/src/Pages/BookingScreen/BookingPage.jsx
index 66b1b3d..6eefdf3 100644
--- a/src/Pages/BookingScreen/BookingPage.jsx
+++ b/src/Pages/BookingScreen/BookingPage.jsx
@@ -53,6 +53,8 @@ import {
gettinghold,
} from '../../Features/BookingScreen/HoldOption/HoldOption.js';
import Loader from '../../Components/Loader/Loader.jsx';
+import PozoLoader1 from '../../Components/PozoAppLoader/PozoLoader1.jsx';
+import PozoLoader2 from '../../Components/PozoAppLoader/PozoLoader2.jsx';
const BookingPage = () => {
const dispatch = useDispatch();
@@ -422,30 +424,8 @@ const BookingPage = () => {
{Object.keys(templateData)?.length > 0 ? (
<>
-
- Loading Layout...
-
- PozoApp
-
-
- }
- >
+ {/* }> */}
+ }>
{BookingLayout === 'Layout1' && }
{BookingLayout === 'Layout2' && }
{BookingLayout === 'Layout3' && }
@@ -456,7 +436,8 @@ const BookingPage = () => {
>
) : (
-
+ //
+
)}
);
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx
deleted file mode 100644
index 8691f94..0000000
--- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx
+++ /dev/null
@@ -1,4975 +0,0 @@
-import React, { useEffect, useState, useRef, lazy } from 'react';
-import { shallowEqual, useDispatch, useSelector } from 'react-redux';
-import { useNavigate } from 'react-router-dom';
-import moment from 'moment';
-import { Badge, Modal, Popover, Tooltip } from 'antd';
-import { BiRightArrowAlt } from 'react-icons/bi';
-import { AiOutlineClose } from 'react-icons/ai';
-// import BSBillingTable4 from './BSBillingTable4';
-import { UpCircleOutlined } from '@ant-design/icons';
-const BSSummery = lazy(() => import('../BSBillingTableSummery/BSSummery'));
-
-const QrComponent = lazy(
- () => import('../../BookingFunctionality/DynamicQr.jsx')
-);
-
-const QrinScreen = lazy(
- () => import('../../BookingFunctionality/DynamicScreenQr.jsx')
-);
-import { ArrowRightOutlined } from '@ant-design/icons';
-import Buttons from '../../../../../Components/Forms/Buttons';
-import WpIcon from '../../../../../Images/message.png';
-import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4.scss';
-import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTables3/BSBillingTable3.scss';
-import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBillingTable2.scss';
-
-import {
- GlobalSelectedFont,
- getTemplateData,
- SelectedPrintTemplate,
- StoredSessionData,
- GlobalprintDatas,
- GlobalPrinterMappingDtls,
- getPrinterMappingDetails,
- // getPrintSelectionComponentData,
-} from '../../../../../Features/ThemeChange/ThemeChange';
-import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js';
-
-const SplitPayment = lazy(
- () => import('../../BookingFunctionality/SplitPayment.jsx')
-);
-
-const FeaturesFunctionalities = lazy(
- () => import('../../BookingFunctionality/FeaturesFunctionalities')
-);
-import {
- ChangeNavHoldData,
- GlobalBookingType,
- GlobalCustId,
- GlobalNavHoldData,
- GlobalOrderCardDetails,
- GlobalReorderHoldDetails,
- GlobalSelectedTableDetails,
- PostBookingData,
- PutBookingData,
- changeBookingType,
- changeOrderCardDetails,
- changeReorderHoldDetails,
- getConfigType,
- getPaymentOptions,
- getPaymentUpiOptions,
- getUnpaidData,
- getSelectedFavItems,
- GlobalProductSubCategorie,
- getCardDataWithoutSub,
- getCardDataWithoutSubmodule,
- GlobalProductCategorie,
- changeSelectedCustId,
- GlobalSelCustId,
- getLayoutproductCard,
- changeSelectedOption,
- GlobalSelOption,
- changeCustomerID,
- changeUnpaidData,
- ChangeSelectedCustDisable,
- getSalesDetailData,
- GlobalSelectedCustDisable,
- SendPaymentLink,
- changeSummeryTotalAmount,
- changeUpiIDprint,
- changeSummeryTotalItems,
- changeSummeryQty,
- changeSummeryTotalWithoutTaxAmount,
- changeSummeryTotalTaxAmount,
- GlobalEstimateBooking,
- GlobalSelProdWiseEst,
- changeSelProdWiseEst,
- GlobalUpiIDprint,
- GlobalUpiIDName,
- GlobalUpiIDoptionId,
- GlobalBookingTypeBoth,
- changeSelectTable,
- changeSelectChair,
- changeSelectedTableDetails,
- changeReorderProductDetails,
- GlobalCommonPaymentOptions,
- changeUpiIDName,
- changeUpiIDoptionId,
- PostPaymentdevice,
- GetPaymentdeviceResponse,
- PutBookingPaymentStatusChange,
- changePaymentloader,
- GlobalPayementloader,
- PaymentGatewayGetdetail,
- changePaymentTransactionNumber,
- Globalunpaidflow,
- changeunpaidflow,
- PutPendingPaymentList,
- ChangeInitialPaymentName,
- PreferenceData,
- changeOrderType,
- GlobalOrderType,
- GlobalFailedTotalAmt,
- putSplitpaymentStatus,
- GlobalScreenSize,
- GlobalUnpaidListData,
- GlobalOverAllDiscEstimate,
- GlobalOverAllDiscSales,
- ChangeOverAllDiscSales,
- ChangeOverAllDiscEstimate,
- getAllCustomer,
- GlobalBranchFinancialStatus,
- changeSummeryComboOfferAmount,
- ChangeComboCarddata,
- GlobaltipAmount,
- changeTipAmount,
- GlobalOtherSevices,
- GlobalOtherServiceTicketClaim,
- changeOtherServiceTicketClaim,
- GlobalRetailWSSalesType,
- GlobalDefaultBookingType,
- GlobalPaymentTrigger,
- GlobalCurrentOrderId,
- changeCurrentOrderId,
- GlobalCombocarddata,
- getCreditCustomer,
- GlobalSalesBillEdit,
- GlobalPreviousOrderPayment,
- GlobalPreviousOrderOfferDetails,
- GlobalpaymentOptionData,
- putSalesBillEdit,
- changeBillEditingMode,
- changePreviousOrderPayment,
- changePreviousOrderOfferDetail,
- changeSearchedData,
-} from '../../../../../Features/BookingScreen/BookingData/BookingData';
-import {
- globalExtraTotalAmount,
- ChangeTotalAmount,
-} from '../../../../../Features/ExteraCharges/ExtraCharges'; // Shifayath Date:27/12/2023
-import {
- blobToBase64,
- pdfDiv,
- extractLastNumberOrderId,
- printDiv,
- encryptObject,
-} from '../../../../../Services/Others';
-import {
- getAddCustomerDetails,
- getDefaultPaymentOptions,
- GlobalAddCustomerDetails,
- ReprintDetails,
- triggerCustomerRefresh,
-} from '../../../../../Features/BookingScreen/Customer/addCustomer';
-import {
- changeholddata,
- gettinghold,
- globalholddata,
-} from '../../../../../Features/BookingScreen/HoldOption/HoldOption';
-import { Messages } from '../../../../../Components/Notifications/Messages';
-import PaymentPdfBooking from '../../../../paymentpdfPage/PaymentPdfBooking';
-import { DefaultModal } from '../../../../../Components/Modal/DefaultModal';
-import { Tables } from '../../../../../Components/Tables/Table';
-import paygate from '../../../../../Images/paygate.png';
-import defaultupi from '../../../../../Images/defaultupi.png';
-import paydevice from '../../../../../Images/paydevice.png';
-import BSCustomerSelect from '../../UtillComponents/BSSelectCustomer.jsx';
-import PozoHoldIcon from '../../UtillComponents/Pozo retail icons/PozoHoldIcon';
-import PozoDineInIcon from '../../UtillComponents/Pozo retail icons/PozoDineIn.jsx';
-import PozoUnpaidIcon from '../../UtillComponents/Pozo retail icons/PozoUnpaidIcon.jsx';
-import PozoBillIcon from '../../UtillComponents/Pozo retail icons/PozoBIllIcon.jsx';
-const PozoAddCustomerIcon = lazy(
- () =>
- import('../../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx')
-);
-
-const BsBillingCreditCustomer = lazy(
- () => import('../../BookingFunctionality/BSBillingCreditCustomer.jsx')
-);
-import PozoAdvanceIcon from '../../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx';
-const BSCreditCustomer = lazy(
- () => import('../../UtillComponents/BSCreditCustomer.jsx')
-);
-import { isMobile } from 'react-device-detect';
-import MobilePrint from '../../BookingFunctionality/MobilePrint.jsx';
-import CountUp from 'react-countup';
-import { GlobalpreOrderOpen } from '../../../../../Features/BookingScreen/PreOrder/PreOrder.js';
-import TokensinglePrint from '../../../../paymentpdfPage/TokenOnlyPrints/TokeninsinglePrint.jsx';
-import SingleTokenMobilePrint from '../../BookingFunctionality/SingleTokenMobilePrint.jsx';
-import IndividualTokenMobilePrint from '../../BookingFunctionality/IndividualTokenMobilePrint.jsx';
-import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
-import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js';
-import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx';
-import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx';
-import {
- Global_OrderOfferDetail,
- Global_OverallOfferAmount,
-} from '../../../../../Features/Offer/Offer.js';
-import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip';
-import { useAuth } from '../../../../../AuthContext.jsx';
-import { GlobalBookingStatus } from '../../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js';
-import {
- changeSalesPaymentoption,
- GlobalSalesPaymentoption,
-} from '../../../../../Features/Payment/Paymentoptions/Paymentoptions.js';
-const Paymentoption = lazy(
- () => import('../../../../Payment/PaymentOptions/PaymentOptions.jsx')
-);
-import { getPaymentOptionsData } from '../../../../../Features/BookingScreen/BookingData/KioskBookingData.js';
-import { getCombolist } from '../../../../../Features/ComboMaster/ComboMaster.js';
-const WhatsAppShare = lazy(
- () => import('../../../../WhatsAppShare/whatsAppShare.jsx')
-);
-
-const SMSShare = lazy(() => import('../../../../WhatsAppShare/SmsShare.jsx'));
-import { MdSms } from 'react-icons/md';
-import { FaWhatsapp, FaPrint, FaCartPlus } from 'react-icons/fa';
-const BSTipAmount = lazy(() => import('../../UtillComponents/BSTipAmount.jsx'));
-import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js';
-import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js';
-import { TfiClipboard } from 'react-icons/tfi';
-import { PublicQrCodepost } from '../../../../../Features/ConfigMasterPage/ConfigMasterPage.js';
-import {
- ChangeFullFreeProductList,
- changeFullOfferAppliedProducts,
- changeLoyaltyConsumedQuantities,
- GlobalFreeProdList,
- GlobalOfferAppliedProducts,
- GlobalOverAllOfferAmt,
-} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
-import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js';
-import UpiPopover from '../StandardTable/Utils/UpiPopOver.jsx';
-import CardPopover from '../StandardTable/Utils/CardPopover.jsx';
-import pozologoimg from '../../../../../Images/pozologoimg.png';
-import MobileMultiPdfPrintTrigger from '../../UtillComponents/MobileMultiPdfPrintTrigger.jsx';
-const PaymentGatewayEmbedded = lazy(
- () => import('../../UtillComponents/PaymentGatewayEmbedded.jsx')
-);
-
-const CustomerOrders = lazy(
- () => import('../../BookingFunctionality/CustomerOrders.jsx')
-); // jsx File
-const BSOtherServiceClaim = lazy(
- () => import('../../UtillComponents/BSOtherServiceClaim.jsx')
-);
-import OtherServiceMobilePrint from '../../BookingFunctionality/OtherServiceMobilePrint.jsx';
-
-const OtherServicePrintStyle1 = lazy(
- () =>
- import('../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx')
-);
-const subDirectory = import.meta.env.ENV_BASE_URL;
-const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
-const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
-
-const BSBilling4Payment = () => {
- const isF4Pressed = useRef(false);
- const { SadminuserAccess } = useAuth();
- let SAAccessCommonMaster = SadminuserAccess?.find(
- (e) => e?.MenuName === 'Sales'
- );
- const dispatch = useDispatch();
- const navigate = useNavigate();
- const salesBillEdit = useSelector(GlobalSalesBillEdit);
- const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
- const previousOrderOfferDetails = useSelector(
- GlobalPreviousOrderOfferDetails
- );
- const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
- const FreeProdList = useSelector(GlobalFreeProdList);
- const offerAppliedProducts = useSelector(GlobalOfferAppliedProducts);
- // const applyOffer = useApplyOfferto_CardDetail();
- const screenwidth = useSelector(GlobalScreenSize);
- const defaultBookingType = useSelector(GlobalDefaultBookingType);
- const FontFamily = useSelector(GlobalSelectedFont);
- const OrderCardDetail = useSelector(GlobalOrderCardDetails);
- const globalTipAmount = useSelector(GlobaltipAmount);
- const OtherServiceTicketClaim = useSelector(GlobalOtherServiceTicketClaim);
- const GlobalUpiID = useSelector(GlobalUpiIDprint);
- const GetCustId = useSelector(GlobalCustId);
- const SelCustId = useSelector(GlobalSelCustId);
- const selOption = useSelector(GlobalSelOption);
-
- const Discount = useSelector(GlobalOverAllOfferAmt);
- const SelectedTableDetails = useSelector(GlobalSelectedTableDetails);
- const GlobalAddCustomerDetails1 = useSelector(GlobalAddCustomerDetails);
- const Holddata = useSelector(globalholddata);
- const ReportholdData = useSelector(GlobalReorderHoldDetails);
- const BookingType = useSelector(GlobalBookingType);
- const printerTemplateStyle = useSelector(SelectedPrintTemplate);
- const BookingTypeBoth = useSelector(GlobalBookingTypeBoth);
- const [SelectedBookingType, setSelectedBookingType] = useState(null);
- const [PaymentOptions, setPaymentOptions] = useState([]);
- const [PaymentUpiOptions, setPaymentUpiOptions] = useState([]);
- const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
- const NavHoldData = useSelector(GlobalNavHoldData);
- const SettingDataSelector = useSelector(PreferenceData);
- const RetailWSSalesType = useSelector(GlobalRetailWSSalesType);
- const appPreferences = useSelector(ApplicationPreferences);
- const bookingTypePreference = appPreferences?.find(
- (preference) => preference?.PreferredCatName === 'Booking Type'
- )?.PreferenceCatDetails;
- const dinePreference = bookingTypePreference?.find(
- (type) =>
- type?.PreferredSubCatName?.toLowerCase() === 'dine in' &&
- type?.PreferredStatus === 'Y'
- );
- const allowDecimal = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'decimal' &&
- setting?.SettingValue === 'Y'
- );
- const Weightasquantity = SettingDataSelector?.[0]?.SettingDtlDetails?.some(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'weightasquantity' &&
- setting?.SettingValue === 'Y'
- );
- const Custombill = SettingDataSelector?.[0]?.SettingDtlDetails?.some(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'customisedbillnumber' &&
- setting?.SettingValue === 'Y'
- );
- const prodCat = useSelector(GlobalProductCategorie);
- const ProdSubCat = useSelector(GlobalProductSubCategorie);
- const templateData = useSelector(getTemplateData);
- const [urlData, setUrlData] = useState();
-
- // for customised invoice number
- const { selectedDate, invoiceDate, clearInvoiceDate } = useDateStore();
- const CurrentOrderId = useSelector(GlobalCurrentOrderId);
- const salespagefields = appPreferences?.find(
- (pref) => pref?.PreferredCatName === 'Sales Page Fields'
- )?.PreferenceCatDetails;
- const AvailableDate = salespagefields?.find(
- (type) =>
- type?.PreferredSubCatName?.toLowerCase() === 'available date' &&
- type?.PreferredStatus === 'Y'
- );
- console.log(AvailableDate, salespagefields, 'Available Date');
- const Custdisable = useSelector(GlobalSelectedCustDisable);
- const GlobEstBooking = useSelector(GlobalEstimateBooking);
- const GlobProdwisedata = useSelector(GlobalSelProdWiseEst);
- const preOrder = useSelector(GlobalpreOrderOpen);
- const OrderType = useSelector(GlobalOrderType);
- const FailedTotalAmt = useSelector(GlobalFailedTotalAmt);
- const OrderOfferDetail = useSelector(Global_OrderOfferDetail, shallowEqual);
- const [selectCustomerDisplay, setSelectCustomerDisplay] = useState(false);
- const [paymentModeDisplay, setPaymentModeDisplay] = useState(true);
- const [messageType, setMessageType] = useState(null);
- const [messageData, setMessageData] = useState(null);
- const [customerPreviesOrders, setCustomerPreviesOrders] = useState(false);
- const SessionData = useSelector(StoredSessionData);
- const AppId = SessionData?.AppId;
- const CompId = SessionData?.CompId;
- const BranchId = SessionData?.BranchId;
- const UserId = SessionData?.UserId;
- const UserType = SessionData?.UserType;
- const [refundPayBtns, setRefundPayBtns] = useState([]);
- const [refundPaySelected, setRefundPaySelected] = useState();
- const [refundPaySelectedName, setRefundPaySelectedName] = useState(null);
- const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0);
- const [previousNetAmount, setPreviousNetAmount] = useState(0);
- const [PaymentgatewayCard, setPaymentgatewayCard] = useState([]);
- const [PaymentDeviceCard, setPaymentDeviceCard] = useState([]);
- const [PaymentgatewayUPI, setPaymentgatewayUPI] = useState([]);
- const [PaymentDeviceUPI, setPaymentDeviceUPI] = useState([]);
- const [UpiPayOption, setUpiPayOption] = useState([]);
- const [CardPayOption, setCardPayOption] = useState([]);
- const [BusinessPayOption, setBusinessPayoption] = useState([]);
- const [paymentSucess, setPaymentSuccess] = useState(false);
- const [businessUPI, setBusinessUPI] = useState(false);
- const [businessUPIOrderId, setBusinessUPIOrderId] = useState(null);
- const [businessUPILink, setBusinessUPILink] = useState(null);
- const OverAllSales = useSelector(GlobalOverAllDiscSales);
- const OverAllEstimate = useSelector(GlobalOverAllDiscEstimate);
- const Combodata = useSelector(GlobalCombocarddata, shallowEqual);
- const [FirstPaymentclick, setFirstPaymentclick] = useState(false);
- const [open, setOpen] = useState(false);
- const [unpaidopen, setUnpaidOpen] = useState(false);
- const unpaidFlow = useSelector(Globalunpaidflow);
- const [open2, setOpen2] = useState(false);
- const [paybtns, setpaybtns] = useState([]);
- const [paybtnselected, setPaybtnselected] = useState();
- const [Paybtnnameselected, setPaybtnnameselected] = useState();
- const [SelectedUpiOption, setSelectedUpiOption] = useState();
- const [hold, setHold] = useState(false);
- const [addcustomer, setAddCustomer] = useState(false);
- const [PrintOrderDetails, setPrintOrderDetails] = useState([]);
- //Total calculation
- const TotalItems = OrderCardDetail?.length;
- const Qty = OrderCardDetail?.reduce((acc, item) => {
- const isWeightScale = item?.ScaleType === 'weight';
-
- if (isWeightScale) {
- return (
- acc + (Weightasquantity ? Math.round(Number(item?.OrderQty || 0)) : 1)
- );
- }
-
- return acc + Math.round(Number(item?.OrderQty || 0));
- }, 0);
-
- const [formattedDate, setFormattedDate] = useState('');
- const [UpiOptionOpen, setUpiOptionOpen] = useState(false);
-
- const [UpiOption, setUpiOption] = useState('');
- const [UpiId, setUpiId] = useState();
- const [qrCode, setQrCode] = useState(false);
- const tabledata = useSelector(GlobalUnpaidListData);
- const GlobalSalesPaymentoptions = useSelector(GlobalSalesPaymentoption);
-
- const [UpinotSelected, setUpinotSelected] = useState(false);
- const [Success, SetSuccess] = useState();
- const [SelectedCardOption, setSelectedCardOption] = useState(null);
- const [SelectedUPIPayOption, setSelectedUPIPayOption] = useState('Default');
- const [brachName, setbrachName] = useState('');
- const [UpiOpen, setUpiOpen] = useState(false);
- const [CardOptionOpen, setCardOptionOpen] = useState(false);
- const [CardoptionnotSelected, setCardoptionnotSelected] = useState(false);
- const [UnpaidConfirmation, setUnpaidConfirmation] = useState(false);
- const [unpaidselectedindex, setunpaidselectedindex] = useState();
- const [credit, setCredit] = useState(false);
- const [overAllBal, setOverAllBal] = useState(0);
- const [CreditCustomer, setCreditCustomer] = useState(false);
- const [creditCustomerOpen, setcreditCustomerOpen] = useState(false);
- const PaymentOptionsModeName =
- PaymentOptions?.find((e) => e.ModeDefault?.toUpperCase() === 'Y')
- ?.ModeName || PaymentOptions?.[0]?.ModeName;
- const PaymentOptionsModeId =
- PaymentOptions?.find((e) => e.ModeDefault?.toUpperCase() === 'Y')?.ModeId ||
- PaymentOptions?.[0]?.ModeId;
-
- const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
- (i) => i.SettingIdName === 'PrintUom'
- )?.[0];
- const Estimation = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (item) => item.SettingIdName == 'Estimation'
- );
- const ParkingDisplay = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'parking' &&
- setting?.SettingValue === 'Y'
- );
- const MobileA4Print = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'mobilea4' &&
- setting?.SettingValue === 'Y'
- );
- const UpiQRPreference = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'upiqr' &&
- setting?.SettingValue === 'Y'
- );
-
- const GlobalUpName = useSelector(GlobalUpiIDName);
- const GlobalUpiIDoptionIdd = useSelector(GlobalUpiIDoptionId);
- const defaultPaymentTrigger = useSelector(GlobalPaymentTrigger);
- const [defaultPaymentMode, setDefaultPaymentMode] = useState([]);
- const [defaultEnabled, setDefaultEnabled] = useState(false);
- const [ConfigDataList, setConfigDataList] = useState([]);
- const [Splitpayment, setSplitpayment] = useState(false);
- const [OrderStatus, setOrderStatus] = useState(true);
- const GlobaluseOptions = useSelector(GlobalCommonPaymentOptions);
- const [useOptions, setuseOptions] = useState([]);
- const CheckOrderType = OrderCardDetail?.filter(
- (a) => a?.BookingTypeName !== BookingType
- );
- const paymentloader = useSelector(GlobalPayementloader);
- const TokenOnly = SettingDataSelector?.[0]?.SettingDtlDetails?.filter(
- (i) => i.SettingIdName === 'TokenOnly'
- )?.[0];
- const IndividualToken = SettingDataSelector?.[0]?.SettingDtlDetails?.filter(
- (i) => i.SettingIdName === 'AllProductindividualToken'
- )?.[0];
- const [failedOrderData, setFailedOrderData] = useState();
- const [empData, setEmpData] = useState();
- const [addnewAccess, setaddnewAccess] = useState(true);
- const [responsiveBill, setResponsiveBill] = useState(true);
- const tableOptions = templateData?.BookingBilling?.[1];
- const NavBarOptions = templateData?.BookingNavbar?.[1];
- const [blink, setBlink] = useState(false);
- const BookingStatus = useSelector(GlobalBookingStatus);
- const CheckBookingStatus =
- BookingStatus?.find((item) => item.ScreenType === 'Booking')
- ?.ScreenStatus ?? 'Open';
- const OverallOfferAmount = useSelector(Global_OverallOfferAmount);
-
- const [TotalAmount, setTotalAmount] = useState(0);
- const [showWhatsAppShare, setShowWhatsAppShare] = useState(false);
- const [showSMSShare, setSMSShare] = useState(false);
- const allowedNames = ['whatsapp', 'Print', 'SMS'];
- const [MobileNoWhatsApp, setMobileNoWhatsApp] = useState();
- const printDatas = useSelector(GlobalprintDatas);
- const OtherServicesglobal = useSelector(GlobalOtherSevices);
- const [OtherServicesModal, setOtherServicesModal] = useState(false);
- const [vehicleInputs, setVehicleInputs] = useState({});
- const [errors, setErrors] = useState({});
- const [OtherServicesPrintDetails, setOtherServicesPrintDetails] = useState(
- []
- );
- const PrinterDetails = useSelector(GlobalPrinterMappingDtls);
- const [showCancelConfirm, setShowCancelConfirm] = useState(false);
- const holdCheckedSalesSetup = tableOptions?.some(
- (item) => item?.OptionName === 'Hold'
- );
-
- const filteredSettingNames = SettingDataSelector?.[0]?.['SettingDtlDetails']
- ?.filter(
- (item) =>
- allowedNames.includes(item?.SettingIdName) && item?.SettingValue === 'Y'
- )
- ?.map((item) => item?.SettingIdName);
- // Usage
- const preferenceshortcutkey = SettingDataSelector?.[0]?.[
- 'SettingDtlDetails'
- ]?.some(
- (item) =>
- item.SettingIdName.toLowerCase() === 'shortcutkeys' &&
- item.SettingValue === 'Y'
- );
- useEffect(() => {
- if (
- OrderCardDetail?.length === 1 &&
- OrderCardDetail?.[0]?.OrderQty === 1 &&
- !SelCustId
- ) {
- console.log(OrderCardDetail, 'OrderCardDetail');
- closePrintOption();
- setPrintOrderDetails([]);
- }
- }, [OrderCardDetail]);
- useEffect(() => {
- const fetchPrinterMapping = async () => {
- try {
- if (UserType !== 'Super Admin' && isMobile && MobileA4Print) {
- const data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- UserId: UserId,
- };
- // && isMobile && MobileA4Print
- const response = await dispatch(
- getPrinterMappingDetails(data)
- ).unwrap();
- if (response?.data?.statusCode === 0) {
- handlePrintMappingClick();
- }
- console.log(response, 'printer mapping response');
- }
- } catch (error) {
- console.error('Error fetching printer mapping:', error);
- }
- };
-
- fetchPrinterMapping();
- }, []);
- const handlePrintMappingClick = () => {
- // setReprint1(true)
- window.dispatchEvent(new Event('CLICK PRINTER MAPPING'));
- };
-
- useEffect(() => {
- if (salesBillEdit) {
- dispatch(getPaymentOptions()).unwrap();
- }
- }, [salesBillEdit]);
-
- useEffect(() => {
- if (salesBillEdit) {
- if (SelCustId) {
- setRefundPayBtns(AllPaymentOptions);
- setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId);
- setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName);
- } else {
- const withoutCustomer = AllPaymentOptions?.filter?.(
- (item) => item?.ConfigName?.toLowerCase() !== 'credit'
- );
- setRefundPaySelected(withoutCustomer?.[0]?.ConfigId);
- setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName);
- setRefundPayBtns(withoutCustomer);
- }
- }
- }, [AllPaymentOptions, SelCustId, salesBillEdit]);
-
- useEffect(() => {
- const fetchCreditCustomer = async () => {
- const selectedMode = paybtns?.find(
- (pay) => paybtnselected === pay?.ModeId
- )?.ModeName;
-
- if (
- selectedMode?.toLowerCase() === 'credit' &&
- (!UpinotSelected || !CardoptionnotSelected)
- ) {
- setCredit(true);
- try {
- const res = await dispatch(
- getCreditCustomer({
- CompId,
- AppId,
- BranchId,
- CustId: selOption?.CustId,
- })
- ).unwrap();
-
- if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) {
- setOverAllBal(res.data.data[0]?.OverAllBal ?? 0);
- } else {
- setOverAllBal(0);
- }
- } catch (error) {
- console.error('Credit fetch failed', error);
- setOverAllBal(0);
- }
- } else {
- setCredit(false);
- setOverAllBal(0);
- }
- };
-
- fetchCreditCustomer();
- }, [paybtnselected, selOption, paybtns]);
-
- useEffect(() => {
- if (!preOrder) {
- const totalSum = OrderCardDetail?.reduce(
- // (acc, card) => acc + parseFloat(card.OrderRate * card.OrderQty || 0),
- (acc, card) => acc + parseFloat(card.TotalAmt || 0),
- 0
- );
-
- const extra = GlobalExtraCharge?.reduce(
- (acc, obj) => acc + (obj.TotalAmt || 0),
- 0
- );
-
- let withComboSum = 0;
- const withComboOffer_CardDetail = OrderCardDetail?.filter(
- (item) => item.Type === 'C'
- );
- if (withComboOffer_CardDetail?.length > 0) {
- withComboSum = formatAmount(
- withComboOffer_CardDetail.reduce(
- (acc, card) =>
- acc +
- parseFloat(card.OrderRate * card.OrderQty - card.TotalAmt || 0),
- 0
- )
- );
- }
-
- let Total =
- extra === undefined
- ? totalSum - OverallOfferAmount - withComboSum
- : totalSum + extra - OverallOfferAmount - withComboSum;
-
- // Subtract OtherServiceTicketClaim?.totalTicketamount if present and > 0
- if (OtherServiceTicketClaim?.TotalAmt > 0) {
- if (Total - OtherServiceTicketClaim.TotalAmt > 0) {
- Total -= OtherServiceTicketClaim.TotalAmt;
- } else {
- dispatch(
- changeOtherServiceTicketClaim({
- TicketId: null,
- TotalAmt: 0,
- ParkingClaimed: false,
- ServiceCategory: null,
- })
- );
- }
- } else if (OtherServiceTicketClaim?.OtherType == 'Remove') {
- dispatch(
- changeOtherServiceTicketClaim({
- TicketId: null,
- TotalAmt: 0,
- ParkingClaimed: false,
- ServiceCategory: null,
- })
- );
- }
-
- const filteredPayments =
- previousOrderPayment?.filter(
- (p) =>
- p?.LastOrderTran === 'Y' &&
- p?.AfterAdjustment != null &&
- p?.AfterAdjustment !== '' &&
- p?.AfterAdjustment
- ) || [];
-
- const paymentsToUse =
- filteredPayments.length > 0
- ? filteredPayments
- : previousOrderPayment || [];
-
- const totalPreviouspayment = paymentsToUse?.reduce(
- (acc, payment) =>
- acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
- 0
- );
-
- const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce(
- (acc, offer) => acc + parseFloat(offer.OfferAmount || 0),
- 0
- );
-
- const previousNetAmount = totalPreviouspayment || 0;
-
- let withdiscTotal =
- Total -
- ((OverAllSales || 0) +
- (OverAllEstimate || 0) +
- (Discount > 0 ? Discount : 0));
-
- const currentOrderNetAmount = formatAmount(
- withdiscTotal >= 0
- ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2)
- : (Number(Total) + Number(globalTipAmount)).toFixed(2)
- );
-
- setTotalAmount(
- salesBillEdit
- ? currentOrderNetAmount > previousNetAmount
- ? currentOrderNetAmount - previousNetAmount
- : 0
- : currentOrderNetAmount
- );
- setCurrentOrderNetAmount(currentOrderNetAmount);
- setPreviousNetAmount(previousNetAmount);
- dispatch(
- changeSummeryTotalAmount(
- salesBillEdit
- ? currentOrderNetAmount > previousNetAmount
- ? currentOrderNetAmount - previousNetAmount
- : 0
- : currentOrderNetAmount
- )
- );
-
- dispatch(changeSummeryComboOfferAmount(withComboSum));
-
- // if (withdiscTotal <= 0) {
- // dispatch(ChangeOverAllDiscSales(0));
- // dispatch(ChangeOverAllDiscEstimate(0));
- // }
- } else {
- setTotalAmount(0);
- dispatch(changeSummeryTotalAmount(0));
- dispatch(changeSummeryComboOfferAmount(0));
- }
- }, [
- OrderCardDetail,
- GlobalExtraCharge,
- OverAllSales,
- OverAllEstimate,
- globalTipAmount,
- OtherServiceTicketClaim,
- Discount,
- ]);
-
- //mohan stoped data
- useEffect(() => {
- if (
- (BookingType === 'Dine In' ||
- BookingTypeBoth ||
- CheckOrderType?.length > 0) &&
- !unpaidFlow &&
- SelectedTableDetails?.length !== 0
- ) {
- setOrderStatus(true);
- } else {
- setOrderStatus(false);
- }
- }, [BookingTypeBoth, BookingType, unpaidFlow]);
- //mohan end
- // useEffect(() => {
- // const handleKeyPress = (event) => {
- // if (event.shiftKey && event.code === 'KeyM') {
- // if (
- // document.activeElement.tagName !== 'INPUT' &&
- // document.activeElement.tagName !== 'TEXTAREA'
- // ) {
- // event.preventDefault();
- // setBlink(true);
- // }
- // }
- // };
- // const handleClickOutside = (event) => {
- // setBlink(false);
- // };
- // window.addEventListener('keydown', handleKeyPress);
- // window.addEventListener('mousedown', handleClickOutside);
- // return () => {
- // window.removeEventListener('keydown', handleKeyPress);
- // window.addEventListener('mousedown', handleClickOutside);
- // };
- // }, []);
- useEffect(() => {
- let data = selOption != null ? selOption : GetCustId;
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- customer: data,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- }, [selOption, GetCustId]);
- useEffect(() => {
- let data = GlobalUpiID;
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- upi: data,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- setUpiOption(GlobalUpName);
- setSelectedUpiOption(GlobalUpiIDoptionIdd);
- setUpiId(GlobalUpiID);
- }, [GlobalUpiID]);
- useEffect(() => {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- paymentMethod: Paybtnnameselected,
- Paymentgateway: false,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- dispatch(ChangeInitialPaymentName(Paybtnnameselected));
- }, [Paybtnnameselected]);
- useEffect(() => {
- if (OrderCardDetail?.length <= 0) {
- dispatch(changeCustomerID(null));
- dispatch(changeSelectedCustId());
- dispatch(changeSelectedOption(null));
-
- dispatch(ChangeSelectedCustDisable(false));
- }
- }, [OrderCardDetail]);
-
- useEffect(() => {
- if (SelCustId) {
- setpaybtns(PaymentOptions);
- } else {
- const withoutCustomer = PaymentOptions?.filter?.(
- (item) => item?.ModeName?.toLowerCase() !== 'credit'
- );
- setpaybtns(withoutCustomer);
- }
- }, [PaymentUpiOptions, PaymentOptions, SelCustId]);
-
- const Print = async () => {
- const style = await PrintStyleFunction(
- printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle,
- 'Sales'
- );
- console.log(style, printerTemplateStyle, 'printpagestyle');
- const stylesMap = {
- 'Style 1': 'PrintStyle1',
- 'Style 2': 'PrintStyle2',
- 'Style 3': 'PrintStyle3',
- 'Style 4': 'PrintStyle4',
- 'Style 5': 'PrintStyle5',
- 'Style 6': 'PrintStyle6',
- 'Style 7': 'PrintStyle7',
- 'Style 8': 'PrintStyle8',
- 'Style 9': 'PrintStyle9',
- 'Style 10': 'PrintStyle10',
- 'Style 11': 'PrintStyle11',
- 'Style 12': 'PrintStyle12',
- 'Style 13': 'RePrint',
- A4: 'PrintStyleA4',
- A5: 'PrintStyleA5',
- A4Standard: 'A4Standard',
- TaxInvoice: 'TaxInvoice',
- };
-
- const selectedStyle =
- stylesMap[
- printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle
- ];
- console.log(selectedStyle, style, 'style');
- if (selectedStyle) {
- await Promise.all(
- PrintOrderDetails?.[0]?.OrderDetails?.map(
- async (orderDetail, index) => {
- await printDiv(`${selectedStyle}-${index}`, style); // Use unique IDs for each print
- if (orderDetail?.BookingTypeName !== 'Dine In') {
- const groupedTokens = orderDetail?.productDetails?.reduce(
- (acc, item, idx) => {
- if (item.TokenAvailable === 'Y') {
- if (!item.CounterName) {
- // If CounterName is null or empty
- acc[`individual-${idx}-${item.ProdId}`] = [item]; // Unique entry for each null/empty CounterName item
- } else {
- if (!acc[item.CounterName]) {
- acc[item.CounterName] = [];
- }
- acc[item.CounterName].push(item); // Group by CounterName
- }
- }
- return acc;
- },
- {}
- );
-
- // Iterate over grouped tokens and print them
- const tokensToPrint = Object.entries(groupedTokens).map(
- async ([counterName, items], idx) => {
- // Use the counterName (or unique identifier for individual items) as part of the tokenId
- const tokenId = `${idx}-${items?.[0]?.ProdId}-${counterName}`;
- await TokenPrint(tokenId, items); // Pass all grouped items to the print function
- }
- );
- if (tokensToPrint?.length > 0) {
- await Promise.all(tokensToPrint);
- }
- }
- }
- )
- );
-
- setPrintOrderDetails([]);
- }
- };
- // const MobilePdfPrint = async ()=>{
- // const style = await PrintStyleFunction(
- // printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle,
- // 'Sales'
- // );
- // const stylesMap = {
- // 'Style 1': 'PrintStyle1',
- // 'Style 2': 'PrintStyle2',
- // 'Style 3': 'PrintStyle3',
- // 'Style 4': 'PrintStyle4',
- // 'Style 5': 'PrintStyle5',
- // 'Style 6': 'PrintStyle6',
- // 'Style 7': 'PrintStyle7',
- // 'Style 8': 'PrintStyle8',
- // 'Style 9': 'PrintStyle9',
- // 'Style 10': 'PrintStyle10',
- // 'Style 11': 'PrintStyle11',
- // 'Style 12': 'PrintStyle12',
- // 'Style 13': 'RePrint',
- // A4: 'PrintStyleA4',
- // A5: 'PrintStyleA5',
- // A4Standard: 'A4Standard',
- // };
-
- // const selectedStyle =
- // stylesMap[
- // printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle
- // ];
- // let Printsize = printDatas?.Printsize? printDatas?.Printsize:"A4"
- // if (selectedStyle) {
- // let container = document.getElementById('print-merged');
- // if (!container) {
- // container = document.createElement('div');
- // container.id = 'print-merged';
- // container.style.display = 'none'; // optional
- // document.body.appendChild(container);
- // } else {
- // container.innerHTML = ''; // Clear old content
- // }
-
- // PrintOrderDetails?.[0]?.OrderDetails?.forEach((_, index) => {
- // const element = document.getElementById(`${selectedStyle}-${index}`);
- // if (element) {
- // const cloned = element.cloneNode(true);
- // container.appendChild(cloned);
- // }
- // });
-
- // const pdfBlob = await pdfDiv('print-merged', style);
-
- // const base64Pdf = await blobToBase64(pdfBlob);
- // const intentUrl =
- // 'intent://open?' +
- // 'filename=' + encodeURIComponent('Receipt.pdf') +
- // '&size=' + pdfBlob.size +
- // '&type=application/pdf' +
- // '&data=' + encodeURIComponent(base64Pdf) +'&PrintTypeS=' + encodeURIComponent(Printsize) +
- // '&PrintTypeE' +
- // '#Intent;scheme=pozoprinter;package=com.example.pozoprinter;end';
-
- // window.location.href = intentUrl;
-
- // setPrintOrderDetails([]);
- // }
-
- // }
- useEffect(() => {
- if (NavHoldData) {
- AddBookingDetails('Hold');
- }
- }, [NavHoldData]);
-
- useEffect(() => {
- if (selOption) {
- closePrintOption();
- setMobileNoWhatsApp(selOption);
- }
- }, [selOption]);
- const formatAmount = (value) => {
- return allowDecimal
- ? parseFloat(value || 0).toFixed(2)
- : Math.round(value || 0);
- };
- const TokenPrint = async (index) => {
- try {
- console.log(`Starting token print for index ${index}`);
-
- const stylePrint = ``;
- if (TokenOnly?.SettingValue === 'Y') {
- if (IndividualToken?.SettingValue === 'Y') {
- await printDiv(`TokenOnlySingle${index}`, stylePrint);
- } else {
- await printDiv(`TokenOnlyMultiple${index}`, stylePrint);
- }
- } else {
- await printDiv(`TakeawayToken${index}`, stylePrint);
- }
- } catch (error) {
- console.error(`Error printing token for index ${index}:`, error);
- }
- };
- const closePrintOption = () => {
- setShowWhatsAppShare(false);
- setSMSShare(false);
- setPrintOrderDetails([]);
- setMobileNoWhatsApp();
- };
-
- const handleWhatsAppClick = () => {
- setShowWhatsAppShare(true);
- };
- const handleSMSClick = () => {
- setSMSShare(true);
- };
-
- // useEffect(() => {
- // if (
- // PrintOrderDetails?.length > 0
-
- // ) {
- // handlePrintOrToken();
- // }
- // }, [PrintOrderDetails]);
-
- useEffect(() => {
- if (!PrintOrderDetails?.length) return;
-
- const selectedOptions = filteredSettingNames || [];
- const count = selectedOptions.length;
-
- if (count === 0) {
- handlePrintOrToken();
- return;
- }
- if (count === 1) {
- const option = selectedOptions[0];
-
- switch (option) {
- case 'whatsapp':
- if (!selOption && MobileNoWhatsApp?.value) {
- handleWhatsAppClick();
- } else {
- handlePrintOrToken();
- }
- return;
-
- case 'SMS':
- if (isMobile) handleSMSClick();
- else handlePrintOrToken();
- return;
-
- case 'Print':
- handlePrintOrToken();
- return;
-
- // case "Email":
- // handleEmailClick();
- // return;
-
- default:
- return;
- }
- }
- return;
- }, [PrintOrderDetails]);
-
- const handlePrintOrToken = async () => {
- const dinein =
- PrintOrderDetails?.[0]?.OrderDetails?.[0]?.productDetails?.some(
- (product) => product.BookingTypeName === 'Dine In'
- );
- const Tokenthere =
- PrintOrderDetails?.[0]?.OrderDetails?.[0]?.productDetails?.some(
- (product) => product.TokenAvailable === 'Y'
- );
-
- const preferenceDetails = SettingDataSelector?.[0]?.SettingDtlDetails;
- if (isMobile) {
- if (MobileA4Print) {
- await MobileMultiPdfPrintTrigger({
- preferenceDetails,
- printerTemplateStyle,
- printDatas,
- PrinterDetails,
- PrintOrderDetails,
- SessionData,
- bookingTypePreference,
- });
- } else {
- if (Tokenthere && TokenOnly?.SettingValue === 'Y' && !dinein) {
- if (IndividualToken?.SettingValue === 'Y' && !dinein) {
- IndividualTokenMobilePrint(PrintOrderDetails, UpiId, 'Booking');
- closePrintOption();
- } else {
- SingleTokenMobilePrint(PrintOrderDetails, UpiId, 'Booking');
- closePrintOption();
- }
- } else {
- MobilePrint(
- appPreferences,
- PrintOrderDetails,
- UpiId,
- 'Booking',
- SettingDataSelector
- );
- closePrintOption();
- }
- }
- } else {
- if (Tokenthere && TokenOnly?.SettingValue === 'Y' && !dinein) {
- AllProductTokenFunction();
- } else {
- Print();
- }
- }
- };
-
- useEffect(() => {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- ExtraCharges: GlobalExtraCharge,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- }, [GlobalExtraCharge]);
-
- useEffect(() => {
- // TotalItemsCalculation();
- TotalWithoutTaxRate();
- TotalTaxAmt();
- OrderCardDetail?.length == 0 ? dispatch(changeunpaidflow(false)) : '';
- }, [OrderCardDetail]);
- useEffect(() => {
- if (CompId && BranchId && AppId) {
- if (
- holdCheckedSalesSetup ||
- NavBarOptions?.some((e) => e?.OptionName == 'Hold')
- ) {
- getHolddata();
- }
- // getUnpaiddatas();
- getCustomerData();
- }
- }, [CompId, BranchId, AppId]);
- useEffect(() => {
- gettodaydate();
- getBookingTypeId();
- getPaymentOptionFeature();
-
- // if (UserType === "Employee") {
- // fetchApi()
- // }
- }, []);
- 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'
- );
- setEmpData(datas?.[0]);
- };
- const getCustomerData = async () => {
- await dispatch(
- getAllCustomer({ CompId: CompId, AppId: AppId, branchId: BranchId })
- );
- await dispatch(
- getAddCustomerDetails({
- CompId: CompId,
- AppId: AppId,
- branchId: BranchId,
- })
- );
- };
-
- useEffect(() => {
- getPaymentOptionFeature();
- }, [GlobaluseOptions]);
- const AllProductTokenFunction = async () => {
- if (IndividualToken?.SettingValue === 'Y') {
- await Promise.all(
- PrintOrderDetails?.[0]?.OrderDetails?.map(
- async (orderDetail, index) => {
- const groupedTokens = orderDetail?.productDetails?.reduce(
- (acc, item, idx) => {
- if (item.TokenAvailable === 'Y') {
- if (!item.CounterName) {
- // If CounterName is null or empty
- acc[`single-${idx}-${item.ProdId}`] = [item]; // Unique entry for each null/empty CounterName item
- } else {
- if (!acc[item.CounterName]) {
- acc[item.CounterName] = [];
- }
- acc[item.CounterName].push(item); // Group by CounterName
- }
- }
- return acc;
- },
- {}
- );
-
- // Iterate over grouped tokens and print them
- const tokensToPrint = Object.entries(groupedTokens).map(
- async ([counterName, items], idx) => {
- // Use the counterName (or unique identifier for individual items) as part of the tokenId
- const tokenId = `${idx}-${items?.[0]?.ProdId}-${counterName}`;
- await TokenPrint(tokenId, items); // Pass all grouped items to the print function
- }
- );
- if (tokensToPrint?.length > 0) {
- await Promise.all(tokensToPrint);
- }
- setPrintOrderDetails([]);
- closePrintOption();
- }
- )
- );
- } else {
- await Promise.all(
- PrintOrderDetails?.[0]?.OrderDetails?.map(
- async (orderDetail, index) => {
- await TokenPrint(`${index}-${orderDetail?.OrderId}`);
- }
- )
- );
- setPrintOrderDetails([]);
- closePrintOption();
- }
- };
-
- //dhana
- // Function to check if the button is active
- const isButtonActive = () => {
- const baseCondition =
- FirstPaymentclick === false &&
- OrderCardDetail?.length > 0 &&
- paybtnselected &&
- CheckBookingStatus !== 'Close';
- let accessCondition = true;
- if (UserType === 'Employee') {
- accessCondition = empData?.AddAccess === 'Y';
- } else if (UserType === 'Super Admin User') {
- accessCondition = SAAccessCommonMaster?.AddAccess === 'Y';
- }
- return baseCondition && accessCondition;
- };
-
- // Function to handle the button click
- const handleButtonClick = () => {
- if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) {
- UpiPayment();
- } else if (
- salesBillEdit &&
- currentOrderNetAmount < previousNetAmount &&
- !refundPaySelected
- ) {
- setMessageType('warning');
- setMessageData('Please Select Refund Payment Method');
- return;
- } else {
- OrderStatus
- ? AddBookingDetails('Dine-In', false)
- : AddBookingDetails(BookingType, true);
- }
- };
- const financialYearError = async () => {
- setMessageType('error');
- setMessageData('Financial Year-Based Sales Not Yet Started');
- };
-
- useEffect(() => {
- const handleKeyPress = (event) => {
- if (!preferenceshortcutkey) return;
- if (event.key === 'F4' && isButtonActive() && !isF4Pressed.current) {
- isF4Pressed.current = true;
- // BranchFinancialStatus==='N'? financialYearError():
- handleButtonClick();
- setTimeout(() => {
- isF4Pressed.current = false; // Reset after a short delay
- }, 1000);
- }
-
- if (
- event.altKey &&
- event.key === 'w' &&
- BookingType !== 'Dine In' &&
- tableOptions?.some((e) => e?.OptionName == 'Hold') &&
- paybtns?.length > 0
- ) {
- event.preventDefault();
- if (
- OrderCardDetail?.length > 0 &&
- CheckBookingStatus !== 'Close' &&
- !addnewAccess
- ) {
- AddBookingDetails('Hold', false);
- } else if (
- Holddata?.length > 0 &&
- OrderCardDetail?.length === 0 &&
- CheckBookingStatus !== 'Close' &&
- !addnewAccess
- ) {
- HandleholdModelOpen();
- }
- }
-
- // Alt+S for Split Payment
- if (event.altKey && event.key === 's' && paybtns?.length > 1) {
- event.preventDefault();
- if (
- OrderCardDetail?.length > 0 &&
- CheckBookingStatus !== 'Close' &&
- !addnewAccess &&
- !unpaidFlow &&
- !OrderStatus
- ) {
- SplitPaymentOpen();
- }
- }
- };
-
- window.addEventListener('keydown', handleKeyPress);
- return () => {
- window.removeEventListener('keydown', handleKeyPress);
- };
- }, [
- paybtns,
- preferenceshortcutkey,
- FirstPaymentclick,
- OrderCardDetail,
- paybtnselected,
- OrderStatus,
- qrCode,
- SelectedUPIPayOption,
- TotalAmount,
- SelectedUpiOption,
- SelectedCardOption,
- BookingType,
- Holddata,
- CheckBookingStatus,
- addnewAccess,
- paybtns,
- unpaidFlow,
- ]);
-
- //dhana
-
- const getPaymentOptionFeature = async () => {
- const FiltersalesPayment = GlobaluseOptions?.filter(
- (item) => item.FlowName?.toLowerCase() === 'sales'
- );
- setuseOptions(FiltersalesPayment);
- const filterpaycounter = FiltersalesPayment?.[0]?.OptionDetails?.filter(
- (item) => item?.OptionName?.toLowerCase() === 'pay at the counter'
- );
- const filterpaymentgateway = FiltersalesPayment?.[0]?.OptionDetails?.filter(
- (item) => item?.OptionName?.toLowerCase() === 'payment gateway'
- );
- const filterpaymentdevice = FiltersalesPayment?.[0]?.OptionDetails?.filter(
- (item) => item?.OptionName?.toLowerCase() === 'payment device'
- );
- const filterBusinessUpi = FiltersalesPayment?.[0]?.OptionDetails?.filter(
- (item) => item?.OptionName?.toLowerCase() === 'business upi'
- );
- const cardinpaymentgateway =
- filterpaymentgateway?.[0]?.ModeDetails?.filter((item) =>
- item?.ModeName?.toLowerCase()?.includes('card')
- ) || [];
- const cardinpaymentdevice =
- filterpaymentdevice?.[0]?.ModeDetails?.filter((item) =>
- item?.ModeName?.toLowerCase()?.includes('card')
- ) || [];
- const upiinpaymentgateway =
- filterpaymentgateway?.[0]?.ModeDetails?.filter((item) =>
- item?.ModeName?.toLowerCase()?.includes('upi')
- ) || [];
- const upiinpaymentdevice =
- filterpaymentdevice?.[0]?.ModeDetails?.filter((item) =>
- item?.ModeName?.toLowerCase()?.includes('upi')
- ) || [];
-
- setPaymentOptions(filterpaycounter?.[0]?.ModeDetails);
- setPaymentUpiOptions(
- FiltersalesPayment?.[0]?.PaymentDetails?.Payatthecounter
- );
- setPaymentDeviceCard(cardinpaymentdevice);
- setPaymentgatewayCard(cardinpaymentgateway);
- setPaymentgatewayUPI(upiinpaymentgateway);
- setPaymentDeviceUPI(upiinpaymentdevice);
- const cardoptions = [];
- if (cardinpaymentgateway?.length > 0) {
- cardoptions.push({
- label: 'Payment Gateway',
- value: 'PG',
- imgSrc: paygate,
- });
- }
- if (cardinpaymentdevice?.length > 0) {
- cardoptions.push({
- label: 'Payment Device',
- value: 'PD',
- imgSrc: paydevice,
- });
- }
- setCardPayOption(cardoptions);
- const options = [];
-
- if (FiltersalesPayment?.[0]?.PaymentDetails?.Payatthecounter?.length > 0) {
- options.push({
- label: 'Personal UPI',
- value: 'Default',
- imgSrc: defaultupi,
- });
- }
- if (filterBusinessUpi?.[0]?.ModeDetails?.length > 0) {
- options.push({
- label: 'Business UPI',
- value: 'Business',
- imgSrc: pozologoimg,
- PaymentOptionId: filterBusinessUpi?.[0]?.PaymentOptionId,
- PaymentFlowId: filterBusinessUpi?.[0]?.PaymentFlowId,
- OptionId: filterBusinessUpi?.[0]?.OptionId,
- });
- }
- if (upiinpaymentgateway?.length > 0) {
- options.push({
- label: 'Payment Gateway',
- value: 'PG',
- imgSrc: paygate,
- PaymentOptionId: upiinpaymentgateway?.[0]?.PaymentOptionId,
- PaymentModeId: upiinpaymentgateway?.[0]?.PaymentModeId,
- ModeId: upiinpaymentgateway?.[0]?.ModeId,
- });
- }
-
- if (upiinpaymentdevice?.length > 0) {
- options.push({ label: 'Payment Device', value: 'PD', imgSrc: paydevice });
- }
- setUpiPayOption(options);
- setBusinessPayoption(filterBusinessUpi?.[0]?.ModeDetails || []);
- // }
- };
- useEffect(() => {
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- }, [PaymentOptions]);
- useEffect(() => {
- getBookingTypeId();
- }, [BookingType]);
- const getPaymentOptionsfun = async () => {
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- };
- await dispatch(getPaymentOptions()).unwrap();
- await dispatch(getPaymentUpiOptions(data)).unwrap();
- };
- const handleResponsiveBill = () => {
- setResponsiveBill(!responsiveBill);
- };
-
- const getHolddata = async () => {
- const data = { CompId: CompId, BranchId: BranchId, AppId: AppId };
- let response = await dispatch(gettinghold(data)).unwrap();
- if (response?.data?.statusCode == 1) {
- // handleHold();
- dispatch(changeholddata(response?.data?.data));
- } else {
- dispatch(changeholddata([]));
- }
- };
- const getUnpaiddatas = async () => {
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- };
- await dispatch(getUnpaidData(data)).unwrap();
- };
-
- const getBookingTypeId = async () => {
- let tempconfigdata = await dispatch(
- getConfigType({ TypeName: 'Booking Type' })
- ).unwrap();
- setConfigDataList(tempconfigdata?.data?.data);
- let configdata = tempconfigdata?.data?.data;
-
- let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType;
-
- let filterconfigdata = configdata?.find((a) => a?.ConfigName === checkName);
-
- setSelectedBookingType(filterconfigdata?.ConfigId);
- };
- const gettodaydate = () => {
- const currentDate = new Date();
- const day = String(currentDate.getDate()).padStart(2, '0');
- const month = String(currentDate.getMonth() + 1).padStart(2, '0'); // Month is 0-based, so we add 1.
- const year = currentDate.getFullYear();
-
- const tempformattedDate = `${year}-${month}-${day}`;
- setFormattedDate(tempformattedDate);
- };
- const TotalItemsCalculation = async () => {
- let tempTotalitems = OrderCardDetail.length;
- let OverAllQty = OrderCardDetail?.reduce(
- (prev, current) => prev + Number(current?.OrderQty || 0),
- 0
- );
- // setQty(OverAllQty);
- await dispatch(changeSummeryTotalItems(tempTotalitems));
- await dispatch(changeSummeryQty(OverAllQty));
- };
-
- const TotalWithoutTaxRate = async () => {
- const totalwithouttax = OrderCardDetail?.reduce((accumulator, card) => {
- return accumulator + parseFloat(card.WithoutTaxRate || 0);
- }, 0);
- await dispatch(
- changeSummeryTotalWithoutTaxAmount(totalwithouttax.toFixed(2))
- );
- };
- const TotalTaxAmt = async () => {
- const totaltax = OrderCardDetail?.reduce((accumulator, card) => {
- return accumulator + parseFloat(card.TaxAmt || 0);
- }, 0);
- await dispatch(changeSummeryTotalTaxAmount(totaltax.toFixed(2)));
- };
-
- const handleOpenChange = (newOpen) => {
- setOpen(newOpen);
- };
- const handleOpenChange2 = (newOpen) => {
- if (open2) {
- setOpen2(false);
- } else {
- setOpen2(true);
- }
- };
-
- const hide = () => {
- setOpen2(false);
- setOpen(false);
- };
-
- const handlePaymentMode = (id, name) => {
- if (name?.toLowerCase() !== 'credit') {
- setOverAllBal(0);
- setCredit(false);
- }
- if (paymentloader === false) {
- setPaybtnselected(id);
- setPaybtnnameselected(name);
- if (CardPayOption?.length === 1) {
- setSelectedCardOption(CardPayOption?.[0]?.value);
- }
- setUpiOptionOpen(false);
- setQrCode(false);
- setUpinotSelected(false);
- setCardoptionnotSelected(false);
- }
- };
-
- const handleRefundPaymentMode = (id, name) => {
- setRefundPaySelected(id);
- setRefundPaySelectedName(name);
- };
-
- const addUpiOption = async (id, name, UPIId) => {
- await dispatch(changeUpiIDprint(UPIId));
- await dispatch(changeUpiIDName(name));
- await dispatch(changeUpiIDoptionId(id));
- setSelectedUpiOption(id);
- setUpiOption(name);
- setUpiId(UPIId);
- setUpinotSelected(false);
- setCardoptionnotSelected(false);
- // setQrCode(true)
- };
- const AddCardOption = (data) => {
- setSelectedCardOption(data);
- setCardOptionOpen(false);
- setCardoptionnotSelected(false);
- };
- const AddUPIPaymentOption = async (data, mode = false) => {
- setSelectedUpiOption('');
- setUpiOption('');
- setUpiId('');
- await dispatch(changeUpiIDprint(null));
- await dispatch(changeUpiIDName(''));
- await dispatch(changeUpiIDoptionId(null));
- setSelectedUPIPayOption(data);
- setUpinotSelected(false);
- setCardoptionnotSelected(false);
- if (data !== 'Default' && data !== 'Business' && !mode) {
- setUpiOptionOpen(false);
- }
- };
- const handleUPIButtonClick = (id, name) => {
- if (paymentloader === false) {
- setPaybtnnameselected(name);
- setPaybtnselected(id);
- let brachName1 = PaymentUpiOptions?.[0]?.BrName;
- setbrachName(brachName1);
- if (UpiPayOption?.length === 1) {
- setSelectedUPIPayOption(UpiPayOption?.[0]?.value);
- if (UpiPayOption?.[0]?.value?.toLowerCase() === 'default') {
- if (PaymentUpiOptions?.length === 1) {
- addUpiOption(
- PaymentUpiOptions?.[0]?.Mode,
- PaymentUpiOptions?.[0]?.ModeName,
- PaymentUpiOptions?.[0]?.UPIId
- );
- }
- }
- }
-
- setQrCode(true);
- SetSuccess(true);
- }
- };
- const EnableUpiOptions = () => {
- setUpiOptionOpen(!UpiOptionOpen);
- };
- const EnableCardOptions = () => {
- setCardOptionOpen(!CardOptionOpen);
- };
- const HandleholdModelOpen = () => {
- setHold(true);
- };
-
- const handleHoldCancel = () => {
- setHold(false);
- };
- const handleAddCustomer = () => {
- if (Custdisable === false) {
- setAddCustomer(true);
- }
- };
- const handleAddCustomerCancel = () => {
- setAddCustomer(false);
- };
-
- const hideDefault = () => {
- setUpiOptionOpen(false);
- };
- const handlePopoverVisibleChange = (visible) => {
- setUpiOptionOpen(visible);
- };
- const ProductSummary = (salesData) => {
- // Create a map to store the aggregated values for each unique product
- const productMap = new Map();
- // Iterate over the sales data to aggregate values
- salesData.forEach((item) => {
- let offerMode = item?.OfferMode?.trim();
- offerMode = offerMode && offerMode !== '' ? offerMode : null;
-
- let OfferId = null;
- if (
- item?.OfferMessage &&
- Array.isArray(item.OfferMessage) &&
- item.OfferMessage.length > 0
- ) {
- OfferId = item.OfferMessage[0]?.OfferId || null;
- }
-
- const keyData = [
- item.ProdId || null,
- item.InwardDtlId || null,
- item.BookingType || null,
- item.SinglePc || null,
- item.OrderRate || null,
- offerMode,
- OfferId,
- ];
-
- const key = keyData.join('-');
-
- if (productMap.has(key)) {
- const existingItem = productMap.get(key);
- existingItem.OrderQty =
- (existingItem.OrderQty || 0) + (item.OrderQty || 0);
- existingItem.TotalAmt =
- (existingItem.TotalAmt || 0) + (item.TotalAmt || 0);
- existingItem.TaxAmt =
- (parseFloat(existingItem.TaxAmt) || 0) +
- (parseFloat(item.TaxAmt) || 0);
- } else {
- const newItem = {
- ...item,
- OfferMode: offerMode,
- OfferMessage:
- item?.OfferMessage && Array.isArray(item.OfferMessage)
- ? item.OfferMessage
- : null,
- };
- productMap.set(key, newItem);
- }
- });
-
- // Convert the map values back to an array
- const aggregatedProducts = Array.from(productMap.values());
-
- return aggregatedProducts;
- }; //change by karthiga27
-
- const UpiPayment = () => {
- if (OrderStatus) {
- AddBookingDetails('Dine-In', false);
- } else {
- if (SelectedUpiOption && TotalAmount == 0) {
- Upimodel('Submit');
- } else if (SelectedUpiOption) {
- setUpiOpen(true);
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- OrderTotalAmount: TotalAmount,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- } else {
- setUpinotSelected(true);
- setMessageType('error');
- setMessageData('Please Select Upi Option');
- }
- }
- };
- const handleCreditCustomer = (type) => {
- setCreditCustomer(false);
- if (type == 'Submit') {
- Booking(BookingType, true);
- }
- if (type == 'Cancel') {
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- }
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedRemovedData = {
- type: 'remove',
- keyValue: 'OrderTotalAmount',
- };
- customerDisplayWindow.postMessage(updatedRemovedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- };
-
- const handlePopoverVisibleChangeCard = (visible) => {
- setCardOptionOpen(visible);
- };
- const ClearAllGlobalStateDatas = async (value) => {
- // if (OfferCheckedInSetup && preferenceOffer) {
- // await applyOffer([]);
- // } else {
- dispatch(changeOrderCardDetails([]));
- // }
- dispatch(changeBillEditingMode(false));
- dispatch(changeSearchedData(''));
- await dispatch(changePreviousOrderPayment([]));
- await dispatch(changePreviousOrderOfferDetail([]));
- dispatch(changeLoyaltyConsumedQuantities({}));
- dispatch(changeFullOfferAppliedProducts([]));
- dispatch(ChangeFullFreeProductList([]));
- dispatch(changeTipAmount(0));
- await dispatch(ChangeTotalAmount([]));
- await dispatch(changeReorderHoldDetails({}));
- await dispatch(changeReorderProductDetails([]));
- setFirstPaymentclick(false);
- await dispatch(ChangeNavHoldData(false));
- await dispatch(changeCustomerID(null));
- await dispatch(changeSelectedCustId());
- await dispatch(changeSelectedOption(null));
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- setQrCode(false);
- setCurrentOrderNetAmount(0);
- setPreviousNetAmount(0);
- setUpinotSelected(false);
- if (
- holdCheckedSalesSetup ||
- NavBarOptions?.some((e) => e?.OptionName == 'Hold')
- ) {
- getHolddata();
- }
- if (defaultBookingType === 'Both') {
- await dispatch(changeBookingType('TakeAway'));
- }
- await dispatch(changeSelProdWiseEst([]));
- await dispatch(ChangeOverAllDiscSales(null));
- await dispatch(ChangeOverAllDiscEstimate(null));
- // clearInvoiceDate
- clearInvoiceDate();
- dispatch(changeCurrentOrderId(null));
- // await dispatch(changeEstimateBooking(null))
- getstockbadge();
- Combodata?.length > 0 && Combocarddata();
- getUnpaiddatas();
- await dispatch(changeSelectTable([]));
- await dispatch(changeSelectChair([]));
- await dispatch(changeSelectedTableDetails([]));
- await dispatch(changeOrderType());
- if (value === 'Dine-In') {
- navigate(`${subDirectory}sales/dine-in`);
- }
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- UserId: UserId,
- FromDate: currentDateValue,
- ToDate: currentDateValue,
- };
- await dispatch(getSalesDetailData(data));
- };
-
- const AddBookingDetails = async (value, pay) => {
- const customerDisplayWindow = getCustomerDisplayWindow();
-
- const OnUpiSelected = PaymentOptions?.find(
- (item) => item.ModeId === paybtnselected
- );
-
- if (
- OnUpiSelected?.ModeName?.toLowerCase() === 'upi' &&
- (SelectedUPIPayOption?.toLowerCase() === 'default' ||
- SelectedUPIPayOption?.toLowerCase() === 'business')
- ) {
- SetSuccess(false);
- setTimeout(function () {
- SetSuccess(true);
- // Add your state change code here
- // For example:
- // setNewState(newValue);
- }, 3000);
- if (SelectedUpiOption) {
- Booking(value, pay);
- } else {
- setUpinotSelected(true);
- setMessageType('error');
- setMessageData('Please Select Upi Option');
- }
- } else if (
- OnUpiSelected?.ModeName?.toLowerCase() === 'card' &&
- PaymentgatewayCard?.length > 0 &&
- PaymentDeviceCard?.length > 0
- ) {
- if (SelectedCardOption) {
- if (SelectedCardOption?.toLowerCase() === 'pg') {
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- if (SelCustId) {
- Booking(value, pay);
- } else {
- setMessageType('error');
- setMessageData('Please Select Customer');
- }
- } else {
- setMessageType('error');
- setMessageData('Please Set the customer display');
- }
- } else {
- Booking(value, pay);
- }
- } else {
- setCardoptionnotSelected(true);
- setMessageType('error');
- setMessageData('Please Select Card Option');
- }
- } else if (OnUpiSelected?.ModeName?.toLowerCase() === 'credit') {
- if (!SelCustId) {
- setMessageType('error');
- setMessageData('Please Select Customer');
- } else {
- setCreditCustomer(true);
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- OrderTotalAmount: TotalAmount,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- }
- } else if (
- OnUpiSelected?.ModeName?.toLowerCase() === 'upi' &&
- SelectedUPIPayOption?.toLowerCase() === 'pg'
- ) {
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- if (SelCustId) {
- Booking(value, pay);
- } else {
- setMessageType('error');
- setMessageData('Please Select Customer');
- }
- } else {
- setMessageType('error');
- setMessageData('Please Set the customer display');
- }
- } else if (
- OnUpiSelected?.ModeName?.toLowerCase() === 'card' &&
- SelectedCardOption?.toLowerCase() === 'pg'
- ) {
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- if (SelCustId) {
- Booking(value, pay);
- } else {
- setMessageType('error');
- setMessageData('Please Select Customer');
- }
- } else {
- setMessageType('error');
- setMessageData('Please Set the customer display');
- }
- } else {
- Booking(value, pay);
- }
- };
- // getextracharges bookingtype id
- const extrachargesbookingtype = (extradata) => {
- const TakAwayId = ConfigDataList?.find(
- (a) => a?.ConfigName === 'TakeAway'
- )?.ConfigId;
- const DineinId = ConfigDataList?.find(
- (a) => a?.ConfigName === 'Dine In'
- )?.ConfigId;
- let tempdata = extradata?.map((data) => ({
- ...data,
- BookingType: data?.BookingTypeName === 'Dine In' ? DineinId : TakAwayId,
- }));
- return tempdata;
- };
- const Booking = async (value, pay) => {
- const TakAwayId = ConfigDataList?.find(
- (a) => a?.ConfigName === 'TakeAway'
- )?.ConfigId;
- const DineinId = ConfigDataList?.find(
- (a) => a?.ConfigName === 'Dine In'
- )?.ConfigId;
-
- setFirstPaymentclick(true);
- let temporderdetail = OrderCardDetail?.map((a) => ({
- ProdId: a.ProdId,
- Type: a.Type,
- OrderQty: a.OrderQty,
- OrderRate: a.OrderRate,
- // TotalAmt: a.OrderQty * a.OrderRate,
- TotalAmt: a.TotalAmt,
- TaxAmt: a.TaxAmt,
- RefundQty: 0,
- InwardDtlId: a.InwardDtlId,
- TaxId: a.TaxId,
- ProdNameQty:
- UomPrint?.SettingValue === 'N'
- ? `${a.ProdName} ${a.UomName?.toLowerCase() === 'half' ? '(Half)' : ''}`
- : `${a.ProdName} ${a.Size} ${a.UomName}`,
- OrderStatus: 'O',
- OrderType:
- BookingType === 'Dine In' ||
- BookingTypeBoth ||
- Estimation?.SettingValue == 'N'
- ? 'S'
- : GlobEstBooking === 'OvrAllEst'
- ? 'E'
- : GlobEstBooking === 'ParEst'
- ? GlobProdwisedata?.includes(
- a.InwardDtlId + ' ' + a?.BookingTypeName
- )
- ? 'E'
- : 'S'
- : 'S',
- SinglePc: a.SinglePc,
- BookingType: a.BookingTypeName === 'Dine In' ? DineinId : TakAwayId,
- OfferValue: a?.Type === 'C' ? a?.OfferValue : a.Offer,
- OfferAmt: a?.Type === 'C' ? a?.TotalAmt : a.Offer,
- OfferType: a?.Type === 'C' ? a?.OfferType : '',
- OfferMode: a?.OfferMode,
- OfferMessage: a?.OfferMessage,
- CounterName: a?.TokenAvailable === 'Y' ? a?.CounterName : null,
- ProductIdentifierDtls: a.ProductIdentifierDtls,
- ModelNumber: a.ModelNumber,
- BatchRef: a.BatchRef,
- PackageDtl: a.PackageDtl,
- SetCount: a.SetCount,
- BookingDate: AvailableDate ? a.BookedDate : null,
- ...(a?.DiscountValue && { DiscountValue: a.DiscountValue }),
- ...(a?.DiscountType && { DiscountType: a.DiscountType }),
- ...(a?.DiscountAmt && { DiscountAmt: a.DiscountAmt }),
- }));
- const NotSlectedTypeFind = temporderdetail?.find(
- (a) => a?.BookingType != SelectedBookingType
- );
- const { totalwithouttax, totaltax } = OrderCardDetail?.reduce(
- (totals, card) => {
- totals.totalwithouttax += parseFloat(card.WithoutTaxRate || 0);
- totals.totaltax += parseFloat(card.TaxAmt || 0);
- return totals;
- },
- { totalwithouttax: 0, totaltax: 0 }
- ) || { totalwithouttax: 0, totaltax: 0 };
- let updatedOfferDetails = offerAppliedProducts;
- if (GlobEstBooking !== 'Sales') {
- updatedOfferDetails = offerAppliedProducts?.filter(
- (item) =>
- !(
- item.TableName === 'LoyaltyPoints' &&
- item.TableUniqueName === 'UniqueId' &&
- item.Type === 'A'
- )
- );
- }
- let temppostdata = {
- SalesMode: RetailWSSalesType || 'R',
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- OrderDate: Custombill ? invoiceDate : null,
- CustomOrderNo: Custombill ? CurrentOrderId : null,
- OrderType:
- Object.keys(ReportholdData)?.length > 0
- ? ReportholdData?.OrderType
- : 'S',
- CustSuppId: SelCustId ? SelCustId : null,
- Reference: 'test',
- BookingType:
- NotSlectedTypeFind && !BookingTypeBoth
- ? NotSlectedTypeFind?.BookingType
- : SelectedBookingType,
- // (NotSlectedTypeFind?.length>0 && !BookingTypeBoth)?NotSlectedTypeFind?.[0]?.BookingTypeName:
-
- ServiceProvider: 0,
- ActiveStatus: 'A',
- CreatedBy: UserId,
- AddlInfo: 'test',
- BillAmount: totalwithouttax,
- OverallDiscSales: OverAllSales > 0 ? OverAllSales : 0,
- OverallDiscEst: OverAllEstimate > 0 ? OverAllEstimate : 0,
- TaxAmount: totaltax,
- VatAmount: 0,
- NetAmount: Math.round(TotalAmount),
- PaymentType:
- Paybtnnameselected?.toLowerCase() === 'upi'
- ? SelectedUPIPayOption?.toLowerCase() === 'pd'
- ? PaymentDeviceUPI?.[0]?.ModeId
- : SelectedUPIPayOption?.toLowerCase() === 'pg'
- ? PaymentgatewayUPI?.[0]?.ModeId
- : paybtnselected
- : paybtnselected
- ? paybtnselected
- : null,
- GivenAmt: 0,
- BalGiven: 0,
- BookingMedia: 'DW',
- RefundAmount: 0,
- ServiceCategory: OtherServiceTicketClaim?.ServiceCategory || null,
- OtherServiceTicketId: OtherServiceTicketClaim?.TicketId || null,
- OtherServiceTicketAmount: OtherServiceTicketClaim?.TotalAmt || null,
- PaymentStatus:
- Paybtnnameselected?.toLowerCase() === 'cash'
- ? 'S'
- : Paybtnnameselected?.toLowerCase() === 'credit'
- ? 'S'
- : Paybtnnameselected?.toLowerCase() === 'upi' &&
- SelectedUPIPayOption?.toLowerCase() === 'default'
- ? 'S'
- : 'P',
- OrderDtlDetails:
- Object.keys(ReportholdData)?.length > 0
- ? ProductSummary(temporderdetail)
- : temporderdetail,
- // (BookingType === "Dine In" || BookingTypeBoth)
- ExtraChargeDetails:
- GlobalExtraCharge?.length > 0
- ? extrachargesbookingtype(GlobalExtraCharge)
- : null,
- SalesTableLinkDetails:
- SelectedTableDetails?.length > 0
- ? globalTipAmount === 0
- ? SelectedTableDetails
- : SelectedTableDetails?.map((item) => ({
- ...item,
- TipsAmount: globalTipAmount,
- }))
- : null,
- SalesPaymentType: 'normal',
- PaymentDetail: [
- {
- PaymentType:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? refundPaySelected
- : Paybtnnameselected?.toLowerCase() === 'upi'
- ? SelectedUPIPayOption?.toLowerCase() === 'pd'
- ? PaymentDeviceUPI?.[0]?.ModeId
- : SelectedUPIPayOption?.toLowerCase() === 'pg'
- ? PaymentgatewayUPI?.[0]?.ModeId
- : SelectedUPIPayOption?.toLowerCase() === 'business'
- ? BusinessPayOption?.find(
- (busupi) => busupi?.ModeId === UpiId
- )?.ModeId
- : paybtnselected
- : paybtnselected
- ? paybtnselected
- : null,
- Amount:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? previousNetAmount - currentOrderNetAmount
- : Math.round(TotalAmount),
- MerchantId:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? null
- : Paybtnnameselected?.toLowerCase() === 'upi' &&
- SelectedUPIPayOption?.toLowerCase() === 'business'
- ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
- ?.MerchantId
- : null,
- PaymentOptionType:
- salesBillEdit &&
- currentOrderNetAmount < previousNetAmount &&
- (refundPaySelectedName?.toLowerCase() === 'cash' ||
- refundPaySelectedName?.toLowerCase() === 'credit')
- ? 'PC'
- : Paybtnnameselected?.toLowerCase() === 'cash'
- ? 'PC'
- : Paybtnnameselected?.toLowerCase() === 'credit'
- ? 'PC'
- : Paybtnnameselected?.toLowerCase() === 'card'
- ? SelectedCardOption
- : Paybtnnameselected?.toLowerCase() === 'upi'
- ? SelectedUPIPayOption?.toLowerCase() === 'default'
- ? 'PC'
- : SelectedUPIPayOption?.toLowerCase() === 'business'
- ? 'BU'
- : SelectedUPIPayOption
- : null,
- ModeOfPayment:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? null
- : SelectedUPIPayOption?.toLowerCase() === 'default'
- ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
- ?.UPIDetailId
- : SelectedUPIPayOption?.toLowerCase() === 'business'
- ? BusinessPayOption?.find(
- (busupi) => busupi?.ModeId === UpiId
- )?.MerchantUPIId
- : null,
- AccountDtl:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? []
- : Paybtnnameselected?.toLowerCase() === 'upi' &&
- SelectedUPIPayOption?.toLowerCase() === 'default'
- ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
- (upipay) => upipay?.UPIId === UpiId
- )
- : (Paybtnnameselected?.toLowerCase() === 'upi' &&
- 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')
- ? useOptions?.[0]?.PaymentDetails?.PaymentGateway
- : [],
- PaymentStatus:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? 'S'
- : Paybtnnameselected?.toLowerCase() === 'cash'
- ? 'S'
- : Paybtnnameselected?.toLowerCase() === 'credit'
- ? 'S'
- : Paybtnnameselected?.toLowerCase() === 'upi' &&
- SelectedUPIPayOption?.toLowerCase() === 'default'
- ? 'S'
- : 'P',
- Debit:
- salesBillEdit &&
- currentOrderNetAmount < previousNetAmount &&
- refundPaySelectedName?.toLowerCase() === 'credit'
- ? Math.round(previousNetAmount - currentOrderNetAmount)
- : 0,
- Credit: salesBillEdit
- ? currentOrderNetAmount > previousNetAmount &&
- Paybtnnameselected?.toLowerCase() === 'credit'
- ? Math.round(TotalAmount)
- : 0
- : Paybtnnameselected?.toLowerCase() === 'credit'
- ? Math.round(TotalAmount)
- : 0,
- },
- ],
- RefDetails: [
- {
- FreeProdList: FreeProdList,
- OfferAppliedProductList: offerAppliedProducts,
- },
- ],
- OrderOfferDetail: updatedOfferDetails,
- };
- let PostData = temppostdata;
-
- if (value === 'Dine-In') {
- PostData['PaymentStatus'] = pay ? 'S' : 'P';
- PostData['PaymentDetail'] = !pay && [];
- PostData['PaymentType'] = !pay && '';
- } else if (value === 'Hold') {
- ((PostData['PaymentStatus'] = pay ? 'S' : 'P'),
- (PostData['PaymentDetail'] = !pay && []));
- PostData['PaymentType'] = !pay && '';
- PostData['ActiveStatus'] = pay ? 'A' : 'D';
- } else if (value === 'Unpaid') {
- PostData['PaymentStatus'] = pay ? 'S' : 'P';
- PostData['PaymentDetail'] = !pay && [];
- PostData['PaymentType'] = !pay && '';
- PostData['PrintType'] = 'Y';
- }
-
- Object.keys(ReportholdData)?.length > 0
- ? OrderType === 'Failed'
- ? PutFailedPayment(PostData, value, pay)
- : PutBooking(PostData, value, pay)
- : !OtherServicesglobal
- ? PostBooking(PostData, value)
- : OtherServicePostBooking(PostData, value);
- // getHolddata()
- // getstockbadge();
- // Combocarddata();
- };
- const PostBooking = async (PostData, value) => {
- let response = await dispatch(PostBookingData(PostData)).unwrap();
- if (response?.data?.statusCode == 1) {
- let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pd' &&
- item?.PaymentStatus === 'P'
- );
- let PaymentGatewayfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pg' &&
- item?.PaymentStatus === 'P'
- );
- let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) => item?.PaymentOptionType?.toLowerCase() === 'pc'
- );
- let businessUPIfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'bu' &&
- item?.PaymentStatus === 'P'
- );
- if (
- PayatCounterfilter?.length === 1 ||
- response?.data?.PaymentOrderDtl?.length === 0
- ) {
- 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 &&
- setPrintOrderDetails([response?.data]);
- CustomerDisplay(value);
- filteredSettingNames?.includes('whatsapp') &&
- MobileNoWhatsApp?.value &&
- handleURL([response?.data]);
- ClearAllGlobalStateDatas(value);
- }
-
- if (Paymentdevicefilter?.length === 1) {
- if (
- Paymentdevicefilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pd'
- ) {
- PaymentDeviceFlow(Paymentdevicefilter, value);
- }
- } else {
- console.log('more pd data');
- }
- if (PaymentGatewayfilter?.length === 1) {
- if (
- PaymentGatewayfilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pg'
- ) {
- await dispatch(changePaymentloader(true));
-
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- OrderBookingId: PaymentGatewayfilter?.[0]?.OrderId,
- Paymentgateway: true,
- OrderPaymentId: PaymentGatewayfilter?.[0]?.PaymentOrderId,
- OrderTotalAmount: PaymentGatewayfilter?.[0]?.Amount,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- const checkPaymentStatus = async () => {
- const intervalId = setInterval(async () => {
- try {
- let getpaymentgatewaydetail = await dispatch(
- PaymentGatewayGetdetail(PaymentGatewayfilter?.[0]?.OrderId)
- ).unwrap();
-
- if (getpaymentgatewaydetail?.data?.statusCode === 1) {
- let paymentdataget =
- getpaymentgatewaydetail?.data?.PaymentOrderDtl?.find(
- (item) =>
- item?.PaymentOrderId ===
- PaymentGatewayfilter?.[0]?.PaymentOrderId
- )?.PaymentStatus;
-
- if (paymentdataget === 'S') {
- setMessageType('success');
- setMessageData('Payment Success');
- await dispatch(changePaymentloader(false));
- if (
- getpaymentgatewaydetail?.data?.OrderDetails?.length > 0
- ) {
- setPrintOrderDetails([getpaymentgatewaydetail?.data]);
- CustomerDisplay(value);
-
- ClearAllGlobalStateDatas(value);
- }
- clearInterval(intervalId); // Stop the loop when payment is successful
- } else if (paymentdataget === 'F') {
- setMessageType('error');
- setMessageData('Payment Failed');
- await dispatch(changePaymentloader(false));
- setFirstPaymentclick(false);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- clearInterval(intervalId); // Stop the loop when payment fails
- CustomerDisplayRemovedData();
- ClearAllGlobalStateDatas(value);
- }
- }
- } catch (error) {
- console.error('Error fetching payment details: ', error);
- }
- }, 3000); // Call the API every 3 seconds
- };
-
- // Call the function to start checking payment status
- checkPaymentStatus();
- }
- } else {
- console.log('more pg data');
- }
- if (businessUPIfilter?.length === 1) {
- businessUPIFlow(
- businessUPIfilter,
- response?.data?.OrderId,
- response?.data?.PaymentPageLink
- );
- }
- dispatch(triggerCustomerRefresh());
- } else {
- setMessageType('error');
- setMessageData(response?.data?.response);
- setFirstPaymentclick(false);
- // clearInvoiceDate
- clearInvoiceDate();
- dispatch(changeCurrentOrderId(null));
- }
- };
-
- const PutBooking = async (putdatas, value, pay) => {
- let putdata = putdatas;
- putdata['OrderId'] = ReportholdData?.OrderId;
- putdata['SalesId'] = ReportholdData?.SalesId;
- putdata['UpdatedBy'] = UserId;
- if (value === 'Dine-In') {
- putdata['PaymentStatus'] = pay ? 'S' : 'P';
- putdata['PaymentDetail'] = !pay && [];
- putdata['PaymentType'] = !pay && '';
- } else if (value === 'Hold') {
- ((putdata['PaymentStatus'] = pay ? 'S' : 'P'),
- (putdata['PaymentDetail'] = !pay && []));
- putdata['PaymentType'] = !pay && '';
- putdata['ActiveStatus'] = pay ? 'A' : 'D';
- } else if (value === 'Unpaid') {
- putdata['PaymentStatus'] = pay ? 'S' : 'P';
- putdata['PaymentDetail'] = !pay && [];
- putdata['PaymentType'] = !pay && '';
- putdata['PrintType'] = 'Y';
- }
- console.log(putdata, 'putdataputdata');
- let response = null;
- if (salesBillEdit) {
- response = await dispatch(putSalesBillEdit(putdata)).unwrap();
- } else {
- response = await dispatch(PutBookingData(putdata)).unwrap();
- }
- let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) => item?.PaymentOptionType?.toLowerCase() === 'pc'
- );
-
- if (value !== 'Unpaid') {
- if (response?.data?.statusCode == 1) {
- let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pd' &&
- item?.PaymentStatus === 'P'
- );
- let PaymentGatewayfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pg' &&
- item?.PaymentStatus === 'P'
- );
-
- if (
- PayatCounterfilter?.length === 1 ||
- response?.data?.PaymentOrderDtl?.length === 0
- ) {
- 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 &&
- setPrintOrderDetails([response?.data]);
- CustomerDisplay(value);
-
- ClearAllGlobalStateDatas(value);
- }
- if (Paymentdevicefilter?.length === 1) {
- if (
- Paymentdevicefilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pd'
- ) {
- PaymentDeviceFlow(Paymentdevicefilter, value);
- }
- } else {
- console.log('more pd data');
- }
- if (PaymentGatewayfilter?.length === 1) {
- PaymentGatewayFlow(PaymentGatewayfilter);
- } else {
- setPrintOrderDetails([response?.data]);
- // CustomerDisplay();
- ClearAllGlobalStateDatas();
- console.log('more pg data');
- }
- } else {
- // clearInvoiceDate
- clearInvoiceDate();
- dispatch(changeCurrentOrderId(null));
- }
- } else {
- setPrintOrderDetails([response?.data]);
- // if (OfferCheckedInSetup && preferenceOffer) {
- // await applyOffer([]);
- // } else {
- dispatch(changeOrderCardDetails([]));
- // }
- await dispatch(changeReorderHoldDetails({}));
- await dispatch(changeReorderProductDetails([]));
- setFirstPaymentclick(false);
- if (defaultBookingType === 'Both') {
- await dispatch(changeBookingType('TakeAway'));
- }
- await dispatch(changeSelectTable([]));
- await dispatch(changeSelectChair([]));
- getUnpaiddatas();
- }
- };
- const PutFailedPayment = async (PayData, value, pay) => {
- console.log(PayData?.PaymentDetail?.[0]?.PaymentType, 'mohanPayData');
- let tempsplitdata = {
- CompId: PayData?.CompId,
- BranchId: PayData?.BranchId,
- AppId: PayData?.AppId,
- CustSuppId: PayData?.SelCustId ? SelCustId : null,
- UpdatedBy: UserId,
- OrderId: ReportholdData?.OrderId,
- PaymentType: PayData?.PaymentDetail?.[0]?.PaymentType,
- Amount: FailedTotalAmt,
- PaymentOptionType: PayData?.PaymentDetail?.[0]?.PaymentOptionType,
- ModeOfPayment: PayData?.PaymentDetail?.[0]?.ModeOfPayment,
- AccountDtl: PayData?.PaymentDetail?.[0]?.AccountDtl,
- PaymentStatus: PayData?.PaymentDetail?.[0]?.PaymentStatus,
- Debit: PayData?.PaymentDetail?.[0]?.Debit,
- Credit: PayData?.PaymentDetail?.[0]?.Credit,
- };
-
- let response = await dispatch(
- putSplitpaymentStatus(tempsplitdata)
- ).unwrap();
- if (response?.data?.statusCode == 1) {
- let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pd' &&
- item?.PaymentStatus === 'P'
- );
- let PaymentGatewayfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pg' &&
- item?.PaymentStatus === 'P'
- );
- let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pc' &&
- item?.PaymentType === PayData?.PaymentDetail?.[0]?.PaymentType
- );
- if (
- PayatCounterfilter?.length > 0 ||
- response?.data?.PaymentOrderDtl?.length === 0
- ) {
- setMessageType('success');
-
- // setSplitSelPayMode({...SplitSelPayMode,...{[`PaymentStatus-${i}`]:"S"}})
-
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- upi: null,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- setMessageData(
- response?.data?.response +
- ' ' +
- (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]);
- CustomerDisplay();
- ClearAllGlobalStateDatas();
- }
- }
- if (Paymentdevicefilter?.length === 1) {
- if (
- Paymentdevicefilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pd'
- ) {
- PaymentDeviceFlow(Paymentdevicefilter, value);
- }
- }
-
- if (PaymentGatewayfilter?.length === 1) {
- if (
- PaymentGatewayfilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pg'
- ) {
- PaymentGatewayFlow(PaymentGatewayfilter, value);
- }
- }
- }
- };
- const PaymentGatewayFlow = async (PaymentGatewayfilter) => {
- if (PaymentGatewayfilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pg') {
- await dispatch(changePaymentloader(true));
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- OrderBookingId: PaymentGatewayfilter?.[0]?.OrderId,
- Paymentgateway: true,
- OrderPaymentId: PaymentGatewayfilter?.[0]?.PaymentOrderId,
- OrderTotalAmount: PaymentGatewayfilter?.[0]?.Amount,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- const checkPaymentStatus = async () => {
- const intervalId = setInterval(async () => {
- try {
- let getpaymentgatewaydetail = await dispatch(
- PaymentGatewayGetdetail(PaymentGatewayfilter?.[0]?.OrderId)
- ).unwrap();
-
- if (getpaymentgatewaydetail?.data?.statusCode === 1) {
- let paymentdataget =
- getpaymentgatewaydetail?.data?.PaymentOrderDtl?.find(
- (item) =>
- item?.PaymentOrderId ===
- PaymentGatewayfilter?.[0]?.PaymentOrderId
- )?.PaymentStatus;
-
- if (paymentdataget === 'S') {
- setMessageType('success');
- setMessageData('Payment Success');
- await dispatch(changePaymentloader(false));
- if (getpaymentgatewaydetail?.data?.OrderDetails?.length > 0) {
- setPrintOrderDetails([getpaymentgatewaydetail?.data]);
- CustomerDisplay(value);
-
- ClearAllGlobalStateDatas(value);
- }
- clearInterval(intervalId); // Stop the loop when payment is successful
- } else if (paymentdataget === 'F') {
- setMessageType('error');
- setMessageData('Payment Failed');
- await dispatch(changePaymentloader(false));
- setFirstPaymentclick(false);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- clearInterval(intervalId); // Stop the loop when payment fails
- CustomerDisplayRemovedData();
- ClearAllGlobalStateDatas(value);
- // const customerDisplayWindow = getCustomerDisplayWindow();
- // if (customerDisplayWindow && !customerDisplayWindow.closed) {
- // const updatedData = {
- // userData: OrderCardDetail,
- // ExtraCharges: GlobalExtraCharge,
- // upi: GlobalUpiID,
- // customer: selOption != null ? selOption : GetCustId,
- // paymentMethod: Paybtnnameselected,
- // Paymentgateway: false,
- // OrderTotalAmount: PaymentGatewayfilter?.[0]?.Amount
-
- // };
- // customerDisplayWindow.postMessage(updatedData, '*');
- // }
- }
- }
- } catch (error) {
- console.error('Error fetching payment details: ', error);
- }
- }, 3000); // Call the API every 3 seconds
- };
-
- // Call the function to start checking payment status
- checkPaymentStatus();
- }
- };
- const PaymentDeviceFlow = async (Paymentdevicefilter, value) => {
- await dispatch(changePaymentloader(true));
- await dispatch(
- changePaymentTransactionNumber(Paymentdevicefilter?.[0]?.PaymentOrderId)
- );
-
- let paymentdetail = {
- TransactionNumber: Paymentdevicefilter?.[0]?.PaymentOrderId,
- SequenceNumber: 1,
- AllowedPaymentMode:
- Paymentdevicefilter?.[0]?.PaymentTypeName?.toLowerCase() === 'card'
- ? '1'
- : Paymentdevicefilter?.[0]?.PaymentTypeName?.toLowerCase() === 'upi'
- ? '10'
- : '',
- Amount: `${parseInt(Paymentdevicefilter?.[0]?.Amount) * 100}`,
- ClientID: useOptions?.[0]?.PDConfigDetails?.[0]?.ClientId,
- StoreID: useOptions?.[0]?.PDConfigDetails?.[0]?.StoreId,
- UserID: useOptions?.[0]?.PDConfigDetails?.[0]?.UserId,
- MerchantID: useOptions?.[0]?.PDConfigDetails?.[0]?.MerchantId,
- SecurityToken: useOptions?.[0]?.PDConfigDetails?.[0]?.SecurityToken,
- IMEI: useOptions?.[0]?.PDConfigDetails?.[0]?.IMEI,
- AutoCancelDurationInMinutes:
- useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes,
- };
- let apiresponse = await dispatch(PostPaymentdevice(paymentdetail)).unwrap();
- if (apiresponse?.ResponseMessage?.toLowerCase() === 'approved') {
- let pendingPaymentList = {
- MerchantID: useOptions?.[0]?.PDConfigDetails?.[0]?.MerchantId,
- SecurityToken: useOptions?.[0]?.PDConfigDetails?.[0]?.SecurityToken,
- ClientID: useOptions?.[0]?.PDConfigDetails?.[0]?.ClientId,
- StoreID: useOptions?.[0]?.PDConfigDetails?.[0]?.StoreId,
- IMEI: useOptions?.[0]?.PDConfigDetails?.[0]?.IMEI,
- PlutusTransactionReferenceId: apiresponse?.PlutusTransactionReferenceID,
- PaymentOrderId: Paymentdevicefilter?.[0]?.PaymentOrderId,
- UpdatedBy: UserId,
- };
- await dispatch(PutPendingPaymentList(pendingPaymentList)).unwrap();
- let isApproved = false;
- const startTime = Date.now();
- let postpaymentdata = {
- MerchantID: useOptions?.[0]?.PDConfigDetails?.[0]?.MerchantId,
- SecurityToken: useOptions?.[0]?.PDConfigDetails?.[0]?.SecurityToken,
- ClientID: useOptions?.[0]?.PDConfigDetails?.[0]?.ClientId,
- StoreID: useOptions?.[0]?.PDConfigDetails?.[0]?.StoreId,
- IMEI: useOptions?.[0]?.PDConfigDetails?.[0]?.IMEI,
- PlutusTransactionReferenceID: apiresponse?.PlutusTransactionReferenceID,
- };
- // Loop to call the second API every 3 seconds
- while (!isApproved) {
- let ApiResponseget = await dispatch(
- GetPaymentdeviceResponse(postpaymentdata)
- ).unwrap();
-
- if (ApiResponseget?.ResponseMessage?.toLowerCase() === 'txn approved') {
- let putbookingdata = {
- OrderBookingId: Paymentdevicefilter?.[0]?.OrderId,
- OrderId: Paymentdevicefilter?.[0]?.PaymentOrderId,
- PaymentStatus: 'S',
- Amount: Paymentdevicefilter?.[0]?.Amount,
- ResponseDtl: [ApiResponseget],
- PaymentType: Paymentdevicefilter?.[0]?.PaymentType,
- UpdatedBy: UserId,
- };
-
- let bookingpaymentupdate = await dispatch(
- PutBookingPaymentStatusChange(putbookingdata)
- ).unwrap();
- if (bookingpaymentupdate?.data?.statusCode === 1) {
- 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 &&
- setPrintOrderDetails([bookingpaymentupdate?.data]);
- CustomerDisplay(value);
-
- ClearAllGlobalStateDatas(value);
- await dispatch(changePaymentloader(false));
- }
- isApproved = true;
- console.log('Transaction Approved!');
- // Exit the loop
- break;
- }
-
- // Check if 1 minute has passed
- if (
- Date.now() - startTime >
- useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes *
- 60000
- ) {
- // 60,000 ms = 1 minute
-
- let putbookingdata = {
- OrderBookingId: Paymentdevicefilter?.[0]?.OrderId,
- OrderId: Paymentdevicefilter?.[0]?.PaymentOrderId,
- PaymentStatus: 'F',
- Amount: Paymentdevicefilter?.[0]?.Amount,
- ResponseDtl: [ApiResponseget],
- PaymentType: Paymentdevicefilter?.[0]?.PaymentType,
- UpdatedBy: UserId,
- };
-
- let bookingpaymentupdate = await dispatch(
- PutBookingPaymentStatusChange(putbookingdata)
- ).unwrap();
- if (bookingpaymentupdate?.data?.statusCode === 1) {
- setMessageType('error');
- setMessageData(
- `Payment Failed. Your Transaction Number is ${Paymentdevicefilter?.[0]?.PaymentOrderId}`
- );
- setFirstPaymentclick(false);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- await dispatch(changePaymentloader(false));
- CustomerDisplayRemovedData();
- ClearAllGlobalStateDatas(value);
- }
-
- console.error('Transaction not approved within 1 minute.');
- // Send an error message or handle the timeout
- // You can dispatch an action, show a notification, etc.
- break;
- }
-
- // Wait for 3 seconds before making the next call
- await new Promise((resolve) => setTimeout(resolve, 3000));
- }
- } else {
- let putbookingdata = {
- OrderBookingId: Paymentdevicefilter?.[0]?.OrderId,
- OrderId: Paymentdevicefilter?.[0]?.PaymentOrderId,
- PaymentStatus: 'F',
- Amount: Paymentdevicefilter?.[0]?.Amount,
- PaymentType: Paymentdevicefilter?.[0]?.PaymentType,
- UpdatedBy: UserId,
- };
- let bookingpaymentupdate = await dispatch(
- PutBookingPaymentStatusChange(putbookingdata)
- ).unwrap();
- if (bookingpaymentupdate?.data?.statusCode === 1) {
- setMessageType('error');
- setMessageData(apiresponse?.ResponseMessage);
- setFirstPaymentclick(false);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- dispatch(changePaymentloader(false));
- CustomerDisplayRemovedData();
- ClearAllGlobalStateDatas(value);
- }
- }
- };
- const businessUPIFlow = async (
- businessUPIfilter,
- OrderId,
- PaymentStatusLink
- ) => {
- // Implement your business UPI flow here
- // You can add similar logic as PaymentDeviceFlow or PaymentGatewayFlow based on your requirements
- setBusinessUPILink(PaymentStatusLink);
- setBusinessUPI(true);
- setBusinessUPIOrderId(OrderId);
- };
- const columns = [
- {
- title: 'Sl.No',
- key: 'sno',
- align: 'center',
- width: '100px',
- render: (text, object, index) => (
- {index + 1}
- ),
- },
- {
- title: 'Table Name/Chair Name',
- dataIndex: 'TableName',
- key: 'TableName',
- width: '150px',
- onCell: (_, record, index) => {
- return {
- onClick: () => {
- Unpaidfun(record);
- },
- };
- },
- },
- {
- title: 'Order Id',
- dataIndex: 'OrderID',
- key: 'OrderID',
- width: '150px',
- align: 'right',
- onCell: (_, record, index) => {
- return {
- onClick: () => {
- Unpaidfun(record);
- },
- };
- },
- },
- {
- title: "Item's",
- dataIndex: 'ProductName',
- key: 'ProductName',
- width: '250px',
- onCell: (_, record, index) => {
- return {
- onClick: () => {
- Unpaidfun(record);
- },
- };
- },
- },
- {
- title: 'Amount',
- dataIndex: 'TotalAmount',
- key: 'TotalAmount',
- width: '150px',
- align: 'right',
- onCell: (_, record, index) => {
- return {
- onClick: () => {
- Unpaidfun(record);
- },
- };
- },
- },
- ];
-
- const TableData = [];
- tabledata?.map((item) =>
- TableData.push({
- TableName: item.SalesTableLinkDetails?.map((item) =>
- item.ChairName == null ? item.TableName : item.ChairName
- )?.join(','),
- OrderID: extractLastNumberOrderId(item?.OrderId, item?.FYStatus),
- // ProductName: item.productDetails
- // ?.map((item) => item?.ProdName + "-" + item?.OrderQty)
- // ?.join(","),
- ProductName: item.productDetails
- ?.map(
- (item) =>
- item?.ProdName +
- '-' +
- (item?.Type != 'C' ? item?.OrderQty : '1 Combo')
- )
- ?.join(','),
- TotalAmount: item.NetAmount,
- })
- );
-
- const Unpaidfun = async (event) => {
- dispatch(changeunpaidflow(true));
- if (
- OrderCardDetail?.length > 0 &&
- (BookingType === 'Dine In' || BookingTypeBoth)
- ) {
- // await dispatch(changeOrderCardDetails([]))
- // await dispatch(changeOrderCardDetails(tabledata?.[event]?.productDetails))
- // await dispatch(ChangeTotalAmount(tabledata?.[event]?.ExtraChargeDetails))
- // await dispatch(changeUnpaidData(true))
- // await dispatch(changeReorderHoldDetails([tabledata?.[event]]?.[0]));
- // await dispatch(changeReorderProductDetails(tabledata?.[event]?.productDetails))
- // setUnpaidOpen(false)
- setUnpaidConfirmation(true);
- setunpaidselectedindex(event);
- } else {
- const UpdatedData = tabledata?.[event]?.productDetails;
- // if (OfferCheckedInSetup && preferenceOffer) {
- // await applyOffer(UpdatedData);
- // } else {
- dispatch(changeOrderCardDetails(UpdatedData));
- // }
- await dispatch(changeReorderHoldDetails([tabledata?.[event]]?.[0]));
- await dispatch(ChangeTotalAmount(tabledata?.[event]?.ExtraChargeDetails));
- await dispatch(
- changeReorderProductDetails(tabledata?.[event]?.productDetails)
- );
- await dispatch(changeUnpaidData(true));
- setUnpaidOpen(false);
- }
- };
-
- const UnpaidOk = async () => {
- setOrderStatus(false);
- await dispatch(changeSelectedTableDetails([]));
- await dispatch(changeSelectTable([]));
- await dispatch(changeSelectChair([]));
- if (defaultBookingType === 'Both') {
- await dispatch(changeBookingType('TakeAway'));
- }
- await dispatch(
- changeOrderCardDetails(tabledata?.[unpaidselectedindex]?.productDetails)
- );
- await dispatch(
- changeReorderProductDetails(
- tabledata?.[unpaidselectedindex]?.productDetails
- )
- );
- await dispatch(
- changeReorderHoldDetails([tabledata?.[unpaidselectedindex]]?.[0])
- );
- await dispatch(
- ChangeTotalAmount(tabledata?.[unpaidselectedindex]?.ExtraChargeDetails)
- );
- await dispatch(changeUnpaidData(true));
- setUnpaidOpen(false);
- setUnpaidConfirmation(false);
- };
- const Unpaidclose = async () => {
- dispatch(changeunpaidflow(false));
- setUnpaidOpen(false);
- setUnpaidConfirmation(false);
- };
-
- const Recipt = async () => {
- AddBookingDetails('Unpaid', false);
- };
-
- const getstockbadge = async () => {
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- ...(AvailableDate && selectedDate
- ? {
- fromDate: selectedDate?.[0],
- toDate: selectedDate?.[1],
- }
- : {}),
- };
- await dispatch(getSelectedFavItems(data)).unwrap();
-
- let data1 = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- ProdSubCat: ProdSubCat,
- ...(AvailableDate && selectedDate
- ? {
- fromDate: selectedDate?.[0],
- toDate: selectedDate?.[1],
- }
- : {}),
- };
-
- let data2 = {
- compId: CompId,
- branchId: BranchId,
- appId: AppId,
- prodCat: prodCat,
- ...(AvailableDate && selectedDate
- ? {
- fromDate: selectedDate?.[0],
- toDate: selectedDate?.[1],
- }
- : {}),
- };
-
- if (
- templateData?.BookingLayout?.[1]?.some(
- (item) => item?.OptionName === 'SubCategory'
- ) &&
- ProdSubCat
- ) {
- await dispatch(getLayoutproductCard(data1)).unwrap();
- } else if (
- !templateData?.BookingLayout?.[1]?.some(
- (item) => item?.OptionName === 'SubCategory'
- )
- ) {
- await dispatch(getCardDataWithoutSubmodule(data2)).unwrap();
- } else {
- await dispatch(getCardDataWithoutSub(data2)).unwrap();
- }
- };
-
- const Combocarddata = async () => {
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- ActiveStatus: 'A',
- };
-
- let response = await dispatch(getCombolist(data)).unwrap();
- let datas = response?.data?.data;
- await dispatch(ChangeComboCarddata(datas));
- if (response?.data?.statusCode === 1) {
- // let Data = response?.data?.data
- // let comboList = Data?.map((item, index) => ({
- // ...item,
- // id: `${item.ComboName || 'Combo'}-${index}`,
- // ProdName:item?.ComboName,
- // OverAllQty:item?.OverallQuantity
- // }));
- // setCombocardata(comboList);
- }
- };
- const SplitPaymentOpen = () => {
- if (OrderCardDetail?.length > 0 && TotalAmount > 0) {
- const updatedData = {
- userData: OrderCardDetail,
- ExtraCharges: GlobalExtraCharge,
- customer: selOption != null ? selOption : GetCustId,
- Paymentgateway: false,
- };
- setFailedOrderData(updatedData);
- setSplitpayment(true);
- } else {
- if (TotalAmount <= 0) {
- setMessageType('warning');
- setMessageData('Cannot split when total amount is zero or less');
- return;
- }
- setMessageType('warning');
- setMessageData('Please Select the Product');
- }
- };
-
- const handlesplitpaymentclose = () => {
- setSplitpayment(false);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- paymentMethod: PaymentOptions?.[0]?.ModeName,
- Paymentgateway: false,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- };
- const Upimodel = (type) => {
- setUpiOpen(false);
- if (type == 'Submit') {
- AddBookingDetails(BookingType, true);
- }
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedRemovedData = {
- type: 'remove',
- keyValue: 'OrderTotalAmount',
- };
- customerDisplayWindow.postMessage(updatedRemovedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- };
- // const OrderId=PostBookingDataDetailOrderId ?.OrderId
- const today = new Date();
- const year = today.getFullYear();
- // Note: Months are zero-based, so we add 1 to get the actual month
- const month = today.getMonth() + 1;
- const day = today.getDate();
-
- // Creating a formatted date string (in the format YYYY-MM-DD)
- const Todaydate = `${day < 10 ? '0' : ''}${day}-${month < 10 ? '0' : ''}${month}-${year}`;
- const OrderId = PrintOrderDetails?.[0]?.OrderDetails?.[0]?.OrderId;
- let MobileNo = selOption?.value;
- const onFinalSubmit = async () => {
- let url = `${MainHomeUrl}payment-page?amt=${TotalAmount}&Id=${MobileNo}&cus=${SelCustId} &CusN=${selOption?.CustName}&Br=${brachName}`;
- let response = await dispatch(SendPaymentLink({ MobileNo, url })).unwrap();
- if (response?.data?.statusCode === 1) {
- setMessageType('success');
- setMessageData('Link Sent Successfully');
- }
- };
-
- const CreditCustomerHAndleCancel = () => {
- setcreditCustomerOpen(false);
- };
- const CreditCustomerFun = () => {
- if (
- OrderCardDetail?.length === 0 &&
- (selOption?.value !== undefined ||
- GlobalAddCustomerDetails1.length > 0 ||
- GetCustId?.CustMobile !== undefined)
- ) {
- setcreditCustomerOpen(true);
- } else {
- if (selOption?.value == undefined) {
- setMessageType('warning');
- setMessageData('Please Select the Customer');
- }
- }
- };
- const CustomerDisplayRemovedData = () => {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- userData: [],
- ExtraCharges: [],
- Paymentgateway: false,
- type: 'remove',
- keyValue: 'customer',
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- const updatedRemovedData = {
- type: 'remove',
- keyValue: 'OrderTotalAmount',
- };
- customerDisplayWindow.postMessage(updatedRemovedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- };
- const CustomerDisplay = (value) => {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (value == 'TakeAway') {
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- userData: [],
- ExtraCharges: [],
- Paymentgateway: false,
- upioption1: 'okk',
- type: 'remove',
- keyValue: 'customer',
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- const updatedRemovedData = {
- type: 'remove',
- keyValue: 'OrderTotalAmount',
- };
- customerDisplayWindow.postMessage(updatedRemovedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- } else {
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- type: 'remove',
- keyValue: 'customer',
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- }
- };
- const changeOrderStatus = () => {
- setOrderStatus(!OrderStatus);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- };
-
- // const orderIdsArray =
- // PrintOrderDetails?.[0]?.OrderDetails?.map(
- // (orderDetail) => orderDetail?.OrderId
- // ) || [];
-
- const handleURL = async (PrintOrderDetails) => {
- let orderIdsArray = PrintOrderDetails?.[0]?.OrderDetails?.map(
- (orderDetail) => orderDetail?.OrderId
- );
-
- const encrypted = encryptObject(orderIdsArray);
-
- const postData = {
- Url: encrypted,
- CreatedBy: UserId,
- };
- if (orderIdsArray) {
- const res = await dispatch(PublicQrCodepost(postData)).unwrap();
- const urlData = res?.data?.ReferenceNo;
- setUrlData(urlData);
- }
- };
- const customerNameOrMobile = MobileNoWhatsApp?.CustName?.trim()
- ? `Dear ${MobileNoWhatsApp?.CustName}`
- : `Dear ${MobileNoWhatsApp?.value}`;
- const documentUrl = `${MainHomeUrl}viewbill?code=${urlData}`;
- const encodedMessage = `${customerNameOrMobile},\n\n🙏 Thank you for being a valuable customer!\n\n🧾 To view your bill, please click the link below:\n${documentUrl}`;
-
- const navCust = templateData?.BookingNavbar?.[1]?.some(
- (item) => item?.OptionName === 'AddCustomer'
- );
-
- const handlepaymentoptions = async () => {
- await dispatch(changeSalesPaymentoption(true));
- await dispatch(
- getPaymentOptionsData({
- AppId: AppId,
- CompId: CompId,
- BranchId: BranchId,
- })
- );
- };
-
- // ------------------------------------------------OTHER SERVICES FUNCTIONALITY-----------------------------------------------------------------------------------
-
- useEffect(() => {
- if (isMobile) {
- OtherServiceMobilePrint(
- OtherServicesPrintDetails,
- UpiId,
- 'Booking',
- SettingDataSelector
- );
- } else {
- Otherserviceprint();
- }
- }, [OtherServicesPrintDetails]);
-
- useEffect(() => {
- const setDefaultPaymentOption = async () => {
- const res = await dispatch(
- getDefaultPaymentOptions({ AppId, CompId, BranchId })
- )?.unwrap();
- const defaultDetail = res?.data?.data?.[0]?.DefaultDetails?.[0];
- if (res?.data?.data?.length > 0 && defaultDetail) {
- setDefaultEnabled(true);
- setDefaultPaymentMode(defaultDetail);
- const { option, card } = defaultDetail;
- if (option?.value) setSelectedUPIPayOption(option.value);
- if (card) {
- const isDefault =
- String(option?.value ?? '').toLowerCase() === 'default';
- const idToUse = isDefault ? card?.UPIId : card?.ModeId;
-
- if (idToUse) {
- addUpiOption(card?.Mode, card?.ModeName, idToUse);
- }
- }
- } else {
- setDefaultEnabled(false);
- setDefaultPaymentMode([]);
- }
- };
- if (salesBillEdit) {
- setDefaultPaymentOption();
- }
- }, [defaultPaymentTrigger, salesBillEdit]);
-
- const Otherserviceprint = async () => {
- if (OtherServicesPrintDetails?.length > 0) {
- const style = await PrintStyleFunction('OtherServices1');
- const stylesMap = {
- OtherServices1: 'OtherServices1',
- };
-
- const selectedStyle = stylesMap['OtherServices1'];
-
- console.log(selectedStyle, 'selectedStyle');
-
- await printDiv('OtherServices1', style); // Use unique IDs for each print
-
- setOtherServicesPrintDetails([]);
- closePrintOption();
- }
- };
-
- const OtherServicePostBooking = async (PostData, value) => {
- console.log(PostData, value, 'PostData, value');
-
- let postdata = {
- AppId: AppId,
- CompId: CompId,
- BranchId: BranchId,
- BillAmount: PostData?.BillAmount,
- TaxAmount: PostData?.TaxAmount,
- NetAmount: PostData?.NetAmount,
- OtherServicesTicketDetails: OrderCardDetail.map((item) => ({
- ServiceId: item.ServiceId,
- ServiceCategory: item.ServiceCategory,
- VehicleNumber: item.VehicleNo || '',
- Qty: item.OrderQty,
- Rate: item.Rate,
- TaxAmount: item.TaxAmt,
- TotalAmount: item.TotalAmt,
- })),
- PaymentDetail: PostData?.PaymentDetail,
- CreatedBy: UserId,
- };
-
- let Response = await dispatch(PostOtherServices(postdata)).unwrap();
-
- if (Response?.data?.statusCode == 1) {
- setMessageType('success');
- setMessageData(Response?.data?.response);
- ClearAllGlobalStateDatas(value);
- setOtherServicesPrintDetails([
- Response?.data?.OtherServicesTicketDetails?.[0],
- ]);
- }
-
- console.log(postdata, 'PostdataPostdataPostdata');
- };
-
- const Otherservicesvehicleno = () => {
- setOtherServicesModal(true);
- };
-
- const handleInputChange = (key, index, value, serviceType, item) => {
- const uppercasedValue = value.toUpperCase();
- const regex = /^[A-Z]{2}[0-9]{2}[A-Z]{1,2}[0-9]{4}$/;
- const isValid = regex.test(uppercasedValue);
-
- if (serviceType === 'G') {
- const existing = vehicleInputs[key] ? [...vehicleInputs[key]] : [];
- existing[index] = uppercasedValue;
-
- setVehicleInputs((prev) => ({ ...prev, [key]: existing }));
-
- const updatedErrors = {
- ...errors,
- [key]: [...(errors[key] || [])],
- };
- // updatedErrors[key][index] = isValid ? '' : 'Invalid format (e.g., KA01AB1234)';
- updatedErrors[key][index] =
- uppercasedValue === ''
- ? ''
- : isValid
- ? ''
- : 'Invalid format (e.g., KA01AB1234)';
-
- setErrors(updatedErrors);
-
- vehiclesvalues({ ...vehicleInputs, [key]: existing });
- } else {
- const uniqueKey = `${key}__${item.__index}`;
- const updatedInputs = {
- ...vehicleInputs,
- [uniqueKey]: [uppercasedValue],
- };
-
- const updatedErrors = { ...errors };
- // updatedErrors[uniqueKey] = [isValid ? '' : 'Invalid format (e.g., KA01AB1234)'];
-
- updatedErrors[uniqueKey] = [
- uppercasedValue === ''
- ? ''
- : isValid
- ? ''
- : 'Invalid format (e.g., KA01AB1234)',
- ];
-
- setVehicleInputs(updatedInputs);
- setErrors(updatedErrors);
-
- vehiclesvalues(updatedInputs);
- }
- };
-
- const vehiclesvalues = (vehicleData) => {
- const updated = OrderCardDetail.map((item) => {
- const key =
- item.ServiceType === 'G'
- ? item.id // using `id` now
- : `${item.ServiceId}__${item.__index}`;
-
- // if (vehicleData[key]) {
- // return {
- // ...item,
- // VehicleNo: vehicleData[key],
- // };
- // }
- // return item;
-
- const value = vehicleData[key];
-
- if (value && value.length) {
- return {
- ...item,
- VehicleNo:
- item.ServiceType === 'G'
- ? value.join(',') // 👈 convert array to comma-separated string
- : value[0], // 👈 single string from array
- };
- }
-
- return item;
- });
-
- dispatch(changeOrderCardDetails(updated));
- };
-
- const Handlevehiclenumbers = () => {
- setOtherServicesModal(false);
- };
- const hasVehicleInputErrors = () => {
- return Object.values(errors).some(
- (arr) => Array.isArray(arr) && arr.some((err) => err)
- );
- };
-
- return (
-
-
-
-
- {screenwidth <= 768 && (
-
- {Array.isArray(OrderCardDetail) &&
- OrderCardDetail?.length >= 1 && (
-
- )}
-
- )}
- {/* {Array.isArray(OrderCardDetail) && OrderCardDetail?.length >= 1 && (
-
- {" "}
-
-
- )} */}
-
-
-
- {tableOptions
- .filter((item) => item.OptionName === 'AddCustomer')
- .map((filteredItem) => (
-
-
-
- ))}
-
-
- {screenwidth <= 768 && (
- <>
- {Array.isArray(OrderCardDetail) &&
- OrderCardDetail?.length >= 1 && (
-
- {responsiveBill ? (
-
- ) : (
-
- )}
-
- )}
- >
- )}
-
-
- {(addcustomer || hold) && (
-
- )}
- {creditCustomerOpen && (
-
- )}
- {TotalAmount == 0 && Success && (
-
-
-
- )}
- {TotalAmount > 0 &&
- qrCode &&
- PaymentUpiOptions?.length > 0 &&
- SelectedUpiOption && (
-
-
-
- )}
-
- {PaymentUpiOptions?.length > 0 && OrderId && (
-
-
-
- )}
- {tableOptions?.filter((item) => item.OptionName === 'AddCustomer')
- .length === 1 || navCust === true ? (
-
- {Object.keys(useOptions)?.length > 0 &&
- useOptions?.some((flow) =>
- flow.OptionDetails.some(
- (option) =>
- option.OptionName === 'Pay at the counter' &&
- option.ModeDetails.some(
- (mode) => mode.ModeName === 'Credit'
- )
- )
- ) && (
-
- {!OtherServicesglobal && (
-
- {' '}
- 0 && 'not-allowed',
- color:
- OrderCardDetail?.length > 0 ||
- (selOption?.value === undefined &&
- GlobalAddCustomerDetails1?.length === 0 &&
- GetCustId?.CustMobile === undefined)
- ? 'gray'
- : 'rgb(18, 146, 238)',
- fontSize: '28px',
- }}
- />
-
- )}
-
- )}
-
- ) : (
- ''
- )}
- {paybtns?.length > 1 && (
-
0) &&
- !unpaidFlow &&
- OrderStatus
- ? 'none'
- : 'auto',
- opacity:
- (BookingType === 'Dine In' ||
- BookingTypeBoth ||
- CheckOrderType?.length > 0) &&
- !unpaidFlow &&
- OrderStatus
- ? 0.5
- : 1,
- width: '2rem',
- }}
- >
- {/*
*/}
- {!OtherServicesglobal && (
-
- {' '}
-
-
- )}
-
- {OtherServicesglobal && OrderCardDetail.length >= 1 && (
-
- {' '}
-
-
-
-
- )}
- {/* */}
-
- )}
-
- {/* Customer Orders */}
- {SelCustId &&
- tableOptions?.filter(
- (item) => item.OptionName === 'PreviousBillFetch'
- ).length === 1 && (
-
- {' '}
- {
- if (
- CheckBookingStatus !== 'Close' &&
- !addnewAccess &&
- !(OrderCardDetail?.length > 0)
- ) {
- setCustomerPreviesOrders(true);
- }
- }}
- style={{
- cursor: OrderCardDetail?.length > 0 && 'not-allowed',
- color:
- OrderCardDetail?.length > 0 ||
- (OrderCardDetail?.length > 0 &&
- GetCustId?.CustMobile === undefined)
- ? 'gray'
- : 'rgb(18, 146, 238)',
- fontSize: '25px',
- display: 'flex',
- alignItems: 'center',
- height: '2.46rem',
- width: '1.5rem',
- }}
- >
-
-
-
- )}
- {tabledata?.length > 0 && (
-
- {tableOptions
- .filter((item) => item.OptionName === 'UnpaidBill')
- .map((filteredItem) => (
-
- {!OtherServicesglobal && (
-
- {' '}
- {
- (setUnpaidOpen(true), getUnpaiddatas());
- }}
- />
-
- )}
-
- ))}
-
- )}
- {dinePreference && (
-
- {(BookingType === 'Dine In' ||
- BookingTypeBoth ||
- CheckOrderType?.length > 0) &&
- !unpaidFlow &&
- SelectedTableDetails?.length !== 0 && (
- <>
-
- {' '}
-
- FirstPaymentclick === false && !addnewAccess
- ? changeOrderStatus()
- : ''
- }
- />
-
- {FirstPaymentclick === false &&
- !addnewAccess &&
- !OrderStatus &&
}
- >
- )}
-
- )}
- {!OtherServicesglobal && (
-
- {tableOptions?.map((item) => (
- <>
- {unpaidFlow == false
- ? item?.OptionName == 'Hold' &&
- BookingType !== 'Dine In' &&
- !BookingTypeBoth &&
- OrderCardDetail?.length != 0 &&
- CheckOrderType?.length === 0 &&
- OrderType != 'Failed' &&
- paybtns?.length > 0 &&
- CheckBookingStatus != 'Close' &&
- !addnewAccess && (
-
- {' '}
- AddBookingDetails('Hold')}
- style={{
- fontSize: '30px',
- cursor: 'pointer',
- color: '' ? '#52c41a' : '#1292EE',
- }}
- />
-
- )
- : ''}
- {unpaidFlow == false
- ? item?.OptionName == 'Hold' &&
- BookingType !== 'Dine In' &&
- !BookingTypeBoth &&
- Holddata?.length > 0 &&
- OrderCardDetail?.length == 0 &&
- paybtns?.length > 0 &&
- CheckBookingStatus != 'Close' &&
- !addnewAccess && (
-
- {' '}
-
- HandleholdModelOpen()}
- style={{
- fontSize: '28px',
- cursor: 'pointer',
- color: Holddata ? '#52c41a' : 'default',
- pointerEvents:
- OrderType === 'Failed' ? 'none' : 'auto',
- }}
- />
-
-
- )
- : ''}
- >
- ))}
-
- )}
-
-
-
- 0) &&
- !unpaidFlow &&
- OrderStatus
- ? 'none'
- : 'auto',
- opacity:
- (BookingType === 'Dine In' ||
- BookingTypeBoth ||
- CheckOrderType?.length > 0) &&
- !unpaidFlow &&
- OrderStatus
- ? 0.5
- : 1,
- }}
- >
- {paybtns?.length > 0 &&
- currentOrderNetAmount >= previousNetAmount ? (
- paybtns?.map((payment) => (
-
-
- payment?.ModeName?.toLowerCase() === 'upi' // Change the condition to payment.Id
- ? handleUPIButtonClick(
- payment.ModeId,
- payment.ModeName
- )
- : handlePaymentMode(
- payment.ModeId,
- payment.ModeName
- )
- }
- >
- {/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && UPI
} */}
-
-
- {payment.ModeName}
- {payment?.ModeName?.toLowerCase() === 'card' && (
-
- )}
- {payment?.ModeName?.toLowerCase() === 'upi' && (
-
- )}
-
-
-
- ))
- ) : currentOrderNetAmount < previousNetAmount &&
- salesBillEdit &&
- refundPayBtns.length > 0 ? (
- refundPayBtns.map((payment) => (
-
-
- handleRefundPaymentMode(
- payment?.ConfigId,
- payment?.ConfigName
- )
- }
- >
- {/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && UPI
} */}
-
-
- {payment.ConfigName}
-
-
-
- ))
- ) : (
-
- Please Set Payment Options
-
- )}
-
-
- {PrintOrderDetails?.length > 0 && (
-
- {filteredSettingNames?.includes('whatsapp') &&
- MobileNoWhatsApp?.value && (
-
- )}
-
-
-
- {filteredSettingNames?.includes('SMS') && isMobile && (
-
- )}
- {/* WhatsAppShare modal/component */}
- {showWhatsAppShare && (
- closePrintOption(false)}
- />
- )}
- {showSMSShare && isMobile && (
- closePrintOption(false)}
- />
- )}
-
- )}
-
-
- {/* {(selectCustomerDisplay === true || paymentModeDisplay === true) && (
-
- )} */}
-
-
-
-
-
-
-
-
- Items:
-
-
- {TotalItems}
-
-
-
-
-
- Qty:
-
-
- {Qty}
-
-
-
-
-
- {OrderCardDetail?.length > 0 &&
- ParkingDisplay &&
- !OtherServicesglobal && (
-
-
-
- )}
-
- {' '}
- {!OtherServicesglobal && unpaidFlow == true ? (
-
- {' '}
- {
- Recipt();
- }}
- />
-
- ) : (
- ''
- )}
-
-
-
-
-
-
-
- {/*
- {" "}
-
- */}
-
- >
- }
- trigger="click"
- // width={1000}
- open={open}
- onOpenChange={handleOpenChange}
- >
-
-
-
-
-
-
-
-
-
- {/*
-
- */}
-
- >
- }
- trigger="click"
- // width={1000}
- open={open2}
- onOpenChange={handleOpenChange2}
- >
-
-
-
-
-
-
-
-
-
- 0 &&
- paybtnselected &&
- CheckBookingStatus != 'Close'
- ? !OrderStatus
- ? salesBillEdit &&
- currentOrderNetAmount < previousNetAmount
- ? 'Table4-Btn-final-price'
- : 'Table4-Btn-final-price'
- : 'Table4-Btn-final-price order'
- : 'Table4-Btn-final-price-disabled'
- }
- // onClick={() => {
- // (qrCode && SelectedUPIPayOption === "Default")
- // ? UpiPayment() : OrderStatus ? AddBookingDetails("Dine-In") : AddBookingDetails(BookingType, true);
- // }}
- onClick={
- // BranchFinancialStatus==='N'? financialYearError:
- handleButtonClick
- }
- >
- {!OrderStatus ? (
- salesBillEdit &&
- currentOrderNetAmount < previousNetAmount ? (
-
- Refund: ₹
- {(previousNetAmount || 0) -
- (currentOrderNetAmount || 0)}
-
- ) : (
-
-
AddBookingDetails(BookingType, true)}
- >
- {isMobile ? (
- `₹ ${Math.round(
- OrderType === 'Failed'
- ? FailedTotalAmt
- : credit && overAllBal >= 0
- ? Math.max(0, TotalAmount - overAllBal)
- : TotalAmount
- )}`
- ) : (
-
- ₹{' '}
- = 0
- ? Math.max(0, TotalAmount - overAllBal)
- : TotalAmount
- )}
- />
-
- )}
- {/* ₹ {Math.round(TotalAmount)} */}
-
-
-
-
-
- )
- ) : (
- ORDER
- )}
-
-
-
-
{
- Upimodel('Cancel');
- }}
- footer={false}
- children={
-
- {/*
UPI PAYMENT */}
-
-
-
-
-
-
-
-
- {' '}
- RS :
- {OrderType === 'Failed'
- ? FailedTotalAmt
- : Math.round(TotalAmount)}{' '}
-
-
-
-
-
- {(selOption || SelCustId) && (
-
- Sent Payment Link
-
- {/*
*/}
-
- )}
-
-
- }
- handleSubmit={() => {
- Upimodel('Submit');
- }}
- />
-
-
-
- }
- />
- {PrintOrderDetails?.length > 0 &&
- PrintOrderDetails?.[0]?.OrderDetails?.map(
- (orderDetail, index) => (
-
- )
- )}
- {PrintOrderDetails?.length > 0 &&
- (TokenOnly?.SettingValue === 'Y' ||
- IndividualToken?.SettingValue === 'Y') &&
- PrintOrderDetails?.[0]?.OrderDetails?.map(
- (orderDetail, index) => (
-
-
-
- )
- )}
- {CreditCustomer && (
-
- {
- handleCreditCustomer('Cancel');
- }}
- handleOk={() => {
- handleCreditCustomer('Submit');
- }}
- />
-
- )}
-
-
-
-
-
-
{
- setUnpaidOpen(false);
- }}
- footer={false}
- children={
-
- }
- />
- {UnpaidConfirmation && (
-
-
- You have already selected a table. If you click 'OK,' the table
- selection will be removed, and the unpaid flow will continue. If
- you click 'Cancel,' the dine-in flow will proceed as selected.
-
- >
- }
- onOk={UnpaidOk}
- onCancel={Unpaidclose}
- />
- )}
- {Splitpayment && (
- data?.TotalAmt + acc,
- 0
- ) -
- ((OverAllSales > 0 ? OverAllSales : 0) +
- (OverAllEstimate > 0 ? OverAllEstimate : 0) +
- (Discount > 0 ? Discount : 0))
- )
- }
- failedOrderData={failedOrderData}
- />
- )}
- {
- dispatch(changeSalesPaymentoption(false));
- }}
- footer={false}
- children={
-
- }
- />
-
- {
- OtherServicesPrintDetails?.length > 0 && (
- // PrintOrderDetails?.[0]?.OrderDetails?.map((orderDetail, index) => (
-
-
-
- )
- // ))
- }
-
- {
- setOtherServicesModal(false);
- }}
- // handleSubmit={Handlevehiclenumbers}
- footer={false}
- children={
-
- {OrderCardDetail.map((item, i) => {
- const isGroup = item.ServiceType === 'G';
- const groupKey = item.id; // 🔁 using `id` for groups now
- const uniqueKey = `${item.ServiceId}__${item.__index}`;
-
- // For G-type: render input only once for the group
- if (
- isGroup &&
- i !== OrderCardDetail.findIndex((o) => o.id === groupKey)
- ) {
- return null;
- }
-
- const qty = isGroup
- ? OrderCardDetail.filter((o) => o.id === groupKey).reduce(
- (sum, o) => sum + (o.OrderQty || 1),
- 0
- )
- : item.OrderQty || 1;
-
- return (
-
-
{item.ServiceName}
-
- {Array.from({ length: qty }).map((_, index) => {
- const inputKey = isGroup
- ? item.id
- : `${item.ServiceId}__${item.__index}`;
- const value = vehicleInputs[inputKey]?.[index] || '';
- const error = errors[inputKey]?.[index] || '';
-
- return (
-
-
- handleInputChange(
- isGroup ? item.id : item.ServiceId,
- index,
- e.target.value,
- item.ServiceType,
- item
- )
- }
- onKeyPress={(e) => {
- if (!/[A-Za-z0-9]/.test(e.key)) {
- e.preventDefault();
- }
- }}
- style={{
- width: '100%',
- padding: 8,
- borderRadius: 4,
- border: error ? '1px solid red' : '1px solid #ccc',
- }}
- />
- {error && (
-
- {error}
-
- )}
-
- );
- })}
-
- );
- })}
-
-
- Submit
-
-
-
- }
- />
- setShowCancelConfirm(true)}
- footer={false}
- width={500}
- children={
- <>
-
- >
- }
- />
- {showCancelConfirm && (
- {
- setBusinessUPI(false);
- setShowCancelConfirm(false);
- ClearAllGlobalStateDatas();
- CustomerDisplay();
- }}
- onCancel={() => setShowCancelConfirm(false)}
- okText="Yes"
- cancelText="No"
- >
- Do you want to cancel the payment?
-
- )}
- {customerPreviesOrders && (
- setCustomerPreviesOrders(false)}
- footer={false}
- width={700}
- className={'ModalPaymentGatewayEmbedded'}
- children={
- <>
- setCustomerPreviesOrders(false)}
- />
- >
- }
- />
- )}
-
- );
-};
-export default BSBilling4Payment;
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4.jsx
deleted file mode 100644
index 355b630..0000000
--- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4.jsx
+++ /dev/null
@@ -1,3613 +0,0 @@
-import React, { lazy, useEffect, useState } from 'react';
-import { shallowEqual, useDispatch, useSelector } from 'react-redux';
-import { isMobile } from 'react-device-detect';
-import { AiFillDelete, AiOutlineClose } from 'react-icons/ai';
-import { Popconfirm, Tooltip } from 'antd';
-import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4.scss';
-import {
- getTemplateData,
- SelectedGlobalBillingColorDetail,
- SelectedGlobalBillingFont,
- StoredSessionData,
-} from '../../../../../Features/ThemeChange/ThemeChange';
-import {
- GlobalOrderCardDetails,
- changeOrderCardDetails,
- GlobalBookingType,
- GlobalPreviousOrderLength,
- GlobalHoldOrderDtl,
- GlobalUnpaidData,
- ChangeSelectedCustDisable,
- changeReorderHoldDetails,
- changeUnpaidData,
- changeBookingType,
- changeSelectedOption,
- GlobalSelProdWiseEst,
- GlobalBookingTypeBoth,
- GlobalOrderType,
- changeReorderProductDetails,
- GlobalReorderHoldDetails,
- getSelectedFavItems,
- getLayoutproductCard,
- getCardDataWithoutSubmodule,
- getCardDataWithoutSub,
- changeOrderType,
- GlobalProductCategorie,
- GlobalProductSubCategorie,
- changeAllProductTokenAvailable,
- changeTokenOnly,
- PreferenceData,
- GlobalEstimateBooking,
- ChangeOverAllDiscSales,
- ChangeOverAllDiscEstimate,
- changeSelProdWiseEst,
- GlobalOtherSevices,
- GlobalDefaultBookingType,
- PostBlockSlots,
- GlobalSelOption,
- GlobalCustId,
- GlobalSalesBillEdit,
- changeBillEditingMode,
- changePreviousOrderPayment,
- changePreviousOrderOfferDetail,
-} from '../../../../../Features/BookingScreen/BookingData/BookingData';
-import {
- ChangeTotalAmount,
- globalExtraTotalAmount,
-} from '../../../../../Features/ExteraCharges/ExtraCharges.js'; //Shifayath Date:27/12/2023
-const BSBillingEditQuantity = lazy(
- () => import('../BSBillingEditQuantity/BSBillingEditQuantity')
-);
-import dineInIcon from '../../../../../Images/Dine In.svg';
-import TakeAwayIcon from '../../../../../Images/Take away.svg';
-import WebFont from 'webfontloader';
-import {
- changeholddata,
- gettinghold,
- puttinghold,
-} from '../../../../../Features/BookingScreen/HoldOption/HoldOption.js';
-import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
-import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
-const BSEditTotalAmt = lazy(
- () => import('../BSEditTotalAmount/BSEditTotalAmt.jsx')
-);
-
-const BSImeiDetails = lazy(() => import('../BSImeiDetails/BSImeiDetails.jsx'));
-import {
- ChangeFullFreeProductList,
- changeFullOfferAppliedProducts,
- ClearOfferAppliedProducts,
- GlobalFreeProdList,
- GlobalOfferAppliedProducts,
-} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
-import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js';
-import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js';
-import { useUtilsComponent } from '../../../../../Services/utils.js';
-const CustomerPriceHistory = lazy(
- () => import('../../UtillComponents/CustomerPriceHistory.jsx')
-);
-const BSBillingTable4 = () => {
- const { removeExtraCharge } = useUtilsComponent();
- const dispatch = useDispatch();
- const applyOffer = useApplyOfferto_CardDetail();
- const preferenceDatas = useSelector(PreferenceData);
- const preferenceDetails = preferenceDatas?.[0]?.SettingDtlDetails;
- const allowDecimal = preferenceDatas?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'decimal' &&
- setting?.SettingValue === 'Y'
- );
- const preferenceOffer =
- preferenceDetails?.find((item) => item.SettingIdName === 'Offer')
- ?.SettingValue === 'Y';
- const BillOrderPre = preferenceDatas?.[0]?.SettingDtlDetails?.find(
- (item) => item.SettingIdName === 'BillItemsOrder'
- )?.SettingValue;
- const imeiModal = preferenceDatas?.[0]?.SettingDtlDetails?.some(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'imeidetails' &&
- setting?.SettingValue === 'Y'
- );
- const SessionData = useSelector(StoredSessionData);
- const BranchId = SessionData?.BranchId;
- const AppId = SessionData?.AppId;
- const CompId = SessionData?.CompId;
- const UserId = SessionData?.UserId;
-
- const templateData = useSelector(getTemplateData);
- const tableOptions = templateData?.BookingBilling?.[1];
- const OfferCheckedInSetup = templateData?.BookingNavbar?.[1].some(
- (item) => item?.OptionName == 'Offer'
- );
- const GlobalOfferAppliedProductsData = useSelector(
- GlobalOfferAppliedProducts
- );
- const OfferFreeProduct = useSelector(GlobalFreeProdList, shallowEqual);
- const SelectedBillColor = useSelector(SelectedGlobalBillingColorDetail);
- const SelectedFont = useSelector(SelectedGlobalBillingFont);
- const UnpaidData = useSelector(GlobalUnpaidData);
- const tableData = useSelector(GlobalOrderCardDetails);
- console.log(tableData, 'tableDatatableData');
- const ReportholdData = useSelector(GlobalReorderHoldDetails);
- const PreviousOrderLength = useSelector(GlobalPreviousOrderLength);
- const HoldOrderDtl = useSelector(GlobalHoldOrderDtl);
- const GlobProdwisedata = useSelector(GlobalSelProdWiseEst);
- const prodCat = useSelector(GlobalProductCategorie);
- const ProdSubCat = useSelector(GlobalProductSubCategorie);
- const [shortKeyMethod, setshortKeyMethod] = useState(null);
- const preferenceshortcutkey = preferenceDatas?.[0]?.SettingDtlDetails?.some(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'shortcutkeys' &&
- setting?.SettingValue === 'Y'
- );
- const [PreviousdataLength, setPreviousdataLength] =
- useState(PreviousOrderLength);
- const [triggerAnimation, setTriggerAnimation] = useState(false);
- const [EditQuantity, setEditQuantity] = useState(false);
- const [Modaldata, setModaldata] = useState([]);
- const [Index, setIndex] = useState(null);
- const BookingType = useSelector(GlobalBookingType);
- const defaultBookingType = useSelector(GlobalDefaultBookingType);
-
- const [editField, setEditField] = useState(false);
- const BookingTypeBoth = useSelector(GlobalBookingTypeBoth);
- const OrderType = useSelector(GlobalOrderType);
- const GlobEstBooking = useSelector(GlobalEstimateBooking);
- const GetCustId = useSelector(GlobalCustId);
- const selectedCustomer = useSelector(GlobalSelOption);
-
- const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] =
- useState(false);
- const [customerProduct, setCustomerProduct] = useState(null);
- const [OpenEditTotalAmt, setOpenEditTotalAmt] = useState(false);
- const [OpenImeiDetail, setOpenImeiDetail] = useState(false);
- const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
- const OtherServicesglobal = useSelector(GlobalOtherSevices);
- const appPreferences = useSelector(ApplicationPreferences);
- const commonModulePreference = appPreferences?.find(
- (preference) => preference?.PreferredCatName === 'Common Module'
- )?.PreferenceCatDetails;
- const sportsAppPreference = commonModulePreference?.find(
- (preference) =>
- preference?.PreferredSubCatName === 'SportsApp' &&
- preference?.PreferredStatus == 'Y'
- );
- const salespagefields = appPreferences?.find(
- (pref) => pref?.PreferredCatName === 'Sales Page Fields'
- )?.PreferenceCatDetails;
- const AvailableDate = salespagefields?.find(
- (type) =>
- type?.PreferredSubCatName?.toLowerCase() === 'available date' &&
- type?.PreferredStatus === 'Y'
- );
- const { selectedDate } = useDateStore();
-
- console.log(AvailableDate, salespagefields, 'Available Date');
- const productBasedExtraCharges = GlobalExtraCharge.filter(
- (obj) => 'ProdName' in obj
- );
-
- const tableDataDinein = tableData?.filter(
- (a, b) => a.BookingTypeName === 'Dine In' && !a?.SalesId
- );
- const tableDataTakeAway =
- OrderType === 'Hold'
- ? tableData?.filter((a, b) => a.BookingTypeName === 'TakeAway')
- : tableData?.filter(
- (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
- )
- : [];
-
- useEffect(() => {
- if (SelectedFont) {
- WebFont.load({
- google: {
- families: [SelectedFont], // Load the selected font
- },
- });
- }
- }, [SelectedFont]);
- useEffect(() => {
- const handleKeyDown = (e) => {
- if (e.ctrlKey && e.key.toLowerCase() === 'i') {
- e.preventDefault();
-
- const prodId = tableData?.[0]?.ProdId;
-
- if (GetCustId && prodId) {
- setCustomerPriceHistoryOpen(true);
- setCustomerProduct(prodId);
- }
- }
- };
-
- window.addEventListener('keydown', handleKeyDown);
-
- return () => {
- window.removeEventListener('keydown', handleKeyDown);
- };
- }, [GetCustId, tableData]);
- useEffect(() => {
- if (tableData?.length === 0) {
- dispatch(ClearOfferAppliedProducts());
- }
- // setTriggerAnimation(true);
- if (!isMobile) {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- userData: tableData,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- }
-
- const timer = setTimeout(() => {
- setTriggerAnimation(false);
- }, 400);
-
- return () => clearTimeout(timer);
- }
- }, [tableData]);
-
- // useEffect(() => {
- // setPreviousdataLength(PreviousOrderLength);
- // }, [PreviousOrderLength]);
-
- useEffect(() => {
- if (tableOptions?.length > 0) {
- let editFieldValue = tableOptions?.filter(
- (item) => item.OptionName == 'Edit'
- );
- if (editFieldValue?.length > 0) {
- setEditField(true);
- } else {
- setEditField(false);
- }
- }
- }, [tableOptions]);
-
- useEffect(() => {
- const getSelectedItem = () => {
- const getItem = (data = []) => {
- if (!data.length) return null;
- return BillOrderPre === 'Y' ? data[0] : data[data.length - 1];
- };
-
- if (tableDataTakeAway?.length > 0) {
- return getItem(tableDataTakeAway);
- } else if (tableDataDinein?.length > 0) {
- return getItem(tableDataDinein);
- }
- return null;
- };
-
- const handleShortcut = (method) => {
- const item = getSelectedItem();
- if (!item) return;
-
- handleEditQuantity(item);
- setshortKeyMethod(method);
- };
-
- const handleKeyDown = (event) => {
- const key = event.key.toLowerCase();
- // 👉 ALT + P → Open Edit Total Amount
- if (event.altKey && key === 'p') {
- event.preventDefault();
- if (tableData?.length > 0) {
- OpenEditTotalAmount();
- }
- return;
- }
- // 👉 CTRL shortcuts
- if (!event.ctrlKey) return;
-
- if (key === 'q') {
- event.preventDefault();
- handleShortcut('qty');
- } else if (key === 'e') {
- event.preventDefault();
- handleShortcut('price');
- } else if (key === 'y') {
- event.preventDefault();
- handleShortcut('Parcel');
- } else if (key === 'b') {
- event.preventDefault();
- handleShortcut('weightAmount');
- }
- };
-
- window.addEventListener('keydown', handleKeyDown);
-
- return () => {
- window.removeEventListener('keydown', handleKeyDown);
- };
- }, [preferenceshortcutkey, tableDataTakeAway, tableDataDinein, BillOrderPre]);
-
- const handleImeiDetails = (value) => {
- setOpenImeiDetail(true);
- setModaldata(value);
- };
- const handleImeiDetailClose = () => {
- setOpenImeiDetail(false);
- };
-
- const calculateAmounts = (
- OrderQty,
- OrderRate,
- TaxPercentage,
- IsPaid = true
- ) => {
- const total = OrderQty * OrderRate;
-
- const withoutTax = total - (total * TaxPercentage) / (100 + TaxPercentage);
-
- return {
- TotalAmt: total,
- ...(IsPaid && { Offer: total }),
- WithoutTaxRate: +withoutTax.toFixed(2),
- };
- };
-
- const ChangeOrderCardDetailsFn = async ({
- OrderQty,
- InwardDtlId,
- Offer,
- CompleteRemove = false,
- RemoveAndUpdate = false,
- BuyInwardDtlId,
- BuyProdQty,
- UpdateBuyAndFree = false,
- CompleteRemoveBuyAndAddWithPaid = false,
- CompleteRemoveconvertFreetoPaid = false,
- CompleteRemoveconvertFreetoPaidTwoTypes = false,
- CompleteRemoveconvertFreetoPaidNotCompletely = false,
- CompleteRemoveAndPaidToFreeOtherType = false,
- CompleteRemoveAndPaidToFreeOtherTypeWithoutMerge = false,
- RemoveAndUpdateOtherBookingType = false,
- BookingTypeName,
- BookedDate,
- OrderRate,
- }) => {
- let ModifiedOrderCardDetail = JSON.parse(JSON.stringify(tableData));
-
- if (RemoveAndUpdate) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === InwardDtlId &&
- (sportsAppPreference ? e?.BookedDate === BookedDate : true) &&
- e?.Offer === Offer &&
- e?.BookingTypeName === BookingTypeName &&
- (!e?.SalesId || OrderType == 'Hold')
- )
- )?.map((e) => {
- if (
- e?.InwardDtlId == InwardDtlId &&
- e?.Offer > 0 &&
- e?.BookingTypeName === BookingTypeName
- ) {
- const newQty = OrderQty;
- return {
- ...e,
- OrderQty: newQty,
- ...calculateAmounts(newQty, e.OrderRate, e.TaxPercentage),
- };
- }
-
- if (e?.InwardDtlId == BuyInwardDtlId) {
- return {
- ...e,
- OrderQty: BuyProdQty,
- ...calculateAmounts(
- BuyProdQty,
- e.OrderRate,
- e.TaxPercentage,
- false
- ),
- };
- }
-
- return e;
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
- if (RemoveAndUpdateOtherBookingType) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === InwardDtlId &&
- (sportsAppPreference ? e?.BookedDate === BookedDate : true) &&
- e?.Offer === Offer &&
- e?.BookingTypeName === BookingTypeName &&
- (!e?.SalesId || OrderType == 'Hold')
- )
- )?.flatMap((e) => {
- if (
- e?.InwardDtlId == InwardDtlId &&
- e?.Offer > 0 &&
- e?.BookingTypeName === BookingTypeName
- ) {
- const newQty = e?.OrderQty - BuyProdQty;
-
- return {
- ...e,
- OrderQty: newQty,
- ...calculateAmounts(newQty, e.OrderRate, e.TaxPercentage),
- };
- }
- if (
- e?.InwardDtlId == InwardDtlId &&
- e?.Offer == 0 &&
- e?.BookingTypeName !== BookingTypeName
- ) {
- const newQty = e?.OrderQty - BuyProdQty;
-
- let first = {
- ...e,
- OrderQty: BuyProdQty,
- ...calculateAmounts(BuyProdQty, e.OrderRate, e.TaxPercentage),
- };
- if (newQty > 0) {
- let second = {
- ...e,
- Offer: 0,
- OrderQty: newQty,
- ...calculateAmounts(newQty, e.OrderRate, e.TaxPercentage, false),
- };
- return [first, second];
- }
- return [first];
- }
-
- if (e?.InwardDtlId == BuyInwardDtlId) {
- return {
- ...e,
- OrderQty: BuyProdQty,
- ...calculateAmounts(
- BuyProdQty,
- e.OrderRate,
- e.TaxPercentage,
- false
- ),
- };
- }
-
- return e;
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
- if (CompleteRemove) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === InwardDtlId &&
- (sportsAppPreference ? e?.BookedDate === BookedDate : true) &&
- e?.Offer === Offer &&
- e?.BookingTypeName === BookingTypeName &&
- (!e?.SalesId || OrderType == 'Hold') &&
- e?.SinglePc == 'N' &&
- e?.OrderRate == OrderRate
- )
- );
- return dispatch(changeOrderCardDetails(data));
- }
- if (CompleteRemoveAndPaidToFreeOtherType) {
- let data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === InwardDtlId &&
- e?.Offer === Offer &&
- e?.BookingTypeName === BookingTypeName &&
- (!e?.SalesId || OrderType == 'Hold')
- )
- )?.flatMap((exp) => {
- // Same product but different booking type and not an offer
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer == 0 &&
- exp?.BookingTypeName !== BookingTypeName
- ) {
- const remainingQty = exp.OrderQty - OrderQty;
-
- if (remainingQty === 0) {
- return {
- ...exp,
- OfferMode: 'B',
- ...calculateAmounts(
- exp.OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- true
- ),
- };
- }
-
- if (remainingQty > 0) {
- return [
- {
- ...exp,
- OrderQty: remainingQty,
- ...calculateAmounts(
- remainingQty,
- exp.OrderRate,
- exp.TaxPercentage,
- false
- ),
- },
- {
- ...exp,
- OrderQty: OrderQty,
- Offer: 0,
- OfferMode: 'B',
- ...calculateAmounts(
- OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- true
- ),
- },
- ];
- }
- }
-
- return exp;
- });
-
- // ===== Merge duplicates for free offers =====
- const mergedData = [];
- data?.forEach((item) => {
- if (item?.OfferMode === 'B') {
- // Check if a free item already exists for this product + booking type
- const existingIndex = mergedData.findIndex(
- (e) =>
- e.InwardDtlId === item.InwardDtlId &&
- (sportsAppPreference ? e?.BookedDate === BookedDate : true) &&
- e.BookingTypeName === item.BookingTypeName &&
- e.OfferMode === 'B'
- );
-
- if (existingIndex > -1) {
- // Merge quantities
- const existing = mergedData[existingIndex];
- const newQty = existing.OrderQty + item.OrderQty;
- mergedData[existingIndex] = {
- ...existing,
- OrderQty: newQty,
- ...calculateAmounts(
- newQty,
- item.OrderRate,
- item.TaxPercentage,
- true
- ),
- };
- } else {
- mergedData.push(item);
- }
- } else {
- mergedData.push(item);
- }
- });
-
- return dispatch(changeOrderCardDetails(mergedData));
- }
- if (CompleteRemoveAndPaidToFreeOtherTypeWithoutMerge) {
- let data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === InwardDtlId &&
- (sportsAppPreference ? e?.BookedDate === BookedDate : true) &&
- e?.Offer === Offer &&
- e?.BookingTypeName === BookingTypeName &&
- (!e?.SalesId || OrderType == 'Hold')
- )
- )?.flatMap((exp) => {
- // Same product but different booking type and not an offer
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer == 0 &&
- exp?.BookingTypeName !== BookingTypeName
- ) {
- const remainingQty = exp.OrderQty - OrderQty;
-
- if (remainingQty === 0) {
- return {
- ...exp,
- OfferMode: 'B',
- ...calculateAmounts(
- exp.OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- true
- ),
- };
- }
-
- if (remainingQty < 0) {
- return [
- {
- ...exp,
- OrderQty: exp.OrderQty,
- OfferMode: 'B',
- ...calculateAmounts(
- exp.OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- true
- ),
- },
- ];
- }
- }
-
- return exp;
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
-
- if (CompleteRemoveconvertFreetoPaid) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === BuyInwardDtlId &&
- (sportsAppPreference ? e?.BookedDate === BookedDate : true) &&
- e?.BookingTypeName === BookingTypeName &&
- (!e?.SalesId || OrderType == 'Hold')
- )
- )?.map((exp) => {
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer > 0 &&
- exp?.BookingTypeName === BookingTypeName
- ) {
- const { OfferType, OfferMessage, ...exp1 } = exp;
- return {
- ...exp1,
- Offer: 0,
- OrderQty: OrderQty,
- ...calculateAmounts(
- OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- false
- ),
- };
- }
- return exp; // keep unchanged item
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
- if (CompleteRemoveconvertFreetoPaidNotCompletely) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === BuyInwardDtlId &&
- (sportsAppPreference ? e?.BookedDate === BookedDate : true) &&
- e?.BookingTypeName === BookingTypeName &&
- (!e?.SalesId || OrderType == 'Hold')
- )
- )?.flatMap((exp) => {
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer > 0 &&
- exp?.BookingTypeName === BookingTypeName
- ) {
- const { OfferType, OfferMessage, ...exp1 } = exp;
- let first = {
- ...exp1,
- Offer: 0,
- OrderQty: BuyProdQty,
- ...calculateAmounts(
- OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- false
- ),
- };
- if (BuyProdQty < OrderQty) {
- let second = {
- ...exp1,
- Offer: 0,
- OrderQty: exp1?.OrderQty - BuyProdQty,
- ...calculateAmounts(
- exp1?.OrderQty - BuyProdQty,
- exp.OrderRate,
- exp.TaxPercentage,
- true
- ),
- };
- return [first, second];
- }
- return [first];
- }
- return exp; // keep unchanged item
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
- if (CompleteRemoveBuyAndAddWithPaid) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- (e?.InwardDtlId === BuyInwardDtlId &&
- e?.BookingTypeName === BookingTypeName &&
- (sportsAppPreference ? e?.BookedDate === BookedDate : true) &&
- (!e?.SalesId || OrderType == 'Hold')) ||
- (e?.InwardDtlId == InwardDtlId &&
- e?.Offer > 0 &&
- e?.BookingTypeName === BookingTypeName &&
- (!e?.SalesId || OrderType == 'Hold'))
- )
- )?.map((exp) => {
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer == 0 &&
- exp?.BookingTypeName === BookingTypeName
- ) {
- return {
- ...exp, // keep existing fields
- OrderQty: OrderQty,
- ...calculateAmounts(
- OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- false
- ),
- };
- }
- return exp; // keep unchanged item
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
-
- if (UpdateBuyAndFree) {
- const data = ModifiedOrderCardDetail?.map((e) => {
- if (
- e?.InwardDtlId == InwardDtlId &&
- (sportsAppPreference ? e?.BookedDate === BookedDate : true) &&
- e?.Offer > 0 &&
- e?.BookingTypeName === BookingTypeName
- ) {
- const newQty = e?.OrderQty + OrderQty;
- return {
- ...e,
- OrderQty: newQty,
- ...calculateAmounts(newQty, e.OrderRate, e.TaxPercentage),
- };
- }
- if (e?.InwardDtlId == InwardDtlId && e?.Offer == Offer) {
- const newQty = e?.OrderQty - OrderQty;
- return {
- ...e,
- OrderQty: newQty,
-
- ...calculateAmounts(newQty, e.OrderRate, e.TaxPercentage, false),
- };
- }
-
- if (
- e?.InwardDtlId == BuyInwardDtlId &&
- e?.BookingTypeName === BookingTypeName
- ) {
- return {
- ...e,
- OrderQty: BuyProdQty,
- ...calculateAmounts(
- BuyProdQty,
- e.OrderRate,
- e.TaxPercentage,
- false
- ),
- };
- }
-
- return e;
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
-
- if (CompleteRemoveconvertFreetoPaidTwoTypes) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === BuyInwardDtlId &&
- (sportsAppPreference ? e?.BookedDate === BookedDate : true) &&
- e?.BookingTypeName === BookingTypeName &&
- (!e?.SalesId || OrderType == 'Hold')
- )
- )?.flatMap((exp) => {
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer > 0 &&
- exp?.BookingTypeName === BookingTypeName
- ) {
- const { OfferType, OfferMessage, ...exp1 } = exp;
- return {
- ...exp1,
- Offer: 0,
- OrderQty: OrderQty,
- ...calculateAmounts(
- OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- false
- ),
- };
- }
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer > 0 &&
- exp?.BookingTypeName !== BookingTypeName
- ) {
- const { ...exp1 } = exp;
- let first = {
- ...exp1,
- // Offer: 0,
- OrderQty: exp1?.OrderQty - BuyProdQty,
- ...calculateAmounts(
- exp1?.OrderQty - BuyProdQty,
- exp.OrderRate,
- exp.TaxPercentage,
- true
- ),
- };
-
- let second = {
- ...exp1,
- Offer: 0,
- OrderQty: BuyProdQty,
- ...calculateAmounts(
- BuyProdQty,
- exp.OrderRate,
- exp.TaxPercentage,
- false
- ),
- };
- delete second?.OfferMessage;
- delete second?.OfferType;
- return [first, second];
- }
- return exp; // keep unchanged item
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
- // Update qty for normal case
-
- const data = ModifiedOrderCardDetail?.map((e) => {
- if (
- e?.InwardDtlId == InwardDtlId &&
- (sportsAppPreference ? e?.BookedDate === BookedDate : true) &&
- e?.Offer == Offer &&
- e?.BookingTypeName === BookingTypeName
- ) {
- return {
- ...e,
- OrderQty,
- ...calculateAmounts(OrderQty, e.OrderRate, e.TaxPercentage, false),
- };
- }
- return e;
- });
-
- dispatch(changeOrderCardDetails(data));
- };
-
- const ChangeFreeprodlistFn = async ({
- FreeProdId,
- OfferId,
- OverAllFreeQty,
- RemainingQty,
- FreeQty,
- CompleteRemove = false,
- }) => {
- const deepCopy = JSON.parse(JSON.stringify(OfferFreeProduct));
-
- let ModifyedData;
-
- if (CompleteRemove) {
- // 🔹 Remove the matching FreeProd completely
- ModifyedData = deepCopy?.filter(
- (exp) => !(exp?.OfferId == OfferId && exp?.FreeProdId == FreeProdId)
- );
- } else {
- // 🔹 Update the matching FreeProd
- ModifyedData = deepCopy?.map((exp) => {
- if (exp?.OfferId == OfferId && FreeProdId == exp?.FreeProdId) {
- return {
- ...exp,
- OverAllFreeQty,
- RemainingQty,
- FreeQty,
- };
- }
- return { ...exp };
- });
- }
-
- dispatch(ChangeFullFreeProductList(ModifyedData));
- };
-
- const ChangeOfferAppliedProdsFn = async ({
- inwardDtlId,
- OfferAmount,
- FreeQty,
- CompleteRemove = false,
- insideinwardDtlId = false,
- }) => {
- const deepCopy = JSON.parse(JSON.stringify(GlobalOfferAppliedProductsData));
-
- let ModifyedData;
-
- if (CompleteRemove) {
- // 🔹 Remove case
- if (!insideinwardDtlId) {
- ModifyedData = deepCopy?.filter(
- (exp) => exp?.InwardDtlId !== inwardDtlId
- );
- } else {
- ModifyedData = deepCopy?.filter(
- (exp) =>
- !(
- Array?.isArray(exp?.FreeProductsList)
- ? exp?.FreeProductsList
- : [exp?.FreeProductsList]
- )?.some((freeProd) =>
- freeProd?.ProdVariantDetails?.some((variant) =>
- variant?.StockDetails?.some(
- (stock) => stock?.FreeInwardDtlId === inwardDtlId
- )
- )
- )
- );
- }
- } else {
- // 🔹 Update case
- ModifyedData = deepCopy?.map((exp) => {
- let shouldUpdate = false;
-
- if (!insideinwardDtlId) {
- shouldUpdate = exp?.InwardDtlId == inwardDtlId;
- } else {
- shouldUpdate = (
- Array?.isArray(exp?.FreeProductsList)
- ? exp?.FreeProductsList
- : [exp?.FreeProductsList]
- )?.some((freeProd) =>
- freeProd?.ProdVariantDetails?.some((variant) =>
- variant?.StockDetails?.some(
- (stock) => stock?.FreeInwardDtlId === inwardDtlId
- )
- )
- );
- }
-
- if (shouldUpdate) {
- return {
- ...exp,
- OfferAmount,
- ActualFreeQty: FreeQty,
- FreeProductsList: (Array?.isArray(exp?.FreeProductsList)
- ? exp?.FreeProductsList
- : [exp?.FreeProductsList]
- )?.map((item, idx) =>
- idx === 0
- ? {
- ...item,
- FreeQty,
- }
- : item
- ),
- };
- }
- return { ...exp };
- });
- }
-
- dispatch(changeFullOfferAppliedProducts(ModifyedData));
- };
-
- const removeFromCart = async (item) => {
- removeExtraCharge(item);
- setPreviousdataLength(tableData?.length);
- AvailableDate && UnblockSlots(item);
- if (item?.SinglePc == 'Y') {
- let ModifiedOrderCardDetail = JSON.parse(JSON.stringify(tableData));
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === item?.InwardDtlId &&
- (sportsAppPreference ? e?.BookedDate === BookedDate : true) &&
- e?.Offer === item?.Offer &&
- e?.BookingTypeName === item?.BookingTypeName &&
- (!e?.SalesId || OrderType == 'Hold') &&
- e?.SinglePc == 'Y'
- )
- );
- return dispatch(changeOrderCardDetails(data));
- }
- let ischeckBothBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- (sportsAppPreference ? e?.BookedDate === BookedDate : true) &&
- e?.Offer > 0 &&
- e?.BookingTypeName != item?.BookingTypeName
- );
-
- if (tableData?.length <= 1) {
- await dispatch(changeSelectedOption(null));
- await dispatch(ChangeSelectedCustDisable(false));
- await dispatch(changeReorderHoldDetails({}));
- await dispatch(changeReorderProductDetails([]));
- await dispatch(changeUnpaidData(false));
- await dispatch(changeBookingType('TakeAway'));
- await dispatch(changeTokenOnly(false));
- await dispatch(ChangeTotalAmount([]));
- await dispatch(changeAllProductTokenAvailable(false));
- await dispatch(ChangeOverAllDiscSales(null));
- await dispatch(ChangeOverAllDiscEstimate(null));
- await dispatch(changeSelProdWiseEst([]));
- dispatch(changeBillEditingMode(false));
- await dispatch(changePreviousOrderPayment([]));
- await dispatch(changePreviousOrderOfferDetail([]));
- }
-
- if (item?.Offer > 0) {
- //check is Buyxgetx Or something
- // let ischeck= GlobalOfferAppliedProductsData?.some((e)=>e?.FreeProductsList?.[0]??.
- const isBuyAndGetX =
- GlobalOfferAppliedProductsData?.find((data) =>
- (Array?.isArray(data?.FreeProductsList)
- ? data?.FreeProductsList
- : [data?.FreeProductsList]
- )?.some((freeProd) =>
- freeProd?.ProdVariantDetails?.some((variant) =>
- variant?.StockDetails?.some(
- (stock) => stock?.FreeInwardDtlId === item?.InwardDtlId
- )
- )
- )
- )?.OfferMode == 'B';
-
- const isItemWiseOrQuantityProduct = GlobalOfferAppliedProductsData?.find(
- (data) =>
- data?.ProdId === item?.ProdId &&
- data?.InwardDtlId === item?.InwardDtlId &&
- (data?.OfferMode === 'I' || data?.OfferMode === 'Q') &&
- data?.OfferAmount === item?.Offer
- );
-
- const isCheckFreeProduct = GlobalOfferAppliedProductsData?.find((off) =>
- (Array.isArray(off?.FreeProductsList)
- ? off?.FreeProductsList
- : [off?.FreeProductsList]
- )?.some((prod) =>
- prod?.ProdVariantDetails?.some((variant) =>
- variant?.StockDetails?.some(
- (stock) => stock.FreeInwardDtlId === item?.InwardDtlId
- )
- )
- )
- );
-
- if (isBuyAndGetX) {
- let isPaidproduct = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- item?.BookingTypeName == e?.BookingTypeName
- );
- const isCheckFreeProduct = OfferFreeProduct?.find((exp) =>
- exp?.ProdVariantDetails?.some((variant) =>
- variant?.StockDetails?.some(
- (stock) => stock?.FreeInwardDtlId === item?.InwardDtlId
- )
- )
- );
- if (isPaidproduct) {
- if (isPaidproduct?.OrderQty == item?.OrderQty) {
- //just remove Paid Qty
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidproduct?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- BookedDate: isPaidproduct?.BookedDate,
- BuyInwardDtlId: null,
- Offer: 0,
- OrderRate: isPaidproduct?.OrderRate,
- });
- } else if (isPaidproduct?.OrderQty > item?.OrderQty) {
- // Just Decrease Paid Qty
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidproduct?.OrderQty - item?.OrderQty,
- CompleteRemove: false,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- BookedDate: isPaidproduct?.BookedDate,
- BuyInwardDtlId: null,
- Offer: 0,
- });
- } else if (isPaidproduct?.OrderQty < item?.OrderQty) {
- //just remove Paid Qty
- //decrease FreeQty
-
- if (ischeckBothBookingType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: -isPaidproduct?.OrderQty,
- RemoveAndUpdate: true,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- BookedDate: isPaidproduct?.BookedDate,
- BuyInwardDtlId: null,
- Offer: 0,
- });
-
- await ChangeFreeprodlistFn({
- OverAllFreeQty: isCheckFreeProduct?.OverAllFreeQty,
- RemainingQty:
- isCheckFreeProduct?.OverAllFreeQty -
- (ischeckBothBookingType?.OrderQty + isPaidproduct?.OrderQty),
- FreeQty:
- ischeckBothBookingType?.OrderQty + isPaidproduct?.OrderQty,
- FreeProdId: isPaidproduct?.ProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: isPaidproduct?.InwardDtlId,
- OfferAmount: isPaidproduct?.OrderRate * isPaidproduct?.OrderQty,
- FreeQty: isPaidproduct?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- } else {
- let FreeProdcutinPaidModeOtherBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- item?.BookingTypeName != e?.BookingTypeName
- );
-
- if (FreeProdcutinPaidModeOtherBookingType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: item?.OrderQty - isPaidproduct?.OrderQty,
- OrderQty: item.OrderQty,
- RemoveAndUpdateOtherBookingType: true,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- BookedDate: isPaidproduct?.BookedDate,
- BuyInwardDtlId: null,
- Offer: 0,
- });
-
- await ChangeFreeprodlistFn({
- OverAllFreeQty: item?.OrderQty,
- RemainingQty:
- item?.OrderQty -
- (isPaidproduct?.OrderQty +
- (FreeProdcutinPaidModeOtherBookingType?.OrderQty -
- (item?.OrderQty - isPaidproduct?.OrderQty) ||
- FreeProdcutinPaidModeOtherBookingType?.OrderQty)),
- FreeQty:
- isPaidproduct?.OrderQty +
- (FreeProdcutinPaidModeOtherBookingType?.OrderQty -
- (item?.OrderQty - isPaidproduct?.OrderQty) ||
- FreeProdcutinPaidModeOtherBookingType?.OrderQty),
- FreeProdId: isPaidproduct?.ProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
-
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: isPaidproduct?.InwardDtlId,
- OfferAmount:
- isPaidproduct?.OrderRate *
- (isPaidproduct?.OrderQty +
- (FreeProdcutinPaidModeOtherBookingType?.OrderQty -
- (item?.OrderQty - isPaidproduct?.OrderQty) ||
- FreeProdcutinPaidModeOtherBookingType?.OrderQty)),
- FreeQty:
- isPaidproduct?.OrderQty +
- (FreeProdcutinPaidModeOtherBookingType?.OrderQty -
- (item?.OrderQty - isPaidproduct?.OrderQty) ||
- FreeProdcutinPaidModeOtherBookingType?.OrderQty),
- insideinwardDtlId: true,
- });
- } else {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidproduct?.OrderQty,
- RemoveAndUpdate: true,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- BookedDate: isPaidproduct?.BookedDate,
- BuyInwardDtlId: null,
- Offer: 0,
- });
-
- await ChangeFreeprodlistFn({
- OverAllFreeQty: item?.OrderQty,
- RemainingQty: item?.OrderQty - isPaidproduct?.OrderQty,
- FreeQty: isPaidproduct?.OrderQty,
- FreeProdId: isPaidproduct?.ProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
-
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: isPaidproduct?.InwardDtlId,
- OfferAmount:
- isPaidproduct?.OrderRate * isPaidproduct?.OrderQty,
- FreeQty: isPaidproduct?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- }
- }
- }
- } else {
- if (ischeckBothBookingType) {
- // //Free Product in Paid Mode
- let FreeProdcutinPaidModeOtherBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- item?.BookingTypeName != e?.BookingTypeName
- );
-
- //if free product is available in paid mode in other booking type then just decrease the free qty from that product
- if (FreeProdcutinPaidModeOtherBookingType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: item?.OrderQty,
- CompleteRemoveAndPaidToFreeOtherType: true,
- InwardDtlId: item?.InwardDtlId,
- BookedDate: item?.BookedDate,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: isCheckFreeProduct?.OverAllFreeQty,
- RemainingQty: isCheckFreeProduct?.OverAllFreeQty,
- FreeQty: isCheckFreeProduct?.FreeQty,
- FreeProdId: isCheckFreeProduct?.FreeProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * Quantity), Quantity, true,)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount: isCheckFreeProduct?.FreeQty * item?.OrderRate,
- FreeQty: item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- } else {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidproduct?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- BookedDate: item?.BookedDate,
- BuyInwardDtlId: null,
- OrderRate: item?.OrderRate,
- Offer: item?.Offer,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: isCheckFreeProduct?.OverAllFreeQty,
- RemainingQty:
- isCheckFreeProduct?.OverAllFreeQty - item?.OrderQty,
- FreeQty: isCheckFreeProduct?.FreeQty - item?.OrderQty,
- FreeProdId: isCheckFreeProduct?.FreeProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * Quantity), Quantity, true,)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- (isCheckFreeProduct?.FreeQty - item?.OrderQty) *
- item?.OrderRate,
- FreeQty: item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- }
- }
-
- // }
- else {
- let isPaidProductAvailableInCartOtherType = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- item?.BookingTypeName != e?.BookingTypeName
- );
-
- if (isPaidProductAvailableInCartOtherType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: item?.OrderQty,
- CompleteRemoveAndPaidToFreeOtherTypeWithoutMerge: true,
- InwardDtlId: item?.InwardDtlId,
- BookedDate: item?.BookedDate,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: isCheckFreeProduct?.OverAllFreeQty,
- RemainingQty:
- isCheckFreeProduct?.OverAllFreeQty -
- (isCheckFreeProduct?.FreeQty -
- (item?.OrderQty -
- isPaidProductAvailableInCartOtherType?.OrderQty)),
- FreeQty:
- isCheckFreeProduct?.FreeQty -
- (item?.OrderQty -
- isPaidProductAvailableInCartOtherType?.OrderQty),
- FreeProdId: isCheckFreeProduct?.FreeProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * Quantity), Quantity, true,)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- item?.OrderRate *
- (isCheckFreeProduct?.FreeQty -
- (item?.OrderQty -
- isPaidProductAvailableInCartOtherType?.OrderQty)),
- FreeQty:
- isCheckFreeProduct?.FreeQty -
- (item?.OrderQty -
- isPaidProductAvailableInCartOtherType?.OrderQty),
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- } else {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidproduct?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- OrderRate: item?.OrderRate,
- BookedDate: item?.BookedDate,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: isCheckFreeProduct?.OverAllFreeQty,
- RemainingQty: isCheckFreeProduct?.OverAllFreeQty,
- FreeQty: 0,
- FreeProdId: isCheckFreeProduct?.FreeProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * Quantity), Quantity, true,)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount: item?.OrderRate * item?.OrderQty,
- FreeQty: item?.OrderQty,
- CompleteRemove: true,
- insideinwardDtlId: true,
- });
- }
- }
- //Change Remove OrderCartDetail
- //Remove FreeprodList
- //ChangeOfferApplied Products
- }
- } else {
- ///remove item wise offer
- if (isItemWiseOrQuantityProduct) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: item?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- OrderRate: item?.OrderRate,
- BookedDate: item?.BookedDate,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- });
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount: item?.OrderRate * item?.OrderQty,
- FreeQty: item?.OrderQty,
- CompleteRemove: true,
- });
- } else if (isCheckFreeProduct) {
- // remove or update loyalty/code based free product which is added in cart
- const freeProdList = Array?.isArray(
- isCheckFreeProduct?.FreeProductsList
- )
- ? isCheckFreeProduct?.FreeProductsList?.[0]
- : isCheckFreeProduct?.FreeProductsList;
- let isPaidProductAvailableInCart = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- item?.BookingTypeName == e?.BookingTypeName
- );
- if (isPaidProductAvailableInCart) {
- if (isPaidProductAvailableInCart?.OrderQty === item?.OrderQty) {
- //just remove Paid Qty
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidProductAvailableInCart?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: isPaidProductAvailableInCart?.InwardDtlId,
- BookedDate: isPaidProductAvailableInCart?.BookedDate,
- OrderRate: isPaidProductAvailableInCart?.OrderRate,
- BuyInwardDtlId: null,
- Offer: 0,
- });
- } else if (
- isPaidProductAvailableInCart?.OrderQty > item?.OrderQty
- ) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty:
- isPaidProductAvailableInCart?.OrderQty - item?.OrderQty,
- CompleteRemove: false,
- InwardDtlId: isPaidProductAvailableInCart?.InwardDtlId,
- BookedDate: isPaidProductAvailableInCart?.BookedDate,
- BuyInwardDtlId: null,
- Offer: 0,
- });
- } else if (
- isPaidProductAvailableInCart?.OrderQty < item?.OrderQty
- ) {
- //just remove Paid Qty
- //decrease FreeQty
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: -isPaidProductAvailableInCart?.OrderQty,
- RemoveAndUpdate: true,
- InwardDtlId: isPaidProductAvailableInCart?.InwardDtlId,
- BookedDate: isPaidProductAvailableInCart?.BookedDate,
- BuyInwardDtlId: null,
- Offer: 0,
- });
-
- if (ischeckBothBookingType) {
- await ChangeFreeprodlistFn({
- OverAllFreeQty: freeProdList?.OverAllFreeQty,
- RemainingQty:
- freeProdList?.OverAllFreeQty -
- (ischeckBothBookingType?.OrderQty +
- isPaidProductAvailableInCart?.OrderQty),
- FreeQty:
- ischeckBothBookingType?.OrderQty +
- isPaidProductAvailableInCart?.OrderQty,
- FreeProdId: isPaidProductAvailableInCart?.ProdId,
- OfferId: freeProdList?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: isPaidProductAvailableInCart?.InwardDtlId,
- OfferAmount:
- isPaidProductAvailableInCart?.OrderRate *
- isPaidProductAvailableInCart?.OrderQty,
- FreeQty: isPaidProductAvailableInCart?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- } else {
- await ChangeFreeprodlistFn({
- OverAllFreeQty: item?.OrderQty,
- RemainingQty:
- item?.OrderQty - isPaidProductAvailableInCart?.OrderQty,
- FreeQty: isPaidProductAvailableInCart?.OrderQty,
- FreeProdId: isPaidProductAvailableInCart?.ProdId,
- OfferId: freeProdList?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: isPaidProductAvailableInCart?.InwardDtlId,
- OfferAmount:
- isPaidProductAvailableInCart?.OrderRate *
- isPaidProductAvailableInCart?.OrderQty,
- FreeQty: isPaidProductAvailableInCart?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- }
- }
- } else {
- if (ischeckBothBookingType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidProductAvailableInCart?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- BookedDate: item?.BookedDate,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- OrderRate: item?.OrderRate,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: freeProdList?.OverAllFreeQty,
- RemainingQty: freeProdList?.OverAllFreeQty - item?.OrderQty,
- FreeQty: freeProdList?.FreeQty - item?.OrderQty,
- FreeProdId: freeProdList?.FreeProdId,
- OfferId: freeProdList?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * Quantity), Quantity, true,)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- (freeProdList?.FreeQty - item?.OrderQty) * item?.OrderRate,
- FreeQty: item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- } else {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidProductAvailableInCart?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- BookedDate: item?.BookedDate,
- OrderRate: item?.OrderRate,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: freeProdList?.OverAllFreeQty,
- RemainingQty: freeProdList?.OverAllFreeQty,
- FreeQty: 0,
- FreeProdId: freeProdList?.FreeProdId,
- OfferId: freeProdList?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * Quantity), Quantity, true,)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount: item?.OrderRate * item?.OrderQty,
- FreeQty: item?.OrderQty,
- CompleteRemove: true,
- insideinwardDtlId: true,
- });
- }
- }
- } else {
- let ModifiedOrderCardDetail = JSON.parse(JSON.stringify(tableData));
-
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === item?.InwardDtlId &&
- e?.Offer === item?.Offer &&
- e?.BookingTypeName === item?.BookingTypeName &&
- (!e?.SalesId || OrderType == 'Hold')
- )
- );
- return dispatch(changeOrderCardDetails(data));
- }
- }
- } else {
- const isCheckFreeProductOutside = OfferFreeProduct?.find(
- (exp) => exp?.InwardDtlId == item?.InwardDtlId
- );
-
- if (!isCheckFreeProductOutside) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: item?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- BookedDate: item?.BookedDate,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- OrderRate: item?.OrderRate,
- });
- } else {
- const isCheck = GlobalOfferAppliedProductsData?.find(
- (exp) => exp?.InwardDtlId === item?.InwardDtlId
- );
- const FreeProd = OfferFreeProduct?.find(
- (exp) => exp?.InwardDtlId === item?.InwardDtlId
- );
-
- if (isCheck) {
- let inward =
- isCheck?.FreeProductsList?.[0]?.ProdVariantDetails?.[0]
- ?.StockDetails?.[0]?.FreeInwardDtlId;
-
- let isPaidproduct = tableData?.find(
- (e) =>
- e?.InwardDtlId == inward &&
- e?.Offer == 0 &&
- e?.BookingTypeName == item?.BookingTypeName
- );
- if (isPaidproduct) {
- let ischeckBothBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == inward &&
- e?.Offer > 0 &&
- e?.BookingTypeName != item?.BookingTypeName
- );
-
- //if any Paid Product is there, we have to Merge With That
- if (ischeckBothBookingType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty:
- isPaidproduct?.OrderQty +
- isCheck?.ActualFreeQty -
- ischeckBothBookingType?.OrderQty,
- CompleteRemoveBuyAndAddWithPaid: true,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- BuyInwardDtlId: item?.InwardDtlId,
- BookedDate: item?.BookedDate,
- Offer: item?.Offer,
- });
-
- await ChangeFreeprodlistFn({
- OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
- RemainingQty:
- FreeProd?.OverAllFreeQty -
- item?.OrderQty -
- (FreeProd?.FreeQty - item?.OrderQty),
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: false,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- isPaidproduct?.OrderRate *
- (FreeProd?.FreeQty - item?.OrderQty),
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: false,
- });
- } else {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidproduct?.OrderQty + isCheck?.ActualFreeQty,
- CompleteRemoveBuyAndAddWithPaid: true,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- BuyInwardDtlId: item?.InwardDtlId,
- BookedDate: item?.BookedDate,
- Offer: item?.Offer,
- });
-
- await ChangeFreeprodlistFn({
- OverAllFreeQty: item?.OrderQty,
- RemainingQty: item?.OrderQty - isPaidproduct?.OrderQty,
- FreeQty: isPaidproduct?.OrderQty,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: true,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount: isPaidproduct?.OrderRate * isPaidproduct?.OrderQty,
- FreeQty: isPaidproduct?.OrderQty,
- CompleteRemove: true,
- insideinwardDtlId: false,
- });
- }
- } else {
- //have to find if thereis two Booking Type is there
- //Convert That Free Product To Paid Product
- let ischeckBothBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == inward &&
- e?.Offer > 0 &&
- e?.BookingTypeName != item?.BookingTypeName
- );
-
- let FreeProductSameBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == inward &&
- e?.Offer > 0 &&
- e?.BookingTypeName == item?.BookingTypeName
- );
- if (ischeckBothBookingType) {
- //Convert That Free Product To Paid Product
-
- //merge that paid product with same booking type
- //decrease free prod list qty
- //change offer applied product qty
- // await ChangeOrderCardDetailsFn(item?.BookingTypeName, null, ischeckBothBookingType?.OrderQty + FreeProductSameBookingType?.OrderQty, false, ischeckBothBookingType?.InwardDtlId, item?.InwardDtlId, item?.Offer, true)
- if (FreeProductSameBookingType?.OrderQty >= item?.OrderQty) {
- await ChangeFreeprodlistFn({
- OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
- RemainingQty:
- FreeProd?.OverAllFreeQty -
- item?.OrderQty -
- (FreeProd?.FreeQty - item?.OrderQty),
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: false,
- });
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: item?.OrderQty,
- OrderQty: FreeProductSameBookingType?.OrderQty,
- CompleteRemoveconvertFreetoPaidNotCompletely: true,
- InwardDtlId: inward,
- BuyInwardDtlId: item?.InwardDtlId,
- BookedDate: item?.BookedDate,
- Offer: item?.Offer,
- });
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- (FreeProd?.FreeQty - item?.OrderQty) *
- ischeckBothBookingType?.OrderRate,
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: false,
- });
- } else {
- let data = isCheckFreeProductOutside?.FreeQty - item?.OrderQty;
- //First i Calculate Another Booking Type Qty
- let anotherBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- e?.BookingTypeName != item?.BookingTypeName
- );
- let anotherBookingTypeOffer = tableData?.find(
- (e) =>
- e?.InwardDtlId == inward &&
- e?.Offer > 0 &&
- e?.BookingTypeName != item?.BookingTypeName
- );
-
- let diff =
- item?.OrderQty - FreeProductSameBookingType?.OrderQty;
-
- //SameBookingFreeQty
- //FreeProductSameBookingType?.OrderQty
-
- //Another BookingType Paid Qty
- //anotherBookingType
-
- //anotherBookingType?.Free OrderQty
- //ischeckBothBookingType
-
- //anotherBookingType?.OrderQty-ischeckBothBookingType?.OrderQty
- //convert another Booking Type Qty also Free to Paid
-
- if (
- (anotherBookingType?.OrderQty || 0) <
- anotherBookingTypeOffer?.OrderQty
- ) {
- //paidproduct ischeckBothBookingType?.OrderQty-anotherBookingType?.OrderQty
- //PaidProdcut Current BookingType FreeProductSameBookingType?.OrderQty
- let paidproductAnotherType =
- ischeckBothBookingType?.OrderQty -
- anotherBookingType?.OrderQty;
- let paidproductCurrentType =
- FreeProductSameBookingType?.OrderQty;
-
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: paidproductAnotherType,
- OrderQty: paidproductCurrentType,
- CompleteRemoveconvertFreetoPaidTwoTypes: true,
- InwardDtlId: inward,
- BuyInwardDtlId: item?.InwardDtlId,
- BookedDate: item?.BookedDate,
- Offer: item?.Offer,
- });
-
- await ChangeFreeprodlistFn({
- OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
- RemainingQty:
- FreeProd?.OverAllFreeQty -
- item?.OrderQty -
- (FreeProd?.FreeQty -
- (paidproductCurrentType + paidproductCurrentType)),
- FreeQty:
- FreeProd?.FreeQty -
- (paidproductCurrentType + paidproductCurrentType),
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: false,
- });
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- (FreeProd?.FreeQty - item?.OrderQty) *
- ischeckBothBookingType?.OrderRate,
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: false,
- });
- } else {
- await ChangeFreeprodlistFn({
- OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
- RemainingQty:
- FreeProd?.OverAllFreeQty -
- item?.OrderQty -
- (FreeProd?.FreeQty - item?.OrderQty),
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: false,
- });
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: FreeProductSameBookingType?.OrderQty,
- CompleteRemoveconvertFreetoPaid: true,
- InwardDtlId: inward,
- BuyInwardDtlId: item?.InwardDtlId,
- BookedDate: item?.BookedDate,
- Offer: item?.Offer,
- });
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- (FreeProd?.FreeQty - item?.OrderQty) *
- ischeckBothBookingType?.OrderRate,
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: false,
- });
- }
- }
- } else {
- await ChangeFreeprodlistFn({
- OverAllFreeQty: item?.OrderQty,
- RemainingQty: item?.OrderQty - isPaidproduct?.OrderQty,
- FreeQty: isPaidproduct?.OrderQty,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: true,
- });
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: FreeProductSameBookingType?.OrderQty,
- CompleteRemoveconvertFreetoPaid: true,
- InwardDtlId: inward,
- BuyInwardDtlId: item?.InwardDtlId,
- BookedDate: item?.BookedDate,
- Offer: item?.Offer,
- });
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- (isCheck?.ActualFreeQty -
- FreeProductSameBookingType?.OrderQty) *
- isPaidproduct?.OrderQty,
- FreeQty:
- isCheck?.ActualFreeQty - FreeProductSameBookingType?.OrderQty,
- CompleteRemove: true,
- insideinwardDtlId: false,
- });
- }
- }
- } else {
- let ischeckBothBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- e?.BookingTypeName != item?.BookingTypeName
- );
-
- if (ischeckBothBookingType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: 0,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- BuyInwardDtlId: item?.InwardDtlId,
- BookedDate: item?.BookedDate,
- OrderRate: item?.OrderRate,
- Offer: item?.Offer,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
- RemainingQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
- FreeQty: 0,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: false,
- });
- } else {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: 0,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- BuyInwardDtlId: item?.InwardDtlId,
- BookedDate: item?.BookedDate,
- OrderRate: item?.OrderRate,
- Offer: item?.Offer,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: item?.OrderQty,
- RemainingQty: 0,
- FreeQty: 0,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: true,
- });
- }
- //Remove From Free ProdList That Entirely
- }
- }
- }
- };
- const UnblockSlots = async (newCartItem) => {
- let BlockPostdata = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- ProductList: [
- {
- ProdId: newCartItem?.ProdId,
- InwardDtlId: newCartItem?.InwardDtlId,
- SinglePc: newCartItem?.SinglePc,
- Qty: newCartItem?.OrderQty,
- Date: newCartItem?.BookedDate,
- },
- ],
- Status: 'UnBlock',
- CreatedBy: UserId,
- };
- await dispatch(PostBlockSlots(BlockPostdata)).unwrap();
- };
- const UnblockSlotsAll = async (data) => {
- if (!data?.length) return; // nothing to unblock
-
- // Build ProductList array dynamically
- const ProductList = data.map((item) => ({
- ProdId: item?.ProdId,
- InwardDtlId: item?.InwardDtlId,
- SinglePc: item?.SinglePc,
- Qty: item?.OrderQty,
- Date: item?.BookedDate,
- }));
-
- const BlockPostdata = {
- CompId,
- BranchId,
- AppId,
- ProductList,
- Status: 'UnBlock',
- CreatedBy: UserId,
- };
- try {
- await dispatch(PostBlockSlots(BlockPostdata)).unwrap();
- console.log('✅ All slots unblocked successfully');
- } catch (err) {
- console.error('❌ Failed to unblock slots:', err);
- }
- };
-
- function safeRound(amountStr) {
- if (amountStr == null) return allowDecimal ? '0.00' : '0';
-
- const cleaned = String(amountStr).replace(/[^0-9.-]+/g, '');
- const num = Number(cleaned);
-
- if (isNaN(num)) return allowDecimal ? '0.00' : '0';
-
- return allowDecimal ? num.toFixed(2) : Math.round(num).toString();
- }
- const handleCustomerProductPriceHistory = (item) => {
- setCustomerPriceHistoryOpen(true);
- setCustomerProduct(item?.ProdId);
- };
-
- const getstockbadge = async () => {
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- ...(AvailableDate && selectedDate
- ? {
- fromDate: selectedDate?.[0],
- toDate: selectedDate?.[1],
- }
- : {}),
- };
- await dispatch(getSelectedFavItems(data)).unwrap();
-
- let data1 = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- ProdSubCat: ProdSubCat,
- ...(AvailableDate && selectedDate
- ? {
- fromDate: selectedDate?.[0],
- toDate: selectedDate?.[1],
- }
- : {}),
- };
-
- let data2 = {
- compId: CompId,
- branchId: BranchId,
- appId: AppId,
- prodCat: prodCat,
- ...(AvailableDate && selectedDate
- ? {
- fromDate: selectedDate?.[0],
- toDate: selectedDate?.[1],
- }
- : {}),
- };
-
- if (
- templateData?.BookingLayout?.[1]?.some(
- (item) => item?.OptionName === 'SubCategory'
- ) &&
- ProdSubCat
- ) {
- await dispatch(getLayoutproductCard(data1)).unwrap();
- } else if (
- !templateData?.BookingLayout?.[1]?.some(
- (item) => item?.OptionName === 'SubCategory'
- )
- ) {
- await dispatch(getCardDataWithoutSubmodule(data2)).unwrap();
- } else {
- await dispatch(getCardDataWithoutSub(data2)).unwrap();
- }
- };
- const Clearall = async () => {
- if (OrderType === 'Hold') {
- AvailableDate && UnblockSlotsAll(tableData);
- await dispatch(changeOrderCardDetails([]));
- if (salesBillEdit) {
- getstockbadge();
- dispatch(changeBillEditingMode(false));
- await dispatch(changePreviousOrderPayment([]));
- await dispatch(changePreviousOrderOfferDetail([]));
- } else {
- let putData = { OrderId: [ReportholdData?.OrderId] };
- let response = await dispatch(puttinghold(putData)).unwrap();
- if (response?.data?.statusCode == 1) {
- getstockbadge();
- let holdingData = await dispatch(
- gettinghold({ CompId: CompId, BranchId: BranchId, AppId: AppId })
- ).unwrap();
- if (holdingData?.data?.statusCode === 1) {
- dispatch(changeholddata(holdingData?.data?.data));
- } else {
- dispatch(changeholddata([]));
- }
- }
- }
- await dispatch(ChangeTotalAmount([]));
- await dispatch(changeOrderType(null));
- await dispatch(changeReorderHoldDetails({}));
- } else if (OrderType === 'Reorder') {
- const UpdatedData = tableData?.filter((cartItem) => cartItem?.SalesId);
- const UnOrderData = tableData?.filter((cartItem) => !cartItem?.SalesId);
- AvailableDate && UnblockSlotsAll(UnOrderData);
- if (OfferCheckedInSetup && preferenceOffer) {
- await applyOffer(UpdatedData);
- } else {
- dispatch(changeOrderCardDetails(UpdatedData));
- }
- await dispatch(changeBookingType('Dine In'));
- } else {
- AvailableDate && UnblockSlotsAll(tableData);
- if (OfferCheckedInSetup && preferenceOffer) {
- await applyOffer([]);
- } else {
- dispatch(changeOrderCardDetails([]));
- }
- await dispatch(ChangeTotalAmount([])); //Shifayath Date:27/12/2023
- await dispatch(changeUnpaidData(false));
- await dispatch(changeReorderHoldDetails({}));
- await dispatch(changeReorderProductDetails([]));
- await dispatch(ChangeSelectedCustDisable(false));
- await dispatch(changeSelectedOption(false));
- await dispatch(changeBookingType(defaultBookingType || 'TakeAway'));
- // await dispatch(changeholddata(null))
- await dispatch(changeOrderType());
- }
- await dispatch(ChangeOverAllDiscSales(null));
- await dispatch(ChangeOverAllDiscEstimate(null));
- await dispatch(changeTokenOnly(false));
- await dispatch(changeAllProductTokenAvailable(false));
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- type: 'remove',
- keyValue: 'customer',
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- };
- const OpenEditTotalAmount = () => {
- setOpenEditTotalAmt(true);
- };
- const handleEditTotalAmountCancel = () => {
- setOpenEditTotalAmt(false);
- };
-
- const handleEditQuantity = (value) => {
- if (OtherServicesglobal && value.Type == 'OS' && value.ServiceType == 'I') {
- setEditQuantity(false);
- } else {
- setEditQuantity(true);
- setModaldata(value);
- setIndex(value?.localId);
- }
- };
-
- const to12Hour = (timeStr) => {
- if (!timeStr) return '';
- let [h, m] = timeStr.split(':');
- h = parseInt(h, 10);
- const suffix = h >= 12 ? 'PM' : 'AM';
- h = h % 12 || 12; // 0 → 12
- return `${h}${suffix}`;
- };
-
- const handleEditQuantityCancel = () => {
- setEditQuantity(false);
- };
-
- return (
-
-
-
-
- {tableOptions?.map((item) => (
- <>
- {item.OptionName == 'Sl.No' && BookingTypeBoth && (
-
- {!isMobile ? (
- {''}
- ) : (
- {''}
- )}
-
- )}
- {item.OptionName == 'Sl.No' && (
-
- {!isMobile ? (
- Sl.No
- ) : (
- Sl.No
- )}
-
- )}
- {item.OptionName == 'Item' && (
-
- {!isMobile ? (
- Item
- ) : (
- Item
- )}
-
- )}
- {item.OptionName == 'MRP' && (
-
- {!isMobile ? (
- MRP
- ) : (
- MRP
- )}
-
- )}
- {item.OptionName == 'Discount' && (
-
- {!isMobile ? (
- ₹/%
- ) : (
- ₹/%
- )}
-
- )}
- {item.OptionName == 'Quantity' && (
- {
- if (tableData?.length > 0) {
- OpenEditTotalAmount();
- }
- }}
- // onClick={tableData?.length>0? OpenEditTotalAmount :""}
- >
- {!isMobile ? (
- Qty
- ) : (
- Qty
- )}
-
- )}
- {item.OptionName == 'Rate' && (
-
- {!isMobile ? (
- Rt
- ) : (
- Rt
- )}
-
- )}
- {item.OptionName == 'Amount' && (
-
- {!isMobile ? (
- Amt
- ) : (
- Amt
- )}
-
- )}
-
- {item.OptionName == 'Delete' && (
-
- {tableData?.length > 0 ? (
- {
- Clearall();
- }}
- >
-
- {' '}
- {!isMobile ? (
-
- {' '}
- {' '}
-
- ) : (
-
- )}{' '}
-
-
- ) : (
-
- {' '}
- {!isMobile ? (
-
-
-
- ) : (
-
- )}{' '}
-
- )}
-
- )}
- >
- ))}
-
-
-
- {OldtableDataTakeAway?.length > 0 && (
-
- {OldtableDataTakeAway?.map((item, index) => (
- = PreviousdataLength
- ? 'wheat'
- : BookingType !== 'Dine In' &&
- triggerAnimation &&
- index === 0 &&
- tableDataTakeAway?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'wheat'
- : 'inherit'
- : 'none',
- background:
- item?.SalesId && OrderType !== 'Hold'
- ? 'rgb(243, 248, 213)'
- : GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
- ? '#b2d1f7'
- : index % 2 === 0
- ? 'white'
- : SelectedBillColor?.['OverallBackgroundColor']
- ? SelectedBillColor?.['OverallBackgroundColor']
- : '#d6d6d6',
- animation:
- BillOrderPre === 'Y' && !BookingTypeBoth
- ? triggerAnimation &&
- index === 0 &&
- !item?.SalesId &&
- tableDataTakeAway?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'splashAnimation 0.5s ease-in-out'
- : 'none'
- : 'none',
- }}
- >
- {tableOptions?.map((tableitem) => (
- <>
- {BookingTypeBoth &&
- index == 0 &&
- tableitem.OptionName == 'Sl.No' && (
-
-
-
- )}
- {tableitem.OptionName == 'Sl.No' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {index + 1}
-
- )}
- {tableitem.OptionName == 'Item' && (
-
- item.FullProductIdentifierDtls?.length > 0 ||
- item.ProductIdentifierDtls?.length > 0 ||
- imeiModal
- ? handleImeiDetails(item)
- : editField && handleEditQuantity(item)
- }
- >
- {item.ProdName}
- {item?.BrandName !== null ? item?.BrandName : ''}
- {item?.Type != 'C' && (
- <>
-
- (
- {!item?.ProdVariantName?.toLowerCase()?.includes(
- 'variant'
- ) && {item?.ProdVariantName} }
- {AvailableDate ? (
- <>
- {' '}
- (
- {`${to12Hour(item?.VariantAvailableFrom)} - ${to12Hour(item?.VariantAvailableTo)}`}
- )
- {item?.SinglePc == 'Y' && 'Single'}
- >
- ) : (
- <>
- {item?.Size}
- {item?.SinglePc == 'Y'
- ? 'Single'
- : item?.UomName}
- >
- )}
- )
-
- {item?.OfferMessage &&
- !Array.isArray(item.OfferMessage) && (
-
- {item.OfferMessage?.split('>')?.[0] +
- `> ${item?.OrderQty} Eligible Free`}
-
- )}
- >
- )}
- {item?.Type === 'C' && (
-
- {item.ProdDetail?.map((prod, index) => (
-
- {prod.ProdName} - {prod.Size} {prod.UomName}
-
- ))}
-
- )}
- {productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- ) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
-
- )}
- {tableitem.OptionName == 'MRP' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item?.MRP}
-
- )}
- {tableitem.OptionName == 'Discount' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item?.Type != 'C'
- ? item.Offer && item.Offer > 0
- ? item.Offer
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'
- : item?.OfferPrice && item?.OfferPrice > 0
- ? item?.OfferType === 'F'
- ? `₹${safeRound(item.OfferPrice)}`
- : `${item.OfferPrice}%`
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'}
-
- )}
- {tableitem.OptionName == 'Quantity' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item.OrderQty}
-
- )}
- {tableitem.OptionName == 'Rate' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item?.OrderRate}
-
- )}
- {tableitem.OptionName == 'Amount' && (
- {
- // if (editField) {
- // handleEditQuantity(item);
- // }
- if (GetCustId) {
- handleCustomerProductPriceHistory(item);
- }
- }}
- >
- {Number(
- item?.TotalAmt - (item?.Offer || 0) || 0
- ).toFixed(2)}
-
- )}
-
- {tableitem.OptionName == 'Delete' && (
-
- removeFromCart(item)}
- style={{ color: '#FF4D4F', cursor: 'pointer' }}
- />
-
- )}
- >
- ))}
-
- ))}
-
- {EditQuantity && OldtableDataTakeAway?.length > 0 && (
-
- )}
-
- )}
- {OldtableDataDinein?.length > 0 && (
-
- {OldtableDataDinein?.map((item, index) => (
- = PreviousdataLength
- ? 'wheat'
- : BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length + index === 0 &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'wheat'
- : 'inherit'
- : 'none',
- background: item?.SalesId
- ? 'rgb(243, 248, 213)'
- : GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
- ? '#b2d1f7'
- : (OldtableDataTakeAway?.length + index) % 2 === 0
- ? 'white'
- : SelectedBillColor?.['OverallBackgroundColor']
- ? SelectedBillColor?.['OverallBackgroundColor']
- : '#d6d6d6',
- animation:
- BillOrderPre === 'Y' && !BookingTypeBoth
- ? triggerAnimation &&
- OldtableDataTakeAway?.length + index === 0 &&
- !item?.SalesId &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'splashAnimation 0.5s ease-in-out'
- : 'none'
- : 'none',
- }}
- >
- {tableOptions?.map((tableitem) => (
- <>
- {BookingTypeBoth &&
- index == 0 &&
- tableitem.OptionName == 'Sl.No' && (
-
-
-
- )}
- {tableitem.OptionName == 'Sl.No' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {OldtableDataTakeAway?.length + index + 1}
-
- )}
- {tableitem.OptionName == 'Item' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item.ProdName}
- {item?.BrandName !== null ? item?.BrandName : ''}
- {item?.Type != 'C' && (
- <>
-
- (
- {!item?.ProdVariantName?.toLowerCase()?.includes(
- 'variant'
- ) && {item?.ProdVariantName} }
- {AvailableDate ? (
- <>
- {' '}
- (
- {`${to12Hour(item?.VariantAvailableFrom)} - ${to12Hour(item?.VariantAvailableTo)}`}
- )
- {item?.SinglePc == 'Y' && 'Single'}
- >
- ) : (
- <>
- {item?.Size}
- {item?.SinglePc == 'Y'
- ? 'Single'
- : item?.UomName}
- >
- )}
- )
-
- {item?.OfferMessage &&
- !Array.isArray(item.OfferMessage) && (
-
- {item.OfferMessage?.split('>')?.[0] +
- `> ${item?.OrderQty} Eligible Free`}
-
- )}
- >
- )}
- {item?.Type === 'C' && (
-
- {item.ProdDetail?.map((prod, index) => (
-
- {prod.ProdName} - {prod.Size} {prod.UomName}
-
- ))}
-
- )}
- {productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- ) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
-
- )}
- {tableitem.OptionName == 'MRP' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item?.MRP}
-
- )}
- {tableitem.OptionName == 'Discount' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item?.Type != 'C'
- ? item.Offer && item.Offer > 0
- ? item.Offer
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'
- : item?.OfferPrice && item?.OfferPrice > 0
- ? item?.OfferType === 'F'
- ? `₹${safeRound(item.OfferPrice)}`
- : `${item.OfferPrice}%`
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'}
-
- )}
- {tableitem.OptionName == 'Quantity' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item.OrderQty}
-
- )}
- {tableitem.OptionName == 'Rate' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item?.OrderRate}
-
- )}
- {tableitem.OptionName == 'Amount' && (
- {
- // if (editField) {
- // handleEditQuantity(item);
- // }
- if (GetCustId) {
- handleCustomerProductPriceHistory(item);
- }
- }}
- >
- {Number(
- item?.TotalAmt - (item?.Offer || 0) || 0
- ).toFixed(2)}
-
- )}
-
- {tableitem.OptionName == 'Delete' && (
-
- removeFromCart(item)}
- style={{ color: '#FF4D4F', cursor: 'pointer' }}
- />
-
- )}
- >
- ))}
-
- ))}
-
- {OldtableDataDinein?.length > 0 && EditQuantity && (
-
- )}
-
- )}
- {tableDataTakeAway?.length > 0 && (
-
- {tableDataTakeAway?.map((item, index) => (
- = PreviousdataLength
- ? 'wheat'
- : BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
- tableDataTakeAway?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'wheat'
- : (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
- ? 'white'
- : SelectedBillColor?.['OverallBackgroundColor']
- ? SelectedBillColor?.['OverallBackgroundColor']
- : '#d6d6d6'
- : (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
- ? 'white'
- : SelectedBillColor?.['OverallBackgroundColor']
- ? SelectedBillColor?.['OverallBackgroundColor']
- : '#d6d6d6',
- //change
- background:
- BookingType === 'Dine In' && item?.SalesId
- ? 'rgb(243, 248, 213)'
- : GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
- ? '#b2d1f7'
- : (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
- ? 'white'
- : SelectedBillColor?.['OverallBackgroundColor']
- ? SelectedBillColor?.['OverallBackgroundColor']
- : '#d6d6d6',
- animation:
- BillOrderPre === 'Y' && !BookingTypeBoth
- ? triggerAnimation &&
- OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
- !item?.SalesId &&
- tableDataTakeAway?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'splashAnimation 0.5s ease-in-out'
- : 'none'
- : 'none',
- }}
- >
- {tableOptions?.map((tableitem) => (
- <>
- {BookingTypeBoth &&
- index == 0 &&
- tableitem.OptionName == 'Sl.No' && (
-
-
-
- )}
- {tableitem?.OptionName == 'Sl.No' && (
- {
- if (editField) {
- handleEditQuantity(item, index);
- }
- }}
- >
- {OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index +
- 1}
-
- )}
- {tableitem?.OptionName == 'Item' && (
-
- item.FullProductIdentifierDtls?.length > 0 ||
- item.ProductIdentifierDtls?.length > 0 ||
- imeiModal
- ? handleImeiDetails(item)
- : editField && handleEditQuantity(item, index)
- }
- >
- {item?.Type !== 'OS' ? item.ProdName : item.ServiceName}
- {item?.BrandName !== null ? item?.BrandName : ''}
- {item?.Type != 'C' && (
- <>
-
- {/* (
- {!item?.ProdVariantName?.toLowerCase()?.includes(
- 'variant'
- ) && {item?.ProdVariantName} }
- {item?.Size}
- {item?.SinglePc == 'Y' ? 'PCS' : item?.UomName}) */}
- {item?.Type !== 'OS' && (
- <>
- {!item?.ProdVariantName?.toLowerCase()?.includes(
- 'variant'
- ) && {item?.ProdVariantName} }
-
- {AvailableDate ? (
- <>
- {' '}
- (
- {`${to12Hour(item?.VariantAvailableFrom)} - ${to12Hour(item?.VariantAvailableTo)}`}
- )
- {item?.SinglePc == 'Y' && 'Single'}
- >
- ) : (
- <>
- {item?.Size}
- {item?.SinglePc == 'Y'
- ? 'Single'
- : item?.UomName}
- >
- )}
- >
- )}
-
- {item?.OfferMessage &&
- !Array.isArray(item.OfferMessage) && (
-
- {item.OfferMessage?.split('>')?.[0] +
- `> ${item?.OrderQty} Eligible Free`}
-
- )}
- >
- )}
- {item?.Type === 'C' && (
-
- {item.ProdDetail?.map((prod, index) => (
-
- {prod.ProdName} - {prod.Size} {prod.UomName}
-
- ))}
-
- )}
- {productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- ) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
-
- )}
- {tableitem.OptionName == 'MRP' && (
- {
- if (editField) {
- handleEditQuantity(item, index);
- }
- }}
- >
- {item?.MRP}
-
- )}
- {tableitem.OptionName == 'Discount' && (
- {
- if (editField) {
- handleEditQuantity(item, index);
- }
- }}
- >
- {item?.Type != 'C'
- ? item.Offer && item.Offer > 0
- ? item.Offer
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'
- : item?.OfferPrice && item?.OfferPrice > 0
- ? item?.OfferType === 'F'
- ? `₹${safeRound(item.OfferPrice)}`
- : `${item.OfferPrice}%`
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'}
-
- )}
- {tableitem.OptionName == 'Quantity' && (
- {
- if (editField) {
- handleEditQuantity(item, index);
- }
- }}
- >
- {item?.OrderQty}
-
- )}
- {tableitem.OptionName == 'Rate' && (
- {
- if (editField) {
- handleEditQuantity(item, index);
- }
- }}
- >
- {item?.OrderRate}
-
- )}
- {tableitem.OptionName == 'Amount' && (
- {
- // if (editField) {
- // handleEditQuantity(item, index);
- // }
- if (GetCustId) {
- handleCustomerProductPriceHistory(item);
- }
- }}
- >
- {Number(
- item?.TotalAmt - (item?.Offer || 0) || 0
- ).toFixed(2)}
-
- )}
-
- {tableitem.OptionName == 'Delete' && (
-
- removeFromCart(item)}
- style={{ color: '#FF4D4F', cursor: 'pointer' }}
- />
-
- )}
- >
- ))}
-
- ))}
-
- {tableDataTakeAway?.length > 0 && EditQuantity && (
-
- )}
-
- )}
- {tableDataDinein?.length > 0 && (
-
- {tableDataDinein?.map((item, index) => (
- = PreviousdataLength
- ? 'wheat'
- : BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'wheat'
- : 'inherit'
- : 'none',
- background:
- BookingType === 'Dine In' &&
- item?.SalesId &&
- !BookingTypeBoth
- ? 'rgb(243, 248, 213)'
- : GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
- ? '#b2d1f7'
- : (OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index) %
- 2 ===
- 0
- ? 'white'
- : SelectedBillColor?.['OverallBackgroundColor']
- ? SelectedBillColor?.['OverallBackgroundColor']
- : '#d6d6d6',
- animation:
- BillOrderPre === 'Y' && !BookingTypeBoth
- ? triggerAnimation &&
- OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
- !item?.SalesId &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'splashAnimation 0.5s ease-in-out'
- : 'none'
- : 'none',
- }}
- >
- {tableOptions?.map((tableitem) => (
- <>
- {BookingTypeBoth &&
- index == 0 &&
- tableitem.OptionName == 'Sl.No' && (
-
-
-
- )}
- {tableitem.OptionName == 'Sl.No' && (
- {
- if (editField) {
- handleEditQuantity(item, index);
- }
- }}
- >
- {tableDataTakeAway?.length +
- OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index +
- 1}
-
- )}
- {tableitem.OptionName == 'Item' && (
- {
- if (editField) {
- handleEditQuantity(item, index);
- }
- }}
- >
- {item.ProdName}
- {item?.BrandName !== null ? item?.BrandName : ''}
- {item?.Type != 'C' && (
- <>
-
- (
- {!item?.ProdVariantName?.toLowerCase()?.includes(
- 'variant'
- ) && {item?.ProdVariantName} }
- {AvailableDate ? (
- <>
- {' '}
- (
- {`${to12Hour(item?.VariantAvailableFrom)} - ${to12Hour(item?.VariantAvailableTo)}`}
- )
- {item?.SinglePc == 'Y' && 'Single'}
- >
- ) : (
- <>
- {item?.Size}
- {item?.SinglePc == 'Y'
- ? 'Single'
- : item?.UomName}
- >
- )}
- )
-
- {item?.OfferMessage &&
- !Array.isArray(item.OfferMessage) && (
-
- {item.OfferMessage?.split('>')?.[0] +
- `> ${item?.OrderQty} Eligible Free`}
-
- )}
- >
- )}
- {item?.Type === 'C' && (
-
- {item.ProdDetail?.map((prod, index) => (
-
- {prod.ProdName} - {prod.Size} {prod.UomName}
-
- ))}
-
- )}
- {productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- ) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
-
- )}
- {tableitem.OptionName == 'MRP' && (
- {
- if (editField) {
- handleEditQuantity(item, index);
- }
- }}
- >
- {item?.MRP}
-
- )}
- {tableitem.OptionName == 'Discount' && (
- {
- if (editField) {
- handleEditQuantity(item, index);
- }
- }}
- >
- {item?.Type != 'C'
- ? item.Offer && item.Offer > 0
- ? item.Offer
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'
- : item?.OfferPrice && item?.OfferPrice > 0
- ? item?.OfferType === 'F'
- ? `₹${safeRound(item.OfferPrice)}`
- : `${item.OfferPrice}%`
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'}
-
- )}
- {tableitem.OptionName == 'Quantity' && (
- {
- if (editField) {
- handleEditQuantity(item, index);
- }
- }}
- >
- {item.OrderQty}
-
- )}
- {tableitem.OptionName == 'Rate' && (
- {
- if (editField) {
- handleEditQuantity(item, index);
- }
- }}
- >
- {item?.OrderRate}
-
- )}
- {tableitem.OptionName == 'Amount' && (
- {
- // if (editField) {
- // handleEditQuantity(item);
- // }
- if (GetCustId) {
- handleCustomerProductPriceHistory(item);
- }
- }}
- >
- {Number(
- item?.TotalAmt - (item?.Offer || 0) || 0
- ).toFixed(2)}
-
- )}
-
- {tableitem.OptionName == 'Delete' && (
-
- removeFromCart(item)}
- style={{ color: '#FF4D4F', cursor: 'pointer' }}
- />
-
- )}
- >
- ))}
-
- ))}
-
- {tableDataDinein?.length > 0 && EditQuantity && (
-
- )}
-
- )}
-
- {OpenEditTotalAmt && (
-
- )}
- {OpenImeiDetail && (
-
- )}
- {customerPriceHistoryOpen && GetCustId && (
-
- )}
-
- );
-};
-
-export default BSBillingTable4;
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4Full.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4Full.jsx
deleted file mode 100644
index 14a3b7e..0000000
--- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4Full.jsx
+++ /dev/null
@@ -1,85 +0,0 @@
-import React from 'react';
-import { useSelector } from 'react-redux';
-import BSBilling4Payment from './BSBilling4Payment';
-import { getTemplateData } from '../../../../../Features/ThemeChange/ThemeChange';
-import { isMobile } from 'react-device-detect';
-import { GlobalExpDateforHeight } from '../../../../../Features/BookingScreen/BookingData/BookingData';
-import BSBillingTable3 from '../BSBillingTable3/BSBillingTable3';
-
-const BSBillingTable4Full = () => {
- const templateData = useSelector(getTemplateData);
- const ExpDate = useSelector(GlobalExpDateforHeight);
- let containerHeight = '';
-
- if (templateData?.BookingLayout?.[0] === 'Layout1') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '480px'
- : '470px' //billing table 4 height in POS -- Layout 1
- : ExpDate <= 7
- ? '82vh'
- : '';
- } else if (templateData?.BookingLayout?.[0] === 'Layout5') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '480px'
- : '475px'
- : ExpDate <= 7
- ? '85vh'
- : '';
- } else if (templateData?.BookingLayout?.[0] === 'Layout6') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '420px'
- : '410px'
- : ExpDate <= 7
- ? '72.5vh'
- : '';
- } else if (templateData?.BookingLayout?.[0] === 'Layout4') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '500px'
- : '475px'
- : ExpDate <= 7
- ? '85vh'
- : '';
- } else if (templateData?.BookingLayout?.[0] === 'Layout2') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '490px'
- : '475px' // billing table 4 height in POS -- Layout 2
- : ExpDate <= 7
- ? '84vh'
- : '';
- } else if (templateData?.BookingLayout?.[0] === 'Layout3') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '480px'
- : '460px'
- : ExpDate <= 7
- ? '82vh'
- : '';
- }
-
- return (
- <>
-
- >
- );
-};
-export default BSBillingTable4Full;
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable5.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable5.jsx
deleted file mode 100644
index 33450db..0000000
--- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable5.jsx
+++ /dev/null
@@ -1,4011 +0,0 @@
-import React, { useEffect, useState, useRef, lazy } from 'react';
-import { shallowEqual, useDispatch, useSelector } from 'react-redux';
-import moment from 'moment';
-import { Popover, Badge, Modal, Tooltip } from 'antd';
-import { useNavigate } from 'react-router-dom';
-import {
- ArrowRightOutlined,
- UpCircleOutlined,
- DownCircleOutlined,
-} from '@ant-design/icons';
-import { AiOutlineClose } from 'react-icons/ai';
-import paygate from '../../../../../Images/paygate.png';
-import defaultupi from '../../../../../Images/defaultupi.png';
-import pozologoimg from '../../../../../Images/pozologoimg.png';
-import paydevice from '../../../../../Images/paydevice.png';
-import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable15.scss';
-import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTables3/BSBillingTable3.scss';
-import { isMobile } from 'react-device-detect';
-import {
- GlobalSelectedFont,
- getTemplateData,
- SelectedPrintTemplate,
- StoredSessionData,
- GlobalprintDatas,
- GlobalPrinterMappingDtls,
- getPrinterMappingDetails,
- getPrintSelectionComponentData,
-} from '../../../../../Features/ThemeChange/ThemeChange';
-import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js';
-import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities';
-const BSSummery1 = lazy(
- () => import('../../BSBillingTables/BSBillingTableSummery/BSSummery')
-);
-import { Messages } from '../../../../../Components/Notifications/Messages';
-import {
- GlobalOrderCardDetails,
- changeOrderCardDetails,
- GlobalBookingType,
- getConfigType,
- GlobalCustId,
- GlobalSelectedTableDetails,
- GlobalReorderHoldDetails,
- changeBookingType,
- PostBookingData,
- PutBookingData,
- ChangeNavHoldData,
- GlobalNavHoldData,
- changeReorderHoldDetails,
- getUnpaidData,
- getSelectedFavItems,
- GlobalProductSubCategorie,
- getCardDataWithoutSub,
- getCardDataWithoutSubmodule,
- GlobalProductCategorie,
- changeSelectedCustId,
- GlobalSelCustId,
- getLayoutproductCard,
- changeSelectedOption,
- GlobalSelOption,
- changeCustomerID,
- changeUnpaidData,
- ChangeSelectedCustDisable,
- getSalesDetailData,
- GlobalSelectedCustDisable,
- SendPaymentLink,
- changeSummeryTotalAmount,
- GlobalExpDateforHeight,
- changeUpiIDprint,
- changeSummeryTotalItems,
- changeSummeryQty,
- changeSummeryTotalWithoutTaxAmount,
- changeSummeryTotalTaxAmount,
- GlobalEstimateBooking,
- GlobalSelProdWiseEst,
- changeSelProdWiseEst,
- GlobalUpiIDprint,
- GlobalUpiIDName,
- GlobalUpiIDoptionId,
- GlobalBookingTypeBoth,
- changeSelectTable,
- changeSelectChair,
- changeSelectedTableDetails,
- changeReorderProductDetails,
- GlobalCommonPaymentOptions,
- changeUpiIDName,
- changeUpiIDoptionId,
- PostPaymentdevice,
- GetPaymentdeviceResponse,
- PutBookingPaymentStatusChange,
- changePaymentloader,
- GlobalPayementloader,
- PaymentGatewayGetdetail,
- changePaymentTransactionNumber,
- Globalunpaidflow,
- changeunpaidflow,
- PutPendingPaymentList,
- ChangeInitialPaymentName,
- PreferenceData,
- changeOrderType,
- GlobalOrderType,
- GlobalFailedTotalAmt,
- putSplitpaymentStatus,
- GlobalScreenSize,
- GlobalUnpaidListData,
- GlobalOverAllDiscEstimate,
- GlobalOverAllDiscSales,
- ChangeOverAllDiscSales,
- ChangeOverAllDiscEstimate,
- GlobalBranchFinancialStatus,
- changeSummeryComboOfferAmount,
- ChangeComboCarddata,
- GlobaltipAmount,
- changeTipAmount,
- GlobalOtherSevices,
- GlobalOtherServiceTicketClaim,
- changeOtherServiceTicketClaim,
- GlobalRetailWSSalesType,
- GlobalDefaultBookingType,
- GlobalPaymentTrigger,
- GlobalCurrentOrderId,
- changeCurrentOrderId,
- GlobalCombocarddata,
- getCreditCustomer,
- GlobalSalesBillEdit,
- GlobalPreviousOrderPayment,
- GlobalPreviousOrderOfferDetails,
- GlobalpaymentOptionData,
- getPaymentOptions,
- putSalesBillEdit,
- changeBillEditingMode,
- changePreviousOrderPayment,
- changePreviousOrderOfferDetail,
- GlobalAllBookingType,
- changeSearchedData,
-} from '../../../../../Features/BookingScreen/BookingData/BookingData';
-import { ChangeTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges.js'; //Shifayth Date:27/12/2023
-import {
- gettinghold,
- globalholddata,
- changeholddata,
-} from '../../../../../Features/BookingScreen/HoldOption/HoldOption';
-import { globalExtraTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges';
-import {
- encryptObject,
- extractLastNumberOrderId,
- printDiv,
-} from '../../../../../Services/Others';
-import { DefaultModal } from '../../../../../Components/Modal/DefaultModal.jsx';
-import { Tables } from '../../../../../Components/Tables/Table';
-import {
- getAddCustomerDetails,
- getDefaultPaymentOptions,
- GlobalAddCustomerDetails,
- triggerCustomerRefresh,
- VerifiedPaymentDtl,
-} from '../../../../../Features/BookingScreen/Customer/addCustomer';
-import BSCustomerSelect from '../../UtillComponents/BSSelectCustomer.jsx';
-import PozoUnpaidIcon from '../../UtillComponents/Pozo retail icons/PozoUnpaidIcon.jsx';
-import PozoBillIcon from '../../UtillComponents/Pozo retail icons/PozoBIllIcon.jsx';
-import PozoAddCustomerIcon from '../../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx';
-import Buttons from '../../../../../Components/Forms/Buttons';
-import WpIcon from '../../../../../Images/message.png';
-import PozoAdvanceIcon from '../../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx';
-import CountUp from 'react-countup';
-import { GlobalpreOrderOpen } from '../../../../../Features/BookingScreen/PreOrder/PreOrder.js';
-import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
-import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js';
-import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx';
-import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx';
-import {
- Global_OrderOfferDetail,
- Global_OverallOfferAmount,
-} from '../../../../../Features/Offer/Offer.js';
-import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
-import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip';
-import { useAuth } from '../../../../../AuthContext.jsx';
-import { GlobalBookingStatus } from '../../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js';
-import {
- changeSalesPaymentoption,
- GlobalSalesPaymentoption,
-} from '../../../../../Features/Payment/Paymentoptions/Paymentoptions.js';
-import { getPaymentOptionsData } from '../../../../../Features/BookingScreen/BookingData/KioskBookingData.js';
-import { getCombolist } from '../../../../../Features/ComboMaster/ComboMaster.js';
-import { MdSms } from 'react-icons/md';
-import { FaWhatsapp, FaPrint, FaCartPlus } from 'react-icons/fa';
-import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js';
-import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js';
-import { TfiClipboard } from 'react-icons/tfi';
-import { PublicQrCodepost } from '../../../../../Features/ConfigMasterPage/ConfigMasterPage.js';
-import {
- ChangeFullFreeProductList,
- changeFullOfferAppliedProducts,
- changeLoyaltyConsumedQuantities,
- GlobalFreeProdList,
- GlobalOfferAppliedProducts,
- GlobalOverAllOfferAmt,
-} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
-import CardPopover from '../StandardTable/Utils/CardPopover.jsx';
-import UpiPopover from '../StandardTable/Utils/UpiPopOver.jsx';
-import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js';
-import OtherServiceMobilePrint from '../../BookingFunctionality/OtherServiceMobilePrint.jsx';
-import BSBillingTable3 from '../BSBillingTable3/BSBillingTable3.jsx';
-import BSBillingTable3Pay from '../BSBillingTable3/BSBillingTable3pay.jsx';
-// Jsx Files
-const OtherServicePrintStyle1 = lazy(
- () =>
- import('../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx')
-);
-const BSOtherServiceClaim = lazy(
- () => import('../../UtillComponents/BSOtherServiceClaim.jsx')
-);
-const WhatsAppShare = lazy(
- () => import('../../../../WhatsAppShare/whatsAppShare.jsx')
-);
-const BsBill = lazy(() => import('./BsBill'));
-
-const SMSShare = lazy(() => import('../../../../WhatsAppShare/SmsShare.jsx'));
-
-const PaymentPdfBooking = lazy(
- () => import('../../../../paymentpdfPage/PaymentPdfBooking')
-);
-const PozoDineInIcon = lazy(
- () => import('../../UtillComponents/Pozo retail icons/PozoDineIn.jsx')
-);
-const QrComponent = lazy(
- () => import('../../BookingFunctionality/DynamicQr.jsx')
-);
-const QrinScreen = lazy(
- () => import('../../BookingFunctionality/DynamicScreenQr.jsx')
-);
-const BsBillingCreditCustomer = lazy(
- () => import('../../BookingFunctionality/BSBillingCreditCustomer.jsx')
-);
-const BSCreditCustomer = lazy(
- () => import('../../UtillComponents/BSCreditCustomer.jsx')
-);
-const MobilePrint = lazy(
- () => import('../../BookingFunctionality/MobilePrint.jsx')
-);
-const SplitPayment = lazy(
- () => import('../../BookingFunctionality/SplitPayment.jsx')
-);
-const TokensinglePrint = lazy(
- () =>
- import('../../../../paymentpdfPage/TokenOnlyPrints/TokeninsinglePrint.jsx')
-);
-const SingleTokenMobilePrint = lazy(
- () => import('../../BookingFunctionality/SingleTokenMobilePrint.jsx')
-);
-const IndividualTokenMobilePrint = lazy(
- () => import('../../BookingFunctionality/IndividualTokenMobilePrint.jsx')
-);
-const MobileMultiPdfPrintTrigger = lazy(
- () => import('../../UtillComponents/MobileMultiPdfPrintTrigger.jsx')
-);
-const CustomerOrders = lazy(
- () => import('../../BookingFunctionality/CustomerOrders.jsx')
-);
-const Paymentoption = lazy(
- () => import('../../../../Payment/PaymentOptions/PaymentOptions.jsx')
-);
-const BSTipAmount = lazy(() => import('../../UtillComponents/BSTipAmount.jsx'));
-const PaymentGatewayEmbedded = lazy(
- () => import('../../UtillComponents/PaymentGatewayEmbedded.jsx')
-);
-
-const subDirectory = import.meta.env.ENV_BASE_URL;
-const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
-
-const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
-
-const BSBillingTable5 = () => {
- const isF4Pressed = useRef(false);
- const applyOffer = useApplyOfferto_CardDetail();
- const screenwidth = useSelector(GlobalScreenSize);
- const { SadminuserAccess } = useAuth();
- let SAAccessCommonMaster = SadminuserAccess?.find(
- (e) => e?.MenuName === 'Sales'
- );
- const dispatch = useDispatch();
- const navigate = useNavigate();
- const SessionData = useSelector(StoredSessionData);
- const AppId = SessionData?.AppId;
- const CompId = SessionData?.CompId;
- const BranchId = SessionData?.BranchId;
- const UserId = SessionData?.UserId;
- const UserType = SessionData?.UserType;
- const AllBookingType = useSelector(GlobalAllBookingType);
- const salesBillEdit = useSelector(GlobalSalesBillEdit);
- const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
- const previousOrderOfferDetails = useSelector(
- GlobalPreviousOrderOfferDetails
- );
- const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
- const Discount = useSelector(GlobalOverAllOfferAmt);
- const FreeProdList = useSelector(GlobalFreeProdList);
- const offerAppliedProducts = useSelector(GlobalOfferAppliedProducts);
- const appPreferences = useSelector(ApplicationPreferences);
- const defaultBookingType = useSelector(GlobalDefaultBookingType);
- const bookingTypePreference = appPreferences?.find(
- (preference) => preference?.PreferredCatName === 'Booking Type'
- )?.PreferenceCatDetails;
- const dinePreference = bookingTypePreference?.find(
- (type) =>
- type?.PreferredSubCatName?.toLowerCase() === 'dine in' &&
- type?.PreferredStatus === 'Y'
- );
- const printerTemplateStyle = useSelector(SelectedPrintTemplate);
- const OrderCardDetail = useSelector(GlobalOrderCardDetails);
- const GlobalAddCustomerDetails1 = useSelector(GlobalAddCustomerDetails);
- const globalTipAmount = useSelector(GlobaltipAmount);
- const OtherServiceTicketClaim = useSelector(GlobalOtherServiceTicketClaim);
- const Holddata = useSelector(globalholddata);
- const FontFamily = useSelector(GlobalSelectedFont);
- const GetCustId = useSelector(GlobalCustId);
- const SelCustId = useSelector(GlobalSelCustId);
- const selOption = useSelector(GlobalSelOption);
- const RetailWSSalesType = useSelector(GlobalRetailWSSalesType);
- const [PaymentOptions, setPaymentOptions] = useState([]);
- const [PaymentUpiOptions, setPaymentUpiOptions] = useState([]);
- const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
- const NavHoldData = useSelector(GlobalNavHoldData);
- const SelectedTableDetails = useSelector(GlobalSelectedTableDetails);
- const BookingType = useSelector(GlobalBookingType);
- const BookingTypeBoth = useSelector(GlobalBookingTypeBoth);
- const SettingDataSelector = useSelector(PreferenceData);
- const Combodata = useSelector(GlobalCombocarddata, shallowEqual);
- const allowDecimal = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'decimal' &&
- setting?.SettingValue === 'Y'
- );
- const Weightasquantity = SettingDataSelector?.[0]?.SettingDtlDetails?.some(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'weightasquantity' &&
- setting?.SettingValue === 'Y'
- );
- const Custombill = SettingDataSelector?.[0]?.SettingDtlDetails?.some(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'customisedbillnumber' &&
- setting?.SettingValue === 'Y'
- );
- const preferenceOffer =
- SettingDataSelector?.[0]?.['SettingDtlDetails']?.find(
- (item) => item.SettingIdName === 'Offer'
- )?.SettingValue === 'Y';
- const GlobalUpName = useSelector(GlobalUpiIDName);
- const GlobalUpiIDoptionIdd = useSelector(GlobalUpiIDoptionId);
- const OrderOfferDetail = useSelector(Global_OrderOfferDetail, shallowEqual);
- const GlobalUpiID = useSelector(GlobalUpiIDprint);
- const prodCat = useSelector(GlobalProductCategorie);
- const ProdSubCat = useSelector(GlobalProductSubCategorie);
- const templateData = useSelector(getTemplateData);
- const [urlData, setUrlData] = useState();
- const OfferCheckedInSetup = templateData?.BookingNavbar?.[1].some(
- (item) => item?.OptionName == 'Offer'
- );
- const tableOptions = templateData?.BookingBilling?.[1];
- const NavBarOptions = templateData?.BookingNavbar?.[1];
- const ReportholdData = useSelector(GlobalReorderHoldDetails);
- const Custdisable = useSelector(GlobalSelectedCustDisable);
- const GlobEstBooking = useSelector(GlobalEstimateBooking);
- const GlobProdwisedata = useSelector(GlobalSelProdWiseEst);
- const preOrder = useSelector(GlobalpreOrderOpen);
- const OrderType = useSelector(GlobalOrderType);
- const FailedTotalAmt = useSelector(GlobalFailedTotalAmt);
- const BranchFinancialStatus = useSelector(GlobalBranchFinancialStatus);
- const GlobalSalesPaymentoptions = useSelector(GlobalSalesPaymentoption);
- const OverAllSales = useSelector(GlobalOverAllDiscSales);
- const OverAllEstimate = useSelector(GlobalOverAllDiscEstimate);
-
- const [paybtns, setpaybtns] = useState([]);
- const printDatas = useSelector(GlobalprintDatas);
- const PrinterDetails = useSelector(GlobalPrinterMappingDtls);
-
- const [refundPayBtns, setRefundPayBtns] = useState([]);
- const [refundPaySelected, setRefundPaySelected] = useState();
- const [refundPaySelectedName, setRefundPaySelectedName] = useState(null);
- const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0);
- const [previousNetAmount, setPreviousNetAmount] = useState(0);
- const [paybtnselected, setPaybtnselected] = useState();
- const [Paybtnnameselected, setPaybtnnameselected] = useState();
- const [SelectedBookingType, setSelectedBookingType] = useState(null);
- const [FirstPaymentclick, setFirstPaymentclick] = useState(false);
- const [SelectedCardOption, setSelectedCardOption] = useState(null);
- const [SelectedUPIPayOption, setSelectedUPIPayOption] = useState('Default');
- const [UpiOptionOpen, setUpiOptionOpen] = useState(false);
- const [CardOptionOpen, setCardOptionOpen] = useState(false);
- const [SelectedUpiOption, setSelectedUpiOption] = useState();
- const [UpiOption, setUpiOption] = useState('');
- const [BusinessPayOption, setBusinessPayoption] = useState([]);
- const [paymentSucess, setPaymentSuccess] = useState(false);
- const [businessUPI, setBusinessUPI] = useState(false);
- const [businessUPIOrderId, setBusinessUPIOrderId] = useState(null);
- const [businessUPILink, setBusinessUPILink] = useState(null);
- const [UpiId, setUpiId] = useState();
- const [hold, setHold] = useState(false);
- const [addcustomer, setAddCustomer] = useState(false);
- const [qrCode, setQrCode] = useState(false);
- const [formattedDate, setFormattedDate] = useState('');
- const [open2, setOpen2] = useState(false);
- const [PrintOrderDetails, setPrintOrderDetails] = useState([]);
- const [messageType, setMessageType] = useState(null);
- const [messageData, setMessageData] = useState(null);
- const tabledata = useSelector(GlobalUnpaidListData);
- const [unpaidopen, setUnpaidOpen] = useState(false);
- const unpaidFlow = useSelector(Globalunpaidflow);
- const [CreditCustomer, setCreditCustomer] = useState(false);
- const [isUp, setIsUp] = useState(true);
- const ExpDate = useSelector(GlobalExpDateforHeight);
- const [UpinotSelected, setUpinotSelected] = useState(false);
- const [CardoptionnotSelected, setCardoptionnotSelected] = useState(false);
- const [PaymentgatewayCard, setPaymentgatewayCard] = useState([]);
- const [PaymentDeviceCard, setPaymentDeviceCard] = useState([]);
- const [PaymentgatewayUPI, setPaymentgatewayUPI] = useState([]);
- const [PaymentDeviceUPI, setPaymentDeviceUPI] = useState([]);
- const [UpiPayOption, setUpiPayOption] = useState([]);
- const [CardPayOption, setCardPayOption] = useState([]);
- const [Splitpayment, setSplitpayment] = useState(false);
- const [Success, SetSuccess] = useState();
- const [brachName, setbrachName] = useState('');
- const [UpiOpen, setUpiOpen] = useState(false);
- const [ConfigDataList, setConfigDataList] = useState([]);
- const [credit, setCredit] = useState(false);
- const [overAllBal, setOverAllBal] = useState(0);
- const [creditCustomerOpen, setcreditCustomerOpen] = useState(false);
- const [OrderStatus, setOrderStatus] = useState(true);
- const GlobaluseOptions = useSelector(GlobalCommonPaymentOptions);
- const [useOptions, setuseOptions] = useState([]);
- const paymentloader = useSelector(GlobalPayementloader);
- const [UnpaidConfirmation, setUnpaidConfirmation] = useState(false);
- const [unpaidselectedindex, setunpaidselectedindex] = useState();
- const [failedOrderData, setFailedOrderData] = useState();
- const [empData, setEmpData] = useState();
- const [addnewAccess, setaddnewAccess] = useState(true);
- const [responsiveBill, setResponsiveBill] = useState(true);
- const [blink, setBlink] = useState(false);
- const BookingStatus = useSelector(GlobalBookingStatus);
- const [TotalAmount, setTotalAmount] = useState(0);
- const OverallOfferAmount = useSelector(Global_OverallOfferAmount);
- const [showWhatsAppShare, setShowWhatsAppShare] = useState(false);
- const [showSMSShare, setSMSShare] = useState(false);
- const defaultPaymentTrigger = useSelector(GlobalPaymentTrigger);
- const [defaultPaymentMode, setDefaultPaymentMode] = useState([]);
- const [defaultEnabled, setDefaultEnabled] = useState(false);
- const [customerPreviesOrders, setCustomerPreviesOrders] = useState(false);
- // Usage
- const allowedNames = ['whatsapp', 'Print', 'SMS'];
- const [MobileNoWhatsApp, setMobileNoWhatsApp] = useState();
-
- const OtherServicesglobal = useSelector(GlobalOtherSevices);
- const [OtherServicesModal, setOtherServicesModal] = useState(false);
- const [vehicleInputs, setVehicleInputs] = useState({});
- const [errors, setErrors] = useState({});
- const [OtherServicesPrintDetails, setOtherServicesPrintDetails] = useState(
- []
- );
- const [showCancelConfirm, setShowCancelConfirm] = useState(false);
-
- const PaymentOptionsModeName =
- PaymentOptions?.find((e) => e.ModeDefault?.toUpperCase() === 'Y')
- ?.ModeName || PaymentOptions?.[0]?.ModeName;
- const PaymentOptionsModeId =
- PaymentOptions?.find((e) => e.ModeDefault?.toUpperCase() === 'Y')?.ModeId ||
- PaymentOptions?.[0]?.ModeId;
-
- const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
- (i) => i.SettingIdName === 'PrintUom'
- )?.[0];
- const Estimation = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (item) => item.SettingIdName == 'Estimation'
- );
- const CheckOrderType = OrderCardDetail?.filter(
- (a) => a?.BookingTypeName !== BookingType
- );
- const ParkingDisplay = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'parking' &&
- setting?.SettingValue === 'Y'
- );
- const MobileA4Print = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'mobilea4' &&
- setting?.SettingValue === 'Y'
- );
- const UpiQRPreference = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'upiqr' &&
- setting?.SettingValue === 'Y'
- );
-
- const CheckBookingStatus =
- BookingStatus?.find((item) => item.ScreenType === 'Booking')
- ?.ScreenStatus ?? 'Open';
-
- const TokenOnly = SettingDataSelector?.[0]?.SettingDtlDetails?.filter(
- (i) => i.SettingIdName === 'TokenOnly'
- )?.[0];
- const IndividualToken = SettingDataSelector?.[0]?.SettingDtlDetails?.filter(
- (i) => i.SettingIdName === 'AllProductindividualToken'
- )?.[0];
- const preferenceshortcutkey = SettingDataSelector?.[0]?.[
- 'SettingDtlDetails'
- ]?.some(
- (item) =>
- item.SettingIdName.toLowerCase() === 'shortcutkeys' &&
- item.SettingValue === 'Y'
- );
- const TotalItems = OrderCardDetail?.length;
- const Qty = OrderCardDetail?.reduce((acc, item) => {
- const isWeightScale = item?.ScaleType === 'weight';
-
- if (isWeightScale) {
- return (
- acc + (Weightasquantity ? Math.round(Number(item?.OrderQty || 0)) : 1)
- );
- }
-
- return acc + Math.round(Number(item?.OrderQty || 0));
- }, 0);
-
- const filteredSettingNames = SettingDataSelector?.[0]?.['SettingDtlDetails']
- ?.filter(
- (item) =>
- allowedNames.includes(item?.SettingIdName) && item?.SettingValue === 'Y'
- )
- ?.map((item) => item?.SettingIdName);
- // for customised invoice number
- const { invoiceDate, clearInvoiceDate } = useDateStore();
- const CurrentOrderId = useSelector(GlobalCurrentOrderId);
- const holdCheckedSalesSetup = tableOptions?.some(
- (item) => item?.OptionName === 'Hold'
- );
-
- useEffect(() => {
- if (salesBillEdit) {
- dispatch(getPaymentOptions()).unwrap();
- }
- }, [salesBillEdit]);
-
- useEffect(() => {
- if (salesBillEdit) {
- if (SelCustId) {
- setRefundPayBtns(AllPaymentOptions);
- setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId);
- setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName);
- } else {
- const withoutCustomer = AllPaymentOptions?.filter?.(
- (item) => item?.ConfigName?.toLowerCase() !== 'credit'
- );
- setRefundPaySelected(withoutCustomer?.[0]?.ConfigId);
- setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName);
- setRefundPayBtns(withoutCustomer);
- }
- }
- }, [AllPaymentOptions, SelCustId, salesBillEdit]);
-
- useEffect(() => {
- if (
- OrderCardDetail?.length === 1 &&
- OrderCardDetail?.[0]?.OrderQty === 1 &&
- !SelCustId
- ) {
- console.log(OrderCardDetail, 'OrderCardDetail');
- closePrintOption();
- setPrintOrderDetails([]);
- }
- }, [OrderCardDetail]);
- useEffect(() => {
- const fetchPrinterMapping = async () => {
- try {
- if (UserType !== 'Super Admin' && isMobile && MobileA4Print) {
- const data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- UserId: UserId,
- };
- // && isMobile && MobileA4Print
- const response = await dispatch(
- getPrinterMappingDetails(data)
- ).unwrap();
- if (response?.data?.statusCode === 0) {
- handlePrintMappingClick();
- }
- console.log(response, 'printer mapping response');
- }
- } catch (error) {
- console.error('Error fetching printer mapping:', error);
- }
- };
-
- fetchPrinterMapping();
- }, []);
- const handlePrintMappingClick = () => {
- // setReprint1(true)
- window.dispatchEvent(new Event('CLICK PRINTER MAPPING'));
- };
- useEffect(() => {
- if (selOption) {
- closePrintOption();
- setMobileNoWhatsApp(selOption);
- }
- }, [selOption]);
- useEffect(() => {
- const fetchCreditCustomer = async () => {
- const selectedMode = paybtns?.find(
- (pay) => paybtnselected === pay?.ModeId
- )?.ModeName;
-
- if (
- selectedMode?.toLowerCase() === 'credit' &&
- (!UpinotSelected || !CardoptionnotSelected)
- ) {
- setCredit(true);
- try {
- const res = await dispatch(
- getCreditCustomer({
- CompId,
- AppId,
- BranchId,
- CustId: selOption?.CustId,
- })
- ).unwrap();
-
- if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) {
- setOverAllBal(res.data.data[0]?.OverAllBal ?? 0);
- } else {
- setOverAllBal(0);
- }
- } catch (error) {
- console.error('Credit fetch failed', error);
- setOverAllBal(0);
- }
- } else {
- setCredit(false);
- setOverAllBal(0);
- }
- };
-
- fetchCreditCustomer();
- }, [paybtnselected, selOption, paybtns]);
- useEffect(() => {
- if (!preOrder) {
- const totalSum = OrderCardDetail?.reduce(
- // (acc, card) => acc + parseFloat(card.OrderRate * card.OrderQty || 0),
- (acc, card) => acc + parseFloat(card.TotalAmt || 0),
- 0
- );
-
- const extra = GlobalExtraCharge?.reduce(
- (acc, obj) => acc + (obj.TotalAmt || 0),
- 0
- );
-
- let withComboSum = 0;
- const withComboOffer_CardDetail = OrderCardDetail?.filter(
- (item) => item.Type === 'C'
- );
- if (withComboOffer_CardDetail?.length > 0) {
- withComboSum = formatAmount(
- withComboOffer_CardDetail.reduce(
- (acc, card) =>
- acc +
- parseFloat(card.OrderRate * card.OrderQty - card.TotalAmt || 0),
- 0
- )
- );
- }
-
- let Total =
- extra === undefined
- ? totalSum - OverallOfferAmount - withComboSum
- : totalSum + extra - OverallOfferAmount - withComboSum;
-
- // Subtract OtherServiceTicketClaim?.totalTicketamount if present and > 0
- if (OtherServiceTicketClaim?.TotalAmt > 0) {
- if (Total - OtherServiceTicketClaim.TotalAmt > 0) {
- Total -= OtherServiceTicketClaim.TotalAmt;
- } else {
- dispatch(
- changeOtherServiceTicketClaim({
- TicketId: null,
- TotalAmt: 0,
- ParkingClaimed: false,
- ServiceCategory: null,
- })
- );
- }
- } else if (OtherServiceTicketClaim?.OtherType == 'Remove') {
- dispatch(
- changeOtherServiceTicketClaim({
- TicketId: null,
- TotalAmt: 0,
- ParkingClaimed: false,
- ServiceCategory: null,
- })
- );
- }
-
- const filteredPayments =
- previousOrderPayment?.filter(
- (p) =>
- p?.LastOrderTran === 'Y' &&
- p?.AfterAdjustment != null &&
- p?.AfterAdjustment !== '' &&
- p?.AfterAdjustment
- ) || [];
-
- const paymentsToUse =
- filteredPayments.length > 0
- ? filteredPayments
- : previousOrderPayment || [];
-
- const totalPreviouspayment = paymentsToUse?.reduce(
- (acc, payment) =>
- acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
- 0
- );
-
- const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce(
- (acc, offer) => acc + parseFloat(offer.OfferAmount || 0),
- 0
- );
-
- const previousNetAmount = totalPreviouspayment || 0;
-
- let withdiscTotal =
- Total -
- ((OverAllSales || 0) +
- (OverAllEstimate || 0) +
- (Discount > 0 ? Discount : 0));
-
- const currentOrderNetAmount = formatAmount(
- withdiscTotal >= 0
- ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2)
- : (Number(Total) + Number(globalTipAmount)).toFixed(2)
- );
-
- setTotalAmount(
- salesBillEdit
- ? currentOrderNetAmount > previousNetAmount
- ? currentOrderNetAmount - previousNetAmount
- : 0
- : currentOrderNetAmount
- );
- setCurrentOrderNetAmount(currentOrderNetAmount);
- setPreviousNetAmount(previousNetAmount);
- dispatch(
- changeSummeryTotalAmount(
- salesBillEdit
- ? currentOrderNetAmount > previousNetAmount
- ? currentOrderNetAmount - previousNetAmount
- : 0
- : currentOrderNetAmount
- )
- );
-
- dispatch(changeSummeryComboOfferAmount(withComboSum));
-
- // if (withdiscTotal <= 0) {
- // dispatch(ChangeOverAllDiscSales(0));
- // dispatch(ChangeOverAllDiscEstimate(0));
- // }
- } else {
- setTotalAmount(0);
- dispatch(changeSummeryTotalAmount(0));
- dispatch(changeSummeryComboOfferAmount(0));
- }
- }, [
- OrderCardDetail,
- GlobalExtraCharge,
- OverAllSales,
- OverAllEstimate,
- globalTipAmount,
- OtherServiceTicketClaim,
- Discount,
- ]);
-
- useEffect(() => {
- if (CompId && BranchId && AppId) {
- if (
- holdCheckedSalesSetup ||
- NavBarOptions?.some((e) => e?.OptionName == 'Hold')
- ) {
- getHolddata();
- }
- getCustomerData();
- }
- }, [CompId, BranchId, AppId]);
-
- useEffect(() => {
- gettodaydate();
- getBookingTypeId();
- getPaymentOptionFeature();
- // if (UserType === "Employee") {
- // fetchApi()
- // }
- }, []);
- 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 formatAmount = (value) => {
- return allowDecimal
- ? parseFloat(value || 0).toFixed(2)
- : Math.round(value || 0);
- };
- 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'
- );
- setEmpData(datas?.[0]);
- };
- const getCustomerData = async () => {
- await dispatch(
- getAddCustomerDetails({
- CompId: CompId,
- AppId: AppId,
- branchId: BranchId,
- })
- );
- };
-
- const handleIconClick = () => {
- setIsUp((prevIsUp) => !prevIsUp);
- };
-
- useEffect(() => {
- if (OrderCardDetail?.length <= 0) {
- dispatch(changeCustomerID(null));
- dispatch(changeSelectedCustId());
- dispatch(changeSelectedOption(null));
- dispatch(ChangeSelectedCustDisable(false));
- }
- }, [OrderCardDetail]);
-
- //mohan stoped data
- useEffect(() => {
- if (
- (BookingType === 'Dine In' ||
- BookingTypeBoth ||
- CheckOrderType?.length > 0) &&
- !unpaidFlow &&
- SelectedTableDetails?.length !== 0
- ) {
- setOrderStatus(true);
- } else {
- setOrderStatus(false);
- }
- }, [BookingTypeBoth, BookingType, unpaidFlow]);
- //mohan end
- useEffect(() => {
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- setQrCode(false);
- }, [PaymentOptions]);
- useEffect(() => {
- if (NavHoldData) {
- AddBookingDetails('Hold');
- }
- }, [NavHoldData]); //change by karthiga 27
-
- useEffect(() => {
- if (SelCustId) {
- setpaybtns(PaymentOptions);
- } else {
- const withoutCustomer = PaymentOptions?.filter?.(
- (item) => item?.ModeName?.toLowerCase() !== 'credit'
- );
-
- setpaybtns(withoutCustomer);
- }
- }, [PaymentUpiOptions, PaymentOptions, SelCustId]);
-
- useEffect(() => {
- getPaymentOptionFeature();
- }, [GlobaluseOptions]);
- const AllProductTokenFunction = async () => {
- if (IndividualToken?.SettingValue === 'Y') {
- await Promise.all(
- PrintOrderDetails?.[0]?.OrderDetails?.map(
- async (orderDetail, index) => {
- const groupedTokens = orderDetail?.productDetails?.reduce(
- (acc, item, idx) => {
- if (item.TokenAvailable === 'Y') {
- if (!item.CounterName) {
- // If CounterName is null or empty
- acc[`single-${idx}-${item.ProdId}`] = [item]; // Unique entry for each null/empty CounterName item
- } else {
- if (!acc[item.CounterName]) {
- acc[item.CounterName] = [];
- }
- acc[item.CounterName].push(item); // Group by CounterName
- }
- }
- return acc;
- },
- {}
- );
-
- // Iterate over grouped tokens and print them
- const tokensToPrint = Object.entries(groupedTokens).map(
- async ([counterName, items], idx) => {
- // Use the counterName (or unique identifier for individual items) as part of the tokenId
- const tokenId = `${idx}-${items?.[0]?.ProdId}-${counterName}`;
- await TokenPrint(tokenId, items); // Pass all grouped items to the print function
- }
- );
- if (tokensToPrint?.length > 0) {
- await Promise.all(tokensToPrint);
- }
- setPrintOrderDetails([]);
- closePrintOption();
- }
- )
- );
- } else {
- await Promise.all(
- PrintOrderDetails?.[0]?.OrderDetails?.map(
- async (orderDetail, index) => {
- await TokenPrint(`${index}-${orderDetail?.OrderId}`);
- }
- )
- );
- setPrintOrderDetails([]);
- closePrintOption();
- }
- };
-
- //dhana
- // Function to check if the button is active
- const isButtonActive = () => {
- const baseCondition =
- FirstPaymentclick === false &&
- OrderCardDetail?.length > 0 &&
- paybtnselected &&
- CheckBookingStatus !== 'Close';
- let accessCondition = true;
- if (UserType === 'Employee') {
- accessCondition = empData?.AddAccess === 'Y';
- } else if (UserType === 'Super Admin User') {
- accessCondition = SAAccessCommonMaster?.AddAccess === 'Y';
- }
- return baseCondition && accessCondition;
- };
-
- // Function to handle the button click
- const handleButtonClick = () => {
- if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) {
- UpiPayment();
- } else if (
- salesBillEdit &&
- currentOrderNetAmount < previousNetAmount &&
- !refundPaySelected
- ) {
- setMessageType('warning');
- setMessageData('Please Select Refund Payment Method');
- return;
- } else {
- OrderStatus
- ? AddBookingDetails('Dine-In', false)
- : AddBookingDetails(BookingType, true);
- }
- };
- const financialYearError = async () => {
- setMessageType('error');
- setMessageData('Financial Year-Based Sales Not Yet Started');
- };
-
- useEffect(() => {
- const handleKeyPress = (event) => {
- if (!preferenceshortcutkey) return;
- if (event.key === 'F4' && isButtonActive() && !isF4Pressed.current) {
- isF4Pressed.current = true;
- // BranchFinancialStatus==='N'? financialYearError():
- handleButtonClick();
- setTimeout(() => {
- isF4Pressed.current = false; // Reset after a short delay
- }, 1000);
- }
-
- if (
- event.altKey &&
- event.key === 'w' &&
- BookingType !== 'Dine In' &&
- tableOptions?.some((e) => e?.OptionName == 'Hold') &&
- paybtns?.length > 0
- ) {
- event.preventDefault();
- if (
- OrderCardDetail?.length > 0 &&
- CheckBookingStatus !== 'Close' &&
- !addnewAccess
- ) {
- AddBookingDetails('Hold', false);
- } else if (
- Holddata?.length > 0 &&
- OrderCardDetail?.length === 0 &&
- CheckBookingStatus !== 'Close' &&
- !addnewAccess
- ) {
- HandleholdModelOpen();
- }
- }
-
- // Alt+S for Split Payment
- if (event.altKey && event.key === 's' && paybtns?.length > 1) {
- event.preventDefault();
- if (
- OrderCardDetail?.length > 0 &&
- CheckBookingStatus !== 'Close' &&
- !addnewAccess &&
- !unpaidFlow &&
- !OrderStatus
- ) {
- SplitPaymentOpen();
- }
- }
- };
-
- window.addEventListener('keydown', handleKeyPress);
- return () => {
- window.removeEventListener('keydown', handleKeyPress);
- };
- }, [
- paybtns,
- FirstPaymentclick,
- OrderCardDetail,
- paybtnselected,
- OrderStatus,
- qrCode,
- SelectedUPIPayOption,
- TotalAmount,
- SelectedUpiOption,
- SelectedCardOption,
- BookingType,
- Holddata,
- CheckBookingStatus,
- addnewAccess,
- preferenceshortcutkey,
- paybtns,
- unpaidFlow,
- ]);
-
- //dhana
-
- const getPaymentOptionFeature = async () => {
- const FiltersalesPayment = GlobaluseOptions?.filter(
- (item) => item.FlowName?.toLowerCase() === 'sales'
- );
- setuseOptions(FiltersalesPayment);
- const filterpaycounter = FiltersalesPayment?.[0]?.OptionDetails?.filter(
- (item) => item?.OptionName?.toLowerCase() === 'pay at the counter'
- );
- const filterpaymentgateway = FiltersalesPayment?.[0]?.OptionDetails?.filter(
- (item) => item?.OptionName?.toLowerCase() === 'payment gateway'
- );
- const filterpaymentdevice = FiltersalesPayment?.[0]?.OptionDetails?.filter(
- (item) => item?.OptionName?.toLowerCase() === 'payment device'
- );
- const filterBusinessUpi = FiltersalesPayment?.[0]?.OptionDetails?.filter(
- (item) => item?.OptionName?.toLowerCase() === 'business upi'
- );
- const cardinpaymentgateway =
- filterpaymentgateway?.[0]?.ModeDetails?.filter((item) =>
- item?.ModeName?.toLowerCase()?.includes('card')
- ) || [];
- const cardinpaymentdevice =
- filterpaymentdevice?.[0]?.ModeDetails?.filter((item) =>
- item?.ModeName?.toLowerCase()?.includes('card')
- ) || [];
- const upiinpaymentgateway =
- filterpaymentgateway?.[0]?.ModeDetails?.filter((item) =>
- item?.ModeName?.toLowerCase()?.includes('upi')
- ) || [];
- const upiinpaymentdevice =
- filterpaymentdevice?.[0]?.ModeDetails?.filter((item) =>
- item?.ModeName?.toLowerCase()?.includes('upi')
- ) || [];
-
- setPaymentOptions(filterpaycounter?.[0]?.ModeDetails);
- setPaymentUpiOptions(
- FiltersalesPayment?.[0]?.PaymentDetails?.Payatthecounter
- );
- setPaymentDeviceCard(cardinpaymentdevice);
- setPaymentgatewayCard(cardinpaymentgateway);
- setPaymentgatewayUPI(upiinpaymentgateway);
- setPaymentDeviceUPI(upiinpaymentdevice);
- const cardoptions = [];
- if (cardinpaymentgateway?.length > 0) {
- cardoptions.push({
- label: 'Payment Gateway',
- value: 'PG',
- imgSrc: paygate,
- });
- }
- if (cardinpaymentdevice?.length > 0) {
- cardoptions.push({
- label: 'Payment Device',
- value: 'PD',
- imgSrc: paydevice,
- });
- }
- setCardPayOption(cardoptions);
- const options = [];
-
- if (FiltersalesPayment?.[0]?.PaymentDetails?.Payatthecounter?.length > 0) {
- options.push({
- label: 'Personal UPI',
- value: 'Default',
- imgSrc: defaultupi,
- });
- }
- if (filterBusinessUpi?.[0]?.ModeDetails?.length > 0) {
- options.push({
- label: 'Business UPI',
- value: 'Business',
- imgSrc: pozologoimg,
- PaymentOptionId: filterBusinessUpi?.[0]?.PaymentOptionId,
- PaymentFlowId: filterBusinessUpi?.[0]?.PaymentFlowId,
- OptionId: filterBusinessUpi?.[0]?.OptionId,
- });
- }
-
- if (upiinpaymentgateway?.length > 0) {
- options.push({
- label: 'Payment Gateway',
- value: 'PG',
- imgSrc: paygate,
- PaymentOptionId: upiinpaymentgateway?.[0]?.PaymentOptionId,
- PaymentModeId: upiinpaymentgateway?.[0]?.PaymentModeId,
- ModeId: upiinpaymentgateway?.[0]?.ModeId,
- });
- }
-
- if (upiinpaymentdevice?.length > 0) {
- options.push({ label: 'Payment Device', value: 'PD', imgSrc: paydevice });
- }
- setUpiPayOption(options);
- setBusinessPayoption(filterBusinessUpi?.[0]?.ModeDetails || []);
- // }
- };
-
- const Print = async () => {
- const style = await PrintStyleFunction(
- printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle,
- 'Sales'
- );
- const stylesMap = {
- 'Style 1': 'PrintStyle1',
- 'Style 2': 'PrintStyle2',
- 'Style 3': 'PrintStyle3',
- 'Style 4': 'PrintStyle4',
- 'Style 5': 'PrintStyle5',
- 'Style 6': 'PrintStyle6',
- 'Style 7': 'PrintStyle7',
- 'Style 8': 'PrintStyle8',
- 'Style 9': 'PrintStyle9',
- 'Style 10': 'PrintStyle10',
- 'Style 11': 'PrintStyle11',
- 'Style 12': 'PrintStyle12',
- 'Style 13': 'RePrint',
- A4: 'PrintStyleA4',
- A5: 'PrintStyleA5',
- A4Standard: 'A4Standard',
- TaxInvoice: 'TaxInvoice',
- };
-
- const selectedStyle =
- stylesMap[
- printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle
- ];
-
- if (selectedStyle) {
- await Promise.all(
- PrintOrderDetails?.[0]?.OrderDetails?.map(
- async (orderDetail, index) => {
- await printDiv(`${selectedStyle}-${index}`, style); // Use unique IDs for each print
- if (orderDetail?.BookingTypeName !== 'Dine In') {
- const groupedTokens = orderDetail?.productDetails?.reduce(
- (acc, item, idx) => {
- if (item.TokenAvailable === 'Y') {
- if (!item.CounterName) {
- // If CounterName is null or empty
- acc[`individual-${idx}-${item.ProdId}`] = [item]; // Unique entry for each null/empty CounterName item
- } else {
- if (!acc[item.CounterName]) {
- acc[item.CounterName] = [];
- }
- acc[item.CounterName].push(item); // Group by CounterName
- }
- }
- return acc;
- },
- {}
- );
-
- // Iterate over grouped tokens and print them
- const tokensToPrint = Object.entries(groupedTokens).map(
- async ([counterName, items], idx) => {
- // Use the counterName (or unique identifier for individual items) as part of the tokenId
- const tokenId = `${idx}-${items?.[0]?.ProdId}-${counterName}`;
- await TokenPrint(tokenId, items); // Pass all grouped items to the print function
- }
- );
- if (tokensToPrint?.length > 0) {
- await Promise.all(tokensToPrint);
- }
- }
- }
- )
- );
-
- setPrintOrderDetails([]);
- closePrintOption();
- }
- };
- const TokenPrint = async (index) => {
- try {
- console.log(`Starting token print for index ${index}`);
-
- const stylePrint = ``;
- if (TokenOnly?.SettingValue === 'Y') {
- if (IndividualToken?.SettingValue === 'Y') {
- await printDiv(`TokenOnlySingle${index}`, stylePrint);
- } else {
- await printDiv(`TokenOnlyMultiple${index}`, stylePrint);
- }
- } else {
- await printDiv(`TakeawayToken${index}`, stylePrint);
- }
- } catch (error) {
- console.error(`Error printing token for index ${index}:`, error);
- }
- };
- useEffect(() => {
- let data = selOption != null ? selOption : GetCustId;
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- customer: data,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- }, [selOption, GetCustId]);
- useEffect(() => {
- let data = GlobalUpiID;
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- upi: data,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- setUpiOption(GlobalUpName);
- setSelectedUpiOption(GlobalUpiIDoptionIdd);
- setUpiId(GlobalUpiID);
- }, [GlobalUpiID]);
- useEffect(() => {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- paymentMethod: Paybtnnameselected,
- Paymentgateway: false,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- dispatch(ChangeInitialPaymentName(Paybtnnameselected));
- }, [Paybtnnameselected]);
-
- useEffect(() => {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- ExtraCharges: GlobalExtraCharge,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- }, [GlobalExtraCharge]); //Shifayth Date:27/12/2023
-
- useEffect(() => {
- // TotalItemsCalculation();
- TotalWithoutTaxRate();
- TotalTaxAmt();
- OrderCardDetail?.length == 0 ? dispatch(changeunpaidflow(false)) : '';
- }, [OrderCardDetail]);
-
- // useEffect(() => {
- // if (
- // PrintOrderDetails?.length > 0 &&
- // (!filteredSettingNames || filteredSettingNames?.includes('Print') ||filteredSettingNames?.length === 0) && (
- // (!filteredSettingNames?.includes('whatsapp') &&
- // (!isMobile || !filteredSettingNames?.includes('SMS'))) ||
- // (
- // (filteredSettingNames?.includes('whatsapp') ||
- // (isMobile && filteredSettingNames?.includes('SMS'))) &&
- // (!MobileNoWhatsApp || Object.keys(MobileNoWhatsApp).length === 0)
- // )
- // )
- // ) {
-
- // handlePrintOrToken();
- // }
- // }, [PrintOrderDetails]);
-
- useEffect(() => {
- if (!PrintOrderDetails?.length) return;
-
- const selectedOptions = filteredSettingNames || [];
- const count = selectedOptions.length;
-
- // ⭐ Case 1: Nothing selected → Default Print
- if (count === 0) {
- handlePrintOrToken();
- return;
- }
-
- // ⭐ Case 2: Only ONE option selected → Auto action
- if (count === 1) {
- const option = selectedOptions[0];
-
- switch (option) {
- case 'whatsapp':
- if (!selOption && MobileNoWhatsApp?.value) {
- handleWhatsAppClick();
- } else {
- handlePrintOrToken();
- }
- return;
-
- case 'SMS':
- if (isMobile) handleSMSClick();
- else handlePrintOrToken();
- return;
-
- case 'Print':
- handlePrintOrToken();
- return;
-
- // case "Email":
- // handleEmailClick();
- // return;
-
- default:
- return;
- }
- }
- return;
- }, [PrintOrderDetails]);
-
- const closePrintOption = () => {
- setShowWhatsAppShare(false);
- setSMSShare(false);
- setPrintOrderDetails([]);
- setMobileNoWhatsApp();
- };
-
- const handleWhatsAppClick = () => {
- setShowWhatsAppShare(true);
- };
-
- const handleSMSClick = () => {
- setSMSShare(true);
- };
-
- const handlePrintOrToken = async () => {
- const dinein =
- PrintOrderDetails?.[0]?.OrderDetails?.[0]?.productDetails?.some(
- (product) => product.BookingTypeName === 'Dine In'
- );
- const Tokenthere =
- PrintOrderDetails?.[0]?.OrderDetails?.[0]?.productDetails?.some(
- (product) => product.TokenAvailable === 'Y'
- );
- const preferenceDetails = SettingDataSelector?.[0]?.SettingDtlDetails;
- if (isMobile) {
- if (MobileA4Print) {
- await MobileMultiPdfPrintTrigger({
- preferenceDetails,
- printerTemplateStyle,
- printDatas,
- PrinterDetails,
- PrintOrderDetails,
- SessionData,
- bookingTypePreference,
- });
- } else {
- if (Tokenthere && TokenOnly?.SettingValue === 'Y' && !dinein) {
- if (IndividualToken?.SettingValue === 'Y' && !dinein) {
- IndividualTokenMobilePrint(PrintOrderDetails, UpiId, 'Booking');
- closePrintOption();
- } else {
- SingleTokenMobilePrint(PrintOrderDetails, UpiId, 'Booking');
- closePrintOption();
- }
- } else {
- MobilePrint(
- appPreferences,
- PrintOrderDetails,
- UpiId,
- 'Booking',
- SettingDataSelector
- );
- closePrintOption();
- }
- }
- } else {
- if (Tokenthere && TokenOnly?.SettingValue === 'Y' && !dinein) {
- AllProductTokenFunction();
- } else {
- Print();
- }
- }
- };
- useEffect(() => {
- getBookingTypeId();
- }, [BookingType, BookingTypeBoth]);
- useEffect(() => {
- const getPrintData = async () => {
- try {
- const data = {
- AppId,
- CompId,
- BranchId,
- OrderId: businessUPIOrderId,
- };
-
- const res = await dispatch(VerifiedPaymentDtl(data)).unwrap();
-
- if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) {
- const orderData = [{ OrderDetails: res.data.data }];
-
- // Reset states first
- setBusinessUPIOrderId(null);
- setBusinessUPI(false);
- setPaymentSuccess(false);
-
- // Then set new data and trigger side effects
- setPrintOrderDetails(orderData);
- CustomerDisplay();
- ClearAllGlobalStateDatas();
- filteredSettingNames?.includes('whatsapp') &&
- MobileNoWhatsApp?.value &&
- handleURL(orderData);
- }
- } catch (error) {
- console.error('Failed to fetch print data:', error);
- // Reset states even on error
- setBusinessUPI(false);
- setPaymentSuccess(false);
- }
- };
-
- if (paymentSucess && businessUPIOrderId) {
- const timer = setTimeout(() => {
- getPrintData();
- }, 3000);
-
- return () => clearTimeout(timer);
- }
- }, [paymentSucess, businessUPIOrderId, AppId, CompId, BranchId, dispatch]);
- const getUnpaiddatas = async () => {
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- };
- await dispatch(getUnpaidData(data)).unwrap();
- };
-
- const getBookingTypeId = async () => {
- setConfigDataList(AllBookingType);
- let configdata = AllBookingType;
- let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType;
-
- let filterconfigdata = configdata?.find((a) => a?.ConfigName === checkName);
- setSelectedBookingType(filterconfigdata?.ConfigId);
- };
- const TotalItemsCalculation = async () => {
- let tempTotalitems = OrderCardDetail?.length;
- let OverAllQty = OrderCardDetail?.reduce(
- (prev, current) => prev + Number(current?.OrderQty || 0),
- 0
- );
- await dispatch(changeSummeryTotalItems(tempTotalitems));
- await dispatch(changeSummeryQty(OverAllQty));
- };
-
- const TotalWithoutTaxRate = async () => {
- const totalwithouttax = OrderCardDetail?.reduce((accumulator, card) => {
- return accumulator + parseFloat(card.WithoutTaxRate || 0);
- }, 0);
- await dispatch(
- changeSummeryTotalWithoutTaxAmount(totalwithouttax.toFixed(2))
- );
- };
- const TotalTaxAmt = async () => {
- const totaltax = OrderCardDetail?.reduce((accumulator, card) => {
- return accumulator + parseFloat(card.TaxAmt || 0);
- }, 0);
- await dispatch(changeSummeryTotalTaxAmount(totaltax.toFixed(2)));
- };
-
- const Recipt = async () => {
- AddBookingDetails('Unpaid', false);
- };
-
- const gettodaydate = () => {
- const currentDate = new Date();
- const day = String(currentDate.getDate()).padStart(2, '0');
- const month = String(currentDate.getMonth() + 1).padStart(2, '0'); // Month is 0-based, so we add 1.
- const year = currentDate.getFullYear();
-
- const tempformattedDate = `${year}-${month}-${day}`;
- setFormattedDate(tempformattedDate);
- };
- const ProductSummary = (salesData) => {
- // Create a map to store the aggregated values for each unique product
- const productMap = new Map();
- // Iterate over the sales data to aggregate values
- salesData.forEach((item) => {
- let offerMode = item?.OfferMode?.trim();
- offerMode = offerMode && offerMode !== '' ? offerMode : null;
-
- let OfferId = null;
- if (
- item?.OfferMessage &&
- Array.isArray(item.OfferMessage) &&
- item.OfferMessage.length > 0
- ) {
- OfferId = item.OfferMessage[0]?.OfferId || null;
- }
-
- const keyData = [
- item.ProdId || null,
- item.InwardDtlId || null,
- item.BookingType || null,
- item.SinglePc || null,
- item.OrderRate || null,
- offerMode,
- OfferId,
- ];
-
- const key = keyData.join('-');
-
- if (productMap.has(key)) {
- const existingItem = productMap.get(key);
- existingItem.OrderQty =
- (existingItem.OrderQty || 0) + (item.OrderQty || 0);
- existingItem.TotalAmt =
- (existingItem.TotalAmt || 0) + (item.TotalAmt || 0);
- existingItem.TaxAmt =
- (parseFloat(existingItem.TaxAmt) || 0) +
- (parseFloat(item.TaxAmt) || 0);
- } else {
- const newItem = {
- ...item,
- OfferMode: offerMode,
- OfferMessage:
- item?.OfferMessage && Array.isArray(item.OfferMessage)
- ? item.OfferMessage
- : null,
- };
- productMap.set(key, newItem);
- }
- });
-
- // Convert the map values back to an array
- const aggregatedProducts = Array.from(productMap.values());
-
- return aggregatedProducts;
- };
-
- const UpiPayment = () => {
- if (OrderStatus) {
- AddBookingDetails('Dine-In', false);
- } else {
- if (SelectedUpiOption && TotalAmount == 0) {
- Upimodel('Submit');
- } else if (SelectedUpiOption) {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- OrderTotalAmount: TotalAmount,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
-
- setUpiOpen(true);
- } else {
- setUpinotSelected(true);
- setMessageType('error');
- setMessageData('Please Select Upi Option');
- }
- }
- };
- const handleCreditCustomer = (type) => {
- setCreditCustomer(false);
- if (type == 'Submit') {
- Booking(BookingType, true);
- }
- if (type == 'Cancel') {
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- }
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedRemovedData = {
- type: 'remove',
- keyValue: 'OrderTotalAmount',
- };
- customerDisplayWindow.postMessage(updatedRemovedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- };
-
- const HandleholdModelOpen = () => {
- setHold(true);
- };
-
- const handleHoldCancel = () => {
- setHold(false);
- };
-
- const handleAddCustomer = () => {
- if (Custdisable === false) {
- setAddCustomer(true);
- }
- };
- const handleAddCustomerCancel = () => {
- setAddCustomer(false);
- };
- const handlePaymentMode = (id, name) => {
- if (name?.toLowerCase() !== 'credit') {
- setOverAllBal(0);
- setCredit(false);
- }
- if (paymentloader === false) {
- setPaybtnselected(id);
- setPaybtnnameselected(name);
- if (CardPayOption?.length === 1) {
- setSelectedCardOption(CardPayOption?.[0]?.value);
- }
- setUpiOptionOpen(false);
- setQrCode(false);
- setUpinotSelected(false);
- setCardoptionnotSelected(false);
- }
- };
-
- const handleRefundPaymentMode = (id, name) => {
- setRefundPaySelected(id);
- setRefundPaySelectedName(name);
- };
-
- const addUpiOption = async (id, name, UPIId) => {
- await dispatch(changeUpiIDprint(UPIId));
- await dispatch(changeUpiIDName(name));
- await dispatch(changeUpiIDoptionId(id));
- setSelectedUpiOption(id);
- setUpiOption(name);
- setUpiId(UPIId);
- setUpinotSelected(false);
- setCardoptionnotSelected(false);
- };
- const AddCardOption = (data) => {
- setSelectedCardOption(data);
- setCardOptionOpen(false);
- setCardoptionnotSelected(false);
- };
- const AddUPIPaymentOption = async (data, mode = false) => {
- setSelectedUpiOption('');
- setUpiOption('');
- setUpiId('');
- await dispatch(changeUpiIDprint(null));
- await dispatch(changeUpiIDName(''));
- await dispatch(changeUpiIDoptionId(null));
- setSelectedUPIPayOption(data);
- setUpinotSelected(false);
- setCardoptionnotSelected(false);
- if (data !== 'Default' && data !== 'Business' && !mode) {
- setUpiOptionOpen(false);
- }
- };
- const handleUPIButtonClick = (id, name) => {
- if (paymentloader === false) {
- setPaybtnnameselected(name);
- setPaybtnselected(id);
- let brachName1 = PaymentUpiOptions?.[0]?.BrName;
- setbrachName(brachName1);
- if (UpiPayOption?.length === 1) {
- setSelectedUPIPayOption(UpiPayOption?.[0]?.value);
- if (UpiPayOption?.[0]?.value?.toLowerCase() === 'default') {
- if (PaymentUpiOptions?.length === 1) {
- addUpiOption(
- PaymentUpiOptions?.[0]?.Mode,
- PaymentUpiOptions?.[0]?.ModeName,
- PaymentUpiOptions?.[0]?.UPIId
- );
- }
- }
- }
-
- setQrCode(true);
- SetSuccess(true);
- }
- };
- const EnableUpiOptions = () => {
- setUpiOptionOpen(!UpiOptionOpen);
- };
- const EnableCardOptions = () => {
- setCardOptionOpen(!CardOptionOpen);
- };
- const hideDefault = () => {
- setUpiOptionOpen(false);
- };
-
- const getHolddata = async () => {
- const data = { CompId: CompId, BranchId: BranchId, AppId: AppId };
- let response = await dispatch(gettinghold(data)).unwrap();
- if (response?.data?.statusCode == 1) {
- dispatch(changeholddata(response?.data?.data));
- } else {
- dispatch(changeholddata([]));
- }
- };
- const CustomerDisplayRemovedData = () => {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- userData: [],
- ExtraCharges: [],
- Paymentgateway: false,
- type: 'remove',
- keyValue: 'customer',
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- const updatedRemovedData = {
- type: 'remove',
- keyValue: 'OrderTotalAmount',
- };
- customerDisplayWindow.postMessage(updatedRemovedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- };
- const CustomerDisplay = (value) => {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (value == 'TakeAway') {
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- userData: [],
- ExtraCharges: [],
- Paymentgateway: false,
- upioption1: 'okk',
- type: 'remove',
- keyValue: 'customer',
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- const updatedRemovedData = {
- type: 'remove',
- keyValue: 'OrderTotalAmount',
- };
- customerDisplayWindow.postMessage(updatedRemovedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- } else {
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- type: 'remove',
- keyValue: 'customer',
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- }
- };
- const ClearAllGlobalStateDatas = async (value) => {
- if (OfferCheckedInSetup && preferenceOffer) {
- await applyOffer([]);
- } else {
- dispatch(changeOrderCardDetails([]));
- }
- dispatch(changeBillEditingMode(false));
- dispatch(changeSearchedData(''));
- await dispatch(changePreviousOrderPayment([]));
- await dispatch(changePreviousOrderOfferDetail([]));
- dispatch(changeTipAmount(0));
- dispatch(changeLoyaltyConsumedQuantities({}));
- await dispatch(ChangeTotalAmount([]));
- dispatch(changeFullOfferAppliedProducts([]));
- dispatch(ChangeFullFreeProductList([]));
- await dispatch(changeReorderHoldDetails({}));
- await dispatch(changeReorderProductDetails([]));
- setFirstPaymentclick(false);
- await dispatch(ChangeNavHoldData(false));
- await dispatch(changeCustomerID(null));
- await dispatch(changeSelectedCustId());
- await dispatch(changeSelectedOption(null));
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- setQrCode(false);
- setUpinotSelected(false);
- setCurrentOrderNetAmount(0);
- setPreviousNetAmount(0);
- if (
- holdCheckedSalesSetup ||
- NavBarOptions?.some((e) => e?.OptionName == 'Hold')
- ) {
- getHolddata();
- }
- if (defaultBookingType === 'Both') {
- await dispatch(changeBookingType('TakeAway'));
- }
- await dispatch(changeSelProdWiseEst([]));
- await dispatch(ChangeOverAllDiscSales(null));
- await dispatch(ChangeOverAllDiscEstimate(null));
- // await dispatch(changeEstimateBooking(null))
- // clearInvoiceDate
- clearInvoiceDate();
- dispatch(changeCurrentOrderId(null));
- getstockbadge();
- Combodata?.length > 0 && Combocarddata();
- getUnpaiddatas();
- await dispatch(changeSelectTable([]));
- await dispatch(changeSelectChair([]));
- await dispatch(changeSelectedTableDetails([]));
- await dispatch(changeOrderType());
- if (value === 'Dine-In') {
- navigate(`${subDirectory}sales/dine-in`);
- }
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- UserId: UserId,
- FromDate: currentDateValue,
- ToDate: currentDateValue,
- };
- await dispatch(getSalesDetailData(data));
- };
-
- const AddBookingDetails = async (value, pay) => {
- const customerDisplayWindow = getCustomerDisplayWindow();
-
- const OnUpiSelected = PaymentOptions?.find(
- (item) => item.ModeId === paybtnselected
- );
-
- if (
- OnUpiSelected?.ModeName?.toLowerCase() === 'upi' &&
- (SelectedUPIPayOption?.toLowerCase() === 'default' ||
- SelectedUPIPayOption?.toLowerCase() === 'business')
- ) {
- SetSuccess(false);
- setTimeout(function () {
- SetSuccess(true);
- // Add your state change code here
- // For example:
- // setNewState(newValue);
- }, 3000);
- if (SelectedUpiOption) {
- Booking(value, pay);
- } else {
- setUpinotSelected(true);
- setMessageType('error');
- setMessageData('Please Select Upi Option');
- }
- } else if (
- OnUpiSelected?.ModeName?.toLowerCase() === 'card' &&
- PaymentgatewayCard?.length > 0 &&
- PaymentDeviceCard?.length > 0
- ) {
- if (SelectedCardOption) {
- if (SelectedCardOption?.toLowerCase() === 'pg') {
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- if (SelCustId) {
- Booking(value, pay);
- } else {
- setMessageType('error');
- setMessageData('Please Select Customer');
- }
- } else {
- setMessageType('error');
- setMessageData('Please Set the customer display');
- }
- } else {
- Booking(value, pay);
- }
- } else {
- setCardoptionnotSelected(true);
- setMessageType('error');
- setMessageData('Please Select Card Option');
- }
- } else if (OnUpiSelected?.ModeName?.toLowerCase() === 'credit') {
- if (!SelCustId) {
- setMessageType('error');
- setMessageData('Please Select Customer');
- } else {
- setCreditCustomer(true);
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- OrderTotalAmount: TotalAmount,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- }
- } else if (
- OnUpiSelected?.ModeName?.toLowerCase() === 'upi' &&
- SelectedUPIPayOption?.toLowerCase() === 'pg'
- ) {
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- if (SelCustId) {
- Booking(value, pay);
- } else {
- setMessageType('error');
- setMessageData('Please Select Customer');
- }
- } else {
- setMessageType('error');
- setMessageData('Please Set the customer display');
- }
- } else if (
- OnUpiSelected?.ModeName?.toLowerCase() === 'card' &&
- SelectedCardOption?.toLowerCase() === 'pg'
- ) {
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- if (SelCustId) {
- Booking(value, pay);
- } else {
- setMessageType('error');
- setMessageData('Please Select Customer');
- }
- } else {
- setMessageType('error');
- setMessageData('Please Set the customer display');
- }
- } else {
- Booking(value, pay);
- }
- };
- const extrachargesbookingtype = (extradata) => {
- const TakAwayId = ConfigDataList?.find(
- (a) => a?.ConfigName === 'TakeAway'
- )?.ConfigId;
- const DineinId = ConfigDataList?.find(
- (a) => a?.ConfigName === 'Dine In'
- )?.ConfigId;
- let tempdata = extradata?.map((data) => ({
- ...data,
- BookingType: data?.BookingTypeName === 'Dine In' ? DineinId : TakAwayId,
- }));
- return tempdata;
- };
- const Booking = async (value, pay) => {
- const TakAwayId = ConfigDataList?.find(
- (a) => a?.ConfigName === 'TakeAway'
- )?.ConfigId;
- const DineinId = ConfigDataList?.find(
- (a) => a?.ConfigName === 'Dine In'
- )?.ConfigId;
-
- setFirstPaymentclick(true);
- let temporderdetail = OrderCardDetail?.map((a) => ({
- ProdId: a.ProdId,
- Type: a.Type,
- OrderQty: a.OrderQty,
- OrderRate: a.OrderRate,
- // TotalAmt: a.OrderQty * a.OrderRate,
- TotalAmt: a.TotalAmt,
- TaxAmt: a.TaxAmt,
- RefundQty: 0,
- InwardDtlId: a.InwardDtlId,
- TaxId: a.TaxId,
- ProdNameQty:
- UomPrint?.SettingValue === 'N'
- ? `${a.ProdName} ${a.UomName?.toLowerCase() === 'half' ? '(Half)' : ''}`
- : `${a.ProdName} ${a.Size} ${a.UomName}`,
- OrderStatus: 'O',
- OrderType:
- BookingType === 'Dine In' ||
- BookingTypeBoth ||
- Estimation?.SettingValue == 'N'
- ? 'S'
- : GlobEstBooking === 'OvrAllEst'
- ? 'E'
- : GlobEstBooking === 'ParEst'
- ? GlobProdwisedata?.includes(
- a.InwardDtlId + ' ' + a?.BookingTypeName
- )
- ? 'E'
- : 'S'
- : 'S',
- SinglePc: a.SinglePc,
- BookingType: a.BookingTypeName === 'Dine In' ? DineinId : TakAwayId,
- OfferValue: a?.Type === 'C' ? a?.OfferValue : a.Offer,
- OfferAmt: a?.Type === 'C' ? a?.TotalAmt : a.Offer,
- OfferType: a?.Type === 'C' ? a?.OfferType : '',
- OfferMode: a?.OfferMode,
- OfferMessage: a?.OfferMessage,
- CounterName: a?.TokenAvailable === 'Y' ? a?.CounterName : null,
- ProductIdentifierDtls: a.ProductIdentifierDtls,
- ModelNumber: a.ModelNumber,
- BatchRef: a.BatchRef,
- PackageDtl: a.PackageDtl,
- SetCount: a.SetCount,
- ...(a?.DiscountValue && { DiscountValue: a.DiscountValue }),
- ...(a?.DiscountType && { DiscountType: a.DiscountType }),
- ...(a?.DiscountAmt && { DiscountAmt: a.DiscountAmt }),
- }));
- const NotSlectedTypeFind = temporderdetail?.find(
- (a) => a?.BookingType != SelectedBookingType
- );
- const { totalwithouttax, totaltax } = OrderCardDetail?.reduce(
- (totals, card) => {
- totals.totalwithouttax += parseFloat(card.WithoutTaxRate || 0);
- totals.totaltax += parseFloat(card.TaxAmt || 0);
- return totals;
- },
- { totalwithouttax: 0, totaltax: 0 }
- ) || { totalwithouttax: 0, totaltax: 0 };
- let updatedOfferDetails = offerAppliedProducts;
- if (GlobEstBooking !== 'Sales') {
- updatedOfferDetails = offerAppliedProducts?.filter(
- (item) =>
- !(
- item.TableName === 'LoyaltyPoints' &&
- item.TableUniqueName === 'UniqueId' &&
- item.Type === 'A'
- )
- );
- }
-
- let temppostdata = {
- SalesMode: RetailWSSalesType || 'R',
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- OrderDate: Custombill ? invoiceDate : null,
- CustomOrderNo: Custombill ? CurrentOrderId : null,
- OrderType:
- Object.keys(ReportholdData)?.length > 0
- ? ReportholdData?.OrderType
- : 'S',
- CustSuppId: SelCustId ? SelCustId : null,
- Reference: 'test',
- BookingType:
- NotSlectedTypeFind && !BookingTypeBoth
- ? NotSlectedTypeFind?.BookingType
- : SelectedBookingType,
- ServiceProvider: 0,
- ActiveStatus: 'A',
- CreatedBy: UserId,
- AddlInfo: 'test',
- BillAmount: totalwithouttax,
- OverallDiscSales: OverAllSales > 0 ? OverAllSales : 0,
- OverallDiscEst: OverAllEstimate > 0 ? OverAllEstimate : 0,
- TaxAmount: totaltax,
- VatAmount: 0,
- NetAmount: Math.round(TotalAmount),
- PaymentType:
- Paybtnnameselected?.toLowerCase() === 'upi'
- ? SelectedUPIPayOption?.toLowerCase() === 'pd'
- ? PaymentDeviceUPI?.[0]?.ModeId
- : SelectedUPIPayOption?.toLowerCase() === 'pg'
- ? PaymentgatewayUPI?.[0]?.ModeId
- : paybtnselected
- : paybtnselected
- ? paybtnselected
- : null,
- GivenAmt: 0,
- BalGiven: 0,
- BookingMedia: 'DW',
- RefundAmount: 0,
- ServiceCategory: OtherServiceTicketClaim?.ServiceCategory || null,
- OtherServiceTicketId: OtherServiceTicketClaim?.TicketId || null,
- OtherServiceTicketAmount: OtherServiceTicketClaim?.TotalAmt || null,
- PaymentStatus:
- Paybtnnameselected?.toLowerCase() === 'cash'
- ? 'S'
- : Paybtnnameselected?.toLowerCase() === 'credit'
- ? 'S'
- : Paybtnnameselected?.toLowerCase() === 'upi' &&
- SelectedUPIPayOption?.toLowerCase() === 'default'
- ? 'S'
- : 'P',
- OrderDtlDetails:
- Object.keys(ReportholdData)?.length > 0
- ? ProductSummary(temporderdetail)
- : temporderdetail,
- // (BookingType === "Dine In" || BookingTypeBoth)
- ExtraChargeDetails:
- GlobalExtraCharge?.length > 0
- ? extrachargesbookingtype(GlobalExtraCharge)
- : null,
- SalesTableLinkDetails:
- SelectedTableDetails?.length > 0
- ? globalTipAmount === 0
- ? SelectedTableDetails
- : SelectedTableDetails?.map((item) => ({
- ...item,
- TipsAmount: globalTipAmount,
- }))
- : null,
- SalesPaymentType: 'normal',
- PaymentDetail: [
- {
- PaymentType:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? refundPaySelected
- : Paybtnnameselected?.toLowerCase() === 'upi'
- ? SelectedUPIPayOption?.toLowerCase() === 'pd'
- ? PaymentDeviceUPI?.[0]?.ModeId
- : SelectedUPIPayOption?.toLowerCase() === 'pg'
- ? PaymentgatewayUPI?.[0]?.ModeId
- : SelectedUPIPayOption?.toLowerCase() === 'business'
- ? BusinessPayOption?.find(
- (busupi) => busupi?.ModeId === UpiId
- )?.ModeId
- : paybtnselected
- : paybtnselected
- ? paybtnselected
- : null,
- Amount:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? previousNetAmount - currentOrderNetAmount
- : Math.round(TotalAmount),
- MerchantId:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? null
- : Paybtnnameselected?.toLowerCase() === 'upi' &&
- SelectedUPIPayOption?.toLowerCase() === 'business'
- ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
- ?.MerchantId
- : null,
- PaymentOptionType:
- salesBillEdit &&
- currentOrderNetAmount < previousNetAmount &&
- (refundPaySelectedName?.toLowerCase() === 'cash' ||
- refundPaySelectedName?.toLowerCase() === 'credit')
- ? 'PC'
- : Paybtnnameselected?.toLowerCase() === 'cash'
- ? 'PC'
- : Paybtnnameselected?.toLowerCase() === 'credit'
- ? 'PC'
- : Paybtnnameselected?.toLowerCase() === 'card'
- ? SelectedCardOption
- : Paybtnnameselected?.toLowerCase() === 'upi'
- ? SelectedUPIPayOption?.toLowerCase() === 'default'
- ? 'PC'
- : SelectedUPIPayOption?.toLowerCase() === 'business'
- ? 'BU'
- : SelectedUPIPayOption
- : null,
- ModeOfPayment:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? null
- : SelectedUPIPayOption?.toLowerCase() === 'default'
- ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
- ?.UPIDetailId
- : SelectedUPIPayOption?.toLowerCase() === 'business'
- ? BusinessPayOption?.find(
- (busupi) => busupi?.ModeId === UpiId
- )?.MerchantUPIId
- : null,
- AccountDtl:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? []
- : Paybtnnameselected?.toLowerCase() === 'upi' &&
- SelectedUPIPayOption?.toLowerCase() === 'default'
- ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
- (upipay) => upipay?.UPIId === UpiId
- )
- : (Paybtnnameselected?.toLowerCase() === 'upi' &&
- 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')
- ? useOptions?.[0]?.PaymentDetails?.PaymentGateway
- : [],
- PaymentStatus:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? 'S'
- : Paybtnnameselected?.toLowerCase() === 'cash'
- ? 'S'
- : Paybtnnameselected?.toLowerCase() === 'credit'
- ? 'S'
- : Paybtnnameselected?.toLowerCase() === 'upi' &&
- SelectedUPIPayOption?.toLowerCase() === 'default'
- ? 'S'
- : 'P',
- Debit:
- salesBillEdit &&
- currentOrderNetAmount < previousNetAmount &&
- refundPaySelectedName?.toLowerCase() === 'credit'
- ? Math.round(previousNetAmount - currentOrderNetAmount)
- : 0,
- Credit: salesBillEdit
- ? currentOrderNetAmount > previousNetAmount &&
- Paybtnnameselected?.toLowerCase() === 'credit'
- ? Math.round(TotalAmount)
- : 0
- : Paybtnnameselected?.toLowerCase() === 'credit'
- ? Math.round(TotalAmount)
- : 0,
- },
- ],
- OrderOfferDetail: updatedOfferDetails,
- RefDetails: [
- {
- FreeProdList: FreeProdList,
- OfferAppliedProductList: offerAppliedProducts,
- },
- ],
- };
- let PostData = temppostdata;
-
- if (value === 'Dine-In') {
- PostData['PaymentStatus'] = pay ? 'S' : 'P';
- PostData['PaymentDetail'] = !pay && [];
- PostData['PaymentType'] = !pay && '';
- } else if (value === 'Hold') {
- ((PostData['PaymentStatus'] = pay ? 'S' : 'P'),
- (PostData['PaymentDetail'] = !pay && []));
- PostData['PaymentType'] = !pay && '';
- PostData['ActiveStatus'] = pay ? 'A' : 'D';
- } else if (value === 'Unpaid') {
- PostData['PaymentStatus'] = pay ? 'S' : 'P';
- PostData['PaymentDetail'] = !pay && [];
- PostData['PaymentType'] = !pay && '';
- PostData['PrintType'] = 'Y';
- }
-
- Object.keys(ReportholdData)?.length > 0
- ? OrderType === 'Failed'
- ? PutFailedPayment(PostData, value, pay)
- : PutBooking(PostData, value, pay)
- : !OtherServicesglobal
- ? PostBooking(PostData, value)
- : OtherServicePostBooking(PostData, value);
- };
- const PostBooking = async (PostData, value) => {
- let response = await dispatch(PostBookingData(PostData)).unwrap();
- if (response?.data?.statusCode == 1) {
- let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pd' &&
- item?.PaymentStatus === 'P'
- );
- let PaymentGatewayfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pg' &&
- item?.PaymentStatus === 'P'
- );
- let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) => item?.PaymentOptionType?.toLowerCase() === 'pc'
- );
- let businessUPIfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'bu' &&
- item?.PaymentStatus === 'P'
- );
- if (
- PayatCounterfilter?.length === 1 ||
- response?.data?.PaymentOrderDtl?.length === 0
- ) {
- 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 &&
- setPrintOrderDetails([response?.data]);
- CustomerDisplay(value);
- filteredSettingNames?.includes('whatsapp') &&
- MobileNoWhatsApp?.value &&
- handleURL([response?.data]);
- ClearAllGlobalStateDatas(value);
- }
-
- if (Paymentdevicefilter?.length === 1) {
- if (
- Paymentdevicefilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pd'
- ) {
- PaymentDeviceFlow(Paymentdevicefilter, value);
- }
- } else {
- console.log('more pd data');
- }
- if (PaymentGatewayfilter?.length === 1) {
- if (
- PaymentGatewayfilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pg'
- ) {
- await dispatch(changePaymentloader(true));
-
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- OrderBookingId: PaymentGatewayfilter?.[0]?.OrderId,
- Paymentgateway: true,
- OrderPaymentId: PaymentGatewayfilter?.[0]?.PaymentOrderId,
- OrderTotalAmount: PaymentGatewayfilter?.[0]?.Amount,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- const checkPaymentStatus = async () => {
- const intervalId = setInterval(async () => {
- try {
- let getpaymentgatewaydetail = await dispatch(
- PaymentGatewayGetdetail(PaymentGatewayfilter?.[0]?.OrderId)
- ).unwrap();
-
- if (getpaymentgatewaydetail?.data?.statusCode === 1) {
- let paymentdataget =
- getpaymentgatewaydetail?.data?.PaymentOrderDtl?.find(
- (item) =>
- item?.PaymentOrderId ===
- PaymentGatewayfilter?.[0]?.PaymentOrderId
- )?.PaymentStatus;
-
- if (paymentdataget === 'S') {
- setMessageType('success');
- setMessageData('Payment Success');
- await dispatch(changePaymentloader(false));
-
- if (
- getpaymentgatewaydetail?.data?.OrderDetails?.length > 0
- ) {
- setPrintOrderDetails([getpaymentgatewaydetail?.data]);
- CustomerDisplay(value);
-
- ClearAllGlobalStateDatas(value);
- }
- clearInterval(intervalId); // Stop the loop when payment is successful
- } else if (paymentdataget === 'F') {
- setMessageType('error');
- setMessageData('Payment Failed');
- await dispatch(changePaymentloader(false));
- setFirstPaymentclick(false);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- clearInterval(intervalId); // Stop the loop when payment fails
- CustomerDisplayRemovedData();
- ClearAllGlobalStateDatas(value);
- }
- }
- } catch (error) {
- console.error('Error fetching payment details: ', error);
- }
- }, 3000); // Call the API every 3 seconds
- };
-
- // Call the function to start checking payment status
- checkPaymentStatus();
- }
- } else {
- console.log('more pg data');
- }
- if (businessUPIfilter?.length === 1) {
- businessUPIFlow(
- businessUPIfilter,
- response?.data?.OrderId,
- response?.data?.PaymentPageLink
- );
- }
- dispatch(triggerCustomerRefresh());
- } else {
- setMessageType('error');
- setMessageData(response?.data?.response);
- setFirstPaymentclick(false);
- // clearInvoiceDate
- clearInvoiceDate();
- dispatch(changeCurrentOrderId(null));
- }
- };
-
- const PutBooking = async (putdatas, value, pay) => {
- let putdata = putdatas;
- putdata['OrderId'] = ReportholdData?.OrderId;
- putdata['SalesId'] = ReportholdData?.SalesId;
- putdata['UpdatedBy'] = UserId;
- if (value === 'Dine-In') {
- putdata['PaymentStatus'] = pay ? 'S' : 'P';
- putdata['PaymentDetail'] = !pay && [];
- putdata['PaymentType'] = !pay && '';
- } else if (value === 'Hold') {
- ((putdata['PaymentStatus'] = pay ? 'S' : 'P'),
- (putdata['PaymentDetail'] = !pay && []));
- putdata['PaymentType'] = !pay && '';
- putdata['ActiveStatus'] = pay ? 'A' : 'D';
- } else if (value === 'Unpaid') {
- putdata['PaymentStatus'] = pay ? 'S' : 'P';
- putdata['PaymentDetail'] = !pay && [];
- putdata['PaymentType'] = !pay && '';
- putdata['PrintType'] = 'Y';
- }
- let response = null;
- if (salesBillEdit) {
- response = await dispatch(putSalesBillEdit(putdata)).unwrap();
- } else {
- response = await dispatch(PutBookingData(putdata)).unwrap();
- }
- if (value !== 'Unpaid') {
- if (response?.data?.statusCode == 1) {
- let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pd' &&
- item?.PaymentStatus === 'P'
- );
- let PaymentGatewayfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pg' &&
- item?.PaymentStatus === 'P'
- );
- let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) => item?.PaymentOptionType?.toLowerCase() === 'pc'
- );
- if (
- PayatCounterfilter?.length === 1 ||
- response?.data?.PaymentOrderDtl?.length === 0
- ) {
- 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 &&
- setPrintOrderDetails([response?.data]);
- CustomerDisplay(value);
-
- ClearAllGlobalStateDatas(value);
- }
- if (Paymentdevicefilter?.length === 1) {
- if (
- Paymentdevicefilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pd'
- ) {
- PaymentDeviceFlow(Paymentdevicefilter, value);
- }
- } else {
- console.log('more pd data');
- }
- if (PaymentGatewayfilter?.length === 1) {
- PaymentGatewayFlow(PaymentGatewayfilter);
- } else {
- setPrintOrderDetails([response?.data]);
- // CustomerDisplay();
- ClearAllGlobalStateDatas();
- console.log('more pg data');
- }
- } else {
- // clearInvoiceDate
- clearInvoiceDate();
- dispatch(changeCurrentOrderId(null));
- }
- } else {
- setPrintOrderDetails([response?.data]);
- if (OfferCheckedInSetup && preferenceOffer) {
- await applyOffer([]);
- } else {
- dispatch(changeOrderCardDetails([]));
- }
- await dispatch(changeReorderHoldDetails({}));
- await dispatch(changeReorderProductDetails([]));
- setFirstPaymentclick(false);
- if (defaultBookingType === 'Both') {
- await dispatch(changeBookingType('TakeAway'));
- }
- await dispatch(changeSelectTable([]));
- await dispatch(changeSelectChair([]));
- getUnpaiddatas();
- }
- };
- const PutFailedPayment = async (PayData, value, pay) => {
- console.log(PayData?.PaymentDetail?.[0]?.PaymentType, 'mohanPayData');
- let tempsplitdata = {
- CompId: PayData?.CompId,
- BranchId: PayData?.BranchId,
- AppId: PayData?.AppId,
- CustSuppId: PayData?.SelCustId ? SelCustId : null,
- UpdatedBy: UserId,
- OrderId: ReportholdData?.OrderId,
- PaymentType: PayData?.PaymentDetail?.[0]?.PaymentType,
- Amount: FailedTotalAmt,
- PaymentOptionType: PayData?.PaymentDetail?.[0]?.PaymentOptionType,
- ModeOfPayment: PayData?.PaymentDetail?.[0]?.ModeOfPayment,
- AccountDtl: PayData?.PaymentDetail?.[0]?.AccountDtl,
- PaymentStatus: PayData?.PaymentDetail?.[0]?.PaymentStatus,
- Debit: PayData?.PaymentDetail?.[0]?.Debit,
- Credit: PayData?.PaymentDetail?.[0]?.Credit,
- };
-
- let response = await dispatch(
- putSplitpaymentStatus(tempsplitdata)
- ).unwrap();
- if (response?.data?.statusCode == 1) {
- let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pd' &&
- item?.PaymentStatus === 'P'
- );
- let PaymentGatewayfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pg' &&
- item?.PaymentStatus === 'P'
- );
- let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pc' &&
- item?.PaymentType === PayData?.PaymentDetail?.[0]?.PaymentType
- );
- if (
- PayatCounterfilter?.length > 0 ||
- response?.data?.PaymentOrderDtl?.length === 0
- ) {
- setMessageType('success');
-
- // setSplitSelPayMode({...SplitSelPayMode,...{[`PaymentStatus-${i}`]:"S"}})
-
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- upi: null,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- setMessageData(
- response?.data?.response +
- ' ' +
- (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]);
- CustomerDisplay();
- ClearAllGlobalStateDatas();
- }
- }
- if (Paymentdevicefilter?.length === 1) {
- if (
- Paymentdevicefilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pd'
- ) {
- PaymentDeviceFlow(Paymentdevicefilter, value);
- }
- }
-
- if (PaymentGatewayfilter?.length === 1) {
- if (
- PaymentGatewayfilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pg'
- ) {
- PaymentGatewayFlow(PaymentGatewayfilter, value);
- }
- }
- }
- };
-
- const PaymentGatewayFlow = async (PaymentGatewayfilter) => {
- if (PaymentGatewayfilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pg') {
- await dispatch(changePaymentloader(true));
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- OrderBookingId: PaymentGatewayfilter?.[0]?.OrderId,
- Paymentgateway: true,
- OrderPaymentId: PaymentGatewayfilter?.[0]?.PaymentOrderId,
- OrderTotalAmount: PaymentGatewayfilter?.[0]?.Amount,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- const checkPaymentStatus = async () => {
- const intervalId = setInterval(async () => {
- try {
- let getpaymentgatewaydetail = await dispatch(
- PaymentGatewayGetdetail(PaymentGatewayfilter?.[0]?.OrderId)
- ).unwrap();
-
- if (getpaymentgatewaydetail?.data?.statusCode === 1) {
- let paymentdataget =
- getpaymentgatewaydetail?.data?.PaymentOrderDtl?.find(
- (item) =>
- item?.PaymentOrderId ===
- PaymentGatewayfilter?.[0]?.PaymentOrderId
- )?.PaymentStatus;
-
- if (paymentdataget === 'S') {
- setMessageType('success');
- setMessageData('Payment Success');
- await dispatch(changePaymentloader(false));
- if (getpaymentgatewaydetail?.data?.OrderDetails?.length > 0) {
- setPrintOrderDetails([getpaymentgatewaydetail?.data]);
- CustomerDisplay(value);
-
- ClearAllGlobalStateDatas(value);
- }
- clearInterval(intervalId); // Stop the loop when payment is successful
- } else if (paymentdataget === 'F') {
- setMessageType('error');
- setMessageData('Payment Failed');
- await dispatch(changePaymentloader(false));
- setFirstPaymentclick(false);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- clearInterval(intervalId); // Stop the loop when payment fails
- CustomerDisplayRemovedData();
- ClearAllGlobalStateDatas(value);
- // const customerDisplayWindow = getCustomerDisplayWindow();
- // if (customerDisplayWindow && !customerDisplayWindow.closed) {
- // const updatedData = {
- // userData: OrderCardDetail,
- // ExtraCharges: GlobalExtraCharge,
- // upi: GlobalUpiID,
- // customer: selOption != null ? selOption : GetCustId,
- // paymentMethod: Paybtnnameselected,
- // Paymentgateway: false,
- // OrderTotalAmount: PaymentGatewayfilter?.[0]?.Amount
-
- // };
- // customerDisplayWindow.postMessage(updatedData, '*');
- // }
- }
- }
- } catch (error) {
- console.error('Error fetching payment details: ', error);
- }
- }, 3000); // Call the API every 3 seconds
- };
-
- // Call the function to start checking payment status
- checkPaymentStatus();
- }
- };
- const PaymentDeviceFlow = async (Paymentdevicefilter, value) => {
- await dispatch(changePaymentloader(true));
- await dispatch(
- changePaymentTransactionNumber(Paymentdevicefilter?.[0]?.PaymentOrderId)
- );
-
- let paymentdetail = {
- TransactionNumber: Paymentdevicefilter?.[0]?.PaymentOrderId,
- SequenceNumber: 1,
- AllowedPaymentMode:
- Paymentdevicefilter?.[0]?.PaymentTypeName?.toLowerCase() === 'card'
- ? '1'
- : Paymentdevicefilter?.[0]?.PaymentTypeName?.toLowerCase() === 'upi'
- ? '10'
- : '',
- Amount: `${parseInt(Paymentdevicefilter?.[0]?.Amount) * 100}`,
- ClientID: useOptions?.[0]?.PDConfigDetails?.[0]?.ClientId,
- StoreID: useOptions?.[0]?.PDConfigDetails?.[0]?.StoreId,
- UserID: useOptions?.[0]?.PDConfigDetails?.[0]?.UserId,
- MerchantID: useOptions?.[0]?.PDConfigDetails?.[0]?.MerchantId,
- SecurityToken: useOptions?.[0]?.PDConfigDetails?.[0]?.SecurityToken,
- IMEI: useOptions?.[0]?.PDConfigDetails?.[0]?.IMEI,
- AutoCancelDurationInMinutes:
- useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes,
- };
- let apiresponse = await dispatch(PostPaymentdevice(paymentdetail)).unwrap();
- if (apiresponse?.ResponseMessage?.toLowerCase() === 'approved') {
- let pendingPaymentList = {
- MerchantID: useOptions?.[0]?.PDConfigDetails?.[0]?.MerchantId,
- SecurityToken: useOptions?.[0]?.PDConfigDetails?.[0]?.SecurityToken,
- ClientID: useOptions?.[0]?.PDConfigDetails?.[0]?.ClientId,
- StoreID: useOptions?.[0]?.PDConfigDetails?.[0]?.StoreId,
- IMEI: useOptions?.[0]?.PDConfigDetails?.[0]?.IMEI,
- PlutusTransactionReferenceId: apiresponse?.PlutusTransactionReferenceID,
- PaymentOrderId: Paymentdevicefilter?.[0]?.PaymentOrderId,
- UpdatedBy: UserId,
- };
- await dispatch(PutPendingPaymentList(pendingPaymentList)).unwrap();
- let isApproved = false;
- const startTime = Date.now();
- let postpaymentdata = {
- MerchantID: useOptions?.[0]?.PDConfigDetails?.[0]?.MerchantId,
- SecurityToken: useOptions?.[0]?.PDConfigDetails?.[0]?.SecurityToken,
- ClientID: useOptions?.[0]?.PDConfigDetails?.[0]?.ClientId,
- StoreID: useOptions?.[0]?.PDConfigDetails?.[0]?.StoreId,
- IMEI: useOptions?.[0]?.PDConfigDetails?.[0]?.IMEI,
- PlutusTransactionReferenceID: apiresponse?.PlutusTransactionReferenceID,
- };
- // Loop to call the second API every 3 seconds
- while (!isApproved) {
- let ApiResponseget = await dispatch(
- GetPaymentdeviceResponse(postpaymentdata)
- ).unwrap();
-
- if (ApiResponseget?.ResponseMessage?.toLowerCase() === 'txn approved') {
- let putbookingdata = {
- OrderBookingId: Paymentdevicefilter?.[0]?.OrderId,
- OrderId: Paymentdevicefilter?.[0]?.PaymentOrderId,
- PaymentStatus: 'S',
- Amount: Paymentdevicefilter?.[0]?.Amount,
- ResponseDtl: [ApiResponseget],
- PaymentType: Paymentdevicefilter?.[0]?.PaymentType,
- UpdatedBy: UserId,
- };
- let bookingpaymentupdate = await dispatch(
- PutBookingPaymentStatusChange(putbookingdata)
- ).unwrap();
- if (bookingpaymentupdate?.data?.statusCode === 1) {
- setMessageType('success');
- setMessageData(
- bookingpaymentupdate?.data?.response +
- ' ' +
- (bookingpaymentupdate?.data?.OrderDetails?.length > 0
- ? bookingpaymentupdate?.data?.OrderId &&
- extractLastNumberOrderId(
- bookingpaymentupdate?.data?.OrderId,
- rbookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus
- )
- : '')
- );
- bookingpaymentupdate?.data?.OrderDetails?.length > 0 &&
- setPrintOrderDetails([bookingpaymentupdate?.data]);
- CustomerDisplay(value);
-
- ClearAllGlobalStateDatas(value);
- await dispatch(changePaymentloader(false));
- }
- isApproved = true;
- console.log('Transaction Approved!');
- // Exit the loop
- break;
- }
-
- // Check if 1 minute has passed
- if (
- Date.now() - startTime >
- useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes *
- 60000
- ) {
- // 60,000 ms = 1 minute
-
- let putbookingdata = {
- OrderBookingId: Paymentdevicefilter?.[0]?.OrderId,
- OrderId: Paymentdevicefilter?.[0]?.PaymentOrderId,
- PaymentStatus: 'F',
- Amount: Paymentdevicefilter?.[0]?.Amount,
- ResponseDtl: [ApiResponseget],
- PaymentType: Paymentdevicefilter?.[0]?.PaymentType,
- UpdatedBy: UserId,
- };
-
- let bookingpaymentupdate = await dispatch(
- PutBookingPaymentStatusChange(putbookingdata)
- ).unwrap();
- if (bookingpaymentupdate?.data?.statusCode === 1) {
- setMessageType('error');
- setMessageData(
- `Payment Failed. Your Transaction Number is ${Paymentdevicefilter?.[0]?.PaymentOrderId}`
- );
- setFirstPaymentclick(false);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- await dispatch(changePaymentloader(false));
- CustomerDisplayRemovedData();
- ClearAllGlobalStateDatas(value);
- }
-
- console.error('Transaction not approved within 1 minute.');
- // Send an error message or handle the timeout
- // You can dispatch an action, show a notification, etc.
- break;
- }
-
- // Wait for 3 seconds before making the next call
- await new Promise((resolve) => setTimeout(resolve, 3000));
- }
- } else {
- let putbookingdata = {
- OrderBookingId: Paymentdevicefilter?.[0]?.OrderId,
- OrderId: Paymentdevicefilter?.[0]?.PaymentOrderId,
- PaymentStatus: 'F',
- Amount: Paymentdevicefilter?.[0]?.Amount,
- PaymentType: Paymentdevicefilter?.[0]?.PaymentType,
- UpdatedBy: UserId,
- };
- let bookingpaymentupdate = await dispatch(
- PutBookingPaymentStatusChange(putbookingdata)
- ).unwrap();
- if (bookingpaymentupdate?.data?.statusCode === 1) {
- setMessageType('error');
- setMessageData(apiresponse?.ResponseMessage);
- setFirstPaymentclick(false);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- dispatch(changePaymentloader(false));
- CustomerDisplayRemovedData();
- ClearAllGlobalStateDatas(value);
- }
- }
- };
-
- const businessUPIFlow = async (
- businessUPIfilter,
- OrderId,
- PaymentStatusLink
- ) => {
- // Implement your business UPI flow here
- console.log('Business UPI Flow Triggered', businessUPIfilter);
- // You can add similar logic as PaymentDeviceFlow or PaymentGatewayFlow based on your requirements
- setBusinessUPILink(PaymentStatusLink);
- setBusinessUPI(true);
- setBusinessUPIOrderId(OrderId);
- };
-
- function safeRound(amountStr) {
- if (amountStr == null) return allowDecimal ? '0.00' : '0';
-
- const cleaned = String(amountStr).replace(/[^0-9.-]+/g, '');
- const num = Number(cleaned);
-
- if (isNaN(num)) return allowDecimal ? '0.00' : '0';
-
- return allowDecimal ? num.toFixed(2) : Math.round(num).toString();
- }
- const columns = [
- {
- title: 'Sl.No',
- key: 'sno',
- align: 'center',
- width: '100px',
- render: (text, object, index) => (
- {index + 1}
- ),
- },
- {
- title: 'Table Name/Chair Name',
- dataIndex: 'TableName',
- key: 'TableName',
- width: '150px',
- onCell: (_, record, index) => {
- return {
- onClick: () => {
- Unpaidfun(record);
- },
- };
- },
- },
- {
- title: 'Order Id',
- dataIndex: 'OrderID',
- key: 'OrderID',
- width: '150px',
- align: 'right',
- onCell: (_, record, index) => {
- return {
- onClick: () => {
- Unpaidfun(record);
- },
- };
- },
- },
- {
- title: "Item's",
- dataIndex: 'ProductName',
- key: 'ProductName',
- width: '250px',
- onCell: (_, record, index) => {
- return {
- onClick: () => {
- Unpaidfun(record);
- },
- };
- },
- },
- {
- title: 'Amount',
- dataIndex: 'TotalAmount',
- key: 'TotalAmount',
- width: '150px',
- align: 'right',
- render: (text) => {safeRound(text)} ,
- onCell: (_, record, index) => {
- return {
- onClick: () => {
- Unpaidfun(record);
- },
- };
- },
- },
- ];
- const TableDat = [];
- tabledata?.map((item) =>
- TableDat.push({
- TableName: item.SalesTableLinkDetails?.map((item) =>
- item.ChairName == null ? item.TableName : item.ChairName
- )?.join(','),
- OrderID: extractLastNumberOrderId(item?.OrderId, item?.FYStatus),
- ProductName: item.productDetails
- ?.map(
- (item) =>
- item?.ProdName +
- '-' +
- (item?.Type != 'C' ? item?.OrderQty : '1 Combo')
- )
- ?.join(','),
- TotalAmount: item.NetAmount,
- })
- );
- const Unpaidfun = async (event) => {
- dispatch(changeunpaidflow(true));
- if (
- OrderCardDetail?.length > 0 &&
- (BookingType === 'Dine In' || BookingTypeBoth)
- ) {
- setUnpaidConfirmation(true);
- setunpaidselectedindex(event);
- } else {
- const UpdatedData = tabledata?.[event]?.productDetails;
- if (OfferCheckedInSetup && preferenceOffer) {
- await applyOffer(UpdatedData);
- } else {
- await dispatch(changeOrderCardDetails(UpdatedData));
- }
- await dispatch(changeReorderHoldDetails([tabledata?.[event]]?.[0]));
- await dispatch(
- changeReorderProductDetails(tabledata?.[event]?.productDetails)
- );
- await dispatch(ChangeTotalAmount(tabledata?.[event]?.ExtraChargeDetails));
- await dispatch(changeUnpaidData(true));
- setUnpaidOpen(false);
- }
- };
-
- const UnpaidOk = async () => {
- setOrderStatus(false);
- await dispatch(changeSelectedTableDetails([]));
- await dispatch(changeSelectTable([]));
- await dispatch(changeSelectChair([]));
- if (defaultBookingType === 'Both') {
- await dispatch(changeBookingType('TakeAway'));
- }
- await dispatch(
- changeOrderCardDetails(tabledata?.[unpaidselectedindex]?.productDetails)
- );
- await dispatch(
- changeReorderProductDetails(
- tabledata?.[unpaidselectedindex]?.productDetails
- )
- );
- await dispatch(
- changeReorderHoldDetails([tabledata?.[unpaidselectedindex]]?.[0])
- );
- await dispatch(
- ChangeTotalAmount(tabledata?.[unpaidselectedindex]?.ExtraChargeDetails)
- );
- await dispatch(changeUnpaidData(true));
- setUnpaidOpen(false);
- setUnpaidConfirmation(false);
- };
- const Unpaidclose = async () => {
- dispatch(changeunpaidflow(false));
- setUnpaidOpen(false);
- setUnpaidConfirmation(false);
- };
-
- const hide = () => {
- setOpen2(false);
- };
-
- const handleOpenChange2 = (newOpen) => {
- if (open2) {
- setOpen2(false);
- } else {
- setOpen2(true);
- }
- };
-
- const getstockbadge = async () => {
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- };
- await dispatch(getSelectedFavItems(data)).unwrap();
-
- let data1 = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- ProdSubCat: ProdSubCat,
- };
-
- let data2 = {
- compId: CompId,
- branchId: BranchId,
- appId: AppId,
- prodCat: prodCat,
- };
-
- if (
- templateData?.BookingLayout?.[1]?.some(
- (item) => item?.OptionName === 'SubCategory'
- ) &&
- ProdSubCat
- ) {
- await dispatch(getLayoutproductCard(data1)).unwrap();
- } else if (
- !templateData?.BookingLayout?.[1]?.some(
- (item) => item?.OptionName === 'SubCategory'
- )
- ) {
- await dispatch(getCardDataWithoutSubmodule(data2)).unwrap();
- } else {
- await dispatch(getCardDataWithoutSub(data2)).unwrap();
- }
- };
-
- const Combocarddata = async () => {
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- ActiveStatus: 'A',
- };
-
- let response = await dispatch(getCombolist(data)).unwrap();
- let datas = response?.data?.data;
- await dispatch(ChangeComboCarddata(datas));
- if (response?.data?.statusCode === 1) {
- }
- };
-
- const Upimodel = (type) => {
- setUpiOpen(false);
-
- if (type == 'Submit') {
- AddBookingDetails(BookingType, true);
- }
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedRemovedData = {
- type: 'remove',
- keyValue: 'OrderTotalAmount',
- };
- customerDisplayWindow.postMessage(updatedRemovedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- };
- const today = new Date();
- const year = today.getFullYear();
- // Note: Months are zero-based, so we add 1 to get the actual month
- const month = today.getMonth() + 1;
- const day = today.getDate();
-
- // Creating a formatted date string (in the format YYYY-MM-DD)
- const Todaydate = `${day < 10 ? '0' : ''}${day}-${month < 10 ? '0' : ''}${month}-${year}`;
- const OrderId = PrintOrderDetails?.[0]?.OrderDetails?.[0]?.OrderId;
- let MobileNo = selOption?.value;
- const onFinalSubmit = async () => {
- let url = `${MainHomeUrl}payment-page?amt=${TotalAmount}&Id=${MobileNo}&cus=${SelCustId} &CusN=${selOption?.CustName}&Br=${brachName}`;
- let response = await dispatch(SendPaymentLink({ MobileNo, url })).unwrap();
- if (response?.data?.statusCode === 1) {
- setMessageType('success');
- setMessageData('Link Sent Successfully');
- }
- };
- const CreditCustomerHAndleCancel = () => {
- setcreditCustomerOpen(false);
- };
-
- const CreditCustomerFun = () => {
- if (
- OrderCardDetail?.length === 0 &&
- (selOption?.value !== undefined ||
- GlobalAddCustomerDetails1?.length > 0 ||
- GetCustId?.CustMobile !== undefined)
- ) {
- setcreditCustomerOpen(true);
- } else {
- if (selOption?.value == undefined) {
- setMessageType('warning');
- setMessageData('Please Select the Customer');
- }
- }
- };
-
- let containerHeight = '';
-
- if (templateData?.BookingLayout?.[0] === 'Layout5') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '490px'
- : '475px'
- : ExpDate <= 7
- ? '85.5vh'
- : '';
- } else if (templateData?.BookingLayout?.[0] === 'Layout1') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '490px'
- : '500px'
- : ExpDate <= 7
- ? '83vh'
- : '';
- } else if (templateData?.BookingLayout?.[0] === 'Layout6') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '425px'
- : '410px'
- : ExpDate <= 7
- ? '74vh'
- : '';
- } else if (templateData?.BookingLayout?.[0] === 'Layout2') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '490px'
- : '475px' // billing table 5 height in POS
- : ExpDate <= 7
- ? '85vh'
- : '';
- } else if (templateData?.BookingLayout?.[0] === 'Layout3') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '490px'
- : '460px'
- : ExpDate <= 7
- ? '82vh'
- : '';
- } else if (templateData?.BookingLayout?.[0] === 'Layout4') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '500px'
- : '475px'
- : ExpDate <= 7
- ? '86vh'
- : '';
- }
- const changeOrderStatus = () => {
- setOrderStatus(!OrderStatus);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- };
-
- // split payments
- const SplitPaymentOpen = () => {
- if (OrderCardDetail?.length > 0 && TotalAmount > 0) {
- const updatedData = {
- userData: OrderCardDetail,
- ExtraCharges: GlobalExtraCharge,
- customer: selOption != null ? selOption : GetCustId,
- Paymentgateway: false,
- };
- setFailedOrderData(updatedData);
- setSplitpayment(true);
- } else {
- if (TotalAmount <= 0) {
- setMessageType('warning');
- setMessageData('Cannot split when total amount is zero or less');
- return;
- }
- setMessageType('warning');
- setMessageData('Please Select the Product');
- }
- };
-
- const handlesplitpaymentclose = () => {
- setSplitpayment(false);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- paymentMethod: PaymentOptions?.[0]?.ModeName,
- Paymentgateway: false,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- };
- const handleResponsiveBill = () => {
- setResponsiveBill(!responsiveBill);
- };
-
- // const orderIdsArray =
- // PrintOrderDetails?.[0]?.OrderDetails?.map(
- // (orderDetail) => orderDetail?.OrderId
- // ) || [];
- const handleURL = async (PrintOrderDetails) => {
- let orderIdsArray = PrintOrderDetails?.[0]?.OrderDetails?.map(
- (orderDetail) => orderDetail?.OrderId
- );
- const encrypted = encryptObject(orderIdsArray);
-
- const postData = {
- Url: encrypted,
- CreatedBy: UserId,
- };
- if (orderIdsArray) {
- const res = await dispatch(PublicQrCodepost(postData)).unwrap();
- const urlData = res?.data?.ReferenceNo;
- setUrlData(urlData);
- }
- };
- const customerNameOrMobile = MobileNoWhatsApp?.CustName?.trim()
- ? `Dear ${MobileNoWhatsApp?.CustName}`
- : `Dear ${MobileNoWhatsApp?.value}`;
- const documentUrl = `${MainHomeUrl}viewbill?code=${urlData}`;
- const encodedMessage = `${customerNameOrMobile},\n\n🙏 Thank you for being a valuable customer!\n\n🧾 To view your bill, please click the link below:\n${documentUrl}`;
-
- const navCust = templateData?.BookingNavbar?.[1]?.some(
- (item) => item?.OptionName === 'AddCustomer'
- );
-
- const handlepaymentoptions = async () => {
- await dispatch(changeSalesPaymentoption(true));
- await dispatch(
- getPaymentOptionsData({
- AppId: AppId,
- CompId: CompId,
- BranchId: BranchId,
- })
- );
- };
-
- // ------------------------------------------------OTHER SERVICES FUNCTIONALITY-----------------------------------------------------------------------------------
-
- useEffect(() => {
- if (isMobile) {
- OtherServiceMobilePrint(
- OtherServicesPrintDetails,
- UpiId,
- 'Booking',
- SettingDataSelector
- );
- } else {
- Otherserviceprint();
- }
- }, [OtherServicesPrintDetails]);
-
- useEffect(() => {
- const setDefaultPaymentOption = async () => {
- const res = await dispatch(
- getDefaultPaymentOptions({ AppId, CompId, BranchId })
- )?.unwrap();
- const defaultDetail = res?.data?.data?.[0]?.DefaultDetails?.[0];
- if (res?.data?.data?.length > 0 && defaultDetail) {
- setDefaultEnabled(true);
- setDefaultPaymentMode(defaultDetail);
- const { option, card } = defaultDetail;
- if (option?.value) setSelectedUPIPayOption(option.value);
- if (card) {
- const isDefault =
- String(option?.value ?? '').toLowerCase() === 'default';
- const idToUse = isDefault ? card?.UPIId : card?.ModeId;
-
- if (idToUse) {
- addUpiOption(card?.Mode, card?.ModeName, idToUse);
- }
- }
- } else {
- setDefaultEnabled(false);
- setDefaultPaymentMode([]);
- }
- };
- if (salesBillEdit) {
- setDefaultPaymentOption();
- }
- }, [defaultPaymentTrigger, salesBillEdit]);
-
- const Otherserviceprint = async () => {
- if (OtherServicesPrintDetails?.length > 0) {
- const style = await PrintStyleFunction('OtherServices1');
- const stylesMap = {
- OtherServices1: 'OtherServices1',
- };
-
- const selectedStyle = stylesMap['OtherServices1'];
-
- console.log(selectedStyle, 'selectedStyle');
-
- await printDiv('OtherServices1', style); // Use unique IDs for each print
-
- setOtherServicesPrintDetails([]);
- closePrintOption();
- }
- };
-
- const OtherServicePostBooking = async (PostData, value) => {
- console.log(PostData, value, 'PostData, value');
-
- let postdata = {
- AppId: AppId,
- CompId: CompId,
- BranchId: BranchId,
- BillAmount: PostData?.BillAmount,
- TaxAmount: PostData?.TaxAmount,
- NetAmount: PostData?.NetAmount,
- OtherServicesTicketDetails: OrderCardDetail.map((item) => ({
- ServiceId: item.ServiceId,
- ServiceCategory: item.ServiceCategory,
- VehicleNumber: item.VehicleNo || '',
- Qty: item.OrderQty,
- Rate: item.Rate,
- TaxAmount: item.TaxAmt,
- TotalAmount: item.TotalAmt,
- })),
- PaymentDetail: PostData?.PaymentDetail,
- CreatedBy: UserId,
- };
-
- let Response = await dispatch(PostOtherServices(postdata)).unwrap();
-
- if (Response?.data?.statusCode == 1) {
- setMessageType('success');
- setMessageData(Response?.data?.response);
- ClearAllGlobalStateDatas(value);
- setOtherServicesPrintDetails([
- Response?.data?.OtherServicesTicketDetails?.[0],
- ]);
- }
-
- console.log(postdata, 'PostdataPostdataPostdata');
- };
-
- const Otherservicesvehicleno = () => {
- setOtherServicesModal(true);
- };
-
- const handleInputChange = (key, index, value, serviceType, item) => {
- const uppercasedValue = value.toUpperCase();
- const regex = /^[A-Z]{2}[0-9]{2}[A-Z]{1,2}[0-9]{4}$/;
- const isValid = regex.test(uppercasedValue);
-
- if (serviceType === 'G') {
- const existing = vehicleInputs[key] ? [...vehicleInputs[key]] : [];
- existing[index] = uppercasedValue;
-
- setVehicleInputs((prev) => ({ ...prev, [key]: existing }));
-
- const updatedErrors = {
- ...errors,
- [key]: [...(errors[key] || [])],
- };
- // updatedErrors[key][index] = isValid ? '' : 'Invalid format (e.g., KA01AB1234)';
- updatedErrors[key][index] =
- uppercasedValue === ''
- ? ''
- : isValid
- ? ''
- : 'Invalid format (e.g., KA01AB1234)';
-
- setErrors(updatedErrors);
-
- vehiclesvalues({ ...vehicleInputs, [key]: existing });
- } else {
- const uniqueKey = `${key}__${item.__index}`;
- const updatedInputs = {
- ...vehicleInputs,
- [uniqueKey]: [uppercasedValue],
- };
-
- const updatedErrors = { ...errors };
- // updatedErrors[uniqueKey] = [isValid ? '' : 'Invalid format (e.g., KA01AB1234)'];
-
- updatedErrors[uniqueKey] = [
- uppercasedValue === ''
- ? ''
- : isValid
- ? ''
- : 'Invalid format (e.g., KA01AB1234)',
- ];
-
- setVehicleInputs(updatedInputs);
- setErrors(updatedErrors);
-
- vehiclesvalues(updatedInputs);
- }
- };
-
- const vehiclesvalues = (vehicleData) => {
- const updated = OrderCardDetail.map((item) => {
- const key =
- item.ServiceType === 'G'
- ? item.id // using `id` now
- : `${item.ServiceId}__${item.__index}`;
-
- // if (vehicleData[key]) {
- // return {
- // ...item,
- // VehicleNo: vehicleData[key],
- // };
- // }
- // return item;
-
- const value = vehicleData[key];
-
- if (value && value.length) {
- return {
- ...item,
- VehicleNo:
- item.ServiceType === 'G'
- ? value.join(',') // 👈 convert array to comma-separated string
- : value[0], // 👈 single string from array
- };
- }
-
- return item;
- });
-
- dispatch(changeOrderCardDetails(updated));
- };
-
- const Handlevehiclenumbers = () => {
- setOtherServicesModal(false);
- };
- const hasVehicleInputErrors = () => {
- return Object.values(errors).some(
- (arr) => Array.isArray(arr) && arr.some((err) => err)
- );
- };
- return (
- <>
-
- {(addcustomer || hold) && (
-
- )}
- {creditCustomerOpen && (
-
- )}
- {TotalAmount == 0 && Success && (
-
-
-
- )}
- {TotalAmount > 0 &&
- qrCode &&
- PaymentUpiOptions?.length > 0 &&
- SelectedUpiOption && (
-
-
-
- )}
-
- {PaymentUpiOptions?.length > 0 && OrderId && (
-
-
-
- )}
-
- {screenwidth > 768 && (
-
-
-
- )}
-
- {/* bill table */}
-
-
- {unpaidopen && (
-
{
- setUnpaidOpen(false);
- }}
- footer={false}
- children={
-
- }
- />
- )}
- {UnpaidConfirmation && (
-
-
- You have already selected a table. If you click 'OK,' the
- table selection will be removed, and the unpaid flow will
- continue. If you click 'Cancel,' the dine-in flow will proceed
- as selected.
-
- >
- }
- onOk={UnpaidOk}
- onCancel={Unpaidclose}
- />
- )}
- {Splitpayment && (
- data?.TotalAmt + acc,
- 0
- ) -
- ((OverAllSales > 0 ? OverAllSales : 0) +
- (OverAllEstimate > 0 ? OverAllEstimate : 0) +
- (Discount > 0 ? Discount : 0))
- )
- }
- failedOrderData={failedOrderData}
- />
- )}
- {PrintOrderDetails?.length > 0 && (
-
- {filteredSettingNames?.includes('whatsapp') &&
- MobileNoWhatsApp?.value && (
-
- )}
-
- {(filteredSettingNames?.includes('Print') ||
- !MobileNoWhatsApp ||
- !MobileNoWhatsApp.value) && (
-
- )}
-
- {filteredSettingNames?.includes('SMS') && isMobile && (
-
- )}
- {/* WhatsAppShare modal/component */}
- {showWhatsAppShare && (
- closePrintOption(false)}
- />
- )}
- {showSMSShare && isMobile && (
- closePrintOption(false)}
- />
- )}
-
- )}
- {
- OtherServicesPrintDetails?.length > 0 && (
- // PrintOrderDetails?.[0]?.OrderDetails?.map((orderDetail, index) => (
-
-
-
- )
- // ))
- }
- {
- setOtherServicesModal(false);
- }}
- // handleSubmit={Handlevehiclenumbers}
- footer={false}
- children={
-
- {OrderCardDetail.map((item, i) => {
- const isGroup = item.ServiceType === 'G';
- const groupKey = item.id; // 🔁 using `id` for groups now
- const uniqueKey = `${item.ServiceId}__${item.__index}`;
-
- // For G-type: render input only once for the group
- if (
- isGroup &&
- i !== OrderCardDetail.findIndex((o) => o.id === groupKey)
- ) {
- return null;
- }
-
- const qty = isGroup
- ? OrderCardDetail.filter((o) => o.id === groupKey).reduce(
- (sum, o) => sum + (o.OrderQty || 1),
- 0
- )
- : item.OrderQty || 1;
-
- return (
-
-
{item.ServiceName}
-
- {Array.from({ length: qty }).map((_, index) => {
- const inputKey = isGroup
- ? item.id
- : `${item.ServiceId}__${item.__index}`;
- const value = vehicleInputs[inputKey]?.[index] || '';
- const error = errors[inputKey]?.[index] || '';
-
- return (
-
-
- handleInputChange(
- isGroup ? item.id : item.ServiceId,
- index,
- e.target.value,
- item.ServiceType,
- item
- )
- }
- onKeyPress={(e) => {
- if (!/[A-Za-z0-9]/.test(e.key)) {
- e.preventDefault();
- }
- }}
- style={{
- width: '100%',
- padding: 8,
- borderRadius: 4,
- border: error
- ? '1px solid red'
- : '1px solid #ccc',
- }}
- />
- {error && (
-
- {error}
-
- )}
-
- );
- })}
-
- );
- })}
-
-
- Submit
-
-
-
- }
- />
- {
- dispatch(changeSalesPaymentoption(false));
- }}
- footer={false}
- children={
-
- }
- />
- setShowCancelConfirm(true)}
- footer={false}
- width={500}
- children={
- <>
-
- >
- }
- />
- {showCancelConfirm && (
- {
- setBusinessUPI(false);
- setShowCancelConfirm(false);
- ClearAllGlobalStateDatas();
- CustomerDisplay();
- }}
- onCancel={() => setShowCancelConfirm(false)}
- okText="Yes"
- cancelText="No"
- >
- Do you want to cancel the payment?
-
- )}
- {customerPreviesOrders && (
- setCustomerPreviesOrders(false)}
- footer={false}
- width={700}
- className={'ModalPaymentGatewayEmbedded'}
- children={
- <>
- setCustomerPreviesOrders(false)}
- />
- >
- }
- />
- )}
-
- >
- );
-};
-
-export default BSBillingTable5;
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBTOverall6.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBTOverall6.jsx
deleted file mode 100644
index 38188de..0000000
--- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBTOverall6.jsx
+++ /dev/null
@@ -1,91 +0,0 @@
-import React from 'react';
-import { useSelector } from 'react-redux';
-import BSBillingTable6 from '../BSBillingTable6/BSBillingTable6';
-import BST6Payment from '../BSBillingTable6/BST6Payment';
-import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBTOverall6.scss';
-import { GlobalExpDateforHeight } from '../../../../../Features/BookingScreen/BookingData/BookingData';
-import { isMobile } from 'react-device-detect';
-import { getTemplateData } from '../../../../../Features/ThemeChange/ThemeChange';
-import BSBillingTable3 from '../BSBillingTable3/BSBillingTable3';
-
-const BSBTOverall6 = () => {
- const templateData = useSelector(getTemplateData);
- const ExpDate = useSelector(GlobalExpDateforHeight);
-
- let containerHeight = '';
-
- if (templateData?.BookingLayout?.[0] === 'Layout6') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '420px'
- : '410px'
- : ExpDate <= 7
- ? '72vh'
- : '';
- } else if (templateData?.BookingLayout?.[0] === 'Layout1') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '470px'
- : '470px' // billing table 6 height in POS
- : ExpDate <= 7
- ? '81vh'
- : '';
- } else if (templateData?.BookingLayout?.[0] === 'Layout2') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '490px'
- : '475px' // billing table 6 height in POS
- : ExpDate <= 7
- ? '83vh'
- : '';
- } else if (templateData?.BookingLayout?.[0] === 'Layout3') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '480px'
- : '460px'
- : ExpDate <= 7
- ? '81vh'
- : '';
- } else if (templateData?.BookingLayout?.[0] === 'Layout4') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '500px'
- : '475px'
- : ExpDate <= 7
- ? '84vh'
- : '';
- } else if (templateData?.BookingLayout?.[0] === 'Layout5') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '480px'
- : '475px'
- : ExpDate <= 7
- ? '84vh'
- : '';
- }
-
- return (
- <>
-
- >
- );
-};
-export default BSBTOverall6;
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBillingTable6.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBillingTable6.jsx
deleted file mode 100644
index dc9bfdd..0000000
--- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBillingTable6.jsx
+++ /dev/null
@@ -1,3358 +0,0 @@
-import React, { useEffect, useState, lazy } from 'react';
-import { useSelector, useDispatch } from 'react-redux';
-import { Popconfirm, Tooltip } from 'antd';
-import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBillingTable6.scss';
-import {
- getTemplateData,
- SelectedGlobalBillingColorDetail,
- SelectedGlobalBillingFont,
- StoredSessionData,
-} from '../../../../../Features/ThemeChange/ThemeChange';
-import {
- ChangeTotalAmount,
- globalExtraTotalAmount,
-} from '../../../../../Features/ExteraCharges/ExtraCharges.js'; //Shifayath Date:27/12/2023
-import {
- GlobalOrderCardDetails,
- changeOrderCardDetails,
- GlobalBookingType,
- GlobalPreviousOrderLength,
- GlobalHoldOrderDtl,
- GlobalUnpaidData,
- ChangeSelectedCustDisable,
- changeReorderHoldDetails,
- changeUnpaidData,
- changeSelectedOption,
- changeBookingType,
- GlobalSelProdWiseEst,
- GlobalBookingTypeBoth,
- GlobalOrderType,
- changeReorderProductDetails,
- GlobalReorderHoldDetails,
- getSelectedFavItems,
- getLayoutproductCard,
- getCardDataWithoutSubmodule,
- getCardDataWithoutSub,
- changeOrderType,
- GlobalProductCategorie,
- GlobalProductSubCategorie,
- changeAllProductTokenAvailable,
- changeTokenOnly,
- PreferenceData,
- GlobalEstimateBooking,
- ChangeOverAllDiscSales,
- ChangeOverAllDiscEstimate,
- changeSelProdWiseEst,
- GlobalOtherSevices,
- GlobalDefaultBookingType,
- GlobalSelOption,
- GlobalCustId,
- GlobalSalesBillEdit,
- changeBillEditingMode,
- changePreviousOrderPayment,
- changePreviousOrderOfferDetail,
-} from '../../../../../Features/BookingScreen/BookingData/BookingData';
-import {
- ChangeFullFreeProductList,
- changeFullOfferAppliedProducts,
- ClearOfferAppliedProducts,
- GlobalFreeProdList,
- GlobalOfferAppliedProducts,
-} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
-import { AiOutlineClose, AiFillDelete } from 'react-icons/ai';
-const BSBillingEditQuantity = lazy(
- () => import('../BSBillingEditQuantity/BSBillingEditQuantity')
-);
-import { isMobile } from 'react-device-detect';
-import WebFont from 'webfontloader';
-import dineInIcon from '../../../../../Images/Dine In.svg';
-import TakeAwayIcon from '../../../../../Images/Take away.svg';
-import {
- changeholddata,
- gettinghold,
- puttinghold,
-} from '../../../../../Features/BookingScreen/HoldOption/HoldOption.js';
-import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
-import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
-import { useUtilsComponent } from '../../../../../Services/utils.js';
-const BSEditTotalAmt = lazy(
- () => import('../BSEditTotalAmount/BSEditTotalAmt.jsx')
-);
-
-const BSImeiDetails = lazy(() => import('../BSImeiDetails/BSImeiDetails.jsx'));
-
-const CustomerPriceHistory = lazy(
- () => import('../../UtillComponents/CustomerPriceHistory.jsx')
-);
-
-const BSBillingTable6 = () => {
- const { removeExtraCharge } = useUtilsComponent();
- const applyOffer = useApplyOfferto_CardDetail();
- const dispatch = useDispatch();
- const SessionData = useSelector(StoredSessionData);
- const BranchId = SessionData?.BranchId;
- const AppId = SessionData?.AppId;
- const CompId = SessionData?.CompId;
- const templateData = useSelector(getTemplateData);
- const tableOptions = templateData?.BookingBilling?.[1];
- const OfferCheckedInSetup = templateData?.BookingNavbar?.[1].some(
- (item) => item?.OptionName == 'Offer'
- );
- const preferenceDatas = useSelector(PreferenceData);
- const allowDecimal = preferenceDatas?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'decimal' &&
- setting?.SettingValue === 'Y'
- );
- const preferenceOffer =
- preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
- (item) => item.SettingIdName === 'Offer'
- )?.SettingValue === 'Y';
-
- const GlobalOfferAppliedProductsData = useSelector(
- GlobalOfferAppliedProducts
- );
- const OfferFreeProduct = useSelector(GlobalFreeProdList);
- const SelectedBillColor = useSelector(SelectedGlobalBillingColorDetail);
- const SelectedFont = useSelector(SelectedGlobalBillingFont);
- const tableData = useSelector(GlobalOrderCardDetails);
- const BookingType = useSelector(GlobalBookingType);
- const defaultBookingType = useSelector(GlobalDefaultBookingType);
- const PreviousOrderLength = useSelector(GlobalPreviousOrderLength);
- const HoldOrderDtl = useSelector(GlobalHoldOrderDtl);
- const UnpaidData = useSelector(GlobalUnpaidData);
- const GlobProdwisedata = useSelector(GlobalSelProdWiseEst);
- const salesBillEdit = useSelector(GlobalSalesBillEdit);
- const ReportholdData = useSelector(GlobalReorderHoldDetails);
- const prodCat = useSelector(GlobalProductCategorie);
- const ProdSubCat = useSelector(GlobalProductSubCategorie);
- const [PreviousdataLength, setPreviousdataLength] =
- useState(PreviousOrderLength);
- const [triggerAnimation, setTriggerAnimation] = useState(true);
- const [EditQuantity, setEditQuantity] = useState(false);
- const [Modaldata, setModaldata] = useState([]);
- const [Index, setIndex] = useState(null);
- const [editField, setEditField] = useState(false);
- const BillOrderPre = preferenceDatas?.[0]?.SettingDtlDetails?.find(
- (item) => item.SettingIdName === 'BillItemsOrder'
- )?.SettingValue;
- const imeiModal = preferenceDatas?.[0]?.SettingDtlDetails?.some(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'imeidetails' &&
- setting?.SettingValue === 'Y'
- );
- const BookingTypeBoth = useSelector(GlobalBookingTypeBoth);
- const OrderType = useSelector(GlobalOrderType);
- const GlobEstBooking = useSelector(GlobalEstimateBooking);
- const GetCustId = useSelector(GlobalCustId);
- const selectedCustomer = useSelector(GlobalSelOption);
-
- const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] =
- useState(false);
- const [customerProduct, setCustomerProduct] = useState(null);
- const [OpenImeiDetail, setOpenImeiDetail] = useState(false);
- const [shortKeyMethod, setshortKeyMethod] = useState(null);
- const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
-
- const OtherServicesglobal = useSelector(GlobalOtherSevices);
- const preferenceshortcutkey = preferenceDatas?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'shortcutkeys' &&
- setting?.SettingValue === 'Y'
- );
- const productBasedExtraCharges = GlobalExtraCharge.filter(
- (obj) => 'ProdName' in obj
- );
-
- const tableDataDinein = tableData?.filter(
- (a, b) => a.BookingTypeName === 'Dine In' && !a?.SalesId
- );
- const tableDataTakeAway =
- OrderType === 'Hold'
- ? tableData?.filter((a, b) => a.BookingTypeName === 'TakeAway')
- : tableData?.filter(
- (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
- )
- : [];
- const [OpenEditTotalAmt, setOpenEditTotalAmt] = useState(false);
- useEffect(() => {
- if (SelectedFont) {
- WebFont.load({
- google: {
- families: [SelectedFont], // Load the selected font
- },
- });
- }
- }, [SelectedFont]);
- useEffect(() => {
- const handleKeyDown = (e) => {
- if (e.ctrlKey && e.key.toLowerCase() === 'i') {
- e.preventDefault();
-
- const prodId = tableData?.[0]?.ProdId;
-
- if (GetCustId && prodId) {
- setCustomerPriceHistoryOpen(true);
- setCustomerProduct(prodId);
- }
- }
- };
-
- window.addEventListener('keydown', handleKeyDown);
-
- return () => {
- window.removeEventListener('keydown', handleKeyDown);
- };
- }, [GetCustId, tableData]);
- useEffect(() => {
- if (tableData?.length === 0) {
- dispatch(ClearOfferAppliedProducts());
- }
- // setTriggerAnimation(true);
- if (!isMobile) {
- const customerDisplayWindow = getCustomerDisplayWindow();
- console.log('customerDisplayWindowtableData', customerDisplayWindow);
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- userData: tableData,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- }
-
- const timer = setTimeout(() => {
- setTriggerAnimation(false);
- }, 400);
-
- return () => clearTimeout(timer);
- }
- }, [tableData]);
-
- useEffect(() => {
- if (tableOptions?.length > 0) {
- let editFieldValue = tableOptions?.filter(
- (item) => item.OptionName == 'Edit'
- );
- if (editFieldValue?.length > 0) {
- setEditField(true);
- } else {
- setEditField(false);
- }
- }
- }, [tableOptions]);
-
- useEffect(() => {
- const getSelectedItem = () => {
- const getItem = (data = []) => {
- if (!data.length) return null;
- return BillOrderPre === 'Y' ? data[0] : data[data.length - 1];
- };
-
- if (tableDataTakeAway?.length > 0) {
- return getItem(tableDataTakeAway);
- } else if (tableDataDinein?.length > 0) {
- return getItem(tableDataDinein);
- }
- return null;
- };
-
- const handleShortcut = (method) => {
- const item = getSelectedItem();
- if (!item) return;
-
- handleEditQuantity(item);
- setshortKeyMethod(method);
- };
-
- const handleKeyDown = (event) => {
- const key = event.key.toLowerCase();
- // 👉 ALT + P → Open Edit Total Amount
- if (event.altKey && key === 'p') {
- event.preventDefault();
- if (tableData?.length > 0) {
- OpenEditTotalAmount();
- }
- return;
- }
- // 👉 CTRL shortcuts
- if (!event.ctrlKey) return;
- if (key === 'q') {
- event.preventDefault();
- handleShortcut('qty');
- } else if (key === 'e') {
- event.preventDefault();
- handleShortcut('price');
- } else if (key === 'y') {
- event.preventDefault();
- handleShortcut('Parcel');
- } else if (key === 'b') {
- event.preventDefault();
- handleShortcut('weightAmount');
- }
- };
- window.addEventListener('keydown', handleKeyDown);
-
- return () => {
- window.removeEventListener('keydown', handleKeyDown);
- };
- }, [preferenceshortcutkey, tableDataTakeAway, tableDataDinein, BillOrderPre]);
-
- const handleImeiDetails = (value) => {
- setOpenImeiDetail(true);
- setModaldata(value);
- };
- const handleImeiDetailClose = () => {
- setOpenImeiDetail(false);
- };
- const getstockbadge = async () => {
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- };
- await dispatch(getSelectedFavItems(data)).unwrap();
-
- let data1 = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- ProdSubCat: ProdSubCat,
- };
-
- let data2 = {
- compId: CompId,
- branchId: BranchId,
- appId: AppId,
- prodCat: prodCat,
- };
-
- if (
- templateData?.BookingLayout?.[1]?.some(
- (item) => item?.OptionName === 'SubCategory'
- ) &&
- ProdSubCat
- ) {
- await dispatch(getLayoutproductCard(data1)).unwrap();
- } else if (
- !templateData?.BookingLayout?.[1]?.some(
- (item) => item?.OptionName === 'SubCategory'
- )
- ) {
- await dispatch(getCardDataWithoutSubmodule(data2)).unwrap();
- } else {
- await dispatch(getCardDataWithoutSub(data2)).unwrap();
- }
- };
- const Clearall = async () => {
- if (OrderType === 'Hold') {
- if (OfferCheckedInSetup && preferenceOffer) {
- await applyOffer([]);
- } else {
- dispatch(changeOrderCardDetails([]));
- }
- if (salesBillEdit) {
- getstockbadge();
- dispatch(changeBillEditingMode(false));
- await dispatch(changePreviousOrderPayment([]));
- await dispatch(changePreviousOrderOfferDetail([]));
- } else {
- let putData = { OrderId: [ReportholdData?.OrderId] };
- console.log(putData, 'putDataputData');
- let response = await dispatch(puttinghold(putData)).unwrap();
- if (response?.data?.statusCode == 1) {
- getstockbadge();
- let holdingData = await dispatch(
- gettinghold({ CompId: CompId, BranchId: BranchId, AppId: AppId })
- ).unwrap();
- if (holdingData?.data?.statusCode === 1) {
- dispatch(changeholddata(holdingData?.data?.data));
- } else {
- dispatch(changeholddata([]));
- }
- }
- }
- await dispatch(ChangeTotalAmount([]));
- await dispatch(changeOrderType(null));
- await dispatch(changeReorderHoldDetails({}));
- } else if (OrderType === 'Reorder') {
- const UpdatedData = tableData?.filter((cartItem) => cartItem?.SalesId);
-
- if (OfferCheckedInSetup && preferenceOffer) {
- await applyOffer(UpdatedData);
- } else {
- dispatch(changeOrderCardDetails(UpdatedData));
- }
-
- await dispatch(changeBookingType('Dine In'));
- } else {
- await dispatch(changeOrderCardDetails([]));
- await dispatch(ChangeTotalAmount([]));
- await dispatch(changeUnpaidData(false));
- await dispatch(changeReorderHoldDetails({}));
- await dispatch(changeReorderProductDetails([]));
- await dispatch(ChangeSelectedCustDisable(false));
- await dispatch(changeSelectedOption(false));
- await dispatch(changeBookingType(defaultBookingType || 'TakeAway'));
- // await dispatch(changeholddata([]))
- await dispatch(changeOrderType());
- }
- await dispatch(ChangeOverAllDiscSales(null));
- await dispatch(ChangeOverAllDiscEstimate(null));
- await dispatch(changeTokenOnly(false));
- await dispatch(changeAllProductTokenAvailable(false));
-
- await dispatch(changeSelProdWiseEst([]));
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- type: 'remove',
- keyValue: 'customer',
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- };
-
- const calculateAmounts = (
- OrderQty,
- OrderRate,
- TaxPercentage,
- IsPaid = true
- ) => {
- const total = OrderQty * OrderRate;
-
- const withoutTax = total - (total * TaxPercentage) / (100 + TaxPercentage);
-
- return {
- TotalAmt: total,
- ...(IsPaid && { Offer: total }),
- WithoutTaxRate: +withoutTax.toFixed(2),
- };
- };
-
- const ChangeOrderCardDetailsFn = async ({
- OrderQty,
- InwardDtlId,
- Offer,
- CompleteRemove = false,
- RemoveAndUpdate = false,
- BuyInwardDtlId,
- BuyProdQty,
- UpdateBuyAndFree = false,
- CompleteRemoveBuyAndAddWithPaid = false,
- CompleteRemoveconvertFreetoPaid = false,
- CompleteRemoveconvertFreetoPaidTwoTypes = false,
- CompleteRemoveconvertFreetoPaidNotCompletely = false,
- CompleteRemoveAndPaidToFreeOtherType = false,
- CompleteRemoveAndPaidToFreeOtherTypeWithoutMerge = false,
- RemoveAndUpdateOtherBookingType = false,
- BookingTypeName,
- }) => {
- let ModifiedOrderCardDetail = JSON.parse(JSON.stringify(tableData));
-
- if (RemoveAndUpdate) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === InwardDtlId &&
- e?.Offer === Offer &&
- e?.BookingTypeName === BookingTypeName
- )
- )?.map((e) => {
- if (
- e?.InwardDtlId == InwardDtlId &&
- e?.Offer > 0 &&
- e?.BookingTypeName === BookingTypeName
- ) {
- const newQty = OrderQty;
- return {
- ...e,
- OrderQty: newQty,
- ...calculateAmounts(newQty, e.OrderRate, e.TaxPercentage),
- };
- }
-
- if (e?.InwardDtlId == BuyInwardDtlId) {
- return {
- ...e,
- OrderQty: BuyProdQty,
- ...calculateAmounts(
- BuyProdQty,
- e.OrderRate,
- e.TaxPercentage,
- false
- ),
- };
- }
-
- return e;
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
- if (RemoveAndUpdateOtherBookingType) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === InwardDtlId &&
- e?.Offer === Offer &&
- e?.BookingTypeName === BookingTypeName
- )
- )?.flatMap((e) => {
- if (
- e?.InwardDtlId == InwardDtlId &&
- e?.Offer > 0 &&
- e?.BookingTypeName === BookingTypeName
- ) {
- const newQty = e?.OrderQty - BuyProdQty;
-
- return {
- ...e,
- OrderQty: newQty,
- ...calculateAmounts(newQty, e.OrderRate, e.TaxPercentage),
- };
- }
- if (
- e?.InwardDtlId == InwardDtlId &&
- e?.Offer == 0 &&
- e?.BookingTypeName !== BookingTypeName
- ) {
- const newQty = e?.OrderQty - BuyProdQty;
-
- let first = {
- ...e,
- OrderQty: BuyProdQty,
- ...calculateAmounts(BuyProdQty, e.OrderRate, e.TaxPercentage),
- };
- if (newQty > 0) {
- let second = {
- ...e,
- Offer: 0,
- OrderQty: newQty,
- ...calculateAmounts(newQty, e.OrderRate, e.TaxPercentage, false),
- };
- return [first, second];
- }
- return [first];
- }
-
- if (e?.InwardDtlId == BuyInwardDtlId) {
- return {
- ...e,
- OrderQty: BuyProdQty,
- ...calculateAmounts(
- BuyProdQty,
- e.OrderRate,
- e.TaxPercentage,
- false
- ),
- };
- }
-
- return e;
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
- if (CompleteRemove) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === InwardDtlId &&
- e?.Offer === Offer &&
- e?.BookingTypeName === BookingTypeName
- )
- );
- return dispatch(changeOrderCardDetails(data));
- }
- if (CompleteRemoveAndPaidToFreeOtherType) {
- let data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === InwardDtlId &&
- e?.Offer === Offer &&
- e?.BookingTypeName === BookingTypeName
- )
- )?.flatMap((exp) => {
- // Same product but different booking type and not an offer
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer == 0 &&
- exp?.BookingTypeName !== BookingTypeName
- ) {
- const remainingQty = exp.OrderQty - OrderQty;
-
- if (remainingQty === 0) {
- return {
- ...exp,
- OfferMode: 'B',
- ...calculateAmounts(
- exp.OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- true
- ),
- };
- }
-
- if (remainingQty > 0) {
- return [
- {
- ...exp,
- OrderQty: remainingQty,
- ...calculateAmounts(
- remainingQty,
- exp.OrderRate,
- exp.TaxPercentage,
- false
- ),
- },
- {
- ...exp,
- OrderQty: OrderQty,
- Offer: 0,
- OfferMode: 'B',
- ...calculateAmounts(
- OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- true
- ),
- },
- ];
- }
- }
-
- return exp;
- });
-
- // ===== Merge duplicates for free offers =====
- const mergedData = [];
- data?.forEach((item) => {
- if (item?.OfferMode === 'B') {
- // Check if a free item already exists for this product + booking type
- const existingIndex = mergedData.findIndex(
- (e) =>
- e.InwardDtlId === item.InwardDtlId &&
- e.BookingTypeName === item.BookingTypeName &&
- e.OfferMode === 'B'
- );
-
- if (existingIndex > -1) {
- // Merge quantities
- const existing = mergedData[existingIndex];
- const newQty = existing.OrderQty + item.OrderQty;
- mergedData[existingIndex] = {
- ...existing,
- OrderQty: newQty,
- ...calculateAmounts(
- newQty,
- item.OrderRate,
- item.TaxPercentage,
- true
- ),
- };
- } else {
- mergedData.push(item);
- }
- } else {
- mergedData.push(item);
- }
- });
-
- return dispatch(changeOrderCardDetails(mergedData));
- }
- if (CompleteRemoveAndPaidToFreeOtherTypeWithoutMerge) {
- let data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === InwardDtlId &&
- e?.Offer === Offer &&
- e?.BookingTypeName === BookingTypeName
- )
- )?.flatMap((exp) => {
- // Same product but different booking type and not an offer
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer == 0 &&
- exp?.BookingTypeName !== BookingTypeName
- ) {
- const remainingQty = exp.OrderQty - OrderQty;
-
- if (remainingQty === 0) {
- return {
- ...exp,
- OfferMode: 'B',
- ...calculateAmounts(
- exp.OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- true
- ),
- };
- }
-
- if (remainingQty < 0) {
- return [
- {
- ...exp,
- OrderQty: exp.OrderQty,
- OfferMode: 'B',
- ...calculateAmounts(
- exp.OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- true
- ),
- },
- ];
- }
- }
-
- return exp;
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
-
- if (CompleteRemoveconvertFreetoPaid) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === BuyInwardDtlId &&
- e?.BookingTypeName === BookingTypeName
- )
- )?.map((exp) => {
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer > 0 &&
- exp?.BookingTypeName === BookingTypeName
- ) {
- const { OfferType, OfferMessage, ...exp1 } = exp;
- return {
- ...exp1,
- Offer: 0,
- OrderQty: OrderQty,
- ...calculateAmounts(
- OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- false
- ),
- };
- }
- return exp; // keep unchanged item
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
- if (CompleteRemoveconvertFreetoPaidNotCompletely) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === BuyInwardDtlId &&
- e?.BookingTypeName === BookingTypeName
- )
- )?.flatMap((exp) => {
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer > 0 &&
- exp?.BookingTypeName === BookingTypeName
- ) {
- const { OfferType, OfferMessage, ...exp1 } = exp;
- let first = {
- ...exp1,
- Offer: 0,
- OrderQty: BuyProdQty,
- ...calculateAmounts(
- OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- false
- ),
- };
- if (BuyProdQty < OrderQty) {
- let second = {
- ...exp1,
- Offer: 0,
- OrderQty: exp1?.OrderQty - BuyProdQty,
- ...calculateAmounts(
- exp1?.OrderQty - BuyProdQty,
- exp.OrderRate,
- exp.TaxPercentage,
- true
- ),
- };
- return [first, second];
- }
- return [first];
- }
- return exp; // keep unchanged item
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
- if (CompleteRemoveBuyAndAddWithPaid) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- (e?.InwardDtlId === BuyInwardDtlId &&
- e?.BookingTypeName === BookingTypeName) ||
- (e?.InwardDtlId == InwardDtlId &&
- e?.Offer > 0 &&
- e?.BookingTypeName === BookingTypeName)
- )
- )?.map((exp) => {
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer == 0 &&
- exp?.BookingTypeName === BookingTypeName
- ) {
- return {
- ...exp, // keep existing fields
- OrderQty: OrderQty,
- ...calculateAmounts(
- OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- false
- ),
- };
- }
- return exp; // keep unchanged item
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
-
- if (UpdateBuyAndFree) {
- const data = ModifiedOrderCardDetail?.map((e) => {
- if (
- e?.InwardDtlId == InwardDtlId &&
- e?.Offer > 0 &&
- e?.BookingTypeName === BookingTypeName
- ) {
- const newQty = e?.OrderQty + OrderQty;
- return {
- ...e,
- OrderQty: newQty,
- ...calculateAmounts(newQty, e.OrderRate, e.TaxPercentage),
- };
- }
- if (e?.InwardDtlId == InwardDtlId && e?.Offer == Offer) {
- const newQty = e?.OrderQty - OrderQty;
- return {
- ...e,
- OrderQty: newQty,
-
- ...calculateAmounts(newQty, e.OrderRate, e.TaxPercentage, false),
- };
- }
-
- if (
- e?.InwardDtlId == BuyInwardDtlId &&
- e?.BookingTypeName === BookingTypeName
- ) {
- return {
- ...e,
- OrderQty: BuyProdQty,
- ...calculateAmounts(
- BuyProdQty,
- e.OrderRate,
- e.TaxPercentage,
- false
- ),
- };
- }
-
- return e;
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
-
- if (CompleteRemoveconvertFreetoPaidTwoTypes) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === BuyInwardDtlId &&
- e?.BookingTypeName === BookingTypeName
- )
- )?.flatMap((exp) => {
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer > 0 &&
- exp?.BookingTypeName === BookingTypeName
- ) {
- const { OfferType, OfferMessage, ...exp1 } = exp;
- return {
- ...exp1,
- Offer: 0,
- OrderQty: OrderQty,
- ...calculateAmounts(
- OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- false
- ),
- };
- }
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer > 0 &&
- exp?.BookingTypeName !== BookingTypeName
- ) {
- const { ...exp1 } = exp;
- let first = {
- ...exp1,
- // Offer: 0,
- OrderQty: exp1?.OrderQty - BuyProdQty,
- ...calculateAmounts(
- exp1?.OrderQty - BuyProdQty,
- exp.OrderRate,
- exp.TaxPercentage,
- true
- ),
- };
-
- let second = {
- ...exp1,
- Offer: 0,
- OrderQty: BuyProdQty,
- ...calculateAmounts(
- BuyProdQty,
- exp.OrderRate,
- exp.TaxPercentage,
- false
- ),
- };
- delete second?.OfferMessage;
- delete second?.OfferType;
- return [first, second];
- }
- return exp; // keep unchanged item
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
- // Update qty for normal case
-
- const data = ModifiedOrderCardDetail?.map((e) => {
- if (
- e?.InwardDtlId == InwardDtlId &&
- e?.Offer == Offer &&
- e?.BookingTypeName === BookingTypeName
- ) {
- return {
- ...e,
- OrderQty,
- ...calculateAmounts(OrderQty, e.OrderRate, e.TaxPercentage, false),
- };
- }
- return e;
- });
-
- dispatch(changeOrderCardDetails(data));
- };
-
- const ChangeFreeprodlistFn = async ({
- FreeProdId,
- OfferId,
- OverAllFreeQty,
- RemainingQty,
- FreeQty,
- CompleteRemove = false,
- }) => {
- const deepCopy = JSON.parse(JSON.stringify(OfferFreeProduct));
-
- let ModifyedData;
-
- if (CompleteRemove) {
- // 🔹 Remove the matching FreeProd completely
- ModifyedData = deepCopy?.filter(
- (exp) => !(exp?.OfferId == OfferId && exp?.FreeProdId == FreeProdId)
- );
- } else {
- // 🔹 Update the matching FreeProd
- ModifyedData = deepCopy?.map((exp) => {
- if (exp?.OfferId == OfferId && FreeProdId == exp?.FreeProdId) {
- return {
- ...exp,
- OverAllFreeQty,
- RemainingQty,
- FreeQty,
- };
- }
- return { ...exp };
- });
- }
-
- dispatch(ChangeFullFreeProductList(ModifyedData));
- };
-
- const ChangeOfferAppliedProdsFn = async ({
- inwardDtlId,
- OfferAmount,
- FreeQty,
- CompleteRemove = false,
- insideinwardDtlId = false,
- }) => {
- const deepCopy = JSON.parse(JSON.stringify(GlobalOfferAppliedProductsData));
-
- let ModifyedData;
-
- if (CompleteRemove) {
- // 🔹 Remove case
- if (!insideinwardDtlId) {
- ModifyedData = deepCopy?.filter(
- (exp) => exp?.InwardDtlId !== inwardDtlId
- );
- } else {
- ModifyedData = deepCopy?.filter(
- (exp) =>
- !(
- Array?.isArray(exp?.FreeProductsList)
- ? exp?.FreeProductsList
- : [exp?.FreeProductsList]
- )?.some((freeProd) =>
- freeProd?.ProdVariantDetails?.some((variant) =>
- variant?.StockDetails?.some(
- (stock) => stock?.FreeInwardDtlId === inwardDtlId
- )
- )
- )
- );
- }
- } else {
- // 🔹 Update case
- ModifyedData = deepCopy?.map((exp) => {
- let shouldUpdate = false;
-
- if (!insideinwardDtlId) {
- shouldUpdate = exp?.InwardDtlId == inwardDtlId;
- } else {
- shouldUpdate = (
- Array?.isArray(exp?.FreeProductsList)
- ? exp?.FreeProductsList
- : [exp?.FreeProductsList]
- )?.some((freeProd) =>
- freeProd?.ProdVariantDetails?.some((variant) =>
- variant?.StockDetails?.some(
- (stock) => stock?.FreeInwardDtlId === inwardDtlId
- )
- )
- );
- }
-
- if (shouldUpdate) {
- return {
- ...exp,
- OfferAmount,
- ActualFreeQty: FreeQty,
- FreeProductsList: (Array?.isArray(exp?.FreeProductsList)
- ? exp?.FreeProductsList
- : [exp?.FreeProductsList]
- )?.map((item, idx) =>
- idx === 0
- ? {
- ...item,
- FreeQty,
- }
- : item
- ),
- };
- }
-
- return { ...exp };
- });
- }
-
- dispatch(changeFullOfferAppliedProducts(ModifyedData));
- };
-
- const removeFromCart = async (item) => {
- removeExtraCharge(item);
- setPreviousdataLength(tableData?.length);
-
- let ischeckBothBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer > 0 &&
- e?.BookingTypeName != item?.BookingTypeName
- );
-
- if (tableData?.length <= 1) {
- await dispatch(changeReorderHoldDetails({}));
- await dispatch(changeReorderProductDetails([]));
- await dispatch(changeUnpaidData(false));
- await dispatch(changeBookingType('TakeAway'));
- await dispatch(changeTokenOnly(false));
- await dispatch(ChangeTotalAmount([]));
- await dispatch(changeAllProductTokenAvailable(false));
- await dispatch(ChangeOverAllDiscSales(null));
- await dispatch(ChangeOverAllDiscEstimate(null));
- await dispatch(changeSelProdWiseEst([]));
- dispatch(changeBillEditingMode(false));
- await dispatch(changePreviousOrderPayment([]));
- await dispatch(changePreviousOrderOfferDetail([]));
- await dispatch(changeSelectedOption(null));
- await dispatch(ChangeSelectedCustDisable(false));
- }
-
- if (item?.Offer > 0) {
- //check is Buyxgetx Or something
- // let ischeck= GlobalOfferAppliedProductsData?.some((e)=>e?.FreeProductsList?.[0]??.
- const isBuyAndGetX =
- GlobalOfferAppliedProductsData?.find((data) =>
- (Array?.isArray(data?.FreeProductsList)
- ? data?.FreeProductsList
- : [data?.FreeProductsList]
- )?.some((freeProd) =>
- freeProd?.ProdVariantDetails?.some((variant) =>
- variant?.StockDetails?.some(
- (stock) => stock?.FreeInwardDtlId === item?.InwardDtlId
- )
- )
- )
- )?.OfferMode == 'B';
-
- const isItemWiseOrQuantityProduct = GlobalOfferAppliedProductsData?.find(
- (data) =>
- data?.ProdId === item?.ProdId &&
- data?.InwardDtlId === item?.InwardDtlId &&
- (data?.OfferMode === 'I' || data?.OfferMode === 'Q') &&
- data?.OfferAmount === item?.Offer
- );
-
- const isCheckFreeProduct = GlobalOfferAppliedProductsData?.find((off) =>
- (Array.isArray(off?.FreeProductsList)
- ? off?.FreeProductsList
- : [off?.FreeProductsList]
- )?.some((prod) =>
- prod?.ProdVariantDetails?.some((variant) =>
- variant?.StockDetails?.some(
- (stock) => stock.FreeInwardDtlId === item?.InwardDtlId
- )
- )
- )
- );
-
- if (isBuyAndGetX) {
- let isPaidproduct = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- item?.BookingTypeName == e?.BookingTypeName
- );
- const isCheckFreeProduct = OfferFreeProduct?.find((exp) =>
- exp?.ProdVariantDetails?.some((variant) =>
- variant?.StockDetails?.some(
- (stock) => stock?.FreeInwardDtlId === item?.InwardDtlId
- )
- )
- );
- if (isPaidproduct) {
- if (isPaidproduct?.OrderQty == item?.OrderQty) {
- //just remove Paid Qty
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidproduct?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- OrderRate: isPaidproduct?.OrderRate,
- BuyInwardDtlId: null,
- Offer: 0,
- });
- } else if (isPaidproduct?.OrderQty > item?.OrderQty) {
- // Just Decrease Paid Qty
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidproduct?.OrderQty - item?.OrderQty,
- CompleteRemove: false,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: 0,
- });
- } else if (isPaidproduct?.OrderQty < item?.OrderQty) {
- //just remove Paid Qty
- //decrease FreeQty
-
- if (ischeckBothBookingType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: -isPaidproduct?.OrderQty,
- RemoveAndUpdate: true,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: 0,
- });
-
- await ChangeFreeprodlistFn({
- OverAllFreeQty: isCheckFreeProduct?.OverAllFreeQty,
- RemainingQty:
- isCheckFreeProduct?.OverAllFreeQty -
- (ischeckBothBookingType?.OrderQty + isPaidproduct?.OrderQty),
- FreeQty:
- ischeckBothBookingType?.OrderQty + isPaidproduct?.OrderQty,
- FreeProdId: isPaidproduct?.ProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: isPaidproduct?.InwardDtlId,
- OfferAmount: isPaidproduct?.OrderRate * isPaidproduct?.OrderQty,
- FreeQty: isPaidproduct?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- } else {
- let FreeProdcutinPaidModeOtherBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- item?.BookingTypeName != e?.BookingTypeName
- );
-
- if (FreeProdcutinPaidModeOtherBookingType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: item?.OrderQty - isPaidproduct?.OrderQty,
- OrderQty: item.OrderQty,
- RemoveAndUpdateOtherBookingType: true,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: 0,
- });
-
- await ChangeFreeprodlistFn({
- OverAllFreeQty: item?.OrderQty,
- RemainingQty:
- item?.OrderQty -
- (isPaidproduct?.OrderQty +
- (FreeProdcutinPaidModeOtherBookingType?.OrderQty -
- (item?.OrderQty - isPaidproduct?.OrderQty) ||
- FreeProdcutinPaidModeOtherBookingType?.OrderQty)),
- FreeQty:
- isPaidproduct?.OrderQty +
- (FreeProdcutinPaidModeOtherBookingType?.OrderQty -
- (item?.OrderQty - isPaidproduct?.OrderQty) ||
- FreeProdcutinPaidModeOtherBookingType?.OrderQty),
- FreeProdId: isPaidproduct?.ProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
-
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: isPaidproduct?.InwardDtlId,
- OfferAmount:
- isPaidproduct?.OrderRate *
- (isPaidproduct?.OrderQty +
- (FreeProdcutinPaidModeOtherBookingType?.OrderQty -
- (item?.OrderQty - isPaidproduct?.OrderQty) ||
- FreeProdcutinPaidModeOtherBookingType?.OrderQty)),
- FreeQty:
- isPaidproduct?.OrderQty +
- (FreeProdcutinPaidModeOtherBookingType?.OrderQty -
- (item?.OrderQty - isPaidproduct?.OrderQty) ||
- FreeProdcutinPaidModeOtherBookingType?.OrderQty),
- insideinwardDtlId: true,
- });
- } else {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidproduct?.OrderQty,
- RemoveAndUpdate: true,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: 0,
- });
-
- await ChangeFreeprodlistFn({
- OverAllFreeQty: item?.OrderQty,
- RemainingQty: item?.OrderQty - isPaidproduct?.OrderQty,
- FreeQty: isPaidproduct?.OrderQty,
- FreeProdId: isPaidproduct?.ProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
-
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: isPaidproduct?.InwardDtlId,
- OfferAmount:
- isPaidproduct?.OrderRate * isPaidproduct?.OrderQty,
- FreeQty: isPaidproduct?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- }
- }
- }
- } else {
- if (ischeckBothBookingType) {
- // //Free Product in Paid Mode
- let FreeProdcutinPaidModeOtherBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- item?.BookingTypeName != e?.BookingTypeName
- );
-
- //if free product is available in paid mode in other booking type then just decrease the free qty from that product
- if (FreeProdcutinPaidModeOtherBookingType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: item?.OrderQty,
- CompleteRemoveAndPaidToFreeOtherType: true,
- InwardDtlId: item?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: isCheckFreeProduct?.OverAllFreeQty,
- RemainingQty: isCheckFreeProduct?.OverAllFreeQty,
- FreeQty: isCheckFreeProduct?.FreeQty,
- FreeProdId: isCheckFreeProduct?.FreeProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * Quantity), Quantity, true,)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount: isCheckFreeProduct?.FreeQty * item?.OrderRate,
- FreeQty: item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- } else {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidproduct?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- OrderRate: item?.OrderRate,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: isCheckFreeProduct?.OverAllFreeQty,
- RemainingQty:
- isCheckFreeProduct?.OverAllFreeQty - item?.OrderQty,
- FreeQty: isCheckFreeProduct?.FreeQty - item?.OrderQty,
- FreeProdId: isCheckFreeProduct?.FreeProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * Quantity), Quantity, true,)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- (isCheckFreeProduct?.FreeQty - item?.OrderQty) *
- item?.OrderRate,
- FreeQty: item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- }
- }
-
- // }
- else {
- let isPaidProductAvailableInCartOtherType = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- item?.BookingTypeName != e?.BookingTypeName
- );
-
- if (isPaidProductAvailableInCartOtherType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: item?.OrderQty,
- CompleteRemoveAndPaidToFreeOtherTypeWithoutMerge: true,
- InwardDtlId: item?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: isCheckFreeProduct?.OverAllFreeQty,
- RemainingQty:
- isCheckFreeProduct?.OverAllFreeQty -
- (isCheckFreeProduct?.FreeQty -
- (item?.OrderQty -
- isPaidProductAvailableInCartOtherType?.OrderQty)),
- FreeQty:
- isCheckFreeProduct?.FreeQty -
- (item?.OrderQty -
- isPaidProductAvailableInCartOtherType?.OrderQty),
- FreeProdId: isCheckFreeProduct?.FreeProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * Quantity), Quantity, true,)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- item?.OrderRate *
- (isCheckFreeProduct?.FreeQty -
- (item?.OrderQty -
- isPaidProductAvailableInCartOtherType?.OrderQty)),
- FreeQty:
- isCheckFreeProduct?.FreeQty -
- (item?.OrderQty -
- isPaidProductAvailableInCartOtherType?.OrderQty),
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- } else {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidproduct?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- OrderRate: item?.OrderRate,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: isCheckFreeProduct?.OverAllFreeQty,
- RemainingQty: isCheckFreeProduct?.OverAllFreeQty,
- FreeQty: 0,
- FreeProdId: isCheckFreeProduct?.FreeProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * Quantity), Quantity, true,)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount: item?.OrderRate * item?.OrderQty,
- FreeQty: item?.OrderQty,
- CompleteRemove: true,
- insideinwardDtlId: true,
- });
- }
- }
- //Change Remove OrderCartDetail
- //Remove FreeprodList
- //ChangeOfferApplied Products
- }
- } else {
- ///remove item wise offer
- if (isItemWiseOrQuantityProduct) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: item?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- OrderRate: item?.OrderRate,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- });
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount: item?.OrderRate * item?.OrderQty,
- FreeQty: item?.OrderQty,
- CompleteRemove: true,
- });
- } else if (isCheckFreeProduct) {
- // remove or update loyalty/code based free product which is added in cart
- const freeProdList = Array?.isArray(
- isCheckFreeProduct?.FreeProductsList
- )
- ? isCheckFreeProduct?.FreeProductsList?.[0]
- : isCheckFreeProduct?.FreeProductsList;
- let isPaidProductAvailableInCart = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- item?.BookingTypeName == e?.BookingTypeName
- );
- if (isPaidProductAvailableInCart) {
- if (isPaidProductAvailableInCart?.OrderQty === item?.OrderQty) {
- //just remove Paid Qty
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidProductAvailableInCart?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: isPaidProductAvailableInCart?.InwardDtlId,
- BuyInwardDtlId: null,
- OrderRate: isPaidProductAvailableInCart?.OrderRate,
- Offer: 0,
- });
- } else if (
- isPaidProductAvailableInCart?.OrderQty > item?.OrderQty
- ) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty:
- isPaidProductAvailableInCart?.OrderQty - item?.OrderQty,
- CompleteRemove: false,
- InwardDtlId: isPaidProductAvailableInCart?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: 0,
- });
- } else if (
- isPaidProductAvailableInCart?.OrderQty < item?.OrderQty
- ) {
- //just remove Paid Qty
- //decrease FreeQty
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: -isPaidProductAvailableInCart?.OrderQty,
- RemoveAndUpdate: true,
- InwardDtlId: isPaidProductAvailableInCart?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: 0,
- });
-
- if (ischeckBothBookingType) {
- await ChangeFreeprodlistFn({
- OverAllFreeQty: freeProdList?.OverAllFreeQty,
- RemainingQty:
- freeProdList?.OverAllFreeQty -
- (ischeckBothBookingType?.OrderQty +
- isPaidProductAvailableInCart?.OrderQty),
- FreeQty:
- ischeckBothBookingType?.OrderQty +
- isPaidProductAvailableInCart?.OrderQty,
- FreeProdId: isPaidProductAvailableInCart?.ProdId,
- OfferId: freeProdList?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: isPaidProductAvailableInCart?.InwardDtlId,
- OfferAmount:
- isPaidProductAvailableInCart?.OrderRate *
- isPaidProductAvailableInCart?.OrderQty,
- FreeQty: isPaidProductAvailableInCart?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- } else {
- await ChangeFreeprodlistFn({
- OverAllFreeQty: item?.OrderQty,
- RemainingQty:
- item?.OrderQty - isPaidProductAvailableInCart?.OrderQty,
- FreeQty: isPaidProductAvailableInCart?.OrderQty,
- FreeProdId: isPaidProductAvailableInCart?.ProdId,
- OfferId: freeProdList?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: isPaidProductAvailableInCart?.InwardDtlId,
- OfferAmount:
- isPaidProductAvailableInCart?.OrderRate *
- isPaidProductAvailableInCart?.OrderQty,
- FreeQty: isPaidProductAvailableInCart?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- }
- }
- } else {
- if (ischeckBothBookingType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidProductAvailableInCart?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- OrderRate: item?.OrderRate,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: freeProdList?.OverAllFreeQty,
- RemainingQty: freeProdList?.OverAllFreeQty - item?.OrderQty,
- FreeQty: freeProdList?.FreeQty - item?.OrderQty,
- FreeProdId: freeProdList?.FreeProdId,
- OfferId: freeProdList?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * Quantity), Quantity, true,)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- (freeProdList?.FreeQty - item?.OrderQty) * item?.OrderRate,
- FreeQty: item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- } else {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidProductAvailableInCart?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- OrderRate: item?.OrderRate,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: freeProdList?.OverAllFreeQty,
- RemainingQty: freeProdList?.OverAllFreeQty,
- FreeQty: 0,
- FreeProdId: freeProdList?.FreeProdId,
- OfferId: freeProdList?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * Quantity), Quantity, true,)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount: item?.OrderRate * item?.OrderQty,
- FreeQty: item?.OrderQty,
- CompleteRemove: true,
- insideinwardDtlId: true,
- });
- }
- }
- } else {
- let ModifiedOrderCardDetail = JSON.parse(JSON.stringify(tableData));
-
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === item?.InwardDtlId &&
- e?.Offer === item?.Offer &&
- e?.BookingTypeName === item?.BookingTypeName &&
- (!e?.SalesId || OrderType == 'Hold')
- )
- );
- return dispatch(changeOrderCardDetails(data));
- }
- }
- } else {
- const isCheckFreeProductOutside = OfferFreeProduct?.find(
- (exp) => exp?.InwardDtlId == item?.InwardDtlId
- );
-
- if (!isCheckFreeProductOutside) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: item?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- OrderRate: item?.OrderRate,
- });
- } else {
- const isCheck = GlobalOfferAppliedProductsData?.find(
- (exp) => exp?.InwardDtlId === item?.InwardDtlId
- );
- const FreeProd = OfferFreeProduct?.find(
- (exp) => exp?.InwardDtlId === item?.InwardDtlId
- );
-
- if (isCheck) {
- let inward =
- isCheck?.FreeProductsList?.[0]?.ProdVariantDetails?.[0]
- ?.StockDetails?.[0]?.FreeInwardDtlId;
-
- let isPaidproduct = tableData?.find(
- (e) =>
- e?.InwardDtlId == inward &&
- e?.Offer == 0 &&
- e?.BookingTypeName == item?.BookingTypeName
- );
- if (isPaidproduct) {
- let ischeckBothBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == inward &&
- e?.Offer > 0 &&
- e?.BookingTypeName != item?.BookingTypeName
- );
-
- //if any Paid Product is there, we have to Merge With That
- if (ischeckBothBookingType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty:
- isPaidproduct?.OrderQty +
- isCheck?.ActualFreeQty -
- ischeckBothBookingType?.OrderQty,
- CompleteRemoveBuyAndAddWithPaid: true,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- BuyInwardDtlId: item?.InwardDtlId,
- Offer: item?.Offer,
- });
-
- await ChangeFreeprodlistFn({
- OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
- RemainingQty:
- FreeProd?.OverAllFreeQty -
- item?.OrderQty -
- (FreeProd?.FreeQty - item?.OrderQty),
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: false,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- isPaidproduct?.OrderRate *
- (FreeProd?.FreeQty - item?.OrderQty),
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: false,
- });
- } else {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidproduct?.OrderQty + isCheck?.ActualFreeQty,
- CompleteRemoveBuyAndAddWithPaid: true,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- BuyInwardDtlId: item?.InwardDtlId,
- Offer: item?.Offer,
- });
-
- await ChangeFreeprodlistFn({
- OverAllFreeQty: item?.OrderQty,
- RemainingQty: item?.OrderQty - isPaidproduct?.OrderQty,
- FreeQty: isPaidproduct?.OrderQty,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: true,
- });
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount: isPaidproduct?.OrderRate * isPaidproduct?.OrderQty,
- FreeQty: isPaidproduct?.OrderQty,
- CompleteRemove: true,
- insideinwardDtlId: false,
- });
- }
- } else {
- let ischeckBothBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == inward &&
- e?.Offer > 0 &&
- e?.BookingTypeName != item?.BookingTypeName
- );
-
- let FreeProductSameBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == inward &&
- e?.Offer > 0 &&
- e?.BookingTypeName == item?.BookingTypeName
- );
- if (ischeckBothBookingType) {
- if (FreeProductSameBookingType?.OrderQty >= item?.OrderQty) {
- await ChangeFreeprodlistFn({
- OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
- RemainingQty:
- FreeProd?.OverAllFreeQty -
- item?.OrderQty -
- (FreeProd?.FreeQty - item?.OrderQty),
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: false,
- });
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: item?.OrderQty,
- OrderQty: FreeProductSameBookingType?.OrderQty,
- CompleteRemoveconvertFreetoPaidNotCompletely: true,
- InwardDtlId: inward,
- BuyInwardDtlId: item?.InwardDtlId,
- Offer: item?.Offer,
- });
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- (FreeProd?.FreeQty - item?.OrderQty) *
- ischeckBothBookingType?.OrderRate,
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: false,
- });
- } else {
- let data = isCheckFreeProductOutside?.FreeQty - item?.OrderQty;
- let anotherBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- e?.BookingTypeName != item?.BookingTypeName
- );
- let anotherBookingTypeOffer = tableData?.find(
- (e) =>
- e?.InwardDtlId == inward &&
- e?.Offer > 0 &&
- e?.BookingTypeName != item?.BookingTypeName
- );
-
- let diff =
- item?.OrderQty - FreeProductSameBookingType?.OrderQty;
-
- if (
- (anotherBookingType?.OrderQty || 0) <
- anotherBookingTypeOffer?.OrderQty
- ) {
- let paidproductAnotherType =
- ischeckBothBookingType?.OrderQty -
- anotherBookingType?.OrderQty;
- let paidproductCurrentType =
- FreeProductSameBookingType?.OrderQty;
-
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: paidproductAnotherType,
- OrderQty: paidproductCurrentType,
- CompleteRemoveconvertFreetoPaidTwoTypes: true,
- InwardDtlId: inward,
- BuyInwardDtlId: item?.InwardDtlId,
- Offer: item?.Offer,
- });
-
- await ChangeFreeprodlistFn({
- OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
- RemainingQty:
- FreeProd?.OverAllFreeQty -
- item?.OrderQty -
- (FreeProd?.FreeQty -
- (paidproductCurrentType + paidproductCurrentType)),
- FreeQty:
- FreeProd?.FreeQty -
- (paidproductCurrentType + paidproductCurrentType),
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: false,
- });
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- (FreeProd?.FreeQty - item?.OrderQty) *
- ischeckBothBookingType?.OrderRate,
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: false,
- });
- } else {
- await ChangeFreeprodlistFn({
- OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
- RemainingQty:
- FreeProd?.OverAllFreeQty -
- item?.OrderQty -
- (FreeProd?.FreeQty - item?.OrderQty),
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: false,
- });
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: FreeProductSameBookingType?.OrderQty,
- CompleteRemoveconvertFreetoPaid: true,
- InwardDtlId: inward,
- BuyInwardDtlId: item?.InwardDtlId,
- Offer: item?.Offer,
- });
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- (FreeProd?.FreeQty - item?.OrderQty) *
- ischeckBothBookingType?.OrderRate,
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: false,
- });
- }
- }
- } else {
- await ChangeFreeprodlistFn({
- OverAllFreeQty: item?.OrderQty,
- RemainingQty: item?.OrderQty - isPaidproduct?.OrderQty,
- FreeQty: isPaidproduct?.OrderQty,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: true,
- });
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: FreeProductSameBookingType?.OrderQty,
- CompleteRemoveconvertFreetoPaid: true,
- InwardDtlId: inward,
- BuyInwardDtlId: item?.InwardDtlId,
- Offer: item?.Offer,
- });
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- (isCheck?.ActualFreeQty -
- FreeProductSameBookingType?.OrderQty) *
- isPaidproduct?.OrderQty,
- FreeQty:
- isCheck?.ActualFreeQty - FreeProductSameBookingType?.OrderQty,
- CompleteRemove: true,
- insideinwardDtlId: false,
- });
- }
- }
- } else {
- let ischeckBothBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- e?.BookingTypeName != item?.BookingTypeName
- );
-
- if (ischeckBothBookingType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: 0,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- BuyInwardDtlId: item?.InwardDtlId,
- OrderRate: item?.OrderRate,
- Offer: item?.Offer,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
- RemainingQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
- FreeQty: 0,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: false,
- });
- } else {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: 0,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- BuyInwardDtlId: item?.InwardDtlId,
- OrderRate: item?.OrderRate,
- Offer: item?.Offer,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: item?.OrderQty,
- RemainingQty: 0,
- FreeQty: 0,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: true,
- });
- }
- //Remove From Free ProdList That Entirely
- }
- }
- }
- };
-
- function safeRound(amountStr) {
- if (amountStr == null) return allowDecimal ? '0.00' : '0';
-
- const cleaned = String(amountStr).replace(/[^0-9.-]+/g, '');
- const num = Number(cleaned);
-
- if (isNaN(num)) return allowDecimal ? '0.00' : '0';
-
- return allowDecimal ? num.toFixed(2) : Math.round(num).toString();
- }
-
- const handleCustomerProductPriceHistory = (item) => {
- setCustomerPriceHistoryOpen(true);
- setCustomerProduct(item?.ProdId);
- };
-
- const OpenEditTotalAmount = () => {
- setOpenEditTotalAmt(true);
- };
- const handleEditTotalAmountCancel = () => {
- setOpenEditTotalAmt(false);
- };
-
- const handleEditQuantity = (value) => {
- if (OtherServicesglobal && value.Type == 'OS' && value.ServiceType == 'I') {
- setEditQuantity(false);
- } else {
- setEditQuantity(true);
- setModaldata(value);
- setIndex(value?.localId);
- }
- };
-
- const handleEditQuantityCancel = () => {
- setEditQuantity(false);
- };
-
- return (
-
-
-
-
- {tableOptions?.map((item) => (
- <>
- {item.OptionName == 'Sl.No' && BookingTypeBoth && (
-
- {!isMobile ? (
- {''}
- ) : (
- {''}
- )}
-
- )}
- {item.OptionName == 'Sl.No' && (
-
- {!isMobile ? (
- Sl.No
- ) : (
- Sl.No
- )}
-
- )}
- {item.OptionName == 'Item' && (
-
- {!isMobile ? (
- Item
- ) : (
- Item
- )}
-
- )}
- {item.OptionName == 'MRP' && (
-
- {!isMobile ? (
- MRP
- ) : (
- MRP
- )}
-
- )}
- {item.OptionName == 'Discount' && (
-
- {!isMobile ? (
- ₹/%
- ) : (
- ₹/%
- )}
-
- )}
- {item.OptionName == 'Quantity' && (
- 0 ? OpenEditTotalAmount : ""}
- onClick={() => {
- if (tableData?.length > 0) {
- OpenEditTotalAmount();
- }
- }}
- >
- {!isMobile ? (
- Qty
- ) : (
- Qty
- )}
-
- )}
- {item.OptionName == 'Rate' && (
-
- {!isMobile ? (
- Rt
- ) : (
- Rt
- )}
-
- )}
- {item.OptionName == 'Amount' && (
-
- {!isMobile ? (
- Amt
- ) : (
- Amt
- )}
-
- )}
-
- {item.OptionName == 'Delete' && (
-
- {tableData?.length > 0 ? (
- {
- Clearall();
- }}
- >
-
- {' '}
- {!isMobile ? (
-
- {' '}
- {' '}
-
- ) : (
-
- )}{' '}
-
-
- ) : (
-
- {!isMobile ? (
-
-
-
- ) : (
-
- )}
-
- )}
-
- )}
- >
- ))}
-
-
- {/* For Reorder TakeWay */}
- {OldtableDataTakeAway?.length > 0 && (
-
- {OldtableDataTakeAway?.map((item, index) => (
- = PreviousdataLength
- ? 'wheat'
- : triggerAnimation &&
- index === 0 &&
- tableDataTakeAway?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'wheat'
- : 'inherit'
- : 'none',
- background:
- item?.SalesId && OrderType !== 'Hold'
- ? 'rgb(243, 248, 213)'
- : GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
- ? '#b2d1f7'
- : index % 2 === 0
- ? 'white'
- : SelectedBillColor?.['OverallBackgroundColor']
- ? SelectedBillColor?.['OverallBackgroundColor']
- : '#d6d6d6',
- animation:
- BillOrderPre === 'Y' && !BookingTypeBoth
- ? triggerAnimation &&
- index === 0 &&
- !item?.SalesId &&
- tableDataTakeAway?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'splashAnimation 0.5s ease-in-out'
- : 'none'
- : 'none',
- }}
- >
- {tableOptions?.map((tableitem) => (
- <>
- {BookingTypeBoth &&
- index == 0 &&
- tableitem.OptionName == 'Sl.No' && (
-
-
-
- )}
-
- {tableitem.OptionName == 'Sl.No' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {index + 1}
-
- )}
- {tableitem.OptionName == 'Item' && (
-
- item.FullProductIdentifierDtls?.length > 0 ||
- item.ProductIdentifierDtls?.length > 0 ||
- imeiModal
- ? handleImeiDetails(item)
- : editField && handleEditQuantity(item)
- }
- >
- {item.ProdName}
- {item?.BrandName !== null ? item?.BrandName : ''}
- {item?.Type != 'C' && (
- <>
-
- (
- {!item?.ProdVariantName?.toLowerCase()?.includes(
- 'variant'
- ) && {item?.ProdVariantName} }
- {item?.Size}
- {item?.SinglePc == 'Y' ? 'PCS' : item?.UomName})
-
- {item?.OfferMessage &&
- !Array.isArray(item.OfferMessage) && (
-
- {item.OfferMessage?.split('>')?.[0] +
- `> ${item?.OrderQty} Eligible Free`}
-
- )}
- >
- )}
- {item?.Type === 'C' && (
-
- {item.ProdDetail?.map((prod, index) => (
-
- {prod.ProdName} - {prod.Size} {prod.UomName}
-
- ))}
-
- )}
- {productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- ) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
-
- )}
- {tableitem.OptionName == 'MRP' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item?.MRP}
-
- )}
- {tableitem.OptionName == 'Discount' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item?.Type != 'C'
- ? item.Offer && item.Offer > 0
- ? item.Offer
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'
- : item?.OfferPrice && item?.OfferPrice > 0
- ? item?.OfferType === 'F'
- ? `₹${safeRound(item.OfferPrice)}`
- : `${item.OfferPrice}%`
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'}
-
- )}
- {tableitem.OptionName == 'Quantity' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item.OrderQty}
-
- )}
- {tableitem.OptionName == 'Rate' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item?.OrderRate}
-
- )}
- {tableitem.OptionName == 'Amount' && (
- {
- // if (editField) {
- // handleEditQuantity(item);
- // }
- if (GetCustId) {
- handleCustomerProductPriceHistory(item);
- }
- }}
- >
- {item.TotalAmt}
-
- )}
-
- {tableitem.OptionName == 'Delete' && (
- removeFromCart(item)}
- >
-
-
- )}
- >
- ))}
-
- ))}
- {EditQuantity && OldtableDataTakeAway?.length > 0 && (
-
- )}
-
- )}
- {/* Reorder DineIn */}
- {OldtableDataDinein?.length > 0 && (
-
- {OldtableDataDinein?.map((item, index) => (
- = PreviousdataLength
- ? 'wheat'
- : BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length + index === 0 &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'wheat'
- : 'inherit'
- : 'none',
- background: item?.SalesId
- ? 'rgb(243, 248, 213)'
- : GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
- ? '#b2d1f7'
- : (OldtableDataTakeAway?.length + index) % 2 === 0
- ? 'white'
- : SelectedBillColor?.['OverallBackgroundColor']
- ? SelectedBillColor?.['OverallBackgroundColor']
- : '#d6d6d6',
- animation:
- BillOrderPre === 'Y' && !BookingTypeBoth
- ? triggerAnimation &&
- OldtableDataTakeAway?.length + index === 0 &&
- !item?.SalesId &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'splashAnimation 0.5s ease-in-out'
- : 'none'
- : 'none',
- }}
- >
- {tableOptions?.map((tableitem) => (
- <>
- {BookingTypeBoth &&
- index == 0 &&
- tableitem.OptionName == 'Sl.No' && (
-
-
-
- )}
- {tableitem.OptionName == 'Sl.No' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {OldtableDataTakeAway?.length + index + 1}
-
- )}
- {tableitem.OptionName == 'Item' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item.ProdName}
- {item?.BrandName !== null ? item?.BrandName : ''}
- {item?.Type != 'C' && (
- <>
-
- (
- {!item?.ProdVariantName?.toLowerCase()?.includes(
- 'variant'
- ) && {item?.ProdVariantName} }
- {item?.Size}
- {item?.SinglePc == 'Y' ? 'PCS' : item?.UomName})
-
- {item?.OfferMessage &&
- !Array.isArray(item.OfferMessage) && (
-
- {item.OfferMessage?.split('>')?.[0] +
- `> ${item?.OrderQty} Eligible Free`}
-
- )}
- >
- )}
- {item?.Type === 'C' && (
-
- {item.ProdDetail?.map((prod, index) => (
-
- {prod.ProdName} - {prod.Size} {prod.UomName}
-
- ))}
-
- )}
- {productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- ) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
-
- )}
- {tableitem.OptionName == 'MRP' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item?.MRP}
-
- )}
- {tableitem.OptionName == 'Discount' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item?.Type != 'C'
- ? item.Offer && item.Offer > 0
- ? item.Offer
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'
- : item?.OfferPrice && item?.OfferPrice > 0
- ? item?.OfferType === 'F'
- ? `₹${safeRound(item.OfferPrice)}`
- : `${item.OfferPrice}%`
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'}
-
- )}
- {tableitem.OptionName == 'Quantity' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item.OrderQty}
-
- )}
- {tableitem.OptionName == 'Rate' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item?.OrderRate}
-
- )}
- {tableitem.OptionName == 'Amount' && (
- {
- // if (editField) {
- // handleEditQuantity(item);
- // }
- if (GetCustId) {
- handleCustomerProductPriceHistory(item);
- }
- }}
- >
- {item.TotalAmt}
-
- )}
-
- {tableitem.OptionName == 'Delete' && (
- removeFromCart(item)}
- >
-
-
- )}
- >
- ))}
-
- ))}
- {OldtableDataDinein?.length > 0 && EditQuantity && (
-
- )}
-
- )}
- {/* TakeWay */}
- {tableDataTakeAway?.length > 0 && (
-
- {tableDataTakeAway?.map((item, index) => (
- = PreviousdataLength
- ? 'wheat'
- : BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
- tableDataTakeAway?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'wheat'
- : (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
- ? 'white'
- : SelectedBillColor?.['OverallBackgroundColor']
- ? SelectedBillColor?.['OverallBackgroundColor']
- : '#d6d6d6'
- : (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
- ? 'white'
- : SelectedBillColor?.['OverallBackgroundColor']
- ? SelectedBillColor?.['OverallBackgroundColor']
- : '#d6d6d6',
- background:
- BookingType === 'Dine In' && item?.SalesId
- ? 'rgb(243, 248, 213)'
- : GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
- ? '#b2d1f7'
- : (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
- ? 'white'
- : SelectedBillColor?.['OverallBackgroundColor']
- ? SelectedBillColor?.['OverallBackgroundColor']
- : '#d6d6d6',
- animation:
- BillOrderPre === 'Y' && !BookingTypeBoth
- ? triggerAnimation &&
- OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
- !item?.SalesId &&
- tableDataTakeAway?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'splashAnimation 0.5s ease-in-out'
- : 'none'
- : 'none',
- }}
- >
- {tableOptions?.map((tableitem) => (
- <>
- {BookingTypeBoth &&
- index == 0 &&
- tableitem.OptionName == 'Sl.No' && (
-
-
-
- )}
- {tableitem.OptionName == 'Sl.No' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index +
- 1}
-
- )}
- {tableitem.OptionName == 'Item' && (
-
- item.FullProductIdentifierDtls?.length > 0 ||
- item.ProductIdentifierDtls?.length > 0 ||
- imeiModal
- ? handleImeiDetails(item)
- : editField && handleEditQuantity(item)
- }
- >
- {item.ProdName}
- {item?.BrandName !== null ? item?.BrandName : ''}
- {item?.Type != 'C' && (
- <>
-
- {item?.Type !== 'OS' && (
- <>
- {!item?.ProdVariantName?.toLowerCase()?.includes(
- 'variant'
- ) && {item?.ProdVariantName} }
- {item?.Size}
- {item?.SinglePc == 'Y'
- ? 'PCS'
- : item?.UomName}
- >
- )}
-
- {item?.OfferMessage &&
- !Array.isArray(item.OfferMessage) && (
-
- {item.OfferMessage?.split('>')?.[0] +
- `> ${item?.OrderQty} Eligible Free`}
-
- )}
- >
- )}
- {item?.Type === 'C' && (
-
- {item.ProdDetail?.map((prod, index) => (
-
- {prod.ProdName} - {prod.Size} {prod.UomName}
-
- ))}
-
- )}
- {productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- ) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
-
- )}
- {tableitem.OptionName == 'MRP' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item?.MRP}
-
- )}
- {tableitem.OptionName == 'Discount' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item?.Type != 'C'
- ? item.Offer && item.Offer > 0
- ? item.Offer
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'
- : item?.OfferPrice && item?.OfferPrice > 0
- ? item?.OfferType === 'F'
- ? `₹${safeRound(item.OfferPrice)}`
- : `${item.OfferPrice}%`
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'}
-
- )}
- {tableitem.OptionName == 'Quantity' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item?.OrderQty}
-
- )}
- {tableitem.OptionName == 'Rate' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item?.OrderRate}
-
- )}
- {tableitem.OptionName == 'Amount' && (
- {
- // if (editField) {
- // handleEditQuantity(item);
- // }
- if (GetCustId) {
- handleCustomerProductPriceHistory(item);
- }
- }}
- >
- {item.TotalAmt}
-
- )}
- {tableitem.OptionName == 'Delete' && (
- removeFromCart(item)}
- >
-
-
- )}
- >
- ))}
-
- ))}
- {tableDataTakeAway?.length > 0 && EditQuantity && (
-
- )}
-
- )}
- {/* DineIn */}
- {tableDataDinein?.length > 0 && (
-
- {tableDataDinein?.map((item, index) => (
- = PreviousdataLength
- ? 'wheat'
- : BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'wheat'
- : 'inherit'
- : 'none',
- background:
- BookingType === 'Dine In' &&
- item?.SalesId &&
- !BookingTypeBoth
- ? 'rgb(243, 248, 213)'
- : GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
- ? '#b2d1f7'
- : (OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index) %
- 2 ===
- 0
- ? 'white'
- : SelectedBillColor?.['OverallBackgroundColor']
- ? SelectedBillColor?.['OverallBackgroundColor']
- : '#d6d6d6',
- animation:
- BillOrderPre === 'Y' && !BookingTypeBoth
- ? triggerAnimation &&
- OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
- !item?.SalesId &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'splashAnimation 0.5s ease-in-out'
- : 'none'
- : 'none',
- }}
- >
- {tableOptions?.map((tableitem) => (
- <>
- {BookingTypeBoth &&
- index == 0 &&
- tableitem.OptionName == 'Sl.No' && (
-
-
-
- )}
- {tableitem.OptionName == 'Sl.No' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index +
- 1}
-
- )}
- {tableitem.OptionName == 'Item' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item.ProdName}
- {item?.BrandName !== null ? item?.BrandName : ''}
- {item?.Type != 'C' && (
- <>
-
- (
- {!item?.ProdVariantName?.toLowerCase()?.includes(
- 'variant'
- ) && {item?.ProdVariantName} }
- {item?.Size}
- {item?.SinglePc == 'Y' ? 'PCS' : item?.UomName})
-
- {item?.OfferMessage &&
- !Array.isArray(item.OfferMessage) && (
-
- {item.OfferMessage?.split('>')?.[0] +
- `> ${item?.OrderQty} Eligible Free`}
-
- )}
- >
- )}
- {item?.Type === 'C' && (
-
- {item.ProdDetail?.map((prod, index) => (
-
- {prod.ProdName} - {prod.Size} {prod.UomName}
-
- ))}
-
- )}
- {productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- ) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
-
- )}
- {tableitem.OptionName == 'MRP' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item?.MRP}
-
- )}
- {tableitem.OptionName == 'Discount' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item?.Type != 'C'
- ? item.Offer && item.Offer > 0
- ? item.Offer
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'
- : item?.OfferPrice && item?.OfferPrice > 0
- ? item?.OfferType === 'F'
- ? `₹${safeRound(item.OfferPrice)}`
- : `${item.OfferPrice}%`
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'}
-
- )}
- {tableitem.OptionName == 'Quantity' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item.OrderQty}
-
- )}
- {tableitem.OptionName == 'Rate' && (
- {
- if (editField) {
- handleEditQuantity(item);
- }
- }}
- >
- {item?.OrderRate}
-
- )}
- {tableitem.OptionName == 'Amount' && (
- {
- // if (editField) {
- // handleEditQuantity(item);
- // }
- if (GetCustId) {
- handleCustomerProductPriceHistory(item);
- }
- }}
- >
- {item.TotalAmt}
-
- )}
-
- {tableitem.OptionName == 'Delete' && (
- removeFromCart(item)}
- >
-
-
- )}
- >
- ))}
-
- ))}
- {tableDataDinein?.length > 0 && EditQuantity && (
-
- )}
-
- )}
-
- {OpenEditTotalAmt && (
-
- )}
- {OpenImeiDetail && (
-
- )}
- {customerPriceHistoryOpen && GetCustId && (
-
- )}
-
- );
-};
-
-export default BSBillingTable6;
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx
deleted file mode 100644
index bcd6884..0000000
--- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx
+++ /dev/null
@@ -1,4872 +0,0 @@
-import React, { useEffect, useState, useRef, lazy } from 'react';
-import { shallowEqual, useDispatch, useSelector } from 'react-redux';
-import { useNavigate } from 'react-router-dom';
-import moment from 'moment';
-import { AiOutlineClose, AiOutlineArrowRight } from 'react-icons/ai';
-import { Tables } from '../../../../../Components/Tables/Table';
-import { DefaultModal } from '../../../../../Components/Modal/DefaultModal.jsx';
-import { UpCircleOutlined } from '@ant-design/icons';
-import { Popover, Badge, Modal, Tooltip } from 'antd';
-import {
- printDiv,
- extractLastNumberOrderId,
- encryptObject,
-} from '../../../../../Services/Others';
-import { Messages } from '../../../../../Components/Notifications/Messages';
-import BSBillingTable6 from '../BSBillingTable6/BSBillingTable6';
-import paygate from '../../../../../Images/paygate.png';
-import defaultupi from '../../../../../Images/defaultupi.png';
-import paydevice from '../../../../../Images/paydevice.png';
-import BSSummery1 from '../../BSBillingTables/BSBillingTableSummery/BSSummery';
-import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.scss';
-import {
- GlobalSelectedFont,
- getTemplateData,
- SelectedPrintTemplate,
- StoredSessionData,
- GlobalprintDatas,
- GlobalPrinterMappingDtls,
- getPrinterMappingDetails,
- getPrintSelectionComponentData,
-} from '../../../../../Features/ThemeChange/ThemeChange';
-import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js';
-import {
- GlobalOrderCardDetails,
- changeOrderCardDetails,
- GlobalCustId,
- PostBookingData,
- GlobalSelectedTableDetails,
- GlobalBookingType,
- changeBookingType,
- PutBookingData,
- GlobalReorderHoldDetails,
- getUnpaidData,
- changeReorderHoldDetails,
- ChangeNavHoldData,
- GlobalNavHoldData,
- changeSummeryQty,
- changeSummeryTotalItems,
- changeSummeryTotalAmount,
- changeSummeryTotalTaxAmount,
- changeSummeryTotalWithoutTaxAmount,
- getSelectedFavItems,
- GlobalProductSubCategorie,
- getCardDataWithoutSub,
- getCardDataWithoutSubmodule,
- GlobalProductCategorie,
- GlobalSelCustId,
- changeSelectedOption,
- getLayoutproductCard,
- changeCustomerID,
- changeSelectedCustId,
- GlobalSelOption,
- changeUnpaidData,
- ChangeSelectedCustDisable,
- getSalesDetailData,
- GlobalSelectedCustDisable,
- SendPaymentLink,
- changeUpiIDprint,
- GlobalEstimateBooking,
- GlobalSelProdWiseEst,
- changeSelProdWiseEst,
- GlobalUpiIDprint,
- GlobalUpiIDName,
- GlobalUpiIDoptionId,
- GlobalBookingTypeBoth,
- changeSelectTable,
- changeSelectChair,
- changeSelectedTableDetails,
- changeReorderProductDetails,
- GlobalCommonPaymentOptions,
- changeUpiIDName,
- changeUpiIDoptionId,
- PostPaymentdevice,
- GetPaymentdeviceResponse,
- PutBookingPaymentStatusChange,
- changePaymentloader,
- GlobalPayementloader,
- PaymentGatewayGetdetail,
- changePaymentTransactionNumber,
- Globalunpaidflow,
- changeunpaidflow,
- PutPendingPaymentList,
- ChangeInitialPaymentName,
- PreferenceData,
- changeOrderType,
- GlobalOrderType,
- GlobalFailedTotalAmt,
- putSplitpaymentStatus,
- GlobalOverAllDiscEstimate,
- GlobalOverAllDiscSales,
- ChangeOverAllDiscSales,
- ChangeOverAllDiscEstimate,
- GlobalScreenSize,
- GlobalUnpaidListData,
- GlobalBranchFinancialStatus,
- changeSummeryComboOfferAmount,
- ChangeComboCarddata,
- GlobaltipAmount,
- changeTipAmount,
- GlobalOtherSevices,
- GlobalOtherServiceTicketClaim,
- changeOtherServiceTicketClaim,
- GlobalRetailWSSalesType,
- GlobalDefaultBookingType,
- GlobalPaymentTrigger,
- GlobalCurrentOrderId,
- changeCurrentOrderId,
- GlobalCombocarddata,
- getCreditCustomer,
- GlobalSalesBillEdit,
- GlobalPreviousOrderPayment,
- GlobalPreviousOrderOfferDetails,
- GlobalpaymentOptionData,
- getPaymentOptions,
- putSalesBillEdit,
- changeBillEditingMode,
- changePreviousOrderPayment,
- changePreviousOrderOfferDetail,
- GlobalAllBookingType,
- changeSearchedData,
-} from '../../../../../Features/BookingScreen/BookingData/BookingData';
-import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities';
-import {
- gettinghold,
- globalholddata,
- changeholddata,
-} from '../../../../../Features/BookingScreen/HoldOption/HoldOption';
-import PaymentPdfBooking from '../../../../paymentpdfPage/PaymentPdfBooking';
-import {
- globalExtraTotalAmount,
- ChangeTotalAmount,
-} from '../../../../../Features/ExteraCharges/ExtraCharges';
-import {
- getAddCustomerDetails,
- getDefaultPaymentOptions,
- GlobalAddCustomerDetails,
- triggerCustomerRefresh,
- VerifiedPaymentDtl,
-} from '../../../../../Features/BookingScreen/Customer/addCustomer';
-import BSCustomerSelect from '../../UtillComponents/BSSelectCustomer.jsx';
-import PozoHoldIcon from '../../UtillComponents/Pozo retail icons/PozoHoldIcon';
-import PozoDineInIcon from '../../UtillComponents/Pozo retail icons/PozoDineIn.jsx';
-import PozoUnpaidIcon from '../../UtillComponents/Pozo retail icons/PozoUnpaidIcon.jsx';
-import PozoBillIcon from '../../UtillComponents/Pozo retail icons/PozoBIllIcon.jsx';
-import PozoAddCustomerIcon from '../../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx';
-import QrComponent from '../../BookingFunctionality/DynamicQr.jsx';
-import QrinScreen from '../../BookingFunctionality/DynamicScreenQr.jsx';
-import { ArrowRightOutlined } from '@ant-design/icons';
-import Buttons from '../../../../../Components/Forms/Buttons';
-import WpIcon from '../../../../../Images/message.png';
-import BSCreditCustomer from '../../UtillComponents/BSCreditCustomer.jsx';
-import PozoAdvanceIcon from '../../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx';
-import { isMobile } from 'react-device-detect';
-import MobilePrint from '../../BookingFunctionality/MobilePrint.jsx';
-import CountUp from 'react-countup';
-import { GlobalpreOrderOpen } from '../../../../../Features/BookingScreen/PreOrder/PreOrder.js';
-import SplitPayment from '../../BookingFunctionality/SplitPayment.jsx';
-import TokensinglePrint from '../../../../paymentpdfPage/TokenOnlyPrints/TokeninsinglePrint.jsx';
-import SingleTokenMobilePrint from '../../BookingFunctionality/SingleTokenMobilePrint.jsx';
-import IndividualTokenMobilePrint from '../../BookingFunctionality/IndividualTokenMobilePrint.jsx';
-import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
-import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js';
-import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx';
-import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx';
-import { Global_OrderOfferDetail, Global_OverallOfferAmount } from '../../../../../Features/Offer/Offer.js';
-import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
-import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip';
-import { useAuth } from '../../../../../AuthContext.jsx';
-import { GlobalBookingStatus } from '../../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js';
-import {
- changeSalesPaymentoption,
- GlobalSalesPaymentoption,
-} from '../../../../../Features/Payment/Paymentoptions/Paymentoptions.js';
-import Paymentoption from '../../../../Payment/PaymentOptions/PaymentOptions.jsx';
-import { getPaymentOptionsData } from '../../../../../Features/BookingScreen/BookingData/KioskBookingData.js';
-import { getCombolist } from '../../../../../Features/ComboMaster/ComboMaster.js';
-import { MdSms } from 'react-icons/md';
-import { FaWhatsapp, FaPrint, FaCartPlus } from 'react-icons/fa';
-import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js';
-import { TfiClipboard } from 'react-icons/tfi';
-import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js';
-import OtherServiceMobilePrint from '../../BookingFunctionality/OtherServiceMobilePrint.jsx';
-import BSOtherServiceClaim from '../../UtillComponents/BSOtherServiceClaim.jsx';
-import { MobilePdfPrint } from '../../BookingFunctionality/MobilePdfPrint.js';
-import { PublicQrCodepost } from '../../../../../Features/ConfigMasterPage/ConfigMasterPage.js';
-import {
- ChangeFullFreeProductList,
- changeFullOfferAppliedProducts,
- changeLoyaltyConsumedQuantities,
- GlobalFreeProdList,
- GlobalOfferAppliedProducts,
- GlobalOverAllOfferAmt,
-} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
-import CardPopover from '../StandardTable/Utils/CardPopover.jsx';
-import UpiPopover from '../StandardTable/Utils/UpiPopOver.jsx';
-import PaymentGatewayEmbedded from '../../UtillComponents/PaymentGatewayEmbedded.jsx';
-import pozologoimg from '../../../../../Images/pozologoimg.png';
-import MobileMultiPdfPrintTrigger from '../../UtillComponents/MobileMultiPdfPrintTrigger.jsx';
-import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js';
-import CustomerOrders from '../../BookingFunctionality/CustomerOrders.jsx';
-// jsx Files
-const BsBillingCreditCustomer = lazy(
- () => import('../../BookingFunctionality/BSBillingCreditCustomer.jsx')
-);
-const PaymentInput = lazy(
- () => import('../BSBillingTable1/BalanceAndReceived.jsx')
-);
-const WhatsAppShare = lazy(
- () => import('../../../../WhatsAppShare/whatsAppShare.jsx')
-);
-const SMSShare = lazy(() => import('../../../../WhatsAppShare/SmsShare.jsx'));
-const BSTipAmount = lazy(() => import('../../UtillComponents/BSTipAmount.jsx'));
-const OtherServicePrintStyle1 = lazy(
- () =>
- import('../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx')
-);
-const subDirectory = import.meta.env.ENV_BASE_URL;
-const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
-
-const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
-
-const BST6Payment = () => {
- const isF4Pressed = useRef(false);
- const applyOffer = useApplyOfferto_CardDetail();
- const { SadminuserAccess } = useAuth();
- let SAAccessCommonMaster = SadminuserAccess?.find(
- (e) => e?.MenuName === 'Sales'
- );
- const dispatch = useDispatch();
- const navigate = useNavigate();
- const FreeProdList = useSelector(GlobalFreeProdList);
- const offerAppliedProducts = useSelector(GlobalOfferAppliedProducts);
- const AllBookingType = useSelector(GlobalAllBookingType);
- const defaultBookingType = useSelector(GlobalDefaultBookingType);
- const appPreferences = useSelector(ApplicationPreferences);
- const bookingTypePreference = appPreferences?.find(
- (preference) => preference?.PreferredCatName === 'Booking Type'
- )?.PreferenceCatDetails;
- const dinePreference = bookingTypePreference?.find(
- (type) =>
- type?.PreferredSubCatName?.toLowerCase() === 'dine in' &&
- type?.PreferredStatus === 'Y'
- );
- const salesBillEdit = useSelector(GlobalSalesBillEdit);
- const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
- const previousOrderOfferDetails = useSelector(
- GlobalPreviousOrderOfferDetails
- );
- const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
- const screenwidth = useSelector(GlobalScreenSize);
- const printerTemplateStyle = useSelector(SelectedPrintTemplate);
- const RetailWSSalesType = useSelector(GlobalRetailWSSalesType);
- const FontFamily = useSelector(GlobalSelectedFont);
- const OrderCardDetail = useSelector(GlobalOrderCardDetails);
- const GetCustId = useSelector(GlobalCustId);
- const GlobalUpiID = useSelector(GlobalUpiIDprint);
- const SelCustId = useSelector(GlobalSelCustId);
- const selOption = useSelector(GlobalSelOption);
- const SelectedTableDetails = useSelector(GlobalSelectedTableDetails);
- const GlobalAddCustomerDetails1 = useSelector(GlobalAddCustomerDetails);
- const Holddata = useSelector(globalholddata);
- const ReportholdData = useSelector(GlobalReorderHoldDetails);
- const BookingType = useSelector(GlobalBookingType);
- const globalTipAmount = useSelector(GlobaltipAmount);
- const OtherServiceTicketClaim = useSelector(GlobalOtherServiceTicketClaim);
- const BookingTypeBoth = useSelector(GlobalBookingTypeBoth);
- const [SelectedBookingType, setSelectedBookingType] = useState(null);
- const [PaymentOptions, setPaymentOptions] = useState([]);
- const [PaymentUpiOptions, setPaymentUpiOptions] = useState([]);
- const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
- const SettingDataSelector = useSelector(PreferenceData);
- const Combodata = useSelector(GlobalCombocarddata, shallowEqual);
- const preferenceOffer =
- SettingDataSelector?.[0]?.['SettingDtlDetails']?.find(
- (item) => item.SettingIdName === 'Offer'
- )?.SettingValue === 'Y';
- const allowDecimal = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'decimal' &&
- setting?.SettingValue === 'Y'
- );
- const Custombill = SettingDataSelector?.[0]?.SettingDtlDetails?.some(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'customisedbillnumber' &&
- setting?.SettingValue === 'Y'
- );
- const GlobEstBooking = useSelector(GlobalEstimateBooking);
- const GlobProdwisedata = useSelector(GlobalSelProdWiseEst);
- const GlobalUpName = useSelector(GlobalUpiIDName);
- const GlobalUpiIDoptionIdd = useSelector(GlobalUpiIDoptionId);
- const preOrder = useSelector(GlobalpreOrderOpen);
- const prodCat = useSelector(GlobalProductCategorie);
- const ProdSubCat = useSelector(GlobalProductSubCategorie);
- const templateData = useSelector(getTemplateData);
- const tableOptions = templateData?.BookingBilling?.[1];
- const NavBarOptions = templateData?.BookingNavbar?.[1];
- const OfferCheckedInSetup = templateData?.BookingNavbar?.[1].some(
- (item) => item?.OptionName == 'Offer'
- );
- const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
- (i) => i.SettingIdName === 'PrintUom'
- )?.[0];
- const Estimation = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (item) => item.SettingIdName == 'Estimation'
- );
- const ParkingDisplay = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'parking' &&
- setting?.SettingValue === 'Y'
- );
- const MobileA4Print = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'mobilea4' &&
- setting?.SettingValue === 'Y'
- );
- const UpiQRPreference = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'upiqr' &&
- setting?.SettingValue === 'Y'
- );
- const preferenceshortcutkey =
- SettingDataSelector?.[0]?.SettingDtlDetails?.some(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'shortcutkeys' &&
- setting?.SettingValue === 'Y'
- );
-
- const Discount = useSelector(GlobalOverAllOfferAmt);
- const OrderOfferDetail = useSelector(Global_OrderOfferDetail, shallowEqual);
- const OrderType = useSelector(GlobalOrderType);
- const FailedTotalAmt = useSelector(GlobalFailedTotalAmt);
- const NavHoldData = useSelector(GlobalNavHoldData);
- const [empData, setEmpData] = useState();
- const [addnewAccess, setaddnewAccess] = useState(true);
- const Custdisable = useSelector(GlobalSelectedCustDisable);
- const [messageType, setMessageType] = useState(null);
- const [messageData, setMessageData] = useState(null);
- const SessionData = useSelector(StoredSessionData);
- const AppId = SessionData?.AppId;
- const CompId = SessionData?.CompId;
- const BranchId = SessionData?.BranchId;
- const UserId = SessionData?.UserId;
- const UserType = SessionData?.UserType;
- const AuthToken = SessionData?.AuthToken;
- const SessionMobileNo = SessionData?.SessionMobileNo;
- const [refundPayBtns, setRefundPayBtns] = useState([]);
- const [refundPaySelected, setRefundPaySelected] = useState();
- const [refundPaySelectedName, setRefundPaySelectedName] = useState(null);
- const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0);
- const [previousNetAmount, setPreviousNetAmount] = useState(0);
- const [FirstPaymentclick, setFirstPaymentclick] = useState(false);
- const [open, setOpen] = useState(false);
- const [unpaidopen, setUnpaidOpen] = useState(false);
- const unpaidFlow = useSelector(Globalunpaidflow);
- const [open2, setOpen2] = useState(false);
- const [urlData, setUrlData] = useState();
- const [credit, setCredit] = useState(false);
- const [overAllBal, setOverAllBal] = useState(0);
- const [paybtnselected, setPaybtnselected] = useState();
- const [Paybtnnameselected, setPaybtnnameselected] = useState();
- const [SelectedUpiOption, setSelectedUpiOption] = useState();
- const [hold, setHold] = useState(false);
- const [addcustomer, setAddCustomer] = useState(false);
- const [PrintOrderDetails, setPrintOrderDetails] = useState([]);
- const [paybtns, setpaybtns] = useState([]);
- const [SelectedCardOption, setSelectedCardOption] = useState(null);
- const [SelectedUPIPayOption, setSelectedUPIPayOption] = useState('Default');
- const [CardOptionOpen, setCardOptionOpen] = useState(false);
- const [PaymentgatewayCard, setPaymentgatewayCard] = useState([]);
- const [PaymentDeviceCard, setPaymentDeviceCard] = useState([]);
- const [PaymentgatewayUPI, setPaymentgatewayUPI] = useState([]);
- const [PaymentDeviceUPI, setPaymentDeviceUPI] = useState([]);
- const [UpiPayOption, setUpiPayOption] = useState([]);
- const [CardPayOption, setCardPayOption] = useState([]);
- const [Splitpayment, setSplitpayment] = useState(false);
- const [customerPreviesOrders, setCustomerPreviesOrders] = useState(false);
-
- //Total calculation
- const [failedOrderData, setFailedOrderData] = useState();
- const OverAllSales = useSelector(GlobalOverAllDiscSales);
- const OverAllEstimate = useSelector(GlobalOverAllDiscEstimate);
-
- const defaultPaymentTrigger = useSelector(GlobalPaymentTrigger);
- const [defaultPaymentMode, setDefaultPaymentMode] = useState([]);
- const [defaultEnabled, setDefaultEnabled] = useState(false);
-
- const [formattedDate, setFormattedDate] = useState('');
- const [UpiOptionOpen, setUpiOptionOpen] = useState(false);
- const [UpiOption, setUpiOption] = useState('');
- const [BusinessPayOption, setBusinessPayoption] = useState([]);
- const [paymentSucess, setPaymentSuccess] = useState(false);
- const [businessUPI, setBusinessUPI] = useState(false);
- const [businessUPIOrderId, setBusinessUPIOrderId] = useState(null);
- const [businessUPILink, setBusinessUPILink] = useState(null);
- const [UpiId, setUpiId] = useState();
- const [qrCode, setQrCode] = useState(false);
- const tabledata = useSelector(GlobalUnpaidListData);
- const GlobalSalesPaymentoptions = useSelector(GlobalSalesPaymentoption);
-
- const [UpinotSelected, setUpinotSelected] = useState(false);
- const [CardoptionnotSelected, setCardoptionnotSelected] = useState(false);
- const [Success, SetSuccess] = useState();
- const [brachName, setbrachName] = useState('');
- const [UpiOpen, setUpiOpen] = useState(false);
- const [CreditCustomer, setCreditCustomer] = useState(false);
- const [creditCustomerOpen, setcreditCustomerOpen] = useState(false);
- const [ConfigDataList, setConfigDataList] = useState([]);
- const [OrderStatus, setOrderStatus] = useState(true);
- const CheckOrderType = OrderCardDetail?.filter(
- (a) => a?.BookingTypeName !== BookingType
- );
- const GlobaluseOptions = useSelector(GlobalCommonPaymentOptions);
- const [useOptions, setuseOptions] = useState([]);
- const paymentloader = useSelector(GlobalPayementloader);
- const TokenOnly = SettingDataSelector?.[0]?.SettingDtlDetails?.filter(
- (i) => i.SettingIdName === 'TokenOnly'
- )?.[0];
- const IndividualToken = SettingDataSelector?.[0]?.SettingDtlDetails?.filter(
- (i) => i.SettingIdName === 'AllProductindividualToken'
- )?.[0];
- const [UnpaidConfirmation, setUnpaidConfirmation] = useState(false);
- const [unpaidselectedindex, setunpaidselectedindex] = useState();
- const [responsiveBill, setResponsiveBill] = useState(true);
- const [blink, setBlink] = useState(false);
- const [TotalAmount, setTotalAmount] = useState(0);
- const BookingStatus = useSelector(GlobalBookingStatus);
- const CheckBookingStatus =
- BookingStatus?.find((item) => item.ScreenType === 'Booking')
- ?.ScreenStatus ?? 'Open';
- const OverallOfferAmount = useSelector(Global_OverallOfferAmount);
- const [showWhatsAppShare, setShowWhatsAppShare] = useState(false);
- const [showSMSShare, setSMSShare] = useState(false);
- // Usage
- const allowedNames = ['whatsapp', 'Print', 'SMS'];
- const [MobileNoWhatsApp, setMobileNoWhatsApp] = useState();
- const printDatas = useSelector(GlobalprintDatas);
- const PrinterDetails = useSelector(GlobalPrinterMappingDtls);
- const OtherServicesglobal = useSelector(GlobalOtherSevices);
- const [OtherServicesModal, setOtherServicesModal] = useState(false);
- const [vehicleInputs, setVehicleInputs] = useState({});
- const [errors, setErrors] = useState({});
- const [OtherServicesPrintDetails, setOtherServicesPrintDetails] = useState(
- []
- );
- const [showCancelConfirm, setShowCancelConfirm] = useState(false);
-
- const PaymentOptionsModeName =
- PaymentOptions?.find((e) => e.ModeDefault?.toUpperCase() === 'Y')
- ?.ModeName || PaymentOptions?.[0]?.ModeName;
- const PaymentOptionsModeId =
- PaymentOptions?.find((e) => e.ModeDefault?.toUpperCase() === 'Y')?.ModeId ||
- PaymentOptions?.[0]?.ModeId;
-
- const filteredSettingNames = SettingDataSelector?.[0]?.['SettingDtlDetails']
- ?.filter(
- (item) =>
- allowedNames.includes(item?.SettingIdName) && item?.SettingValue === 'Y'
- )
- ?.map((item) => item?.SettingIdName);
- // for customised invoice number
- const { invoiceDate, clearInvoiceDate } = useDateStore();
- const CurrentOrderId = useSelector(GlobalCurrentOrderId);
- const holdCheckedSalesSetup = tableOptions?.some(
- (item) => item?.OptionName === 'Hold'
- );
-
- useEffect(() => {
- if (
- OrderCardDetail?.length === 1 &&
- OrderCardDetail?.[0]?.OrderQty === 1 &&
- !SelCustId
- ) {
- console.log(OrderCardDetail, 'OrderCardDetail');
- closePrintOption();
- setPrintOrderDetails([]);
- }
- }, [OrderCardDetail]);
- useEffect(() => {
- if (salesBillEdit) {
- dispatch(getPaymentOptions()).unwrap();
- }
- }, [salesBillEdit]);
-
- useEffect(() => {
- if (salesBillEdit) {
- if (SelCustId) {
- setRefundPayBtns(AllPaymentOptions);
- setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId);
- setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName);
- } else {
- const withoutCustomer = AllPaymentOptions?.filter?.(
- (item) => item?.ConfigName?.toLowerCase() !== 'credit'
- );
- setRefundPaySelected(withoutCustomer?.[0]?.ConfigId);
- setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName);
- setRefundPayBtns(withoutCustomer);
- }
- }
- }, [AllPaymentOptions, SelCustId, salesBillEdit]);
- console.log(PrintOrderDetails, 'PrintOrderDetails');
- useEffect(() => {
- if (selOption) {
- closePrintOption();
- setMobileNoWhatsApp(selOption);
- }
- }, [selOption]);
- // Usage
- useEffect(() => {
- const fetchCreditCustomer = async () => {
- const selectedMode = paybtns?.find(
- (pay) => paybtnselected === pay?.ModeId
- )?.ModeName;
-
- if (
- selectedMode?.toLowerCase() === 'credit' &&
- (!UpinotSelected || !CardoptionnotSelected)
- ) {
- setCredit(true);
- try {
- const res = await dispatch(
- getCreditCustomer({
- CompId,
- AppId,
- BranchId,
- CustId: selOption?.CustId,
- })
- ).unwrap();
-
- if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) {
- setOverAllBal(res.data.data[0]?.OverAllBal ?? 0);
- } else {
- setOverAllBal(0);
- }
- } catch (error) {
- console.error('Credit fetch failed', error);
- setOverAllBal(0);
- }
- } else {
- setCredit(false);
- setOverAllBal(0);
- }
- };
-
- fetchCreditCustomer();
- }, [paybtnselected, selOption, paybtns]);
-
- useEffect(() => {
- if (!preOrder) {
- const totalSum = OrderCardDetail?.reduce(
- // (acc, card) => acc + parseFloat(card.OrderRate * card.OrderQty || 0),
- (acc, card) => acc + parseFloat(card.TotalAmt || 0),
- 0
- );
-
- const extra = GlobalExtraCharge?.reduce(
- (acc, obj) => acc + (obj.TotalAmt || 0),
- 0
- );
-
- let withComboSum = 0;
- const withComboOffer_CardDetail = OrderCardDetail?.filter(
- (item) => item.Type === 'C'
- );
- if (withComboOffer_CardDetail?.length > 0) {
- withComboSum = formatAmount(
- withComboOffer_CardDetail.reduce(
- (acc, card) =>
- acc +
- parseFloat(card.OrderRate * card.OrderQty - card.TotalAmt || 0),
- 0
- )
- );
- }
-
- let Total =
- extra === undefined
- ? totalSum - OverallOfferAmount - withComboSum
- : totalSum + extra - OverallOfferAmount - withComboSum;
-
- // Subtract OtherServiceTicketClaim?.totalTicketamount if present and > 0
- if (OtherServiceTicketClaim?.TotalAmt > 0) {
- if (Total - OtherServiceTicketClaim.TotalAmt > 0) {
- Total -= OtherServiceTicketClaim.TotalAmt;
- } else {
- dispatch(
- changeOtherServiceTicketClaim({
- TicketId: null,
- TotalAmt: 0,
- ParkingClaimed: false,
- ServiceCategory: null,
- })
- );
- }
- } else if (OtherServiceTicketClaim?.OtherType == 'Remove') {
- dispatch(
- changeOtherServiceTicketClaim({
- TicketId: null,
- TotalAmt: 0,
- ParkingClaimed: false,
- ServiceCategory: null,
- })
- );
- }
-
- const filteredPayments =
- previousOrderPayment?.filter(
- (p) =>
- p?.LastOrderTran === 'Y' &&
- p?.AfterAdjustment != null &&
- p?.AfterAdjustment !== '' &&
- p?.AfterAdjustment
- ) || [];
-
- const paymentsToUse =
- filteredPayments.length > 0
- ? filteredPayments
- : previousOrderPayment || [];
-
- const totalPreviouspayment = paymentsToUse?.reduce(
- (acc, payment) =>
- acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
- 0
- );
-
- const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce(
- (acc, offer) => acc + parseFloat(offer.OfferAmount || 0),
- 0
- );
-
- const previousNetAmount = totalPreviouspayment || 0;
-
- let withdiscTotal =
- Total -
- ((OverAllSales || 0) +
- (OverAllEstimate || 0) +
- (Discount > 0 ? Discount : 0));
-
- const currentOrderNetAmount = formatAmount(
- withdiscTotal >= 0
- ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2)
- : (Number(Total) + Number(globalTipAmount)).toFixed(2)
- );
-
- setTotalAmount(
- salesBillEdit
- ? currentOrderNetAmount > previousNetAmount
- ? currentOrderNetAmount - previousNetAmount
- : 0
- : currentOrderNetAmount
- );
- setCurrentOrderNetAmount(currentOrderNetAmount);
- setPreviousNetAmount(previousNetAmount);
- dispatch(
- changeSummeryTotalAmount(
- salesBillEdit
- ? currentOrderNetAmount > previousNetAmount
- ? currentOrderNetAmount - previousNetAmount
- : 0
- : currentOrderNetAmount
- )
- );
-
- dispatch(changeSummeryComboOfferAmount(withComboSum));
-
- // if (withdiscTotal <= 0) {
- // dispatch(ChangeOverAllDiscSales(0));
- // dispatch(ChangeOverAllDiscEstimate(0));
- // }
- } else {
- setTotalAmount(0);
- dispatch(changeSummeryTotalAmount(0));
- dispatch(changeSummeryComboOfferAmount(0));
- }
- }, [
- OrderCardDetail,
- GlobalExtraCharge,
- OverAllSales,
- OverAllEstimate,
- globalTipAmount,
- OtherServiceTicketClaim,
- Discount,
- ]);
- useEffect(() => {
-
- const fetchPrinterMapping = async () => {
- try {
- if (UserType !== 'Super Admin' && isMobile && MobileA4Print) {
- const data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- UserId: UserId,
- };
- // && isMobile && MobileA4Print
- const response = await dispatch(getPrinterMappingDetails(data)).unwrap();
- if (response?.data?.statusCode === 0) {
- handlePrintMappingClick()
- }
- console.log(response, "printer mapping response");
- }
- } catch (error) {
- console.error("Error fetching printer mapping:", error);
- }
- };
-
- fetchPrinterMapping();
-
- }, []);
- const handlePrintMappingClick = () => {
- // setReprint1(true)
- window.dispatchEvent(new Event('CLICK PRINTER MAPPING'));
- };
- //mohan stoped data
- useEffect(() => {
- if (
- (BookingType === 'Dine In' ||
- BookingTypeBoth ||
- CheckOrderType?.length > 0) &&
- !unpaidFlow &&
- SelectedTableDetails?.length !== 0
- ) {
- setOrderStatus(true);
- } else {
- setOrderStatus(false);
- }
- }, [BookingTypeBoth, BookingType, unpaidFlow]);
- //mohan end
-
- useEffect(() => {
- if (SelCustId) {
- setpaybtns(PaymentOptions);
- } else {
- const withoutCustomer = PaymentOptions?.filter?.(
- (item) => item?.ModeName?.toLowerCase() !== 'credit'
- );
-
- setpaybtns(withoutCustomer);
- }
- }, [PaymentUpiOptions, PaymentOptions, SelCustId]);
- const formatAmount = (value) => {
- return allowDecimal
- ? parseFloat(value || 0).toFixed(2)
- : Math.round(value || 0);
- };
- const Print = async () => {
- const style = await PrintStyleFunction(
- printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle,
- 'Sales'
- );
- const stylesMap = {
- 'Style 1': 'PrintStyle1',
- 'Style 2': 'PrintStyle2',
- 'Style 3': 'PrintStyle3',
- 'Style 4': 'PrintStyle4',
- 'Style 5': 'PrintStyle5',
- 'Style 6': 'PrintStyle6',
- 'Style 7': 'PrintStyle7',
- 'Style 8': 'PrintStyle8',
- 'Style 9': 'PrintStyle9',
- 'Style 10': 'PrintStyle10',
- 'Style 11': 'PrintStyle11',
- 'Style 12': 'PrintStyle12',
- 'Style 13': 'RePrint',
- A4: 'PrintStyleA4',
- A5: 'PrintStyleA5',
- A4Standard: 'A4Standard',
- TaxInvoice: 'TaxInvoice',
- };
-
- const selectedStyle =
- stylesMap[
- printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle
- ];
-
- if (selectedStyle) {
- await Promise.all(
- PrintOrderDetails?.[0]?.OrderDetails?.map(
- async (orderDetail, index) => {
- await printDiv(`${selectedStyle}-${index}`, style); // Use unique IDs for each print
- if (orderDetail?.BookingTypeName !== 'Dine In') {
- const groupedTokens = orderDetail?.productDetails?.reduce(
- (acc, item, idx) => {
- if (item.TokenAvailable === 'Y') {
- if (!item.CounterName) {
- // If CounterName is null or empty
- acc[`individual-${idx}-${item.ProdId}`] = [item]; // Unique entry for each null/empty CounterName item
- } else {
- if (!acc[item.CounterName]) {
- acc[item.CounterName] = [];
- }
- acc[item.CounterName].push(item); // Group by CounterName
- }
- }
- return acc;
- },
- {}
- );
-
- // Iterate over grouped tokens and print them
- const tokensToPrint = Object.entries(groupedTokens).map(
- async ([counterName, items], idx) => {
- // Use the counterName (or unique identifier for individual items) as part of the tokenId
- const tokenId = `${idx}-${items?.[0]?.ProdId}-${counterName}`;
- await TokenPrint(tokenId, items); // Pass all grouped items to the print function
- }
- );
- if (tokensToPrint?.length > 0) {
- await Promise.all(tokensToPrint);
- }
- }
- }
- )
- );
-
- setPrintOrderDetails([]);
- }
- };
-
- useEffect(() => {
- if (NavHoldData) {
- AddBookingDetails('Hold');
- }
- }, [NavHoldData]); //changeby karthiga
-
- const TokenPrint = async (index) => {
- try {
- console.log(`Starting token print for index ${index}`);
-
- const stylePrint = ``;
- if (TokenOnly?.SettingValue === 'Y') {
- if (IndividualToken?.SettingValue === 'Y') {
- await printDiv(`TokenOnlySingle${index}`, stylePrint);
- } else {
- await printDiv(`TokenOnlyMultiple${index}`, stylePrint);
- }
- } else {
- await printDiv(`TakeawayToken${index}`, stylePrint);
- }
- } catch (error) {
- console.error(`Error printing token for index ${index}:`, error);
- }
- };
-
- useEffect(() => {
- if (!PrintOrderDetails?.length) return;
-
- const selectedOptions = filteredSettingNames || [];
- const count = selectedOptions.length;
-
- if (count === 0) {
- handlePrintOrToken();
- return;
- }
- if (count === 1) {
- const option = selectedOptions[0];
-
- switch (option) {
- case 'whatsapp':
- if (!selOption && MobileNoWhatsApp?.value) {
- handleWhatsAppClick();
- } else {
- handlePrintOrToken();
- }
- return;
-
- case 'SMS':
- if (isMobile) handleSMSClick();
- else handlePrintOrToken();
- return;
-
- case 'Print':
- handlePrintOrToken();
- return;
-
- // case "Email":
- // handleEmailClick();
- // return;
-
- default:
- return;
- }
- }
- return;
- }, [PrintOrderDetails]);
- const closePrintOption = () => {
- setShowWhatsAppShare(false);
- setSMSShare(false);
- setPrintOrderDetails([]);
- setMobileNoWhatsApp();
- };
-
- const handleWhatsAppClick = () => {
- setShowWhatsAppShare(true);
- };
- const handleSMSClick = () => {
- setSMSShare(true);
- };
-
- const handlePrintOrToken = async () => {
- const dinein =
- PrintOrderDetails?.[0]?.OrderDetails?.[0]?.productDetails?.some(
- (product) => product.BookingTypeName === 'Dine In'
- );
- const Tokenthere =
- PrintOrderDetails?.[0]?.OrderDetails?.[0]?.productDetails?.some(
- (product) => product.TokenAvailable === 'Y'
- );
-
- const preferenceDetails = SettingDataSelector?.[0]?.SettingDtlDetails;
- if (isMobile) {
- if (MobileA4Print) {
- await MobileMultiPdfPrintTrigger({
- preferenceDetails,
- printerTemplateStyle,
- printDatas,
- PrinterDetails,
- PrintOrderDetails,
- SessionData,
- bookingTypePreference,
- });
- } else {
- if (Tokenthere && TokenOnly?.SettingValue === 'Y' && !dinein) {
- if (IndividualToken?.SettingValue === 'Y' && !dinein) {
- IndividualTokenMobilePrint(PrintOrderDetails, UpiId, 'Booking');
- closePrintOption();
- } else {
- SingleTokenMobilePrint(PrintOrderDetails, UpiId, 'Booking');
- closePrintOption();
- }
- } else {
- MobilePrint(
- appPreferences,
- PrintOrderDetails,
- UpiId,
- 'Booking',
- SettingDataSelector
- );
- closePrintOption();
- }
- }
- } else {
- if (Tokenthere && TokenOnly?.SettingValue === 'Y' && !dinein) {
- AllProductTokenFunction();
- } else {
- Print();
- }
- }
- };
- useEffect(() => {
- if (CompId && BranchId && AppId) {
- if (holdCheckedSalesSetup || NavBarOptions?.some((e) => e?.OptionName == 'Hold')) {
- getHolddata();
- }
- // getUnpaiddatas();
- getCustomerData();
- }
- }, [CompId, BranchId, AppId]);
- useEffect(() => {
- gettodaydate();
- getBookingTypeId();
- getPaymentOptionFeature();
- // if (UserType === "Employee") {
- // fetchApi()
- // }
- }, []);
- useEffect(() => {
- const getPrintData = async () => {
- try {
- const data = {
- AppId,
- CompId,
- BranchId,
- OrderId: businessUPIOrderId,
- };
-
- const res = await dispatch(VerifiedPaymentDtl(data)).unwrap();
-
- if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) {
- const orderData = [{ OrderDetails: res.data.data }];
-
- // Reset states first
- setBusinessUPIOrderId(null);
- setBusinessUPI(false);
- setPaymentSuccess(false);
-
- // Then set new data and trigger side effects
- setPrintOrderDetails(orderData);
- CustomerDisplay();
- ClearAllGlobalStateDatas();
- filteredSettingNames?.includes('whatsapp') &&
- MobileNoWhatsApp?.value &&
- handleURL(orderData);
- }
- } catch (error) {
- console.error('Failed to fetch print data:', error);
- // Reset states even on error
- setBusinessUPI(false);
- setPaymentSuccess(false);
- }
- };
-
- if (paymentSucess && businessUPIOrderId) {
- const timer = setTimeout(() => {
- getPrintData();
- }, 3000);
-
- return () => clearTimeout(timer);
- }
- }, [paymentSucess, businessUPIOrderId, AppId, CompId, BranchId, dispatch]);
- 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'
- );
- setEmpData(datas?.[0]);
- };
- const getCustomerData = async () => {
- await dispatch(
- getAddCustomerDetails({
- CompId: CompId,
- AppId: AppId,
- branchId: BranchId,
- })
- );
- };
-
- useEffect(() => {
- if (isMobile) {
- OtherServiceMobilePrint(
- OtherServicesPrintDetails,
- UpiId,
- 'Booking',
- SettingDataSelector
- );
- } else {
- Otherserviceprint();
- }
- }, [OtherServicesPrintDetails]);
-
- useEffect(() => {
- getPaymentOptionFeature();
- }, [GlobaluseOptions]);
- const AllProductTokenFunction = async () => {
- if (IndividualToken?.SettingValue === 'Y') {
- await Promise.all(
- PrintOrderDetails?.[0]?.OrderDetails?.map(
- async (orderDetail, index) => {
- const groupedTokens = orderDetail?.productDetails?.reduce(
- (acc, item, idx) => {
- if (item.TokenAvailable === 'Y') {
- if (!item.CounterName) {
- // If CounterName is null or empty
- acc[`single-${idx}-${item.ProdId}`] = [item]; // Unique entry for each null/empty CounterName item
- } else {
- if (!acc[item.CounterName]) {
- acc[item.CounterName] = [];
- }
- acc[item.CounterName].push(item); // Group by CounterName
- }
- }
- return acc;
- },
- {}
- );
-
- // Iterate over grouped tokens and print them
- const tokensToPrint = Object.entries(groupedTokens).map(
- async ([counterName, items], idx) => {
- // Use the counterName (or unique identifier for individual items) as part of the tokenId
- const tokenId = `${idx}-${items?.[0]?.ProdId}-${counterName}`;
- await TokenPrint(tokenId, items); // Pass all grouped items to the print function
- }
- );
- if (tokensToPrint?.length > 0) {
- await Promise.all(tokensToPrint);
- }
- setPrintOrderDetails([]);
- }
- )
- );
- } else {
- await Promise.all(
- PrintOrderDetails?.[0]?.OrderDetails?.map(
- async (orderDetail, index) => {
- await TokenPrint(`${index}-${orderDetail?.OrderId}`);
- }
- )
- );
- setPrintOrderDetails([]);
- }
- };
-
- //dhana
- // Function to check if the button is active
- const isButtonActive = () => {
- const baseCondition =
- FirstPaymentclick === false &&
- OrderCardDetail?.length > 0 &&
- paybtnselected &&
- CheckBookingStatus !== 'Close';
- let accessCondition = true;
- if (UserType === 'Employee') {
- accessCondition = empData?.AddAccess === 'Y';
- } else if (UserType === 'Super Admin User') {
- accessCondition = SAAccessCommonMaster?.AddAccess === 'Y';
- }
- return baseCondition && accessCondition;
- };
-
- // Function to handle the button click
- const handleButtonClick = () => {
- if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) {
- UpiPayment();
- } else if (
- salesBillEdit &&
- currentOrderNetAmount < previousNetAmount &&
- !refundPaySelected
- ) {
- setMessageType('warning');
- setMessageData('Please Select Refund Payment Method');
- return;
- } else {
- OrderStatus
- ? AddBookingDetails('Dine-In', false)
- : AddBookingDetails(BookingType, true);
- }
- };
- const financialYearError = async () => {
- setMessageType('error');
- setMessageData('Financial Year-Based Sales Not Yet Started');
- };
-
- useEffect(() => {
- const handleKeyPress = (event) => {
- if (!preferenceshortcutkey) return;
- if (event.key === 'F4' && isButtonActive() && !isF4Pressed.current) {
- isF4Pressed.current = true;
- // BranchFinancialStatus==='N'? financialYearError():
- handleButtonClick();
- setTimeout(() => {
- isF4Pressed.current = false; // Reset after a short delay
- }, 1000);
- }
- // tableOptions?.map((item
- // item?.OptionName == 'Hold'
- if (
- event.altKey &&
- event.key === 'w' &&
- BookingType !== 'Dine In' &&
- tableOptions?.some((e) => e?.OptionName == 'Hold') &&
- paybtns?.length > 0
- ) {
- event.preventDefault();
- if (
- OrderCardDetail?.length > 0 &&
- CheckBookingStatus !== 'Close' &&
- !addnewAccess
- ) {
- AddBookingDetails('Hold', false);
- } else if (
- Holddata?.length > 0 &&
- OrderCardDetail?.length === 0 &&
- CheckBookingStatus !== 'Close' &&
- !addnewAccess
- ) {
- HandleholdModelOpen();
- }
- }
-
- // Alt+S for Split Payment
- if (event.altKey && event.key === 's' && paybtns?.length > 1) {
- event.preventDefault();
- if (
- OrderCardDetail?.length > 0 &&
- CheckBookingStatus !== 'Close' &&
- !addnewAccess &&
- !unpaidFlow &&
- !OrderStatus
- ) {
- SplitPaymentOpen();
- }
- }
- };
-
- window.addEventListener('keydown', handleKeyPress);
- return () => {
- window.removeEventListener('keydown', handleKeyPress);
- };
- }, [
- paybtns,
- FirstPaymentclick,
- OrderCardDetail,
- paybtnselected,
- OrderStatus,
- qrCode,
- SelectedUPIPayOption,
- TotalAmount,
- SelectedUpiOption,
- SelectedCardOption,
- BookingType,
- Holddata,
- CheckBookingStatus,
- addnewAccess,
- preferenceshortcutkey,
- paybtns,
- unpaidFlow,
- ]);
-
- //dhana
-
- const getPaymentOptionFeature = async () => {
- const FiltersalesPayment = GlobaluseOptions?.filter(
- (item) => item.FlowName?.toLowerCase() === 'sales'
- );
- setuseOptions(FiltersalesPayment);
- const filterpaycounter = FiltersalesPayment?.[0]?.OptionDetails?.filter(
- (item) => item?.OptionName?.toLowerCase() === 'pay at the counter'
- );
- const filterpaymentgateway = FiltersalesPayment?.[0]?.OptionDetails?.filter(
- (item) => item?.OptionName?.toLowerCase() === 'payment gateway'
- );
- const filterpaymentdevice = FiltersalesPayment?.[0]?.OptionDetails?.filter(
- (item) => item?.OptionName?.toLowerCase() === 'payment device'
- );
- const filterBusinessUpi = FiltersalesPayment?.[0]?.OptionDetails?.filter(
- (item) => item?.OptionName?.toLowerCase() === 'business upi'
- );
- const cardinpaymentgateway =
- filterpaymentgateway?.[0]?.ModeDetails?.filter((item) =>
- item?.ModeName?.toLowerCase()?.includes('card')
- ) || [];
- const cardinpaymentdevice =
- filterpaymentdevice?.[0]?.ModeDetails?.filter((item) =>
- item?.ModeName?.toLowerCase()?.includes('card')
- ) || [];
- const upiinpaymentgateway =
- filterpaymentgateway?.[0]?.ModeDetails?.filter((item) =>
- item?.ModeName?.toLowerCase()?.includes('upi')
- ) || [];
- const upiinpaymentdevice =
- filterpaymentdevice?.[0]?.ModeDetails?.filter((item) =>
- item?.ModeName?.toLowerCase()?.includes('upi')
- ) || [];
-
- setPaymentOptions(filterpaycounter?.[0]?.ModeDetails);
- setPaymentUpiOptions(
- FiltersalesPayment?.[0]?.PaymentDetails?.Payatthecounter
- );
- setPaymentDeviceCard(cardinpaymentdevice);
- setPaymentgatewayCard(cardinpaymentgateway);
- setPaymentgatewayUPI(upiinpaymentgateway);
- setPaymentDeviceUPI(upiinpaymentdevice);
- const cardoptions = [];
- if (cardinpaymentgateway?.length > 0) {
- cardoptions.push({
- label: 'Payment Gateway',
- value: 'PG',
- imgSrc: paygate,
- });
- }
- if (cardinpaymentdevice?.length > 0) {
- cardoptions.push({
- label: 'Payment Device',
- value: 'PD',
- imgSrc: paydevice,
- });
- }
-
- setCardPayOption(cardoptions);
- const options = [];
-
- if (FiltersalesPayment?.[0]?.PaymentDetails?.Payatthecounter?.length > 0) {
- options.push({
- label: 'Personal UPI',
- value: 'Default',
- imgSrc: defaultupi,
- });
- }
- if (filterBusinessUpi?.[0]?.ModeDetails?.length > 0) {
- options.push({
- label: 'Business UPI',
- value: 'Business',
- imgSrc: pozologoimg,
- PaymentOptionId: filterBusinessUpi?.[0]?.PaymentOptionId,
- PaymentFlowId: filterBusinessUpi?.[0]?.PaymentFlowId,
- OptionId: filterBusinessUpi?.[0]?.OptionId,
- });
- }
-
- if (upiinpaymentgateway?.length > 0) {
- options.push({
- label: 'Payment Gateway',
- value: 'PG',
- imgSrc: paygate,
- PaymentOptionId: upiinpaymentgateway?.[0]?.PaymentOptionId,
- PaymentModeId: upiinpaymentgateway?.[0]?.PaymentModeId,
- ModeId: upiinpaymentgateway?.[0]?.ModeId,
- });
- }
-
- if (upiinpaymentdevice?.length > 0) {
- options.push({ label: 'Payment Device', value: 'PD', imgSrc: paydevice });
- }
- setUpiPayOption(options);
- setBusinessPayoption(filterBusinessUpi?.[0]?.ModeDetails || []);
-
- // }
- };
-
- useEffect(() => {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- ExtraCharges: GlobalExtraCharge,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- }, [GlobalExtraCharge]);
- useEffect(() => {
- let data = selOption != null ? selOption : GetCustId;
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- customer: data,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- }, [selOption, GetCustId]);
- useEffect(() => {
- let data = GlobalUpiID;
- // const jsonString = JSON.stringify(data);
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- upi: data,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- setUpiOption(GlobalUpName);
- setSelectedUpiOption(GlobalUpiIDoptionIdd);
- setUpiId(GlobalUpiID);
- }, [GlobalUpiID]);
- useEffect(() => {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- paymentMethod: Paybtnnameselected,
- Paymentgateway: false,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- dispatch(ChangeInitialPaymentName(Paybtnnameselected));
- }, [Paybtnnameselected]);
-
- const CustomerDisplayRemovedData = () => {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- userData: [],
- ExtraCharges: [],
- Paymentgateway: false,
- type: 'remove',
- keyValue: 'customer',
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- const updatedRemovedData = {
- type: 'remove',
- keyValue: 'OrderTotalAmount',
- };
- customerDisplayWindow.postMessage(updatedRemovedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- };
- const CustomerDisplay = (value) => {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (value == 'TakeAway') {
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- userData: [],
- ExtraCharges: [],
- Paymentgateway: false,
- upioption1: 'okk',
- type: 'remove',
- keyValue: 'customer',
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- const updatedRemovedData = {
- type: 'remove',
- keyValue: 'OrderTotalAmount',
- };
- customerDisplayWindow.postMessage(updatedRemovedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- } else {
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- type: 'remove',
- keyValue: 'customer',
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- }
- };
- useEffect(() => {
- if (OrderCardDetail?.length <= 0) {
- dispatch(changeCustomerID(null));
- dispatch(changeSelectedCustId());
- dispatch(changeSelectedOption(null));
- dispatch(ChangeSelectedCustDisable(false));
- }
- // TotalItemsCalculation();
- TotalWithoutTaxRate();
- TotalTaxAmt();
- OrderCardDetail?.length == 0 ? dispatch(changeunpaidflow(false)) : '';
- }, [OrderCardDetail]);
-
- useEffect(() => {
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- }, [PaymentOptions]);
-
- useEffect(() => {
- getBookingTypeId();
- }, [BookingType, BookingTypeBoth]);
-
- const getHolddata = async () => {
- const data = { CompId: CompId, BranchId: BranchId, AppId: AppId };
- let response = await dispatch(gettinghold(data)).unwrap();
- if (response?.data?.statusCode == 1) {
- await dispatch(changeholddata(response?.data?.data));
- } else {
- await dispatch(changeholddata([]));
- }
- };
-
- const getUnpaiddatas = async () => {
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- };
- await dispatch(getUnpaidData(data)).unwrap();
- };
-
- const getBookingTypeId = async () => {
- setConfigDataList(AllBookingType);
- let configdata = AllBookingType;
- let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType;
-
- let filterconfigdata = configdata?.find((a) => a?.ConfigName === checkName);
- setSelectedBookingType(filterconfigdata?.ConfigId);
- };
- const gettodaydate = () => {
- const currentDate = new Date();
- const day = String(currentDate.getDate()).padStart(2, '0');
- const month = String(currentDate.getMonth() + 1).padStart(2, '0');
- const year = currentDate.getFullYear();
-
- const tempformattedDate = `${year}-${month}-${day}`;
- setFormattedDate(tempformattedDate);
- };
-
- const TotalItemsCalculation = async () => {
- let tempTotalitems = OrderCardDetail?.length;
- let OverAllQty = OrderCardDetail?.reduce(
- (prev, current) => prev + Number(current?.OrderQty || 0),
- 0
- );
- await dispatch(changeSummeryTotalItems(tempTotalitems));
-
- await dispatch(changeSummeryQty(OverAllQty));
- };
-
- const TotalWithoutTaxRate = async () => {
- const totalwithouttax = OrderCardDetail?.reduce((accumulator, card) => {
- return accumulator + parseFloat(card.WithoutTaxRate || 0);
- }, 0);
- // setTotalWithoutTaxAmount(totalwithouttax.toFixed(2));
- await dispatch(
- changeSummeryTotalWithoutTaxAmount(totalwithouttax.toFixed(2))
- );
- };
-
- const TotalTaxAmt = async () => {
- const totaltax = OrderCardDetail?.reduce((accumulator, card) => {
- return accumulator + parseFloat(card.TaxAmt || 0);
- }, 0);
- // setTotalTaxAmount(totaltax.toFixed(2));
- await dispatch(changeSummeryTotalTaxAmount(totaltax.toFixed(2)));
- };
-
- const handleOpenChange = (newOpen) => {
- setOpen(newOpen);
- };
-
- const handleOpenChange2 = (newOpen) => {
- if (open2) {
- setOpen2(false);
- } else {
- setOpen2(true);
- }
- };
-
- const hide = () => {
- setOpen2(false);
- setOpen(false);
- };
-
- const handlePaymentMode = (id, name) => {
- if (name?.toLowerCase() !== 'credit') {
- setOverAllBal(0);
- setCredit(false);
- }
- if (paymentloader === false) {
- setPaybtnselected(id);
- setPaybtnnameselected(name);
- if (CardPayOption?.length === 1) {
- setSelectedCardOption(CardPayOption?.[0]?.value);
- }
- setUpiOptionOpen(false);
- setQrCode(false);
- setUpinotSelected(false);
- setCardoptionnotSelected(false);
- }
- };
-
- const handleRefundPaymentMode = (id, name) => {
- setRefundPaySelected(id);
- setRefundPaySelectedName(name);
- };
-
- const addUpiOption = async (id, name, UPIId) => {
- await dispatch(changeUpiIDprint(UPIId));
- await dispatch(changeUpiIDName(name));
- await dispatch(changeUpiIDoptionId(id));
- setSelectedUpiOption(id);
- setUpiOption(name);
- setUpiId(UPIId);
- setUpinotSelected(false);
- setCardoptionnotSelected(false);
- // setQrCode(true)
- };
- const AddCardOption = (data) => {
- setSelectedCardOption(data);
- setCardOptionOpen(false);
- setCardoptionnotSelected(false);
- };
- const AddUPIPaymentOption = async (data, mode = false) => {
- setSelectedUpiOption('');
- setUpiOption('');
- setUpiId('');
- await dispatch(changeUpiIDprint(null));
- await dispatch(changeUpiIDName(''));
- await dispatch(changeUpiIDoptionId(null));
- setSelectedUPIPayOption(data);
- setUpinotSelected(false);
- setCardoptionnotSelected(false);
- if (data !== 'Default' && data !== 'Business' && !mode) {
- setUpiOptionOpen(false);
- }
- };
- const handleUPIButtonClick = (id, name) => {
- if (paymentloader === false) {
- setPaybtnnameselected(name);
- setPaybtnselected(id);
- let brachName1 = PaymentUpiOptions?.[0]?.BrName;
- setbrachName(brachName1);
- if (UpiPayOption?.length === 1) {
- setSelectedUPIPayOption(UpiPayOption?.[0]?.value);
- if (UpiPayOption?.[0]?.value?.toLowerCase() === 'default') {
- if (PaymentUpiOptions?.length === 1) {
- addUpiOption(
- PaymentUpiOptions?.[0]?.Mode,
- PaymentUpiOptions?.[0]?.ModeName,
- PaymentUpiOptions?.[0]?.UPIId
- );
- }
- }
- }
-
- setQrCode(true);
- SetSuccess(true);
- }
- };
- const EnableUpiOptions = () => {
- setUpiOptionOpen(!UpiOptionOpen);
- };
- const EnableCardOptions = () => {
- setCardOptionOpen(!CardOptionOpen);
- };
- const HandleholdModelOpen = () => {
- setHold(true);
- };
-
- const handleHoldCancel = () => {
- setHold(false);
- };
- const handleAddCustomer = () => {
- if (Custdisable === false) {
- setAddCustomer(true);
- }
- };
- const handleAddCustomerCancel = () => {
- setAddCustomer(false);
- };
- const hideDefault = () => {
- setUpiOptionOpen(false);
- };
- const handlePopoverVisibleChange = (visible) => {
- setUpiOptionOpen(visible);
- };
- const handlePopoverVisibleChangeCard = (visible) => {
- setCardOptionOpen(visible);
- };
- const SplitPaymentOpen = () => {
- if (OrderCardDetail?.length > 0 && TotalAmount > 0) {
- const updatedData = {
- userData: OrderCardDetail,
- ExtraCharges: GlobalExtraCharge,
- customer: selOption != null ? selOption : GetCustId,
- Paymentgateway: false,
- };
- setFailedOrderData(updatedData);
- setSplitpayment(true);
- } else {
- if (TotalAmount <= 0) {
- setMessageType('warning');
- setMessageData('Cannot split when total amount is zero or less');
- return;
- }
- setMessageType('warning');
- setMessageData('Please Select the Product');
- }
- };
-
- const handlesplitpaymentclose = () => {
- setSplitpayment(false);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- paymentMethod: PaymentOptions?.[0]?.ModeName,
- Paymentgateway: false,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- };
- const ProductSummary = (salesData) => {
- // Create a map to store the aggregated values for each unique product
- const productMap = new Map();
- // Iterate over the sales data to aggregate values
- salesData.forEach((item) => {
- let offerMode = item?.OfferMode?.trim();
- offerMode = offerMode && offerMode !== '' ? offerMode : null;
-
- let OfferId = null;
- if (
- item?.OfferMessage &&
- Array.isArray(item.OfferMessage) &&
- item.OfferMessage.length > 0
- ) {
- OfferId = item.OfferMessage[0]?.OfferId || null;
- }
-
- const keyData = [
- item.ProdId || null,
- item.InwardDtlId || null,
- item.BookingType || null,
- item.SinglePc || null,
- item.OrderRate || null,
- offerMode,
- OfferId,
- ];
-
- const key = keyData.join('-');
-
- if (productMap.has(key)) {
- const existingItem = productMap.get(key);
- existingItem.OrderQty =
- (existingItem.OrderQty || 0) + (item.OrderQty || 0);
- existingItem.TotalAmt =
- (existingItem.TotalAmt || 0) + (item.TotalAmt || 0);
- existingItem.TaxAmt =
- (parseFloat(existingItem.TaxAmt) || 0) +
- (parseFloat(item.TaxAmt) || 0);
- } else {
- const newItem = {
- ...item,
- OfferMode: offerMode,
- OfferMessage:
- item?.OfferMessage && Array.isArray(item.OfferMessage)
- ? item.OfferMessage
- : null,
- };
- productMap.set(key, newItem);
- }
- });
-
- // Convert the map values back to an array
- const aggregatedProducts = Array.from(productMap.values());
-
- return aggregatedProducts;
- };
- const UpiPayment = () => {
- if (OrderStatus) {
- AddBookingDetails('Dine-In', false);
- } else {
- if (SelectedUpiOption && TotalAmount == 0) {
- Upimodel('Submit');
- } else if (SelectedUpiOption) {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- OrderTotalAmount: TotalAmount,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
-
- setUpiOpen(true);
- } else {
- setUpinotSelected(true);
- setMessageType('error');
- setMessageData('Please Select Upi Option');
- }
- }
- };
- const handleCreditCustomer = (type) => {
- setCreditCustomer(false);
- if (type == 'Submit') {
- Booking(BookingType, true);
- }
- if (type == 'Cancel') {
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- }
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedRemovedData = {
- type: 'remove',
- keyValue: 'OrderTotalAmount',
- };
- customerDisplayWindow.postMessage(updatedRemovedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- };
- const ClearAllGlobalStateDatas = async (value) => {
- if (OfferCheckedInSetup && preferenceOffer) {
- await applyOffer([]);
- } else {
- dispatch(changeOrderCardDetails([]));
- }
- dispatch(changeSearchedData(''));
- dispatch(changeBillEditingMode(false));
- await dispatch(changePreviousOrderPayment([]));
- await dispatch(changePreviousOrderOfferDetail([]));
- dispatch(changeTipAmount(0));
- dispatch(changeLoyaltyConsumedQuantities({}));
- await dispatch(ChangeTotalAmount([]));
- await dispatch(changeReorderHoldDetails({}));
- dispatch(changeFullOfferAppliedProducts([]));
- dispatch(ChangeFullFreeProductList([]));
- await dispatch(changeReorderProductDetails([]));
- setFirstPaymentclick(false);
- await dispatch(ChangeNavHoldData(false));
- await dispatch(changeCustomerID(null));
- await dispatch(changeSelectedCustId());
- await dispatch(changeSelectedOption(null));
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- setQrCode(false);
- setUpinotSelected(false);
- setCurrentOrderNetAmount(0);
- setPreviousNetAmount(0);
- if (holdCheckedSalesSetup || NavBarOptions?.some((e) => e?.OptionName == 'Hold')) {
- getHolddata();
- }
- if (defaultBookingType === 'Both') {
- await dispatch(changeBookingType('TakeAway'));
- }
- await dispatch(changeSelProdWiseEst([]));
- await dispatch(ChangeOverAllDiscSales(null));
- await dispatch(ChangeOverAllDiscEstimate(null));
- // clearInvoiceDate
- clearInvoiceDate();
- dispatch(changeCurrentOrderId(null));
- getstockbadge();
- Combodata?.length > 0 && Combocarddata();
- getUnpaiddatas();
- await dispatch(changeSelectTable([]));
- await dispatch(changeSelectChair([]));
- await dispatch(changeSelectedTableDetails([]));
- await dispatch(changeOrderType());
- if (value === 'Dine-In') {
- navigate(`${subDirectory}sales/dine-in`);
- }
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- UserId: UserId,
- FromDate: currentDateValue,
- ToDate: currentDateValue,
- };
- await dispatch(getSalesDetailData(data));
- };
- const AddBookingDetails = async (value, pay) => {
- const customerDisplayWindow = getCustomerDisplayWindow();
-
- const OnUpiSelected = PaymentOptions?.find(
- (item) => item.ModeId === paybtnselected
- );
-
- if (
- OnUpiSelected?.ModeName?.toLowerCase() === 'upi' &&
- (SelectedUPIPayOption?.toLowerCase() === 'default' ||
- SelectedUPIPayOption?.toLowerCase() === 'business')
- ) {
- SetSuccess(false);
- setTimeout(function () {
- SetSuccess(true);
- // Add your state change code here
- // For example:
- // setNewState(newValue);
- }, 3000);
- if (SelectedUpiOption) {
- Booking(value, pay);
- } else {
- setUpinotSelected(true);
- setMessageType('error');
- setMessageData('Please Select Upi Option');
- }
- } else if (
- OnUpiSelected?.ModeName?.toLowerCase() === 'card' &&
- PaymentgatewayCard?.length > 0 &&
- PaymentDeviceCard?.length > 0
- ) {
- if (SelectedCardOption) {
- if (SelectedCardOption?.toLowerCase() === 'pg') {
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- if (SelCustId) {
- Booking(value, pay);
- } else {
- setMessageType('error');
- setMessageData('Please Select Customer');
- }
- } else {
- setMessageType('error');
- setMessageData('Please Set the customer display');
- }
- } else {
- Booking(value, pay);
- }
- } else {
- setCardoptionnotSelected(true);
- setMessageType('error');
- setMessageData('Please Select Card Option');
- }
- } else if (OnUpiSelected?.ModeName?.toLowerCase() === 'credit') {
- if (!SelCustId) {
- setMessageType('error');
- setMessageData('Please Select Customer');
- } else {
- setCreditCustomer(true);
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- OrderTotalAmount: TotalAmount,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- }
- } else if (
- OnUpiSelected?.ModeName?.toLowerCase() === 'upi' &&
- SelectedUPIPayOption?.toLowerCase() === 'pg'
- ) {
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- if (SelCustId) {
- Booking(value, pay);
- } else {
- setMessageType('error');
- setMessageData('Please Select Customer');
- }
- } else {
- setMessageType('error');
- setMessageData('Please Set the customer display');
- }
- } else if (
- OnUpiSelected?.ModeName?.toLowerCase() === 'card' &&
- SelectedCardOption?.toLowerCase() === 'pg'
- ) {
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- if (SelCustId) {
- Booking(value, pay);
- } else {
- setMessageType('error');
- setMessageData('Please Select Customer');
- }
- } else {
- setMessageType('error');
- setMessageData('Please Set the customer display');
- }
- } else {
- Booking(value, pay);
- }
- };
- const extrachargesbookingtype = (extradata) => {
- const TakAwayId = ConfigDataList?.find(
- (a) => a?.ConfigName === 'TakeAway'
- )?.ConfigId;
- const DineinId = ConfigDataList?.find(
- (a) => a?.ConfigName === 'Dine In'
- )?.ConfigId;
- let tempdata = extradata?.map((data) => ({
- ...data,
- BookingType: data?.BookingTypeName === 'Dine In' ? DineinId : TakAwayId,
- }));
- return tempdata;
- };
-
- const Booking = async (value, pay) => {
- const TakAwayId = ConfigDataList?.find(
- (a) => a?.ConfigName === 'TakeAway'
- )?.ConfigId;
- const DineinId = ConfigDataList?.find(
- (a) => a?.ConfigName === 'Dine In'
- )?.ConfigId;
-
- setFirstPaymentclick(true);
- let temporderdetail = OrderCardDetail?.map((a) => ({
- ProdId: a.ProdId,
- Type: a.Type,
- OrderQty: a.OrderQty,
- OrderRate: a.OrderRate,
- // TotalAmt: a.OrderQty * a.OrderRate,
- TotalAmt: a.TotalAmt,
- TaxAmt: a.TaxAmt,
- RefundQty: 0,
- InwardDtlId: a.InwardDtlId,
- TaxId: a.TaxId,
- ProdNameQty:
- UomPrint?.SettingValue === 'N'
- ? `${a.ProdName} ${a.UomName?.toLowerCase() === 'half' ? '(Half)' : ''}`
- : `${a.ProdName} ${a.Size} ${a.UomName}`,
- OrderStatus: 'O',
- OrderType:
- BookingType === 'Dine In' ||
- BookingTypeBoth ||
- Estimation?.SettingValue == 'N'
- ? 'S'
- : GlobEstBooking === 'OvrAllEst'
- ? 'E'
- : GlobEstBooking === 'ParEst'
- ? GlobProdwisedata?.includes(
- a.InwardDtlId + ' ' + a?.BookingTypeName
- )
- ? 'E'
- : 'S'
- : 'S',
- SinglePc: a.SinglePc,
- BookingType: a.BookingTypeName === 'Dine In' ? DineinId : TakAwayId,
- OfferValue: a?.Type === 'C' ? a?.OfferValue : a.Offer,
- OfferAmt: a?.Type === 'C' ? a?.TotalAmt : a.Offer,
- OfferType: a?.Type === 'C' ? a?.OfferType : '',
- OfferMode: a?.OfferMode,
- OfferMessage: a?.OfferMessage,
- CounterName: a?.TokenAvailable === 'Y' ? a?.CounterName : null,
- ProductIdentifierDtls: a.ProductIdentifierDtls,
- ModelNumber: a.ModelNumber,
- BatchRef: a.BatchRef,
- PackageDtl: a.PackageDtl,
- SetCount: a.SetCount,
- ...(a?.DiscountValue && { DiscountValue: a.DiscountValue }),
- ...(a?.DiscountType && { DiscountType: a.DiscountType }),
- ...(a?.DiscountAmt && { DiscountAmt: a.DiscountAmt })
- }));
- const NotSlectedTypeFind = temporderdetail?.find(
- (a) => a?.BookingType != SelectedBookingType
- );
- const { totalwithouttax, totaltax } = OrderCardDetail?.reduce(
- (totals, card) => {
- totals.totalwithouttax += parseFloat(card.WithoutTaxRate || 0);
- totals.totaltax += parseFloat(card.TaxAmt || 0);
- return totals;
- },
- { totalwithouttax: 0, totaltax: 0 }
- ) || { totalwithouttax: 0, totaltax: 0 };
- let updatedOfferDetails = offerAppliedProducts;
- if (GlobEstBooking !== 'Sales') {
- updatedOfferDetails = offerAppliedProducts?.filter(
- (item) =>
- !(
- item.TableName === 'LoyaltyPoints' &&
- item.TableUniqueName === 'UniqueId' &&
- item.Type === 'A'
- )
- );
- }
- let temppostdata = {
- SalesMode: RetailWSSalesType || 'R',
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- OrderDate: Custombill ? invoiceDate : null,
- CustomOrderNo: Custombill ? CurrentOrderId : null,
- OrderType:
- Object.keys(ReportholdData)?.length > 0
- ? ReportholdData?.OrderType
- : 'S',
- CustSuppId: SelCustId ? SelCustId : null,
- Reference: 'test',
- BookingType:
- NotSlectedTypeFind && !BookingTypeBoth
- ? NotSlectedTypeFind?.BookingType
- : SelectedBookingType,
- ServiceProvider: 0,
- ActiveStatus: 'A',
- CreatedBy: UserId,
- AddlInfo: 'test',
- BillAmount: totalwithouttax.toFixed(2),
- OverallDiscSales: OverAllSales > 0 ? OverAllSales : 0,
- OverallDiscEst: OverAllEstimate > 0 ? OverAllEstimate : 0,
- TaxAmount: totaltax.toFixed(2),
- VatAmount: 0,
- NetAmount: Math.round(TotalAmount),
- PaymentType:
- Paybtnnameselected?.toLowerCase() === 'upi'
- ? SelectedUPIPayOption?.toLowerCase() === 'pd'
- ? PaymentDeviceUPI?.[0]?.ModeId
- : SelectedUPIPayOption?.toLowerCase() === 'pg'
- ? PaymentgatewayUPI?.[0]?.ModeId
- : paybtnselected
- : paybtnselected
- ? paybtnselected
- : null,
- GivenAmt: 0,
- BalGiven: 0,
- BookingMedia: 'DW',
- RefundAmount: 0,
- ServiceCategory: OtherServiceTicketClaim?.ServiceCategory,
- OtherServiceTicketId: OtherServiceTicketClaim?.TicketId,
- OtherServiceTicketAmount: OtherServiceTicketClaim?.TotalAmt,
- PaymentStatus:
- Paybtnnameselected?.toLowerCase() === 'cash'
- ? 'S'
- : Paybtnnameselected?.toLowerCase() === 'credit'
- ? 'S'
- : Paybtnnameselected?.toLowerCase() === 'upi' &&
- SelectedUPIPayOption?.toLowerCase() === 'default'
- ? 'S'
- : 'P',
- OrderDtlDetails:
- Object.keys(ReportholdData)?.length > 0
- ? ProductSummary(temporderdetail)
- : temporderdetail,
- // (BookingType === "Dine In" || BookingTypeBoth)
- ExtraChargeDetails:
- GlobalExtraCharge?.length > 0
- ? extrachargesbookingtype(GlobalExtraCharge)
- : null,
- SalesTableLinkDetails:
- SelectedTableDetails?.length > 0
- ? globalTipAmount === 0
- ? SelectedTableDetails
- : SelectedTableDetails?.map((item) => ({
- ...item,
- TipsAmount: globalTipAmount,
- }))
- : null,
- SalesPaymentType: 'normal',
- PaymentDetail: [
- {
- PaymentType:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? refundPaySelected
- : Paybtnnameselected?.toLowerCase() === 'upi'
- ? SelectedUPIPayOption?.toLowerCase() === 'pd'
- ? PaymentDeviceUPI?.[0]?.ModeId
- : SelectedUPIPayOption?.toLowerCase() === 'pg'
- ? PaymentgatewayUPI?.[0]?.ModeId
- : SelectedUPIPayOption?.toLowerCase() === 'business'
- ? BusinessPayOption?.find(
- (busupi) => busupi?.ModeId === UpiId
- )?.ModeId
- : paybtnselected
- : paybtnselected
- ? paybtnselected
- : null,
- Amount:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? previousNetAmount - currentOrderNetAmount
- : Math.round(TotalAmount),
- MerchantId:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? null
- : Paybtnnameselected?.toLowerCase() === 'upi' &&
- SelectedUPIPayOption?.toLowerCase() === 'business'
- ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
- ?.MerchantId
- : null,
- PaymentOptionType:
- salesBillEdit &&
- currentOrderNetAmount < previousNetAmount &&
- (refundPaySelectedName?.toLowerCase() === 'cash' ||
- refundPaySelectedName?.toLowerCase() === 'credit')
- ? 'PC'
- : Paybtnnameselected?.toLowerCase() === 'cash'
- ? 'PC'
- : Paybtnnameselected?.toLowerCase() === 'credit'
- ? 'PC'
- : Paybtnnameselected?.toLowerCase() === 'card'
- ? SelectedCardOption
- : Paybtnnameselected?.toLowerCase() === 'upi'
- ? SelectedUPIPayOption?.toLowerCase() === 'default'
- ? 'PC'
- : SelectedUPIPayOption?.toLowerCase() === 'business'
- ? 'BU'
- : SelectedUPIPayOption
- : null,
- ModeOfPayment:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? null
- : SelectedUPIPayOption?.toLowerCase() === 'default'
- ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
- ?.UPIDetailId
- : SelectedUPIPayOption?.toLowerCase() === 'business'
- ? BusinessPayOption?.find(
- (busupi) => busupi?.ModeId === UpiId
- )?.MerchantUPIId
- : null,
- AccountDtl:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? []
- : Paybtnnameselected?.toLowerCase() === 'upi' &&
- SelectedUPIPayOption?.toLowerCase() === 'default'
- ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
- (upipay) => upipay?.UPIId === UpiId
- )
- : (Paybtnnameselected?.toLowerCase() === 'upi' &&
- 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')
- ? useOptions?.[0]?.PaymentDetails?.PaymentGateway
- : [],
- PaymentStatus:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? 'S'
- : Paybtnnameselected?.toLowerCase() === 'cash'
- ? 'S'
- : Paybtnnameselected?.toLowerCase() === 'credit'
- ? 'S'
- : Paybtnnameselected?.toLowerCase() === 'upi' &&
- SelectedUPIPayOption?.toLowerCase() === 'default'
- ? 'S'
- : 'P',
- Debit:
- salesBillEdit &&
- currentOrderNetAmount < previousNetAmount &&
- refundPaySelectedName?.toLowerCase() === 'credit'
- ? Math.round(previousNetAmount - currentOrderNetAmount)
- : 0,
- Credit: salesBillEdit
- ? currentOrderNetAmount > previousNetAmount &&
- Paybtnnameselected?.toLowerCase() === 'credit'
- ? Math.round(TotalAmount)
- : 0
- : Paybtnnameselected?.toLowerCase() === 'credit'
- ? Math.round(TotalAmount)
- : 0,
- },
- ],
- OrderOfferDetail: updatedOfferDetails,
- RefDetails: [
- {
- FreeProdList: FreeProdList,
- OfferAppliedProductList: offerAppliedProducts,
- },
- ],
- };
- let PostData = temppostdata;
-
- if (value === 'Dine-In') {
- PostData['PaymentStatus'] = pay ? 'S' : 'P';
- PostData['PaymentDetail'] = !pay && [];
- PostData['PaymentType'] = !pay && '';
- } else if (value === 'Hold') {
- ((PostData['PaymentStatus'] = pay ? 'S' : 'P'),
- (PostData['PaymentDetail'] = !pay && []));
- PostData['PaymentType'] = !pay && '';
- PostData['ActiveStatus'] = pay ? 'A' : 'D';
- } else if (value === 'Unpaid') {
- PostData['PaymentStatus'] = pay ? 'S' : 'P';
- PostData['PaymentDetail'] = !pay && [];
- PostData['PaymentType'] = !pay && '';
- PostData['PrintType'] = 'Y';
- }
-
- Object.keys(ReportholdData)?.length > 0
- ? OrderType === 'Failed'
- ? PutFailedPayment(PostData, value, pay)
- : PutBooking(PostData, value, pay)
- : !OtherServicesglobal
- ? PostBooking(PostData, value)
- : OtherServicePostBooking(PostData, value);
- // getstockbadge();
- // Combocarddata();
- };
- const PostBooking = async (PostData, value) => {
- let response = await dispatch(PostBookingData(PostData)).unwrap();
- if (response?.data?.statusCode == 1) {
- let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pd' &&
- item?.PaymentStatus === 'P'
- );
- let PaymentGatewayfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pg' &&
- item?.PaymentStatus === 'P'
- );
- let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) => item?.PaymentOptionType?.toLowerCase() === 'pc'
- );
- let businessUPIfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'bu' &&
- item?.PaymentStatus === 'P'
- );
- if (
- PayatCounterfilter?.length === 1 ||
- response?.data?.PaymentOrderDtl?.length === 0
- ) {
- 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 &&
- setPrintOrderDetails([response?.data]);
- filteredSettingNames?.includes('whatsapp') &&
- MobileNoWhatsApp?.value &&
- handleURL([response?.data]);
- CustomerDisplay(value);
-
- ClearAllGlobalStateDatas(value);
- }
-
- if (Paymentdevicefilter?.length === 1) {
- if (
- Paymentdevicefilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pd'
- ) {
- PaymentDeviceFlow(Paymentdevicefilter, value);
- }
- } else {
- console.log('more pd data');
- }
- if (PaymentGatewayfilter?.length === 1) {
- if (
- PaymentGatewayfilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pg'
- ) {
- await dispatch(changePaymentloader(true));
-
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- OrderBookingId: PaymentGatewayfilter?.[0]?.OrderId,
- Paymentgateway: true,
- OrderPaymentId: PaymentGatewayfilter?.[0]?.PaymentOrderId,
- OrderTotalAmount: PaymentGatewayfilter?.[0]?.Amount,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- const checkPaymentStatus = async () => {
- const intervalId = setInterval(async () => {
- try {
- let getpaymentgatewaydetail = await dispatch(
- PaymentGatewayGetdetail(PaymentGatewayfilter?.[0]?.OrderId)
- ).unwrap();
-
- if (getpaymentgatewaydetail?.data?.statusCode === 1) {
- let paymentdataget =
- getpaymentgatewaydetail?.data?.PaymentOrderDtl?.find(
- (item) =>
- item?.PaymentOrderId ===
- PaymentGatewayfilter?.[0]?.PaymentOrderId
- )?.PaymentStatus;
-
- if (paymentdataget === 'S') {
- setMessageType('success');
- setMessageData('Payment Success');
- await dispatch(changePaymentloader(false));
- if (
- getpaymentgatewaydetail?.data?.OrderDetails?.length > 0
- ) {
- setPrintOrderDetails([getpaymentgatewaydetail?.data]);
- CustomerDisplay(value);
-
- ClearAllGlobalStateDatas(value);
- }
- clearInterval(intervalId); // Stop the loop when payment is successful
- } else if (paymentdataget === 'F') {
- setMessageType('error');
- setMessageData('Payment Failed');
- await dispatch(changePaymentloader(false));
- setFirstPaymentclick(false);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- clearInterval(intervalId); // Stop the loop when payment fails
- CustomerDisplayRemovedData();
- ClearAllGlobalStateDatas(value);
- }
- }
- } catch (error) {
- console.error('Error fetching payment details: ', error);
- }
- }, 3000); // Call the API every 3 seconds
- };
-
- // Call the function to start checking payment status
- checkPaymentStatus();
- }
- } else {
- console.log('more pg data');
- }
- if (businessUPIfilter?.length === 1) {
- businessUPIFlow(
- businessUPIfilter,
- response?.data?.OrderId,
- response?.data?.PaymentPageLink
- );
- }
- dispatch(triggerCustomerRefresh());
- } else {
- setMessageType('error');
- setMessageData(response?.data?.response);
- setFirstPaymentclick(false);
- // clearInvoiceDate
- clearInvoiceDate();
- dispatch(changeCurrentOrderId(null));
- }
- };
-
- const PutBooking = async (putdatas, value, pay) => {
- let putdata = putdatas;
- putdata['OrderId'] = ReportholdData?.OrderId;
- putdata['SalesId'] = ReportholdData?.SalesId;
- putdata['UpdatedBy'] = UserId;
- if (value === 'Dine-In') {
- putdata['PaymentStatus'] = pay ? 'S' : 'P';
- putdata['PaymentDetail'] = !pay && [];
- putdata['PaymentType'] = !pay && '';
- } else if (value === 'Hold') {
- ((putdata['PaymentStatus'] = pay ? 'S' : 'P'),
- (putdata['PaymentDetail'] = !pay && []));
- putdata['PaymentType'] = !pay && '';
- putdata['ActiveStatus'] = pay ? 'A' : 'D';
- } else if (value === 'Unpaid') {
- putdata['PaymentStatus'] = pay ? 'S' : 'P';
- putdata['PaymentDetail'] = !pay && [];
- putdata['PaymentType'] = !pay && '';
- putdata['PrintType'] = 'Y';
- }
- let response = null;
- if (salesBillEdit) {
- response = await dispatch(putSalesBillEdit(putdata)).unwrap();
- } else {
- response = await dispatch(PutBookingData(putdata)).unwrap();
- }
- let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) => item?.PaymentOptionType?.toLowerCase() === 'pc'
- );
-
- if (value !== 'Unpaid') {
- if (response?.data?.statusCode == 1) {
- let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pd' &&
- item?.PaymentStatus === 'P'
- );
- let PaymentGatewayfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pg' &&
- item?.PaymentStatus === 'P'
- );
-
- if (
- PayatCounterfilter?.length === 1 ||
- response?.data?.PaymentOrderDtl?.length === 0
- ) {
- 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 &&
- setPrintOrderDetails([response?.data]);
- CustomerDisplay(value);
-
- ClearAllGlobalStateDatas(value);
- }
- if (Paymentdevicefilter?.length === 1) {
- if (
- Paymentdevicefilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pd'
- ) {
- PaymentDeviceFlow(Paymentdevicefilter, value);
- }
- } else {
- console.log('more pd data');
- }
- if (PaymentGatewayfilter?.length === 1) {
- PaymentGatewayFlow(PaymentGatewayfilter);
- } else {
- setPrintOrderDetails([response?.data]);
- // CustomerDisplay();
- ClearAllGlobalStateDatas();
- console.log('more pg data');
- }
- } else {
- // clearInvoiceDate
- clearInvoiceDate();
- dispatch(changeCurrentOrderId(null));
- }
- } else {
- setPrintOrderDetails([response?.data]);
- if (OfferCheckedInSetup && preferenceOffer) {
- await applyOffer([]);
- } else {
- dispatch(changeOrderCardDetails([]));
- }
- await dispatch(changeReorderHoldDetails({}));
- await dispatch(changeReorderProductDetails([]));
- setFirstPaymentclick(false);
- if (defaultBookingType === 'Both') {
- await dispatch(changeBookingType('TakeAway'));
- }
- await dispatch(changeSelectTable([]));
- await dispatch(changeSelectChair([]));
- getUnpaiddatas();
- }
- };
- const PutFailedPayment = async (PayData, value, pay) => {
- console.log(PayData?.PaymentDetail?.[0]?.PaymentType, 'mohanPayData');
- let tempsplitdata = {
- CompId: PayData?.CompId,
- BranchId: PayData?.BranchId,
- AppId: PayData?.AppId,
- CustSuppId: PayData?.SelCustId ? SelCustId : null,
- UpdatedBy: UserId,
- OrderId: ReportholdData?.OrderId,
- PaymentType: PayData?.PaymentDetail?.[0]?.PaymentType,
- Amount: FailedTotalAmt,
- PaymentOptionType: PayData?.PaymentDetail?.[0]?.PaymentOptionType,
- ModeOfPayment: PayData?.PaymentDetail?.[0]?.ModeOfPayment,
- AccountDtl: PayData?.PaymentDetail?.[0]?.AccountDtl,
- PaymentStatus: PayData?.PaymentDetail?.[0]?.PaymentStatus,
- Debit: PayData?.PaymentDetail?.[0]?.Debit,
- Credit: PayData?.PaymentDetail?.[0]?.Credit,
- };
-
- let response = await dispatch(
- putSplitpaymentStatus(tempsplitdata)
- ).unwrap();
- if (response?.data?.statusCode == 1) {
- let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pd' &&
- item?.PaymentStatus === 'P'
- );
- let PaymentGatewayfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pg' &&
- item?.PaymentStatus === 'P'
- );
- let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pc' &&
- item?.PaymentType === PayData?.PaymentDetail?.[0]?.PaymentType
- );
- if (
- PayatCounterfilter?.length > 0 ||
- response?.data?.PaymentOrderDtl?.length === 0
- ) {
- setMessageType('success');
-
- // setSplitSelPayMode({...SplitSelPayMode,...{[`PaymentStatus-${i}`]:"S"}})
-
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- upi: null,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- setMessageData(
- response?.data?.response +
- ' ' +
- (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]);
- CustomerDisplay();
- ClearAllGlobalStateDatas();
- }
- }
- if (Paymentdevicefilter?.length === 1) {
- if (
- Paymentdevicefilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pd'
- ) {
- PaymentDeviceFlow(Paymentdevicefilter, value);
- }
- }
-
- if (PaymentGatewayfilter?.length === 1) {
- if (
- PaymentGatewayfilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pg'
- ) {
- PaymentGatewayFlow(PaymentGatewayfilter, value);
- }
- }
- }
- };
- const PaymentGatewayFlow = async (PaymentGatewayfilter) => {
- if (PaymentGatewayfilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pg') {
- await dispatch(changePaymentloader(true));
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- OrderBookingId: PaymentGatewayfilter?.[0]?.OrderId,
- Paymentgateway: true,
- OrderPaymentId: PaymentGatewayfilter?.[0]?.PaymentOrderId,
- OrderTotalAmount: PaymentGatewayfilter?.[0]?.Amount,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- const checkPaymentStatus = async () => {
- const intervalId = setInterval(async () => {
- try {
- let getpaymentgatewaydetail = await dispatch(
- PaymentGatewayGetdetail(PaymentGatewayfilter?.[0]?.OrderId)
- ).unwrap();
-
- if (getpaymentgatewaydetail?.data?.statusCode === 1) {
- let paymentdataget =
- getpaymentgatewaydetail?.data?.PaymentOrderDtl?.find(
- (item) =>
- item?.PaymentOrderId ===
- PaymentGatewayfilter?.[0]?.PaymentOrderId
- )?.PaymentStatus;
-
- if (paymentdataget === 'S') {
- setMessageType('success');
- setMessageData('Payment Success');
- await dispatch(changePaymentloader(false));
- if (getpaymentgatewaydetail?.data?.OrderDetails?.length > 0) {
- setPrintOrderDetails([getpaymentgatewaydetail?.data]);
- CustomerDisplay(value);
-
- ClearAllGlobalStateDatas(value);
- }
- clearInterval(intervalId); // Stop the loop when payment is successful
- } else if (paymentdataget === 'F') {
- setMessageType('error');
- setMessageData('Payment Failed');
- await dispatch(changePaymentloader(false));
- setFirstPaymentclick(false);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- clearInterval(intervalId); // Stop the loop when payment fails
- CustomerDisplayRemovedData();
- ClearAllGlobalStateDatas(value);
- // const customerDisplayWindow = getCustomerDisplayWindow();
- // if (customerDisplayWindow && !customerDisplayWindow.closed) {
- // const updatedData = {
- // userData: OrderCardDetail,
- // ExtraCharges: GlobalExtraCharge,
- // upi: GlobalUpiID,
- // customer: selOption != null ? selOption : GetCustId,
- // paymentMethod: Paybtnnameselected,
- // Paymentgateway: false,
- // OrderTotalAmount: PaymentGatewayfilter?.[0]?.Amount
-
- // };
- // customerDisplayWindow.postMessage(updatedData, '*');
- // }
- }
- }
- } catch (error) {
- console.error('Error fetching payment details: ', error);
- }
- }, 3000); // Call the API every 3 seconds
- };
-
- // Call the function to start checking payment status
- checkPaymentStatus();
- }
- };
- const PaymentDeviceFlow = async (Paymentdevicefilter, value) => {
- await dispatch(changePaymentloader(true));
- await dispatch(
- changePaymentTransactionNumber(Paymentdevicefilter?.[0]?.PaymentOrderId)
- );
-
- let paymentdetail = {
- TransactionNumber: Paymentdevicefilter?.[0]?.PaymentOrderId,
- SequenceNumber: 1,
- AllowedPaymentMode:
- Paymentdevicefilter?.[0]?.PaymentTypeName?.toLowerCase() === 'card'
- ? '1'
- : Paymentdevicefilter?.[0]?.PaymentTypeName?.toLowerCase() === 'upi'
- ? '10'
- : '',
- Amount: `${parseInt(Paymentdevicefilter?.[0]?.Amount) * 100}`,
- ClientID: useOptions?.[0]?.PDConfigDetails?.[0]?.ClientId,
- StoreID: useOptions?.[0]?.PDConfigDetails?.[0]?.StoreId,
- UserID: useOptions?.[0]?.PDConfigDetails?.[0]?.UserId,
- MerchantID: useOptions?.[0]?.PDConfigDetails?.[0]?.MerchantId,
- SecurityToken: useOptions?.[0]?.PDConfigDetails?.[0]?.SecurityToken,
- IMEI: useOptions?.[0]?.PDConfigDetails?.[0]?.IMEI,
- AutoCancelDurationInMinutes:
- useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes,
- };
- let apiresponse = await dispatch(PostPaymentdevice(paymentdetail)).unwrap();
- if (apiresponse?.ResponseMessage?.toLowerCase() === 'approved') {
- let pendingPaymentList = {
- MerchantID: useOptions?.[0]?.PDConfigDetails?.[0]?.MerchantId,
- SecurityToken: useOptions?.[0]?.PDConfigDetails?.[0]?.SecurityToken,
- ClientID: useOptions?.[0]?.PDConfigDetails?.[0]?.ClientId,
- StoreID: useOptions?.[0]?.PDConfigDetails?.[0]?.StoreId,
- IMEI: useOptions?.[0]?.PDConfigDetails?.[0]?.IMEI,
- PlutusTransactionReferenceId: apiresponse?.PlutusTransactionReferenceID,
- PaymentOrderId: Paymentdevicefilter?.[0]?.PaymentOrderId,
- UpdatedBy: UserId,
- };
- await dispatch(PutPendingPaymentList(pendingPaymentList)).unwrap();
- let isApproved = false;
- const startTime = Date.now();
- let postpaymentdata = {
- MerchantID: useOptions?.[0]?.PDConfigDetails?.[0]?.MerchantId,
- SecurityToken: useOptions?.[0]?.PDConfigDetails?.[0]?.SecurityToken,
- ClientID: useOptions?.[0]?.PDConfigDetails?.[0]?.ClientId,
- StoreID: useOptions?.[0]?.PDConfigDetails?.[0]?.StoreId,
- IMEI: useOptions?.[0]?.PDConfigDetails?.[0]?.IMEI,
- PlutusTransactionReferenceID: apiresponse?.PlutusTransactionReferenceID,
- };
- // Loop to call the second API every 3 seconds
- while (!isApproved) {
- let ApiResponseget = await dispatch(
- GetPaymentdeviceResponse(postpaymentdata)
- ).unwrap();
-
- if (ApiResponseget?.ResponseMessage?.toLowerCase() === 'txn approved') {
- let putbookingdata = {
- OrderBookingId: Paymentdevicefilter?.[0]?.OrderId,
- OrderId: Paymentdevicefilter?.[0]?.PaymentOrderId,
- PaymentStatus: 'S',
- Amount: Paymentdevicefilter?.[0]?.Amount,
- ResponseDtl: [ApiResponseget],
- PaymentType: Paymentdevicefilter?.[0]?.PaymentType,
- UpdatedBy: UserId,
- };
-
- let bookingpaymentupdate = await dispatch(
- PutBookingPaymentStatusChange(putbookingdata)
- ).unwrap();
- if (bookingpaymentupdate?.data?.statusCode === 1) {
- 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 &&
- setPrintOrderDetails([bookingpaymentupdate?.data]);
- CustomerDisplay(value);
-
- ClearAllGlobalStateDatas(value);
- await dispatch(changePaymentloader(false));
- }
- isApproved = true;
- console.log('Transaction Approved!');
- // Exit the loop
- break;
- }
-
- // Check if 1 minute has passed
- if (
- Date.now() - startTime >
- useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes *
- 60000
- ) {
- // 60,000 ms = 1 minute
-
- let putbookingdata = {
- OrderBookingId: Paymentdevicefilter?.[0]?.OrderId,
- OrderId: Paymentdevicefilter?.[0]?.PaymentOrderId,
- PaymentStatus: 'F',
- Amount: Paymentdevicefilter?.[0]?.Amount,
- ResponseDtl: [ApiResponseget],
- PaymentType: Paymentdevicefilter?.[0]?.PaymentType,
- UpdatedBy: UserId,
- };
-
- let bookingpaymentupdate = await dispatch(
- PutBookingPaymentStatusChange(putbookingdata)
- ).unwrap();
- if (bookingpaymentupdate?.data?.statusCode === 1) {
- setMessageType('error');
- setMessageData(
- `Payment Failed. Your Transaction Number is ${Paymentdevicefilter?.[0]?.PaymentOrderId}`
- );
- setFirstPaymentclick(false);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- await dispatch(changePaymentloader(false));
- CustomerDisplayRemovedData();
- ClearAllGlobalStateDatas(value);
- }
-
- console.error('Transaction not approved within 1 minute.');
- // Send an error message or handle the timeout
- // You can dispatch an action, show a notification, etc.
- break;
- }
-
- // Wait for 3 seconds before making the next call
- await new Promise((resolve) => setTimeout(resolve, 3000));
- }
- } else {
- let putbookingdata = {
- OrderBookingId: Paymentdevicefilter?.[0]?.OrderId,
- OrderId: Paymentdevicefilter?.[0]?.PaymentOrderId,
- PaymentStatus: 'F',
- Amount: Paymentdevicefilter?.[0]?.Amount,
- PaymentType: Paymentdevicefilter?.[0]?.PaymentType,
- UpdatedBy: UserId,
- };
- let bookingpaymentupdate = await dispatch(
- PutBookingPaymentStatusChange(putbookingdata)
- ).unwrap();
- if (bookingpaymentupdate?.data?.statusCode === 1) {
- setMessageType('error');
- setMessageData(apiresponse?.ResponseMessage);
- setFirstPaymentclick(false);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- dispatch(changePaymentloader(false));
- CustomerDisplayRemovedData();
- ClearAllGlobalStateDatas(value);
- }
- }
- };
- const businessUPIFlow = async (
- businessUPIfilter,
- OrderId,
- PaymentStatusLink
- ) => {
- // You can add similar logic as PaymentDeviceFlow or PaymentGatewayFlow based on your requirements
- setBusinessUPILink(PaymentStatusLink);
- setBusinessUPI(true);
- setBusinessUPIOrderId(OrderId);
- };
- function safeRound(amountStr) {
- if (amountStr == null) return '0.00';
-
- const cleaned = String(amountStr).replace(/[^0-9.-]+/g, '');
- const num = Number(cleaned);
-
- return isNaN(num) ? '0.00' : num.toFixed(2); // return as string with 2 decimals
- }
- const columns = [
- {
- title: 'Sl.No',
- key: 'sno',
- align: 'center',
- width: '100px',
- render: (text, object, index) => (
- {index + 1}
- ),
- },
- {
- title: 'Table Name/Chair Name',
- dataIndex: 'TableName',
- key: 'TableName',
- width: '150px',
- onCell: (_, record, index) => {
- return {
- onClick: () => {
- Unpaidfun(record);
- },
- };
- },
- },
- {
- title: 'Order Id',
- dataIndex: 'OrderID',
- key: 'OrderID',
- width: '150px',
- align: 'right',
- onCell: (_, record, index) => {
- return {
- onClick: () => {
- Unpaidfun(record);
- },
- };
- },
- },
- {
- title: "Item's",
- dataIndex: 'ProductName',
- key: 'ProductName',
- width: '250px',
- onCell: (_, record, index) => {
- return {
- onClick: () => {
- Unpaidfun(record);
- },
- };
- },
- },
- {
- title: 'Amount',
- dataIndex: 'TotalAmount',
- key: 'TotalAmount',
- width: '150px',
- align: 'right',
- render: (text) => {safeRound(text)} ,
- onCell: (_, record, index) => {
- return {
- onClick: () => {
- Unpaidfun(record);
- },
- };
- },
- },
- ];
-
- const TableData = [];
- tabledata?.map((item) =>
- TableData.push({
- TableName: item.SalesTableLinkDetails?.map((item) =>
- item.ChairName == null ? item.TableName : item.ChairName
- )?.join(','),
- OrderID: extractLastNumberOrderId(item?.OrderId, item?.FYStatus),
- ProductName: item.productDetails
- ?.map(
- (item) =>
- item?.ProdName +
- '-' +
- (item?.Type != 'C' ? item?.OrderQty : '1 Combo')
- )
- ?.join(','),
- TotalAmount: item.NetAmount,
- })
- );
-
- const Unpaidfun = async (event) => {
- dispatch(changeunpaidflow(true));
- if (
- OrderCardDetail?.length > 0 &&
- (BookingType === 'Dine In' || BookingTypeBoth)
- ) {
- setUnpaidConfirmation(true);
- setunpaidselectedindex(event);
- } else {
- const UpdatedData = tabledata?.[event]?.productDetails;
- if (OfferCheckedInSetup && preferenceOffer) {
- await applyOffer(UpdatedData);
- } else {
- dispatch(changeOrderCardDetails(UpdatedData));
- }
- await dispatch(ChangeTotalAmount(tabledata?.[event]?.ExtraChargeDetails));
- await dispatch(changeReorderHoldDetails([tabledata?.[event]]?.[0]));
- await dispatch(
- changeReorderProductDetails(tabledata?.[event]?.productDetails)
- );
- await dispatch(changeUnpaidData(true));
- setUnpaidOpen(false);
- }
- };
-
- const UnpaidOk = async () => {
- setOrderStatus(false);
- await dispatch(changeSelectedTableDetails([]));
- await dispatch(changeSelectTable([]));
- await dispatch(changeSelectChair([]));
- if (defaultBookingType === 'Both') {
- await dispatch(changeBookingType('TakeAway'));
- }
- await dispatch(
- changeOrderCardDetails(tabledata?.[unpaidselectedindex]?.productDetails)
- );
- await dispatch(
- changeReorderProductDetails(
- tabledata?.[unpaidselectedindex]?.productDetails
- )
- );
- await dispatch(
- changeReorderHoldDetails([tabledata?.[unpaidselectedindex]]?.[0])
- );
- await dispatch(
- ChangeTotalAmount(tabledata?.[unpaidselectedindex]?.ExtraChargeDetails)
- );
- await dispatch(changeUnpaidData(true));
- setUnpaidOpen(false);
- setUnpaidConfirmation(false);
- };
- const Unpaidclose = async () => {
- dispatch(changeunpaidflow(false));
- setUnpaidOpen(false);
- setUnpaidConfirmation(false);
- };
-
- const Recipt = () => {
- AddBookingDetails('Unpaid', false);
- };
-
- const getstockbadge = async () => {
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- };
- await dispatch(getSelectedFavItems(data)).unwrap();
-
- let data1 = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- ProdSubCat: ProdSubCat,
- };
-
- let data2 = {
- compId: CompId,
- branchId: BranchId,
- appId: AppId,
- prodCat: prodCat,
- };
-
- if (
- templateData?.BookingLayout?.[1]?.some(
- (item) => item?.OptionName === 'SubCategory'
- ) &&
- ProdSubCat
- ) {
- await dispatch(getLayoutproductCard(data1)).unwrap();
- } else if (
- !templateData?.BookingLayout?.[1]?.some(
- (item) => item?.OptionName === 'SubCategory'
- )
- ) {
- await dispatch(getCardDataWithoutSubmodule(data2)).unwrap();
- } else {
- await dispatch(getCardDataWithoutSub(data2)).unwrap();
- }
- };
-
- const Combocarddata = async () => {
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- ActiveStatus: 'A',
- };
-
- let response = await dispatch(getCombolist(data)).unwrap();
- let datas = response?.data?.data;
- await dispatch(ChangeComboCarddata(datas));
- if (response?.data?.statusCode === 1) {
- // let Data = response?.data?.data
- // let comboList = Data?.map((item, index) => ({
- // ...item,
- // id: `${item.ComboName || 'Combo'}-${index}`,
- // ProdName:item?.ComboName,
- // OverAllQty:item?.OverallQuantity
- // }));
- // setCombocardata(comboList);
- }
- };
-
- const Upimodel = (type) => {
- setUpiOpen(false);
- if (type == 'Submit') {
- AddBookingDetails(BookingType, true);
- }
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedRemovedData = {
- type: 'remove',
- keyValue: 'OrderTotalAmount',
- };
- customerDisplayWindow.postMessage(updatedRemovedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- };
- // const OrderId=PostBookingDataDetailOrderId ?.OrderId
- const today = new Date();
- const year = today.getFullYear();
- // Note: Months are zero-based, so we add 1 to get the actual month
- const month = today.getMonth() + 1;
- const day = today.getDate();
-
- // Creating a formatted date string (in the format YYYY-MM-DD)
- const Todaydate = `${day < 10 ? '0' : ''}${day}-${month < 10 ? '0' : ''}${month}-${year}`;
- const OrderId = PrintOrderDetails?.[0]?.OrderDetails?.[0]?.OrderId;
- let MobileNo = selOption?.value;
- const onFinalSubmit = async () => {
- let url = `${MainHomeUrl}payment-page?amt=${TotalAmount}&Id=${MobileNo}&cus=${SelCustId} &CusN=${selOption?.CustName}&Br=${brachName}`;
- let response = await dispatch(SendPaymentLink({ MobileNo, url })).unwrap();
- if (response?.data?.statusCode === 1) {
- setMessageType('success');
- setMessageData('Link Sent Successfully');
- }
- };
- const handleResponsiveBill = () => {
- setResponsiveBill(!responsiveBill);
- };
-
- const CreditCustomerHAndleCancel = () => {
- setcreditCustomerOpen(false);
- };
-
- const CreditCustomerFun = () => {
- if (
- OrderCardDetail?.length === 0 &&
- (selOption?.value !== undefined ||
- GlobalAddCustomerDetails1.length > 0 ||
- GetCustId?.CustMobile !== undefined)
- ) {
- setcreditCustomerOpen(true);
- } else {
- if (selOption?.value == undefined) {
- setMessageType('warning');
- setMessageData('Please Select the Customer');
- }
- }
- };
- const changeOrderStatus = () => {
- setOrderStatus(!OrderStatus);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- };
-
- const navCust = templateData?.BookingNavbar?.[1]?.some(
- (item) => item?.OptionName === 'AddCustomer'
- );
-
- const handlepaymentoptions = async () => {
- await dispatch(changeSalesPaymentoption(true));
- await dispatch(
- getPaymentOptionsData({
- AppId: AppId,
- CompId: CompId,
- BranchId: BranchId,
- })
- );
- };
-
- const handleURL = async (PrintOrderDetails) => {
- let orderIdsArray = PrintOrderDetails?.[0]?.OrderDetails?.map(
- (orderDetail) => orderDetail?.OrderId
- );
- const encrypted = encryptObject(orderIdsArray);
-
- const postData = {
- Url: encrypted,
- CreatedBy: UserId,
- };
- if (orderIdsArray) {
- const res = await dispatch(PublicQrCodepost(postData)).unwrap();
- const urlData = res?.data?.ReferenceNo;
- setUrlData(urlData);
- }
- };
- // const orderIdsArray =
- // PrintOrderDetails?.[0]?.OrderDetails?.map(
- // (orderDetail) => orderDetail?.OrderId
- // ) || [];
- const customerNameOrMobile = MobileNoWhatsApp?.CustName?.trim()
- ? `Dear ${MobileNoWhatsApp?.CustName}`
- : `Dear ${MobileNoWhatsApp?.value}`;
- const documentUrl = `${MainHomeUrl}viewbill?code=${urlData}`;
- const encodedMessage = `${customerNameOrMobile},\n\n🙏 Thank you for being a valuable customer!\n\n🧾 To view your bill, please click the link below:\n${documentUrl}`;
-
- // ------------------------------------------------OTHER SERVICES FUNCTIONALITY-----------------------------------------------------------------------------------
-
- useEffect(() => {
- if (isMobile) {
- OtherServiceMobilePrint(
- OtherServicesPrintDetails,
- UpiId,
- 'Booking',
- SettingDataSelector
- );
- } else {
- Otherserviceprint();
- }
- }, [OtherServicesPrintDetails]);
-
- useEffect(() => {
- const setDefaultPaymentOption = async () => {
- const res = await dispatch(
- getDefaultPaymentOptions({ AppId, CompId, BranchId })
- )?.unwrap();
- const defaultDetail = res?.data?.data?.[0]?.DefaultDetails?.[0];
- if (res?.data?.data?.length > 0 && defaultDetail) {
- setDefaultEnabled(true);
- setDefaultPaymentMode(defaultDetail);
- const { option, card } = defaultDetail;
- if (option?.value) setSelectedUPIPayOption(option.value);
- if (card) {
- const isDefault =
- String(option?.value ?? '').toLowerCase() === 'default';
- const idToUse = isDefault ? card?.UPIId : card?.ModeId;
-
- if (idToUse) {
- addUpiOption(card?.Mode, card?.ModeName, idToUse);
- }
- }
- } else {
- setDefaultEnabled(false);
- setDefaultPaymentMode([]);
- }
- };
- if (salesBillEdit) {
- setDefaultPaymentOption();
- }
- }, [defaultPaymentTrigger, salesBillEdit]);
-
- const Otherserviceprint = async () => {
- if (OtherServicesPrintDetails?.length > 0) {
- const style = await PrintStyleFunction('OtherServices1');
- const stylesMap = {
- OtherServices1: 'OtherServices1',
- };
-
- const selectedStyle = stylesMap['OtherServices1'];
-
- console.log(selectedStyle, 'selectedStyle');
-
- await printDiv('OtherServices1', style); // Use unique IDs for each print
-
- setOtherServicesPrintDetails([]);
- closePrintOption();
- }
- };
-
- const OtherServicePostBooking = async (PostData, value) => {
- console.log(PostData, value, 'PostData, value');
-
- let postdata = {
- AppId: AppId,
- CompId: CompId,
- BranchId: BranchId,
- BillAmount: PostData?.BillAmount,
- TaxAmount: PostData?.TaxAmount,
- NetAmount: PostData?.NetAmount,
- OtherServicesTicketDetails: OrderCardDetail.map((item) => ({
- ServiceId: item.ServiceId,
- ServiceCategory: item.ServiceCategory,
- VehicleNumber: item.VehicleNo || '',
- Qty: item.OrderQty,
- Rate: item.Rate,
- TaxAmount: item.TaxAmt,
- TotalAmount: item.TotalAmt,
- })),
- PaymentDetail: PostData?.PaymentDetail,
- CreatedBy: UserId,
- };
-
- let Response = await dispatch(PostOtherServices(postdata)).unwrap();
-
- if (Response?.data?.statusCode == 1) {
- setMessageType('success');
- setMessageData(Response?.data?.response);
- ClearAllGlobalStateDatas(value);
- setOtherServicesPrintDetails([
- Response?.data?.OtherServicesTicketDetails?.[0],
- ]);
- }
-
- console.log(postdata, 'PostdataPostdataPostdata');
- };
-
- const Otherservicesvehicleno = () => {
- setOtherServicesModal(true);
- };
-
- const handleInputChange = (key, index, value, serviceType, item) => {
- const uppercasedValue = value.toUpperCase();
- const regex = /^[A-Z]{2}[0-9]{2}[A-Z]{1,2}[0-9]{4}$/;
- const isValid = regex.test(uppercasedValue);
-
- if (serviceType === 'G') {
- const existing = vehicleInputs[key] ? [...vehicleInputs[key]] : [];
- existing[index] = uppercasedValue;
-
- setVehicleInputs((prev) => ({ ...prev, [key]: existing }));
-
- const updatedErrors = {
- ...errors,
- [key]: [...(errors[key] || [])],
- };
- // updatedErrors[key][index] = isValid ? '' : 'Invalid format (e.g., KA01AB1234)';
- updatedErrors[key][index] =
- uppercasedValue === ''
- ? ''
- : isValid
- ? ''
- : 'Invalid format (e.g., KA01AB1234)';
-
- setErrors(updatedErrors);
-
- vehiclesvalues({ ...vehicleInputs, [key]: existing });
- } else {
- const uniqueKey = `${key}__${item.__index}`;
- const updatedInputs = {
- ...vehicleInputs,
- [uniqueKey]: [uppercasedValue],
- };
-
- const updatedErrors = { ...errors };
- // updatedErrors[uniqueKey] = [isValid ? '' : 'Invalid format (e.g., KA01AB1234)'];
-
- updatedErrors[uniqueKey] = [
- uppercasedValue === ''
- ? ''
- : isValid
- ? ''
- : 'Invalid format (e.g., KA01AB1234)',
- ];
-
- setVehicleInputs(updatedInputs);
- setErrors(updatedErrors);
-
- vehiclesvalues(updatedInputs);
- }
- };
-
- const vehiclesvalues = (vehicleData) => {
- const updated = OrderCardDetail.map((item) => {
- const key =
- item.ServiceType === 'G'
- ? item.id // using `id` now
- : `${item.ServiceId}__${item.__index}`;
-
- // if (vehicleData[key]) {
- // return {
- // ...item,
- // VehicleNo: vehicleData[key],
- // };
- // }
- // return item;
-
- const value = vehicleData[key];
-
- if (value && value.length) {
- return {
- ...item,
- VehicleNo:
- item.ServiceType === 'G'
- ? value.join(',') // 👈 convert array to comma-separated string
- : value[0], // 👈 single string from array
- };
- }
-
- return item;
- });
-
- dispatch(changeOrderCardDetails(updated));
- };
-
- const Handlevehiclenumbers = () => {
- setOtherServicesModal(false);
- };
- const hasVehicleInputErrors = () => {
- return Object.values(errors).some(
- (arr) => Array.isArray(arr) && arr.some((err) => err)
- );
- };
- return (
- <>
- {(addcustomer || hold) && (
-
- )}
- {creditCustomerOpen && (
-
- )}
- {TotalAmount == 0 && Success && (
-
-
-
- )}
- {TotalAmount > 0 &&
- qrCode &&
- PaymentUpiOptions?.length > 0 &&
- SelectedUpiOption && (
-
-
-
- )}
-
- {PaymentUpiOptions?.length > 0 && OrderId && (
-
-
-
- )}
-
-
- {screenwidth <= 768 && (
-
- {Array.isArray(OrderCardDetail) &&
- OrderCardDetail?.length >= 1 &&
- (isMobile || screenwidth <= 768) && (
-
- )}
-
- )}
-
-
-
- {tableOptions
- ?.filter((item) => item.OptionName === 'AddCustomer')
- .map((filteredItem) => (
-
-
-
- ))}
-
-
- {!OtherServicesglobal && (
-
- {tableOptions?.map((item) => (
- <>
- {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')}
- style={{
- fontSize: '30px',
- cursor: 'pointer',
- color: '' ? '#52c41a' : '#1292EE',
- }}
- />
-
- )
- : ''}
- {unpaidFlow == false
- ? item?.OptionName == 'Hold' &&
- BookingType !== 'Dine In' &&
- !BookingTypeBoth &&
- Holddata?.length > 0 &&
- OrderCardDetail?.length == 0 &&
- CheckBookingStatus != 'Close' &&
- !addnewAccess &&
- paybtns?.length > 0 &&
- !OtherServicesglobal && (
-
- {' '}
-
- HandleholdModelOpen()}
- style={{
- fontSize: '28px',
- cursor: 'pointer',
- color: Holddata ? '#52c41a' : 'default',
- pointerEvents:
- OrderType === 'Failed' ? 'none' : 'auto',
- }}
- />
-
-
- )
- : ''}
- >
- ))}
- {paybtns?.length > 1 && (
-
0) &&
- !unpaidFlow &&
- OrderStatus
- ? 'none'
- : 'auto',
- opacity:
- (BookingType === 'Dine In' ||
- BookingTypeBoth ||
- CheckOrderType?.length > 0) &&
- !unpaidFlow &&
- OrderStatus
- ? 0.5
- : 1,
- width: '2rem',
- }}
- >
- {!OtherServicesglobal && (
-
- {' '}
-
-
- )}
-
- )}
-
- )}
- {Array.isArray(OrderCardDetail) && OrderCardDetail?.length >= 1 && (
-
- {responsiveBill ? (
-
- ) : (
-
- )}
-
- )}
-
-
-
-
-
-
- 0) &&
- !unpaidFlow &&
- OrderStatus
- ? 'none'
- : 'auto',
- opacity:
- (BookingType === 'Dine In' ||
- BookingTypeBoth ||
- CheckOrderType?.length > 0) &&
- !unpaidFlow &&
- OrderStatus
- ? 0.5
- : 1,
- }}
- >
- {paybtns?.length > 0 &&
- currentOrderNetAmount >= previousNetAmount ? (
- paybtns?.map((payment) => (
-
-
- payment?.ModeName?.toLowerCase() === 'upi' // Change the condition to payment.Id
- ? handleUPIButtonClick(
- payment.ModeId,
- payment.ModeName
- )
- : handlePaymentMode(
- payment.ModeId,
- payment.ModeName
- )
- }
- >
- {/* {UpiOption === "" && payment?.Name?.toLowerCase() === "upi" && UPI
} */}
-
-
- {payment.ModeName}
- {payment?.ModeName?.toLowerCase() === 'card' && (
-
- )}
- {payment?.ModeName?.toLowerCase() === 'upi' && (
-
- )}
-
-
-
- ))
- ) : currentOrderNetAmount < previousNetAmount &&
- salesBillEdit &&
- refundPayBtns.length > 0 ? (
- refundPayBtns.map((payment) => (
-
-
- handleRefundPaymentMode(
- payment?.ConfigId,
- payment?.ConfigName
- )
- }
- >
-
- {payment.ConfigName}
-
-
-
- ))
- ) : (
-
- Please Set Payment Options
-
- )}
-
-
-
-
-
-
- 0 &&
- paybtnselected &&
- CheckBookingStatus != 'Close'
- ? !OrderStatus
- ? salesBillEdit &&
- currentOrderNetAmount < previousNetAmount
- ? 'BST6Payment-Button-pay'
- : 'BST6Payment-Button-pay'
- : 'BST6Payment-Button-pay Order'
- : 'BST6Payment-Button-pay-disabled'
- }
- >
- {
- // (qrCode && SelectedUPIPayOption === "Default") ? UpiPayment() : OrderStatus ? AddBookingDetails("Dine-In") : AddBookingDetails(BookingType, true);
- // }}
- onClick={
- // BranchFinancialStatus==='N'? financialYearError:
- handleButtonClick
- }
- >
- {!OrderStatus ? (
- salesBillEdit &&
- currentOrderNetAmount < previousNetAmount ? (
-
- Refund: ₹
- {(previousNetAmount || 0) -
- (currentOrderNetAmount || 0)}
-
- ) : (
- <>
-
- {isMobile ? (
- `₹ ${safeRound(
- OrderType === 'Failed'
- ? FailedTotalAmt
- : credit && overAllBal >= 0
- ? Math.max(0, TotalAmount - overAllBal)
- : TotalAmount
- )}`
- ) : (
-
- ₹{' '}
- = 0
- ? Math.max(0, TotalAmount - overAllBal)
- : TotalAmount
- )}
- />
-
- )}
- {/* ₹ {Math.round(TotalAmount)} */}
-
-
-
- >
- )
- ) : (
-
ORDER
- )}
- {PrintOrderDetails?.length > 0 &&
- PrintOrderDetails?.[0]?.OrderDetails?.map(
- (orderDetail, index) => (
-
- )
- )}
- {PrintOrderDetails?.length > 0 &&
- (TokenOnly?.SettingValue === 'Y' ||
- IndividualToken?.SettingValue === 'Y') &&
- PrintOrderDetails?.[0]?.OrderDetails?.map(
- (orderDetail, index) => (
-
-
-
- )
- )}
-
-
-
-
-
-
- >
- }
- title=" "
- trigger="click"
- open={open2}
- onOpenChange={handleOpenChange2}
- overlayStyle={{
- // width: "100%",
- height: '300',
- }}
- >
-
-
-
-
-
-
-
-
- >
- }
- title=" "
- trigger="click"
- open={open}
- onOpenChange={handleOpenChange}
- overlayStyle={{
- width: '100%',
- height: '300',
- }}
- >
-
-
-
-
-
-
-
- {paybtnselected ==
- paybtns?.filter(
- (item) => item?.ModeName?.toLowerCase() === 'cash'
- )?.[0]?.ModeId ? (
-
- ) : (
- ''
- )}
-
-
-
- {tableOptions?.filter((item) => item.OptionName === 'AddCustomer')
- .length === 1 || navCust === true ? (
-
- {Object.keys(useOptions)?.length > 0 &&
- useOptions?.some((flow) =>
- flow.OptionDetails.some(
- (option) =>
- option.OptionName === 'Pay at the counter' &&
- option.ModeDetails.some(
- (mode) => mode.ModeName === 'Credit'
- )
- )
- ) && (
-
- {!OtherServicesglobal && (
-
- {' '}
- 0 && 'not-allowed',
- color:
- OrderCardDetail?.length > 0 ||
- (selOption?.value === undefined &&
- GlobalAddCustomerDetails1?.length === 0 &&
- GetCustId?.CustMobile === undefined)
- ? 'gray'
- : 'rgb(18, 146, 238)',
- fontSize: '28px',
- }}
- />
-
- )}
-
- )}
-
- ) : (
- ''
- )}
- {/* Customer Orders */}
- {(SelCustId && tableOptions?.filter((item) => item.OptionName === 'PreviousBillFetch')
- .length === 1) && (
-
- {' '}
- {
- if (
- CheckBookingStatus !== 'Close' &&
- !addnewAccess &&
- !(OrderCardDetail?.length > 0)
- ) {
- setCustomerPreviesOrders(true);
- }
- }}
- style={{
- cursor: OrderCardDetail?.length > 0 && 'not-allowed',
- color:
- OrderCardDetail?.length > 0 ||
- (OrderCardDetail?.length > 0 &&
- GetCustId?.CustMobile === undefined)
- ? 'gray'
- : 'rgb(18, 146, 238)',
- fontSize: '25px',
- display: 'flex',
- alignItems: 'center',
- height: '2.46rem',
- width: '1.5rem',
- }}
- >
-
-
-
- )}
- {tabledata?.length > 0 && dinePreference && (
-
- {tableOptions
- ?.filter((item) => item.OptionName === 'UnpaidBill')
- .map((filteredItem) => (
-
- {!OtherServicesglobal && (
-
- {' '}
- {
- (setUnpaidOpen(true), getUnpaiddatas());
- }}
- />
-
- )}
-
- ))}
-
- )}
- {OtherServicesglobal && OrderCardDetail.length >= 1 && (
-
- {' '}
-
-
-
-
- )}
- {dinePreference && (
-
- {(BookingType === 'Dine In' ||
- BookingTypeBoth ||
- CheckOrderType?.length > 0) &&
- !unpaidFlow &&
- SelectedTableDetails?.length !== 0 && (
- <>
-
- {' '}
-
- FirstPaymentclick === false && !addnewAccess
- ? changeOrderStatus()
- : ''
- }
- />
-
- {FirstPaymentclick === false &&
- !addnewAccess &&
- !OrderStatus &&
}
- >
- )}
-
- )}
- {!OtherServicesglobal &&
- OrderCardDetail?.length > 0 &&
- ParkingDisplay &&
- !OtherServicesglobal && (
-
-
-
- )}
- {!OtherServicesglobal && unpaidFlow == true ? (
-
- {' '}
- {
- Recipt();
- }}
- />
-
- ) : (
- ''
- )}
-
- {!OtherServicesglobal && CreditCustomer && (
-
- {
- handleCreditCustomer('Cancel');
- }}
- handleOk={() => {
- handleCreditCustomer('Submit');
- }}
- />
-
- )}
-
-
{
- Upimodel('Cancel');
- }}
- footer={false}
- children={
-
- {/*
UPI PAYMENT */}
-
-
-
-
-
-
-
-
- {' '}
- RS :
- {OrderType === 'Failed'
- ? FailedTotalAmt
- : Math.round(TotalAmount)}{' '}
-
-
-
-
-
- {(selOption || SelCustId) && (
-
- Sent Payment Link
-
- {/*
*/}
-
- )}
-
-
- }
- handleSubmit={() => {
- Upimodel('Submit');
- }}
- />
-
-
-
- }
- />
- {
- OtherServicesPrintDetails?.length > 0 && (
- // PrintOrderDetails?.[0]?.OrderDetails?.map((orderDetail, index) => (
-
-
-
- )
- // ))
- }
- {
- setUnpaidOpen(false);
- }}
- footer={false}
- children={
-
- }
- />
- {UnpaidConfirmation && (
-
-
- You have already selected a table. If you click 'OK,' the
- table selection will be removed, and the unpaid flow will
- continue. If you click 'Cancel,' the dine-in flow will
- proceed as selected.
-
- >
- }
- onOk={UnpaidOk}
- onCancel={Unpaidclose}
- />
- )}
- {!OtherServicesglobal && Splitpayment && (
- data?.TotalAmt + acc,
- 0
- ) -
- ((OverAllSales > 0 ? OverAllSales : 0) +
- (OverAllEstimate > 0 ? OverAllEstimate : 0) +
- (Discount > 0 ? Discount : 0))
- )
- }
- failedOrderData={failedOrderData}
- />
- )}
-
- {PrintOrderDetails?.length > 0 && (
-
- {filteredSettingNames?.includes('whatsapp') &&
- MobileNoWhatsApp?.value && (
-
- )}
-
-
-
- {filteredSettingNames?.includes('SMS') && isMobile && (
-
- )}
- {/* WhatsAppShare modal/component */}
- {showWhatsAppShare && (
- closePrintOption(false)}
- />
- )}
- {showSMSShare && isMobile && (
- closePrintOption(false)}
- />
- )}
-
- )}
- {
- dispatch(changeSalesPaymentoption(false));
- }}
- footer={false}
- children={
-
- }
- />
- {
- setOtherServicesModal(false);
- }}
- // handleSubmit={Handlevehiclenumbers}
- footer={false}
- children={
-
- {OrderCardDetail.map((item, i) => {
- const isGroup = item.ServiceType === 'G';
- const groupKey = item.id; // 🔁 using `id` for groups now
- const uniqueKey = `${item.ServiceId}__${item.__index}`;
-
- // For G-type: render input only once for the group
- if (
- isGroup &&
- i !== OrderCardDetail.findIndex((o) => o.id === groupKey)
- ) {
- return null;
- }
-
- const qty = isGroup
- ? OrderCardDetail.filter((o) => o.id === groupKey).reduce(
- (sum, o) => sum + (o.OrderQty || 1),
- 0
- )
- : item.OrderQty || 1;
-
- return (
-
-
{item.ServiceName}
-
- {Array.from({ length: qty }).map((_, index) => {
- const inputKey = isGroup
- ? item.id
- : `${item.ServiceId}__${item.__index}`;
- const value = vehicleInputs[inputKey]?.[index] || '';
- const error = errors[inputKey]?.[index] || '';
-
- return (
-
-
- handleInputChange(
- isGroup ? item.id : item.ServiceId,
- index,
- e.target.value,
- item.ServiceType,
- item
- )
- }
- onKeyPress={(e) => {
- if (!/[A-Za-z0-9]/.test(e.key)) {
- e.preventDefault();
- }
- }}
- style={{
- width: '100%',
- padding: 8,
- borderRadius: 4,
- border: error
- ? '1px solid red'
- : '1px solid #ccc',
- }}
- />
- {error && (
-
- {error}
-
- )}
-
- );
- })}
-
- );
- })}
-
-
- Submit
-
-
-
- }
- />
- setShowCancelConfirm(true)}
- footer={false}
- width={500}
- children={
- <>
-
- >
- }
- />
- {showCancelConfirm && (
- {
- setBusinessUPI(false);
- setShowCancelConfirm(false);
- ClearAllGlobalStateDatas();
- CustomerDisplay();
- }}
- onCancel={() => setShowCancelConfirm(false)}
- okText="Yes"
- cancelText="No"
- >
- Do you want to cancel the payment?
-
- )}
- {
- OtherServicesPrintDetails?.length > 0 && (
- // PrintOrderDetails?.[0]?.OrderDetails?.map((orderDetail, index) => (
-
-
-
- )
- // ))
- }
- {customerPreviesOrders && (
- setCustomerPreviesOrders(false)}
- footer={false}
- width={700}
- className={'ModalPaymentGatewayEmbedded'}
- children={
- <>
- setCustomerPreviesOrders(false)}
- />
- >
- }
- />
- )}
- {
- setOtherServicesModal(false);
- }}
- handleSubmit={Handlevehiclenumbers}
- footer={true}
- children={
-
- {OrderCardDetail.map((item, i) => {
- const isGroup = item.ServiceType === 'G';
- const groupKey = item.id; // 🔁 using `id` for groups now
- const uniqueKey = `${item.ServiceId}__${item.__index}`;
-
- // For G-type: render input only once for the group
- if (
- isGroup &&
- i !== OrderCardDetail.findIndex((o) => o.id === groupKey)
- ) {
- return null;
- }
-
- const qty = isGroup
- ? OrderCardDetail.filter((o) => o.id === groupKey).reduce(
- (sum, o) => sum + (o.OrderQty || 1),
- 0
- )
- : item.OrderQty || 1;
-
- return (
-
-
{item.ServiceName}
-
- {Array.from({ length: qty }).map((_, index) => {
- const inputKey = isGroup
- ? item.id
- : `${item.ServiceId}__${item.__index}`;
- const value = vehicleInputs[inputKey]?.[index] || '';
- const error = errors[inputKey]?.[index] || '';
-
- return (
-
-
- handleInputChange(
- isGroup ? item.id : item.ServiceId,
- index,
- e.target.value,
- item.ServiceType,
- item
- )
- }
- style={{
- width: '100%',
- padding: 8,
- borderRadius: 4,
- border: error
- ? '1px solid red'
- : '1px solid #ccc',
- }}
- />
- {error && (
-
- {error}
-
- )}
-
- );
- })}
-
- );
- })}
-
- }
- />
-
- >
-
- );
-};
-
-export default BST6Payment;
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBilling7Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBilling7Payment.jsx
deleted file mode 100644
index 732b8e9..0000000
--- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBilling7Payment.jsx
+++ /dev/null
@@ -1,4907 +0,0 @@
-import React, { useEffect, useState, useRef } from 'react';
-import { shallowEqual, useDispatch, useSelector } from 'react-redux';
-import { useNavigate } from 'react-router-dom';
-import moment from 'moment';
-import { Badge, Popover, Modal, Tooltip } from 'antd';
-import { BiRightArrowAlt } from 'react-icons/bi';
-import { AiOutlineClose } from 'react-icons/ai';
-import BSSummery from '../BSBillingTableSummery/BSSummery.jsx';
-import BSBillingTable7 from './BSBillingTable7';
-import { UpCircleOutlined } from '@ant-design/icons';
-import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4.scss';
-import {
- GlobalSelectedFont,
- getTemplateData,
- SelectedPrintTemplate,
- StoredSessionData,
- GlobalprintDatas,
- GlobalPrinterMappingDtls,
- getPrinterMappingDetails,
- // getPrintSelectionComponentData,
-} from '../../../../../Features/ThemeChange/ThemeChange.js';
-import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js';
-import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities.jsx';
-import {
- ChangeNavHoldData,
- GlobalBookingType,
- GlobalCustId,
- GlobalNavHoldData,
- GlobalOrderCardDetails,
- GlobalReorderHoldDetails,
- GlobalSelectedTableDetails,
- PostBookingData,
- PutBookingData,
- changeBookingType,
- changeOrderCardDetails,
- changeReorderHoldDetails,
- getConfigType,
- getUnpaidData,
- getSelectedFavItems,
- GlobalProductSubCategorie,
- getCardDataWithoutSub,
- getCardDataWithoutSubmodule,
- GlobalProductCategorie,
- changeSelectedCustId,
- GlobalSelCustId,
- getLayoutproductCard,
- changeSelectedOption,
- GlobalSelOption,
- changeCustomerID,
- changeUnpaidData,
- ChangeSelectedCustDisable,
- GlobalSelectedCustDisable,
- SendPaymentLink,
- getSalesDetailData,
- changeSummeryTotalAmount,
- changeUpiIDprint,
- changeSummeryTotalItems,
- changeSummeryTotalWithoutTaxAmount,
- changeSummeryTotalTaxAmount,
- changeSummeryQty,
- GlobalEstimateBooking,
- GlobalSelProdWiseEst,
- changeSelProdWiseEst,
- GlobalUpiIDprint,
- changeUpiIDName,
- GlobalUpiIDName,
- changeUpiIDoptionId,
- GlobalUpiIDoptionId,
- GlobalBookingTypeBoth,
- changeSelectTable,
- changeSelectChair,
- changeSelectedTableDetails,
- changeReorderProductDetails,
- GlobalCommonPaymentOptions,
- PostPaymentdevice,
- GetPaymentdeviceResponse,
- PutBookingPaymentStatusChange,
- changePaymentloader,
- GlobalPayementloader,
- PaymentGatewayGetdetail,
- changePaymentTransactionNumber,
- Globalunpaidflow,
- changeunpaidflow,
- PutPendingPaymentList,
- ChangeInitialPaymentName,
- PreferenceData,
- changeOrderType,
- GlobalOrderType,
- GlobalFailedTotalAmt,
- putSplitpaymentStatus,
- GlobalUnpaidListData,
- GlobalScreenSize,
- GlobalOverAllDiscEstimate,
- GlobalOverAllDiscSales,
- ChangeOverAllDiscSales,
- ChangeOverAllDiscEstimate,
- GlobalBranchFinancialStatus,
- changeSummeryComboOfferAmount,
- ChangeComboCarddata,
- GlobaltipAmount,
- changeTipAmount,
- GlobalOtherSevices,
- GlobalOtherServiceTicketClaim,
- changeOtherServiceTicketClaim,
- GlobalRetailWSSalesType,
- GlobalDefaultBookingType,
- GlobalPaymentTrigger,
- GlobalCurrentOrderId,
- changeCurrentOrderId,
- GlobalCombocarddata,
- getCreditCustomer,
- GlobalSalesBillEdit,
- GlobalPreviousOrderPayment,
- GlobalPreviousOrderOfferDetails,
- GlobalpaymentOptionData,
- getPaymentOptions,
- putSalesBillEdit,
- changeBillEditingMode,
- changePreviousOrderPayment,
- changePreviousOrderOfferDetail,
- GlobalAllBookingType,
- changeSearchedData,
-} from '../../../../../Features/BookingScreen/BookingData/BookingData.js';
-import {
- globalExtraTotalAmount,
- ChangeTotalAmount,
-} from '../../../../../Features/ExteraCharges/ExtraCharges.js'; // Shifayath Date:27/12/2023
-import {
- encryptObject,
- extractLastNumberOrderId,
- printDiv,
-} from '../../../../../Services/Others.js';
-import {
- getAddCustomerDetails,
- getDefaultPaymentOptions,
- GlobalAddCustomerDetails,
- triggerCustomerRefresh,
- VerifiedPaymentDtl,
-} from '../../../../../Features/BookingScreen/Customer/addCustomer.js';
-import {
- changeholddata,
- gettinghold,
- globalholddata,
-} from '../../../../../Features/BookingScreen/HoldOption/HoldOption.js';
-import { Messages } from '../../../../../Components/Notifications/Messages.jsx';
-import PaymentPdfBooking from '../../../../paymentpdfPage/PaymentPdfBooking.jsx';
-import { DefaultModal } from '../../../../../Components/Modal/DefaultModal.jsx';
-import { Tables } from '../../../../../Components/Tables/Table.jsx';
-import paygate from '../../../../../Images/paygate.png';
-import defaultupi from '../../../../../Images/defaultupi.png';
-import paydevice from '../../../../../Images/paydevice.png';
-import BSCustomerSelect from '../../UtillComponents/BSSelectCustomer.jsx';
-import PozoHoldIcon from '../../UtillComponents/Pozo retail icons/PozoHoldIcon.jsx';
-import PozoDineInIcon from '../../UtillComponents/Pozo retail icons/PozoDineIn.jsx';
-import PozoUnpaidIcon from '../../UtillComponents/Pozo retail icons/PozoUnpaidIcon.jsx';
-import PozoBillIcon from '../../UtillComponents/Pozo retail icons/PozoBIllIcon.jsx';
-import PozoAddCustomerIcon from '../../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx';
-import QrinScreen from '../../BookingFunctionality/DynamicScreenQr.jsx';
-import { ArrowRightOutlined } from '@ant-design/icons';
-import Buttons from '../../../../../Components/Forms/Buttons';
-import WpIcon from '../../../../../Images/message.png';
-import BsBillingCreditCustomer from '../../BookingFunctionality/BSBillingCreditCustomer.jsx';
-import BSCreditCustomer from '../../UtillComponents/BSCreditCustomer.jsx';
-import PozoAdvanceIcon from '../../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx';
-import { isMobile } from 'react-device-detect';
-import MobilePrint from '../../BookingFunctionality/MobilePrint.jsx';
-import CountUp from 'react-countup';
-import { GlobalpreOrderOpen } from '../../../../../Features/BookingScreen/PreOrder/PreOrder.js';
-import SplitPayment from '../../BookingFunctionality/SplitPayment.jsx';
-import TokensinglePrint from '../../../../paymentpdfPage/TokenOnlyPrints/TokeninsinglePrint.jsx';
-import SingleTokenMobilePrint from '../../BookingFunctionality/SingleTokenMobilePrint.jsx';
-import IndividualTokenMobilePrint from '../../BookingFunctionality/IndividualTokenMobilePrint.jsx';
-import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
-import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js';
-import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx';
-import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx';
-import {
- Global_OrderOfferDetail,
- Global_OverallOfferAmount,
-} from '../../../../../Features/Offer/Offer.js';
-import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
-import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip';
-import { useAuth } from '../../../../../AuthContext.jsx';
-import { GlobalBookingStatus } from '../../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js';
-import {
- changeSalesPaymentoption,
- GlobalSalesPaymentoption,
-} from '../../../../../Features/Payment/Paymentoptions/Paymentoptions.js';
-import Paymentoption from '../../../../Payment/PaymentOptions/PaymentOptions.jsx';
-import { getPaymentOptionsData } from '../../../../../Features/BookingScreen/BookingData/KioskBookingData.js';
-import { getCombolist } from '../../../../../Features/ComboMaster/ComboMaster.js';
-import WhatsAppShare from '../../../../WhatsAppShare/whatsAppShare.jsx';
-import SMSShare from '../../../../WhatsAppShare/SmsShare.jsx';
-import { MdSms } from 'react-icons/md';
-import { FaWhatsapp, FaPrint, FaCartPlus } from 'react-icons/fa';
-import BSTipAmount from '../../UtillComponents/BSTipAmount.jsx';
-import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js';
-import { TfiClipboard } from 'react-icons/tfi';
-import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js';
-import OtherServicePrintStyle1 from '../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx';
-import BSOtherServiceClaim from '../../UtillComponents/BSOtherServiceClaim.jsx';
-import { MobilePdfPrint } from '../../BookingFunctionality/MobilePdfPrint.js';
-import { PublicQrCodepost } from '../../../../../Features/ConfigMasterPage/ConfigMasterPage.js';
-import {
- ChangeFullFreeProductList,
- changeFullOfferAppliedProducts,
- changeLoyaltyConsumedQuantities,
- GlobalFreeProdList,
- GlobalOfferAppliedProducts,
- GlobalOverAllOfferAmt,
-} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
-import OtherServiceMobilePrint from '../../BookingFunctionality/OtherServiceMobilePrint.jsx';
-import CardPopover from '../StandardTable/Utils/CardPopover.jsx';
-import UpiPopover from '../StandardTable/Utils/UpiPopOver.jsx';
-import pozologoimg from '../../../../../Images/pozologoimg.png';
-import PaymentGatewayEmbedded from '../../UtillComponents/PaymentGatewayEmbedded.jsx';
-import MobileMultiPdfPrintTrigger from '../../UtillComponents/MobileMultiPdfPrintTrigger.jsx';
-import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js';
-import CustomerOrders from '../../BookingFunctionality/CustomerOrders.jsx';
-const subDirectory = import.meta.env.ENV_BASE_URL;
-const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
-const RetailApiurl = import.meta.env.ENV_API_URL;
-
-const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
-
-const BSBilling7Payment = () => {
- const isF4Pressed = useRef(false);
- const applyOffer = useApplyOfferto_CardDetail();
- const { SadminuserAccess } = useAuth();
- let SAAccessCommonMaster = SadminuserAccess?.find(
- (e) => e?.MenuName === 'Sales'
- );
- const dispatch = useDispatch();
- const navigate = useNavigate();
- const salesBillEdit = useSelector(GlobalSalesBillEdit);
- const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
- const previousOrderOfferDetails = useSelector(
- GlobalPreviousOrderOfferDetails
- );
- const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
- const Discount = useSelector(GlobalOverAllOfferAmt);
- const screenwidth = useSelector(GlobalScreenSize);
- const defaultBookingType = useSelector(GlobalDefaultBookingType);
- const printerTemplateStyle = useSelector(SelectedPrintTemplate);
- const AllBookingType = useSelector(GlobalAllBookingType);
- const FontFamily = useSelector(GlobalSelectedFont);
- const OrderCardDetail = useSelector(GlobalOrderCardDetails);
- const GetCustId = useSelector(GlobalCustId);
- const SelCustId = useSelector(GlobalSelCustId);
- const GlobalUpiID = useSelector(GlobalUpiIDprint);
- const selOption = useSelector(GlobalSelOption);
- const SelectedTableDetails = useSelector(GlobalSelectedTableDetails);
- const GlobalAddCustomerDetails1 = useSelector(GlobalAddCustomerDetails);
- const Holddata = useSelector(globalholddata);
- const ReportholdData = useSelector(GlobalReorderHoldDetails);
- const BookingType = useSelector(GlobalBookingType);
- const BookingTypeBoth = useSelector(GlobalBookingTypeBoth);
- const globalTipAmount = useSelector(GlobaltipAmount);
- const OtherServiceTicketClaim = useSelector(GlobalOtherServiceTicketClaim);
- const RetailWSSalesType = useSelector(GlobalRetailWSSalesType);
- const [SelectedBookingType, setSelectedBookingType] = useState(null);
- const [PaymentOptions, setPaymentOptions] = useState([]);
- const [PaymentUpiOptions, setPaymentUpiOptions] = useState([]);
- const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
- const NavHoldData = useSelector(GlobalNavHoldData);
- const GlobalUpName = useSelector(GlobalUpiIDName);
- const GlobalUpiIDoptionIdd = useSelector(GlobalUpiIDoptionId);
- const prodCat = useSelector(GlobalProductCategorie);
- const ProdSubCat = useSelector(GlobalProductSubCategorie);
- const templateData = useSelector(getTemplateData);
- const appPreferences = useSelector(ApplicationPreferences);
- const Combodata = useSelector(GlobalCombocarddata, shallowEqual);
- const bookingTypePreference = appPreferences?.find(
- (preference) => preference?.PreferredCatName === 'Booking Type'
- )?.PreferenceCatDetails;
- const dinePreference = bookingTypePreference?.find(
- (type) =>
- type?.PreferredSubCatName?.toLowerCase() === 'dine in' &&
- type?.PreferredStatus === 'Y'
- );
- const tableOptions = templateData?.BookingBilling?.[1];
- const OfferCheckedInSetup = templateData?.BookingNavbar?.[1].some(
- (item) => item?.OptionName == 'Offer'
- );
- const SettingDataSelector = useSelector(PreferenceData);
- const preferenceOffer =
- SettingDataSelector?.[0]?.['SettingDtlDetails']?.find(
- (item) => item.SettingIdName === 'Offer'
- )?.SettingValue === 'Y';
- const allowDecimal = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'decimal' &&
- setting?.SettingValue === 'Y'
- );
- const Weightasquantity = SettingDataSelector?.[0]?.SettingDtlDetails?.some(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'weightasquantity' &&
- setting?.SettingValue === 'Y'
- );
- const Custombill = SettingDataSelector?.[0]?.SettingDtlDetails?.some(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'customisedbillnumber' &&
- setting?.SettingValue === 'Y'
- );
-
- const FreeProdList = useSelector(GlobalFreeProdList);
- const offerAppliedProducts = useSelector(GlobalOfferAppliedProducts);
- const GlobEstBooking = useSelector(GlobalEstimateBooking);
- const GlobProdwisedata = useSelector(GlobalSelProdWiseEst);
- const preOrder = useSelector(GlobalpreOrderOpen);
- const OrderType = useSelector(GlobalOrderType);
- const FailedTotalAmt = useSelector(GlobalFailedTotalAmt);
- const defaultPaymentTrigger = useSelector(GlobalPaymentTrigger);
- const [defaultPaymentMode, setDefaultPaymentMode] = useState([]);
- const [defaultEnabled, setDefaultEnabled] = useState(false);
- const [selectCustomerDisplay, setSelectCustomer] = useState(false);
- const [paymentModeDisplay, setPaymentModeDisplay] = useState(true);
- const [messageType, setMessageType] = useState(null);
- const [messageData, setMessageData] = useState(null);
- const SessionData = useSelector(StoredSessionData);
- const AppId = SessionData?.AppId;
- const CompId = SessionData?.CompId;
- const BranchId = SessionData?.BranchId;
- const UserId = SessionData?.UserId;
- const UserType = SessionData?.UserType;
- const [FirstPaymentclick, setFirstPaymentclick] = useState(false);
- const [open, setOpen] = useState(false);
- const [unpaidopen, setUnpaidOpen] = useState(false);
- const unpaidFlow = useSelector(Globalunpaidflow);
- const [open2, setOpen2] = useState(false);
- const [paybtns, setpaybtns] = useState([]);
- const [paybtnselected, setPaybtnselected] = useState();
- const [Paybtnnameselected, setPaybtnnameselected] = useState();
- const [credit, setCredit] = useState(false);
- const [overAllBal, setOverAllBal] = useState(0);
- const [SelectedCardOption, setSelectedCardOption] = useState(null);
- const [SelectedUPIPayOption, setSelectedUPIPayOption] = useState('Default');
- const [SelectedUpiOption, setSelectedUpiOption] = useState();
- const [hold, setHold] = useState(false);
- const [refundPayBtns, setRefundPayBtns] = useState([]);
- const [refundPaySelected, setRefundPaySelected] = useState();
- const [refundPaySelectedName, setRefundPaySelectedName] = useState(null);
- const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0);
- const [previousNetAmount, setPreviousNetAmount] = useState(0);
- const [addcustomer, setAddCustomer] = useState(false);
- const [PrintOrderDetails, setPrintOrderDetails] = useState([]);
- const [customerPreviesOrders, setCustomerPreviesOrders] = useState(false);
- const OverAllSales = useSelector(GlobalOverAllDiscSales);
- const OverAllEstimate = useSelector(GlobalOverAllDiscEstimate);
- //Total calculation
- const TotalItems = OrderCardDetail?.length;
- // const [TotalWithoutTaxAmount, setTotalWithoutTaxAmount] = useState("");
- // const [TotalTaxAmount, setTotalTaxAmount] = useState("");
- const [formattedDate, setFormattedDate] = useState('');
- const [UpiOptionOpen, setUpiOptionOpen] = useState(false);
- const Qty = OrderCardDetail?.reduce((acc, item) => {
- const isWeightScale = item?.ScaleType === 'weight';
-
- if (isWeightScale) {
- return (
- acc + (Weightasquantity ? Math.round(Number(item?.OrderQty || 0)) : 1)
- );
- }
-
- return acc + Math.round(Number(item?.OrderQty || 0));
- }, 0);
- console.log(
- salesBillEdit,
- currentOrderNetAmount,
- previousNetAmount,
- 'previousNetAmount'
- );
- const [UpiOption, setUpiOption] = useState('');
- const [BusinessPayOption, setBusinessPayoption] = useState([]);
- const [paymentSucess, setPaymentSuccess] = useState(false);
- const [businessUPI, setBusinessUPI] = useState(false);
- const [businessUPIOrderId, setBusinessUPIOrderId] = useState(null);
- const [businessUPILink, setBusinessUPILink] = useState(null);
- const [CardOptionOpen, setCardOptionOpen] = useState(false);
- const [UpiId, setUpiId] = useState();
- const [qrCode, setQrCode] = useState(false);
- const tabledata = useSelector(GlobalUnpaidListData);
- const GlobalSalesPaymentoptions = useSelector(GlobalSalesPaymentoption);
-
- const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
- (i) => i.SettingIdName === 'PrintUom'
- )?.[0];
- const Estimation = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (item) => item.SettingIdName == 'Estimation'
- );
- const [UpinotSelected, setUpinotSelected] = useState(false);
- const [CardoptionnotSelected, setCardoptionnotSelected] = useState(false);
- const Custdisable = useSelector(GlobalSelectedCustDisable);
- const [brachName, setbrachName] = useState('');
- const [UpiOpen, setUpiOpen] = useState(false);
- const [CreditCustomer, setCreditCustomer] = useState(false);
- const [creditCustomerOpen, setcreditCustomerOpen] = useState(false);
- const [ConfigDataList, setConfigDataList] = useState([]);
- const [OrderStatus, setOrderStatus] = useState(true);
- const [PaymentgatewayCard, setPaymentgatewayCard] = useState([]);
- const [PaymentDeviceCard, setPaymentDeviceCard] = useState([]);
- const [PaymentgatewayUPI, setPaymentgatewayUPI] = useState([]);
- const [PaymentDeviceUPI, setPaymentDeviceUPI] = useState([]);
- const [UpiPayOption, setUpiPayOption] = useState([]);
- const [CardPayOption, setCardPayOption] = useState([]);
- const [Splitpayment, setSplitpayment] = useState(false);
- const [urlData, setUrlData] = useState();
- const GlobaluseOptions = useSelector(GlobalCommonPaymentOptions);
- const [useOptions, setuseOptions] = useState([]);
- const paymentloader = useSelector(GlobalPayementloader);
-
- const PaymentOptionsModeName =
- PaymentOptions?.find((e) => e.ModeDefault?.toUpperCase() === 'Y')
- ?.ModeName || PaymentOptions?.[0]?.ModeName;
- const PaymentOptionsModeId =
- PaymentOptions?.find((e) => e.ModeDefault?.toUpperCase() === 'Y')?.ModeId ||
- PaymentOptions?.[0]?.ModeId;
-
- const CheckOrderType = OrderCardDetail?.filter(
- (a) => a?.BookingTypeName !== BookingType
- );
- const TokenOnly = SettingDataSelector?.[0]?.SettingDtlDetails?.filter(
- (i) => i.SettingIdName === 'TokenOnly'
- )?.[0];
- const IndividualToken = SettingDataSelector?.[0]?.SettingDtlDetails?.filter(
- (i) => i.SettingIdName === 'AllProductindividualToken'
- )?.[0];
- const ParkingDisplay = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'parking' &&
- setting?.SettingValue === 'Y'
- );
- const MobileA4Print = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'mobilea4' &&
- setting?.SettingValue === 'Y'
- );
- const UpiQRPreference = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'upiqr' &&
- setting?.SettingValue === 'Y'
- );
- const preferenceshortcutkey =
- SettingDataSelector?.[0]?.SettingDtlDetails?.some(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'shortcutkeys' &&
- setting?.SettingValue === 'Y'
- );
-
- const [UnpaidConfirmation, setUnpaidConfirmation] = useState(false);
- const [unpaidselectedindex, setunpaidselectedindex] = useState();
- const [failedOrderData, setFailedOrderData] = useState();
- const [responsiveBill, setResponsiveBill] = useState(true);
- const [empData, setEmpData] = useState();
- const [addnewAccess, setaddnewAccess] = useState(true);
- const [blink, setBlink] = useState(false);
- const BookingStatus = useSelector(GlobalBookingStatus);
- const CheckBookingStatus =
- BookingStatus?.find((item) => item.ScreenType === 'Booking')
- ?.ScreenStatus ?? 'Open';
- const OverallOfferAmount = useSelector(Global_OverallOfferAmount);
-
- const [TotalAmount, setTotalAmount] = useState(0);
- const [showWhatsAppShare, setShowWhatsAppShare] = useState(false);
- const [showSMSShare, setSMSShare] = useState(false);
- // Usage
- const allowedNames = ['whatsapp', 'Print', 'SMS'];
- const [MobileNoWhatsApp, setMobileNoWhatsApp] = useState();
- const printDatas = useSelector(GlobalprintDatas);
- const PrinterDetails = useSelector(GlobalPrinterMappingDtls);
- const OtherServicesglobal = useSelector(GlobalOtherSevices);
- const [OtherServicesModal, setOtherServicesModal] = useState(false);
- const [vehicleInputs, setVehicleInputs] = useState({});
- const [errors, setErrors] = useState({});
- const [OtherServicesPrintDetails, setOtherServicesPrintDetails] = useState(
- []
- );
- const [showCancelConfirm, setShowCancelConfirm] = useState(false);
- // for customised invoice number
- const { invoiceDate, clearInvoiceDate } = useDateStore();
- const CurrentOrderId = useSelector(GlobalCurrentOrderId);
- const holdCheckedSalesSetup = tableOptions?.some(
- (item) => item?.OptionName === 'Hold'
- );
-
- const filteredSettingNames = SettingDataSelector?.[0]?.['SettingDtlDetails']
- ?.filter(
- (item) =>
- allowedNames.includes(item?.SettingIdName) && item?.SettingValue === 'Y'
- )
- ?.map((item) => item?.SettingIdName);
-
- useEffect(() => {
- if (
- OrderCardDetail?.length === 1 &&
- OrderCardDetail?.[0]?.OrderQty === 1 &&
- !SelCustId
- ) {
- console.log(OrderCardDetail, 'OrderCardDetail');
- closePrintOption();
- setPrintOrderDetails([]);
- }
- }, [OrderCardDetail]);
- useEffect(() => {
- if (selOption) {
- closePrintOption();
- setMobileNoWhatsApp(selOption);
- }
- }, [selOption]);
-
- useEffect(() => {
- if (salesBillEdit) {
- dispatch(getPaymentOptions()).unwrap();
- }
- }, [salesBillEdit]);
-
- useEffect(() => {
- if (salesBillEdit) {
- if (SelCustId) {
- setRefundPayBtns(AllPaymentOptions);
- setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId);
- setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName);
- } else {
- const withoutCustomer = AllPaymentOptions?.filter?.(
- (item) => item?.ConfigName?.toLowerCase() !== 'credit'
- );
- setRefundPaySelected(withoutCustomer?.[0]?.ConfigId);
- setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName);
- setRefundPayBtns(withoutCustomer);
- }
- }
- }, [AllPaymentOptions, SelCustId, salesBillEdit]);
-
- // Usage
- useEffect(() => {
- const fetchCreditCustomer = async () => {
- const selectedMode = paybtns?.find(
- (pay) => paybtnselected === pay?.ModeId
- )?.ModeName;
-
- if (
- selectedMode?.toLowerCase() === 'credit' &&
- (!UpinotSelected || !CardoptionnotSelected)
- ) {
- setCredit(true);
- try {
- const res = await dispatch(
- getCreditCustomer({
- CompId,
- AppId,
- BranchId,
- CustId: selOption?.CustId,
- })
- ).unwrap();
-
- if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) {
- setOverAllBal(res.data.data[0]?.OverAllBal ?? 0);
- } else {
- setOverAllBal(0);
- }
- } catch (error) {
- console.error('Credit fetch failed', error);
- setOverAllBal(0);
- }
- } else {
- setCredit(false);
- setOverAllBal(0);
- }
- };
-
- fetchCreditCustomer();
- }, [paybtnselected, selOption, paybtns]);
-
- useEffect(() => {
- if (!preOrder) {
- const totalSum = OrderCardDetail?.reduce(
- // (acc, card) => acc + parseFloat(card.OrderRate * card.OrderQty || 0),
- (acc, card) => acc + parseFloat(card.TotalAmt || 0),
- 0
- );
-
- const extra = GlobalExtraCharge?.reduce(
- (acc, obj) => acc + (obj.TotalAmt || 0),
- 0
- );
-
- let withComboSum = 0;
- const withComboOffer_CardDetail = OrderCardDetail?.filter(
- (item) => item.Type === 'C'
- );
- if (withComboOffer_CardDetail?.length > 0) {
- withComboSum = formatAmount(
- withComboOffer_CardDetail.reduce(
- (acc, card) =>
- acc +
- parseFloat(card.OrderRate * card.OrderQty - card.TotalAmt || 0),
- 0
- )
- );
- }
-
- let Total =
- extra === undefined
- ? totalSum - OverallOfferAmount - withComboSum
- : totalSum + extra - OverallOfferAmount - withComboSum;
-
- // Subtract OtherServiceTicketClaim?.totalTicketamount if present and > 0
- if (OtherServiceTicketClaim?.TotalAmt > 0) {
- if (Total - OtherServiceTicketClaim.TotalAmt > 0) {
- Total -= OtherServiceTicketClaim.TotalAmt;
- } else {
- dispatch(
- changeOtherServiceTicketClaim({
- TicketId: null,
- TotalAmt: 0,
- ParkingClaimed: false,
- ServiceCategory: null,
- })
- );
- }
- } else if (OtherServiceTicketClaim?.OtherType == 'Remove') {
- dispatch(
- changeOtherServiceTicketClaim({
- TicketId: null,
- TotalAmt: 0,
- ParkingClaimed: false,
- ServiceCategory: null,
- })
- );
- }
-
- const filteredPayments =
- previousOrderPayment?.filter(
- (p) =>
- p?.LastOrderTran === 'Y' &&
- p?.AfterAdjustment != null &&
- p?.AfterAdjustment !== '' &&
- p?.AfterAdjustment
- ) || [];
-
- const paymentsToUse =
- filteredPayments.length > 0
- ? filteredPayments
- : previousOrderPayment || [];
-
- const totalPreviouspayment = paymentsToUse?.reduce(
- (acc, payment) =>
- acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
- 0
- );
-
- const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce(
- (acc, offer) => acc + parseFloat(offer.OfferAmount || 0),
- 0
- );
-
- const previousNetAmount = totalPreviouspayment || 0;
-
- let withdiscTotal =
- Total -
- ((OverAllSales || 0) +
- (OverAllEstimate || 0) +
- (Discount > 0 ? Discount : 0));
-
- const currentOrderNetAmount = formatAmount(
- withdiscTotal >= 0
- ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2)
- : (Number(Total) + Number(globalTipAmount)).toFixed(2)
- );
- console.log(
- salesBillEdit
- ? currentOrderNetAmount > previousNetAmount
- ? currentOrderNetAmount - previousNetAmount
- : 0
- : currentOrderNetAmount,
- 'totalPreviouspayment'
- );
-
- setTotalAmount(
- salesBillEdit
- ? currentOrderNetAmount > previousNetAmount
- ? currentOrderNetAmount - previousNetAmount
- : 0
- : currentOrderNetAmount
- );
- setCurrentOrderNetAmount(currentOrderNetAmount);
- setPreviousNetAmount(previousNetAmount);
- dispatch(
- changeSummeryTotalAmount(
- salesBillEdit
- ? currentOrderNetAmount > previousNetAmount
- ? currentOrderNetAmount - previousNetAmount
- : 0
- : currentOrderNetAmount
- )
- );
-
- dispatch(changeSummeryComboOfferAmount(withComboSum));
-
- // if (withdiscTotal <= 0) {
- // dispatch(ChangeOverAllDiscSales(0));
- // dispatch(ChangeOverAllDiscEstimate(0));
- // }
- } else {
- setTotalAmount(0);
- dispatch(changeSummeryTotalAmount(0));
- dispatch(changeSummeryComboOfferAmount(0));
- }
- }, [
- OrderCardDetail,
- GlobalExtraCharge,
- OverAllSales,
- OverAllEstimate,
- globalTipAmount,
- OtherServiceTicketClaim,
- Discount,
- ]);
- useEffect(() => {
- const fetchPrinterMapping = async () => {
- try {
- if (UserType !== 'Super Admin' && isMobile && MobileA4Print) {
- const data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- UserId: UserId,
- };
- // && isMobile && MobileA4Print
- const response = await dispatch(
- getPrinterMappingDetails(data)
- ).unwrap();
- if (response?.data?.statusCode === 0) {
- handlePrintMappingClick();
- }
- console.log(response, 'printer mapping response');
- }
- } catch (error) {
- console.error('Error fetching printer mapping:', error);
- }
- };
-
- fetchPrinterMapping();
- }, []);
- const handlePrintMappingClick = () => {
- // setReprint1(true)
- window.dispatchEvent(new Event('CLICK PRINTER MAPPING'));
- };
- useEffect(() => {
- if (CompId && BranchId && AppId) {
- if (holdCheckedSalesSetup) {
- getHolddata();
- }
- // getUnpaiddatas();
- getCustomerData();
- }
- }, [CompId, BranchId, AppId]);
-
- useEffect(() => {
- gettodaydate();
- getBookingTypeId();
- getPaymentOptionFeature();
- // if (UserType === "Employee") {
- // fetchApi()
- // }
- }, []);
- useEffect(() => {
- const getPrintData = async () => {
- try {
- const data = {
- AppId,
- CompId,
- BranchId,
- OrderId: businessUPIOrderId,
- };
-
- const res = await dispatch(VerifiedPaymentDtl(data)).unwrap();
-
- if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) {
- const orderData = [{ OrderDetails: res.data.data }];
-
- // Reset states first
- setBusinessUPIOrderId(null);
- setBusinessUPI(false);
- setPaymentSuccess(false);
-
- // Then set new data and trigger side effects
- setPrintOrderDetails(orderData);
- CustomerDisplay();
- ClearAllGlobalStateDatas();
- filteredSettingNames?.includes('whatsapp') &&
- MobileNoWhatsApp?.value &&
- handleURL(orderData);
- }
- } catch (error) {
- console.error('Failed to fetch print data:', error);
- // Reset states even on error
- setBusinessUPI(false);
- setPaymentSuccess(false);
- }
- };
-
- if (paymentSucess && businessUPIOrderId) {
- const timer = setTimeout(() => {
- getPrintData();
- }, 3000);
-
- return () => clearTimeout(timer);
- }
- }, [paymentSucess, businessUPIOrderId, AppId, CompId, BranchId, dispatch]);
- 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]);
- // useEffect(() => {
- // const handleKeyPress = (event) => {
- // if (event.shiftKey && event.code === 'KeyM') {
- // if (
- // document.activeElement.tagName !== 'INPUT' &&
- // document.activeElement.tagName !== 'TEXTAREA'
- // ) {
- // event.preventDefault();
- // setBlink(true);
- // }
- // }
- // };
- // const handleClickOutside = (event) => {
- // setBlink(false);
- // };
- // window.addEventListener('keydown', handleKeyPress);
- // window.addEventListener('mousedown', handleClickOutside);
- // return () => {
- // window.removeEventListener('keydown', handleKeyPress);
- // window.addEventListener('mousedown', handleClickOutside);
- // };
- // }, []);
- 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'
- );
- setEmpData(datas?.[0]);
- };
- const formatAmount = (value) => {
- return allowDecimal
- ? parseFloat(value || 0).toFixed(2)
- : parseInt(value || 0);
- };
- const getCustomerData = async () => {
- await dispatch(
- getAddCustomerDetails({
- CompId: CompId,
- AppId: AppId,
- branchId: BranchId,
- })
- );
- };
-
- useEffect(() => {
- if (OrderCardDetail?.length <= 0) {
- dispatch(changeCustomerID(null));
- dispatch(changeSelectedCustId());
- dispatch(changeSelectedOption(null));
- dispatch(ChangeSelectedCustDisable(false));
- }
- }, [OrderCardDetail]);
- //mohan stoped data
- useEffect(() => {
- if (
- (BookingType === 'Dine In' ||
- BookingTypeBoth ||
- CheckOrderType?.length > 0) &&
- !unpaidFlow &&
- SelectedTableDetails?.length !== 0
- ) {
- setOrderStatus(true);
- } else {
- setOrderStatus(false);
- }
- }, [BookingTypeBoth, BookingType, unpaidFlow]);
- //mohan end
-
- const Print = async () => {
- const style = await PrintStyleFunction(
- printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle,
- 'Sales'
- );
- const stylesMap = {
- 'Style 1': 'PrintStyle1',
- 'Style 2': 'PrintStyle2',
- 'Style 3': 'PrintStyle3',
- 'Style 4': 'PrintStyle4',
- 'Style 5': 'PrintStyle5',
- 'Style 6': 'PrintStyle6',
- 'Style 7': 'PrintStyle7',
- 'Style 8': 'PrintStyle8',
- 'Style 9': 'PrintStyle9',
- 'Style 10': 'PrintStyle10',
- 'Style 11': 'PrintStyle11',
- 'Style 12': 'PrintStyle12',
- 'Style 13': 'RePrint',
- A4: 'PrintStyleA4',
- A5: 'PrintStyleA5',
- A4Standard: 'A4Standard',
- TaxInvoice: 'TaxInvoice',
- };
-
- const selectedStyle =
- stylesMap[
- printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle
- ];
-
- if (selectedStyle) {
- await Promise.all(
- PrintOrderDetails?.[0]?.OrderDetails?.map(
- async (orderDetail, index) => {
- await printDiv(`${selectedStyle}-${index}`, style); // Use unique IDs for each print
- if (orderDetail?.BookingTypeName !== 'Dine In') {
- const groupedTokens = orderDetail?.productDetails
- ?.filter((data) => data?.EditTokenAvailable !== 'N')
- ?.reduce((acc, item, idx) => {
- if (item.TokenAvailable === 'Y') {
- if (!item.CounterName) {
- // If CounterName is null or empty
- acc[`individual-${idx}-${item.ProdId}`] = [item]; // Unique entry for each null/empty CounterName item
- } else {
- if (!acc[item.CounterName]) {
- acc[item.CounterName] = [];
- }
- acc[item.CounterName].push(item); // Group by CounterName
- }
- }
- return acc;
- }, {});
-
- // Iterate over grouped tokens and print them
- const tokensToPrint = Object.entries(groupedTokens).map(
- async ([counterName, items], idx) => {
- // Use the counterName (or unique identifier for individual items) as part of the tokenId
- const tokenId = `${idx}-${items?.[0]?.ProdId}-${counterName}`;
- await TokenPrint(tokenId, items); // Pass all grouped items to the print function
- }
- );
- if (tokensToPrint?.length > 0) {
- await Promise.all(tokensToPrint);
- }
- }
- }
- )
- );
-
- setPrintOrderDetails([]);
- closePrintOption();
- }
- };
-
- useEffect(() => {
- if (NavHoldData) {
- AddBookingDetails('Hold');
- }
- }, [NavHoldData]);
- useEffect(() => {
- if (SelCustId) {
- setpaybtns(PaymentOptions);
- } else {
- const withoutCustomer = PaymentOptions?.filter?.(
- (item) => item?.ModeName?.toLowerCase() !== 'credit'
- );
-
- setpaybtns(withoutCustomer);
- }
- }, [PaymentUpiOptions, PaymentOptions, SelCustId]);
- useEffect(() => {
- getPaymentOptionFeature();
- }, [GlobaluseOptions]);
-
- //dhana
- // Function to check if the button is active
- const isButtonActive = () => {
- const baseCondition =
- FirstPaymentclick === false &&
- OrderCardDetail?.length > 0 &&
- paybtnselected &&
- CheckBookingStatus !== 'Close';
- let accessCondition = true;
- if (UserType === 'Employee') {
- accessCondition = empData?.AddAccess === 'Y';
- } else if (UserType === 'Super Admin User') {
- accessCondition = SAAccessCommonMaster?.AddAccess === 'Y';
- }
- return baseCondition && accessCondition;
- };
-
- // Function to handle the button click
- const handleButtonClick = () => {
- if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) {
- UpiPayment();
- } else if (
- salesBillEdit &&
- currentOrderNetAmount < previousNetAmount &&
- !refundPaySelected
- ) {
- setMessageType('warning');
- setMessageData('Please Select Refund Payment Method');
- return;
- } else {
- OrderStatus
- ? AddBookingDetails('Dine-In', false)
- : AddBookingDetails(BookingType, true);
- }
- };
-
- const financialYearError = async () => {
- setMessageType('error');
- setMessageData('Financial Year-Based Sales Not Yet Started');
- };
-
- useEffect(() => {
- const handleKeyPress = (event) => {
- if (!preferenceshortcutkey) return;
- if (event.key === 'F4' && isButtonActive() && !isF4Pressed.current) {
- isF4Pressed.current = true;
- // BranchFinancialStatus==='N'? financialYearError():
- handleButtonClick();
- setTimeout(() => {
- isF4Pressed.current = false; // Reset after a short delay
- }, 1000);
- }
-
- if (
- event.altKey &&
- event.key === 'w' &&
- BookingType !== 'Dine In' &&
- tableOptions?.some((e) => e?.OptionName == 'Hold') &&
- paybtns?.length > 0
- ) {
- event.preventDefault();
- if (
- OrderCardDetail?.length > 0 &&
- CheckBookingStatus !== 'Close' &&
- !addnewAccess
- ) {
- AddBookingDetails('Hold', false);
- } else if (
- Holddata?.length > 0 &&
- OrderCardDetail?.length === 0 &&
- CheckBookingStatus !== 'Close' &&
- !addnewAccess
- ) {
- HandleholdModelOpen();
- }
- }
-
- // Alt+S for Split Payment
- if (event.altKey && event.key === 's' && paybtns?.length > 1) {
- event.preventDefault();
- if (
- OrderCardDetail?.length > 0 &&
- CheckBookingStatus !== 'Close' &&
- !addnewAccess &&
- !unpaidFlow &&
- !OrderStatus
- ) {
- SplitPaymentOpen();
- }
- }
- };
-
- window.addEventListener('keydown', handleKeyPress);
- return () => {
- window.removeEventListener('keydown', handleKeyPress);
- };
- }, [
- paybtns,
- tableOptions,
- FirstPaymentclick,
- OrderCardDetail,
- paybtnselected,
- OrderStatus,
- qrCode,
- SelectedUPIPayOption,
- TotalAmount,
- SelectedUpiOption,
- SelectedCardOption,
- BookingType,
- Holddata,
- CheckBookingStatus,
- addnewAccess,
- preferenceshortcutkey,
- paybtns,
- unpaidFlow,
- ]);
-
- //dhana
-
- const getPaymentOptionFeature = async () => {
- const FiltersalesPayment = GlobaluseOptions?.filter(
- (item) => item.FlowName?.toLowerCase() === 'sales'
- );
- setuseOptions(FiltersalesPayment);
- const filterpaycounter = FiltersalesPayment?.[0]?.OptionDetails?.filter(
- (item) => item?.OptionName?.toLowerCase() === 'pay at the counter'
- );
- const filterpaymentgateway = FiltersalesPayment?.[0]?.OptionDetails?.filter(
- (item) => item?.OptionName?.toLowerCase() === 'payment gateway'
- );
- const filterpaymentdevice = FiltersalesPayment?.[0]?.OptionDetails?.filter(
- (item) => item?.OptionName?.toLowerCase() === 'payment device'
- );
- const filterBusinessUpi = FiltersalesPayment?.[0]?.OptionDetails?.filter(
- (item) => item?.OptionName?.toLowerCase() === 'business upi'
- );
- const cardinpaymentgateway =
- filterpaymentgateway?.[0]?.ModeDetails?.filter((item) =>
- item?.ModeName?.toLowerCase()?.includes('card')
- ) || [];
- const cardinpaymentdevice =
- filterpaymentdevice?.[0]?.ModeDetails?.filter((item) =>
- item?.ModeName?.toLowerCase()?.includes('card')
- ) || [];
- const upiinpaymentgateway =
- filterpaymentgateway?.[0]?.ModeDetails?.filter((item) =>
- item?.ModeName?.toLowerCase()?.includes('upi')
- ) || [];
- const upiinpaymentdevice =
- filterpaymentdevice?.[0]?.ModeDetails?.filter((item) =>
- item?.ModeName?.toLowerCase()?.includes('upi')
- ) || [];
-
- setPaymentOptions(filterpaycounter?.[0]?.ModeDetails);
- setPaymentUpiOptions(
- FiltersalesPayment?.[0]?.PaymentDetails?.Payatthecounter
- );
- setPaymentDeviceCard(cardinpaymentdevice);
- setPaymentgatewayCard(cardinpaymentgateway);
- setPaymentgatewayUPI(upiinpaymentgateway);
- setPaymentDeviceUPI(upiinpaymentdevice);
- const cardoptions = [];
- if (cardinpaymentgateway?.length > 0) {
- cardoptions.push({
- label: 'Payment Gateway',
- value: 'PG',
- imgSrc: paygate,
- });
- }
- if (cardinpaymentdevice?.length > 0) {
- cardoptions.push({
- label: 'Payment Device',
- value: 'PD',
- imgSrc: paydevice,
- });
- }
- setCardPayOption(cardoptions);
- const options = [];
-
- if (FiltersalesPayment?.[0]?.PaymentDetails?.Payatthecounter?.length > 0) {
- options.push({
- label: 'Personal UPI',
- value: 'Default',
- imgSrc: defaultupi,
- });
- }
- if (filterBusinessUpi?.[0]?.ModeDetails?.length > 0) {
- options.push({
- label: 'Business UPI',
- value: 'Business',
- imgSrc: pozologoimg,
- PaymentOptionId: filterBusinessUpi?.[0]?.PaymentOptionId,
- PaymentFlowId: filterBusinessUpi?.[0]?.PaymentFlowId,
- OptionId: filterBusinessUpi?.[0]?.OptionId,
- });
- }
-
- if (upiinpaymentgateway?.length > 0) {
- options.push({
- label: 'Payment Gateway',
- value: 'PG',
- imgSrc: paygate,
- PaymentOptionId: upiinpaymentgateway?.[0]?.PaymentOptionId,
- PaymentModeId: upiinpaymentgateway?.[0]?.PaymentModeId,
- ModeId: upiinpaymentgateway?.[0]?.ModeId,
- });
- }
-
- if (upiinpaymentdevice?.length > 0) {
- options.push({ label: 'Payment Device', value: 'PD', imgSrc: paydevice });
- }
- setUpiPayOption(options);
- setBusinessPayoption(filterBusinessUpi?.[0]?.ModeDetails || []);
- // }
- };
-
- const TokenPrint = async (index) => {
- try {
- console.log(`Starting token print for index ${index}`);
-
- const stylePrint = ``;
- if (TokenOnly?.SettingValue === 'Y') {
- if (IndividualToken?.SettingValue === 'Y') {
- await printDiv(`TokenOnlySingle${index}`, stylePrint);
- } else {
- await printDiv(`TokenOnlyMultiple${index}`, stylePrint);
- }
- } else {
- await printDiv(`TakeawayToken${index}`, stylePrint);
- }
- } catch (error) {
- console.error(`Error printing token for index ${index}:`, error);
- }
- };
- // useEffect(() => {
- // if (
- // PrintOrderDetails?.length > 0 &&
- // (!filteredSettingNames ||
- // filteredSettingNames?.includes('Print') ||
- // filteredSettingNames?.length === 0) &&
- // (
- // (!filteredSettingNames?.includes('whatsapp') &&
- // (!isMobile || !filteredSettingNames?.includes('SMS'))) ||
- // (
- // (filteredSettingNames?.includes('whatsapp') ||
- // (isMobile && filteredSettingNames?.includes('SMS'))) &&
- // (!MobileNoWhatsApp || Object.keys(MobileNoWhatsApp).length === 0)
- // )
- // )
- // ) {
-
- // handlePrintOrToken();
- // }
- // }, [PrintOrderDetails]);
-
- useEffect(() => {
- if (!PrintOrderDetails?.length) return;
-
- const selectedOptions = filteredSettingNames || [];
- const count = selectedOptions.length;
-
- if (count === 0) {
- handlePrintOrToken();
- return;
- }
- if (count === 1) {
- const option = selectedOptions[0];
-
- switch (option) {
- case 'whatsapp':
- if (!selOption && MobileNoWhatsApp?.value) {
- handleWhatsAppClick();
- } else {
- handlePrintOrToken();
- }
- return;
-
- case 'SMS':
- if (isMobile) handleSMSClick();
- else handlePrintOrToken();
- return;
-
- case 'Print':
- handlePrintOrToken();
- return;
-
- // case "Email":
- // handleEmailClick();
- // return;
-
- default:
- return;
- }
- }
- return;
- }, [PrintOrderDetails]);
-
- const closePrintOption = () => {
- setShowWhatsAppShare(false);
- setSMSShare(false);
- setPrintOrderDetails([]);
- setMobileNoWhatsApp();
- };
-
- const handleWhatsAppClick = () => {
- setShowWhatsAppShare(true);
- };
-
- const handleSMSClick = () => {
- setSMSShare(true);
- };
-
- const handlePrintOrToken = async () => {
- const dinein =
- PrintOrderDetails?.[0]?.OrderDetails?.[0]?.productDetails?.some(
- (product) => product.BookingTypeName === 'Dine In'
- );
- const Tokenthere =
- PrintOrderDetails?.[0]?.OrderDetails?.[0]?.productDetails?.some(
- (product) => product.TokenAvailable === 'Y'
- );
- const PrintLogo = SettingDataSelector?.[0]?.SettingDtlDetails?.filter(
- (i) => i.SettingIdName === 'PrintLogo'
- )?.[0];
- const PrintGreeting = SettingDataSelector?.[0]?.SettingDtlDetails?.filter(
- (i) => i.SettingIdName === 'PrintGreetings'
- )?.[0];
- const preferenceDetails = SettingDataSelector?.[0]?.SettingDtlDetails;
- if (isMobile) {
- if (MobileA4Print) {
- await MobileMultiPdfPrintTrigger({
- preferenceDetails,
- printerTemplateStyle,
- printDatas,
- PrinterDetails,
- PrintOrderDetails,
- SessionData,
- bookingTypePreference,
- });
- } else {
- if (Tokenthere && TokenOnly?.SettingValue === 'Y' && !dinein) {
- if (IndividualToken?.SettingValue === 'Y' && !dinein) {
- IndividualTokenMobilePrint(PrintOrderDetails, UpiId, 'Booking');
- closePrintOption();
- } else {
- SingleTokenMobilePrint(PrintOrderDetails, UpiId, 'Booking');
- closePrintOption();
- }
- } else {
- MobilePrint(
- appPreferences,
- PrintOrderDetails,
- UpiId,
- 'Booking',
- SettingDataSelector
- );
- closePrintOption();
- }
- }
- } else {
- if (Tokenthere && TokenOnly?.SettingValue === 'Y' && !dinein) {
- AllProductTokenFunction();
- } else {
- Print();
- }
- }
- };
- const AllProductTokenFunction = async () => {
- if (IndividualToken?.SettingValue === 'Y') {
- await Promise.all(
- PrintOrderDetails?.[0]?.OrderDetails?.map(
- async (orderDetail, index) => {
- const groupedTokens = orderDetail?.productDetails?.reduce(
- (acc, item, idx) => {
- if (item.TokenAvailable === 'Y') {
- if (!item.CounterName) {
- // If CounterName is null or empty
- acc[`single-${idx}-${item.ProdId}`] = [item]; // Unique entry for each null/empty CounterName item
- } else {
- if (!acc[item.CounterName]) {
- acc[item.CounterName] = [];
- }
- acc[item.CounterName].push(item); // Group by CounterName
- }
- }
- return acc;
- },
- {}
- );
-
- // Iterate over grouped tokens and print them
- const tokensToPrint = Object.entries(groupedTokens).map(
- async ([counterName, items], idx) => {
- // Use the counterName (or unique identifier for individual items) as part of the tokenId
- const tokenId = `${idx}-${items?.[0]?.ProdId}-${counterName}`;
- await TokenPrint(tokenId, items); // Pass all grouped items to the print function
- }
- );
- if (tokensToPrint?.length > 0) {
- await Promise.all(tokensToPrint);
- }
- setPrintOrderDetails([]);
- closePrintOption();
- }
- )
- );
- } else {
- await Promise.all(
- PrintOrderDetails?.[0]?.OrderDetails?.map(
- async (orderDetail, index) => {
- await TokenPrint(`${index}-${orderDetail?.OrderId}`);
- }
- )
- );
- setPrintOrderDetails([]);
- closePrintOption();
- }
- };
-
- useEffect(() => {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- ExtraCharges: GlobalExtraCharge,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- }, [GlobalExtraCharge]);
- useEffect(() => {
- // TotalItemsCalculation();
- TotalWithoutTaxRate();
- TotalTaxAmt();
- OrderCardDetail?.length == 0 ? dispatch(changeunpaidflow(false)) : '';
- }, [OrderCardDetail]);
-
- useEffect(() => {
- let data = selOption != null ? selOption : GetCustId;
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- customer: data,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- }, [selOption, GetCustId]);
- useEffect(() => {
- let data = GlobalUpiID;
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- upi: data,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- setUpiOption(GlobalUpName);
- setSelectedUpiOption(GlobalUpiIDoptionIdd);
- setUpiId(GlobalUpiID);
- }, [GlobalUpiID]);
- useEffect(() => {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- paymentMethod: Paybtnnameselected,
- Paymentgateway: false,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- dispatch(ChangeInitialPaymentName(Paybtnnameselected));
- }, [Paybtnnameselected]);
- const CustomerDisplayRemovedData = () => {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- userData: [],
- ExtraCharges: [],
- Paymentgateway: false,
- type: 'remove',
- keyValue: 'customer',
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- const updatedRemovedData = {
- type: 'remove',
- keyValue: 'OrderTotalAmount',
- };
- customerDisplayWindow.postMessage(updatedRemovedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- };
- const CustomerDisplay = (value) => {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (value == 'TakeAway') {
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- userData: [],
- ExtraCharges: [],
- Paymentgateway: false,
- upioption1: 'okk',
- type: 'remove',
- keyValue: 'customer',
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- const updatedRemovedData = {
- type: 'remove',
- keyValue: 'OrderTotalAmount',
- };
- customerDisplayWindow.postMessage(updatedRemovedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- } else {
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- type: 'remove',
- keyValue: 'customer',
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- }
- };
-
- useEffect(() => {
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- }, [PaymentOptions]);
- useEffect(() => {
- getBookingTypeId();
- }, [BookingType, BookingTypeBoth]);
-
- const getHolddata = async () => {
- const data = { CompId: CompId, BranchId: BranchId, AppId: AppId };
- let response = await dispatch(gettinghold(data)).unwrap();
- if (response?.data?.statusCode == 1) {
- // handleHold();
- await dispatch(changeholddata(response?.data?.data));
- } else {
- await dispatch(changeholddata([]));
- }
- };
- const getUnpaiddatas = async () => {
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- };
- await dispatch(getUnpaidData(data)).unwrap();
- };
-
- const getBookingTypeId = async () => {
- setConfigDataList(AllBookingType);
- let configdata = AllBookingType;
- let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType;
-
- let filterconfigdata = configdata?.find((a) => a?.ConfigName === checkName);
- setSelectedBookingType(filterconfigdata?.ConfigId);
- };
- const gettodaydate = () => {
- const currentDate = new Date();
- const day = String(currentDate.getDate()).padStart(2, '0');
- const month = String(currentDate.getMonth() + 1).padStart(2, '0'); // Month is 0-based, so we add 1.
- const year = currentDate.getFullYear();
-
- const tempformattedDate = `${year}-${month}-${day}`;
- setFormattedDate(tempformattedDate);
- };
- const TotalItemsCalculation = async () => {
- let tempTotalitems = OrderCardDetail.length;
- let OverAllQty = OrderCardDetail?.reduce(
- (prev, current) => prev + Number(current?.OrderQty || 0),
- 0
- );
- await dispatch(changeSummeryTotalItems(tempTotalitems));
- await dispatch(changeSummeryQty(OverAllQty));
- };
-
- const TotalWithoutTaxRate = async () => {
- const totalwithouttax = OrderCardDetail?.reduce((accumulator, card) => {
- return accumulator + parseFloat(card.WithoutTaxRate || 0);
- }, 0);
- await dispatch(
- changeSummeryTotalWithoutTaxAmount(totalwithouttax.toFixed(2))
- );
- };
- const TotalTaxAmt = async () => {
- const totaltax = OrderCardDetail?.reduce((accumulator, card) => {
- return accumulator + parseFloat(card.TaxAmt || 0);
- }, 0);
- await dispatch(changeSummeryTotalTaxAmount(totaltax.toFixed(2)));
- };
-
- const handleOpenChange = (newOpen) => {
- setOpen(newOpen);
- };
- const handleOpenChange2 = (newOpen) => {
- if (open2) {
- setOpen2(false);
- } else {
- setOpen2(true);
- }
- };
-
- const hide = () => {
- setOpen2(false);
- setOpen(false);
- };
-
- const handlePaymentMode = (id, name) => {
- if (name?.toLowerCase() !== 'credit') {
- setOverAllBal(0);
- setCredit(false);
- }
- if (paymentloader === false) {
- setPaybtnselected(id);
- setPaybtnnameselected(name);
- if (CardPayOption?.length === 1) {
- setSelectedCardOption(CardPayOption?.[0]?.value);
- }
- setUpiOptionOpen(false);
- setQrCode(false);
- setUpinotSelected(false);
- setCardoptionnotSelected(false);
- }
- };
-
- const handleRefundPaymentMode = (id, name) => {
- setRefundPaySelected(id);
- setRefundPaySelectedName(name);
- };
-
- const addUpiOption = async (id, name, UPIId) => {
- await dispatch(changeUpiIDprint(UPIId));
- await dispatch(changeUpiIDName(name));
- await dispatch(changeUpiIDoptionId(id));
- setSelectedUpiOption(id);
- setUpiOption(name);
- setUpiId(UPIId);
- setUpinotSelected(false);
- setCardoptionnotSelected(false);
- // setQrCode(true)
- };
- const AddCardOption = (data) => {
- setSelectedCardOption(data);
- setCardOptionOpen(false);
- setCardoptionnotSelected(false);
- };
- const AddUPIPaymentOption = async (data, mode = false) => {
- setSelectedUpiOption('');
- setUpiOption('');
- setUpiId('');
- await dispatch(changeUpiIDprint(null));
- await dispatch(changeUpiIDName(''));
- await dispatch(changeUpiIDoptionId(null));
- setSelectedUPIPayOption(data);
- setUpinotSelected(false);
- setCardoptionnotSelected(false);
- if (data !== 'Default' && data !== 'Business' && !mode) {
- setUpiOptionOpen(false);
- }
- };
- const handleUPIButtonClick = (id, name) => {
- if (paymentloader === false) {
- setPaybtnnameselected(name);
- setPaybtnselected(id);
- let brachName1 = PaymentUpiOptions?.[0]?.BrName;
- setbrachName(brachName1);
- if (UpiPayOption?.length === 1) {
- setSelectedUPIPayOption(UpiPayOption?.[0]?.value);
- if (UpiPayOption?.[0]?.value?.toLowerCase() === 'default') {
- if (PaymentUpiOptions?.length === 1) {
- addUpiOption(
- PaymentUpiOptions?.[0]?.Mode,
- PaymentUpiOptions?.[0]?.ModeName,
- PaymentUpiOptions?.[0]?.UPIId
- );
- }
- }
- }
-
- setQrCode(true);
- }
- };
- const EnableUpiOptions = () => {
- setUpiOptionOpen(!UpiOptionOpen);
- };
- const EnableCardOptions = () => {
- setCardOptionOpen(!CardOptionOpen);
- };
- const HandleholdModelOpen = () => {
- setHold(true);
- };
-
- const handleHoldCancel = () => {
- setHold(false);
- };
- const handleAddCustomer = () => {
- if (Custdisable === false) {
- setAddCustomer(true);
- }
- };
- const handleAddCustomerCancel = () => {
- setAddCustomer(false);
- };
-
- const hideDefault = () => {
- setUpiOptionOpen(false);
- };
- const handlePopoverVisibleChange = (visible) => {
- setUpiOptionOpen(visible);
- };
- const handlePopoverVisibleChangeCard = (visible) => {
- setCardOptionOpen(visible);
- };
-
- const ProductSummary = (salesData) => {
- // Create a map to store the aggregated values for each unique product
- const productMap = new Map();
-
- salesData.forEach((item) => {
- let offerMode = item?.OfferMode?.trim();
- offerMode = offerMode && offerMode !== '' ? offerMode : null;
-
- let OfferId = null;
- if (
- item?.OfferMessage &&
- Array.isArray(item.OfferMessage) &&
- item.OfferMessage.length > 0
- ) {
- OfferId = item.OfferMessage[0]?.OfferId || null;
- }
-
- const keyData = [
- item.ProdId || null,
- item.InwardDtlId || null,
- item.BookingType || null,
- item.SinglePc || null,
- item.OrderRate || null,
- offerMode,
- OfferId,
- ];
-
- const key = keyData.join('-');
-
- if (productMap.has(key)) {
- const existingItem = productMap.get(key);
- existingItem.OrderQty =
- (existingItem.OrderQty || 0) + (item.OrderQty || 0);
- existingItem.TotalAmt =
- (existingItem.TotalAmt || 0) + (item.TotalAmt || 0);
- existingItem.TaxAmt =
- (parseFloat(existingItem.TaxAmt) || 0) +
- (parseFloat(item.TaxAmt) || 0);
- } else {
- const newItem = {
- ...item,
- OfferMode: offerMode,
- OfferMessage:
- item?.OfferMessage && Array.isArray(item.OfferMessage)
- ? item.OfferMessage
- : null,
- };
- productMap.set(key, newItem);
- }
- });
-
- // Convert the map values back to an array
- const aggregatedProducts = Array.from(productMap.values());
-
- return aggregatedProducts;
- };
- const UpiPayment = () => {
- if (OrderStatus) {
- AddBookingDetails('Dine-In', false);
- } else {
- if (SelectedUpiOption && TotalAmount == 0) {
- Upimodel('Submit');
- } else if (SelectedUpiOption) {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- OrderTotalAmount: TotalAmount,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
-
- setUpiOpen(true);
- } else {
- setUpinotSelected(true);
- setMessageType('error');
- setMessageData('Please Select Upi Option');
- }
- }
- };
- const handleCreditCustomer = (type) => {
- setCreditCustomer(false);
- if (type == 'Submit') {
- Booking(BookingType, true);
- }
- if (type == 'Cancel') {
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- }
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedRemovedData = {
- type: 'remove',
- keyValue: 'OrderTotalAmount',
- };
- customerDisplayWindow.postMessage(updatedRemovedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- };
-
- const ClearAllGlobalStateDatas = async (value) => {
- if (OfferCheckedInSetup && preferenceOffer) {
- await applyOffer([]);
- } else {
- dispatch(changeOrderCardDetails([]));
- }
- dispatch(changeBillEditingMode(false));
- dispatch(changeSearchedData(''));
- await dispatch(changePreviousOrderPayment([]));
- await dispatch(changePreviousOrderOfferDetail([]));
- dispatch(changeTipAmount(0));
- dispatch(changeFullOfferAppliedProducts([]));
- dispatch(changeLoyaltyConsumedQuantities({}));
- dispatch(ChangeFullFreeProductList([]));
- await dispatch(ChangeTotalAmount([]));
- await dispatch(changeReorderHoldDetails({}));
- await dispatch(changeReorderProductDetails([]));
- setFirstPaymentclick(false);
- await dispatch(ChangeNavHoldData(false));
- await dispatch(changeCustomerID(null));
- await dispatch(changeSelectedCustId());
- await dispatch(changeSelectedOption(null));
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- setQrCode(false);
- setCurrentOrderNetAmount(0);
- setPreviousNetAmount(0);
- setUpinotSelected(false);
- if (holdCheckedSalesSetup) {
- getHolddata();
- }
- if (defaultBookingType === 'Both') {
- await dispatch(changeBookingType('TakeAway'));
- }
- await dispatch(changeSelProdWiseEst([]));
- await dispatch(ChangeOverAllDiscSales(null));
- await dispatch(ChangeOverAllDiscEstimate(null));
- // clearInvoiceDate
- clearInvoiceDate();
- dispatch(changeCurrentOrderId(null));
- // await dispatch(changeEstimateBooking(null))
- getstockbadge();
- Combodata?.length > 0 && Combocarddata();
- getUnpaiddatas();
- await dispatch(changeSelectTable([]));
- await dispatch(changeSelectChair([]));
- await dispatch(changeSelectedTableDetails([]));
- await dispatch(changeOrderType());
- if (value === 'Dine-In') {
- navigate(`${subDirectory}sales/dine-in`);
- }
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- UserId: UserId,
- FromDate: currentDateValue,
- ToDate: currentDateValue,
- };
- await dispatch(getSalesDetailData(data));
- };
-
- const AddBookingDetails = async (value, pay) => {
- const customerDisplayWindow = getCustomerDisplayWindow();
-
- const OnUpiSelected = PaymentOptions?.find(
- (item) => item.ModeId === paybtnselected
- );
- if (
- OnUpiSelected?.ModeName?.toLowerCase() === 'upi' &&
- (SelectedUPIPayOption?.toLowerCase() === 'default' ||
- SelectedUPIPayOption?.toLowerCase() === 'business')
- ) {
- if (SelectedUpiOption) {
- Booking(value, pay);
- } else {
- setUpinotSelected(true);
- setMessageType('error');
- setMessageData('Please Select Upi Option');
- }
- } else if (
- OnUpiSelected?.ModeName?.toLowerCase() === 'card' &&
- PaymentgatewayCard?.length > 0 &&
- PaymentDeviceCard?.length > 0
- ) {
- if (SelectedCardOption) {
- if (SelectedCardOption?.toLowerCase() === 'pg') {
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- if (SelCustId) {
- Booking(value, pay);
- } else {
- setMessageType('error');
- setMessageData('Please Select Customer');
- }
- } else {
- setMessageType('error');
- setMessageData('Please Set the customer display');
- }
- } else {
- Booking(value, pay);
- }
- } else {
- setCardoptionnotSelected(true);
- setMessageType('error');
- setMessageData('Please Select Card Option');
- }
- } else if (OnUpiSelected?.ModeName?.toLowerCase() === 'credit') {
- if (!SelCustId) {
- setMessageType('error');
- setMessageData('Please Select Customer');
- } else {
- setCreditCustomer(true);
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- OrderTotalAmount: TotalAmount,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- }
- } else if (
- OnUpiSelected?.ModeName?.toLowerCase() === 'upi' &&
- SelectedUPIPayOption?.toLowerCase() === 'pg'
- ) {
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- if (SelCustId) {
- Booking(value, pay);
- } else {
- setMessageType('error');
- setMessageData('Please Select Customer');
- }
- } else {
- setMessageType('error');
- setMessageData('Please Set the customer display');
- }
- } else if (
- OnUpiSelected?.ModeName?.toLowerCase() === 'card' &&
- SelectedCardOption?.toLowerCase() === 'pg'
- ) {
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- if (SelCustId) {
- Booking(value, pay);
- } else {
- setMessageType('error');
- setMessageData('Please Select Customer');
- }
- } else {
- setMessageType('error');
- setMessageData('Please Set the customer display');
- }
- } else {
- Booking(value, pay);
- }
- };
- const extrachargesbookingtype = (extradata) => {
- const TakAwayId = ConfigDataList?.find(
- (a) => a?.ConfigName === 'TakeAway'
- )?.ConfigId;
- const DineinId = ConfigDataList?.find(
- (a) => a?.ConfigName === 'Dine In'
- )?.ConfigId;
- let tempdata = extradata?.map((data) => ({
- ...data,
- BookingType: data?.BookingTypeName === 'Dine In' ? DineinId : TakAwayId,
- }));
- return tempdata;
- };
- const Booking = async (value, pay) => {
- const TakAwayId = ConfigDataList?.find(
- (a) => a?.ConfigName === 'TakeAway'
- )?.ConfigId;
- const DineinId = ConfigDataList?.find(
- (a) => a?.ConfigName === 'Dine In'
- )?.ConfigId;
-
- setFirstPaymentclick(true);
- let temporderdetail = OrderCardDetail?.map((a) => ({
- ProdId: a.ProdId,
- Type: a.Type,
- OrderQty: a.OrderQty,
- OrderRate: a.OrderRate,
- // TotalAmt: a.OrderQty * a.OrderRate,
- TotalAmt: a.TotalAmt,
- TaxAmt: a.TaxAmt,
- RefundQty: 0,
- InwardDtlId: a.InwardDtlId,
- TaxId: a.TaxId,
- ProdNameQty:
- UomPrint?.SettingValue === 'N'
- ? `${a.ProdName} ${a.UomName?.toLowerCase() === 'half' ? '(Half)' : ''}`
- : `${a.ProdName} ${a.Size} ${a.UomName}`,
- OrderStatus: 'O',
- OrderType:
- BookingType === 'Dine In' ||
- BookingTypeBoth ||
- Estimation?.SettingValue == 'N'
- ? 'S'
- : GlobEstBooking === 'OvrAllEst'
- ? 'E'
- : GlobEstBooking === 'ParEst'
- ? GlobProdwisedata?.includes(
- a.InwardDtlId + ' ' + a?.BookingTypeName
- )
- ? 'E'
- : 'S'
- : 'S',
- SinglePc: a.SinglePc,
- BookingType: a.BookingTypeName === 'Dine In' ? DineinId : TakAwayId,
- OfferValue: a?.Type === 'C' ? a?.OfferValue : a.Offer,
- OfferAmt: a?.Type === 'C' ? a?.TotalAmt : a.Offer,
- OfferType: a?.Type === 'C' ? a?.OfferType : '',
- OfferMode: a?.OfferMode,
- OfferMessage: a?.OfferMessage,
- CounterName: a?.TokenAvailable === 'Y' ? a?.CounterName : null,
- ProductIdentifierDtls: a.ProductIdentifierDtls,
- ModelNumber: a.ModelNumber,
- BatchRef: a.BatchRef,
- PackageDtl: a.PackageDtl,
- SetCount: a.SetCount,
- ...(a?.DiscountValue && { DiscountValue: a.DiscountValue }),
- ...(a?.DiscountType && { DiscountType: a.DiscountType }),
- ...(a?.DiscountAmt && { DiscountAmt: a.DiscountAmt }),
- }));
- const NotSlectedTypeFind = temporderdetail?.find(
- (a) => a?.BookingType != SelectedBookingType
- );
- const { totalwithouttax, totaltax } = OrderCardDetail?.reduce(
- (totals, card) => {
- totals.totalwithouttax += parseFloat(card.WithoutTaxRate || 0);
- totals.totaltax += parseFloat(card.TaxAmt || 0);
- return totals;
- },
- { totalwithouttax: 0, totaltax: 0 }
- ) || { totalwithouttax: 0, totaltax: 0 };
- let updatedOfferDetails = offerAppliedProducts;
- if (GlobEstBooking !== 'Sales') {
- updatedOfferDetails = offerAppliedProducts?.filter(
- (item) =>
- !(
- item.TableName === 'LoyaltyPoints' &&
- item.TableUniqueName === 'UniqueId' &&
- item.Type === 'A'
- )
- );
- }
-
- let temppostdata = {
- SalesMode: RetailWSSalesType || 'R',
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- OrderDate: Custombill ? invoiceDate : null,
- CustomOrderNo: Custombill ? CurrentOrderId : null,
- OrderType:
- Object.keys(ReportholdData)?.length > 0
- ? ReportholdData?.OrderType
- : 'S',
- CustSuppId: SelCustId ? SelCustId : null,
- Reference: 'test',
- BookingType:
- NotSlectedTypeFind && !BookingTypeBoth
- ? NotSlectedTypeFind?.BookingType
- : SelectedBookingType,
- ServiceProvider: 0,
- ActiveStatus: 'A',
- CreatedBy: UserId,
- AddlInfo: 'test',
- BillAmount: totalwithouttax,
- OverallDiscSales: OverAllSales > 0 ? OverAllSales : 0,
- OverallDiscEst: OverAllEstimate > 0 ? OverAllEstimate : 0,
- TaxAmount: totaltax,
- VatAmount: 0,
- NetAmount: Math.round(TotalAmount),
- PaymentType:
- Paybtnnameselected?.toLowerCase() === 'upi'
- ? SelectedUPIPayOption?.toLowerCase() === 'pd'
- ? PaymentDeviceUPI?.[0]?.ModeId
- : SelectedUPIPayOption?.toLowerCase() === 'pg'
- ? PaymentgatewayUPI?.[0]?.ModeId
- : paybtnselected
- : paybtnselected
- ? paybtnselected
- : null,
- GivenAmt: 0,
- BalGiven: 0,
- BookingMedia: 'DW',
- RefundAmount: 0,
- ServiceCategory: OtherServiceTicketClaim?.ServiceCategory || null,
- OtherServiceTicketId: OtherServiceTicketClaim?.TicketId || null,
- OtherServiceTicketAmount: OtherServiceTicketClaim?.TotalAmt || null,
- PaymentStatus:
- Paybtnnameselected?.toLowerCase() === 'cash'
- ? 'S'
- : Paybtnnameselected?.toLowerCase() === 'credit'
- ? 'S'
- : Paybtnnameselected?.toLowerCase() === 'upi' &&
- SelectedUPIPayOption?.toLowerCase() === 'default'
- ? 'S'
- : 'P',
- OrderDtlDetails:
- Object.keys(ReportholdData)?.length > 0
- ? ProductSummary(temporderdetail)
- : temporderdetail,
- // (BookingType === "Dine In" || BookingTypeBoth)
- ExtraChargeDetails:
- GlobalExtraCharge?.length > 0
- ? extrachargesbookingtype(GlobalExtraCharge)
- : null,
- SalesTableLinkDetails:
- SelectedTableDetails?.length > 0
- ? globalTipAmount === 0
- ? SelectedTableDetails
- : SelectedTableDetails?.map((item) => ({
- ...item,
- TipsAmount: globalTipAmount,
- }))
- : null,
- SalesPaymentType: 'normal',
- PaymentDetail: [
- {
- PaymentType:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? refundPaySelected
- : Paybtnnameselected?.toLowerCase() === 'upi'
- ? SelectedUPIPayOption?.toLowerCase() === 'pd'
- ? PaymentDeviceUPI?.[0]?.ModeId
- : SelectedUPIPayOption?.toLowerCase() === 'pg'
- ? PaymentgatewayUPI?.[0]?.ModeId
- : SelectedUPIPayOption?.toLowerCase() === 'business'
- ? BusinessPayOption?.find(
- (busupi) => busupi?.ModeId === UpiId
- )?.ModeId
- : paybtnselected
- : paybtnselected
- ? paybtnselected
- : null,
- Amount:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? previousNetAmount - currentOrderNetAmount
- : Math.round(TotalAmount),
- MerchantId:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? null
- : Paybtnnameselected?.toLowerCase() === 'upi' &&
- SelectedUPIPayOption?.toLowerCase() === 'business'
- ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
- ?.MerchantId
- : null,
- PaymentOptionType:
- salesBillEdit &&
- currentOrderNetAmount < previousNetAmount &&
- (refundPaySelectedName?.toLowerCase() === 'cash' ||
- refundPaySelectedName?.toLowerCase() === 'credit')
- ? 'PC'
- : Paybtnnameselected?.toLowerCase() === 'cash'
- ? 'PC'
- : Paybtnnameselected?.toLowerCase() === 'credit'
- ? 'PC'
- : Paybtnnameselected?.toLowerCase() === 'card'
- ? SelectedCardOption
- : Paybtnnameselected?.toLowerCase() === 'upi'
- ? SelectedUPIPayOption?.toLowerCase() === 'default'
- ? 'PC'
- : SelectedUPIPayOption?.toLowerCase() === 'business'
- ? 'BU'
- : SelectedUPIPayOption
- : null,
- ModeOfPayment:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? null
- : SelectedUPIPayOption?.toLowerCase() === 'default'
- ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
- ?.UPIDetailId
- : SelectedUPIPayOption?.toLowerCase() === 'business'
- ? BusinessPayOption?.find(
- (busupi) => busupi?.ModeId === UpiId
- )?.MerchantUPIId
- : null,
- AccountDtl:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? []
- : Paybtnnameselected?.toLowerCase() === 'upi' &&
- SelectedUPIPayOption?.toLowerCase() === 'default'
- ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
- (upipay) => upipay?.UPIId === UpiId
- )
- : (Paybtnnameselected?.toLowerCase() === 'upi' &&
- 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')
- ? useOptions?.[0]?.PaymentDetails?.PaymentGateway
- : [],
- PaymentStatus:
- salesBillEdit && currentOrderNetAmount < previousNetAmount
- ? 'S'
- : Paybtnnameselected?.toLowerCase() === 'cash'
- ? 'S'
- : Paybtnnameselected?.toLowerCase() === 'credit'
- ? 'S'
- : Paybtnnameselected?.toLowerCase() === 'upi' &&
- SelectedUPIPayOption?.toLowerCase() === 'default'
- ? 'S'
- : 'P',
- Debit:
- salesBillEdit &&
- currentOrderNetAmount < previousNetAmount &&
- refundPaySelectedName?.toLowerCase() === 'credit'
- ? Math.round(previousNetAmount - currentOrderNetAmount)
- : 0,
- Credit: salesBillEdit
- ? currentOrderNetAmount > previousNetAmount &&
- Paybtnnameselected?.toLowerCase() === 'credit'
- ? Math.round(TotalAmount)
- : 0
- : Paybtnnameselected?.toLowerCase() === 'credit'
- ? Math.round(TotalAmount)
- : 0,
- },
- ],
- OrderOfferDetail: updatedOfferDetails,
- RefDetails: [
- {
- FreeProdList: FreeProdList,
- OfferAppliedProductList: offerAppliedProducts,
- },
- ],
- };
- let PostData = temppostdata;
-
- if (value === 'Dine-In') {
- PostData['PaymentStatus'] = pay ? 'S' : 'P';
- PostData['PaymentDetail'] = !pay && [];
- PostData['PaymentType'] = !pay && '';
- } else if (value === 'Hold') {
- ((PostData['PaymentStatus'] = pay ? 'S' : 'P'),
- (PostData['PaymentDetail'] = !pay && []));
- PostData['PaymentType'] = !pay && '';
- PostData['ActiveStatus'] = pay ? 'A' : 'D';
- } else if (value === 'Unpaid') {
- PostData['PaymentStatus'] = pay ? 'S' : 'P';
- PostData['PaymentDetail'] = !pay && [];
- PostData['PaymentType'] = !pay && '';
- PostData['PrintType'] = 'Y';
- }
-
- Object.keys(ReportholdData)?.length > 0
- ? OrderType === 'Failed'
- ? PutFailedPayment(PostData, value, pay)
- : PutBooking(PostData, value, pay)
- : !OtherServicesglobal
- ? PostBooking(PostData, value)
- : OtherServicePostBooking(PostData, value);
- // getstockbadge();
- // Combocarddata();
- };
- const PostBooking = async (PostData, value) => {
- let response = await dispatch(PostBookingData(PostData)).unwrap();
- if (response?.data?.statusCode == 1) {
- let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pd' &&
- item?.PaymentStatus === 'P'
- );
- let PaymentGatewayfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pg' &&
- item?.PaymentStatus === 'P'
- );
- let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) => item?.PaymentOptionType?.toLowerCase() === 'pc'
- );
- let businessUPIfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'bu' &&
- item?.PaymentStatus === 'P'
- );
- if (
- PayatCounterfilter?.length === 1 ||
- response?.data?.PaymentOrderDtl?.length === 0
- ) {
- 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 &&
- setPrintOrderDetails([response?.data]);
- filteredSettingNames?.includes('whatsapp') &&
- MobileNoWhatsApp?.value &&
- handleURL([response?.data]);
- CustomerDisplay(value);
-
- ClearAllGlobalStateDatas(value);
- }
-
- if (Paymentdevicefilter?.length === 1) {
- if (
- Paymentdevicefilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pd'
- ) {
- PaymentDeviceFlow(Paymentdevicefilter, value);
- }
- } else {
- console.log('more pd data');
- }
- if (PaymentGatewayfilter?.length === 1) {
- if (
- PaymentGatewayfilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pg'
- ) {
- await dispatch(changePaymentloader(true));
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- OrderBookingId: PaymentGatewayfilter?.[0]?.OrderId,
- Paymentgateway: true,
- OrderPaymentId: PaymentGatewayfilter?.[0]?.PaymentOrderId,
- OrderTotalAmount: PaymentGatewayfilter?.[0]?.Amount,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- const checkPaymentStatus = async () => {
- const intervalId = setInterval(async () => {
- try {
- let getpaymentgatewaydetail = await dispatch(
- PaymentGatewayGetdetail(PaymentGatewayfilter?.[0]?.OrderId)
- ).unwrap();
-
- if (getpaymentgatewaydetail?.data?.statusCode === 1) {
- let paymentdataget =
- getpaymentgatewaydetail?.data?.PaymentOrderDtl?.find(
- (item) =>
- item?.PaymentOrderId ===
- PaymentGatewayfilter?.[0]?.PaymentOrderId
- )?.PaymentStatus;
-
- if (paymentdataget === 'S') {
- setMessageType('success');
- setMessageData('Payment Success');
- await dispatch(changePaymentloader(false));
- if (
- getpaymentgatewaydetail?.data?.OrderDetails?.length > 0
- ) {
- setPrintOrderDetails([getpaymentgatewaydetail?.data]);
- CustomerDisplay(value);
-
- ClearAllGlobalStateDatas(value);
- }
- clearInterval(intervalId); // Stop the loop when payment is successful
- } else if (paymentdataget === 'F') {
- setMessageType('error');
- setMessageData('Payment Failed');
- await dispatch(changePaymentloader(false));
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- setFirstPaymentclick(false);
- clearInterval(intervalId); // Stop the loop when payment fails
- CustomerDisplayRemovedData();
- ClearAllGlobalStateDatas(value);
- }
- }
- } catch (error) {
- console.error('Error fetching payment details: ', error);
- }
- }, 3000); // Call the API every 3 seconds
- };
-
- // Call the function to start checking payment status
- checkPaymentStatus();
- }
- } else {
- console.log('more pg data');
- }
- if (businessUPIfilter?.length === 1) {
- businessUPIFlow(
- businessUPIfilter,
- response?.data?.OrderId,
- response?.data?.PaymentPageLink
- );
- }
- dispatch(triggerCustomerRefresh());
- } else {
- setMessageType('error');
- setMessageData(response?.data?.response);
- setFirstPaymentclick(false);
- // clearInvoiceDate
- clearInvoiceDate();
- dispatch(changeCurrentOrderId(null));
- }
- };
-
- const PutBooking = async (putdatas, value, pay) => {
- let putdata = putdatas;
- putdata['OrderId'] = ReportholdData?.OrderId;
- putdata['SalesId'] = ReportholdData?.SalesId;
- putdata['UpdatedBy'] = UserId;
- if (value === 'Dine-In') {
- putdata['PaymentStatus'] = pay ? 'S' : 'P';
- putdata['PaymentDetail'] = !pay && [];
- putdata['PaymentType'] = !pay && '';
- } else if (value === 'Hold') {
- ((putdata['PaymentStatus'] = pay ? 'S' : 'P'),
- (putdata['PaymentDetail'] = !pay && []));
- putdata['PaymentType'] = !pay && '';
- putdata['ActiveStatus'] = pay ? 'A' : 'D';
- } else if (value === 'Unpaid') {
- putdata['PaymentStatus'] = pay ? 'S' : 'P';
- putdata['PaymentDetail'] = !pay && [];
- putdata['PaymentType'] = !pay && '';
- putdata['PrintType'] = 'Y';
- }
- let response = null;
- if (salesBillEdit) {
- response = await dispatch(putSalesBillEdit(putdata)).unwrap();
- } else {
- response = await dispatch(PutBookingData(putdata)).unwrap();
- }
- if (value !== 'Unpaid') {
- if (response?.data?.statusCode == 1) {
- let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pd' &&
- item?.PaymentStatus === 'P'
- );
- let PaymentGatewayfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pg' &&
- item?.PaymentStatus === 'P'
- );
- let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) => item?.PaymentOptionType?.toLowerCase() === 'pc'
- );
- if (
- PayatCounterfilter?.length === 1 ||
- response?.data?.PaymentOrderDtl?.length === 0
- ) {
- 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 &&
- setPrintOrderDetails([response?.data]);
- CustomerDisplay(value);
-
- ClearAllGlobalStateDatas(value);
- }
- if (Paymentdevicefilter?.length === 1) {
- if (
- Paymentdevicefilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pd'
- ) {
- PaymentDeviceFlow(Paymentdevicefilter, value);
- }
- } else {
- console.log('more pd data');
- }
- if (PaymentGatewayfilter?.length === 1) {
- PaymentGatewayFlow(PaymentGatewayfilter);
- } else {
- setPrintOrderDetails([response?.data]);
- // CustomerDisplay();
- ClearAllGlobalStateDatas();
- console.log('more pg data');
- }
- } else {
- // clearInvoiceDate
- clearInvoiceDate();
- dispatch(changeCurrentOrderId(null));
- }
- } else {
- setPrintOrderDetails([response?.data]);
- if (OfferCheckedInSetup && preferenceOffer) {
- await applyOffer([]);
- } else {
- dispatch(changeOrderCardDetails([]));
- }
- await dispatch(changeReorderHoldDetails({}));
- await dispatch(changeReorderProductDetails([]));
- setFirstPaymentclick(false);
- if (defaultBookingType === 'Both') {
- await dispatch(changeBookingType('TakeAway'));
- }
- await dispatch(changeSelectTable([]));
- await dispatch(changeSelectChair([]));
- getUnpaiddatas();
- }
- };
- const PutFailedPayment = async (PayData, value, pay) => {
- console.log(PayData?.PaymentDetail?.[0]?.PaymentType, 'mohanPayData');
- let tempsplitdata = {
- CompId: PayData?.CompId,
- BranchId: PayData?.BranchId,
- AppId: PayData?.AppId,
- CustSuppId: PayData?.SelCustId ? SelCustId : null,
- UpdatedBy: UserId,
- OrderId: ReportholdData?.OrderId,
- PaymentType: PayData?.PaymentDetail?.[0]?.PaymentType,
- Amount: FailedTotalAmt,
- PaymentOptionType: PayData?.PaymentDetail?.[0]?.PaymentOptionType,
- ModeOfPayment: PayData?.PaymentDetail?.[0]?.ModeOfPayment,
- AccountDtl: PayData?.PaymentDetail?.[0]?.AccountDtl,
- PaymentStatus: PayData?.PaymentDetail?.[0]?.PaymentStatus,
- Debit: PayData?.PaymentDetail?.[0]?.Debit,
- Credit: PayData?.PaymentDetail?.[0]?.Credit,
- };
-
- let response = await dispatch(
- putSplitpaymentStatus(tempsplitdata)
- ).unwrap();
- if (response?.data?.statusCode == 1) {
- let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pd' &&
- item?.PaymentStatus === 'P'
- );
- let PaymentGatewayfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pg' &&
- item?.PaymentStatus === 'P'
- );
- let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter(
- (item) =>
- item?.PaymentOptionType?.toLowerCase() === 'pc' &&
- item?.PaymentType === PayData?.PaymentDetail?.[0]?.PaymentType
- );
- if (
- PayatCounterfilter?.length > 0 ||
- response?.data?.PaymentOrderDtl?.length === 0
- ) {
- setMessageType('success');
-
- // setSplitSelPayMode({...SplitSelPayMode,...{[`PaymentStatus-${i}`]:"S"}})
-
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- upi: null,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- setMessageData(
- response?.data?.response +
- ' ' +
- (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]);
- CustomerDisplay();
- ClearAllGlobalStateDatas();
- }
- }
- if (Paymentdevicefilter?.length === 1) {
- if (
- Paymentdevicefilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pd'
- ) {
- PaymentDeviceFlow(Paymentdevicefilter, value);
- }
- }
-
- if (PaymentGatewayfilter?.length === 1) {
- if (
- PaymentGatewayfilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pg'
- ) {
- PaymentGatewayFlow(PaymentGatewayfilter, value);
- }
- }
- }
- };
- const PaymentGatewayFlow = async (PaymentGatewayfilter) => {
- if (PaymentGatewayfilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pg') {
- await dispatch(changePaymentloader(true));
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- OrderBookingId: PaymentGatewayfilter?.[0]?.OrderId,
- Paymentgateway: true,
- OrderPaymentId: PaymentGatewayfilter?.[0]?.PaymentOrderId,
- OrderTotalAmount: PaymentGatewayfilter?.[0]?.Amount,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- const checkPaymentStatus = async () => {
- const intervalId = setInterval(async () => {
- try {
- let getpaymentgatewaydetail = await dispatch(
- PaymentGatewayGetdetail(PaymentGatewayfilter?.[0]?.OrderId)
- ).unwrap();
-
- if (getpaymentgatewaydetail?.data?.statusCode === 1) {
- let paymentdataget =
- getpaymentgatewaydetail?.data?.PaymentOrderDtl?.find(
- (item) =>
- item?.PaymentOrderId ===
- PaymentGatewayfilter?.[0]?.PaymentOrderId
- )?.PaymentStatus;
-
- if (paymentdataget === 'S') {
- setMessageType('success');
- setMessageData('Payment Success');
- await dispatch(changePaymentloader(false));
- if (getpaymentgatewaydetail?.data?.OrderDetails?.length > 0) {
- setPrintOrderDetails([getpaymentgatewaydetail?.data]);
- CustomerDisplay(value);
-
- ClearAllGlobalStateDatas(value);
- }
- clearInterval(intervalId); // Stop the loop when payment is successful
- } else if (paymentdataget === 'F') {
- setMessageType('error');
- setMessageData('Payment Failed');
- await dispatch(changePaymentloader(false));
- setFirstPaymentclick(false);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- clearInterval(intervalId); // Stop the loop when payment fails
- CustomerDisplayRemovedData();
- ClearAllGlobalStateDatas(value);
- // const customerDisplayWindow = getCustomerDisplayWindow();
- // if (customerDisplayWindow && !customerDisplayWindow.closed) {
- // const updatedData = {
- // userData: OrderCardDetail,
- // ExtraCharges: GlobalExtraCharge,
- // upi: GlobalUpiID,
- // customer: selOption != null ? selOption : GetCustId,
- // paymentMethod: Paybtnnameselected,
- // Paymentgateway: false,
- // OrderTotalAmount: PaymentGatewayfilter?.[0]?.Amount
-
- // };
- // customerDisplayWindow.postMessage(updatedData, '*');
- // }
- }
- }
- } catch (error) {
- console.error('Error fetching payment details: ', error);
- }
- }, 3000); // Call the API every 3 seconds
- };
-
- // Call the function to start checking payment status
- checkPaymentStatus();
- }
- };
- const PaymentDeviceFlow = async (Paymentdevicefilter, value) => {
- await dispatch(changePaymentloader(true));
- await dispatch(
- changePaymentTransactionNumber(Paymentdevicefilter?.[0]?.PaymentOrderId)
- );
- let paymentdetail = {
- TransactionNumber: Paymentdevicefilter?.[0]?.PaymentOrderId,
- SequenceNumber: 1,
- AllowedPaymentMode:
- Paymentdevicefilter?.[0]?.PaymentTypeName?.toLowerCase() === 'card'
- ? '1'
- : Paymentdevicefilter?.[0]?.PaymentTypeName?.toLowerCase() === 'upi'
- ? '10'
- : '',
- Amount: `${parseInt(Paymentdevicefilter?.[0]?.Amount) * 100}`,
- ClientID: useOptions?.[0]?.PDConfigDetails?.[0]?.ClientId,
- StoreID: useOptions?.[0]?.PDConfigDetails?.[0]?.StoreId,
- UserID: useOptions?.[0]?.PDConfigDetails?.[0]?.UserId,
- MerchantID: useOptions?.[0]?.PDConfigDetails?.[0]?.MerchantId,
- SecurityToken: useOptions?.[0]?.PDConfigDetails?.[0]?.SecurityToken,
- IMEI: useOptions?.[0]?.PDConfigDetails?.[0]?.IMEI,
- AutoCancelDurationInMinutes:
- useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes,
- };
- let apiresponse = await dispatch(PostPaymentdevice(paymentdetail)).unwrap();
- if (apiresponse?.ResponseMessage?.toLowerCase() === 'approved') {
- let pendingPaymentList = {
- MerchantID: useOptions?.[0]?.PDConfigDetails?.[0]?.MerchantId,
- SecurityToken: useOptions?.[0]?.PDConfigDetails?.[0]?.SecurityToken,
- ClientID: useOptions?.[0]?.PDConfigDetails?.[0]?.ClientId,
- StoreID: useOptions?.[0]?.PDConfigDetails?.[0]?.StoreId,
- IMEI: useOptions?.[0]?.PDConfigDetails?.[0]?.IMEI,
- PlutusTransactionReferenceId: apiresponse?.PlutusTransactionReferenceID,
- PaymentOrderId: Paymentdevicefilter?.[0]?.PaymentOrderId,
- UpdatedBy: UserId,
- };
- await dispatch(PutPendingPaymentList(pendingPaymentList)).unwrap();
- let isApproved = false;
- const startTime = Date.now();
- let postpaymentdata = {
- MerchantID: useOptions?.[0]?.PDConfigDetails?.[0]?.MerchantId,
- SecurityToken: useOptions?.[0]?.PDConfigDetails?.[0]?.SecurityToken,
- ClientID: useOptions?.[0]?.PDConfigDetails?.[0]?.ClientId,
- StoreID: useOptions?.[0]?.PDConfigDetails?.[0]?.StoreId,
- IMEI: useOptions?.[0]?.PDConfigDetails?.[0]?.IMEI,
- PlutusTransactionReferenceID: apiresponse?.PlutusTransactionReferenceID,
- };
- // Loop to call the second API every 3 seconds
- while (!isApproved) {
- let ApiResponseget = await dispatch(
- GetPaymentdeviceResponse(postpaymentdata)
- ).unwrap();
-
- if (ApiResponseget?.ResponseMessage?.toLowerCase() === 'txn approved') {
- let putbookingdata = {
- OrderBookingId: Paymentdevicefilter?.[0]?.OrderId,
- OrderId: Paymentdevicefilter?.[0]?.PaymentOrderId,
- PaymentStatus: 'S',
- Amount: Paymentdevicefilter?.[0]?.Amount,
- ResponseDtl: [ApiResponseget],
- PaymentType: Paymentdevicefilter?.[0]?.PaymentType,
- UpdatedBy: UserId,
- };
-
- let bookingpaymentupdate = await dispatch(
- PutBookingPaymentStatusChange(putbookingdata)
- ).unwrap();
- if (bookingpaymentupdate?.data?.statusCode === 1) {
- 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 &&
- setPrintOrderDetails([bookingpaymentupdate?.data]);
- CustomerDisplay(value);
-
- ClearAllGlobalStateDatas(value);
- await dispatch(changePaymentloader(false));
- }
- isApproved = true;
- console.log('Transaction Approved!');
- // Exit the loop
- break;
- }
-
- // Check if 1 minute has passed
- if (
- Date.now() - startTime >
- useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes *
- 60000
- ) {
- // 60,000 ms = 1 minute
-
- let putbookingdata = {
- OrderBookingId: Paymentdevicefilter?.[0]?.OrderId,
- OrderId: Paymentdevicefilter?.[0]?.PaymentOrderId,
- PaymentStatus: 'F',
- Amount: Paymentdevicefilter?.[0]?.Amount,
- ResponseDtl: [ApiResponseget],
- PaymentType: Paymentdevicefilter?.[0]?.PaymentType,
- UpdatedBy: UserId,
- };
-
- let bookingpaymentupdate = await dispatch(
- PutBookingPaymentStatusChange(putbookingdata)
- ).unwrap();
- if (bookingpaymentupdate?.data?.statusCode === 1) {
- setMessageType('error');
- setMessageData(
- `Payment Failed. Your Transaction Number is ${Paymentdevicefilter?.[0]?.PaymentOrderId}`
- );
- setFirstPaymentclick(false);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- await dispatch(changePaymentloader(false));
- CustomerDisplayRemovedData();
- ClearAllGlobalStateDatas(value);
- }
-
- console.error('Transaction not approved within 1 minute.');
- // Send an error message or handle the timeout
- // You can dispatch an action, show a notification, etc.
- break;
- }
-
- // Wait for 3 seconds before making the next call
- await new Promise((resolve) => setTimeout(resolve, 3000));
- }
- } else {
- let putbookingdata = {
- OrderBookingId: Paymentdevicefilter?.[0]?.OrderId,
- OrderId: Paymentdevicefilter?.[0]?.PaymentOrderId,
- PaymentStatus: 'F',
- Amount: Paymentdevicefilter?.[0]?.Amount,
- PaymentType: Paymentdevicefilter?.[0]?.PaymentType,
- UpdatedBy: UserId,
- };
- let bookingpaymentupdate = await dispatch(
- PutBookingPaymentStatusChange(putbookingdata)
- ).unwrap();
- if (bookingpaymentupdate?.data?.statusCode === 1) {
- setMessageType('error');
- setMessageData(apiresponse?.ResponseMessage);
- setFirstPaymentclick(false);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- dispatch(changePaymentloader(false));
- CustomerDisplayRemovedData();
- ClearAllGlobalStateDatas(value);
- }
- }
- };
- const businessUPIFlow = async (
- businessUPIfilter,
- OrderId,
- PaymentStatusLink
- ) => {
- // Implement your business UPI flow here
- console.log('Business UPI Flow Triggered', businessUPIfilter);
- // You can add similar logic as PaymentDeviceFlow or PaymentGatewayFlow based on your requirements
- setBusinessUPILink(PaymentStatusLink);
- setBusinessUPI(true);
- setBusinessUPIOrderId(OrderId);
- };
- function safeRound(amountStr) {
- if (amountStr == null) return '0.00';
-
- const cleaned = String(amountStr).replace(/[^0-9.-]+/g, '');
- const num = Number(cleaned);
-
- return isNaN(num) ? '0.00' : num.toFixed(2); // return as string with 2 decimals
- }
- const columns = [
- {
- title: 'Sl.No',
- key: 'sno',
- align: 'center',
- width: '100px',
- render: (text, object, index) => (
- {index + 1}
- ),
- },
- {
- title: 'Table Name/Chair Name',
- dataIndex: 'TableName',
- key: 'TableName',
- width: '150px',
- onCell: (_, record, index) => {
- return {
- onClick: () => {
- Unpaidfun(record);
- },
- };
- },
- },
- {
- title: 'Order Id',
- dataIndex: 'OrderID',
- key: 'OrderID',
- width: '150px',
- align: 'right',
- onCell: (_, record, index) => {
- return {
- onClick: () => {
- Unpaidfun(record);
- },
- };
- },
- },
- {
- title: "Item's",
- dataIndex: 'ProductName',
- key: 'ProductName',
- width: '250px',
- onCell: (_, record, index) => {
- return {
- onClick: () => {
- Unpaidfun(record);
- },
- };
- },
- },
- {
- title: 'Amount',
- dataIndex: 'TotalAmount',
- key: 'TotalAmount',
- width: '150px',
- align: 'right',
- render: (text) => {safeRound(text)} ,
- onCell: (_, record, index) => {
- return {
- onClick: () => {
- Unpaidfun(record);
- },
- };
- },
- },
- ];
-
- const TableData = [];
- tabledata?.map((item) =>
- TableData.push({
- TableName: item.SalesTableLinkDetails?.map((item) =>
- item.ChairName == null ? item.TableName : item.ChairName
- )?.join(','),
- OrderID: extractLastNumberOrderId(item?.OrderId, item?.FYStatus),
- ProductName: item.productDetails
- ?.map(
- (item) =>
- item?.ProdName +
- '-' +
- (item?.Type != 'C' ? item?.OrderQty : '1 Combo')
- )
- ?.join(','),
- TotalAmount: item.NetAmount,
- })
- );
-
- const Unpaidfun = async (event) => {
- dispatch(changeunpaidflow(true));
- if (
- OrderCardDetail?.length > 0 &&
- (BookingType === 'Dine In' || BookingTypeBoth)
- ) {
- // await dispatch(changeOrderCardDetails([]))
- // await dispatch(changeOrderCardDetails(tabledata?.[event]?.productDetails))
- // await dispatch(ChangeTotalAmount(tabledata?.[event]?.ExtraChargeDetails))
- // await dispatch(changeUnpaidData(true))
- // await dispatch(changeReorderHoldDetails([tabledata?.[event]]?.[0]));
- // await dispatch(changeReorderProductDetails(tabledata?.[event]?.productDetails))
- // setUnpaidOpen(false)
- setUnpaidConfirmation(true);
- setunpaidselectedindex(event);
- } else {
- const UpdatedData = tabledata?.[event]?.productDetails;
- if (OfferCheckedInSetup && preferenceOffer) {
- await applyOffer(UpdatedData);
- } else {
- dispatch(changeOrderCardDetails(UpdatedData));
- }
- await dispatch(changeReorderHoldDetails([tabledata?.[event]]?.[0]));
- await dispatch(ChangeTotalAmount(tabledata?.[event]?.ExtraChargeDetails));
- await dispatch(
- changeReorderProductDetails(tabledata?.[event]?.productDetails)
- );
- await dispatch(changeUnpaidData(true));
- setUnpaidOpen(false);
- }
- };
-
- const UnpaidOk = async () => {
- setOrderStatus(false);
- await dispatch(changeSelectedTableDetails([]));
- await dispatch(changeSelectTable([]));
- await dispatch(changeSelectChair([]));
- if (defaultBookingType === 'Both') {
- await dispatch(changeBookingType('TakeAway'));
- }
- await dispatch(
- changeOrderCardDetails(tabledata?.[unpaidselectedindex]?.productDetails)
- );
- await dispatch(
- changeReorderProductDetails(
- tabledata?.[unpaidselectedindex]?.productDetails
- )
- );
- await dispatch(
- changeReorderHoldDetails([tabledata?.[unpaidselectedindex]]?.[0])
- );
- await dispatch(
- ChangeTotalAmount(tabledata?.[unpaidselectedindex]?.ExtraChargeDetails)
- );
- await dispatch(changeUnpaidData(true));
- setUnpaidOpen(false);
- setUnpaidConfirmation(false);
- };
- const Unpaidclose = async () => {
- dispatch(changeunpaidflow(false));
- setUnpaidOpen(false);
- setUnpaidConfirmation(false);
- };
-
- const Recipt = async () => {
- AddBookingDetails('Unpaid', false);
- };
-
- const getstockbadge = async () => {
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- };
- await dispatch(getSelectedFavItems(data)).unwrap();
-
- let data1 = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- ProdSubCat: ProdSubCat,
- };
-
- let data2 = {
- compId: CompId,
- branchId: BranchId,
- appId: AppId,
- prodCat: prodCat,
- };
-
- if (
- templateData?.BookingLayout?.[1]?.some(
- (item) => item?.OptionName === 'SubCategory'
- ) &&
- ProdSubCat
- ) {
- await dispatch(getLayoutproductCard(data1)).unwrap();
- } else if (
- !templateData?.BookingLayout?.[1]?.some(
- (item) => item?.OptionName === 'SubCategory'
- )
- ) {
- await dispatch(getCardDataWithoutSubmodule(data2)).unwrap();
- } else {
- await dispatch(getCardDataWithoutSub(data2)).unwrap();
- }
- };
-
- const Combocarddata = async () => {
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- ActiveStatus: 'A',
- };
-
- let response = await dispatch(getCombolist(data)).unwrap();
- let datas = response?.data?.data;
- await dispatch(ChangeComboCarddata(datas));
- if (response?.data?.statusCode === 1) {
- // let Data = response?.data?.data
- // let comboList = Data?.map((item, index) => ({
- // ...item,
- // id: `${item.ComboName || 'Combo'}-${index}`,
- // ProdName:item?.ComboName,
- // OverAllQty:item?.OverallQuantity
- // }));
- // setCombocardata(comboList);
- }
- };
-
- const Upimodel = (type) => {
- setUpiOpen(false);
-
- if (type == 'Submit') {
- AddBookingDetails(BookingType, true);
- }
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedRemovedData = {
- type: 'remove',
- keyValue: 'OrderTotalAmount',
- };
- customerDisplayWindow.postMessage(updatedRemovedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- };
- // const OrderId=PostBookingDataDetailOrderId ?.OrderId
- const today = new Date();
- const year = today.getFullYear();
- // Note: Months are zero-based, so we add 1 to get the actual month
- const month = today.getMonth() + 1;
- const day = today.getDate();
-
- // Creating a formatted date string (in the format YYYY-MM-DD)
- const Todaydate = `${day < 10 ? '0' : ''}${day}-${month < 10 ? '0' : ''}${month}-${year}`;
- const OrderId = PrintOrderDetails?.[0]?.OrderDetails?.[0]?.OrderId;
- let MobileNo = selOption?.value;
- const onFinalSubmit = async () => {
- let url = `${MainHomeUrl}payment-page?amt=${TotalAmount}&Id=${MobileNo}&cus=${SelCustId} &CusN=${selOption?.CustName}&Br=${brachName}`;
- let response = await dispatch(SendPaymentLink({ MobileNo, url })).unwrap();
- if (response?.data?.statusCode === 1) {
- setMessageType('success');
- setMessageData('Link Sent Successfully');
- }
- };
-
- const CreditCustomerHAndleCancel = () => {
- setcreditCustomerOpen(false);
- };
-
- const CreditCustomerFun = () => {
- if (
- OrderCardDetail?.length === 0 &&
- (selOption?.value !== undefined ||
- GlobalAddCustomerDetails1.length > 0 ||
- GetCustId?.CustMobile !== undefined)
- ) {
- setcreditCustomerOpen(true);
- } else {
- if (selOption?.value == undefined) {
- setMessageType('warning');
- setMessageData('Please Select the Customer');
- }
- }
- };
- const changeOrderStatus = () => {
- setOrderStatus(!OrderStatus);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- };
- // split payments
- const SplitPaymentOpen = () => {
- if (OrderCardDetail?.length > 0 && TotalAmount > 0) {
- const updatedData = {
- userData: OrderCardDetail,
- ExtraCharges: GlobalExtraCharge,
- customer: selOption != null ? selOption : GetCustId,
- Paymentgateway: false,
- };
- setFailedOrderData(updatedData);
- setSplitpayment(true);
- } else {
- if (TotalAmount <= 0) {
- setMessageType('warning');
- setMessageData('Cannot split when total amount is zero or less');
- return;
- }
- setMessageType('warning');
- setMessageData('Please Select the Product');
- }
- };
-
- const handlesplitpaymentclose = () => {
- setSplitpayment(false);
- setPaybtnnameselected(PaymentOptionsModeName);
- setPaybtnselected(PaymentOptionsModeId);
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- paymentMethod: PaymentOptions?.[0]?.ModeName,
- Paymentgateway: false,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- };
- const handleResponsiveBill = () => {
- setResponsiveBill(!responsiveBill);
- };
- const navCust = templateData?.BookingNavbar?.[1]?.some(
- (item) => item?.OptionName === 'AddCustomer'
- );
-
- const handlepaymentoptions = async () => {
- await dispatch(changeSalesPaymentoption(true));
- await dispatch(
- getPaymentOptionsData({
- AppId: AppId,
- CompId: CompId,
- BranchId: BranchId,
- })
- );
- };
- const handleURL = async (PrintOrderDetails) => {
- let orderIdsArray = PrintOrderDetails?.[0]?.OrderDetails?.map(
- (orderDetail) => orderDetail?.OrderId
- );
- const encrypted = encryptObject(orderIdsArray);
-
- const postData = {
- Url: encrypted,
- CreatedBy: UserId,
- };
- if (orderIdsArray) {
- const res = await dispatch(PublicQrCodepost(postData)).unwrap();
- const urlData = res?.data?.ReferenceNo;
- setUrlData(urlData);
- }
- };
-
- const customerNameOrMobile = MobileNoWhatsApp?.CustName?.trim()
- ? `Dear ${MobileNoWhatsApp?.CustName}`
- : `Dear ${MobileNoWhatsApp?.value}`;
- const documentUrl = `${MainHomeUrl}viewbill?code=${urlData}`;
- const encodedMessage = `${customerNameOrMobile},\n\n🙏 Thank you for being a valuable customer!\n\n🧾 To view your bill, please click the link below:\n${documentUrl}`;
- // ------------------------------------------------OTHER SERVICES FUNCTIONALITY-----------------------------------------------------------------------------------
-
- useEffect(() => {
- if (isMobile) {
- OtherServiceMobilePrint(
- OtherServicesPrintDetails,
- UpiId,
- 'Booking',
- SettingDataSelector
- );
- } else {
- Otherserviceprint();
- }
- }, [OtherServicesPrintDetails]);
-
- useEffect(() => {
- const setDefaultPaymentOption = async () => {
- const res = await dispatch(
- getDefaultPaymentOptions({ AppId, CompId, BranchId })
- )?.unwrap();
- const defaultDetail = res?.data?.data?.[0]?.DefaultDetails?.[0];
- if (res?.data?.data?.length > 0 && defaultDetail) {
- setDefaultEnabled(true);
- setDefaultPaymentMode(defaultDetail);
- const { option, card } = defaultDetail;
- if (option?.value) setSelectedUPIPayOption(option.value);
- if (card) {
- const isDefault =
- String(option?.value ?? '').toLowerCase() === 'default';
- const idToUse = isDefault ? card?.UPIId : card?.ModeId;
-
- if (idToUse) {
- addUpiOption(card?.Mode, card?.ModeName, idToUse);
- }
- }
- } else {
- setDefaultEnabled(false);
- setDefaultPaymentMode([]);
- }
- };
- if (salesBillEdit) {
- setDefaultPaymentOption();
- }
- }, [defaultPaymentTrigger, salesBillEdit]);
-
- const Otherserviceprint = async () => {
- if (OtherServicesPrintDetails?.length > 0) {
- const style = await PrintStyleFunction('OtherServices1');
- const stylesMap = {
- OtherServices1: 'OtherServices1',
- };
-
- const selectedStyle = stylesMap['OtherServices1'];
-
- console.log(selectedStyle, 'selectedStyle');
-
- await printDiv('OtherServices1', style); // Use unique IDs for each print
-
- // setOtherServicesPrintDetails([]);
- closePrintOption();
- }
- };
-
- const OtherServicePostBooking = async (PostData, value) => {
- console.log(PostData, value, 'PostData, value');
-
- let postdata = {
- AppId: AppId,
- CompId: CompId,
- BranchId: BranchId,
- BillAmount: PostData?.BillAmount,
- TaxAmount: PostData?.TaxAmount,
- NetAmount: PostData?.NetAmount,
- OtherServicesTicketDetails: OrderCardDetail.map((item) => ({
- ServiceId: item.ServiceId,
- ServiceCategory: item.ServiceCategory,
- VehicleNumber: item.VehicleNo || '',
- Qty: item.OrderQty,
- Rate: item.Rate,
- TaxAmount: item.TaxAmt,
- TotalAmount: item.TotalAmt,
- })),
- PaymentDetail: PostData?.PaymentDetail,
- CreatedBy: UserId,
- };
-
- let Response = await dispatch(PostOtherServices(postdata)).unwrap();
-
- if (Response?.data?.statusCode == 1) {
- setMessageType('success');
- setMessageData(Response?.data?.response);
- ClearAllGlobalStateDatas(value);
- setOtherServicesPrintDetails([
- Response?.data?.OtherServicesTicketDetails?.[0],
- ]);
- }
-
- console.log(postdata, 'PostdataPostdataPostdata');
- };
-
- const Otherservicesvehicleno = () => {
- setOtherServicesModal(true);
- };
-
- const handleInputChange = (key, index, value, serviceType, item) => {
- const uppercasedValue = value.toUpperCase();
- const regex = /^[A-Z]{2}[0-9]{2}[A-Z]{1,2}[0-9]{4}$/;
- const isValid = regex.test(uppercasedValue);
-
- if (serviceType === 'G') {
- const existing = vehicleInputs[key] ? [...vehicleInputs[key]] : [];
- existing[index] = uppercasedValue;
-
- setVehicleInputs((prev) => ({ ...prev, [key]: existing }));
-
- const updatedErrors = {
- ...errors,
- [key]: [...(errors[key] || [])],
- };
- // updatedErrors[key][index] = isValid ? '' : 'Invalid format (e.g., KA01AB1234)';
- updatedErrors[key][index] =
- uppercasedValue === ''
- ? ''
- : isValid
- ? ''
- : 'Invalid format (e.g., KA01AB1234)';
-
- setErrors(updatedErrors);
-
- vehiclesvalues({ ...vehicleInputs, [key]: existing });
- } else {
- const uniqueKey = `${key}__${item.__index}`;
- const updatedInputs = {
- ...vehicleInputs,
- [uniqueKey]: [uppercasedValue],
- };
-
- const updatedErrors = { ...errors };
- // updatedErrors[uniqueKey] = [isValid ? '' : 'Invalid format (e.g., KA01AB1234)'];
-
- updatedErrors[uniqueKey] = [
- uppercasedValue === ''
- ? ''
- : isValid
- ? ''
- : 'Invalid format (e.g., KA01AB1234)',
- ];
-
- setVehicleInputs(updatedInputs);
- setErrors(updatedErrors);
-
- vehiclesvalues(updatedInputs);
- }
- };
-
- const vehiclesvalues = (vehicleData) => {
- const updated = OrderCardDetail.map((item) => {
- const key =
- item.ServiceType === 'G'
- ? item.id // using `id` now
- : `${item.ServiceId}__${item.__index}`;
-
- // if (vehicleData[key]) {
- // return {
- // ...item,
- // VehicleNo: vehicleData[key],
- // };
- // }
- // return item;
-
- const value = vehicleData[key];
-
- if (value && value.length) {
- return {
- ...item,
- VehicleNo:
- item.ServiceType === 'G'
- ? value.join(',') // 👈 convert array to comma-separated string
- : value[0], // 👈 single string from array
- };
- }
-
- return item;
- });
-
- dispatch(changeOrderCardDetails(updated));
- };
-
- const Handlevehiclenumbers = () => {
- setOtherServicesModal(false);
- };
-
- const hasVehicleInputErrors = () => {
- return Object.values(errors).some(
- (arr) => Array.isArray(arr) && arr.some((err) => err)
- );
- };
- return (
-
-
- {screenwidth <= 768 && (
-
-
- {Array.isArray(OrderCardDetail) &&
- OrderCardDetail?.length >= 1 && (
-
- )}
-
-
-
- {Array.isArray(OrderCardDetail) &&
- OrderCardDetail?.length >= 1 && (
-
- {responsiveBill ? (
-
- ) : (
-
- )}
-
- )}
-
-
- )}
-
-
-
-
-
- {tableOptions
- ?.filter((item) => item.OptionName === 'AddCustomer')
- ?.map((filteredItem) => (
-
-
-
- ))}
-
-
-
- {(addcustomer || hold) && (
-
- )}
- {creditCustomerOpen && (
-
- )}
- {tableOptions?.filter((item) => item.OptionName === 'AddCustomer')
- .length === 1 || navCust === true ? (
-
- {Object.keys(useOptions)?.length > 0 &&
- useOptions?.some((flow) =>
- flow.OptionDetails.some(
- (option) =>
- option.OptionName === 'Pay at the counter' &&
- option.ModeDetails.some(
- (mode) => mode.ModeName === 'Credit'
- )
- )
- ) &&
- !OtherServicesglobal && (
-
-
- {' '}
- 0 && 'not-allowed',
- color:
- OrderCardDetail?.length > 0 ||
- (selOption?.value === undefined &&
- GlobalAddCustomerDetails1?.length === 0 &&
- GetCustId?.CustMobile === undefined)
- ? 'gray'
- : 'rgb(18, 146, 238)',
- fontSize: '28px',
- }}
- />
-
-
- )}
-
- ) : (
- ''
- )}
-
- {/* Customer Orders */}
- {SelCustId &&
- tableOptions?.filter(
- (item) => item.OptionName === 'PreviousBillFetch'
- ).length === 1 && (
-
- {' '}
- {
- if (
- CheckBookingStatus !== 'Close' &&
- !addnewAccess &&
- !(OrderCardDetail?.length > 0)
- ) {
- setCustomerPreviesOrders(true);
- }
- }}
- style={{
- cursor: OrderCardDetail?.length > 0 && 'not-allowed',
- color:
- OrderCardDetail?.length > 0 ||
- (OrderCardDetail?.length > 0 &&
- GetCustId?.CustMobile === undefined)
- ? 'gray'
- : 'rgb(18, 146, 238)',
- fontSize: '25px',
- display: 'flex',
- alignItems: 'center',
- height: '2.46rem',
- width: '1.5rem',
- }}
- >
-
-
-
- )}
- {tabledata?.length > 0 && dinePreference && (
-
- {tableOptions
- .filter((item) => item.OptionName === 'UnpaidBill')
- .map((filteredItem) => (
-
- {!OtherServicesglobal && (
-
- {' '}
- {
- (setUnpaidOpen(true), getUnpaiddatas());
- }}
- />
-
- )}
-
- ))}
-
- )}
- {paybtns?.length > 1 && (
-
0) &&
- !unpaidFlow &&
- OrderStatus
- ? 'none'
- : 'auto',
- opacity:
- (BookingType === 'Dine In' ||
- BookingTypeBoth ||
- CheckOrderType?.length > 0) &&
- !unpaidFlow &&
- OrderStatus
- ? 0.5
- : 1,
- width: '2rem',
- }}
- >
- {!OtherServicesglobal && (
-
- {' '}
-
-
- )}
-
- )}
- {OtherServicesglobal && OrderCardDetail.length >= 1 && (
-
- {' '}
-
-
-
-
- )}
- {dinePreference && (
-
- {(BookingType === 'Dine In' ||
- BookingTypeBoth ||
- CheckOrderType?.length > 0) &&
- !unpaidFlow &&
- SelectedTableDetails?.length !== 0 && (
- <>
-
- {' '}
-
- FirstPaymentclick === false && !addnewAccess
- ? changeOrderStatus()
- : ''
- }
- />
-
- {FirstPaymentclick === false &&
- !addnewAccess &&
- !OrderStatus &&
}
- >
- )}
-
- )}
- {!OtherServicesglobal && (
-
- {tableOptions?.map((item) => (
- <>
- {unpaidFlow == false
- ? item?.OptionName == 'Hold' &&
- BookingType !== 'Dine In' &&
- !BookingTypeBoth &&
- OrderCardDetail?.length != 0 &&
- OrderType != 'Failed' &&
- CheckBookingStatus != 'Close' &&
- paybtns?.length > 0 &&
- !addnewAccess && (
-
- {' '}
- AddBookingDetails('Hold')}
- style={{
- fontSize: '30px',
- cursor: 'pointer',
- color: '' ? '#52c41a' : '#1292EE',
- }}
- />
-
- )
- : ''}
-
- {unpaidFlow == false
- ? item?.OptionName == 'Hold' &&
- BookingType !== 'Dine In' &&
- !BookingTypeBoth &&
- Holddata?.length > 0 &&
- OrderCardDetail?.length == 0 &&
- CheckBookingStatus != 'Close' &&
- paybtns?.length > 0 &&
- !addnewAccess &&
- !OtherServicesglobal && (
-
- {' '}
-
- HandleholdModelOpen()}
- style={{
- fontSize: '28px',
- cursor: 'pointer',
- color: Holddata ? '#52c41a' : 'default',
- pointerEvents:
- OrderType === 'Failed' ? 'none' : 'auto',
- }}
- />
-
-
- )
- : ''}
- >
- ))}
-
- )}
-
-
-
- 0) &&
- !unpaidFlow &&
- OrderStatus
- ? 'none'
- : 'auto',
- opacity:
- (BookingType === 'Dine In' ||
- BookingTypeBoth ||
- CheckOrderType?.length > 0) &&
- !unpaidFlow &&
- OrderStatus
- ? 0.5
- : 1,
- }}
- >
- {paybtns?.length > 0 &&
- currentOrderNetAmount >= previousNetAmount ? (
- paybtns?.map((payment) => (
-
-
- payment?.ModeName?.toLowerCase() === 'upi' // Change the condition to payment.Id
- ? handleUPIButtonClick(
- payment.ModeId,
- payment.ModeName
- )
- : handlePaymentMode(
- payment.ModeId,
- payment.ModeName
- )
- }
- >
- {/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && UPI
} */}
-
-
- {payment.ModeName}
- {payment?.ModeName?.toLowerCase() === 'card' && (
-
- )}
- {payment?.ModeName?.toLowerCase() === 'upi' && (
-
- )}
-
-
-
- ))
- ) : currentOrderNetAmount < previousNetAmount &&
- salesBillEdit &&
- refundPayBtns.length > 0 ? (
- refundPayBtns.map((payment) => (
-
-
- handleRefundPaymentMode(
- payment?.ConfigId,
- payment?.ConfigName
- )
- }
- >
- {/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && UPI
} */}
-
-
- {payment.ConfigName}
-
-
-
- ))
- ) : (
-
- Please Set Payment Options
-
- )}
-
-
- {PrintOrderDetails?.length > 0 && (
-
- {filteredSettingNames?.includes('whatsapp') &&
- MobileNoWhatsApp?.value && (
-
- )}
-
-
-
- {filteredSettingNames?.includes('SMS') && isMobile && (
-
- )}
- {/* WhatsAppShare modal/component */}
- {showWhatsAppShare && (
- closePrintOption(false)}
- />
- )}
- {showSMSShare && isMobile && (
- closePrintOption(false)}
- />
- )}
-
- )}
-
-
-
-
-
-
-
-
-
- Items:
-
-
- {TotalItems}
-
-
-
-
-
- Qty:
-
-
- {Qty}
-
-
-
-
-
- {!OtherServicesglobal &&
- OrderCardDetail?.length > 0 &&
- ParkingDisplay && (
-
-
-
- )}
-
- {' '}
- {!OtherServicesglobal && unpaidFlow == true ? (
-
- {' '}
- {
- Recipt();
- }}
- />
-
- ) : (
- ''
- )}
-
-
-
-
-
-
-
- {/*
- {" "}
-
- */}
-
- >
- }
- trigger="click"
- // width={1000}
- open={open}
- onOpenChange={handleOpenChange}
- >
-
-
-
-
-
-
-
- 0 &&
- paybtnselected &&
- CheckBookingStatus != 'Close'
- ? !OrderStatus
- ? salesBillEdit &&
- currentOrderNetAmount < previousNetAmount
- ? 'Table4-Btn-final-price'
- : 'Table4-Btn-final-price'
- : 'Table4-Btn-final-price Order'
- : 'Table4-Btn-final-price-disabled'
- }
- // onClick={() => {
- // // AddBookingDetails(BookingType, true);
- // (qrCode && SelectedUPIPayOption === "Default") ? UpiPayment() : OrderStatus ? AddBookingDetails("Dine-In") : AddBookingDetails(BookingType, true);
- // }}
- onClick={
- // BranchFinancialStatus==='N'? financialYearError:
- handleButtonClick
- }
- >
- {!OrderStatus ? (
- salesBillEdit &&
- currentOrderNetAmount < previousNetAmount ? (
-
- Refund: ₹
- {(previousNetAmount || 0) -
- (currentOrderNetAmount || 0)}
-
- ) : (
- <>
-
-
AddBookingDetails(BookingType, true)}
- >
- {/* ₹ {Math.round(TotalAmount)} */}
- {isMobile ? (
- `₹ ${safeRound(
- OrderType === 'Failed'
- ? FailedTotalAmt
- : credit && overAllBal >= 0
- ? Math.max(0, TotalAmount - overAllBal)
- : TotalAmount
- )}`
- ) : (
-
- ₹{' '}
- = 0
- ? Math.max(
- 0,
- TotalAmount - overAllBal
- )
- : TotalAmount
- )}
- />
-
- )}
-
-
-
-
-
- >
- )
- ) : (
- ORDER
- )}
-
-
-
- {PrintOrderDetails?.length > 0 &&
- PrintOrderDetails?.[0]?.OrderDetails?.map(
- (orderDetail, index) => (
-
- )
- )}
- {PrintOrderDetails?.length > 0 &&
- (TokenOnly?.SettingValue === 'Y' ||
- IndividualToken?.SettingValue === 'Y') &&
- PrintOrderDetails?.[0]?.OrderDetails?.map(
- (orderDetail, index) => (
-
-
-
- )
- )}
- {CreditCustomer && (
-
- {
- handleCreditCustomer('Cancel');
- }}
- handleOk={() => {
- handleCreditCustomer('Submit');
- }}
- />
-
- )}
-
-
-
-
-
{
- Upimodel('Cancel');
- }}
- footer={false}
- children={
-
- {/*
UPI PAYMENT */}
-
-
-
-
-
-
-
-
- {' '}
- RS :
- {OrderType === 'Failed'
- ? FailedTotalAmt
- : Math.round(TotalAmount)}{' '}
-
-
-
-
-
- {(selOption || SelCustId) && (
-
- Sent Payment Link
-
- {/*
*/}
-
- )}
-
-
- }
- handleSubmit={() => {
- Upimodel('Submit');
- }}
- />
-
-
-
- }
- />
- {
- setOtherServicesModal(false);
- }}
- // handleSubmit={Handlevehiclenumbers}
- footer={false}
- children={
-
- {OrderCardDetail.map((item, i) => {
- const isGroup = item.ServiceType === 'G';
- const groupKey = item.id; // 🔁 using `id` for groups now
- const uniqueKey = `${item.ServiceId}__${item.__index}`;
-
- // For G-type: render input only once for the group
- if (
- isGroup &&
- i !== OrderCardDetail.findIndex((o) => o.id === groupKey)
- ) {
- return null;
- }
-
- const qty = isGroup
- ? OrderCardDetail.filter((o) => o.id === groupKey).reduce(
- (sum, o) => sum + (o.OrderQty || 1),
- 0
- )
- : item.OrderQty || 1;
-
- return (
-
-
{item.ServiceName}
-
- {Array.from({ length: qty }).map((_, index) => {
- const inputKey = isGroup
- ? item.id
- : `${item.ServiceId}__${item.__index}`;
- const value = vehicleInputs[inputKey]?.[index] || '';
- const error = errors[inputKey]?.[index] || '';
-
- return (
-
-
- handleInputChange(
- isGroup ? item.id : item.ServiceId,
- index,
- e.target.value,
- item.ServiceType,
- item
- )
- }
- onKeyPress={(e) => {
- if (!/[A-Za-z0-9]/.test(e.key)) {
- e.preventDefault();
- }
- }}
- style={{
- width: '100%',
- padding: 8,
- borderRadius: 4,
- border: error ? '1px solid red' : '1px solid #ccc',
- }}
- />
- {error && (
-
- {error}
-
- )}
-
- );
- })}
-
- );
- })}
-
-
- Submit
-
-
-
- }
- />
- {
- setUnpaidOpen(false);
- }}
- footer={false}
- children={
-
- }
- />
- {UnpaidConfirmation && (
-
-
- You have already selected a table. If you click 'OK,' the table
- selection will be removed, and the unpaid flow will continue. If
- you click 'Cancel,' the dine-in flow will proceed as selected.
-
- >
- }
- onOk={UnpaidOk}
- onCancel={Unpaidclose}
- />
- )}
- {Splitpayment && (
- data?.TotalAmt + acc,
- 0
- ) -
- ((OverAllSales > 0 ? OverAllSales : 0) +
- (OverAllEstimate > 0 ? OverAllEstimate : 0) +
- (Discount > 0 ? Discount : 0))
- )
- }
- failedOrderData={failedOrderData}
- />
- )}
- {
- dispatch(changeSalesPaymentoption(false));
- }}
- footer={false}
- children={
-
- }
- />
-
- {
- OtherServicesPrintDetails?.length > 0 && (
- // PrintOrderDetails?.[0]?.OrderDetails?.map((orderDetail, index) => (
-
-
-
- )
- // ))
- }
-
- {
- setOtherServicesModal(false);
- }}
- handleSubmit={Handlevehiclenumbers}
- footer={true}
- children={
-
- {OrderCardDetail.map((item, i) => {
- const isGroup = item.ServiceType === 'G';
- const groupKey = item.id; // 🔁 using `id` for groups now
- const uniqueKey = `${item.ServiceId}__${item.__index}`;
-
- // For G-type: render input only once for the group
- if (
- isGroup &&
- i !== OrderCardDetail.findIndex((o) => o.id === groupKey)
- ) {
- return null;
- }
-
- const qty = isGroup
- ? OrderCardDetail.filter((o) => o.id === groupKey).reduce(
- (sum, o) => sum + (o.OrderQty || 1),
- 0
- )
- : item.OrderQty || 1;
-
- return (
-
-
{item.ServiceName}
-
- {Array.from({ length: qty }).map((_, index) => {
- const inputKey = isGroup
- ? item.id
- : `${item.ServiceId}__${item.__index}`;
- const value = vehicleInputs[inputKey]?.[index] || '';
- const error = errors[inputKey]?.[index] || '';
-
- return (
-
-
- handleInputChange(
- isGroup ? item.id : item.ServiceId,
- index,
- e.target.value,
- item.ServiceType,
- item
- )
- }
- style={{
- width: '100%',
- padding: 8,
- borderRadius: 4,
- border: error ? '1px solid red' : '1px solid #ccc',
- }}
- />
- {error && (
-
- {error}
-
- )}
-
- );
- })}
-
- );
- })}
-
- }
- />
- setShowCancelConfirm(true)}
- footer={false}
- width={500}
- children={
- <>
-
- >
- }
- />
- {showCancelConfirm && (
- {
- setBusinessUPI(false);
- setShowCancelConfirm(false);
- ClearAllGlobalStateDatas();
- CustomerDisplay();
- }}
- onCancel={() => setShowCancelConfirm(false)}
- okText="Yes"
- cancelText="No"
- >
- Do you want to cancel the payment?
-
- )}
- {customerPreviesOrders && (
- setCustomerPreviesOrders(false)}
- footer={false}
- width={700}
- className={'ModalPaymentGatewayEmbedded'}
- children={
- <>
- setCustomerPreviesOrders(false)}
- />
- >
- }
- />
- )}
-
- );
-};
-export default BSBilling7Payment;
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7.jsx
deleted file mode 100644
index 8727990..0000000
--- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7.jsx
+++ /dev/null
@@ -1,3171 +0,0 @@
-import React, { lazy, useEffect, useState } from 'react';
-import { useDispatch, useSelector } from 'react-redux';
-import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7.scss';
-import {
- getTemplateData,
- SelectedGlobalBillingColorDetail,
- SelectedGlobalBillingFont,
-} from '../../../../../Features/ThemeChange/ThemeChange';
-import { Tooltip } from 'antd';
-import {
- GlobalBookingType,
- GlobalHoldOrderDtl,
- GlobalOrderCardDetails,
- GlobalPreviousOrderLength,
- GlobalUnpaidData,
- changeOrderCardDetails,
- changeReorderHoldDetails,
- changeBookingType,
- changeSelectedOption,
- GlobalSelProdWiseEst,
- GlobalBookingTypeBoth,
- GlobalOrderType,
- changeAllProductTokenAvailable,
- changeTokenOnly,
- changeOrderType,
- changeReorderProductDetails,
- changeSelectedCustId,
- changeCustomerID,
- ChangeNavHoldData,
- PreferenceData,
- GlobalEstimateBooking,
- ChangeOverAllDiscSales,
- ChangeOverAllDiscEstimate,
- changeSelProdWiseEst,
- changeUnpaidData,
- GlobalOtherSevices,
- GlobalDefaultBookingType,
- GlobalCustId,
- GlobalSelOption,
- changeBillEditingMode,
- changePreviousOrderPayment,
- changePreviousOrderOfferDetail,
- ChangeSelectedCustDisable,
-} from '../../../../../Features/BookingScreen/BookingData/BookingData';
-import {
- ChangeFullFreeProductList,
- changeFullOfferAppliedProducts,
- ClearOfferAppliedProducts,
- GlobalFreeProdList,
- GlobalOfferAppliedProducts,
-} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
-
-const BSBillingEditQuantity = lazy(
- () => import('../BSBillingEditQuantity/BSBillingEditQuantity')
-);
-import {
- ChangeTotalAmount,
- globalExtraTotalAmount,
-} from '../../../../../Features/ExteraCharges/ExtraCharges';
-import WebFont from 'webfontloader';
-import { isMobile } from 'react-device-detect';
-import dineInIcon from '../../../../../Images/Dine In.svg';
-import TakeAwayIcon from '../../../../../Images/Take away.svg';
-import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
-import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
-const BSEditTotalAmt = lazy(
- () => import('../BSEditTotalAmount/BSEditTotalAmt.jsx')
-);
-const BSImeiDetails = lazy(() => import('../BSImeiDetails/BSImeiDetails.jsx'));
-const CustomerPriceHistory = lazy(
- () => import('../../UtillComponents/CustomerPriceHistory.jsx')
-);
-import { useUtilsComponent } from '../../../../../Services/utils.js';
-
-const BSBillingTable7 = () => {
- const { removeExtraCharge } = useUtilsComponent();
- const dispatch = useDispatch();
-
- const preferenceDatas = useSelector(PreferenceData);
- const preferenceOffer =
- preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
- (item) => item.SettingIdName === 'Offer'
- )?.SettingValue === 'Y';
- const applyOffer = useApplyOfferto_CardDetail();
- const SelectedBillColor = useSelector(SelectedGlobalBillingColorDetail);
- const SelectedFont = useSelector(SelectedGlobalBillingFont);
- const tableData = useSelector(GlobalOrderCardDetails);
- const GlobalOfferAppliedProductsData = useSelector(
- GlobalOfferAppliedProducts
- );
- const OfferFreeProduct = useSelector(GlobalFreeProdList);
- const templateData = useSelector(getTemplateData);
- const allowDecimal = preferenceDatas?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'decimal' &&
- setting?.SettingValue === 'Y'
- );
- const tableOptions = templateData?.BookingBilling?.[1];
- const OfferCheckedInSetup = templateData?.BookingNavbar?.[1].some(
- (item) => item?.OptionName == 'Offer'
- );
- const BookingType = useSelector(GlobalBookingType);
- const defaultBookingType = useSelector(GlobalDefaultBookingType);
- const GetCustId = useSelector(GlobalCustId);
- const selectedCustomer = useSelector(GlobalSelOption);
-
- const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] =
- useState(false);
- const [customerProduct, setCustomerProduct] = useState(null);
- const [EditQuantity, setEditQuantity] = useState(false);
- const [Modaldata, setModaldata] = useState([]);
- const [editdelete, seteditdelete] = useState('');
- const [PreviousdataLength, setPreviousdataLength] = useState();
- const [triggerAnimation, setTriggerAnimation] = useState(true);
- const PreviousOrderLength = useSelector(GlobalPreviousOrderLength);
- const HoldOrderDtl = useSelector(GlobalHoldOrderDtl);
- const UnpaidData = useSelector(GlobalUnpaidData);
- const GlobProdwisedata = useSelector(GlobalSelProdWiseEst);
- const [editField, setEditField] = useState(false);
- const [deleteField, setDeleteField] = useState(false);
- const [Index, setIndex] = useState(null);
- const [shortKeyMethod, setshortKeyMethod] = useState(null);
-
- const BillOrderPre = preferenceDatas?.[0]?.SettingDtlDetails?.find(
- (item) => item.SettingIdName === 'BillItemsOrder'
- )?.SettingValue;
- const BookingTypeBoth = useSelector(GlobalBookingTypeBoth);
- const OrderType = useSelector(GlobalOrderType);
- const GlobEstBooking = useSelector(GlobalEstimateBooking);
- const [OpenImeiDetail, setOpenImeiDetail] = useState(false);
- const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
- const OtherServicesglobal = useSelector(GlobalOtherSevices);
-
- const [OpenEditTotalAmt, setOpenEditTotalAmt] = useState(false);
- const tableDataDinein = tableData?.filter(
- (a, b) => a.BookingTypeName === 'Dine In' && !a?.SalesId
- );
- const tableDataTakeAway =
- OrderType === 'Hold'
- ? tableData?.filter((a, b) => a.BookingTypeName === 'TakeAway')
- : tableData?.filter(
- (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
- )
- : [];
- const productBasedExtraCharges = GlobalExtraCharge.filter(
- (obj) => 'ProdName' in obj
- );
- const preferenceshortcutkey = preferenceDatas?.[0]?.SettingDtlDetails?.find(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'shortcutkeys' &&
- setting?.SettingValue === 'Y'
- );
- const imeiModal = preferenceDatas?.[0]?.SettingDtlDetails?.some(
- (setting) =>
- setting?.SettingIdName?.toLowerCase() === 'imeidetails' &&
- setting?.SettingValue === 'Y'
- );
- useEffect(() => {
- if (SelectedFont) {
- WebFont.load({
- google: {
- families: [SelectedFont], // Load the selected font
- },
- });
- }
- }, [SelectedFont]);
- useEffect(() => {
- const handleKeyDown = (e) => {
- if (e.ctrlKey && e.key.toLowerCase() === 'i') {
- e.preventDefault();
-
- const prodId = tableData?.[0]?.ProdId;
-
- if (GetCustId && prodId) {
- setCustomerPriceHistoryOpen(true);
- setCustomerProduct(prodId);
- }
- }
- };
-
- window.addEventListener('keydown', handleKeyDown);
-
- return () => {
- window.removeEventListener('keydown', handleKeyDown);
- };
- }, [GetCustId, tableData]);
- useEffect(() => {
- if (tableData?.length === 0) {
- dispatch(ClearOfferAppliedProducts());
- }
- // setTriggerAnimation(true);
- if (!isMobile) {
- const customerDisplayWindow = getCustomerDisplayWindow();
- console.log('customerDisplayWindowtableData', customerDisplayWindow);
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedData = {
- userData: tableData,
- };
- customerDisplayWindow.postMessage(updatedData, '*');
- }
-
- const timer = setTimeout(() => {
- setTriggerAnimation(false);
- }, 400);
-
- return () => clearTimeout(timer);
- }
- }, [tableData]);
- useEffect(() => {
- if (tableOptions?.length > 0) {
- let editFieldValue = tableOptions?.filter(
- (item) => item.OptionName == 'Edit'
- );
- if (editFieldValue?.length > 0) {
- setEditField(true);
- } else {
- setEditField(false);
- }
- let DeleteFieldValue = tableOptions?.filter(
- (item) => item.OptionName == 'Delete'
- );
- if (DeleteFieldValue?.length > 0) {
- setDeleteField(true);
- } else {
- setDeleteField(false);
- }
- }
- }, [tableOptions]);
-
- useEffect(() => {
- setPreviousdataLength(PreviousOrderLength);
- }, [PreviousOrderLength]);
-
- useEffect(() => {
- if (!preferenceshortcutkey) return;
- const getSelectedItem = () => {
- const getItem = (data = []) => {
- if (!data.length) return null;
- return BillOrderPre === 'Y' ? data[0] : data[data.length - 1];
- };
-
- if (tableDataTakeAway?.length > 0) {
- return getItem(tableDataTakeAway);
- } else if (tableDataDinein?.length > 0) {
- return getItem(tableDataDinein);
- }
- return null;
- };
-
- const handleShortcut = (method) => {
- const item = getSelectedItem();
- if (!item) return;
-
- handleEditQuantity(item);
- setshortKeyMethod(method);
- };
-
- const handleKeyDown = (event) => {
- const key = event.key.toLowerCase();
- // 👉 ALT + P → Open Edit Total Amount
- if (event.altKey && key === 'p') {
- event.preventDefault();
- if (tableData?.length > 0) {
- OpenEditTotalAmount();
- }
- return;
- }
- if (!event.ctrlKey) return;
- if (key === 'q') {
- event.preventDefault();
- handleShortcut('qty');
- } else if (key === 'e') {
- event.preventDefault();
- handleShortcut('price');
- } else if (key === 'y') {
- event.preventDefault();
- handleShortcut('Parcel');
- } else if (key === 'b') {
- event.preventDefault();
- handleShortcut('weightAmount');
- }
- };
- window.addEventListener('keydown', handleKeyDown);
-
- return () => {
- window.removeEventListener('keydown', handleKeyDown);
- };
- }, [preferenceshortcutkey, tableDataTakeAway, tableDataDinein, BillOrderPre]);
-
- const handleImeiDetails = (value) => {
- setOpenImeiDetail(true);
- setModaldata(value);
- };
- const handleImeiDetailClose = () => {
- setOpenImeiDetail(false);
- };
- const calculateAmounts = (
- OrderQty,
- OrderRate,
- TaxPercentage,
- IsPaid = true
- ) => {
- const total = OrderQty * OrderRate;
-
- const withoutTax = total - (total * TaxPercentage) / (100 + TaxPercentage);
-
- return {
- TotalAmt: total,
- ...(IsPaid && { Offer: total }),
- WithoutTaxRate: +withoutTax.toFixed(2),
- };
- };
-
- const ChangeOrderCardDetailsFn = async ({
- OrderQty,
- InwardDtlId,
- Offer,
- CompleteRemove = false,
- RemoveAndUpdate = false,
- BuyInwardDtlId,
- BuyProdQty,
- UpdateBuyAndFree = false,
- CompleteRemoveBuyAndAddWithPaid = false,
- CompleteRemoveconvertFreetoPaid = false,
- CompleteRemoveconvertFreetoPaidTwoTypes = false,
- CompleteRemoveconvertFreetoPaidNotCompletely = false,
- CompleteRemoveAndPaidToFreeOtherType = false,
- CompleteRemoveAndPaidToFreeOtherTypeWithoutMerge = false,
- RemoveAndUpdateOtherBookingType = false,
- BookingTypeName,
- OrderRate,
- }) => {
- let ModifiedOrderCardDetail = JSON.parse(JSON.stringify(tableData));
-
- if (RemoveAndUpdate) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === InwardDtlId &&
- e?.Offer === Offer &&
- e?.BookingTypeName === BookingTypeName
- )
- )?.map((e) => {
- if (
- e?.InwardDtlId == InwardDtlId &&
- e?.Offer > 0 &&
- e?.BookingTypeName === BookingTypeName
- ) {
- const newQty = OrderQty;
- return {
- ...e,
- OrderQty: newQty,
- ...calculateAmounts(newQty, e.OrderRate, e.TaxPercentage),
- };
- }
-
- if (e?.InwardDtlId == BuyInwardDtlId) {
- return {
- ...e,
- OrderQty: BuyProdQty,
- ...calculateAmounts(
- BuyProdQty,
- e.OrderRate,
- e.TaxPercentage,
- false
- ),
- };
- }
-
- return e;
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
- if (RemoveAndUpdateOtherBookingType) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === InwardDtlId &&
- e?.Offer === Offer &&
- e?.BookingTypeName === BookingTypeName
- )
- )?.flatMap((e) => {
- if (
- e?.InwardDtlId == InwardDtlId &&
- e?.Offer > 0 &&
- e?.BookingTypeName === BookingTypeName
- ) {
- const newQty = e?.OrderQty - BuyProdQty;
-
- return {
- ...e,
- OrderQty: newQty,
- ...calculateAmounts(newQty, e.OrderRate, e.TaxPercentage),
- };
- }
- if (
- e?.InwardDtlId == InwardDtlId &&
- e?.Offer == 0 &&
- e?.BookingTypeName !== BookingTypeName
- ) {
- const newQty = e?.OrderQty - BuyProdQty;
-
- let first = {
- ...e,
- OrderQty: BuyProdQty,
- ...calculateAmounts(BuyProdQty, e.OrderRate, e.TaxPercentage),
- };
- if (newQty > 0) {
- let second = {
- ...e,
- Offer: 0,
- OrderQty: newQty,
- ...calculateAmounts(newQty, e.OrderRate, e.TaxPercentage, false),
- };
- return [first, second];
- }
- return [first];
- }
-
- if (e?.InwardDtlId == BuyInwardDtlId) {
- return {
- ...e,
- OrderQty: BuyProdQty,
- ...calculateAmounts(
- BuyProdQty,
- e.OrderRate,
- e.TaxPercentage,
- false
- ),
- };
- }
-
- return e;
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
- if (CompleteRemove) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === InwardDtlId &&
- e?.Offer === Offer &&
- e?.BookingTypeName === BookingTypeName &&
- e?.OrderRate == OrderRate
- )
- );
- return dispatch(changeOrderCardDetails(data));
- }
- if (CompleteRemoveAndPaidToFreeOtherType) {
- let data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === InwardDtlId &&
- e?.Offer === Offer &&
- e?.BookingTypeName === BookingTypeName
- )
- )?.flatMap((exp) => {
- // Same product but different booking type and not an offer
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer == 0 &&
- exp?.BookingTypeName !== BookingTypeName
- ) {
- const remainingQty = exp.OrderQty - OrderQty;
-
- if (remainingQty === 0) {
- return {
- ...exp,
- OfferMode: 'B',
- ...calculateAmounts(
- exp.OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- true
- ),
- };
- }
-
- if (remainingQty > 0) {
- return [
- {
- ...exp,
- OrderQty: remainingQty,
- ...calculateAmounts(
- remainingQty,
- exp.OrderRate,
- exp.TaxPercentage,
- false
- ),
- },
- {
- ...exp,
- OrderQty: OrderQty,
- Offer: 0,
- OfferMode: 'B',
- ...calculateAmounts(
- OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- true
- ),
- },
- ];
- }
- }
-
- return exp;
- });
-
- // ===== Merge duplicates for free offers =====
- const mergedData = [];
- data?.forEach((item) => {
- if (item?.OfferMode === 'B') {
- // Check if a free item already exists for this product + booking type
- const existingIndex = mergedData.findIndex(
- (e) =>
- e.InwardDtlId === item.InwardDtlId &&
- e.BookingTypeName === item.BookingTypeName &&
- e.OfferMode === 'B'
- );
-
- if (existingIndex > -1) {
- // Merge quantities
- const existing = mergedData[existingIndex];
- const newQty = existing.OrderQty + item.OrderQty;
- mergedData[existingIndex] = {
- ...existing,
- OrderQty: newQty,
- ...calculateAmounts(
- newQty,
- item.OrderRate,
- item.TaxPercentage,
- true
- ),
- };
- } else {
- mergedData.push(item);
- }
- } else {
- mergedData.push(item);
- }
- });
-
- return dispatch(changeOrderCardDetails(mergedData));
- }
- if (CompleteRemoveAndPaidToFreeOtherTypeWithoutMerge) {
- let data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === InwardDtlId &&
- e?.Offer === Offer &&
- e?.BookingTypeName === BookingTypeName
- )
- )?.flatMap((exp) => {
- // Same product but different booking type and not an offer
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer == 0 &&
- exp?.BookingTypeName !== BookingTypeName
- ) {
- const remainingQty = exp.OrderQty - OrderQty;
-
- if (remainingQty === 0) {
- return {
- ...exp,
- OfferMode: 'B',
- ...calculateAmounts(
- exp.OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- true
- ),
- };
- }
-
- if (remainingQty < 0) {
- return [
- {
- ...exp,
- OrderQty: exp.OrderQty,
- OfferMode: 'B',
- ...calculateAmounts(
- exp.OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- true
- ),
- },
- ];
- }
- }
-
- return exp;
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
-
- if (CompleteRemoveconvertFreetoPaid) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === BuyInwardDtlId &&
- e?.BookingTypeName === BookingTypeName
- )
- )?.map((exp) => {
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer > 0 &&
- exp?.BookingTypeName === BookingTypeName
- ) {
- const { OfferType, OfferMessage, ...exp1 } = exp;
- return {
- ...exp1,
- Offer: 0,
- OrderQty: OrderQty,
- ...calculateAmounts(
- OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- false
- ),
- };
- }
- return exp; // keep unchanged item
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
- if (CompleteRemoveconvertFreetoPaidNotCompletely) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === BuyInwardDtlId &&
- e?.BookingTypeName === BookingTypeName
- )
- )?.flatMap((exp) => {
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer > 0 &&
- exp?.BookingTypeName === BookingTypeName
- ) {
- const { OfferType, OfferMessage, ...exp1 } = exp;
- let first = {
- ...exp1,
- Offer: 0,
- OrderQty: BuyProdQty,
- ...calculateAmounts(
- OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- false
- ),
- };
- if (BuyProdQty < OrderQty) {
- let second = {
- ...exp1,
- Offer: 0,
- OrderQty: exp1?.OrderQty - BuyProdQty,
- ...calculateAmounts(
- exp1?.OrderQty - BuyProdQty,
- exp.OrderRate,
- exp.TaxPercentage,
- true
- ),
- };
- return [first, second];
- }
- return [first];
- }
- return exp; // keep unchanged item
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
- if (CompleteRemoveBuyAndAddWithPaid) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- (e?.InwardDtlId === BuyInwardDtlId &&
- e?.BookingTypeName === BookingTypeName) ||
- (e?.InwardDtlId == InwardDtlId &&
- e?.Offer > 0 &&
- e?.BookingTypeName === BookingTypeName)
- )
- )?.map((exp) => {
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer == 0 &&
- exp?.BookingTypeName === BookingTypeName
- ) {
- return {
- ...exp, // keep existing fields
- OrderQty: OrderQty,
- ...calculateAmounts(
- OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- false
- ),
- };
- }
- return exp; // keep unchanged item
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
-
- if (UpdateBuyAndFree) {
- const data = ModifiedOrderCardDetail?.map((e) => {
- if (
- e?.InwardDtlId == InwardDtlId &&
- e?.Offer > 0 &&
- e?.BookingTypeName === BookingTypeName
- ) {
- const newQty = e?.OrderQty + OrderQty;
- return {
- ...e,
- OrderQty: newQty,
- ...calculateAmounts(newQty, e.OrderRate, e.TaxPercentage),
- };
- }
- if (e?.InwardDtlId == InwardDtlId && e?.Offer == Offer) {
- const newQty = e?.OrderQty - OrderQty;
- return {
- ...e,
- OrderQty: newQty,
-
- ...calculateAmounts(newQty, e.OrderRate, e.TaxPercentage, false),
- };
- }
-
- if (
- e?.InwardDtlId == BuyInwardDtlId &&
- e?.BookingTypeName === BookingTypeName
- ) {
- return {
- ...e,
- OrderQty: BuyProdQty,
- ...calculateAmounts(
- BuyProdQty,
- e.OrderRate,
- e.TaxPercentage,
- false
- ),
- };
- }
-
- return e;
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
-
- if (CompleteRemoveconvertFreetoPaidTwoTypes) {
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === BuyInwardDtlId &&
- e?.BookingTypeName === BookingTypeName
- )
- )?.flatMap((exp) => {
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer > 0 &&
- exp?.BookingTypeName === BookingTypeName
- ) {
- const { OfferType, OfferMessage, ...exp1 } = exp;
- return {
- ...exp1,
- Offer: 0,
- OrderQty: OrderQty,
- ...calculateAmounts(
- OrderQty,
- exp.OrderRate,
- exp.TaxPercentage,
- false
- ),
- };
- }
- if (
- exp?.InwardDtlId == InwardDtlId &&
- exp?.Offer > 0 &&
- exp?.BookingTypeName !== BookingTypeName
- ) {
- const { ...exp1 } = exp;
- let first = {
- ...exp1,
- // Offer: 0,
- OrderQty: exp1?.OrderQty - BuyProdQty,
- ...calculateAmounts(
- exp1?.OrderQty - BuyProdQty,
- exp.OrderRate,
- exp.TaxPercentage,
- true
- ),
- };
-
- let second = {
- ...exp1,
- Offer: 0,
- OrderQty: BuyProdQty,
- ...calculateAmounts(
- BuyProdQty,
- exp.OrderRate,
- exp.TaxPercentage,
- false
- ),
- };
- delete second?.OfferMessage;
- delete second?.OfferType;
- return [first, second];
- }
- return exp; // keep unchanged item
- });
-
- return dispatch(changeOrderCardDetails(data));
- }
- // Update qty for normal case
-
- const data = ModifiedOrderCardDetail?.map((e) => {
- if (
- e?.InwardDtlId == InwardDtlId &&
- e?.Offer == Offer &&
- e?.BookingTypeName === BookingTypeName
- ) {
- return {
- ...e,
- OrderQty,
- ...calculateAmounts(OrderQty, e.OrderRate, e.TaxPercentage, false),
- };
- }
- return e;
- });
-
- dispatch(changeOrderCardDetails(data));
- };
-
- const ChangeFreeprodlistFn = async ({
- FreeProdId,
- OfferId,
- OverAllFreeQty,
- RemainingQty,
- FreeQty,
- CompleteRemove = false,
- }) => {
- const deepCopy = JSON.parse(JSON.stringify(OfferFreeProduct));
-
- let ModifyedData;
-
- if (CompleteRemove) {
- // 🔹 Remove the matching FreeProd completely
- ModifyedData = deepCopy?.filter(
- (exp) => !(exp?.OfferId == OfferId && exp?.FreeProdId == FreeProdId)
- );
- } else {
- // 🔹 Update the matching FreeProd
- ModifyedData = deepCopy?.map((exp) => {
- if (exp?.OfferId == OfferId && FreeProdId == exp?.FreeProdId) {
- return {
- ...exp,
- OverAllFreeQty,
- RemainingQty,
- FreeQty,
- };
- }
- return { ...exp };
- });
- }
-
- dispatch(ChangeFullFreeProductList(ModifyedData));
- };
-
- const ChangeOfferAppliedProdsFn = async ({
- inwardDtlId,
- OfferAmount,
- FreeQty,
- CompleteRemove = false,
- insideinwardDtlId = false,
- }) => {
- const deepCopy = JSON.parse(JSON.stringify(GlobalOfferAppliedProductsData));
-
- let ModifyedData;
-
- if (CompleteRemove) {
- // 🔹 Remove case
- if (!insideinwardDtlId) {
- ModifyedData = deepCopy?.filter(
- (exp) => exp?.InwardDtlId !== inwardDtlId
- );
- } else {
- ModifyedData = deepCopy?.filter(
- (exp) =>
- !(
- Array?.isArray(exp?.FreeProductsList)
- ? exp?.FreeProductsList
- : [exp?.FreeProductsList]
- )?.some((freeProd) =>
- freeProd?.ProdVariantDetails?.some((variant) =>
- variant?.StockDetails?.some(
- (stock) => stock?.FreeInwardDtlId === inwardDtlId
- )
- )
- )
- );
- }
- } else {
- // 🔹 Update case
- ModifyedData = deepCopy?.map((exp) => {
- let shouldUpdate = false;
-
- if (!insideinwardDtlId) {
- shouldUpdate = exp?.InwardDtlId == inwardDtlId;
- } else {
- shouldUpdate = (
- Array?.isArray(exp?.FreeProductsList)
- ? exp?.FreeProductsList
- : [exp?.FreeProductsList]
- )?.some((freeProd) =>
- freeProd?.ProdVariantDetails?.some((variant) =>
- variant?.StockDetails?.some(
- (stock) => stock?.FreeInwardDtlId === inwardDtlId
- )
- )
- );
- }
-
- if (shouldUpdate) {
- return {
- ...exp,
- OfferAmount,
- ActualFreeQty: FreeQty,
- FreeProductsList: (Array?.isArray(exp?.FreeProductsList)
- ? exp?.FreeProductsList
- : [exp?.FreeProductsList]
- )?.map((item, idx) =>
- idx === 0
- ? {
- ...item,
- FreeQty,
- }
- : item
- ),
- };
- }
-
- return { ...exp };
- });
- }
-
- dispatch(changeFullOfferAppliedProducts(ModifyedData));
- };
-
- const removeFromCart = async (item) => {
- removeExtraCharge(item);
- setPreviousdataLength(tableData?.length);
-
- let ischeckBothBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer > 0 &&
- e?.BookingTypeName != item?.BookingTypeName
- );
- if (tableData?.length <= 1) {
- await dispatch(changeReorderHoldDetails({}));
- await dispatch(changeReorderProductDetails([]));
- await dispatch(changeUnpaidData(false));
- await dispatch(changeBookingType('TakeAway'));
- await dispatch(changeTokenOnly(false));
- await dispatch(ChangeTotalAmount([]));
- await dispatch(changeAllProductTokenAvailable(false));
- await dispatch(ChangeOverAllDiscSales(null));
- await dispatch(ChangeOverAllDiscEstimate(null));
- await dispatch(changeSelProdWiseEst([]));
- dispatch(changeBillEditingMode(false));
- await dispatch(changePreviousOrderPayment([]));
- await dispatch(changePreviousOrderOfferDetail([]));
- await dispatch(changeSelectedOption(null));
- await dispatch(ChangeSelectedCustDisable(false));
- }
- if (item?.Offer > 0) {
- //check is Buyxgetx Or something
- // let ischeck= GlobalOfferAppliedProductsData?.some((e)=>e?.FreeProductsList?.[0]??.
- const isBuyAndGetX =
- GlobalOfferAppliedProductsData?.find((data) =>
- (Array?.isArray(data?.FreeProductsList)
- ? data?.FreeProductsList
- : [data?.FreeProductsList]
- )?.some((freeProd) =>
- freeProd?.ProdVariantDetails?.some((variant) =>
- variant?.StockDetails?.some(
- (stock) => stock?.FreeInwardDtlId === item?.InwardDtlId
- )
- )
- )
- )?.OfferMode == 'B';
-
- const isItemWiseOrQuantityProduct = GlobalOfferAppliedProductsData?.find(
- (data) =>
- data?.ProdId === item?.ProdId &&
- data?.InwardDtlId === item?.InwardDtlId &&
- (data?.OfferMode === 'I' || data?.OfferMode === 'Q') &&
- data?.OfferAmount === item?.Offer
- );
-
- const isCheckFreeProduct = GlobalOfferAppliedProductsData?.find((off) =>
- (Array.isArray(off?.FreeProductsList)
- ? off?.FreeProductsList
- : [off?.FreeProductsList]
- )?.some((prod) =>
- prod?.ProdVariantDetails?.some((variant) =>
- variant?.StockDetails?.some(
- (stock) => stock.FreeInwardDtlId === item?.InwardDtlId
- )
- )
- )
- );
-
- if (isBuyAndGetX) {
- let isPaidproduct = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- item?.BookingTypeName == e?.BookingTypeName
- );
- const isCheckFreeProduct = OfferFreeProduct?.find((exp) =>
- exp?.ProdVariantDetails?.some((variant) =>
- variant?.StockDetails?.some(
- (stock) => stock?.FreeInwardDtlId === item?.InwardDtlId
- )
- )
- );
- if (isPaidproduct) {
- if (isPaidproduct?.OrderQty == item?.OrderQty) {
- //just remove Paid Qty
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidproduct?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: 0,
- OrderRate: isPaidproduct?.OrderRate,
- });
- } else if (isPaidproduct?.OrderQty > item?.OrderQty) {
- // Just Decrease Paid Qty
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidproduct?.OrderQty - item?.OrderQty,
- CompleteRemove: false,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: 0,
- });
- } else if (isPaidproduct?.OrderQty < item?.OrderQty) {
- //just remove Paid Qty
- //decrease FreeQty
-
- if (ischeckBothBookingType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: -isPaidproduct?.OrderQty,
- RemoveAndUpdate: true,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: 0,
- });
-
- await ChangeFreeprodlistFn({
- OverAllFreeQty: isCheckFreeProduct?.OverAllFreeQty,
- RemainingQty:
- isCheckFreeProduct?.OverAllFreeQty -
- (ischeckBothBookingType?.OrderQty + isPaidproduct?.OrderQty),
- FreeQty:
- ischeckBothBookingType?.OrderQty + isPaidproduct?.OrderQty,
- FreeProdId: isPaidproduct?.ProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: isPaidproduct?.InwardDtlId,
- OfferAmount: isPaidproduct?.OrderRate * isPaidproduct?.OrderQty,
- FreeQty: isPaidproduct?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- } else {
- let FreeProdcutinPaidModeOtherBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- item?.BookingTypeName != e?.BookingTypeName
- );
-
- if (FreeProdcutinPaidModeOtherBookingType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: item?.OrderQty - isPaidproduct?.OrderQty,
- OrderQty: item.OrderQty,
- RemoveAndUpdateOtherBookingType: true,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: 0,
- });
-
- await ChangeFreeprodlistFn({
- OverAllFreeQty: item?.OrderQty,
- RemainingQty:
- item?.OrderQty -
- (isPaidproduct?.OrderQty +
- (FreeProdcutinPaidModeOtherBookingType?.OrderQty -
- (item?.OrderQty - isPaidproduct?.OrderQty) ||
- FreeProdcutinPaidModeOtherBookingType?.OrderQty)),
- FreeQty:
- isPaidproduct?.OrderQty +
- (FreeProdcutinPaidModeOtherBookingType?.OrderQty -
- (item?.OrderQty - isPaidproduct?.OrderQty) ||
- FreeProdcutinPaidModeOtherBookingType?.OrderQty),
- FreeProdId: isPaidproduct?.ProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
-
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: isPaidproduct?.InwardDtlId,
- OfferAmount:
- isPaidproduct?.OrderRate *
- (isPaidproduct?.OrderQty +
- (FreeProdcutinPaidModeOtherBookingType?.OrderQty -
- (item?.OrderQty - isPaidproduct?.OrderQty) ||
- FreeProdcutinPaidModeOtherBookingType?.OrderQty)),
- FreeQty:
- isPaidproduct?.OrderQty +
- (FreeProdcutinPaidModeOtherBookingType?.OrderQty -
- (item?.OrderQty - isPaidproduct?.OrderQty) ||
- FreeProdcutinPaidModeOtherBookingType?.OrderQty),
- insideinwardDtlId: true,
- });
- } else {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidproduct?.OrderQty,
- RemoveAndUpdate: true,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: 0,
- });
-
- await ChangeFreeprodlistFn({
- OverAllFreeQty: item?.OrderQty,
- RemainingQty: item?.OrderQty - isPaidproduct?.OrderQty,
- FreeQty: isPaidproduct?.OrderQty,
- FreeProdId: isPaidproduct?.ProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
-
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: isPaidproduct?.InwardDtlId,
- OfferAmount:
- isPaidproduct?.OrderRate * isPaidproduct?.OrderQty,
- FreeQty: isPaidproduct?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- }
- }
- }
- } else {
- if (ischeckBothBookingType) {
- // //Free Product in Paid Mode
- let FreeProdcutinPaidModeOtherBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- item?.BookingTypeName != e?.BookingTypeName
- );
-
- //if free product is available in paid mode in other booking type then just decrease the free qty from that product
- if (FreeProdcutinPaidModeOtherBookingType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: item?.OrderQty,
- CompleteRemoveAndPaidToFreeOtherType: true,
- InwardDtlId: item?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: isCheckFreeProduct?.OverAllFreeQty,
- RemainingQty: isCheckFreeProduct?.OverAllFreeQty,
- FreeQty: isCheckFreeProduct?.FreeQty,
- FreeProdId: isCheckFreeProduct?.FreeProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * Quantity), Quantity, true,)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount: isCheckFreeProduct?.FreeQty * item?.OrderRate,
- FreeQty: item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- } else {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidproduct?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- OrderRate: item?.OrderRate,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: isCheckFreeProduct?.OverAllFreeQty,
- RemainingQty:
- isCheckFreeProduct?.OverAllFreeQty - item?.OrderQty,
- FreeQty: isCheckFreeProduct?.FreeQty - item?.OrderQty,
- FreeProdId: isCheckFreeProduct?.FreeProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * Quantity), Quantity, true,)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- (isCheckFreeProduct?.FreeQty - item?.OrderQty) *
- item?.OrderRate,
- FreeQty: item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- }
- }
-
- // }
- else {
- let isPaidProductAvailableInCartOtherType = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- item?.BookingTypeName != e?.BookingTypeName
- );
-
- if (isPaidProductAvailableInCartOtherType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: item?.OrderQty,
- CompleteRemoveAndPaidToFreeOtherTypeWithoutMerge: true,
- InwardDtlId: item?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: isCheckFreeProduct?.OverAllFreeQty,
- RemainingQty:
- isCheckFreeProduct?.OverAllFreeQty -
- (isCheckFreeProduct?.FreeQty -
- (item?.OrderQty -
- isPaidProductAvailableInCartOtherType?.OrderQty)),
- FreeQty:
- isCheckFreeProduct?.FreeQty -
- (item?.OrderQty -
- isPaidProductAvailableInCartOtherType?.OrderQty),
- FreeProdId: isCheckFreeProduct?.FreeProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * Quantity), Quantity, true,)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- item?.OrderRate *
- (isCheckFreeProduct?.FreeQty -
- (item?.OrderQty -
- isPaidProductAvailableInCartOtherType?.OrderQty)),
- FreeQty:
- isCheckFreeProduct?.FreeQty -
- (item?.OrderQty -
- isPaidProductAvailableInCartOtherType?.OrderQty),
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- } else {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidproduct?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- OrderRate: item?.OrderRate,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: isCheckFreeProduct?.OverAllFreeQty,
- RemainingQty: isCheckFreeProduct?.OverAllFreeQty,
- FreeQty: 0,
- FreeProdId: isCheckFreeProduct?.FreeProdId,
- OfferId: isCheckFreeProduct?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * Quantity), Quantity, true,)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount: item?.OrderRate * item?.OrderQty,
- FreeQty: item?.OrderQty,
- CompleteRemove: true,
- insideinwardDtlId: true,
- });
- }
- }
- }
- } else {
- ///remove item wise offer
- if (isItemWiseOrQuantityProduct) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: item?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- OrderRate: item?.OrderRate,
- });
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount: item?.OrderRate * item?.OrderQty,
- FreeQty: item?.OrderQty,
- CompleteRemove: true,
- });
- } else if (isCheckFreeProduct) {
- // remove or update loyalty/code based free product which is added in cart
- const freeProdList = Array?.isArray(
- isCheckFreeProduct?.FreeProductsList
- )
- ? isCheckFreeProduct?.FreeProductsList?.[0]
- : isCheckFreeProduct?.FreeProductsList;
- let isPaidProductAvailableInCart = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- item?.BookingTypeName == e?.BookingTypeName
- );
- if (isPaidProductAvailableInCart) {
- if (isPaidProductAvailableInCart?.OrderQty === item?.OrderQty) {
- //just remove Paid Qty
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidProductAvailableInCart?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: isPaidProductAvailableInCart?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: 0,
- OrderRate: isPaidProductAvailableInCart?.OrderRate,
- });
- } else if (
- isPaidProductAvailableInCart?.OrderQty > item?.OrderQty
- ) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty:
- isPaidProductAvailableInCart?.OrderQty - item?.OrderQty,
- CompleteRemove: false,
- InwardDtlId: isPaidProductAvailableInCart?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: 0,
- });
- } else if (
- isPaidProductAvailableInCart?.OrderQty < item?.OrderQty
- ) {
- //just remove Paid Qty
- //decrease FreeQty
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: -isPaidProductAvailableInCart?.OrderQty,
- RemoveAndUpdate: true,
- InwardDtlId: isPaidProductAvailableInCart?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: 0,
- });
-
- if (ischeckBothBookingType) {
- await ChangeFreeprodlistFn({
- OverAllFreeQty: freeProdList?.OverAllFreeQty,
- RemainingQty:
- freeProdList?.OverAllFreeQty -
- (ischeckBothBookingType?.OrderQty +
- isPaidProductAvailableInCart?.OrderQty),
- FreeQty:
- ischeckBothBookingType?.OrderQty +
- isPaidProductAvailableInCart?.OrderQty,
- FreeProdId: isPaidProductAvailableInCart?.ProdId,
- OfferId: freeProdList?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: isPaidProductAvailableInCart?.InwardDtlId,
- OfferAmount:
- isPaidProductAvailableInCart?.OrderRate *
- isPaidProductAvailableInCart?.OrderQty,
- FreeQty: isPaidProductAvailableInCart?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- } else {
- await ChangeFreeprodlistFn({
- OverAllFreeQty: item?.OrderQty,
- RemainingQty:
- item?.OrderQty - isPaidProductAvailableInCart?.OrderQty,
- FreeQty: isPaidProductAvailableInCart?.OrderQty,
- FreeProdId: isPaidProductAvailableInCart?.ProdId,
- OfferId: freeProdList?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: isPaidProductAvailableInCart?.InwardDtlId,
- OfferAmount:
- isPaidProductAvailableInCart?.OrderRate *
- isPaidProductAvailableInCart?.OrderQty,
- FreeQty: isPaidProductAvailableInCart?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- }
- }
- } else {
- if (ischeckBothBookingType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidProductAvailableInCart?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- OrderRate: item?.OrderRate,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: freeProdList?.OverAllFreeQty,
- RemainingQty: freeProdList?.OverAllFreeQty - item?.OrderQty,
- FreeQty: freeProdList?.FreeQty - item?.OrderQty,
- FreeProdId: freeProdList?.FreeProdId,
- OfferId: freeProdList?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * Quantity), Quantity, true,)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- (freeProdList?.FreeQty - item?.OrderQty) * item?.OrderRate,
- FreeQty: item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: true,
- });
- } else {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidProductAvailableInCart?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- OrderRate: item?.OrderRate,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: freeProdList?.OverAllFreeQty,
- RemainingQty: freeProdList?.OverAllFreeQty,
- FreeQty: 0,
- FreeProdId: freeProdList?.FreeProdId,
- OfferId: freeProdList?.OfferId,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * Quantity), Quantity, true,)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount: item?.OrderRate * item?.OrderQty,
- FreeQty: item?.OrderQty,
- CompleteRemove: true,
- insideinwardDtlId: true,
- });
- }
- }
- } else {
- let ModifiedOrderCardDetail = JSON.parse(JSON.stringify(tableData));
-
- const data = ModifiedOrderCardDetail?.filter(
- (e) =>
- !(
- e?.InwardDtlId === item?.InwardDtlId &&
- e?.Offer === item?.Offer &&
- e?.BookingTypeName === item?.BookingTypeName &&
- (!e?.SalesId || OrderType == 'Hold')
- )
- );
- return dispatch(changeOrderCardDetails(data));
- }
- }
- } else {
- const isCheckFreeProductOutside = OfferFreeProduct?.find(
- (exp) => exp?.InwardDtlId == item?.InwardDtlId
- );
-
- if (!isCheckFreeProductOutside) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: item?.OrderQty,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- BuyInwardDtlId: null,
- Offer: item?.Offer,
- OrderRate: item?.OrderRate,
- });
- } else {
- const isCheck = GlobalOfferAppliedProductsData?.find(
- (exp) => exp?.InwardDtlId === item?.InwardDtlId
- );
- const FreeProd = OfferFreeProduct?.find(
- (exp) => exp?.InwardDtlId === item?.InwardDtlId
- );
-
- if (isCheck) {
- let inward =
- isCheck?.FreeProductsList?.[0]?.ProdVariantDetails?.[0]
- ?.StockDetails?.[0]?.FreeInwardDtlId;
-
- let isPaidproduct = tableData?.find(
- (e) =>
- e?.InwardDtlId == inward &&
- e?.Offer == 0 &&
- e?.BookingTypeName == item?.BookingTypeName
- );
- if (isPaidproduct) {
- let ischeckBothBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == inward &&
- e?.Offer > 0 &&
- e?.BookingTypeName != item?.BookingTypeName
- );
-
- //if any Paid Product is there, we have to Merge With That
- if (ischeckBothBookingType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty:
- isPaidproduct?.OrderQty +
- isCheck?.ActualFreeQty -
- ischeckBothBookingType?.OrderQty,
- CompleteRemoveBuyAndAddWithPaid: true,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- BuyInwardDtlId: item?.InwardDtlId,
- Offer: item?.Offer,
- });
-
- await ChangeFreeprodlistFn({
- OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
- RemainingQty:
- FreeProd?.OverAllFreeQty -
- item?.OrderQty -
- (FreeProd?.FreeQty - item?.OrderQty),
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: false,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- isPaidproduct?.OrderRate *
- (FreeProd?.FreeQty - item?.OrderQty),
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: false,
- });
- } else {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: isPaidproduct?.OrderQty + isCheck?.ActualFreeQty,
- CompleteRemoveBuyAndAddWithPaid: true,
- InwardDtlId: isPaidproduct?.InwardDtlId,
- BuyInwardDtlId: item?.InwardDtlId,
- Offer: item?.Offer,
- });
-
- await ChangeFreeprodlistFn({
- OverAllFreeQty: item?.OrderQty,
- RemainingQty: item?.OrderQty - isPaidproduct?.OrderQty,
- FreeQty: isPaidproduct?.OrderQty,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: true,
- });
- // await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount: isPaidproduct?.OrderRate * isPaidproduct?.OrderQty,
- FreeQty: isPaidproduct?.OrderQty,
- CompleteRemove: true,
- insideinwardDtlId: false,
- });
- }
- } else {
- let ischeckBothBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == inward &&
- e?.Offer > 0 &&
- e?.BookingTypeName != item?.BookingTypeName
- );
-
- let FreeProductSameBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == inward &&
- e?.Offer > 0 &&
- e?.BookingTypeName == item?.BookingTypeName
- );
- if (ischeckBothBookingType) {
- if (FreeProductSameBookingType?.OrderQty >= item?.OrderQty) {
- await ChangeFreeprodlistFn({
- OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
- RemainingQty:
- FreeProd?.OverAllFreeQty -
- item?.OrderQty -
- (FreeProd?.FreeQty - item?.OrderQty),
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: false,
- });
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: item?.OrderQty,
- OrderQty: FreeProductSameBookingType?.OrderQty,
- CompleteRemoveconvertFreetoPaidNotCompletely: true,
- InwardDtlId: inward,
- BuyInwardDtlId: item?.InwardDtlId,
- Offer: item?.Offer,
- });
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- (FreeProd?.FreeQty - item?.OrderQty) *
- ischeckBothBookingType?.OrderRate,
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: false,
- });
- } else {
- let data = isCheckFreeProductOutside?.FreeQty - item?.OrderQty;
- //First i Calculate Another Booking Type Qty
- let anotherBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- e?.BookingTypeName != item?.BookingTypeName
- );
- let anotherBookingTypeOffer = tableData?.find(
- (e) =>
- e?.InwardDtlId == inward &&
- e?.Offer > 0 &&
- e?.BookingTypeName != item?.BookingTypeName
- );
-
- let diff =
- item?.OrderQty - FreeProductSameBookingType?.OrderQty;
-
- if (
- (anotherBookingType?.OrderQty || 0) <
- anotherBookingTypeOffer?.OrderQty
- ) {
- let paidproductAnotherType =
- ischeckBothBookingType?.OrderQty -
- anotherBookingType?.OrderQty;
- let paidproductCurrentType =
- FreeProductSameBookingType?.OrderQty;
-
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: paidproductAnotherType,
- OrderQty: paidproductCurrentType,
- CompleteRemoveconvertFreetoPaidTwoTypes: true,
- InwardDtlId: inward,
- BuyInwardDtlId: item?.InwardDtlId,
- Offer: item?.Offer,
- });
-
- await ChangeFreeprodlistFn({
- OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
- RemainingQty:
- FreeProd?.OverAllFreeQty -
- item?.OrderQty -
- (FreeProd?.FreeQty -
- (paidproductCurrentType + paidproductCurrentType)),
- FreeQty:
- FreeProd?.FreeQty -
- (paidproductCurrentType + paidproductCurrentType),
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: false,
- });
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- (FreeProd?.FreeQty - item?.OrderQty) *
- ischeckBothBookingType?.OrderRate,
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: false,
- });
- } else {
- await ChangeFreeprodlistFn({
- OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
- RemainingQty:
- FreeProd?.OverAllFreeQty -
- item?.OrderQty -
- (FreeProd?.FreeQty - item?.OrderQty),
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: false,
- });
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: FreeProductSameBookingType?.OrderQty,
- CompleteRemoveconvertFreetoPaid: true,
- InwardDtlId: inward,
- BuyInwardDtlId: item?.InwardDtlId,
- Offer: item?.Offer,
- });
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- (FreeProd?.FreeQty - item?.OrderQty) *
- ischeckBothBookingType?.OrderRate,
- FreeQty: FreeProd?.FreeQty - item?.OrderQty,
- CompleteRemove: false,
- insideinwardDtlId: false,
- });
- }
- }
- } else {
- await ChangeFreeprodlistFn({
- OverAllFreeQty: item?.OrderQty,
- RemainingQty: item?.OrderQty - isPaidproduct?.OrderQty,
- FreeQty: isPaidproduct?.OrderQty,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: true,
- });
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: FreeProductSameBookingType?.OrderQty,
- CompleteRemoveconvertFreetoPaid: true,
- InwardDtlId: inward,
- BuyInwardDtlId: item?.InwardDtlId,
- Offer: item?.Offer,
- });
- await ChangeOfferAppliedProdsFn({
- inwardDtlId: item?.InwardDtlId,
- OfferAmount:
- (isCheck?.ActualFreeQty -
- FreeProductSameBookingType?.OrderQty) *
- isPaidproduct?.OrderQty,
- FreeQty:
- isCheck?.ActualFreeQty - FreeProductSameBookingType?.OrderQty,
- CompleteRemove: true,
- insideinwardDtlId: false,
- });
- }
- }
- } else {
- let ischeckBothBookingType = tableData?.find(
- (e) =>
- e?.InwardDtlId == item?.InwardDtlId &&
- e?.Offer == 0 &&
- e?.BookingTypeName != item?.BookingTypeName
- );
-
- if (ischeckBothBookingType) {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: 0,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- BuyInwardDtlId: item?.InwardDtlId,
- OrderRate: item?.OrderRate,
- Offer: item?.Offer,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
- RemainingQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
- FreeQty: 0,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: false,
- });
- } else {
- await ChangeOrderCardDetailsFn({
- BookingTypeName: item?.BookingTypeName,
- BuyProdQty: null,
- OrderQty: 0,
- CompleteRemove: true,
- InwardDtlId: item?.InwardDtlId,
- BuyInwardDtlId: item?.InwardDtlId,
- Offer: item?.Offer,
- OrderRate: item?.OrderRate,
- });
- await ChangeFreeprodlistFn({
- OverAllFreeQty: item?.OrderQty,
- RemainingQty: 0,
- FreeQty: 0,
- FreeProdId: FreeProd?.FreeProdId,
- OfferId: FreeProd?.OfferId,
- CompleteRemove: true,
- });
- }
- //Remove From Free ProdList That Entirely
- }
- }
- }
- };
-
- function safeRound(amountStr) {
- if (amountStr == null) return allowDecimal ? '0.00' : '0';
-
- const cleaned = String(amountStr).replace(/[^0-9.-]+/g, '');
- const num = Number(cleaned);
-
- if (isNaN(num)) return allowDecimal ? '0.00' : '0';
-
- return allowDecimal ? num.toFixed(2) : Math.round(num).toString();
- }
-
- const handleCustomerProductPriceHistory = (item) => {
- setCustomerPriceHistoryOpen(true);
- setCustomerProduct(item?.ProdId);
- };
-
- const handlechange33 = () => {
- if (editdelete === 'Edit') {
- seteditdelete('');
- } else {
- seteditdelete('Edit');
- }
- };
-
- const handlechange22 = async () => {
- if (editdelete === 'Delete') {
- seteditdelete('');
- } else {
- seteditdelete('Delete');
- if (OrderType === 'Failed') {
- await dispatch(changeOrderType(''));
- await dispatch(changeOrderCardDetails([]));
- await dispatch(ChangeTotalAmount([]));
- await dispatch(changeReorderHoldDetails({}));
- await dispatch(changeReorderProductDetails([]));
- setFirstPaymentclick(false);
- await dispatch(ChangeNavHoldData(false));
- await dispatch(changeCustomerID(null));
- await dispatch(changeSelectedCustId());
- await dispatch(changeSelectedOption(null));
- await dispatch(changeBookingType(defaultBookingType || 'TakeAway'));
- }
- }
- };
- const OpenEditTotalAmount = () => {
- setOpenEditTotalAmt(true);
- };
- const handleEditTotalAmountCancel = () => {
- setOpenEditTotalAmt(false);
- };
-
- const handleEditQuantity = (value) => {
- console.log(value, 'value');
-
- if (OtherServicesglobal && value.Type == 'OS' && value.ServiceType == 'I') {
- setEditQuantity(false);
- } else {
- setEditQuantity(true);
- setModaldata(value);
- setIndex(value?.localId);
- }
- };
-
- const handleEditQuantityCancel = () => {
- setEditQuantity(false);
- };
-
- return (
- <>
-
-
-
-
-
-
-
- {tableOptions?.map((item) => (
- <>
- {item.OptionName == 'Sl.No' && BookingTypeBoth && (
-
- {!isMobile ? (
- {''}
- ) : (
- {''}
- )}
-
- )}
- {item.OptionName == 'Sl.No' && (
-
- {!isMobile ? (
- Sl.No
- ) : (
- Sl.No
- )}
-
- )}
-
- {item.OptionName == 'Item' && (
-
- {!isMobile ? (
- Item
- ) : (
- Item
- )}
-
- )}
- {item.OptionName == 'MRP' && (
-
- {!isMobile ? (
- MRP
- ) : (
- MRP
- )}
-
- )}
- {item.OptionName == 'Discount' && (
-
- {!isMobile ? (
- ₹/%
- ) : (
- ₹/%
- )}
-
- )}
- {item.OptionName == 'Quantity' && (
- 0? OpenEditTotalAmount :""}
- onClick={() => {
- if (tableData?.length > 0) {
- OpenEditTotalAmount();
- }
- }}
- >
- {!isMobile ? (
- Qty
- ) : (
- Qty
- )}
-
- )}
- {item.OptionName == 'Rate' && (
-
- {!isMobile ? (
- Rt
- ) : (
- Rt
- )}
-
- )}
- {item.OptionName == 'Amount' && (
-
- {!isMobile ? (
- Amt
- ) : (
- Amt
- )}
-
- )}
- >
- ))}
-
-
- {/* For Reorder TakeWay */}
- {OldtableDataTakeAway?.length > 0 && (
-
- {OldtableDataTakeAway?.map((item, index) => (
- = PreviousdataLength
- ? 'wheat'
- : triggerAnimation &&
- index === 0 &&
- tableDataTakeAway?.length >=
- PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'wheat'
- : 'inherit'
- : 'none',
- background:
- item?.SalesId && OrderType !== 'Hold'
- ? 'rgb(243, 248, 213)'
- : GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
- ? '#b2d1f7'
- : index % 2 === 0
- ? 'white'
- : SelectedBillColor?.['OverallBackgroundColor']
- ? SelectedBillColor?.['OverallBackgroundColor']
- : '#d6d6d6',
- animation:
- BillOrderPre === 'Y' && !BookingTypeBoth
- ? triggerAnimation &&
- index === 0 &&
- !item?.SalesId &&
- tableDataTakeAway?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'splashAnimation 0.5s ease-in-out'
- : 'none'
- : 'none',
- }}
- key={index}
- onClick={
- editdelete === 'Edit'
- ? () => handleEditQuantity(item)
- : editdelete === 'Delete'
- ? () => removeFromCart(item)
- : () => {}
- }
- // onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
-
- className={`${
- item?.SalesId && OrderType !== 'Hold'
- ? 'BSBill-Table7-content-disabled'
- : 'BSBill-Table7-content'
- }
-
- `}
- >
- {tableOptions?.map((tableitem) => (
- <>
- {BookingTypeBoth &&
- index == 0 &&
- tableitem.OptionName == 'Sl.No' && (
-
-
-
- )}
-
- {tableitem.OptionName == 'Sl.No' && (
-
- {index + 1}
-
- )}
- {tableitem.OptionName == 'Item' && (
-
- (item.FullProductIdentifierDtls?.length > 0 ||
- item.ProductIdentifierDtls?.length > 0) &&
- handleImeiDetails(item)
- }
- >
- {item?.ProdName}
- {item?.Type != 'C' && (
- <>
-
- (
- {!item?.ProdVariantName?.toLowerCase()?.includes(
- 'variant'
- ) && {item?.ProdVariantName} }
- {item?.Size}
- {item?.SinglePc == 'Y' ? 'PCS' : item?.UomName})
-
- {item?.OfferMessage &&
- !Array.isArray(item.OfferMessage) && (
-
- {item.OfferMessage?.split('>')?.[0] +
- `> ${item?.OrderQty} Eligible Free`}
-
- )}
- >
- )}
- {item?.Type === 'C' && (
-
- {item.ProdDetail?.map((prod, index) => (
-
- {prod.ProdName} - {prod.Size} {prod.UomName}
-
- ))}
-
- )}
- {productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- ) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
-
- )}
- {tableitem.OptionName == 'MRP' && (
-
- {item?.MRP}
-
- )}
- {tableitem.OptionName == 'Discount' && (
-
- {item?.Type != 'C'
- ? item.Offer && item.Offer > 0
- ? item.Offer
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'
- : item?.OfferPrice && item?.OfferPrice > 0
- ? item?.OfferType === 'F'
- ? `₹${safeRound(item.OfferPrice)}`
- : `${item.OfferPrice}%`
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'}
-
- )}
- {tableitem.OptionName == 'Quantity' && (
-
- {item?.OrderQty}
-
- )}
- {tableitem.OptionName == 'Rate' && (
-
- {item?.OrderRate}
-
- )}
- {tableitem.OptionName == 'Amount' && (
- {
- e.stopPropagation();
- if (GetCustId) {
- handleCustomerProductPriceHistory(item);
- }
- }}
- style={{ fontFamily: 'Poppins' }}
- >
- {safeRound(item?.TotalAmt)}
-
- )}
- >
- ))}
-
- ))}
-
- )}
- {/* Reorder DineIn */}
- {OldtableDataDinein?.length > 0 && (
-
- {OldtableDataDinein?.map((item, index) => (
- = PreviousdataLength
- ? 'wheat'
- : BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length + index === 0 &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'wheat'
- : 'inherit'
- : 'none',
- background: item?.SalesId
- ? 'rgb(243, 248, 213)'
- : GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
- ? '#b2d1f7'
- : (OldtableDataTakeAway?.length + index) % 2 === 0
- ? 'white'
- : SelectedBillColor?.['OverallBackgroundColor']
- ? SelectedBillColor?.['OverallBackgroundColor']
- : '#d6d6d6',
- animation:
- BillOrderPre === 'Y' && !BookingTypeBoth
- ? triggerAnimation &&
- OldtableDataTakeAway?.length + index === 0 &&
- !item?.SalesId &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'splashAnimation 0.5s ease-in-out'
- : 'none'
- : 'none',
- }}
- key={OldtableDataTakeAway?.length + index}
- onClick={
- editdelete === 'Edit'
- ? () => handleEditQuantity(item)
- : editdelete === 'Delete'
- ? () => removeFromCart(item)
- : () => {}
- }
- // onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
-
- className={`${
- item?.SalesId
- ? 'BSBill-Table7-content-disabled'
- : 'BSBill-Table7-content'
- }
-
- `}
- >
- {tableOptions?.map((tableitem) => (
- <>
- {BookingTypeBoth &&
- index == 0 &&
- tableitem.OptionName == 'Sl.No' && (
-
-
-
- )}
-
- {tableitem.OptionName == 'Sl.No' && (
-
- {OldtableDataTakeAway?.length + index + 1}
-
- )}
- {tableitem.OptionName == 'Item' && (
-
- {item?.ProdName}
-
- {item?.Type != 'C' && (
- <>
-
- (
- {!item?.ProdVariantName?.toLowerCase()?.includes(
- 'variant'
- ) && {item?.ProdVariantName} }
- {item?.Size}
- {item?.SinglePc == 'Y' ? 'PCS' : item?.UomName})
-
- {item?.OfferMessage &&
- !Array.isArray(item.OfferMessage) && (
-
- {item.OfferMessage?.split('>')?.[0] +
- `> ${item?.OrderQty} Eligible Free`}
-
- )}
- >
- )}
- {item?.Type === 'C' && (
-
- {item.ProdDetail?.map((prod, index) => (
-
- {prod.ProdName} - {prod.Size} {prod.UomName}
-
- ))}
-
- )}
- {productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- ) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
-
- )}
- {tableitem.OptionName == 'MRP' && (
-
- {item?.MRP}
-
- )}
- {tableitem.OptionName == 'Discount' && (
-
- {item?.Type != 'C'
- ? item.Offer && item.Offer > 0
- ? item.Offer
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'
- : item?.OfferPrice && item?.OfferPrice > 0
- ? item?.OfferType === 'F'
- ? `₹${safeRound(item.OfferPrice)}`
- : `${item.OfferPrice}%`
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'}
-
- )}
- {tableitem.OptionName == 'Quantity' && (
-
- {item?.OrderQty}
-
- )}
- {tableitem.OptionName == 'Rate' && (
-
- {item?.OrderRate}
-
- )}
- {tableitem.OptionName == 'Amount' && (
- {
- e.stopPropagation();
- if (GetCustId) {
- handleCustomerProductPriceHistory(item);
- }
- }}
- style={{ fontFamily: 'Poppins' }}
- >
- {safeRound(item?.TotalAmt)}
-
- )}
- >
- ))}
-
- ))}
-
- )}
- {/* TakeWay */}
- {tableDataTakeAway?.length > 0 && (
-
- {tableDataTakeAway?.map((item, index) => (
- = PreviousdataLength
- ? 'wheat'
- : BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
- tableDataTakeAway?.length >=
- PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'wheat'
- : (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
- ? 'white'
- : SelectedBillColor?.['OverallBackgroundColor']
- ? SelectedBillColor?.[
- 'OverallBackgroundColor'
- ]
- : '#d6d6d6'
- : (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
- ? 'white'
- : SelectedBillColor?.['OverallBackgroundColor']
- ? SelectedBillColor?.['OverallBackgroundColor']
- : '#d6d6d6',
- background:
- BookingType === 'Dine In' && item?.SalesId
- ? 'rgb(243, 248, 213)'
- : GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
- ? '#b2d1f7'
- : (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
- ? 'white'
- : SelectedBillColor?.['OverallBackgroundColor']
- ? SelectedBillColor?.['OverallBackgroundColor']
- : '#d6d6d6',
- animation:
- BillOrderPre === 'Y' && !BookingTypeBoth
- ? triggerAnimation &&
- OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
- !item?.SalesId &&
- tableDataTakeAway?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'splashAnimation 0.5s ease-in-out'
- : 'none'
- : 'none',
- }}
- key={
- OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index
- }
- onClick={
- editdelete === 'Edit'
- ? () =>
- item.Type == 'P' || item.Type == 'C'
- ? handleEditQuantity(item)
- : item.ServiceType == 'G'
- ? handleEditQuantity(item)
- : ''
- : editdelete === 'Delete'
- ? () => removeFromCart(item)
- : () => {}
- }
- // onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
-
- className={`${
- BookingType === 'Dine In' && item?.SalesId
- ? 'BSBill-Table7-content-disabled'
- : 'BSBill-Table7-content'
- }
-
- `}
- >
- {tableOptions?.map((tableitem) => (
- <>
- {BookingTypeBoth &&
- index == 0 &&
- tableitem.OptionName == 'Sl.No' && (
-
-
-
- )}
-
- {tableitem.OptionName == 'Sl.No' && (
-
- {OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index +
- 1}
-
- )}
- {tableitem.OptionName == 'Item' && (
-
- (item.FullProductIdentifierDtls?.length > 0 ||
- item.ProductIdentifierDtls?.length > 0 ||
- imeiModal) &&
- handleImeiDetails(item)
- }
- >
- {item?.Type !== 'OS'
- ? item.ProdName
- : item.ServiceName}
-
- {item?.Type != 'C' && (
- <>
-
- {' '}
- {item?.Type !== 'OS' && (
- <>
- {!item?.ProdVariantName?.toLowerCase()?.includes(
- 'variant'
- ) && {item?.ProdVariantName} }
- {item?.Size}
- {item?.SinglePc == 'Y'
- ? 'PCS'
- : item?.UomName}
- >
- )}
-
- {item?.OfferMessage &&
- !Array.isArray(item.OfferMessage) && (
-
- {item.OfferMessage?.split('>')?.[0] +
- `> ${item?.OrderQty} Eligible Free`}
-
- )}
- >
- )}
- {item?.Type === 'C' && (
-
- {item.ProdDetail?.map((prod, index) => (
-
- {prod.ProdName} - {prod.Size} {prod.UomName}
-
- ))}
-
- )}
- {productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- ) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
-
- )}
- {tableitem.OptionName == 'MRP' && (
-
- {item?.MRP}
-
- )}
- {tableitem.OptionName == 'Discount' && (
-
- {item?.Type != 'C'
- ? item.Offer && item.Offer > 0
- ? item.Offer
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'
- : item?.OfferPrice && item?.OfferPrice > 0
- ? item?.OfferType === 'F'
- ? `₹${safeRound(item.OfferPrice)}`
- : `${item.OfferPrice}%`
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'}
-
- )}
- {tableitem.OptionName == 'Quantity' && (
-
- {item?.OrderQty}
-
- )}
- {tableitem.OptionName == 'Rate' && (
-
- {safeRound(item?.OrderRate)}
-
- )}
- {tableitem.OptionName == 'Amount' && (
- {
- e.stopPropagation();
- if (GetCustId) {
- handleCustomerProductPriceHistory(item);
- }
- }}
- style={{ fontFamily: 'Poppins' }}
- >
- {item?.TotalAmt}
-
- )}
- >
- ))}
-
- ))}
-
- )}
- {/* DineIn */}
- {tableDataDinein?.length > 0 && (
-
- {tableDataDinein?.map((item, index) => (
- = PreviousdataLength
- ? 'wheat'
- : BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'wheat'
- : 'inherit'
- : 'none',
- background:
- BookingType === 'Dine In' &&
- item?.SalesId &&
- !BookingTypeBoth
- ? 'rgb(243, 248, 213)'
- : GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
- ? '#b2d1f7'
- : (OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index) %
- 2 ===
- 0
- ? 'white'
- : SelectedBillColor?.['OverallBackgroundColor']
- ? SelectedBillColor?.['OverallBackgroundColor']
- : '#d6d6d6',
- animation:
- BillOrderPre === 'Y' && !BookingTypeBoth
- ? triggerAnimation &&
- OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
- !item?.SalesId &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
- ? 'splashAnimation 0.5s ease-in-out'
- : 'none'
- : 'none',
- }}
- key={
- OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index
- }
- onClick={
- editdelete === 'Edit'
- ? () => handleEditQuantity(item)
- : editdelete === 'Delete'
- ? () => removeFromCart(item)
- : () => {}
- }
- // onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
-
- className={`${
- BookingType === 'Dine In' && item?.SalesId
- ? 'BSBill-Table7-content-disabled'
- : 'BSBill-Table7-content'
- }
-
- `}
- >
- {tableOptions?.map((tableitem) => (
- <>
- {BookingTypeBoth &&
- index == 0 &&
- tableitem.OptionName == 'Sl.No' && (
-
-
-
- )}
-
- {tableitem.OptionName == 'Sl.No' && (
-
- {OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index +
- 1}
-
- )}
- {tableitem.OptionName == 'Item' && (
-
- {item?.ProdName}
-
- {item?.Type != 'C' && (
- <>
-
- (
- {!item?.ProdVariantName?.toLowerCase()?.includes(
- 'variant'
- ) && {item?.ProdVariantName} }
- {item?.Size}
- {item?.SinglePc == 'Y' ? 'PCS' : item?.UomName})
-
- {item?.OfferMessage &&
- !Array.isArray(item.OfferMessage) && (
-
- {item.OfferMessage?.split('>')?.[0] +
- `> ${item?.OrderQty} Eligible Free`}
-
- )}
- >
- )}
- {item?.Type === 'C' && (
-
- {item.ProdDetail?.map((prod, index) => (
-
- {prod.ProdName} - {prod.Size} {prod.UomName}
-
- ))}
-
- )}
- {productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- ) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
-
- )}
- {tableitem.OptionName == 'MRP' && (
-
- {item?.MRP}
-
- )}
- {tableitem.OptionName == 'Discount' && (
-
- {item?.Type != 'C'
- ? item.Offer && item.Offer > 0
- ? item.Offer
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'
- : item?.OfferPrice && item?.OfferPrice > 0
- ? item?.OfferType === 'F'
- ? `₹${safeRound(item.OfferPrice)}`
- : `${item.OfferPrice}%`
- : item.DiscountAmt
- ? item.DiscountAmt
- : '-'}
-
- )}
- {tableitem.OptionName == 'Quantity' && (
-
- {item?.OrderQty}
-
- )}
- {tableitem.OptionName == 'Rate' && (
-
- {item?.OrderRate}
-
- )}
- {tableitem.OptionName == 'Amount' && (
- {
- e.stopPropagation();
- if (GetCustId) {
- handleCustomerProductPriceHistory(item);
- }
- }}
- style={{ fontFamily: 'Poppins' }}
- >
- {safeRound(item?.TotalAmt)}
-
- )}
- >
- ))}
-
- ))}
-
- )}
-
- {OpenEditTotalAmt && (
-
- )}
-
- {EditQuantity && (
-
- )}
- {OpenImeiDetail && (
-
- )}
- {customerPriceHistoryOpen && GetCustId && (
-
- )}
- >
- );
-};
-
-export default BSBillingTable7;
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7Overall.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7Overall.jsx
deleted file mode 100644
index 26d3e1f..0000000
--- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7Overall.jsx
+++ /dev/null
@@ -1,92 +0,0 @@
-import React from 'react';
-import { useSelector } from 'react-redux';
-import BSBillingTable7 from './BSBillingTable7';
-import BSBilling7Payment from './BSBilling7Payment';
-import { isMobile } from 'react-device-detect';
-import { getTemplateData } from '../../../../../Features/ThemeChange/ThemeChange';
-import {
- GlobalExpDateforHeight,
- GlobalScreenSize,
-} from '../../../../../Features/BookingScreen/BookingData/BookingData';
-import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7.scss';
-import BSBillingTable3 from '../BSBillingTable3/BSBillingTable3';
-
-const BSBillingTable7Overall = () => {
- const templateData = useSelector(getTemplateData);
- const ExpDate = useSelector(GlobalExpDateforHeight);
- const screenwidth = useSelector(GlobalScreenSize);
- let containerHeight = '';
-
- if (templateData?.BookingLayout?.[0] === 'Layout1') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '480px'
- : '468px' // billing table 7 height in POS
- : ExpDate <= 7
- ? '82vh'
- : '';
- }
- //590
- else if (templateData?.BookingLayout?.[0] === 'Layout2') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '490px'
- : '475px' // billing table 7 height in POS
- : ExpDate <= 7
- ? '84vh'
- : '';
- } else if (templateData?.BookingLayout?.[0] === 'Layout3') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '480px'
- : '460px'
- : ExpDate <= 7
- ? '82vh'
- : '';
- } else if (templateData?.BookingLayout?.[0] === 'Layout5') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '480px'
- : '475px'
- : ExpDate <= 7
- ? '85vh'
- : '';
- } else if (templateData?.BookingLayout?.[0] === 'Layout6') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '420px'
- : '410px'
- : ExpDate <= 7
- ? '72vh'
- : '';
- } else if (templateData?.BookingLayout?.[0] === 'Layout4') {
- containerHeight = isMobile
- ? ExpDate <= 7
- ? '500px'
- : '475px'
- : ExpDate <= 7
- ? '84vh'
- : '';
- }
-
- return (
-
- {screenwidth > 768 && (
-
-
-
- )}
-
-
-
-
- );
-};
-export default BSBillingTable7Overall;
diff --git a/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar2.jsx b/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar2.jsx
deleted file mode 100644
index fafd80f..0000000
--- a/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar2.jsx
+++ /dev/null
@@ -1,1344 +0,0 @@
-import React, { useEffect, useRef, useState, useCallback, lazy } from 'react';
-import { useDispatch, useSelector } from 'react-redux';
-import { useNavigate } from 'react-router-dom';
-import { AiFillHome } from 'react-icons/ai';
-import { MenuOutlined } from '@ant-design/icons';
-import { Popover, Badge, Tooltip, Button, Popconfirm } from 'antd';
-import {
- getEditFavItems,
- PreferenceData,
- getPreferenceData,
- GlobalBookingType,
- GlobalBookingTypeBoth,
- changeCombosearch,
- GlobalCombosearch,
- changeEstimateBooking,
- changeSelectedOption,
- changeSelectedCustId,
- changeCustomerID,
- changealldata,
- GlobalOrderType,
- GlobalEstimateBooking,
- GlobalOrderStatus,
- Changedragging,
- Globaldragging,
- changeBtoBQuickProductTransfer,
- GlobalBtoBQuickProductTransfer,
- changeOrderCardDetails,
- GlobalFeatAddOnData,
- GlobalOtherSevices,
- changeOtherServices,
- GlobalComboRedirectionToDefaultLayoutForParking,
- changeComboRedirectionToDefaultLayoutForParking,
- GlobalCommonPaymentOptions,
- GlobalSelCustId,
-} from '../../../../Features/BookingScreen/BookingData/BookingData';
-
-const BSNavBarSearch = lazy(() => import('../UtillComponents/BSNavBarSearch'));
-
-const BSNavBarHand = lazy(() => import('../UtillComponents/BSNavBarHand'));
-
-const BSNavBarHandbag = lazy(
- () => import('../UtillComponents/BSNavBarHandbag')
-);
-
-const BSNavBarAddons = lazy(() => import('../UtillComponents/BSNavBarAddons'));
-
-const BSNavBarAddUser = lazy(
- () => import('../UtillComponents/BSNavBarAddUser')
-);
-
-const BSNavBarQuickAdd = lazy(
- () => import('../UtillComponents/BSNavBarQuickAdd')
-);
-
-const BSNavBarFavItems = lazy(
- () => import('../UtillComponents/BSNavBarFavItems')
-);
-import BSNavBarWeightScale from '../UtillComponents/BSNavBarWeightScale';
-import { clearSession, sessionStore } from '../../../../Services/Others';
-import PozoUserIcon from '../UtillComponents/Pozo retail icons/PozoUserIcon.jsx';
-import {
- ApplicationPreferences,
- GenerateLogout,
- GlobalCompBranchData,
- getCompBranchData,
-} from '../../../../Features/BrachLogin/BranchLogin.js';
-import BSPrinterSetting from '../UtillComponents/BSPrinterSetting.jsx';
-import BSNavBarEstimate from '../UtillComponents/BSNavBarEst.jsx';
-import BSNavBarComboSearch from '../UtillComponents/BSNavBarComboSearch.jsx';
-import { setCustomerDisplayWindow } from '../../../../Features/customerDisplayWindow/customerDisplayWindow';
-import {
- GlobalPreOrderPendingCount,
- PreOrderGet,
- changePreOrderPendingCount,
- changepreOrder,
- changePreOrderAdditem,
- changepreOrderList,
-} from '../../../../Features/BookingScreen/PreOrder/PreOrder.js';
-import { DefaultModal } from '../../../../Components/Modal/DefaultModal.jsx';
-import { getCustomerDisplayWindow } from '../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
-import PozoAddCustomerIcon from '../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx';
-import PaymentFailedSales from '../../../Payment/PaymentFailedDetails/PaymentFailedSales.jsx';
-import CustomerDisplayicon from '../UtillComponents/Pozo retail icons/PozoCustomerDisplayicon.jsx';
-import PozoPaymentFailesIcon from '../UtillComponents/Pozo retail icons/PozoFailedPaymentsIcon.jsx';
-import TooltipWrapper from '../../../../Components/Tooltip/Tooltip';
-import { Global_OfferStatus } from '../../../../Features/Offer/Offer.js';
-import { isMobile } from 'react-device-detect';
-import { useAuth } from '../../../../AuthContext.jsx';
-import {
- getTemplate,
- getTemplateData,
- StoredSessionData,
-} from '../../../../Features/ThemeChange/ThemeChange.js';
-import PozoPreOrderIcon from '../UtillComponents/Pozo retail icons/PozoPreOrderIcon.jsx';
-import BSNavBarWholeSale from '../UtillComponents/BSNavBarWholeSale.jsx';
-import { GlobalBookingStatus } from '../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js';
-import {
- getUserProfile,
- userDataByUserId,
-} from '../../../../Features/UserAccount/userData.js';
-import { TbSettingsSearch } from 'react-icons/tb';
-import { FaParking } from 'react-icons/fa';
-import BSNavBarUserInfo from './BSNavBarUserInfo';
-import { OtherServicesCardlistdata } from '../../../../Features/OtherServices/OtherServices.js';
-import BSMobilePrintSettings from '../UtillComponents/BSMobilePrintSettings.jsx';
-import BSScanTemplate from '../UtillComponents/BSScanTemplate.jsx';
-import MultipleSearch from '../UtillComponents/MultipleSearch.jsx';
-// Jsx Files
-const VerfiedProducts = lazy(() => import('./verfiedProduct/VerfiedProducts'));
-const UserRelieveManager = lazy(
- () => import('../../Template/RealivingUser.jsx')
-);
-const BranchName = lazy(() => import('../../Template/BranchName.jsx'));
-const BSNavBarOffer = lazy(
- () => import('../UtillComponents/BSNavBarOffer/BSNavBarOffer.jsx')
-);
-const BSNavBarDragItems = lazy(
- () => import('../UtillComponents/BSNavBarDragItems.jsx')
-);
-const BSNavBarTable = lazy(() => import('../UtillComponents/BSNavBarTable'));
-const BSMembership = lazy(() => import('../UtillComponents/BSMembership.jsx'));
-const BSNavBarPreOrder = lazy(
- () => import('../../Components/UtillComponents/BSNavBarPreOrder.jsx')
-);
-const FeaturesFunctionalities = lazy(
- () => import('../BookingFunctionality/FeaturesFunctionalities.jsx')
-);
-const BSCustomerSelect = lazy(
- () => import('../UtillComponents/BSSelectCustomer.jsx')
-);
- import '../../../../Styles/BookingScreen/Components/BSNavbar/BSNavbar2.scss';
-import { RiFullscreenExitFill, RiFullscreenFill } from 'react-icons/ri';
-import { useNavbarCommon } from './BSNavBarCommon.js';
-
-const subDirectory = import.meta.env.ENV_BASE_URL;
-const commonUrl = import.meta.env.ENV_COMMON_BASE_URL;
-
-const BSNavbar2 = () => {
- const dispatch = useDispatch();
- const navigate = useNavigate();
- const [Navmenu, setNavmenu] = useState(false);
- const [isAccOpen, setAccIsOpen] = useState(false);
- const [addcustomer, setAddCustomer] = useState(false);
- const [hold, setHold] = useState(false);
- // const [ComboDropDown, setComboDropDown] = useState();
- const { action, selectedProducts } = useSelector(
- GlobalBtoBQuickProductTransfer
- );
- const preOrderPendingCount = useSelector(GlobalPreOrderPendingCount);
- const FeatureAddonData = useSelector(GlobalFeatAddOnData);
-
- // const [FeatureAddonData, setFeatureAddonData] = useState([]);
- const [paymentfeataddon, setpaymentfeataddon] = useState(false);
- const CompBranchData = useSelector(GlobalCompBranchData);
- const appPreferences = useSelector(ApplicationPreferences);
- const commonModulePreference = appPreferences?.find(
- (preference) => preference?.PreferredCatName === 'Common Module'
- )?.PreferenceCatDetails;
- const sportsAppPreference = commonModulePreference?.find(
- (preference) =>
- preference?.PreferredSubCatName === 'SportsApp' &&
- preference?.PreferredStatus === 'Y'
- );
- const bookingTypePreference = appPreferences?.find(
- (preference) => preference?.PreferredCatName === 'Booking Type'
- )?.PreferenceCatDetails;
- const dinePreference = bookingTypePreference?.find(
- (type) =>
- type?.PreferredSubCatName?.toLowerCase() === 'dine in' &&
- type?.PreferredStatus === 'Y'
- );
- const takeAwayPreference = bookingTypePreference?.find(
- (type) =>
- type?.PreferredSubCatName?.toLowerCase() === 'take away' &&
- type?.PreferredStatus === 'Y'
- );
-
- const OtherServicesglobal = useSelector(GlobalOtherSevices);
- const comboRedirectionToDefaultLayoutForParking = useSelector(
- GlobalComboRedirectionToDefaultLayoutForParking
- );
-
- const [OpenFailData, SetOpenFailData] = useState(false);
- const tableData = useSelector(GlobalOrderStatus);
- const SessionData = useSelector(StoredSessionData);
- const AppId = SessionData?.AppId;
- const CompId = SessionData?.CompId;
- const BranchId = SessionData?.BranchId;
- const UserId = SessionData?.UserId;
- const UserType = SessionData?.UserType;
- const SettingDataSelector = useSelector(PreferenceData);
- const BookingType = useSelector(GlobalBookingType);
- const BookingTypeBoth = useSelector(GlobalBookingTypeBoth);
- const GlobaluseOptions = useSelector(GlobalCommonPaymentOptions);
- const SelCustId = useSelector(GlobalSelCustId);
- const Estimation = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (item) => item.SettingIdName === 'Estimation'
- );
- const SalesMode = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (item) => item.SettingIdName === 'Sales Mode'
- );
- const ScanLayoutScreen = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
- (item) => item.SettingIdName === 'ScanLayout'
- );
- const Comboglobal = useSelector(GlobalCombosearch);
- const OrderType = useSelector(GlobalOrderType);
- const GlobEstBooking = useSelector(GlobalEstimateBooking);
- const OrderOfferStatus = useSelector(Global_OfferStatus);
- const BSLayout1Data = useSelector(getTemplateData);
- const BookingStatus = useSelector(GlobalBookingStatus);
- const CheckBookingStatus =
- BookingStatus?.find((item) => item.ScreenType === 'Booking')
- ?.ScreenStatus ?? 'Open';
- const navbarOptions = BSLayout1Data?.BookingNavbar?.[1];
- const PreferenceDatas = useSelector(PreferenceData);
-
- const userProfileData = useSelector(userDataByUserId);
- const [preOrderOpen, setPreOrderOpen] = useState(false);
- const [preOrderhiseandShow, setpreOrderhiseandShow] = useState(false);
- const [open, setOpen] = useState(false);
- const [empData, setEmpData] = useState();
- const [addnewAccess, setaddnewAccess] = useState(true);
- const { SadminuserAccess } = useAuth();
- const [OtherServiceStatus, setOtherServiceStatus] = useState(false);
- const [isHoldEnable, setisisHoldEnable] = useState(false);
- const [multiple, setMultiple] = useState(false);
- let SAAccessCommonMaster = SadminuserAccess?.find(
- (e) => e?.MenuName === 'Sales'
- );
- const divRef = useRef(null);
-
- const Isdragging = useSelector(Globaldragging);
-
- const handleClickOutside = (event) => {
- if (divRef.current && !divRef.current.contains(event.target)) {
- setAccIsOpen(false);
- }
- };
- const VerifyTheProducts = PreferenceDatas?.[0]?.SettingDtlDetails?.find(
- (item) =>
- item.SettingIdName === 'VerifyProduct' && item?.SettingValue === 'Y'
- );
- const {
- handleFullscreen,
- isFullscreen,
- } = useNavbarCommon();
-
-
-
- useEffect(() => {
- if (!FeatureAddonData?.FeatureDtls?.length) return;
-
- const preorderFeature = FeatureAddonData.FeatureDtls.find(
- (item) => item?.FeatureAddonName?.toLowerCase() === 'preorder'
- );
-
- if (preorderFeature) {
- BadgePendingApi();
- }
- }, [FeatureAddonData]);
- useEffect(() => {
- handleOtherData();
- BadgePendingApi();
- // if (UserType === "Employee") {
- // fetchApi()
- // }
- document.addEventListener('click', handleClickOutside, true);
- return () => {
- document.removeEventListener('click', handleClickOutside, true);
- };
- }, []);
- useEffect(() => {
- getPaymentOptionFeature();
- }, [GlobaluseOptions, SelCustId]);
- const getPaymentOptionFeature = async () => {
- const filterSalesPayment = GlobaluseOptions?.filter(
- (item) => item?.FlowName?.toLowerCase() === 'sales'
- );
-
- let filterPayCounter = filterSalesPayment?.[0]?.OptionDetails?.filter(
- (item) => item?.OptionName?.toLowerCase() === 'pay at the counter'
- );
-
- // If customer NOT selected → remove credit mode
- if (!SelCustId) {
- filterPayCounter = filterPayCounter?.map((option) => ({
- ...option,
- ModeDetails: option?.ModeDetails?.filter(
- (mode) => mode?.ModeName?.toLowerCase() !== 'credit'
- ),
- }));
- }
-
- setisisHoldEnable(filterPayCounter?.[0]?.ModeDetails?.length > 0);
- };
- useEffect(() => {
- // fetchEditFavItems();
- dispatch(
- getPreferenceData({ CompId: CompId, AppId: AppId, BranchId: BranchId,UserId:UserId })
- );
- fetchBranchData();
- dispatch(getUserProfile({ UserId: UserId, ActiveStatus: 'A' })).unwrap();
- }, [CompId, AppId, BranchId, UserType, UserId]);
-
- // useEffect(() => {
- // if (BranchId) {
- // Combodata();
- // }
- // }, [BranchId, AppId, CompId]);
-
- useEffect(() => {
- if (
- UserType !== 'Super Admin' &&
- UserType !== 'Super Admin User' &&
- UserId
- ) {
- getFeatureAddonData();
- }
- }, [FeatureAddonData]);
- 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 fetchBranchData = async () => {
- if (UserType === 'Super Admin' || UserType === 'Super Admin User') {
- await dispatch(
- getCompBranchData({ CompId: CompId, AppId: AppId })
- ).unwrap();
- } else if (UserType === 'Admin' || UserType === 'Admin User') {
- await dispatch(
- getCompBranchData({ AppId: AppId, UserId: UserId, CompId: CompId })
- ).unwrap();
- }
- };
-
- const handleOtherData = async (e) => {
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- };
- let response = await dispatch(OtherServicesCardlistdata(data)).unwrap();
- if (response?.data?.statusCode === 1) {
- setOtherServiceStatus(true);
- } else {
- setOtherServiceStatus(false);
- }
- };
- const getFeatureAddonData = async () => {
- const hasPaymentFeatures = FeatureAddonData?.FeatureDtls.some(
- (item) =>
- item.FeatureAddonName === 'Payment Gateway' ||
- item.FeatureAddonName === 'Payment Device'
- );
- setpaymentfeataddon(hasPaymentFeatures);
- // } else {
- // setFeatureAddonData([]);
- // }
- };
-
- // const openPreOrder = async () => {
- const openPreOrder = async (e) => {
- if (e == 'small-screen') {
- setPreOrderOpen(true);
- if (!preOrderhiseandShow) {
- setpreOrderhiseandShow(true);
- } else {
- setpreOrderhiseandShow(false);
- }
-
- // setpreOrderhiseandShow(!preOrderhiseandShow)
- } else {
- setPreOrderOpen((prevState) => !prevState);
- if (preOrderOpen) {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedRemovedData = {
- userData: [],
- ExtraCharges: [],
- paymentMethod: 'Cash',
- type: 'remove',
- keyValue: 'customer',
- };
- customerDisplayWindow.postMessage(updatedRemovedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- await dispatch(changepreOrder(false));
- await dispatch(changeEstimateBooking('Sales'));
- await dispatch(changePreOrderAdditem('AddDetails'));
- await dispatch(changealldata(null));
- await dispatch(changepreOrderList(null));
- await dispatch(changeCustomerID(null));
- await dispatch(changeSelectedCustId(null));
- await dispatch(changeSelectedOption(null));
- }
- }
- };
-
- const BadgePendingApi = async () => {
- let Data = {
- compId: CompId,
- branchId: BranchId,
- appId: AppId,
- deliveryStatus: 'P',
- };
- let PendingResponse = await dispatch(PreOrderGet(Data)).unwrap();
- if (PendingResponse?.data?.statusCode === 1) {
- await dispatch(
- changePreOrderPendingCount(PendingResponse?.data?.data?.length)
- );
- }
- };
- const NavmenuOpenClose = () => {
- setNavmenu(!Navmenu);
- };
-
- const UserAcc = useCallback(() => {
- setAccIsOpen((prev) => !prev);
- }, []);
-
- const BacktoLogin = () => {
- clearSession('BranchId');
- navigate(`${subDirectory}app-page/branch-login`);
- };
-
- // const Logout = () => {
- // closeCustomerDisplayWindow()
- // clearSession()
- // window.location.replace(commonUrl);
-
- // }
- //mohan
- const Logout = async () => {
- const status = 'N'; // replace with your actual status
- const res = await dispatch(GenerateLogout({ UserId, status })).unwrap();
- if (res?.data?.statusCode === 1) {
- clearSession();
- await sessionStore('Mode', 'Logout');
- window.location.replace(commonUrl);
- }
- };
-
- const handleHome = () => {
- navigate(`${subDirectory}app-page/home`);
- dispatch(Changedragging(false));
- };
-
- const handleAddCustomerCancel = () => {
- setAddCustomer(false);
- };
-
- const handleHoldCancel = () => {
- setHold(false);
- };
-
- const paymentFailedStatusFun = async () => {
- SetOpenFailData(!OpenFailData);
- };
- const openNewTab = async () => {
- const initialData = { Paymentgateway: false };
- let screenDetails;
-
- if ('getScreenDetails' in window) {
- try {
- screenDetails = await window.getScreenDetails();
- } catch (error) {
- console.error('Error accessing screen details:', error);
- }
- }
-
- // Select second monitor if available, otherwise use primary screen
- const secondScreen = screenDetails?.screens.find(
- (screen) => screen !== screenDetails.currentScreen
- );
- const targetScreen = secondScreen || window.screen;
-
- const customerDisplayWindow = window.open(
- `${subDirectory}customer-display`,
- 'CustomerDisplayWindow',
- `width=${targetScreen.width},height=${targetScreen.height},left=${targetScreen.left || 0},top=${targetScreen.top || 0},scrollbars=yes,resizable=yes`
- );
-
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- setCustomerDisplayWindow(customerDisplayWindow);
-
- customerDisplayWindow.onload = () => {
- setTimeout(() => {
- // Ensure it moves & resizes correctly
- customerDisplayWindow.moveTo(
- targetScreen.left || 0,
- targetScreen.top || 0
- );
- customerDisplayWindow.resizeTo(
- targetScreen.width,
- targetScreen.height
- );
-
- // Try fullscreen (Needs user interaction)
- try {
- customerDisplayWindow.document.documentElement.requestFullscreen();
- } catch (err) {
- console.warn('Fullscreen request failed:', err);
- }
-
- // Send initial data
- customerDisplayWindow.postMessage(initialData, '*');
- }, 500);
- };
- } else {
- console.error('Customer display window failed to open.');
- }
- };
-
- const handleClick = async () => {
- if (Comboglobal == false) {
- await dispatch(changeCombosearch(true));
- } else {
- await dispatch(changeCombosearch(false));
- }
- };
-
- // const Combodata = async () => {
- // let data = {
- // AppId: AppId,
- // CompId: CompId,
- // BranchId: BranchId,
- // };
-
- // let Response = await dispatch(Comboget(data)).unwrap();
- // if (Response?.data?.statusCode == 1) {
- // setComboDropDown(Response?.data?.data);
- // }
- // };
- const handleOpenChange = () => {
- setOpen(!open);
- };
-
- const preOrderHandleclose = async () => {
- setPreOrderOpen(false);
- await dispatch(changepreOrder(false));
- setpreOrderhiseandShow(false);
- };
- const handlepreOrderhiseandShow = async () => {
- setpreOrderhiseandShow(!preOrderhiseandShow);
- };
-
- const searchOption = navbarOptions?.find(
- (item) => item?.OptionName === 'Search' && Comboglobal === false
- );
- const showModal = () => {
- dispatch(changeOrderCardDetails([]));
- dispatch(
- changeBtoBQuickProductTransfer({
- selectedProducts: [],
- action: !action,
- })
- );
- };
-
- const handleEditProfile = async () => {
- navigate(`${subDirectory}app-page/redirect-userprofile`);
- };
-
- // -------------------------------------------------------------------------------------------------------------------------------------------------
-
- const handleotherservices = async () => {
- if (OtherServicesglobal && comboRedirectionToDefaultLayoutForParking) {
- dispatch(changeComboRedirectionToDefaultLayoutForParking(false));
- await dispatch(getTemplate({ CompId, BranchId, AppId })).unwrap();
- }
- dispatch(changeOtherServices(!OtherServicesglobal));
- dispatch(changeOrderCardDetails([]));
- };
-
- return (
-
-
-
{' '}
-
-
-
- {(addcustomer || hold) && (
-
- )}
- {OtherServiceStatus && (
-
- )}
-
-
-
- {searchOption &&
- !Comboglobal &&
- !OtherServicesglobal &&
- !sportsAppPreference && (
-
-
- {/* Multiple search */}
-
-
- setMultiple(true)} />
-
-
-
- )}
-
- {Comboglobal === true && !OtherServicesglobal && (
-
- )}
- {OpenFailData && (
-
- )}
-
- {navbarOptions?.map((item) => (
- <>
-
-
-
- <>
- {item?.OptionName == 'RePrint' && !OtherServicesglobal && (
-
-
-
-
-
- )}
- >
-
- {!OtherServicesglobal && (
- <>
- {item?.OptionName == 'Hold' &&
- OrderType != 'Failed' &&
- OrderType != 'Reorder' &&
- CheckBookingStatus != 'Close' &&
- isHoldEnable &&
- !addnewAccess && (
-
-
-
- )}
-
- {item?.OptionName == 'QuickAdd' && (
-
-
-
- )}
- >
- )}
-
-
-
- {!OtherServicesglobal && (
- <>
- {item?.OptionName == 'QuickAdd' && dinePreference && (
-
- {' '}
-
{' '}
-
- )}
-
- {(dinePreference || takeAwayPreference) && (
-
-
- {item?.OptionName == 'DineIn' &&
- dinePreference &&
- !BookingTypeBoth &&
- PreferenceDatas?.[0]?.['SettingDtlDetails']?.find(
- (item) => item.SettingIdName === 'DineIn'
- )?.SettingValue === 'Y' && (
-
-
-
- )}
- {item?.OptionName == 'TakeAway' &&
- takeAwayPreference && (
-
-
-
- )}
-
-
- )}
-
- {item?.OptionName == 'TakeAway' && takeAwayPreference && (
-
- {' '}
-
{' '}
-
- )}
-
-
- {item?.OptionName === 'Offer' &&
- GlobEstBooking !== 'OvrAllEst' &&
- GlobEstBooking !== 'ParEst' &&
- GlobEstBooking === 'Sales' &&
- PreferenceDatas?.[0]?.['SettingDtlDetails']?.find(
- (item) => item.SettingIdName === 'Offer'
- )?.SettingValue === 'Y' && (
-
-
-
- )}
- {item?.OptionName == 'ExtraCharge' && (
-
-
-
- )}
- {item?.OptionName == 'AddCustomer' && !preOrderOpen && (
- <>
-
-
-
-
- >
- )}
-
- >
- )}
-
- >
- ))}
- {FeatureAddonData?.FeatureDtls?.find(
- (item) => item?.FeatureAddonName?.toLowerCase() === 'weight scale'
- ) &&
- !OtherServicesglobal && (
-
-
-
- )}
-
- {!OtherServicesglobal && (
- <>
- {FeatureAddonData?.FeatureDtls?.find(
- (item) => item?.FeatureAddonName?.toLowerCase() === 'preorder'
- ) && (
-
-
-
- {
- openPreOrder();
- }}
- HandleClose={preOrderHandleclose}
- />
-
-
-
- )}
- >
- )}
- {preOrderOpen && (
-
-
-
- )}
- {sportsAppPreference &&
}
- {!OtherServicesglobal && (
- <>
- {Estimation?.SettingValue === 'Y' &&
- BookingType !== 'Dine In' &&
- !BookingTypeBoth &&
- !OrderOfferStatus && (
-
-
-
- )}
- >
- )}
-
- {SalesMode?.SettingValue === 'Y' && !OtherServicesglobal && (
-
- )}
-
- {!OtherServicesglobal && ScanLayoutScreen?.SettingValue === 'Y' && (
-
- )}
-
- {!OtherServicesglobal && (
- <>
- {!sportsAppPreference && (
-
-
-
- )}
-
-
-
- >
- )}
-
- {FeatureAddonData?.FeatureDtls?.find(
- (item) => item?.FeatureAddonName?.toLowerCase() === 'customer display'
- ) && (
-
-
-
-
-
- )}
- {VerifyTheProducts && (
-
-
-
-
-
- )}
- {paymentfeataddon && !OtherServicesglobal && (
-
- {
- paymentFailedStatusFun();
- }}
- className="BSBillingNavBar1-AllIcons"
- style={{ width: '1.4rem', cursor: 'pointer' }}
- >
-
-
-
- )}
-
- {!OtherServicesglobal && (
-
- }
- Logout={Logout}
- />
-
- )}
- {/* small screen nav bar */}
- {Navmenu && (
- <>
-
-
- {OtherServiceStatus && (
-
- )}
-
- {OpenFailData && (
-
- )}
- {/* {ComboDropDown?.length >= 1 && !OtherServicesglobal && (
-
- )} */}
- {navbarOptions?.map((item) => (
- <>
- {item?.OptionName == 'RePrint' && !OtherServicesglobal && (
-
-
-
- )}
- {!OtherServicesglobal && (
- <>
- {item?.OptionName == 'Hold' &&
- OrderType != 'Failed' &&
- OrderType != 'Reorder' &&
- CheckBookingStatus != 'Close' &&
- isHoldEnable &&
- !addnewAccess && (
-
-
-
- )}
- {/* {item?.OptionName == 'Quick Transfer' && (
-
-
- }
- size="small"
- onClick={showModal}
- />
-
-
- )} */}
- {item?.OptionName == 'QuickAdd' && (
-
-
-
- )}
- {item?.OptionName == 'DineIn' &&
- dinePreference &&
- PreferenceDatas?.[0]?.['SettingDtlDetails']?.find(
- (item) => item.SettingIdName === 'DineIn'
- )?.SettingValue === 'Y' && (
-
-
-
- )}
- {item?.OptionName == 'TakeAway' && (
-
-
-
- )}
- {item?.OptionName === 'Offer' &&
- GlobEstBooking !== 'OvrAllEst' &&
- GlobEstBooking !== 'ParEst' &&
- GlobEstBooking === 'Sales' &&
- PreferenceDatas?.[0]?.['SettingDtlDetails']?.find(
- (item) => item.SettingIdName === 'Offer'
- )?.SettingValue === 'Y' && (
-
-
-
- )}
- {item?.OptionName == 'ExtraCharge' && (
-
-
-
- )}
-
- {item?.OptionName == 'AddCustomer' && (
-
-
-
-
- }
- trigger="click"
- placement="left"
- open={open}
- onOpenChange={handleOpenChange}
- >
-
-
- )}
- >
- )}
- >
- ))}
- {!OtherServicesglobal && (
- <>
- {FeatureAddonData?.FeatureDtls?.find(
- (item) =>
- item?.FeatureAddonName?.toLowerCase() === 'Weight Scale'
- ) && (
-
-
-
- )}
- {!OtherServicesglobal && (
- <>
- {FeatureAddonData?.FeatureDtls?.find(
- (item) =>
- item?.FeatureAddonName?.toLowerCase() === 'preorder'
- ) && (
-
-
-
- {
- openPreOrder('small-screen');
- }}
- />
-
-
-
- )}
- >
- )}
- {preOrderOpen && (
-
- )}
- {sportsAppPreference &&
}
- {Estimation?.SettingValue === 'Y' &&
- !OrderOfferStatus &&
- BookingType !== 'Dine In' &&
- !BookingTypeBoth && (
-
-
-
- )}
- {SalesMode?.SettingValue === 'Y' &&
- !OtherServicesglobal &&
}
- {!OtherServicesglobal &&
- ScanLayoutScreen?.SettingValue === 'Y' && (
-
- )}
- {!sportsAppPreference && (
-
-
-
- )}
-
-
-
- {FeatureAddonData?.FeatureDtls?.find(
- (item) =>
- item?.FeatureAddonName?.toLowerCase() ===
- 'customer display'
- ) && (
-
- {/*
-
-
*/}
-
-
-
-
- )}
- {VerifyTheProducts && (
-
-
-
-
-
- )}
- {paymentfeataddon && (
-
- {
- paymentFailedStatusFun();
- }}
- style={{ width: '1.4rem', cursor: 'pointer' }}
- >
-
-
-
- )}
- >
- )}
-
-
- >
- )}
-
-
-
- {isFullscreen ? : }
-
-
-
- {isMobile && (
-
-
-
- )}
- {!OtherServicesglobal && (
-
-
-
- )}
-
-
-
-
-
-
- setMultiple(false)}
- destroyOnClose={true}
- children={
- <>
-
- >
- }
- />
-
- );
-};
-export default BSNavbar2;
diff --git a/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar3.jsx b/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar3.jsx
deleted file mode 100644
index 6a009a2..0000000
--- a/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar3.jsx
+++ /dev/null
@@ -1,1194 +0,0 @@
-import { useState, useEffect, useRef, useCallback, useMemo, lazy } from 'react';
-import { useNavigate } from 'react-router-dom';
-import { useDispatch, useSelector, shallowEqual } from 'react-redux';
-import {
- changealldata,
- changeBookingType,
- changeComboRedirectionToDefaultLayoutForParking,
- changeCompoPaymentIconStatus,
- changeCustomerID,
- changeEstimateBooking,
- changeOrderCardDetails,
- changeOtherServices,
- changeReorderHoldDetails,
- changeReorderProductDetails,
- changeSelectedCustId,
- changeSelectedOption,
- GlobalBookingType,
- GlobalBookingTypeBoth,
- GlobalComboRedirectionToDefaultLayoutForParking,
- GlobalCommonPaymentOptions,
- GlobalEstimateBooking,
- GlobalFeatAddOnData,
- GlobalOrderCardDetails,
- GlobalOrderStatus,
- GlobalOrderType,
- GlobalOtherSevices,
- GlobalSelCustId,
- PreferenceData,
-} from '../../../../Features/BookingScreen/BookingData/BookingData.js';
-import {
- ApplicationPreferences,
- GenerateLogout,
- GlobalCompBranchData,
-} from '../../../../Features/BrachLogin/BranchLogin.js';
-import { useApplyOfferto_CardDetail } from '../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
-import '../../../../Styles/BookingScreen/Components/BSNavbar/BSNavbar3.scss';
-
-// UI Imports
-import { Badge, Popconfirm, Tooltip } from 'antd';
-import { AiFillHome } from 'react-icons/ai';
-import { FaPlus, FaHandPaper, FaUserAlt, FaParking } from 'react-icons/fa';
-import { CiMenuBurger } from 'react-icons/ci';
-import { IoCloseOutline } from 'react-icons/io5';
-import {
- RiFullscreenExitFill,
- RiFullscreenFill,
- RiPrinterFill,
-} from 'react-icons/ri';
-import { GiShoppingBag } from 'react-icons/gi';
-const BSNavBarAddUser = lazy(
- () => import('../UtillComponents/BSNavBarAddUser.jsx')
-);
-const BSCustomerSelect = lazy(
- () => import('../UtillComponents/BSSelectCustomer.jsx')
-);
-const FeaturesFunctionalities = lazy(
- () => import('../BookingFunctionality/FeaturesFunctionalities.jsx')
-);
-import CustomerDisplayicon from '../UtillComponents/Pozo retail icons/PozoCustomerDisplayicon.jsx';
-import {
- getUserProfile,
- userDataByUserId,
-} from '../../../../Features/UserAccount/userData.js';
-import {
- clearSession,
- getSession,
- sessionStore,
-} from '../../../../Services/Others.js';
-import {
- getTemplate,
- getTemplateData,
- StoredSessionData,
-} from '../../../../Features/ThemeChange/ThemeChange.js';
-import {
- CurrentTimeDisplay,
- CurrentDateDisplay,
-} from '../UtillComponents/CurrentDateTimeDisplay.jsx';
-import TooltipWrapper from '../../../../Components/Tooltip/Tooltip.jsx';
-import { isMobile } from 'react-device-detect';
-import {
- getCustomerDisplayWindow,
- setCustomerDisplayWindow,
-} from '../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
-import BSNavBarPreOrder from '../UtillComponents/BSNavBarPreOrder.jsx';
-import {
- changepreOrder,
- changePreOrderAdditem,
- changepreOrderList,
- GlobalPreOrderPendingCount,
-} from '../../../../Features/BookingScreen/PreOrder/PreOrder.js';
-import PozoPreOrderIcon from '../UtillComponents/Pozo retail icons/PozoPreOrderIcon.jsx';
-import { OtherServicesCardlistdata } from '../../../../Features/OtherServices/OtherServices.js';
-import BSNavBarEstimate from '../UtillComponents/BSNavBarEst.jsx';
-import BSNavBarWholeSale from '../UtillComponents/BSNavBarWholeSale.jsx';
-import { Global_OfferStatus } from '../../../../Features/Offer/Offer.js';
-import { globalholddata } from '../../../../Features/BookingScreen/HoldOption/HoldOption.js';
-import BSNavBarWeightScale from '../UtillComponents/BSNavBarWeightScale.jsx';
-import { TbSettingsSearch } from 'react-icons/tb';
-import { DefaultModal } from '../../../../Components/Modal/DefaultModal.jsx';
-import MultipleSearch from '../UtillComponents/MultipleSearch.jsx';
-import { useNavbarCommon } from './BSNavBarCommon.js';
-
-// Jsx Files
-const BSNavBarFavItems = lazy(
- () => import('../UtillComponents/BSNavBarFavItems.jsx')
-);
-const BSNavBarHand = lazy(() => import('../UtillComponents/BSNavBarHand.jsx'));
-const BSNavBarDragItems = lazy(
- () => import('../UtillComponents/BSNavBarDragItems.jsx')
-);
-const BSNavBarUserInfo = lazy(() => import('./BSNavBarUserInfo.jsx'));
-
-const UserRelieveManager = lazy(
- () => import('../../Template/RealivingUser.jsx')
-);
-const BSNavbarSearchStandard = lazy(
- () => import('../UtillComponents/BSNavbarSearchStandard.jsx')
-);
-const BSPrinterSetting = lazy(
- () => import('../UtillComponents/BSPrinterSetting.jsx')
-);
-const BSNavBarTable = lazy(
- () => import('../UtillComponents/BSNavBarTable.jsx')
-);
-const BSMobilePrintSettings = lazy(
- () => import('../UtillComponents/BSMobilePrintSettings.jsx')
-);
-const BSScanTemplate = lazy(
- () => import('../UtillComponents/BSScanTemplate.jsx')
-);
-const VerfiedProducts = lazy(
- () => import('./verfiedProduct/VerfiedProducts.jsx')
-);
-const BSMembership = lazy(() => import('../UtillComponents/BSMembership.jsx'));
-const BranchName = lazy(() => import('../../Template/BranchName.jsx'));
-const BSNavBarAddons = lazy(
- () => import('../UtillComponents/BSNavBarAddons.jsx')
-);
-const BSNavBarOffer = lazy(
- () => import('../UtillComponents/BSNavBarOffer/BSNavBarOffer.jsx')
-);
-const BSNavBarQuickAdd = lazy(
- () => import('../UtillComponents/BSNavBarQuickAdd.jsx')
-);
-// Api
-const subDirectory = import.meta.env.ENV_BASE_URL;
-const commonUrl = import.meta.env.ENV_COMMON_BASE_URL;
-
-const BSNavbar3 = ({ optionNames }) => {
- const navigate = useNavigate();
- const dispatch = useDispatch();
- const applyOffer = useApplyOfferto_CardDetail();
- const userMenuRef = useRef(null);
- const searchInputRef = useRef(null);
- const mobileMenuRef = useRef(null);
- const SessionData = useSelector(StoredSessionData);
- const AppId = SessionData?.AppId;
- const CompId = SessionData?.CompId;
- const BranchId = SessionData?.BranchId;
- const userId = getSession('UserId');
-
- const [drawerOpen, setDrawerOpen] = useState({
- favourite: false,
- customer: false,
- hold: false,
- dragItem: false,
- reprint: false,
- verifyProduct: false,
- membership: false,
- wholesale: false,
- });
- const [isHoldEnable, setisisHoldEnable] = useState(false);
- const [isUserAccOpen, setIsUserAccOpen] = useState(false);
- const [quickAdd, setQuickAdd] = useState(false);
- const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
-
- const [multiple, setMultiple] = useState(false);
- const GlobEstBooking = useSelector(GlobalEstimateBooking);
- const compBranchData = useSelector(GlobalCompBranchData);
- const userProfileData = useSelector(userDataByUserId);
- const appPreferences = useSelector(ApplicationPreferences);
- const preferences = useSelector(PreferenceData);
- console.log(preferences, "preferencespreferences")
- const orderType = useSelector(GlobalOrderType);
- const bookingType = useSelector(GlobalBookingType, shallowEqual);
- const layoutData = useSelector(getTemplateData);
- const OtherServicesglobal = useSelector(GlobalOtherSevices);
- const preOrderPendingCount = useSelector(GlobalPreOrderPendingCount);
- const comboRedirectionToDefaultLayoutForParking = useSelector(
- GlobalComboRedirectionToDefaultLayoutForParking
- );
- const Holddata = useSelector(globalholddata);
- const OrderCardDetail = useSelector(GlobalOrderCardDetails);
- const FeatureAddonData = useSelector(GlobalFeatAddOnData);
- const tableData = useSelector(GlobalOrderStatus);
- const BookingTypeBoth = useSelector(GlobalBookingTypeBoth);
- const OrderOfferStatus = useSelector(Global_OfferStatus);
- const GlobaluseOptions = useSelector(GlobalCommonPaymentOptions);
- const SelCustId = useSelector(GlobalSelCustId);
-
- const Estimation = preferences?.[0]?.SettingDtlDetails?.find(
- (item) => item.SettingIdName === 'Estimation'
- );
- const ScanLayoutScreen = preferences?.[0]?.SettingDtlDetails?.find(
- (item) => item.SettingIdName === 'ScanLayout'
- );
- const verifyproduct = preferences?.[0]?.SettingDtlDetails?.find(
- (item) =>
- item.SettingIdName === 'VerifyProduct' && item.SettingValue === 'Y'
- );
- const Parking = preferences?.[0]?.SettingDtlDetails?.find(
- (item) => item.SettingIdName === 'Parking' && item.SettingValue === 'Y'
- );
-
- const commonModulePreference = appPreferences?.find(
- (preference) => preference?.PreferredCatName === 'Common Module'
- )?.PreferenceCatDetails;
- const sportsAppPreference = commonModulePreference?.find(
- (preference) =>
- preference?.PreferredSubCatName === 'SportsApp' &&
- preference?.PreferredStatus === 'Y'
- );
- const {
- searchOption,
- reprintOption,
- quickAddOption,
- dineInOption,
- takeAwayOption,
- offerOption,
- extraChargeOption,
- holdOption,
- addCustomerOption,
- } = useMemo(() => {
- const navbarOptions = layoutData?.BookingNavbar?.[1];
- return {
- searchOption: navbarOptions?.find(
- (option) => option?.OptionName?.toLowerCase() === 'search'
- ),
- reprintOption: navbarOptions?.find(
- (option) => option?.OptionName?.toLowerCase() === 'reprint'
- ),
- quickAddOption: navbarOptions?.find(
- (option) => option?.OptionName?.toLowerCase() === 'quickadd'
- ),
- dineInOption: navbarOptions?.find(
- (option) => option?.OptionName?.toLowerCase() === 'dinein'
- ),
- takeAwayOption: navbarOptions?.find(
- (option) => option?.OptionName?.toLowerCase() === 'takeaway'
- ),
- offerOption: navbarOptions?.find(
- (option) => option?.OptionName?.toLowerCase() === 'offer'
- ),
- extraChargeOption: navbarOptions?.find(
- (option) => option?.OptionName?.toLowerCase() === 'extracharge'
- ),
- holdOption: navbarOptions?.find(
- (option) => option?.OptionName?.toLowerCase() === 'hold'
- ),
- addCustomerOption: navbarOptions?.find(
- (option) => option?.OptionName?.toLowerCase() === 'addcustomer'
- ),
- };
- }, [layoutData]);
-
- const [preOrderOpen, setPreOrderOpen] = useState(false);
- const [preOrderhiseandShow, setpreOrderhiseandShow] = useState(false);
- const [OtherServiceStatus, setOtherServiceStatus] = useState(false);
-
- // Memoized preference data
- const { dineInPreference, takeAwayPreference } = useMemo(() => {
- const bookingTypePref =
- appPreferences?.find((p) => p?.PreferredCatName === 'Booking Type')
- ?.PreferenceCatDetails || [];
- return {
- dineInPreference: bookingTypePref.find(
- (p) =>
- p?.PreferredSubCatName?.toLowerCase() === 'dine in' &&
- p?.PreferredStatus === 'Y'
- ),
- takeAwayPreference: bookingTypePref.find(
- (p) =>
- p?.PreferredSubCatName?.toLowerCase() === 'take away' &&
- p?.PreferredStatus === 'Y'
- ),
- };
- }, [appPreferences]);
-
- const SalesMode = preferences?.[0]?.SettingDtlDetails?.find(
- (item) => item.SettingIdName === 'Sales Mode'
- );
-
- const { preferenceOffer, dineIn } = useMemo(() => {
- return {
- preferenceOffer:
- preferences?.[0]?.['SettingDtlDetails']?.find(
- (item) => item.SettingIdName === 'Offer'
- )?.SettingValue === 'Y',
-
- dineIn: preferences?.[0]?.['SettingDtlDetails'].find(
- (item) => item.SettingIdName === 'DineIn' && item?.SettingValue === 'Y'
- ),
- };
- }, [preferences]);
-
- console.log(dineIn, dineInPreference, 'dineInPreference');
-
- const BSComboNavbar = useMemo(() => {
- const layout = optionNames?.BookingLayout?.[0];
- return layout === 'Combo1'
- ? optionNames?.BookingCombo1
- : optionNames?.BookingCombo2;
- }, [optionNames]);
-
- const OfferCheckedInSetup = useMemo(() => {
- return BSComboNavbar?.[1]?.some((opt) => opt.OptionName === 'Offer');
- }, [BSComboNavbar]);
-
- useEffect(() => {
- dispatch(getUserProfile({ UserId: userId, ActiveStatus: 'A' })).unwrap();
- }, [userId]);
- useEffect(() => {
- handleOtherData();
- }, []);
- useEffect(() => {
- getPaymentOptionFeature();
- }, [GlobaluseOptions, SelCustId]);
- const getPaymentOptionFeature = async () => {
- const filterSalesPayment = GlobaluseOptions?.filter(
- (item) => item?.FlowName?.toLowerCase() === 'sales'
- );
-
- let filterPayCounter = filterSalesPayment?.[0]?.OptionDetails?.filter(
- (item) => item?.OptionName?.toLowerCase() === 'pay at the counter'
- );
-
- // If customer NOT selected → remove credit mode
- if (!SelCustId) {
- filterPayCounter = filterPayCounter?.map((option) => ({
- ...option,
- ModeDetails: option?.ModeDetails?.filter(
- (mode) => mode?.ModeName?.toLowerCase() !== 'credit'
- ),
- }));
- }
-
- setisisHoldEnable(filterPayCounter?.[0]?.ModeDetails?.length > 0);
- };
- useEffect(() => {
- const handleClickOutside = (event) => {
- if (userMenuRef.current && !userMenuRef.current.contains(event.target)) {
- setIsUserAccOpen(false);
- }
- if (
- mobileMenuRef.current &&
- !mobileMenuRef.current.contains(event.target) &&
- !event.target.closest('.mobile-toggle-btn')
- ) {
- setIsMobileMenuOpen(false);
- }
- };
- const handleEscKey = (event) => {
- if (event.key === 'Escape') {
- setIsUserAccOpen(false);
- setIsMobileMenuOpen(false);
- }
- };
- if (isUserAccOpen || isMobileMenuOpen) {
- document.addEventListener('mousedown', handleClickOutside);
- document.addEventListener('keydown', handleEscKey);
- }
- return () => {
- document.removeEventListener('mousedown', handleClickOutside);
- document.removeEventListener('keydown', handleEscKey);
- };
- }, [isUserAccOpen, isMobileMenuOpen]);
-
- const handleDineInNavigate = useCallback(async () => {
- navigate(`${subDirectory}sales/dine-in`);
- dispatch(changeBookingType('Dine In'));
- dispatch(changeEstimateBooking('Sales'));
- if (orderType === 'Hold') {
- dispatch(changeReorderHoldDetails({}));
- dispatch(changeReorderProductDetails([]));
- if (OfferCheckedInSetup && preferenceOffer) {
- await applyOffer([]);
- } else {
- dispatch(changeOrderCardDetails([]));
- }
- }
- }, [
- navigate,
- dispatch,
- orderType,
- OfferCheckedInSetup,
- preferenceOffer,
- applyOffer,
- ]);
-
- const handleTakeAway = () => dispatch(changeBookingType('TakeAway'));
- const handleUserAcc = () => setIsUserAccOpen((prev) => !prev);
- const handleHomePageNavigate = () => navigate(`${subDirectory}app-page/home`);
- const handleMobileMenuToggle = () => setIsMobileMenuOpen((prev) => !prev);
-
- const { handleFullscreen, isFullscreen } = useNavbarCommon();
-
- const renderWithTooltip = (element, title, placement = 'bottom') => (
-
- {element}
-
- );
- const openNewTab = async () => {
- const initialData = { Paymentgateway: false };
- let screenDetails;
-
- if ('getScreenDetails' in window) {
- try {
- screenDetails = await window.getScreenDetails();
- } catch (error) {
- console.error('Error accessing screen details:', error);
- }
- }
-
- // Select second monitor if available, otherwise use primary screen
- const secondScreen = screenDetails?.screens.find(
- (screen) => screen !== screenDetails.currentScreen
- );
- const targetScreen = secondScreen || window.screen;
-
- const customerDisplayWindow = window.open(
- `${subDirectory}customer-display`,
- 'CustomerDisplayWindow',
- `width=${targetScreen.width},height=${targetScreen.height},left=${targetScreen.left || 0},top=${targetScreen.top || 0},scrollbars=yes,resizable=yes`
- );
-
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- setCustomerDisplayWindow(customerDisplayWindow);
-
- customerDisplayWindow.onload = () => {
- setTimeout(() => {
- // Ensure it moves & resizes correctly
- customerDisplayWindow.moveTo(
- targetScreen.left || 0,
- targetScreen.top || 0
- );
- customerDisplayWindow.resizeTo(
- targetScreen.width,
- targetScreen.height
- );
-
- // Try fullscreen (Needs user interaction)
- try {
- customerDisplayWindow.document.documentElement.requestFullscreen();
- } catch (err) {
- console.warn('Fullscreen request failed:', err);
- }
-
- // Send initial data
- customerDisplayWindow.postMessage(initialData, '*');
- }, 500);
- };
- } else {
- console.error('Customer display window failed to open.');
- }
- };
- const handleQuickAddClose = async () => {
- dispatch(changeCompoPaymentIconStatus(false));
- setQuickAdd(false);
- };
-
- const handleQuickAddOpen = async () => {
- dispatch(changeCompoPaymentIconStatus(true));
- setQuickAdd(true);
- };
-
- const handleBackToLogin = () => {
- clearSession('BranchId');
- navigate(`${subDirectory}app-page/branch-login`);
- };
-
- const handleEditProfile = async () => {
- navigate(`${subDirectory}app-page/redirect-userprofile`);
- };
-
- const Logout = async () => {
- const status = 'N'; // replace with your actual status
- const res = await dispatch(
- GenerateLogout({ UserId: userId, status })
- ).unwrap();
- if (res?.data?.statusCode === 1) {
- clearSession();
- await sessionStore('Mode', 'Logout');
- window.location.replace(commonUrl);
- }
- };
-
- const openPreOrder = async (e) => {
- if (e == 'small-screen') {
- setPreOrderOpen(true);
- if (!preOrderhiseandShow) {
- setpreOrderhiseandShow(true);
- } else {
- setpreOrderhiseandShow(false);
- }
-
- // setpreOrderhiseandShow(!preOrderhiseandShow)
- } else {
- setPreOrderOpen((prevState) => !prevState);
- if (preOrderOpen) {
- const customerDisplayWindow = getCustomerDisplayWindow();
- if (customerDisplayWindow && !customerDisplayWindow.closed) {
- const updatedRemovedData = {
- userData: [],
- ExtraCharges: [],
- paymentMethod: 'Cash',
- type: 'remove',
- keyValue: 'customer',
- };
- customerDisplayWindow.postMessage(updatedRemovedData, '*');
- } else {
- console.error(
- 'Customer display window is not available or has been closed.'
- );
- }
- await dispatch(changepreOrder(false));
- await dispatch(changeEstimateBooking('Sales'));
- await dispatch(changePreOrderAdditem('AddDetails'));
- await dispatch(changealldata(null));
- await dispatch(changepreOrderList(null));
- await dispatch(changeCustomerID(null));
- await dispatch(changeSelectedCustId(null));
- await dispatch(changeSelectedOption(null));
- }
- }
- };
-
- const preOrderHandleclose = async () => {
- setPreOrderOpen(false);
- await dispatch(changepreOrder(false));
- setpreOrderhiseandShow(false);
- };
-
- const handleOtherData = async (e) => {
- let data = {
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- };
- let response = await dispatch(OtherServicesCardlistdata(data)).unwrap();
- if (response?.data?.statusCode === 1) {
- setOtherServiceStatus(true);
- } else {
- setOtherServiceStatus(false);
- }
- };
- const handleotherservices = async () => {
- if (OtherServicesglobal && comboRedirectionToDefaultLayoutForParking) {
- dispatch(changeComboRedirectionToDefaultLayoutForParking(false));
- await dispatch(getTemplate({ CompId, BranchId, AppId })).unwrap();
- }
- dispatch(changeOtherServices(!OtherServicesglobal));
- dispatch(changeOrderCardDetails([]));
- };
-
- return (
- <>
-
-
-
-
-
- {' '}
-
- {' '}
-
-
-
-
- {OtherServiceStatus && Parking && (
-
- )}
-
-
- {!sportsAppPreference && searchOption && (
-
searchInputRef.current?.focus()}
- >
-
- {/* Multiple search */}
-
-
- setMultiple(true)} />
-
-
-
- )}
-
- {/* Customer Select - Always visible */}
- {addCustomerOption && (
-
-
- {addCustomerOption && (
-
- {renderWithTooltip( , 'Add Customer')}
-
- )}
-
- )}
-
- {offerOption && (
-
- {GlobEstBooking !== 'OvrAllEst' &&
- GlobEstBooking !== 'ParEst' &&
- GlobEstBooking === 'Sales' &&
- preferences?.[0]?.['SettingDtlDetails']?.find(
- (item) => item.SettingIdName === 'Offer'
- )?.SettingValue === 'Y' && (
-
-
-
- )}
-
- )}
- {extraChargeOption && !sportsAppPreference && (
-
-
-
- )}
-
- {!sportsAppPreference && quickAddOption && (
-
-
-
- )}
- {/* Desktop CustomerActions */}
-
- {dineInPreference && dineIn && dineInOption && (
-
-
-
- )}
-
- {!OtherServicesglobal && (
- <>
- {FeatureAddonData?.FeatureDtls?.find(
- (item) =>
- item?.FeatureAddonName?.toLowerCase() !== 'weight scale'
- ) && (
-
-
-
- )}
- {FeatureAddonData?.FeatureDtls?.find(
- (item) => item?.FeatureAddonName?.toLowerCase() === 'preorder'
- ) && (
-
-
-
- {
- openPreOrder();
- }}
- HandleClose={preOrderHandleclose}
- />
-
-
-
- )}
- >
- )}
- {preOrderOpen && (
-
-
-
- )}
- {sportsAppPreference &&
}
- {!OtherServicesglobal && (
- <>
- {Estimation?.SettingValue === 'Y' &&
- bookingType !== 'Dine In' &&
- !BookingTypeBoth &&
- !OrderOfferStatus && (
-
-
-
- )}
- >
- )}
-
- {SalesMode?.SettingValue === 'Y' && !OtherServicesglobal && (
-
- )}
-
- {!sportsAppPreference && (
-
- {renderWithTooltip(
- ,
- 'Favourites'
- )}
-
- )}
- {holdOption &&
- ((bookingType !== 'Dine In' && OrderCardDetail?.length != 0) ||
- (bookingType !== 'Dine In' &&
- Holddata?.length > 0 &&
- OrderCardDetail?.length == 0)) &&
- isHoldEnable &&
- renderWithTooltip(
-
,
- 'Hold'
- )}
- {ScanLayoutScreen?.SettingValue === 'Y' &&
}
-
-
-
- {FeatureAddonData?.FeatureDtls?.find(
- (item) =>
- item?.FeatureAddonName?.toLowerCase() === 'customer display'
- ) && (
-
-
-
-
-
- )}
-
- {reprintOption && (
-
- )}
-
-
- {verifyproduct && (
-
- )}
-
- {isMobile && (
-
-
-
- )}
-
-
-
-
-
-
-
-
-
- {isFullscreen ? : }
-
-
-
-
-
- }
- Logout={Logout}
- />
-
-
- {/* Mobile Toggle Button */}
-
-
-
-
-
-
- {/* Mobile Menu */}
-
-
-
- {isMobileMenuOpen ? (
-
- ) : (
-
- )}
-
-
- {takeAwayPreference && takeAwayOption && (
-
- )}
- {dineInPreference && dineIn && dineInOption && (
-
- )}
- {!sportsAppPreference && (
-
- setDrawerOpen((prev) => ({
- ...prev,
- favourite: !prev?.favourite,
- }))
- }
- >
-
-
Favourite
-
- )}
- {addCustomerOption && (
-
- setDrawerOpen((prev) => ({
- ...prev,
- customer: !prev?.customer,
- }))
- }
- >
-
-
Add Customer
-
- )}
- {quickAddOption && (
-
- {renderWithTooltip(
, 'Quick Add', 'top')}
-
Quick Add
-
- )}
- {holdOption &&
- ((bookingType !== 'Dine In' && OrderCardDetail?.length != 0) ||
- (bookingType !== 'Dine In' &&
- Holddata?.length > 0 &&
- isHoldEnable &&
- OrderCardDetail?.length == 0)) && (
-
- setDrawerOpen((prev) => ({ ...prev, hold: !prev?.hold }))
- }
- >
-
-
Hold
-
- )}
- {ScanLayoutScreen?.SettingValue === 'Y' &&
}
-
{
- if (e.target === e.currentTarget) {
- setDrawerOpen((prev) => ({
- ...prev,
- dragItem: !prev?.dragItem,
- }));
- }
- }}
- >
-
-
{
- if (e.target === e.currentTarget) {
- setDrawerOpen((prev) => ({
- ...prev,
- dragItem: !prev?.dragItem,
- }));
- }
- }}
- >
- Drag Item
-
-
- {reprintOption && (
-
{
- if (e.target === e.currentTarget) {
- setDrawerOpen((prev) => ({
- ...prev,
- reprint: !prev?.reprint,
- }));
- }
- }}
- >
-
-
{
- if (e.target === e.currentTarget) {
- setDrawerOpen((prev) => ({
- ...prev,
- reprint: !prev?.reprint,
- }));
- }
- }}
- >
- Re-Print
-
-
- )}
- {verifyproduct && (
-
{
- if (e.target === e.currentTarget) {
- setDrawerOpen((prev) => ({
- ...prev,
- verifyProduct: !prev?.verifyProduct,
- }));
- }
- }}
- >
-
-
-
-
-
-
-
{
- if (e.target === e.currentTarget) {
- setDrawerOpen((prev) => ({
- ...prev,
- verifyProduct: !prev?.verifyProduct,
- }));
- }
- }}
- >
- Verify Product
-
-
- )}
-
- {sportsAppPreference && (
-
{
- if (e.target === e.currentTarget) {
- setDrawerOpen((prev) => ({
- ...prev,
- membership: !prev?.membership,
- }));
- }
- }}
- >
-
-
{
- if (e.target === e.currentTarget) {
- setDrawerOpen((prev) => ({
- ...prev,
- membership: !prev?.membership,
- }));
- }
- }}
- >
- Membership
-
-
- )}
-
- {!OtherServicesglobal && (
- <>
- {Estimation?.SettingValue === 'Y' &&
- bookingType !== 'Dine In' &&
- !BookingTypeBoth &&
- !OrderOfferStatus && (
-
- )}
- >
- )}
- {SalesMode?.SettingValue === 'Y' && !OtherServicesglobal && (
-
{
- if (e.target === e.currentTarget) {
- setDrawerOpen((prev) => ({
- ...prev,
- wholesale: !prev?.wholesale,
- }));
- }
- }}
- >
-
-
{
- if (e.target === e.currentTarget) {
- setDrawerOpen((prev) => ({
- ...prev,
- wholesale: !prev?.wholesale,
- }));
- }
- }}
- >
- WholeSale
-
-
- )}
-
-
-
-
- setMultiple(false)}
- destroyOnClose={true}
- children={
- <>
-
- >
- }
- />
- {quickAdd && (
-
- )}
- >
- );
-};
-
-export default BSNavbar3;
diff --git a/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarFavItems.jsx b/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarFavItems.jsx
index 6b61425..66277f6 100644
--- a/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarFavItems.jsx
+++ b/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarFavItems.jsx
@@ -26,7 +26,7 @@ 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 '../../../../Styles/BookingScreen/Components/BSNavbar/BSNavbar2.scss';
+import "./BSNavBarFavItems.scss"
const BSNavBarFavItems = ({ type, fill, drawerOpen = false }) => {
const [open, setOpen] = useState(false);
diff --git a/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarFavItems.scss b/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarFavItems.scss
new file mode 100644
index 0000000..1e99ba9
--- /dev/null
+++ b/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarFavItems.scss
@@ -0,0 +1,150 @@
+.AddFavList {
+ padding: 1.5rem 2rem;
+ position: absolute;
+ width: 33vw;
+ top: 0;
+ height: 100vh;
+ background-color: white;
+ right: 2px;
+ transition-duration: 0.6s;
+ z-index: 50;
+ box-shadow: var(--BOX_SHADOW_LEVEL2);
+ color: black;
+ display: inline-flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 10px;
+ border-radius: 6px;
+}
+
+.AddFavList-subContainer {
+ display: flex;
+ column-gap: 2rem;
+ flex-wrap: wrap;
+ flex-direction: column;
+}
+
+.favItem-SearchBar {
+ display: flex;
+ height: 32px;
+ border: 1px solid var(--DEFAULT_SELECTED_COLOR);
+ border-radius: 50px;
+ width: 100%;
+ background-image: url(https://cdn3.iconfinder.com/data/icons/feather-5/24/search-64.png);
+ background-repeat: no-repeat;
+ background-size: 18px 18px;
+ background-position: 95% center;
+ padding: 0 1rem;
+}
+
+.AddFavItemListCont {
+ height: 60vh;
+ overflow: auto;
+ width: 100%;
+}
+
+.AddFavItemList {
+ margin: 0.5rem 0rem;
+ padding: 0.5rem 2rem;
+ display: flex;
+ width: 100%;
+ height: 40px;
+ background-color: #fcfcfc;
+ justify-content: space-between;
+ border-radius: 6px;
+ align-items: center;
+ transition-duration: 0.6s;
+
+ .anticon {
+ color: red !important;
+ }
+}
+
+.AddFavItemList:hover {
+ width: 100%;
+ height: 45px;
+ background-color: #ebebeb;
+ font-size: 16px;
+ font-weight: 600;
+ transition-duration: 0.1s;
+}
+@media (max-width: 900px) {
+ .AddFavList-subContainer {
+ display: flex;
+ column-gap: 2rem;
+ flex-direction: column;
+ width: 100%;
+ }
+
+ .AddFavList {
+ width: 55vw !important;
+ }
+}
+
+@media (max-width: 768px) {
+ .AddFavList {
+ position: fixed;
+ left: 0;
+ top: 17rem;
+ width: 100vw !important;
+ padding: 1rem 1rem !important;
+ }
+
+ .AddFavItemListCont {
+ height: 34vh;
+ overflow: auto;
+ }
+
+ .AddFavItemList {
+ padding: 0.5rem !important;
+ }
+}
+
+@media (max-width: 768px) {
+ .AddFavList {
+ position: fixed;
+ left: 0;
+ top: 17rem;
+ width: 100vw !important;
+ padding: 1rem 1rem !important;
+ }
+
+ .smallScreenclose {
+ display: none;
+ }
+
+ .favItem-SearchBar {
+ width: 97%;
+ height: 2.8rem;
+ }
+
+ .fav-close {
+ display: flex;
+ justify-content: flex-end;
+ border: none;
+ border-radius: 5px;
+ cursor: pointer;
+ font-size: 23px;
+ }
+
+ .fav-Downarrow {
+ display: flex;
+ }
+
+ .AddFavList .primary_Button {
+ width: 12rem !important;
+ }
+ .favItem-SearchBar {
+ width: 97%;
+ height: 2.8rem;
+ }
+
+ .AddFavList .primary_Button {
+ width: 10rem;
+ }
+}
+@media (max-width: 499px) {
+ .favItem-SearchBar {
+ width: 7.6rem;
+ }
+}
diff --git a/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarSearch.jsx b/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarSearch.jsx
index ded503f..cd24d4c 100644
--- a/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarSearch.jsx
+++ b/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarSearch.jsx
@@ -435,32 +435,10 @@ const BSNavBarSearch = (props) => {
)}
- {/* {props.nosearch==true?'':
-
-
-
} */}
+
- {/* {isMobile && screenWidth <= 768 && (
- handleQrData('')} // Close modal on cancel
- className={'barcode-reader-modal'}
- >
- {openScanner && (
-
- )}
-
- )} */}
+
);
};
diff --git a/src/Pages/BookingScreen/Forms/DirectSale/DirectSale.jsx b/src/Pages/BookingScreen/Forms/DirectSale/DirectSale.jsx
index 450ca02..63bb1da 100644
--- a/src/Pages/BookingScreen/Forms/DirectSale/DirectSale.jsx
+++ b/src/Pages/BookingScreen/Forms/DirectSale/DirectSale.jsx
@@ -45,6 +45,8 @@ const StickerPrintTemplates = lazy(
// SCss
import '../../../../Styles/BookingScreen/Components/OtherConponents/Reprint/BSReprint.scss';
import Loader from '../../../../Components/Loader/Loader.jsx';
+import PozoLoader1 from '../../../../Components/PozoAppLoader/PozoLoader1.jsx';
+import PozoLoader2 from '../../../../Components/PozoAppLoader/PozoLoader2.jsx';
const DirectSale = ({
UomData = [],
TaxData = [],
@@ -951,7 +953,8 @@ const DirectSale = ({
}, []);
return (
- }>
+ // }>
+ }>
import('../../Components/BSItemCards/BSOtherServiceItemCard.jsx')
);
-const BSNavbar3 = lazy(() => import('../../Components/BSNavbar/BSNavbar3.jsx'));
-const SalesCountForStandard = lazy(
+ const SalesCountForStandard = lazy(
() => import('../SalesCountForStandard.jsx')
);
const StandardTable = lazy(
diff --git a/src/Pages/BookingScreen/Template/BSLayout2/BSLayout2.jsx b/src/Pages/BookingScreen/Template/BSLayout2/BSLayout2.jsx
index 554c6d2..5448527 100644
--- a/src/Pages/BookingScreen/Template/BSLayout2/BSLayout2.jsx
+++ b/src/Pages/BookingScreen/Template/BSLayout2/BSLayout2.jsx
@@ -50,11 +50,8 @@ import { PutBookingClose } from '../../../../Features/BookingScreen/RetailBookin
import TooltipWrapper from '../../../../Components/Tooltip/Tooltip.jsx';
const BSNavbar1 = lazy(() => import('../../Components/BSNavbar/BSNavbar1'));
-const BSNavbar2 = lazy(() => import('../../Components/BSNavbar/BSNavbar2'));
import BSItemCard from '../../Components/BSItemCards/BSItemCard';
-const BSBillingTable1 = lazy(
- () => import('../../Components/BSBillingTables/BSBillingTable1/BSBTOverall1')
-);
+
const BSBillingTable2 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable2/BSBillingTable2')
@@ -63,21 +60,7 @@ const BSBillingTable3 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3overall')
);
-const BSBillingTable4 = lazy(
- () =>
- import('../../Components/BSBillingTables/BSBillingTable4/BSBillingTable4Full')
-);
-const BSBillingTable5 = lazy(
- () =>
- import('../../Components/BSBillingTables/BSBillingTable5/BSBillingTable5')
-);
-const BSBillingTable6 = lazy(
- () => import('../../Components/BSBillingTables/BSBillingTable6/BSBTOverall6')
-);
-const BSBillingTable7 = lazy(
- () =>
- import('../../Components/BSBillingTables/BSBillingTable7/BSBillingTable7Overall.jsx')
-);
+
const CategoryHorizontal = lazy(
() => import('../../Components/BSCategories/BSCategoryHorizontal')
);
@@ -117,7 +100,6 @@ const ListOfSalesInvoices = lazy(
import('../../Components/BSBillingTables/ListofInvoices/ListOfSalesInvoices.jsx')
);
-const BSNavbar3 = lazy(() => import('../../Components/BSNavbar/BSNavbar3.jsx'));
const StandardTable = lazy(
() =>
import('../../Components/BSBillingTables/StandardTable/StandardTable.jsx')
diff --git a/src/Pages/BookingScreen/Template/BSLayout3/BSLayout3.jsx b/src/Pages/BookingScreen/Template/BSLayout3/BSLayout3.jsx
index c6c6c07..c7d0475 100644
--- a/src/Pages/BookingScreen/Template/BSLayout3/BSLayout3.jsx
+++ b/src/Pages/BookingScreen/Template/BSLayout3/BSLayout3.jsx
@@ -13,14 +13,9 @@ import { isMobile } from 'react-device-detect';
import CategoryHorizontal from '../../Components/BSCategories/BSCategoryHorizontal';
import SubCategoryHorizontal from '../../Components/BSSubCategories/BSSubCategoryHorizontal';
import BSItemCard from '../../Components/BSItemCards/BSItemCard';
-import BSBillingTable1 from '../../Components/BSBillingTables/BSBillingTable1/BSBTOverall1';
-import BSBillingTable2 from '../../Components/BSBillingTables/BSBillingTable2/BSBillingTable2';
+ import BSBillingTable2 from '../../Components/BSBillingTables/BSBillingTable2/BSBillingTable2';
import BSBillingTable3 from '../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3overall';
-import BSBillingTable4 from '../../Components/BSBillingTables/BSBillingTable4/BSBillingTable4Full';
-import BSBillingTable6 from '../../Components/BSBillingTables/BSBillingTable6/BSBTOverall6';
-import BSBillingTable5 from '../../Components/BSBillingTables/BSBillingTable5/BSBillingTable5';
-import BSBillingTable7 from '../../Components/BSBillingTables/BSBillingTable7/BSBillingTable7Overall.jsx';
-import { dynamicComponentProps } from '../DynamicComponentProps.js';
+ import { dynamicComponentProps } from '../DynamicComponentProps.js';
import {
getTemplateData,
GlobalPricingAppPricingName,
@@ -90,8 +85,7 @@ const BSOtherServiceItemCard = lazy(
const BSOtherServicesHorizontalcat = lazy(
() => import('../../Components/BSCategories/BSOtherServicesHorizontalcat')
);
-const BSNavbar3 = lazy(() => import('../../Components/BSNavbar/BSNavbar3.jsx'));
-const SalesCountForStandard = lazy(
+ const SalesCountForStandard = lazy(
() => import('../SalesCountForStandard.jsx')
);
const StandardTable = lazy(
@@ -107,8 +101,7 @@ const ComboSalesBillTable = lazy(
// );
import PlanExpireNotification from '../PlanExpireNotification.jsx';
const BSNavbar1 = lazy(() => import('../../Components/BSNavbar/BSNavbar1'));
-const BSNavbar2 = lazy(() => import('../../Components/BSNavbar/BSNavbar2'));
-// Scss
+ // Scss
import '../../../../Styles/BookingScreen/Template/BSLayout3/BSLayout3.scss';
import CardSkeleton from '../../../../Components/Skeleton/CardSkeleton.jsx';
diff --git a/src/Pages/BookingScreen/Template/BSLayout4/BSLayout4.jsx b/src/Pages/BookingScreen/Template/BSLayout4/BSLayout4.jsx
index 9586f5c..f43e5fc 100644
--- a/src/Pages/BookingScreen/Template/BSLayout4/BSLayout4.jsx
+++ b/src/Pages/BookingScreen/Template/BSLayout4/BSLayout4.jsx
@@ -5,16 +5,13 @@ 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 BSNavbar2 = lazy(() => import('../../Components/BSNavbar/BSNavbar2'));
-const CategoryHorizontal = lazy(
+ const CategoryHorizontal = lazy(
() => import('../../Components/BSCategories/BSCategoryHorizontal')
);
const BSItemCard = lazy(
() => import('../../Components/BSItemCards/BSItemCard')
);
-const BSBillingTable1 = lazy(
- () => import('../../Components/BSBillingTables/BSBillingTable1/BSBTOverall1')
-);
+
const BSBillingTable2 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable2/BSBillingTable2')
@@ -23,21 +20,7 @@ const BSBillingTable3 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3overall')
);
-const BSBillingTable4 = lazy(
- () =>
- import('../../Components/BSBillingTables/BSBillingTable4/BSBillingTable4Full')
-);
-const BSBillingTable5 = lazy(
- () =>
- import('../../Components/BSBillingTables/BSBillingTable5/BSBillingTable5')
-);
-const BSBillingTable6 = lazy(
- () => import('../../Components/BSBillingTables/BSBillingTable6/BSBTOverall6')
-);
-const BSBillingTable7 = lazy(
- () =>
- import('../../Components/BSBillingTables/BSBillingTable7/BSBillingTable7Overall.jsx')
-);
+
import { dynamicComponentProps } from '../DynamicComponentProps.js';
import {
getTemplateData,
@@ -112,8 +95,7 @@ const BSOtherServicesVerticalcat = lazy(
() => import('../../Components/BSCategories/BSOtherServicesVerticalcat.jsx')
);
-const BSNavbar3 = lazy(() => import('../../Components/BSNavbar/BSNavbar3.jsx'));
-
+
const SalesCountForStandard = lazy(
() => import('../SalesCountForStandard.jsx')
);
diff --git a/src/Pages/BookingScreen/Template/BSLayout5/BSLayout5.jsx b/src/Pages/BookingScreen/Template/BSLayout5/BSLayout5.jsx
index fa9f184..018e86e 100644
--- a/src/Pages/BookingScreen/Template/BSLayout5/BSLayout5.jsx
+++ b/src/Pages/BookingScreen/Template/BSLayout5/BSLayout5.jsx
@@ -6,8 +6,6 @@ import { Tooltip, Badge, Popconfirm } from 'antd';
const BSNavbar1 = lazy(() => import('../../Components/BSNavbar/BSNavbar1'));
-const BSNavbar2 = lazy(() => import('../../Components/BSNavbar/BSNavbar2'));
-
const BSBillingTable1 = lazy(
() => import('../../Components/BSBillingTables/BSBillingTable1/BSBTOverall1')
);
@@ -22,21 +20,6 @@ const BSBillingTable3 = lazy(
import('../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3overall')
);
-import BSBillingTable4 from '../../Components/BSBillingTables/BSBillingTable4/BSBillingTable4Full';
-
-const BSBillingTable5 = lazy(
- () =>
- import('../../Components/BSBillingTables/BSBillingTable5/BSBillingTable5')
-);
-
-const BSBillingTable6 = lazy(
- () => import('../../Components/BSBillingTables/BSBillingTable6/BSBTOverall6')
-);
-
-const BSBillingTable7 = lazy(
- () =>
- import('../../Components/BSBillingTables/BSBillingTable7/BSBillingTable7Overall.jsx')
-);
import BSItemCard from '../../Components/BSItemCards/BSItemCard';
const CategoryHorizontal = lazy(
() => import('../../Components/BSCategories/BSCategoryHorizontal')
@@ -101,7 +84,6 @@ import BSOtherServiceItemCard from '../../Components/BSItemCards/BSOtherServiceI
import BSOtherServicesHorizontalcat from '../../Components/BSCategories/BSOtherServicesHorizontalcat';
import BSOtherServicesVerticalcat from '../../Components/BSCategories/BSOtherServicesVerticalcat.jsx';
import StandardTable from '../../Components/BSBillingTables/StandardTable/StandardTable.jsx';
-import BSNavbar3 from '../../Components/BSNavbar/BSNavbar3.jsx';
import SalesCountForStandard from '../SalesCountForStandard.jsx';
import { CiShop } from 'react-icons/ci';
import BranchName from '../BranchName.jsx';
diff --git a/src/Pages/BookingScreen/Template/BSLayout6/BSLayout6.jsx b/src/Pages/BookingScreen/Template/BSLayout6/BSLayout6.jsx
index f92d08f..a945133 100644
--- a/src/Pages/BookingScreen/Template/BSLayout6/BSLayout6.jsx
+++ b/src/Pages/BookingScreen/Template/BSLayout6/BSLayout6.jsx
@@ -5,8 +5,6 @@ import moment from 'moment';
import { Tooltip, Badge, Popconfirm } from 'antd';
const BSNavbar1 = lazy(() => import('../../Components/BSNavbar/BSNavbar1'));
-const BSNavbar2 = lazy(() => import('../../Components/BSNavbar/BSNavbar2'));
-
const BSBillingTable1 = lazy(
() => import('../../Components/BSBillingTables/BSBillingTable1/BSBTOverall1')
);
@@ -20,25 +18,7 @@ const BSBillingTable3 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3overall')
);
-
-const BSBillingTable4 = lazy(
- () =>
- import('../../Components/BSBillingTables/BSBillingTable4/BSBillingTable4Full')
-);
-
-const BSBillingTable5 = lazy(
- () =>
- import('../../Components/BSBillingTables/BSBillingTable5/BSBillingTable5')
-);
-
-const BSBillingTable6 = lazy(
- () => import('../../Components/BSBillingTables/BSBillingTable6/BSBTOverall6')
-);
-
-const BSBillingTable7 = lazy(
- () =>
- import('../../Components/BSBillingTables/BSBillingTable7/BSBillingTable7Overall.jsx')
-);
+
import BSItemCard from '../../Components/BSItemCards/BSItemCard';
const CategoryHorizontal = lazy(
() => import('../../Components/BSCategories/BSCategoryHorizontal')
@@ -54,7 +34,6 @@ import {
SelectedGlobalBillingColorDetail,
} from '../../../../Features/ThemeChange/ThemeChange';
import '../../../../Styles/BookingScreen/Template/BSLayout6/BSLayout6.scss';
-import '../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4.scss';
import { settingDataSelector } from '../../../../Features/PreferenceMaster/PreferenceMaster.js';
import {
GlobalSalesDetailData,
@@ -112,7 +91,6 @@ const BSExpireProductsList = lazy(
import BSOtherServiceItemCard from '../../Components/BSItemCards/BSOtherServiceItemCard.jsx';
import BSOtherServicesHorizontalcat from '../../Components/BSCategories/BSOtherServicesHorizontalcat';
-import BSNavbar3 from '../../Components/BSNavbar/BSNavbar3.jsx';
import SalesCountForStandard from '../SalesCountForStandard.jsx';
import StandardTable from '../../Components/BSBillingTables/StandardTable/StandardTable.jsx';
import ComboSalesBillTable from '../../Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx';
diff --git a/src/Pages/BookingScreen/Template/BSLayout7/BSCombo1.jsx b/src/Pages/BookingScreen/Template/BSLayout7/BSCombo1.jsx
index a7b227b..f56559d 100644
--- a/src/Pages/BookingScreen/Template/BSLayout7/BSCombo1.jsx
+++ b/src/Pages/BookingScreen/Template/BSLayout7/BSCombo1.jsx
@@ -9,10 +9,7 @@ import React, {
import { useDispatch, useSelector } from 'react-redux';
import moment from 'moment';
import { Tooltip, Badge, Popconfirm } from 'antd';
-// const BSBillingTable1 = lazy(
-// () =>
-// import('../../Components/BSBillingTables/BSBillingTable1/BSBillingTable1')
-// );
+
const BSBillingTable2 = lazy(
() => import('../../Components/BSBillingTables/BSBillingTable2/BsBill2')
);
@@ -20,21 +17,8 @@ const BSBillingTable3 = lazy(
() =>
import('../../Components/BSBillingTables/BSBillingTable3/BSBillingTable3')
);
-// const BSBillingTable4 = lazy(
-// () =>
-// import('../../Components/BSBillingTables/BSBillingTable4/BSBillingTable4')
-// );
-const BSBillingTable5 = lazy(
- () => import('../../Components/BSBillingTables/BSBillingTable5/BsBill')
-);
-const BSBillingTable6 = lazy(
- () =>
- import('../../Components/BSBillingTables/BSBillingTable6/BSBillingTable6')
-);
-const BSBillingTable7 = lazy(
- () =>
- import('../../Components/BSBillingTables/BSBillingTable7/BSBillingTable7')
-);
+
+
// Combo components (lazy)
const BSC1Payment = lazy(() => import('../../Components/BSCombo/BSC1Payment'));
@@ -75,7 +59,6 @@ import {
StoredSessionData,
} from '../../../../Features/ThemeChange/ThemeChange.js';
import './../../../../Styles/BookingScreen/Template/BSLayout7/Combo1.scss';
-import '../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.scss';
import {
GLobalSadminUserPin,
putSadminUserExit,
@@ -607,9 +590,9 @@ export default function BSCombo1() {
{BookingBilling == 'Billing2' && }
{BookingBilling == 'Billing3' && }
{BookingBilling == 'Billing4' && }
- {BookingBilling == 'Billing5' && }
- {BookingBilling == 'Billing6' && }
- {BookingBilling == 'Billing7' && }
+ {BookingBilling == 'Billing5' && }
+ {BookingBilling == 'Billing6' && }
+ {BookingBilling == 'Billing7' && }
{BookingBilling == 'Billing8' && }
>
)}
diff --git a/src/Pages/DashBoard/RetailDashboard.jsx b/src/Pages/DashBoard/RetailDashboard.jsx
index 1354768..8b52761 100644
--- a/src/Pages/DashBoard/RetailDashboard.jsx
+++ b/src/Pages/DashBoard/RetailDashboard.jsx
@@ -88,6 +88,8 @@ import Loader from '../../Components/Loader/Loader.jsx';
import { getUserProfile } from '../../Features/UserAccount/userData.js';
import { Messages } from '../../Components/Notifications/Messages.jsx';
import TabSwitcher from './TabSwitcher.jsx';
+import PozoLoader1 from '../../Components/PozoAppLoader/PozoLoader1.jsx';
+import PozoLoader2 from '../../Components/PozoAppLoader/PozoLoader2.jsx';
const commonUrl = import.meta.env.ENV_COMMON_BASE_URL;
const subDirectory = import.meta.env.ENV_BASE_URL;
@@ -128,7 +130,7 @@ const RetailDashboard = () => {
const CompId = getSession('CompId');
const BranchId = getSession('BranchId');
- console.log(BranchId, "BranchId")
+ console.log(BranchId, 'BranchId');
const AppId = getSession('AppId');
const UserId = getSession('UserId');
const UserType = getSession('UserType');
@@ -316,18 +318,17 @@ const RetailDashboard = () => {
const checkWarehouseorNot = async (e) => {
let data = CompBranchData?.find((a) => a?.BrId == e);
if (data?.LocationType == 'W') {
- sessionStore("Warhouse", true)
+ sessionStore('Warhouse', true);
await dispatch(changeWarehouse(true));
- }
- else {
- sessionStore("Warehouse", false)
+ } else {
+ sessionStore('Warehouse', false);
await dispatch(changeWarehouse(false));
}
- }
+ };
if (CompBranchData?.length > 0 && BranchId) {
- checkWarehouseorNot(BranchId)
+ checkWarehouseorNot(BranchId);
}
- }, [CompBranchData, BranchId])
+ }, [CompBranchData, BranchId]);
useEffect(() => {
if (
@@ -1380,7 +1381,8 @@ const RetailDashboard = () => {
backgroundColor: '#fff',
}}
>
-
+ {/* */}
+
);
@@ -1655,8 +1657,8 @@ const RetailDashboard = () => {
{
if (!BranchId) {
- message.error("Please log in to a branch first.");
- return null
+ message.error('Please log in to a branch first.');
+ return null;
}
const hasEmpAccess = EmpData?.find(
(item) =>
@@ -1694,8 +1696,8 @@ const RetailDashboard = () => {
{
if (!BranchId) {
- message.error("Please log in to a branch first.");
- return null
+ message.error('Please log in to a branch first.');
+ return null;
}
const hasEmpAccess = EmpData?.find(
(item) =>
@@ -1726,8 +1728,8 @@ const RetailDashboard = () => {
{
if (!BranchId) {
- message.error("Please log in to a branch first.");
- return null
+ message.error('Please log in to a branch first.');
+ return null;
}
const hasEmpAccess = EmpData?.find(
(item) =>
@@ -1756,8 +1758,8 @@ const RetailDashboard = () => {
className="quickActionBox"
onClick={() => {
if (!BranchId) {
- message.error("Please log in to a branch first.");
- return null
+ message.error('Please log in to a branch first.');
+ return null;
}
const hasEmpAccess = EmpData?.find(
(item) =>
@@ -1773,6 +1775,11 @@ 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`);
}
}}
@@ -2220,24 +2227,24 @@ const RetailDashboard = () => {
>
{preorderData?.[0]?.BranchDtl
? preorderData?.[0]?.BranchDtl?.map(
- (item, index) => (
-
-
- {item.BranchName || 'N/A'}
-
-
- Total Orders: {item.TotalOrders || 0}
-
-
+ (item, index) => (
+
+
+ {item.BranchName || 'N/A'}
+
+
+ Total Orders: {item.TotalOrders || 0}
+
+
+ )
)
- )
: 'No Data'}
}
@@ -2260,24 +2267,24 @@ const RetailDashboard = () => {
>
{preorderData?.[0]?.BranchDtl
? preorderData?.[0]?.BranchDtl?.map(
- (item, index) => (
-
-
- {item.BranchName || 'N/A'}
-
-
- Total Orders: {item.PendingOrders || 0}
-
-
+ (item, index) => (
+
+
+ {item.BranchName || 'N/A'}
+
+
+ Total Orders: {item.PendingOrders || 0}
+
+
+ )
)
- )
: 'No Data'}
}
@@ -2300,24 +2307,24 @@ const RetailDashboard = () => {
>
{preorderData?.[0]?.BranchDtl
? preorderData?.[0]?.BranchDtl?.map(
- (item, index) => (
-
-
- {item.BranchName || 'N/A'}
-
-
- Total Orders: {item.CompletedOrders || 0}
-
-
+ (item, index) => (
+
+
+ {item.BranchName || 'N/A'}
+
+
+ Total Orders: {item.CompletedOrders || 0}
+
+
+ )
)
- )
: 'No Data'}
}
@@ -2477,12 +2484,14 @@ const RetailDashboard = () => {
{SelectTypeName === 'OTP'
? !FirstTimeOtp
? `send ${SelectTypeName.toLocaleLowerCase()}`
- : `resend ${SelectTypeName.toLocaleLowerCase()}${seconds > 0 ? ` in ${seconds}s` : ''
- }`
+ : `resend ${SelectTypeName.toLocaleLowerCase()}${
+ seconds > 0 ? ` in ${seconds}s` : ''
+ }`
: !FirstTimePin
? `send ${SelectTypeName.toLocaleLowerCase()}`
- : `resend ${SelectTypeName.toLocaleLowerCase()}${seconds > 0 ? ` in ${seconds}s` : ''
- }`}
+ : `resend ${SelectTypeName.toLocaleLowerCase()}${
+ seconds > 0 ? ` in ${seconds}s` : ''
+ }`}
diff --git a/src/Pages/PurchaseOrder/CustomerPurchaseConfirm/CustomerPurchaseConfirm.jsx b/src/Pages/PurchaseOrder/CustomerPurchaseConfirm/CustomerPurchaseConfirm.jsx
index 1a7d6dc..b4603ee 100644
--- a/src/Pages/PurchaseOrder/CustomerPurchaseConfirm/CustomerPurchaseConfirm.jsx
+++ b/src/Pages/PurchaseOrder/CustomerPurchaseConfirm/CustomerPurchaseConfirm.jsx
@@ -1,8 +1,12 @@
import React, { useCallback, useEffect, useState } from 'react';
import './CustomerPurchaseConfirm.scss';
import axios from 'axios';
-import { ArrowRightOutlined, DeleteFilled, CheckCircleOutlined } from '@ant-design/icons';
-import { Table } from "antd";
+import {
+ ArrowRightOutlined,
+ DeleteFilled,
+ CheckCircleOutlined,
+} from '@ant-design/icons';
+import { Table } from 'antd';
const url_string = window.location.href;
const url = new URL(url_string);
@@ -11,300 +15,327 @@ const codesParam = url.searchParams.get('code');
import { sessionStore } from '../../../Services/Others';
import Loader from '../../../Components/Loader/Loader';
import { useDispatch } from 'react-redux';
-import { CustomerPurchase, getPurchaseLowStock } from '../../../Features/ConfigMasterPage/ConfigMasterPage';
+import {
+ CustomerPurchase,
+ getPurchaseLowStock,
+} from '../../../Features/ConfigMasterPage/ConfigMasterPage';
import { Messages } from '../../../Components/Notifications/Messages';
import PurchasePDFPrint from './PurchasePDFPrint';
import { Buttons } from '../../../../ownLib/my-ui-lib';
+import PozoLoader1 from '../../../Components/PozoAppLoader/PozoLoader1';
+import PozoLoader2 from '../../../Components/PozoAppLoader/PozoLoader2';
function CustomerPurchaseConfirm() {
- const apiUrlToken = import.meta.env.ENV_API_URL_TOKEN;
- const dispatch = useDispatch();
+ const apiUrlToken = import.meta.env.ENV_API_URL_TOKEN;
+ const dispatch = useDispatch();
- const [loading, setLoading] = useState(true);
- const [searchTerm, setSearchTerm] = useState('');
- const [products, setProducts] = useState([]);
- const [message, setMessage] = useState({ type: null, data: null });
- const [orderSuccess, setOrderSuccess] = useState(false);
- const [details, setDetails] = useState({
- AppId: "",
- CompId: "",
- BranchId: ""
- });
+ const [loading, setLoading] = useState(true);
+ const [searchTerm, setSearchTerm] = useState('');
+ const [products, setProducts] = useState([]);
+ const [message, setMessage] = useState({ type: null, data: null });
+ const [orderSuccess, setOrderSuccess] = useState(false);
+ const [details, setDetails] = useState({
+ AppId: '',
+ CompId: '',
+ BranchId: '',
+ });
- const handleOrderSuccess = () => {
- setOrderSuccess(true);
- };
+ const handleOrderSuccess = () => {
+ setOrderSuccess(true);
+ };
- console.log(products, 'hsbdjhsdjvbsdj');
- useEffect(() => {
- if (!codesParam) {
- setLoading(true);
- return;
- }
- initializeSession();
- getPurchaseData();
- }, []);
-
- const getPurchaseData = async () => {
- try {
- const response = await dispatch(getPurchaseLowStock(codesParam)).unwrap();
- const list = response?.data?.data;
- setDetails({
- AppId: list?.[0]?.AppId,
- CompId: list?.[0]?.CompId,
- BranchId: list?.[0]?.BranchId
- });
- setProducts(list);
- setLoading(false);
- if (list?.[0]?.LinkStatus === "N") {
- setOrderSuccess(true)
- }
-
- } catch (error) {
- setLoading(false);
- console.error("❌ Error getting purchase data:", error);
- }
- };
-
- const initializeSession = async () => {
- try {
- await addSession();
- setLoading(false);
- } catch (error) {
- console.error('❌ Error initializing session:', error);
- setLoading(false);
- }
- };
-
- const addSession = async () => {
- if (!sessionStorage.getItem('auth')) {
- try {
- const data = { username: '1000000001', password: '1234' };
- const response = await axios.post(`${apiUrlToken}/jwtTokenGenerator`, data, {
- headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
- });
-
- const { token } = response?.data;
-
- if (token) {
- sessionStorage.setItem('auth', token);
- sessionStore('LoginType', 'Kiosk');
- }
- } catch (error) {
- console.error('❌ Error adding session:', error);
- }
- }
- };
-
- const handleRequiredQtyChange = (ProdId, value) => {
- // allow only digits
- if (!/^\d*$/.test(value)) return;
-
- setProducts((prev) =>
- prev.map((p) =>
- p.ProdId === ProdId ? { ...p, OrderQty: value } : p
- )
- );
- };
-
- const handleDeleteProduct = (record) => {
- setProducts((prev) => prev?.filter((p) => p.ProdId !== record.ProdId));
- };
-
- const filteredProducts = products?.filter(p =>
- p.ProdName?.toLowerCase()?.includes(searchTerm?.toLowerCase())
- );
-
- // const purchasePost = async () => {
- // if (!products || products.length === 0) return;
-
- // const groupedBySupplier = products.reduce((acc, p) => {
- // const suppId = p.SupplierDetails?.[0]?.SuppId;
- // if (!acc[suppId]) acc[suppId] = [];
- // acc[suppId].push(p);
- // return acc;
- // }, {});
-
- // const payloadArray = Object.values(groupedBySupplier).map(group => {
- // const firstProduct = group[0];
- // return {
- // CompId: firstProduct.CompId,
- // BranchId: firstProduct.BranchId,
- // AppId: firstProduct.AppId,
- // SuppId: firstProduct.SupplierDetails?.[0]?.SuppId,
- // Remarks: "",
- // LocationType: firstProduct.SupplierDetails?.[0]?.Type,
- // CreatedBy: '',
- // OrderDetails: group.map(p => ({
- // ProdId: p.ProdId,
- // OrderQty: Number(p.OrderQty || 0),
- // ProdVariantName: p.ProdVariantName || ""
- // }))
- // };
- // });
-
- // try {
- // const response = await dispatch(CustomerPurchase(payloadArray)).unwrap();
- // if (response?.status === 200) {
- // setOrderId(response?.data?.[0]?.OrderId);
- // setMessage({ type: 'success', data: "Purchase Order Added Successfully" });
- // setOrderSuccess(true);
- // } else {
- // setMessage({ type: 'error', data: "Error submitting order" });
- // }
- // } catch (error) {
- // setMessage({ type: 'error', data: error });
- // }
- // };
-
- const onComplete = useCallback(() => {
- setMessage({ type: null, data: null });
- }, []);
-
- const ProductdataColumns = [
- {
- title: 'SI NO',
- dataIndex: 'index',
- key: 'index',
- align: "center",
- render: (_, __, index) => index + 1
- },
- {
- title: 'Product Name',
- dataIndex: 'ProdName',
- key: 'ProdName'
- },
- {
- title: 'Current Qty',
- dataIndex: 'BalanceQty',
- key: 'BalanceQty',
- align: "center",
- },
- {
- title: 'Required Qty',
- dataIndex: 'OrderQty',
- key: 'OrderQty',
- align: "center",
- render: (_, record) => (
-
- handleRequiredQtyChange(record.ProdId, e.target.value)
- }
- className="CustomerPurchaseConfirm-requiredInput"
- />
- )
- },
- {
- title: 'Action',
- key: 'Action',
- width: '80px',
- align: 'center',
- render: (_, record) => (
- handleDeleteProduct(record)}
- />
- ),
- },
- ];
-
- if (loading) {
- return ;
+ console.log(products, 'hsbdjhsdjvbsdj');
+ useEffect(() => {
+ if (!codesParam) {
+ setLoading(true);
+ return;
}
+ initializeSession();
+ getPurchaseData();
+ }, []);
- return (
-
-
{
+ try {
+ const response = await dispatch(getPurchaseLowStock(codesParam)).unwrap();
+ const list = response?.data?.data;
+ setDetails({
+ AppId: list?.[0]?.AppId,
+ CompId: list?.[0]?.CompId,
+ BranchId: list?.[0]?.BranchId,
+ });
+ setProducts(list);
+ setLoading(false);
+ if (list?.[0]?.LinkStatus === 'N') {
+ setOrderSuccess(true);
+ }
+ } catch (error) {
+ setLoading(false);
+ console.error('❌ Error getting purchase data:', error);
+ }
+ };
+
+ const initializeSession = async () => {
+ try {
+ await addSession();
+ setLoading(false);
+ } catch (error) {
+ console.error('❌ Error initializing session:', error);
+ setLoading(false);
+ }
+ };
+
+ const addSession = async () => {
+ if (!sessionStorage.getItem('auth')) {
+ try {
+ const data = { username: '1000000001', password: '1234' };
+ const response = await axios.post(
+ `${apiUrlToken}/jwtTokenGenerator`,
+ data,
+ {
+ headers: {
+ 'Content-Type': 'application/json',
+ Accept: 'application/json',
+ },
+ }
+ );
+
+ const { token } = response?.data;
+
+ if (token) {
+ sessionStorage.setItem('auth', token);
+ sessionStore('LoginType', 'Kiosk');
+ }
+ } catch (error) {
+ console.error('❌ Error adding session:', error);
+ }
+ }
+ };
+
+ const handleRequiredQtyChange = (ProdId, value) => {
+ // allow only digits
+ if (!/^\d*$/.test(value)) return;
+
+ setProducts((prev) =>
+ prev.map((p) => (p.ProdId === ProdId ? { ...p, OrderQty: value } : p))
+ );
+ };
+
+ const handleDeleteProduct = (record) => {
+ setProducts((prev) => prev?.filter((p) => p.ProdId !== record.ProdId));
+ };
+
+ const filteredProducts = products?.filter((p) =>
+ p.ProdName?.toLowerCase()?.includes(searchTerm?.toLowerCase())
+ );
+
+ // const purchasePost = async () => {
+ // if (!products || products.length === 0) return;
+
+ // const groupedBySupplier = products.reduce((acc, p) => {
+ // const suppId = p.SupplierDetails?.[0]?.SuppId;
+ // if (!acc[suppId]) acc[suppId] = [];
+ // acc[suppId].push(p);
+ // return acc;
+ // }, {});
+
+ // const payloadArray = Object.values(groupedBySupplier).map(group => {
+ // const firstProduct = group[0];
+ // return {
+ // CompId: firstProduct.CompId,
+ // BranchId: firstProduct.BranchId,
+ // AppId: firstProduct.AppId,
+ // SuppId: firstProduct.SupplierDetails?.[0]?.SuppId,
+ // Remarks: "",
+ // LocationType: firstProduct.SupplierDetails?.[0]?.Type,
+ // CreatedBy: '',
+ // OrderDetails: group.map(p => ({
+ // ProdId: p.ProdId,
+ // OrderQty: Number(p.OrderQty || 0),
+ // ProdVariantName: p.ProdVariantName || ""
+ // }))
+ // };
+ // });
+
+ // try {
+ // const response = await dispatch(CustomerPurchase(payloadArray)).unwrap();
+ // if (response?.status === 200) {
+ // setOrderId(response?.data?.[0]?.OrderId);
+ // setMessage({ type: 'success', data: "Purchase Order Added Successfully" });
+ // setOrderSuccess(true);
+ // } else {
+ // setMessage({ type: 'error', data: "Error submitting order" });
+ // }
+ // } catch (error) {
+ // setMessage({ type: 'error', data: error });
+ // }
+ // };
+
+ const onComplete = useCallback(() => {
+ setMessage({ type: null, data: null });
+ }, []);
+
+ const ProductdataColumns = [
+ {
+ title: 'SI NO',
+ dataIndex: 'index',
+ key: 'index',
+ align: 'center',
+ render: (_, __, index) => index + 1,
+ },
+ {
+ title: 'Product Name',
+ dataIndex: 'ProdName',
+ key: 'ProdName',
+ },
+ {
+ title: 'Current Qty',
+ dataIndex: 'BalanceQty',
+ key: 'BalanceQty',
+ align: 'center',
+ },
+ {
+ title: 'Required Qty',
+ dataIndex: 'OrderQty',
+ key: 'OrderQty',
+ align: 'center',
+ render: (_, record) => (
+
+ handleRequiredQtyChange(record.ProdId, e.target.value)
+ }
+ className="CustomerPurchaseConfirm-requiredInput"
+ />
+ ),
+ },
+ {
+ title: 'Action',
+ key: 'Action',
+ width: '80px',
+ align: 'center',
+ render: (_, record) => (
+ handleDeleteProduct(record)}
+ />
+ ),
+ },
+ ];
+
+ if (loading) {
+ // return ;
+ return ;
+ }
+
+ return (
+
+
+
+
+ {orderSuccess ? (
+
+
+
Order Placed Successfully!
+
Your purchase order has been submitted.
+
+ ) : (
+ <>
+ {/*
{products?.[0]?.CompName} */}
+
+ Low Stock Products
+
-
- {orderSuccess ? (
-
-
-
Order Placed Successfully!
-
Your purchase order has been submitted.
-
- ) : (
- <>
- {/*
{products?.[0]?.CompName} */}
-
Low Stock Products
+
+
Supplier Details
-
-
Supplier Details
-
- {/*
+ {/*
Supplier ID
{products?.[0]?.SupplierDetails?.[0]?.SuppId}
*/}
-
- Supplier Name
- {products?.[0]?.SupplierDetails?.[0]?.SuppName}
-
- {products?.[0]?.SupplierDetails?.[0]?.SuppMobile &&
- Supplier Mobile
- {products?.[0]?.SupplierDetails?.[0]?.SuppMobile}
-
}
- {products?.[0]?.SupplierDetails?.[0]?.SuppEmail &&
- Email
- {products?.[0]?.SupplierDetails?.[0]?.SuppEmail}
-
}
+
+ Supplier Name
+
+ {products?.[0]?.SupplierDetails?.[0]?.SuppName}
+
+
+ {products?.[0]?.SupplierDetails?.[0]?.SuppMobile && (
+
+ Supplier Mobile
+
+ {products?.[0]?.SupplierDetails?.[0]?.SuppMobile}
+
+
+ )}
+ {products?.[0]?.SupplierDetails?.[0]?.SuppEmail && (
+
+ Email
+
+ {products?.[0]?.SupplierDetails?.[0]?.SuppEmail}
+
+
+ )}
-
- Address
-
- {products?.[0]?.SupplierDetails?.[0]?.Address1},
- {products?.[0]?.SupplierDetails?.[0]?.Address2},
- {products?.[0]?.SupplierDetails?.[0]?.City},
- {products?.[0]?.SupplierDetails?.[0]?.Dist},
- {products?.[0]?.SupplierDetails?.[0]?.State} -
- {products?.[0]?.SupplierDetails?.[0]?.Zip}
-
-
-
-
-
- setSearchTerm(e.target.value)}
- className="CustomerPurchaseConfirm-search"
- />
-
-
- {/* TABLE */}
-
console.log("Page:", page)
- }}
- />
-
- {/* Submit */}
-
- >
- )}
+
+ Address
+
+ {products?.[0]?.SupplierDetails?.[0]?.Address1},
+ {products?.[0]?.SupplierDetails?.[0]?.Address2},
+ {products?.[0]?.SupplierDetails?.[0]?.City},
+ {products?.[0]?.SupplierDetails?.[0]?.Dist},
+ {products?.[0]?.SupplierDetails?.[0]?.State} -
+ {products?.[0]?.SupplierDetails?.[0]?.Zip}
+
+
-
- );
+
+
+ setSearchTerm(e.target.value)}
+ className="CustomerPurchaseConfirm-search"
+ />
+
+
+ {/* TABLE */}
+ console.log('Page:', page),
+ }}
+ />
+
+ {/* Submit */}
+
+ >
+ )}
+
+
+ );
}
export default CustomerPurchaseConfirm;
diff --git a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBPayment.scss b/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBPayment.scss
index 1666e44..9c2d2c5 100644
--- a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBPayment.scss
+++ b/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBPayment.scss
@@ -194,8 +194,8 @@ input::-webkit-inner-spin-button {
.BST1-Payment-onlyicons {
display: flex;
flex-direction: row;
- justify-content: center;
- column-gap: 0.5rem;
+ justify-content: center;
+ column-gap: 0.5rem;
}
@media (min-width: 500px) and (max-width: 768px) {
@@ -221,7 +221,7 @@ input::-webkit-inner-spin-button {
}
.BST1-Payment-payicons {
- flex-direction: row;
+ flex-direction: row;
align-items: center;
justify-content: space-evenly;
}
@@ -229,7 +229,7 @@ input::-webkit-inner-spin-button {
.BST1-Payment-onlyicons {
display: flex;
flex-direction: row;
- justify-content: center;
+ justify-content: center;
}
.Table1-payment-mode {
@@ -298,3 +298,26 @@ input::-webkit-inner-spin-button {
text-transform: capitalize;
outline: none;
}
+
+.BSBTOverall1Defaultsummary {
+ display: flex;
+ justify-content: center;
+ // margin-Top:2rem;
+ align-items: center;
+ gap: 1rem;
+ .icon-button {
+ font-size: 10px;
+ font-weight: 500;
+ height: unset;
+ padding: 4px 6px;
+ }
+}
+
+@media all and (max-width: 499px) {
+ .BSBTOverall1Defaultsummary {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ gap: 0rem;
+ }
+}
diff --git a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4.scss b/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4.scss
deleted file mode 100644
index c171bac..0000000
--- a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4.scss
+++ /dev/null
@@ -1,821 +0,0 @@
-.BSBillingDefault-table {
- height: inherit;
- flex-grow: 1;
- overflow: auto;
-}
-
-.BSLayout6-fullbody {
- height: 99.3vh;
- overflow: hidden;
-}
-
-.BSLayout6-fullbody .BSBilling4TableCont-default {
- height: 83vh;
-}
-
-
-
-.BSLayout6-fullbody .BsTable2-Master {
- height: 71vh;
-}
-
-.BSLayout6-fullbody .BSBTOverall1-Default {
- height: 79vh;
-}
-
-.BSLayout6-fullbody .BSBillingTable5-table-master-div {
- height: 83vh;
-}
-
-.BSBilling4div {
- width: 100%;
- flex-shrink: 0;
- background-color: white;
-}
-
-.BSC1-Master .BSBilling4-tablediv {
- height: 100%;
- overflow: auto;
- padding-bottom: 3rem;
-}
-
-.BSBilling4-tablediv-mobile {
- display: block;
- height: 40vh;
- overflow-y: auto;
-}
-
-.BSBilling4-tablediv-mobile::-webkit-scrollbar {
- display: none;
-}
-
-.BSBilling4-tablediv::-webkit-scrollbar {
- display: none;
-}
-
-.BSBill-Table4 {
- width: 100%;
- border-spacing: 0;
- text-align: center;
-}
-
-.Table4-tbody {
- width: 100%;
-}
-
-.BsBill-table4-contenttable {
- width: 100%;
- border-spacing: 0 10px;
- text-align: center;
- height: 70vh;
-}
-
-.BSBill-table4-itemtext-th {
- padding: 10px;
- font-size: 16px;
-}
-
-.BSBill-Table4-throw {
- background-color: #161a1e;
- color: white;
- width: 60px;
- height: 3rem;
- position: sticky;
- top: 0;
-}
-
-.BSBill-Table4 th {
- border-spacing: 0;
- text-align: center;
- font-size: 14px;
- font-style: normal;
- font-weight: 400;
- line-height: normal;
-}
-
-.Table4-items {
- text-align: left;
- font-size: 14px;
- font-style: normal;
- font-weight: 600;
- padding: 4px;
-}
-
-.BSBill4-item-extraprice {
- color: #007e1c;
- font-size: 14px;
- font-style: normal;
- font-weight: 600;
-}
-
-.BSBill-Table4-content {
- background-color: rgba(235, 235, 236, 1);
- height: 3rem;
- font-size: 14px;
- font-style: normal;
- font-weight: 600;
-}
-
-.BSBill-Table4-content-disabled {
- pointer-events: none;
- background-color: rgb(243, 248, 213);
- height: 3rem;
- font-size: 14px;
- font-style: normal;
- font-weight: 600;
-}
-
-.BSBilling4-down-content {
- bottom: 0;
- width: inherit;
- background-color: white;
-}
-
-.BSBilling4-view-summary {
- display: flex;
- justify-content: flex-end;
- width: 90%;
-}
-
-.BSBilling4-price-full {
- display: flex;
- width: 100%;
- row-gap: 0rem;
- box-shadow: var(--BOX_SHADOW_LEVEL2);
-}
-
-.BSBilling4-customer {
- display: flex;
- width: 50%;
- flex-wrap: wrap;
- background-color: white;
- justify-content: center;
-}
-
-.BSBilling4-customer-subdiv {
- display: flex;
- flex-wrap: wrap;
- width: 100%;
- height: fit-content;
- justify-content: center;
- row-gap: 1rem;
-}
-
-.Table4-price {
- display: flex;
- flex-wrap: wrap;
- margin-right: 26px;
-}
-
-.Table4-price-fullflex {
- width: 55%;
-}
-
-.Table4-finalprice {
- display: flex;
- justify-content: flex-end;
- width: 100%;
-}
-
-.Table4-customer .ant-select-single:not(.ant-select-customize-input) .ant-select-selector {
- width: 10rem;
- height: 2rem;
- text-align: center;
- border-radius: 4.982px;
- background-color: rgba(51, 55, 58, 0.1);
- border: none;
- font-size: 14px;
- font-style: normal;
- font-weight: 600;
-}
-
-.Table4-customer .ant-select-single.ant-select-show-arrow .ant-select-selection-placeholder {
- color: #000;
- padding-inline-end: 0px !important;
-}
-
-.BSBill4-Add-new-customer {
- display: flex;
- align-items: center;
-
- padding-left: 10px;
-}
-
-.Table4-payment-mode {
- display: flex;
- flex-wrap: nowrap;
- justify-content: center;
- flex-direction: row;
- column-gap: 1rem;
-}
-
-.Table4-cash {
- display: flex;
- width: 60px;
-}
-
-.Table4-Btn-payment-mode {
- height: 2rem;
- width: 8rem;
- border-radius: 6.216px;
- border: 0px;
- background: #e0e0e0;
- color: black;
- font-size: 14px;
- font-style: normal;
- font-weight: 600;
- cursor: pointer;
-}
-
-.Table4-paymentmode-active {
- height: 2rem;
- width: 8rem;
- border-radius: 6.216px;
- border: 0px;
- background: #33373a;
- color: #e0e0e0;
- font-size: 14px;
- font-style: normal;
- font-weight: 600;
-}
-
-.Table4-vertical-line {
- border: 0.83px solid rgb(175, 173, 173);
-}
-
-.Table4-total-price {
- width: 70%;
- font-size: 14px;
- font-weight: 600;
- text-align: right;
-}
-
-.Table4-totalprice-row {
- height: 0px;
-}
-
-.Table4-price-btn-master {
- display: flex;
- flex-direction: column;
- gap: 0px;
-}
-
-.Table4-Price-div {
- display: flex;
- width: 100%;
- align-items: center;
- justify-content: space-around;
-}
-
-.Table4-Btn-final-price {
- width: 8.5rem;
- margin: 0.5rem;
- height: 3rem;
- border-radius: 4.982px;
- background: var(--SELECTED_COLOR);
- text-align: center;
- border: 0;
- color: #fff;
- cursor: pointer;
-}
-
-.Table4-Btn-final-price-disabled {
- width: 8.5rem;
- margin: 0.5rem;
- height: 3rem;
- border-radius: 4.982px;
- background: var(--SELECTED_COLOR);
- text-align: center;
- border: 0;
- pointer-events: none;
- opacity: 0.5;
-}
-
-.Table4-rate {
- display: flex;
- font-family: "Poppins", sans-serif;
- font-size: 23px;
- font-style: normal;
- font-weight: 600;
-}
-
-.Table4-td-names {
- text-align: left;
- font-weight: 600;
-}
-
-.Table4-td-values {
- text-align: right;
- font-size: 16px;
- font-weight: 600;
-}
-
-.BSBilling4-price-content {
- display: flex;
- justify-content: space-between;
- flex-direction: column;
- gap: 4px;
-}
-
-@media (min-width: 280px) and (max-width: 499px) {
- .Table4-Btn-payment-mode {
- font-size: 12px !important;
- padding: 0;
- }
-
- .T4PTable {
- display: flex;
- }
-
- .Table4-total-price {
- justify-content: space-between;
- }
-
- .Table4-finalprice {
- justify-content: center;
- }
-
- .BSBilling4-price-content {
- row-gap: 0rem;
- }
-
- .Table4-cash {
- width: 60px !important;
- }
-
- .BSLayout6-fullbody {
- height: 88vh !important;
- }
-}
-
-@media (max-width: 500px) {
- .Table4-td-names {
- text-align: left;
- font-weight: 600;
- }
-
- .Table4-td-values {
- font-size: 12px !important;
- }
-
- .Table4-rate {
- font-size: 24px !important;
- }
-
- .Table4-price {
- display: revert;
- margin-right: 0 !important;
- }
-
- .Table4-hand-icon {
- font-size: 20px !important;
- }
-
- .Table4-total-price {
- width: 70px;
- }
-
- .Table4-rate-arrow {
- width: 20px !important;
- height: 20px !important;
- border-radius: 20px !important;
- }
-
- .Table4-customer .ant-select-single:not(.ant-select-customize-input) .ant-select-selector {
- width: 8rem !important;
- font-size: 8px !important;
- }
-
- .BSBilling4-price-content {
- display: flex;
- flex-direction: column !important;
- }
-
- .Table4-price {
- justify-content: center;
- margin-left: 6px !important;
- margin-right: 0 !important;
- }
-}
-
-.BSBill4-items {
- color: #007e1c;
- text-align: right;
- font-size: 14px;
- font-style: normal;
- font-weight: 600;
-}
-
-.BSBilling4-summary {
- font-size: 14px;
- font-style: normal;
- font-weight: 600;
-}
-
-.Table4-pencil {
- width: 18px;
- height: 18px;
-}
-
-.BSBill4-icon-button {
- height: 30px;
- width: 30px;
- border-radius: 30px;
- padding: 0px;
- margin: 6px 6px;
-}
-
-.Table4-fullrate {
- display: flex;
- justify-content: space-evenly;
- align-items: center;
-}
-
-.BSBill4-male-usericon {
- height: 25px;
- width: 25px;
-}
-
-.Table4-hand-icon {
- font-size: 23px;
-}
-
-.BSBilling4-vertical-line {
- width: 1px;
- height: 100%;
- background-color: #000;
- margin: 0 10px;
-}
-
-// MobileScreen design
-.BSBilling4TableCont-MobileScreen {
- display: none;
-}
-
-.BSBilling4TableCont-default {
- width: inherit;
- display: flex;
- flex-direction: column;
- row-gap: 1rem;
- justify-content: space-between;
- overflow: auto;
- height: 80vh;
-}
-
-.BSBilling4TableCont-default-6 {
- height: 71vh;
-}
-
-@media (min-width: 500px) and (max-width: 768px) {
- .BSBill-table4-itemtext-th {
- padding: 5px;
- font-size: 16px;
- }
-
- .Table4-items {
- padding: 0;
- }
-
- .BSBill-Table4 {
- width: 100vw;
- border-spacing: 0 4px;
- text-align: center;
- }
-
- .BSBill-Table4 th {
- border-spacing: 0;
- text-align: center;
- font-size: 12px;
- font-style: normal;
- font-weight: 400;
- line-height: normal;
- }
- .BSBillingDefault-table {
- display: none;
- }
-
- .BSBillingMobile-Table {
- display: block;
- }
-
- .BSBilling4-down-content {
- display: flex;
- width: inherit;
- position: fixed;
- bottom: 4px;
- z-index: 2;
- }
-
- .BSBilling4-vertical-line {
- display: none;
- }
-
- .Table4-Pricetable-content {
- width: 100% !important;
- }
-
- .BSBilling4-customer {
- display: flex;
- width: 100%;
- flex-wrap: wrap;
- background-color: white;
- justify-content: center;
- align-items: center;
- }
-
- .Table4-payment-mode {
- display: flex;
- flex-wrap: nowrap;
- justify-content: center;
- flex-direction: row;
- column-gap: 1rem;
- padding: 1rem 1rem;
- }
-
- .BSBilling4-price-full {
- display: flex;
- flex-direction: column;
- box-shadow: var(--BOX_SHADOW_LEVEL2);
- }
-
- .Table4-price {
- display: flex;
-
- width: 100%;
- }
-
- .Table4-Btn-final-price {
- width: max-content !important;
- padding: 0rem 3rem;
- height: 3rem !important;
- }
-
- .BSBilling4-view-summary {
- width: 100%;
- }
-
- .BSBilling4TableCont-default {
- position: fixed;
- width: 0px !important;
- bottom: 0;
- left: 0;
- }
-
- .BSBilling4-popover-overlay {
- width: 95% !important;
- }
-
- .BSBilling4-viewtext {
- display: none !important;
- }
-
- .BSBillingTable4-Icons {
- width: 95%;
- justify-content: space-around;
- }
-
- .BSBilling4-price-content {
- display: flex;
- flex-direction: column !important;
- row-gap: 0.3rem !important;
- align-items: center;
- background-color: #fff;
- }
-
- .Table4-price {
- justify-content: center;
- }
-}
-
-.BSBilling4-popover-overlay {
- width: 30vw;
-}
-
-.Table4-editicon {
- font-size: 16px;
- font-weight: 600;
-}
-
-.Table-4-mrp_price {
- font-size: 14px;
- font-weight: 600;
-}
-
-.Table-4_qty {
- font-size: 14px;
- font-weight: 600;
-}
-
-.Table4-Dis {
- font-size: 14px;
- font-weight: 600;
-}
-
-.Table4-item-price {
- text-align: center;
- font-family: "Gilroy-Medium";
- font-size: 14px;
- text-align: right;
- font-weight: 600;
-}
-
-@media (min-width: 280px) and (max-width: 499px) {
- .BSBill-Table4 {
- width: 100vw;
- border-spacing: 0 4px;
- text-align: center;
- }
-
- .BSBill-table4-itemtext-th {
- padding: 1px;
- font-size: 14px !important;
- }
-
- .BSBilling4-price-full {
- position: fixed;
- bottom: 0;
- box-shadow: var(--BOX_SHADOW_LEVEL2);
- background-color: #fff;
- }
-
- .Table4-items {
- padding: 0;
- }
-
- .BSBilling4TableCont-default {
- position: fixed;
- bottom: 0;
- left: 0;
- height: 0vh !important;
- }
-
- .BSBillingDefault-table {
- display: none;
- }
-
- .BSBill4-items {
- font-size: 10px;
- }
-
- .BSBill4-item-extraprice {
- font-size: 10px;
- }
-
- .BSBilling4-down-conten {
- display: none !important;
- }
-
- .BSBilling4-down-content {
- bottom: 0px;
- width: 100vw;
- }
-
- .Table4-payment-mode {
- display: flex;
- flex-wrap: nowrap;
- justify-content: center;
- flex-direction: row;
- column-gap: 0.5rem;
- padding: 0.4rem 1rem;
- }
-
- .Table4-price-icon-container {
- row-gap: 0 !important;
- flex-wrap: wrap !important;
- flex-direction: row;
- }
-
- .Table7-price-icon-container {
- row-gap: 0 !important;
- flex-wrap: wrap !important;
- flex-direction: row;
- }
-
- .CustomerAddSrch {
- justify-content: space-around !important;
- width: 100%;
- }
-
- .BSBilling4-price-content {
- display: flex;
- flex-direction: column !important;
- row-gap: 0rem !important;
- }
-
- .Table4-price {
- justify-content: center;
- width: 100vw;
- }
-}
-
-.BSBillingTable4-Icons {
- display: flex;
- flex-direction: row;
- width: 100%;
- justify-content: space-evenly;
- font-size: 23px;
- align-items: center;
-}
-
-.BSBilling4-price-content {
- display: flex;
- flex-direction: row;
- width: 100vw;
- @media (max-width: 768px) {
- width: 100% !important;
- }
-}
-
-.Table4-price-icon-container {
- display: flex;
- flex-direction: row;
- width: 100%;
- justify-content: space-evenly;
- padding: 0px 0px;
-}
- .Table7-price-icon-container {
- display: flex;
- flex-direction: column;
- width: 100%;
- justify-content: space-evenly;
- padding: 0px 0px;
- flex-wrap: wrap;
-}
-
-.BSCategory5-tablecont {
- width: inherit;
-}
-
-.Tbl4-Variant {
- font-size: 10px;
-}
-
-@media (min-width: 500px) and (max-width: 768px) {
- .Table4-price-icon-container {
- width: 100vw;
- flex-direction: column;
- }
-
- .Table7-price-icon-container {
- width: 100vw;
- flex-direction: row;
- }
-}
-
-.Order {
- background-color: var(--SELECTED_COLOR);
-}
-
-.ChairClrRed {
- color: red;
-}
-
-.ChairClrGreen {
- color: var(--SELECTED_COLOR);
-}
-
-.Table4-Order {
- font-size: 18px;
- font-weight: 600;
-}
-
-.billing-in-style-Order4 {
- font-size: 16px;
- font-weight: bold;
- padding: 2px;
-}
-.BS7hold-sum {
- display: flex;
- justify-content: center;
- align-items: center;
- flex-direction: row;
- column-gap: 1rem;
- color: var(--DEFAULT_SELECTED_COLOR);
-}
-.RowforResposiveBill7 {
- display: flex;
- flex-direction: column;
- width: 100%;
-}
-
-.RowResposiveBill7 {
- display: flex;
- align-items: flex-start;
- gap: 4px;
- width: 100%;
-}
-.bsbilltable7 {
- padding: 10px;
-}
-
-@media (max-width: 768px) {
- .BSTable3_payroll {
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
- }
- .bsbilltable7 {
- padding: 0;
- }
-}
diff --git a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable15.scss b/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable15.scss
deleted file mode 100644
index b08c506..0000000
--- a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable15.scss
+++ /dev/null
@@ -1,700 +0,0 @@
-.BSBillingTable5-table-master-div {
- display: flex;
- flex-direction: column;
- row-gap: 0em;
- background-color: #fff;
- width: inherit;
- overflow: auto;
- scrollbar-width: thin;
- height: 80vh;
-}
-.BSBillingTable5-table-master-div-6 {
- height: 70vh;
-}
-
-.BSLayout5-Master .AddFavList {
- left: 0;
- height: 95vh;
- width: 400px;
- box-shadow: var(--BOX_SHADOW_LEVEL2);
-}
-
-.BSLayout5-Master .favsbmtbtn {
- position: fixed;
- bottom: 10px;
- left: 40px;
-}
-
-.SmallScreen {
- display: none;
-}
-
-.Credit Customer {
- display: flex;
- align-items: center;
- justify-items: center;
-}
-
-.BSC1-Master .BSBillingTable5-billtable {
- height: 100%;
- overflow: auto;
- scrollbar-width: thin;
- padding-bottom: 3rem;
-}
-
-.BSBillingTable5-thead {
- position: sticky;
- top: 0;
-}
-
-.BSBillingTable5-payOptions {
- display: flex;
- align-items: center;
- gap: 1rem;
-}
-
-.BSBillingTable-title {
- text-transform: uppercase;
- display: flex;
- justify-content: center;
- align-items: center;
- flex-direction: row;
- column-gap: 0.5rem;
- font-size: 2.7dvh;
- padding: 1rem 0rem;
- font-weight: 600;
-}
-
-.BSBillingTable5-addcstmr-link {
- cursor: pointer;
- font-size: 18px;
- transition-duration: 0.2s;
-}
-
-.BSBillingTable5-addcstmr-link:hover {
- cursor: pointer;
- font-size: 18.5px;
- transition-duration: 0.2s;
-}
-
-.BSBillingTable5-addbtn {
- font-size: 24px;
- cursor: pointer;
-}
-
-.BSBillingTable5-tablediv {
- font-family: arial, sans-serif;
- border-collapse: collapse;
-
- border-spacing: 0 0px;
- text-align: center;
- width: 100%;
-}
-
-.BSBillingTable5-table-td {
- border-bottom: 1.9px dashed #000;
- text-align: left;
- padding: 8px;
- text-align: center;
- font-size: 18px;
- font-weight: 500;
- font-family: var(--PARA_FONT_FAMILY);
-}
-
-.BSBillingTable5-table-th {
- border-bottom: 1.9px solid #000;
- padding: 10px;
- text-align: center;
-}
-
-.Table3-Price-summarypop-tab {
- display: none;
-}
-
-.BSBillingTable5-table-notes {
- font-size: "14px";
- font-weight: 500;
-}
-
-.BSBillingTable5-table-cont {
- text-align: left;
- line-height: 1.5;
- font-size: 14px;
-}
-
-.BSBillingTable5-table-sub-td {
- font-size: 14px;
- font-weight: 500;
- color: #52c41a;
-}
-
-.BSBillingTable5-table-tr:nth-child(even) {
- text-align: center;
-}
-
-.BSBillingTable5-table-tr-disabled {
- pointer-events: none;
- background-color: rgb(243, 248, 213);
-}
-
-.BSBillingTable5-table-count {
- display: flex;
- justify-content: center;
-}
-
-.BSBillingTable5-table-count-min-btn {
- width: 25px;
- height: 25px;
- background-color: rgb(207, 207, 207);
- border-radius: 25px;
- color: #000000;
- cursor: pointer;
- border: none;
-}
-
-.BSBillingTable5-table-count-num {
- width: 40px;
- display: flex;
- justify-content: center;
- align-items: center;
-}
-
-.BSBillingTable5-table-count-max-btn {
- width: 25px;
- height: 25px;
- background-color: #ff4d4f;
- border-radius: 25px;
- color: #fff;
- cursor: pointer;
- border: none;
-}
-
-hr.new1 {
- border-top: 2px dashed #000;
-}
-
-// bill table /
-.BSBillingTable-billtable {
- display: flex;
- justify-content: center;
- gap: 0.5rem;
- padding: 10px 0px;
-}
-
-.payrow1 {
- display: flex;
- color: var(--DEFAULT_SELECTED_COLOR);
- gap: 1.2rem;
-}
-
-.BSBillingTable-ftr {
- bottom: 0;
- background-color: #fff;
- width: inherit;
- gap: 0.5rem;
- display: flex;
- flex-direction: column;
-}
-
-.BSBillingTable5-billtablediv {
- width: 100%;
- font-family: var(--PARA_FONT_FAMILY);
- line-height: 0;
-}
-
-.BSBillingTable5-billtable-td {
- text-align: left;
- padding: 8px;
- text-align: right;
- font-size: 14px;
- font-weight: 600;
-}
-
-.BSBillingTable5-billsubtable-td {
- border-bottom: 1.9px dashed #000000;
- padding: 8px;
- text-align: right;
- font-size: 15px;
- font-weight: 600;
-}
-
-.BSBillingTable5-billtable-total {
- padding: 8px;
- text-align: right;
- font-size: 14px;
- font-weight: 600;
-}
-
-.BSBIllingTable5-btns {
- display: flex;
- justify-content: center;
- flex-direction: row;
- column-gap: 0.5rem;
- margin-bottom: 0.8rem;
-}
-
-.BSBIllingTable5-holdbtn {
- width: 130px;
- height: 50px;
- border: none;
- border-radius: 3px;
- font-size: 16px;
- font-weight: 600;
- font-family: var(--PARA_FONT_FAMILY);
- background-color: var(--DEFAULT_SELECTED_COLOR);
- cursor: pointer;
- display: flex;
- justify-content: space-evenly;
- align-items: center;
- transition-duration: 0.2s;
- border: #ececec solid 1px;
-}
-
-.BSBIllingTable5-paybtn {
- width: 25rem;
- height: 50px;
- border-radius: 3px;
- font-size: 20px;
- font-weight: 600;
- font-family: var(--HEADING_FONT_FAMILY);
- background-color: var(--SELECTED_COLOR);
- color: #000;
- cursor: pointer;
- display: flex;
- justify-content: space-evenly;
- align-items: center;
- transition-duration: 0.2s;
- border: rgba(236, 236, 236, 0) solid 1px;
-}
-
-.BSBIllingTable5-paybtn-noitems {
- width: 180px;
- height: 50px;
- border-radius: 3px;
- font-size: 20px;
- font-weight: 600;
- font-family: var(--HEADING_FONT_FAMILY);
- background-color: var(--SELECTED_COLOR);
- color: #000;
- cursor: pointer;
- display: flex;
- justify-content: space-evenly;
- align-items: center;
- transition-duration: 0.2s;
- border: rgba(236, 236, 236, 0) solid 1px;
-}
-
-.BSBIllingTable5-paybtn-noitems-disable {
- width: 180px;
- height: 50px;
- border-radius: 3px;
- font-size: 20px;
- font-weight: 600;
- font-family: var(--HEADING_FONT_FAMILY);
- background-color: var(--SELECTED_COLOR);
- color: #000;
- cursor: pointer;
- display: flex;
- justify-content: space-evenly;
- align-items: center;
- transition-duration: 0.2s;
- border: rgba(236, 236, 236, 0) solid 1px;
- pointer-events: none;
- opacity: 0.5;
-}
-
-.BSBIllingTable5-cnclbtn {
- margin-left: 2px;
- width: 70px;
- height: 50px;
- border: none;
- border-radius: 3px;
- font-size: 16px;
- font-weight: 600;
- font-family: var(--PARA_FONT_FAMILY);
- background-color: #dd2a2a40;
- cursor: pointer;
- display: flex;
- justify-content: space-evenly;
- align-items: center;
-}
-
-.BSBIllingTable5-ftrbtns {
- display: none;
-}
-
-.BSBillingTable5-payOpt {
- display: flex;
- font-size: 25px;
- font-weight: 500;
- flex-direction: row;
- row-gap: 1rem;
- column-gap: 1rem;
- justify-content: space-around;
-}
-
-.BSBillingTable5-payOptsel {
- height: 30px;
- font-size: 14px;
- font-weight: 550;
- border: none;
- color: #242424;
- text-transform: uppercase;
-}
-
-select:focus-visible {
- outline: none;
-}
-
-.BSBIllingTable5-summary {
- display: none;
-}
-
-.BSBillingTable5-addpay {
- display: none;
-}
-
-.smallScreensummary {
- display: none;
-}
-
-@media (width: 280px) {
- .BSBIllingTable5-paybtn-noitems {
- width: 170px !important;
- }
-
- .BSBIllingTable5-cnclbtn {
- width: 55px;
- height: 45px;
- }
-}
-
-@media (min-width: 280px) and (max-width: 499px) {
- .BSBillingTable5-payOptsel {
- width: inherit;
- }
-
- .Table3-Price-summarypop-tab {
- display: flex;
- }
-
- .payrow1 {
- column-gap: 0.5rem;
- align-items: center;
- justify-content: center;
- }
-
- .BSBillingTable5-payOptions {
- column-gap: 0.1rem;
- }
-
- .BSBillingTable5-payOpt {
- display: flex;
- flex-direction: row;
- column-gap: 0.1rem;
- row-gap: 0rem;
- }
-
- .payrow2 {
- display: flex;
- align-items: center;
- justify-content: center;
- }
-
- .BSBillingTable-billtable {
- gap: 0.22rem !important;
- justify-content: flex-start !important;
- padding: 0;
- }
-
- .BSBillingTable5-billtablediv {
- display: none;
- }
-
- .BigScreen {
- display: none;
- }
-
- .SmallScreen {
- display: flex;
- font-size: 23px;
- }
-
- .smallScreensummary {
- width: 90vw;
- display: flex;
- }
-
- .BSBIllingTable5-btns {
- width: 100vw !important;
- align-items: center;
- }
-
- .BSBillingTable-ftr {
- position: fixed;
- left: 0;
- background-color: #fff;
- width: 100vw;
- padding-top: 5px;
- }
-
- .BSBillingTable-oCbtn {
- position: fixed !important;
- z-index: 1;
- }
-
- .BSLayout2-bSlayer {
- position: fixed;
- right: 0;
- }
-
- .BSBillingTable-title {
- font-size: 2.4dvh !important;
- }
-
- .BSBillingTable5-table-th {
- padding: 3px;
- }
-
- .BSBillingTable5-table-td {
- padding: 0;
- }
-
- .BSBillingTable5-table-count {
- display: flex;
- justify-content: center;
- flex-direction: row;
- align-items: center;
- padding: 10px 5px;
- }
-
- .BSBIllingTable5-ftrbtns {
- display: flex !important;
- flex-direction: row !important;
- column-gap: 0.4rem !important;
- position: fixed !important;
- align-items: center !important;
- width: 100%;
- justify-content: flex-start;
- background-color: #fff !important;
- }
-
- .BSBIllingTable5-holdbtn {
- height: 45px;
- width: 120px;
- font-size: 14px;
- }
-
- .BSBIllingTable5-paybtn {
- height: 50px;
- font-size: 18px;
- }
-
- .BSBIllingTable5-cnclbtn {
- width: 55px;
- height: 50px;
- }
-
- .BSBillingTable5-table-master-div {
- width: 0px !important;
- }
-
- .BSBillingTable5-billtablediv {
- width: 100vw;
- }
-
- .BSBillingTable5-payOpt {
- width: inherit !important;
- }
-
- .BSBillingTable5-addpay {
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
-
- .BSBillingTable5-adpay-ico {
- display: flex;
- align-items: center;
- flex-direction: row;
- column-gap: 2rem;
- font-size: 20px;
- }
-
- .BSBIllingTable5-summary {
- position: absolute;
- background-color: #fff;
- bottom: 65px;
- width: 280px;
- display: flex;
- flex-direction: column;
- z-index: 3;
- }
-
- .BSBIllingTable5-mobscrn {
- position: fixed;
- bottom: 0;
- left: 0;
- width: 25vw !important;
- height: 5rem;
- width: 100%;
- z-index: 3;
- background-color: #fff;
- }
-}
-
-/* For screens smaller than 768px (e.g., smartphones) */
-
-@media all and (max-width: 499px) {
- .smallScreensummary {
- display: flex;
- }
-
- .BSBillingTable5-addpay {
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
-
- .BSBIllingTable5-mobscrn {
- width: 100vw !important;
- }
-
- .BSBillingTable5-adpay-ico {
- display: flex;
- align-items: center;
- flex-direction: row;
- column-gap: 3rem;
- padding: 0rem 2rem;
- font-size: 23px;
- }
-
- .BSBIllingTable5-ftrbtns {
- width: 100vw !important;
- justify-content: space-evenly;
- }
-
- .BSBIllingTable5-summary {
- position: absolute;
- background-color: #fff;
- bottom: 98px;
- width: 100vw;
- display: flex;
- flex-direction: column;
- }
-}
-
-@media (min-width: 500px) and (max-width: 767px) {
- .Table3-Price-summarypop-tab {
- display: flex;
- }
-
- .BSBIllingTable5-btns {
- column-gap: 2rem;
- }
-
- .smallScreensummary {
- display: flex;
- }
-
- .BSBillingTable-oCbtn {
- position: fixed !important;
- z-index: 1;
- }
-
- .BSBillingTable5-table-master-div {
- width: 0vw;
- }
-
- .BSBIllingTable5-ftrbtns {
- display: flex !important;
- flex-direction: row !important;
- column-gap: 1rem !important;
- position: fixed !important;
- align-items: center !important;
- width: 100%;
- background-color: #fff !important;
- }
-
- .BSBillingTable5-payOpt {
- padding-top: 10px;
- }
-
- .BSBIllingTable5-holdbtn {
- height: 45px;
- }
-
- .BSBillingTable-ftr {
- position: fixed;
- bottom: 0;
- left: 0;
- background-color: #fff;
- width: 100vw;
- }
-
- .BSBIllingTable5-cnclbtn {
- width: 95px;
- }
-
- .BSBillingTable5-addpay {
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
-
- .BSBIllingTable5-mobscrn {
- height: 77px;
- width: 98vw !important;
- position: fixed;
- bottom: 0;
- right: 0;
- z-index: 2;
- background-color: white;
- }
-
- .BSBillingTable5-adpay-ico {
- display: flex;
- align-items: center;
- flex-direction: row;
- column-gap: 1rem;
- font-size: 23px;
- }
-
- .BSBIllingTable5-summary {
- position: absolute;
- background-color: #fff;
- width: 100vw;
- height: 25rem;
- display: flex;
- flex-direction: column;
- z-index: 3;
- }
-}
-
-@media (min-width: 991px) and (max-width: 1364px) {
- .BSBillingTable-oCbtn {
- position: fixed !important;
- z-index: 1;
- }
-
- .BSLayout2-bSlayer {
- position: fixed;
- right: 0;
- }
-}
-
-.Tbl5-Variant {
- font-size: 10px;
-}
-
-.Order {
- background-color: var(--SELECTED_COLOR);
-}
-
-.ChairClrRed {
- color: red;
-}
-
-.ChairClrGreen {
- color: var(--SELECTED_COLOR);
-}
diff --git a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBTOverall6.scss b/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBTOverall6.scss
deleted file mode 100644
index b509add..0000000
--- a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBTOverall6.scss
+++ /dev/null
@@ -1,89 +0,0 @@
-.BSBTOverall6-defaultscreen-table {
- height: 100vh;
- overflow: auto;
- background-color: #fff;
-}
-
-.BSBTOverall6-mobileScreen {
- display: none;
-}
-
-.BSBTOverall6-defaultscreen {
- display: flex;
- width: inherit;
- // max-height: 40vh !important;
- // min-height: 30px !important;
- overflow-y: auto;
- //vm
- // height: 84vh;
- height: 80vh;
- flex-direction: column;
- justify-content: center;
-}
-.BSBTOverall6-defaultscreen-6 {
- //vm
- height: 70vh;
-}
-
-@media screen and (max-width: 768px) {
- .BSBTOverall6-mobileScreen {
- display: flex;
- flex-direction: row;
- justify-content: center;
- width: 100%;
- gap: 0.5rem;
- }
-
- .BSBTOverall6-defaultscreen {
- flex-direction: row;
- }
-
- .BSBTOverall6-defaultscreen-table {
- display: none;
- }
-
- .BSBTOverall6-defaultscreen-summery {
- // display: none;
- }
-
- .overall-summery {
- // display: none !important;
- }
-
- .BSBTOverall6-container {
- position: fixed;
- height: 0;
- bottom: 0;
- width: inherit;
- z-index: 1;
- }
-
- .BSBTOverall6-container {
- // position: fixed;
- bottom: 0;
- left: 0;
- width: inherit;
- z-index: 1;
- }
-
- .Summary6 {
- display: none;
- }
-}
-
-@media (min-width: 280px) and (max-width: 499px) {
- .BSBTOverall6-mobileScreen {
- width: 10%;
- }
-
- .BSBTOverall6-defaultscreen {
- height: 0px;
- }
-}
-
-.BSBTOverall6-container {
- // position: fixed;
- bottom: 10px;
- width: inherit;
- z-index: 1;
-}
diff --git a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBillingTable6.scss b/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBillingTable6.scss
deleted file mode 100644
index 69f7e4d..0000000
--- a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBillingTable6.scss
+++ /dev/null
@@ -1,76 +0,0 @@
-::-webkit-scrollbar {
- display: none;
-}
-
-.BillingTable6-Structure {
- width: 100%;
- display: flex;
- flex-direction: column;
- row-gap: 2rem;
-}
-
-.BSC1-Master .BillingTable6-Structure {
- height: 100%;
- overflow: auto;
- padding-bottom: 3rem;
-}
-
-.BillingTable6-Table1 {
- border-spacing: 0px;
-}
-
-.BillingTable6Table1-head {
- text-align: center;
- position: sticky;
- top: 0;
-}
-
-.BillingTable6-table-th {
- padding: 1vh 1vh 1vh 1vh;
- border: 0.1px solid rgba(168, 168, 168, 0.5019607843);
- font-family: "Poppins", sans-serif;
- // border:none; // Mohan 1
-}
-
-.BillingTable6-Table1-row {
- border: 2px solid #a5a4a4;
- background-color: #fff;
-}
-
-.BillingTable6-Table1-row-disabled {
- border: 2px solid #a5a4a4;
- pointer-events: none;
- background-color: rgb(243, 248, 213);
-}
-
-.BillingTable6-table-td {
- text-align: center;
- font-weight: 600;
- padding: 5px;
- border: 0.1px solid #a8a8a880;
- border-top: none;
- font-family: "Poppins", sans-serif;
- font-size: 14px;
- // border:none; // Mohan 2
-}
-
-.BillingTable6Table1-body {
- overflow-y: scroll;
-}
-
-.BillingTable6-Structure2 {
- height: 48vh !important;
-}
-
-.Tbl6-Variant {
- font-size: 10px;
-}
-
-@media (min-width: 280px) and (max-width: 499px) {
- .BillingTable6-table-th {
- padding: 4px;
- }
- .BillingTable6-Table1 {
- width: 100vw;
- }
-}
diff --git a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.scss b/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.scss
deleted file mode 100644
index 17949b0..0000000
--- a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.scss
+++ /dev/null
@@ -1,479 +0,0 @@
-input::-webkit-outer-spin-button,
-input::-webkit-inner-spin-button {
- -webkit-appearance: none;
- margin: 0;
-}
-
-.BST6Payment-select {
- width: 100px;
- height: 49.82px;
- border-radius: 8.3px;
- background-color: #eef3f3;
- font-size: 14px;
- font-weight: 600;
- line-height: 25px;
- letter-spacing: 0em;
- text-align: center;
- border: none;
- font-family: "Poppins", sans-serif;
-}
-
-.BST6Payment-Button-pay {
- width: 10rem;
- height: 49.82px;
- border-radius: 6px;
- background-color: var(--SELECTED_COLOR);
- font-weight: 600;
- letter-spacing: 0em;
- font-size: 19px;
- text-align: center;
- border: none;
- cursor: pointer;
- font-family: "Poppins", sans-serif;
-}
-
-.BST6Payment-Button-pay-disabled {
- width: 10rem;
- height: 49.82px;
- border-radius: 6px;
- background-color: var(--SELECTED_COLOR);
- font-weight: 600;
- letter-spacing: 0em;
- font-size: 19px;
- text-align: center;
- border: none;
- cursor: pointer;
- font-family: "Poppins", sans-serif;
- pointer-events: none;
- opacity: 0.5;
-}
-
-.c-btn {
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-.BST6Payment-Button-CANCEL {
- width: 50px;
- height: 50px;
- border-radius: 8.3px;
- background-color: #c6303e;
- border: none;
- font-size: 14px;
- font-weight: 600;
- color: #fff;
- cursor: pointer;
- font-family: "Poppins", sans-serif;
-}
-
-.BST6Payment-Button-RECIEVED {
- width: 100px;
- height: 38.16px;
- border-radius: 8.3px;
- border: 0.83px solid #8e8e8e;
- font-size: 18px;
- font-weight: 500;
- font-family: "Poppins", sans-serif;
- text-align: center;
-}
-
-.BST6Payment-Button-RECIEVED1 {
- width: 100px;
- height: 38.16px;
- border-radius: 8.3px;
- border: 0.83px solid #ff4d4f;
- font-size: 12px;
- font-family: "Poppins", sans-serif;
- text-align: center;
-}
-
-.BST6Payment-Button-RECIEVED1:focus-visible {
- outline: 1px solid #ff4d4f;
-}
-
-.BST6Payment-Button-BALANCE {
- width: 100px;
- height: 38.16px;
- border-radius: 8.3px;
- border: 0.83px solid #8e8e8e;
- font-size: 18px;
- font-family: "Poppins", sans-serif;
- text-align: center;
- font-weight: 500;
-}
-
-.BST6Payment-Structure {
- background-color: #fff;
- display: flex;
- flex-direction: column;
- gap: 0.5rem;
- align-items: center;
- justify-content: space-between;
-}
-
-.BST6Payment-div1 {
- padding-top: 8px;
- display: flex;
- flex-direction: row;
- align-items: center;
- gap: 0.4rem;
-}
-
-.BST6Payment-div2 {
- display: flex;
- flex-direction: row;
- gap: 2rem;
- align-items: center;
-}
-
-.BST6Payment-Paydiv {
- display: flex;
- justify-content: space-evenly;
-}
-
-.Payicon-Align {
- font-size: 18px;
- display: flex;
- align-items: center;
-}
-
-.pay-opt {
- width: 80px;
- height: 40px;
- font-size: 14px;
- text-transform: uppercase;
- border-radius: 6px;
- font-weight: 600;
- cursor: pointer;
-}
-
-.BST6Payment-Button-Hold {
- font-size: 25px;
- cursor: pointer;
-}
-
-.pop-sum-btn {
- display: none;
-}
-
-.Table6-payment-mode {
- display: flex;
- justify-content: space-between;
- column-gap: 0.2rem;
-}
-
-.splitpaymantBTNCombo {
- background-color: var(--DEFAULT_SELECTED_COLOR);
- font-size: 14px;
- font-weight: 500;
- height: 40px;
- width: 100px;
- border-radius: 7.2px;
- color: #fff;
- padding: 3px;
- display: flex;
- gap: 0.2rem;
- align-items: center;
- font-family: "Poppins";
- justify-content: center;
- cursor: pointer;
- text-transform: capitalize;
- svg {
- width: 20px;
- height: 20px;
- }
- @media (max-width: 992px) {
- font-size: 11px;
- height: 35px;
- width: 105px;
- svg {
- width: 17px;
- height: 17px;
- }
- }
- @media (max-width: 768px) {
- font-size: 13px;
- height: 40px;
- width: 130px;
- }
- @media (max-width: 500px) {
- font-size: 12px;
- height: 40px;
- width: 80px;
- }
-}
-
-.Btn-payment-mode {
- background-color: var(--SELECTED_COLOR);
- font-size: 13px !important;
- font-weight: 500;
- border: none;
- height: 40px;
- outline: none;
- flex-grow: 1;
- flex: 1;
- width: max-content !important;
- border-radius: 7.2px;
- color: #fff;
- padding: 3px;
- display: flex;
- gap: 0.2rem;
- align-items: center;
- font-family: "Poppins";
- justify-content: center;
- cursor: pointer;
- border: none;
- text-transform: capitalize;
- @media (max-width: 992px) {
- font-size: 11px;
- height: 35px;
- width: 105px;
- }
- @media (max-width: 768px) {
- font-size: 13px;
- height: 40px;
- width: 130px;
- }
- @media (max-width: 500px) {
- font-size: 12px;
- height: 40px;
- width: 80px;
- }
-}
-
-.Btn-payment-mode-sel {
- background-color: var(--DEFAULT_SELECTED_COLOR);
- font-size: 13px !important;
- font-weight: 500;
- outline: none;
- border: none;
- height: 40px;
- width: max-content !important;
- flex: 1;
- flex-grow: 1;
- border-radius: 7.2px;
- color: #fff;
- padding: 3px;
- display: flex;
- gap: 0.2rem;
- align-items: center;
- font-family: "Poppins";
- justify-content: center;
- cursor: pointer;
- text-transform: capitalize;
- border: none;
- @media (max-width: 992px) {
- font-size: 11px;
- height: 35px;
- width: 105px;
- }
- @media (max-width: 768px) {
- font-size: 13px;
- height: 40px;
- width: 130px;
- }
- @media (max-width: 500px) {
- font-size: 12px;
- height: 40px;
- width: 80px;
- }
-}
-
-.upioptbtn {
- width: 20px;
- height: 20px;
- cursor: pointer;
- background-color: #bebebe;
- color: #000000;
- border: none;
- border-radius: 6px;
-}
-
-.paymenticon {
- width: 20px;
- height: 20px;
- cursor: pointer;
- border: none;
- border-radius: 6px;
-}
-
-.BST6Payment-flex {
- display: flex;
- gap: 0.5rem;
- flex-direction: row;
- color: var(--DEFAULT_SELECTED_COLOR);
-}
-
-.BST6Payment-others {
- display: flex;
- align-items: center;
- gap: 0.5rem;
- color: var(--DEFAULT_SELECTED_COLOR);
-}
-
-.BST6Payment-buttons {
- display: flex;
- flex-direction: row;
- gap: 1rem;
-}
-.table6-billtable {
- display: none;
-}
-
-@media (max-width: 280px) {
- .table6-billtable {
- display: block !important;
- }
- .BST6Payment-select {
- width: 55px !important;
- }
-
- .BST6Payment-div2 {
- flex-direction: column-reverse;
- gap: 0.5rem !important;
- }
-
- .BST6Payment-buttons {
- display: flex;
- flex-direction: row;
- gap: 0.5rem;
- }
-
- .BST6Payment-others {
- display: flex;
- flex-direction: row;
- gap: 0.4rem;
- }
-
- .BST6Payment-div1 {
- gap: 1rem;
- }
-
- .pop-sum-btn {
- display: flex;
- }
-
- .pay-opt {
- width: 40px !important;
- font-size: 11px !important;
- }
-
- .BST6Payment-Button-pay {
- width: 125px !important;
- height: 40px;
- font-size: 17px;
- }
-
- .Table6-payment-mode {
- padding: 0rem 0.8rem;
- column-gap: 0.5rem;
- }
-}
-
-@media all and (max-width: 499px) {
- .table6-billtable {
- display: block !important;
- }
- .BST6Payment-div1 {
- display: flex;
- flex-direction: row;
- }
-
- .BST6Payment-select {
- width: 70px !important;
- height: 20px;
- font-size: 9px;
- font-weight: 400;
- line-height: 15px;
- }
-
- .BST6Payment-Structure {
- width: 100vw;
- position: fixed;
- bottom: 0;
- left: 0;
- }
-
- .pay-opt {
- width: 80px;
- font-size: 11px !important;
- }
-
- .BST6Payment-Button-pay {
- width: 155px;
- height: 40px;
- font-size: 19px;
- }
-
- .BST6Payment-Button-CANCEL {
- width: 35px;
- height: 35px;
- border-radius: 2px;
- }
-
- .BST6Payment-Button-CANCEL-txt {
- font-size: 0px;
- }
-
- .BST6Payment-Button-RECIEVED {
- width: 56px;
- height: 30px;
- font-size: 12px;
- }
-
- .BST6Payment-Button-BALANCE {
- width: 56px;
- height: 30px;
- font-size: 12px;
- }
-
- .Payicon-Align {
- font-size: 12px;
- }
-
- .pop-sum-btn {
- display: flex;
- }
-
- .Table6-payment-mode {
- column-gap: 0.5rem !important;
- align-items: center;
- }
-}
-
-@media screen and (max-width: 768px) {
- .pop-sum-btn {
- display: flex;
- }
- .table6-billtable {
- display: block !important;
- }
-
- .BST6Payment-Structure {
- width: 100vw;
- row-gap: 0.5rem;
- position: fixed;
- bottom: 10px;
- }
-
- .Table6-payment-mode {
- column-gap: 0.5rem !important;
- }
-
- .BigScreenSummary {
- display: none !important;
- }
-}
-
-.Order {
- background-color: var(--SELECTED_COLOR);
-}
-
-.ChairClrRed {
- color: red;
-}
-
-.ChairClrGreen {
- color: var(--SELECTED_COLOR);
-}
diff --git a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7.scss b/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7.scss
deleted file mode 100644
index 939ff23..0000000
--- a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7.scss
+++ /dev/null
@@ -1,571 +0,0 @@
-.BSBilling7div {
- width: 100%;
- flex-shrink: 0;
- background-color: white;
- position: relative;
-}
-
-.BSBilling7-tablediv {
- display: block;
- height: 53vh;
- overflow-y: scroll;
- max-height: 59vh;
-}
-.BSTable3_overall-6 {
- height: 71vh;
-}
-
-.BSBill-Table7 {
- width: 100%;
- border-spacing: 0;
- text-align: center;
- font-weight: 600;
-}
-
-.Table7-tbody {
- width: 100%;
- overflow-y: scroll;
-}
-
-.BSBill-Table7-throw {
- background-color: white;
- color: black;
- border-spacing: 1vh;
- height: 3rem;
- position: sticky;
- top: 0;
-}
-
-.summery-div {
- display: flex;
- align-items: flex-end;
-}
-
-.BSBill-Table7 th {
- position: sticky;
- border-spacing: 0;
- text-align: center;
- font-size: 16px;
- font-style: normal;
- font-weight: 600;
- line-height: normal;
-}
-
-.BSBill-Table7-content {
- background-color: rgba(235, 235, 236, 1);
- height: 3rem;
- font-size: 13px;
- font-style: normal;
- font-weight: 500;
-}
-
-.BSBill-Table7-content-disabled {
- background-color: rgba(235, 235, 236, 1);
- height: 3rem;
-
- font-size: 14px;
- font-style: normal;
- font-weight: 600;
- pointer-events: none;
-}
-
-.Table7-items {
- text-align: left;
-
- font-size: 14px;
- font-style: normal;
- font-weight: 600;
-}
-
-.Table7-item-price {
- font-size: 14px;
- font-style: normal;
- font-weight: 600;
-}
-
-.BSBilling7-down-content {
- display: flex;
- flex-wrap: wrap;
- background-color: white;
-}
-
-.BSBilling7-view-summary {
- display: flex;
- justify-content: flex-end;
- width: 90%;
-}
-
-.BSBilling7-price-full {
- display: flex;
- width: 100%;
-}
-
-.BSBilling7-customer {
- display: flex;
- width: 50%;
- flex-wrap: wrap;
- background-color: white;
- justify-content: center;
-}
-
-.BSBilling7-customer-subdiv {
- display: flex;
- flex-wrap: wrap;
- width: 100%;
- height: fit-content;
- justify-content: space-evenly;
-}
-
-.Table7-price {
- display: flex;
- flex-wrap: wrap;
- width: 45%;
- justify-content: flex-end;
- background-color: white;
-}
-
-.Table7-price-fullflex {
- width: auto;
-}
-
-.BSBill7-Btn-select-customer {
- width: 13rem;
- height: 3rem;
- border-radius: 4.982px;
- background: rgba(51, 55, 58, 0.1);
- border: none;
- font-size: 16px;
- font-style: normal;
- font-weight: 600;
- text-align: center;
-}
-
-.Add-new-customer {
- display: flex;
- align-items: center;
- margin: 1vh;
-}
-
-.Table7-payment-mode {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-evenly;
-}
-
-.Table7-cash {
- display: flex;
- width: 60px;
- margin: 10px 10px;
-}
-
-.Table7-customer .ant-select-single:not(.ant-select-customize-input) .ant-select-selector {
- width: 10rem;
- height: 3rem;
- text-align: center;
- border-radius: 4.982px;
- background-color: rgba(51, 55, 58, 0.1);
- border: none;
- font-size: 14px;
- font-style: normal;
- font-weight: 600;
-}
-
-.Table7-customer .ant-select-single.ant-select-show-arrow .ant-select-selection-placeholder {
- color: #000;
- padding-inline-end: 0px !important;
-}
-
-.Table7-customer {
- .ant-select-selection-placeholder {
- padding-inline-end: 0px;
- }
-}
-
-.Table7-Btn-payment-mode {
- height: 3rem;
- width: 10rem;
- border-radius: 6.216px;
- border: 0px;
- background: #e0e0e0;
- color: black;
- font-size: 14px;
- font-style: normal;
- font-weight: bold;
- padding: 10px 10px;
- margin: 10px 10px;
- cursor: pointer;
-}
-
-.Table7-paymentmode-active {
- height: 3rem;
- width: 10rem;
- border-radius: 6.216px;
- border: 0px;
- background: #33373a;
- color: #e0e0e0;
- font-size: 14px;
- font-style: normal;
- font-weight: bold;
- padding: 10px 10px;
- margin: 10px 10px;
-}
-
-.Table7-vertical-line {
- border: 0.83px solid rgb(175, 173, 173);
-}
-
-.Table7-total-price {
- width: 90%;
- margin: 1vw;
- text-align: right;
-}
-
-@media (max-width: 700px) {
- .BSBill-Table7 th {
- padding: 2px !important;
- }
-}
-
-@media (max-width: 500px) {
- .BSBilling7-tablediv {
- height: 85% !important;
- }
-
- .Table7-td-names {
- text-align: right;
- font-size: 8px !important;
- font-weight: 600;
- }
-
- .Table7-td-values {
- font-size: 9px !important;
- }
-
- .Table7-rate {
- font-size: 14px !important;
- }
-
- .Table7-price {
- display: revert;
- }
-
- .Table4-hand-icon {
- font-size: 20px;
- }
-
- .Table7-total-price {
- width: 70%;
- }
-
- .Table7-rate-arrow {
- width: 20px !important;
- height: 20px !important;
- border-radius: 20px !important;
- }
-
- .BSBill-Table7 th {
- padding: 2px;
- }
-
- .BSBill-Table7-content {
- font-size: 14px;
- font-style: normal;
- }
-
- .Table7-items {
- font-weight: 400;
- }
-
- .Table7-item-price {
- font-weight: 400;
- }
-}
-
-.Table7-totalprice-row {
- height: 50px;
-}
-
-.Table7-td-names {
- text-align: right;
- font-size: 16px;
- font-weight: 600;
-}
-
-.Table7-td-values {
- text-align: right;
- font-size: 18px;
- font-weight: 600;
-}
-
-.Table7-Price-div {
- display: flex;
- width: 100%;
- align-items: center;
-}
-
-.Table7-Btn-final-price {
- width: 15rem;
- height: 4rem;
- border-radius: 4.982px;
- background: #6df38b;
- text-align: center;
- border: 0;
- margin: 1vw;
-}
-
-.Table7-rate {
- display: flex;
- font-family: "Poppins", sans-serif;
- font-size: 32.203px;
- font-style: normal;
- font-weight: bold;
- align-items: center;
-}
-
-.BSBilling7-summary {
- font-size: 14px;
- font-style: normal;
- font-weight: bold;
-}
-
-.Table7-pencil {
- width: 25px;
- height: 25px;
-}
-
-.icon-button {
- height: 30px;
- border-radius: 30px;
- padding: 0px;
- margin: 6px 6px;
-}
-
-.BSBilling-customer-subdiv {
- display: flex;
- flex-wrap: wrap;
- width: 100%;
- height: fit-content;
-}
-
-.Table7-fullrate {
- display: flex;
- justify-content: space-between;
- column-gap: 1rem;
- align-items: center;
- cursor: pointer;
-}
-
-.Table7-rate-arrow {
- display: flex;
- height: 30px;
- width: 30px;
- border-radius: 30px;
- background-color: #6df38b;
- align-items: center;
-}
-
-.Table7-arrow {
- font-size: 40px;
- text-align: center;
- margin: 4px 4px;
-}
-
-.Table7-finalprice {
- display: flex;
- width: 100%;
- justify-content: flex-end;
-}
-
-//icon bar design
-.BSBilling7-Iconbar {
- display: flex;
- justify-content: space-around;
- height: 60px;
- width: 100%;
- background-color: black;
-}
-
-.BSBilling7-icon-flex {
- display: flex;
- align-items: center;
- div {
- display: flex;
- align-items: center;
- justify-content: center;
-
- }
-}
-
-.BSBilling7-icon {
- height: 30px;
- width: 30px;
- color: white;
-}
-
-.BSBilling7-vertical-line {
- width: 1px;
- height: 100%;
- background-color: #000;
- margin: 0 10px;
-}
-
-hr.Table7-Dotted-Line1 {
- border-top: 1px dashed black;
- width: 100%;
- text-align: center;
- border-left: 0px;
-}
-
-.Table7-horizondal-line {
- width: 100%;
- height: 1px;
-}
-
-.Table7-hand-icon {
- font-size: 40px;
-}
-
-.BSBilling7TableCont {
- height: 100vh;
- overflow-y: scroll;
-}
-
-@media (max-width: 700px) {
- .BSBilling7-down-content {
- display: flex;
- width: 100%;
- position: fixed;
- bottom: 0px;
- height: fit-content;
- }
-}
-
-.edit-btn-table {
- width: max-content;
- padding: 0.2rem 0.5rem;
- font-weight: 600;
- background-color: var(--SELECTED_COLOR);
- border-radius: 3px;
- text-align: center;
- font-size: 14px;
- cursor: pointer;
- color: #f3f3f3 !important;
- border: solid 1px var(--SELECTED_COLOR);
-}
-
-.edit-btn-table:hover:focus:active {
- background-color: none !important;
- color: #000000 !important;
-}
-
-.edit-btn-table:focus {
- background-color: #fff;
- color: var(--SELECTED_COLOR) !important;
- border: solid 1px var(--SELECTED_COLOR);
-}
-
-.del-btn-table {
- width: max-content;
- padding: 0.2rem 0.5rem;
- font-size: 14px;
- font-weight: 600;
- background-color: var(--ERROR_COLOR);
- border-radius: 3px;
- text-align: center;
- border: solid 1px var(--ERROR_COLOR);
- cursor: pointer;
- color: #f3f3f3 !important;
-}
-
-.del-btn-table:hover {
- background-color: var(--ERROR_COLOR);
- color: #fff !important;
-}
-
-.del-btn-table:focus {
- background-color: #fff;
- border: solid 1px var(--ERROR_COLOR) !important;
- color: var(--ERROR_COLOR) !important;
-}
-
-.radio-button-group {
- display: flex;
- gap: 0.3rem;
- justify-content: flex-end;
-}
-
-.radio-button-group .radio-button {
- position: absolute;
- width: 1px;
- height: 1px;
- opacity: 0;
-}
-
-.radio-button-group .radio-button + label {
- padding: 4px 10px;
- cursor: pointer;
- border: none;
- margin-right: -2px;
- color: #ffffff;
- background-color: var(--DEFAULT_SELECTED_COLOR);
- font-family: "gilroy";
- font-size: 13px;
- font-weight: 600;
- display: block;
- text-align: center;
-}
-
-.radio-button-group .item:first-of-type .radio-button + label {
- border-top-left-radius: 5px;
- border-bottom-left-radius: 5px;
-}
-
-.radio-button-group .item:last-of-type .radio-button + label {
- border-top-right-radius: 5px;
- border-bottom-right-radius: 5px;
-}
-
-.radio-button-group .radio-button:checked + label {
- background-color: var(--SELECTED_COLOR);
- color: #fff;
-}
-.Btn-payment-mode-sel {
- background-color: var(--DEFAULT_SELECTED_COLOR);
- font-size: 14px;
- font-weight: 500;
- border: none;
- height: 40px;
- width: 75px;
- border-radius: 7.2px;
- color: #fff;
- padding: 3px;
- display: flex;
- gap: 0.2rem;
- align-items: center;
- font-family: "Poppins";
- justify-content: center;
- cursor: pointer;
- text-transform: capitalize;
- outline: none;
-}
-
-.Btn-payment-mode {
- background-color: var(--SELECTED_COLOR);
- font-size: 14px;
- border: none;
- font-weight: 500;
- height: 40px;
- outline: none;
- width: 75px;
- border-radius: 7.2px;
- color: #fff;
- padding: 3px;
- display: flex;
- gap: 0.2rem;
- align-items: center;
- font-family: "Poppins";
- justify-content: center;
- cursor: pointer;
- text-transform: capitalize;
- outline: none;
-}
diff --git a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTables3/BSBillingTable3.scss b/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTables3/BSBillingTable3.scss
index 8bc6899..e78096d 100644
--- a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTables3/BSBillingTable3.scss
+++ b/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTables3/BSBillingTable3.scss
@@ -23,7 +23,6 @@
width: 100%;
border-spacing: 0 0px;
text-align: center;
-
}
.BSBill-Table3-throw {
@@ -769,7 +768,6 @@
padding: 2px !important;
font-size: 10px;
}
-
.BSBill-Table3 {
border-spacing: 0;
@@ -1102,6 +1100,9 @@
width: 100%;
box-shadow: rgba(17, 17, 26, 0.1) 0px 0px 16px;
}
+ .BSBillingTable1-summeryTable {
+ display: none;
+ }
}
.BillTable-carticon {
@@ -1191,6 +1192,7 @@
align-items: center;
justify-content: center;
margin-top: 10px;
+ gap: 2px;
.BodyBillTable-Qty {
padding: 2px !important;
width: 20px !important;
@@ -1368,3 +1370,63 @@
font-family: "Poppins" !important;
}
}
+.BSBillingTable5-table-count-min-btn {
+ width: 25px;
+ height: 25px;
+ background-color: rgb(207, 207, 207);
+ border-radius: 25px;
+ color: #000000;
+ cursor: pointer;
+ border: none;
+}
+
+.BSBillingTable5-table-count-max-btn {
+ width: 25px;
+ height: 25px;
+ background-color: #ff4d4f;
+ border-radius: 25px;
+ color: #fff;
+ cursor: pointer;
+ border: none;
+}
+
+.radio-button-group .radio-button + label {
+ padding: 4px 10px;
+ cursor: pointer;
+ border: none;
+ margin-right: -2px;
+ color: #ffffff;
+ background-color: var(--DEFAULT_SELECTED_COLOR);
+ font-family: "gilroy";
+ font-size: 13px;
+ font-weight: 600;
+ display: block;
+ text-align: center;
+}
+
+.radio-button-group .item:first-of-type .radio-button + label {
+ border-top-left-radius: 5px;
+ border-bottom-left-radius: 5px;
+}
+
+.radio-button-group .item:last-of-type .radio-button + label {
+ border-top-right-radius: 5px;
+ border-bottom-right-radius: 5px;
+}
+
+.radio-button-group .radio-button:checked + label {
+ background-color: var(--SELECTED_COLOR);
+ color: #fff;
+}
+
+.radio-button-group .radio-button {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ opacity: 0;
+}
+.radio-button-group {
+ display: flex;
+ gap: 0.3rem;
+ justify-content: flex-end;
+}
diff --git a/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar2.scss b/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar2.scss
deleted file mode 100644
index 11f3fb3..0000000
--- a/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar2.scss
+++ /dev/null
@@ -1,463 +0,0 @@
-.BSBillingNavBar2 {
- display: flex;
- align-items: center;
- width: 100%;
- height: 45px;
- padding: 0rem 1rem;
- box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.2);
- background-color: #ffffff;
- .RiVerifiedBadgeFill {
- color: #1292ee !important;
- }
- .FaparkingIcon {
- width: 32px !important;
- height: 32px !important;
- }
- .ant-form-item {
- margin-bottom: 0 !important;
- }
- .Combosearch .ant-select.ant-select-in-form-item {
- width: unset !important;
- }
- .Combosearch {
- height: unset !important;
- }
- @media (max-width: 500px) {
- padding: 0rem 10px;
- }
-}
-
-.BSBillingNav2div2 {
- display: flex;
- justify-content: space-evenly;
- align-items: center;
- width: 100%;
-
- .bs-membership__icon-btn {
- svg {
- color: #fbbf24;
- }
- }
- @media (max-width: 500px) {
- .BSBillingNavBar2-SearchBar {
- width: 60% !important;
- }
- }
-}
-
-.BSBillingNavBar2-SearchBar {
- display: flex;
- height: 32px;
- border-radius: 50px;
- position: relative;
- .BarCodeScanMaster {
- position: absolute;
- padding: 0 !important;
- right: 10px;
- top: 9px;
- svg {
- font-size: 18px !important;
- }
- }
-
- .custom-input {
- padding: 10px 35px 10px 40px;
- }
- .search-icon {
- top: 50%;
- }
- .search-input {
- bottom: 3px;
- }
- .MultiSearchIconDiv2 {
- color: #1292ee !important;
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- width: 20px !important;
- height: 20px;
- position: absolute;
- left: 5px;
- top: 5px;
-
- svg {
- font-size: 22px;
- width: 32px !important;
- height: 32px;
-
- display: flex;
- }
- }
-}
-
-.favItem-SearchBar {
- display: flex;
- height: 32px;
- border: 1px solid var(--DEFAULT_SELECTED_COLOR);
- border-radius: 50px;
- width: 100%;
- background-image: url(https://cdn3.iconfinder.com/data/icons/feather-5/24/search-64.png);
- background-repeat: no-repeat;
- background-size: 18px 18px;
- background-position: 95% center;
- padding: 0 1rem;
-}
-
-.BSNavBar2-searchbar-searchicon {
- display: flex;
- padding: 8px 16px;
- color: var(--DEFAULT_SELECTED_COLOR);
-}
-.BSBillingNav2-toggle-icon {
- padding-left: 5px;
- font-size: 25px;
- cursor: pointer;
-
- &:hover {
- transform: scale(1.1);
- }
-}
-
-.BSBillingNavBar2-AllIcons {
- display: flex;
- color: var(--DEFAULT_SELECTED_COLOR);
-}
-
-.BSBillingnav2-threedots {
- display: none;
- cursor: pointer;
-}
-
-.AddFavList {
- padding: 1.5rem 2rem;
- position: absolute;
- width: 33vw;
- top: 0;
- height: 100vh;
- background-color: white;
- right: 2px;
- transition-duration: 0.6s;
- z-index: 50;
- box-shadow: var(--BOX_SHADOW_LEVEL2);
- color: black;
- display: inline-flex;
- flex-direction: column;
- align-items: flex-start;
- gap: 10px;
- border-radius: 6px;
-}
-
-.AddFavItemListCont {
- height: 60vh;
- overflow: auto;
- width: 100%;
-}
-
-.favsbmtbtn {
- display: flex;
- justify-content: flex-end;
- align-items: flex-end;
- width: 100%;
-}
-
-.AddFavItemList {
- margin: 0.5rem 0rem;
- padding: 0.5rem 2rem;
- display: flex;
- width: 100%;
- height: 40px;
- background-color: #fcfcfc;
- justify-content: space-between;
- border-radius: 6px;
- align-items: center;
- transition-duration: 0.6s;
-
- .anticon {
- color: red !important;
- }
-}
-
-.AddFavItemList:hover {
- width: 100%;
- height: 45px;
- background-color: #ebebeb;
- font-size: 16px;
- font-weight: 600;
- transition-duration: 0.1s;
-}
-
-.AddFavList-subContainer {
- display: flex;
- column-gap: 2rem;
- flex-wrap: wrap;
- flex-direction: column;
-}
-
-.fav-close {
- display: none;
-}
-
-.fav-Downarrow {
- display: none;
-}
-
-.salesUserProfile {
- display: flex;
- align-items: center;
- gap: 6px;
- flex-direction: column;
- padding: 10px 1rem;
- font-family: "Poppins";
-
- > div {
- width: 100%;
- font-size: 14px;
- display: flex;
- align-items: center;
- gap: 10px;
- }
-
- .BSNavBar1-Acc-menu-list {
- padding: 6px 10px;
- background-color: #ee0000;
- color: #fff;
- border-radius: 6px;
- cursor: pointer;
- display: flex;
- align-items: center;
- gap: 1rem;
- }
-
- img {
- width: 70px;
- height: 70px;
- border-radius: 1000px;
- border: 1px solid #a1a1a1;
- background-position: center;
- }
-}
-
-@media (max-width: 900px) {
- .AddFavList-subContainer {
- display: flex;
- column-gap: 2rem;
- flex-direction: column;
- width: 100%;
- }
-
- .AddFavList {
- width: 55vw !important;
- }
-}
-
-@media (max-width: 499px) {
- .favItem-SearchBar {
- width: 7.6rem;
- }
-}
-
-@media (max-width: 768px) {
- .AddFavList {
- position: fixed;
- left: 0;
- top: 17rem;
- width: 100vw !important;
- padding: 1rem 1rem !important;
- }
-
- .smallScreenclose {
- display: none;
- }
-
- .AddFavItemListCont {
- height: 40vh;
- overflow: auto;
- }
-
- .favItem-SearchBar {
- width: 97%;
- height: 2.8rem;
- }
-
- .fav-close {
- display: flex;
- justify-content: flex-end;
- border: none;
- border-radius: 5px;
- cursor: pointer;
- font-size: 23px;
- }
-
- .fav-Downarrow {
- display: flex;
- }
-
- .AddFavList .primary_Button {
- width: 12rem !important;
- }
-
- .favsbmtbtn {
- bottom: 40px;
- }
-
- .AddFavList .primary_Button {
- width: 10rem;
- }
-
- .favIcon {
- display: none;
- }
-
- .AddFavItemList {
- padding: 0.5rem !important;
- }
-
- .BSBillingnav2-threedots {
- display: flex;
- color: var(--DEFAULT_SELECTED_COLOR);
- }
-
- .BSBillingNavBar2-AllIcons {
- display: none;
- column-gap: 1.5rem;
- }
-
- .BSBillingnav2-Smallscreen {
- position: absolute;
- right: 0;
- top: 40px;
- display: flex !important;
- border-right: 1px solid rgb(204, 198, 198);
- background-color: rgb(255, 255, 255);
- z-index: 3 !important;
- justify-content: center;
- padding: 10px;
- box-shadow:
- rgba(0, 0, 0, 0.16) 0px 10px 36px 0px,
- rgba(0, 0, 0, 0.06) 0px 0px 0px 1px;
- height: 100vh;
- width: 90px;
- }
-
- .BSBillingNavBar2-AllIcons-column {
- row-gap: 0.8rem !important;
- }
-
- .BSBillingNav2div2 .EstimateButton {
- flex-direction: column !important;
- height: max-content !important;
- padding: 5px 2px !important;
- }
- .Nav2BSNavBarWholeSale {
- display: none;
- }
-}
-
-.BSBillingNav2div2 .EstimateButton {
- cursor: pointer;
- display: flex;
- align-items: center;
- color: #52c41a;
- background-color: #1292ee;
- height: 30px;
- width: max-content;
- justify-content: space-around;
- border-radius: 6px;
- padding: 0 5px;
-}
-
-.BSBillingnav2-Smallscreen {
- display: none;
-}
-
-.BSBillingNavBar2-AllIcons-column {
- display: flex;
- flex-direction: column;
- row-gap: 1.2rem;
- color: var(--DEFAULT_SELECTED_COLOR);
- height: 100vh !important;
- overflow: auto;
- scrollbar-width: thin;
- padding-bottom: 20rem;
- align-items: center;
-}
-
-.BSNavBar2-acc {
- color: #fff;
- display: flex;
- align-items: center;
- width: 100%;
- justify-content: flex-end;
- flex-direction: row;
- font-size: 20px;
- column-gap: 1.5rem;
-}
-
-.BSNavBar2-Accmenu {
- position: absolute;
- z-index: 2;
- right: 0;
- width: 160px;
- height: 80px;
- color: black;
- display: flex;
- justify-content: center;
- background-color: #f3f3f3;
-}
-
-.BSNavBar2-Acc-menu {
- cursor: pointer;
- display: flex;
- justify-content: center;
- row-gap: 0.5rem;
- flex-direction: column;
- text-align: center;
-}
-
-.BSNavBar2-Acc-menu-list {
- color: black;
- font-size: 14px;
-}
-
-.BSNavBar2-Acc-menu-list:hover {
- color: var(--SELECTED_COLOR);
-
- font-weight: 600;
-}
-
-.BSBillingNavBar2-hand {
- position: relative;
-}
-
-.BSBillingNavBar2-hand .ant-badge {
- position: absolute;
- left: 11px;
- top: 10px;
-}
-
-.BsNavbar1FullScreen {
- background-color: #1292ee;
- height: 28px;
- width: 28px;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: 4px;
- cursor: pointer;
- font-size: 18px;
- color: #fff;
-}
-
-.BsNavbar1FullScreenExit {
- background-color: #ef4444;
- height: 28px;
- width: 28px;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: 4px;
- color: #fff;
- font-size: 18px;
- cursor: pointer;
-}
diff --git a/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar3.scss b/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar3.scss
deleted file mode 100644
index 25d5efb..0000000
--- a/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar3.scss
+++ /dev/null
@@ -1,740 +0,0 @@
-.BSNavbar3Main {
- width: 100vw;
- background: linear-gradient(to bottom right, #1e2536, #2a3447);
- padding: 0.4rem 12px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 1rem;
-
- .searchDiv .ant-input {
- height: 32px !important;
- }
-
- .css-1ao51vv-control {
- background-color: #414d5c !important;
- border: 1px solid #7b838f !important;
-
- .css-1uc962m-placeholder {
- color: #b1b1b1 !important;
- opacity: 1;
- }
- }
-
- .homeTime {
- display: flex;
- align-items: center;
- gap: 1rem;
- color: #fff;
- font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
- white-space: nowrap;
-
- .CiShopIcon {
- display: none !important;
- }
- }
-
- .standard-extra-charges {
- svg {
- color: #ffffff !important;
- transition: all 0.2s;
- &:hover {
- color: #1292ee !important;
- }
- }
- }
-
- .homeIcon {
- display: flex;
- font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
- justify-content: center;
- gap: 0.5rem;
- font-size: 16px;
- font-weight: 500;
- align-items: flex-end;
- cursor: pointer;
-
- svg {
- display: flex;
- transition: all 0.2s ease-in-out;
- &:hover {
- color: #1292ee !important;
- }
- }
-
- @media (max-width: 1000px) {
- > div {
- display: none;
- }
- }
- }
-
- .timedate {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 0.2rem;
- font-size: 12px;
- font-weight: 400;
- -webkit-text-stroke-width: 0.2px;
- border-radius: 50px;
- font-family: "Poppins", sans-serif !important;
- }
-
- .BsnavbarSearchMain {
- width: 25vw;
- position: relative;
- .MultiSearchIconDiv3 {
- position: absolute;
- right: 10px;
- top: 5px;
- z-index: 100;
- }
- .BarCodeScanMaster {
- position: absolute;
- right: -25PX;
- padding: 0 !important;
- top: 30%;
- svg {
- font-size: 20px !important;
- }
- }
-
- .searchDiv .ant-input {
- color: #fff !important;
-
- &::placeholder {
- color: #b1b1b1b4;
- opacity: 1;
- }
- }
-
- &:focus-within {
- border: 1px solid #ffffff52;
- border-radius: 0.75rem !important;
- }
-
- .ant-input-affix-wrapper {
- border-radius: 0.5rem !important;
- border: 1px solid #7b838f63;
- background-color: #414d5cc2 !important;
- height: 40px !important;
- width: 100% !important;
-
- .ant-input {
- margin-top: 0 !important;
- padding-top: 3px !important;
- }
- }
- }
-
- .CustomerActions {
- display: flex;
- align-items: center;
- gap: 0.3rem;
-
- .RiVerifiedBadgeFill {
- transition: all 0.2s ease-in-out;
- height: 37px;
- width: 37px;
- padding: 6px 4px;
- border-radius: 0.5rem;
-
- &:hover {
- color: #1292ee !important;
- }
- }
- .BSBillingNavBar1-AllIcons {
- color: #ffffff !important;
- &:hover {
- color: #1292ee !important;
- }
- }
- .bs-membership__icon-btn {
- display: flex;
- align-items: center;
- justify-content: center;
- svg {
- transition: all 0.2s ease-in-out;
- color: #ffffff !important;
- }
- &:hover {
- svg {
- color: #1292ee !important;
- }
- }
- }
- }
-
- .FaTruckIcon {
- padding: 10px 10px;
- border-radius: 0.5rem;
- color: #6b7280;
- cursor: pointer;
- // background-color: #2563eb;
- height: 41px;
- width: 41px;
-
- &:hover {
- background-color: #eff6ff;
- color: #2563eb;
- }
- }
-
- .FaTruckIconFavItem {
- padding: 10px 10px;
- border-radius: 0.5rem;
- color: #ffffff !important;
- cursor: pointer;
- // background-color: #2563eb;
- height: 41px;
- width: 41px;
-
- &:hover {
- color: #1292ee !important;
- }
-
- .BSBillingNav-icon {
- color: #ffffff !important;
- }
- }
-
- .FaTruckIconDragItems {
- padding: 6px 9px;
- border-radius: 0.5rem;
- color: #6b7280 !important;
- cursor: pointer;
- // background-color: #2563eb;
- height: 40px;
- width: 40px;
- transition: all 0.2s ease-in-out;
- svg {
- color: #ffffff !important;
- }
-
- &:hover {
- color: #1292ee;
- svg {
- color: #1292ee !important;
- }
- }
- }
-
- .FaTruckIconHold {
- padding: 10px 7px;
- border-radius: 0.5rem;
- color: #ffffff;
- cursor: pointer;
- width: 40px !important;
- height: 40px !important;
- // background-color: #2563eb;
- transition: all 0.2s ease-in-out;
-
- &:hover {
- color: #1292ee;
- }
- }
-
- .FaTruckIconreprint {
- // padding: 2px 7px;
- // border-radius: 0.5rem;
- // color: #6b7280;
- // cursor: pointer;
- padding: 12px 9px;
- border-radius: 0.5rem;
- color: #ffffff;
- cursor: pointer;
- // background-color: #2563eb;
- height: 41px;
- width: 41px;
- transition: all 0.2s ease-in-out;
-
- .BSBillingNav-icon {
- height: 22px !important;
- width: 25px !important;
- }
-
- &:hover {
- color: #1292ee;
- }
- }
-
- // .FaPlusIcon {
- // padding: 11px 10px;
- // border-radius: 0.5rem;
- // color: #eff6ff;
- // font-size: 3.3rem;
- // cursor: pointer;
- // height: 40px;
- // width: 38px;
- // background-color: #2563eb;
-
- // &:hover {
- // background-color: #134ac0;
- // color: #eff6ff;
- // }
- // }
-
- .userDates {
- display: flex;
- align-items: center;
- gap: 1rem;
-
- .BSNavBar1-Accmenu {
- right: 0 !important;
- }
- }
-
- .datesNew {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 0.2rem;
- font-size: 12px;
- font-weight: 400;
- -webkit-text-stroke-width: 0.2px;
- border-radius: 50px;
- font-family: "Poppins", sans-serif !important;
- }
-
- .BsNavbarUser {
- color: #ffffff;
- font-size: 1.3rem;
- cursor: pointer;
- position: relative;
- display: flex;
- align-items: center;
- justify-content: center;
- transition: all 0.2s ease-in-out;
- &:hover {
- color: #1292ee;
- }
- }
-
- .DropDownsCustomer {
- display: flex;
- gap: 2px;
- position: relative;
- align-items: center;
-
- .BSBillingNav-icon {
- color: #ffffff !important;
- transition: all 0.2s ease-in-out;
- width: 30px !important;
- &:hover {
- color: #1292ee !important;
- }
- }
-
- .ant-select {
- width: 8.5rem !important;
- }
-
- .float-label {
- margin-bottom: 0 !important;
- }
-
- .ant-select-selector {
- height: 42px !important;
- }
- }
-
- .DropDownsCustomerClose {
- color: #c2c2c2;
- position: absolute;
- right: 60px;
- font-weight: 500;
- cursor: pointer;
- &:hover {
- color: #727272;
- }
- @media (max-width: 768px) {
- right: 30px;
- }
- }
-
- .DropDownsCustomer.always-visible {
- .ant-select {
- width: 7rem !important;
- }
- }
-
- // Mobile toggle button
- .mobile-toggle-btn {
- display: none;
- cursor: pointer;
- padding: 8px;
- border-radius: 4px;
- transition: background-color 0.2s ease;
-
- &:hover {
- background-color: rgba(255, 255, 255, 0.1);
- }
- }
-}
-
-// Mobile Menu Styles
-.mobile-menu {
- position: fixed;
- top: 0;
- right: -100%;
- width: 200px;
- height: 100vh;
- background-color: #2a3447;
- z-index: 1000;
- transition: right 0.3s ease;
- box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
-
- &.open {
- right: 0;
- }
-
- .mobile-menu-content {
- padding: 1rem 1rem;
- height: 100%;
- overflow-y: auto;
-
- @media (max-width: 500px) {
- .ant-tooltip-content {
- display: none !important;
- }
- }
- }
-
- .mobile-customer-actions {
- display: flex;
- flex-direction: column;
- gap: 1px;
- .EstimateButton > span svg {
- color: rgb(82, 196, 26) !important;
- }
- }
-
- .mobile-action-item {
- display: flex;
- align-items: center;
- justify-content: flex-start;
- gap: 1rem;
- color: #fff;
- transition: background-color 0.2s ease;
- padding: 0.4rem 0.4rem;
- height: 50px;
- border-radius: 8px;
- cursor: pointer;
-
- &:hover {
- background-color: #4a5568;
- padding: 0.4rem 0.4rem;
- }
-
- div {
- font-family: "Inter", ui-sans-serif, system-ui, sans-serif !important;
- font-weight: 400;
- font-size: 0.9rem;
- }
-
- svg {
- color: #ffffff !important;
- display: flex;
- }
-
- .ant-select {
- width: 100% !important;
- }
- }
-
- .BothSalesBadge {
- background-color: #2563eb !important;
- font-weight: 400 !important;
- }
-}
-
-.userAccMenu {
- position: absolute;
- top: 1rem;
- right: 1rem;
- background-color: #fff;
- padding: 1rem;
- border-radius: 10px;
- border: 1px solid #ccc;
- box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px;
- font-family: "Inter", ui-sans-serif, system-ui, sans-serif !important;
-}
-
-.profileImage {
- display: flex;
- align-items: center;
- gap: 0.5rem;
- font-size: 1.2rem;
- font-weight: 500;
- position: relative;
-
- img {
- width: 50px;
- height: 50px;
- border-radius: 100px;
- border: 1px solid #ccc;
- }
-}
-
-.userAccMenuList {
- display: flex;
- flex-direction: column;
- gap: 10px;
- border-top: 1px solid #ccc;
- padding-top: 1rem;
- margin-top: 1rem;
-
- div {
- display: flex;
- align-items: center;
- gap: 0.5rem;
- color: #4b5563da;
- }
-}
-
-.UserAccMenusignOutButton {
- width: 100%;
- padding: 10px 12px;
- font-size: 16px;
- font-family: "Inter", ui-sans-serif, system-ui, sans-serif !important;
- font-weight: 500;
- -webkit-text-stroke-width: 0.1px;
- border: none;
- border-radius: 6px;
- outline: none;
- margin-top: 6px;
- display: flex;
- align-items: center;
- gap: 0.5rem;
- color: #fff;
- background-color: #e53935;
- cursor: pointer;
- text-align: center;
- justify-content: center;
-}
-
-.closeUserAccMenu {
- position: absolute;
- top: -12px;
- right: -7px;
- font-size: 16px;
- cursor: pointer;
- color: #6b7280;
- transition: all 0.2s ease;
-
- &:hover {
- color: #ef4444;
- transform: scale(1.1);
- }
-}
-
-.EstimateButton {
- > span {
- svg {
- color: rgb(82, 196, 26);
- height: 22px;
- width: 22px;
- }
- }
-}
-
-.voiceToTextIcon {
- position: fixed;
- // width: max-content;
- top: 7px;
- left: 10px;
- display: flex;
- align-items: center;
- gap: 0.3rem;
- background-color: #414d5c;
- color: #f5d945;
- padding: 0.2rem 0.9rem;
- border-radius: 0.75rem;
- font-size: 0.7rem;
- font-family: "Inter", ui-sans-serif, system-ui, sans-serif !important;
- cursor: pointer;
- position: relative;
- z-index: 0;
-
- button {
- background: none;
- border: none;
- color: #f5d945;
-
- svg {
- font-size: 1.1rem;
- display: flex;
- }
- }
-
- @keyframes rainbowBorder {
- 0% {
- background-position: 0% 50%;
- }
-
- 50% {
- background-position: 100% 50%;
- }
-
- 100% {
- background-position: 0% 50%;
- }
- }
-
- @media (max-width: 500px) {
- top: 2px;
- left: 8px;
- }
-}
-
-.navbar-fav-icon .AddFavList {
- padding: 2rem 2rem;
- position: absolute;
- width: 33vw;
- height: 90vh;
- background-color: white;
- right: 2px;
- transition-duration: 0.6s;
- z-index: 23;
- box-shadow: var(--BOX_SHADOW_LEVEL2);
- color: black;
- display: inline-flex;
- flex-direction: column;
- align-items: flex-start;
- gap: 1rem;
- border-radius: 6px;
- top: 87px;
-}
-
-.datesNewtimedate {
- background-color: #f3f4f6;
- color: #4b5563da;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- gap: 0;
- font-size: 0.875rem;
- font-weight: 500;
- padding: 0.1rem 0.1rem;
- border-radius: 7px;
- white-space: nowrap;
- font-family: "Poppins", sans-serif;
- width: 110px;
- line-height: 1.3;
-
- @media (max-width: 1000px) {
- display: none;
- }
-}
-
-// Responsive Design
-@media (max-width: 768px) {
- .BSNavbar3Main {
- padding: 0.8rem;
- gap: 0.5rem;
-
- .homeTime {
- gap: 0.5rem;
- }
-
- .BsnavbarSearchMain {
- width: 30vw;
- min-width: 120px;
- }
-
- .DropDownsCustomer.always-visible {
- .ant-select {
- width: 6rem !important;
- }
-
- > span {
- display: none;
- }
- }
-
- .CustomerActions.desktop-only {
- display: none;
- }
-
- .userDates {
- gap: 0.5rem;
- }
-
- .mobile-toggle-btn {
- display: flex;
- align-items: center;
- justify-content: center;
- }
- }
-
- .ant-tooltip {
- display: none !important;
- }
-}
-
-@media (max-width: 500px) {
- .BSNavbar3Main {
- padding: 0.3rem 0.8rem;
- gap: 0.3rem;
-
- .BsnavbarSearchMain {
- width: 32vw;
- min-width: 120px;
-
- // .searchDiv {
- // width: unset !important;
- // }
- }
-
- .homeIcon {
- font-size: 0.8rem;
- }
-
- .css-1ao51vv-control {
- width: 100px !important;
- }
- }
-}
-.BsNavbar3FullScreen {
- background-color: #f4f4f4;
- height: 30px;
- width: 30px;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: 4px;
- cursor: pointer;
-}
-.BsNavbar3FullScreenExit {
- background-color: #ef4444;
- height: 30px;
- width: 30px;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: 4px;
- color: #fff;
- cursor: pointer;
-}
-
-.MultiSearchIconDiv3 {
- // background-color: #ffffff;
- color: #aaaaaa !important;
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- width: 30px !important;
- height: 30px;
- padding: 4px;
-
- svg {
- font-size: 22px;
- width: 32px !important;
- height: 32px;
-
- display: flex;
- }
-}