Merge pull request 'Optimization Code' (#161) from FridayOptim into main

Reviewed-on: Pozomind/pozo-retail-app#161
This commit is contained in:
karthikalakshmi 2026-02-23 12:21:21 +05:30
commit f717c55f67
46 changed files with 29098 additions and 25396 deletions

796
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -53,6 +53,9 @@ export default function AddProduct({ products, setProducts }) {
return ( return (
<div className="add-product__container"> <div className="add-product__container">
<div className="add-product__header"> <div className="add-product__header">
<div>
Add Product
</div>
<button className="add-product__add-btn" onClick={addRow}>+ Add Row</button> <button className="add-product__add-btn" onClick={addRow}>+ Add Row</button>
</div> </div>

View File

@ -1,9 +1,11 @@
import React from 'react'; import React, { lazy } from 'react';
import { DefaultModal } from './DefaultModal'; import { DefaultModal } from './DefaultModal';
import StockReceived from '../../Pages/StockTransfer/StockReceived';
import Buttons from '../Forms/Buttons'; import Buttons from '../Forms/Buttons';
import { BiPlus } from 'react-icons/bi'; import { BiPlus } from 'react-icons/bi';
import { ArrowRightOutlined } from '@ant-design/icons'; import { ArrowRightOutlined } from '@ant-design/icons';
const StockReceived = lazy(
() => import('../../Pages/StockTransfer/StockReceived.jsx')
);
const ProductDetailsModal = ({ const ProductDetailsModal = ({
open, open,
@ -11,7 +13,7 @@ const ProductDetailsModal = ({
productDetails, productDetails,
headerData, headerData,
onDataChange, onDataChange,
onSubmit onSubmit,
}) => { }) => {
return ( return (
<DefaultModal <DefaultModal
@ -23,17 +25,34 @@ const ProductDetailsModal = ({
> >
<div style={{ overflowX: 'auto' }}> <div style={{ overflowX: 'auto' }}>
{headerData && ( {headerData && (
<div style={{ <div
style={{
display: 'flex', display: 'flex',
gap: '20px', gap: '20px',
marginBottom: '15px', marginBottom: '15px',
padding: '10px', padding: '10px',
backgroundColor: '#f5f5f5', backgroundColor: '#f5f5f5',
borderRadius: '4px' borderRadius: '4px',
}}> }}
<div><strong>Dispatch Id:</strong> <span style={{fontSize:"12px"}}> {headerData.Dispatch_Id} </span> </div> >
<div><strong>Date & Time:</strong> <span style={{fontSize:"12px"}}> {headerData.dateTime} </span></div> <div>
<div><strong>From Branch:</strong> <span style={{fontSize:"12px"}}> {headerData.fromBranch} </span> </div> <strong>Dispatch Id:</strong>{' '}
<span style={{ fontSize: '12px' }}>
{' '}
{headerData.Dispatch_Id}{' '}
</span>{' '}
</div>
<div>
<strong>Date & Time:</strong>{' '}
<span style={{ fontSize: '12px' }}> {headerData.dateTime} </span>
</div>
<div>
<strong>From Branch:</strong>{' '}
<span style={{ fontSize: '12px' }}>
{' '}
{headerData.fromBranch}{' '}
</span>{' '}
</div>
{/* <div><strong>dispatched By</strong> {headerData.Created_By}</div> */} {/* <div><strong>dispatched By</strong> {headerData.Created_By}</div> */}
</div> </div>
)} )}
@ -43,12 +62,14 @@ const ProductDetailsModal = ({
editable={true} editable={true}
/> />
<div style={{ <div
display: "flex", style={{
alignItems: "center", display: 'flex',
paddingTop: "10px", alignItems: 'center',
flexDirection: "row-reverse" paddingTop: '10px',
}}> flexDirection: 'row-reverse',
}}
>
<Buttons <Buttons
buttonText={'SUBMIT'} buttonText={'SUBMIT'}
handleSubmit={onSubmit} handleSubmit={onSubmit}

View File

@ -1,14 +1,14 @@
import React from 'react'; import React from 'react';
import { DefaultModal } from './DefaultModal'; import { DefaultModal } from './DefaultModal';
import { Tables } from '../Tables/Table'; import { Tables } from '../Tables/Table';
import "./ReceivedStockModel.scss" import './ReceivedStockModel.scss';
const ReceivedStocksModal = ({ const ReceivedStocksModal = ({
open, open,
onClose, onClose,
columns, columns,
tableData, tableData,
handlePageChange, handlePageChange,
customTable = false customTable = false,
}) => { }) => {
const renderCell = (column, row, index) => { const renderCell = (column, row, index) => {
if (column.render) { if (column.render) {
@ -28,24 +28,32 @@ const ReceivedStocksModal = ({
className={'receive-stocks-modal'} className={'receive-stocks-modal'}
> >
<> <>
{!customTable && (
{!customTable && <div style={{overflowX:"auto"}}> <div style={{ overflowX: 'auto' }}>
<Tables <Tables
columns={columns} columns={columns}
data={tableData} data={tableData}
dataSource={tableData} dataSource={tableData}
pagination={handlePageChange} pagination={handlePageChange}
/> />
</div>} </div>
{ )}
customTable && {customTable && (
<div className="ReceivedStocksModalMaster"> <div className="ReceivedStocksModalMaster">
<table style={{ width: "100%" }}> <table style={{ width: '100%' }}>
<thead> <thead>
<tr> <tr>
{columns.map((column) => ( {columns.map((column) => (
<th key={column.key} style={{ textAlign: column.align, width: column.width, backgroundColor: '#f0f8ff', fontFamily: "poppins", fontWeight: "450" }}> <th
key={column.key}
style={{
textAlign: column.align,
width: column.width,
backgroundColor: '#f0f8ff',
fontFamily: 'poppins',
fontWeight: '450',
}}
>
{column.title?.toUpperCase()} {column.title?.toUpperCase()}
</th> </th>
))} ))}
@ -53,9 +61,12 @@ const ReceivedStocksModal = ({
</thead> </thead>
<tbody> <tbody>
{tableData.map((row, index) => ( {tableData.map((row, index) => (
<tr key={row.key || index} style={{ fontSize: "13px" }}> <tr key={row.key || index} style={{ fontSize: '13px' }}>
{columns.map((column) => ( {columns.map((column) => (
<td key={column.key} style={{ textAlign: column.align, width: column.width }}> <td
key={column.key}
style={{ textAlign: column.align, width: column.width }}
>
{renderCell(column, row, index)} {renderCell(column, row, index)}
</td> </td>
))} ))}
@ -64,11 +75,8 @@ const ReceivedStocksModal = ({
</tbody> </tbody>
</table> </table>
</div> </div>
} )}
</> </>
</DefaultModal> </DefaultModal>
); );
}; };

View File

@ -149,6 +149,16 @@ export const getConfigType = createAsyncThunk(
} }
} }
); );
export const getConfigTypeBookingType = createAsyncThunk(
'BookingData/getConfigTypeBookingType',
async ({ TypeName }) => {
if (TypeName != null && TypeName != undefined) {
return await axiosRetailInstanceData.get(
`/configMaster?TypeName=${TypeName}`
);
}
}
);
export const PostBookingData = createAsyncThunk( export const PostBookingData = createAsyncThunk(
'BookingData/PostBookingdata', 'BookingData/PostBookingdata',
async (postData) => { async (postData) => {
@ -682,7 +692,6 @@ export const getSelectedFavItems = createAsyncThunk(
if (fromDate) params.append('fromDate', fromDate); if (fromDate) params.append('fromDate', fromDate);
if (toDate) params.append('toDate', toDate); if (toDate) params.append('toDate', toDate);
// let url = `/productCardList?CompId=${data?.CompId}&BranchId=${data?.BranchId}&AppId=${data?.AppId}&Type=A`; // let url = `/productCardList?CompId=${data?.CompId}&BranchId=${data?.BranchId}&AppId=${data?.AppId}&Type=A`;
return await axiosRetailInstanceData.get( return await axiosRetailInstanceData.get(
`/productCardList?${params.toString()}` `/productCardList?${params.toString()}`
); );
@ -858,7 +867,6 @@ export const getCardDataWithoutSubmodule = createAsyncThunk(
? { fromDate: data?.fromDate, toDate: data?.toDate } ? { fromDate: data?.fromDate, toDate: data?.toDate }
: {}), : {}),
}); });
return await axiosRetailInstanceData.get( return await axiosRetailInstanceData.get(
`/productCardList?${params.toString()}` `/productCardList?${params.toString()}`
); );
@ -1609,7 +1617,8 @@ const initialState = {
salesBillEdit: false, salesBillEdit: false,
previousOrderPayment: [], previousOrderPayment: [],
previousOrderOfferDetails: [], previousOrderOfferDetails: [],
getmultipleSearchDatas: [] getmultipleSearchDatas: [],
AllBookingType: [],
}; };
const BookingData = createSlice({ const BookingData = createSlice({
@ -1981,6 +1990,13 @@ const BookingData = createSlice({
state.ItemCard = []; state.ItemCard = [];
} }
}), }),
builder.addCase(getConfigTypeBookingType.fulfilled, (state, action) => {
if (action?.payload?.data?.statusCode === 1) {
state.AllBookingType = action?.payload?.data?.data;
} else {
state.AllBookingType = [];
}
}),
builder.addCase(getLayoutsearch.fulfilled, (state, action) => { builder.addCase(getLayoutsearch.fulfilled, (state, action) => {
if (action?.payload?.data?.statusCode === 1) { if (action?.payload?.data?.statusCode === 1) {
state.ItemCard = action?.payload?.data?.data; state.ItemCard = action?.payload?.data?.data;
@ -2113,7 +2129,10 @@ const BookingData = createSlice({
}); });
builder.addCase(getmultipleSearch.fulfilled, (state, action) => { builder.addCase(getmultipleSearch.fulfilled, (state, action) => {
if (action?.payload?.data?.statusCode === 1) { if (action?.payload?.data?.statusCode === 1) {
state.getmultipleSearchDatas = action?.payload?.data?.data[0]?.SearchTermDtl?.map((e) => e?.SearchTerm) || []; state.getmultipleSearchDatas =
action?.payload?.data?.data[0]?.SearchTermDtl?.map(
(e) => e?.SearchTerm
) || [];
} else { } else {
state.getmultipleSearchDatas = []; state.getmultipleSearchDatas = [];
} }
@ -2220,7 +2239,7 @@ export const {
triggerProductCard, triggerProductCard,
changeBillEditingMode, changeBillEditingMode,
changePreviousOrderPayment, changePreviousOrderPayment,
changePreviousOrderOfferDetail changePreviousOrderOfferDetail,
} = BookingData.actions; } = BookingData.actions;
export const GlobalComboRedirectionToDefaultLayoutForParking = (state) => export const GlobalComboRedirectionToDefaultLayoutForParking = (state) =>
@ -2389,13 +2408,14 @@ export const GlobalAddBookingDetailsTrigger = (state) =>
state?.BookingData?.AddBookingDetailsTrigger; state?.BookingData?.AddBookingDetailsTrigger;
export const GlobalCurrentOrderId = (state) => export const GlobalCurrentOrderId = (state) =>
state?.BookingData?.CurrentOrderId; state?.BookingData?.CurrentOrderId;
export const GlobalSalesBillEdit = (state) => export const GlobalSalesBillEdit = (state) => state?.BookingData?.salesBillEdit;
state?.BookingData?.salesBillEdit;
export const GlobalPreviousOrderPayment = (state) => export const GlobalPreviousOrderPayment = (state) =>
state?.BookingData?.previousOrderPayment; state?.BookingData?.previousOrderPayment;
export const GlobalPreviousOrderOfferDetails = (state) => export const GlobalPreviousOrderOfferDetails = (state) =>
state?.BookingData?.previousOrderOfferDetails; state?.BookingData?.previousOrderOfferDetails;
export const GlobalGetmultipleSearchDatas = (state) => export const GlobalGetmultipleSearchDatas = (state) =>
state?.BookingData?.getmultipleSearchDatas; state?.BookingData?.getmultipleSearchDatas;
export const GlobalAllBookingType = (state) =>
state?.BookingData?.AllBookingType;
export default BookingData.reducer; export default BookingData.reducer;

View File

@ -465,8 +465,8 @@ const WholesaleData = createSlice({
state.WholeSaleEntryList = action?.payload; state.WholeSaleEntryList = action?.payload;
}, },
changeWholeSaleSelectedEntryDtl: (state, action) => { changeWholeSaleSelectedEntryDtl: (state, action) => {
(state.WholeSaleSelectedEntryDtl = action?.payload), ((state.WholeSaleSelectedEntryDtl = action?.payload),
(state.WholeSaleSelectedProdDtl = [action?.payload?.ProdDetails?.[0]]); (state.WholeSaleSelectedProdDtl = [action?.payload?.ProdDetails?.[0]]));
state.WholeSaleSelectedGradeDtl = [ state.WholeSaleSelectedGradeDtl = [
action?.payload?.ProdDetails?.[0].GradeDetails?.[0], action?.payload?.ProdDetails?.[0].GradeDetails?.[0],
]; ];
@ -513,7 +513,7 @@ const WholesaleData = createSlice({
}, },
}, },
extraReducers: (builder) => { extraReducers: (builder) => {
builder.addCase(getWholeSaleSupplier.fulfilled, (state, action) => { (builder.addCase(getWholeSaleSupplier.fulfilled, (state, action) => {
if (action?.payload?.data?.statusCode == 1) { if (action?.payload?.data?.statusCode == 1) {
state.SupplierDetails = action?.payload?.data?.data; state.SupplierDetails = action?.payload?.data?.data;
} else { } else {
@ -636,7 +636,7 @@ const WholesaleData = createSlice({
} else { } else {
state.WSBookingStatus = []; state.WSBookingStatus = [];
} }
}); }));
}, },
}); });
export const { export const {

View File

@ -1,11 +1,8 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect, lazy, Suspense } from 'react';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { Button, Popover } from 'antd'; import { Button, Popover } from 'antd';
import { AiOutlineClose } from 'react-icons/ai'; import { AiOutlineClose } from 'react-icons/ai';
import { IoIosArrowUp } from 'react-icons/io'; import { IoIosArrowUp } from 'react-icons/io';
import BSBillingTable1 from '../BSBillingTable1/BSBillingTable1';
import BST1Payment from '../BSBillingTable1/BST1Payment';
import BSSummery from '../BSBillingTableSummery/BSSummery';
import { import {
GlobalCustId, GlobalCustId,
GlobalSelOption, GlobalSelOption,
@ -14,13 +11,23 @@ import {
GlobalOrderStatus, GlobalOrderStatus,
} from '../../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../../Features/BookingScreen/BookingData/BookingData';
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBTOverall.scss'; import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBTOverall.scss';
import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities';
import BSCustomerSelect from '../../UtillComponents/BSSelectCustomer.jsx';
import PozoAddCustomerIcon from '../../UtillComponents/Pozo retail icons/PozoAddCustomerIcon'; import PozoAddCustomerIcon from '../../UtillComponents/Pozo retail icons/PozoAddCustomerIcon';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import { getTemplateData } from '../../../../../Features/ThemeChange/ThemeChange.js'; import { getTemplateData } from '../../../../../Features/ThemeChange/ThemeChange.js';
import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx'; import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx';
import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip'; import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip';
// jsx File
const BSBillingTable1 = lazy(
() => import('../BSBillingTable1/BSBillingTable1.jsx')
);
const BST1Payment = lazy(() => import('../BSBillingTable1/BST1Payment'));
const BSSummery = lazy(() => import('../BSBillingTableSummery/BSSummery'));
const FeaturesFunctionalities = lazy(
() => import('../../BookingFunctionality/FeaturesFunctionalities')
);
const BSCustomerSelect = lazy(
() => import('../../UtillComponents/BSSelectCustomer.jsx')
);
export default function BSBTOverall1() { export default function BSBTOverall1() {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
@ -121,6 +128,7 @@ export default function BSBTOverall1() {
}, [width]); }, [width]);
return ( return (
<Suspense fallback={<div>Loading</div>}>
<> <>
<div <div
className={ className={
@ -199,14 +207,18 @@ export default function BSBTOverall1() {
> >
<BSCustomerSelect /> <BSCustomerSelect />
<TooltipWrapper title={'Add Customer'} isMobile={isMobile}> <TooltipWrapper
title={'Add Customer'}
isMobile={isMobile}
>
{' '} {' '}
<PozoAddCustomerIcon <PozoAddCustomerIcon
className="BSBillingNav-icon-table-icon" className="BSBillingNav-icon-table-icon"
onClick={handleAddCustomer} onClick={handleAddCustomer}
style={{ style={{
fontSize: '25px', fontSize: '25px',
color: selOption || GetCustId ? '#52c41a' : '#1292EE', color:
selOption || GetCustId ? '#52c41a' : '#1292EE',
cursor: Custdisable ? 'not-allowed' : 'pointer', cursor: Custdisable ? 'not-allowed' : 'pointer',
}} }}
/> />
@ -242,5 +254,6 @@ export default function BSBTOverall1() {
</div> </div>
</div> </div>
</> </>
</Suspense>
); );
} }

View File

@ -6,7 +6,6 @@ import WebFont from 'webfontloader';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import dineInIcon from '../../../../../Images/Dine In.svg'; import dineInIcon from '../../../../../Images/Dine In.svg';
import TakeAwayIcon from '../../../../../Images/Take away.svg'; import TakeAwayIcon from '../../../../../Images/Take away.svg';
import { settingDataSelector } from '../../../../../Features/PreferenceMaster/PreferenceMaster.js';
import BSBillingEditQuantity from '../BSBillingEditQuantity/BSBillingEditQuantity'; import BSBillingEditQuantity from '../BSBillingEditQuantity/BSBillingEditQuantity';
import { import {
ChangeTotalAmount, ChangeTotalAmount,
@ -18,13 +17,10 @@ import {
puttinghold, puttinghold,
} from '../../../../../Features/BookingScreen/HoldOption/HoldOption.js'; } from '../../../../../Features/BookingScreen/HoldOption/HoldOption.js';
import { import {
ChangeOfferAppliedProducts,
ChangeFreeProductList,
ChangeFullFreeProductList, ChangeFullFreeProductList,
GlobalFreeProdList, GlobalFreeProdList,
GlobalOfferAppliedProducts, GlobalOfferAppliedProducts,
changeFullOfferAppliedProducts, changeFullOfferAppliedProducts,
changeLoyaltyConsumedQuantities,
ClearOfferAppliedProducts, ClearOfferAppliedProducts,
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js'; } from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
@ -76,11 +72,17 @@ import {
changePreviousOrderPayment, changePreviousOrderPayment,
changePreviousOrderOfferDetail, changePreviousOrderOfferDetail,
} from '../../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../../Features/BookingScreen/BookingData/BookingData';
import BSEditTotalAmt from '../BSEditTotalAmount/BSEditTotalAmt.jsx';
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx';
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBillingTable1.scss';
import { useUtilsComponent } from '../../../../../Services/utils.js'; import { useUtilsComponent } from '../../../../../Services/utils.js';
import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx'; // Jsx Files
const BSEditTotalAmt = lazy(
() => import('../BSEditTotalAmount/BSEditTotalAmt.jsx')
);
const BSImeiDetails = lazy(() => import('../BSImeiDetails/BSImeiDetails.jsx'));
const CustomerPriceHistory = lazy(
() => import('../../UtillComponents/CustomerPriceHistory.jsx')
); // Scss File
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBillingTable1.scss';
const BSBillingTable1 = () => { const BSBillingTable1 = () => {
const { removeExtraCharge } = useUtilsComponent(); const { removeExtraCharge } = useUtilsComponent();
@ -142,7 +144,8 @@ const BSBillingTable1 = () => {
const GetCustId = useSelector(GlobalCustId); const GetCustId = useSelector(GlobalCustId);
const selectedCustomer = useSelector(GlobalSelOption); const selectedCustomer = useSelector(GlobalSelOption);
const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false); const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] =
useState(false);
const [customerProduct, setCustomerProduct] = useState(null); const [customerProduct, setCustomerProduct] = useState(null);
const tableDataDinein = tableData?.filter( const tableDataDinein = tableData?.filter(
@ -320,7 +323,6 @@ const BSBillingTable1 = () => {
event.preventDefault(); event.preventDefault();
handleShortcut('weightAmount'); handleShortcut('weightAmount');
} }
}; };
window.addEventListener('keydown', handleKeyDown); window.addEventListener('keydown', handleKeyDown);
@ -329,11 +331,6 @@ const BSBillingTable1 = () => {
}; };
}, [preferenceshortcutkey, tableDataTakeAway, tableDataDinein, BillOrderPre]); }, [preferenceshortcutkey, tableDataTakeAway, tableDataDinein, BillOrderPre]);
function safeRound(amountStr) { function safeRound(amountStr) {
if (amountStr == null) return allowDecimal ? '0.00' : '0'; if (amountStr == null) return allowDecimal ? '0.00' : '0';
@ -347,7 +344,7 @@ const BSBillingTable1 = () => {
const handleCustomerProductPriceHistory = (item) => { const handleCustomerProductPriceHistory = (item) => {
setCustomerPriceHistoryOpen(true); setCustomerPriceHistoryOpen(true);
setCustomerProduct(item?.ProdId); setCustomerProduct(item?.ProdId);
} };
const getstockbadge = async () => { const getstockbadge = async () => {
let data = { let data = {
@ -1855,7 +1852,6 @@ const BSBillingTable1 = () => {
insideinwardDtlId: false, insideinwardDtlId: false,
}); });
} else { } else {
let data = isCheckFreeProductOutside?.FreeQty - item?.OrderQty;
//First i Calculate Another Booking Type Qty //First i Calculate Another Booking Type Qty
let anotherBookingType = tableData?.find( let anotherBookingType = tableData?.find(
(e) => (e) =>
@ -1870,21 +1866,6 @@ const BSBillingTable1 = () => {
e?.BookingTypeName != item?.BookingTypeName 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 ( if (
(anotherBookingType?.OrderQty || 0) < (anotherBookingType?.OrderQty || 0) <
anotherBookingTypeOffer?.OrderQty anotherBookingTypeOffer?.OrderQty
@ -2042,145 +2023,7 @@ const BSBillingTable1 = () => {
} }
} }
} }
}; };
// const removeFromCart = async (item) => {
// setPreviousdataLength(tableData?.length);
// if (item?.BookingTypeName !== 'Dine In' && OrderType !== 'Hold') {
// const UpdatedData = tableData?.filter(
// (cartItem) =>
// !(
// cartItem?.ProdId === item?.ProdId &&
// cartItem?.InwardDtlId === item?.InwardDtlId &&
// cartItem?.OrderRate === item?.OrderRate &&
// cartItem?.BookingTypeName === item?.BookingTypeName &&
// !cartItem?.SalesId
// )
// );
// if (OfferCheckedInSetup && preferenceOffer) {
// await applyOffer(UpdatedData);
// } else {
// dispatch(changeOrderCardDetails(UpdatedData));
// }
// await dispatch(
// ChangeTotalAmount(
// GlobalExtraCharge?.filter((extra) => {
// if (BookingType === 'Dine In') {
// // Remove extra charges linked to the removed product
// return !(extra.ProdId === item?.ProdId && !extra.SalesId);
// } else if (BookingType === 'TakeAway') {
// // Remove extra charges only if SalesId is not present
// return extra.ProdId !== item?.ProdId;
// }
// return true; // Keep everything else
// })
// )
// );
// // if the quantity of the item is 1, remove the item from the cart
// if (tableData?.length <= 1) {
// await dispatch(changeReorderHoldDetails({}));
// await dispatch(changeReorderProductDetails([]));
// await dispatch(changeUnpaidData(false));
// await dispatch(changeBookingType('TakeAway'));
// await dispatch(changeTokenOnly(false));
// await dispatch(changeAllProductTokenAvailable(false));
// await dispatch(ChangeOverAllDiscSales(null));
// await dispatch(ChangeOverAllDiscEstimate(null));
// await dispatch(changeSelProdWiseEst([]));
// await dispatch(ChangeTotalAmount([]));
// }
// } else if (item?.BookingTypeName !== 'Dine In' && OrderType === 'Hold') {
// const UpdatedData = tableData?.filter(
// (cartItem) =>
// !(
// cartItem?.ProdId === item?.ProdId &&
// cartItem?.InwardDtlId === item?.InwardDtlId &&
// cartItem?.OrderRate === item?.OrderRate &&
// cartItem?.BookingTypeName === item?.BookingTypeName
// )
// );
// if (OfferCheckedInSetup && preferenceOffer) {
// await applyOffer(UpdatedData);
// } else {
// dispatch(changeOrderCardDetails(UpdatedData));
// }
// await dispatch(ChangeTotalAmount([]));
// await dispatch(
// ChangeTotalAmount(
// GlobalExtraCharge?.filter((extra) => {
// if (BookingType === 'Dine In') {
// // Remove extra charges linked to the removed product
// return !(extra.ProdId === item?.ProdId && !extra.SalesId);
// } else if (BookingType === 'TakeAway') {
// // Remove extra charges only if SalesId is not present
// return extra.ProdId !== item?.ProdId;
// }
// return true; // Keep everything else
// })
// )
// );
// // if the quantity of the item is 1, remove the item from the cart
// if (tableData?.length <= 1) {
// await dispatch(changeReorderHoldDetails({}));
// await dispatch(changeReorderProductDetails([]));
// await dispatch(changeUnpaidData(false));
// await dispatch(changeBookingType('TakeAway'));
// await dispatch(changeTokenOnly(false));
// await dispatch(changeAllProductTokenAvailable(false));
// await dispatch(ChangeOverAllDiscSales(null));
// await dispatch(ChangeOverAllDiscEstimate(null));
// await dispatch(changeSelProdWiseEst([]));
// await dispatch(ChangeTotalAmount([]));
// }
// } else if (item?.BookingTypeName === 'Dine In') {
// const UpdatedData = tableData?.filter(
// (cartItem) =>
// !(
// cartItem?.ProdId === item?.ProdId &&
// cartItem?.InwardDtlId === item?.InwardDtlId &&
// cartItem?.OrderRate === item?.OrderRate &&
// cartItem?.BookingTypeName === item?.BookingTypeName &&
// !cartItem?.SalesId
// )
// );
// if (OfferCheckedInSetup && preferenceOffer) {
// await applyOffer(UpdatedData);
// } else {
// dispatch(changeOrderCardDetails(UpdatedData));
// }
// await dispatch(
// ChangeTotalAmount(
// GlobalExtraCharge?.filter((extra) => {
// if (BookingType === 'Dine In') {
// // Remove extra charges linked to the removed product
// return !(extra.ProdId === item?.ProdId && !extra.SalesId);
// } else if (BookingType === 'TakeAway') {
// // Remove extra charges only if SalesId is not present
// return extra.ProdId !== item?.ProdId;
// }
// return true; // Keep everything else
// })
// )
// ); // if the quantity of the item is 1, remove the item from the cart
// if (tableData?.length <= 1) {
// await dispatch(changeReorderHoldDetails({}));
// await dispatch(changeReorderProductDetails([]));
// await dispatch(changeUnpaidData(false));
// await dispatch(ChangeSelectedCustDisable(false));
// await dispatch(changeSelectedOption(false));
// await dispatch(changeBookingType('TakeAway'));
// await dispatch(changeTokenOnly(false));
// await dispatch(changeAllProductTokenAvailable(false));
// await dispatch(ChangeOverAllDiscSales(null));
// await dispatch(ChangeOverAllDiscEstimate(null));
// await dispatch(changeSelProdWiseEst([]));
// await dispatch(ChangeTotalAmount([]));
// }
// }
// };
const OpenEditTotalAmount = () => { const OpenEditTotalAmount = () => {
setOpenEditTotalAmt(true); setOpenEditTotalAmt(true);
@ -2190,6 +2033,7 @@ const BSBillingTable1 = () => {
}; };
return ( return (
<Suspense fallback={<div>Loading</div>}>
<> <>
<div className="BillingTable1-Structure" style={{ overflow: 'auto' }}> <div className="BillingTable1-Structure" style={{ overflow: 'auto' }}>
<div className="BillingTable1-table-div"> <div className="BillingTable1-table-div">
@ -2223,6 +2067,7 @@ const BSBillingTable1 = () => {
)} )}
{item.OptionName == 'Sl.No' && ( {item.OptionName == 'Sl.No' && (
<th <th
className="BillingTable1-table-th"
style={{ style={{
fontFamily: SelectedFont, fontFamily: SelectedFont,
fontWeight: '600', fontWeight: '600',
@ -2413,7 +2258,8 @@ const BSBillingTable1 = () => {
{OldtableDataTakeAway?.map((item, index) => ( {OldtableDataTakeAway?.map((item, index) => (
<tr <tr
key={index} key={index}
className={`${item?.SalesId && OrderType !== 'Hold' className={`${
item?.SalesId && OrderType !== 'Hold'
? 'Billing-Table1-row-disabled' ? 'Billing-Table1-row-disabled'
: 'Billing-Table1-row' : 'Billing-Table1-row'
} }
@ -2429,7 +2275,8 @@ const BSBillingTable1 = () => {
: triggerAnimation && : triggerAnimation &&
index === 0 && index === 0 &&
!item?.SalesId && !item?.SalesId &&
tableDataTakeAway?.length >= PreviousdataLength tableDataTakeAway?.length >=
PreviousdataLength
? 'wheat' ? 'wheat'
: triggerAnimation && : triggerAnimation &&
index === 0 && index === 0 &&
@ -2445,13 +2292,17 @@ const BSBillingTable1 = () => {
? 'rgb(243, 248, 213)' ? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' && : GlobEstBooking === 'ParEst' &&
GlobProdwisedata?.includes( GlobProdwisedata?.includes(
item?.InwardDtlId + ' ' + item?.BookingTypeName item?.InwardDtlId +
' ' +
item?.BookingTypeName
) )
? '#b2d1f7' ? '#b2d1f7'
: index % 2 === 0 : index % 2 === 0
? 'white' ? 'white'
: SelectedBillColor?.['OverallBackgroundColor'] : SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor'] ? SelectedBillColor?.[
'OverallBackgroundColor'
]
: '#d6d6d6', : '#d6d6d6',
animation: animation:
BillOrderPre === 'Y' && !BookingTypeBoth BillOrderPre === 'Y' && !BookingTypeBoth
@ -2472,7 +2323,7 @@ const BSBillingTable1 = () => {
index == 0 && index == 0 &&
tableitem.OptionName == 'Sl.No' && ( tableitem.OptionName == 'Sl.No' && (
<td <td
rowspan={tableData.length} rowSpan={tableData.length}
style={{ backgroundColor: '#CFB59D' }} style={{ backgroundColor: '#CFB59D' }}
> >
<img width="30px" alt="" src={TakeAwayIcon} /> <img width="30px" alt="" src={TakeAwayIcon} />
@ -2498,7 +2349,10 @@ const BSBillingTable1 = () => {
{tableitem.OptionName == 'Item' && ( {tableitem.OptionName == 'Item' && (
<td <td
className="BillingTable1-table-td for-combo" className="BillingTable1-table-td for-combo"
style={{ fontFamily: 'Poppins', textAlign: 'left' }} style={{
fontFamily: 'Poppins',
textAlign: 'left',
}}
onClick={() => onClick={() =>
item.FullProductIdentifierDtls?.length > 0 || item.FullProductIdentifierDtls?.length > 0 ||
item.ProductIdentifierDtls?.length > 0 item.ProductIdentifierDtls?.length > 0
@ -2543,7 +2397,8 @@ const BSBillingTable1 = () => {
> >
{item.ProdDetail?.map((prod, index) => ( {item.ProdDetail?.map((prod, index) => (
<p key={index}> <p key={index}>
{prod.ProdName} - {prod.Size} {prod.UomName} {prod.ProdName} - {prod.Size}{' '}
{prod.UomName}
</p> </p>
))} ))}
</div> </div>
@ -2699,7 +2554,8 @@ const BSBillingTable1 = () => {
{OldtableDataDinein?.map((item, index) => ( {OldtableDataDinein?.map((item, index) => (
<tr <tr
key={OldtableDataTakeAway?.length + index} key={OldtableDataTakeAway?.length + index}
className={`${item?.SalesId className={`${
item?.SalesId
? 'Billing-Table1-row-disabled' ? 'Billing-Table1-row-disabled'
: 'Billing-Table1-row' : 'Billing-Table1-row'
} }
@ -2720,7 +2576,8 @@ const BSBillingTable1 = () => {
? 'wheat' ? 'wheat'
: BookingType !== 'Dine In' && : BookingType !== 'Dine In' &&
triggerAnimation && triggerAnimation &&
OldtableDataTakeAway?.length + index === 0 && OldtableDataTakeAway?.length + index ===
0 &&
tableDataDinein?.length >= tableDataDinein?.length >=
PreviousdataLength && PreviousdataLength &&
!HoldOrderDtl && !HoldOrderDtl &&
@ -2759,7 +2616,7 @@ const BSBillingTable1 = () => {
index == 0 && index == 0 &&
tableitem.OptionName == 'Sl.No' && ( tableitem.OptionName == 'Sl.No' && (
<td <td
rowspan={tableData.length} rowSpan={tableData.length}
style={{ backgroundColor: '#A2C3CD' }} style={{ backgroundColor: '#A2C3CD' }}
> >
<img width="30px" alt="" src={dineInIcon} /> <img width="30px" alt="" src={dineInIcon} />
@ -2785,7 +2642,10 @@ const BSBillingTable1 = () => {
{tableitem.OptionName == 'Item' && ( {tableitem.OptionName == 'Item' && (
<td <td
className="BillingTable1-table-td for-combo" className="BillingTable1-table-td for-combo"
style={{ fontFamily: 'Poppins', textAlign: 'left' }} style={{
fontFamily: 'Poppins',
textAlign: 'left',
}}
onClick={() => { onClick={() => {
if (editField) { if (editField) {
handleEditQuantity(item); handleEditQuantity(item);
@ -2829,7 +2689,8 @@ const BSBillingTable1 = () => {
> >
{item.ProdDetail?.map((prod, index) => ( {item.ProdDetail?.map((prod, index) => (
<p key={index}> <p key={index}>
{prod.ProdName} - {prod.Size} {prod.UomName} {prod.ProdName} - {prod.Size}{' '}
{prod.UomName}
</p> </p>
))} ))}
</div> </div>
@ -2990,7 +2851,8 @@ const BSBillingTable1 = () => {
OldtableDataTakeAway?.length + OldtableDataTakeAway?.length +
index index
} }
className={`${BookingType === 'Dine In' && item?.SalesId className={`${
BookingType === 'Dine In' && item?.SalesId
? 'Billing-Table1-row-disabled' ? 'Billing-Table1-row-disabled'
: 'Billing-Table1-row' : 'Billing-Table1-row'
} }
@ -3010,7 +2872,8 @@ const BSBillingTable1 = () => {
index === index ===
0 && 0 &&
!item?.SalesId && !item?.SalesId &&
tableDataTakeAway?.length >= PreviousdataLength tableDataTakeAway?.length >=
PreviousdataLength
? 'wheat' ? 'wheat'
: BookingType !== 'Dine In' && : BookingType !== 'Dine In' &&
triggerAnimation && triggerAnimation &&
@ -3050,7 +2913,9 @@ const BSBillingTable1 = () => {
? 'rgb(243, 248, 213)' ? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' && : GlobEstBooking === 'ParEst' &&
GlobProdwisedata?.includes( GlobProdwisedata?.includes(
item?.InwardDtlId + ' ' + item?.BookingTypeName item?.InwardDtlId +
' ' +
item?.BookingTypeName
) )
? '#b2d1f7' ? '#b2d1f7'
: (OldtableDataDinein?.length + : (OldtableDataDinein?.length +
@ -3060,7 +2925,9 @@ const BSBillingTable1 = () => {
0 0
? 'white' ? 'white'
: SelectedBillColor?.['OverallBackgroundColor'] : SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor'] ? SelectedBillColor?.[
'OverallBackgroundColor'
]
: '#d6d6d6', : '#d6d6d6',
animation: animation:
BillOrderPre === 'Y' && !BookingTypeBoth BillOrderPre === 'Y' && !BookingTypeBoth
@ -3084,7 +2951,7 @@ const BSBillingTable1 = () => {
index == 0 && index == 0 &&
tableitem.OptionName == 'Sl.No' && ( tableitem.OptionName == 'Sl.No' && (
<td <td
rowspan={tableData.length} rowSpan={tableData.length}
style={{ backgroundColor: '#CFB59D' }} style={{ backgroundColor: '#CFB59D' }}
> >
<img width="30px" alt="" src={TakeAwayIcon} /> <img width="30px" alt="" src={TakeAwayIcon} />
@ -3113,7 +2980,10 @@ const BSBillingTable1 = () => {
{tableitem.OptionName == 'Item' && ( {tableitem.OptionName == 'Item' && (
<td <td
className="BillingTable1-table-td for-combo" className="BillingTable1-table-td for-combo"
style={{ fontFamily: 'Poppins', textAlign: 'left' }} style={{
fontFamily: 'Poppins',
textAlign: 'left',
}}
onClick={() => onClick={() =>
item.FullProductIdentifierDtls?.length > 0 || item.FullProductIdentifierDtls?.length > 0 ||
item.ProductIdentifierDtls?.length > 0 item.ProductIdentifierDtls?.length > 0
@ -3164,7 +3034,8 @@ const BSBillingTable1 = () => {
> >
{item.ProdDetail?.map((prod, index) => ( {item.ProdDetail?.map((prod, index) => (
<p key={index}> <p key={index}>
{prod.ProdName} - {prod.Size} {prod.UomName} {prod.ProdName} - {prod.Size}{' '}
{prod.UomName}
</p> </p>
))} ))}
</div> </div>
@ -3326,7 +3197,8 @@ const BSBillingTable1 = () => {
tableDataTakeAway?.length + tableDataTakeAway?.length +
index index
} }
className={`${BookingType === 'Dine In' && item?.SalesId className={`${
BookingType === 'Dine In' && item?.SalesId
? 'Billing-Table1-row-disabled' ? 'Billing-Table1-row-disabled'
: 'Billing-Table1-row' : 'Billing-Table1-row'
} }
@ -3372,7 +3244,9 @@ const BSBillingTable1 = () => {
? 'rgb(243, 248, 213)' ? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' && : GlobEstBooking === 'ParEst' &&
GlobProdwisedata?.includes( GlobProdwisedata?.includes(
item?.InwardDtlId + ' ' + item?.BookingTypeName item?.InwardDtlId +
' ' +
item?.BookingTypeName
) )
? '#b2d1f7' ? '#b2d1f7'
: (OldtableDataTakeAway?.length + : (OldtableDataTakeAway?.length +
@ -3383,7 +3257,9 @@ const BSBillingTable1 = () => {
0 0
? 'white' ? 'white'
: SelectedBillColor?.['OverallBackgroundColor'] : SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor'] ? SelectedBillColor?.[
'OverallBackgroundColor'
]
: '#d6d6d6', : '#d6d6d6',
animation: animation:
BillOrderPre === 'Y' && !BookingTypeBoth BillOrderPre === 'Y' && !BookingTypeBoth
@ -3408,7 +3284,7 @@ const BSBillingTable1 = () => {
index == 0 && index == 0 &&
tableitem.OptionName == 'Sl.No' && ( tableitem.OptionName == 'Sl.No' && (
<td <td
rowspan={tableData.length} rowSpan={tableData.length}
style={{ backgroundColor: '#A2C3CD' }} style={{ backgroundColor: '#A2C3CD' }}
> >
<img width="30px" alt="" src={dineInIcon} /> <img width="30px" alt="" src={dineInIcon} />
@ -3438,7 +3314,10 @@ const BSBillingTable1 = () => {
{tableitem.OptionName == 'Item' && ( {tableitem.OptionName == 'Item' && (
<td <td
className="BillingTable1-table-td for-combo" className="BillingTable1-table-td for-combo"
style={{ fontFamily: 'Poppins', textAlign: 'left' }} style={{
fontFamily: 'Poppins',
textAlign: 'left',
}}
onClick={() => { onClick={() => {
if (editField) { if (editField) {
handleEditQuantity(item); handleEditQuantity(item);
@ -3482,7 +3361,8 @@ const BSBillingTable1 = () => {
> >
{item.ProdDetail?.map((prod, index) => ( {item.ProdDetail?.map((prod, index) => (
<p key={index}> <p key={index}>
{prod.ProdName} - {prod.Size} {prod.UomName} {prod.ProdName} - {prod.Size}{' '}
{prod.UomName}
</p> </p>
))} ))}
</div> </div>
@ -3648,7 +3528,7 @@ const BSBillingTable1 = () => {
ProductDetail={Modaldata} ProductDetail={Modaldata}
/> />
)} )}
{(customerPriceHistoryOpen && GetCustId) && {customerPriceHistoryOpen && GetCustId && (
<CustomerPriceHistory <CustomerPriceHistory
open={customerPriceHistoryOpen} open={customerPriceHistoryOpen}
custId={GetCustId} custId={GetCustId}
@ -3657,10 +3537,11 @@ const BSBillingTable1 = () => {
setCustomerProduct={setCustomerProduct} setCustomerProduct={setCustomerProduct}
selectedCustomer={selectedCustomer} selectedCustomer={selectedCustomer}
/> />
} )}
</div> </div>
</div> </div>
</> </>
</Suspense>
); );
}; };

View File

@ -2,10 +2,9 @@ import React, { useCallback, useEffect, useState, useRef } from 'react';
import { shallowEqual, useDispatch, useSelector } from 'react-redux'; import { shallowEqual, useDispatch, useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import moment from 'moment'; import moment from 'moment';
import { Badge, Popover, Modal, Tooltip } from 'antd'; import { Badge, Modal, Tooltip } from 'antd';
import { Tables } from '../../../../../Components/Tables/Table'; import { Tables } from '../../../../../Components/Tables/Table';
import { DefaultModal } from '../../../../../Components/Modal/DefaultModal.jsx'; import { DefaultModal } from '../../../../../Components/Modal/DefaultModal.jsx';
import { UpOutlined } from '@ant-design/icons';
import paygate from '../../../../../Images/paygate.png'; import paygate from '../../../../../Images/paygate.png';
import defaultupi from '../../../../../Images/defaultupi.png'; import defaultupi from '../../../../../Images/defaultupi.png';
import paydevice from '../../../../../Images/paydevice.png'; import paydevice from '../../../../../Images/paydevice.png';
@ -42,8 +41,6 @@ import {
changeReorderHoldDetails, changeReorderHoldDetails,
ChangeNavHoldData, ChangeNavHoldData,
GlobalNavHoldData, GlobalNavHoldData,
changeSummeryQty,
changeSummeryTotalItems,
changeSummeryTotalAmount, changeSummeryTotalAmount,
changeSummeryTotalTaxAmount, changeSummeryTotalTaxAmount,
changeSummeryTotalWithoutTaxAmount, changeSummeryTotalWithoutTaxAmount,
@ -126,6 +123,7 @@ import {
changeBillEditingMode, changeBillEditingMode,
changePreviousOrderPayment, changePreviousOrderPayment,
changePreviousOrderOfferDetail, changePreviousOrderOfferDetail,
GlobalAllBookingType,
} from '../../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../../Features/BookingScreen/BookingData/BookingData';
import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities'; import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities';
import { import {
@ -158,7 +156,6 @@ import BsBillingCreditCustomer from '../../BookingFunctionality/BSBillingCreditC
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import MobilePrint from '../../BookingFunctionality/MobilePrint.jsx'; import MobilePrint from '../../BookingFunctionality/MobilePrint.jsx';
import OtherServiceMobilePrint from '../../BookingFunctionality/OtherServiceMobilePrint.jsx'; import OtherServiceMobilePrint from '../../BookingFunctionality/OtherServiceMobilePrint.jsx';
import { settingDataSelector } from '../../../../../Features/PreferenceMaster/PreferenceMaster.js';
import CountUp from 'react-countup'; import CountUp from 'react-countup';
import { GlobalpreOrderOpen } from '../../../../../Features/BookingScreen/PreOrder/PreOrder.js'; import { GlobalpreOrderOpen } from '../../../../../Features/BookingScreen/PreOrder/PreOrder.js';
import SplitPayment from '../../BookingFunctionality/SplitPayment.jsx'; import SplitPayment from '../../BookingFunctionality/SplitPayment.jsx';
@ -197,7 +194,6 @@ import BSOtherServiceClaim from '../../UtillComponents/BSOtherServiceClaim.jsx';
import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js'; import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js';
import { TfiClipboard } from 'react-icons/tfi'; import { TfiClipboard } from 'react-icons/tfi';
import OtherServicePrintStyle1 from '../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx'; import OtherServicePrintStyle1 from '../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx';
import { MobilePdfPrint } from '../../BookingFunctionality/MobilePdfPrint.js';
import { PublicQrCodepost } from '../../../../../Features/ConfigMasterPage/ConfigMasterPage.js'; import { PublicQrCodepost } from '../../../../../Features/ConfigMasterPage/ConfigMasterPage.js';
import { import {
ChangeFullFreeProductList, ChangeFullFreeProductList,
@ -218,7 +214,6 @@ import CustomerOrders from '../../BookingFunctionality/CustomerOrders.jsx';
const subDirectory = import.meta.env.ENV_BASE_URL; const subDirectory = import.meta.env.ENV_BASE_URL;
const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL; const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss'); const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
const RetailApiurl = import.meta.env.ENV_API_URL;
export default function BST1Payment() { export default function BST1Payment() {
const isF4Pressed = useRef(false); const isF4Pressed = useRef(false);
@ -246,7 +241,9 @@ export default function BST1Payment() {
const navigate = useNavigate(); const navigate = useNavigate();
const salesBillEdit = useSelector(GlobalSalesBillEdit); const salesBillEdit = useSelector(GlobalSalesBillEdit);
const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); const previousOrderOfferDetails = useSelector(
GlobalPreviousOrderOfferDetails
);
const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
const Discount = useSelector(GlobalOverAllOfferAmt); const Discount = useSelector(GlobalOverAllOfferAmt);
const defaultBookingType = useSelector(GlobalDefaultBookingType); const defaultBookingType = useSelector(GlobalDefaultBookingType);
@ -281,7 +278,6 @@ export default function BST1Payment() {
const GlobEstBooking = useSelector(GlobalEstimateBooking); const GlobEstBooking = useSelector(GlobalEstimateBooking);
const GlobProdwisedata = useSelector(GlobalSelProdWiseEst); const GlobProdwisedata = useSelector(GlobalSelProdWiseEst);
const preOrder = useSelector(GlobalpreOrderOpen); const preOrder = useSelector(GlobalpreOrderOpen);
const OrderOfferDetail = useSelector(Global_OrderOfferDetail, shallowEqual);
const prodCat = useSelector(GlobalProductCategorie); const prodCat = useSelector(GlobalProductCategorie);
const ProdSubCat = useSelector(GlobalProductSubCategorie); const ProdSubCat = useSelector(GlobalProductSubCategorie);
const templateData = useSelector(getTemplateData); const templateData = useSelector(getTemplateData);
@ -292,6 +288,7 @@ export default function BST1Payment() {
const SettingDataSelector = useSelector(PreferenceData); const SettingDataSelector = useSelector(PreferenceData);
const unpaidFlow = useSelector(Globalunpaidflow); const unpaidFlow = useSelector(Globalunpaidflow);
const appPreferences = useSelector(ApplicationPreferences); const appPreferences = useSelector(ApplicationPreferences);
const AllBookingType = useSelector(GlobalAllBookingType);
const bookingTypePreference = appPreferences?.find( const bookingTypePreference = appPreferences?.find(
(preference) => preference?.PreferredCatName === 'Booking Type' (preference) => preference?.PreferredCatName === 'Booking Type'
)?.PreferenceCatDetails; )?.PreferenceCatDetails;
@ -321,8 +318,6 @@ export default function BST1Payment() {
const AppId = SessionData?.AppId; const AppId = SessionData?.AppId;
const UserId = SessionData?.UserId; const UserId = SessionData?.UserId;
const UserType = SessionData?.UserType; const UserType = SessionData?.UserType;
const AuthToken = SessionData?.AuthToken;
const SessionMobileNo = SessionData?.SessionMobileNo;
// for customised invoice number // for customised invoice number
const { invoiceDate, clearInvoiceDate } = useDateStore(); const { invoiceDate, clearInvoiceDate } = useDateStore();
const CurrentOrderId = useSelector(GlobalCurrentOrderId); const CurrentOrderId = useSelector(GlobalCurrentOrderId);
@ -341,7 +336,7 @@ export default function BST1Payment() {
const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); const [refundPaySelectedName, setRefundPaySelectedName] = useState(null);
const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0);
const [previousNetAmount, setPreviousNetAmount] = useState(0); const [previousNetAmount, setPreviousNetAmount] = useState(0);
console.log(currentOrderNetAmount, 'currentOrderNetAmount', previousNetAmount, salesBillEdit);
const [addcustomer, setAddCustomer] = useState(false); const [addcustomer, setAddCustomer] = useState(false);
const [PrintOrderDetails, setPrintOrderDetails] = useState([]); const [PrintOrderDetails, setPrintOrderDetails] = useState([]);
//Total calculation //Total calculation
@ -365,7 +360,7 @@ export default function BST1Payment() {
(item) => item.SettingIdName == 'Estimation' (item) => item.SettingIdName == 'Estimation'
); );
const BookingTypeBoth = useSelector(GlobalBookingTypeBoth); const BookingTypeBoth = useSelector(GlobalBookingTypeBoth);
const [ConfigDataList, setConfigDataList] = useState([]); const [ConfigDataList, setConfigDataList] = useState(AllBookingType);
const [OrderStatus, setOrderStatus] = useState(true); const [OrderStatus, setOrderStatus] = useState(true);
const CheckOrderType = OrderCardDetail?.filter( const CheckOrderType = OrderCardDetail?.filter(
(a) => a?.BookingTypeName !== BookingType (a) => a?.BookingTypeName !== BookingType
@ -562,14 +557,21 @@ export default function BST1Payment() {
const filteredPayments = const filteredPayments =
previousOrderPayment?.filter( previousOrderPayment?.filter(
p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment (p) =>
p?.LastOrderTran === 'Y' &&
p?.AfterAdjustment != null &&
p?.AfterAdjustment !== '' &&
p?.AfterAdjustment
) || []; ) || [];
const paymentsToUse = const paymentsToUse =
filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; filteredPayments.length > 0
? filteredPayments
: previousOrderPayment || [];
const totalPreviouspayment = paymentsToUse?.reduce( const totalPreviouspayment = paymentsToUse?.reduce(
(acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), (acc, payment) =>
acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
0 0
); );
@ -578,8 +580,7 @@ export default function BST1Payment() {
0 0
); );
const previousNetAmount = const previousNetAmount = totalPreviouspayment || 0;
(totalPreviouspayment) || 0;
// let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0)); // let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0));
let withdiscTotal = let withdiscTotal =
@ -592,13 +593,26 @@ export default function BST1Payment() {
withdiscTotal >= 0 withdiscTotal >= 0
? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2)
: (Number(Total) + Number(globalTipAmount)).toFixed(2) : (Number(Total) + Number(globalTipAmount)).toFixed(2)
) );
setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); setTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
);
setCurrentOrderNetAmount(currentOrderNetAmount); setCurrentOrderNetAmount(currentOrderNetAmount);
setPreviousNetAmount(previousNetAmount); setPreviousNetAmount(previousNetAmount);
dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(
changeSummeryTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
)
);
dispatch(changeSummeryComboOfferAmount(withComboSum)); dispatch(changeSummeryComboOfferAmount(withComboSum));
@ -628,14 +642,17 @@ export default function BST1Payment() {
UserId: UserId, UserId: UserId,
}; };
dispatch(getPrinterMappingDetails(data)).unwrap(); dispatch(getPrinterMappingDetails(data)).unwrap();
const Data1 = { AppId, CompId, BranchId }; // const Data1 = { AppId, CompId, BranchId };
dispatch(getPrintSelectionComponentData(Data1)).unwrap(); // alert("hih")
// dispatch(getPrintSelectionComponentData(Data1)).unwrap();
}, []); }, []);
//mohan stoped data //mohan stoped data
useEffect(() => { useEffect(() => {
if (CompId && BranchId && AppId) { if (CompId && BranchId && AppId) {
if (holdCheckedSalesSetup) {
getHolddata(); getHolddata();
getUnpaiddatas(); }
// getUnpaiddatas();
getCustomerData(); getCustomerData();
} }
}, [CompId, BranchId, AppId]); }, [CompId, BranchId, AppId]);
@ -668,7 +685,6 @@ export default function BST1Payment() {
}, [salesBillEdit]); }, [salesBillEdit]);
useEffect(() => { useEffect(() => {
if (salesBillEdit) { if (salesBillEdit) {
if (SelCustId) { if (SelCustId) {
setRefundPayBtns(AllPaymentOptions); setRefundPayBtns(AllPaymentOptions);
@ -683,8 +699,7 @@ export default function BST1Payment() {
setRefundPayBtns(withoutCustomer); setRefundPayBtns(withoutCustomer);
} }
} }
}, [AllPaymentOptions, SelCustId, salesBillEdit]);
}, [AllPaymentOptions, SelCustId, salesBillEdit])
useEffect(() => { useEffect(() => {
let hasAccess = false; let hasAccess = false;
@ -712,9 +727,6 @@ export default function BST1Payment() {
setEmpData(datas?.[0]); setEmpData(datas?.[0]);
}; };
const getCustomerData = async () => { const getCustomerData = async () => {
await dispatch(
getAllCustomer({ CompId: CompId, AppId: AppId, branchId: BranchId })
);
await dispatch( await dispatch(
getAddCustomerDetails({ getAddCustomerDetails({
CompId: CompId, CompId: CompId,
@ -1246,8 +1258,9 @@ export default function BST1Payment() {
await Promise.all( await Promise.all(
PrintOrderDetails?.[0]?.OrderDetails?.map( PrintOrderDetails?.[0]?.OrderDetails?.map(
async (orderDetail, index) => { async (orderDetail, index) => {
const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( const groupedTokens = orderDetail?.productDetails
(acc, item, idx) => { ?.filter((data) => data?.EditTokenAvailable !== 'N')
?.reduce((acc, item, idx) => {
if (item.TokenAvailable === 'Y') { if (item.TokenAvailable === 'Y') {
if (!item.CounterName) { if (!item.CounterName) {
// If CounterName is null or empty // If CounterName is null or empty
@ -1260,9 +1273,7 @@ export default function BST1Payment() {
} }
} }
return acc; return acc;
}, }, {});
{}
);
// Iterate over grouped tokens and print them // Iterate over grouped tokens and print them
const tokensToPrint = Object.entries(groupedTokens).map( const tokensToPrint = Object.entries(groupedTokens).map(
@ -1327,7 +1338,11 @@ export default function BST1Payment() {
const handleButtonClick = () => { const handleButtonClick = () => {
if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) {
UpiPayment(); UpiPayment();
} else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { } else if (
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
!refundPaySelected
) {
setMessageType('warning'); setMessageType('warning');
setMessageData('Please Select Refund Payment Method'); setMessageData('Please Select Refund Payment Method');
return; return;
@ -1523,9 +1538,9 @@ export default function BST1Payment() {
setPaybtnselected(PaymentOptionsModeId); setPaybtnselected(PaymentOptionsModeId);
}, [PaymentOptions]); }, [PaymentOptions]);
useEffect(() => { // useEffect(() => {
getBookingTypeId(); // getBookingTypeId();
}, [BookingType]); // }, [BookingType]);
const getHolddata = async () => { const getHolddata = async () => {
const data = { CompId: CompId, BranchId: BranchId, AppId: AppId }; const data = { CompId: CompId, BranchId: BranchId, AppId: AppId };
@ -1607,7 +1622,7 @@ export default function BST1Payment() {
const handleRefundPaymentMode = (id, name) => { const handleRefundPaymentMode = (id, name) => {
setRefundPaySelected(id); setRefundPaySelected(id);
setRefundPaySelectedName(name); setRefundPaySelectedName(name);
} };
const addUpiOption = async (id, name, UPIId) => { const addUpiOption = async (id, name, UPIId) => {
await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDprint(UPIId));
@ -1831,7 +1846,9 @@ export default function BST1Payment() {
setUpinotSelected(false); setUpinotSelected(false);
setCurrentOrderNetAmount(0); setCurrentOrderNetAmount(0);
setPreviousNetAmount(0); setPreviousNetAmount(0);
if (holdCheckedSalesSetup) {
getHolddata(); getHolddata();
}
if (defaultBookingType === 'Both') { if (defaultBookingType === 'Both') {
await dispatch(changeBookingType('TakeAway')); await dispatch(changeBookingType('TakeAway'));
} }
@ -2131,8 +2148,10 @@ export default function BST1Payment() {
SalesPaymentType: 'normal', SalesPaymentType: 'normal',
PaymentDetail: [ PaymentDetail: [
{ {
PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : PaymentType:
Paybtnnameselected?.toLowerCase() === 'upi' salesBillEdit && currentOrderNetAmount < previousNetAmount
? refundPaySelected
: Paybtnnameselected?.toLowerCase() === 'upi'
? SelectedUPIPayOption?.toLowerCase() === 'pd' ? SelectedUPIPayOption?.toLowerCase() === 'pd'
? PaymentDeviceUPI?.[0]?.ModeId ? PaymentDeviceUPI?.[0]?.ModeId
: SelectedUPIPayOption?.toLowerCase() === 'pg' : SelectedUPIPayOption?.toLowerCase() === 'pg'
@ -2145,15 +2164,25 @@ export default function BST1Payment() {
: paybtnselected : paybtnselected
? paybtnselected ? paybtnselected
: null, : null,
Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), Amount:
MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : salesBillEdit && currentOrderNetAmount < previousNetAmount
Paybtnnameselected?.toLowerCase() === 'upi' && ? previousNetAmount - currentOrderNetAmount
: Math.round(TotalAmount),
MerchantId:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'business' SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantId ?.MerchantId
: null, : null,
PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : PaymentOptionType:
Paybtnnameselected?.toLowerCase() === 'cash' salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'PC' ? 'PC'
: Paybtnnameselected?.toLowerCase() === 'credit' : Paybtnnameselected?.toLowerCase() === 'credit'
? 'PC' ? 'PC'
@ -2166,16 +2195,21 @@ export default function BST1Payment() {
? 'BU' ? 'BU'
: SelectedUPIPayOption : SelectedUPIPayOption
: null, : null,
ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : ModeOfPayment:
SelectedUPIPayOption?.toLowerCase() === 'default' salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: SelectedUPIPayOption?.toLowerCase() === 'default'
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
?.UPIDetailId ?.UPIDetailId
: SelectedUPIPayOption?.toLowerCase() === 'business' : SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ? BusinessPayOption?.find(
?.MerchantUPIId (busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
: null, : null,
AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : AccountDtl:
Paybtnnameselected?.toLowerCase() === 'upi' && salesBillEdit && currentOrderNetAmount < previousNetAmount
? []
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default' SelectedUPIPayOption?.toLowerCase() === 'default'
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
(upipay) => upipay?.UPIId === UpiId (upipay) => upipay?.UPIId === UpiId
@ -2191,8 +2225,10 @@ export default function BST1Payment() {
SelectedCardOption?.toLowerCase() === 'pg') SelectedCardOption?.toLowerCase() === 'pg')
? useOptions?.[0]?.PaymentDetails?.PaymentGateway ? useOptions?.[0]?.PaymentDetails?.PaymentGateway
: [], : [],
PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : PaymentStatus:
Paybtnnameselected?.toLowerCase() === 'cash' salesBillEdit && currentOrderNetAmount < previousNetAmount
? 'S'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'S' ? 'S'
: Paybtnnameselected?.toLowerCase() === 'credit' : Paybtnnameselected?.toLowerCase() === 'credit'
? 'S' ? 'S'
@ -2200,9 +2236,18 @@ export default function BST1Payment() {
SelectedUPIPayOption?.toLowerCase() === 'default' SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S' ? 'S'
: 'P', : 'P',
Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, Debit:
Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && Paybtnnameselected?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
? Math.round(previousNetAmount - currentOrderNetAmount)
: 0,
Credit: salesBillEdit
? currentOrderNetAmount > previousNetAmount &&
Paybtnnameselected?.toLowerCase() === 'credit' Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount)
: 0
: Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount) ? Math.round(TotalAmount)
: 0, : 0,
}, },
@ -3300,8 +3345,10 @@ export default function BST1Payment() {
setDefaultPaymentMode([]); setDefaultPaymentMode([]);
} }
}; };
if (salesBillEdit) {
setDefaultPaymentOption(); setDefaultPaymentOption();
}, [defaultPaymentTrigger]); }
}, [defaultPaymentTrigger, salesBillEdit]);
const Otherserviceprint = async () => { const Otherserviceprint = async () => {
if (OtherServicesPrintDetails?.length > 0) { if (OtherServicesPrintDetails?.length > 0) {
@ -3541,7 +3588,8 @@ export default function BST1Payment() {
: 1, : 1,
}} }}
> >
{paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( {paybtns?.length > 0 &&
currentOrderNetAmount >= previousNetAmount ? (
paybtns?.map((payment) => ( paybtns?.map((payment) => (
<div className="Table3-cash"> <div className="Table3-cash">
<button <button
@ -3621,7 +3669,9 @@ export default function BST1Payment() {
</button> </button>
</div> </div>
)) ))
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( ) : currentOrderNetAmount < previousNetAmount &&
salesBillEdit &&
refundPayBtns.length > 0 ? (
refundPayBtns.map((payment) => ( refundPayBtns.map((payment) => (
<div className="Table3-cash"> <div className="Table3-cash">
<button <button
@ -3641,7 +3691,12 @@ export default function BST1Payment() {
? 'blink-animation 0.5s infinite alternate' ? 'blink-animation 0.5s infinite alternate'
: 'none', : 'none',
}} }}
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)} onClick={() =>
handleRefundPaymentMode(
payment?.ConfigId,
payment?.ConfigName
)
}
> >
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */} {/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
@ -3804,7 +3859,6 @@ export default function BST1Payment() {
{/* Customer Orders */} {/* Customer Orders */}
{GetCustId && ( {GetCustId && (
<Tooltip title="Customer Orders" isMobile={isMobile}> <Tooltip title="Customer Orders" isMobile={isMobile}>
{' '} {' '}
<div <div
@ -3838,7 +3892,6 @@ export default function BST1Payment() {
</Tooltip> </Tooltip>
)} )}
{OtherServicesglobal && OrderCardDetail.length >= 1 && ( {OtherServicesglobal && OrderCardDetail.length >= 1 && (
<TooltipWrapper title="Vehicle Number" isMobile={isMobile}> <TooltipWrapper title="Vehicle Number" isMobile={isMobile}>
{' '} {' '}
@ -4039,8 +4092,10 @@ export default function BST1Payment() {
OrderCardDetail?.length > 0 && OrderCardDetail?.length > 0 &&
paybtnselected && paybtnselected &&
CheckBookingStatus != 'Close' CheckBookingStatus != 'Close'
? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? ? !OrderStatus
'price-button' ? salesBillEdit &&
currentOrderNetAmount < previousNetAmount
? 'price-button'
: 'price-button' : 'price-button'
: 'price-button Order' : 'price-button Order'
: 'price-button-disabled' : 'price-button-disabled'
@ -4056,7 +4111,15 @@ export default function BST1Payment() {
> >
{' '} {' '}
{isMobile ? ( {isMobile ? (
!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? <div>Refund: {(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</div> : ( !OrderStatus ? (
salesBillEdit &&
currentOrderNetAmount < previousNetAmount ? (
<div>
Refund:
{(previousNetAmount || 0) -
(currentOrderNetAmount || 0)}
</div>
) : (
`${Math.round( `${Math.round(
OrderType === 'Failed' OrderType === 'Failed'
? FailedTotalAmt ? FailedTotalAmt
@ -4064,10 +4127,17 @@ export default function BST1Payment() {
? Math.max(0, TotalAmount - overAllBal) ? Math.max(0, TotalAmount - overAllBal)
: TotalAmount : TotalAmount
)}` )}`
)
) : ( ) : (
'ORDER' 'ORDER'
) )
) : !OrderStatus ? (salesBillEdit && (currentOrderNetAmount < previousNetAmount)) ? (<div>Refund: {(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</div>) : ( ) : !OrderStatus ? (
salesBillEdit && currentOrderNetAmount < previousNetAmount ? (
<div>
Refund:
{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
</div>
) : (
<div> <div>
{' '} {' '}
<CountUp <CountUp
@ -4082,6 +4152,7 @@ export default function BST1Payment() {
)} )}
/> />
</div> </div>
)
) : ( ) : (
<div>ORDER</div> <div>ORDER</div>
)} )}
@ -4265,10 +4336,17 @@ export default function BST1Payment() {
SplitPaymentModal={Splitpayment} SplitPaymentModal={Splitpayment}
handlesplitpaymentclose={handlesplitpaymentclose} handlesplitpaymentclose={handlesplitpaymentclose}
TotalNetAmount={ TotalNetAmount={
OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - OrderType === 'Failed'
? FailedTotalAmt
: Math.round(
OrderCardDetail?.reduce(
(acc, data) => data?.TotalAmt + acc,
0
) -
((OverAllSales > 0 ? OverAllSales : 0) + ((OverAllSales > 0 ? OverAllSales : 0) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) + (OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0))) (Discount > 0 ? Discount : 0))
)
} }
failedOrderData={failedOrderData} failedOrderData={failedOrderData}
/> />

View File

@ -1,4 +1,11 @@
import React, { useCallback, useEffect, useState, useRef } from 'react'; import React, {
useCallback,
useEffect,
useState,
useRef,
lazy,
Suspense,
} from 'react';
import { shallowEqual, useDispatch, useSelector } from 'react-redux'; import { shallowEqual, useDispatch, useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import moment from 'moment'; import moment from 'moment';
@ -13,9 +20,6 @@ import { AiOutlineClose } from 'react-icons/ai';
import paygate from '../../../../../Images/paygate.png'; import paygate from '../../../../../Images/paygate.png';
import defaultupi from '../../../../../Images/defaultupi.png'; import defaultupi from '../../../../../Images/defaultupi.png';
import paydevice from '../../../../../Images/paydevice.png'; import paydevice from '../../../../../Images/paydevice.png';
import BsBill2 from './BsBill2';
import BsBill2Sum from './BsBill2Sum';
import BSSummery1 from '../BSBillingTableSummery/BSSummery';
import { Tables } from '../../../../../Components/Tables/Table'; import { Tables } from '../../../../../Components/Tables/Table';
import { import {
printDiv, printDiv,
@ -133,14 +137,21 @@ import {
changeBillEditingMode, changeBillEditingMode,
changePreviousOrderPayment, changePreviousOrderPayment,
changePreviousOrderOfferDetail, changePreviousOrderOfferDetail,
} from '../../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../../Features/BookingScreen/BookingData/BookingData.js';
import {
ChangeFullFreeProductList,
changeFullOfferAppliedProducts,
changeLoyaltyConsumedQuantities,
GlobalFreeProdList,
GlobalOfferAppliedProducts,
GlobalOverAllOfferAmt,
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import { import {
gettinghold, gettinghold,
globalholddata, globalholddata,
changeholddata, changeholddata,
} from '../../../../../Features/BookingScreen/HoldOption/HoldOption'; } from '../../../../../Features/BookingScreen/HoldOption/HoldOption';
import { ChangeTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges.js'; //Shifayath Date:27/12/2023 import { ChangeTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges.js'; //Shifayath Date:27/12/2023
import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities';
import { globalExtraTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges'; import { globalExtraTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges';
import { import {
getAddCustomerDetails, getAddCustomerDetails,
@ -148,31 +159,20 @@ import {
GlobalAddCustomerDetails, GlobalAddCustomerDetails,
ReprintDetails, ReprintDetails,
triggerCustomerRefresh, triggerCustomerRefresh,
} from '../../../../../Features/BookingScreen/Customer/addCustomer'; } from '../../../../../Features/BookingScreen/Customer/addCustomer.js';
import PaymentPdfBooking from '../../../../paymentpdfPage/PaymentPdfBooking'; import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip';
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBIllingTable2.scss'; import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBIllingTable2.scss';
import BSCustomerSelect from '../../UtillComponents/BSSelectCustomer.jsx';
import PozoHoldIcon from '../../UtillComponents/Pozo retail icons/PozoHoldIcon'; 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 PozoUnpaidIcon from '../../UtillComponents/Pozo retail icons/PozoUnpaidIcon.jsx';
import PozoAdvanceIcon from '../../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx';
import PozoBillIcon from '../../UtillComponents/Pozo retail icons/PozoBIllIcon.jsx'; import PozoBillIcon from '../../UtillComponents/Pozo retail icons/PozoBIllIcon.jsx';
import PozoAddCustomerIcon from '../../UtillComponents/Pozo retail icons/PozoAddCustomerIcon'; import PozoAddCustomerIcon from '../../UtillComponents/Pozo retail icons/PozoAddCustomerIcon';
import QrComponent from '../../BookingFunctionality/DynamicQr.jsx';
import QrinScreen from '../../BookingFunctionality/DynamicScreenQr.jsx';
import BSCreditCustomer from '../../UtillComponents/BSCreditCustomer.jsx';
import Buttons from '../../../../../Components/Forms/Buttons'; import Buttons from '../../../../../Components/Forms/Buttons';
import WpIcon from '../../../../../Images/message.png'; import WpIcon from '../../../../../Images/message.png';
import BsBillingCreditCustomer from '../../BookingFunctionality/BSBillingCreditCustomer.jsx';
import PozoAdvanceIcon from '../../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import MobilePrint from '../../BookingFunctionality/MobilePrint.jsx';
import { settingDataSelector } from '../../../../../Features/PreferenceMaster/PreferenceMaster.js'; import { settingDataSelector } from '../../../../../Features/PreferenceMaster/PreferenceMaster.js';
import CountUp from 'react-countup'; import CountUp from 'react-countup';
import { GlobalpreOrderOpen } from '../../../../../Features/BookingScreen/PreOrder/PreOrder.js'; 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 { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js'; import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js';
import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx'; import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx';
@ -184,49 +184,94 @@ import {
Global_OverallOfferAmount, Global_OverallOfferAmount,
Global_SalesWiseOfferAmount, Global_SalesWiseOfferAmount,
} from '../../../../../Features/Offer/Offer.js'; } from '../../../../../Features/Offer/Offer.js';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx'; import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js';
import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip';
import { useAuth } from '../../../../../AuthContext.jsx'; import { useAuth } from '../../../../../AuthContext.jsx';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import { GlobalBookingStatus } from '../../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js'; import { GlobalBookingStatus } from '../../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js';
import { import {
changeSalesPaymentoption, changeSalesPaymentoption,
getPaymentOptionsData, getPaymentOptionsData,
GlobalSalesPaymentoption, GlobalSalesPaymentoption,
} from '../../../../../Features/Payment/Paymentoptions/Paymentoptions.js'; } from '../../../../../Features/Payment/Paymentoptions/Paymentoptions.js';
import Paymentoption from '../../../../Payment/PaymentOptions/PaymentOptions.jsx';
import { getCombolist } from '../../../../../Features/ComboMaster/ComboMaster.js'; import { getCombolist } from '../../../../../Features/ComboMaster/ComboMaster.js';
import SMSShare from '../../../../WhatsAppShare/SmsShare.jsx';
import WhatsAppShare from '../../../../WhatsAppShare/whatsAppShare.jsx';
import { MdSms } from 'react-icons/md'; import { MdSms } from 'react-icons/md';
import { FaWhatsapp, FaPrint, FaCartPlus } from 'react-icons/fa'; import { FaWhatsapp, FaPrint, FaCartPlus } from 'react-icons/fa';
import BSTipAmount from '../../UtillComponents/BSTipAmount.jsx';
import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js'; import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js';
import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js'; import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js';
import { TfiClipboard } from 'react-icons/tfi'; import { TfiClipboard } from 'react-icons/tfi';
import OtherServicePrintStyle1 from '../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx';
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 { 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 CardPopover from '../StandardTable/Utils/CardPopover.jsx';
import UpiPopover from '../StandardTable/Utils/UpiPopOver.jsx'; import UpiPopover from '../StandardTable/Utils/UpiPopOver.jsx';
import pozologoimg from '../../../../../Images/pozologoimg.png'; import pozologoimg from '../../../../../Images/pozologoimg.png';
import PaymentGatewayEmbedded from '../../UtillComponents/PaymentGatewayEmbedded.jsx'; import PaymentGatewayEmbedded from '../../UtillComponents/PaymentGatewayEmbedded.jsx';
import MobileMultiPdfPrintTrigger from '../../UtillComponents/MobileMultiPdfPrintTrigger.jsx'; import MobileMultiPdfPrintTrigger from '../../UtillComponents/MobileMultiPdfPrintTrigger.jsx';
import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js'; // Jsx Files
import CustomerOrders from '../../BookingFunctionality/CustomerOrders.jsx'; const CustomerOrders = lazy(
() => import('../../BookingFunctionality/CustomerOrders.jsx')
);
const BSCustomerSelect = lazy(
() => import('../../UtillComponents/BSSelectCustomer.jsx')
);
const BSCreditCustomer = lazy(
() => import('../../UtillComponents/BSCreditCustomer.jsx')
);
const OtherServicePrintStyle1 = lazy(
() =>
import('../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx')
);
import OtherServiceMobilePrint from '../../BookingFunctionality/OtherServiceMobilePrint.jsx';
const BSOtherServiceClaim = lazy(
() => import('../../UtillComponents/BSOtherServiceClaim.jsx')
);
const SplitPayment = lazy(
() => import('../../BookingFunctionality/SplitPayment.jsx')
);
const FeaturesFunctionalities = lazy(
() => import('../../BookingFunctionality/FeaturesFunctionalities.jsx')
);
const Paymentoption = lazy(
() => import('../../../../Payment/PaymentOptions/PaymentOptions.jsx')
);
const BsBill2 = lazy(() => import('./BsBill2'));
const BsBill2Sum = lazy(() => import('./BsBill2Sum'));
const BSSummery1 = lazy(() => import('../BSBillingTableSummery/BSSummery'));
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 MobilePrint = lazy(
() => import('../../BookingFunctionality/MobilePrint.jsx')
);
const TokensinglePrint = lazy(
() =>
import('../../../../paymentpdfPage/TokenOnlyPrints/TokeninsinglePrint.jsx')
);
const SingleTokenMobilePrint = lazy(
() => import('../../BookingFunctionality/SingleTokenMobilePrint.jsx')
);
const IndividualTokenMobilePrint = lazy(
() => import('../../BookingFunctionality/IndividualTokenMobilePrint.jsx')
);
const SMSShare = lazy(() => import('../../../../WhatsAppShare/SmsShare.jsx'));
const WhatsAppShare = lazy(
() => import('../../../../WhatsAppShare/whatsAppShare.jsx')
);
const BSTipAmount = lazy(() => import('../../UtillComponents/BSTipAmount.jsx'));
const subDirectory = import.meta.env.ENV_BASE_URL; const subDirectory = import.meta.env.ENV_BASE_URL;
const MainHomeUrl = import.meta.env.ENV_MAIN_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 currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
const BSBillingTable2 = () => { const BSBillingTable2 = () => {
@ -254,7 +299,9 @@ const BSBillingTable2 = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const salesBillEdit = useSelector(GlobalSalesBillEdit); const salesBillEdit = useSelector(GlobalSalesBillEdit);
const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); const previousOrderOfferDetails = useSelector(
GlobalPreviousOrderOfferDetails
);
const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
const defaultBookingType = useSelector(GlobalDefaultBookingType); const defaultBookingType = useSelector(GlobalDefaultBookingType);
const globalTipAmount = useSelector(GlobaltipAmount); const globalTipAmount = useSelector(GlobaltipAmount);
@ -375,6 +422,10 @@ const BSBillingTable2 = () => {
const OverAllSales = useSelector(GlobalOverAllDiscSales); const OverAllSales = useSelector(GlobalOverAllDiscSales);
const OverAllEstimate = useSelector(GlobalOverAllDiscEstimate); const OverAllEstimate = useSelector(GlobalOverAllDiscEstimate);
const holdCheckedSalesSetup = tableOptions?.some(
(item) => item?.OptionName === 'Hold'
);
const PaymentOptionsModeName = const PaymentOptionsModeName =
PaymentOptions?.find((e) => e.ModeDefault?.toUpperCase() === 'Y') PaymentOptions?.find((e) => e.ModeDefault?.toUpperCase() === 'Y')
?.ModeName || PaymentOptions?.[0]?.ModeName; ?.ModeName || PaymentOptions?.[0]?.ModeName;
@ -518,7 +569,6 @@ const BSBillingTable2 = () => {
}, [salesBillEdit]); }, [salesBillEdit]);
useEffect(() => { useEffect(() => {
if (salesBillEdit) { if (salesBillEdit) {
if (SelCustId) { if (SelCustId) {
setRefundPayBtns(AllPaymentOptions); setRefundPayBtns(AllPaymentOptions);
@ -533,8 +583,7 @@ const BSBillingTable2 = () => {
setRefundPayBtns(withoutCustomer); setRefundPayBtns(withoutCustomer);
} }
} }
}, [AllPaymentOptions, SelCustId, salesBillEdit]);
}, [AllPaymentOptions, SelCustId, salesBillEdit])
useEffect(() => { useEffect(() => {
if (!preOrder) { if (!preOrder) {
@ -594,14 +643,21 @@ const BSBillingTable2 = () => {
const filteredPayments = const filteredPayments =
previousOrderPayment?.filter( previousOrderPayment?.filter(
p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment (p) =>
p?.LastOrderTran === 'Y' &&
p?.AfterAdjustment != null &&
p?.AfterAdjustment !== '' &&
p?.AfterAdjustment
) || []; ) || [];
const paymentsToUse = const paymentsToUse =
filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; filteredPayments.length > 0
? filteredPayments
: previousOrderPayment || [];
const totalPreviouspayment = paymentsToUse?.reduce( const totalPreviouspayment = paymentsToUse?.reduce(
(acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), (acc, payment) =>
acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
0 0
); );
@ -610,8 +666,7 @@ const BSBillingTable2 = () => {
0 0
); );
const previousNetAmount = const previousNetAmount = totalPreviouspayment || 0;
(totalPreviouspayment) || 0;
let withdiscTotal = let withdiscTotal =
Total - Total -
@ -623,12 +678,26 @@ const BSBillingTable2 = () => {
withdiscTotal >= 0 withdiscTotal >= 0
? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2)
: (Number(Total) + Number(globalTipAmount)).toFixed(2) : (Number(Total) + Number(globalTipAmount)).toFixed(2)
) );
setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); setTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
);
setCurrentOrderNetAmount(currentOrderNetAmount); setCurrentOrderNetAmount(currentOrderNetAmount);
setPreviousNetAmount(previousNetAmount); setPreviousNetAmount(previousNetAmount);
dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(
changeSummeryTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
)
);
dispatch(changeSummeryComboOfferAmount(withComboSum)); dispatch(changeSummeryComboOfferAmount(withComboSum));
@ -658,13 +727,16 @@ const BSBillingTable2 = () => {
UserId: UserId, UserId: UserId,
}; };
dispatch(getPrinterMappingDetails(data)).unwrap(); dispatch(getPrinterMappingDetails(data)).unwrap();
const Data1 = { AppId, CompId, BranchId }; // const Data1 = { AppId, CompId, BranchId };
dispatch(getPrintSelectionComponentData(Data1)).unwrap(); // dispatch(getPrintSelectionComponentData(Data1)).unwrap();
}, []); }, []);
useEffect(() => { useEffect(() => {
if (CompId && BranchId && AppId) { if (CompId && BranchId && AppId) {
if (holdCheckedSalesSetup) {
getHolddata(); getHolddata();
getUnpaiddatas(); }
// getUnpaiddatas();
getCustomerData(); getCustomerData();
} }
}, [CompId, BranchId, AppId]); }, [CompId, BranchId, AppId]);
@ -702,29 +774,6 @@ const BSBillingTable2 = () => {
setResponsiveBill(!responsiveBill); setResponsiveBill(!responsiveBill);
}; };
// 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 () => { const fetchApi = async () => {
let data = { let data = {
CompId: CompId, CompId: CompId,
@ -740,9 +789,9 @@ const BSBillingTable2 = () => {
}; };
const getCustomerData = async () => { const getCustomerData = async () => {
await dispatch( // await dispatch(
getAllCustomer({ CompId: CompId, AppId: AppId, branchId: BranchId }) // getAllCustomer({ CompId: CompId, AppId: AppId, branchId: BranchId })
); // );
await dispatch( await dispatch(
getAddCustomerDetails({ getAddCustomerDetails({
CompId: CompId, CompId: CompId,
@ -833,7 +882,11 @@ const BSBillingTable2 = () => {
const handleButtonClick = () => { const handleButtonClick = () => {
if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) {
UpiPayment(); UpiPayment();
} else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { } else if (
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
!refundPaySelected
) {
setMessageType('warning'); setMessageType('warning');
setMessageData('Please Select Refund Payment Method'); setMessageData('Please Select Refund Payment Method');
return; return;
@ -1313,7 +1366,7 @@ const BSBillingTable2 = () => {
const handleRefundPaymentMode = (id, name) => { const handleRefundPaymentMode = (id, name) => {
setRefundPaySelected(id); setRefundPaySelected(id);
setRefundPaySelectedName(name); setRefundPaySelectedName(name);
} };
const addUpiOption = async (id, name, UPIId) => { const addUpiOption = async (id, name, UPIId) => {
await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDprint(UPIId));
@ -1872,7 +1925,10 @@ const BSBillingTable2 = () => {
setUpinotSelected(false); setUpinotSelected(false);
setCurrentOrderNetAmount(0); setCurrentOrderNetAmount(0);
setPreviousNetAmount(0); setPreviousNetAmount(0);
if (holdCheckedSalesSetup) {
getHolddata(); getHolddata();
}
if (defaultBookingType === 'Both') { if (defaultBookingType === 'Both') {
await dispatch(changeBookingType('TakeAway')); await dispatch(changeBookingType('TakeAway'));
} }
@ -2174,8 +2230,10 @@ const BSBillingTable2 = () => {
SalesPaymentType: 'normal', SalesPaymentType: 'normal',
PaymentDetail: [ PaymentDetail: [
{ {
PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : PaymentType:
Paybtnnameselected?.toLowerCase() === 'upi' salesBillEdit && currentOrderNetAmount < previousNetAmount
? refundPaySelected
: Paybtnnameselected?.toLowerCase() === 'upi'
? SelectedUPIPayOption?.toLowerCase() === 'pd' ? SelectedUPIPayOption?.toLowerCase() === 'pd'
? PaymentDeviceUPI?.[0]?.ModeId ? PaymentDeviceUPI?.[0]?.ModeId
: SelectedUPIPayOption?.toLowerCase() === 'pg' : SelectedUPIPayOption?.toLowerCase() === 'pg'
@ -2188,15 +2246,25 @@ const BSBillingTable2 = () => {
: paybtnselected : paybtnselected
? paybtnselected ? paybtnselected
: null, : null,
Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), Amount:
MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : salesBillEdit && currentOrderNetAmount < previousNetAmount
Paybtnnameselected?.toLowerCase() === 'upi' && ? previousNetAmount - currentOrderNetAmount
: Math.round(TotalAmount),
MerchantId:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'business' SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantId ?.MerchantId
: null, : null,
PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : PaymentOptionType:
Paybtnnameselected?.toLowerCase() === 'cash' salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'PC' ? 'PC'
: Paybtnnameselected?.toLowerCase() === 'credit' : Paybtnnameselected?.toLowerCase() === 'credit'
? 'PC' ? 'PC'
@ -2209,16 +2277,21 @@ const BSBillingTable2 = () => {
? 'BU' ? 'BU'
: SelectedUPIPayOption : SelectedUPIPayOption
: null, : null,
ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : ModeOfPayment:
SelectedUPIPayOption?.toLowerCase() === 'default' salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: SelectedUPIPayOption?.toLowerCase() === 'default'
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
?.UPIDetailId ?.UPIDetailId
: SelectedUPIPayOption?.toLowerCase() === 'business' : SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ? BusinessPayOption?.find(
?.MerchantUPIId (busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
: null, : null,
AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : AccountDtl:
Paybtnnameselected?.toLowerCase() === 'upi' && salesBillEdit && currentOrderNetAmount < previousNetAmount
? []
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default' SelectedUPIPayOption?.toLowerCase() === 'default'
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
(upipay) => upipay?.UPIId === UpiId (upipay) => upipay?.UPIId === UpiId
@ -2234,8 +2307,10 @@ const BSBillingTable2 = () => {
SelectedCardOption?.toLowerCase() === 'pg') SelectedCardOption?.toLowerCase() === 'pg')
? useOptions?.[0]?.PaymentDetails?.PaymentGateway ? useOptions?.[0]?.PaymentDetails?.PaymentGateway
: [], : [],
PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : PaymentStatus:
Paybtnnameselected?.toLowerCase() === 'cash' salesBillEdit && currentOrderNetAmount < previousNetAmount
? 'S'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'S' ? 'S'
: Paybtnnameselected?.toLowerCase() === 'credit' : Paybtnnameselected?.toLowerCase() === 'credit'
? 'S' ? 'S'
@ -2243,9 +2318,18 @@ const BSBillingTable2 = () => {
SelectedUPIPayOption?.toLowerCase() === 'default' SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S' ? 'S'
: 'P', : 'P',
Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, Debit:
Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && Paybtnnameselected?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
? Math.round(previousNetAmount - currentOrderNetAmount)
: 0,
Credit: salesBillEdit
? currentOrderNetAmount > previousNetAmount &&
Paybtnnameselected?.toLowerCase() === 'credit' Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount)
: 0
: Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount) ? Math.round(TotalAmount)
: 0, : 0,
}, },
@ -3417,8 +3501,10 @@ const BSBillingTable2 = () => {
setDefaultPaymentMode([]); setDefaultPaymentMode([]);
} }
}; };
if (salesBillEdit) {
setDefaultPaymentOption(); setDefaultPaymentOption();
}, [defaultPaymentTrigger]); }
}, [defaultPaymentTrigger, salesBillEdit]);
const Otherserviceprint = async () => { const Otherserviceprint = async () => {
if (OtherServicesPrintDetails?.length > 0) { if (OtherServicesPrintDetails?.length > 0) {
@ -3572,6 +3658,7 @@ const BSBillingTable2 = () => {
); );
}; };
return ( return (
<Suspense fallback={<div>Loading</div>}>
<div <div
className={ className={
templateData?.BookingLayout?.[0] === 'Layout6' templateData?.BookingLayout?.[0] === 'Layout6'
@ -3910,7 +3997,8 @@ const BSBillingTable2 = () => {
: 1, : 1,
}} }}
> >
{paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( {paybtns?.length > 0 &&
currentOrderNetAmount >= previousNetAmount ? (
paybtns?.map((payment) => ( paybtns?.map((payment) => (
<div className="Table3-cash"> <div className="Table3-cash">
<button <button
@ -3936,7 +4024,10 @@ const BSBillingTable2 = () => {
payment.ModeId, payment.ModeId,
payment.ModeName payment.ModeName
) )
: handlePaymentMode(payment.ModeId, payment.ModeName) : handlePaymentMode(
payment.ModeId,
payment.ModeName
)
} }
> >
<div <div
@ -3985,7 +4076,9 @@ const BSBillingTable2 = () => {
</button> </button>
</div> </div>
)) ))
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( ) : currentOrderNetAmount < previousNetAmount &&
salesBillEdit &&
refundPayBtns.length > 0 ? (
refundPayBtns.map((payment) => ( refundPayBtns.map((payment) => (
<div className="Table3-cash"> <div className="Table3-cash">
<button <button
@ -4005,7 +4098,12 @@ const BSBillingTable2 = () => {
? 'blink-animation 0.5s infinite alternate' ? 'blink-animation 0.5s infinite alternate'
: 'none', : 'none',
}} }}
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)} onClick={() =>
handleRefundPaymentMode(
payment?.ConfigId,
payment?.ConfigName
)
}
> >
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */} {/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
@ -4077,7 +4175,6 @@ const BSBillingTable2 = () => {
'' ''
)} )}
{/* Customer Orders */} {/* Customer Orders */}
{GetCustId && ( {GetCustId && (
<Tooltip title="Customer Orders" isMobile={isMobile}> <Tooltip title="Customer Orders" isMobile={isMobile}>
@ -4119,7 +4216,10 @@ const BSBillingTable2 = () => {
.map((filteredItem) => ( .map((filteredItem) => (
<React.Fragment key={filteredItem.TemplateOptionsId}> <React.Fragment key={filteredItem.TemplateOptionsId}>
{!OtherServicesglobal && ( {!OtherServicesglobal && (
<TooltipWrapper title="Unpaid Bills" isMobile={isMobile}> <TooltipWrapper
title="Unpaid Bills"
isMobile={isMobile}
>
{' '} {' '}
<PozoUnpaidIcon <PozoUnpaidIcon
className="BSBillingNav-icon-table-icon" className="BSBillingNav-icon-table-icon"
@ -4257,8 +4357,9 @@ const BSBillingTable2 = () => {
OrderCardDetail?.length > 0 && OrderCardDetail?.length > 0 &&
paybtnselected && paybtnselected &&
CheckBookingStatus != 'Close' CheckBookingStatus != 'Close'
? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? ? salesBillEdit &&
'billing-btn' currentOrderNetAmount < previousNetAmount
? 'billing-btn'
: 'billing-btn' : 'billing-btn'
: 'billing-btn-deactive' : 'billing-btn-deactive'
} }
@ -4270,12 +4371,21 @@ const BSBillingTable2 = () => {
handleButtonClick handleButtonClick
} }
> >
{!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? <div {!OrderStatus ? (
salesBillEdit && currentOrderNetAmount < previousNetAmount ? (
<div
className="billing-in-style-Order" className="billing-in-style-Order"
style={{ fontFamily: FontFamily['head'] }}>Refund: {(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</div> : ( style={{ fontFamily: FontFamily['head'] }}
>
Refund:
{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
</div>
) : (
<> <>
<div className="billing-in-style"> <div className="billing-in-style">
<h1 style={{ fontFamily: FontFamily['head'] }}>Total</h1> <h1 style={{ fontFamily: FontFamily['head'] }}>
Total
</h1>
</div> </div>
<div> <div>
@ -4308,6 +4418,7 @@ const BSBillingTable2 = () => {
</h1> </h1>
</div> </div>
</> </>
)
) : ( ) : (
<div <div
className="billing-in-style-Order" className="billing-in-style-Order"
@ -4479,8 +4590,8 @@ const BSBillingTable2 = () => {
<div> <div>
You have already selected a table. If you click 'OK,' the You have already selected a table. If you click 'OK,' the
table selection will be removed, and the unpaid flow will table selection will be removed, and the unpaid flow will
continue. If you click 'Cancel,' the dine-in flow will proceed continue. If you click 'Cancel,' the dine-in flow will
as selected. proceed as selected.
</div> </div>
</> </>
} }
@ -4493,10 +4604,17 @@ const BSBillingTable2 = () => {
SplitPaymentModal={Splitpayment} SplitPaymentModal={Splitpayment}
handlesplitpaymentclose={handlesplitpaymentclose} handlesplitpaymentclose={handlesplitpaymentclose}
TotalNetAmount={ TotalNetAmount={
OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - OrderType === 'Failed'
? FailedTotalAmt
: Math.round(
OrderCardDetail?.reduce(
(acc, data) => data?.TotalAmt + acc,
0
) -
((OverAllSales > 0 ? OverAllSales : 0) + ((OverAllSales > 0 ? OverAllSales : 0) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) + (OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0))) (Discount > 0 ? Discount : 0))
)
} }
failedOrderData={failedOrderData} failedOrderData={failedOrderData}
/> />
@ -4591,7 +4709,9 @@ const BSBillingTable2 = () => {
) )
} }
CreatedDate={OtherServicesPrintDetails?.CreatedDate} CreatedDate={OtherServicesPrintDetails?.CreatedDate}
PaymentStatus={OtherServicesPrintDetails?.[0]?.PaymentOrderDtl} PaymentStatus={
OtherServicesPrintDetails?.[0]?.PaymentOrderDtl
}
Preference={SettingDataSelector} Preference={SettingDataSelector}
printDatas={printDatas} printDatas={printDatas}
/> />
@ -4702,7 +4822,9 @@ const BSBillingTable2 = () => {
color: '#fff', color: '#fff',
border: 'none', border: 'none',
borderRadius: 4, borderRadius: 4,
cursor: hasVehicleInputErrors() ? 'not-allowed' : 'pointer', cursor: hasVehicleInputErrors()
? 'not-allowed'
: 'pointer',
}} }}
> >
Submit Submit
@ -4768,6 +4890,7 @@ const BSBillingTable2 = () => {
)} )}
</div> </div>
</div> </div>
</Suspense>
); );
}; };

View File

@ -10,16 +10,13 @@ import {
ChangeTotalAmount, ChangeTotalAmount,
globalExtraTotalAmount, globalExtraTotalAmount,
} from '../../../../../Features/ExteraCharges/ExtraCharges.js'; } from '../../../../../Features/ExteraCharges/ExtraCharges.js';
import BSBillingEditQuantity from '../BSBillingEditQuantity/BSBillingEditQuantity';
import { import {
changeholddata, changeholddata,
gettinghold, gettinghold,
puttinghold, puttinghold,
} from '../../../../../Features/BookingScreen/HoldOption/HoldOption.js'; } from '../../../../../Features/BookingScreen/HoldOption/HoldOption.js';
import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js'; import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import BSEditTotalAmt from '../BSEditTotalAmount/BSEditTotalAmt.jsx';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx'; import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx';
import { import {
getTemplateData, getTemplateData,
SelectedGlobalBillingColorDetail, SelectedGlobalBillingColorDetail,
@ -80,6 +77,10 @@ import {
import { useRemoveProducts } from './RemoveCartWithOffer.jsx'; import { useRemoveProducts } from './RemoveCartWithOffer.jsx';
import { useUtilsComponent } from '../../../../../Services/utils.js'; import { useUtilsComponent } from '../../../../../Services/utils.js';
import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx'; import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
// jsx Files
import BSBillingEditQuantity from '../BSBillingEditQuantity/BSBillingEditQuantity';
import BSEditTotalAmt from '../BSEditTotalAmount/BSEditTotalAmt.jsx';
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx';
const BSBillingTable3 = () => { const BSBillingTable3 = () => {
const { removeExtraCharge } = useUtilsComponent(); const { removeExtraCharge } = useUtilsComponent();
@ -123,7 +124,6 @@ const BSBillingTable3 = () => {
const UnpaidData = useSelector(GlobalUnpaidData); const UnpaidData = useSelector(GlobalUnpaidData);
const GlobProdwisedata = useSelector(GlobalSelProdWiseEst); const GlobProdwisedata = useSelector(GlobalSelProdWiseEst);
const ReportholdData = useSelector(GlobalReorderHoldDetails); const ReportholdData = useSelector(GlobalReorderHoldDetails);
const salesBillEdit = useSelector(GlobalSalesBillEdit);
const prodCat = useSelector(GlobalProductCategorie); const prodCat = useSelector(GlobalProductCategorie);
const ProdSubCat = useSelector(GlobalProductSubCategorie); const ProdSubCat = useSelector(GlobalProductSubCategorie);
const [PreviousdataLength, setPreviousdataLength] = const [PreviousdataLength, setPreviousdataLength] =
@ -137,7 +137,8 @@ const BSBillingTable3 = () => {
const GetCustId = useSelector(GlobalCustId); const GetCustId = useSelector(GlobalCustId);
const selectedCustomer = useSelector(GlobalSelOption); const selectedCustomer = useSelector(GlobalSelOption);
const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false); const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] =
useState(false);
const [customerProduct, setCustomerProduct] = useState(null); const [customerProduct, setCustomerProduct] = useState(null);
const preferenceshortcutkey = preferenceDatas?.[0]?.[ const preferenceshortcutkey = preferenceDatas?.[0]?.[
'SettingDtlDetails' 'SettingDtlDetails'
@ -259,7 +260,6 @@ const BSBillingTable3 = () => {
event.preventDefault(); event.preventDefault();
handleShortcut('weightAmount'); handleShortcut('weightAmount');
} }
}; };
window.addEventListener('keydown', handleKeyDown); window.addEventListener('keydown', handleKeyDown);
@ -389,7 +389,7 @@ const BSBillingTable3 = () => {
const handleCustomerProductPriceHistory = (item) => { const handleCustomerProductPriceHistory = (item) => {
setCustomerPriceHistoryOpen(true); setCustomerPriceHistoryOpen(true);
setCustomerProduct(item?.ProdId); setCustomerProduct(item?.ProdId);
} };
function safeRound(amountStr) { function safeRound(amountStr) {
if (amountStr == null) return allowDecimal ? '0.00' : '0'; if (amountStr == null) return allowDecimal ? '0.00' : '0';
@ -1983,7 +1983,6 @@ const BSBillingTable3 = () => {
} }
} }
} }
}; };
// const removeFromCart = async (item) => { // const removeFromCart = async (item) => {
@ -2395,7 +2394,8 @@ const BSBillingTable3 = () => {
{OldtableDataTakeAway?.map((item, index) => ( {OldtableDataTakeAway?.map((item, index) => (
<tr <tr
key={index} key={index}
className={`${item?.SalesId && OrderType !== 'Hold' className={`${
item?.SalesId && OrderType !== 'Hold'
? 'BSBill-Table3-content-Disabled' ? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content' : 'BSBill-Table3-content'
} }
@ -2673,7 +2673,8 @@ const BSBillingTable3 = () => {
{OldtableDataDinein?.map((item, index) => ( {OldtableDataDinein?.map((item, index) => (
<tr <tr
key={OldtableDataTakeAway?.length + index} key={OldtableDataTakeAway?.length + index}
className={`${item?.SalesId className={`${
item?.SalesId
? 'BSBill-Table3-content-Disabled' ? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content' : 'BSBill-Table3-content'
} }
@ -2955,7 +2956,8 @@ const BSBillingTable3 = () => {
OldtableDataTakeAway?.length + OldtableDataTakeAway?.length +
index index
} }
className={`${BookingType === 'Dine In' && item?.SalesId className={`${
BookingType === 'Dine In' && item?.SalesId
? 'BSBill-Table3-content-Disabled' ? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content' : 'BSBill-Table3-content'
} }
@ -3280,7 +3282,8 @@ const BSBillingTable3 = () => {
tableDataTakeAway?.length + tableDataTakeAway?.length +
index index
} }
className={`${BookingType === 'Dine In' && item?.SalesId className={`${
BookingType === 'Dine In' && item?.SalesId
? 'BSBill-Table3-content-Disabled' ? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content' : 'BSBill-Table3-content'
} }
@ -3592,7 +3595,7 @@ const BSBillingTable3 = () => {
ProductDetail={Modaldata} ProductDetail={Modaldata}
/> />
)} )}
{(customerPriceHistoryOpen && GetCustId) && {customerPriceHistoryOpen && GetCustId && (
<CustomerPriceHistory <CustomerPriceHistory
open={customerPriceHistoryOpen} open={customerPriceHistoryOpen}
custId={GetCustId} custId={GetCustId}
@ -3601,7 +3604,7 @@ const BSBillingTable3 = () => {
setCustomerProduct={setCustomerProduct} setCustomerProduct={setCustomerProduct}
selectedCustomer={selectedCustomer} selectedCustomer={selectedCustomer}
/> />
} )}
</div> </div>
); );
}; };

View File

@ -1,4 +1,11 @@
import React, { useCallback, useEffect, useState, useRef } from 'react'; import React, {
useCallback,
useEffect,
useState,
useRef,
lazy,
Suspense,
} from 'react';
import { shallowEqual, useDispatch, useSelector } from 'react-redux'; import { shallowEqual, useDispatch, useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import moment from 'moment'; import moment from 'moment';
@ -6,17 +13,12 @@ import { BiRightArrowAlt } from 'react-icons/bi';
import { AiOutlineClose } from 'react-icons/ai'; import { AiOutlineClose } from 'react-icons/ai';
import { Tables } from '../../../../../Components/Tables/Table'; import { Tables } from '../../../../../Components/Tables/Table';
import { DefaultModal } from '../../../../../Components/Modal/DefaultModal.jsx'; import { DefaultModal } from '../../../../../Components/Modal/DefaultModal.jsx';
import { import { UpCircleOutlined, DownCircleOutlined } from '@ant-design/icons';
UpCircleOutlined,
DownCircleOutlined,
UpOutlined,
} from '@ant-design/icons';
import { Popover, Badge, Modal, Tooltip } from 'antd'; import { Popover, Badge, Modal, Tooltip } from 'antd';
import { import {
printDiv, printDiv,
extractLastNumberOrderId, extractLastNumberOrderId,
encryptObject, encryptObject,
decryptToObject,
} from '../../../../../Services/Others'; } from '../../../../../Services/Others';
import { Messages } from '../../../../../Components/Notifications/Messages'; import { Messages } from '../../../../../Components/Notifications/Messages';
import BSBillingTable3 from './BSBillingTable3'; import BSBillingTable3 from './BSBillingTable3';
@ -24,9 +26,9 @@ import paygate from '../../../../../Images/paygate.png';
import defaultupi from '../../../../../Images/defaultupi.png'; import defaultupi from '../../../../../Images/defaultupi.png';
import pozologoimg from '../../../../../Images/pozologoimg.png'; import pozologoimg from '../../../../../Images/pozologoimg.png';
import paydevice from '../../../../../Images/paydevice.png'; import paydevice from '../../../../../Images/paydevice.png';
import BSSummery1 from '../../BSBillingTables/BSBillingTableSummery/BSSummery'; const BSSummery1 = lazy(
import QrComponent from '../../BookingFunctionality/DynamicQr.jsx'; () => import('../../BSBillingTables/BSBillingTableSummery/BSSummery')
import QrinScreen from '../../BookingFunctionality/DynamicScreenQr.jsx'; );
import { ArrowRightOutlined } from '@ant-design/icons'; import { ArrowRightOutlined } from '@ant-design/icons';
import Buttons from '../../../../../Components/Forms/Buttons'; import Buttons from '../../../../../Components/Forms/Buttons';
import WpIcon from '../../../../../Images/message.png'; import WpIcon from '../../../../../Images/message.png';
@ -40,6 +42,15 @@ import {
getPrinterMappingDetails, getPrinterMappingDetails,
getPrintSelectionComponentData, getPrintSelectionComponentData,
} from '../../../../../Features/ThemeChange/ThemeChange'; } from '../../../../../Features/ThemeChange/ThemeChange';
import {
ChangeFullFreeProductList,
changeFullOfferAppliedProducts,
changeLoyaltyConsumedQuantities,
GlobalFreeProdList,
GlobalOfferAppliedProducts,
GlobalOverAllOfferAmt,
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import { import {
GlobalOrderCardDetails, GlobalOrderCardDetails,
changeOrderCardDetails, changeOrderCardDetails,
@ -48,7 +59,6 @@ import {
GlobalSelectedTableDetails, GlobalSelectedTableDetails,
GlobalBookingType, GlobalBookingType,
changeBookingType, changeBookingType,
getConfigType,
PutBookingData, PutBookingData,
GlobalReorderHoldDetails, GlobalReorderHoldDetails,
getUnpaidData, getUnpaidData,
@ -73,8 +83,6 @@ import {
SendPaymentLink, SendPaymentLink,
changeSummeryTotalAmount, changeSummeryTotalAmount,
changeUpiIDprint, changeUpiIDprint,
changeSummeryTotalItems,
changeSummeryQty,
changeSummeryTotalWithoutTaxAmount, changeSummeryTotalWithoutTaxAmount,
changeSummeryTotalTaxAmount, changeSummeryTotalTaxAmount,
GlobalEstimateBooking, GlobalEstimateBooking,
@ -113,7 +121,7 @@ import {
GlobalOverAllDiscSales, GlobalOverAllDiscSales,
ChangeOverAllDiscSales, ChangeOverAllDiscSales,
ChangeOverAllDiscEstimate, ChangeOverAllDiscEstimate,
getAllCustomer, // getAllCustomer,
GlobalBranchFinancialStatus, GlobalBranchFinancialStatus,
changeSummeryComboOfferAmount, changeSummeryComboOfferAmount,
ChangeComboCarddata, ChangeComboCarddata,
@ -124,13 +132,11 @@ import {
changeOtherServiceTicketClaim, changeOtherServiceTicketClaim,
GlobalRetailWSSalesType, GlobalRetailWSSalesType,
GlobalDefaultBookingType, GlobalDefaultBookingType,
GlobalComboOfferAmount,
GlobalPaymentTrigger, GlobalPaymentTrigger,
GlobalCurrentOrderId, GlobalCurrentOrderId,
changeCurrentOrderId, changeCurrentOrderId,
GlobalCombocarddata, GlobalCombocarddata,
getCreditCustomer, getCreditCustomer,
GlobalSummeryTotalItems,
GlobalSalesBillEdit, GlobalSalesBillEdit,
GlobalPreviousOrderPayment, GlobalPreviousOrderPayment,
GlobalPreviousOrderOfferDetails, GlobalPreviousOrderOfferDetails,
@ -140,17 +146,19 @@ import {
changeBillEditingMode, changeBillEditingMode,
changePreviousOrderPayment, changePreviousOrderPayment,
changePreviousOrderOfferDetail, changePreviousOrderOfferDetail,
GlobalAllBookingType,
} from '../../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../../Features/BookingScreen/BookingData/BookingData';
import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js'; import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js';
import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities'; import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities';
import BSCustomerSelect from '../../UtillComponents/BSSelectCustomer.jsx'; const BSCustomerSelect = lazy(
() => import('../../UtillComponents/BSSelectCustomer.jsx')
);
import { ChangeTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges.js'; import { ChangeTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges.js';
import { import {
gettinghold, gettinghold,
globalholddata, globalholddata,
changeholddata, changeholddata,
} from '../../../../../Features/BookingScreen/HoldOption/HoldOption'; } from '../../../../../Features/BookingScreen/HoldOption/HoldOption';
import PaymentPdfBooking from '../../../../paymentpdfPage/PaymentPdfBooking';
import { globalExtraTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges'; import { globalExtraTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges';
import { import {
getAddCustomerDetails, getAddCustomerDetails,
@ -160,18 +168,20 @@ import {
triggerCustomerRefresh, triggerCustomerRefresh,
} from '../../../../../Features/BookingScreen/Customer/addCustomer'; } from '../../../../../Features/BookingScreen/Customer/addCustomer';
import PozoHoldIcon from '../../UtillComponents/Pozo retail icons/PozoHoldIcon'; 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 PozoUnpaidIcon from '../../UtillComponents/Pozo retail icons/PozoUnpaidIcon.jsx';
import PozoBillIcon from '../../UtillComponents/Pozo retail icons/PozoBIllIcon.jsx'; import PozoBillIcon from '../../UtillComponents/Pozo retail icons/PozoBIllIcon.jsx';
import PozoAddCustomerIcon from '../../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx'; import PozoAddCustomerIcon from '../../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx';
import BsBillingCreditCustomer from '../../BookingFunctionality/BSBillingCreditCustomer.jsx'; const BSCreditCustomer = lazy(
import BSCreditCustomer from '../../UtillComponents/BSCreditCustomer.jsx'; () => import('../../UtillComponents/BSCreditCustomer.jsx')
);
import PozoAdvanceIcon from '../../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx'; import PozoAdvanceIcon from '../../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import MobilePrint from '../../BookingFunctionality/MobilePrint.jsx'; import MobilePrint from '../../BookingFunctionality/MobilePrint.jsx';
import CountUp from 'react-countup'; import CountUp from 'react-countup';
import SplitPayment from '../../BookingFunctionality/SplitPayment.jsx';
import { GlobalpreOrderOpen } from '../../../../../Features/BookingScreen/PreOrder/PreOrder.js'; import { GlobalpreOrderOpen } from '../../../../../Features/BookingScreen/PreOrder/PreOrder.js';
const SplitPayment = lazy(
() => import('../../BookingFunctionality/SplitPayment.jsx')
);
import TokensinglePrint from '../../../../paymentpdfPage/TokenOnlyPrints/TokeninsinglePrint.jsx'; import TokensinglePrint from '../../../../paymentpdfPage/TokenOnlyPrints/TokeninsinglePrint.jsx';
import SingleTokenMobilePrint from '../../BookingFunctionality/SingleTokenMobilePrint.jsx'; import SingleTokenMobilePrint from '../../BookingFunctionality/SingleTokenMobilePrint.jsx';
import IndividualTokenMobilePrint from '../../BookingFunctionality/IndividualTokenMobilePrint.jsx'; import IndividualTokenMobilePrint from '../../BookingFunctionality/IndividualTokenMobilePrint.jsx';
@ -180,7 +190,6 @@ import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js';
import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx'; import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx';
import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx'; import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx';
import { Global_OverallOfferAmount } from '../../../../../Features/Offer/Offer.js'; import { Global_OverallOfferAmount } from '../../../../../Features/Offer/Offer.js';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip'; import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip';
import { useAuth } from '../../../../../AuthContext.jsx'; import { useAuth } from '../../../../../AuthContext.jsx';
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTables3/BSBillingTable3.scss'; import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTables3/BSBillingTable3.scss';
@ -189,45 +198,65 @@ import {
changeSalesPaymentoption, changeSalesPaymentoption,
GlobalSalesPaymentoption, GlobalSalesPaymentoption,
} from '../../../../../Features/Payment/Paymentoptions/Paymentoptions.js'; } from '../../../../../Features/Payment/Paymentoptions/Paymentoptions.js';
import Paymentoption from '../../../../Payment/PaymentOptions/PaymentOptions.jsx';
import { getPaymentOptionsData } from '../../../../../Features/BookingScreen/BookingData/KioskBookingData.js'; import { getPaymentOptionsData } from '../../../../../Features/BookingScreen/BookingData/KioskBookingData.js';
import { getCombolist } from '../../../../../Features/ComboMaster/ComboMaster.js'; import { getCombolist } from '../../../../../Features/ComboMaster/ComboMaster.js';
import SMSShare from '../../../../WhatsAppShare/SmsShare.jsx';
import WhatsAppShare from '../../../../WhatsAppShare/whatsAppShare.jsx';
import { MdSms } from 'react-icons/md'; import { MdSms } from 'react-icons/md';
import { FaWhatsapp, FaPrint, FaCartPlus } from 'react-icons/fa'; import { FaWhatsapp, FaPrint, FaCartPlus } from 'react-icons/fa';
import BSTipAmount from '../../UtillComponents/BSTipAmount.jsx';
import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js'; import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js';
import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js'; import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js';
import { TfiClipboard } from 'react-icons/tfi'; import { TfiClipboard } from 'react-icons/tfi';
import OtherServicePrintStyle1 from '../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx';
import OtherServiceMobilePrint from '../../BookingFunctionality/OtherServiceMobilePrint.jsx'; import OtherServiceMobilePrint from '../../BookingFunctionality/OtherServiceMobilePrint.jsx';
import BSOtherServiceClaim from '../../UtillComponents/BSOtherServiceClaim.jsx'; const BSOtherServiceClaim = lazy(
import { MobilePdfPrint } from '../../BookingFunctionality/MobilePdfPrint.js'; () => import('../../UtillComponents/BSOtherServiceClaim.jsx')
);
import { PublicQrCodepost } from '../../../../../Features/ConfigMasterPage/ConfigMasterPage.js'; import { PublicQrCodepost } from '../../../../../Features/ConfigMasterPage/ConfigMasterPage.js';
import {
ChangeFreeProductList,
ChangeFullFreeProductList,
changeFullOfferAppliedProducts,
changeLoyaltyConsumedQuantities,
GlobalFreeProdList,
GlobalOfferAppliedProducts,
GlobalOverAllOfferAmt,
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import CardPopover from '../StandardTable/Utils/CardPopover.jsx'; import CardPopover from '../StandardTable/Utils/CardPopover.jsx';
import UpiPopover from '../StandardTable/Utils/UpiPopOver.jsx'; import UpiPopover from '../StandardTable/Utils/UpiPopOver.jsx';
import PaymentGatewayEmbedded from '../../UtillComponents/PaymentGatewayEmbedded.jsx';
import MobileMultiPdfPrintTrigger from '../../UtillComponents/MobileMultiPdfPrintTrigger.jsx'; import MobileMultiPdfPrintTrigger from '../../UtillComponents/MobileMultiPdfPrintTrigger.jsx';
import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js'; import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js';
import CustomerOrders from '../../BookingFunctionality/CustomerOrders.jsx'; const PaymentGatewayEmbedded = lazy(
() => import('../../UtillComponents/PaymentGatewayEmbedded.jsx')
);
const CustomerOrders = lazy(
() => import('../../BookingFunctionality/CustomerOrders.jsx')
);
// jsx File
const QrComponent = lazy(
() => import('../../BookingFunctionality/DynamicQr.jsx')
);
const QrinScreen = lazy(
() => import('../../BookingFunctionality/DynamicScreenQr.jsx')
);
const PaymentPdfBooking = lazy(
() => import('../../../../paymentpdfPage/PaymentPdfBooking')
);
const PozoDineInIcon = lazy(
() => import('../../UtillComponents/Pozo retail icons/PozoDineIn.jsx')
);
const BsBillingCreditCustomer = lazy(
() => import('../../BookingFunctionality/BSBillingCreditCustomer.jsx')
);
const Paymentoption = lazy(
() => import('../../../../Payment/PaymentOptions/PaymentOptions.jsx')
);
const SMSShare = lazy(() => import('../../../../WhatsAppShare/SmsShare.jsx'));
const WhatsAppShare = lazy(
() => import('../../../../WhatsAppShare/whatsAppShare.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 subDirectory = import.meta.env.ENV_BASE_URL;
const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL; const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss'); const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
const RetailApiurl = import.meta.env.ENV_API_URL;
const BSBillingTable3Pay = () => { const BSBillingTable3Pay = () => {
const isF4Pressed = useRef(false); const isF4Pressed = useRef(false);
const applyOffer = useApplyOfferto_CardDetail(); const AllBookingType = useSelector(GlobalAllBookingType);
const { SadminuserAccess } = useAuth(); const { SadminuserAccess } = useAuth();
let SAAccessCommonMaster = SadminuserAccess?.find( let SAAccessCommonMaster = SadminuserAccess?.find(
(e) => e?.MenuName === 'Sales' (e) => e?.MenuName === 'Sales'
@ -236,7 +265,9 @@ const BSBillingTable3Pay = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const salesBillEdit = useSelector(GlobalSalesBillEdit); const salesBillEdit = useSelector(GlobalSalesBillEdit);
const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); const previousOrderOfferDetails = useSelector(
GlobalPreviousOrderOfferDetails
);
const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
const FreeProdList = useSelector(GlobalFreeProdList); const FreeProdList = useSelector(GlobalFreeProdList);
const offerAppliedProducts = useSelector( const offerAppliedProducts = useSelector(
@ -289,15 +320,10 @@ const BSBillingTable3Pay = () => {
const ProdSubCat = useSelector(GlobalProductSubCategorie); const ProdSubCat = useSelector(GlobalProductSubCategorie);
const BSLayoutData = useSelector(getTemplateData); const BSLayoutData = useSelector(getTemplateData);
const Combodata = useSelector(GlobalCombocarddata, shallowEqual); const Combodata = useSelector(GlobalCombocarddata, shallowEqual);
const OfferCheckedInSetup = BSLayoutData?.BookingNavbar?.[1].some(
(item) => item?.OptionName == 'Offer'
);
const Custdisable = useSelector(GlobalSelectedCustDisable); const Custdisable = useSelector(GlobalSelectedCustDisable);
const SettingDataSelector = useSelector(PreferenceData); const SettingDataSelector = useSelector(PreferenceData);
const preferenceOffer =
SettingDataSelector?.[0]?.['SettingDtlDetails']?.find(
(item) => item.SettingIdName === 'Offer'
)?.SettingValue === 'Y';
const allowDecimal = SettingDataSelector?.[0]?.SettingDtlDetails?.find( const allowDecimal = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
(setting) => (setting) =>
setting?.SettingIdName?.toLowerCase() === 'decimal' && setting?.SettingIdName?.toLowerCase() === 'decimal' &&
@ -316,10 +342,7 @@ const BSBillingTable3Pay = () => {
const preOrder = useSelector(GlobalpreOrderOpen); const preOrder = useSelector(GlobalpreOrderOpen);
const OrderType = useSelector(GlobalOrderType); const OrderType = useSelector(GlobalOrderType);
const FailedTotalAmt = useSelector(GlobalFailedTotalAmt); const FailedTotalAmt = useSelector(GlobalFailedTotalAmt);
const OrderOfferDetail = useSelector(
GlobalOfferAppliedProducts,
shallowEqual
);
const tabledata = useSelector(GlobalUnpaidListData); const tabledata = useSelector(GlobalUnpaidListData);
const GlobalSalesPaymentoptions = useSelector(GlobalSalesPaymentoption); const GlobalSalesPaymentoptions = useSelector(GlobalSalesPaymentoption);
@ -402,6 +425,10 @@ const BSBillingTable3Pay = () => {
const [Splitpayment, setSplitpayment] = useState(false); const [Splitpayment, setSplitpayment] = useState(false);
const [urlData, setUrlData] = useState(); const [urlData, setUrlData] = useState();
const holdCheckedSalesSetup = tableOptions?.some(
(item) => item?.OptionName === 'Hold'
);
const PaymentOptionsModeName = const PaymentOptionsModeName =
PaymentOptions?.find((e) => e.ModeDefault?.toUpperCase() === 'Y') PaymentOptions?.find((e) => e.ModeDefault?.toUpperCase() === 'Y')
?.ModeName || PaymentOptions?.[0]?.ModeName; ?.ModeName || PaymentOptions?.[0]?.ModeName;
@ -589,14 +616,21 @@ const BSBillingTable3Pay = () => {
const filteredPayments = const filteredPayments =
previousOrderPayment?.filter( previousOrderPayment?.filter(
p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment (p) =>
p?.LastOrderTran === 'Y' &&
p?.AfterAdjustment != null &&
p?.AfterAdjustment !== '' &&
p?.AfterAdjustment
) || []; ) || [];
const paymentsToUse = const paymentsToUse =
filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; filteredPayments.length > 0
? filteredPayments
: previousOrderPayment || [];
const totalPreviouspayment = paymentsToUse?.reduce( const totalPreviouspayment = paymentsToUse?.reduce(
(acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), (acc, payment) =>
acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
0 0
); );
@ -605,8 +639,7 @@ const BSBillingTable3Pay = () => {
0 0
); );
const previousNetAmount = const previousNetAmount = totalPreviouspayment || 0;
(totalPreviouspayment) || 0;
let withdiscTotal = let withdiscTotal =
Total - Total -
@ -618,12 +651,26 @@ const BSBillingTable3Pay = () => {
withdiscTotal >= 0 withdiscTotal >= 0
? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2)
: (Number(Total) + Number(globalTipAmount)).toFixed(2) : (Number(Total) + Number(globalTipAmount)).toFixed(2)
) );
setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); setTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
);
setCurrentOrderNetAmount(currentOrderNetAmount); setCurrentOrderNetAmount(currentOrderNetAmount);
setPreviousNetAmount(previousNetAmount); setPreviousNetAmount(previousNetAmount);
dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(
changeSummeryTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
)
);
dispatch(changeSummeryComboOfferAmount(withComboSum)); dispatch(changeSummeryComboOfferAmount(withComboSum));
@ -653,8 +700,8 @@ const BSBillingTable3Pay = () => {
UserId: UserId, UserId: UserId,
}; };
dispatch(getPrinterMappingDetails(data)).unwrap(); dispatch(getPrinterMappingDetails(data)).unwrap();
const Data1 = { AppId, CompId, BranchId }; // const Data1 = { AppId, CompId, BranchId };
dispatch(getPrintSelectionComponentData(Data1)).unwrap(); // dispatch(getPrintSelectionComponentData(Data1)).unwrap();
}, []); }, []);
useEffect(() => { useEffect(() => {
@ -711,8 +758,11 @@ const BSBillingTable3Pay = () => {
}; };
useEffect(() => { useEffect(() => {
if (CompId && BranchId && AppId) { if (CompId && BranchId && AppId) {
if (holdCheckedSalesSetup) {
getHolddata(); getHolddata();
getUnpaiddatas(); }
// getUnpaiddatas();
getCustomerData(); getCustomerData();
} }
}, [CompId, BranchId, AppId]); }, [CompId, BranchId, AppId]);
@ -739,7 +789,6 @@ const BSBillingTable3Pay = () => {
}, [salesBillEdit]); }, [salesBillEdit]);
useEffect(() => { useEffect(() => {
if (salesBillEdit) { if (salesBillEdit) {
if (SelCustId) { if (SelCustId) {
setRefundPayBtns(AllPaymentOptions); setRefundPayBtns(AllPaymentOptions);
@ -754,8 +803,7 @@ const BSBillingTable3Pay = () => {
setRefundPayBtns(withoutCustomer); setRefundPayBtns(withoutCustomer);
} }
} }
}, [AllPaymentOptions, SelCustId, salesBillEdit]);
}, [AllPaymentOptions, SelCustId, salesBillEdit])
useEffect(() => { useEffect(() => {
if (UserType === 'Employee') { if (UserType === 'Employee') {
@ -777,29 +825,6 @@ const BSBillingTable3Pay = () => {
setaddnewAccess(!hasAccess); setaddnewAccess(!hasAccess);
}, [empData, SAAccessCommonMaster, UserType]); }, [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 () => { const fetchApi = async () => {
let data = { let data = {
CompId: CompId, CompId: CompId,
@ -815,9 +840,9 @@ const BSBillingTable3Pay = () => {
}; };
const getCustomerData = async () => { const getCustomerData = async () => {
await dispatch( // await dispatch(
getAllCustomer({ CompId: CompId, AppId: AppId, branchId: BranchId }) // getAllCustomer({ CompId: CompId, AppId: AppId, branchId: BranchId })
); // );
await dispatch( await dispatch(
getAddCustomerDetails({ getAddCustomerDetails({
CompId: CompId, CompId: CompId,
@ -1044,8 +1069,10 @@ const BSBillingTable3Pay = () => {
setDefaultPaymentMode([]); setDefaultPaymentMode([]);
} }
}; };
if (salesBillEdit) {
setDefaultPaymentOption(); setDefaultPaymentOption();
}, [defaultPaymentTrigger]); }
}, [defaultPaymentTrigger, salesBillEdit]);
const TokenPrint = async (index) => { const TokenPrint = async (index) => {
try { try {
@ -1488,7 +1515,11 @@ const BSBillingTable3Pay = () => {
const handleButtonClick = () => { const handleButtonClick = () => {
if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) {
UpiPayment(); UpiPayment();
} else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { } else if (
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
!refundPaySelected
) {
setMessageType('warning'); setMessageType('warning');
setMessageData('Please Select Refund Payment Method'); setMessageData('Please Select Refund Payment Method');
return; return;
@ -1700,20 +1731,12 @@ const BSBillingTable3Pay = () => {
}; };
const getBookingTypeId = async () => { const getBookingTypeId = async () => {
let tempconfigdata = await dispatch( setConfigDataList(AllBookingType);
getConfigType({ TypeName: 'Booking Type' }) let configdata = AllBookingType;
).unwrap();
if (tempconfigdata?.data?.statusCode == 1) {
setConfigDataList(tempconfigdata?.data?.data);
let configdata = tempconfigdata?.data?.data;
let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType; let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType;
let filterconfigdata = configdata?.find( let filterconfigdata = configdata?.find((a) => a?.ConfigName === checkName);
(a) => a?.ConfigName === checkName
);
setSelectedBookingType(filterconfigdata?.ConfigId); setSelectedBookingType(filterconfigdata?.ConfigId);
}
}; };
const gettodaydate = () => { const gettodaydate = () => {
@ -1776,7 +1799,7 @@ const BSBillingTable3Pay = () => {
const handleRefundPaymentMode = (id, name) => { const handleRefundPaymentMode = (id, name) => {
setRefundPaySelected(id); setRefundPaySelected(id);
setRefundPaySelectedName(name); setRefundPaySelectedName(name);
} };
const addUpiOption = async (id, name, UPIId) => { const addUpiOption = async (id, name, UPIId) => {
await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDprint(UPIId));
@ -1865,14 +1888,6 @@ const BSBillingTable3Pay = () => {
setUpiOptionOpen(false); setUpiOptionOpen(false);
}; };
const handlePopoverVisibleChange = (visible) => {
setUpiOptionOpen(visible);
};
const handlePopoverVisibleChangeCard = (visible) => {
setCardOptionOpen(visible);
};
const ProductSummary = (salesData) => { const ProductSummary = (salesData) => {
const productMap = new Map(); const productMap = new Map();
@ -2006,7 +2021,9 @@ const BSBillingTable3Pay = () => {
setCurrentOrderNetAmount(0); setCurrentOrderNetAmount(0);
setPreviousNetAmount(0); setPreviousNetAmount(0);
setUpinotSelected(false); setUpinotSelected(false);
if (holdCheckedSalesSetup) {
getHolddata(); getHolddata();
}
if (defaultBookingType === 'Both') { if (defaultBookingType === 'Both') {
await dispatch(changeBookingType('TakeAway')); await dispatch(changeBookingType('TakeAway'));
} }
@ -2318,8 +2335,10 @@ const BSBillingTable3Pay = () => {
SalesPaymentType: 'normal', SalesPaymentType: 'normal',
PaymentDetail: [ PaymentDetail: [
{ {
PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : PaymentType:
Paybtnnameselected?.toLowerCase() === 'upi' salesBillEdit && currentOrderNetAmount < previousNetAmount
? refundPaySelected
: Paybtnnameselected?.toLowerCase() === 'upi'
? SelectedUPIPayOption?.toLowerCase() === 'pd' ? SelectedUPIPayOption?.toLowerCase() === 'pd'
? PaymentDeviceUPI?.[0]?.ModeId ? PaymentDeviceUPI?.[0]?.ModeId
: SelectedUPIPayOption?.toLowerCase() === 'pg' : SelectedUPIPayOption?.toLowerCase() === 'pg'
@ -2332,15 +2351,25 @@ const BSBillingTable3Pay = () => {
: paybtnselected : paybtnselected
? paybtnselected ? paybtnselected
: null, : null,
Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), Amount:
MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : salesBillEdit && currentOrderNetAmount < previousNetAmount
Paybtnnameselected?.toLowerCase() === 'upi' && ? previousNetAmount - currentOrderNetAmount
: Math.round(TotalAmount),
MerchantId:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'business' SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantId ?.MerchantId
: null, : null,
PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : PaymentOptionType:
Paybtnnameselected?.toLowerCase() === 'cash' salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'PC' ? 'PC'
: Paybtnnameselected?.toLowerCase() === 'credit' : Paybtnnameselected?.toLowerCase() === 'credit'
? 'PC' ? 'PC'
@ -2353,16 +2382,21 @@ const BSBillingTable3Pay = () => {
? 'BU' ? 'BU'
: SelectedUPIPayOption : SelectedUPIPayOption
: null, : null,
ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : ModeOfPayment:
SelectedUPIPayOption?.toLowerCase() === 'default' salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: SelectedUPIPayOption?.toLowerCase() === 'default'
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
?.UPIDetailId ?.UPIDetailId
: SelectedUPIPayOption?.toLowerCase() === 'business' : SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ? BusinessPayOption?.find(
?.MerchantUPIId (busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
: null, : null,
AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : AccountDtl:
Paybtnnameselected?.toLowerCase() === 'upi' && salesBillEdit && currentOrderNetAmount < previousNetAmount
? []
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default' SelectedUPIPayOption?.toLowerCase() === 'default'
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
(upipay) => upipay?.UPIId === UpiId (upipay) => upipay?.UPIId === UpiId
@ -2378,8 +2412,10 @@ const BSBillingTable3Pay = () => {
SelectedCardOption?.toLowerCase() === 'pg') SelectedCardOption?.toLowerCase() === 'pg')
? useOptions?.[0]?.PaymentDetails?.PaymentGateway ? useOptions?.[0]?.PaymentDetails?.PaymentGateway
: [], : [],
PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : PaymentStatus:
Paybtnnameselected?.toLowerCase() === 'cash' salesBillEdit && currentOrderNetAmount < previousNetAmount
? 'S'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'S' ? 'S'
: Paybtnnameselected?.toLowerCase() === 'credit' : Paybtnnameselected?.toLowerCase() === 'credit'
? 'S' ? 'S'
@ -2387,9 +2423,18 @@ const BSBillingTable3Pay = () => {
SelectedUPIPayOption?.toLowerCase() === 'default' SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S' ? 'S'
: 'P', : 'P',
Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, Debit:
Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && Paybtnnameselected?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
? Math.round(previousNetAmount - currentOrderNetAmount)
: 0,
Credit: salesBillEdit
? currentOrderNetAmount > previousNetAmount &&
Paybtnnameselected?.toLowerCase() === 'credit' Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount)
: 0
: Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount) ? Math.round(TotalAmount)
: 0, : 0,
}, },
@ -3540,6 +3585,7 @@ const BSBillingTable3Pay = () => {
); );
}; };
return ( return (
<Suspense fallback={<div>Suspense Loading...</div>}>
<> <>
<div className="BSBilling3div"> <div className="BSBilling3div">
{screenwidth <= 768 && ( {screenwidth <= 768 && (
@ -3551,9 +3597,8 @@ const BSBillingTable3Pay = () => {
maxHeight: responsiveBill ? '180px' : '0px', maxHeight: responsiveBill ? '180px' : '0px',
}} }}
> >
{Array.isArray(OrderCardDetail) && OrderCardDetail?.length >= 1 && ( {Array.isArray(OrderCardDetail) &&
<BSBillingTable3 /> OrderCardDetail?.length >= 1 && <BSBillingTable3 />}
)}
</div> </div>
)} )}
@ -3660,7 +3705,8 @@ const BSBillingTable3Pay = () => {
onClick={CreditCustomerFun} onClick={CreditCustomerFun}
style={{ style={{
cursor: cursor:
OrderCardDetail?.length > 0 && 'not-allowed', OrderCardDetail?.length > 0 &&
'not-allowed',
color: color:
OrderCardDetail?.length > 0 || OrderCardDetail?.length > 0 ||
(selOption?.value === undefined && (selOption?.value === undefined &&
@ -3742,7 +3788,6 @@ const BSBillingTable3Pay = () => {
)} )}
{/* Customer Orders */} {/* Customer Orders */}
{GetCustId && ( {GetCustId && (
<Tooltip title="Customer Orders" isMobile={isMobile}> <Tooltip title="Customer Orders" isMobile={isMobile}>
{' '} {' '}
<div <div
@ -4043,7 +4088,8 @@ const BSBillingTable3Pay = () => {
: 1, : 1,
}} }}
> >
{paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( {paybtns?.length > 0 &&
currentOrderNetAmount >= previousNetAmount ? (
paybtns?.map((payment) => ( paybtns?.map((payment) => (
<div className="Table3-cash"> <div className="Table3-cash">
<button <button
@ -4124,7 +4170,9 @@ const BSBillingTable3Pay = () => {
</button> </button>
</div> </div>
)) ))
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( ) : currentOrderNetAmount < previousNetAmount &&
salesBillEdit &&
refundPayBtns.length > 0 ? (
refundPayBtns.map((payment) => ( refundPayBtns.map((payment) => (
<div className="Table3-cash"> <div className="Table3-cash">
<button <button
@ -4144,7 +4192,12 @@ const BSBillingTable3Pay = () => {
? 'blink-animation 0.5s infinite alternate' ? 'blink-animation 0.5s infinite alternate'
: 'none', : 'none',
}} }}
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)} onClick={() =>
handleRefundPaymentMode(
payment?.ConfigId,
payment?.ConfigName
)
}
> >
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */} {/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
@ -4286,7 +4339,9 @@ const BSBillingTable3Pay = () => {
<BSOtherServiceClaim /> <BSOtherServiceClaim />
</div> </div>
)} )}
<div style={{ display: 'flex', alignItems: 'center', gap: '6px' }}> <div
style={{ display: 'flex', alignItems: 'center', gap: '6px' }}
>
{!OtherServicesglobal && unpaidFlow == true ? ( {!OtherServicesglobal && unpaidFlow == true ? (
<TooltipWrapper title={'Print Bill'} isMobile={isMobile}> <TooltipWrapper title={'Print Bill'} isMobile={isMobile}>
{' '} {' '}
@ -4401,8 +4456,10 @@ const BSBillingTable3Pay = () => {
OrderCardDetail?.length > 0 && OrderCardDetail?.length > 0 &&
paybtnselected && paybtnselected &&
CheckBookingStatus != 'Close' CheckBookingStatus != 'Close'
? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? ? !OrderStatus
'BSBillingTable3-paybtn' ? salesBillEdit &&
currentOrderNetAmount < previousNetAmount
? 'BSBillingTable3-paybtn'
: 'BSBillingTable3-paybtn' : 'BSBillingTable3-paybtn'
: 'BSBillingTable3-paybtn Order' : 'BSBillingTable3-paybtn Order'
: 'BSBillingTable3-paybtn-deactive' : 'BSBillingTable3-paybtn-deactive'
@ -4418,7 +4475,13 @@ const BSBillingTable3Pay = () => {
} }
//dhana //dhana
> >
{!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? <p className="Table4-Order">Refund: {(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</p> : ( {!OrderStatus ? (
salesBillEdit && currentOrderNetAmount < previousNetAmount ? (
<p className="Table4-Order">
Refund:
{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
</p>
) : (
<> <>
<p style={{ fontFamily: FontFamily['head'] }}> <p style={{ fontFamily: FontFamily['head'] }}>
{' '} {' '}
@ -4452,6 +4515,7 @@ const BSBillingTable3Pay = () => {
<BiRightArrowAlt /> <BiRightArrowAlt />
</div> </div>
</> </>
)
) : ( ) : (
<div>ORDER</div> <div>ORDER</div>
)} )}
@ -4532,7 +4596,8 @@ const BSBillingTable3Pay = () => {
/> />
)} )}
{PrintOrderDetails?.length > 0 && {PrintOrderDetails?.length > 0 &&
PrintOrderDetails?.[0]?.OrderDetails?.map((orderDetail, index) => ( PrintOrderDetails?.[0]?.OrderDetails?.map(
(orderDetail, index) => (
<div style={{ display: 'none' }}> <div style={{ display: 'none' }}>
<PaymentPdfBooking <PaymentPdfBooking
index={index} index={index}
@ -4551,11 +4616,13 @@ const BSBillingTable3Pay = () => {
printDatas={printDatas} printDatas={printDatas}
/> />
</div> </div>
))} )
)}
{PrintOrderDetails?.length > 0 && {PrintOrderDetails?.length > 0 &&
(TokenOnly?.SettingValue === 'Y' || (TokenOnly?.SettingValue === 'Y' ||
IndividualToken?.SettingValue === 'Y') && IndividualToken?.SettingValue === 'Y') &&
PrintOrderDetails?.[0]?.OrderDetails?.map((orderDetail, index) => ( PrintOrderDetails?.[0]?.OrderDetails?.map(
(orderDetail, index) => (
<div style={{ display: 'none' }}> <div style={{ display: 'none' }}>
<TokensinglePrint <TokensinglePrint
index={index} index={index}
@ -4572,7 +4639,8 @@ const BSBillingTable3Pay = () => {
PaymentStatus={PrintOrderDetails?.[0]?.PaymentOrderDtl} PaymentStatus={PrintOrderDetails?.[0]?.PaymentOrderDtl}
/> />
</div> </div>
))} )
)}
{CreditCustomer && ( {CreditCustomer && (
<div style={{ display: 'none' }}> <div style={{ display: 'none' }}>
<BsBillingCreditCustomer <BsBillingCreditCustomer
@ -4615,9 +4683,10 @@ const BSBillingTable3Pay = () => {
children={ children={
<> <>
<div> <div>
You have already selected a table. If you click 'OK,' the table You have already selected a table. If you click 'OK,' the
selection will be removed, and the unpaid flow will continue. If table selection will be removed, and the unpaid flow will
you click 'Cancel,' the dine-in flow will proceed as selected. continue. If you click 'Cancel,' the dine-in flow will proceed
as selected.
</div> </div>
</> </>
} }
@ -4630,10 +4699,17 @@ const BSBillingTable3Pay = () => {
SplitPaymentModal={Splitpayment} SplitPaymentModal={Splitpayment}
handlesplitpaymentclose={handlesplitpaymentclose} handlesplitpaymentclose={handlesplitpaymentclose}
TotalNetAmount={ TotalNetAmount={
OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - OrderType === 'Failed'
? FailedTotalAmt
: Math.round(
OrderCardDetail?.reduce(
(acc, data) => data?.TotalAmt + acc,
0
) -
((OverAllSales > 0 ? OverAllSales : 0) + ((OverAllSales > 0 ? OverAllSales : 0) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) + (OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0))) (Discount > 0 ? Discount : 0))
)
} }
failedOrderData={failedOrderData} failedOrderData={failedOrderData}
/> />
@ -4660,10 +4736,8 @@ const BSBillingTable3Pay = () => {
{ {
OtherServicesPrintDetails?.length > 0 && ( OtherServicesPrintDetails?.length > 0 && (
// PrintOrderDetails?.[0]?.OrderDetails?.map((orderDetail, index) => (
<div style={{ display: 'none' }}> <div style={{ display: 'none' }}>
<OtherServicePrintStyle1 <OtherServicePrintStyle1
// index={index}
table2Data={OtherServicesPrintDetails} table2Data={OtherServicesPrintDetails}
singleData2={OtherServicesPrintDetails?.productDetails} singleData2={OtherServicesPrintDetails?.productDetails}
orderId={ orderId={
@ -4690,7 +4764,6 @@ const BSBillingTable3Pay = () => {
handleCancel={() => { handleCancel={() => {
setOtherServicesModal(false); setOtherServicesModal(false);
}} }}
// handleSubmit={Handlevehiclenumbers}
footer={false} footer={false}
children={ children={
<div <div
@ -4757,7 +4830,9 @@ const BSBillingTable3Pay = () => {
width: '100%', width: '100%',
padding: 8, padding: 8,
borderRadius: 4, borderRadius: 4,
border: error ? '1px solid red' : '1px solid #ccc', border: error
? '1px solid red'
: '1px solid #ccc',
}} }}
/> />
{error && ( {error && (
@ -4847,6 +4922,7 @@ const BSBillingTable3Pay = () => {
/> />
)} )}
</> </>
</Suspense>
); );
}; };

View File

@ -1,19 +1,28 @@
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef, lazy, Suspense } from 'react';
import { shallowEqual, useDispatch, useSelector } from 'react-redux'; import { shallowEqual, useDispatch, useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import moment from 'moment'; import moment from 'moment';
import { Badge, Modal, Popover, Tooltip } from 'antd'; import { Badge, Modal, Popover, Tooltip } from 'antd';
import { BiRightArrowAlt } from 'react-icons/bi'; import { BiRightArrowAlt } from 'react-icons/bi';
import { AiOutlineClose } from 'react-icons/ai'; import { AiOutlineClose } from 'react-icons/ai';
import BSSummery from '../BSBillingTableSummery/BSSummery';
import BSBillingTable4 from './BSBillingTable4'; import BSBillingTable4 from './BSBillingTable4';
import { UpCircleOutlined, UpOutlined } from '@ant-design/icons'; import { UpCircleOutlined } from '@ant-design/icons';
import QrComponent from '../../BookingFunctionality/DynamicQr.jsx'; const BSSummery = lazy(() => import('../BSBillingTableSummery/BSSummery'));
import QrinScreen from '../../BookingFunctionality/DynamicScreenQr.jsx';
const QrComponent = lazy(
() => import('../../BookingFunctionality/DynamicQr.jsx')
);
const QrinScreen = lazy(
() => import('../../BookingFunctionality/DynamicScreenQr.jsx')
);
import { ArrowRightOutlined } from '@ant-design/icons'; import { ArrowRightOutlined } from '@ant-design/icons';
import Buttons from '../../../../../Components/Forms/Buttons'; import Buttons from '../../../../../Components/Forms/Buttons';
import WpIcon from '../../../../../Images/message.png'; import WpIcon from '../../../../../Images/message.png';
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4.scss'; 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 { import {
GlobalSelectedFont, GlobalSelectedFont,
getTemplateData, getTemplateData,
@ -22,11 +31,17 @@ import {
GlobalprintDatas, GlobalprintDatas,
GlobalPrinterMappingDtls, GlobalPrinterMappingDtls,
getPrinterMappingDetails, getPrinterMappingDetails,
getPrintSelectionComponentData, // getPrintSelectionComponentData,
} from '../../../../../Features/ThemeChange/ThemeChange'; } from '../../../../../Features/ThemeChange/ThemeChange';
import SplitPayment from '../../BookingFunctionality/SplitPayment.jsx';
import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js'; import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js';
import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities';
const SplitPayment = lazy(
() => import('../../BookingFunctionality/SplitPayment.jsx')
);
const FeaturesFunctionalities = lazy(
() => import('../../BookingFunctionality/FeaturesFunctionalities')
);
import { import {
ChangeNavHoldData, ChangeNavHoldData,
GlobalBookingType, GlobalBookingType,
@ -162,10 +177,18 @@ import PozoHoldIcon from '../../UtillComponents/Pozo retail icons/PozoHoldIcon';
import PozoDineInIcon from '../../UtillComponents/Pozo retail icons/PozoDineIn.jsx'; import PozoDineInIcon from '../../UtillComponents/Pozo retail icons/PozoDineIn.jsx';
import PozoUnpaidIcon from '../../UtillComponents/Pozo retail icons/PozoUnpaidIcon.jsx'; import PozoUnpaidIcon from '../../UtillComponents/Pozo retail icons/PozoUnpaidIcon.jsx';
import PozoBillIcon from '../../UtillComponents/Pozo retail icons/PozoBIllIcon.jsx'; import PozoBillIcon from '../../UtillComponents/Pozo retail icons/PozoBIllIcon.jsx';
import PozoAddCustomerIcon from '../../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx'; const PozoAddCustomerIcon = lazy(
import BsBillingCreditCustomer from '../../BookingFunctionality/BSBillingCreditCustomer.jsx'; () =>
import('../../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx')
);
const BsBillingCreditCustomer = lazy(
() => import('../../BookingFunctionality/BSBillingCreditCustomer.jsx')
);
import PozoAdvanceIcon from '../../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx'; import PozoAdvanceIcon from '../../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx';
import BSCreditCustomer from '../../UtillComponents/BSCreditCustomer.jsx'; const BSCreditCustomer = lazy(
() => import('../../UtillComponents/BSCreditCustomer.jsx')
);
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import MobilePrint from '../../BookingFunctionality/MobilePrint.jsx'; import MobilePrint from '../../BookingFunctionality/MobilePrint.jsx';
import CountUp from 'react-countup'; import CountUp from 'react-countup';
@ -178,13 +201,9 @@ import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js';
import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx'; import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx';
import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx'; import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx';
import { import {
Global_CoupenCodeAmount,
Global_loyaltyPointsDiscountAmount,
Global_OrderOfferDetail, Global_OrderOfferDetail,
Global_OverallOfferAmount, Global_OverallOfferAmount,
Global_SalesWiseOfferAmount,
} from '../../../../../Features/Offer/Offer.js'; } from '../../../../../Features/Offer/Offer.js';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip'; import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip';
import { useAuth } from '../../../../../AuthContext.jsx'; import { useAuth } from '../../../../../AuthContext.jsx';
import { GlobalBookingStatus } from '../../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js'; import { GlobalBookingStatus } from '../../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js';
@ -192,24 +211,24 @@ import {
changeSalesPaymentoption, changeSalesPaymentoption,
GlobalSalesPaymentoption, GlobalSalesPaymentoption,
} from '../../../../../Features/Payment/Paymentoptions/Paymentoptions.js'; } from '../../../../../Features/Payment/Paymentoptions/Paymentoptions.js';
import Paymentoption from '../../../../Payment/PaymentOptions/PaymentOptions.jsx'; const Paymentoption = lazy(
() => import('../../../../Payment/PaymentOptions/PaymentOptions.jsx')
);
import { getPaymentOptionsData } from '../../../../../Features/BookingScreen/BookingData/KioskBookingData.js'; import { getPaymentOptionsData } from '../../../../../Features/BookingScreen/BookingData/KioskBookingData.js';
import { getCombolist } from '../../../../../Features/ComboMaster/ComboMaster.js'; import { getCombolist } from '../../../../../Features/ComboMaster/ComboMaster.js';
import WhatsAppShare from '../../../../WhatsAppShare/whatsAppShare.jsx'; const WhatsAppShare = lazy(
import SMSShare from '../../../../WhatsAppShare/SmsShare.jsx'; () => import('../../../../WhatsAppShare/whatsAppShare.jsx')
);
const SMSShare = lazy(() => import('../../../../WhatsAppShare/SmsShare.jsx'));
import { MdSms } from 'react-icons/md'; import { MdSms } from 'react-icons/md';
import { FaWhatsapp, FaPrint, FaCartPlus } from 'react-icons/fa'; import { FaWhatsapp, FaPrint, FaCartPlus } from 'react-icons/fa';
import BSTipAmount from '../../UtillComponents/BSTipAmount.jsx'; const BSTipAmount = lazy(() => import('../../UtillComponents/BSTipAmount.jsx'));
import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js'; import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js';
import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js'; import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js';
import { TfiClipboard } from 'react-icons/tfi'; import { TfiClipboard } from 'react-icons/tfi';
import OtherServicePrintStyle1 from '../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx';
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 { PublicQrCodepost } from '../../../../../Features/ConfigMasterPage/ConfigMasterPage.js';
import { import {
ChangeFreeProductList,
ChangeFullFreeProductList, ChangeFullFreeProductList,
changeFullOfferAppliedProducts, changeFullOfferAppliedProducts,
changeLoyaltyConsumedQuantities, changeLoyaltyConsumedQuantities,
@ -220,15 +239,27 @@ import {
import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js'; import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js';
import UpiPopover from '../StandardTable/Utils/UpiPopOver.jsx'; import UpiPopover from '../StandardTable/Utils/UpiPopOver.jsx';
import CardPopover from '../StandardTable/Utils/CardPopover.jsx'; import CardPopover from '../StandardTable/Utils/CardPopover.jsx';
import PaymentGatewayEmbedded from '../../UtillComponents/PaymentGatewayEmbedded.jsx';
import pozologoimg from '../../../../../Images/pozologoimg.png'; import pozologoimg from '../../../../../Images/pozologoimg.png';
import MobileMultiPdfPrintTrigger from '../../UtillComponents/MobileMultiPdfPrintTrigger.jsx'; import MobileMultiPdfPrintTrigger from '../../UtillComponents/MobileMultiPdfPrintTrigger.jsx';
import CustomerOrders from '../../BookingFunctionality/CustomerOrders.jsx'; const PaymentGatewayEmbedded = lazy(
() => import('../../UtillComponents/PaymentGatewayEmbedded.jsx')
);
const CustomerOrders = lazy(
() => import('../../BookingFunctionality/CustomerOrders.jsx')
); // jsx File
const BSOtherServiceClaim = lazy(
() => import('../../UtillComponents/BSOtherServiceClaim.jsx')
);
const OtherServiceMobilePrint = lazy(
() => import('../../BookingFunctionality/OtherServiceMobilePrint.jsx')
);
const OtherServicePrintStyle1 = lazy(
() =>
import('../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx')
);
const subDirectory = import.meta.env.ENV_BASE_URL; const subDirectory = import.meta.env.ENV_BASE_URL;
const MainHomeUrl = import.meta.env.ENV_MAIN_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 currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
const BSBilling4Payment = () => { const BSBilling4Payment = () => {
@ -241,7 +272,9 @@ const BSBilling4Payment = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const salesBillEdit = useSelector(GlobalSalesBillEdit); const salesBillEdit = useSelector(GlobalSalesBillEdit);
const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); const previousOrderOfferDetails = useSelector(
GlobalPreviousOrderOfferDetails
);
const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
const FreeProdList = useSelector(GlobalFreeProdList); const FreeProdList = useSelector(GlobalFreeProdList);
const offerAppliedProducts = useSelector(GlobalOfferAppliedProducts); const offerAppliedProducts = useSelector(GlobalOfferAppliedProducts);
@ -271,7 +304,6 @@ const BSBilling4Payment = () => {
const GlobalExtraCharge = useSelector(globalExtraTotalAmount); const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
const NavHoldData = useSelector(GlobalNavHoldData); const NavHoldData = useSelector(GlobalNavHoldData);
const SettingDataSelector = useSelector(PreferenceData); const SettingDataSelector = useSelector(PreferenceData);
const BranchFinancialStatus = useSelector(GlobalBranchFinancialStatus);
const RetailWSSalesType = useSelector(GlobalRetailWSSalesType); const RetailWSSalesType = useSelector(GlobalRetailWSSalesType);
const appPreferences = useSelector(ApplicationPreferences); const appPreferences = useSelector(ApplicationPreferences);
const bookingTypePreference = appPreferences?.find( const bookingTypePreference = appPreferences?.find(
@ -282,10 +314,6 @@ const BSBilling4Payment = () => {
type?.PreferredSubCatName?.toLowerCase() === 'dine in' && type?.PreferredSubCatName?.toLowerCase() === 'dine in' &&
type?.PreferredStatus === 'Y' type?.PreferredStatus === 'Y'
); );
const preferenceOffer =
SettingDataSelector?.[0]?.['SettingDtlDetails']?.find(
(item) => item.SettingIdName === 'Offer'
)?.SettingValue === 'Y';
const allowDecimal = SettingDataSelector?.[0]?.SettingDtlDetails?.find( const allowDecimal = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
(setting) => (setting) =>
setting?.SettingIdName?.toLowerCase() === 'decimal' && setting?.SettingIdName?.toLowerCase() === 'decimal' &&
@ -305,9 +333,6 @@ const BSBilling4Payment = () => {
const ProdSubCat = useSelector(GlobalProductSubCategorie); const ProdSubCat = useSelector(GlobalProductSubCategorie);
const templateData = useSelector(getTemplateData); const templateData = useSelector(getTemplateData);
const [urlData, setUrlData] = useState(); const [urlData, setUrlData] = useState();
const OfferCheckedInSetup = templateData?.BookingNavbar?.[1].some(
(item) => item?.OptionName == 'Offer'
);
// for customised invoice number // for customised invoice number
const { selectedDate, invoiceDate, clearInvoiceDate } = useDateStore(); const { selectedDate, invoiceDate, clearInvoiceDate } = useDateStore();
@ -339,8 +364,6 @@ const BSBilling4Payment = () => {
const BranchId = SessionData?.BranchId; const BranchId = SessionData?.BranchId;
const UserId = SessionData?.UserId; const UserId = SessionData?.UserId;
const UserType = SessionData?.UserType; const UserType = SessionData?.UserType;
const AuthToken = SessionData?.AuthToken;
const SessionMobileNo = SessionData?.SessionMobileNo;
const [refundPayBtns, setRefundPayBtns] = useState([]); const [refundPayBtns, setRefundPayBtns] = useState([]);
const [refundPaySelected, setRefundPaySelected] = useState(); const [refundPaySelected, setRefundPaySelected] = useState();
const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); const [refundPaySelectedName, setRefundPaySelectedName] = useState(null);
@ -485,8 +508,10 @@ const BSBilling4Payment = () => {
); );
const PrinterDetails = useSelector(GlobalPrinterMappingDtls); const PrinterDetails = useSelector(GlobalPrinterMappingDtls);
const [showCancelConfirm, setShowCancelConfirm] = useState(false); const [showCancelConfirm, setShowCancelConfirm] = useState(false);
const holdCheckedSalesSetup = tableOptions?.some(
(item) => item?.OptionName === 'Hold'
);
console.log(PrinterDetails, 'PrinterDetailsPrinterDetails');
const filteredSettingNames = SettingDataSelector?.[0]?.['SettingDtlDetails'] const filteredSettingNames = SettingDataSelector?.[0]?.['SettingDtlDetails']
?.filter( ?.filter(
(item) => (item) =>
@ -521,7 +546,7 @@ const BSBilling4Payment = () => {
}; };
dispatch(getPrinterMappingDetails(data)).unwrap(); dispatch(getPrinterMappingDetails(data)).unwrap();
const Data1 = { AppId, CompId, BranchId }; const Data1 = { AppId, CompId, BranchId };
dispatch(getPrintSelectionComponentData(Data1)).unwrap(); // dispatch(getPrintSelectionComponentData(Data1)).unwrap();
}, []); }, []);
useEffect(() => { useEffect(() => {
@ -531,7 +556,6 @@ const BSBilling4Payment = () => {
}, [salesBillEdit]); }, [salesBillEdit]);
useEffect(() => { useEffect(() => {
if (salesBillEdit) { if (salesBillEdit) {
if (SelCustId) { if (SelCustId) {
setRefundPayBtns(AllPaymentOptions); setRefundPayBtns(AllPaymentOptions);
@ -546,8 +570,7 @@ const BSBilling4Payment = () => {
setRefundPayBtns(withoutCustomer); setRefundPayBtns(withoutCustomer);
} }
} }
}, [AllPaymentOptions, SelCustId, salesBillEdit]);
}, [AllPaymentOptions, SelCustId, salesBillEdit])
useEffect(() => { useEffect(() => {
const fetchCreditCustomer = async () => { const fetchCreditCustomer = async () => {
@ -648,14 +671,21 @@ const BSBilling4Payment = () => {
const filteredPayments = const filteredPayments =
previousOrderPayment?.filter( previousOrderPayment?.filter(
p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment (p) =>
p?.LastOrderTran === 'Y' &&
p?.AfterAdjustment != null &&
p?.AfterAdjustment !== '' &&
p?.AfterAdjustment
) || []; ) || [];
const paymentsToUse = const paymentsToUse =
filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; filteredPayments.length > 0
? filteredPayments
: previousOrderPayment || [];
const totalPreviouspayment = paymentsToUse?.reduce( const totalPreviouspayment = paymentsToUse?.reduce(
(acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), (acc, payment) =>
acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
0 0
); );
@ -664,8 +694,7 @@ const BSBilling4Payment = () => {
0 0
); );
const previousNetAmount = const previousNetAmount = totalPreviouspayment || 0;
(totalPreviouspayment) || 0;
let withdiscTotal = let withdiscTotal =
Total - Total -
@ -677,12 +706,26 @@ const BSBilling4Payment = () => {
withdiscTotal >= 0 withdiscTotal >= 0
? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2)
: (Number(Total) + Number(globalTipAmount)).toFixed(2) : (Number(Total) + Number(globalTipAmount)).toFixed(2)
) );
setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); setTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
);
setCurrentOrderNetAmount(currentOrderNetAmount); setCurrentOrderNetAmount(currentOrderNetAmount);
setPreviousNetAmount(previousNetAmount); setPreviousNetAmount(previousNetAmount);
dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(
changeSummeryTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
)
);
dispatch(changeSummeryComboOfferAmount(withComboSum)); dispatch(changeSummeryComboOfferAmount(withComboSum));
@ -1235,8 +1278,10 @@ const BSBilling4Payment = () => {
}, [OrderCardDetail]); }, [OrderCardDetail]);
useEffect(() => { useEffect(() => {
if (CompId && BranchId && AppId) { if (CompId && BranchId && AppId) {
if (holdCheckedSalesSetup) {
getHolddata(); getHolddata();
getUnpaiddatas(); }
// getUnpaiddatas();
getCustomerData(); getCustomerData();
} }
}, [CompId, BranchId, AppId]); }, [CompId, BranchId, AppId]);
@ -1369,7 +1414,11 @@ const BSBilling4Payment = () => {
const handleButtonClick = () => { const handleButtonClick = () => {
if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) {
UpiPayment(); UpiPayment();
} else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { } else if (
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
!refundPaySelected
) {
setMessageType('warning'); setMessageType('warning');
setMessageData('Please Select Refund Payment Method'); setMessageData('Please Select Refund Payment Method');
return; return;
@ -1680,7 +1729,7 @@ const BSBilling4Payment = () => {
const handleRefundPaymentMode = (id, name) => { const handleRefundPaymentMode = (id, name) => {
setRefundPaySelected(id); setRefundPaySelected(id);
setRefundPaySelectedName(name); setRefundPaySelectedName(name);
} };
const addUpiOption = async (id, name, UPIId) => { const addUpiOption = async (id, name, UPIId) => {
await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDprint(UPIId));
@ -1899,7 +1948,9 @@ const BSBilling4Payment = () => {
setCurrentOrderNetAmount(0); setCurrentOrderNetAmount(0);
setPreviousNetAmount(0); setPreviousNetAmount(0);
setUpinotSelected(false); setUpinotSelected(false);
if (holdCheckedSalesSetup) {
getHolddata(); getHolddata();
}
if (defaultBookingType === 'Both') { if (defaultBookingType === 'Both') {
await dispatch(changeBookingType('TakeAway')); await dispatch(changeBookingType('TakeAway'));
} }
@ -2201,8 +2252,10 @@ const BSBilling4Payment = () => {
SalesPaymentType: 'normal', SalesPaymentType: 'normal',
PaymentDetail: [ PaymentDetail: [
{ {
PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : PaymentType:
Paybtnnameselected?.toLowerCase() === 'upi' salesBillEdit && currentOrderNetAmount < previousNetAmount
? refundPaySelected
: Paybtnnameselected?.toLowerCase() === 'upi'
? SelectedUPIPayOption?.toLowerCase() === 'pd' ? SelectedUPIPayOption?.toLowerCase() === 'pd'
? PaymentDeviceUPI?.[0]?.ModeId ? PaymentDeviceUPI?.[0]?.ModeId
: SelectedUPIPayOption?.toLowerCase() === 'pg' : SelectedUPIPayOption?.toLowerCase() === 'pg'
@ -2215,15 +2268,25 @@ const BSBilling4Payment = () => {
: paybtnselected : paybtnselected
? paybtnselected ? paybtnselected
: null, : null,
Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), Amount:
MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : salesBillEdit && currentOrderNetAmount < previousNetAmount
Paybtnnameselected?.toLowerCase() === 'upi' && ? previousNetAmount - currentOrderNetAmount
: Math.round(TotalAmount),
MerchantId:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'business' SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantId ?.MerchantId
: null, : null,
PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : PaymentOptionType:
Paybtnnameselected?.toLowerCase() === 'cash' salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'PC' ? 'PC'
: Paybtnnameselected?.toLowerCase() === 'credit' : Paybtnnameselected?.toLowerCase() === 'credit'
? 'PC' ? 'PC'
@ -2236,16 +2299,21 @@ const BSBilling4Payment = () => {
? 'BU' ? 'BU'
: SelectedUPIPayOption : SelectedUPIPayOption
: null, : null,
ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : ModeOfPayment:
SelectedUPIPayOption?.toLowerCase() === 'default' salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: SelectedUPIPayOption?.toLowerCase() === 'default'
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
?.UPIDetailId ?.UPIDetailId
: SelectedUPIPayOption?.toLowerCase() === 'business' : SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ? BusinessPayOption?.find(
?.MerchantUPIId (busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
: null, : null,
AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : AccountDtl:
Paybtnnameselected?.toLowerCase() === 'upi' && salesBillEdit && currentOrderNetAmount < previousNetAmount
? []
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default' SelectedUPIPayOption?.toLowerCase() === 'default'
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
(upipay) => upipay?.UPIId === UpiId (upipay) => upipay?.UPIId === UpiId
@ -2261,8 +2329,10 @@ const BSBilling4Payment = () => {
SelectedCardOption?.toLowerCase() === 'pg') SelectedCardOption?.toLowerCase() === 'pg')
? useOptions?.[0]?.PaymentDetails?.PaymentGateway ? useOptions?.[0]?.PaymentDetails?.PaymentGateway
: [], : [],
PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : PaymentStatus:
Paybtnnameselected?.toLowerCase() === 'cash' salesBillEdit && currentOrderNetAmount < previousNetAmount
? 'S'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'S' ? 'S'
: Paybtnnameselected?.toLowerCase() === 'credit' : Paybtnnameselected?.toLowerCase() === 'credit'
? 'S' ? 'S'
@ -2270,9 +2340,18 @@ const BSBilling4Payment = () => {
SelectedUPIPayOption?.toLowerCase() === 'default' SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S' ? 'S'
: 'P', : 'P',
Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, Debit:
Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && Paybtnnameselected?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
? Math.round(previousNetAmount - currentOrderNetAmount)
: 0,
Credit: salesBillEdit
? currentOrderNetAmount > previousNetAmount &&
Paybtnnameselected?.toLowerCase() === 'credit' Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount)
: 0
: Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount) ? Math.round(TotalAmount)
: 0, : 0,
}, },
@ -3385,8 +3464,10 @@ const BSBilling4Payment = () => {
setDefaultPaymentMode([]); setDefaultPaymentMode([]);
} }
}; };
if (salesBillEdit) {
setDefaultPaymentOption(); setDefaultPaymentOption();
}, [defaultPaymentTrigger]); }
}, [defaultPaymentTrigger, salesBillEdit]);
const Otherserviceprint = async () => { const Otherserviceprint = async () => {
if (OtherServicesPrintDetails?.length > 0) { if (OtherServicesPrintDetails?.length > 0) {
@ -3541,6 +3622,7 @@ const BSBilling4Payment = () => {
}; };
return ( return (
<Suspense fallback={<span>Loading ...</span>}>
<div className="BSBilling4-price-full"> <div className="BSBilling4-price-full">
<div className="BSBilling4-price-content"> <div className="BSBilling4-price-content">
<div className="Table4-price-icon-container"> <div className="Table4-price-icon-container">
@ -3602,7 +3684,9 @@ const BSBilling4Payment = () => {
style={{ style={{
fontSize: '25px', fontSize: '25px',
color: color:
selOption || GetCustId ? '#52c41a' : '#1292EE', selOption || GetCustId
? '#52c41a'
: '#1292EE',
cursor: Custdisable ? 'not-allowed' : 'pointer', cursor: Custdisable ? 'not-allowed' : 'pointer',
}} }}
/> />
@ -3691,8 +3775,9 @@ const BSBilling4Payment = () => {
/> />
</div> </div>
)} )}
{tableOptions?.filter((item) => item.OptionName === 'AddCustomer') {tableOptions?.filter(
.length === 1 || navCust === true ? ( (item) => item.OptionName === 'AddCustomer'
).length === 1 || navCust === true ? (
<div style={{ width: '2rem' }}> <div style={{ width: '2rem' }}>
{Object.keys(useOptions)?.length > 0 && {Object.keys(useOptions)?.length > 0 &&
useOptions?.some((flow) => useOptions?.some((flow) =>
@ -3716,7 +3801,8 @@ const BSBilling4Payment = () => {
onClick={CreditCustomerFun} onClick={CreditCustomerFun}
style={{ style={{
cursor: cursor:
OrderCardDetail?.length > 0 && 'not-allowed', OrderCardDetail?.length > 0 &&
'not-allowed',
color: color:
OrderCardDetail?.length > 0 || OrderCardDetail?.length > 0 ||
(selOption?.value === undefined && (selOption?.value === undefined &&
@ -3793,7 +3879,10 @@ const BSBilling4Payment = () => {
)} )}
{OtherServicesglobal && OrderCardDetail.length >= 1 && ( {OtherServicesglobal && OrderCardDetail.length >= 1 && (
<TooltipWrapper title="Vehicle Number" isMobile={isMobile}> <TooltipWrapper
title="Vehicle Number"
isMobile={isMobile}
>
{' '} {' '}
<div <div
className="BSBillingNav-icon-table-icon" className="BSBillingNav-icon-table-icon"
@ -3938,7 +4027,10 @@ const BSBilling4Payment = () => {
paybtns?.length > 0 && paybtns?.length > 0 &&
CheckBookingStatus != 'Close' && CheckBookingStatus != 'Close' &&
!addnewAccess && ( !addnewAccess && (
<TooltipWrapper title={'Hold'} isMobile={isMobile}> <TooltipWrapper
title={'Hold'}
isMobile={isMobile}
>
{' '} {' '}
<PozoHoldIcon <PozoHoldIcon
className="BSBillingNav-icon-table-icon" className="BSBillingNav-icon-table-icon"
@ -3979,7 +4071,9 @@ const BSBilling4Payment = () => {
cursor: 'pointer', cursor: 'pointer',
color: Holddata ? '#52c41a' : 'default', color: Holddata ? '#52c41a' : 'default',
pointerEvents: pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto', OrderType === 'Failed'
? 'none'
: 'auto',
}} }}
/> />
</Badge> </Badge>
@ -4024,7 +4118,8 @@ const BSBilling4Payment = () => {
: 1, : 1,
}} }}
> >
{paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( {paybtns?.length > 0 &&
currentOrderNetAmount >= previousNetAmount ? (
paybtns?.map((payment) => ( paybtns?.map((payment) => (
<div className="Table3-cash"> <div className="Table3-cash">
<button <button
@ -4104,7 +4199,9 @@ const BSBilling4Payment = () => {
</button> </button>
</div> </div>
)) ))
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( ) : currentOrderNetAmount < previousNetAmount &&
salesBillEdit &&
refundPayBtns.length > 0 ? (
refundPayBtns.map((payment) => ( refundPayBtns.map((payment) => (
<div className="Table3-cash"> <div className="Table3-cash">
<button <button
@ -4124,7 +4221,12 @@ const BSBilling4Payment = () => {
? 'blink-animation 0.5s infinite alternate' ? 'blink-animation 0.5s infinite alternate'
: 'none', : 'none',
}} }}
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)} onClick={() =>
handleRefundPaymentMode(
payment?.ConfigId,
payment?.ConfigName
)
}
> >
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */} {/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
@ -4375,8 +4477,10 @@ const BSBilling4Payment = () => {
OrderCardDetail?.length > 0 && OrderCardDetail?.length > 0 &&
paybtnselected && paybtnselected &&
CheckBookingStatus != 'Close' CheckBookingStatus != 'Close'
? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? ? !OrderStatus
'Table4-Btn-final-price' ? salesBillEdit &&
currentOrderNetAmount < previousNetAmount
? 'Table4-Btn-final-price'
: 'Table4-Btn-final-price' : 'Table4-Btn-final-price'
: 'Table4-Btn-final-price order' : 'Table4-Btn-final-price order'
: 'Table4-Btn-final-price-disabled' : 'Table4-Btn-final-price-disabled'
@ -4390,7 +4494,15 @@ const BSBilling4Payment = () => {
handleButtonClick handleButtonClick
} }
> >
{!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? <p className="Table4-Order">Refund: {(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</p> : ( {!OrderStatus ? (
salesBillEdit &&
currentOrderNetAmount < previousNetAmount ? (
<p className="Table4-Order">
Refund:
{(previousNetAmount || 0) -
(currentOrderNetAmount || 0)}
</p>
) : (
<div className="Table4-fullrate"> <div className="Table4-fullrate">
<div <div
className="Table4-rate" className="Table4-rate"
@ -4415,7 +4527,10 @@ const BSBilling4Payment = () => {
OrderType === 'Failed' OrderType === 'Failed'
? FailedTotalAmt ? FailedTotalAmt
: credit && overAllBal >= 0 : credit && overAllBal >= 0
? Math.max(0, TotalAmount - overAllBal) ? Math.max(
0,
TotalAmount - overAllBal
)
: TotalAmount : TotalAmount
)} )}
/> />
@ -4427,6 +4542,7 @@ const BSBilling4Payment = () => {
<BiRightArrowAlt /> <BiRightArrowAlt />
</div> </div>
</div> </div>
)
) : ( ) : (
<div className="billing-in-style-Order4">ORDER</div> <div className="billing-in-style-Order4">ORDER</div>
)} )}
@ -4524,7 +4640,9 @@ const BSBilling4Payment = () => {
) )
} }
CreatedDate={orderDetail?.CreatedDate} CreatedDate={orderDetail?.CreatedDate}
PaymentStatus={PrintOrderDetails?.[0]?.PaymentOrderDtl} PaymentStatus={
PrintOrderDetails?.[0]?.PaymentOrderDtl
}
Preference={SettingDataSelector} Preference={SettingDataSelector}
printDatas={printDatas} printDatas={printDatas}
/> />
@ -4549,7 +4667,9 @@ const BSBilling4Payment = () => {
) )
} }
CreatedDate={orderDetail?.CreatedDate} CreatedDate={orderDetail?.CreatedDate}
PaymentStatus={PrintOrderDetails?.[0]?.PaymentOrderDtl} PaymentStatus={
PrintOrderDetails?.[0]?.PaymentOrderDtl
}
/> />
</div> </div>
) )
@ -4599,9 +4719,10 @@ const BSBilling4Payment = () => {
children={ children={
<> <>
<div> <div>
You have already selected a table. If you click 'OK,' the table You have already selected a table. If you click 'OK,' the
selection will be removed, and the unpaid flow will continue. If table selection will be removed, and the unpaid flow will
you click 'Cancel,' the dine-in flow will proceed as selected. continue. If you click 'Cancel,' the dine-in flow will proceed
as selected.
</div> </div>
</> </>
} }
@ -4614,10 +4735,17 @@ const BSBilling4Payment = () => {
SplitPaymentModal={Splitpayment} SplitPaymentModal={Splitpayment}
handlesplitpaymentclose={handlesplitpaymentclose} handlesplitpaymentclose={handlesplitpaymentclose}
TotalNetAmount={ TotalNetAmount={
OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - OrderType === 'Failed'
? FailedTotalAmt
: Math.round(
OrderCardDetail?.reduce(
(acc, data) => data?.TotalAmt + acc,
0
) -
((OverAllSales > 0 ? OverAllSales : 0) + ((OverAllSales > 0 ? OverAllSales : 0) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) + (OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0))) (Discount > 0 ? Discount : 0))
)
} }
failedOrderData={failedOrderData} failedOrderData={failedOrderData}
/> />
@ -4740,7 +4868,9 @@ const BSBilling4Payment = () => {
width: '100%', width: '100%',
padding: 8, padding: 8,
borderRadius: 4, borderRadius: 4,
border: error ? '1px solid red' : '1px solid #ccc', border: error
? '1px solid red'
: '1px solid #ccc',
}} }}
/> />
{error && ( {error && (
@ -4830,6 +4960,7 @@ const BSBilling4Payment = () => {
/> />
)} )}
</div> </div>
</Suspense>
); );
}; };
export default BSBilling4Payment; export default BSBilling4Payment;

View File

@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'; import React, { lazy, useEffect, useState, Suspense } from 'react';
import { shallowEqual, useDispatch, useSelector } from 'react-redux'; import { shallowEqual, useDispatch, useSelector } from 'react-redux';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import { AiFillDelete, AiOutlineClose } from 'react-icons/ai'; import { AiFillDelete, AiOutlineClose } from 'react-icons/ai';
@ -55,7 +55,9 @@ import {
ChangeTotalAmount, ChangeTotalAmount,
globalExtraTotalAmount, globalExtraTotalAmount,
} from '../../../../../Features/ExteraCharges/ExtraCharges.js'; //Shifayath Date:27/12/2023 } from '../../../../../Features/ExteraCharges/ExtraCharges.js'; //Shifayath Date:27/12/2023
import BSBillingEditQuantity from '../BSBillingEditQuantity/BSBillingEditQuantity'; const BSBillingEditQuantity = lazy(
() => import('../BSBillingEditQuantity/BSBillingEditQuantity')
);
import dineInIcon from '../../../../../Images/Dine In.svg'; import dineInIcon from '../../../../../Images/Dine In.svg';
import TakeAwayIcon from '../../../../../Images/Take away.svg'; import TakeAwayIcon from '../../../../../Images/Take away.svg';
import WebFont from 'webfontloader'; import WebFont from 'webfontloader';
@ -66,8 +68,11 @@ import {
} from '../../../../../Features/BookingScreen/HoldOption/HoldOption.js'; } from '../../../../../Features/BookingScreen/HoldOption/HoldOption.js';
import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js'; import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx'; import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import BSEditTotalAmt from '../BSEditTotalAmount/BSEditTotalAmt.jsx'; const BSEditTotalAmt = lazy(
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx'; () => import('../BSEditTotalAmount/BSEditTotalAmt.jsx')
);
const BSImeiDetails = lazy(() => import('../BSImeiDetails/BSImeiDetails.jsx'));
import { import {
ChangeFullFreeProductList, ChangeFullFreeProductList,
changeFullOfferAppliedProducts, changeFullOfferAppliedProducts,
@ -78,8 +83,9 @@ import {
import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js'; import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js';
import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js'; import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js';
import { useUtilsComponent } from '../../../../../Services/utils.js'; import { useUtilsComponent } from '../../../../../Services/utils.js';
import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx'; const CustomerPriceHistory = lazy(
() => import('../../UtillComponents/CustomerPriceHistory.jsx')
);
const BSBillingTable4 = () => { const BSBillingTable4 = () => {
const { removeExtraCharge } = useUtilsComponent(); const { removeExtraCharge } = useUtilsComponent();
const dispatch = useDispatch(); const dispatch = useDispatch();
@ -117,7 +123,6 @@ const BSBillingTable4 = () => {
const UnpaidData = useSelector(GlobalUnpaidData); const UnpaidData = useSelector(GlobalUnpaidData);
const tableData = useSelector(GlobalOrderCardDetails); const tableData = useSelector(GlobalOrderCardDetails);
console.log(tableData, 'tableDatatableData'); console.log(tableData, 'tableDatatableData');
const salesBillEdit = useSelector(GlobalSalesBillEdit);
const ReportholdData = useSelector(GlobalReorderHoldDetails); const ReportholdData = useSelector(GlobalReorderHoldDetails);
const PreviousOrderLength = useSelector(GlobalPreviousOrderLength); const PreviousOrderLength = useSelector(GlobalPreviousOrderLength);
const HoldOrderDtl = useSelector(GlobalHoldOrderDtl); const HoldOrderDtl = useSelector(GlobalHoldOrderDtl);
@ -146,7 +151,8 @@ const BSBillingTable4 = () => {
const GetCustId = useSelector(GlobalCustId); const GetCustId = useSelector(GlobalCustId);
const selectedCustomer = useSelector(GlobalSelOption); const selectedCustomer = useSelector(GlobalSelOption);
const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false); const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] =
useState(false);
const [customerProduct, setCustomerProduct] = useState(null); const [customerProduct, setCustomerProduct] = useState(null);
const [OpenEditTotalAmt, setOpenEditTotalAmt] = useState(false); const [OpenEditTotalAmt, setOpenEditTotalAmt] = useState(false);
const [OpenImeiDetail, setOpenImeiDetail] = useState(false); const [OpenImeiDetail, setOpenImeiDetail] = useState(false);
@ -312,7 +318,6 @@ const BSBillingTable4 = () => {
event.preventDefault(); event.preventDefault();
handleShortcut('weightAmount'); handleShortcut('weightAmount');
} }
}; };
window.addEventListener('keydown', handleKeyDown); window.addEventListener('keydown', handleKeyDown);
@ -329,142 +334,6 @@ const BSBillingTable4 = () => {
const handleImeiDetailClose = () => { const handleImeiDetailClose = () => {
setOpenImeiDetail(false); setOpenImeiDetail(false);
}; };
// const removeFromCart = async (item) => {
// setPreviousdataLength(tableData?.length);
// if (item?.BookingTypeName !== 'Dine In' && OrderType !== 'Hold') {
// const UpdatedData = tableData?.filter(
// (cartItem) =>
// !(
// cartItem?.ProdId === item?.ProdId &&
// cartItem?.InwardDtlId === item?.InwardDtlId &&
// cartItem?.OrderRate === item?.OrderRate &&
// cartItem?.BookingTypeName === item?.BookingTypeName &&
// !cartItem?.SalesId
// )
// );
// if (OfferCheckedInSetup && preferenceOffer) {
// await applyOffer(UpdatedData);
// } else {
// dispatch(changeOrderCardDetails(UpdatedData));
// }
// await dispatch(
// ChangeTotalAmount(
// GlobalExtraCharge?.filter((extra) => {
// if (BookingType === 'Dine In') {
// // Remove extra charges linked to the removed product
// return !(extra.ProdId === item?.ProdId && !extra.SalesId);
// } else if (BookingType === 'TakeAway') {
// // Remove extra charges only if SalesId is not present
// return extra.ProdId !== item?.ProdId;
// }
// return true; // Keep everything else
// })
// )
// );
// // if the quantity of the item is 1, remove the item from the cart
// if (tableData?.length <= 1) {
// await dispatch(changeReorderHoldDetails({}));
// await dispatch(changeReorderProductDetails([]));
// await dispatch(changeUnpaidData(false));
// await dispatch(changeBookingType('TakeAway'));
// await dispatch(changeTokenOnly(false));
// await dispatch(changeAllProductTokenAvailable(false));
// await dispatch(ChangeOverAllDiscSales(null));
// await dispatch(ChangeOverAllDiscEstimate(null));
// await dispatch(changeSelProdWiseEst([]));
// await dispatch(ChangeTotalAmount([]));
// }
// } else if (item?.BookingTypeName !== 'Dine In' && OrderType === 'Hold') {
// const UpdatedData = tableData?.filter(
// (cartItem) =>
// !(
// cartItem?.ProdId === item?.ProdId &&
// cartItem?.InwardDtlId === item?.InwardDtlId &&
// cartItem?.OrderRate === item?.OrderRate &&
// cartItem?.BookingTypeName === item?.BookingTypeName
// )
// );
// if (OfferCheckedInSetup && preferenceOffer) {
// await applyOffer(UpdatedData);
// } else {
// dispatch(changeOrderCardDetails(UpdatedData));
// }
// await dispatch(
// ChangeTotalAmount(
// GlobalExtraCharge?.filter((extra) => {
// if (BookingType === 'Dine In') {
// // Remove extra charges linked to the removed product
// return !(extra.ProdId === item?.ProdId && !extra.SalesId);
// } else if (BookingType === 'TakeAway') {
// // Remove extra charges only if SalesId is not present
// return extra.ProdId !== item?.ProdId;
// }
// return true; // Keep everything else
// })
// )
// );
// // if the quantity of the item is 1, remove the item from the cart
// if (tableData?.length <= 1) {
// await dispatch(changeReorderHoldDetails({}));
// await dispatch(changeReorderProductDetails([]));
// await dispatch(changeUnpaidData(false));
// await dispatch(changeBookingType('TakeAway'));
// await dispatch(changeTokenOnly(false));
// await dispatch(changeAllProductTokenAvailable(false));
// await dispatch(ChangeOverAllDiscSales(null));
// await dispatch(ChangeOverAllDiscEstimate(null));
// await dispatch(changeSelProdWiseEst([]));
// await dispatch(ChangeTotalAmount([]));
// }
// } else if (item?.BookingTypeName === 'Dine In') {
// const UpdatedData = tableData?.filter(
// (cartItem) =>
// !(
// cartItem?.ProdId === item?.ProdId &&
// cartItem?.InwardDtlId === item?.InwardDtlId &&
// cartItem?.OrderRate === item?.OrderRate &&
// cartItem?.BookingTypeName === item?.BookingTypeName &&
// !cartItem?.SalesId
// )
// );
// if (OfferCheckedInSetup && preferenceOffer) {
// await applyOffer(UpdatedData);
// } else {
// dispatch(changeOrderCardDetails(UpdatedData));
// }
// await dispatch(
// ChangeTotalAmount(
// GlobalExtraCharge?.filter((extra) => {
// if (BookingType === 'Dine In') {
// // Remove extra charges linked to the removed product
// return !(extra.ProdId === item?.ProdId && !extra.SalesId);
// } else if (BookingType === 'TakeAway') {
// // Remove extra charges only if SalesId is not present
// return extra.ProdId !== item?.ProdId;
// }
// return true; // Keep everything else
// })
// )
// ); // if the quantity of the item is 1, remove the item from the cart
// if (tableData?.length <= 1) {
// await dispatch(changeReorderHoldDetails({}));
// await dispatch(changeReorderProductDetails([]));
// await dispatch(changeUnpaidData(false));
// await dispatch(ChangeSelectedCustDisable(false));
// await dispatch(changeSelectedOption(false));
// await dispatch(changeBookingType('TakeAway'));
// await dispatch(changeTokenOnly(false));
// await dispatch(changeAllProductTokenAvailable(false));
// await dispatch(ChangeOverAllDiscSales(null));
// await dispatch(ChangeOverAllDiscEstimate(null));
// await dispatch(changeSelProdWiseEst([]));
// await dispatch(ChangeTotalAmount([]));
// }
// }
// };
const calculateAmounts = ( const calculateAmounts = (
OrderQty, OrderQty,
@ -2083,7 +1952,6 @@ const BSBillingTable4 = () => {
} }
} }
} }
}; };
const UnblockSlots = async (newCartItem) => { const UnblockSlots = async (newCartItem) => {
let BlockPostdata = { let BlockPostdata = {
@ -2145,7 +2013,7 @@ const BSBillingTable4 = () => {
const handleCustomerProductPriceHistory = (item) => { const handleCustomerProductPriceHistory = (item) => {
setCustomerPriceHistoryOpen(true); setCustomerPriceHistoryOpen(true);
setCustomerProduct(item?.ProdId); setCustomerProduct(item?.ProdId);
} };
const getstockbadge = async () => { const getstockbadge = async () => {
let data = { let data = {
@ -2306,6 +2174,7 @@ const BSBillingTable4 = () => {
}; };
return ( return (
<Suspense fallback={<div>Loading...</div>}>
<div <div
className={ className={
isMobile ? 'BSBilling4-tablediv-mobile' : 'BSBilling4-tablediv' isMobile ? 'BSBilling4-tablediv-mobile' : 'BSBilling4-tablediv'
@ -2520,7 +2389,8 @@ const BSBillingTable4 = () => {
{OldtableDataTakeAway?.map((item, index) => ( {OldtableDataTakeAway?.map((item, index) => (
<tr <tr
key={index} key={index}
className={`${item?.SalesId && OrderType !== 'Hold' className={`${
item?.SalesId && OrderType !== 'Hold'
? 'BSBill-Table3-content-Disabled' ? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content' : 'BSBill-Table3-content'
} }
@ -2541,7 +2411,8 @@ const BSBillingTable4 = () => {
: BookingType !== 'Dine In' && : BookingType !== 'Dine In' &&
triggerAnimation && triggerAnimation &&
index === 0 && index === 0 &&
tableDataTakeAway?.length >= PreviousdataLength && tableDataTakeAway?.length >=
PreviousdataLength &&
!HoldOrderDtl && !HoldOrderDtl &&
!UnpaidData !UnpaidData
? 'wheat' ? 'wheat'
@ -2610,7 +2481,8 @@ const BSBillingTable4 = () => {
} }
> >
{item.ProdName} {item.ProdName}
&nbsp; {item?.BrandName !== null ? item?.BrandName : ''} &nbsp;{' '}
{item?.BrandName !== null ? item?.BrandName : ''}
{item?.Type != 'C' && ( {item?.Type != 'C' && (
<> <>
<p <p
@ -2792,7 +2664,8 @@ const BSBillingTable4 = () => {
{OldtableDataDinein?.map((item, index) => ( {OldtableDataDinein?.map((item, index) => (
<tr <tr
key={OldtableDataTakeAway?.length + index} key={OldtableDataTakeAway?.length + index}
className={`${item?.SalesId className={`${
item?.SalesId
? 'BSBill-Table3-content-Disabled' ? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content' : 'BSBill-Table3-content'
} }
@ -2880,7 +2753,8 @@ const BSBillingTable4 = () => {
}} }}
> >
{item.ProdName} {item.ProdName}
&nbsp; {item?.BrandName !== null ? item?.BrandName : ''} &nbsp;{' '}
{item?.BrandName !== null ? item?.BrandName : ''}
{item?.Type != 'C' && ( {item?.Type != 'C' && (
<> <>
<p <p
@ -3066,7 +2940,8 @@ const BSBillingTable4 = () => {
OldtableDataTakeAway?.length + OldtableDataTakeAway?.length +
index index
} }
className={`${BookingType === 'Dine In' && item?.SalesId className={`${
BookingType === 'Dine In' && item?.SalesId
? 'BSBill-Table3-content-Disabled' ? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content' : 'BSBill-Table3-content'
} }
@ -3093,7 +2968,8 @@ const BSBillingTable4 = () => {
OldtableDataTakeAway?.length + OldtableDataTakeAway?.length +
index === index ===
0 && 0 &&
tableDataTakeAway?.length >= PreviousdataLength && tableDataTakeAway?.length >=
PreviousdataLength &&
!HoldOrderDtl && !HoldOrderDtl &&
!UnpaidData !UnpaidData
? 'wheat' ? 'wheat'
@ -3104,7 +2980,9 @@ const BSBillingTable4 = () => {
0 0
? 'white' ? 'white'
: SelectedBillColor?.['OverallBackgroundColor'] : SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor'] ? SelectedBillColor?.[
'OverallBackgroundColor'
]
: '#d6d6d6' : '#d6d6d6'
: (OldtableDataDinein?.length + : (OldtableDataDinein?.length +
OldtableDataTakeAway?.length + OldtableDataTakeAway?.length +
@ -3188,8 +3066,11 @@ const BSBillingTable4 = () => {
: editField && handleEditQuantity(item, index) : editField && handleEditQuantity(item, index)
} }
> >
{item?.Type !== 'OS' ? item.ProdName : item.ServiceName} {item?.Type !== 'OS'
&nbsp; {item?.BrandName !== null ? item?.BrandName : ''} ? item.ProdName
: item.ServiceName}
&nbsp;{' '}
{item?.BrandName !== null ? item?.BrandName : ''}
{item?.Type != 'C' && ( {item?.Type != 'C' && (
<> <>
<p <p
@ -3385,7 +3266,8 @@ const BSBillingTable4 = () => {
OldtableDataTakeAway?.length + OldtableDataTakeAway?.length +
index index
} }
className={`${item?.SalesId && OrderType !== 'Hold' className={`${
item?.SalesId && OrderType !== 'Hold'
? 'BSBill-Table3-content-Disabled' ? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content' : 'BSBill-Table3-content'
} }
@ -3499,7 +3381,8 @@ const BSBillingTable4 = () => {
}} }}
> >
{item.ProdName} {item.ProdName}
&nbsp; {item?.BrandName !== null ? item?.BrandName : ''} &nbsp;{' '}
{item?.BrandName !== null ? item?.BrandName : ''}
{item?.Type != 'C' && ( {item?.Type != 'C' && (
<> <>
<p <p
@ -3690,7 +3573,7 @@ const BSBillingTable4 = () => {
ProductDetail={Modaldata} ProductDetail={Modaldata}
/> />
)} )}
{(customerPriceHistoryOpen && GetCustId) && {customerPriceHistoryOpen && GetCustId && (
<CustomerPriceHistory <CustomerPriceHistory
open={customerPriceHistoryOpen} open={customerPriceHistoryOpen}
custId={GetCustId} custId={GetCustId}
@ -3699,8 +3582,9 @@ const BSBillingTable4 = () => {
setCustomerProduct={setCustomerProduct} setCustomerProduct={setCustomerProduct}
selectedCustomer={selectedCustomer} selectedCustomer={selectedCustomer}
/> />
} )}
</div> </div>
</Suspense>
); );
}; };

View File

@ -1,10 +1,9 @@
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef, lazy, Suspense } from 'react';
import { shallowEqual, useDispatch, useSelector } from 'react-redux'; import { shallowEqual, useDispatch, useSelector } from 'react-redux';
import moment from 'moment'; import moment from 'moment';
import { Popover, Badge, Modal, Tooltip } from 'antd'; import { Popover, Badge, Modal, Tooltip } from 'antd';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { import {
UpOutlined,
ArrowRightOutlined, ArrowRightOutlined,
UpCircleOutlined, UpCircleOutlined,
DownCircleOutlined, DownCircleOutlined,
@ -15,7 +14,6 @@ import defaultupi from '../../../../../Images/defaultupi.png';
import pozologoimg from '../../../../../Images/pozologoimg.png'; import pozologoimg from '../../../../../Images/pozologoimg.png';
import paydevice from '../../../../../Images/paydevice.png'; import paydevice from '../../../../../Images/paydevice.png';
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable15.scss'; import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable15.scss';
import BsBill from './BsBill';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import { import {
GlobalSelectedFont, GlobalSelectedFont,
@ -29,7 +27,9 @@ import {
} from '../../../../../Features/ThemeChange/ThemeChange'; } from '../../../../../Features/ThemeChange/ThemeChange';
import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js'; import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js';
import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities'; import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities';
import BSSummery1 from '../../BSBillingTables/BSBillingTableSummery/BSSummery'; const BSSummery1 = lazy(
() => import('../../BSBillingTables/BSBillingTableSummery/BSSummery')
);
import { Messages } from '../../../../../Components/Notifications/Messages'; import { Messages } from '../../../../../Components/Notifications/Messages';
import { import {
GlobalOrderCardDetails, GlobalOrderCardDetails,
@ -105,7 +105,6 @@ import {
GlobalOverAllDiscSales, GlobalOverAllDiscSales,
ChangeOverAllDiscSales, ChangeOverAllDiscSales,
ChangeOverAllDiscEstimate, ChangeOverAllDiscEstimate,
getAllCustomer,
GlobalBranchFinancialStatus, GlobalBranchFinancialStatus,
changeSummeryComboOfferAmount, changeSummeryComboOfferAmount,
ChangeComboCarddata, ChangeComboCarddata,
@ -130,6 +129,7 @@ import {
changeBillEditingMode, changeBillEditingMode,
changePreviousOrderPayment, changePreviousOrderPayment,
changePreviousOrderOfferDetail, changePreviousOrderOfferDetail,
GlobalAllBookingType,
} from '../../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../../Features/BookingScreen/BookingData/BookingData';
import { ChangeTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges.js'; //Shifayth Date:27/12/2023 import { ChangeTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges.js'; //Shifayth Date:27/12/2023
import { import {
@ -137,7 +137,6 @@ import {
globalholddata, globalholddata,
changeholddata, changeholddata,
} from '../../../../../Features/BookingScreen/HoldOption/HoldOption'; } from '../../../../../Features/BookingScreen/HoldOption/HoldOption';
import PaymentPdfBooking from '../../../../paymentpdfPage/PaymentPdfBooking';
import { globalExtraTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges'; import { globalExtraTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges';
import { import {
encryptObject, encryptObject,
@ -154,34 +153,21 @@ import {
triggerCustomerRefresh, triggerCustomerRefresh,
} from '../../../../../Features/BookingScreen/Customer/addCustomer'; } from '../../../../../Features/BookingScreen/Customer/addCustomer';
import BSCustomerSelect from '../../UtillComponents/BSSelectCustomer.jsx'; import BSCustomerSelect from '../../UtillComponents/BSSelectCustomer.jsx';
import PozoDineInIcon from '../../UtillComponents/Pozo retail icons/PozoDineIn.jsx';
import PozoUnpaidIcon from '../../UtillComponents/Pozo retail icons/PozoUnpaidIcon.jsx'; import PozoUnpaidIcon from '../../UtillComponents/Pozo retail icons/PozoUnpaidIcon.jsx';
import PozoBillIcon from '../../UtillComponents/Pozo retail icons/PozoBIllIcon.jsx'; import PozoBillIcon from '../../UtillComponents/Pozo retail icons/PozoBIllIcon.jsx';
import PozoAddCustomerIcon from '../../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx'; import PozoAddCustomerIcon from '../../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx';
import QrComponent from '../../BookingFunctionality/DynamicQr.jsx';
import QrinScreen from '../../BookingFunctionality/DynamicScreenQr.jsx';
import Buttons from '../../../../../Components/Forms/Buttons'; import Buttons from '../../../../../Components/Forms/Buttons';
import WpIcon from '../../../../../Images/message.png'; 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 PozoAdvanceIcon from '../../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx';
import MobilePrint from '../../BookingFunctionality/MobilePrint.jsx';
import CountUp from 'react-countup'; import CountUp from 'react-countup';
import { GlobalpreOrderOpen } from '../../../../../Features/BookingScreen/PreOrder/PreOrder.js'; 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 { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js'; import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js';
import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx'; import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx';
import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx'; import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx';
import { import {
Global_CoupenCodeAmount,
Global_loyaltyPointsDiscountAmount,
Global_OrderOfferDetail, Global_OrderOfferDetail,
Global_OverallOfferAmount, Global_OverallOfferAmount,
Global_SalesWiseOfferAmount,
} from '../../../../../Features/Offer/Offer.js'; } from '../../../../../Features/Offer/Offer.js';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx'; import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip'; import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip';
@ -191,21 +177,13 @@ import {
changeSalesPaymentoption, changeSalesPaymentoption,
GlobalSalesPaymentoption, GlobalSalesPaymentoption,
} from '../../../../../Features/Payment/Paymentoptions/Paymentoptions.js'; } from '../../../../../Features/Payment/Paymentoptions/Paymentoptions.js';
import Paymentoption from '../../../../Payment/PaymentOptions/PaymentOptions.jsx';
import { getPaymentOptionsData } from '../../../../../Features/BookingScreen/BookingData/KioskBookingData.js'; import { getPaymentOptionsData } from '../../../../../Features/BookingScreen/BookingData/KioskBookingData.js';
import { getCombolist } from '../../../../../Features/ComboMaster/ComboMaster.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 { MdSms } from 'react-icons/md';
import { FaWhatsapp, FaPrint, FaCartPlus } from 'react-icons/fa'; import { FaWhatsapp, FaPrint, FaCartPlus } from 'react-icons/fa';
import BSTipAmount from '../../UtillComponents/BSTipAmount.jsx';
import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js'; import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js';
import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js'; import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js';
import { TfiClipboard } from 'react-icons/tfi'; import { TfiClipboard } from 'react-icons/tfi';
import OtherServicePrintStyle1 from '../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx';
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 { PublicQrCodepost } from '../../../../../Features/ConfigMasterPage/ConfigMasterPage.js';
import { import {
ChangeFullFreeProductList, ChangeFullFreeProductList,
@ -217,14 +195,75 @@ import {
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js'; } from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import CardPopover from '../StandardTable/Utils/CardPopover.jsx'; import CardPopover from '../StandardTable/Utils/CardPopover.jsx';
import UpiPopover from '../StandardTable/Utils/UpiPopOver.jsx'; import UpiPopover from '../StandardTable/Utils/UpiPopOver.jsx';
import PaymentGatewayEmbedded from '../../UtillComponents/PaymentGatewayEmbedded.jsx';
import MobileMultiPdfPrintTrigger from '../../UtillComponents/MobileMultiPdfPrintTrigger.jsx';
import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js'; import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js';
import CustomerOrders from '../../BookingFunctionality/CustomerOrders.jsx'; // Jsx Files
const OtherServicePrintStyle1 = lazy(
() =>
import('../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx')
);
const OtherServiceMobilePrint = lazy(
() => import('../../BookingFunctionality/OtherServiceMobilePrint.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 subDirectory = import.meta.env.ENV_BASE_URL;
const MainHomeUrl = import.meta.env.ENV_MAIN_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 currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
@ -244,11 +283,12 @@ const BSBillingTable5 = () => {
const BranchId = SessionData?.BranchId; const BranchId = SessionData?.BranchId;
const UserId = SessionData?.UserId; const UserId = SessionData?.UserId;
const UserType = SessionData?.UserType; const UserType = SessionData?.UserType;
const AuthToken = SessionData?.AuthToken; const AllBookingType = useSelector(GlobalAllBookingType);
const SessionMobileNo = SessionData?.SessionMobileNo;
const salesBillEdit = useSelector(GlobalSalesBillEdit); const salesBillEdit = useSelector(GlobalSalesBillEdit);
const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); const previousOrderOfferDetails = useSelector(
GlobalPreviousOrderOfferDetails
);
const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
const Discount = useSelector(GlobalOverAllOfferAmt); const Discount = useSelector(GlobalOverAllOfferAmt);
const FreeProdList = useSelector(GlobalFreeProdList); const FreeProdList = useSelector(GlobalFreeProdList);
@ -485,6 +525,10 @@ const BSBillingTable5 = () => {
// for customised invoice number // for customised invoice number
const { invoiceDate, clearInvoiceDate } = useDateStore(); const { invoiceDate, clearInvoiceDate } = useDateStore();
const CurrentOrderId = useSelector(GlobalCurrentOrderId); const CurrentOrderId = useSelector(GlobalCurrentOrderId);
const holdCheckedSalesSetup = tableOptions?.some(
(item) => item?.OptionName === 'Hold'
);
useEffect(() => { useEffect(() => {
if (salesBillEdit) { if (salesBillEdit) {
dispatch(getPaymentOptions()).unwrap(); dispatch(getPaymentOptions()).unwrap();
@ -492,7 +536,6 @@ const BSBillingTable5 = () => {
}, [salesBillEdit]); }, [salesBillEdit]);
useEffect(() => { useEffect(() => {
if (salesBillEdit) { if (salesBillEdit) {
if (SelCustId) { if (SelCustId) {
setRefundPayBtns(AllPaymentOptions); setRefundPayBtns(AllPaymentOptions);
@ -507,8 +550,7 @@ const BSBillingTable5 = () => {
setRefundPayBtns(withoutCustomer); setRefundPayBtns(withoutCustomer);
} }
} }
}, [AllPaymentOptions, SelCustId, salesBillEdit]);
}, [AllPaymentOptions, SelCustId, salesBillEdit])
useEffect(() => { useEffect(() => {
if ( if (
@ -529,8 +571,8 @@ const BSBillingTable5 = () => {
UserId: UserId, UserId: UserId,
}; };
dispatch(getPrinterMappingDetails(data)).unwrap(); dispatch(getPrinterMappingDetails(data)).unwrap();
const Data1 = { AppId, CompId, BranchId }; // const Data1 = { AppId, CompId, BranchId };
dispatch(getPrintSelectionComponentData(Data1)).unwrap(); // dispatch(getPrintSelectionComponentData(Data1)).unwrap();
}, []); }, []);
useEffect(() => { useEffect(() => {
if (selOption) { if (selOption) {
@ -634,17 +676,23 @@ const BSBillingTable5 = () => {
); );
} }
const filteredPayments = const filteredPayments =
previousOrderPayment?.filter( previousOrderPayment?.filter(
p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment (p) =>
p?.LastOrderTran === 'Y' &&
p?.AfterAdjustment != null &&
p?.AfterAdjustment !== '' &&
p?.AfterAdjustment
) || []; ) || [];
const paymentsToUse = const paymentsToUse =
filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; filteredPayments.length > 0
? filteredPayments
: previousOrderPayment || [];
const totalPreviouspayment = paymentsToUse?.reduce( const totalPreviouspayment = paymentsToUse?.reduce(
(acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), (acc, payment) =>
acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
0 0
); );
@ -653,8 +701,7 @@ const BSBillingTable5 = () => {
0 0
); );
const previousNetAmount = const previousNetAmount = totalPreviouspayment || 0;
(totalPreviouspayment) || 0;
let withdiscTotal = let withdiscTotal =
Total - Total -
@ -666,12 +713,26 @@ const BSBillingTable5 = () => {
withdiscTotal >= 0 withdiscTotal >= 0
? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2)
: (Number(Total) + Number(globalTipAmount)).toFixed(2) : (Number(Total) + Number(globalTipAmount)).toFixed(2)
) );
setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); setTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
);
setCurrentOrderNetAmount(currentOrderNetAmount); setCurrentOrderNetAmount(currentOrderNetAmount);
setPreviousNetAmount(previousNetAmount); setPreviousNetAmount(previousNetAmount);
dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(
changeSummeryTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
)
);
dispatch(changeSummeryComboOfferAmount(withComboSum)); dispatch(changeSummeryComboOfferAmount(withComboSum));
@ -696,8 +757,9 @@ const BSBillingTable5 = () => {
useEffect(() => { useEffect(() => {
if (CompId && BranchId && AppId) { if (CompId && BranchId && AppId) {
if (holdCheckedSalesSetup) {
getHolddata(); getHolddata();
getUnpaiddatas(); }
getCustomerData(); getCustomerData();
} }
}, [CompId, BranchId, AppId]); }, [CompId, BranchId, AppId]);
@ -728,28 +790,6 @@ const BSBillingTable5 = () => {
setaddnewAccess(!hasAccess); setaddnewAccess(!hasAccess);
}, [empData, SAAccessCommonMaster, UserType]); }, [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 formatAmount = (value) => { const formatAmount = (value) => {
return allowDecimal return allowDecimal
? parseFloat(value || 0).toFixed(2) ? parseFloat(value || 0).toFixed(2)
@ -769,9 +809,6 @@ const BSBillingTable5 = () => {
setEmpData(datas?.[0]); setEmpData(datas?.[0]);
}; };
const getCustomerData = async () => { const getCustomerData = async () => {
await dispatch(
getAllCustomer({ CompId: CompId, AppId: AppId, branchId: BranchId })
);
await dispatch( await dispatch(
getAddCustomerDetails({ getAddCustomerDetails({
CompId: CompId, CompId: CompId,
@ -908,7 +945,11 @@ const BSBillingTable5 = () => {
const handleButtonClick = () => { const handleButtonClick = () => {
if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) {
UpiPayment(); UpiPayment();
} else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { } else if (
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
!refundPaySelected
) {
setMessageType('warning'); setMessageType('warning');
setMessageData('Please Select Refund Payment Method'); setMessageData('Please Select Refund Payment Method');
return; return;
@ -1554,20 +1595,12 @@ const BSBillingTable5 = () => {
}; };
const getBookingTypeId = async () => { const getBookingTypeId = async () => {
let tempconfigdata = await dispatch( setConfigDataList(AllBookingType);
getConfigType({ TypeName: 'Booking Type' }) let configdata = AllBookingType;
).unwrap();
if (tempconfigdata?.data?.statusCode == 1) {
setConfigDataList(tempconfigdata?.data?.data);
let configdata = tempconfigdata?.data?.data;
let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType; let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType;
let filterconfigdata = configdata?.find( let filterconfigdata = configdata?.find((a) => a?.ConfigName === checkName);
(a) => a?.ConfigName === checkName
);
setSelectedBookingType(filterconfigdata?.ConfigId); setSelectedBookingType(filterconfigdata?.ConfigId);
}
}; };
const TotalItemsCalculation = async () => { const TotalItemsCalculation = async () => {
let tempTotalitems = OrderCardDetail?.length; let tempTotalitems = OrderCardDetail?.length;
@ -1751,7 +1784,7 @@ const BSBillingTable5 = () => {
const handleRefundPaymentMode = (id, name) => { const handleRefundPaymentMode = (id, name) => {
setRefundPaySelected(id); setRefundPaySelected(id);
setRefundPaySelectedName(name); setRefundPaySelectedName(name);
} };
const addUpiOption = async (id, name, UPIId) => { const addUpiOption = async (id, name, UPIId) => {
await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDprint(UPIId));
@ -1814,12 +1847,7 @@ const BSBillingTable5 = () => {
const hideDefault = () => { const hideDefault = () => {
setUpiOptionOpen(false); setUpiOptionOpen(false);
}; };
const handlePopoverVisibleChange = (visible) => {
setUpiOptionOpen(visible);
};
const handlePopoverVisibleChangeCard = (visible) => {
setCardOptionOpen(visible);
};
const getHolddata = async () => { const getHolddata = async () => {
const data = { CompId: CompId, BranchId: BranchId, AppId: AppId }; const data = { CompId: CompId, BranchId: BranchId, AppId: AppId };
let response = await dispatch(gettinghold(data)).unwrap(); let response = await dispatch(gettinghold(data)).unwrap();
@ -1915,7 +1943,9 @@ const BSBillingTable5 = () => {
setUpinotSelected(false); setUpinotSelected(false);
setCurrentOrderNetAmount(0); setCurrentOrderNetAmount(0);
setPreviousNetAmount(0); setPreviousNetAmount(0);
if (holdCheckedSalesSetup) {
getHolddata(); getHolddata();
}
if (defaultBookingType === 'Both') { if (defaultBookingType === 'Both') {
await dispatch(changeBookingType('TakeAway')); await dispatch(changeBookingType('TakeAway'));
} }
@ -2214,8 +2244,10 @@ const BSBillingTable5 = () => {
SalesPaymentType: 'normal', SalesPaymentType: 'normal',
PaymentDetail: [ PaymentDetail: [
{ {
PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : PaymentType:
Paybtnnameselected?.toLowerCase() === 'upi' salesBillEdit && currentOrderNetAmount < previousNetAmount
? refundPaySelected
: Paybtnnameselected?.toLowerCase() === 'upi'
? SelectedUPIPayOption?.toLowerCase() === 'pd' ? SelectedUPIPayOption?.toLowerCase() === 'pd'
? PaymentDeviceUPI?.[0]?.ModeId ? PaymentDeviceUPI?.[0]?.ModeId
: SelectedUPIPayOption?.toLowerCase() === 'pg' : SelectedUPIPayOption?.toLowerCase() === 'pg'
@ -2228,15 +2260,25 @@ const BSBillingTable5 = () => {
: paybtnselected : paybtnselected
? paybtnselected ? paybtnselected
: null, : null,
Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), Amount:
MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : salesBillEdit && currentOrderNetAmount < previousNetAmount
Paybtnnameselected?.toLowerCase() === 'upi' && ? previousNetAmount - currentOrderNetAmount
: Math.round(TotalAmount),
MerchantId:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'business' SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantId ?.MerchantId
: null, : null,
PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : PaymentOptionType:
Paybtnnameselected?.toLowerCase() === 'cash' salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'PC' ? 'PC'
: Paybtnnameselected?.toLowerCase() === 'credit' : Paybtnnameselected?.toLowerCase() === 'credit'
? 'PC' ? 'PC'
@ -2249,16 +2291,21 @@ const BSBillingTable5 = () => {
? 'BU' ? 'BU'
: SelectedUPIPayOption : SelectedUPIPayOption
: null, : null,
ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : ModeOfPayment:
SelectedUPIPayOption?.toLowerCase() === 'default' salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: SelectedUPIPayOption?.toLowerCase() === 'default'
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
?.UPIDetailId ?.UPIDetailId
: SelectedUPIPayOption?.toLowerCase() === 'business' : SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ? BusinessPayOption?.find(
?.MerchantUPIId (busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
: null, : null,
AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : AccountDtl:
Paybtnnameselected?.toLowerCase() === 'upi' && salesBillEdit && currentOrderNetAmount < previousNetAmount
? []
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default' SelectedUPIPayOption?.toLowerCase() === 'default'
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
(upipay) => upipay?.UPIId === UpiId (upipay) => upipay?.UPIId === UpiId
@ -2274,8 +2321,10 @@ const BSBillingTable5 = () => {
SelectedCardOption?.toLowerCase() === 'pg') SelectedCardOption?.toLowerCase() === 'pg')
? useOptions?.[0]?.PaymentDetails?.PaymentGateway ? useOptions?.[0]?.PaymentDetails?.PaymentGateway
: [], : [],
PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : PaymentStatus:
Paybtnnameselected?.toLowerCase() === 'cash' salesBillEdit && currentOrderNetAmount < previousNetAmount
? 'S'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'S' ? 'S'
: Paybtnnameselected?.toLowerCase() === 'credit' : Paybtnnameselected?.toLowerCase() === 'credit'
? 'S' ? 'S'
@ -2283,9 +2332,18 @@ const BSBillingTable5 = () => {
SelectedUPIPayOption?.toLowerCase() === 'default' SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S' ? 'S'
: 'P', : 'P',
Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, Debit:
Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && Paybtnnameselected?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
? Math.round(previousNetAmount - currentOrderNetAmount)
: 0,
Credit: salesBillEdit
? currentOrderNetAmount > previousNetAmount &&
Paybtnnameselected?.toLowerCase() === 'credit' Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount)
: 0
: Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount) ? Math.round(TotalAmount)
: 0, : 0,
}, },
@ -3389,8 +3447,10 @@ const BSBillingTable5 = () => {
setDefaultPaymentMode([]); setDefaultPaymentMode([]);
} }
}; };
if (salesBillEdit) {
setDefaultPaymentOption(); setDefaultPaymentOption();
}, [defaultPaymentTrigger]); }
}, [defaultPaymentTrigger, salesBillEdit]);
const Otherserviceprint = async () => { const Otherserviceprint = async () => {
if (OtherServicesPrintDetails?.length > 0) { if (OtherServicesPrintDetails?.length > 0) {
@ -3545,6 +3605,7 @@ const BSBillingTable5 = () => {
}; };
return ( return (
<> <>
<Suspense fallback={<div>Loading</div>}>
<div <div
className={ className={
templateData?.BookingLayout?.[0] === 'Layout6' templateData?.BookingLayout?.[0] === 'Layout6'
@ -3665,7 +3726,10 @@ const BSBillingTable5 = () => {
<div className="BSBillingTable-billtable"> <div className="BSBillingTable-billtable">
<div className="BSBillingTable5-payOpt"> <div className="BSBillingTable5-payOpt">
<div className="payrow1"> <div className="payrow1">
<Messages messageType={messageType} messageData={messageData} /> <Messages
messageType={messageType}
messageData={messageData}
/>
</div> </div>
<div className="payrow2"> <div className="payrow2">
@ -3695,7 +3759,8 @@ const BSBillingTable5 = () => {
: 1, : 1,
}} }}
> >
{paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( {paybtns?.length > 0 &&
currentOrderNetAmount >= previousNetAmount ? (
paybtns?.map((payment) => ( paybtns?.map((payment) => (
<div className="Table3-cash"> <div className="Table3-cash">
<button <button
@ -3704,7 +3769,8 @@ const BSBillingTable5 = () => {
(UpinotSelected || CardoptionnotSelected) (UpinotSelected || CardoptionnotSelected)
? 'Btn-payment-mode-notupisel' ? 'Btn-payment-mode-notupisel'
: paybtnselected === payment.ModeId && : paybtnselected === payment.ModeId &&
(!UpinotSelected || !CardoptionnotSelected) (!UpinotSelected ||
!CardoptionnotSelected)
? 'Btn-payment-mode' ? 'Btn-payment-mode'
: 'Btn-payment-mode-sel' : 'Btn-payment-mode-sel'
} }
@ -3735,7 +3801,8 @@ const BSBillingTable5 = () => {
}} }}
> >
{payment.ModeName} {payment.ModeName}
{payment?.ModeName?.toLowerCase() === 'card' && ( {payment?.ModeName?.toLowerCase() ===
'card' && (
<CardPopover <CardPopover
CardPayOption={CardPayOption} CardPayOption={CardPayOption}
SelectedCardOption={SelectedCardOption} SelectedCardOption={SelectedCardOption}
@ -3773,7 +3840,9 @@ const BSBillingTable5 = () => {
</button> </button>
</div> </div>
)) ))
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( ) : currentOrderNetAmount < previousNetAmount &&
salesBillEdit &&
refundPayBtns.length > 0 ? (
refundPayBtns.map((payment) => ( refundPayBtns.map((payment) => (
<div className="Table3-cash"> <div className="Table3-cash">
<button <button
@ -3782,7 +3851,8 @@ const BSBillingTable5 = () => {
(UpinotSelected || CardoptionnotSelected) (UpinotSelected || CardoptionnotSelected)
? 'Btn-payment-mode-notupisel' ? 'Btn-payment-mode-notupisel'
: refundPaySelected === payment.ConfigId && : refundPaySelected === payment.ConfigId &&
(!UpinotSelected || !CardoptionnotSelected) (!UpinotSelected ||
!CardoptionnotSelected)
? 'Btn-payment-mode' ? 'Btn-payment-mode'
: 'Btn-payment-mode-sel' : 'Btn-payment-mode-sel'
} }
@ -3793,7 +3863,12 @@ const BSBillingTable5 = () => {
? 'blink-animation 0.5s infinite alternate' ? 'blink-animation 0.5s infinite alternate'
: 'none', : 'none',
}} }}
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)} onClick={() =>
handleRefundPaymentMode(
payment?.ConfigId,
payment?.ConfigName
)
}
> >
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */} {/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
@ -3943,7 +4018,10 @@ const BSBillingTable5 = () => {
</div> </div>
</div> </div>
</div> </div>
<div style={{ justifyContent: 'center' }} className="CustomerAddSrch"> <div
style={{ justifyContent: 'center' }}
className="CustomerAddSrch"
>
<div style={{ height: '2.1rem' }}> <div style={{ height: '2.1rem' }}>
{tableOptions {tableOptions
.filter((item) => item.OptionName === 'AddCustomer') .filter((item) => item.OptionName === 'AddCustomer')
@ -4280,8 +4358,10 @@ const BSBillingTable5 = () => {
OrderCardDetail?.length > 0 && OrderCardDetail?.length > 0 &&
paybtnselected && paybtnselected &&
CheckBookingStatus != 'Close' CheckBookingStatus != 'Close'
? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? ? !OrderStatus
'BSBIllingTable5-paybtn-noitems' ? salesBillEdit &&
currentOrderNetAmount < previousNetAmount
? 'BSBIllingTable5-paybtn-noitems'
: 'BSBIllingTable5-paybtn-noitems' : 'BSBIllingTable5-paybtn-noitems'
: 'BSBIllingTable5-paybtn-noitems Order' : 'BSBIllingTable5-paybtn-noitems Order'
: 'BSBIllingTable5-paybtn-noitems-disable' : 'BSBIllingTable5-paybtn-noitems-disable'
@ -4294,7 +4374,15 @@ const BSBillingTable5 = () => {
handleButtonClick handleButtonClick
} }
> >
{!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? <div>Refund: {(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</div> : ( {!OrderStatus ? (
salesBillEdit &&
currentOrderNetAmount < previousNetAmount ? (
<div>
Refund:
{(previousNetAmount || 0) -
(currentOrderNetAmount || 0)}
</div>
) : (
<> <>
{/* ₹ {Math.round(TotalAmount)} */} {/* ₹ {Math.round(TotalAmount)} */}
{isMobile ? ( {isMobile ? (
@ -4323,6 +4411,7 @@ const BSBillingTable5 = () => {
)} )}
<ArrowRightOutlined /> <ArrowRightOutlined />
</> </>
)
) : ( ) : (
<div>ORDER</div> <div>ORDER</div>
)} )}
@ -4405,7 +4494,8 @@ const BSBillingTable5 = () => {
} }
/> />
{PrintOrderDetails?.length > 0 && {PrintOrderDetails?.length > 0 &&
PrintOrderDetails?.[0]?.OrderDetails?.map((orderDetail, index) => ( PrintOrderDetails?.[0]?.OrderDetails?.map(
(orderDetail, index) => (
<div style={{ display: 'none' }}> <div style={{ display: 'none' }}>
<PaymentPdfBooking <PaymentPdfBooking
index={index} index={index}
@ -4424,11 +4514,13 @@ const BSBillingTable5 = () => {
printDatas={printDatas} printDatas={printDatas}
/> />
</div> </div>
))} )
)}
{PrintOrderDetails?.length > 0 && {PrintOrderDetails?.length > 0 &&
(TokenOnly?.SettingValue === 'Y' || (TokenOnly?.SettingValue === 'Y' ||
IndividualToken?.SettingValue === 'Y') && IndividualToken?.SettingValue === 'Y') &&
PrintOrderDetails?.[0]?.OrderDetails?.map((orderDetail, index) => ( PrintOrderDetails?.[0]?.OrderDetails?.map(
(orderDetail, index) => (
<div style={{ display: 'none' }}> <div style={{ display: 'none' }}>
<TokensinglePrint <TokensinglePrint
index={index} index={index}
@ -4445,7 +4537,8 @@ const BSBillingTable5 = () => {
PaymentStatus={PrintOrderDetails?.[0]?.PaymentOrderDtl} PaymentStatus={PrintOrderDetails?.[0]?.PaymentOrderDtl}
/> />
</div> </div>
))} )
)}
{CreditCustomer && ( {CreditCustomer && (
<div style={{ display: 'none' }}> <div style={{ display: 'none' }}>
<BsBillingCreditCustomer <BsBillingCreditCustomer
@ -4489,8 +4582,8 @@ const BSBillingTable5 = () => {
<div> <div>
You have already selected a table. If you click 'OK,' the You have already selected a table. If you click 'OK,' the
table selection will be removed, and the unpaid flow will table selection will be removed, and the unpaid flow will
continue. If you click 'Cancel,' the dine-in flow will proceed continue. If you click 'Cancel,' the dine-in flow will
as selected. proceed as selected.
</div> </div>
</> </>
} }
@ -4503,10 +4596,17 @@ const BSBillingTable5 = () => {
SplitPaymentModal={Splitpayment} SplitPaymentModal={Splitpayment}
handlesplitpaymentclose={handlesplitpaymentclose} handlesplitpaymentclose={handlesplitpaymentclose}
TotalNetAmount={ TotalNetAmount={
OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - OrderType === 'Failed'
? FailedTotalAmt
: Math.round(
OrderCardDetail?.reduce(
(acc, data) => data?.TotalAmt + acc,
0
) -
((OverAllSales > 0 ? OverAllSales : 0) + ((OverAllSales > 0 ? OverAllSales : 0) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) + (OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0))) (Discount > 0 ? Discount : 0))
)
} }
failedOrderData={failedOrderData} failedOrderData={failedOrderData}
/> />
@ -4585,7 +4685,9 @@ const BSBillingTable5 = () => {
) )
} }
CreatedDate={OtherServicesPrintDetails?.CreatedDate} CreatedDate={OtherServicesPrintDetails?.CreatedDate}
PaymentStatus={OtherServicesPrintDetails?.[0]?.PaymentOrderDtl} PaymentStatus={
OtherServicesPrintDetails?.[0]?.PaymentOrderDtl
}
Preference={SettingDataSelector} Preference={SettingDataSelector}
printDatas={printDatas} printDatas={printDatas}
/> />
@ -4695,7 +4797,9 @@ const BSBillingTable5 = () => {
color: '#fff', color: '#fff',
border: 'none', border: 'none',
borderRadius: 4, borderRadius: 4,
cursor: hasVehicleInputErrors() ? 'not-allowed' : 'pointer', cursor: hasVehicleInputErrors()
? 'not-allowed'
: 'pointer',
}} }}
> >
Submit Submit
@ -4777,6 +4881,7 @@ const BSBillingTable5 = () => {
/> />
)} )}
</div> </div>
</Suspense>
</> </>
); );
}; };

View File

@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'; import React, { Suspense, useEffect, useState } from 'react';
import { useSelector, useDispatch } from 'react-redux'; import { useSelector, useDispatch } from 'react-redux';
import { Popconfirm, Tooltip } from 'antd'; import { Popconfirm, Tooltip } from 'antd';
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBillingTable6.scss'; import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBillingTable6.scss';
@ -60,7 +60,9 @@ import {
GlobalOfferAppliedProducts, GlobalOfferAppliedProducts,
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js'; } from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import { AiOutlineClose, AiFillDelete } from 'react-icons/ai'; import { AiOutlineClose, AiFillDelete } from 'react-icons/ai';
import BSBillingEditQuantity from '../BSBillingEditQuantity/BSBillingEditQuantity'; const BSBillingEditQuantity = lazy(
() => import('../BSBillingEditQuantity/BSBillingEditQuantity')
);
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import WebFont from 'webfontloader'; import WebFont from 'webfontloader';
import dineInIcon from '../../../../../Images/Dine In.svg'; import dineInIcon from '../../../../../Images/Dine In.svg';
@ -71,11 +73,17 @@ import {
puttinghold, puttinghold,
} from '../../../../../Features/BookingScreen/HoldOption/HoldOption.js'; } from '../../../../../Features/BookingScreen/HoldOption/HoldOption.js';
import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js'; import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import BSEditTotalAmt from '../BSEditTotalAmount/BSEditTotalAmt.jsx';
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx'; import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import { useUtilsComponent } from '../../../../../Services/utils.js'; import { useUtilsComponent } from '../../../../../Services/utils.js';
import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx'; const BSEditTotalAmt = lazy(
() => import('../BSEditTotalAmount/BSEditTotalAmt.jsx')
);
const BSImeiDetails = lazy(() => import('../BSImeiDetails/BSImeiDetails.jsx'));
const CustomerPriceHistory = lazy(
() => import('../../UtillComponents/CustomerPriceHistory.jsx')
);
const BSBillingTable6 = () => { const BSBillingTable6 = () => {
const { removeExtraCharge } = useUtilsComponent(); const { removeExtraCharge } = useUtilsComponent();
@ -134,7 +142,8 @@ const BSBillingTable6 = () => {
const GetCustId = useSelector(GlobalCustId); const GetCustId = useSelector(GlobalCustId);
const selectedCustomer = useSelector(GlobalSelOption); const selectedCustomer = useSelector(GlobalSelOption);
const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false); const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] =
useState(false);
const [customerProduct, setCustomerProduct] = useState(null); const [customerProduct, setCustomerProduct] = useState(null);
const [OpenImeiDetail, setOpenImeiDetail] = useState(false); const [OpenImeiDetail, setOpenImeiDetail] = useState(false);
const [shortKeyMethod, setshortKeyMethod] = useState(null); const [shortKeyMethod, setshortKeyMethod] = useState(null);
@ -221,9 +230,6 @@ const BSBillingTable6 = () => {
} }
}, [tableData]); }, [tableData]);
// useEffect(() => {
// setPreviousdataLength(PreviousOrderLength)
// }, [PreviousOrderLength])
useEffect(() => { useEffect(() => {
if (tableOptions?.length > 0) { if (tableOptions?.length > 0) {
let editFieldValue = tableOptions?.filter( let editFieldValue = tableOptions?.filter(
@ -285,7 +291,6 @@ const BSBillingTable6 = () => {
event.preventDefault(); event.preventDefault();
handleShortcut('weightAmount'); handleShortcut('weightAmount');
} }
}; };
window.addEventListener('keydown', handleKeyDown); window.addEventListener('keydown', handleKeyDown);
@ -1715,7 +1720,6 @@ const BSBillingTable6 = () => {
OfferId: FreeProd?.OfferId, OfferId: FreeProd?.OfferId,
CompleteRemove: true, CompleteRemove: true,
}); });
// await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
await ChangeOfferAppliedProdsFn({ await ChangeOfferAppliedProdsFn({
inwardDtlId: item?.InwardDtlId, inwardDtlId: item?.InwardDtlId,
OfferAmount: isPaidproduct?.OrderRate * isPaidproduct?.OrderQty, OfferAmount: isPaidproduct?.OrderRate * isPaidproduct?.OrderQty,
@ -1725,8 +1729,6 @@ const BSBillingTable6 = () => {
}); });
} }
} else { } else {
//have to find if thereis two Booking Type is there
//Convert That Free Product To Paid Product
let ischeckBothBookingType = tableData?.find( let ischeckBothBookingType = tableData?.find(
(e) => (e) =>
e?.InwardDtlId == inward && e?.InwardDtlId == inward &&
@ -1741,12 +1743,6 @@ const BSBillingTable6 = () => {
e?.BookingTypeName == item?.BookingTypeName e?.BookingTypeName == item?.BookingTypeName
); );
if (ischeckBothBookingType) { 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) { if (FreeProductSameBookingType?.OrderQty >= item?.OrderQty) {
await ChangeFreeprodlistFn({ await ChangeFreeprodlistFn({
OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty, OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
@ -1779,7 +1775,6 @@ const BSBillingTable6 = () => {
}); });
} else { } else {
let data = isCheckFreeProductOutside?.FreeQty - item?.OrderQty; let data = isCheckFreeProductOutside?.FreeQty - item?.OrderQty;
//First i Calculate Another Booking Type Qty
let anotherBookingType = tableData?.find( let anotherBookingType = tableData?.find(
(e) => (e) =>
e?.InwardDtlId == item?.InwardDtlId && e?.InwardDtlId == item?.InwardDtlId &&
@ -1796,24 +1791,10 @@ const BSBillingTable6 = () => {
let diff = let diff =
item?.OrderQty - FreeProductSameBookingType?.OrderQty; 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 ( if (
(anotherBookingType?.OrderQty || 0) < (anotherBookingType?.OrderQty || 0) <
anotherBookingTypeOffer?.OrderQty anotherBookingTypeOffer?.OrderQty
) { ) {
//paidproduct ischeckBothBookingType?.OrderQty-anotherBookingType?.OrderQty
//PaidProdcut Current BookingType FreeProductSameBookingType?.OrderQty
let paidproductAnotherType = let paidproductAnotherType =
ischeckBothBookingType?.OrderQty - ischeckBothBookingType?.OrderQty -
anotherBookingType?.OrderQty; anotherBookingType?.OrderQty;
@ -1965,144 +1946,7 @@ const BSBillingTable6 = () => {
} }
} }
} }
}; };
// const removeFromCart = async (item) => {
// setPreviousdataLength(tableData?.length);
// if (item?.BookingTypeName !== 'Dine In' && OrderType !== 'Hold') {
// const UpdatedData = tableData?.filter(
// (cartItem) =>
// !(
// cartItem?.ProdId === item?.ProdId &&
// cartItem?.InwardDtlId === item?.InwardDtlId &&
// cartItem?.OrderRate === item?.OrderRate &&
// cartItem?.BookingTypeName === item?.BookingTypeName &&
// !cartItem?.SalesId
// )
// );
// if (OfferCheckedInSetup && preferenceOffer) {
// await applyOffer(UpdatedData);
// } else {
// dispatch(changeOrderCardDetails(UpdatedData));
// }
// await dispatch(
// ChangeTotalAmount(
// GlobalExtraCharge?.filter((extra) => {
// if (BookingType === 'Dine In') {
// // Remove extra charges linked to the removed product
// return !(extra.ProdId === item?.ProdId && !extra.SalesId);
// } else if (BookingType === 'TakeAway') {
// // Remove extra charges only if SalesId is not present
// return extra.ProdId !== item?.ProdId;
// }
// return true; // Keep everything else
// })
// )
// );
// // if the quantity of the item is 1, remove the item from the cart
// if (tableData?.length <= 1) {
// await dispatch(changeReorderHoldDetails({}));
// await dispatch(changeReorderProductDetails([]));
// await dispatch(changeUnpaidData(false));
// await dispatch(changeBookingType('TakeAway'));
// await dispatch(changeTokenOnly(false));
// await dispatch(changeAllProductTokenAvailable(false));
// await dispatch(ChangeOverAllDiscSales(null));
// await dispatch(ChangeOverAllDiscEstimate(null));
// await dispatch(changeSelProdWiseEst([]));
// await dispatch(ChangeTotalAmount([]));
// }
// } else if (item?.BookingTypeName !== 'Dine In' && OrderType === 'Hold') {
// const UpdatedData = tableData?.filter(
// (cartItem) =>
// !(
// cartItem?.ProdId === item?.ProdId &&
// cartItem?.InwardDtlId === item?.InwardDtlId &&
// cartItem?.OrderRate === item?.OrderRate &&
// cartItem?.BookingTypeName === item?.BookingTypeName
// )
// );
// if (OfferCheckedInSetup && preferenceOffer) {
// await applyOffer(UpdatedData);
// } else {
// dispatch(changeOrderCardDetails(UpdatedData));
// }
// await dispatch(
// ChangeTotalAmount(
// GlobalExtraCharge?.filter((extra) => {
// if (BookingType === 'Dine In') {
// // Remove extra charges linked to the removed product
// return !(extra.ProdId === item?.ProdId && !extra.SalesId);
// } else if (BookingType === 'TakeAway') {
// // Remove extra charges only if SalesId is not present
// return extra.ProdId !== item?.ProdId;
// }
// return true; // Keep everything else
// })
// )
// );
// // if the quantity of the item is 1, remove the item from the cart
// if (tableData?.length <= 1) {
// await dispatch(changeReorderHoldDetails({}));
// await dispatch(changeReorderProductDetails([]));
// await dispatch(changeUnpaidData(false));
// await dispatch(changeBookingType('TakeAway'));
// await dispatch(changeTokenOnly(false));
// await dispatch(changeAllProductTokenAvailable(false));
// await dispatch(ChangeOverAllDiscSales(null));
// await dispatch(ChangeOverAllDiscEstimate(null));
// await dispatch(changeSelProdWiseEst([]));
// await dispatch(ChangeTotalAmount([]));
// }
// } else if (item?.BookingTypeName === 'Dine In') {
// const UpdatedData = tableData?.filter(
// (cartItem) =>
// !(
// cartItem?.ProdId === item?.ProdId &&
// cartItem?.InwardDtlId === item?.InwardDtlId &&
// cartItem?.OrderRate === item?.OrderRate &&
// cartItem?.BookingTypeName === item?.BookingTypeName &&
// !cartItem?.SalesId
// )
// );
// if (OfferCheckedInSetup && preferenceOffer) {
// await applyOffer(UpdatedData);
// } else {
// dispatch(changeOrderCardDetails(UpdatedData));
// }
// await dispatch(
// ChangeTotalAmount(
// GlobalExtraCharge?.filter((extra) => {
// if (BookingType === 'Dine In') {
// // Remove extra charges linked to the removed product
// return !(extra.ProdId === item?.ProdId && !extra.SalesId);
// } else if (BookingType === 'TakeAway') {
// // Remove extra charges only if SalesId is not present
// return extra.ProdId !== item?.ProdId;
// }
// return true; // Keep everything else
// })
// )
// ); // if the quantity of the item is 1, remove the item from the cart
// if (tableData?.length <= 1) {
// await dispatch(changeReorderHoldDetails({}));
// await dispatch(changeReorderProductDetails([]));
// await dispatch(changeUnpaidData(false));
// await dispatch(ChangeSelectedCustDisable(false));
// await dispatch(changeSelectedOption(false));
// await dispatch(changeBookingType('TakeAway'));
// await dispatch(changeTokenOnly(false));
// await dispatch(changeAllProductTokenAvailable(false));
// await dispatch(ChangeOverAllDiscSales(null));
// await dispatch(ChangeOverAllDiscEstimate(null));
// await dispatch(changeSelProdWiseEst([]));
// await dispatch(ChangeTotalAmount([]));
// }
// }
// };
function safeRound(amountStr) { function safeRound(amountStr) {
if (amountStr == null) return allowDecimal ? '0.00' : '0'; if (amountStr == null) return allowDecimal ? '0.00' : '0';
@ -2118,7 +1962,7 @@ const BSBillingTable6 = () => {
const handleCustomerProductPriceHistory = (item) => { const handleCustomerProductPriceHistory = (item) => {
setCustomerPriceHistoryOpen(true); setCustomerPriceHistoryOpen(true);
setCustomerProduct(item?.ProdId); setCustomerProduct(item?.ProdId);
} };
const OpenEditTotalAmount = () => { const OpenEditTotalAmount = () => {
setOpenEditTotalAmt(true); setOpenEditTotalAmt(true);
@ -2142,6 +1986,7 @@ const BSBillingTable6 = () => {
}; };
return ( return (
<Suspense fallback={<div>Loading...</div>}>
<div <div
className={ className={
true true
@ -2384,7 +2229,8 @@ const BSBillingTable6 = () => {
? 'wheat' ? 'wheat'
: triggerAnimation && : triggerAnimation &&
index === 0 && index === 0 &&
tableDataTakeAway?.length >= PreviousdataLength && tableDataTakeAway?.length >=
PreviousdataLength &&
!HoldOrderDtl && !HoldOrderDtl &&
!UnpaidData !UnpaidData
? 'wheat' ? 'wheat'
@ -2454,7 +2300,8 @@ const BSBillingTable6 = () => {
} }
> >
{item.ProdName} {item.ProdName}
&nbsp; {item?.BrandName !== null ? item?.BrandName : ''} &nbsp;{' '}
{item?.BrandName !== null ? item?.BrandName : ''}
{item?.Type != 'C' && ( {item?.Type != 'C' && (
<> <>
<p <p
@ -2708,7 +2555,8 @@ const BSBillingTable6 = () => {
}} }}
> >
{item.ProdName} {item.ProdName}
&nbsp; {item?.BrandName !== null ? item?.BrandName : ''} &nbsp;{' '}
{item?.BrandName !== null ? item?.BrandName : ''}
{item?.Type != 'C' && ( {item?.Type != 'C' && (
<> <>
<p <p
@ -2905,7 +2753,8 @@ const BSBillingTable6 = () => {
OldtableDataTakeAway?.length + OldtableDataTakeAway?.length +
index === index ===
0 && 0 &&
tableDataTakeAway?.length >= PreviousdataLength && tableDataTakeAway?.length >=
PreviousdataLength &&
!HoldOrderDtl && !HoldOrderDtl &&
!UnpaidData !UnpaidData
? 'wheat' ? 'wheat'
@ -2916,7 +2765,9 @@ const BSBillingTable6 = () => {
0 0
? 'white' ? 'white'
: SelectedBillColor?.['OverallBackgroundColor'] : SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor'] ? SelectedBillColor?.[
'OverallBackgroundColor'
]
: '#d6d6d6' : '#d6d6d6'
: (OldtableDataDinein?.length + : (OldtableDataDinein?.length +
OldtableDataTakeAway?.length + OldtableDataTakeAway?.length +
@ -3000,7 +2851,8 @@ const BSBillingTable6 = () => {
} }
> >
{item.ProdName} {item.ProdName}
&nbsp; {item?.BrandName !== null ? item?.BrandName : ''} &nbsp;{' '}
{item?.BrandName !== null ? item?.BrandName : ''}
{item?.Type != 'C' && ( {item?.Type != 'C' && (
<> <>
<p <p
@ -3288,7 +3140,8 @@ const BSBillingTable6 = () => {
}} }}
> >
{item.ProdName} {item.ProdName}
&nbsp; {item?.BrandName !== null ? item?.BrandName : ''} &nbsp;{' '}
{item?.BrandName !== null ? item?.BrandName : ''}
{item?.Type != 'C' && ( {item?.Type != 'C' && (
<> <>
<p <p
@ -3462,7 +3315,7 @@ const BSBillingTable6 = () => {
ProductDetail={Modaldata} ProductDetail={Modaldata}
/> />
)} )}
{(customerPriceHistoryOpen && GetCustId) && {customerPriceHistoryOpen && GetCustId && (
<CustomerPriceHistory <CustomerPriceHistory
open={customerPriceHistoryOpen} open={customerPriceHistoryOpen}
custId={GetCustId} custId={GetCustId}
@ -3471,8 +3324,9 @@ const BSBillingTable6 = () => {
setCustomerProduct={setCustomerProduct} setCustomerProduct={setCustomerProduct}
selectedCustomer={selectedCustomer} selectedCustomer={selectedCustomer}
/> />
} )}
</div> </div>
</Suspense>
); );
}; };

View File

@ -1,11 +1,11 @@
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef, lazy } from 'react';
import { shallowEqual, useDispatch, useSelector } from 'react-redux'; import { shallowEqual, useDispatch, useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import moment from 'moment'; import moment from 'moment';
import { AiOutlineClose, AiOutlineArrowRight } from 'react-icons/ai'; import { AiOutlineClose, AiOutlineArrowRight } from 'react-icons/ai';
import { Tables } from '../../../../../Components/Tables/Table'; import { Tables } from '../../../../../Components/Tables/Table';
import { DefaultModal } from '../../../../../Components/Modal/DefaultModal.jsx'; import { DefaultModal } from '../../../../../Components/Modal/DefaultModal.jsx';
import { UpCircleOutlined, UpOutlined } from '@ant-design/icons'; import { UpCircleOutlined } from '@ant-design/icons';
import { Popover, Badge, Modal, Tooltip } from 'antd'; import { Popover, Badge, Modal, Tooltip } from 'antd';
import { import {
printDiv, printDiv,
@ -38,7 +38,6 @@ import {
GlobalSelectedTableDetails, GlobalSelectedTableDetails,
GlobalBookingType, GlobalBookingType,
changeBookingType, changeBookingType,
getConfigType,
PutBookingData, PutBookingData,
GlobalReorderHoldDetails, GlobalReorderHoldDetails,
getUnpaidData, getUnpaidData,
@ -61,7 +60,6 @@ import {
changeCustomerID, changeCustomerID,
changeSelectedCustId, changeSelectedCustId,
GlobalSelOption, GlobalSelOption,
changefocusStatusBalrec,
changeUnpaidData, changeUnpaidData,
ChangeSelectedCustDisable, ChangeSelectedCustDisable,
getSalesDetailData, getSalesDetailData,
@ -104,7 +102,6 @@ import {
ChangeOverAllDiscEstimate, ChangeOverAllDiscEstimate,
GlobalScreenSize, GlobalScreenSize,
GlobalUnpaidListData, GlobalUnpaidListData,
getAllCustomer,
GlobalBranchFinancialStatus, GlobalBranchFinancialStatus,
changeSummeryComboOfferAmount, changeSummeryComboOfferAmount,
ChangeComboCarddata, ChangeComboCarddata,
@ -129,6 +126,7 @@ import {
changeBillEditingMode, changeBillEditingMode,
changePreviousOrderPayment, changePreviousOrderPayment,
changePreviousOrderOfferDetail, changePreviousOrderOfferDetail,
GlobalAllBookingType,
} from '../../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../../Features/BookingScreen/BookingData/BookingData';
import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities'; import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities';
import { import {
@ -159,7 +157,6 @@ import QrinScreen from '../../BookingFunctionality/DynamicScreenQr.jsx';
import { ArrowRightOutlined } from '@ant-design/icons'; import { ArrowRightOutlined } from '@ant-design/icons';
import Buttons from '../../../../../Components/Forms/Buttons'; import Buttons from '../../../../../Components/Forms/Buttons';
import WpIcon from '../../../../../Images/message.png'; import WpIcon from '../../../../../Images/message.png';
import BsBillingCreditCustomer from '../../BookingFunctionality/BSBillingCreditCustomer.jsx';
import BSCreditCustomer from '../../UtillComponents/BSCreditCustomer.jsx'; import BSCreditCustomer from '../../UtillComponents/BSCreditCustomer.jsx';
import PozoAdvanceIcon from '../../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx'; import PozoAdvanceIcon from '../../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
@ -174,17 +171,10 @@ import { getCustomerDisplayWindow } from '../../../../../Features/customerDispla
import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js'; import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js';
import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx'; import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx';
import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx'; import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx';
import { import { Global_OverallOfferAmount } from '../../../../../Features/Offer/Offer.js';
Global_CoupenCodeAmount,
Global_loyaltyPointsDiscountAmount,
Global_OrderOfferDetail,
Global_OverallOfferAmount,
Global_SalesWiseOfferAmount,
} from '../../../../../Features/Offer/Offer.js';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx'; import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip'; import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip';
import { useAuth } from '../../../../../AuthContext.jsx'; import { useAuth } from '../../../../../AuthContext.jsx';
import PaymentInput from '../BSBillingTable1/BalanceAndReceived.jsx';
import { GlobalBookingStatus } from '../../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js'; import { GlobalBookingStatus } from '../../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js';
import { import {
changeSalesPaymentoption, changeSalesPaymentoption,
@ -193,15 +183,11 @@ import {
import Paymentoption from '../../../../Payment/PaymentOptions/PaymentOptions.jsx'; import Paymentoption from '../../../../Payment/PaymentOptions/PaymentOptions.jsx';
import { getPaymentOptionsData } from '../../../../../Features/BookingScreen/BookingData/KioskBookingData.js'; import { getPaymentOptionsData } from '../../../../../Features/BookingScreen/BookingData/KioskBookingData.js';
import { getCombolist } from '../../../../../Features/ComboMaster/ComboMaster.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 { MdSms } from 'react-icons/md';
import { FaWhatsapp, FaPrint, FaCartPlus } from 'react-icons/fa'; import { FaWhatsapp, FaPrint, FaCartPlus } from 'react-icons/fa';
import BSTipAmount from '../../UtillComponents/BSTipAmount.jsx';
import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js'; import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js';
import { TfiClipboard } from 'react-icons/tfi'; import { TfiClipboard } from 'react-icons/tfi';
import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js'; import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js';
import OtherServicePrintStyle1 from '../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx';
import OtherServiceMobilePrint from '../../BookingFunctionality/OtherServiceMobilePrint.jsx'; import OtherServiceMobilePrint from '../../BookingFunctionality/OtherServiceMobilePrint.jsx';
import BSOtherServiceClaim from '../../UtillComponents/BSOtherServiceClaim.jsx'; import BSOtherServiceClaim from '../../UtillComponents/BSOtherServiceClaim.jsx';
import { MobilePdfPrint } from '../../BookingFunctionality/MobilePdfPrint.js'; import { MobilePdfPrint } from '../../BookingFunctionality/MobilePdfPrint.js';
@ -221,10 +207,24 @@ import pozologoimg from '../../../../../Images/pozologoimg.png';
import MobileMultiPdfPrintTrigger from '../../UtillComponents/MobileMultiPdfPrintTrigger.jsx'; import MobileMultiPdfPrintTrigger from '../../UtillComponents/MobileMultiPdfPrintTrigger.jsx';
import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js'; import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js';
import CustomerOrders from '../../BookingFunctionality/CustomerOrders.jsx'; 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 subDirectory = import.meta.env.ENV_BASE_URL;
const MainHomeUrl = import.meta.env.ENV_MAIN_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 currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
@ -239,6 +239,7 @@ const BST6Payment = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const FreeProdList = useSelector(GlobalFreeProdList); const FreeProdList = useSelector(GlobalFreeProdList);
const offerAppliedProducts = useSelector(GlobalOfferAppliedProducts); const offerAppliedProducts = useSelector(GlobalOfferAppliedProducts);
const AllBookingType = useSelector(GlobalAllBookingType);
const defaultBookingType = useSelector(GlobalDefaultBookingType); const defaultBookingType = useSelector(GlobalDefaultBookingType);
const appPreferences = useSelector(ApplicationPreferences); const appPreferences = useSelector(ApplicationPreferences);
const bookingTypePreference = appPreferences?.find( const bookingTypePreference = appPreferences?.find(
@ -251,7 +252,9 @@ const BST6Payment = () => {
); );
const salesBillEdit = useSelector(GlobalSalesBillEdit); const salesBillEdit = useSelector(GlobalSalesBillEdit);
const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); const previousOrderOfferDetails = useSelector(
GlobalPreviousOrderOfferDetails
);
const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
const screenwidth = useSelector(GlobalScreenSize); const screenwidth = useSelector(GlobalScreenSize);
const printerTemplateStyle = useSelector(SelectedPrintTemplate); const printerTemplateStyle = useSelector(SelectedPrintTemplate);
@ -298,7 +301,9 @@ const BST6Payment = () => {
const prodCat = useSelector(GlobalProductCategorie); const prodCat = useSelector(GlobalProductCategorie);
const ProdSubCat = useSelector(GlobalProductSubCategorie); const ProdSubCat = useSelector(GlobalProductSubCategorie);
const templateData = useSelector(getTemplateData); const templateData = useSelector(getTemplateData);
const BranchFinancialStatus = useSelector(GlobalBranchFinancialStatus); const holdCheckedSalesSetup = tableOptions?.some(
(item) => item?.OptionName === 'Hold'
);
const tableOptions = templateData?.BookingBilling?.[1]; const tableOptions = templateData?.BookingBilling?.[1];
const OfferCheckedInSetup = templateData?.BookingNavbar?.[1].some( const OfferCheckedInSetup = templateData?.BookingNavbar?.[1].some(
(item) => item?.OptionName == 'Offer' (item) => item?.OptionName == 'Offer'
@ -484,7 +489,6 @@ const BST6Payment = () => {
}, [salesBillEdit]); }, [salesBillEdit]);
useEffect(() => { useEffect(() => {
if (salesBillEdit) { if (salesBillEdit) {
if (SelCustId) { if (SelCustId) {
setRefundPayBtns(AllPaymentOptions); setRefundPayBtns(AllPaymentOptions);
@ -499,8 +503,7 @@ const BST6Payment = () => {
setRefundPayBtns(withoutCustomer); setRefundPayBtns(withoutCustomer);
} }
} }
}, [AllPaymentOptions, SelCustId, salesBillEdit]);
}, [AllPaymentOptions, SelCustId, salesBillEdit])
console.log(PrintOrderDetails, 'PrintOrderDetails'); console.log(PrintOrderDetails, 'PrintOrderDetails');
useEffect(() => { useEffect(() => {
if (selOption) { if (selOption) {
@ -608,14 +611,21 @@ const BST6Payment = () => {
const filteredPayments = const filteredPayments =
previousOrderPayment?.filter( previousOrderPayment?.filter(
p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment (p) =>
p?.LastOrderTran === 'Y' &&
p?.AfterAdjustment != null &&
p?.AfterAdjustment !== '' &&
p?.AfterAdjustment
) || []; ) || [];
const paymentsToUse = const paymentsToUse =
filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; filteredPayments.length > 0
? filteredPayments
: previousOrderPayment || [];
const totalPreviouspayment = paymentsToUse?.reduce( const totalPreviouspayment = paymentsToUse?.reduce(
(acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), (acc, payment) =>
acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
0 0
); );
@ -624,8 +634,7 @@ const BST6Payment = () => {
0 0
); );
const previousNetAmount = const previousNetAmount = totalPreviouspayment || 0;
(totalPreviouspayment) || 0;
let withdiscTotal = let withdiscTotal =
Total - Total -
@ -637,12 +646,26 @@ const BST6Payment = () => {
withdiscTotal >= 0 withdiscTotal >= 0
? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2)
: (Number(Total) + Number(globalTipAmount)).toFixed(2) : (Number(Total) + Number(globalTipAmount)).toFixed(2)
) );
setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); setTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
);
setCurrentOrderNetAmount(currentOrderNetAmount); setCurrentOrderNetAmount(currentOrderNetAmount);
setPreviousNetAmount(previousNetAmount); setPreviousNetAmount(previousNetAmount);
dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(
changeSummeryTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
)
);
dispatch(changeSummeryComboOfferAmount(withComboSum)); dispatch(changeSummeryComboOfferAmount(withComboSum));
@ -672,8 +695,8 @@ const BST6Payment = () => {
UserId: UserId, UserId: UserId,
}; };
dispatch(getPrinterMappingDetails(data)).unwrap(); dispatch(getPrinterMappingDetails(data)).unwrap();
const Data1 = { AppId, CompId, BranchId }; // const Data1 = { AppId, CompId, BranchId };
dispatch(getPrintSelectionComponentData(Data1)).unwrap(); // dispatch(getPrintSelectionComponentData(Data1)).unwrap();
}, []); }, []);
//mohan stoped data //mohan stoped data
useEffect(() => { useEffect(() => {
@ -919,27 +942,6 @@ const BST6Payment = () => {
} }
}; };
// 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(() => { useEffect(() => {
if (!PrintOrderDetails?.length) return; if (!PrintOrderDetails?.length) return;
@ -1047,8 +1049,10 @@ const BST6Payment = () => {
}; };
useEffect(() => { useEffect(() => {
if (CompId && BranchId && AppId) { if (CompId && BranchId && AppId) {
if (holdCheckedSalesSetup) {
getHolddata(); getHolddata();
getUnpaiddatas(); }
// getUnpaiddatas();
getCustomerData(); getCustomerData();
} }
}, [CompId, BranchId, AppId]); }, [CompId, BranchId, AppId]);
@ -1136,9 +1140,6 @@ const BST6Payment = () => {
setEmpData(datas?.[0]); setEmpData(datas?.[0]);
}; };
const getCustomerData = async () => { const getCustomerData = async () => {
await dispatch(
getAllCustomer({ CompId: CompId, AppId: AppId, branchId: BranchId })
);
await dispatch( await dispatch(
getAddCustomerDetails({ getAddCustomerDetails({
CompId: CompId, CompId: CompId,
@ -1235,7 +1236,11 @@ const BST6Payment = () => {
const handleButtonClick = () => { const handleButtonClick = () => {
if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) {
UpiPayment(); UpiPayment();
} else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { } else if (
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
!refundPaySelected
) {
setMessageType('warning'); setMessageType('warning');
setMessageData('Please Select Refund Payment Method'); setMessageData('Please Select Refund Payment Method');
return; return;
@ -1564,28 +1569,7 @@ const BST6Payment = () => {
setPaybtnnameselected(PaymentOptionsModeName); setPaybtnnameselected(PaymentOptionsModeName);
setPaybtnselected(PaymentOptionsModeId); setPaybtnselected(PaymentOptionsModeId);
}, [PaymentOptions]); }, [PaymentOptions]);
// 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(() => { useEffect(() => {
getBookingTypeId(); getBookingTypeId();
}, [BookingType, BookingTypeBoth]); }, [BookingType, BookingTypeBoth]);
@ -1610,20 +1594,12 @@ const BST6Payment = () => {
}; };
const getBookingTypeId = async () => { const getBookingTypeId = async () => {
let tempconfigdata = await dispatch( setConfigDataList(AllBookingType);
getConfigType({ TypeName: 'Booking Type' }) let configdata = AllBookingType;
).unwrap();
if (tempconfigdata?.data?.statusCode == 1) {
setConfigDataList(tempconfigdata?.data?.data);
let configdata = tempconfigdata?.data?.data;
let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType; let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType;
let filterconfigdata = configdata?.find( let filterconfigdata = configdata?.find((a) => a?.ConfigName === checkName);
(a) => a?.ConfigName === checkName
);
setSelectedBookingType(filterconfigdata?.ConfigId); setSelectedBookingType(filterconfigdata?.ConfigId);
}
}; };
const gettodaydate = () => { const gettodaydate = () => {
const currentDate = new Date(); const currentDate = new Date();
@ -1702,7 +1678,7 @@ const BST6Payment = () => {
const handleRefundPaymentMode = (id, name) => { const handleRefundPaymentMode = (id, name) => {
setRefundPaySelected(id); setRefundPaySelected(id);
setRefundPaySelectedName(name); setRefundPaySelectedName(name);
} };
const addUpiOption = async (id, name, UPIId) => { const addUpiOption = async (id, name, UPIId) => {
await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDprint(UPIId));
@ -1957,7 +1933,9 @@ const BST6Payment = () => {
setUpinotSelected(false); setUpinotSelected(false);
setCurrentOrderNetAmount(0); setCurrentOrderNetAmount(0);
setPreviousNetAmount(0); setPreviousNetAmount(0);
if (holdCheckedSalesSetup) {
getHolddata(); getHolddata();
}
if (defaultBookingType === 'Both') { if (defaultBookingType === 'Both') {
await dispatch(changeBookingType('TakeAway')); await dispatch(changeBookingType('TakeAway'));
} }
@ -2254,8 +2232,10 @@ const BST6Payment = () => {
SalesPaymentType: 'normal', SalesPaymentType: 'normal',
PaymentDetail: [ PaymentDetail: [
{ {
PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : PaymentType:
Paybtnnameselected?.toLowerCase() === 'upi' salesBillEdit && currentOrderNetAmount < previousNetAmount
? refundPaySelected
: Paybtnnameselected?.toLowerCase() === 'upi'
? SelectedUPIPayOption?.toLowerCase() === 'pd' ? SelectedUPIPayOption?.toLowerCase() === 'pd'
? PaymentDeviceUPI?.[0]?.ModeId ? PaymentDeviceUPI?.[0]?.ModeId
: SelectedUPIPayOption?.toLowerCase() === 'pg' : SelectedUPIPayOption?.toLowerCase() === 'pg'
@ -2268,15 +2248,25 @@ const BST6Payment = () => {
: paybtnselected : paybtnselected
? paybtnselected ? paybtnselected
: null, : null,
Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), Amount:
MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : salesBillEdit && currentOrderNetAmount < previousNetAmount
Paybtnnameselected?.toLowerCase() === 'upi' && ? previousNetAmount - currentOrderNetAmount
: Math.round(TotalAmount),
MerchantId:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'business' SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantId ?.MerchantId
: null, : null,
PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : PaymentOptionType:
Paybtnnameselected?.toLowerCase() === 'cash' salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'PC' ? 'PC'
: Paybtnnameselected?.toLowerCase() === 'credit' : Paybtnnameselected?.toLowerCase() === 'credit'
? 'PC' ? 'PC'
@ -2289,16 +2279,21 @@ const BST6Payment = () => {
? 'BU' ? 'BU'
: SelectedUPIPayOption : SelectedUPIPayOption
: null, : null,
ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : ModeOfPayment:
SelectedUPIPayOption?.toLowerCase() === 'default' salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: SelectedUPIPayOption?.toLowerCase() === 'default'
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
?.UPIDetailId ?.UPIDetailId
: SelectedUPIPayOption?.toLowerCase() === 'business' : SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ? BusinessPayOption?.find(
?.MerchantUPIId (busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
: null, : null,
AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : AccountDtl:
Paybtnnameselected?.toLowerCase() === 'upi' && salesBillEdit && currentOrderNetAmount < previousNetAmount
? []
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default' SelectedUPIPayOption?.toLowerCase() === 'default'
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
(upipay) => upipay?.UPIId === UpiId (upipay) => upipay?.UPIId === UpiId
@ -2314,8 +2309,10 @@ const BST6Payment = () => {
SelectedCardOption?.toLowerCase() === 'pg') SelectedCardOption?.toLowerCase() === 'pg')
? useOptions?.[0]?.PaymentDetails?.PaymentGateway ? useOptions?.[0]?.PaymentDetails?.PaymentGateway
: [], : [],
PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : PaymentStatus:
Paybtnnameselected?.toLowerCase() === 'cash' salesBillEdit && currentOrderNetAmount < previousNetAmount
? 'S'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'S' ? 'S'
: Paybtnnameselected?.toLowerCase() === 'credit' : Paybtnnameselected?.toLowerCase() === 'credit'
? 'S' ? 'S'
@ -2323,9 +2320,18 @@ const BST6Payment = () => {
SelectedUPIPayOption?.toLowerCase() === 'default' SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S' ? 'S'
: 'P', : 'P',
Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, Debit:
Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && Paybtnnameselected?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
? Math.round(previousNetAmount - currentOrderNetAmount)
: 0,
Credit: salesBillEdit
? currentOrderNetAmount > previousNetAmount &&
Paybtnnameselected?.toLowerCase() === 'credit' Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount)
: 0
: Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount) ? Math.round(TotalAmount)
: 0, : 0,
}, },
@ -3323,8 +3329,10 @@ const BST6Payment = () => {
setDefaultPaymentMode([]); setDefaultPaymentMode([]);
} }
}; };
if (salesBillEdit) {
setDefaultPaymentOption(); setDefaultPaymentOption();
}, [defaultPaymentTrigger]); }
}, [defaultPaymentTrigger, salesBillEdit]);
const Otherserviceprint = async () => { const Otherserviceprint = async () => {
if (OtherServicesPrintDetails?.length > 0) { if (OtherServicesPrintDetails?.length > 0) {
@ -3478,6 +3486,7 @@ const BST6Payment = () => {
); );
}; };
return ( return (
<Suspense fallback={<div>Suspense Loading...</div>}>
<> <>
{(addcustomer || hold) && ( {(addcustomer || hold) && (
<FeaturesFunctionalities <FeaturesFunctionalities
@ -3764,7 +3773,8 @@ const BST6Payment = () => {
: 1, : 1,
}} }}
> >
{paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( {paybtns?.length > 0 &&
currentOrderNetAmount >= previousNetAmount ? (
paybtns?.map((payment) => ( paybtns?.map((payment) => (
<div className="Table6-cash"> <div className="Table6-cash">
<button <button
@ -3844,7 +3854,9 @@ const BST6Payment = () => {
</button> </button>
</div> </div>
)) ))
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( ) : currentOrderNetAmount < previousNetAmount &&
salesBillEdit &&
refundPayBtns.length > 0 ? (
refundPayBtns.map((payment) => ( refundPayBtns.map((payment) => (
<div className="Table6-cash"> <div className="Table6-cash">
<button <button
@ -3864,7 +3876,12 @@ const BST6Payment = () => {
? 'blink-animation 0.5s infinite alternate' ? 'blink-animation 0.5s infinite alternate'
: 'none', : 'none',
}} }}
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)} onClick={() =>
handleRefundPaymentMode(
payment?.ConfigId,
payment?.ConfigName
)
}
> >
<div <div
style={{ style={{
@ -3902,8 +3919,10 @@ const BST6Payment = () => {
OrderCardDetail?.length > 0 && OrderCardDetail?.length > 0 &&
paybtnselected && paybtnselected &&
CheckBookingStatus != 'Close' CheckBookingStatus != 'Close'
? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? ? !OrderStatus
'BST6Payment-Button-pay' ? salesBillEdit &&
currentOrderNetAmount < previousNetAmount
? 'BST6Payment-Button-pay'
: 'BST6Payment-Button-pay' : 'BST6Payment-Button-pay'
: 'BST6Payment-Button-pay Order' : 'BST6Payment-Button-pay Order'
: 'BST6Payment-Button-pay-disabled' : 'BST6Payment-Button-pay-disabled'
@ -3919,7 +3938,15 @@ const BST6Payment = () => {
handleButtonClick handleButtonClick
} }
> >
{!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? <div>Refund: {(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</div> : ( {!OrderStatus ? (
salesBillEdit &&
currentOrderNetAmount < previousNetAmount ? (
<div>
Refund:
{(previousNetAmount || 0) -
(currentOrderNetAmount || 0)}
</div>
) : (
<> <>
<p style={{ fontFamily: FontFamily['head'] }}> <p style={{ fontFamily: FontFamily['head'] }}>
{isMobile ? ( {isMobile ? (
@ -3951,6 +3978,7 @@ const BST6Payment = () => {
<AiOutlineArrowRight /> <AiOutlineArrowRight />
</> </>
)
) : ( ) : (
<div>ORDER</div> <div>ORDER</div>
)} )}
@ -4389,7 +4417,9 @@ const BST6Payment = () => {
) )
} }
CreatedDate={OtherServicesPrintDetails?.CreatedDate} CreatedDate={OtherServicesPrintDetails?.CreatedDate}
PaymentStatus={OtherServicesPrintDetails?.[0]?.PaymentOrderDtl} PaymentStatus={
OtherServicesPrintDetails?.[0]?.PaymentOrderDtl
}
Preference={SettingDataSelector} Preference={SettingDataSelector}
printDatas={printDatas} printDatas={printDatas}
/> />
@ -4424,8 +4454,8 @@ const BST6Payment = () => {
<div> <div>
You have already selected a table. If you click 'OK,' the You have already selected a table. If you click 'OK,' the
table selection will be removed, and the unpaid flow will table selection will be removed, and the unpaid flow will
continue. If you click 'Cancel,' the dine-in flow will proceed continue. If you click 'Cancel,' the dine-in flow will
as selected. proceed as selected.
</div> </div>
</> </>
} }
@ -4438,10 +4468,17 @@ const BST6Payment = () => {
SplitPaymentModal={Splitpayment} SplitPaymentModal={Splitpayment}
handlesplitpaymentclose={handlesplitpaymentclose} handlesplitpaymentclose={handlesplitpaymentclose}
TotalNetAmount={ TotalNetAmount={
OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - OrderType === 'Failed'
? FailedTotalAmt
: Math.round(
OrderCardDetail?.reduce(
(acc, data) => data?.TotalAmt + acc,
0
) -
((OverAllSales > 0 ? OverAllSales : 0) + ((OverAllSales > 0 ? OverAllSales : 0) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) + (OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0))) (Discount > 0 ? Discount : 0))
)
} }
failedOrderData={failedOrderData} failedOrderData={failedOrderData}
/> />
@ -4621,7 +4658,9 @@ const BST6Payment = () => {
color: '#fff', color: '#fff',
border: 'none', border: 'none',
borderRadius: 4, borderRadius: 4,
cursor: hasVehicleInputErrors() ? 'not-allowed' : 'pointer', cursor: hasVehicleInputErrors()
? 'not-allowed'
: 'pointer',
}} }}
> >
Submit Submit
@ -4683,7 +4722,9 @@ const BST6Payment = () => {
) )
} }
CreatedDate={OtherServicesPrintDetails?.CreatedDate} CreatedDate={OtherServicesPrintDetails?.CreatedDate}
PaymentStatus={OtherServicesPrintDetails?.[0]?.PaymentOrderDtl} PaymentStatus={
OtherServicesPrintDetails?.[0]?.PaymentOrderDtl
}
Preference={SettingDataSelector} Preference={SettingDataSelector}
printDatas={printDatas} printDatas={printDatas}
/> />
@ -4798,6 +4839,7 @@ const BST6Payment = () => {
/> />
</div> </div>
</> </>
</Suspense>
); );
}; };

View File

@ -7,7 +7,7 @@ import { BiRightArrowAlt } from 'react-icons/bi';
import { AiOutlineClose } from 'react-icons/ai'; import { AiOutlineClose } from 'react-icons/ai';
import BSSummery from '../BSBillingTableSummery/BSSummery.jsx'; import BSSummery from '../BSBillingTableSummery/BSSummery.jsx';
import BSBillingTable7 from './BSBillingTable7'; import BSBillingTable7 from './BSBillingTable7';
import { UpCircleOutlined, UpOutlined } from '@ant-design/icons'; import { UpCircleOutlined } from '@ant-design/icons';
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4.scss'; import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4.scss';
import { import {
GlobalSelectedFont, GlobalSelectedFont,
@ -17,7 +17,7 @@ import {
GlobalprintDatas, GlobalprintDatas,
GlobalPrinterMappingDtls, GlobalPrinterMappingDtls,
getPrinterMappingDetails, getPrinterMappingDetails,
getPrintSelectionComponentData, // getPrintSelectionComponentData,
} from '../../../../../Features/ThemeChange/ThemeChange.js'; } from '../../../../../Features/ThemeChange/ThemeChange.js';
import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js'; import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js';
import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities.jsx'; import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities.jsx';
@ -94,7 +94,7 @@ import {
GlobalOverAllDiscSales, GlobalOverAllDiscSales,
ChangeOverAllDiscSales, ChangeOverAllDiscSales,
ChangeOverAllDiscEstimate, ChangeOverAllDiscEstimate,
getAllCustomer,
GlobalBranchFinancialStatus, GlobalBranchFinancialStatus,
changeSummeryComboOfferAmount, changeSummeryComboOfferAmount,
ChangeComboCarddata, ChangeComboCarddata,
@ -119,6 +119,7 @@ import {
changeBillEditingMode, changeBillEditingMode,
changePreviousOrderPayment, changePreviousOrderPayment,
changePreviousOrderOfferDetail, changePreviousOrderOfferDetail,
GlobalAllBookingType,
} from '../../../../../Features/BookingScreen/BookingData/BookingData.js'; } from '../../../../../Features/BookingScreen/BookingData/BookingData.js';
import { import {
globalExtraTotalAmount, globalExtraTotalAmount,
@ -174,11 +175,8 @@ import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js';
import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx'; import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx';
import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx'; import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx';
import { import {
Global_CoupenCodeAmount,
Global_loyaltyPointsDiscountAmount,
Global_OrderOfferDetail, Global_OrderOfferDetail,
Global_OverallOfferAmount, Global_OverallOfferAmount
Global_SalesWiseOfferAmount,
} from '../../../../../Features/Offer/Offer.js'; } from '../../../../../Features/Offer/Offer.js';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx'; import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip'; import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip';
@ -242,6 +240,7 @@ const BSBilling7Payment = () => {
const screenwidth = useSelector(GlobalScreenSize); const screenwidth = useSelector(GlobalScreenSize);
const defaultBookingType = useSelector(GlobalDefaultBookingType); const defaultBookingType = useSelector(GlobalDefaultBookingType);
const printerTemplateStyle = useSelector(SelectedPrintTemplate); const printerTemplateStyle = useSelector(SelectedPrintTemplate);
const AllBookingType=useSelector(GlobalAllBookingType)
const FontFamily = useSelector(GlobalSelectedFont); const FontFamily = useSelector(GlobalSelectedFont);
const OrderCardDetail = useSelector(GlobalOrderCardDetails); const OrderCardDetail = useSelector(GlobalOrderCardDetails);
const GetCustId = useSelector(GlobalCustId); const GetCustId = useSelector(GlobalCustId);
@ -269,6 +268,9 @@ const BSBilling7Payment = () => {
const templateData = useSelector(getTemplateData); const templateData = useSelector(getTemplateData);
const appPreferences = useSelector(ApplicationPreferences); const appPreferences = useSelector(ApplicationPreferences);
const Combodata = useSelector(GlobalCombocarddata, shallowEqual); const Combodata = useSelector(GlobalCombocarddata, shallowEqual);
const holdCheckedSalesSetup = tableOptions?.some(
(item) => item?.OptionName === 'Hold'
);
const bookingTypePreference = appPreferences?.find( const bookingTypePreference = appPreferences?.find(
(preference) => preference?.PreferredCatName === 'Booking Type' (preference) => preference?.PreferredCatName === 'Booking Type'
)?.PreferenceCatDetails; )?.PreferenceCatDetails;
@ -306,11 +308,9 @@ const BSBilling7Payment = () => {
const offerAppliedProducts = useSelector(GlobalOfferAppliedProducts); const offerAppliedProducts = useSelector(GlobalOfferAppliedProducts);
const GlobEstBooking = useSelector(GlobalEstimateBooking); const GlobEstBooking = useSelector(GlobalEstimateBooking);
const GlobProdwisedata = useSelector(GlobalSelProdWiseEst); const GlobProdwisedata = useSelector(GlobalSelProdWiseEst);
const BranchFinancialStatus = useSelector(GlobalBranchFinancialStatus);
const preOrder = useSelector(GlobalpreOrderOpen); const preOrder = useSelector(GlobalpreOrderOpen);
const OrderType = useSelector(GlobalOrderType); const OrderType = useSelector(GlobalOrderType);
const FailedTotalAmt = useSelector(GlobalFailedTotalAmt); const FailedTotalAmt = useSelector(GlobalFailedTotalAmt);
const OrderOfferDetail = useSelector(Global_OrderOfferDetail, shallowEqual);
const defaultPaymentTrigger = useSelector(GlobalPaymentTrigger); const defaultPaymentTrigger = useSelector(GlobalPaymentTrigger);
const [defaultPaymentMode, setDefaultPaymentMode] = useState([]); const [defaultPaymentMode, setDefaultPaymentMode] = useState([]);
const [defaultEnabled, setDefaultEnabled] = useState(false); const [defaultEnabled, setDefaultEnabled] = useState(false);
@ -324,8 +324,6 @@ const BSBilling7Payment = () => {
const BranchId = SessionData?.BranchId; const BranchId = SessionData?.BranchId;
const UserId = SessionData?.UserId; const UserId = SessionData?.UserId;
const UserType = SessionData?.UserType; const UserType = SessionData?.UserType;
const AuthToken = SessionData?.AuthToken;
const SessionMobileNo = SessionData?.SessionMobileNo;
const [FirstPaymentclick, setFirstPaymentclick] = useState(false); const [FirstPaymentclick, setFirstPaymentclick] = useState(false);
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const [unpaidopen, setUnpaidOpen] = useState(false); const [unpaidopen, setUnpaidOpen] = useState(false);
@ -692,13 +690,16 @@ const BSBilling7Payment = () => {
UserId: UserId, UserId: UserId,
}; };
dispatch(getPrinterMappingDetails(data)).unwrap(); dispatch(getPrinterMappingDetails(data)).unwrap();
const Data1 = { AppId, CompId, BranchId }; // const Data1 = { AppId, CompId, BranchId };
dispatch(getPrintSelectionComponentData(Data1)).unwrap(); // dispatch(getPrintSelectionComponentData(Data1)).unwrap();
}, []); }, []);
useEffect(() => { useEffect(() => {
if (CompId && BranchId && AppId) { if (CompId && BranchId && AppId) {
if(holdCheckedSalesSetup)
{
getHolddata(); getHolddata();
getUnpaiddatas(); }
// getUnpaiddatas();
getCustomerData(); getCustomerData();
} }
}, [CompId, BranchId, AppId]); }, [CompId, BranchId, AppId]);
@ -814,9 +815,7 @@ const BSBilling7Payment = () => {
: parseInt(value || 0); : parseInt(value || 0);
}; };
const getCustomerData = async () => { const getCustomerData = async () => {
await dispatch(
getAllCustomer({ CompId: CompId, AppId: AppId, branchId: BranchId })
);
await dispatch( await dispatch(
getAddCustomerDetails({ getAddCustomerDetails({
CompId: CompId, CompId: CompId,
@ -1627,20 +1626,14 @@ const BSBilling7Payment = () => {
}; };
const getBookingTypeId = async () => { const getBookingTypeId = async () => {
let tempconfigdata = await dispatch( setConfigDataList(AllBookingType);
getConfigType({ TypeName: 'Booking Type' }) let configdata = AllBookingType;
).unwrap();
if (tempconfigdata?.data?.statusCode == 1) {
setConfigDataList(tempconfigdata?.data?.data);
let configdata = tempconfigdata?.data?.data;
let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType; let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType;
let filterconfigdata = configdata?.find( let filterconfigdata = configdata?.find(
(a) => a?.ConfigName === checkName (a) => a?.ConfigName === checkName
); );
setSelectedBookingType(filterconfigdata?.ConfigId); setSelectedBookingType(filterconfigdata?.ConfigId);
}
}; };
const gettodaydate = () => { const gettodaydate = () => {
const currentDate = new Date(); const currentDate = new Date();
@ -1932,7 +1925,10 @@ const BSBilling7Payment = () => {
setCurrentOrderNetAmount(0); setCurrentOrderNetAmount(0);
setPreviousNetAmount(0); setPreviousNetAmount(0);
setUpinotSelected(false); setUpinotSelected(false);
if(holdCheckedSalesSetup)
{
getHolddata(); getHolddata();
}
if (defaultBookingType === 'Both') { if (defaultBookingType === 'Both') {
await dispatch(changeBookingType('TakeAway')); await dispatch(changeBookingType('TakeAway'));
} }
@ -3331,8 +3327,10 @@ const BSBilling7Payment = () => {
setDefaultPaymentMode([]); setDefaultPaymentMode([]);
} }
}; };
if(salesBillEdit){
setDefaultPaymentOption(); setDefaultPaymentOption();
}, [defaultPaymentTrigger]); }
}, [defaultPaymentTrigger,salesBillEdit]);
const Otherserviceprint = async () => { const Otherserviceprint = async () => {
if (OtherServicesPrintDetails?.length > 0) { if (OtherServicesPrintDetails?.length > 0) {

View File

@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'; import React, { lazy, Suspense, useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7.scss'; import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7.scss';
import { import {
@ -14,7 +14,6 @@ import {
GlobalPreviousOrderLength, GlobalPreviousOrderLength,
GlobalUnpaidData, GlobalUnpaidData,
changeOrderCardDetails, changeOrderCardDetails,
ChangeSelectedCustDisable,
changeReorderHoldDetails, changeReorderHoldDetails,
changeBookingType, changeBookingType,
changeSelectedOption, changeSelectedOption,
@ -50,7 +49,9 @@ import {
GlobalOfferAppliedProducts, GlobalOfferAppliedProducts,
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js'; } from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import BSBillingEditQuantity from '../BSBillingEditQuantity/BSBillingEditQuantity'; const BSBillingEditQuantity = lazy(
() => import('../BSBillingEditQuantity/BSBillingEditQuantity')
);
import { import {
ChangeTotalAmount, ChangeTotalAmount,
globalExtraTotalAmount, globalExtraTotalAmount,
@ -61,11 +62,14 @@ import dineInIcon from '../../../../../Images/Dine In.svg';
import TakeAwayIcon from '../../../../../Images/Take away.svg'; import TakeAwayIcon from '../../../../../Images/Take away.svg';
import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js'; import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx'; import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import BSEditTotalAmt from '../BSEditTotalAmount/BSEditTotalAmt.jsx'; const BSEditTotalAmt = lazy(
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx'; () => import('../BSEditTotalAmount/BSEditTotalAmt.jsx')
import { getSession } from '../../../../../Services/Others.js'; );
const BSImeiDetails = lazy(() => import('../BSImeiDetails/BSImeiDetails.jsx'));
const CustomerPriceHistory = lazy(
() => import('../../UtillComponents/CustomerPriceHistory.jsx')
);
import { useUtilsComponent } from '../../../../../Services/utils.js'; import { useUtilsComponent } from '../../../../../Services/utils.js';
import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
const BSBillingTable7 = () => { const BSBillingTable7 = () => {
const { removeExtraCharge } = useUtilsComponent(); const { removeExtraCharge } = useUtilsComponent();
@ -99,7 +103,8 @@ const BSBillingTable7 = () => {
const GetCustId = useSelector(GlobalCustId); const GetCustId = useSelector(GlobalCustId);
const selectedCustomer = useSelector(GlobalSelOption); const selectedCustomer = useSelector(GlobalSelOption);
const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false); const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] =
useState(false);
const [customerProduct, setCustomerProduct] = useState(null); const [customerProduct, setCustomerProduct] = useState(null);
const [EditQuantity, setEditQuantity] = useState(false); const [EditQuantity, setEditQuantity] = useState(false);
const [Modaldata, setModaldata] = useState([]); const [Modaldata, setModaldata] = useState([]);
@ -276,7 +281,6 @@ const BSBillingTable7 = () => {
event.preventDefault(); event.preventDefault();
handleShortcut('weightAmount'); handleShortcut('weightAmount');
} }
}; };
window.addEventListener('keydown', handleKeyDown); window.addEventListener('keydown', handleKeyDown);
@ -1309,9 +1313,6 @@ const BSBillingTable7 = () => {
}); });
} }
} }
//Change Remove OrderCartDetail
//Remove FreeprodList
//ChangeOfferApplied Products
} }
} else { } else {
///remove item wise offer ///remove item wise offer
@ -1605,8 +1606,6 @@ const BSBillingTable7 = () => {
}); });
} }
} else { } else {
//have to find if thereis two Booking Type is there
//Convert That Free Product To Paid Product
let ischeckBothBookingType = tableData?.find( let ischeckBothBookingType = tableData?.find(
(e) => (e) =>
e?.InwardDtlId == inward && e?.InwardDtlId == inward &&
@ -1621,12 +1620,6 @@ const BSBillingTable7 = () => {
e?.BookingTypeName == item?.BookingTypeName e?.BookingTypeName == item?.BookingTypeName
); );
if (ischeckBothBookingType) { 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) { if (FreeProductSameBookingType?.OrderQty >= item?.OrderQty) {
await ChangeFreeprodlistFn({ await ChangeFreeprodlistFn({
OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty, OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
@ -1676,24 +1669,10 @@ const BSBillingTable7 = () => {
let diff = let diff =
item?.OrderQty - FreeProductSameBookingType?.OrderQty; 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 ( if (
(anotherBookingType?.OrderQty || 0) < (anotherBookingType?.OrderQty || 0) <
anotherBookingTypeOffer?.OrderQty anotherBookingTypeOffer?.OrderQty
) { ) {
//paidproduct ischeckBothBookingType?.OrderQty-anotherBookingType?.OrderQty
//PaidProdcut Current BookingType FreeProductSameBookingType?.OrderQty
let paidproductAnotherType = let paidproductAnotherType =
ischeckBothBookingType?.OrderQty - ischeckBothBookingType?.OrderQty -
anotherBookingType?.OrderQty; anotherBookingType?.OrderQty;
@ -1845,146 +1824,7 @@ const BSBillingTable7 = () => {
} }
} }
} }
}; };
// const removeFromCart = async (item) => {
// setPreviousdataLength(tableData?.length);
// if (item?.BookingTypeName !== 'Dine In' && OrderType !== 'Hold') {
// const UpdatedData = tableData?.filter(
// (cartItem) =>
// !(
// cartItem?.ProdId === item?.ProdId &&
// cartItem?.InwardDtlId === item?.InwardDtlId &&
// cartItem?.OrderRate === item?.OrderRate &&
// cartItem?.BookingTypeName === item?.BookingTypeName &&
// !cartItem?.SalesId
// )
// );
// if (OfferCheckedInSetup && preferenceOffer) {
// await applyOffer(UpdatedData);
// } else {
// dispatch(changeOrderCardDetails(UpdatedData));
// }
// await dispatch(
// ChangeTotalAmount(
// GlobalExtraCharge?.filter((extra) => {
// if (BookingType === 'Dine In') {
// // Remove extra charges linked to the removed product
// return !(extra.ProdId === item?.ProdId && !extra.SalesId);
// } else if (BookingType === 'TakeAway') {
// // Remove extra charges only if SalesId is not present
// return extra.ProdId !== item?.ProdId;
// }
// return true; // Keep everything else
// })
// )
// );
// // if the quantity of the item is 1, remove the item from the cart
// if (tableData?.length <= 1) {
// await dispatch(changeReorderHoldDetails({}));
// await dispatch(changeReorderHoldDetails([]));
// await dispatch(changeUnpaidData(false));
// await dispatch(changeBookingType('TakeAway'));
// await dispatch(changeTokenOnly(false));
// await dispatch(changeAllProductTokenAvailable(false));
// await dispatch(ChangeOverAllDiscSales(null));
// await dispatch(ChangeOverAllDiscEstimate(null));
// await dispatch(changeSelProdWiseEst([]));
// await dispatch(ChangeTotalAmount([]));
// }
// } else if (item?.BookingTypeName !== 'Dine In' && OrderType === 'Hold') {
// const UpdatedData = tableData?.filter(
// (cartItem) =>
// !(
// cartItem?.ProdId === item?.ProdId &&
// cartItem?.InwardDtlId === item?.InwardDtlId &&
// cartItem?.OrderRate === item?.OrderRate &&
// cartItem?.BookingTypeName === item?.BookingTypeName
// )
// );
// if (OfferCheckedInSetup && preferenceOffer) {
// await applyOffer(UpdatedData);
// } else {
// dispatch(changeOrderCardDetails(UpdatedData));
// }
// await dispatch(
// ChangeTotalAmount(
// GlobalExtraCharge?.filter((extra) => {
// if (BookingType === 'Dine In') {
// // Remove extra charges linked to the removed product
// return !(extra.ProdId === item?.ProdId && !extra.SalesId);
// } else if (BookingType === 'TakeAway') {
// // Remove extra charges only if SalesId is not present
// return extra.ProdId !== item?.ProdId;
// }
// return true; // Keep everything else
// })
// )
// );
// // if the quantity of the item is 1, remove the item from the cart
// if (tableData?.length <= 1) {
// await dispatch(changeReorderHoldDetails({}));
// await dispatch(changeReorderHoldDetails([]));
// await dispatch(changeUnpaidData(false));
// await dispatch(changeBookingType('TakeAway'));
// await dispatch(changeTokenOnly(false));
// await dispatch(changeAllProductTokenAvailable(false));
// await dispatch(ChangeOverAllDiscSales(null));
// await dispatch(ChangeOverAllDiscEstimate(null));
// await dispatch(changeSelProdWiseEst([]));
// await dispatch(ChangeTotalAmount([]));
// }
// } else if (item?.BookingTypeName === 'Dine In') {
// const UpdatedData = tableData?.filter(
// (cartItem) =>
// !(
// cartItem?.ProdId === item?.ProdId &&
// cartItem?.InwardDtlId === item?.InwardDtlId &&
// cartItem?.OrderRate === item?.OrderRate &&
// cartItem?.BookingTypeName === item?.BookingTypeName &&
// !cartItem?.SalesId
// )
// );
// if (OfferCheckedInSetup && preferenceOffer) {
// await applyOffer(UpdatedData);
// } else {
// dispatch(changeOrderCardDetails(UpdatedData));
// }
// await dispatch(
// ChangeTotalAmount(
// GlobalExtraCharge?.filter((extra) => {
// if (BookingType === 'Dine In') {
// // Remove extra charges linked to the removed product
// return !(extra.ProdId === item?.ProdId && !extra.SalesId);
// } else if (BookingType === 'TakeAway') {
// // Remove extra charges only if SalesId is not present
// return extra.ProdId !== item?.ProdId;
// }
// return true; // Keep everything else
// })
// )
// ); // if the quantity of the item is 1, remove the item from the cart
// if (tableData?.length <= 1) {
// await dispatch(changeReorderHoldDetails({}));
// await dispatch(changeReorderHoldDetails([]));
// await dispatch(changeUnpaidData(false));
// await dispatch(ChangeSelectedCustDisable(false));
// await dispatch(changeSelectedOption(false));
// await dispatch(changeBookingType('TakeAway'));
// await dispatch(changeTokenOnly(false));
// await dispatch(changeAllProductTokenAvailable(false));
// await dispatch(ChangeOverAllDiscSales(null));
// await dispatch(ChangeOverAllDiscEstimate(null));
// await dispatch(changeSelProdWiseEst([]));
// await dispatch(ChangeTotalAmount([]));
// }
// }
// };
function safeRound(amountStr) { function safeRound(amountStr) {
if (amountStr == null) return allowDecimal ? '0.00' : '0'; if (amountStr == null) return allowDecimal ? '0.00' : '0';
@ -1997,11 +1837,10 @@ const BSBillingTable7 = () => {
return allowDecimal ? num.toFixed(2) : Math.round(num).toString(); return allowDecimal ? num.toFixed(2) : Math.round(num).toString();
} }
const handleCustomerProductPriceHistory = (item) => { const handleCustomerProductPriceHistory = (item) => {
setCustomerPriceHistoryOpen(true); setCustomerPriceHistoryOpen(true);
setCustomerProduct(item?.ProdId); setCustomerProduct(item?.ProdId);
} };
const handlechange33 = () => { const handlechange33 = () => {
if (editdelete === 'Edit') { if (editdelete === 'Edit') {
@ -2055,6 +1894,7 @@ const BSBillingTable7 = () => {
}; };
return ( return (
<Suspense fallback={<div>Loading...</div>}>
<> <>
<div <div
style={{ style={{
@ -2337,7 +2177,8 @@ const BSBillingTable7 = () => {
} }
// onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""} // onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
className={`${item?.SalesId && OrderType !== 'Hold' className={`${
item?.SalesId && OrderType !== 'Hold'
? 'BSBill-Table7-content-disabled' ? 'BSBill-Table7-content-disabled'
: 'BSBill-Table7-content' : 'BSBill-Table7-content'
} }
@ -2393,7 +2234,10 @@ const BSBillingTable7 = () => {
'variant' 'variant'
) && <span>{item?.ProdVariantName} </span>} ) && <span>{item?.ProdVariantName} </span>}
{item?.Size} {item?.Size}
{item?.SinglePc == 'Y' ? 'PCS' : item?.UomName}) {item?.SinglePc == 'Y'
? 'PCS'
: item?.UomName}
)
</p> </p>
{item?.OfferMessage && {item?.OfferMessage &&
!Array.isArray(item.OfferMessage) && ( !Array.isArray(item.OfferMessage) && (
@ -2490,7 +2334,8 @@ const BSBillingTable7 = () => {
handleCustomerProductPriceHistory(item); handleCustomerProductPriceHistory(item);
} }
}} }}
style={{ fontFamily: 'Poppins' }}> style={{ fontFamily: 'Poppins' }}
>
{safeRound(item?.TotalAmt)} {safeRound(item?.TotalAmt)}
</td> </td>
)} )}
@ -2521,7 +2366,8 @@ const BSBillingTable7 = () => {
: BookingType !== 'Dine In' && : BookingType !== 'Dine In' &&
triggerAnimation && triggerAnimation &&
OldtableDataTakeAway?.length + index === 0 && OldtableDataTakeAway?.length + index === 0 &&
tableDataDinein?.length >= PreviousdataLength && tableDataDinein?.length >=
PreviousdataLength &&
!HoldOrderDtl && !HoldOrderDtl &&
!UnpaidData !UnpaidData
? 'wheat' ? 'wheat'
@ -2561,7 +2407,8 @@ const BSBillingTable7 = () => {
} }
// onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""} // onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
className={`${item?.SalesId className={`${
item?.SalesId
? 'BSBill-Table7-content-disabled' ? 'BSBill-Table7-content-disabled'
: 'BSBill-Table7-content' : 'BSBill-Table7-content'
} }
@ -2613,7 +2460,10 @@ const BSBillingTable7 = () => {
'variant' 'variant'
) && <span>{item?.ProdVariantName} </span>} ) && <span>{item?.ProdVariantName} </span>}
{item?.Size} {item?.Size}
{item?.SinglePc == 'Y' ? 'PCS' : item?.UomName}) {item?.SinglePc == 'Y'
? 'PCS'
: item?.UomName}
)
</p> </p>
{item?.OfferMessage && {item?.OfferMessage &&
!Array.isArray(item.OfferMessage) && ( !Array.isArray(item.OfferMessage) && (
@ -2703,12 +2553,15 @@ const BSBillingTable7 = () => {
</td> </td>
)} )}
{tableitem.OptionName == 'Amount' && ( {tableitem.OptionName == 'Amount' && (
<td onClick={(e) => { <td
onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
if (GetCustId) { if (GetCustId) {
handleCustomerProductPriceHistory(item); handleCustomerProductPriceHistory(item);
} }
}} style={{ fontFamily: 'Poppins' }}> }}
style={{ fontFamily: 'Poppins' }}
>
{safeRound(item?.TotalAmt)} {safeRound(item?.TotalAmt)}
</td> </td>
)} )}
@ -2756,7 +2609,9 @@ const BSBillingTable7 = () => {
2 === 2 ===
0 0
? 'white' ? 'white'
: SelectedBillColor?.['OverallBackgroundColor'] : SelectedBillColor?.[
'OverallBackgroundColor'
]
? SelectedBillColor?.[ ? SelectedBillColor?.[
'OverallBackgroundColor' 'OverallBackgroundColor'
] ]
@ -2821,7 +2676,8 @@ const BSBillingTable7 = () => {
} }
// onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""} // onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
className={`${BookingType === 'Dine In' && item?.SalesId className={`${
BookingType === 'Dine In' && item?.SalesId
? 'BSBill-Table7-content-disabled' ? 'BSBill-Table7-content-disabled'
: 'BSBill-Table7-content' : 'BSBill-Table7-content'
} }
@ -2878,17 +2734,14 @@ const BSBillingTable7 = () => {
className="Tbl3-Variant" className="Tbl3-Variant"
style={{ fontFamily: 'Poppins' }} style={{ fontFamily: 'Poppins' }}
> >
{/* ( {' '}
{!item?.ProdVariantName?.toLowerCase()?.includes(
'variant'
) && <span>{item?.ProdVariantName} </span>}
{item?.Size}
{item?.SinglePc == 'Y' ? 'PCS' : item?.UomName}) */}
{item?.Type !== 'OS' && ( {item?.Type !== 'OS' && (
<> <>
{!item?.ProdVariantName?.toLowerCase()?.includes( {!item?.ProdVariantName?.toLowerCase()?.includes(
'variant' 'variant'
) && <span>{item?.ProdVariantName} </span>} ) && (
<span>{item?.ProdVariantName} </span>
)}
{item?.Size} {item?.Size}
{item?.SinglePc == 'Y' {item?.SinglePc == 'Y'
? 'PCS' ? 'PCS'
@ -2984,12 +2837,15 @@ const BSBillingTable7 = () => {
</td> </td>
)} )}
{tableitem.OptionName == 'Amount' && ( {tableitem.OptionName == 'Amount' && (
<td onClick={(e) => { <td
onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
if (GetCustId) { if (GetCustId) {
handleCustomerProductPriceHistory(item); handleCustomerProductPriceHistory(item);
} }
}} style={{ fontFamily: 'Poppins' }}> }}
style={{ fontFamily: 'Poppins' }}
>
{item?.TotalAmt} {item?.TotalAmt}
</td> </td>
)} )}
@ -3030,7 +2886,8 @@ const BSBillingTable7 = () => {
tableDataTakeAway?.length + tableDataTakeAway?.length +
index === index ===
0 && 0 &&
tableDataDinein?.length >= PreviousdataLength && tableDataDinein?.length >=
PreviousdataLength &&
!HoldOrderDtl && !HoldOrderDtl &&
!UnpaidData !UnpaidData
? 'wheat' ? 'wheat'
@ -3087,7 +2944,8 @@ const BSBillingTable7 = () => {
} }
// onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""} // onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
className={`${BookingType === 'Dine In' && item?.SalesId className={`${
BookingType === 'Dine In' && item?.SalesId
? 'BSBill-Table7-content-disabled' ? 'BSBill-Table7-content-disabled'
: 'BSBill-Table7-content' : 'BSBill-Table7-content'
} }
@ -3143,7 +3001,10 @@ const BSBillingTable7 = () => {
'variant' 'variant'
) && <span>{item?.ProdVariantName} </span>} ) && <span>{item?.ProdVariantName} </span>}
{item?.Size} {item?.Size}
{item?.SinglePc == 'Y' ? 'PCS' : item?.UomName}) {item?.SinglePc == 'Y'
? 'PCS'
: item?.UomName}
)
</p> </p>
{item?.OfferMessage && {item?.OfferMessage &&
!Array.isArray(item.OfferMessage) && ( !Array.isArray(item.OfferMessage) && (
@ -3240,7 +3101,8 @@ const BSBillingTable7 = () => {
handleCustomerProductPriceHistory(item); handleCustomerProductPriceHistory(item);
} }
}} }}
style={{ fontFamily: 'Poppins' }}> style={{ fontFamily: 'Poppins' }}
>
{safeRound(item?.TotalAmt)} {safeRound(item?.TotalAmt)}
</td> </td>
)} )}
@ -3274,7 +3136,7 @@ const BSBillingTable7 = () => {
ProductDetail={Modaldata} ProductDetail={Modaldata}
/> />
)} )}
{(customerPriceHistoryOpen && GetCustId) && {customerPriceHistoryOpen && GetCustId && (
<CustomerPriceHistory <CustomerPriceHistory
open={customerPriceHistoryOpen} open={customerPriceHistoryOpen}
custId={GetCustId} custId={GetCustId}
@ -3283,8 +3145,9 @@ const BSBillingTable7 = () => {
setCustomerProduct={setCustomerProduct} setCustomerProduct={setCustomerProduct}
selectedCustomer={selectedCustomer} selectedCustomer={selectedCustomer}
/> />
} )}
</> </>
</Suspense>
); );
}; };

View File

@ -1,7 +1,5 @@
import { useCallback, useEffect, useRef, useState } from 'react'; import { useCallback, useEffect, useRef, useState } from 'react';
import { shallowEqual, useDispatch, useSelector } from 'react-redux'; import { shallowEqual, useDispatch, useSelector } from 'react-redux';
import { DefaultModal } from '../../../../../Components/Modal/DefaultModal';
import FormHeader from '../../../../PageComponents/FormHeader.jsx';
import { Form } from 'antd'; import { Form } from 'antd';
import { import {
GlobalOrderCardDetails, GlobalOrderCardDetails,
@ -11,38 +9,29 @@ import {
GlobalOrderType, GlobalOrderType,
GlobalReorderProductDetails, GlobalReorderProductDetails,
PreferenceData, PreferenceData,
getConfigType, GlobalAllBookingType,
} from '../../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../../Features/BookingScreen/BookingData/BookingData';
import { ArrowRightOutlined } from '@ant-design/icons';
import { Messages } from '../../../../../Components/Notifications/Messages'; import { Messages } from '../../../../../Components/Notifications/Messages';
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.scss'; import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.scss';
import { settingDataSelector } from '../../../../../Features/PreferenceMaster/PreferenceMaster.js';
import { RadioGrpButton } from '../../../../../Components/Forms/RadioGroup.jsx';
import Buttons from '../../../../../Components/Forms/Buttons.jsx';
import { InputField } from '../../../../../Components/Forms/InputField.jsx';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import { import {
getTemplateData, getTemplateData,
StoredSessionData, StoredSessionData,
} from '../../../../../Features/ThemeChange/ThemeChange.js'; } from '../../../../../Features/ThemeChange/ThemeChange.js';
import { validateSafeInput } from '../../../../../Services/Others.js';
import { GlobalEmpAccessDetail } from '../../../../../Features/AppPage/CenterPage.js'; import { GlobalEmpAccessDetail } from '../../../../../Features/AppPage/CenterPage.js';
import { import {
ChangeFullFreeProductList, ChangeFullFreeProductList,
changeFullOfferAppliedProducts, changeFullOfferAppliedProducts,
ChangeOfferAppliedProducts, ChangeOfferAppliedProducts,
changeOfferAppliedProductsForLoyalty,
GlobalFreeProdList, GlobalFreeProdList,
GlobalOfferAppliedProducts, GlobalOfferAppliedProducts,
RemoveOfferAppliedProduct, RemoveOfferAppliedProduct,
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js'; } from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import { validateOffers } from '../../BSItemCards/ValidateOffer.jsx'; import { validateOffers } from '../../BSItemCards/ValidateOffer.jsx';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import "./ComboBillTableEdit.scss" import './ComboBillTableEdit.scss';
const ComboEditQty = (props) => { const ComboEditQty = (props) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const formRef = useRef(null);
const quantityInputRef = useRef(null); const quantityInputRef = useRef(null);
const priceChangeInputRef = useRef(null); const priceChangeInputRef = useRef(null);
const reductionInputRef = useRef(null); const reductionInputRef = useRef(null);
@ -54,7 +43,7 @@ const ComboEditQty = (props) => {
// const CompId = SessionData?.CompId; // const CompId = SessionData?.CompId;
// const BranchId = SessionData?.BranchId; // const BranchId = SessionData?.BranchId;
const UserType = SessionData?.UserType; const UserType = SessionData?.UserType;
const applyOffer = useApplyOfferto_CardDetail(); const AllBookingType = useSelector(GlobalAllBookingType);
const preferenceDatas = useSelector(PreferenceData); const preferenceDatas = useSelector(PreferenceData);
const EmpAccessDetail = useSelector(GlobalEmpAccessDetail); const EmpAccessDetail = useSelector(GlobalEmpAccessDetail);
const OverAllproductBasedOfferDatas = useSelector( const OverAllproductBasedOfferDatas = useSelector(
@ -75,7 +64,7 @@ const ComboEditQty = (props) => {
console.log(preferenceshortcutkey, 'preferenceshortcutkey'); console.log(preferenceshortcutkey, 'preferenceshortcutkey');
const [PriceChangeaccess, setPriceChangeaccess] = useState(true); const [PriceChangeaccess, setPriceChangeaccess] = useState(true);
const [ConfigDataList, setConfigDataList] = useState([]); const [ConfigDataList, setConfigDataList] = useState(AllBookingType);
const [messageType, setMessageType] = useState(null); const [messageType, setMessageType] = useState(null);
const [messageData, setMessageData] = useState(null); const [messageData, setMessageData] = useState(null);
const [EditOpen, setEditOpen] = useState(props?.BSBillingEditQuantity); const [EditOpen, setEditOpen] = useState(props?.BSBillingEditQuantity);
@ -104,7 +93,7 @@ const ComboEditQty = (props) => {
? 'Price' ? 'Price'
: 'Parcel' : 'Parcel'
); );
const [PercentageSelection, setPercentageSelection] = useState('Fixed');
const [RadioDetails, setRadioDetails] = useState(false); const [RadioDetails, setRadioDetails] = useState(false);
const [editedPrice, setEditedPrice] = useState(0); const [editedPrice, setEditedPrice] = useState(0);
const allowDecimal = preferenceDatas?.[0]?.SettingDtlDetails?.find( const allowDecimal = preferenceDatas?.[0]?.SettingDtlDetails?.find(
@ -265,10 +254,6 @@ const ComboEditQty = (props) => {
setEditedPrice(0); setEditedPrice(0);
}; };
// const AddQuantityonly = () => {
// setMessageType('success');
// setMessageData('Quantity Added');
// };
const createUpdatedCartItem = (cartItem, quantity, newPrice) => { const createUpdatedCartItem = (cartItem, quantity, newPrice) => {
const qty = parseInt(quantity); const qty = parseInt(quantity);

View File

@ -29,16 +29,18 @@ import {
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js'; } from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import { validateOffers } from '../../BSItemCards/ValidateOffer.jsx'; import { validateOffers } from '../../BSItemCards/ValidateOffer.jsx';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import "./ComboBillTableEdit.scss" import './ComboBillTableEdit.scss';
const ComboEditQtyAndRate = (props) => { const ComboEditQtyAndRate = (props) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const formRef = useRef(null); const formRef = useRef(null);
const quantityInputRef = useRef(null); const quantityInputRef = useRef(null);
const priceChangeInputRef = useRef(null); const priceChangeInputRef = useRef(null);
const modalRef = useRef(null); const {
const { setIndex = () => {}, setEditQtyCombo = () => {}, setEditRateCombo = () => {} } = props; setIndex = () => {},
setEditQtyCombo = () => {},
setEditRateCombo = () => {},
} = props;
const [disableSubmitButton, setDisableSubmitButton] = useState(false); const [disableSubmitButton, setDisableSubmitButton] = useState(false);
const SessionData = useSelector(StoredSessionData); const SessionData = useSelector(StoredSessionData);
@ -70,7 +72,9 @@ const ComboEditQtyAndRate = (props) => {
const [ConfigDataList, setConfigDataList] = useState([]); const [ConfigDataList, setConfigDataList] = useState([]);
const [messageType, setMessageType] = useState(null); const [messageType, setMessageType] = useState(null);
const [messageData, setMessageData] = useState(null); const [messageData, setMessageData] = useState(null);
const [EditOpen, setEditOpen] = useState(props?.BSBillingEditQuantity || props?.BSBillingEditRate); const [EditOpen, setEditOpen] = useState(
props?.BSBillingEditQuantity || props?.BSBillingEditRate
);
const [ItemData, setItemData] = useState(props?.Productdata); const [ItemData, setItemData] = useState(props?.Productdata);
const [Quantity, setQuantity] = useState(''); const [Quantity, setQuantity] = useState('');
const ReorderProductData = useSelector(GlobalReorderProductDetails); const ReorderProductData = useSelector(GlobalReorderProductDetails);
@ -142,7 +146,12 @@ const ComboEditQtyAndRate = (props) => {
useEffect(() => { useEffect(() => {
const handleKeyDown = (event) => { const handleKeyDown = (event) => {
const navigationKeys = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown']; const navigationKeys = [
'ArrowLeft',
'ArrowRight',
'ArrowUp',
'ArrowDown',
];
if (event.key === 'Escape' || navigationKeys.includes(event.key)) { if (event.key === 'Escape' || navigationKeys.includes(event.key)) {
event.preventDefault(); event.preventDefault();
if (props.BSBillingEditQuantity) { if (props.BSBillingEditQuantity) {
@ -173,8 +182,6 @@ const handleKeyDown = (event) => {
props.BSBillingEditRate, props.BSBillingEditRate,
]); ]);
useEffect(() => { useEffect(() => {
const BillOrder = SettingDataSelector?.[0]?.SettingDtlDetails?.find( const BillOrder = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
(item) => item.SettingIdName === 'BillItemsOrder' (item) => item.SettingIdName === 'BillItemsOrder'
@ -198,7 +205,11 @@ const handleKeyDown = (event) => {
} else if (props?.BSBillingEditQuantity) { } else if (props?.BSBillingEditQuantity) {
setRadioBtnSelection('Quantity'); setRadioBtnSelection('Quantity');
} }
}, [props?.BSBillingEditRate, props?.BSBillingEditQuantity, props.Productdata?.OrderRate]); }, [
props?.BSBillingEditRate,
props?.BSBillingEditQuantity,
props.Productdata?.OrderRate,
]);
const getBookingTypeId = async () => { const getBookingTypeId = async () => {
let tempconfigdata = await dispatch( let tempconfigdata = await dispatch(
getConfigType({ TypeName: 'Booking Type' }) getConfigType({ TypeName: 'Booking Type' })
@ -209,7 +220,6 @@ const handleKeyDown = (event) => {
} }
}; };
const calculateOverAllQty = (item, filterItems) => { const calculateOverAllQty = (item, filterItems) => {
if (!item) return 0; if (!item) return 0;
@ -3223,7 +3233,6 @@ const handleKeyDown = (event) => {
AddProductQuantity(); AddProductQuantity();
} }
}} }}
min={0}
className="EditQTYcomboInput" className="EditQTYcomboInput"
placeholder="Enter Qty" placeholder="Enter Qty"
/> />
@ -3239,7 +3248,11 @@ const handleKeyDown = (event) => {
autoComplete="off" autoComplete="off"
onChange={SellingPriceChange} onChange={SellingPriceChange}
onBlur={() => { onBlur={() => {
if (editedPrice && editedPrice !== '' && disableSubmitButton) { if (
editedPrice &&
editedPrice !== '' &&
disableSubmitButton
) {
AddProductQuantity(); AddProductQuantity();
} }
}} }}

View File

@ -1,5 +1,4 @@
import React, { useEffect, useRef, useState } from 'react'; import React, { lazy, useEffect, useRef, useState } from 'react';
import './ComboSalesBillTable.scss';
import { shallowEqual, useDispatch, useSelector } from 'react-redux'; import { shallowEqual, useDispatch, useSelector } from 'react-redux';
import { Popconfirm, Tooltip } from 'antd'; import { Popconfirm, Tooltip } from 'antd';
import WebFont from 'webfontloader'; import WebFont from 'webfontloader';
@ -9,16 +8,12 @@ import {
ChangeTotalAmount, ChangeTotalAmount,
globalExtraTotalAmount, globalExtraTotalAmount,
} from '../../../../../Features/ExteraCharges/ExtraCharges.js'; } from '../../../../../Features/ExteraCharges/ExtraCharges.js';
import BSBillingEditQuantity from '../BSBillingEditQuantity/BSBillingEditQuantity';
import { import {
changeholddata, changeholddata,
gettinghold, gettinghold,
puttinghold, puttinghold,
} from '../../../../../Features/BookingScreen/HoldOption/HoldOption.js'; } from '../../../../../Features/BookingScreen/HoldOption/HoldOption.js';
import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js'; import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import BSEditTotalAmt from '../BSEditTotalAmount/BSEditTotalAmt.jsx';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx';
import { import {
getTemplateData, getTemplateData,
SelectedGlobalBillingColorDetail, SelectedGlobalBillingColorDetail,
@ -66,8 +61,6 @@ import {
GlobalSalesBillEdit, GlobalSalesBillEdit,
} from '../../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../../Features/BookingScreen/BookingData/BookingData';
import { import {
ChangeOfferAppliedProducts,
ChangeFreeProductList,
ChangeFullFreeProductList, ChangeFullFreeProductList,
GlobalFreeProdList, GlobalFreeProdList,
GlobalOfferAppliedProducts, GlobalOfferAppliedProducts,
@ -75,11 +68,24 @@ import {
changeLoyaltyConsumedQuantities, changeLoyaltyConsumedQuantities,
ClearOfferAppliedProducts, ClearOfferAppliedProducts,
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js'; } from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import { useRemoveProducts } from '../BSBillingTable3/RemoveCartWithOffer.jsx';
import { useUtilsComponent } from '../../../../../Services/utils.js'; import { useUtilsComponent } from '../../../../../Services/utils.js';
import ComboEditRate from '../ComboBillTableEdit/ComboEditRate.jsx'; import { useRemoveProducts } from '../BSBillingTable3/RemoveCartWithOffer.jsx';
import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx'; import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import ComboEditQtyAndRate from '../ComboBillTableEdit/ComboEditQtyAndRate.jsx'; // jsx files
const CustomerPriceHistory = lazy(
() => import('../../UtillComponents/CustomerPriceHistory.jsx')
);
const ComboEditQtyAndRate = lazy(
() => import('../ComboBillTableEdit/ComboEditQtyAndRate.jsx')
);
const BSEditTotalAmt = lazy(
() => import('../BSEditTotalAmount/BSEditTotalAmt.jsx')
);
const BSImeiDetails = lazy(() => import('../BSImeiDetails/BSImeiDetails.jsx'));
const BSBillingEditQuantity = lazy(
() => import('../BSBillingEditQuantity/BSBillingEditQuantity.jsx')
); // Scss Files
import './ComboSalesBillTable.scss';
const ComboSalesBillTable = () => { const ComboSalesBillTable = () => {
const { removeExtraCharge } = useUtilsComponent(); const { removeExtraCharge } = useUtilsComponent();
@ -267,7 +273,9 @@ const ComboSalesBillTable = () => {
...sameItems[0], ...sameItems[0],
OrderQty: totalQty, OrderQty: totalQty,
TotalAmt: totalQty * item.OrderRate, TotalAmt: totalQty * item.OrderRate,
TaxAmt: ((totalQty * item.OrderRate * item.TaxPercentage) / (100 + item.TaxPercentage)), TaxAmt:
(totalQty * item.OrderRate * item.TaxPercentage) /
(100 + item.TaxPercentage),
}; };
mergedData.push(mergedItem); mergedData.push(mergedItem);
} else { } else {
@ -313,12 +321,6 @@ const ComboSalesBillTable = () => {
}; };
}, [GetCustId, tableData]); }, [GetCustId, tableData]);
// useEffect(() => {
// const BillOrder = preferenceDatas?.[0]?.SettingDtlDetails?.find(
// (item) => item.SettingIdName === 'BillItemsOrder'
// );
// setBillOrderPre(BillOrder?.SettingValue);
// }, [preferenceDatas]);
useEffect(() => { useEffect(() => {
const getSelectedItem = () => { const getSelectedItem = () => {
const getItem = (data = []) => { const getItem = (data = []) => {
@ -463,6 +465,7 @@ const ComboSalesBillTable = () => {
BranchId: BranchId, BranchId: BranchId,
AppId: AppId, AppId: AppId,
}; };
await dispatch(getSelectedFavItems(data)).unwrap(); await dispatch(getSelectedFavItems(data)).unwrap();
let data1 = { let data1 = {
@ -2136,7 +2139,6 @@ const ComboSalesBillTable = () => {
} }
} }
} }
}; };
useEffect(() => { useEffect(() => {
@ -2476,7 +2478,8 @@ const ComboSalesBillTable = () => {
? 'wheat' ? 'wheat'
: 'inherit' : 'inherit'
: 'none', : 'none',
background: row?.SalesId && OrderType !== 'Hold' background:
row?.SalesId && OrderType !== 'Hold'
? 'rgb(243, 248, 213)' ? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' && : GlobEstBooking === 'ParEst' &&
GlobProdwisedata?.includes( GlobProdwisedata?.includes(
@ -2588,7 +2591,8 @@ const ComboSalesBillTable = () => {
}} }}
key={`qty-${index}`} key={`qty-${index}`}
tabIndex={0} tabIndex={0}
className={`${EditQtyCombo && row?.localId === Index className={`${
EditQtyCombo && row?.localId === Index
? 'EditQTYcomboTD' ? 'EditQTYcomboTD'
: 'qtyTd' : 'qtyTd'
} ${isActiveCell ? 'active-cell' : ''}`} } ${isActiveCell ? 'active-cell' : ''}`}

View File

@ -1,25 +1,27 @@
import { useEffect, useState } from 'react'; import { useEffect, useState, lazy, Suspense } from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { Popconfirm, Tooltip } from 'antd'; import { Popconfirm, Tooltip } from 'antd';
import WebFont from 'webfontloader'; import WebFont from 'webfontloader';
import { isMobile } from 'react-device-detect';
import { AiOutlineClose, AiFillDelete } from 'react-icons/ai'; import { AiOutlineClose, AiFillDelete } from 'react-icons/ai';
import TakeAwayIcon from '../../../../../Images/Take away.svg'; import TakeAwayIcon from '../../../../../Images/Take away.svg';
import dineInIcon from '../../../../../Images/Dine In.svg'; import dineInIcon from '../../../../../Images/Dine In.svg';
import {
ChangeTotalAmount,
globalExtraTotalAmount,
} from '../../../../../Features/ExteraCharges/ExtraCharges.js';
import BSBillingEditQuantity from '../BSBillingEditQuantity/BSBillingEditQuantity';
import {
changeholddata,
gettinghold,
puttinghold,
} from '../../../../../Features/BookingScreen/HoldOption/HoldOption.js';
import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js'; import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import BSEditTotalAmt from '../BSEditTotalAmount/BSEditTotalAmt.jsx'; const BSEditTotalAmt = lazy(
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx'; () => import('../BSEditTotalAmount/BSEditTotalAmt.jsx')
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx'; );
const StandardTablePayment = lazy(() => import('./StandardTablePayment.jsx'));
const CustomerPriceHistory = lazy(
() => import('../../UtillComponents/CustomerPriceHistory.jsx')
);
const BSImeiDetails = lazy(() => import('../BSImeiDetails/BSImeiDetails.jsx'));
const BSBillingEditQuantity = lazy(
() => import('../BSBillingEditQuantity/BSBillingEditQuantity')
);
import { import {
getTemplateData, getTemplateData,
SelectedGlobalBillingColorDetail, SelectedGlobalBillingColorDetail,
@ -70,9 +72,17 @@ import {
GlobalSelOption, GlobalSelOption,
GlobalSalesBillEdit, GlobalSalesBillEdit,
} from '../../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../../Features/BookingScreen/BookingData/BookingData';
import {
ChangeTotalAmount,
globalExtraTotalAmount,
} from '../../../../../Features/ExteraCharges/ExtraCharges.js';
import {
changeholddata,
gettinghold,
puttinghold,
} from '../../../../../Features/BookingScreen/HoldOption/HoldOption.js';
import './StandardTable.scss'; import './StandardTable.scss';
import { IoClose } from 'react-icons/io5';
import StandardTablePayment from './StandardTablePayment.jsx';
import { FaAngleDown, FaAngleUp } from 'react-icons/fa'; import { FaAngleDown, FaAngleUp } from 'react-icons/fa';
import { import {
ChangeFullFreeProductList, ChangeFullFreeProductList,
@ -82,10 +92,7 @@ import {
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js'; } from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js'; import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js';
import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js'; import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js';
import { CiShop } from 'react-icons/ci';
import BranchName from '../../../Template/BranchName.jsx';
import { useUtilsComponent } from '../../../../../Services/utils.js'; import { useUtilsComponent } from '../../../../../Services/utils.js';
import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
const StandardTable = () => { const StandardTable = () => {
const { removeExtraCharge } = useUtilsComponent(); const { removeExtraCharge } = useUtilsComponent();
@ -139,18 +146,12 @@ const StandardTable = () => {
const OrderType = useSelector(GlobalOrderType); const OrderType = useSelector(GlobalOrderType);
const GlobalExtraCharge = useSelector(globalExtraTotalAmount); const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
const OtherServicesglobal = useSelector(GlobalOtherSevices); const OtherServicesglobal = useSelector(GlobalOtherSevices);
const totalItems = useSelector(GlobalSummeryTotalItems);
const GetCustId = useSelector(GlobalCustId); const GetCustId = useSelector(GlobalCustId);
const selectedCustomer = useSelector(GlobalSelOption); const selectedCustomer = useSelector(GlobalSelOption);
const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false); const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] =
useState(false);
const [customerProduct, setCustomerProduct] = useState(null); const [customerProduct, setCustomerProduct] = useState(null);
const [tableCollapse, setTableCollapse] = useState(false);
const [shortKeyMethod, setshortKeyMethod] = useState(null); const [shortKeyMethod, setshortKeyMethod] = useState(null);
// Add state for toggle functionality
const [isExpanded, setIsExpanded] = useState(false);
// Add state for mobile table show/hide
const [mobileTableVisible, setMobileTableVisible] = useState(true); const [mobileTableVisible, setMobileTableVisible] = useState(true);
const tableDataDinein = OrderCardDetail?.filter( const tableDataDinein = OrderCardDetail?.filter(
@ -274,16 +275,7 @@ const StandardTable = () => {
} }
return; return;
} }
// 👉 CTRL shortcuts
if (!event.ctrlKey) return; if (!event.ctrlKey) return;
// if (key === 'q') {
// event.preventDefault();
// handleShortcut('qty');
// }
// if (key === 'e') {
// event.preventDefault();
// handleShortcut('price');
// }
if (key === 'q') { if (key === 'q') {
event.preventDefault(); event.preventDefault();
handleShortcut('qty'); handleShortcut('qty');
@ -305,36 +297,6 @@ const StandardTable = () => {
}; };
}, [preferenceshortcutkey, tableDataTakeAway, tableDataDinein, BillOrderPre]); }, [preferenceshortcutkey, tableDataTakeAway, tableDataDinein, BillOrderPre]);
// useEffect(() => {
// const handleKeyDown = (event) => {
// // Ctrl + Q
// if (event.ctrlKey && event.key.toLowerCase() === "q") {
// event.preventDefault();
// const getItem = (data = []) => {
// if (!data.length) return null;
// return BillOrderPre === "Y"
// ? data[0]
// : data[data.length - 1];
// };
// let item = null;
// if (tableDataTakeAway?.length > 0) {
// item = getItem(tableDataTakeAway);
// } else if (tableDataDinein?.length > 0) {
// item = getItem(tableDataDinein);
// }
// if (item) {
// handleEditQuantity(item);
// }
// }
// };
// window.addEventListener("keydown", handleKeyDown);
// return () => {
// window.removeEventListener("keydown", handleKeyDown);
// };
// }, [tableDataTakeAway, tableDataDinein, BillOrderPre]);
const getstockbadge = async () => { const getstockbadge = async () => {
let data = { let data = {
CompId: CompId, CompId: CompId,
@ -576,7 +538,6 @@ const StandardTable = () => {
CompleteRemoveAndPaidToFreeOtherTypeWithoutMerge = false, CompleteRemoveAndPaidToFreeOtherTypeWithoutMerge = false,
RemoveAndUpdateOtherBookingType = false, RemoveAndUpdateOtherBookingType = false,
BookingTypeName, BookingTypeName,
TotalAmt,
localid, localid,
}) => { }) => {
let ModifiedOrderCardDetail = JSON.parse(JSON.stringify(OrderCardDetail)); let ModifiedOrderCardDetail = JSON.parse(JSON.stringify(OrderCardDetail));
@ -687,14 +648,7 @@ const StandardTable = () => {
} }
if (CompleteRemove) { if (CompleteRemove) {
const data = ModifiedOrderCardDetail?.filter( const data = ModifiedOrderCardDetail?.filter(
(e) => (e) => !(e.localId === localid)
!(
(e.localId === localid)
// e?.InwardDtlId === InwardDtlId &&
// e?.Offer === Offer &&
// e?.BookingTypeName === BookingTypeName &&
// e?.TotalAmt === TotalAmt
)
); );
return dispatch(changeOrderCardDetails(data)); return dispatch(changeOrderCardDetails(data));
} }
@ -1915,7 +1869,6 @@ const StandardTable = () => {
insideinwardDtlId: false, insideinwardDtlId: false,
}); });
} else { } else {
let data = isCheckFreeProductOutside?.FreeQty - item?.OrderQty;
//First i Calculate Another Booking Type Qty //First i Calculate Another Booking Type Qty
let anotherBookingType = OrderCardDetail?.find( let anotherBookingType = OrderCardDetail?.find(
(e) => (e) =>
@ -1930,27 +1883,10 @@ const StandardTable = () => {
e?.BookingTypeName != item?.BookingTypeName 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 ( if (
(anotherBookingType?.OrderQty || 0) < (anotherBookingType?.OrderQty || 0) <
anotherBookingTypeOffer?.OrderQty anotherBookingTypeOffer?.OrderQty
) { ) {
//paidproduct ischeckBothBookingType?.OrderQty-anotherBookingType?.OrderQty
//PaidProdcut Current BookingType FreeProductSameBookingType?.OrderQty
let paidproductAnotherType = let paidproductAnotherType =
ischeckBothBookingType?.OrderQty - ischeckBothBookingType?.OrderQty -
anotherBookingType?.OrderQty; anotherBookingType?.OrderQty;
@ -2102,146 +2038,7 @@ const StandardTable = () => {
} }
} }
} }
}; };
// const removeFromCart = async (item) => {
// setPreviousdataLength(OrderCardDetail?.length);
// if (item?.BookingTypeName !== 'Dine In' && OrderType !== 'Hold') {
// const UpdatedData = OrderCardDetail?.filter(
// (cartItem) =>
// !(
// cartItem?.ProdId === item?.ProdId &&
// cartItem?.InwardDtlId === item?.InwardDtlId &&
// cartItem?.OrderRate === item?.OrderRate &&
// cartItem?.BookingTypeName === item?.BookingTypeName &&
// !cartItem?.SalesId
// )
// );
// if (OfferCheckedInSetup && preferenceOffer) {
// await applyOffer(UpdatedData);
// } else {
// dispatch(changeOrderCardDetails(UpdatedData));
// }
// await dispatch(
// ChangeTotalAmount(
// GlobalExtraCharge?.filter((extra) => {
// if (BookingType === 'Dine In') {
// // Remove extra charges linked to the removed product
// return !(extra.ProdId === item?.ProdId && !extra.SalesId);
// } else if (BookingType === 'TakeAway') {
// // Remove extra charges only if SalesId is not present
// return extra.ProdId !== item?.ProdId;
// }
// return true; // Keep everything else
// })
// )
// );
// // if the quantity of the item is 1, remove the item from the cart
// if (OrderCardDetail?.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([]));
// }
// } else if (item?.BookingTypeName !== 'Dine In' && OrderType === 'Hold') {
// const UpdatedData = OrderCardDetail?.filter(
// (cartItem) =>
// !(
// cartItem?.ProdId === item?.ProdId &&
// cartItem?.InwardDtlId === item?.InwardDtlId &&
// cartItem?.OrderRate === item?.OrderRate &&
// cartItem?.BookingTypeName === item?.BookingTypeName
// )
// );
// if (OfferCheckedInSetup && preferenceOffer) {
// await applyOffer(UpdatedData);
// } else {
// dispatch(changeOrderCardDetails(UpdatedData));
// }
// await dispatch(
// ChangeTotalAmount(
// GlobalExtraCharge?.filter((extra) => {
// if (BookingType === 'Dine In') {
// // Remove extra charges linked to the removed product
// return !(extra.ProdId === item?.ProdId && !extra.SalesId);
// } else if (BookingType === 'TakeAway') {
// // Remove extra charges only if SalesId is not present
// return extra.ProdId !== item?.ProdId;
// }
// return true; // Keep everything else
// })
// )
// );
// // if the quantity of the item is 1, remove the item from the cart
// if (OrderCardDetail?.length <= 1) {
// await dispatch(changeReorderHoldDetails({}));
// await dispatch(changeReorderProductDetails([]));
// await dispatch(changeUnpaidData(false));
// await dispatch(changeBookingType('TakeAway'));
// await dispatch(changeTokenOnly(false));
// await dispatch(changeAllProductTokenAvailable(false));
// await dispatch(ChangeOverAllDiscSales(null));
// await dispatch(ChangeOverAllDiscEstimate(null));
// await dispatch(changeSelProdWiseEst([]));
// await dispatch(ChangeTotalAmount([]));
// }
// } else if (item?.BookingTypeName === 'Dine In') {
// const UpdatedData = OrderCardDetail?.filter(
// (cartItem) =>
// !(
// cartItem?.ProdId === item?.ProdId &&
// cartItem?.InwardDtlId === item?.InwardDtlId &&
// cartItem?.OrderRate === item?.OrderRate &&
// cartItem?.BookingTypeName === item?.BookingTypeName &&
// !cartItem?.SalesId
// )
// );
// if (OfferCheckedInSetup && preferenceOffer) {
// await applyOffer(UpdatedData);
// } else {
// dispatch(changeOrderCardDetails(UpdatedData));
// }
// await dispatch(
// ChangeTotalAmount(
// GlobalExtraCharge?.filter((extra) => {
// if (BookingType === 'Dine In') {
// // Remove extra charges linked to the removed product
// return !(extra.ProdId === item?.ProdId && !extra.SalesId);
// } else if (BookingType === 'TakeAway') {
// // Remove extra charges only if SalesId is not present
// return extra.ProdId !== item?.ProdId;
// }
// return true; // Keep everything else
// })
// )
// ); // if the quantity of the item is 1, remove the item from the cart
// if (OrderCardDetail?.length <= 1) {
// await dispatch(changeReorderHoldDetails({}));
// await dispatch(changeReorderProductDetails([]));
// await dispatch(changeUnpaidData(false));
// await dispatch(ChangeSelectedCustDisable(false));
// await dispatch(changeSelectedOption(false));
// await dispatch(changeBookingType('TakeAway'));
// await dispatch(changeTokenOnly(false));
// await dispatch(changeAllProductTokenAvailable(false));
// await dispatch(ChangeOverAllDiscSales(null));
// await dispatch(ChangeOverAllDiscEstimate(null));
// await dispatch(changeSelProdWiseEst([]));
// await dispatch(ChangeTotalAmount([]));
// }
// }
// };
useEffect(() => { useEffect(() => {
// setTriggerAnimation(true); // setTriggerAnimation(true);
@ -2296,16 +2093,12 @@ const StandardTable = () => {
const handleCustomerProductPriceHistory = (item) => { const handleCustomerProductPriceHistory = (item) => {
setCustomerPriceHistoryOpen(true); setCustomerPriceHistoryOpen(true);
setCustomerProduct(item?.ProdId); setCustomerProduct(item?.ProdId);
} };
const handleEditQuantityCancel = () => { const handleEditQuantityCancel = () => {
setEditQuantity(false); setEditQuantity(false);
}; };
const handleToggle = () => {
setIsExpanded(!isExpanded);
};
const handleTableCart = () => { const handleTableCart = () => {
if (window.innerWidth <= 768) { if (window.innerWidth <= 768) {
setMobileTableVisible((prev) => !prev); setMobileTableVisible((prev) => !prev);
@ -2594,7 +2387,8 @@ const StandardTable = () => {
{OldtableDataTakeAway?.map((item, index) => ( {OldtableDataTakeAway?.map((item, index) => (
<tr <tr
key={index} key={index}
className={`${item?.SalesId && OrderType !== 'Hold' className={`${
item?.SalesId && OrderType !== 'Hold'
? 'booking-billing-table-row-disabled' ? 'booking-billing-table-row-disabled'
: 'booking-billing-table-row' : 'booking-billing-table-row'
}`} }`}
@ -2652,7 +2446,7 @@ const StandardTable = () => {
index == 0 && index == 0 &&
tableitem.OptionName == 'Sl.No' && ( tableitem.OptionName == 'Sl.No' && (
<td <td
rowspan={OrderCardDetail.length} rowSpan={OrderCardDetail.length}
style={{ backgroundColor: '#CFB59D' }} style={{ backgroundColor: '#CFB59D' }}
> >
<img width="30px" alt="" src={TakeAwayIcon} /> <img width="30px" alt="" src={TakeAwayIcon} />
@ -2870,7 +2664,9 @@ const StandardTable = () => {
} }
}} }}
> >
{safeRound(item?.TotalAmt - (item?.Offer || 0) || 0)} {safeRound(
item?.TotalAmt - (item?.Offer || 0) || 0
)}
</td> </td>
)} )}
{tableitem.OptionName == 'Delete' && ( {tableitem.OptionName == 'Delete' && (
@ -2914,7 +2710,8 @@ const StandardTable = () => {
{OldtableDataDinein?.map((item, index) => ( {OldtableDataDinein?.map((item, index) => (
<tr <tr
key={OldtableDataTakeAway?.length + index} key={OldtableDataTakeAway?.length + index}
className={`${item?.SalesId className={`${
item?.SalesId
? 'booking-billing-table-row-disabled' ? 'booking-billing-table-row-disabled'
: 'booking-billing-table-row' : 'booking-billing-table-row'
} }
@ -2975,7 +2772,7 @@ const StandardTable = () => {
index == 0 && index == 0 &&
tableitem.OptionName == 'Sl.No' && ( tableitem.OptionName == 'Sl.No' && (
<td <td
rowspan={OrderCardDetail.length} rowSpan={OrderCardDetail.length}
style={{ backgroundColor: '#A2C3CD' }} style={{ backgroundColor: '#A2C3CD' }}
> >
<img width="30px" alt="" src={dineInIcon} /> <img width="30px" alt="" src={dineInIcon} />
@ -3187,7 +2984,9 @@ const StandardTable = () => {
} }
}} }}
> >
{safeRound(item?.TotalAmt - (item?.Offer || 0) || 0)} {safeRound(
item?.TotalAmt - (item?.Offer || 0) || 0
)}
</td> </td>
)} )}
@ -3236,7 +3035,8 @@ const StandardTable = () => {
OldtableDataTakeAway?.length + OldtableDataTakeAway?.length +
index index
} }
className={`${BookingType === 'Dine In' && item?.SalesId className={`${
BookingType === 'Dine In' && item?.SalesId
? 'booking-billing-table-row-disabled' ? 'booking-billing-table-row-disabled'
: 'booking-billing-table-row' : 'booking-billing-table-row'
} }
@ -3328,7 +3128,7 @@ const StandardTable = () => {
index == 0 && index == 0 &&
tableitem.OptionName == 'Sl.No' && ( tableitem.OptionName == 'Sl.No' && (
<td <td
rowspan={OrderCardDetail.length} rowSpan={OrderCardDetail.length}
style={{ backgroundColor: '#CFB59D' }} style={{ backgroundColor: '#CFB59D' }}
> >
<img width="30px" alt="" src={TakeAwayIcon} /> <img width="30px" alt="" src={TakeAwayIcon} />
@ -3552,7 +3352,9 @@ const StandardTable = () => {
} }
}} }}
> >
{safeRound(item?.TotalAmt - (item?.Offer || 0) || 0)} {safeRound(
item?.TotalAmt - (item?.Offer || 0) || 0
)}
</td> </td>
)} )}
@ -3601,7 +3403,8 @@ const StandardTable = () => {
tableDataTakeAway?.length + tableDataTakeAway?.length +
index index
} }
className={`${BookingType === 'Dine In' && item?.SalesId className={`${
BookingType === 'Dine In' && item?.SalesId
? 'booking-billing-table-row-disabled' ? 'booking-billing-table-row-disabled'
: 'booking-billing-table-row' : 'booking-billing-table-row'
} }
@ -3681,7 +3484,7 @@ const StandardTable = () => {
index == 0 && index == 0 &&
tableitem.OptionName == 'Sl.No' && ( tableitem.OptionName == 'Sl.No' && (
<td <td
rowspan={OrderCardDetail.length} rowSpan={OrderCardDetail.length}
style={{ backgroundColor: '#A2C3CD' }} style={{ backgroundColor: '#A2C3CD' }}
> >
<img width="30px" alt="" src={dineInIcon} /> <img width="30px" alt="" src={dineInIcon} />
@ -3898,7 +3701,9 @@ const StandardTable = () => {
} }
}} }}
> >
{safeRound(item?.TotalAmt - (item?.Offer || 0) || 0)} {safeRound(
item?.TotalAmt - (item?.Offer || 0) || 0
)}
</td> </td>
)} )}
@ -3929,6 +3734,7 @@ const StandardTable = () => {
</tbody> </tbody>
)} )}
</table> </table>
<Suspense fallback={<div>Loading...</div>}>
{OpenEditTotalAmt && ( {OpenEditTotalAmt && (
<BSEditTotalAmt <BSEditTotalAmt
EditTotalOpen={OpenEditTotalAmt} EditTotalOpen={OpenEditTotalAmt}
@ -3942,7 +3748,7 @@ const StandardTable = () => {
ProductDetail={Modaldata} ProductDetail={Modaldata}
/> />
)} )}
{(customerPriceHistoryOpen && GetCustId) && {customerPriceHistoryOpen && GetCustId && (
<CustomerPriceHistory <CustomerPriceHistory
open={customerPriceHistoryOpen} open={customerPriceHistoryOpen}
custId={GetCustId} custId={GetCustId}
@ -3952,10 +3758,13 @@ const StandardTable = () => {
selectedCustomer={selectedCustomer} selectedCustomer={selectedCustomer}
OrderCardDetail={OrderCardDetail} OrderCardDetail={OrderCardDetail}
/> />
} )}
</Suspense>
</div> </div>
<div className="booking-table-footer"> <div className="booking-table-footer">
<Suspense fallback={<div>Loading...</div>}>
<StandardTablePayment /> <StandardTablePayment />
</Suspense>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,5 +1,12 @@
import React, {
useCallback,
useEffect,
useRef,
useState,
lazy,
Suspense,
} from 'react';
import { import {
FaAngleDown,
FaCartPlus, FaCartPlus,
FaMoneyBillWave, FaMoneyBillWave,
FaPrint, FaPrint,
@ -8,8 +15,13 @@ import {
import { IoClose } from 'react-icons/io5'; import { IoClose } from 'react-icons/io5';
import { FaMobileScreenButton } from 'react-icons/fa6'; import { FaMobileScreenButton } from 'react-icons/fa6';
import moment from 'moment'; import moment from 'moment';
import Credit from '../../UtillComponents/Pozo retail icons/credit.svg'; import { Tables } from '../../../../../Components/Tables/Table.jsx';
import { FaCreditCard } from 'react-icons/fa6'; import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip.jsx';
import UpiPopover from './Utils/UpiPopOver';
import { isMobile } from 'react-device-detect';
import { useDispatch } from 'react-redux';
// Js Files
import { import {
changeAddBookingDetailsTrigger, changeAddBookingDetailsTrigger,
changeBillEditingMode, changeBillEditingMode,
@ -58,6 +70,7 @@ import {
getSelectedFavItems, getSelectedFavItems,
getUnpaidData, getUnpaidData,
GlobalAddBookingDetailsTrigger, GlobalAddBookingDetailsTrigger,
GlobalAllBookingType,
GlobalBookingType, GlobalBookingType,
GlobalBookingTypeBoth, GlobalBookingTypeBoth,
GlobalCombocarddata, GlobalCombocarddata,
@ -89,7 +102,6 @@ import {
GlobalSelectedTableDetails, GlobalSelectedTableDetails,
GlobalSelOption, GlobalSelOption,
GlobalSelProdWiseEst, GlobalSelProdWiseEst,
GlobalSummeryTotalItems,
GlobalSummeryTotalTaxAmount, GlobalSummeryTotalTaxAmount,
GlobaltipAmount, GlobaltipAmount,
Globalunpaidflow, Globalunpaidflow,
@ -104,16 +116,10 @@ import {
putSalesBillEdit, putSalesBillEdit,
putSplitpaymentStatus, putSplitpaymentStatus,
SendPaymentLink, SendPaymentLink,
} from '../../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../../Features/BookingScreen/BookingData/BookingData.js';
import { shallowEqual, useSelector } from 'react-redux'; import { shallowEqual, useSelector } from 'react-redux';
import { Global_OverallOfferAmount } from '../../../../../Features/Offer/Offer';
import { import {
Global_OrderOfferDetail,
Global_OverallOfferAmount,
} from '../../../../../Features/Offer/Offer';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import {
getPrinterMappingDetails,
getPrintSelectionComponentData,
getTemplateData, getTemplateData,
GlobalprintDatas, GlobalprintDatas,
GlobalPrinterMappingDtls, GlobalPrinterMappingDtls,
@ -130,13 +136,11 @@ import {
encryptObject, encryptObject,
extractLastNumberOrderId, extractLastNumberOrderId,
} from '../../../../../Services/Others'; } from '../../../../../Services/Others';
import { useDispatch } from 'react-redux';
import { getPaymentOptionsData } from '../../../../../Features/BookingScreen/BookingData/KioskBookingData'; import { getPaymentOptionsData } from '../../../../../Features/BookingScreen/BookingData/KioskBookingData';
import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices'; import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices';
import paygate from '../../../../../Images/paygate.png'; import paygate from '../../../../../Images/paygate.png';
import defaultupi from '../../../../../Images/defaultupi.png'; import defaultupi from '../../../../../Images/defaultupi.png';
import paydevice from '../../../../../Images/paydevice.png'; import paydevice from '../../../../../Images/paydevice.png';
import QrinScreen from '../../BookingFunctionality/DynamicScreenQr.jsx';
import { import {
changeholddata, changeholddata,
gettinghold, gettinghold,
@ -147,33 +151,22 @@ import {
changeSalesPaymentoption, changeSalesPaymentoption,
GlobalSalesPaymentoption, GlobalSalesPaymentoption,
} from '../../../../../Features/Payment/Paymentoptions/Paymentoptions'; } from '../../../../../Features/Payment/Paymentoptions/Paymentoptions';
import UpiPopover from './Utils/UpiPopOver';
import { isMobile } from 'react-device-detect';
import { MobilePdfPrint } from '../../BookingFunctionality/MobilePdfPrint';
import IndividualTokenMobilePrint from '../../BookingFunctionality/IndividualTokenMobilePrint'; import IndividualTokenMobilePrint from '../../BookingFunctionality/IndividualTokenMobilePrint';
import SingleTokenMobilePrint from '../../BookingFunctionality/SingleTokenMobilePrint'; import SingleTokenMobilePrint from '../../BookingFunctionality/SingleTokenMobilePrint';
import MobilePrint from '../../BookingFunctionality/MobilePrint'; import MobilePrint from '../../BookingFunctionality/MobilePrint';
import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction'; import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction';
import { printDiv } from '../../../../../Services/WSOthers'; import { printDiv } from '../../../../../Services/WSOthers';
import { MdSms } from 'react-icons/md';
import WhatsAppShare from '../../../../WhatsAppShare/whatsAppShare';
import SMSShare from '../../../../WhatsAppShare/SmsShare';
import { GlobalBookingStatus } from '../../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail'; import { GlobalBookingStatus } from '../../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail';
import { useAuth } from '../../../../../AuthContext'; import { useAuth } from '../../../../../AuthContext';
import CountUp from 'react-countup'; import CountUp from 'react-countup';
import { BiRightArrowAlt } from 'react-icons/bi';
import { GlobalpreOrderOpen } from '../../../../../Features/BookingScreen/PreOrder/PreOrder'; import { GlobalpreOrderOpen } from '../../../../../Features/BookingScreen/PreOrder/PreOrder';
import BsBillingCreditCustomer from '../../BookingFunctionality/BSBillingCreditCustomer'; import BsBillingCreditCustomer from '../../BookingFunctionality/BSBillingCreditCustomer';
import TokensinglePrint from '../../../../paymentpdfPage/TokenOnlyPrints/TokeninsinglePrint';
import PaymentPdfBooking from '../../../../paymentpdfPage/PaymentPdfBooking'; import PaymentPdfBooking from '../../../../paymentpdfPage/PaymentPdfBooking';
import { DefaultModal } from '../../../../../Components/Modal/DefaultModal'; import { DefaultModal } from '../../../../../Components/Modal/DefaultModal';
import Buttons from '../../../../../Components/Forms/Buttons'; import Buttons from '../../../../../Components/Forms/Buttons';
import { ArrowRightOutlined } from '@ant-design/icons';
import Paymentoption from '../../../../Payment/PaymentOptions/PaymentOptions';
import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon';
import SplitPayment from '../../BookingFunctionality/SplitPayment'; import SplitPayment from '../../BookingFunctionality/SplitPayment';
import BSCreditCustomer from '../../UtillComponents/BSCreditCustomer'; import BSCreditCustomer from '../../UtillComponents/BSCreditCustomer';
import PozoAdvanceIcon from '../../UtillComponents/Pozo retail icons/PozoAdvanceIcon';
import { import {
getDefaultPaymentOptions, getDefaultPaymentOptions,
GlobalAddCustomerDetails, GlobalAddCustomerDetails,
@ -182,12 +175,8 @@ import {
} from '../../../../../Features/BookingScreen/Customer/addCustomer'; } from '../../../../../Features/BookingScreen/Customer/addCustomer';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin'; import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin';
import PozoDineInIcon from '../../UtillComponents/Pozo retail icons/PozoDineIn';
import { Messages } from '../../../../../Components/Notifications/Messages'; import { Messages } from '../../../../../Components/Notifications/Messages';
import WpIcon from '../../../../../Images/message.png';
import { FaAngleUp } from 'react-icons/fa'; import { FaAngleUp } from 'react-icons/fa';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import CardPopover from './Utils/CardPopover.jsx';
import { import {
ChangeFullFreeProductList, ChangeFullFreeProductList,
changeFullOfferAppliedProducts, changeFullOfferAppliedProducts,
@ -197,24 +186,57 @@ import {
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js'; } from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js'; import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js';
import { PublicQrCodepost } from '../../../../../Features/ConfigMasterPage/ConfigMasterPage.js'; import { PublicQrCodepost } from '../../../../../Features/ConfigMasterPage/ConfigMasterPage.js';
import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip.jsx';
import PozoUnpaidIcon from '../../UtillComponents/Pozo retail icons/PozoUnpaidIcon.jsx';
import { Tables } from '../../../../../Components/Tables/Table.jsx';
import pozologoimg from '../../../../../Images/pozologoimg.png';
import PaymentGatewayEmbedded from '../../UtillComponents/PaymentGatewayEmbedded.jsx';
import MobileMultiPdfPrintTrigger from '../../UtillComponents/MobileMultiPdfPrintTrigger.jsx';
import OtherServicePrintStyle1 from '../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx';
import OtherServiceMobilePrint from '../../BookingFunctionality/OtherServiceMobilePrint.jsx';
import { import {
getExpireProductsList, getExpireProductsList,
getLowStockAlertProductsList, getLowStockAlertProductsList,
} from '../../../../../Features/ProductPage/ProductPage.js'; } from '../../../../../Features/ProductPage/ProductPage.js';
import { PostBlockSlots } from '../../../../../Features/Kiosk/kiosk.js';
import CustomerOrders from '../../BookingFunctionality/CustomerOrders.jsx'; // Jsx Files
import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js'; const CustomerOrders = lazy(
() => import('../../BookingFunctionality/CustomerOrders.jsx')
);
const PaymentGatewayEmbedded = lazy(
() => import('../../UtillComponents/PaymentGatewayEmbedded.jsx')
);
const MobileMultiPdfPrintTrigger = lazy(
() => import('../../UtillComponents/MobileMultiPdfPrintTrigger.jsx')
);
const OtherServicePrintStyle1 = lazy(
() =>
import('../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx')
);
const OtherServiceMobilePrint = lazy(
() => import('../../BookingFunctionality/OtherServiceMobilePrint.jsx')
);
const QrinScreen = lazy(
() => import('../../BookingFunctionality/DynamicScreenQr.jsx')
);
const CardPopover = lazy(() => import('./Utils/CardPopover.jsx'));
const SMSShare = lazy(() => import('../../../../WhatsAppShare/SmsShare'));
const WhatsAppShare = lazy(
() => import('../../../../WhatsAppShare/whatsAppShare')
);
const TokensinglePrint = lazy(
() => import('../../../../paymentpdfPage/TokenOnlyPrints/TokeninsinglePrint')
);
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
// Icons File
import WpIcon from '../../../../../Images/message.png';
import pozologoimg from '../../../../../Images/pozologoimg.png';
import PozoUnpaidIcon from '../../UtillComponents/Pozo retail icons/PozoUnpaidIcon.jsx';
import PozoDineInIcon from '../../UtillComponents/Pozo retail icons/PozoDineIn';
import Credit from '../../UtillComponents/Pozo retail icons/credit.svg';
import Paymentoption from '../../../../Payment/PaymentOptions/PaymentOptions';
import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon';
import { ArrowRightOutlined } from '@ant-design/icons';
import { BiRightArrowAlt } from 'react-icons/bi';
import PozoAdvanceIcon from '../../UtillComponents/Pozo retail icons/PozoAdvanceIcon';
import { MdSms } from 'react-icons/md';
//
const subDirectory = import.meta.env.ENV_BASE_URL; const subDirectory = import.meta.env.ENV_BASE_URL;
const MainHomeUrl = import.meta.env.ENV_MAIN_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 currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
const StandardTablePayment = () => { const StandardTablePayment = () => {
@ -231,11 +253,10 @@ const StandardTablePayment = () => {
const CompId = SessionData?.CompId; const CompId = SessionData?.CompId;
const UserId = SessionData?.UserId; const UserId = SessionData?.UserId;
const UserType = SessionData?.UserType; const UserType = SessionData?.UserType;
const AuthToken = SessionData?.AuthToken;
const SessionMobileNo = SessionData?.SessionMobileNo;
const applyOffer = useApplyOfferto_CardDetail(); const applyOffer = useApplyOfferto_CardDetail();
const defaultPaymentTrigger = useSelector(GlobalPaymentTrigger); const defaultPaymentTrigger = useSelector(GlobalPaymentTrigger);
const defaultBookingType = useSelector(GlobalDefaultBookingType); const defaultBookingType = useSelector(GlobalDefaultBookingType);
const AllBookingType = useSelector(GlobalAllBookingType);
const Holddata = useSelector(globalholddata); const Holddata = useSelector(globalholddata);
const FontFamily = useSelector(GlobalSelectedFont); const FontFamily = useSelector(GlobalSelectedFont);
const prodCat = useSelector(GlobalProductCategorie); const prodCat = useSelector(GlobalProductCategorie);
@ -273,13 +294,14 @@ const StandardTablePayment = () => {
const [SelectedBookingType, setSelectedBookingType] = useState(null); const [SelectedBookingType, setSelectedBookingType] = useState(null);
const GlobaluseOptions = useSelector(GlobalCommonPaymentOptions); const GlobaluseOptions = useSelector(GlobalCommonPaymentOptions);
const SelCustId = useSelector(GlobalSelCustId); const SelCustId = useSelector(GlobalSelCustId);
const OrderOfferDetail = useSelector(Global_OrderOfferDetail, shallowEqual);
const GlobProdwisedata = useSelector(GlobalSelProdWiseEst); const GlobProdwisedata = useSelector(GlobalSelProdWiseEst);
const GlobEstBooking = useSelector(GlobalEstimateBooking); const GlobEstBooking = useSelector(GlobalEstimateBooking);
const OtherServicesglobal = useSelector(GlobalOtherSevices); const OtherServicesglobal = useSelector(GlobalOtherSevices);
const salesBillEdit = useSelector(GlobalSalesBillEdit); const salesBillEdit = useSelector(GlobalSalesBillEdit);
const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); const previousOrderOfferDetails = useSelector(
GlobalPreviousOrderOfferDetails
);
const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
const OrderType = useSelector(GlobalOrderType); const OrderType = useSelector(GlobalOrderType);
const unpaidFlow = useSelector(Globalunpaidflow); const unpaidFlow = useSelector(Globalunpaidflow);
@ -323,7 +345,6 @@ const StandardTablePayment = () => {
preference?.PreferredSubCatName === 'SportsApp' && preference?.PreferredSubCatName === 'SportsApp' &&
preference?.PreferredStatus == 'Y' preference?.PreferredStatus == 'Y'
); );
console.log(selectedDate, 'selectedDateselectedDate');
const PrinterDetails = useSelector(GlobalPrinterMappingDtls); const PrinterDetails = useSelector(GlobalPrinterMappingDtls);
const UpiQRPreference = preferenceDetails?.find( const UpiQRPreference = preferenceDetails?.find(
(setting) => (setting) =>
@ -336,7 +357,6 @@ const StandardTablePayment = () => {
const [blink, setBlink] = useState(false); const [blink, setBlink] = useState(false);
const [showWhatsAppShare, setShowWhatsAppShare] = useState(false); const [showWhatsAppShare, setShowWhatsAppShare] = useState(false);
const [showSMSShare, setSMSShare] = useState(false); const [showSMSShare, setSMSShare] = useState(false);
const [formattedDate, setFormattedDate] = useState('');
const [OrderStatus, setOrderStatus] = useState(true); const [OrderStatus, setOrderStatus] = useState(true);
const [OtherServicesPrintDetails, setOtherServicesPrintDetails] = useState( const [OtherServicesPrintDetails, setOtherServicesPrintDetails] = useState(
[] []
@ -598,10 +618,10 @@ const StandardTablePayment = () => {
}, },
}, },
]; ];
useEffect(() => { // useEffect(() => {
let data = { compId: CompId, branchId: BranchId }; // let data = { compId: CompId, branchId: BranchId };
dispatch(getCurrentOrderid(data)).unwrap(); // dispatch(getCurrentOrderid(data)).unwrap();
}, []); // }, []);
const TableData = []; const TableData = [];
tabledata?.map((item) => tabledata?.map((item) =>
TableData.push({ TableData.push({
@ -639,19 +659,6 @@ const StandardTablePayment = () => {
} }
}, [AddBookingDetailsTrigger]); }, [AddBookingDetailsTrigger]);
// useEffect(() => {
// let data = {
// CompId: CompId,
// BranchId: BranchId,
// AppId: AppId,
// UserId: UserId,
// };
// dispatch(getPrinterMappingDetails(data)).unwrap();
// const Data1 = { AppId, CompId, BranchId };
// dispatch(getPrintSelectionComponentData(Data1)).unwrap();
// }, []);
useEffect(() => { useEffect(() => {
if (isMobile) { if (isMobile) {
OtherServiceMobilePrint( OtherServiceMobilePrint(
@ -735,29 +742,6 @@ const StandardTablePayment = () => {
unpaidFlow, unpaidFlow,
]); ]);
// 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(() => { useEffect(() => {
// setPaybtnnameselected(PaymentOptions?.[0]?.ModeName); // setPaybtnnameselected(PaymentOptions?.[0]?.ModeName);
// setPaybtnselected(PaymentOptions?.[0]?.ModeId); // setPaybtnselected(PaymentOptions?.[0]?.ModeId);
@ -900,14 +884,21 @@ const StandardTablePayment = () => {
const filteredPayments = const filteredPayments =
previousOrderPayment?.filter( previousOrderPayment?.filter(
p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment (p) =>
p?.LastOrderTran === 'Y' &&
p?.AfterAdjustment != null &&
p?.AfterAdjustment !== '' &&
p?.AfterAdjustment
) || []; ) || [];
const paymentsToUse = const paymentsToUse =
filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; filteredPayments.length > 0
? filteredPayments
: previousOrderPayment || [];
const totalPreviouspayment = paymentsToUse?.reduce( const totalPreviouspayment = paymentsToUse?.reduce(
(acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), (acc, payment) =>
acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
0 0
); );
@ -916,9 +907,7 @@ const StandardTablePayment = () => {
0 0
); );
const previousNetAmount = const previousNetAmount = totalPreviouspayment || 0;
(totalPreviouspayment) || 0;
let withdiscTotal = let withdiscTotal =
Total - Total -
@ -930,22 +919,35 @@ const StandardTablePayment = () => {
withdiscTotal >= 0 withdiscTotal >= 0
? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2)
: (Number(Total) + Number(globalTipAmount)).toFixed(2) : (Number(Total) + Number(globalTipAmount)).toFixed(2)
) );
console.log(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount, "totalPreviouspayment") console.log(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount,
'totalPreviouspayment'
);
setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); setTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
);
setCurrentOrderNetAmount(currentOrderNetAmount); setCurrentOrderNetAmount(currentOrderNetAmount);
setPreviousNetAmount(previousNetAmount); setPreviousNetAmount(previousNetAmount);
dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(
// dispatch( changeSummeryTotalAmount(
// changeSummeryTotalAmount(withdiscTotal > 0 ? withdiscTotal : Number(Total)) salesBillEdit
// ); ? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
)
);
dispatch(changeSummeryComboOfferAmount(withComboSum)); dispatch(changeSummeryComboOfferAmount(withComboSum));
// if (withdiscTotal <= 0) {
// dispatch(ChangeOverAllDiscSales(0));
// dispatch(ChangeOverAllDiscEstimate(0));
// }
} else { } else {
setTotalAmount(0); setTotalAmount(0);
dispatch(changeSummeryTotalAmount(0)); dispatch(changeSummeryTotalAmount(0));
@ -971,22 +973,6 @@ const StandardTablePayment = () => {
} }
}, [orderCardDetail]); }, [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(() => { useEffect(() => {
if (!PrintOrderDetails?.length) return; if (!PrintOrderDetails?.length) return;
@ -1065,7 +1051,6 @@ const StandardTablePayment = () => {
}, [PaymentUpiOptions, PaymentOptions, SelCustId]); }, [PaymentUpiOptions, PaymentOptions, SelCustId]);
useEffect(() => { useEffect(() => {
if (salesBillEdit) { if (salesBillEdit) {
if (SelCustId) { if (SelCustId) {
setRefundPayBtns(AllPaymentOptions); setRefundPayBtns(AllPaymentOptions);
@ -1080,8 +1065,7 @@ const StandardTablePayment = () => {
setRefundPayBtns(withoutCustomer); setRefundPayBtns(withoutCustomer);
} }
} }
}, [AllPaymentOptions, SelCustId, salesBillEdit]);
}, [AllPaymentOptions, SelCustId, salesBillEdit])
useEffect(() => { useEffect(() => {
if ( if (
@ -1179,7 +1163,11 @@ const StandardTablePayment = () => {
const handleButtonClick = () => { const handleButtonClick = () => {
if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) {
UpiPayment(); UpiPayment();
} else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { } else if (
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
!refundPaySelected
) {
setMessageType('warning'); setMessageType('warning');
setMessageData('Please Select Refund Payment Method'); setMessageData('Please Select Refund Payment Method');
return; return;
@ -1562,8 +1550,10 @@ const StandardTablePayment = () => {
SalesPaymentType: 'normal', SalesPaymentType: 'normal',
PaymentDetail: [ PaymentDetail: [
{ {
PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : PaymentType:
Paybtnnameselected?.toLowerCase() === 'upi' salesBillEdit && currentOrderNetAmount < previousNetAmount
? refundPaySelected
: Paybtnnameselected?.toLowerCase() === 'upi'
? SelectedUPIPayOption?.toLowerCase() === 'pd' ? SelectedUPIPayOption?.toLowerCase() === 'pd'
? PaymentDeviceUPI?.[0]?.ModeId ? PaymentDeviceUPI?.[0]?.ModeId
: SelectedUPIPayOption?.toLowerCase() === 'pg' : SelectedUPIPayOption?.toLowerCase() === 'pg'
@ -1576,15 +1566,25 @@ const StandardTablePayment = () => {
: paybtnselected : paybtnselected
? paybtnselected ? paybtnselected
: null, : null,
Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), Amount:
MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : salesBillEdit && currentOrderNetAmount < previousNetAmount
Paybtnnameselected?.toLowerCase() === 'upi' && ? previousNetAmount - currentOrderNetAmount
: Math.round(TotalAmount),
MerchantId:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'business' SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantId ?.MerchantId
: null, : null,
PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : PaymentOptionType:
Paybtnnameselected?.toLowerCase() === 'cash' salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'PC' ? 'PC'
: Paybtnnameselected?.toLowerCase() === 'credit' : Paybtnnameselected?.toLowerCase() === 'credit'
? 'PC' ? 'PC'
@ -1597,16 +1597,21 @@ const StandardTablePayment = () => {
? 'BU' ? 'BU'
: SelectedUPIPayOption : SelectedUPIPayOption
: null, : null,
ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : ModeOfPayment:
SelectedUPIPayOption?.toLowerCase() === 'default' salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: SelectedUPIPayOption?.toLowerCase() === 'default'
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
?.UPIDetailId ?.UPIDetailId
: SelectedUPIPayOption?.toLowerCase() === 'business' : SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ? BusinessPayOption?.find(
?.MerchantUPIId (busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
: null, : null,
AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : AccountDtl:
Paybtnnameselected?.toLowerCase() === 'upi' && salesBillEdit && currentOrderNetAmount < previousNetAmount
? []
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default' SelectedUPIPayOption?.toLowerCase() === 'default'
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
(upipay) => upipay?.UPIId === UpiId (upipay) => upipay?.UPIId === UpiId
@ -1622,8 +1627,10 @@ const StandardTablePayment = () => {
SelectedCardOption?.toLowerCase() === 'pg') SelectedCardOption?.toLowerCase() === 'pg')
? useOptions?.[0]?.PaymentDetails?.PaymentGateway ? useOptions?.[0]?.PaymentDetails?.PaymentGateway
: [], : [],
PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : PaymentStatus:
Paybtnnameselected?.toLowerCase() === 'cash' salesBillEdit && currentOrderNetAmount < previousNetAmount
? 'S'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'S' ? 'S'
: Paybtnnameselected?.toLowerCase() === 'credit' : Paybtnnameselected?.toLowerCase() === 'credit'
? 'S' ? 'S'
@ -1631,9 +1638,18 @@ const StandardTablePayment = () => {
SelectedUPIPayOption?.toLowerCase() === 'default' SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S' ? 'S'
: 'P', : 'P',
Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, Debit:
Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && Paybtnnameselected?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
? Math.round(previousNetAmount - currentOrderNetAmount)
: 0,
Credit: salesBillEdit
? currentOrderNetAmount > previousNetAmount &&
Paybtnnameselected?.toLowerCase() === 'credit' Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount)
: 0
: Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount) ? Math.round(TotalAmount)
: 0, : 0,
}, },
@ -2039,8 +2055,8 @@ const StandardTablePayment = () => {
}; };
const handleSalesBillEdit = async (putdatas, value, pay) => { const handleSalesBillEdit = async (putdatas, value, pay) => {
console.log(putdatas, value, pay, "handleSalesBillEdit") console.log(putdatas, value, pay, 'handleSalesBillEdit');
} };
const OtherServicePostBooking = async (PostData, value) => { const OtherServicePostBooking = async (PostData, value) => {
console.log(PostData, value, 'PostData, value'); console.log(PostData, value, 'PostData, value');
@ -2091,6 +2107,7 @@ const StandardTablePayment = () => {
} }
: {}), : {}),
}; };
await dispatch(getSelectedFavItems(data)).unwrap(); await dispatch(getSelectedFavItems(data)).unwrap();
let data1 = { let data1 = {
@ -2435,27 +2452,11 @@ const StandardTablePayment = () => {
setMessageData('Payment Failed'); setMessageData('Payment Failed');
await dispatch(changePaymentloader(false)); await dispatch(changePaymentloader(false));
setFirstPaymentclick(false); setFirstPaymentclick(false);
// setPaybtnselected(PaymentOptions?.[0]?.ModeId);
// setPaybtnnameselected(PaymentOptions?.[0]?.ModeName);
setPaybtnnameselected(PaymentOptionsModeName); setPaybtnnameselected(PaymentOptionsModeName);
setPaybtnselected(PaymentOptionsModeId); setPaybtnselected(PaymentOptionsModeId);
clearInterval(intervalId); // Stop the loop when payment fails clearInterval(intervalId); // Stop the loop when payment fails
CustomerDisplayRemovedData(); CustomerDisplayRemovedData();
ClearAllGlobalStateDatas(value); 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) { } catch (error) {
@ -2666,13 +2667,6 @@ const StandardTablePayment = () => {
orderCardDetail?.length > 0 && orderCardDetail?.length > 0 &&
(BookingType === 'Dine In' || BookingTypeBoth) (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); setUnpaidConfirmation(true);
setunpaidselectedindex(event); setunpaidselectedindex(event);
} else { } else {
@ -2789,7 +2783,7 @@ const StandardTablePayment = () => {
const handleRefundPaymentMode = (id, name) => { const handleRefundPaymentMode = (id, name) => {
setRefundPaySelected(id); setRefundPaySelected(id);
setRefundPaySelectedName(name); setRefundPaySelectedName(name);
} };
const addUpiOption = async (id, name, UPIId) => { const addUpiOption = async (id, name, UPIId) => {
await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDprint(UPIId));
@ -2842,7 +2836,9 @@ const StandardTablePayment = () => {
setPaybtnselected(PaymentOptionsModeId); setPaybtnselected(PaymentOptionsModeId);
setQrCode(false); setQrCode(false);
setUpinotSelected(false); setUpinotSelected(false);
if (holdCheckedSalesSetup) {
getHolddata(); getHolddata();
}
setCurrentOrderNetAmount(0); setCurrentOrderNetAmount(0);
setPreviousNetAmount(0); setPreviousNetAmount(0);
if (defaultBookingType === 'Both') { if (defaultBookingType === 'Both') {
@ -2986,8 +2982,9 @@ const StandardTablePayment = () => {
async (orderDetail, index) => { async (orderDetail, index) => {
await printDiv(`${selectedStyle}-${index}`, style); // Use unique IDs for each print await printDiv(`${selectedStyle}-${index}`, style); // Use unique IDs for each print
if (orderDetail?.BookingTypeName !== 'Dine In') { if (orderDetail?.BookingTypeName !== 'Dine In') {
const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( const groupedTokens = orderDetail?.productDetails
(acc, item, idx) => { ?.filter((data) => data?.EditTokenAvailable !== 'N')
?.reduce((acc, item, idx) => {
if (item.TokenAvailable === 'Y') { if (item.TokenAvailable === 'Y') {
if (!item.CounterName) { if (!item.CounterName) {
// If CounterName is null or empty // If CounterName is null or empty
@ -3000,9 +2997,7 @@ const StandardTablePayment = () => {
} }
} }
return acc; return acc;
}, }, {});
{}
);
// Iterate over grouped tokens and print them // Iterate over grouped tokens and print them
const tokensToPrint = Object.entries(groupedTokens).map( const tokensToPrint = Object.entries(groupedTokens).map(
@ -3031,8 +3026,9 @@ const StandardTablePayment = () => {
await Promise.all( await Promise.all(
PrintOrderDetails?.[0]?.OrderDetails?.map( PrintOrderDetails?.[0]?.OrderDetails?.map(
async (orderDetail, index) => { async (orderDetail, index) => {
const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( const groupedTokens = orderDetail?.productDetails
(acc, item, idx) => { ?.filter((data) => data?.EditTokenAvailable !== 'N')
?.reduce((acc, item, idx) => {
if (item.TokenAvailable === 'Y') { if (item.TokenAvailable === 'Y') {
if (!item.CounterName) { if (!item.CounterName) {
// If CounterName is null or empty // If CounterName is null or empty
@ -3045,9 +3041,7 @@ const StandardTablePayment = () => {
} }
} }
return acc; return acc;
}, }, {});
{}
);
// Iterate over grouped tokens and print them // Iterate over grouped tokens and print them
const tokensToPrint = Object.entries(groupedTokens).map( const tokensToPrint = Object.entries(groupedTokens).map(
@ -3067,11 +3061,11 @@ const StandardTablePayment = () => {
); );
} else { } else {
await Promise.all( await Promise.all(
PrintOrderDetails?.[0]?.OrderDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.map( PrintOrderDetails?.[0]?.OrderDetails?.filter(
async (orderDetail, index) => { (data) => data?.EditTokenAvailable !== 'N'
)?.map(async (orderDetail, index) => {
await TokenPrint(`${index}-${orderDetail?.OrderId}`); await TokenPrint(`${index}-${orderDetail?.OrderId}`);
} })
)
); );
setPrintOrderDetails([]); setPrintOrderDetails([]);
closePrintOption(); closePrintOption();
@ -3395,6 +3389,7 @@ const StandardTablePayment = () => {
} }
return ( return (
<Suspense fallback={<div>Suspense Loading...</div>}>
<div className="booking-table-footer" style={{ padding: '0' }}> <div className="booking-table-footer" style={{ padding: '0' }}>
<Messages <Messages
messageType={messageType} messageType={messageType}
@ -3461,9 +3456,11 @@ const StandardTablePayment = () => {
<div>Total :</div> <div>Total :</div>
<p> <p>
{safeRound(credit && overAllBal >= 0 {safeRound(
credit && overAllBal >= 0
? Math.max(0, TotalAmount - overAllBal) ? Math.max(0, TotalAmount - overAllBal)
: TotalAmount)} : TotalAmount
)}
</p> </p>
</div> </div>
</div> </div>
@ -3527,7 +3524,6 @@ const StandardTablePayment = () => {
{/* Customer Orders */} {/* Customer Orders */}
{GetCustId && ( {GetCustId && (
<Tooltip title="Customer Orders" isMobile={isMobile}> <Tooltip title="Customer Orders" isMobile={isMobile}>
{' '} {' '}
<div <div
@ -3568,7 +3564,10 @@ const StandardTablePayment = () => {
.map((filteredItem) => ( .map((filteredItem) => (
<React.Fragment key={filteredItem.TemplateOptionsId}> <React.Fragment key={filteredItem.TemplateOptionsId}>
{!OtherServicesglobal && ( {!OtherServicesglobal && (
<TooltipWrapper title="Unpaid Bills" isMobile={isMobile}> <TooltipWrapper
title="Unpaid Bills"
isMobile={isMobile}
>
{' '} {' '}
<PozoUnpaidIcon <PozoUnpaidIcon
className="BSBillingNav-icon-table-icon" className="BSBillingNav-icon-table-icon"
@ -3660,7 +3659,11 @@ const StandardTablePayment = () => {
!unpaidFlow && !unpaidFlow &&
SelectedTableDetails?.length !== 0 && ( SelectedTableDetails?.length !== 0 && (
<div <div
style={{ width: '4rem', display: 'flex', alignItems: 'center' }} style={{
width: '4rem',
display: 'flex',
alignItems: 'center',
}}
> >
<Tooltip title="ORDER" isMobile={isMobile}> <Tooltip title="ORDER" isMobile={isMobile}>
{' '} {' '}
@ -3702,7 +3705,8 @@ const StandardTablePayment = () => {
opacity: isDisabled ? 0.5 : 1, opacity: isDisabled ? 0.5 : 1,
}} }}
> >
{payBtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( {payBtns?.length > 0 &&
currentOrderNetAmount >= previousNetAmount ? (
payBtns.map((payment) => { payBtns.map((payment) => {
const mode = payment?.ModeName?.toLowerCase(); const mode = payment?.ModeName?.toLowerCase();
const isSelected = paybtnselected === payment?.ModeId; const isSelected = paybtnselected === payment?.ModeId;
@ -3714,7 +3718,8 @@ const StandardTablePayment = () => {
mode === 'upi' mode === 'upi'
? () => ? () =>
handleUPIButtonClick(payment?.ModeId, payment?.ModeName) handleUPIButtonClick(payment?.ModeId, payment?.ModeName)
: () => handlePaymentMode(payment?.ModeId, payment?.ModeName); : () =>
handlePaymentMode(payment?.ModeId, payment?.ModeName);
return ( return (
<div className="standard-pay-btns" key={payment?.ModeId}> <div className="standard-pay-btns" key={payment?.ModeId}>
@ -3792,7 +3797,9 @@ const StandardTablePayment = () => {
</div> </div>
); );
}) })
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( ) : currentOrderNetAmount < previousNetAmount &&
salesBillEdit &&
refundPayBtns.length > 0 ? (
refundPayBtns.map((payment) => { refundPayBtns.map((payment) => {
const mode = payment?.ConfigName?.toLowerCase(); const mode = payment?.ConfigName?.toLowerCase();
const isSelected = refundPaySelected === payment?.ConfigId; const isSelected = refundPaySelected === payment?.ConfigId;
@ -3818,7 +3825,12 @@ const StandardTablePayment = () => {
? 'blink-animation 0.5s infinite alternate' ? 'blink-animation 0.5s infinite alternate'
: 'none', : 'none',
}} }}
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)} onClick={() =>
handleRefundPaymentMode(
payment?.ConfigId,
payment?.ConfigName
)
}
> >
<div <div
style={{ style={{
@ -3862,15 +3874,22 @@ const StandardTablePayment = () => {
orderCardDetail?.length > 0 && orderCardDetail?.length > 0 &&
paybtnselected && paybtnselected &&
CheckBookingStatus !== 'Close' CheckBookingStatus !== 'Close'
? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? ? !OrderStatus
'standard-pay-btn-refund' ? salesBillEdit && currentOrderNetAmount < previousNetAmount
? 'standard-pay-btn-refund'
: 'standard-pay-btn' : 'standard-pay-btn'
: 'standard-pay-btn order-complete' : 'standard-pay-btn order-complete'
: 'standard-pay-btn-disabled' : 'standard-pay-btn-disabled'
} }
onClick={handleButtonClick} onClick={handleButtonClick}
> >
{!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? <p>Refund: {(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</p> : ( {!OrderStatus ? (
salesBillEdit && currentOrderNetAmount < previousNetAmount ? (
<p>
Refund:
{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
</p>
) : (
<> <>
<p <p
className="standard-pay-amount" className="standard-pay-amount"
@ -3906,6 +3925,7 @@ const StandardTablePayment = () => {
<BiRightArrowAlt size={25} /> <BiRightArrowAlt size={25} />
</div> </div>
</> </>
)
) : ( ) : (
<div className="standard-pay-order-label">ORDER</div> <div className="standard-pay-order-label">ORDER</div>
)} )}
@ -3939,9 +3959,10 @@ const StandardTablePayment = () => {
children={ children={
<> <>
<div> <div>
You have already selected a table. If you click 'OK,' the table You have already selected a table. If you click 'OK,' the
selection will be removed, and the unpaid flow will continue. If table selection will be removed, and the unpaid flow will
you click 'Cancel,' the dine-in flow will proceed as selected. continue. If you click 'Cancel,' the dine-in flow will proceed
as selected.
</div> </div>
</> </>
} }
@ -4200,6 +4221,7 @@ const StandardTablePayment = () => {
// )) // ))
} }
</div> </div>
</Suspense>
); );
}; };

View File

@ -524,36 +524,6 @@ function BSCategoryHorizontal(props) {
await dispatch(changeProductSubCategorieProdCatfun()); await dispatch(changeProductSubCategorieProdCatfun());
} }
}; };
// const handleClick = async (e, ProdCat, index) => {
// let data1 = {
// compId: CompId,
// branchId: BranchId,
// appId: AppId,
// prodCat: ProdCat,
// };
// let data = false;
// setaccessToCard(false);
// await dispatch(changeCombosearch(false));
// dispatch(ChangeisFavClicked(false));
// setAccessOther(false);
// setIsModalOpen(false);
// setIndexVal(index);
// await dispatch(changeProductCategorie(ProdCat));
// // await dispatch(changeProductSubCategorie(ProdCat));
// await dispatch(changeAccessForOthers(data));
// await dispatch(ChangeFocusCatCard(!FocusStatus));
// let tempSubCat = templateData?.BookingLayout?.[1]?.filter(
// (a, b) => a?.OptionName === 'SubCategory'
// );
// if (tempSubCat.length === 0) {
// await dispatch(changeProductSubCategorieProdCatfun());
// }
// if (templateData?.BookingLayout?.[0] === 'Layout2') {
// setSubCat(true);
// }
// };
useEffect(() => { useEffect(() => {
if (productCardTrigger && FavSelected) { if (productCardTrigger && FavSelected) {
@ -584,27 +554,15 @@ function BSCategoryHorizontal(props) {
} }
: {}), : {}),
}; };
await dispatch(getSelectedFavItems(data1));
// await dispatch(getSelectedFavItems(data1));
await dispatch(ChangeFocusCatCard(!FocusStatus)); await dispatch(ChangeFocusCatCard(!FocusStatus));
}; };
const handleClickOtherItems = async () => { const handleClickOtherItems = async () => {
dispatch(ChangedraggingComponent(null)); dispatch(ChangedraggingComponent(null));
dispatch(Changedragging(false)); dispatch(Changedragging(false));
let data = false;
setIndexVal(Infinity); setIndexVal(Infinity);
// setaccessToCard(true);
// dispatch(ChangeisFavClicked(true));
// setAccessOther(false);
setIsModalOpen(true); setIsModalOpen(true);
// // await dispatch(ChangeSubcategoryData(null));
// await dispatch(changeAccessForOthers(data));
// let data1 = {
// CompId: CompId,
// BranchId: BranchId,
// AppId: AppId,
// };
// await dispatch(getSelectedFavItems(data1));
// await dispatch(ChangeFocusCatCard(!FocusStatus));
}; };
const handleClick2 = async () => { const handleClick2 = async () => {
@ -690,8 +648,10 @@ function BSCategoryHorizontal(props) {
}; };
useEffect(() => { useEffect(() => {
if (isModalOpen) {
holdnamedrop(); holdnamedrop();
}, [AppId, CompId, BranchId]); }
}, [isModalOpen]);
const holdnamedrop = async () => { const holdnamedrop = async () => {
let data = { let data = {
@ -896,16 +856,16 @@ function BSCategoryHorizontal(props) {
formRef?.current?.resetFields(); formRef?.current?.resetFields();
resetForm(); resetForm();
let data = { // let data = {
CompId: CompId, // CompId: CompId,
BranchId: BranchId, // BranchId: BranchId,
AppId: AppId, // AppId: AppId,
ProdType: 'O', // ProdType: 'O',
}; // };
const respons = await dispatch(othernamedrop(data)).unwrap(); // const respons = await dispatch(othernamedrop(data)).unwrap();
if (respons?.data?.statusCode == 1) { // if (respons?.data?.statusCode == 1) {
setTabledropname(respons?.data?.data); // setTabledropname(respons?.data?.data);
} // }
}; };
const handleValuesChange = (values) => { const handleValuesChange = (values) => {
@ -1702,7 +1662,7 @@ function BSCategoryHorizontal(props) {
}))} }))}
className="field-DropDown" className="field-DropDown"
// placeholder="ConfigType" // placeholder="ConfigType"
label={<label class="required">Tax</label>} label={<label className="required">Tax</label>}
// optionsNames={{ value: "TaxPercentage", label: "TaxIdName" }} // optionsNames={{ value: "TaxPercentage", label: "TaxIdName" }}
onChangeFunction={(selectedValue) => onChangeFunction={(selectedValue) =>
onChangeFunction(selectedValue) onChangeFunction(selectedValue)
@ -1773,7 +1733,7 @@ function BSCategoryHorizontal(props) {
// }} // }}
className="size-input" className="size-input"
label={ label={
<label class="required">No.of.Units :</label> <label className="required">No.of.Units :</label>
} }
autocomplete="off" autocomplete="off"
onChange={(e) => onChange={(e) =>
@ -1885,7 +1845,7 @@ function BSCategoryHorizontal(props) {
]} ]}
> >
<InputField <InputField
label={<label class="required">Quantity</label>} label={<label className="required">Quantity</label>}
valueData={defaultQuantity} valueData={defaultQuantity}
autocomplete="off" autocomplete="off"
onChange={(e) => onChange={(e) =>
@ -1953,7 +1913,9 @@ function BSCategoryHorizontal(props) {
> >
<InputField <InputField
label={ label={
<label class="required">Amount / Per Item</label> <label className="required">
Amount / Per Item
</label>
} }
autocomplete="off" autocomplete="off"
onChange={(e) => onChange={(e) =>

View File

@ -510,8 +510,10 @@ function BSCategoryVertical(props) {
}; };
useEffect(() => { useEffect(() => {
if (isModalOpen) {
holdnamedrop(); holdnamedrop();
}, [AppId, CompId, BranchId]); }
}, [isModalOpen]);
const holdnamedrop = async () => { const holdnamedrop = async () => {
let data = { let data = {
@ -708,16 +710,16 @@ function BSCategoryVertical(props) {
formRef?.current?.resetFields(); formRef?.current?.resetFields();
resetForm(); resetForm();
let data = { // let data = {
CompId: CompId, // CompId: CompId,
BranchId: BranchId, // BranchId: BranchId,
AppId: AppId, // AppId: AppId,
ProdType: 'O', // ProdType: 'O',
}; // };
const respons = await dispatch(othernamedrop(data)).unwrap(); // const respons = await dispatch(othernamedrop(data)).unwrap();
if (respons?.data?.statusCode == 1) { // if (respons?.data?.statusCode == 1) {
setTabledropname(respons?.data?.data); // setTabledropname(respons?.data?.data);
} // }
}; };
const handleValuesChange = (values) => { const handleValuesChange = (values) => {
@ -1422,7 +1424,7 @@ function BSCategoryVertical(props) {
<p <p
style={{ style={{
textTransform: Uppercase, textTransform: Uppercase,
fontWeight: '600', fontWeight: '500',
// paddingTop: !item.SmallIcon && "4px", // paddingTop: !item.SmallIcon && "4px",
fontFamily: SelectedFontFamily ? SelectedFontFamily : '', fontFamily: SelectedFontFamily ? SelectedFontFamily : '',
color: SelectedCatgColor color: SelectedCatgColor

View File

@ -62,7 +62,10 @@ import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
import { BsSortAlphaDown } from 'react-icons/bs'; import { BsSortAlphaDown } from 'react-icons/bs';
import { BsSortAlphaDownAlt } from 'react-icons/bs'; import { BsSortAlphaDownAlt } from 'react-icons/bs';
import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin.js'; import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin.js';
import {changeothersdatas, OtherServicesCardlistdata} from '../../../../Features/OtherServices/OtherServices.js'; import {
changeothersdatas,
OtherServicesCardlistdata,
} from '../../../../Features/OtherServices/OtherServices.js';
function BSOtherServicesHorizontalcat(props) { function BSOtherServicesHorizontalcat(props) {
const formRef = useRef(null); const formRef = useRef(null);
@ -93,7 +96,6 @@ function BSOtherServicesHorizontalcat(props) {
const draggingComponent = useSelector(GlobaldraggingComponent); const draggingComponent = useSelector(GlobaldraggingComponent);
const alphabeticFormat = useSelector(GlobalisAlphabeticFormat); const alphabeticFormat = useSelector(GlobalisAlphabeticFormat);
const [isDragging, setIsDragging] = useState(false); const [isDragging, setIsDragging] = useState(false);
const [startX, setStartX] = useState(null); const [startX, setStartX] = useState(null);
const [accessToCard, setaccessToCard] = useState(false); const [accessToCard, setaccessToCard] = useState(false);
@ -375,14 +377,19 @@ function BSOtherServicesHorizontalcat(props) {
}; };
const handleClick = async (e, ProdCat, index) => { const handleClick = async (e, ProdCat, index) => {
let Filterdata1 = ComboCardata?.filter(
(item) => item?.ServiceCategory === ProdCat
);
let Filterdata2 = ComboCardata?.filter(
(item) => item?.ServiceCategory === ProdCat
);
let Filterdata1 = ComboCardata?.filter((item) => item?.ServiceCategory === ProdCat) let Filterdata = ComboCardata?.filter(
let Filterdata2 = ComboCardata?.filter((item) => item?.ServiceCategory === ProdCat) (item) => item?.ServiceCategory === ProdCat
)?.[0]?.ServiceDetails;
let Filterdatas = ComboCardata?.filter(
let Filterdata = ComboCardata?.filter((item) => item?.ServiceCategory === ProdCat)?.[0]?.ServiceDetails; (item) => item?.ServiceCategory === ProdCat
let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdCat)?.[0]?.ServiceDetails; )?.[0]?.ServiceDetails;
let data1 = { let data1 = {
compId: CompId, compId: CompId,
@ -430,7 +437,6 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
}; };
const handleClick2 = async () => { const handleClick2 = async () => {
getTaxname(); getTaxname();
getUom(); getUom();
setIndexVal(-1); setIndexVal(-1);
@ -511,8 +517,10 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
}; };
useEffect(() => { useEffect(() => {
if (isModalOpen) {
holdnamedrop(); holdnamedrop();
}, [AppId, CompId, BranchId]); }
}, [isModalOpen]);
const holdnamedrop = async () => { const holdnamedrop = async () => {
let data = { let data = {
@ -526,12 +534,6 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
const response = await dispatch(getUomData()).unwrap(); const response = await dispatch(getUomData()).unwrap();
// setTableuomname(response?.data?.data);
// let UomId = response?.data?.data?.filter(
// (item) => item.ConfigName?.toLowerCase() === 'pcs'
// )?.[0]?.['ConfigId'];
// formRef.current?.setFieldsValue({ UOM: UomId });
// setselectedUom(UomId);
const UomTypePreference = ApplicationPreferenceData?.find( const UomTypePreference = ApplicationPreferenceData?.find(
(preference) => preference?.PreferredCatName === 'Product Uom' (preference) => preference?.PreferredCatName === 'Product Uom'
@ -719,16 +721,6 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
formRef?.current?.resetFields(); formRef?.current?.resetFields();
resetForm(); resetForm();
let data = {
CompId: CompId,
BranchId: BranchId,
AppId: AppId,
ProdType: 'O',
};
const respons = await dispatch(othernamedrop(data)).unwrap();
if (respons?.data?.statusCode == 1) {
setTabledropname(respons?.data?.data);
}
}; };
const handleValuesChange = (values) => { const handleValuesChange = (values) => {
@ -873,7 +865,6 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
} else if (categoryData?.length > 0) { } else if (categoryData?.length > 0) {
setIndexVal(0); setIndexVal(0);
} }
}, [searchData, categoryData]); }, [searchData, categoryData]);
useEffect(() => { useEffect(() => {
@ -893,14 +884,13 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
let Data = response?.data?.data; let Data = response?.data?.data;
setCombocardata(Data?.ServiceCategories); setCombocardata(Data?.ServiceCategories);
} }
}; };
return ( return (
<> <>
<div
<div className="CategoryHorizontal bs1" className="CategoryHorizontal bs1"
ref={containerRef} ref={containerRef}
style={{ maxWidth: '100%' }} style={{ maxWidth: '100%' }}
> >
@ -1026,7 +1016,7 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
option, option,
selectedTaxPercentage === option.TaxId selectedTaxPercentage === option.TaxId
), ),
// label: option.TaxIdName + ' - ' + option.TaxPercentage + ' % ', // label: option.NameTaxIdName + ' - ' + option.TaxPercentage + ' % ',
}))} }))}
className="field-DropDown" className="field-DropDown"
// placeholder="ConfigType" // placeholder="ConfigType"
@ -1099,13 +1089,11 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
} }
// inputMode="numeric" // inputMode="numeric"
// onInput={(e) => { // onInput={(e) => {
// e.target.value = e.target.value.replace(/\D/g, ""); // e.target.Namevalue = e.target.value.replace(/\D/g, "");
// }} // }}
className="size-input" className="size-input"
label={ label={
<label class="required"> <label class="required">No.of.Units :</label>
No.of.Units :
</label>
} }
autocomplete="off" autocomplete="off"
onChange={(e) => onChange={(e) =>
@ -1148,31 +1136,6 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
</Form.Item> </Form.Item>
</div> </div>
</div> </div>
{/* <Form.Item
name="UOM"
rules={[
{
required: true,
message: "Please Select UOM",
},
]}
>
<DropDowns
options={Tableuomname?.map((option) => ({
value: option.ConfigId,
label: option.ConfigName,
}))}
placeholder="ConfigType"
label={<label class="required">UOM</label>}
optionsNames={{ value: "TypeId", label: "TypeName" }}
className="field-DropDown"
onChangeFunction={(selectedValues) =>
onChangeuomFunction(selectedValues)
}
valueData={selectedUom}
disabled={add || !EditState ? false : true}
/>
</Form.Item> */}
<div <div
className="quantity-amt" className="quantity-amt"
style={{ style={{
@ -1569,7 +1532,9 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
minWidth: 'max-content', // set a width if needed minWidth: 'max-content', // set a width if needed
}} }}
className="sampleCard" className="sampleCard"
onClick={(e) => handleClick(e, item.ServiceCategory, index)} onClick={(e) =>
handleClick(e, item.ServiceCategory, index)
}
> >
<div <div
style={{ flexDirection: Reverse1 }} style={{ flexDirection: Reverse1 }}
@ -1703,9 +1668,7 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
</div> </div>
)} )}
</div> </div>
</div> </div>
</> </>
); );
} }

View File

@ -58,7 +58,10 @@ import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
import { BsSortAlphaDown } from 'react-icons/bs'; import { BsSortAlphaDown } from 'react-icons/bs';
import { BsSortAlphaDownAlt } from 'react-icons/bs'; import { BsSortAlphaDownAlt } from 'react-icons/bs';
import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin.js'; import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin.js';
import { changeothersdatas, OtherServicesCardlistdata } from '../../../../Features/OtherServices/OtherServices.js'; import {
changeothersdatas,
OtherServicesCardlistdata,
} from '../../../../Features/OtherServices/OtherServices.js';
function BSOtherServicesVerticalcat(props) { function BSOtherServicesVerticalcat(props) {
const formRef = useRef(null); const formRef = useRef(null);
@ -105,7 +108,7 @@ function BSOtherServicesVerticalcat(props) {
const [add, setAdd] = useState(false); const [add, setAdd] = useState(false);
const [defaultQuantity, setdefaultQuantity] = useState(1); const [defaultQuantity, setdefaultQuantity] = useState(1);
const [isSortClicked, setIsSortClicked] = useState(false); const [isSortClicked, setIsSortClicked] = useState(false);
const [otherServiceCategoryData,setOtherServiceCategoryData] = useState([]) const [otherServiceCategoryData, setOtherServiceCategoryData] = useState([]);
const AppId = SessionData?.AppId; const AppId = SessionData?.AppId;
const CompId = SessionData?.CompId; const CompId = SessionData?.CompId;
const BranchId = SessionData?.BranchId; const BranchId = SessionData?.BranchId;
@ -147,7 +150,7 @@ function BSOtherServicesVerticalcat(props) {
); );
} }
}; };
OtherServicesCategoryList() OtherServicesCategoryList();
const container = scrollContainerRef?.current; const container = scrollContainerRef?.current;
if (container) { if (container) {
container.addEventListener('scroll', handleScroll); container.addEventListener('scroll', handleScroll);
@ -299,7 +302,9 @@ function BSOtherServicesVerticalcat(props) {
}; };
const handleClick = async (e, ProdCat, index) => { const handleClick = async (e, ProdCat, index) => {
const selectedOtherServiceCategory = otherServiceCategoryData?.filter(({ServiceCategory}) => ServiceCategory === ProdCat) const selectedOtherServiceCategory = otherServiceCategoryData?.filter(
({ ServiceCategory }) => ServiceCategory === ProdCat
);
let data = false; let data = false;
setaccessToCard(false); setaccessToCard(false);
setAccessOther(false); setAccessOther(false);
@ -416,8 +421,10 @@ function BSOtherServicesVerticalcat(props) {
}; };
useEffect(() => { useEffect(() => {
if (isModalOpen) {
holdnamedrop(); holdnamedrop();
}, [AppId, CompId, BranchId]); }
}, [isModalOpen]);
const holdnamedrop = async () => { const holdnamedrop = async () => {
let data = { let data = {
@ -614,16 +621,16 @@ function BSOtherServicesVerticalcat(props) {
formRef?.current?.resetFields(); formRef?.current?.resetFields();
resetForm(); resetForm();
let data = { // let data = {
CompId: CompId, // CompId: CompId,
BranchId: BranchId, // BranchId: BranchId,
AppId: AppId, // AppId: AppId,
ProdType: 'O', // ProdType: 'O',
}; // };
const respons = await dispatch(othernamedrop(data)).unwrap(); // const respons = await dispatch(othernamedrop(data)).unwrap();
if (respons?.data?.statusCode == 1) { // if (respons?.data?.statusCode == 1) {
setTabledropname(respons?.data?.data); // setTabledropname(respons?.data?.data);
} // }
}; };
const handleValuesChange = (values) => { const handleValuesChange = (values) => {
@ -791,16 +798,17 @@ function BSOtherServicesVerticalcat(props) {
} else if (categoryData?.length > 0) { } else if (categoryData?.length > 0) {
setIndexVal(0); setIndexVal(0);
} }
}, [searchData, categoryData]); }, [searchData, categoryData]);
const OtherServicesCategoryList = async () => { const OtherServicesCategoryList = async () => {
let response = await dispatch(OtherServicesCardlistdata({CompId,BranchId,AppId})).unwrap(); let response = await dispatch(
OtherServicesCardlistdata({ CompId, BranchId, AppId })
).unwrap();
if (response?.data?.statusCode === 1) { if (response?.data?.statusCode === 1) {
setOtherServiceCategoryData(response?.data?.data?.ServiceCategories); setOtherServiceCategoryData(response?.data?.data?.ServiceCategories);
} else { } else {
setMessageType("error") setMessageType('error');
setMessageData(response?.data?.response) setMessageData(response?.data?.response);
} }
}; };
@ -919,7 +927,7 @@ function BSOtherServicesVerticalcat(props) {
), ),
// label: // label:
// option.TaxIdName + // option.TaxIdName +
// " - " + // " - " +Name
// option.TaxPercentage + // option.TaxPercentage +
// " % ", // " % ",
}))} }))}
@ -951,7 +959,7 @@ function BSOtherServicesVerticalcat(props) {
); );
} }
return Promise.resolve(); return Promise.Nameresolve();
}, },
}, },
]} ]}
@ -1099,6 +1107,7 @@ function BSOtherServicesVerticalcat(props) {
return Promise.resolve(); return Promise.resolve();
}, },
Name,
}, },
]} ]}
> >
@ -1210,50 +1219,6 @@ function BSOtherServicesVerticalcat(props) {
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto', pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
}} }}
> >
{/* {globalAllItemdata?.length > 0 && (
<div
style={{
borderRadius: Radius,
backgroundColor:
!accessOther && accessToCard
? lightenColor(SelectedCatgColor?.['BackgroundColor'], 0.4)
: SelectedCatgColor?.['BackgroundColor'],
padding: padding,
border: accessToCard && '1px solid',
borderColor:
accessToCard &&
!accessOther &&
SelectedCatgColor?.['BackgroundColor'] == '#ffffff'
? '#000000'
: SelectedCatgColor?.['BackgroundColor'] === '#000000'
? '#ffffff'
: darkenColor(SelectedCatgColor?.['BackgroundColor'], 70),
}}
// key={}
className="sampleCard"
index={indexval}
onClick={() => handleClick1()}
>
<div
style={{ flexDirection: Reverse1 }}
className="CategoryHorizontal-sub-samplecard"
>
{categoryFunction?.Image && <img src={catLogo} alt="" />}
<p
style={{
textTransform: Uppercase,
fontWeight: '600',
fontFamily: SelectedFontFamily ? SelectedFontFamily : '',
color: SelectedCatgColor
? SelectedCatgColor?.['FontColor']
: '',
}}
>
Favourites
</p>
</div>
</div>
)} */}
{(!Isdragging || draggingComponent !== 'category') && {(!Isdragging || draggingComponent !== 'category') &&
otherServiceCategoryData?.map((item, index) => ( otherServiceCategoryData?.map((item, index) => (
@ -1418,90 +1383,6 @@ function BSOtherServicesVerticalcat(props) {
</DragDropContext> </DragDropContext>
)} )}
{/* {globalAllItemdata?.length === 0 && (
<div
style={{
borderRadius: Radius,
backgroundColor:
!accessOther && accessToCard
? lightenColor(SelectedCatgColor?.['BackgroundColor'], 0.4)
: SelectedCatgColor?.['BackgroundColor'],
padding: padding,
border: accessToCard && '1px solid',
borderColor:
accessToCard &&
!accessOther &&
SelectedCatgColor?.['BackgroundColor'] == '#ffffff'
? '#000000'
: SelectedCatgColor?.['BackgroundColor'] === '#000000'
? '#ffffff'
: SelectedCatgColor?.['BackgroundColor'],
}}
// key={}
className="sampleCard"
index={indexval}
onClick={() => handleClick1()}
>
<div
style={{ flexDirection: Reverse1 }}
className="CategoryHorizontal-sub-samplecard"
>
{categoryFunction?.Image && <img src={catLogo} alt="" />}
<p
style={{
textTransform: Uppercase,
fontWeight: '600',
fontFamily: SelectedFontFamily ? SelectedFontFamily : '',
color: SelectedCatgColor
? SelectedCatgColor?.['FontColor']
: '',
}}
>
Favourites
</p>
</div>
</div>
)} */}
{/* <div
style={{
borderRadius: Radius,
backgroundColor: accessOther
? lightenColor(SelectedCatgColor?.['BackgroundColor'], 0.4)
: SelectedCatgColor?.['BackgroundColor'],
padding: padding,
border: accessOther && '1px solid',
borderColor:
accessOther && SelectedCatgColor?.['BackgroundColor'] == '#ffffff'
? '#000000'
: SelectedCatgColor?.['BackgroundColor'] === '#000000'
? '#ffffff'
: SelectedCatgColor?.['BackgroundColor'],
}}
// key={}
className="sampleCard"
index={indexval}
onClick={() => handleClick2()}
>
<div
style={{ flexDirection: Reverse1 }}
className="CategoryHorizontal-sub-samplecard"
>
{categoryFunction?.Image && <img src={horizontal} alt="" />}
<p
style={{
textTransform: Uppercase,
fontWeight: '600',
fontFamily: SelectedFontFamily ? SelectedFontFamily : '',
color: SelectedCatgColor
? SelectedCatgColor?.['FontColor']
: '',
}}
>
Others
</p>
</div>
</div> */}
</div> </div>
</div> </div>
); );

View File

@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from 'react'; import React, { lazy, Suspense, useEffect, useRef, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { TiLocation } from 'react-icons/ti'; import { TiLocation } from 'react-icons/ti';
@ -24,30 +24,31 @@ import BSPrinterSetting from '../UtillComponents/BSPrinterSetting.jsx';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import { FaDisplay } from 'react-icons/fa6'; import { FaDisplay } from 'react-icons/fa6';
import { import {
FeatureAddon,
GlobalFeatAddOnData, GlobalFeatAddOnData,
PreferenceData, PreferenceData,
} from '../../../../Features/BookingScreen/BookingData/BookingData.js'; } from '../../../../Features/BookingScreen/BookingData/BookingData.js';
import { import { setCustomerDisplayWindow } from '../../../../Features/customerDisplayWindow/customerDisplayWindow';
setCustomerDisplayWindow,
closeCustomerDisplayWindow,
} from '../../../../Features/customerDisplayWindow/customerDisplayWindow';
import TooltipWrapper from '../../../../Components/Tooltip/Tooltip'; import TooltipWrapper from '../../../../Components/Tooltip/Tooltip';
import { import { userDataByUserId } from '../../../../Features/UserAccount/userData.js';
getUserProfile,
userDataByUserId,
} from '../../../../Features/UserAccount/userData.js';
import UserRelieveManager from '../../Template/RealivingUser.jsx';
import BSNavBarUserInfo from '../BSNavbar/BSNavBarUserInfo.jsx';
import BSScanTemplate from '../UtillComponents/BSScanTemplate.jsx';
import { RiFullscreenExitFill, RiFullscreenFill } from 'react-icons/ri'; import { RiFullscreenExitFill, RiFullscreenFill } from 'react-icons/ri';
import { Popconfirm, Tooltip } from 'antd'; import { Popconfirm, Tooltip } from 'antd';
import { FaCaretDown } from 'react-icons/fa'; import { FaCaretDown } from 'react-icons/fa';
const UserRelieveManager = lazy(
() => import('../../Template/RealivingUser.jsx')
);
const BSNavBarUserInfo = lazy(() => import('../BSNavbar/BSNavBarUserInfo.jsx'));
const BSScanTemplate = lazy(
() => import('../UtillComponents/BSScanTemplate.jsx')
);
const BSPrinterSetting = lazy(
() => import('../UtillComponents/BSPrinterSetting.jsx')
);
const subDirectory = import.meta.env.ENV_BASE_URL; const subDirectory = import.meta.env.ENV_BASE_URL;
const commonUrl = import.meta.env.ENV_COMMON_BASE_URL; const commonUrl = import.meta.env.ENV_COMMON_BASE_URL;
const BSC1NavBar = (props) => { const BSC1NavBar = (props) => {
const BSComboData = props?.hasOwnProperty('data') ? props['data'] : null;
const divRef = useRef(null); const divRef = useRef(null);
const navigate = useNavigate(); const navigate = useNavigate();
@ -109,16 +110,7 @@ const BSC1NavBar = (props) => {
).unwrap(); ).unwrap();
} }
}; };
// const getFeatureAddonData = async () => {
// let featureAddon = await dispatch(
// FeatureAddon({ AppId: AppId, UserId: UserId })
// ).unwrap();
// if (featureAddon?.data?.statusCode === 1) {
// setFeatureAddonData(featureAddon?.data?.data?.[0]?.FeatAddonHdr?.[0]);
// } else {
// setFeatureAddonData([]);
// }
// };
const UserAcc = () => { const UserAcc = () => {
setAccIsOpen(!isAccOpen); setAccIsOpen(!isAccOpen);
}; };
@ -197,25 +189,6 @@ const BSC1NavBar = (props) => {
console.error('Customer display window failed to open.'); console.error('Customer display window failed to open.');
} }
}; };
// const openNewTab = async () => {
// const initialData = {
// Paymentgateway: false,
// };
// const customerDisplayWindow = window.open(`${subDirectory}customer-display`, 'CustomerDisplayWindow', 'width=2000,height=5000,scrollbars=yes,resizable=yes');
// if (customerDisplayWindow && !customerDisplayWindow.closed) {
// setCustomerDisplayWindow(customerDisplayWindow);
// customerDisplayWindow.onload = () => {
// setTimeout(() => {
// customerDisplayWindow.postMessage(initialData, '*'); // Or use targetOrigin for CORS
// }, 500); // Slight delay to ensure window is ready
// };
// } else {
// console.error("Customer display window failed to open.");
// }
// };
const handleEditProfile = async () => { const handleEditProfile = async () => {
navigate(`${subDirectory}app-page/redirect-userprofile`); navigate(`${subDirectory}app-page/redirect-userprofile`);
}; };
@ -240,6 +213,7 @@ const BSC1NavBar = (props) => {
}; };
return ( return (
<Suspense fallback={<div>Loading...</div>}>
<> <>
<div <div
className="BSC1NavBar-Container" className="BSC1NavBar-Container"
@ -306,7 +280,9 @@ const BSC1NavBar = (props) => {
<div className="BSC1NavBar-name"> <div className="BSC1NavBar-name">
{/* <PiStorefrontFill className="BSC1NavBar-name-icon" /> */} {/* <PiStorefrontFill className="BSC1NavBar-name-icon" /> */}
<TooltipWrapper placement="bottom" title={branchName}> <TooltipWrapper placement="bottom" title={branchName}>
<span className="BSC1NavBar-ellipsisname">{branchName}</span>{' '} <span className="BSC1NavBar-ellipsisname">
{branchName}
</span>{' '}
</TooltipWrapper> </TooltipWrapper>
{BranchCity && ( {BranchCity && (
<span className="BSC1NavBar-location"> <span className="BSC1NavBar-location">
@ -340,7 +316,9 @@ const BSC1NavBar = (props) => {
<Tooltip title={isFullscreen ? 'Exit Full Screen' : 'Full Screen'}> <Tooltip title={isFullscreen ? 'Exit Full Screen' : 'Full Screen'}>
<div <div
className={ className={
isFullscreen ? 'BsNavbar1FullScreenExit' : 'BsNavbar1FullScreen' isFullscreen
? 'BsNavbar1FullScreenExit'
: 'BsNavbar1FullScreen'
} }
onClick={handleFullscreen} onClick={handleFullscreen}
> >
@ -395,6 +373,7 @@ const BSC1NavBar = (props) => {
</div> </div>
</div> </div>
</> </>
</Suspense>
); );
}; };

View File

@ -1,33 +1,34 @@
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef, lazy, Suspense } from 'react';
import { FaWhatsapp, FaPrint, FaParking } from 'react-icons/fa'; import { FaWhatsapp, FaPrint, FaParking } from 'react-icons/fa';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import moment from 'moment'; import moment from 'moment';
import { Badge, Popover, Modal, Tooltip } from 'antd'; import { Badge, Popover, Modal, Tooltip } from 'antd';
import { AiOutlineClose, AiOutlineArrowRight } from 'react-icons/ai'; import { AiOutlineClose, AiOutlineArrowRight } from 'react-icons/ai';
import { GiBasket } from 'react-icons/gi'; import { UpCircleOutlined } from '@ant-design/icons';
import {
UpCircleOutlined,
UpOutlined,
TransactionOutlined,
} from '@ant-design/icons';
import { import {
printDiv, printDiv,
extractLastNumberOrderId, extractLastNumberOrderId,
encryptObject, encryptObject,
} from '../../../../Services/Others'; } from '../../../../Services/Others';
import PaymentPdfBooking from '../../../paymentpdfPage/PaymentPdfBooking'; const PaymentPdfBooking = lazy(
() => import('../../../paymentpdfPage/PaymentPdfBooking')
);
import { Messages } from '../../../../Components/Notifications/Messages'; import { Messages } from '../../../../Components/Notifications/Messages';
import { MdMoneyOff } from 'react-icons/md';
import paygate from '../../../../Images/paygate.png'; import paygate from '../../../../Images/paygate.png';
import defaultupi from '../../../../Images/defaultupi.png'; import defaultupi from '../../../../Images/defaultupi.png';
import paydevice from '../../../../Images/paydevice.png'; import paydevice from '../../../../Images/paydevice.png';
import paymentFailure from '../../../../Images/payment-failure2.png';
import BSSummery1 from '../BSBillingTables/BSBillingTableSummery/BSSummery';
import { DefaultModal } from '../../../../Components/Modal/DefaultModal.jsx'; import { DefaultModal } from '../../../../Components/Modal/DefaultModal.jsx';
import { Tables } from '../../../../Components/Tables/Table'; import { Tables } from '../../../../Components/Tables/Table';
import QrComponent from '../BookingFunctionality/DynamicQr.jsx'; const BSSummery1 = lazy(
import QrinScreen from '../BookingFunctionality/DynamicScreenQr.jsx'; () => import('../BSBillingTables/BSBillingTableSummery/BSSummery')
);
const QrComponent = lazy(() => import('../BookingFunctionality/DynamicQr.jsx'));
const QrinScreen = lazy(
() => import('../BookingFunctionality/DynamicScreenQr.jsx')
);
import { ArrowRightOutlined } from '@ant-design/icons'; import { ArrowRightOutlined } from '@ant-design/icons';
import Buttons from '../../../../Components/Forms/Buttons'; import Buttons from '../../../../Components/Forms/Buttons';
import WpIcon from '../../../../Images/message.png'; import WpIcon from '../../../../Images/message.png';
@ -51,7 +52,6 @@ import {
GlobalReprintModal, GlobalReprintModal,
changeSelectedTableDetails, changeSelectedTableDetails,
GlobalNavHoldData, GlobalNavHoldData,
getPreferenceData,
changeSelectedCustId, changeSelectedCustId,
GlobalSelCustId, GlobalSelCustId,
changeSelectedOption, changeSelectedOption,
@ -64,8 +64,6 @@ import {
changeCreditFocus, changeCreditFocus,
changeUpiIDprint, changeUpiIDprint,
GlobalSelectedCustDisable, GlobalSelectedCustDisable,
changeSummeryTotalItems,
changeSummeryQty,
changeSummeryTotalWithoutTaxAmount, changeSummeryTotalWithoutTaxAmount,
changeSummeryTotalTaxAmount, changeSummeryTotalTaxAmount,
GlobalEstimateBooking, GlobalEstimateBooking,
@ -80,16 +78,13 @@ import {
changeSelectChair, changeSelectChair,
GlobalOrderType, GlobalOrderType,
changeReorderProductDetails, changeReorderProductDetails,
FeatureAddon,
GlobalCommonPaymentOptions, GlobalCommonPaymentOptions,
PostPaymentdevice, PostPaymentdevice,
changeUpiIDName, changeUpiIDName,
changeUpiIDoptionId, changeUpiIDoptionId,
GetPaymentdeviceResponse, GetPaymentdeviceResponse,
PutBookingPaymentStatusChange, PutBookingPaymentStatusChange,
changeCombosearch,
GlobalCombosearch, GlobalCombosearch,
Comboget,
GlobalPayementloader, GlobalPayementloader,
changePaymentloader, changePaymentloader,
PaymentGatewayGetdetail, PaymentGatewayGetdetail,
@ -108,7 +103,6 @@ import {
ChangeOverAllDiscEstimate, ChangeOverAllDiscEstimate,
GlobalUnpaidListData, GlobalUnpaidListData,
changeUnpaidData, changeUnpaidData,
getAllCustomer,
GlobalBranchFinancialStatus, GlobalBranchFinancialStatus,
changeSummeryComboOfferAmount, changeSummeryComboOfferAmount,
changeTipAmount, changeTipAmount,
@ -116,7 +110,6 @@ import {
GlobalFeatAddOnData, GlobalFeatAddOnData,
GlobalOtherServiceTicketClaim, GlobalOtherServiceTicketClaim,
changeOtherServiceTicketClaim, changeOtherServiceTicketClaim,
GlobalOtherSevices,
changeOtherServices, changeOtherServices,
changeComboRedirectionToDefaultLayoutForParking, changeComboRedirectionToDefaultLayoutForParking,
GlobalRetailWSSalesType, GlobalRetailWSSalesType,
@ -149,7 +142,7 @@ import {
GlobalprintDatas, GlobalprintDatas,
GlobalPrinterMappingDtls, GlobalPrinterMappingDtls,
getPrinterMappingDetails, getPrinterMappingDetails,
getPrintSelectionComponentData, // getPrintSelectionComponentData,
} from '../../../../Features/ThemeChange/ThemeChange'; } from '../../../../Features/ThemeChange/ThemeChange';
import FeaturesFunctionalities from '../BookingFunctionality/FeaturesFunctionalities'; import FeaturesFunctionalities from '../BookingFunctionality/FeaturesFunctionalities';
import { import {
@ -163,7 +156,6 @@ import {
ReprintDetails, ReprintDetails,
triggerCustomerRefresh, triggerCustomerRefresh,
} from '../../../../Features/BookingScreen/Customer/addCustomer'; } from '../../../../Features/BookingScreen/Customer/addCustomer';
import BSCustomerSelect from '../UtillComponents/BSSelectCustomer.jsx';
import PozoHoldIcon from '../UtillComponents/Pozo retail icons/PozoHoldIcon'; import PozoHoldIcon from '../UtillComponents/Pozo retail icons/PozoHoldIcon';
import PozoDineInIcon from '../UtillComponents/Pozo retail icons/PozoDineIn.jsx'; import PozoDineInIcon from '../UtillComponents/Pozo retail icons/PozoDineIn.jsx';
import PozoUnpaidIcon from '../UtillComponents/Pozo retail icons/PozoUnpaidIcon.jsx'; import PozoUnpaidIcon from '../UtillComponents/Pozo retail icons/PozoUnpaidIcon.jsx';
@ -173,16 +165,32 @@ import PozoQuickAddIcon from '../UtillComponents/Pozo retail icons/PozoQuickAddI
import PozoReprintIcon from '../UtillComponents/Pozo retail icons/PozoReprintIcon'; import PozoReprintIcon from '../UtillComponents/Pozo retail icons/PozoReprintIcon';
import PozoExtraChargesIcon from '../UtillComponents/Pozo retail icons/PozoExtraChargesIcon.jsx'; import PozoExtraChargesIcon from '../UtillComponents/Pozo retail icons/PozoExtraChargesIcon.jsx';
import PozoAddCustomerIcon from '../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx'; import PozoAddCustomerIcon from '../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx';
import BsBillingCreditCustomer from '../BookingFunctionality/BSBillingCreditCustomer.jsx'; const BSCustomerSelect = lazy(
() => import('../UtillComponents/BSSelectCustomer.jsx')
);
const BsBillingCreditCustomer = lazy(
() => import('../BookingFunctionality/BSBillingCreditCustomer.jsx')
);
import { TfiMoreAlt } from 'react-icons/tfi'; import { TfiMoreAlt } from 'react-icons/tfi';
import BSCreditCustomer from '../UtillComponents/BSCreditCustomer.jsx'; const BSCreditCustomer = lazy(
() => import('../UtillComponents/BSCreditCustomer.jsx')
);
import PozoAdvanceIcon from '../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx'; import PozoAdvanceIcon from '../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import MobilePrint from '../BookingFunctionality/MobilePrint.jsx'; import MobilePrint from '../BookingFunctionality/MobilePrint.jsx';
import SplitPayment from '../BookingFunctionality/SplitPayment.jsx';
import BSNavBarEstimate from '../UtillComponents/BSNavBarEst.jsx';
import CountUp from 'react-countup'; import CountUp from 'react-countup';
import BSNavBarPreOrder from '../UtillComponents/BSComboNavBarPreOrder.jsx'; const SplitPayment = lazy(
() => import('../BookingFunctionality/SplitPayment.jsx')
);
const BSNavBarEstimate = lazy(
() => import('../UtillComponents/BSNavBarEst.jsx')
);
const BSNavBarPreOrder = lazy(
() => import('../UtillComponents/BSComboNavBarPreOrder.jsx')
);
import { GlobalpreOrderOpen } from '../../../../Features/BookingScreen/PreOrder/PreOrder.js'; import { GlobalpreOrderOpen } from '../../../../Features/BookingScreen/PreOrder/PreOrder.js';
import TokensinglePrint from '../../../paymentpdfPage/TokenOnlyPrints/TokeninsinglePrint.jsx'; import TokensinglePrint from '../../../paymentpdfPage/TokenOnlyPrints/TokeninsinglePrint.jsx';
import SingleTokenMobilePrint from '../BookingFunctionality/SingleTokenMobilePrint.jsx'; import SingleTokenMobilePrint from '../BookingFunctionality/SingleTokenMobilePrint.jsx';
@ -207,38 +215,48 @@ import {
changePreOrderDistrict, changePreOrderDistrict,
changePreOrderState, changePreOrderState,
} from '../../../../Features/BookingScreen/PreOrder/PreOrder.js'; } from '../../../../Features/BookingScreen/PreOrder/PreOrder.js';
import PaymentFailedSales from '../../../Payment/PaymentFailedDetails/PaymentFailedSales.jsx'; const PaymentFailedSales = lazy(
() => import('../../../Payment/PaymentFailedDetails/PaymentFailedSales.jsx')
);
import PozoSplitPaymentIcon from '../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx'; import PozoSplitPaymentIcon from '../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx';
import PozoFailedPaymentsIcon from '../UtillComponents/Pozo retail icons/PozoFailedPaymentsIcon.jsx'; import PozoFailedPaymentsIcon from '../UtillComponents/Pozo retail icons/PozoFailedPaymentsIcon.jsx';
import { import {
Global_CoupenCodeAmount,
Global_loyaltyPointsDiscountAmount,
Global_OrderOfferDetail, Global_OrderOfferDetail,
Global_OverallOfferAmount, Global_OverallOfferAmount,
Global_SalesWiseOfferAmount,
} from '../../../../Features/Offer/Offer.js'; } from '../../../../Features/Offer/Offer.js';
import { useApplyOfferto_CardDetail } from '../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx'; import { useApplyOfferto_CardDetail } from '../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import TooltipWrapper from '../../../../Components/Tooltip/Tooltip'; import TooltipWrapper from '../../../../Components/Tooltip/Tooltip';
import BSNavBarOffer from '../UtillComponents/BSNavBarOffer/BSNavBarOffer.jsx';
import { getEmpAccess } from '../../../../Features/AppPage/CenterPage.js'; import { getEmpAccess } from '../../../../Features/AppPage/CenterPage.js';
import { useAuth } from '../../../../AuthContext.jsx'; import { useAuth } from '../../../../AuthContext.jsx';
import { GlobalBookingStatus } from '../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js'; import { GlobalBookingStatus } from '../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js';
import WhatsAppShare from '../../../WhatsAppShare/whatsAppShare.jsx'; const BSNavBarOffer = lazy(
import CryptoJS from 'crypto-js'; () => import('../UtillComponents/BSNavBarOffer/BSNavBarOffer.jsx')
import SMSShare from '../../../WhatsAppShare/SmsShare.jsx'; );
const WhatsAppShare = lazy(
() => import('../../../WhatsAppShare/whatsAppShare.jsx')
);
const SMSShare = lazy(() => import('../../../WhatsAppShare/SmsShare.jsx'));
import { MdSms } from 'react-icons/md'; import { MdSms } from 'react-icons/md';
import { import {
changeSalesPaymentoption, changeSalesPaymentoption,
GlobalSalesPaymentoption, GlobalSalesPaymentoption,
} from '../../../../Features/Payment/Paymentoptions/Paymentoptions.js'; } from '../../../../Features/Payment/Paymentoptions/Paymentoptions.js';
import Paymentoption from '../../../Payment/PaymentOptions/PaymentOptions.jsx';
import BSTipAmount from '../UtillComponents/BSTipAmount.jsx';
import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin.js'; import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin.js';
import BSOtherServiceClaim from '../UtillComponents/BSOtherServiceClaim.jsx'; const Paymentoption = lazy(
() => import('../../../Payment/PaymentOptions/PaymentOptions.jsx')
);
const BSTipAmount = lazy(() => import('../UtillComponents/BSTipAmount.jsx'));
const BSOtherServiceClaim = lazy(
() => import('../UtillComponents/BSOtherServiceClaim.jsx')
);
const BSMembership = lazy(() => import('../UtillComponents/BSMembership.jsx'));
import { OtherServicesCardlistdata } from '../../../../Features/OtherServices/OtherServices.js'; import { OtherServicesCardlistdata } from '../../../../Features/OtherServices/OtherServices.js';
import { MobilePdfPrint } from '../BookingFunctionality/MobilePdfPrint.js';
import { PublicQrCodepost } from '../../../../Features/ConfigMasterPage/ConfigMasterPage.js'; import { PublicQrCodepost } from '../../../../Features/ConfigMasterPage/ConfigMasterPage.js';
import BSMembership from '../UtillComponents/BSMembership.jsx';
import CardPopover from '../BSBillingTables/StandardTable/Utils/CardPopover.jsx'; import CardPopover from '../BSBillingTables/StandardTable/Utils/CardPopover.jsx';
import UpiPopover from '../BSBillingTables/StandardTable/Utils/UpiPopOver.jsx'; import UpiPopover from '../BSBillingTables/StandardTable/Utils/UpiPopOver.jsx';
import { useDateStore } from '../../../../Features/BookingScreen/BookingData/DateStore.js'; import { useDateStore } from '../../../../Features/BookingScreen/BookingData/DateStore.js';
@ -248,13 +266,12 @@ import {
GlobalOfferAppliedProducts, GlobalOfferAppliedProducts,
GlobalOverAllOfferAmt, GlobalOverAllOfferAmt,
} from '../../../../Features/Offer/Offernew/BookingOffernew.js'; } from '../../../../Features/Offer/Offernew/BookingOffernew.js';
import BSNavBarTable from '../UtillComponents/BSNavBarTable.jsx';
import pozologoimg from '../../../../Images/pozologoimg.png'; import pozologoimg from '../../../../Images/pozologoimg.png';
import PaymentGatewayEmbedded from '../UtillComponents/PaymentGatewayEmbedded.jsx'; const PaymentGatewayEmbedded = lazy(
() => import('../UtillComponents/PaymentGatewayEmbedded.jsx')
);
const subDirectory = import.meta.env.ENV_BASE_URL; const subDirectory = import.meta.env.ENV_BASE_URL;
const MainHomeUrl = import.meta.env.ENV_MAIN_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 currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
@ -275,7 +292,7 @@ const BSC1Payment = (props) => {
); );
const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
const SessionData = useSelector(StoredSessionData); const SessionData = useSelector(StoredSessionData);
const BranchFinancialStatus = useSelector(GlobalBranchFinancialStatus);
const globalTipAmount = useSelector(GlobaltipAmount); const globalTipAmount = useSelector(GlobaltipAmount);
const OtherServiceTicketClaim = useSelector(GlobalOtherServiceTicketClaim); const OtherServiceTicketClaim = useSelector(GlobalOtherServiceTicketClaim);
const RetailWSSalesType = useSelector(GlobalRetailWSSalesType); const RetailWSSalesType = useSelector(GlobalRetailWSSalesType);
@ -285,8 +302,7 @@ const BSC1Payment = (props) => {
const CompId = SessionData?.CompId; const CompId = SessionData?.CompId;
const UserId = SessionData?.UserId; const UserId = SessionData?.UserId;
const UserType = SessionData?.UserType; const UserType = SessionData?.UserType;
const AuthToken = SessionData?.AuthToken;
const SessionMobileNo = SessionData?.SessionMobileNo;
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const printerTemplateStyle = useSelector(SelectedPrintTemplate); const printerTemplateStyle = useSelector(SelectedPrintTemplate);
const SelectedTableDetails = useSelector(GlobalSelectedTableDetails); const SelectedTableDetails = useSelector(GlobalSelectedTableDetails);
@ -327,9 +343,7 @@ const BSC1Payment = (props) => {
const GlobEstBooking = useSelector(GlobalEstimateBooking); const GlobEstBooking = useSelector(GlobalEstimateBooking);
const GlobProdwisedata = useSelector(GlobalSelProdWiseEst); const GlobProdwisedata = useSelector(GlobalSelProdWiseEst);
const preOrder = useSelector(GlobalpreOrderOpen); const preOrder = useSelector(GlobalpreOrderOpen);
const Comboglobal = useSelector(GlobalCombosearch);
const FailedTotalAmt = useSelector(GlobalFailedTotalAmt); const FailedTotalAmt = useSelector(GlobalFailedTotalAmt);
const OrderOfferDetail = useSelector(Global_OrderOfferDetail);
const [SelectedUpiOption, setSelectedUpiOption] = useState(); const [SelectedUpiOption, setSelectedUpiOption] = useState();
const [credit, setCredit] = useState(false); const [credit, setCredit] = useState(false);
const [overAllBal, setOverAllBal] = useState(0); const [overAllBal, setOverAllBal] = useState(0);
@ -359,11 +373,7 @@ const BSC1Payment = (props) => {
preference?.PreferredSubCatName === 'SportsApp' && preference?.PreferredSubCatName === 'SportsApp' &&
preference?.PreferredStatus == 'Y' preference?.PreferredStatus == 'Y'
); );
console.log(
sportsAppPreference,
commonModulePreference,
'sportsAppPreference'
);
const bookingTypePreference = appPreferences?.find( const bookingTypePreference = appPreferences?.find(
(preference) => preference?.PreferredCatName === 'Booking Type' (preference) => preference?.PreferredCatName === 'Booking Type'
)?.PreferenceCatDetails; )?.PreferenceCatDetails;
@ -620,8 +630,10 @@ const BSC1Payment = (props) => {
setDefaultPaymentMode([]); setDefaultPaymentMode([]);
} }
}; };
if (salesBillEdit) {
setDefaultPaymentOption(); setDefaultPaymentOption();
}, [defaultPaymentTrigger]); }
}, [defaultPaymentTrigger, salesBillEdit]);
useEffect(() => { useEffect(() => {
const getPrintData = async () => { const getPrintData = async () => {
@ -846,11 +858,6 @@ const BSC1Payment = (props) => {
); );
dispatch(changeSummeryComboOfferAmount(withComboSum)); dispatch(changeSummeryComboOfferAmount(withComboSum));
// if (withdiscTotal <= 0) {
// dispatch(ChangeOverAllDiscSales(0));
// dispatch(ChangeOverAllDiscEstimate(0));
// }
} else { } else {
setTotalAmount(0); setTotalAmount(0);
dispatch(changeSummeryTotalAmount(0)); dispatch(changeSummeryTotalAmount(0));
@ -873,8 +880,8 @@ const BSC1Payment = (props) => {
UserId: UserId, UserId: UserId,
}; };
dispatch(getPrinterMappingDetails(data)).unwrap(); dispatch(getPrinterMappingDetails(data)).unwrap();
const Data1 = { AppId, CompId, BranchId }; // const Data1 = { AppId, CompId, BranchId };
dispatch(getPrintSelectionComponentData(Data1)).unwrap(); // dispatch(getPrintSelectionComponentData(Data1)).unwrap();
handleOtherData(); handleOtherData();
}, []); }, []);
useEffect(() => { useEffect(() => {
@ -960,28 +967,6 @@ const BSC1Payment = (props) => {
const paymentFailedStatusFun = async () => { const paymentFailedStatusFun = async () => {
SetOpenFailData(!OpenFailData); SetOpenFailData(!OpenFailData);
}; };
// 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 handleOtherData = async () => { const handleOtherData = async () => {
let data = { let data = {
@ -1011,7 +996,7 @@ const BSC1Payment = (props) => {
useEffect(() => { useEffect(() => {
if (CompId && BranchId && AppId) { if (CompId && BranchId && AppId) {
getHolddata(); getHolddata();
getUnpaiddatas(); // getUnpaiddatas();
getCustomerData(); getCustomerData();
} }
}, [CompId, BranchId, AppId]); }, [CompId, BranchId, AppId]);
@ -1134,21 +1119,6 @@ const BSC1Payment = (props) => {
setPaybtnnameselected(PaymentOptionsModeName); setPaybtnnameselected(PaymentOptionsModeName);
setPaybtnselected(PaymentOptionsModeId); setPaybtnselected(PaymentOptionsModeId);
}, [PaymentOptions]); }, [PaymentOptions]);
// 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(() => { useEffect(() => {
if (!PrintOrderDetails?.length) return; if (!PrintOrderDetails?.length) return;
@ -1342,9 +1312,6 @@ const BSC1Payment = (props) => {
setEmpData(datas?.[0]); setEmpData(datas?.[0]);
}; };
const getCustomerData = async () => { const getCustomerData = async () => {
await dispatch(
getAllCustomer({ CompId: CompId, AppId: AppId, branchId: BranchId })
);
await dispatch( await dispatch(
getAddCustomerDetails({ getAddCustomerDetails({
CompId: CompId, CompId: CompId,
@ -2944,8 +2911,6 @@ const BSC1Payment = (props) => {
} }
console.error('Transaction not approved within 1 minute.'); 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; break;
} }
@ -3029,20 +2994,6 @@ const BSC1Payment = (props) => {
clearInterval(intervalId); // Stop the loop when payment fails clearInterval(intervalId); // Stop the loop when payment fails
CustomerDisplayRemovedData(); CustomerDisplayRemovedData();
ClearAllGlobalStateDatas(value); 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) { } catch (error) {
@ -3212,13 +3163,6 @@ const BSC1Payment = (props) => {
} else { } else {
dispatch(changeOrderCardDetails([])); dispatch(changeOrderCardDetails([]));
} }
// 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); setUnpaidConfirmation(true);
setunpaidselectedindex(event); setunpaidselectedindex(event);
} else { } else {
@ -3435,28 +3379,6 @@ const BSC1Payment = (props) => {
); );
} }
}; };
// 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,
// ActiveStatus: 'A',
// };
// let Response = await dispatch(Comboget(data)).unwrap();
// if (Response?.data?.statusCode == 1) {
// setComboDropDown(Response?.data?.data);
// }
// };
const openPreOrder = async () => { const openPreOrder = async () => {
setPreOrderOpen((prevState) => !prevState); setPreOrderOpen((prevState) => !prevState);
if (preOrderOpen) { if (preOrderOpen) {
@ -3555,6 +3477,7 @@ const BSC1Payment = (props) => {
}; };
return ( return (
<Suspense fallback={<div>Loading...</div>}>
<> <>
<div <div
className="BSC1Payment-Container" className="BSC1Payment-Container"
@ -3645,7 +3568,8 @@ const BSC1Payment = (props) => {
BookingType !== 'TakeAway' && ChangeTakeAway() BookingType !== 'TakeAway' && ChangeTakeAway()
} }
style={{ style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto', pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}} }}
> >
<PozoTakeAway <PozoTakeAway
@ -3702,7 +3626,10 @@ const BSC1Payment = (props) => {
title="Alt + A" title="Alt + A"
open={isAltPressed} open={isAltPressed}
> >
<TooltipWrapper title={'Extra Charge'} isMobile={isMobile}> <TooltipWrapper
title={'Extra Charge'}
isMobile={isMobile}
>
<div <div
className="BSC1Payment-div1-btns" className="BSC1Payment-div1-btns"
onClick={handleextraCharges} onClick={handleextraCharges}
@ -3723,7 +3650,10 @@ const BSC1Payment = (props) => {
{!isAltPressed && ( {!isAltPressed && (
<div <div
style={{ fontSize: '9px', letterSpacing: '0.5px' }} style={{
fontSize: '9px',
letterSpacing: '0.5px',
}}
> >
(Alt + A) (Alt + A)
</div> </div>
@ -4006,7 +3936,10 @@ const BSC1Payment = (props) => {
}} }}
onClick={() => onClick={() =>
payment?.ModeName?.toLowerCase() === 'upi' // Change the condition to payment.Id payment?.ModeName?.toLowerCase() === 'upi' // Change the condition to payment.Id
? handleUPIButtonClick(payment.ModeId, payment.ModeName) ? handleUPIButtonClick(
payment.ModeId,
payment.ModeName
)
: handlePaymentMode(payment.ModeId, payment.ModeName) : handlePaymentMode(payment.ModeId, payment.ModeName)
} }
> >
@ -4215,7 +4148,10 @@ const BSC1Payment = (props) => {
> >
<div style={{ width: '3rem' }}>Qty </div> <div style={{ width: '3rem' }}>Qty </div>
<div style={{ width: '4px' }}> : </div> <div style={{ width: '4px' }}> : </div>
<div style={{ textAlign: 'right', width: '1rem' }}> {Qty} </div> <div style={{ textAlign: 'right', width: '1rem' }}>
{' '}
{Qty}{' '}
</div>
</div> </div>
<div <div
style={{ display: 'flex', alignItems: 'center' }} style={{ display: 'flex', alignItems: 'center' }}
@ -4321,7 +4257,9 @@ const BSC1Payment = (props) => {
> >
<div <div
style={{ style={{
backgroundColor: Holddata ? '#52c41a' : 'default', backgroundColor: Holddata
? '#52c41a'
: 'default',
color: Holddata ? '#ffffffff' : 'default', color: Holddata ? '#ffffffff' : 'default',
height: '40px', height: '40px',
width: '45px', width: '45px',
@ -4350,11 +4288,16 @@ const BSC1Payment = (props) => {
{tabledata?.length > 0 && dinePreference && ( {tabledata?.length > 0 && dinePreference && (
<> <>
{item?.OptionName == 'UnpaidBill' && ( {item?.OptionName == 'UnpaidBill' && (
<TooltipWrapper title="Unpaid Bills" isMobile={isMobile}> <TooltipWrapper
title="Unpaid Bills"
isMobile={isMobile}
>
{' '} {' '}
<div <div
style={{ style={{
backgroundColor: unpaidFlow ? '#52c41a' : '#1292EE', backgroundColor: unpaidFlow
? '#52c41a'
: '#1292EE',
color: unpaidFlow ? '#ffffffff' : '#ffffffff', color: unpaidFlow ? '#ffffffff' : '#ffffffff',
height: '40px', height: '40px',
width: '40px', width: '40px',
@ -4437,13 +4380,6 @@ const BSC1Payment = (props) => {
style={{ style={{
cursor: cursor:
OrderCardDetail?.length > 0 && 'not-allowed', OrderCardDetail?.length > 0 && 'not-allowed',
// color:
// OrderCardDetail?.length > 0 ||
// (selOption?.value === undefined &&
// GlobalAddCustomerDetails1?.length === 0 &&
// GetCustId?.CustMobile === undefined)
// ? 'gray'
// : '#1292eeff',
fontSize: '28px', fontSize: '28px',
}} }}
/>{' '} />{' '}
@ -4513,7 +4449,8 @@ const BSC1Payment = (props) => {
: '' : ''
} }
style={{ style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto', pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}} }}
/> />
</TooltipWrapper> </TooltipWrapper>
@ -4552,33 +4489,6 @@ const BSC1Payment = (props) => {
) : ( ) : (
'' ''
)} )}
{/* <div>
<Popover
content={<><a onClick={hide}><AiOutlineClose color='black' /></a>
<BSSummery1 />
</>
}
trigger="click"
open={open}
onOpenChange={handleOpenChange}
>
<TooltipWrapper placement="topRight" title='SUMMARY' isMobile={isMobile}><UpCircleOutlined style={{ color: "rgb(18, 146, 238)" }} className='BSC1Payment-icon-button' /></TooltipWrapper>
</Popover>
</div> */}
{/* {ComboDropDown?.length >= 1 && (
<div style={{ fontSize: '1.5rem', color: 'rgb(18, 146, 238)' }}>
<TooltipWrapper title="Combo Product" isMobile={isMobile}>
<GiBasket
fill={Comboglobal === true ? '#52C41A' : '#1292EE'}
onClick={handleClick}
style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
cursor: 'pointer',
}}
/>
</TooltipWrapper>
</div>
)} */}
{paymentfeataddon && ( {paymentfeataddon && (
<TooltipWrapper title="Failed Payment" isMobile={isMobile}> <TooltipWrapper title="Failed Payment" isMobile={isMobile}>
<div <div
@ -4615,10 +4525,17 @@ const BSC1Payment = (props) => {
open={isAltPressed} open={isAltPressed}
> >
<div <div
style={{ display: 'flex', gap: '0', alignItems: 'center' }} style={{
display: 'flex',
gap: '0',
alignItems: 'center',
}}
> >
<BSCustomerSelect /> <BSCustomerSelect />
<TooltipWrapper title={'Add Customer'} isMobile={isMobile}> <TooltipWrapper
title={'Add Customer'}
isMobile={isMobile}
>
<div> <div>
<PozoAddCustomerIcon <PozoAddCustomerIcon
className="BSBillingNav-icon-table-icon bspaymentcomboAddCus" className="BSBillingNav-icon-table-icon bspaymentcomboAddCus"
@ -4922,9 +4839,10 @@ const BSC1Payment = (props) => {
children={ children={
<> <>
<div> <div>
You have already selected a table. If you click 'OK,' the table You have already selected a table. If you click 'OK,' the
selection will be removed, and the unpaid flow will continue. If table selection will be removed, and the unpaid flow will
you click 'Cancel,' the dine-in flow will proceed as selected. continue. If you click 'Cancel,' the dine-in flow will proceed
as selected.
</div> </div>
</> </>
} }
@ -5063,6 +4981,7 @@ const BSC1Payment = (props) => {
</Modal> </Modal>
)} )}
</> </>
</Suspense>
); );
}; };

View File

@ -1,4 +1,11 @@
import { useEffect, useRef, useState, useCallback } from 'react'; import {
useEffect,
useRef,
useState,
useCallback,
Suspense,
lazy,
} from 'react';
import { shallowEqual, useDispatch, useSelector } from 'react-redux'; import { shallowEqual, useDispatch, useSelector } from 'react-redux';
import moment from 'moment'; import moment from 'moment';
import { BiBarcodeReader } from 'react-icons/bi'; import { BiBarcodeReader } from 'react-icons/bi';
@ -54,7 +61,9 @@ import { Messages } from '../../../../Components/Notifications/Messages';
import FormHeader from '../../../PageComponents/FormHeader'; import FormHeader from '../../../PageComponents/FormHeader';
import { DefaultModal } from '../../../../Components/Modal/DefaultModal'; import { DefaultModal } from '../../../../Components/Modal/DefaultModal';
import { Tables } from '../../../../Components/Tables/Table'; import { Tables } from '../../../../Components/Tables/Table';
import FeaturesFunctionalities from '../BookingFunctionality/FeaturesFunctionalities'; const FeaturesFunctionalities = lazy(
() => import('../BookingFunctionality/FeaturesFunctionalities')
);
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import BarcodeScanner from '../UtillComponents/BarcodeScanner.jsx'; import BarcodeScanner from '../UtillComponents/BarcodeScanner.jsx';
import { import {
@ -80,8 +89,17 @@ import {
import { Global_PromoCodeOffers } from '../../../../Features/Offer/Offer.js'; import { Global_PromoCodeOffers } from '../../../../Features/Offer/Offer.js';
import { validateOffers } from '../BSItemCards/ValidateOffer.jsx'; import { validateOffers } from '../BSItemCards/ValidateOffer.jsx';
import { useSaleswiseOfferWatcher } from '../BSItemCards/SalesWiseOffer.jsx'; import { useSaleswiseOfferWatcher } from '../BSItemCards/SalesWiseOffer.jsx';
import ExpireConfirmModal from '../BookingFunctionality/ExpireConfirmModal.jsx'; const ExpireConfirmModal = lazy(
import BarCodeScan from '../../../../Services/BarCodeScan.jsx'; () => import('../BookingFunctionality/ExpireConfirmModal.jsx')
);
const BarcodeScanner = lazy(
() => import('../UtillComponents/BarcodeScanner.jsx')
);
const BSNavBarWeightScale = lazy(
() => import('../UtillComponents/BSNavBarWeightScale.jsx')
);
export default function BSC1Search(props) { export default function BSC1Search(props) {
const dispatch = useDispatch(); const dispatch = useDispatch();
@ -4499,6 +4517,7 @@ export default function BSC1Search(props) {
const widthBasedOnProdVariantDetails = getMaxBrandWidth(); const widthBasedOnProdVariantDetails = getMaxBrandWidth();
return ( return (
<Suspense fallback={<div>Loading...</div>}>
<> <>
<div <div
className="BSC1Search-container" className="BSC1Search-container"
@ -4587,7 +4606,9 @@ export default function BSC1Search(props) {
</div> </div>
{ProductSearch?.length > 5 && {ProductSearch?.length > 5 &&
QuickAdd && QuickAdd &&
GetmultipleSearchDatas.some((e) => e.toLowerCase() === 'qrcode') && ( GetmultipleSearchDatas.some(
(e) => e.toLowerCase() === 'qrcode'
) && (
<div> <div>
<FeaturesFunctionalities <FeaturesFunctionalities
handleQuickAddCancel={handleQuickCancel} handleQuickAddCancel={handleQuickCancel}
@ -4662,8 +4683,11 @@ export default function BSC1Search(props) {
<div key={index}> <div key={index}>
<div <div
className={ className={
returnQtyCount(item?.ProdId, item, CartOrderDetails) > returnQtyCount(
0 || item?.StockAvailable !== 'Y' item?.ProdId,
item,
CartOrderDetails
) > 0 || item?.StockAvailable !== 'Y'
? 'ItemQtyCard' ? 'ItemQtyCard'
: 'ItemQtyCard-disabled' : 'ItemQtyCard-disabled'
} }
@ -4697,8 +4721,8 @@ export default function BSC1Search(props) {
<sup style={{ fontFamily: 'Gilroy' }}></sup> <sup style={{ fontFamily: 'Gilroy' }}></sup>
&nbsp; &nbsp;
{ {
item?.ProdVariantDetails?.[0]?.StockDetails?.[0] item?.ProdVariantDetails?.[0]
?.SellPrice ?.StockDetails?.[0]?.SellPrice
} }
</p> </p>
) : ( ) : (
@ -4709,7 +4733,11 @@ export default function BSC1Search(props) {
</div> </div>
))} ))}
</div> </div>
{brandId !== 'null' && brandId !== 'undefined' ? <hr></hr> : ''} {brandId !== 'null' && brandId !== 'undefined' ? (
<hr></hr>
) : (
''
)}
</div> </div>
))} ))}
@ -4748,7 +4776,9 @@ export default function BSC1Search(props) {
className="EditQuantity-headingproductname" className="EditQuantity-headingproductname"
style={{ marginLeft: '1rem' }} style={{ marginLeft: '1rem' }}
> >
<p className="EditQuantity-productname">{qtydata?.ProdName}</p> <p className="EditQuantity-productname">
{qtydata?.ProdName}
</p>
</div> </div>
</div> </div>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
@ -4802,7 +4832,9 @@ export default function BSC1Search(props) {
className="EditQuantity-headingproductname" className="EditQuantity-headingproductname"
style={{ marginLeft: '1rem' }} style={{ marginLeft: '1rem' }}
> >
<p className="EditQuantity-productname">{qtydata?.ProdName}</p> <p className="EditQuantity-productname">
{qtydata?.ProdName}
</p>
</div> </div>
</div> </div>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
@ -4847,5 +4879,6 @@ export default function BSC1Search(props) {
</DefaultModal> </DefaultModal>
)} */} )} */}
</> </>
</Suspense>
); );
} }

View File

@ -6098,7 +6098,7 @@ const BSItemCard = (props) => {
style={{ style={{
position: 'relative', position: 'relative',
overflow: 'hidden', overflow: 'hidden',
scrollbarWidth:"none" scrollbarWidth: 'none',
}} }}
className={ className={
(item?.OverAllQty !== undefined && (item?.OverAllQty !== undefined &&

View File

@ -75,9 +75,7 @@ import WebFont from 'webfontloader';
import FeaturesFunctionalities from '../BookingFunctionality/FeaturesFunctionalities'; import FeaturesFunctionalities from '../BookingFunctionality/FeaturesFunctionalities';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import { Global_OfferStatus } from '../../../../Features/Offer/Offer'; import { Global_OfferStatus } from '../../../../Features/Offer/Offer';
import { import { useApplyOfferto_CardDetail } from '../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
useApplyOfferto_CardDetail
} from '../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import { GlobalAddCustomerDetails } from '../../../../Features/BookingScreen/Customer/addCustomer.js'; import { GlobalAddCustomerDetails } from '../../../../Features/BookingScreen/Customer/addCustomer.js';
import { import {
DndContext, DndContext,
@ -94,8 +92,10 @@ import {
import { useSortable } from '@dnd-kit/sortable'; import { useSortable } from '@dnd-kit/sortable';
import { CSS } from '@dnd-kit/utilities'; import { CSS } from '@dnd-kit/utilities';
import { getCombolist } from '../../../../Features/ComboMaster/ComboMaster.js'; import { getCombolist } from '../../../../Features/ComboMaster/ComboMaster.js';
import { GlobalOtherServicesdata, OtherServicesCardlistdata } from '../../../../Features/OtherServices/OtherServices.js'; import {
GlobalOtherServicesdata,
OtherServicesCardlistdata,
} from '../../../../Features/OtherServices/OtherServices.js';
export function SortableCard({ id, children, item }) { export function SortableCard({ id, children, item }) {
const { const {
@ -185,10 +185,13 @@ const BSOtherServiceItemCard = (props) => {
SelectedGlobalCardColorDetail, SelectedGlobalCardColorDetail,
shallowEqual shallowEqual
); );
const GetmultipleSearchDatas = useSelector(GlobalGetmultipleSearchDatas, shallowEqual) const GetmultipleSearchDatas = useSelector(
GlobalGetmultipleSearchDatas,
shallowEqual
);
const SelectedCardFont = useSelector(SelectedGlobalCardFont, shallowEqual); const SelectedCardFont = useSelector(SelectedGlobalCardFont, shallowEqual);
const CartOrderDetails = useSelector(GlobalOrderCardDetails, shallowEqual); const CartOrderDetails = useSelector(GlobalOrderCardDetails, shallowEqual);
console.log(CartOrderDetails, "CartOrderDetailsOTHERSERVICESITEMCARD"); console.log(CartOrderDetails, 'CartOrderDetailsOTHERSERVICESITEMCARD');
const SelectedDatas = useSelector(GlobalSelectedDatas, shallowEqual); const SelectedDatas = useSelector(GlobalSelectedDatas, shallowEqual);
const otherscarddata = useSelector(Globalothersdata, shallowEqual); const otherscarddata = useSelector(Globalothersdata, shallowEqual);
const WSProductdata = useSelector(GlobalWSProduct, shallowEqual); const WSProductdata = useSelector(GlobalWSProduct, shallowEqual);
@ -209,7 +212,6 @@ const BSOtherServiceItemCard = (props) => {
const SessionData = useSelector(StoredSessionData, shallowEqual); const SessionData = useSelector(StoredSessionData, shallowEqual);
const GlobalOtherServicescarddatas = useSelector(GlobalOtherServicesdata); const GlobalOtherServicescarddatas = useSelector(GlobalOtherServicesdata);
const [messageType, setMessageType] = useState(null); const [messageType, setMessageType] = useState(null);
const [messageData, setMessageData] = useState(null); const [messageData, setMessageData] = useState(null);
const [repeatedModel, setRepeatedModel] = useState(false); const [repeatedModel, setRepeatedModel] = useState(false);
@ -224,7 +226,7 @@ const BSOtherServiceItemCard = (props) => {
const [ComboCardata, setCombocardata] = useState([]); const [ComboCardata, setCombocardata] = useState([]);
const [ExpiredProduct, setExpiredProduct] = useState() const [ExpiredProduct, setExpiredProduct] = useState();
const AppId = SessionData?.AppId; const AppId = SessionData?.AppId;
const CompId = SessionData?.CompId; const CompId = SessionData?.CompId;
@ -272,7 +274,7 @@ const BSOtherServiceItemCard = (props) => {
useEffect(() => { useEffect(() => {
if (AppId && CompId && BranchId) { if (AppId && CompId && BranchId) {
fetchedit(); fetchedit();
GetmultipleSearchData() GetmultipleSearchData();
} }
// dispatch(changepreOrder(false)); Commented to Add Normal Produts After Adding the Combo Pack !!!!!! Dont Touch Without Shifayath Permission // dispatch(changepreOrder(false)); Commented to Add Normal Produts After Adding the Combo Pack !!!!!! Dont Touch Without Shifayath Permission
@ -285,10 +287,9 @@ const BSOtherServiceItemCard = (props) => {
}; };
try { try {
const response = await dispatch(getmultipleSearch(data)) const response = await dispatch(getmultipleSearch(data));
} catch (error) { } catch (error) {
console.error("Get Search Terms Error:", error); console.error('Get Search Terms Error:', error);
} }
}; };
useEffect(() => { useEffect(() => {
@ -307,12 +308,12 @@ const BSOtherServiceItemCard = (props) => {
if (noSubcatCardData) { if (noSubcatCardData) {
setNoSubcatCardData(); setNoSubcatCardData();
} }
if (ProductSearch?.length > 5 && GetmultipleSearchDatas.some( if (
e => e.toLowerCase() === "qrcode" ProductSearch?.length > 5 &&
)) { GetmultipleSearchDatas.some((e) => e.toLowerCase() === 'qrcode')
) {
setQuickAdd(true); setQuickAdd(true);
} }
}, [ProductSearch, GetmultipleSearchDatas]); }, [ProductSearch, GetmultipleSearchDatas]);
useEffect(() => { useEffect(() => {
@ -418,95 +419,94 @@ const BSOtherServiceItemCard = (props) => {
let Data = response?.data?.data; let Data = response?.data?.data;
setCombocardata(Data); setCombocardata(Data);
} }
}; };
let Otherservicedata = [ let Otherservicedata = [
{ {
"CompId": 1, CompId: 1,
"BranchId": 101, BranchId: 101,
"AppId": 2025, AppId: 2025,
"ConfigTypeId": 10, ConfigTypeId: 10,
"ConfigTypeIdName": "Other Services", ConfigTypeIdName: 'Other Services',
"ServiceCategories": [ ServiceCategories: [
{ {
"ServiceCategory": 1, ServiceCategory: 1,
"ServiceCategoryName": "Parking", ServiceCategoryName: 'Parking',
"ServiceDetails": [ ServiceDetails: [
{ {
"ServiceId": "PK2W", ServiceId: 'PK2W',
"ServiceCategory": 1, ServiceCategory: 1,
"ServiceCategoryName": "Parking", ServiceCategoryName: 'Parking',
"ServiceName": "2-Wheeler Parking", ServiceName: '2-Wheeler Parking',
"ServiceShortName": "2W", ServiceShortName: '2W',
"TaxId": "T1", TaxId: 'T1',
"TaxName": "GST 5%", TaxName: 'GST 5%',
"TaxAmt": 1.50, TaxAmt: 1.5,
"Rate": 30.00, Rate: 30.0,
"TotalAmt": 31.50, TotalAmt: 31.5,
"ActiveStatus": "Active" ActiveStatus: 'Active',
}, },
{ {
"ServiceId": "PK4W", ServiceId: 'PK4W',
"ServiceCategory": 1, ServiceCategory: 1,
"ServiceCategoryName": "Parking", ServiceCategoryName: 'Parking',
"ServiceName": "4-Wheeler Parking", ServiceName: '4-Wheeler Parking',
"ServiceShortName": "4W", ServiceShortName: '4W',
"TaxId": "T1", TaxId: 'T1',
"TaxName": "GST 5%", TaxName: 'GST 5%',
"TaxAmt": 2.50, TaxAmt: 2.5,
"Rate": 50.00, Rate: 50.0,
"TotalAmt": 52.50, TotalAmt: 52.5,
"ActiveStatus": "Active" ActiveStatus: 'Active',
} },
] ],
}, },
{ {
"ServiceCategory": 2, ServiceCategory: 2,
"ServiceCategoryName": "Entrance", ServiceCategoryName: 'Entrance',
"ServiceDetails": [ ServiceDetails: [
{ {
"ServiceId": "ENAD", ServiceId: 'ENAD',
"ServiceCategory": 2, ServiceCategory: 2,
"ServiceCategoryName": "Entrance", ServiceCategoryName: 'Entrance',
"ServiceName": "Adult Entry", ServiceName: 'Adult Entry',
"ServiceShortName": "Adult", ServiceShortName: 'Adult',
"TaxId": "T2", TaxId: 'T2',
"TaxName": "GST 12%", TaxName: 'GST 12%',
"TaxAmt": 6.00, TaxAmt: 6.0,
"Rate": 50.00, Rate: 50.0,
"TotalAmt": 56.00, TotalAmt: 56.0,
"ActiveStatus": "Active" ActiveStatus: 'Active',
}, },
{ {
"ServiceId": "ENCH", ServiceId: 'ENCH',
"ServiceCategory": 2, ServiceCategory: 2,
"ServiceCategoryName": "Entrance", ServiceCategoryName: 'Entrance',
"ServiceName": "Child Entry", ServiceName: 'Child Entry',
"ServiceShortName": "Child", ServiceShortName: 'Child',
"TaxId": "T2", TaxId: 'T2',
"TaxName": "GST 12%", TaxName: 'GST 12%',
"TaxAmt": 3.00, TaxAmt: 3.0,
"Rate": 25.00, Rate: 25.0,
"TotalAmt": 28.00, TotalAmt: 28.0,
"ActiveStatus": "Active" ActiveStatus: 'Active',
} },
] ],
} },
] ],
} },
] ];
const processGlobalComboData = () => { const processGlobalComboData = () => {
const serviceCategories = GlobalOtherServicescarddatas?.[0]?.ServiceDetails; const serviceCategories = GlobalOtherServicescarddatas?.[0]?.ServiceDetails;
if (!Array.isArray(serviceCategories)) return []; if (!Array.isArray(serviceCategories)) return [];
// Flatten all ServiceDetails into a single array // Flatten all ServiceDetails into a single array
const allServiceDetails = serviceCategories.map((category) => category.ServiceDetails || []); const allServiceDetails = serviceCategories.map(
(category) => category.ServiceDetails || []
);
const comboList = serviceCategories.map((item, index) => ({ const comboList = serviceCategories.map((item, index) => ({
...item, ...item,
@ -520,7 +520,6 @@ const BSOtherServiceItemCard = (props) => {
const comboList = processGlobalComboData() || []; const comboList = processGlobalComboData() || [];
useEffect(() => { useEffect(() => {
DispatchData(); DispatchData();
}, [SelectedProdNames]); }, [SelectedProdNames]);
@ -536,7 +535,6 @@ const BSOtherServiceItemCard = (props) => {
}, [WSProductdata]); }, [WSProductdata]);
useEffect(() => { useEffect(() => {
if (ItemCard?.[0]?.QrBasedSearch === 'Y') { if (ItemCard?.[0]?.QrBasedSearch === 'Y') {
if (ItemCard?.[0]?.OverAllExpStatus == 'Y' && ExpiredProduct) { if (ItemCard?.[0]?.OverAllExpStatus == 'Y' && ExpiredProduct) {
setexpModel(true); setexpModel(true);
@ -632,10 +630,11 @@ const BSOtherServiceItemCard = (props) => {
); );
setBillOrderPre(BillOrder?.SettingValue); setBillOrderPre(BillOrder?.SettingValue);
const expiredDate = PreferenceStckDtl?.find( const expiredDate =
PreferenceStckDtl?.find(
(item) => item.SettingIdName === 'ExpiredSelection' (item) => item.SettingIdName === 'ExpiredSelection'
)?.SettingValue === 'Y'; )?.SettingValue === 'Y';
setExpiredProduct(expiredDate) setExpiredProduct(expiredDate);
}; };
const CloseModal = () => { const CloseModal = () => {
@ -808,7 +807,7 @@ const BSOtherServiceItemCard = (props) => {
if ( if (
overallExpStatus === 'N' || overallExpStatus === 'N' ||
// (overallExpStatus === 'Y' && prodexpir) // (overallExpStatus === 'Y' && prodexpir)
(overallExpStatus === 'Y') overallExpStatus === 'Y'
) { ) {
setModalVarient(false); setModalVarient(false);
setModelstock(true); setModelstock(true);
@ -896,22 +895,18 @@ const BSOtherServiceItemCard = (props) => {
} }
} }
} else { } else {
if (overallExpStatus === 'N' || (overallExpStatus === 'Y' && prodexpir)) {
if (
overallExpStatus === 'N' ||
(overallExpStatus === 'Y' && prodexpir)
) {
setModalVarient(false); setModalVarient(false);
setModelstock(true); setModelstock(true);
setVarItem(index.key); setVarItem(index.key);
if (overallExpStatus === 'Y' && prodexpir) { if (overallExpStatus === 'Y' && prodexpir) {
setRepeatedModel(true); setRepeatedModel(true);
} }
return return;
} else if (overallExpStatus === 'Y' && ExpiredProduct) { } else if (overallExpStatus === 'Y' && ExpiredProduct) {
setVarItem(index.key); setVarItem(index.key);
setexpVarModel(true); setexpVarModel(true);
return return;
} }
let Isincart = CartOrderDetails?.find( let Isincart = CartOrderDetails?.find(
(cartItem) => (cartItem) =>
@ -1801,7 +1796,7 @@ const BSOtherServiceItemCard = (props) => {
setQtyIndex(0); setQtyIndex(0);
setVarientIndex(0); setVarientIndex(0);
setVarItem(0); setVarItem(0);
setItem(), setStockItem(); (setItem(), setStockItem());
dispatch(changeSearchedData('')); dispatch(changeSearchedData(''));
AddOrderDetails(data); AddOrderDetails(data);
dispatch(changeWeightScaleWeight(null)); dispatch(changeWeightScaleWeight(null));
@ -1923,7 +1918,7 @@ const BSOtherServiceItemCard = (props) => {
setQtyIndex(0); setQtyIndex(0);
setVarientIndex(0); setVarientIndex(0);
setVarItem(0); setVarItem(0);
setItem(), setStockItem(); (setItem(), setStockItem());
dispatch(changeSearchedData('')); dispatch(changeSearchedData(''));
AddOrderDetails(data); AddOrderDetails(data);
setOnePeiceFlow(false); setOnePeiceFlow(false);
@ -1938,7 +1933,7 @@ const BSOtherServiceItemCard = (props) => {
setQtyIndex(0); setQtyIndex(0);
setVarientIndex(0); setVarientIndex(0);
setVarItem(0); setVarItem(0);
setItem(), setStockItem(); (setItem(), setStockItem());
dispatch(changeSearchedData('')); dispatch(changeSearchedData(''));
setOnePeiceFlow(false); setOnePeiceFlow(false);
} }
@ -2903,12 +2898,9 @@ const BSOtherServiceItemCard = (props) => {
}; };
const onAutocompleteChange = async (selectedOption) => { const onAutocompleteChange = async (selectedOption) => {
console.log(selectedOption, 'selectedOptionselectedOption');
console.log(selectedOption, "selectedOptionselectedOption");
let data = { let data = {
Type: 'OS', Type: 'OS',
ActiveStatus: selectedOption?.ActiveStatus, ActiveStatus: selectedOption?.ActiveStatus,
@ -2927,7 +2919,6 @@ const BSOtherServiceItemCard = (props) => {
ProdLogo: selectedOption?.ImageUrl, ProdLogo: selectedOption?.ImageUrl,
OrderRate: selectedOption?.TotalAmt, OrderRate: selectedOption?.TotalAmt,
TotalAmt: selectedOption?.TotalAmt, TotalAmt: selectedOption?.TotalAmt,
TotalSellPrice: selectedOption?.TotalAmt, TotalSellPrice: selectedOption?.TotalAmt,
@ -2963,7 +2954,7 @@ const BSOtherServiceItemCard = (props) => {
}; };
const AddOrderDetails = async (item) => { const AddOrderDetails = async (item) => {
console.log("AddOrderDetails item", item) console.log('AddOrderDetails item', item);
if (preOrder) { if (preOrder) {
let Response = await dispatch( let Response = await dispatch(
getConfigType({ TypeName: 'Booking Type' }) getConfigType({ TypeName: 'Booking Type' })
@ -2983,8 +2974,7 @@ const BSOtherServiceItemCard = (props) => {
if (Condition !== undefined && Condition === true) { if (Condition !== undefined && Condition === true) {
setMessageData('Dublicate Data'); setMessageData('Dublicate Data');
setMessageType('error'); setMessageType('error');
} } else {
else {
let OfferPri = let OfferPri =
item?.OfferType === 'F' item?.OfferType === 'F'
? item?.OfferPrice ? item?.OfferPrice
@ -3050,9 +3040,7 @@ const BSOtherServiceItemCard = (props) => {
dispatch(changepreOrderList(Data)); dispatch(changepreOrderList(Data));
} }
} }
} } else {
else {
dispatch(changeHoldOrderDtl(false)); dispatch(changeHoldOrderDtl(false));
dispatch(changePreviousOrderLength(CartOrderDetails?.length)); dispatch(changePreviousOrderLength(CartOrderDetails?.length));
const OtherOrderDatas = CartOrderDetails?.filter( const OtherOrderDatas = CartOrderDetails?.filter(
@ -3121,7 +3109,6 @@ const BSOtherServiceItemCard = (props) => {
const BookingTypeProd = item?.BookingTypeName; const BookingTypeProd = item?.BookingTypeName;
if (isItemInCart && BookingTypeProd != 'Dine In' && OrderType != 'Hold') { if (isItemInCart && BookingTypeProd != 'Dine In' && OrderType != 'Hold') {
if (BillOrderPre === 'Y') { if (BillOrderPre === 'Y') {
const UpdatedCartItem = const UpdatedCartItem =
// if the item is already in the cart, increase the quantity of the item // if the item is already in the cart, increase the quantity of the item
{ {
@ -3165,9 +3152,7 @@ const BSOtherServiceItemCard = (props) => {
...OtherorderDataforNormal, ...OtherorderDataforNormal,
]) ])
); );
} } else {
else {
const isGroupService = isItemInCart?.ServiceType == 'G'; const isGroupService = isItemInCart?.ServiceType == 'G';
if (isGroupService) { if (isGroupService) {
const UpdatedCartItem = const UpdatedCartItem =
@ -3179,7 +3164,8 @@ const BSOtherServiceItemCard = (props) => {
isItemInCart?.OfferPrice > 0 isItemInCart?.OfferPrice > 0
? (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate - ? (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
(isItemInCart?.OfferType === 'F' (isItemInCart?.OfferType === 'F'
? (isItemInCart?.OrderQty + 1) * isItemInCart?.OfferPrice ? (isItemInCart?.OrderQty + 1) *
isItemInCart?.OfferPrice
: ((isItemInCart?.OrderQty + 1) * : ((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate * isItemInCart?.OrderRate *
isItemInCart?.OfferPrice) / isItemInCart?.OfferPrice) /
@ -3218,13 +3204,14 @@ const BSOtherServiceItemCard = (props) => {
} else { } else {
// Not a group service // Not a group service
setMessageType('error'); setMessageType('error');
setMessageData("Service Already Exist") setMessageData('Service Already Exist');
}
} }
} }
else if (isItemInCart && BookingTypeProd === 'Dine In' && OrderType != 'Hold') { } else if (
isItemInCart &&
BookingTypeProd === 'Dine In' &&
OrderType != 'Hold'
) {
if (BillOrderPre === 'Y') { if (BillOrderPre === 'Y') {
const UpdatedCartItem = const UpdatedCartItem =
// if the item is already in the cart, increase the quantity of the item // if the item is already in the cart, increase the quantity of the item
@ -3269,8 +3256,7 @@ const BSOtherServiceItemCard = (props) => {
...OtherorderDataforNormal, ...OtherorderDataforNormal,
]) ])
); );
} } else {
else {
const UpdatedCartItem = const UpdatedCartItem =
// if the item is already in the cart, increase the quantity of the item // if the item is already in the cart, increase the quantity of the item
{ {
@ -3315,9 +3301,7 @@ const BSOtherServiceItemCard = (props) => {
]) ])
); );
} }
} } else if (isItemInCartHold && OrderType === 'Hold') {
else if (isItemInCartHold && OrderType === 'Hold') {
if (BillOrderPre === 'Y') { if (BillOrderPre === 'Y') {
const UpdatedCartItem = const UpdatedCartItem =
// if the item is already in the cart, increase the quantity of the item // if the item is already in the cart, increase the quantity of the item
@ -3364,8 +3348,7 @@ const BSOtherServiceItemCard = (props) => {
...OtherorderDataforNormalWithoutSalesId, ...OtherorderDataforNormalWithoutSalesId,
]) ])
); );
} } else {
else {
const UpdatedCartItem = const UpdatedCartItem =
// if the item is already in the cart, increase the quantity of the item // if the item is already in the cart, increase the quantity of the item
{ {
@ -3412,9 +3395,11 @@ const BSOtherServiceItemCard = (props) => {
]) ])
); );
} }
} } else if (
else if (isItemNotInDine && BookingTypeProd == 'Dine In' && OrderType != 'Hold') { isItemNotInDine &&
BookingTypeProd == 'Dine In' &&
OrderType != 'Hold'
) {
if (BillOrderPre === 'Y') { if (BillOrderPre === 'Y') {
const UpdatedCartItem = { const UpdatedCartItem = {
...isItemNotInDine, ...isItemNotInDine,
@ -3458,8 +3443,7 @@ const BSOtherServiceItemCard = (props) => {
...OtherOrderDatawithsales, ...OtherOrderDatawithsales,
]) ])
); );
} } else {
else {
const UpdatedCartItem = { const UpdatedCartItem = {
...isItemNotInDine, ...isItemNotInDine,
OrderQty: isItemNotInDine?.OrderQty + 1, OrderQty: isItemNotInDine?.OrderQty + 1,
@ -3503,9 +3487,7 @@ const BSOtherServiceItemCard = (props) => {
]) ])
); );
} }
} } else {
else {
if (item?.OtherProduct === 'Others') { if (item?.OtherProduct === 'Others') {
BillOrderPre === 'Y' BillOrderPre === 'Y'
? dispatch( ? dispatch(
@ -3593,7 +3575,6 @@ const BSOtherServiceItemCard = (props) => {
// ])); // ]));
// } // }
// } // }
else { else {
const baseItem = { const baseItem = {
...item, ...item,
@ -3618,29 +3599,30 @@ const BSOtherServiceItemCard = (props) => {
}; };
if (item?.ServiceType === 'I') { if (item?.ServiceType === 'I') {
// Add the item and include a __index to track vehicle number uniquely // Add the item and include a __index to track vehicle number uniquely
const updatedCart = [...CartOrderDetails, baseItem].map((itm, idx) => ({ const updatedCart = [...CartOrderDetails, baseItem].map(
(itm, idx) => ({
...itm, ...itm,
__index: idx, // Temporary index used for vehicle number assignment __index: idx, // Temporary index used for vehicle number assignment
})); })
);
dispatch(changeOrderCardDetails(updatedCart)); dispatch(changeOrderCardDetails(updatedCart));
} else { } else {
// Use existing flow with optional BillOrderPre control // Use existing flow with optional BillOrderPre control
// const updatedCart = // const updatedCart =
// BillOrderPre === 'Y' // BillOrderPre === 'Y'
// ? [baseItem, ...CartOrderDetails] // ? [baseItem, ...CartOrderDetails]
// : [...CartOrderDetails, baseItem]; // : [...CartOrderDetails, baseItem];
const updatedCart = [...CartOrderDetails, baseItem].map((itm, idx) => ({ const updatedCart = [...CartOrderDetails, baseItem].map(
(itm, idx) => ({
...itm, ...itm,
__index: idx, // Temporary index used for vehicle number assignment __index: idx, // Temporary index used for vehicle number assignment
})); })
);
dispatch(changeOrderCardDetails(updatedCart)); dispatch(changeOrderCardDetails(updatedCart));
} }
} }
} }
dispatch(changeothersdata({})); dispatch(changeothersdata({}));
@ -3839,7 +3821,6 @@ const BSOtherServiceItemCard = (props) => {
function encrypt(code, key) { function encrypt(code, key) {
let encrypted = ( let encrypted = (
<> <>
<div <div
className="bs-item-card-masterdiv" className="bs-item-card-masterdiv"
style={{ style={{
@ -3849,7 +3830,6 @@ const BSOtherServiceItemCard = (props) => {
height: containerHeight, height: containerHeight,
}} }}
> >
{messageType && messageData && ( {messageType && messageData && (
<Messages <Messages
messageType={messageType} messageType={messageType}
@ -4029,7 +4009,11 @@ const BSOtherServiceItemCard = (props) => {
? 'BSItemCard-image-smallimage' ? 'BSItemCard-image-smallimage'
: 'BSItemCard-image' : 'BSItemCard-image'
} }
src={item?.ImageUrl === null ? defaultimage : item?.ImageUrl ? item?.ImageUrl src={
item?.ImageUrl === null
? defaultimage
: item?.ImageUrl
? item?.ImageUrl
: defaultimage : defaultimage
} }
alt="" alt=""
@ -4142,10 +4126,8 @@ const BSOtherServiceItemCard = (props) => {
<p <p
className="BSItemCard-itemPrice" className="BSItemCard-itemPrice"
style={{ style={{
fontSize: fontSize: !cardFunction?.SmallImage
!cardFunction?.SmallImage ? cardFunction?.BigImage && '12px'
? cardFunction?.BigImage &&
'12px'
: '12px', : '12px',
textAlign: 'center', textAlign: 'center',
lineHeight: '2', lineHeight: '2',
@ -4153,16 +4135,11 @@ const BSOtherServiceItemCard = (props) => {
? SelectedCardFont ? SelectedCardFont
: '', : '',
color: SelectedCardColor color: SelectedCardColor
? SelectedCardColor?.[ ? SelectedCardColor?.['FontColor']
'FontColor'
]
: '', : '',
}} }}
> >
{' '} {item?.TotalAmt}
{
item?.TotalAmt
}
&nbsp; &nbsp;
{/* {item?.TotalAmt}&nbsp; */} {/* {item?.TotalAmt}&nbsp; */}
{/* {ItemSellingPrice(item)} */} {/* {ItemSellingPrice(item)} */}
@ -4170,8 +4147,7 @@ const BSOtherServiceItemCard = (props) => {
{'(1 Combo Pack)'} {'(1 Combo Pack)'}
</span> */} </span> */}
</p> </p>
) )}
}
</div> </div>
{cardFunction?.StockCount && {cardFunction?.StockCount &&
@ -4206,9 +4182,7 @@ const BSOtherServiceItemCard = (props) => {
)} )}
</div> </div>
</Tooltip> </Tooltip>
) : ) : (
(
<> <>
{globaldata && ( {globaldata && (
<input <input
@ -4504,8 +4478,7 @@ const BSOtherServiceItemCard = (props) => {
)} )}
</div> </div>
</> </>
) )}
}
</div> </div>
</SortableCard> </SortableCard>
))} ))}
@ -4513,8 +4486,9 @@ const BSOtherServiceItemCard = (props) => {
</SortableContext> </SortableContext>
</DndContext> </DndContext>
</> </>
) : ProductSearch?.length > 5 && GetmultipleSearchDatas.some( ) : ProductSearch?.length > 5 &&
e => e.toLowerCase() === "qrcode" GetmultipleSearchDatas.some(
(e) => e.toLowerCase() === 'qrcode'
) && ) &&
(cardData?.length == 0 || cardData == undefined) ? ( (cardData?.length == 0 || cardData == undefined) ? (
<div> <div>
@ -4535,19 +4509,19 @@ const BSOtherServiceItemCard = (props) => {
display: globalAccessForOthers && 'none', display: globalAccessForOthers && 'none',
}} }}
> >
<div align="center" class="fond"> <div align="center" className="fond">
<div class="contener_general"> <div className="contener_general">
<div class="contener_mixte"> <div className="contener_mixte">
<div class="ballcolor ball_1">&nbsp;</div> <div className="ballcolor ball_1">&nbsp;</div>
</div> </div>
<div class="contener_mixte"> <div className="contener_mixte">
<div class="ballcolor ball_2">&nbsp;</div> <div className="ballcolor ball_2">&nbsp;</div>
</div> </div>
<div class="contener_mixte"> <div className="contener_mixte">
<div class="ballcolor ball_3">&nbsp;</div> <div className="ballcolor ball_3">&nbsp;</div>
</div> </div>
<div class="contener_mixte"> <div className="contener_mixte">
<div class="ballcolor ball_4">&nbsp;</div> <div className="ballcolor ball_4">&nbsp;</div>
</div> </div>
</div> </div>
</div> </div>
@ -4556,19 +4530,19 @@ const BSOtherServiceItemCard = (props) => {
)} )}
{paymentloader === true && ( {paymentloader === true && (
<div class="Payment-loader1"> <div className="Payment-loader1">
<div class="Payment-loader"> <div className="Payment-loader">
<div class="contener_mixte"> <div className="contener_mixte">
<div class="ballcolor ball_1">&nbsp;</div> <div className="ballcolor ball_1">&nbsp;</div>
</div> </div>
<div class="contener_mixte"> <div className="contener_mixte">
<div class="ballcolor ball_2">&nbsp;</div> <div className="ballcolor ball_2">&nbsp;</div>
</div> </div>
<div class="contener_mixte"> <div className="contener_mixte">
<div class="ballcolor ball_3">&nbsp;</div> <div className="ballcolor ball_3">&nbsp;</div>
</div> </div>
<div class="contener_mixte"> <div className="contener_mixte">
<div class="ballcolor ball_4">&nbsp;</div> <div className="ballcolor ball_4">&nbsp;</div>
</div> </div>
<p style={{ marginTop: '2rem' }}> <p style={{ marginTop: '2rem' }}>
{' '} {' '}
@ -4582,10 +4556,8 @@ const BSOtherServiceItemCard = (props) => {
</div> </div>
</div> </div>
)} )}
</div> </div>
</div> </div>
</div> </div>
{expModel && ( {expModel && (
@ -4629,9 +4601,9 @@ const BSOtherServiceItemCard = (props) => {
open={expQtyModel} open={expQtyModel}
onOk={() => expQtyFun(qtyExpData)} onOk={() => expQtyFun(qtyExpData)}
onCancel={() => { onCancel={() => {
setRepeatedModel(false), (setRepeatedModel(false),
setProdexpir(false), setProdexpir(false),
setExpQtyModel(false); setExpQtyModel(false));
}} }}
okText="Submit" okText="Submit"
cancelText="Don't Submit" cancelText="Don't Submit"
@ -4655,9 +4627,9 @@ const BSOtherServiceItemCard = (props) => {
open={expVarModel} open={expVarModel}
onOk={() => expVerFun(VarItem)} onOk={() => expVerFun(VarItem)}
onCancel={() => { onCancel={() => {
setexpVarModel(false), (setexpVarModel(false),
setRepeatedModel(false), setRepeatedModel(false),
setProdexpir(false); setProdexpir(false));
}} }}
okText="Submit" okText="Submit"
cancelText="Don't Submit" cancelText="Don't Submit"
@ -4681,9 +4653,9 @@ const BSOtherServiceItemCard = (props) => {
open={expStockModel} open={expStockModel}
onOk={() => expStockFun(StockItem)} onOk={() => expStockFun(StockItem)}
onCancel={() => { onCancel={() => {
setexpStockModel(false), (setexpStockModel(false),
setRepeatedModel(false), setRepeatedModel(false),
setProdexpir(false); setProdexpir(false));
}} }}
okText="Submit" okText="Submit"
cancelText="Don't Submit" cancelText="Don't Submit"
@ -4943,7 +4915,6 @@ const BSOtherServiceItemCard = (props) => {
} }
/> />
)} )}
</> </>
); );
@ -4974,5 +4945,4 @@ const BSOtherServiceItemCard = (props) => {
return <>{encrypt()}</>; return <>{encrypt()}</>;
}; };
export default BSOtherServiceItemCard;
export default BSOtherServiceItemCard

View File

@ -67,6 +67,7 @@ import {
GlobalAddBookingDetailsTrigger, GlobalAddBookingDetailsTrigger,
GlobalGetmultipleSearchDatas, GlobalGetmultipleSearchDatas,
getmultipleSearch, getmultipleSearch,
GlobalAllBookingType,
} from '../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../Features/BookingScreen/BookingData/BookingData';
import { import {
GlobalPreOrderAdditem, GlobalPreOrderAdditem,
@ -108,7 +109,7 @@ import { ExtractDateFormate } from '../../../../Services/Others.js';
import { import {
changeFullOfferAppliedProducts, changeFullOfferAppliedProducts,
changeOfferAppliedProductsForMembership, changeOfferAppliedProductsForMembership,
GlobalOfferAppliedProducts GlobalOfferAppliedProducts,
} from '../../../../Features/Offer/Offernew/BookingOffernew.js'; } from '../../../../Features/Offer/Offernew/BookingOffernew.js';
import { useSaleswiseOfferWatcher } from './SalesWiseOffer.jsx'; import { useSaleswiseOfferWatcher } from './SalesWiseOffer.jsx';
import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin.js'; import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin.js';
@ -164,6 +165,8 @@ const BsBookingitemCard = (props) => {
const voiceTriggerRef = useRef(null); const voiceTriggerRef = useRef(null);
const unsubscribeRef = useRef(null); const unsubscribeRef = useRef(null);
const AllBookingType = useSelector(GlobalAllBookingType);
const { removeFromCart, clearAllItems, decline } = useRemoveFromCart(); const { removeFromCart, clearAllItems, decline } = useRemoveFromCart();
const handleRemoveFromCart = async (item) => { const handleRemoveFromCart = async (item) => {
await removeFromCart(item, setPreviousdataLength); await removeFromCart(item, setPreviousdataLength);
@ -172,9 +175,6 @@ const BsBookingitemCard = (props) => {
await decline(item, setPreviousdataLength); await decline(item, setPreviousdataLength);
}; };
const cardFunction = props?.cardFunctionality; const cardFunction = props?.cardFunctionality;
// const applyOffer = useApplyOfferto_CardDetail(); // const applyOffer = useApplyOfferto_CardDetail();
const preferenceDatas = useSelector(PreferenceData, shallowEqual); const preferenceDatas = useSelector(PreferenceData, shallowEqual);
@ -194,7 +194,10 @@ const BsBookingitemCard = (props) => {
shallowEqual shallowEqual
); );
// const SelectedCust = useSelector(GlobalSelOption, shallowEqual); // const SelectedCust = useSelector(GlobalSelOption, shallowEqual);
const GetmultipleSearchDatas = useSelector(GlobalGetmultipleSearchDatas, shallowEqual) const GetmultipleSearchDatas = useSelector(
GlobalGetmultipleSearchDatas,
shallowEqual
);
const RetailWSSalesType = useSelector(GlobalRetailWSSalesType, shallowEqual); const RetailWSSalesType = useSelector(GlobalRetailWSSalesType, shallowEqual);
// const CustDetails = SelectedCust ? SelectedCust : AddCustomerDetails?.[0]; // const CustDetails = SelectedCust ? SelectedCust : AddCustomerDetails?.[0];
const BookingTypeBoth = useSelector(GlobalBookingTypeBoth); const BookingTypeBoth = useSelector(GlobalBookingTypeBoth);
@ -1069,7 +1072,7 @@ const BsBookingitemCard = (props) => {
useEffect(() => { useEffect(() => {
if (AppId && CompId && BranchId) { if (AppId && CompId && BranchId) {
fetchedit(); fetchedit();
GetmultipleSearchData() GetmultipleSearchData();
} }
// dispatch(changepreOrder(false)); Commented to Add Normal Produts After Adding the Combo Pack !!!!!! Dont Touch Without Shifayath Permission // dispatch(changepreOrder(false)); Commented to Add Normal Produts After Adding the Combo Pack !!!!!! Dont Touch Without Shifayath Permission
@ -1082,10 +1085,9 @@ const BsBookingitemCard = (props) => {
}; };
try { try {
const response = await dispatch(getmultipleSearch(data)) const response = await dispatch(getmultipleSearch(data));
} catch (error) { } catch (error) {
console.error("Get Search Terms Error:", error); console.error('Get Search Terms Error:', error);
} }
}; };
useEffect(() => { useEffect(() => {
@ -1120,9 +1122,10 @@ const BsBookingitemCard = (props) => {
if (noSubcatCardData) { if (noSubcatCardData) {
setNoSubcatCardData(); setNoSubcatCardData();
} }
if (ProductSearch?.length > 5 && GetmultipleSearchDatas.some( if (
e => e.toLowerCase() === "qrcode" ProductSearch?.length > 5 &&
)) { GetmultipleSearchDatas.some((e) => e.toLowerCase() === 'qrcode')
) {
setQuickAdd(true); setQuickAdd(true);
} }
}, [ProductSearch, GetmultipleSearchDatas]); }, [ProductSearch, GetmultipleSearchDatas]);
@ -1233,20 +1236,12 @@ const BsBookingitemCard = (props) => {
}; };
const getBookingTypeId = async () => { const getBookingTypeId = async () => {
let tempconfigdata = await dispatch( setConfigDataList(AllBookingType);
getConfigType({ TypeName: 'Booking Type' }) let configdata = AllBookingType;
).unwrap();
if (tempconfigdata?.data?.statusCode == 1) {
setConfigDataList(tempconfigdata?.data?.data);
let configdata = tempconfigdata?.data?.data;
let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType; let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType;
let filterconfigdata = configdata?.find( let filterconfigdata = configdata?.find((a) => a?.ConfigName === checkName);
(a) => a?.ConfigName === checkName
);
// setSelectedBookingType(filterconfigdata?.ConfigId); // setSelectedBookingType(filterconfigdata?.ConfigId);
}
}; };
function getCurrentMembership(memberships) { function getCurrentMembership(memberships) {
@ -5336,8 +5331,9 @@ const BsBookingitemCard = (props) => {
</SortableContext> </SortableContext>
</DndContext> </DndContext>
</> </>
) : ProductSearch?.length > 5 && GetmultipleSearchDatas.some( ) : ProductSearch?.length > 5 &&
e => e.toLowerCase() === "qrcode" GetmultipleSearchDatas.some(
(e) => e.toLowerCase() === 'qrcode'
) && ) &&
(cardData?.length == 0 || cardData == undefined) ? ( (cardData?.length == 0 || cardData == undefined) ? (
<div> <div>
@ -5358,39 +5354,46 @@ const BsBookingitemCard = (props) => {
display: globalAccessForOthers && 'none', display: globalAccessForOthers && 'none',
}} }}
> >
<div align="center" class="fond"> Name
<div class="contener_general"> <div align="Namecenter" className="fond">
<div class="contener_mixte"> <div className="Namecontener_general">
<div class="ballcolor ball_1">&nbsp;</div> <div className="Namecontener_mixte">
<div className="ballcolor ball_1">&nbsp;</div>
</div> </div>
<div class="contener_mixte"> Name
<div class="ballcolor ball_2">&nbsp;</div> <div className="Namecontener_mixte">
<div className="ballcolor ball_2">&nbsp;</div>
</div> </div>
<div class="contener_mixte"> Name
<div class="ballcolor ball_3">&nbsp;</div> <div className="Namecontener_mixte">
<div className="ballcolor ball_3">&nbsp;</div>
</div> </div>
<div class="contener_mixte"> Name
<div class="ballcolor ball_4">&nbsp;</div> <div className="Namecontener_mixte">
<div className="ballcolor ball_4">&nbsp;</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</> </>
)} )}
{paymentloader === true && ( {paymentloadNameer === true && (
<div class="Payment-loader1"> <div className="NamePayment-loader1">
<div class="Payment-loader"> <div className="NamePayment-loader">
<div class="contener_mixte"> <div className="Namecontener_mixte">
<div class="ballcolor ball_1">&nbsp;</div> <div className="ballcolor ball_1">&nbsp;</div>
</div> </div>
<div class="contener_mixte"> Name
<div class="ballcolor ball_2">&nbsp;</div> <div className="Namecontener_mixte">
<div className="ballcolor ball_2">&nbsp;</div>
</div> </div>
<div class="contener_mixte"> Name
<div class="ballcolor ball_3">&nbsp;</div> <div className="Namecontener_mixte">
<div className="ballcolor ball_3">&nbsp;</div>
</div> </div>
<div class="contener_mixte"> Name
<div class="ballcolor ball_4">&nbsp;</div> <div className="Namecontener_mixte">
<div className="ballcolor ball_4">&nbsp;</div>
</div> </div>
<p style={{ marginTop: '2rem' }}> <p style={{ marginTop: '2rem' }}>
{' '} {' '}
@ -6070,7 +6073,8 @@ const BsBookingitemCard = (props) => {
return ( return (
<div <div
key={idx} key={idx}
className={`slotTimingSelect ${isBooked className={`slotTimingSelect ${
isBooked
? 'booked' ? 'booked'
: isAlreadyAdded : isAlreadyAdded
? 'incart' ? 'incart'
@ -6220,8 +6224,7 @@ const BsBookingitemCard = (props) => {
/> />
)} )}
{ {(timeSlot?.SlotStatus ===
(timeSlot?.SlotStatus ===
'Partially Booked' || 'Partially Booked' ||
timeSlot?.SlotStatus === timeSlot?.SlotStatus ===
'Booked') && ( 'Booked') && (

View File

@ -1,15 +1,16 @@
import React from 'react'; import React, { lazy, Suspense } from 'react';
import { MdEdit } from 'react-icons/md'; import { MdEdit } from 'react-icons/md';
import { FaUserLarge } from 'react-icons/fa6'; import { FaUserLarge } from 'react-icons/fa6';
import { BiSolidPhoneCall } from 'react-icons/bi'; import { BiSolidPhoneCall } from 'react-icons/bi';
import { PiSignOutLight } from 'react-icons/pi'; import { PiSignOutLight } from 'react-icons/pi';
import user from '../../../../Images/dashboard/user.jpg'; import user from '../../../../Images/dashboard/user.jpg';
import { clearSession, getSession } from '../../../../Services/Others'; import { clearSession, getSession } from '../../../../Services/Others';
import UserRelieveManager from '../../Template/RealivingUser';
import { GlobalCompBranchData } from '../../../../Features/BrachLogin/BranchLogin'; import { GlobalCompBranchData } from '../../../../Features/BrachLogin/BranchLogin';
import { userDataByUserId } from '../../../../Features/UserAccount/userData'; import { userDataByUserId } from '../../../../Features/UserAccount/userData';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
const UserRelieveManager = lazy(() => import('../../Template/RealivingUser'));
// Scss
import "../../../../Styles/BookingScreen/Components/BSNavbar/BSNavbar1.scss" import "../../../../Styles/BookingScreen/Components/BSNavbar/BSNavbar1.scss"
const subDirectory = import.meta.env.ENV_BASE_URL; const subDirectory = import.meta.env.ENV_BASE_URL;
@ -37,6 +38,7 @@ const BSNavBarUserInfo = ({
navigate(`${subDirectory}app-page/branch-login`); navigate(`${subDirectory}app-page/branch-login`);
}; };
return ( return (
<Suspense fallback={<div>Loading</div>}>
<div ref={divRef} className="BSNavBar1-Accmenu"> <div ref={divRef} className="BSNavBar1-Accmenu">
<div className="BSNavBar1-Acc-menu"> <div className="BSNavBar1-Acc-menu">
{CompBranchData?.length > 1 && ( {CompBranchData?.length > 1 && (
@ -96,6 +98,7 @@ const BSNavBarUserInfo = ({
</div> </div>
</div> </div>
</div> </div>
</Suspense>
); );
}; };

View File

@ -1,16 +1,20 @@
import React, { useCallback, useEffect, useRef, useState } from 'react'; import React, {
useCallback,
useEffect,
useRef,
useState,
lazy,
Suspense,
} from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { Badge, Button, Popconfirm, Popover, Tooltip } from 'antd'; import { Badge, Popconfirm, Popover, Tooltip } from 'antd';
import { import {
FeatureAddon,
GlobalBookingType, GlobalBookingType,
GlobalBookingTypeBoth, GlobalBookingTypeBoth,
PreferenceData, PreferenceData,
changeCombosearch,
GlobalCombosearch, GlobalCombosearch,
getPreferenceData, getPreferenceData,
Comboget,
GlobalOrderCardDetails, GlobalOrderCardDetails,
changeEstimateBooking, changeEstimateBooking,
GlobalOrderStatus, GlobalOrderStatus,
@ -31,46 +35,8 @@ import {
changeComboRedirectionToDefaultLayoutForParking, changeComboRedirectionToDefaultLayoutForParking,
GlobalCommonPaymentOptions, GlobalCommonPaymentOptions,
GlobalSelCustId, GlobalSelCustId,
} from '../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../Features/BookingScreen/BookingData/BookingData.js';
import PozoPreOrderIcon from '../UtillComponents/Pozo retail icons/PozoPreOrderIcon.jsx'; // js Files
import BSNavBarPrinter from '../UtillComponents/BSNavBarPrinter';
import BSNavBarHand from '../UtillComponents/BSNavBarHand';
import BSNavBarTable from '../UtillComponents/BSNavBarTable';
import BSNavBarHandbag from '../UtillComponents/BSNavBarHandbag';
import BSNavBarOffer from '../UtillComponents/BSNavBarOffer/BSNavBarOffer.jsx';
import BSNavBarAddons from '../UtillComponents/BSNavBarAddons';
import BSNavBarAddUser from '../UtillComponents/BSNavBarAddUser';
import BSNavBarQuickAdd from '../UtillComponents/BSNavBarQuickAdd';
import BSNavBarSearch from '../UtillComponents/BSNavBarSearch';
import BSNavBarWeightScale from '../UtillComponents/BSNavBarWeightScale';
import BSNavBarFavItems from '../UtillComponents/BSNavBarFavItems';
import BSNavBarEstimate from '../UtillComponents/BSNavBarEst.jsx';
import BSNavBarPreOrder from '../../Components/UtillComponents/BSNavBarPreOrder.jsx';
import '../../../../Styles/BookingScreen/Components/BSNavbar/BSNavbar1.scss';
import {
getSession,
clearSession,
sessionStore,
} from '../../../../Services/Others';
import FeaturesFunctionalities from '../BookingFunctionality/FeaturesFunctionalities';
import BSCustomerSelect from '../UtillComponents/BSSelectCustomer.jsx';
import PozoHomeIcon from '../UtillComponents/Pozo retail icons/PozoHomeIcon';
import PozoUserIcon from '../UtillComponents/Pozo retail icons/PozoUserIcon';
import TimerClock from '../BSCombo/BSTimer.jsx';
import {
ApplicationPreferences,
GenerateLogout,
GlobalCompBranchData,
getCompBranchData,
} from '../../../../Features/BrachLogin/BranchLogin.js';
import BSPrinterSetting from '../UtillComponents/BSPrinterSetting.jsx';
import { isMobile } from 'react-device-detect';
import { FaDisplay } from 'react-icons/fa6';
import BSNavBarComboSearch from '../UtillComponents/BSNavBarComboSearch.jsx';
import {
setCustomerDisplayWindow,
closeCustomerDisplayWindow,
} from '../../../../Features/customerDisplayWindow/customerDisplayWindow';
import { import {
GlobalPreOrderPendingCount, GlobalPreOrderPendingCount,
PreOrderGet, PreOrderGet,
@ -79,49 +45,125 @@ import {
changePreOrderAdditem, changePreOrderAdditem,
changepreOrderList, changepreOrderList,
} from '../../../../Features/BookingScreen/PreOrder/PreOrder.js'; } from '../../../../Features/BookingScreen/PreOrder/PreOrder.js';
import {
ApplicationPreferences,
GenerateLogout,
GlobalCompBranchData,
getCompBranchData,
} from '../../../../Features/BrachLogin/BranchLogin.js';
import { getCustomerDisplayWindow } from '../../../../Features/customerDisplayWindow/customerDisplayWindow.js'; import { getCustomerDisplayWindow } from '../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import PozoAddCustomerIcon from '../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx';
import PaymentFailedSales from '../../../Payment/PaymentFailedDetails/PaymentFailedSales.jsx';
import PozoComboProductIcon from '../UtillComponents/Pozo retail icons/PozoComboProductIcon.jsx';
import CustomerDisplayicon from '../UtillComponents/Pozo retail icons/PozoCustomerDisplayicon.jsx';
import PozoPaymentFailesIcon from '../UtillComponents/Pozo retail icons/PozoFailedPaymentsIcon.jsx';
import PozoMenuIcon from '../UtillComponents/Pozo retail icons/PozoMenuIcon.jsx';
import TooltipWrapper from '../../../../Components/Tooltip/Tooltip';
import { Global_OfferStatus } from '../../../../Features/Offer/Offer.js'; import { Global_OfferStatus } from '../../../../Features/Offer/Offer.js';
import { import {
getPrintSelectionComponentData,
getTemplate, getTemplate,
getTemplateData, getTemplateData,
StoredSessionData, StoredSessionData,
} from '../../../../Features/ThemeChange/ThemeChange.js'; } from '../../../../Features/ThemeChange/ThemeChange.js';
import { IoMdClose } from 'react-icons/io';
import { GlobalBookingStatus } from '../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js'; import { GlobalBookingStatus } from '../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js';
import { getEmpAccess } from '../../../../Features/AppPage/CenterPage.js'; import { getEmpAccess } from '../../../../Features/AppPage/CenterPage.js';
import { useAuth } from '../../../../AuthContext.jsx';
import BSNavBarDragItems from '../UtillComponents/BSNavBarDragItems.jsx';
import { import {
getUserProfile, getUserProfile,
userDataByUserId, userDataByUserId,
} from '../../../../Features/UserAccount/userData.js'; } from '../../../../Features/UserAccount/userData.js';
import { FaUserLarge } from 'react-icons/fa6'; import { OtherServicesCardlistdata } from '../../../../Features/OtherServices/OtherServices.js';
import { BiSolidPhoneCall } from 'react-icons/bi'; import { clearSession, sessionStore } from '../../../../Services/Others.js';
import { PiSignOutLight } from 'react-icons/pi'; import { setCustomerDisplayWindow } from '../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import PozoSwapIcon from '../UtillComponents/Pozo retail icons/PozoSwapIcon.jsx'; import BSMobilePrintSettings from '../UtillComponents/BSMobilePrintSettings.jsx';
import { MdEdit } from 'react-icons/md';
// Jsx Files
const BSNavBarOffer = lazy(
() => import('../UtillComponents/BSNavBarOffer/BSNavBarOffer.jsx')
);
const BSNavBarPreOrder = lazy(
() => import('../../Components/UtillComponents/BSNavBarPreOrder.jsx')
);
const BSNavBarEstimate = lazy(
() => import('../UtillComponents/BSNavBarEst.jsx')
);
const BSCustomerSelect = lazy(
() => import('../UtillComponents/BSSelectCustomer.jsx')
);
const TimerClock = lazy(() => import('../BSCombo/BSTimer.jsx'));
const BSPrinterSetting = lazy(
() => import('../UtillComponents/BSPrinterSetting.jsx')
);
const BSNavBarComboSearch = lazy(
() => import('../UtillComponents/BSNavBarComboSearch.jsx')
);
const PaymentFailedSales = lazy(
() => import('../../../Payment/PaymentFailedDetails/PaymentFailedSales.jsx')
);
const BSNavBarWholeSale = lazy(
() => import('../UtillComponents/BSNavBarWholeSale.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 MultipleSearch = lazy(
() => import('../UtillComponents/MultipleSearch.jsx')
);
const BSNavBarDragItems = lazy(
() => import('../UtillComponents/BSNavBarDragItems.jsx')
);
const UserRelieveManager = lazy(
() => import('../../Template/RealivingUser.jsx')
);
const FeaturesFunctionalities = lazy(
() => import('../BookingFunctionality/FeaturesFunctionalities.jsx')
);
import { useAuth } from '../../../../AuthContext.jsx';
const BSNavBarAddons = lazy(
() => import('../UtillComponents/BSNavBarAddons.jsx')
);
const BSNavBarQuickAdd = lazy(
() => import('../UtillComponents/BSNavBarQuickAdd.jsx')
);
const BSNavBarAddUser = lazy(
() => import('../UtillComponents/BSNavBarAddUser.jsx')
);
const BSNavBarSearch = lazy(
() => import('../UtillComponents/BSNavBarSearch.jsx')
);
const BSNavBarWeightScale = lazy(
() => import('../UtillComponents/BSNavBarWeightScale.jsx')
);
const BSNavBarFavItems = lazy(
() => import('../UtillComponents/BSNavBarFavItems.jsx')
);
const BSNavBarHand = lazy(() => import('../UtillComponents/BSNavBarHand.jsx'));
const BSNavBarTable = lazy(
() => import('../UtillComponents/BSNavBarTable.jsx')
);
const BSNavBarHandbag = lazy(
() => import('../UtillComponents/BSNavBarHandbag.jsx')
);
// Icon Files
import PozoHomeIcon from '../UtillComponents/Pozo retail icons/PozoHomeIcon';
import PozoPreOrderIcon from '../UtillComponents/Pozo retail icons/PozoPreOrderIcon.jsx';
import PozoUserIcon from '../UtillComponents/Pozo retail icons/PozoUserIcon';
import PozoAddCustomerIcon from '../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx';
import CustomerDisplayicon from '../UtillComponents/Pozo retail icons/PozoCustomerDisplayicon.jsx';
import PozoPaymentFailesIcon from '../UtillComponents/Pozo retail icons/PozoFailedPaymentsIcon.jsx';
import PozoMenuIcon from '../UtillComponents/Pozo retail icons/PozoMenuIcon.jsx';
import TooltipWrapper from '../../../../Components/Tooltip/Tooltip';
import { IoMdClose } from 'react-icons/io';
import { CgSearchLoading } from 'react-icons/cg'; import { CgSearchLoading } from 'react-icons/cg';
import UserRelieveManager from '../../Template/RealivingUser.jsx';
import user from '../../../../Images/dashboard/user.jpg';
import BSNavBarUserInfo from './BSNavBarUserInfo'; import BSNavBarUserInfo from './BSNavBarUserInfo';
import { FaParking } from 'react-icons/fa'; import { FaParking } from 'react-icons/fa';
import { OtherServicesCardlistdata } from '../../../../Features/OtherServices/OtherServices.js'; import { isMobile } from 'react-device-detect';
import BSNavBarWholeSale from '../UtillComponents/BSNavBarWholeSale.jsx';
import BSMobilePrintSettings from '../UtillComponents/BSMobilePrintSettings.jsx';
import BSScanTemplate from '../UtillComponents/BSScanTemplate.jsx';
import VerfiedProducts from './verfiedProduct/VerfiedProducts.jsx';
import BSMembership from '../UtillComponents/BSMembership.jsx';
import BranchName from '../../Template/BranchName.jsx';
import MultipleSearch from '../UtillComponents/MultipleSearch.jsx';
import { DefaultModal } from '../../../../Components/Modal/DefaultModal.jsx'; import { DefaultModal } from '../../../../Components/Modal/DefaultModal.jsx';
import '../../../../Styles/BookingScreen/Components/BSNavbar/BSNavbar1.scss';
const subDirectory = import.meta.env.ENV_BASE_URL; const subDirectory = import.meta.env.ENV_BASE_URL;
const commonUrl = import.meta.env.ENV_COMMON_BASE_URL; const commonUrl = import.meta.env.ENV_COMMON_BASE_URL;
@ -221,17 +263,28 @@ const BSNavbar1 = (props) => {
const comboRedirectionToDefaultLayoutForParking = useSelector( const comboRedirectionToDefaultLayoutForParking = useSelector(
GlobalComboRedirectionToDefaultLayoutForParking GlobalComboRedirectionToDefaultLayoutForParking
); );
const CartOrderDetails = useSelector(GlobalOrderCardDetails);
const divRef = useRef(null); const divRef = useRef(null);
const handleClickOutside = (event) => { const handleClickOutside = (event) => {
if (divRef.current && !divRef.current.contains(event.target)) { if (divRef.current && !divRef.current.contains(event.target)) {
setAccIsOpen(false); setAccIsOpen(false);
} }
}; };
useEffect(() => {
if (!FeatureAddonData?.FeatureDtls?.length) return;
const preorderFeature = FeatureAddonData.FeatureDtls.find(
(item) => item?.FeatureAddonName?.toLowerCase() === 'preorder'
);
if (preorderFeature) {
BadgePendingApi();
}
}, [FeatureAddonData]);
useEffect(() => { useEffect(() => {
handleOtherData(); handleOtherData();
BadgePendingApi();
// if (UserType === "Employee") { // if (UserType === "Employee") {
// fetchApi() // fetchApi()
// } // }
@ -558,6 +611,7 @@ const BSNavbar1 = (props) => {
}; };
return ( return (
<Suspense fallback={<div>Suspense Loading...</div>}>
<div <div
className="BSBillingNavBar1" className="BSBillingNavBar1"
style={{ style={{
@ -581,7 +635,11 @@ const BSNavbar1 = (props) => {
isMobile={isMobile} isMobile={isMobile}
> >
<PozoHomeIcon <PozoHomeIcon
style={{ color: '#1292EE', fontSize: '28px', cursor: 'pointer' }} style={{
color: '#1292EE',
fontSize: '28px',
cursor: 'pointer',
}}
className="BSBillingNav2-toggle-icon" className="BSBillingNav2-toggle-icon"
/> />
</TooltipWrapper> </TooltipWrapper>
@ -615,7 +673,9 @@ const BSNavbar1 = (props) => {
}} }}
> >
<FaParking <FaParking
fill={OtherServicesglobal === true ? '#52C41A' : '#1292EE'} fill={
OtherServicesglobal === true ? '#52C41A' : '#1292EE'
}
/> />
</div> </div>
</TooltipWrapper> </TooltipWrapper>
@ -652,7 +712,10 @@ const BSNavbar1 = (props) => {
OrderType === 'Failed' ? 'none' : 'auto', OrderType === 'Failed' ? 'none' : 'auto',
}} }}
> >
<BSNavBarSearch nosearch={true} OrderType={OrderType} /> <BSNavBarSearch
nosearch={true}
OrderType={OrderType}
/>
</div> </div>
)} )}
</> </>
@ -684,7 +747,8 @@ const BSNavbar1 = (props) => {
<TooltipWrapper title="RePrint (Alt+R)" isMobile={isMobile}> <TooltipWrapper title="RePrint (Alt+R)" isMobile={isMobile}>
<div <div
style={{ style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto', pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}} }}
> >
<BSPrinterSetting /> <BSPrinterSetting />
@ -707,7 +771,8 @@ const BSNavbar1 = (props) => {
{item?.OptionName == 'QuickAdd' && ( {item?.OptionName == 'QuickAdd' && (
<div <div
style={{ style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto', pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}} }}
> >
<BSNavBarQuickAdd /> <BSNavBarQuickAdd />
@ -732,7 +797,8 @@ const BSNavbar1 = (props) => {
{item?.OptionName == 'TakeAway' && takeAwayPreference && ( {item?.OptionName == 'TakeAway' && takeAwayPreference && (
<div <div
style={{ style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto', pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}} }}
> >
<BSNavBarHandbag /> <BSNavBarHandbag />
@ -759,7 +825,8 @@ const BSNavbar1 = (props) => {
// CartOrderDetails?.length > 0 && // CartOrderDetails?.length > 0 &&
<div <div
style={{ style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto', pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}} }}
> >
<BSNavBarAddons /> <BSNavBarAddons />
@ -895,7 +962,10 @@ const BSNavbar1 = (props) => {
)} )}
{VerifyTheProducts && ( {VerifyTheProducts && (
<TooltipWrapper title={'Verfied Products'} isMobile={isMobile}> <TooltipWrapper
title={'Verfied Products'}
isMobile={isMobile}
>
<div> <div>
<VerfiedProducts /> <VerfiedProducts />
</div> </div>
@ -962,11 +1032,16 @@ const BSNavbar1 = (props) => {
<div <div
style={{ fontSize: '1.5rem', color: 'rgb(18, 146, 238)' }} style={{ fontSize: '1.5rem', color: 'rgb(18, 146, 238)' }}
> >
<TooltipWrapper title="Other Services" isMobile={isMobile}> <TooltipWrapper
title="Other Services"
isMobile={isMobile}
>
<div onClick={handleotherservices}> <div onClick={handleotherservices}>
<FaParking <FaParking
fill={ fill={
OtherServicesglobal === true ? '#52C41A' : '#1292EE' OtherServicesglobal === true
? '#52C41A'
: '#1292EE'
} }
/> />
</div> </div>
@ -974,7 +1049,9 @@ const BSNavbar1 = (props) => {
</div> </div>
)} )}
{!OtherServicesglobal && {!OtherServicesglobal &&
ScanLayoutScreen?.SettingValue === 'Y' && <BSScanTemplate />} ScanLayoutScreen?.SettingValue === 'Y' && (
<BSScanTemplate />
)}
{!OtherServicesglobal && ( {!OtherServicesglobal && (
<> <>
@ -1136,7 +1213,8 @@ const BSNavbar1 = (props) => {
))} ))}
{FeatureAddonData?.FeatureDtls?.find( {FeatureAddonData?.FeatureDtls?.find(
(item) => (item) =>
item?.FeatureAddonName?.toLowerCase() === 'Weight Scale' item?.FeatureAddonName?.toLowerCase() ===
'Weight Scale'
) && ( ) && (
<div <div
style={{ style={{
@ -1217,7 +1295,8 @@ const BSNavbar1 = (props) => {
<div <div
style={{ style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto', pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}} }}
> >
<BSNavBarDragItems type="small-screen" /> <BSNavBarDragItems type="small-screen" />
@ -1290,6 +1369,7 @@ const BSNavbar1 = (props) => {
} }
/> />
</div> </div>
</Suspense>
); );
}; };
export default BSNavbar1; export default BSNavbar1;

View File

@ -1,4 +1,11 @@
import React, { useEffect, useRef, useState, useCallback } from 'react'; import React, {
useEffect,
useRef,
useState,
useCallback,
lazy,
Suspense,
} from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { AiFillHome } from 'react-icons/ai'; import { AiFillHome } from 'react-icons/ai';
@ -8,14 +15,10 @@ import {
getEditFavItems, getEditFavItems,
PreferenceData, PreferenceData,
getPreferenceData, getPreferenceData,
GlobalCustId,
GlobalOrderCardDetails,
GlobalBookingType, GlobalBookingType,
GlobalBookingTypeBoth, GlobalBookingTypeBoth,
FeatureAddon,
changeCombosearch, changeCombosearch,
GlobalCombosearch, GlobalCombosearch,
Comboget,
changeEstimateBooking, changeEstimateBooking,
changeSelectedOption, changeSelectedOption,
changeSelectedCustId, changeSelectedCustId,
@ -37,23 +40,30 @@ import {
GlobalCommonPaymentOptions, GlobalCommonPaymentOptions,
GlobalSelCustId, GlobalSelCustId,
} from '../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../Features/BookingScreen/BookingData/BookingData';
import BSNavBarSearch from '../UtillComponents/BSNavBarSearch';
import BSNavBarPrinter from '../UtillComponents/BSNavBarPrinter'; const BSNavBarSearch = lazy(() => import('../UtillComponents/BSNavBarSearch'));
import BSNavBarHand from '../UtillComponents/BSNavBarHand';
import BSNavBarTable from '../UtillComponents/BSNavBarTable'; const BSNavBarHand = lazy(() => import('../UtillComponents/BSNavBarHand'));
import BSNavBarHandbag from '../UtillComponents/BSNavBarHandbag';
import BSNavBarOffer from '../UtillComponents/BSNavBarOffer/BSNavBarOffer.jsx'; const BSNavBarHandbag = lazy(
import BSNavBarAddons from '../UtillComponents/BSNavBarAddons'; () => import('../UtillComponents/BSNavBarHandbag')
import BSNavBarAddUser from '../UtillComponents/BSNavBarAddUser'; );
import BSNavBarQuickAdd from '../UtillComponents/BSNavBarQuickAdd';
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 BSNavBarWeightScale from '../UtillComponents/BSNavBarWeightScale';
import BSNavBarFavItems from '../UtillComponents/BSNavBarFavItems';
import BSNavBarPreOrder from '../../Components/UtillComponents/BSNavBarPreOrder.jsx';
import BSMembership from '../UtillComponents/BSMembership.jsx';
import '../../../../Styles/BookingScreen/Components/BSNavbar/BSNavbar2.scss';
import { clearSession, sessionStore } from '../../../../Services/Others'; import { clearSession, sessionStore } from '../../../../Services/Others';
import FeaturesFunctionalities from '../BookingFunctionality/FeaturesFunctionalities.jsx';
import BSCustomerSelect from '../UtillComponents/BSSelectCustomer.jsx';
import PozoUserIcon from '../UtillComponents/Pozo retail icons/PozoUserIcon.jsx'; import PozoUserIcon from '../UtillComponents/Pozo retail icons/PozoUserIcon.jsx';
import { import {
ApplicationPreferences, ApplicationPreferences,
@ -73,48 +83,61 @@ import {
changePreOrderAdditem, changePreOrderAdditem,
changepreOrderList, changepreOrderList,
} from '../../../../Features/BookingScreen/PreOrder/PreOrder.js'; } from '../../../../Features/BookingScreen/PreOrder/PreOrder.js';
import { DefaultModal } from '../../../../Components/Modal/DefaultModal.jsx';
import { getCustomerDisplayWindow } from '../../../../Features/customerDisplayWindow/customerDisplayWindow.js'; import { getCustomerDisplayWindow } from '../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import PozoAddCustomerIcon from '../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx'; import PozoAddCustomerIcon from '../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx';
import PaymentFailedSales from '../../../Payment/PaymentFailedDetails/PaymentFailedSales.jsx'; import PaymentFailedSales from '../../../Payment/PaymentFailedDetails/PaymentFailedSales.jsx';
import PozoComboProductIcon from '../UtillComponents/Pozo retail icons/PozoComboProductIcon.jsx';
import CustomerDisplayicon from '../UtillComponents/Pozo retail icons/PozoCustomerDisplayicon.jsx'; import CustomerDisplayicon from '../UtillComponents/Pozo retail icons/PozoCustomerDisplayicon.jsx';
import PozoPaymentFailesIcon from '../UtillComponents/Pozo retail icons/PozoFailedPaymentsIcon.jsx'; import PozoPaymentFailesIcon from '../UtillComponents/Pozo retail icons/PozoFailedPaymentsIcon.jsx';
import TooltipWrapper from '../../../../Components/Tooltip/Tooltip'; import TooltipWrapper from '../../../../Components/Tooltip/Tooltip';
import { Global_OfferStatus } from '../../../../Features/Offer/Offer.js'; import { Global_OfferStatus } from '../../../../Features/Offer/Offer.js';
import { IoMdClose } from 'react-icons/io';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import { useAuth } from '../../../../AuthContext.jsx';
import { import {
getPrintSelectionComponentData,
getTemplate, getTemplate,
getTemplateData, getTemplateData,
StoredSessionData, StoredSessionData,
} from '../../../../Features/ThemeChange/ThemeChange.js'; } from '../../../../Features/ThemeChange/ThemeChange.js';
import PozoPreOrderIcon from '../UtillComponents/Pozo retail icons/PozoPreOrderIcon.jsx'; import PozoPreOrderIcon from '../UtillComponents/Pozo retail icons/PozoPreOrderIcon.jsx';
import BSNavBarWholeSale from '../UtillComponents/BSNavBarWholeSale.jsx';
import { GlobalBookingStatus } from '../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js'; import { GlobalBookingStatus } from '../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js';
import { getEmpAccess } from '../../../../Features/AppPage/CenterPage.js';
import { useAuth } from '../../../../AuthContext.jsx';
import { TfiHandDrag } from 'react-icons/tfi';
import BSNavBarDragItems from '../UtillComponents/BSNavBarDragItems.jsx';
import { PiSignOutLight } from 'react-icons/pi';
import { import {
getUserProfile, getUserProfile,
userDataByUserId, userDataByUserId,
} from '../../../../Features/UserAccount/userData.js'; } from '../../../../Features/UserAccount/userData.js';
import { FaUserLarge } from 'react-icons/fa6';
import { BiSolidPhoneCall } from 'react-icons/bi';
import PozoSwapIcon from '../UtillComponents/Pozo retail icons/PozoSwapIcon.jsx';
import { CgSearchLoading } from 'react-icons/cg'; import { CgSearchLoading } from 'react-icons/cg';
import UserRelieveManager from '../../Template/RealivingUser.jsx';
import { FaParking } from 'react-icons/fa'; import { FaParking } from 'react-icons/fa';
import BSNavBarUserInfo from './BSNavBarUserInfo'; import BSNavBarUserInfo from './BSNavBarUserInfo';
import { OtherServicesCardlistdata } from '../../../../Features/OtherServices/OtherServices.js'; import { OtherServicesCardlistdata } from '../../../../Features/OtherServices/OtherServices.js';
import BSNavBarWholeSale from '../UtillComponents/BSNavBarWholeSale.jsx';
import BSMobilePrintSettings from '../UtillComponents/BSMobilePrintSettings.jsx'; import BSMobilePrintSettings from '../UtillComponents/BSMobilePrintSettings.jsx';
import BSScanTemplate from '../UtillComponents/BSScanTemplate.jsx'; import BSScanTemplate from '../UtillComponents/BSScanTemplate.jsx';
import VerfiedProducts from './verfiedProduct/VerfiedProducts';
import BranchName from '../../Template/BranchName.jsx';
import MultipleSearch from '../UtillComponents/MultipleSearch.jsx'; import MultipleSearch from '../UtillComponents/MultipleSearch.jsx';
import { DefaultModal } from '../../../../Components/Modal/DefaultModal.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')
);
// Scss
import '../../../../Styles/BookingScreen/Components/BSNavbar/BSNavbar2.scss';
const subDirectory = import.meta.env.ENV_BASE_URL; const subDirectory = import.meta.env.ENV_BASE_URL;
const commonUrl = import.meta.env.ENV_COMMON_BASE_URL; const commonUrl = import.meta.env.ENV_COMMON_BASE_URL;
@ -222,6 +245,18 @@ const BSNavbar2 = () => {
(item) => (item) =>
item.SettingIdName === 'VerifyProduct' && item?.SettingValue === 'Y' item.SettingIdName === 'VerifyProduct' && item?.SettingValue === 'Y'
); );
useEffect(() => {
if (!FeatureAddonData?.FeatureDtls?.length) return;
const preorderFeature = FeatureAddonData.FeatureDtls.find(
(item) => item?.FeatureAddonName?.toLowerCase() === 'preorder'
);
if (preorderFeature) {
BadgePendingApi();
}
}, [FeatureAddonData]);
useEffect(() => { useEffect(() => {
handleOtherData(); handleOtherData();
BadgePendingApi(); BadgePendingApi();
@ -258,7 +293,7 @@ const BSNavbar2 = () => {
setisisHoldEnable(filterPayCounter?.[0]?.ModeDetails?.length > 0); setisisHoldEnable(filterPayCounter?.[0]?.ModeDetails?.length > 0);
}; };
useEffect(() => { useEffect(() => {
fetchEditFavItems(); // fetchEditFavItems();
dispatch( dispatch(
getPreferenceData({ CompId: CompId, AppId: AppId, BranchId: BranchId }) getPreferenceData({ CompId: CompId, AppId: AppId, BranchId: BranchId })
); );
@ -294,27 +329,7 @@ const BSNavbar2 = () => {
setaddnewAccess(!hasAccess); setaddnewAccess(!hasAccess);
}, [empData, SAAccessCommonMaster, UserType]); }, [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 fetchEditFavItems = async () => {
let data = {
CompId: CompId,
BranchId: BranchId,
AppId: AppId,
};
await dispatch(getEditFavItems(data)).unwrap();
};
const fetchBranchData = async () => { const fetchBranchData = async () => {
if (UserType === 'Super Admin' || UserType === 'Super Admin User') { if (UserType === 'Super Admin' || UserType === 'Super Admin User') {
await dispatch( await dispatch(
@ -341,11 +356,6 @@ const BSNavbar2 = () => {
} }
}; };
const getFeatureAddonData = async () => { const getFeatureAddonData = async () => {
// let featureAddon = await dispatch(
// FeatureAddon({ AppId: AppId, UserId: UserId })
// ).unwrap();
// if (featureAddon?.data?.statusCode === 1) {
// setFeatureAddonData(featureAddon?.data?.data?.[0]?.FeatAddonHdr?.[0]);
const hasPaymentFeatures = FeatureAddonData?.FeatureDtls.some( const hasPaymentFeatures = FeatureAddonData?.FeatureDtls.some(
(item) => (item) =>
item.FeatureAddonName === 'Payment Gateway' || item.FeatureAddonName === 'Payment Gateway' ||
@ -575,8 +585,9 @@ const BSNavbar2 = () => {
}; };
return ( return (
<Suspense fallback={<div>Loading</div>}>
<div className="BSBillingNavBar2" style={{ backgroundColor: 'white' }}> <div className="BSBillingNavBar2" style={{ backgroundColor: 'white' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: '10px' }}> <div style={{ display: 'flex', alignItems: 'center', gap: '4px' }}>
<div> <div>
<Popconfirm <Popconfirm
title="Are you sure you want to go home?" title="Are you sure you want to go home?"
@ -621,7 +632,7 @@ const BSNavbar2 = () => {
</div> </div>
{/* Multiple search */} {/* Multiple search */}
<Tooltip title={'Multiple Search'}> <Tooltip title={'Multiple Search'}>
<div className="MultiSearchIconDiv2"> <div className="MultiSearchIconDiv2" style={{ margin: '0 6px' }}>
<CgSearchLoading onClick={() => setMultiple(true)} /> <CgSearchLoading onClick={() => setMultiple(true)} />
</div> </div>
</Tooltip> </Tooltip>
@ -643,27 +654,6 @@ const BSNavbar2 = () => {
{Comboglobal === true && !OtherServicesglobal && ( {Comboglobal === true && !OtherServicesglobal && (
<BSNavBarComboSearch SessionData={SessionData} /> <BSNavBarComboSearch SessionData={SessionData} />
)} )}
{/* {ComboDropDown?.length >= 1 && !OtherServicesglobal && (
<div style={{ fontSize: '1.5rem', color: 'rgb(18, 146, 238)' }}>
<TooltipWrapper title="Combo Product" isMobile={isMobile}>
<div
onClick={handleClick}
className="BSBillingNavBar1-AllIcons"
style={{
width: '1.49rem',
margin: '10px',
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
cursor: 'pointer',
}}
>
<PozoComboProductIcon
fill={Comboglobal === true ? '#52C41A' : '#1292EE'}
/>
</div>
</TooltipWrapper>
</div>
)} */}
{OpenFailData && ( {OpenFailData && (
<PaymentFailedSales <PaymentFailedSales
paymentFailedStatusFun={paymentFailedStatusFun} paymentFailedStatusFun={paymentFailedStatusFun}
@ -677,7 +667,8 @@ const BSNavbar2 = () => {
<div style={{ display: 'flex', alignItems: 'center' }}> <div style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ display: 'flex', flexGrow: '1' }}> <div style={{ display: 'flex', flexGrow: '1' }}>
<> <>
{item?.OptionName == 'RePrint' && !OtherServicesglobal && ( {item?.OptionName == 'RePrint' &&
!OtherServicesglobal && (
<TooltipWrapper <TooltipWrapper
title="RePrint (Alt+R)" title="RePrint (Alt+R)"
isMobile={isMobile} isMobile={isMobile}
@ -908,20 +899,16 @@ const BSNavbar2 = () => {
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto', pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
}} }}
> >
{/* <TfiHandDrag onClick={() => dispatch(Changedragging(!Isdragging))} style={{ color: Isdragging ? "green" : "#1292ee",fontSize:"25px" }} /> */}
<BSNavBarDragItems /> <BSNavBarDragItems />
</div> </div>
</> </>
)} )}
{FeatureAddonData?.FeatureDtls?.find( {FeatureAddonData?.FeatureDtls?.find(
(item) => item?.FeatureAddonName?.toLowerCase() === 'customer display' (item) =>
item?.FeatureAddonName?.toLowerCase() === 'customer display'
) && ( ) && (
<TooltipWrapper title="Customer Display" isMobile={isMobile}> <TooltipWrapper title="Customer Display" isMobile={isMobile}>
{/* <div onClick={openNewTab} style={{ display: "flex", alignItems: "center", cursor: "pointer" }} className="BSBillingNavBar2-AllIcons">
<FaDisplay />
</div> */}
<div <div
onClick={openNewTab} onClick={openNewTab}
className="BSBillingNavBar1-AllIcons" className="BSBillingNavBar1-AllIcons"
@ -975,11 +962,16 @@ const BSNavbar2 = () => {
<div <div
style={{ fontSize: '1.5rem', color: 'rgb(18, 146, 238)' }} style={{ fontSize: '1.5rem', color: 'rgb(18, 146, 238)' }}
> >
<TooltipWrapper title="Other Services" isMobile={isMobile}> <TooltipWrapper
title="Other Services"
isMobile={isMobile}
>
<div onClick={handleotherservices}> <div onClick={handleotherservices}>
<FaParking <FaParking
fill={ fill={
OtherServicesglobal === true ? '#52C41A' : '#1292EE' OtherServicesglobal === true
? '#52C41A'
: '#1292EE'
} }
/> />
</div> </div>
@ -1016,7 +1008,8 @@ const BSNavbar2 = () => {
)} */} )} */}
{navbarOptions?.map((item) => ( {navbarOptions?.map((item) => (
<> <>
{item?.OptionName == 'RePrint' && !OtherServicesglobal && ( {item?.OptionName == 'RePrint' &&
!OtherServicesglobal && (
<div <div
style={{ style={{
pointerEvents: pointerEvents:
@ -1151,7 +1144,8 @@ const BSNavbar2 = () => {
<> <>
{FeatureAddonData?.FeatureDtls?.find( {FeatureAddonData?.FeatureDtls?.find(
(item) => (item) =>
item?.FeatureAddonName?.toLowerCase() === 'Weight Scale' item?.FeatureAddonName?.toLowerCase() ===
'Weight Scale'
) && ( ) && (
<div <div
style={{ style={{
@ -1166,7 +1160,8 @@ const BSNavbar2 = () => {
<> <>
{FeatureAddonData?.FeatureDtls?.find( {FeatureAddonData?.FeatureDtls?.find(
(item) => (item) =>
item?.FeatureAddonName?.toLowerCase() === 'preorder' item?.FeatureAddonName?.toLowerCase() ===
'preorder'
) && ( ) && (
<div <div
style={{ style={{
@ -1238,7 +1233,8 @@ const BSNavbar2 = () => {
)} )}
<div <div
style={{ style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto', pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}} }}
> >
<BSNavBarDragItems type="small-screen" /> <BSNavBarDragItems type="small-screen" />
@ -1334,6 +1330,7 @@ const BSNavbar2 = () => {
} }
/> />
</div> </div>
</Suspense>
); );
}; };
export default BSNavbar2; export default BSNavbar2;

View File

@ -1,4 +1,12 @@
import { useState, useEffect, useRef, useCallback, useMemo } from 'react'; import {
useState,
useEffect,
useRef,
useCallback,
useMemo,
lazy,
Suspense,
} from 'react';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { useDispatch, useSelector, shallowEqual } from 'react-redux'; import { useDispatch, useSelector, shallowEqual } from 'react-redux';
import { import {
@ -38,7 +46,6 @@ import '../../../../Styles/BookingScreen/Components/BSNavbar/BSNavbar3.scss';
// UI Imports // UI Imports
import { Badge, Popconfirm, Tooltip } from 'antd'; import { Badge, Popconfirm, Tooltip } from 'antd';
import { AiFillHome } from 'react-icons/ai'; import { AiFillHome } from 'react-icons/ai';
import { GoClockFill } from 'react-icons/go';
import { import {
FaPlus, FaPlus,
FaHandPaper, FaHandPaper,
@ -48,30 +55,23 @@ import {
FaParking, FaParking,
} from 'react-icons/fa'; } from 'react-icons/fa';
import { CiMenuBurger } from 'react-icons/ci'; import { CiMenuBurger } from 'react-icons/ci';
import { IoClose, IoCloseOutline } from 'react-icons/io5'; import { IoCloseOutline } from 'react-icons/io5';
import { FaCalendar } from 'react-icons/fa6';
import { import {
RiFullscreenExitFill, RiFullscreenExitFill,
RiFullscreenFill, RiFullscreenFill,
RiPrinterFill, RiPrinterFill,
} from 'react-icons/ri'; } from 'react-icons/ri';
import { GiShoppingBag } from 'react-icons/gi'; import { GiShoppingBag } from 'react-icons/gi';
import { PiSignOutFill } from 'react-icons/pi'; const BSNavBarAddUser = lazy(
import { TfiHandDrag } from 'react-icons/tfi'; () => import('../UtillComponents/BSNavBarAddUser.jsx')
import { CgClose } from 'react-icons/cg'; );
const BSCustomerSelect = lazy(
import { DropDowns } from '../../../../Components/Forms/DropDown'; () => import('../UtillComponents/BSSelectCustomer.jsx')
import PozoDineInIcon from '../UtillComponents/Pozo retail icons/PozoDineIn.jsx'; );
import BSNavBarFavItems from '../UtillComponents/BSNavBarFavItems.jsx'; const FeaturesFunctionalities = lazy(
import BSNavBarAddUser from '../UtillComponents/BSNavBarAddUser.jsx'; () => import('../BookingFunctionality/FeaturesFunctionalities.jsx')
import BSCustomerSelect from '../UtillComponents/BSSelectCustomer.jsx'; );
import FeaturesFunctionalities from '../BookingFunctionality/FeaturesFunctionalities.jsx';
import BSNavBarHand from '../UtillComponents/BSNavBarHand.jsx';
import BSNavBarDragItems from '../UtillComponents/BSNavBarDragItems.jsx';
import CustomerDisplayicon from '../UtillComponents/Pozo retail icons/PozoCustomerDisplayicon.jsx'; import CustomerDisplayicon from '../UtillComponents/Pozo retail icons/PozoCustomerDisplayicon.jsx';
import BSNavBarPrinter from '../UtillComponents/BSNavBarPrinter.jsx';
import BSNavBarUserInfo from './BSNavBarUserInfo.jsx';
import { import {
getUserProfile, getUserProfile,
userDataByUserId, userDataByUserId,
@ -81,8 +81,6 @@ import {
getSession, getSession,
sessionStore, sessionStore,
} from '../../../../Services/Others.js'; } from '../../../../Services/Others.js';
import UserRelieveManager from '../../Template/RealivingUser.jsx';
import BSNavbarSearchStandard from '../UtillComponents/BSNavbarSearchStandard.jsx';
import { import {
getTemplate, getTemplate,
getTemplateData, getTemplateData,
@ -92,22 +90,12 @@ import {
CurrentTimeDisplay, CurrentTimeDisplay,
CurrentDateDisplay, CurrentDateDisplay,
} from '../UtillComponents/CurrentDateTimeDisplay.jsx'; } from '../UtillComponents/CurrentDateTimeDisplay.jsx';
import BSPrinterSetting from '../UtillComponents/BSPrinterSetting.jsx';
import BSNavBarTable from '../UtillComponents/BSNavBarTable.jsx';
import TooltipWrapper from '../../../../Components/Tooltip/Tooltip.jsx'; import TooltipWrapper from '../../../../Components/Tooltip/Tooltip.jsx';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import { import {
getCustomerDisplayWindow, getCustomerDisplayWindow,
setCustomerDisplayWindow, setCustomerDisplayWindow,
} from '../../../../Features/customerDisplayWindow/customerDisplayWindow.js'; } from '../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import BSMobilePrintSettings from '../UtillComponents/BSMobilePrintSettings.jsx';
import BSScanTemplate from '../UtillComponents/BSScanTemplate.jsx';
import VerfiedProducts from './verfiedProduct/VerfiedProducts.jsx';
import BSMembership from '../UtillComponents/BSMembership.jsx';
import BranchName from '../../Template/BranchName.jsx';
import BSNavBarAddons from '../UtillComponents/BSNavBarAddons.jsx';
import BSNavBarOffer from '../UtillComponents/BSNavBarOffer/BSNavBarOffer.jsx';
import BSNavBarQuickAdd from '../UtillComponents/BSNavBarQuickAdd.jsx';
import BSNavBarPreOrder from '../UtillComponents/BSNavBarPreOrder.jsx'; import BSNavBarPreOrder from '../UtillComponents/BSNavBarPreOrder.jsx';
import { import {
changepreOrder, changepreOrder,
@ -126,6 +114,49 @@ import { CgSearchLoading } from 'react-icons/cg';
import { DefaultModal } from '../../../../Components/Modal/DefaultModal.jsx'; import { DefaultModal } from '../../../../Components/Modal/DefaultModal.jsx';
import MultipleSearch from '../UtillComponents/MultipleSearch.jsx'; import MultipleSearch from '../UtillComponents/MultipleSearch.jsx';
// 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 subDirectory = import.meta.env.ENV_BASE_URL;
const commonUrl = import.meta.env.ENV_COMMON_BASE_URL; const commonUrl = import.meta.env.ENV_COMMON_BASE_URL;
@ -156,6 +187,7 @@ const BSNavbar3 = ({ optionNames }) => {
const [isUserAccOpen, setIsUserAccOpen] = useState(false); const [isUserAccOpen, setIsUserAccOpen] = useState(false);
const [quickAdd, setQuickAdd] = useState(false); const [quickAdd, setQuickAdd] = useState(false);
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false); const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
const [isFullscreen, setIsFullscreen] = useState(false); const [isFullscreen, setIsFullscreen] = useState(false);
const [multiple, setMultiple] = useState(false); const [multiple, setMultiple] = useState(false);
const GlobEstBooking = useSelector(GlobalEstimateBooking); const GlobEstBooking = useSelector(GlobalEstimateBooking);
@ -563,6 +595,7 @@ const BSNavbar3 = ({ optionNames }) => {
}; };
return ( return (
<Suspense fallback={<div>Loading</div>}>
<> <>
<div className="BSNavbar3Main"> <div className="BSNavbar3Main">
<div className="homeTime"> <div className="homeTime">
@ -597,7 +630,9 @@ const BSNavbar3 = ({ optionNames }) => {
justifyContent: 'center', justifyContent: 'center',
cursor: 'pointer', cursor: 'pointer',
}} }}
fill={OtherServicesglobal === true ? '#52C41A' : '#1292EE'} fill={
OtherServicesglobal === true ? '#52C41A' : '#1292EE'
}
/> />
</div> </div>
</TooltipWrapper> </TooltipWrapper>
@ -621,6 +656,7 @@ const BSNavbar3 = ({ optionNames }) => {
)} )}
{/* Customer Select - Always visible */} {/* Customer Select - Always visible */}
{addCustomerOption && (
<div className="DropDownsCustomer always-visible"> <div className="DropDownsCustomer always-visible">
<BSCustomerSelect <BSCustomerSelect
placeholder="Customer Name" placeholder="Customer Name"
@ -631,8 +667,8 @@ const BSNavbar3 = ({ optionNames }) => {
{renderWithTooltip(<BSNavBarAddUser />, 'Add Customer')} {renderWithTooltip(<BSNavBarAddUser />, 'Add Customer')}
</span> </span>
)} )}
{/* <IoClose className="DropDownsCustomerClose" strokeWidth={3} /> */}
</div> </div>
)}
{offerOption && ( {offerOption && (
<div className="standard-extra-charges"> <div className="standard-extra-charges">
@ -675,12 +711,6 @@ const BSNavbar3 = ({ optionNames }) => {
)} )}
{/* Desktop CustomerActions */} {/* Desktop CustomerActions */}
<div className="CustomerActions desktop-only"> <div className="CustomerActions desktop-only">
{/* {(takeAwayPreference && takeAwayOption) && renderWithTooltip(
<GiShoppingBag size={43} className="FaTruckIcon" color={bookingType === 'TakeAway' ? '#52c41a' :
'#6b7280'} onClick={handleTakeAway} />, 'Takeaway')}
{(dineInPreference && dineIn && dineInOption) && renderWithTooltip(
<PozoDineInIcon width='40' height='40' className="FaTruckIcon" onClick={handleDineInNavigate} />, 'Dine-in')} */}
{dineInPreference && dineIn && dineInOption && ( {dineInPreference && dineIn && dineInOption && (
<div className="mobile-action-item"> <div className="mobile-action-item">
<BSNavBarTable /> <BSNavBarTable />
@ -761,7 +791,10 @@ const BSNavbar3 = ({ optionNames }) => {
)} )}
{!sportsAppPreference && ( {!sportsAppPreference && (
<div className="FaTruckIconFavItem" style={{ padding: '4px 6px' }}> <div
className="FaTruckIconFavItem"
style={{ padding: '4px 6px' }}
>
{renderWithTooltip( {renderWithTooltip(
<BSNavBarFavItems <BSNavBarFavItems
size={41} size={41}
@ -772,14 +805,6 @@ const BSNavbar3 = ({ optionNames }) => {
)} )}
</div> </div>
)} )}
{/*
{!sportsAppPreference &&
quickAddOption &&
renderWithTooltip(
<FaPlus className="FaTruckIcon" onClick={handleQuickAddOpen} />,
'QUICK ADD (SHIFT + Q)'
)} */}
{holdOption && {holdOption &&
((bookingType !== 'Dine In' && OrderCardDetail?.length != 0) || ((bookingType !== 'Dine In' && OrderCardDetail?.length != 0) ||
(bookingType !== 'Dine In' && (bookingType !== 'Dine In' &&
@ -797,7 +822,9 @@ const BSNavbar3 = ({ optionNames }) => {
{ScanLayoutScreen?.SettingValue === 'Y' && <BSScanTemplate />} {ScanLayoutScreen?.SettingValue === 'Y' && <BSScanTemplate />}
<div <div
className="FaTruckIconDragItems" className="FaTruckIconDragItems"
style={{ pointerEvents: orderType === 'Failed' ? 'none' : 'auto' }} style={{
pointerEvents: orderType === 'Failed' ? 'none' : 'auto',
}}
> >
<BSNavBarDragItems /> <BSNavBarDragItems />
</div> </div>
@ -866,7 +893,9 @@ const BSNavbar3 = ({ optionNames }) => {
<Tooltip title={isFullscreen ? 'Exit Full Screen' : 'Full Screen'}> <Tooltip title={isFullscreen ? 'Exit Full Screen' : 'Full Screen'}>
<div <div
className={ className={
isFullscreen ? 'BsNavbar3FullScreenExit' : 'BsNavbar3FullScreen' isFullscreen
? 'BsNavbar3FullScreenExit'
: 'BsNavbar3FullScreen'
} }
onClick={handleFullscreen} onClick={handleFullscreen}
> >
@ -971,7 +1000,10 @@ const BSNavbar3 = ({ optionNames }) => {
</div> </div>
)} )}
{quickAddOption && ( {quickAddOption && (
<div className="mobile-action-item" onClick={handleQuickAddOpen}> <div
className="mobile-action-item"
onClick={handleQuickAddOpen}
>
{renderWithTooltip(<FaPlus size={30} />, 'Quick Add', 'top')} {renderWithTooltip(<FaPlus size={30} />, 'Quick Add', 'top')}
<div>Quick Add</div> <div>Quick Add</div>
</div> </div>
@ -1070,7 +1102,10 @@ const BSNavbar3 = ({ optionNames }) => {
} }
}} }}
> >
<TooltipWrapper title={'Verfied Products'} isMobile={isMobile}> <TooltipWrapper
title={'Verfied Products'}
isMobile={isMobile}
>
<div> <div>
<VerfiedProducts <VerfiedProducts
drawerOpen={drawerOpen} drawerOpen={drawerOpen}
@ -1134,7 +1169,8 @@ const BSNavbar3 = ({ optionNames }) => {
<div <div
className="BSBillingNavBar2-AllIcons" className="BSBillingNavBar2-AllIcons"
style={{ style={{
pointerEvents: orderType === 'Failed' ? 'none' : 'auto', pointerEvents:
orderType === 'Failed' ? 'none' : 'auto',
}} }}
> >
<div className="mobile-action-item" onClick={() => {}}> <div className="mobile-action-item" onClick={() => {}}>
@ -1199,6 +1235,7 @@ const BSNavbar3 = ({ optionNames }) => {
/> />
)} )}
</> </>
</Suspense>
); );
}; };

View File

@ -1,4 +1,11 @@
import { useEffect, useRef, useState, useCallback } from 'react'; import {
useEffect,
useRef,
useState,
useCallback,
Suspense,
lazy,
} from 'react';
import { shallowEqual, useDispatch, useSelector } from 'react-redux'; import { shallowEqual, useDispatch, useSelector } from 'react-redux';
import { import {
getConfigType, getConfigType,
@ -43,13 +50,17 @@ import {
validateSafeInput, validateSafeInput,
} from '../../../../Services/Others.js'; } from '../../../../Services/Others.js';
import WpIcon from '../../../../Images/message.png'; import WpIcon from '../../../../Images/message.png';
import QrinScreen from '../BookingFunctionality/DynamicScreenQr.jsx'; const QrinScreen = lazy(
() => import('../BookingFunctionality/DynamicScreenQr.jsx')
);
import { import {
getTemplateData, getTemplateData,
SelectedPrintTemplate, SelectedPrintTemplate,
} from '../../../../Features/ThemeChange/ThemeChange.js'; } from '../../../../Features/ThemeChange/ThemeChange.js';
import '../../../../Styles/BookingScreen/Components/BookingFunctionality/SplitPayment.scss'; import '../../../../Styles/BookingScreen/Components/BookingFunctionality/SplitPayment.scss';
import FeaturesFunctionalities from './FeaturesFunctionalities.jsx'; const FeaturesFunctionalities = lazy(
() => import('./FeaturesFunctionalities.jsx')
);
import numberToWords from 'number-to-words'; import numberToWords from 'number-to-words';
import { getCustomerDisplayWindow } from '../../../../Features/customerDisplayWindow/customerDisplayWindow.js'; import { getCustomerDisplayWindow } from '../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import { getConfigTypeData } from '../../../../Features/ConfigMasterPage/ConfigMasterPage.js'; import { getConfigTypeData } from '../../../../Features/ConfigMasterPage/ConfigMasterPage.js';
@ -1241,6 +1252,7 @@ const CreditCustSplitPayment = (props) => {
: 'Debit amount not available'; : 'Debit amount not available';
return ( return (
<Suspense fallback={<div>Loading features...</div>}>
<> <>
<Messages messageType={messageType} messageData={messageData} /> <Messages messageType={messageType} messageData={messageData} />
<div className="splitmodal"> <div className="splitmodal">
@ -1374,6 +1386,7 @@ const CreditCustSplitPayment = (props) => {
</div> </div>
)} )}
</> </>
</Suspense>
); );
}; };
export default CreditCustSplitPayment; export default CreditCustSplitPayment;

View File

@ -4,6 +4,7 @@ import React, {
useEffect, useEffect,
useCallback, useCallback,
useContext, useContext,
lazy,
} from 'react'; } from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { import {
@ -16,7 +17,6 @@ import {
Checkbox, Checkbox,
AutoComplete, AutoComplete,
Switch, Switch,
Tooltip,
Popconfirm, Popconfirm,
Tabs, Tabs,
} from 'antd'; } from 'antd';
@ -58,7 +58,6 @@ import {
ChangeOverAllDiscSales, ChangeOverAllDiscSales,
PreferenceData, PreferenceData,
ChangeComboCarddata, ChangeComboCarddata,
getPreferenceData,
getCustomerForHold, getCustomerForHold,
PostBlockSlots, PostBlockSlots,
} from '../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../Features/BookingScreen/BookingData/BookingData';
@ -68,7 +67,6 @@ import { ArrowRightOutlined, CloseSquareFilled } from '@ant-design/icons';
import { InputField } from '../../../../Components/Forms/InputField'; import { InputField } from '../../../../Components/Forms/InputField';
import { Messages } from '../../../../Components/Notifications/Messages'; import { Messages } from '../../../../Components/Notifications/Messages';
import Buttons from '../../../../Components/Forms/Buttons'; import Buttons from '../../../../Components/Forms/Buttons';
import ProductForm from '../../../../Pages/BookingScreen/Forms/QuickAdd/QuickAdd.jsx';
import { import {
GlobalAddCustomerDetails, GlobalAddCustomerDetails,
getAddCustomerDetails, getAddCustomerDetails,
@ -86,7 +84,6 @@ import {
ChangeTotalAmount, ChangeTotalAmount,
globalExtraTotalAmount, globalExtraTotalAmount,
} from '../../../../Features/ExteraCharges/ExtraCharges.js'; } from '../../../../Features/ExteraCharges/ExtraCharges.js';
import WeightScaleComp from '../../../../Components/WeightScale/weightScale.jsx';
import { import {
gettinghold, gettinghold,
puttinghold, puttinghold,
@ -98,7 +95,6 @@ import {
getProductsearch, getProductsearch,
} from '../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../Features/BookingScreen/BookingData/BookingData';
import { AiOutlineDownCircle, AiOutlineUpCircle } from 'react-icons/ai'; import { AiOutlineDownCircle, AiOutlineUpCircle } from 'react-icons/ai';
import '../../../../Styles/BookingScreen/Components/BookingFunctionality/FeaturesFunctionalities.scss';
import { import {
IoCloseSharp, IoCloseSharp,
IoPersonAddSharp, IoPersonAddSharp,
@ -111,7 +107,6 @@ import {
GlobalPreOrderList, GlobalPreOrderList,
GlobalpreOrderOpen, GlobalpreOrderOpen,
} from '../../../../Features/BookingScreen/PreOrder/PreOrder.js'; } from '../../../../Features/BookingScreen/PreOrder/PreOrder.js';
import Imageupload from '../../../../Components/Forms/Upload.jsx';
import { useApplyOfferto_CardDetail } from '../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx'; import { useApplyOfferto_CardDetail } from '../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import { getCombolist } from '../../../../Features/ComboMaster/ComboMaster.js'; import { getCombolist } from '../../../../Features/ComboMaster/ComboMaster.js';
import { import {
@ -122,9 +117,21 @@ import {
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin.js'; import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin.js';
import { useDateStore } from '../../../../Features/BookingScreen/BookingData/DateStore.js'; import { useDateStore } from '../../../../Features/BookingScreen/BookingData/DateStore.js';
import { FaEdit, FaMapMarkedAlt, FaTrash } from 'react-icons/fa'; import { FaEdit, FaTrash } from 'react-icons/fa';
import { MdHome, MdLocationOn } from 'react-icons/md'; import { MdHome, MdLocationOn } from 'react-icons/md';
import { RadioGrpButton } from '../../../../Components/Forms/RadioGroup.jsx'; import { RadioGrpButton } from '../../../../Components/Forms/RadioGroup.jsx';
// jsx Files
const ProductForm = lazy(
() => import('../../../../Pages/BookingScreen/Forms/QuickAdd/QuickAdd.jsx')
);
const WeightScaleComp = lazy(
() => import('../../../../Components/WeightScale/weightScale.jsx')
);
const Imageupload = lazy(
() => import('../../../../Components/Forms/Upload.jsx')
);
// Scss
import '../../../../Styles/BookingScreen/Components/BookingFunctionality/FeaturesFunctionalities.scss';
const FeaturesFunctionalities = (props) => { const FeaturesFunctionalities = (props) => {
const { closeModal = () => {} } = props; const { closeModal = () => {} } = props;
@ -141,7 +148,6 @@ const FeaturesFunctionalities = (props) => {
const formRefExtraCharges = useRef(); const formRefExtraCharges = useRef();
const ExtraChargesType = useSelector(globalExtraChargesType); const ExtraChargesType = useSelector(globalExtraChargesType);
const GlobalExtraCharge = useSelector(globalExtraTotalAmount); const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
console.log(GlobalExtraCharge, "GlobalExtraCharge")
const ReorderHoldDetails = useSelector(GlobalReorderHoldDetails); const ReorderHoldDetails = useSelector(GlobalReorderHoldDetails);
const BookingType = useSelector(GlobalBookingType); const BookingType = useSelector(GlobalBookingType);
const BookingTypeBoth = useSelector(GlobalBookingTypeBoth); const BookingTypeBoth = useSelector(GlobalBookingTypeBoth);
@ -582,12 +588,6 @@ const FeaturesFunctionalities = (props) => {
useEffect(() => { useEffect(() => {
setWeightScale(props.WeightScale); setWeightScale(props.WeightScale);
}, [props.WeightScale]); }, [props.WeightScale]);
// useEffect(() => {
// if (!props.addcustomer) {
// formRef.current?.resetFields();
// setZipCodeData(false);
// }
// }, [props.addcustomer]);
const ExtTabledata = async () => { const ExtTabledata = async () => {
const data = { const data = {
CompId: CompId, CompId: CompId,
@ -1194,11 +1194,6 @@ const FeaturesFunctionalities = (props) => {
), ),
}, },
]; ];
console.log(ReorderHoldDetails,
BookingType,
GlobalExtraCharge, "GlobalExtraCharge");
const defaultColumns1 = [ const defaultColumns1 = [
{ {
title: 'ExtraCharge Type', title: 'ExtraCharge Type',
@ -3316,7 +3311,9 @@ const FeaturesFunctionalities = (props) => {
<Popconfirm <Popconfirm
title="Remove Address" title="Remove Address"
description="Are you sure you want to remove this address?" description="Are you sure you want to remove this address?"
onConfirm={() => handleRemoveAddress(idx)} onConfirm={() =>
handleRemoveAddress(idx)
}
okText="Yes, Remove" okText="Yes, Remove"
cancelText="Cancel" cancelText="Cancel"
okType="danger" okType="danger"
@ -3921,7 +3918,7 @@ const FeaturesFunctionalities = (props) => {
onChange={setActiveTab} onChange={setActiveTab}
items={[ items={[
{ key: 'quickAdd', label: 'Quick Add' }, { key: 'quickAdd', label: 'Quick Add' },
{ key: 'directSale', label: 'Direct Sale' } { key: 'directSale', label: 'Direct Sale' },
]} ]}
/> />
<ProductForm <ProductForm

View File

@ -1,6 +1,28 @@
import { useEffect, useRef, useState, useCallback } from 'react'; import {
useEffect,
useRef,
useState,
useCallback,
lazy,
Suspense,
} from 'react';
import { shallowEqual, useDispatch, useSelector } from 'react-redux'; import { shallowEqual, useDispatch, useSelector } from 'react-redux';
import moment from 'moment'; import moment from 'moment';
import { Form, Radio } from 'antd';
import {
ArrowRightOutlined,
CheckCircleOutlined,
CloseCircleOutlined,
PlusOutlined,
} from '@ant-design/icons';
import { InputField } from '../../../../Components/Forms/InputField';
import { DefaultModal } from '../../../../Components/Modal/DefaultModal.jsx';
import { DropDowns } from '../../../../Components/Forms/DropDown.jsx';
import Buttons from '../../../../Components/Forms/Buttons';
import { Messages } from '../../../../Components/Notifications/Messages';
import { isMobile } from 'react-device-detect';
// Js files
import { import {
getConfigType, getConfigType,
GlobalCommonPaymentOptions, GlobalCommonPaymentOptions,
@ -58,54 +80,61 @@ import {
putSalesBillEdit, putSalesBillEdit,
changeBillEditingMode, changeBillEditingMode,
changePreviousOrderPayment, changePreviousOrderPayment,
changePreviousOrderOfferDetail changePreviousOrderOfferDetail,
GlobalAllBookingType,
} from '../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../Features/BookingScreen/BookingData/BookingData';
import { Form, Radio } from 'antd';
import {
ArrowRightOutlined,
CheckCircleOutlined,
CloseCircleOutlined,
PlusOutlined,
} from '@ant-design/icons';
import { InputField } from '../../../../Components/Forms/InputField';
import { DefaultModal } from '../../../../Components/Modal/DefaultModal.jsx';
import { DropDowns } from '../../../../Components/Forms/DropDown.jsx';
import Buttons from '../../../../Components/Forms/Buttons';
import QrComponent from '../BookingFunctionality/DynamicQr.jsx';
import { Messages } from '../../../../Components/Notifications/Messages';
import { import {
extractLastNumberOrderId, extractLastNumberOrderId,
getSession, getSession,
printDiv, printDiv,
validateSafeInput, validateSafeInput,
} from '../../../../Services/Others.js'; } from '../../../../Services/Others.js';
import WpIcon from '../../../../Images/message.png';
import { import {
ChangeTotalAmount, ChangeTotalAmount,
globalExtraTotalAmount, globalExtraTotalAmount,
} from '../../../../Features/ExteraCharges/ExtraCharges.js'; } from '../../../../Features/ExteraCharges/ExtraCharges.js';
import QrinScreen from '../BookingFunctionality/DynamicScreenQr.jsx';
import PaymentPdfBooking from '../../../paymentpdfPage/PaymentPdfBooking.jsx';
import { isMobile } from 'react-device-detect';
import { PrintStyleFunction } from '../../../paymentpdfPage/PrintStyleFunction.js'; import { PrintStyleFunction } from '../../../paymentpdfPage/PrintStyleFunction.js';
import { import {
getTemplateData, getTemplateData,
GlobalprintDatas, GlobalprintDatas,
SelectedPrintTemplate, SelectedPrintTemplate,
} from '../../../../Features/ThemeChange/ThemeChange.js'; } from '../../../../Features/ThemeChange/ThemeChange.js';
import '../../../../Styles/BookingScreen/Components/BookingFunctionality/SplitPayment.scss';
import BsBillingCreditCustomer from '../BookingFunctionality/BSBillingCreditCustomer.jsx';
import MobilePrint from '../BookingFunctionality/MobilePrint.jsx';
import FeaturesFunctionalities from './FeaturesFunctionalities.jsx';
import TokensinglePrint from '../../../paymentpdfPage/TokenOnlyPrints/TokeninsinglePrint.jsx';
import TokenOnlyMobilePrint from './TokenOnlyMobilePrint.jsx';
import AllProductTokenMobilePrint from './AllProductTokenMobilePrint.jsx';
import { getCustomerDisplayWindow } from '../../../../Features/customerDisplayWindow/customerDisplayWindow.js'; import { getCustomerDisplayWindow } from '../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import { gettinghold } from '../../../../Features/BookingScreen/HoldOption/HoldOption.js'; import { gettinghold } from '../../../../Features/BookingScreen/HoldOption/HoldOption.js';
import { Global_OrderOfferDetail } from '../../../../Features/Offer/Offer.js'; import { Global_OrderOfferDetail } from '../../../../Features/Offer/Offer.js';
import { useApplyOfferto_CardDetail } from '../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin.js'; import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin.js';
import { ChangeFullFreeProductList, changeFullOfferAppliedProducts, GlobalOfferAppliedProducts } from '../../../../Features/Offer/Offernew/BookingOffernew.js'; import {
ChangeFullFreeProductList,
changeFullOfferAppliedProducts,
GlobalOfferAppliedProducts,
} from '../../../../Features/Offer/Offernew/BookingOffernew.js';
// jsx
const QrinScreen = lazy(
() => import('../BookingFunctionality/DynamicScreenQr.jsx')
);
const MobilePrint = lazy(
() => import('../BookingFunctionality/MobilePrint.jsx')
);
const FeaturesFunctionalities = lazy(
() => import('./FeaturesFunctionalities.jsx')
);
const PaymentPdfBooking = lazy(
() => import('../../../paymentpdfPage/PaymentPdfBooking.jsx')
);
const BsBillingCreditCustomer = lazy(
() => import('../BookingFunctionality/BSBillingCreditCustomer.jsx')
);
const TokensinglePrint = lazy(
() => import('../../../paymentpdfPage/TokenOnlyPrints/TokeninsinglePrint.jsx')
);
const QrComponent = lazy(() => import('../BookingFunctionality/DynamicQr.jsx'));
import { useApplyOfferto_CardDetail } from '../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
// Style and Icon
import '../../../../Styles/BookingScreen/Components/BookingFunctionality/SplitPayment.scss';
import WpIcon from '../../../../Images/message.png';
const subDirectory = import.meta.env.BASE_URL; const subDirectory = import.meta.env.BASE_URL;
const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL; const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
@ -119,12 +148,13 @@ const SplitPayment = (props) => {
const AppId = getSession('AppId'); const AppId = getSession('AppId');
const UserId = getSession('UserId'); const UserId = getSession('UserId');
const appPreferences = useSelector(ApplicationPreferences); const appPreferences = useSelector(ApplicationPreferences);
const AllBookingType = useSelector(GlobalAllBookingType);
const applyOffer = useApplyOfferto_CardDetail(); const applyOffer = useApplyOfferto_CardDetail();
const globalTipAmount = useSelector(GlobaltipAmount); const globalTipAmount = useSelector(GlobaltipAmount);
const TotalNetAmount = (props.hasOwnProperty('TotalNetAmount') const TotalNetAmount = props.hasOwnProperty('TotalNetAmount')
? props['TotalNetAmount'] ? props['TotalNetAmount']
: null); : null;
const TableOrderId = props.hasOwnProperty('TableBookingOrderId') const TableOrderId = props.hasOwnProperty('TableBookingOrderId')
? props['TableBookingOrderId'] ? props['TableBookingOrderId']
: null; : null;
@ -138,10 +168,16 @@ const SplitPayment = (props) => {
const SelCustId = useSelector(GlobalSelCustId); const SelCustId = useSelector(GlobalSelCustId);
const salesBillEdit = useSelector(GlobalSalesBillEdit); const salesBillEdit = useSelector(GlobalSalesBillEdit);
const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); const previousOrderOfferDetails = useSelector(
GlobalPreviousOrderOfferDetails
);
const filteredPayments = const filteredPayments =
previousOrderPayment?.filter( previousOrderPayment?.filter(
p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment (p) =>
p?.LastOrderTran === 'Y' &&
p?.AfterAdjustment != null &&
p?.AfterAdjustment !== '' &&
p?.AfterAdjustment
) || []; ) || [];
const paymentsToUse = const paymentsToUse =
filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || [];
@ -150,7 +186,8 @@ const SplitPayment = (props) => {
0 0
); );
const totalPreviouspayment = paymentsToUse?.reduce( const totalPreviouspayment = paymentsToUse?.reduce(
(acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), (acc, payment) =>
acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
0 0
); );
const [paybtns, setpaybtns] = useState([]); const [paybtns, setpaybtns] = useState([]);
@ -193,7 +230,11 @@ const SplitPayment = (props) => {
const OverAllSales = useSelector(GlobalOverAllDiscSales); const OverAllSales = useSelector(GlobalOverAllDiscSales);
const OverAllEstimate = useSelector(GlobalOverAllDiscEstimate); const OverAllEstimate = useSelector(GlobalOverAllDiscEstimate);
const printDatas = useSelector(GlobalprintDatas); const printDatas = useSelector(GlobalprintDatas);
const allowDecimal = SettingDataSelector?.[0]?.SettingDtlDetails?.find((setting) => setting?.SettingIdName?.toLowerCase() === "decimal" && setting?.SettingValue === 'Y'); const allowDecimal = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
(setting) =>
setting?.SettingIdName?.toLowerCase() === 'decimal' &&
setting?.SettingValue === 'Y'
);
const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter( const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
(i) => i.SettingIdName === 'PrintUom' (i) => i.SettingIdName === 'PrintUom'
)?.[0]; )?.[0];
@ -223,7 +264,7 @@ const SplitPayment = (props) => {
(item) => item?.OptionName == 'Offer' (item) => item?.OptionName == 'Offer'
); );
const [TotalAmount, setTotalAmount] = useState(0); const [TotalAmount, setTotalAmount] = useState(0);
console.log(TotalAmount, "TotalSplitAmount", TotalSplitAmount) console.log(TotalAmount, 'TotalSplitAmount', TotalSplitAmount);
const preferenceOffer = const preferenceOffer =
SettingDataSelector?.[0]?.['SettingDtlDetails']?.find( SettingDataSelector?.[0]?.['SettingDtlDetails']?.find(
(item) => item.SettingIdName === 'Offer' (item) => item.SettingIdName === 'Offer'
@ -237,9 +278,8 @@ const SplitPayment = (props) => {
}, []); }, []);
useEffect(() => { useEffect(() => {
if (salesBillEdit) { if (salesBillEdit) {
const previousNetAmount = (totalPreviouspayment || 0); const previousNetAmount = totalPreviouspayment || 0;
if (TotalNetAmount > previousNetAmount) { if (TotalNetAmount > previousNetAmount) {
setTotalAmount(TotalNetAmount - previousNetAmount); setTotalAmount(TotalNetAmount - previousNetAmount);
} else { } else {
@ -248,8 +288,7 @@ const SplitPayment = (props) => {
} else { } else {
setTotalAmount(TotalNetAmount); setTotalAmount(TotalNetAmount);
} }
}, [totalPreviousOfferAmount, totalPreviouspayment, TotalNetAmount]);
}, [totalPreviousOfferAmount, totalPreviouspayment, TotalNetAmount])
useEffect(() => { useEffect(() => {
if (SelCustId) { if (SelCustId) {
@ -272,7 +311,7 @@ const SplitPayment = (props) => {
}, [Splitpayment]); }, [Splitpayment]);
useEffect(() => { useEffect(() => {
const totalPayAmount = Object.keys(SplitSelPayMode) const totalPayAmount = Object.keys(SplitSelPayMode)
.filter(key => key.startsWith('PayAmount-')) .filter((key) => key.startsWith('PayAmount-'))
.reduce((sum, key) => { .reduce((sum, key) => {
const value = parseInt(SplitSelPayMode[key], 10); const value = parseInt(SplitSelPayMode[key], 10);
return sum + (isNaN(value) ? 0 : value); return sum + (isNaN(value) ? 0 : value);
@ -360,20 +399,12 @@ const SplitPayment = (props) => {
setUpiPayOption(options); setUpiPayOption(options);
}; };
const getBookingTypeId = async () => { const getBookingTypeId = async () => {
let tempconfigdata = await dispatch( setConfigDataList(AllBookingType);
getConfigType({ TypeName: 'Booking Type' }) let configdata = AllBookingType;
).unwrap();
if (tempconfigdata?.data?.statusCode == 1) {
setConfigDataList(tempconfigdata?.data?.data);
let configdata = tempconfigdata?.data?.data;
let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType; let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType;
let filterconfigdata = configdata?.find( let filterconfigdata = configdata?.find((a) => a?.ConfigName === checkName);
(a) => a?.ConfigName === checkName
);
setSelectedBookingType(filterconfigdata?.ConfigId); setSelectedBookingType(filterconfigdata?.ConfigId);
}
}; };
const gettodaydate = () => { const gettodaydate = () => {
const currentDate = new Date(); const currentDate = new Date();
@ -547,7 +578,8 @@ const SplitPayment = (props) => {
SingleTokenMobilePrint(PrintOrderDetails, SelUpiId, 'Booking'); SingleTokenMobilePrint(PrintOrderDetails, SelUpiId, 'Booking');
} }
} else { } else {
MobilePrint(appPreferences, MobilePrint(
appPreferences,
PrintOrderDetails, PrintOrderDetails,
SelUpiId, SelUpiId,
'Booking', 'Booking',
@ -570,8 +602,9 @@ const SplitPayment = (props) => {
await Promise.all( await Promise.all(
PrintOrderDetails?.[0]?.OrderDetails?.map( PrintOrderDetails?.[0]?.OrderDetails?.map(
async (orderDetail, index) => { async (orderDetail, index) => {
const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( const groupedTokens = orderDetail?.productDetails
(acc, item, idx) => { ?.filter((data) => data?.EditTokenAvailable !== 'N')
?.reduce((acc, item, idx) => {
if (item.TokenAvailable === 'Y') { if (item.TokenAvailable === 'Y') {
if (!item.CounterName) { if (!item.CounterName) {
// If CounterName is null or empty // If CounterName is null or empty
@ -584,9 +617,7 @@ const SplitPayment = (props) => {
} }
} }
return acc; return acc;
}, }, {});
{}
);
// Iterate over grouped tokens and print them // Iterate over grouped tokens and print them
const tokensToPrint = Object.entries(groupedTokens).map( const tokensToPrint = Object.entries(groupedTokens).map(
@ -605,11 +636,11 @@ const SplitPayment = (props) => {
); );
} else { } else {
await Promise.all( await Promise.all(
PrintOrderDetails?.[0]?.OrderDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.map( PrintOrderDetails?.[0]?.OrderDetails?.filter(
async (orderDetail, index) => { (data) => data?.EditTokenAvailable !== 'N'
)?.map(async (orderDetail, index) => {
await TokenPrint(`${index}-${orderDetail?.OrderId}`); await TokenPrint(`${index}-${orderDetail?.OrderId}`);
} })
)
); );
setPrintOrderDetails([]); setPrintOrderDetails([]);
} }
@ -650,8 +681,9 @@ const SplitPayment = (props) => {
async (orderDetail, index) => { async (orderDetail, index) => {
await printDiv(`${selectedStyle}-${index}`, style); // Use unique IDs for each print await printDiv(`${selectedStyle}-${index}`, style); // Use unique IDs for each print
if (orderDetail?.BookingTypeName !== 'Dine In') { if (orderDetail?.BookingTypeName !== 'Dine In') {
const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( const groupedTokens = orderDetail?.productDetails
(acc, item, idx) => { ?.filter((data) => data?.EditTokenAvailable !== 'N')
?.reduce((acc, item, idx) => {
if (item.TokenAvailable === 'Y') { if (item.TokenAvailable === 'Y') {
if (!item.CounterName) { if (!item.CounterName) {
// If CounterName is null or empty // If CounterName is null or empty
@ -664,9 +696,7 @@ const SplitPayment = (props) => {
} }
} }
return acc; return acc;
}, }, {});
{}
);
// Iterate over grouped tokens and print them // Iterate over grouped tokens and print them
const tokensToPrint = Object.entries(groupedTokens).map( const tokensToPrint = Object.entries(groupedTokens).map(
@ -1448,7 +1478,14 @@ const SplitPayment = (props) => {
// SalesTableLinkDetails: // SalesTableLinkDetails:
// SelectedTableDetails?.length > 0 ? SelectedTableDetails : null, // SelectedTableDetails?.length > 0 ? SelectedTableDetails : null,
SalesTableLinkDetails: SalesTableLinkDetails:
SelectedTableDetails?.length > 0 ? globalTipAmount === 0 ? SelectedTableDetails : SelectedTableDetails?.map(item => ({ ...item, "TipsAmount": globalTipAmount })) : null, SelectedTableDetails?.length > 0
? globalTipAmount === 0
? SelectedTableDetails
: SelectedTableDetails?.map((item) => ({
...item,
TipsAmount: globalTipAmount,
}))
: null,
// "Credit": TotalAmount, // "Credit": TotalAmount,
// "Debit": 0, // "Debit": 0,
@ -1635,10 +1672,16 @@ const SplitPayment = (props) => {
if (response?.data?.statusCode == 1) { if (response?.data?.statusCode == 1) {
setSalesOrderId(response?.data?.OrderId); setSalesOrderId(response?.data?.OrderId);
const salesEditAmount = response?.data?.PaymentOrderDtl?.find(payment => const salesEditAmount = response?.data?.PaymentOrderDtl?.find(
payment?.LastOrderTran === 'Y' && payment?.AdjustmentType && (payment) =>
payment?.AdjustmentType != null && payment?.AfterAdjustment && payment?.BeforeAdjustment && payment?.AfterAdjustment != null && payment?.BeforeAdjustment != null payment?.LastOrderTran === 'Y' &&
) payment?.AdjustmentType &&
payment?.AdjustmentType != null &&
payment?.AfterAdjustment &&
payment?.BeforeAdjustment &&
payment?.AfterAdjustment != null &&
payment?.BeforeAdjustment != null
);
setBeforeAdjAmount(salesEditAmount?.BeforeAdjustment || null); setBeforeAdjAmount(salesEditAmount?.BeforeAdjustment || null);
setAfterAdjAmount(salesEditAmount?.AfterAdjustment || null); setAfterAdjAmount(salesEditAmount?.AfterAdjustment || null);
setAdjustmentType(salesEditAmount?.AdjustmentType || null); setAdjustmentType(salesEditAmount?.AdjustmentType || null);
@ -1722,7 +1765,13 @@ const SplitPayment = (props) => {
OrderId: props.hasOwnProperty('TableBookingOrderId') OrderId: props.hasOwnProperty('TableBookingOrderId')
? TableOrderId ? TableOrderId
: SalesOrderId, : SalesOrderId,
...(i === 0 ? { SalesId: props.hasOwnProperty('TableBookingSalesId') ? TableSalesId : SalesOrderId } : {}), ...(i === 0
? {
SalesId: props.hasOwnProperty('TableBookingSalesId')
? TableSalesId
: SalesOrderId,
}
: {}),
PaymentType: PaymentType:
SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi' SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi'
? SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pd' ? SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pd'
@ -1789,7 +1838,6 @@ const SplitPayment = (props) => {
BeforeAdjAmount: beforeAdjAmount || null, BeforeAdjAmount: beforeAdjAmount || null,
AfterAdjAmount: afterAdjAmount || null, AfterAdjAmount: afterAdjAmount || null,
AdjustmentType: adjustmentType || null, AdjustmentType: adjustmentType || null,
}; };
let response = await dispatch( let response = await dispatch(
@ -2125,6 +2173,7 @@ const SplitPayment = (props) => {
} }
return ( return (
<Suspense fallback={<div>Loading...</div>}>
<> <>
<Messages messageType={messageType} messageData={messageData} /> <Messages messageType={messageType} messageData={messageData} />
<div className="splitmodal"> <div className="splitmodal">
@ -2141,7 +2190,10 @@ const SplitPayment = (props) => {
<div className="splitpaymentModal-content"> <div className="splitpaymentModal-content">
<p>Total Amount : {safeRound(TotalAmount)}</p> <p>Total Amount : {safeRound(TotalAmount)}</p>
<p> <p>
Remaining Balance : {TotalAmount - (isNaN(TotalSplitAmount) ? 0 : TotalSplitAmount)} </p> Remaining Balance :{' '}
{TotalAmount -
(isNaN(TotalSplitAmount) ? 0 : TotalSplitAmount)}{' '}
</p>
<>{calculateField()}</> <>{calculateField()}</>
{TotalAmount > TotalSplitAmount && {TotalAmount > TotalSplitAmount &&
@ -2314,6 +2366,7 @@ const SplitPayment = (props) => {
/> />
)} )}
</> </>
</Suspense>
); );
}; };
export default SplitPayment; export default SplitPayment;

View File

@ -85,6 +85,7 @@ import {
} from '../../Features/BrachLogin/BranchLogin.js'; } from '../../Features/BrachLogin/BranchLogin.js';
import RackForm from '../Rack/RackForm.jsx'; import RackForm from '../Rack/RackForm.jsx';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import BarCodeScan from '../../Services/BarCodeScan.jsx';
const subDirectory = import.meta.env.ENV_BASE_URL; const subDirectory = import.meta.env.ENV_BASE_URL;
const ProductForm = ({ formType }) => { const ProductForm = ({ formType }) => {
@ -818,12 +819,19 @@ const ProductForm = ({ formType }) => {
// dispatch(changeSetup_OfferValue(e?.target?.value)) // dispatch(changeSetup_OfferValue(e?.target?.value))
}; };
const handleInput = async (val) => { const handleInput = async (val) => {
if (val?.target?.value?.length >= 5) { // normalize whether we receive an event (e.target.value) or a raw string
const inputVal = val && val.target && typeof val.target.value === 'string' ? val.target.value : val;
if (!inputVal) return;
if (inputVal.length >= 5) {
let QRCodeData = await dispatch( let QRCodeData = await dispatch(
getQrcodeData({ QRCode: val?.target?.value }) getQrcodeData({ QRCode: inputVal })
).unwrap(); ).unwrap();
if (QRCodeData?.data?.statusCode == 0) { if (QRCodeData?.data?.statusCode == 0) {
await setQrcodeFinalVal(val?.target?.value); // valid & unique - update component state and the form field
setQrcodeFinalVal(inputVal);
formRef.current?.setFieldsValue({ QRCode: inputVal });
} else { } else {
let existsQrcodeData = QRCodeData?.data?.data?.filter( let existsQrcodeData = QRCodeData?.data?.data?.filter(
(item) => (item) =>
@ -831,17 +839,18 @@ const ProductForm = ({ formType }) => {
item.CompId === CompId && item.CompId === CompId &&
item.BranchId === BranchId item.BranchId === BranchId
); );
if (existsQrcodeData?.length > 0) { if (existsQrcodeData?.length > 0) {
setQrcodeFinalVal(null); setQrcodeFinalVal(null);
formRef.current?.setFieldsValue({ QRCode: null }); formRef.current?.setFieldsValue({ QRCode: null });
setQrcodeExistsVal(existsQrcodeData?.[0]?.QRCode); setQrcodeExistsVal(existsQrcodeData?.[0]?.QRCode);
setMessageType('error'); setMessageType('error');
setMessageData('Qrcode Already Exists'); setMessageData('Qrcode Already Exists');
} else { } else {
setQrcodeExistsData(QRCodeData.data?.data); setQrcodeExistsData(QRCodeData.data?.data);
setQrcodeExistsDataOpen(true); setQrcodeExistsDataOpen(true);
await setQrcodeFinalVal(val?.target?.value); setQrcodeFinalVal(inputVal);
formRef.current?.setFieldsValue({ QRCode: inputVal });
setQrcodeAuto('N'); setQrcodeAuto('N');
} }
} }
@ -2685,11 +2694,19 @@ const ProductForm = ({ formType }) => {
autoComplete="off" autoComplete="off"
label="Scanner / AddQrcode" label="Scanner / AddQrcode"
onKeyPress={handleKeyPress} onKeyPress={handleKeyPress}
value={QrcodeFinalVal}
valueData={QrcodeFinalVal} valueData={QrcodeFinalVal}
isOnChange={QrcodeFinalVal ? true : false} isOnChange={QrcodeFinalVal ? true : false}
onChange={handleInput} onChange={handleInput}
disabled={editstate?.QRCode ? true : false} disabled={editstate?.QRCode ? true : false}
/> />
{isMobile &&
<BarCodeScan
onScan={(value) => {
handleInput(value);
}}
/>
}
{QrcodeExistsVal && QrcodeExistsVal} {QrcodeExistsVal && QrcodeExistsVal}
</Form.Item> </Form.Item>
</div> </div>
@ -2904,6 +2921,7 @@ const ProductForm = ({ formType }) => {
autoComplete="off" autoComplete="off"
label="Scanner / AddOnePcQrcode" label="Scanner / AddOnePcQrcode"
onKeyPress={handleKeyPressSingle} onKeyPress={handleKeyPressSingle}
value={QrcodeSingleFinalVal}
valueData={QrcodeSingleFinalVal} valueData={QrcodeSingleFinalVal}
isOnChange={ isOnChange={
QrcodeSingleFinalVal ? true : false QrcodeSingleFinalVal ? true : false

File diff suppressed because it is too large Load Diff

View File

@ -684,7 +684,7 @@ const initSession = () => {
sessionStorage.setItem( sessionStorage.setItem(
'auth', 'auth',
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiOTM2MDY0MjI0NCIsIlBhc3N3b3JkIjoiWkB6MTIzNCIsImF1ZCI6WyJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTIiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTQiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiXSwiZXhwIjoxNzcwOTIyMDEyLCJpc3MiOiJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMDEifQ.8iuEF8S7kW1OvVUda3YAx9v7ilp-uy9PVfbBvCPoq20' 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiOTM2MDY0MjI0NCIsIlBhc3N3b3JkIjoiWkB6MTIzNCIsImF1ZCI6WyJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTIiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTQiLCJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMTMiXSwiZXhwIjoxNzcxODcyOTYwLCJpc3MiOiJodHRwOi8vMTkyLjE2OC4xLjM3OjgwMDEifQ.tRA41-3-m2VYm_jkndGPLzB-jxzuO1XvG94Fmf6NTGQ'
); );
}; };