optimization Code

This commit is contained in:
Your Name 2026-02-23 09:39:46 +05:30
parent 8d19d901b9
commit 9cb84f309d
49 changed files with 29624 additions and 25847 deletions

796
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,7 @@
"dependencies": {
"@ant-design/plots": "^1.2.6",
"@autocomplete/material-ui": "0.0.17",
"@capacitor-mlkit/barcode-scanning": "^8.0.1",
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
"@emotion/react": "^11.11.4",
@ -23,6 +24,7 @@
"@tanstack/react-query": "^5.90.11",
"@tanstack/react-query-devtools": "^5.91.1",
"@tanstack/react-virtual": "^3.13.18",
"@zxing/library": "^0.21.3",
"antd": "^5.17.4",
"antd-img-crop": "^4.22.0",
"aos": "^2.3.4",
@ -52,6 +54,7 @@
"mui-autocomplete": "^2.0.1",
"number-to-words": "^1.2.4",
"pdf-lib": "^1.17.1",
"qr-scanner": "^1.4.2",
"qrcode": "^1.5.3",
"qrcode.react": "^4.2.0",
"react": "^18.3.1",

View File

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

View File

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

View File

@ -1,14 +1,14 @@
import React from 'react';
import { DefaultModal } from './DefaultModal';
import { Tables } from '../Tables/Table';
import "./ReceivedStockModel.scss"
import './ReceivedStockModel.scss';
const ReceivedStocksModal = ({
open,
onClose,
columns,
tableData,
handlePageChange,
customTable = false
customTable = false,
}) => {
const renderCell = (column, row, index) => {
if (column.render) {
@ -28,24 +28,32 @@ const ReceivedStocksModal = ({
className={'receive-stocks-modal'}
>
<>
{!customTable && <div style={{overflowX:"auto"}}>
{!customTable && (
<div style={{ overflowX: 'auto' }}>
<Tables
columns={columns}
data={tableData}
dataSource={tableData}
pagination={handlePageChange}
/>
</div>}
{
customTable &&
</div>
)}
{customTable && (
<div className="ReceivedStocksModalMaster">
<table style={{ width: "100%" }}>
<table style={{ width: '100%' }}>
<thead>
<tr>
{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()}
</th>
))}
@ -53,9 +61,12 @@ const ReceivedStocksModal = ({
</thead>
<tbody>
{tableData.map((row, index) => (
<tr key={row.key || index} style={{ fontSize: "13px" }}>
<tr key={row.key || index} style={{ fontSize: '13px' }}>
{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)}
</td>
))}
@ -64,11 +75,8 @@ const ReceivedStocksModal = ({
</tbody>
</table>
</div>
}
)}
</>
</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(
'BookingData/PostBookingdata',
async (postData) => {
@ -682,7 +692,6 @@ export const getSelectedFavItems = createAsyncThunk(
if (fromDate) params.append('fromDate', fromDate);
if (toDate) params.append('toDate', toDate);
// let url = `/productCardList?CompId=${data?.CompId}&BranchId=${data?.BranchId}&AppId=${data?.AppId}&Type=A`;
return await axiosRetailInstanceData.get(
`/productCardList?${params.toString()}`
);
@ -858,7 +867,6 @@ export const getCardDataWithoutSubmodule = createAsyncThunk(
? { fromDate: data?.fromDate, toDate: data?.toDate }
: {}),
});
return await axiosRetailInstanceData.get(
`/productCardList?${params.toString()}`
);
@ -1609,7 +1617,8 @@ const initialState = {
salesBillEdit: false,
previousOrderPayment: [],
previousOrderOfferDetails: [],
getmultipleSearchDatas: []
getmultipleSearchDatas: [],
AllBookingType: [],
};
const BookingData = createSlice({
@ -1981,6 +1990,13 @@ const BookingData = createSlice({
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) => {
if (action?.payload?.data?.statusCode === 1) {
state.ItemCard = action?.payload?.data?.data;
@ -2113,7 +2129,10 @@ const BookingData = createSlice({
});
builder.addCase(getmultipleSearch.fulfilled, (state, action) => {
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 {
state.getmultipleSearchDatas = [];
}
@ -2220,7 +2239,7 @@ export const {
triggerProductCard,
changeBillEditingMode,
changePreviousOrderPayment,
changePreviousOrderOfferDetail
changePreviousOrderOfferDetail,
} = BookingData.actions;
export const GlobalComboRedirectionToDefaultLayoutForParking = (state) =>
@ -2389,13 +2408,14 @@ export const GlobalAddBookingDetailsTrigger = (state) =>
state?.BookingData?.AddBookingDetailsTrigger;
export const GlobalCurrentOrderId = (state) =>
state?.BookingData?.CurrentOrderId;
export const GlobalSalesBillEdit = (state) =>
state?.BookingData?.salesBillEdit;
export const GlobalSalesBillEdit = (state) => state?.BookingData?.salesBillEdit;
export const GlobalPreviousOrderPayment = (state) =>
state?.BookingData?.previousOrderPayment;
export const GlobalPreviousOrderOfferDetails = (state) =>
state?.BookingData?.previousOrderOfferDetails;
export const GlobalGetmultipleSearchDatas = (state) =>
state?.BookingData?.getmultipleSearchDatas;
export const GlobalAllBookingType = (state) =>
state?.BookingData?.AllBookingType;
export default BookingData.reducer;

View File

@ -465,8 +465,8 @@ const WholesaleData = createSlice({
state.WholeSaleEntryList = action?.payload;
},
changeWholeSaleSelectedEntryDtl: (state, action) => {
(state.WholeSaleSelectedEntryDtl = action?.payload),
(state.WholeSaleSelectedProdDtl = [action?.payload?.ProdDetails?.[0]]);
((state.WholeSaleSelectedEntryDtl = action?.payload),
(state.WholeSaleSelectedProdDtl = [action?.payload?.ProdDetails?.[0]]));
state.WholeSaleSelectedGradeDtl = [
action?.payload?.ProdDetails?.[0].GradeDetails?.[0],
];
@ -513,7 +513,7 @@ const WholesaleData = createSlice({
},
},
extraReducers: (builder) => {
builder.addCase(getWholeSaleSupplier.fulfilled, (state, action) => {
(builder.addCase(getWholeSaleSupplier.fulfilled, (state, action) => {
if (action?.payload?.data?.statusCode == 1) {
state.SupplierDetails = action?.payload?.data?.data;
} else {
@ -636,7 +636,7 @@ const WholesaleData = createSlice({
} else {
state.WSBookingStatus = [];
}
});
}));
},
});
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 { Button, Popover } from 'antd';
import { AiOutlineClose } from 'react-icons/ai';
import { IoIosArrowUp } from 'react-icons/io';
import BSBillingTable1 from '../BSBillingTable1/BSBillingTable1';
import BST1Payment from '../BSBillingTable1/BST1Payment';
import BSSummery from '../BSBillingTableSummery/BSSummery';
import {
GlobalCustId,
GlobalSelOption,
@ -14,13 +11,23 @@ import {
GlobalOrderStatus,
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
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 { isMobile } from 'react-device-detect';
import { getTemplateData } from '../../../../../Features/ThemeChange/ThemeChange.js';
import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx';
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() {
const [open, setOpen] = useState(false);
@ -121,6 +128,7 @@ export default function BSBTOverall1() {
}, [width]);
return (
<Suspense fallback={<div>Loading</div>}>
<>
<div
className={
@ -199,14 +207,18 @@ export default function BSBTOverall1() {
>
<BSCustomerSelect />
<TooltipWrapper title={'Add Customer'} isMobile={isMobile}>
<TooltipWrapper
title={'Add Customer'}
isMobile={isMobile}
>
{' '}
<PozoAddCustomerIcon
className="BSBillingNav-icon-table-icon"
onClick={handleAddCustomer}
style={{
fontSize: '25px',
color: selOption || GetCustId ? '#52c41a' : '#1292EE',
color:
selOption || GetCustId ? '#52c41a' : '#1292EE',
cursor: Custdisable ? 'not-allowed' : 'pointer',
}}
/>
@ -242,5 +254,6 @@ export default function BSBTOverall1() {
</div>
</div>
</>
</Suspense>
);
}

View File

@ -6,7 +6,6 @@ import WebFont from 'webfontloader';
import { isMobile } from 'react-device-detect';
import dineInIcon from '../../../../../Images/Dine In.svg';
import TakeAwayIcon from '../../../../../Images/Take away.svg';
import { settingDataSelector } from '../../../../../Features/PreferenceMaster/PreferenceMaster.js';
import BSBillingEditQuantity from '../BSBillingEditQuantity/BSBillingEditQuantity';
import {
ChangeTotalAmount,
@ -18,13 +17,10 @@ import {
puttinghold,
} from '../../../../../Features/BookingScreen/HoldOption/HoldOption.js';
import {
ChangeOfferAppliedProducts,
ChangeFreeProductList,
ChangeFullFreeProductList,
GlobalFreeProdList,
GlobalOfferAppliedProducts,
changeFullOfferAppliedProducts,
changeLoyaltyConsumedQuantities,
ClearOfferAppliedProducts,
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
@ -76,11 +72,17 @@ import {
changePreviousOrderPayment,
changePreviousOrderOfferDetail,
} 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 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 { removeExtraCharge } = useUtilsComponent();
@ -142,7 +144,8 @@ const BSBillingTable1 = () => {
const GetCustId = useSelector(GlobalCustId);
const selectedCustomer = useSelector(GlobalSelOption);
const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false);
const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] =
useState(false);
const [customerProduct, setCustomerProduct] = useState(null);
const tableDataDinein = tableData?.filter(
@ -320,7 +323,6 @@ const BSBillingTable1 = () => {
event.preventDefault();
handleShortcut('weightAmount');
}
};
window.addEventListener('keydown', handleKeyDown);
@ -329,11 +331,6 @@ const BSBillingTable1 = () => {
};
}, [preferenceshortcutkey, tableDataTakeAway, tableDataDinein, BillOrderPre]);
function safeRound(amountStr) {
if (amountStr == null) return allowDecimal ? '0.00' : '0';
@ -347,7 +344,7 @@ const BSBillingTable1 = () => {
const handleCustomerProductPriceHistory = (item) => {
setCustomerPriceHistoryOpen(true);
setCustomerProduct(item?.ProdId);
}
};
const getstockbadge = async () => {
let data = {
@ -1855,7 +1852,6 @@ const BSBillingTable1 = () => {
insideinwardDtlId: false,
});
} else {
let data = isCheckFreeProductOutside?.FreeQty - item?.OrderQty;
//First i Calculate Another Booking Type Qty
let anotherBookingType = tableData?.find(
(e) =>
@ -1870,21 +1866,6 @@ const BSBillingTable1 = () => {
e?.BookingTypeName != item?.BookingTypeName
);
let diff =
item?.OrderQty - FreeProductSameBookingType?.OrderQty;
//SameBookingFreeQty
//FreeProductSameBookingType?.OrderQty
//Another BookingType Paid Qty
//anotherBookingType
//anotherBookingType?.Free OrderQty
//ischeckBothBookingType
//anotherBookingType?.OrderQty-ischeckBothBookingType?.OrderQty
//convert another Booking Type Qty also Free to Paid
if (
(anotherBookingType?.OrderQty || 0) <
anotherBookingTypeOffer?.OrderQty
@ -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 = () => {
setOpenEditTotalAmt(true);
@ -2190,6 +2033,7 @@ const BSBillingTable1 = () => {
};
return (
<Suspense fallback={<div>Loading</div>}>
<>
<div className="BillingTable1-Structure" style={{ overflow: 'auto' }}>
<div className="BillingTable1-table-div">
@ -2223,6 +2067,7 @@ const BSBillingTable1 = () => {
)}
{item.OptionName == 'Sl.No' && (
<th
className="BillingTable1-table-th"
style={{
fontFamily: SelectedFont,
fontWeight: '600',
@ -2413,7 +2258,8 @@ const BSBillingTable1 = () => {
{OldtableDataTakeAway?.map((item, index) => (
<tr
key={index}
className={`${item?.SalesId && OrderType !== 'Hold'
className={`${
item?.SalesId && OrderType !== 'Hold'
? 'Billing-Table1-row-disabled'
: 'Billing-Table1-row'
}
@ -2429,7 +2275,8 @@ const BSBillingTable1 = () => {
: triggerAnimation &&
index === 0 &&
!item?.SalesId &&
tableDataTakeAway?.length >= PreviousdataLength
tableDataTakeAway?.length >=
PreviousdataLength
? 'wheat'
: triggerAnimation &&
index === 0 &&
@ -2445,13 +2292,17 @@ const BSBillingTable1 = () => {
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
GlobProdwisedata?.includes(
item?.InwardDtlId + ' ' + item?.BookingTypeName
item?.InwardDtlId +
' ' +
item?.BookingTypeName
)
? '#b2d1f7'
: index % 2 === 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.[
'OverallBackgroundColor'
]
: '#d6d6d6',
animation:
BillOrderPre === 'Y' && !BookingTypeBoth
@ -2472,7 +2323,7 @@ const BSBillingTable1 = () => {
index == 0 &&
tableitem.OptionName == 'Sl.No' && (
<td
rowspan={tableData.length}
rowSpan={tableData.length}
style={{ backgroundColor: '#CFB59D' }}
>
<img width="30px" alt="" src={TakeAwayIcon} />
@ -2498,7 +2349,10 @@ const BSBillingTable1 = () => {
{tableitem.OptionName == 'Item' && (
<td
className="BillingTable1-table-td for-combo"
style={{ fontFamily: 'Poppins', textAlign: 'left' }}
style={{
fontFamily: 'Poppins',
textAlign: 'left',
}}
onClick={() =>
item.FullProductIdentifierDtls?.length > 0 ||
item.ProductIdentifierDtls?.length > 0
@ -2543,7 +2397,8 @@ const BSBillingTable1 = () => {
>
{item.ProdDetail?.map((prod, index) => (
<p key={index}>
{prod.ProdName} - {prod.Size} {prod.UomName}
{prod.ProdName} - {prod.Size}{' '}
{prod.UomName}
</p>
))}
</div>
@ -2699,7 +2554,8 @@ const BSBillingTable1 = () => {
{OldtableDataDinein?.map((item, index) => (
<tr
key={OldtableDataTakeAway?.length + index}
className={`${item?.SalesId
className={`${
item?.SalesId
? 'Billing-Table1-row-disabled'
: 'Billing-Table1-row'
}
@ -2720,7 +2576,8 @@ const BSBillingTable1 = () => {
? 'wheat'
: BookingType !== 'Dine In' &&
triggerAnimation &&
OldtableDataTakeAway?.length + index === 0 &&
OldtableDataTakeAway?.length + index ===
0 &&
tableDataDinein?.length >=
PreviousdataLength &&
!HoldOrderDtl &&
@ -2759,7 +2616,7 @@ const BSBillingTable1 = () => {
index == 0 &&
tableitem.OptionName == 'Sl.No' && (
<td
rowspan={tableData.length}
rowSpan={tableData.length}
style={{ backgroundColor: '#A2C3CD' }}
>
<img width="30px" alt="" src={dineInIcon} />
@ -2785,7 +2642,10 @@ const BSBillingTable1 = () => {
{tableitem.OptionName == 'Item' && (
<td
className="BillingTable1-table-td for-combo"
style={{ fontFamily: 'Poppins', textAlign: 'left' }}
style={{
fontFamily: 'Poppins',
textAlign: 'left',
}}
onClick={() => {
if (editField) {
handleEditQuantity(item);
@ -2829,7 +2689,8 @@ const BSBillingTable1 = () => {
>
{item.ProdDetail?.map((prod, index) => (
<p key={index}>
{prod.ProdName} - {prod.Size} {prod.UomName}
{prod.ProdName} - {prod.Size}{' '}
{prod.UomName}
</p>
))}
</div>
@ -2990,7 +2851,8 @@ const BSBillingTable1 = () => {
OldtableDataTakeAway?.length +
index
}
className={`${BookingType === 'Dine In' && item?.SalesId
className={`${
BookingType === 'Dine In' && item?.SalesId
? 'Billing-Table1-row-disabled'
: 'Billing-Table1-row'
}
@ -3010,7 +2872,8 @@ const BSBillingTable1 = () => {
index ===
0 &&
!item?.SalesId &&
tableDataTakeAway?.length >= PreviousdataLength
tableDataTakeAway?.length >=
PreviousdataLength
? 'wheat'
: BookingType !== 'Dine In' &&
triggerAnimation &&
@ -3050,7 +2913,9 @@ const BSBillingTable1 = () => {
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
GlobProdwisedata?.includes(
item?.InwardDtlId + ' ' + item?.BookingTypeName
item?.InwardDtlId +
' ' +
item?.BookingTypeName
)
? '#b2d1f7'
: (OldtableDataDinein?.length +
@ -3060,7 +2925,9 @@ const BSBillingTable1 = () => {
0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.[
'OverallBackgroundColor'
]
: '#d6d6d6',
animation:
BillOrderPre === 'Y' && !BookingTypeBoth
@ -3084,7 +2951,7 @@ const BSBillingTable1 = () => {
index == 0 &&
tableitem.OptionName == 'Sl.No' && (
<td
rowspan={tableData.length}
rowSpan={tableData.length}
style={{ backgroundColor: '#CFB59D' }}
>
<img width="30px" alt="" src={TakeAwayIcon} />
@ -3113,7 +2980,10 @@ const BSBillingTable1 = () => {
{tableitem.OptionName == 'Item' && (
<td
className="BillingTable1-table-td for-combo"
style={{ fontFamily: 'Poppins', textAlign: 'left' }}
style={{
fontFamily: 'Poppins',
textAlign: 'left',
}}
onClick={() =>
item.FullProductIdentifierDtls?.length > 0 ||
item.ProductIdentifierDtls?.length > 0
@ -3164,7 +3034,8 @@ const BSBillingTable1 = () => {
>
{item.ProdDetail?.map((prod, index) => (
<p key={index}>
{prod.ProdName} - {prod.Size} {prod.UomName}
{prod.ProdName} - {prod.Size}{' '}
{prod.UomName}
</p>
))}
</div>
@ -3326,7 +3197,8 @@ const BSBillingTable1 = () => {
tableDataTakeAway?.length +
index
}
className={`${BookingType === 'Dine In' && item?.SalesId
className={`${
BookingType === 'Dine In' && item?.SalesId
? 'Billing-Table1-row-disabled'
: 'Billing-Table1-row'
}
@ -3372,7 +3244,9 @@ const BSBillingTable1 = () => {
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
GlobProdwisedata?.includes(
item?.InwardDtlId + ' ' + item?.BookingTypeName
item?.InwardDtlId +
' ' +
item?.BookingTypeName
)
? '#b2d1f7'
: (OldtableDataTakeAway?.length +
@ -3383,7 +3257,9 @@ const BSBillingTable1 = () => {
0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.[
'OverallBackgroundColor'
]
: '#d6d6d6',
animation:
BillOrderPre === 'Y' && !BookingTypeBoth
@ -3408,7 +3284,7 @@ const BSBillingTable1 = () => {
index == 0 &&
tableitem.OptionName == 'Sl.No' && (
<td
rowspan={tableData.length}
rowSpan={tableData.length}
style={{ backgroundColor: '#A2C3CD' }}
>
<img width="30px" alt="" src={dineInIcon} />
@ -3438,7 +3314,10 @@ const BSBillingTable1 = () => {
{tableitem.OptionName == 'Item' && (
<td
className="BillingTable1-table-td for-combo"
style={{ fontFamily: 'Poppins', textAlign: 'left' }}
style={{
fontFamily: 'Poppins',
textAlign: 'left',
}}
onClick={() => {
if (editField) {
handleEditQuantity(item);
@ -3482,7 +3361,8 @@ const BSBillingTable1 = () => {
>
{item.ProdDetail?.map((prod, index) => (
<p key={index}>
{prod.ProdName} - {prod.Size} {prod.UomName}
{prod.ProdName} - {prod.Size}{' '}
{prod.UomName}
</p>
))}
</div>
@ -3648,7 +3528,7 @@ const BSBillingTable1 = () => {
ProductDetail={Modaldata}
/>
)}
{(customerPriceHistoryOpen && GetCustId) &&
{customerPriceHistoryOpen && GetCustId && (
<CustomerPriceHistory
open={customerPriceHistoryOpen}
custId={GetCustId}
@ -3657,10 +3537,11 @@ const BSBillingTable1 = () => {
setCustomerProduct={setCustomerProduct}
selectedCustomer={selectedCustomer}
/>
}
)}
</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 { useNavigate } from 'react-router-dom';
import moment from 'moment';
import { Badge, Popover, Modal, Tooltip } from 'antd';
import { Badge, Modal, Tooltip } from 'antd';
import { Tables } from '../../../../../Components/Tables/Table';
import { DefaultModal } from '../../../../../Components/Modal/DefaultModal.jsx';
import { UpOutlined } from '@ant-design/icons';
import paygate from '../../../../../Images/paygate.png';
import defaultupi from '../../../../../Images/defaultupi.png';
import paydevice from '../../../../../Images/paydevice.png';
@ -42,8 +41,6 @@ import {
changeReorderHoldDetails,
ChangeNavHoldData,
GlobalNavHoldData,
changeSummeryQty,
changeSummeryTotalItems,
changeSummeryTotalAmount,
changeSummeryTotalTaxAmount,
changeSummeryTotalWithoutTaxAmount,
@ -126,6 +123,7 @@ import {
changeBillEditingMode,
changePreviousOrderPayment,
changePreviousOrderOfferDetail,
GlobalAllBookingType,
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities';
import {
@ -158,7 +156,6 @@ import BsBillingCreditCustomer from '../../BookingFunctionality/BSBillingCreditC
import { isMobile } from 'react-device-detect';
import MobilePrint from '../../BookingFunctionality/MobilePrint.jsx';
import OtherServiceMobilePrint from '../../BookingFunctionality/OtherServiceMobilePrint.jsx';
import { settingDataSelector } from '../../../../../Features/PreferenceMaster/PreferenceMaster.js';
import CountUp from 'react-countup';
import { GlobalpreOrderOpen } from '../../../../../Features/BookingScreen/PreOrder/PreOrder.js';
import SplitPayment from '../../BookingFunctionality/SplitPayment.jsx';
@ -197,7 +194,6 @@ import BSOtherServiceClaim from '../../UtillComponents/BSOtherServiceClaim.jsx';
import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js';
import { TfiClipboard } from 'react-icons/tfi';
import OtherServicePrintStyle1 from '../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx';
import { MobilePdfPrint } from '../../BookingFunctionality/MobilePdfPrint.js';
import { PublicQrCodepost } from '../../../../../Features/ConfigMasterPage/ConfigMasterPage.js';
import {
ChangeFullFreeProductList,
@ -218,7 +214,6 @@ import CustomerOrders from '../../BookingFunctionality/CustomerOrders.jsx';
const subDirectory = import.meta.env.ENV_BASE_URL;
const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
const RetailApiurl = import.meta.env.ENV_API_URL;
export default function BST1Payment() {
const isF4Pressed = useRef(false);
@ -246,7 +241,9 @@ export default function BST1Payment() {
const navigate = useNavigate();
const salesBillEdit = useSelector(GlobalSalesBillEdit);
const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails);
const previousOrderOfferDetails = useSelector(
GlobalPreviousOrderOfferDetails
);
const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
const Discount = useSelector(GlobalOverAllOfferAmt);
const defaultBookingType = useSelector(GlobalDefaultBookingType);
@ -281,7 +278,6 @@ export default function BST1Payment() {
const GlobEstBooking = useSelector(GlobalEstimateBooking);
const GlobProdwisedata = useSelector(GlobalSelProdWiseEst);
const preOrder = useSelector(GlobalpreOrderOpen);
const OrderOfferDetail = useSelector(Global_OrderOfferDetail, shallowEqual);
const prodCat = useSelector(GlobalProductCategorie);
const ProdSubCat = useSelector(GlobalProductSubCategorie);
const templateData = useSelector(getTemplateData);
@ -292,6 +288,7 @@ export default function BST1Payment() {
const SettingDataSelector = useSelector(PreferenceData);
const unpaidFlow = useSelector(Globalunpaidflow);
const appPreferences = useSelector(ApplicationPreferences);
const AllBookingType = useSelector(GlobalAllBookingType);
const bookingTypePreference = appPreferences?.find(
(preference) => preference?.PreferredCatName === 'Booking Type'
)?.PreferenceCatDetails;
@ -321,8 +318,6 @@ export default function BST1Payment() {
const AppId = SessionData?.AppId;
const UserId = SessionData?.UserId;
const UserType = SessionData?.UserType;
const AuthToken = SessionData?.AuthToken;
const SessionMobileNo = SessionData?.SessionMobileNo;
// for customised invoice number
const { invoiceDate, clearInvoiceDate } = useDateStore();
const CurrentOrderId = useSelector(GlobalCurrentOrderId);
@ -341,7 +336,7 @@ export default function BST1Payment() {
const [refundPaySelectedName, setRefundPaySelectedName] = useState(null);
const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0);
const [previousNetAmount, setPreviousNetAmount] = useState(0);
console.log(currentOrderNetAmount, 'currentOrderNetAmount', previousNetAmount, salesBillEdit);
const [addcustomer, setAddCustomer] = useState(false);
const [PrintOrderDetails, setPrintOrderDetails] = useState([]);
//Total calculation
@ -365,7 +360,7 @@ export default function BST1Payment() {
(item) => item.SettingIdName == 'Estimation'
);
const BookingTypeBoth = useSelector(GlobalBookingTypeBoth);
const [ConfigDataList, setConfigDataList] = useState([]);
const [ConfigDataList, setConfigDataList] = useState(AllBookingType);
const [OrderStatus, setOrderStatus] = useState(true);
const CheckOrderType = OrderCardDetail?.filter(
(a) => a?.BookingTypeName !== BookingType
@ -562,14 +557,21 @@ export default function BST1Payment() {
const filteredPayments =
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 =
filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || [];
filteredPayments.length > 0
? filteredPayments
: previousOrderPayment || [];
const totalPreviouspayment = paymentsToUse?.reduce(
(acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
(acc, payment) =>
acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
0
);
@ -578,8 +580,7 @@ export default function BST1Payment() {
0
);
const previousNetAmount =
(totalPreviouspayment) || 0;
const previousNetAmount = totalPreviouspayment || 0;
// let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0));
let withdiscTotal =
@ -592,13 +593,26 @@ export default function BST1Payment() {
withdiscTotal >= 0
? (Number(withdiscTotal) + 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);
setPreviousNetAmount(previousNetAmount);
dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount));
dispatch(
changeSummeryTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
)
);
dispatch(changeSummeryComboOfferAmount(withComboSum));
@ -628,14 +642,17 @@ export default function BST1Payment() {
UserId: UserId,
};
dispatch(getPrinterMappingDetails(data)).unwrap();
const Data1 = { AppId, CompId, BranchId };
dispatch(getPrintSelectionComponentData(Data1)).unwrap();
// const Data1 = { AppId, CompId, BranchId };
// alert("hih")
// dispatch(getPrintSelectionComponentData(Data1)).unwrap();
}, []);
//mohan stoped data
useEffect(() => {
if (CompId && BranchId && AppId) {
if (holdCheckedSalesSetup) {
getHolddata();
getUnpaiddatas();
}
// getUnpaiddatas();
getCustomerData();
}
}, [CompId, BranchId, AppId]);
@ -668,7 +685,6 @@ export default function BST1Payment() {
}, [salesBillEdit]);
useEffect(() => {
if (salesBillEdit) {
if (SelCustId) {
setRefundPayBtns(AllPaymentOptions);
@ -683,8 +699,7 @@ export default function BST1Payment() {
setRefundPayBtns(withoutCustomer);
}
}
}, [AllPaymentOptions, SelCustId, salesBillEdit])
}, [AllPaymentOptions, SelCustId, salesBillEdit]);
useEffect(() => {
let hasAccess = false;
@ -712,9 +727,6 @@ export default function BST1Payment() {
setEmpData(datas?.[0]);
};
const getCustomerData = async () => {
await dispatch(
getAllCustomer({ CompId: CompId, AppId: AppId, branchId: BranchId })
);
await dispatch(
getAddCustomerDetails({
CompId: CompId,
@ -1246,8 +1258,9 @@ export default function BST1Payment() {
await Promise.all(
PrintOrderDetails?.[0]?.OrderDetails?.map(
async (orderDetail, index) => {
const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce(
(acc, item, idx) => {
const groupedTokens = orderDetail?.productDetails
?.filter((data) => data?.EditTokenAvailable !== 'N')
?.reduce((acc, item, idx) => {
if (item.TokenAvailable === 'Y') {
if (!item.CounterName) {
// If CounterName is null or empty
@ -1260,9 +1273,7 @@ export default function BST1Payment() {
}
}
return acc;
},
{}
);
}, {});
// Iterate over grouped tokens and print them
const tokensToPrint = Object.entries(groupedTokens).map(
@ -1327,7 +1338,11 @@ export default function BST1Payment() {
const handleButtonClick = () => {
if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) {
UpiPayment();
} else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) {
} else if (
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
!refundPaySelected
) {
setMessageType('warning');
setMessageData('Please Select Refund Payment Method');
return;
@ -1523,9 +1538,9 @@ export default function BST1Payment() {
setPaybtnselected(PaymentOptionsModeId);
}, [PaymentOptions]);
useEffect(() => {
getBookingTypeId();
}, [BookingType]);
// useEffect(() => {
// getBookingTypeId();
// }, [BookingType]);
const getHolddata = async () => {
const data = { CompId: CompId, BranchId: BranchId, AppId: AppId };
@ -1607,7 +1622,7 @@ export default function BST1Payment() {
const handleRefundPaymentMode = (id, name) => {
setRefundPaySelected(id);
setRefundPaySelectedName(name);
}
};
const addUpiOption = async (id, name, UPIId) => {
await dispatch(changeUpiIDprint(UPIId));
@ -1831,7 +1846,9 @@ export default function BST1Payment() {
setUpinotSelected(false);
setCurrentOrderNetAmount(0);
setPreviousNetAmount(0);
if (holdCheckedSalesSetup) {
getHolddata();
}
if (defaultBookingType === 'Both') {
await dispatch(changeBookingType('TakeAway'));
}
@ -2131,8 +2148,10 @@ export default function BST1Payment() {
SalesPaymentType: 'normal',
PaymentDetail: [
{
PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected :
Paybtnnameselected?.toLowerCase() === 'upi'
PaymentType:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? refundPaySelected
: Paybtnnameselected?.toLowerCase() === 'upi'
? SelectedUPIPayOption?.toLowerCase() === 'pd'
? PaymentDeviceUPI?.[0]?.ModeId
: SelectedUPIPayOption?.toLowerCase() === 'pg'
@ -2145,15 +2164,25 @@ export default function BST1Payment() {
: paybtnselected
? paybtnselected
: null,
Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount),
MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null :
Paybtnnameselected?.toLowerCase() === 'upi' &&
Amount:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? previousNetAmount - currentOrderNetAmount
: Math.round(TotalAmount),
MerchantId:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantId
: null,
PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' :
Paybtnnameselected?.toLowerCase() === 'cash'
PaymentOptionType:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'PC'
@ -2166,16 +2195,21 @@ export default function BST1Payment() {
? 'BU'
: SelectedUPIPayOption
: null,
ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null :
SelectedUPIPayOption?.toLowerCase() === 'default'
ModeOfPayment:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: SelectedUPIPayOption?.toLowerCase() === 'default'
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
?.UPIDetailId
: SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantUPIId
? BusinessPayOption?.find(
(busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
: null,
AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] :
Paybtnnameselected?.toLowerCase() === 'upi' &&
AccountDtl:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? []
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default'
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
(upipay) => upipay?.UPIId === UpiId
@ -2191,8 +2225,10 @@ export default function BST1Payment() {
SelectedCardOption?.toLowerCase() === 'pg')
? useOptions?.[0]?.PaymentDetails?.PaymentGateway
: [],
PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' :
Paybtnnameselected?.toLowerCase() === 'cash'
PaymentStatus:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? 'S'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'S'
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'S'
@ -2200,9 +2236,18 @@ export default function BST1Payment() {
SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S'
: 'P',
Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0,
Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && Paybtnnameselected?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 :
Debit:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
? Math.round(previousNetAmount - currentOrderNetAmount)
: 0,
Credit: salesBillEdit
? currentOrderNetAmount > previousNetAmount &&
Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount)
: 0
: Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount)
: 0,
},
@ -3300,8 +3345,10 @@ export default function BST1Payment() {
setDefaultPaymentMode([]);
}
};
if (salesBillEdit) {
setDefaultPaymentOption();
}, [defaultPaymentTrigger]);
}
}, [defaultPaymentTrigger, salesBillEdit]);
const Otherserviceprint = async () => {
if (OtherServicesPrintDetails?.length > 0) {
@ -3541,7 +3588,8 @@ export default function BST1Payment() {
: 1,
}}
>
{paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? (
{paybtns?.length > 0 &&
currentOrderNetAmount >= previousNetAmount ? (
paybtns?.map((payment) => (
<div className="Table3-cash">
<button
@ -3621,7 +3669,9 @@ export default function BST1Payment() {
</button>
</div>
))
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? (
) : currentOrderNetAmount < previousNetAmount &&
salesBillEdit &&
refundPayBtns.length > 0 ? (
refundPayBtns.map((payment) => (
<div className="Table3-cash">
<button
@ -3641,7 +3691,12 @@ export default function BST1Payment() {
? 'blink-animation 0.5s infinite alternate'
: 'none',
}}
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)}
onClick={() =>
handleRefundPaymentMode(
payment?.ConfigId,
payment?.ConfigName
)
}
>
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
@ -3804,7 +3859,6 @@ export default function BST1Payment() {
{/* Customer Orders */}
{GetCustId && (
<Tooltip title="Customer Orders" isMobile={isMobile}>
{' '}
<div
@ -3838,7 +3892,6 @@ export default function BST1Payment() {
</Tooltip>
)}
{OtherServicesglobal && OrderCardDetail.length >= 1 && (
<TooltipWrapper title="Vehicle Number" isMobile={isMobile}>
{' '}
@ -4039,8 +4092,10 @@ export default function BST1Payment() {
OrderCardDetail?.length > 0 &&
paybtnselected &&
CheckBookingStatus != 'Close'
? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
'price-button'
? !OrderStatus
? salesBillEdit &&
currentOrderNetAmount < previousNetAmount
? 'price-button'
: 'price-button'
: 'price-button Order'
: 'price-button-disabled'
@ -4056,7 +4111,15 @@ export default function BST1Payment() {
>
{' '}
{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(
OrderType === 'Failed'
? FailedTotalAmt
@ -4064,10 +4127,17 @@ export default function BST1Payment() {
? Math.max(0, TotalAmount - overAllBal)
: TotalAmount
)}`
)
) : (
'ORDER'
)
) : !OrderStatus ? (salesBillEdit && (currentOrderNetAmount < previousNetAmount)) ? (<div>Refund: {(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</div>) : (
) : !OrderStatus ? (
salesBillEdit && currentOrderNetAmount < previousNetAmount ? (
<div>
Refund:
{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
</div>
) : (
<div>
{' '}
<CountUp
@ -4082,6 +4152,7 @@ export default function BST1Payment() {
)}
/>
</div>
)
) : (
<div>ORDER</div>
)}
@ -4265,10 +4336,17 @@ export default function BST1Payment() {
SplitPaymentModal={Splitpayment}
handlesplitpaymentclose={handlesplitpaymentclose}
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) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0)))
(Discount > 0 ? Discount : 0))
)
}
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 { useNavigate } from 'react-router-dom';
import moment from 'moment';
@ -13,9 +20,6 @@ import { AiOutlineClose } from 'react-icons/ai';
import paygate from '../../../../../Images/paygate.png';
import defaultupi from '../../../../../Images/defaultupi.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 {
printDiv,
@ -133,14 +137,21 @@ import {
changeBillEditingMode,
changePreviousOrderPayment,
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 {
gettinghold,
globalholddata,
changeholddata,
} from '../../../../../Features/BookingScreen/HoldOption/HoldOption';
import { ChangeTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges.js'; //Shifayath Date:27/12/2023
import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities';
import { globalExtraTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges';
import {
getAddCustomerDetails,
@ -148,31 +159,20 @@ import {
GlobalAddCustomerDetails,
ReprintDetails,
triggerCustomerRefresh,
} from '../../../../../Features/BookingScreen/Customer/addCustomer';
import PaymentPdfBooking from '../../../../paymentpdfPage/PaymentPdfBooking';
} from '../../../../../Features/BookingScreen/Customer/addCustomer.js';
import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip';
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBIllingTable2.scss';
import BSCustomerSelect from '../../UtillComponents/BSSelectCustomer.jsx';
import PozoHoldIcon from '../../UtillComponents/Pozo retail icons/PozoHoldIcon';
import PozoDineInIcon from '../../UtillComponents/Pozo retail icons/PozoDineIn.jsx';
import PozoUnpaidIcon from '../../UtillComponents/Pozo retail icons/PozoUnpaidIcon.jsx';
import PozoAdvanceIcon from '../../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx';
import PozoBillIcon from '../../UtillComponents/Pozo retail icons/PozoBIllIcon.jsx';
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 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 MobilePrint from '../../BookingFunctionality/MobilePrint.jsx';
import { settingDataSelector } from '../../../../../Features/PreferenceMaster/PreferenceMaster.js';
import CountUp from 'react-countup';
import { GlobalpreOrderOpen } from '../../../../../Features/BookingScreen/PreOrder/PreOrder.js';
import SplitPayment from '../../BookingFunctionality/SplitPayment.jsx';
import TokensinglePrint from '../../../../paymentpdfPage/TokenOnlyPrints/TokeninsinglePrint.jsx';
import SingleTokenMobilePrint from '../../BookingFunctionality/SingleTokenMobilePrint.jsx';
import IndividualTokenMobilePrint from '../../BookingFunctionality/IndividualTokenMobilePrint.jsx';
import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js';
import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx';
@ -184,49 +184,94 @@ import {
Global_OverallOfferAmount,
Global_SalesWiseOfferAmount,
} from '../../../../../Features/Offer/Offer.js';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip';
import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js';
import { useAuth } from '../../../../../AuthContext.jsx';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import { GlobalBookingStatus } from '../../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js';
import {
changeSalesPaymentoption,
getPaymentOptionsData,
GlobalSalesPaymentoption,
} from '../../../../../Features/Payment/Paymentoptions/Paymentoptions.js';
import Paymentoption from '../../../../Payment/PaymentOptions/PaymentOptions.jsx';
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 { FaWhatsapp, FaPrint, FaCartPlus } from 'react-icons/fa';
import BSTipAmount from '../../UtillComponents/BSTipAmount.jsx';
import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js';
import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js';
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 {
ChangeFullFreeProductList,
changeFullOfferAppliedProducts,
changeLoyaltyConsumedQuantities,
GlobalFreeProdList,
GlobalOfferAppliedProducts,
GlobalOverAllOfferAmt,
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import CardPopover from '../StandardTable/Utils/CardPopover.jsx';
import UpiPopover from '../StandardTable/Utils/UpiPopOver.jsx';
import pozologoimg from '../../../../../Images/pozologoimg.png';
import PaymentGatewayEmbedded from '../../UtillComponents/PaymentGatewayEmbedded.jsx';
import MobileMultiPdfPrintTrigger from '../../UtillComponents/MobileMultiPdfPrintTrigger.jsx';
import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js';
import CustomerOrders from '../../BookingFunctionality/CustomerOrders.jsx';
// Jsx Files
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 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 BSBillingTable2 = () => {
@ -254,7 +299,9 @@ const BSBillingTable2 = () => {
const navigate = useNavigate();
const salesBillEdit = useSelector(GlobalSalesBillEdit);
const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails);
const previousOrderOfferDetails = useSelector(
GlobalPreviousOrderOfferDetails
);
const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
const defaultBookingType = useSelector(GlobalDefaultBookingType);
const globalTipAmount = useSelector(GlobaltipAmount);
@ -375,6 +422,10 @@ const BSBillingTable2 = () => {
const OverAllSales = useSelector(GlobalOverAllDiscSales);
const OverAllEstimate = useSelector(GlobalOverAllDiscEstimate);
const holdCheckedSalesSetup = tableOptions?.some(
(item) => item?.OptionName === 'Hold'
);
const PaymentOptionsModeName =
PaymentOptions?.find((e) => e.ModeDefault?.toUpperCase() === 'Y')
?.ModeName || PaymentOptions?.[0]?.ModeName;
@ -518,7 +569,6 @@ const BSBillingTable2 = () => {
}, [salesBillEdit]);
useEffect(() => {
if (salesBillEdit) {
if (SelCustId) {
setRefundPayBtns(AllPaymentOptions);
@ -533,8 +583,7 @@ const BSBillingTable2 = () => {
setRefundPayBtns(withoutCustomer);
}
}
}, [AllPaymentOptions, SelCustId, salesBillEdit])
}, [AllPaymentOptions, SelCustId, salesBillEdit]);
useEffect(() => {
if (!preOrder) {
@ -594,14 +643,21 @@ const BSBillingTable2 = () => {
const filteredPayments =
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 =
filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || [];
filteredPayments.length > 0
? filteredPayments
: previousOrderPayment || [];
const totalPreviouspayment = paymentsToUse?.reduce(
(acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
(acc, payment) =>
acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
0
);
@ -610,8 +666,7 @@ const BSBillingTable2 = () => {
0
);
const previousNetAmount =
(totalPreviouspayment) || 0;
const previousNetAmount = totalPreviouspayment || 0;
let withdiscTotal =
Total -
@ -623,12 +678,26 @@ const BSBillingTable2 = () => {
withdiscTotal >= 0
? (Number(withdiscTotal) + 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);
setPreviousNetAmount(previousNetAmount);
dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount));
dispatch(
changeSummeryTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
)
);
dispatch(changeSummeryComboOfferAmount(withComboSum));
@ -658,13 +727,16 @@ const BSBillingTable2 = () => {
UserId: UserId,
};
dispatch(getPrinterMappingDetails(data)).unwrap();
const Data1 = { AppId, CompId, BranchId };
dispatch(getPrintSelectionComponentData(Data1)).unwrap();
// const Data1 = { AppId, CompId, BranchId };
// dispatch(getPrintSelectionComponentData(Data1)).unwrap();
}, []);
useEffect(() => {
if (CompId && BranchId && AppId) {
if (holdCheckedSalesSetup) {
getHolddata();
getUnpaiddatas();
}
// getUnpaiddatas();
getCustomerData();
}
}, [CompId, BranchId, AppId]);
@ -702,29 +774,6 @@ const BSBillingTable2 = () => {
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 () => {
let data = {
CompId: CompId,
@ -740,9 +789,9 @@ const BSBillingTable2 = () => {
};
const getCustomerData = async () => {
await dispatch(
getAllCustomer({ CompId: CompId, AppId: AppId, branchId: BranchId })
);
// await dispatch(
// getAllCustomer({ CompId: CompId, AppId: AppId, branchId: BranchId })
// );
await dispatch(
getAddCustomerDetails({
CompId: CompId,
@ -833,7 +882,11 @@ const BSBillingTable2 = () => {
const handleButtonClick = () => {
if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) {
UpiPayment();
} else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) {
} else if (
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
!refundPaySelected
) {
setMessageType('warning');
setMessageData('Please Select Refund Payment Method');
return;
@ -1313,7 +1366,7 @@ const BSBillingTable2 = () => {
const handleRefundPaymentMode = (id, name) => {
setRefundPaySelected(id);
setRefundPaySelectedName(name);
}
};
const addUpiOption = async (id, name, UPIId) => {
await dispatch(changeUpiIDprint(UPIId));
@ -1872,7 +1925,10 @@ const BSBillingTable2 = () => {
setUpinotSelected(false);
setCurrentOrderNetAmount(0);
setPreviousNetAmount(0);
if (holdCheckedSalesSetup) {
getHolddata();
}
if (defaultBookingType === 'Both') {
await dispatch(changeBookingType('TakeAway'));
}
@ -2174,8 +2230,10 @@ const BSBillingTable2 = () => {
SalesPaymentType: 'normal',
PaymentDetail: [
{
PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected :
Paybtnnameselected?.toLowerCase() === 'upi'
PaymentType:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? refundPaySelected
: Paybtnnameselected?.toLowerCase() === 'upi'
? SelectedUPIPayOption?.toLowerCase() === 'pd'
? PaymentDeviceUPI?.[0]?.ModeId
: SelectedUPIPayOption?.toLowerCase() === 'pg'
@ -2188,15 +2246,25 @@ const BSBillingTable2 = () => {
: paybtnselected
? paybtnselected
: null,
Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount),
MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null :
Paybtnnameselected?.toLowerCase() === 'upi' &&
Amount:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? previousNetAmount - currentOrderNetAmount
: Math.round(TotalAmount),
MerchantId:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantId
: null,
PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' :
Paybtnnameselected?.toLowerCase() === 'cash'
PaymentOptionType:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'PC'
@ -2209,16 +2277,21 @@ const BSBillingTable2 = () => {
? 'BU'
: SelectedUPIPayOption
: null,
ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null :
SelectedUPIPayOption?.toLowerCase() === 'default'
ModeOfPayment:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: SelectedUPIPayOption?.toLowerCase() === 'default'
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
?.UPIDetailId
: SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantUPIId
? BusinessPayOption?.find(
(busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
: null,
AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] :
Paybtnnameselected?.toLowerCase() === 'upi' &&
AccountDtl:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? []
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default'
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
(upipay) => upipay?.UPIId === UpiId
@ -2234,8 +2307,10 @@ const BSBillingTable2 = () => {
SelectedCardOption?.toLowerCase() === 'pg')
? useOptions?.[0]?.PaymentDetails?.PaymentGateway
: [],
PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' :
Paybtnnameselected?.toLowerCase() === 'cash'
PaymentStatus:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? 'S'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'S'
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'S'
@ -2243,9 +2318,18 @@ const BSBillingTable2 = () => {
SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S'
: 'P',
Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0,
Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && Paybtnnameselected?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 :
Debit:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
? Math.round(previousNetAmount - currentOrderNetAmount)
: 0,
Credit: salesBillEdit
? currentOrderNetAmount > previousNetAmount &&
Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount)
: 0
: Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount)
: 0,
},
@ -3417,8 +3501,10 @@ const BSBillingTable2 = () => {
setDefaultPaymentMode([]);
}
};
if (salesBillEdit) {
setDefaultPaymentOption();
}, [defaultPaymentTrigger]);
}
}, [defaultPaymentTrigger, salesBillEdit]);
const Otherserviceprint = async () => {
if (OtherServicesPrintDetails?.length > 0) {
@ -3572,6 +3658,7 @@ const BSBillingTable2 = () => {
);
};
return (
<Suspense fallback={<div>Loading</div>}>
<div
className={
templateData?.BookingLayout?.[0] === 'Layout6'
@ -3910,7 +3997,8 @@ const BSBillingTable2 = () => {
: 1,
}}
>
{paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? (
{paybtns?.length > 0 &&
currentOrderNetAmount >= previousNetAmount ? (
paybtns?.map((payment) => (
<div className="Table3-cash">
<button
@ -3936,7 +4024,10 @@ const BSBillingTable2 = () => {
payment.ModeId,
payment.ModeName
)
: handlePaymentMode(payment.ModeId, payment.ModeName)
: handlePaymentMode(
payment.ModeId,
payment.ModeName
)
}
>
<div
@ -3985,7 +4076,9 @@ const BSBillingTable2 = () => {
</button>
</div>
))
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? (
) : currentOrderNetAmount < previousNetAmount &&
salesBillEdit &&
refundPayBtns.length > 0 ? (
refundPayBtns.map((payment) => (
<div className="Table3-cash">
<button
@ -4005,7 +4098,12 @@ const BSBillingTable2 = () => {
? 'blink-animation 0.5s infinite alternate'
: 'none',
}}
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)}
onClick={() =>
handleRefundPaymentMode(
payment?.ConfigId,
payment?.ConfigName
)
}
>
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
@ -4077,7 +4175,6 @@ const BSBillingTable2 = () => {
''
)}
{/* Customer Orders */}
{GetCustId && (
<Tooltip title="Customer Orders" isMobile={isMobile}>
@ -4119,7 +4216,10 @@ const BSBillingTable2 = () => {
.map((filteredItem) => (
<React.Fragment key={filteredItem.TemplateOptionsId}>
{!OtherServicesglobal && (
<TooltipWrapper title="Unpaid Bills" isMobile={isMobile}>
<TooltipWrapper
title="Unpaid Bills"
isMobile={isMobile}
>
{' '}
<PozoUnpaidIcon
className="BSBillingNav-icon-table-icon"
@ -4257,8 +4357,9 @@ const BSBillingTable2 = () => {
OrderCardDetail?.length > 0 &&
paybtnselected &&
CheckBookingStatus != 'Close'
? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
'billing-btn'
? salesBillEdit &&
currentOrderNetAmount < previousNetAmount
? 'billing-btn'
: 'billing-btn'
: 'billing-btn-deactive'
}
@ -4270,12 +4371,21 @@ const BSBillingTable2 = () => {
handleButtonClick
}
>
{!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? <div
{!OrderStatus ? (
salesBillEdit && currentOrderNetAmount < previousNetAmount ? (
<div
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">
<h1 style={{ fontFamily: FontFamily['head'] }}>Total</h1>
<h1 style={{ fontFamily: FontFamily['head'] }}>
Total
</h1>
</div>
<div>
@ -4308,6 +4418,7 @@ const BSBillingTable2 = () => {
</h1>
</div>
</>
)
) : (
<div
className="billing-in-style-Order"
@ -4479,8 +4590,8 @@ const BSBillingTable2 = () => {
<div>
You have already selected a table. If you click 'OK,' the
table selection will be removed, and the unpaid flow will
continue. If you click 'Cancel,' the dine-in flow will proceed
as selected.
continue. If you click 'Cancel,' the dine-in flow will
proceed as selected.
</div>
</>
}
@ -4493,10 +4604,17 @@ const BSBillingTable2 = () => {
SplitPaymentModal={Splitpayment}
handlesplitpaymentclose={handlesplitpaymentclose}
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) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0)))
(Discount > 0 ? Discount : 0))
)
}
failedOrderData={failedOrderData}
/>
@ -4591,7 +4709,9 @@ const BSBillingTable2 = () => {
)
}
CreatedDate={OtherServicesPrintDetails?.CreatedDate}
PaymentStatus={OtherServicesPrintDetails?.[0]?.PaymentOrderDtl}
PaymentStatus={
OtherServicesPrintDetails?.[0]?.PaymentOrderDtl
}
Preference={SettingDataSelector}
printDatas={printDatas}
/>
@ -4702,7 +4822,9 @@ const BSBillingTable2 = () => {
color: '#fff',
border: 'none',
borderRadius: 4,
cursor: hasVehicleInputErrors() ? 'not-allowed' : 'pointer',
cursor: hasVehicleInputErrors()
? 'not-allowed'
: 'pointer',
}}
>
Submit
@ -4768,6 +4890,7 @@ const BSBillingTable2 = () => {
)}
</div>
</div>
</Suspense>
);
};

View File

@ -10,16 +10,13 @@ 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 BSEditTotalAmt from '../BSEditTotalAmount/BSEditTotalAmt.jsx';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx';
import {
getTemplateData,
SelectedGlobalBillingColorDetail,
@ -80,6 +77,10 @@ import {
import { useRemoveProducts } from './RemoveCartWithOffer.jsx';
import { useUtilsComponent } from '../../../../../Services/utils.js';
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 { removeExtraCharge } = useUtilsComponent();
@ -123,7 +124,6 @@ const BSBillingTable3 = () => {
const UnpaidData = useSelector(GlobalUnpaidData);
const GlobProdwisedata = useSelector(GlobalSelProdWiseEst);
const ReportholdData = useSelector(GlobalReorderHoldDetails);
const salesBillEdit = useSelector(GlobalSalesBillEdit);
const prodCat = useSelector(GlobalProductCategorie);
const ProdSubCat = useSelector(GlobalProductSubCategorie);
const [PreviousdataLength, setPreviousdataLength] =
@ -137,7 +137,8 @@ const BSBillingTable3 = () => {
const GetCustId = useSelector(GlobalCustId);
const selectedCustomer = useSelector(GlobalSelOption);
const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false);
const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] =
useState(false);
const [customerProduct, setCustomerProduct] = useState(null);
const preferenceshortcutkey = preferenceDatas?.[0]?.[
'SettingDtlDetails'
@ -259,7 +260,6 @@ const BSBillingTable3 = () => {
event.preventDefault();
handleShortcut('weightAmount');
}
};
window.addEventListener('keydown', handleKeyDown);
@ -389,7 +389,7 @@ const BSBillingTable3 = () => {
const handleCustomerProductPriceHistory = (item) => {
setCustomerPriceHistoryOpen(true);
setCustomerProduct(item?.ProdId);
}
};
function safeRound(amountStr) {
if (amountStr == null) return allowDecimal ? '0.00' : '0';
@ -1983,7 +1983,6 @@ const BSBillingTable3 = () => {
}
}
}
};
// const removeFromCart = async (item) => {
@ -2395,7 +2394,8 @@ const BSBillingTable3 = () => {
{OldtableDataTakeAway?.map((item, index) => (
<tr
key={index}
className={`${item?.SalesId && OrderType !== 'Hold'
className={`${
item?.SalesId && OrderType !== 'Hold'
? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content'
}
@ -2673,7 +2673,8 @@ const BSBillingTable3 = () => {
{OldtableDataDinein?.map((item, index) => (
<tr
key={OldtableDataTakeAway?.length + index}
className={`${item?.SalesId
className={`${
item?.SalesId
? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content'
}
@ -2955,7 +2956,8 @@ const BSBillingTable3 = () => {
OldtableDataTakeAway?.length +
index
}
className={`${BookingType === 'Dine In' && item?.SalesId
className={`${
BookingType === 'Dine In' && item?.SalesId
? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content'
}
@ -3280,7 +3282,8 @@ const BSBillingTable3 = () => {
tableDataTakeAway?.length +
index
}
className={`${BookingType === 'Dine In' && item?.SalesId
className={`${
BookingType === 'Dine In' && item?.SalesId
? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content'
}
@ -3592,7 +3595,7 @@ const BSBillingTable3 = () => {
ProductDetail={Modaldata}
/>
)}
{(customerPriceHistoryOpen && GetCustId) &&
{customerPriceHistoryOpen && GetCustId && (
<CustomerPriceHistory
open={customerPriceHistoryOpen}
custId={GetCustId}
@ -3601,7 +3604,7 @@ const BSBillingTable3 = () => {
setCustomerProduct={setCustomerProduct}
selectedCustomer={selectedCustomer}
/>
}
)}
</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 { useNavigate } from 'react-router-dom';
import moment from 'moment';
@ -6,17 +13,12 @@ import { BiRightArrowAlt } from 'react-icons/bi';
import { AiOutlineClose } from 'react-icons/ai';
import { Tables } from '../../../../../Components/Tables/Table';
import { DefaultModal } from '../../../../../Components/Modal/DefaultModal.jsx';
import {
UpCircleOutlined,
DownCircleOutlined,
UpOutlined,
} from '@ant-design/icons';
import { UpCircleOutlined, DownCircleOutlined } from '@ant-design/icons';
import { Popover, Badge, Modal, Tooltip } from 'antd';
import {
printDiv,
extractLastNumberOrderId,
encryptObject,
decryptToObject,
} from '../../../../../Services/Others';
import { Messages } from '../../../../../Components/Notifications/Messages';
import BSBillingTable3 from './BSBillingTable3';
@ -24,9 +26,9 @@ import paygate from '../../../../../Images/paygate.png';
import defaultupi from '../../../../../Images/defaultupi.png';
import pozologoimg from '../../../../../Images/pozologoimg.png';
import paydevice from '../../../../../Images/paydevice.png';
import BSSummery1 from '../../BSBillingTables/BSBillingTableSummery/BSSummery';
import QrComponent from '../../BookingFunctionality/DynamicQr.jsx';
import QrinScreen from '../../BookingFunctionality/DynamicScreenQr.jsx';
const BSSummery1 = lazy(
() => import('../../BSBillingTables/BSBillingTableSummery/BSSummery')
);
import { ArrowRightOutlined } from '@ant-design/icons';
import Buttons from '../../../../../Components/Forms/Buttons';
import WpIcon from '../../../../../Images/message.png';
@ -40,6 +42,15 @@ import {
getPrinterMappingDetails,
getPrintSelectionComponentData,
} from '../../../../../Features/ThemeChange/ThemeChange';
import {
ChangeFullFreeProductList,
changeFullOfferAppliedProducts,
changeLoyaltyConsumedQuantities,
GlobalFreeProdList,
GlobalOfferAppliedProducts,
GlobalOverAllOfferAmt,
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import {
GlobalOrderCardDetails,
changeOrderCardDetails,
@ -48,7 +59,6 @@ import {
GlobalSelectedTableDetails,
GlobalBookingType,
changeBookingType,
getConfigType,
PutBookingData,
GlobalReorderHoldDetails,
getUnpaidData,
@ -73,8 +83,6 @@ import {
SendPaymentLink,
changeSummeryTotalAmount,
changeUpiIDprint,
changeSummeryTotalItems,
changeSummeryQty,
changeSummeryTotalWithoutTaxAmount,
changeSummeryTotalTaxAmount,
GlobalEstimateBooking,
@ -113,7 +121,7 @@ import {
GlobalOverAllDiscSales,
ChangeOverAllDiscSales,
ChangeOverAllDiscEstimate,
getAllCustomer,
// getAllCustomer,
GlobalBranchFinancialStatus,
changeSummeryComboOfferAmount,
ChangeComboCarddata,
@ -124,13 +132,11 @@ import {
changeOtherServiceTicketClaim,
GlobalRetailWSSalesType,
GlobalDefaultBookingType,
GlobalComboOfferAmount,
GlobalPaymentTrigger,
GlobalCurrentOrderId,
changeCurrentOrderId,
GlobalCombocarddata,
getCreditCustomer,
GlobalSummeryTotalItems,
GlobalSalesBillEdit,
GlobalPreviousOrderPayment,
GlobalPreviousOrderOfferDetails,
@ -140,17 +146,19 @@ import {
changeBillEditingMode,
changePreviousOrderPayment,
changePreviousOrderOfferDetail,
GlobalAllBookingType,
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js';
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 {
gettinghold,
globalholddata,
changeholddata,
} from '../../../../../Features/BookingScreen/HoldOption/HoldOption';
import PaymentPdfBooking from '../../../../paymentpdfPage/PaymentPdfBooking';
import { globalExtraTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges';
import {
getAddCustomerDetails,
@ -160,18 +168,20 @@ import {
triggerCustomerRefresh,
} from '../../../../../Features/BookingScreen/Customer/addCustomer';
import PozoHoldIcon from '../../UtillComponents/Pozo retail icons/PozoHoldIcon';
import PozoDineInIcon from '../../UtillComponents/Pozo retail icons/PozoDineIn.jsx';
import PozoUnpaidIcon from '../../UtillComponents/Pozo retail icons/PozoUnpaidIcon.jsx';
import PozoBillIcon from '../../UtillComponents/Pozo retail icons/PozoBIllIcon.jsx';
import PozoAddCustomerIcon from '../../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx';
import BsBillingCreditCustomer from '../../BookingFunctionality/BSBillingCreditCustomer.jsx';
import BSCreditCustomer from '../../UtillComponents/BSCreditCustomer.jsx';
const BSCreditCustomer = lazy(
() => import('../../UtillComponents/BSCreditCustomer.jsx')
);
import PozoAdvanceIcon from '../../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx';
import { isMobile } from 'react-device-detect';
import MobilePrint from '../../BookingFunctionality/MobilePrint.jsx';
import CountUp from 'react-countup';
import SplitPayment from '../../BookingFunctionality/SplitPayment.jsx';
import { GlobalpreOrderOpen } from '../../../../../Features/BookingScreen/PreOrder/PreOrder.js';
const SplitPayment = lazy(
() => import('../../BookingFunctionality/SplitPayment.jsx')
);
import TokensinglePrint from '../../../../paymentpdfPage/TokenOnlyPrints/TokeninsinglePrint.jsx';
import SingleTokenMobilePrint from '../../BookingFunctionality/SingleTokenMobilePrint.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 PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx';
import { Global_OverallOfferAmount } from '../../../../../Features/Offer/Offer.js';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip';
import { useAuth } from '../../../../../AuthContext.jsx';
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTables3/BSBillingTable3.scss';
@ -189,45 +198,65 @@ import {
changeSalesPaymentoption,
GlobalSalesPaymentoption,
} from '../../../../../Features/Payment/Paymentoptions/Paymentoptions.js';
import Paymentoption from '../../../../Payment/PaymentOptions/PaymentOptions.jsx';
import { getPaymentOptionsData } from '../../../../../Features/BookingScreen/BookingData/KioskBookingData.js';
import { getCombolist } from '../../../../../Features/ComboMaster/ComboMaster.js';
import SMSShare from '../../../../WhatsAppShare/SmsShare.jsx';
import WhatsAppShare from '../../../../WhatsAppShare/whatsAppShare.jsx';
import { MdSms } from 'react-icons/md';
import { FaWhatsapp, FaPrint, FaCartPlus } from 'react-icons/fa';
import BSTipAmount from '../../UtillComponents/BSTipAmount.jsx';
import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js';
import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js';
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';
const BSOtherServiceClaim = lazy(
() => import('../../UtillComponents/BSOtherServiceClaim.jsx')
);
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 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 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 MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
const RetailApiurl = import.meta.env.ENV_API_URL;
const BSBillingTable3Pay = () => {
const isF4Pressed = useRef(false);
const applyOffer = useApplyOfferto_CardDetail();
const AllBookingType = useSelector(GlobalAllBookingType);
const { SadminuserAccess } = useAuth();
let SAAccessCommonMaster = SadminuserAccess?.find(
(e) => e?.MenuName === 'Sales'
@ -236,7 +265,9 @@ const BSBillingTable3Pay = () => {
const navigate = useNavigate();
const salesBillEdit = useSelector(GlobalSalesBillEdit);
const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails);
const previousOrderOfferDetails = useSelector(
GlobalPreviousOrderOfferDetails
);
const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
const FreeProdList = useSelector(GlobalFreeProdList);
const offerAppliedProducts = useSelector(
@ -289,15 +320,10 @@ const BSBillingTable3Pay = () => {
const ProdSubCat = useSelector(GlobalProductSubCategorie);
const BSLayoutData = useSelector(getTemplateData);
const Combodata = useSelector(GlobalCombocarddata, shallowEqual);
const OfferCheckedInSetup = BSLayoutData?.BookingNavbar?.[1].some(
(item) => item?.OptionName == 'Offer'
);
const Custdisable = useSelector(GlobalSelectedCustDisable);
const SettingDataSelector = useSelector(PreferenceData);
const preferenceOffer =
SettingDataSelector?.[0]?.['SettingDtlDetails']?.find(
(item) => item.SettingIdName === 'Offer'
)?.SettingValue === 'Y';
const allowDecimal = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
(setting) =>
setting?.SettingIdName?.toLowerCase() === 'decimal' &&
@ -316,10 +342,7 @@ const BSBillingTable3Pay = () => {
const preOrder = useSelector(GlobalpreOrderOpen);
const OrderType = useSelector(GlobalOrderType);
const FailedTotalAmt = useSelector(GlobalFailedTotalAmt);
const OrderOfferDetail = useSelector(
GlobalOfferAppliedProducts,
shallowEqual
);
const tabledata = useSelector(GlobalUnpaidListData);
const GlobalSalesPaymentoptions = useSelector(GlobalSalesPaymentoption);
@ -402,6 +425,10 @@ const BSBillingTable3Pay = () => {
const [Splitpayment, setSplitpayment] = useState(false);
const [urlData, setUrlData] = useState();
const holdCheckedSalesSetup = tableOptions?.some(
(item) => item?.OptionName === 'Hold'
);
const PaymentOptionsModeName =
PaymentOptions?.find((e) => e.ModeDefault?.toUpperCase() === 'Y')
?.ModeName || PaymentOptions?.[0]?.ModeName;
@ -589,14 +616,21 @@ const BSBillingTable3Pay = () => {
const filteredPayments =
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 =
filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || [];
filteredPayments.length > 0
? filteredPayments
: previousOrderPayment || [];
const totalPreviouspayment = paymentsToUse?.reduce(
(acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
(acc, payment) =>
acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
0
);
@ -605,8 +639,7 @@ const BSBillingTable3Pay = () => {
0
);
const previousNetAmount =
(totalPreviouspayment) || 0;
const previousNetAmount = totalPreviouspayment || 0;
let withdiscTotal =
Total -
@ -618,12 +651,26 @@ const BSBillingTable3Pay = () => {
withdiscTotal >= 0
? (Number(withdiscTotal) + 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);
setPreviousNetAmount(previousNetAmount);
dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount));
dispatch(
changeSummeryTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
)
);
dispatch(changeSummeryComboOfferAmount(withComboSum));
@ -653,8 +700,8 @@ const BSBillingTable3Pay = () => {
UserId: UserId,
};
dispatch(getPrinterMappingDetails(data)).unwrap();
const Data1 = { AppId, CompId, BranchId };
dispatch(getPrintSelectionComponentData(Data1)).unwrap();
// const Data1 = { AppId, CompId, BranchId };
// dispatch(getPrintSelectionComponentData(Data1)).unwrap();
}, []);
useEffect(() => {
@ -711,8 +758,11 @@ const BSBillingTable3Pay = () => {
};
useEffect(() => {
if (CompId && BranchId && AppId) {
if (holdCheckedSalesSetup) {
getHolddata();
getUnpaiddatas();
}
// getUnpaiddatas();
getCustomerData();
}
}, [CompId, BranchId, AppId]);
@ -739,7 +789,6 @@ const BSBillingTable3Pay = () => {
}, [salesBillEdit]);
useEffect(() => {
if (salesBillEdit) {
if (SelCustId) {
setRefundPayBtns(AllPaymentOptions);
@ -754,8 +803,7 @@ const BSBillingTable3Pay = () => {
setRefundPayBtns(withoutCustomer);
}
}
}, [AllPaymentOptions, SelCustId, salesBillEdit])
}, [AllPaymentOptions, SelCustId, salesBillEdit]);
useEffect(() => {
if (UserType === 'Employee') {
@ -777,29 +825,6 @@ const BSBillingTable3Pay = () => {
setaddnewAccess(!hasAccess);
}, [empData, SAAccessCommonMaster, UserType]);
// useEffect(() => {
// const handleKeyPress = (event) => {
// if (event.shiftKey && event.code === 'KeyM') {
// if (
// document.activeElement.tagName !== 'INPUT' &&
// document.activeElement.tagName !== 'TEXTAREA'
// ) {
// event.preventDefault();
// setBlink(true);
// }
// }
// };
// const handleClickOutside = (event) => {
// setBlink(false);
// };
// window.addEventListener('keydown', handleKeyPress);
// window.addEventListener('mousedown', handleClickOutside);
// return () => {
// window.removeEventListener('keydown', handleKeyPress);
// window.addEventListener('mousedown', handleClickOutside);
// };
// }, []);
const fetchApi = async () => {
let data = {
CompId: CompId,
@ -815,9 +840,9 @@ const BSBillingTable3Pay = () => {
};
const getCustomerData = async () => {
await dispatch(
getAllCustomer({ CompId: CompId, AppId: AppId, branchId: BranchId })
);
// await dispatch(
// getAllCustomer({ CompId: CompId, AppId: AppId, branchId: BranchId })
// );
await dispatch(
getAddCustomerDetails({
CompId: CompId,
@ -1044,8 +1069,10 @@ const BSBillingTable3Pay = () => {
setDefaultPaymentMode([]);
}
};
if (salesBillEdit) {
setDefaultPaymentOption();
}, [defaultPaymentTrigger]);
}
}, [defaultPaymentTrigger, salesBillEdit]);
const TokenPrint = async (index) => {
try {
@ -1488,7 +1515,11 @@ const BSBillingTable3Pay = () => {
const handleButtonClick = () => {
if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) {
UpiPayment();
} else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) {
} else if (
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
!refundPaySelected
) {
setMessageType('warning');
setMessageData('Please Select Refund Payment Method');
return;
@ -1700,20 +1731,12 @@ const BSBillingTable3Pay = () => {
};
const getBookingTypeId = async () => {
let tempconfigdata = await dispatch(
getConfigType({ TypeName: 'Booking Type' })
).unwrap();
if (tempconfigdata?.data?.statusCode == 1) {
setConfigDataList(tempconfigdata?.data?.data);
let configdata = tempconfigdata?.data?.data;
setConfigDataList(AllBookingType);
let configdata = AllBookingType;
let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType;
let filterconfigdata = configdata?.find(
(a) => a?.ConfigName === checkName
);
let filterconfigdata = configdata?.find((a) => a?.ConfigName === checkName);
setSelectedBookingType(filterconfigdata?.ConfigId);
}
};
const gettodaydate = () => {
@ -1776,7 +1799,7 @@ const BSBillingTable3Pay = () => {
const handleRefundPaymentMode = (id, name) => {
setRefundPaySelected(id);
setRefundPaySelectedName(name);
}
};
const addUpiOption = async (id, name, UPIId) => {
await dispatch(changeUpiIDprint(UPIId));
@ -1865,14 +1888,6 @@ const BSBillingTable3Pay = () => {
setUpiOptionOpen(false);
};
const handlePopoverVisibleChange = (visible) => {
setUpiOptionOpen(visible);
};
const handlePopoverVisibleChangeCard = (visible) => {
setCardOptionOpen(visible);
};
const ProductSummary = (salesData) => {
const productMap = new Map();
@ -2006,7 +2021,9 @@ const BSBillingTable3Pay = () => {
setCurrentOrderNetAmount(0);
setPreviousNetAmount(0);
setUpinotSelected(false);
if (holdCheckedSalesSetup) {
getHolddata();
}
if (defaultBookingType === 'Both') {
await dispatch(changeBookingType('TakeAway'));
}
@ -2318,8 +2335,10 @@ const BSBillingTable3Pay = () => {
SalesPaymentType: 'normal',
PaymentDetail: [
{
PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected :
Paybtnnameselected?.toLowerCase() === 'upi'
PaymentType:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? refundPaySelected
: Paybtnnameselected?.toLowerCase() === 'upi'
? SelectedUPIPayOption?.toLowerCase() === 'pd'
? PaymentDeviceUPI?.[0]?.ModeId
: SelectedUPIPayOption?.toLowerCase() === 'pg'
@ -2332,15 +2351,25 @@ const BSBillingTable3Pay = () => {
: paybtnselected
? paybtnselected
: null,
Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount),
MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null :
Paybtnnameselected?.toLowerCase() === 'upi' &&
Amount:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? previousNetAmount - currentOrderNetAmount
: Math.round(TotalAmount),
MerchantId:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantId
: null,
PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' :
Paybtnnameselected?.toLowerCase() === 'cash'
PaymentOptionType:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'PC'
@ -2353,16 +2382,21 @@ const BSBillingTable3Pay = () => {
? 'BU'
: SelectedUPIPayOption
: null,
ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null :
SelectedUPIPayOption?.toLowerCase() === 'default'
ModeOfPayment:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: SelectedUPIPayOption?.toLowerCase() === 'default'
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
?.UPIDetailId
: SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantUPIId
? BusinessPayOption?.find(
(busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
: null,
AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] :
Paybtnnameselected?.toLowerCase() === 'upi' &&
AccountDtl:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? []
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default'
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
(upipay) => upipay?.UPIId === UpiId
@ -2378,8 +2412,10 @@ const BSBillingTable3Pay = () => {
SelectedCardOption?.toLowerCase() === 'pg')
? useOptions?.[0]?.PaymentDetails?.PaymentGateway
: [],
PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' :
Paybtnnameselected?.toLowerCase() === 'cash'
PaymentStatus:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? 'S'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'S'
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'S'
@ -2387,9 +2423,18 @@ const BSBillingTable3Pay = () => {
SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S'
: 'P',
Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0,
Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && Paybtnnameselected?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 :
Debit:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
? Math.round(previousNetAmount - currentOrderNetAmount)
: 0,
Credit: salesBillEdit
? currentOrderNetAmount > previousNetAmount &&
Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount)
: 0
: Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount)
: 0,
},
@ -3540,6 +3585,7 @@ const BSBillingTable3Pay = () => {
);
};
return (
<Suspense fallback={<div>Suspense Loading...</div>}>
<>
<div className="BSBilling3div">
{screenwidth <= 768 && (
@ -3551,9 +3597,8 @@ const BSBillingTable3Pay = () => {
maxHeight: responsiveBill ? '180px' : '0px',
}}
>
{Array.isArray(OrderCardDetail) && OrderCardDetail?.length >= 1 && (
<BSBillingTable3 />
)}
{Array.isArray(OrderCardDetail) &&
OrderCardDetail?.length >= 1 && <BSBillingTable3 />}
</div>
)}
@ -3660,7 +3705,8 @@ const BSBillingTable3Pay = () => {
onClick={CreditCustomerFun}
style={{
cursor:
OrderCardDetail?.length > 0 && 'not-allowed',
OrderCardDetail?.length > 0 &&
'not-allowed',
color:
OrderCardDetail?.length > 0 ||
(selOption?.value === undefined &&
@ -3742,7 +3788,6 @@ const BSBillingTable3Pay = () => {
)}
{/* Customer Orders */}
{GetCustId && (
<Tooltip title="Customer Orders" isMobile={isMobile}>
{' '}
<div
@ -4043,7 +4088,8 @@ const BSBillingTable3Pay = () => {
: 1,
}}
>
{paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? (
{paybtns?.length > 0 &&
currentOrderNetAmount >= previousNetAmount ? (
paybtns?.map((payment) => (
<div className="Table3-cash">
<button
@ -4124,7 +4170,9 @@ const BSBillingTable3Pay = () => {
</button>
</div>
))
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? (
) : currentOrderNetAmount < previousNetAmount &&
salesBillEdit &&
refundPayBtns.length > 0 ? (
refundPayBtns.map((payment) => (
<div className="Table3-cash">
<button
@ -4144,7 +4192,12 @@ const BSBillingTable3Pay = () => {
? 'blink-animation 0.5s infinite alternate'
: 'none',
}}
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)}
onClick={() =>
handleRefundPaymentMode(
payment?.ConfigId,
payment?.ConfigName
)
}
>
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
@ -4286,7 +4339,9 @@ const BSBillingTable3Pay = () => {
<BSOtherServiceClaim />
</div>
)}
<div style={{ display: 'flex', alignItems: 'center', gap: '6px' }}>
<div
style={{ display: 'flex', alignItems: 'center', gap: '6px' }}
>
{!OtherServicesglobal && unpaidFlow == true ? (
<TooltipWrapper title={'Print Bill'} isMobile={isMobile}>
{' '}
@ -4401,8 +4456,10 @@ const BSBillingTable3Pay = () => {
OrderCardDetail?.length > 0 &&
paybtnselected &&
CheckBookingStatus != 'Close'
? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
'BSBillingTable3-paybtn'
? !OrderStatus
? salesBillEdit &&
currentOrderNetAmount < previousNetAmount
? 'BSBillingTable3-paybtn'
: 'BSBillingTable3-paybtn'
: 'BSBillingTable3-paybtn Order'
: 'BSBillingTable3-paybtn-deactive'
@ -4418,7 +4475,13 @@ const BSBillingTable3Pay = () => {
}
//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'] }}>
{' '}
@ -4452,6 +4515,7 @@ const BSBillingTable3Pay = () => {
<BiRightArrowAlt />
</div>
</>
)
) : (
<div>ORDER</div>
)}
@ -4532,7 +4596,8 @@ const BSBillingTable3Pay = () => {
/>
)}
{PrintOrderDetails?.length > 0 &&
PrintOrderDetails?.[0]?.OrderDetails?.map((orderDetail, index) => (
PrintOrderDetails?.[0]?.OrderDetails?.map(
(orderDetail, index) => (
<div style={{ display: 'none' }}>
<PaymentPdfBooking
index={index}
@ -4551,11 +4616,13 @@ const BSBillingTable3Pay = () => {
printDatas={printDatas}
/>
</div>
))}
)
)}
{PrintOrderDetails?.length > 0 &&
(TokenOnly?.SettingValue === 'Y' ||
IndividualToken?.SettingValue === 'Y') &&
PrintOrderDetails?.[0]?.OrderDetails?.map((orderDetail, index) => (
PrintOrderDetails?.[0]?.OrderDetails?.map(
(orderDetail, index) => (
<div style={{ display: 'none' }}>
<TokensinglePrint
index={index}
@ -4572,7 +4639,8 @@ const BSBillingTable3Pay = () => {
PaymentStatus={PrintOrderDetails?.[0]?.PaymentOrderDtl}
/>
</div>
))}
)
)}
{CreditCustomer && (
<div style={{ display: 'none' }}>
<BsBillingCreditCustomer
@ -4615,9 +4683,10 @@ const BSBillingTable3Pay = () => {
children={
<>
<div>
You have already selected a table. If you click 'OK,' the table
selection will be removed, and the unpaid flow will continue. If
you click 'Cancel,' the dine-in flow will proceed as selected.
You have already selected a table. If you click 'OK,' the
table selection will be removed, and the unpaid flow will
continue. If you click 'Cancel,' the dine-in flow will proceed
as selected.
</div>
</>
}
@ -4630,10 +4699,17 @@ const BSBillingTable3Pay = () => {
SplitPaymentModal={Splitpayment}
handlesplitpaymentclose={handlesplitpaymentclose}
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) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0)))
(Discount > 0 ? Discount : 0))
)
}
failedOrderData={failedOrderData}
/>
@ -4660,10 +4736,8 @@ const BSBillingTable3Pay = () => {
{
OtherServicesPrintDetails?.length > 0 && (
// PrintOrderDetails?.[0]?.OrderDetails?.map((orderDetail, index) => (
<div style={{ display: 'none' }}>
<OtherServicePrintStyle1
// index={index}
table2Data={OtherServicesPrintDetails}
singleData2={OtherServicesPrintDetails?.productDetails}
orderId={
@ -4690,7 +4764,6 @@ const BSBillingTable3Pay = () => {
handleCancel={() => {
setOtherServicesModal(false);
}}
// handleSubmit={Handlevehiclenumbers}
footer={false}
children={
<div
@ -4757,7 +4830,9 @@ const BSBillingTable3Pay = () => {
width: '100%',
padding: 8,
borderRadius: 4,
border: error ? '1px solid red' : '1px solid #ccc',
border: error
? '1px solid red'
: '1px solid #ccc',
}}
/>
{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 { useNavigate } from 'react-router-dom';
import moment from 'moment';
import { Badge, Modal, Popover, Tooltip } from 'antd';
import { BiRightArrowAlt } from 'react-icons/bi';
import { AiOutlineClose } from 'react-icons/ai';
import BSSummery from '../BSBillingTableSummery/BSSummery';
import BSBillingTable4 from './BSBillingTable4';
import { UpCircleOutlined, UpOutlined } from '@ant-design/icons';
import QrComponent from '../../BookingFunctionality/DynamicQr.jsx';
import QrinScreen from '../../BookingFunctionality/DynamicScreenQr.jsx';
import { UpCircleOutlined } from '@ant-design/icons';
const BSSummery = lazy(() => import('../BSBillingTableSummery/BSSummery'));
const QrComponent = lazy(
() => import('../../BookingFunctionality/DynamicQr.jsx')
);
const QrinScreen = lazy(
() => import('../../BookingFunctionality/DynamicScreenQr.jsx')
);
import { ArrowRightOutlined } from '@ant-design/icons';
import Buttons from '../../../../../Components/Forms/Buttons';
import WpIcon from '../../../../../Images/message.png';
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4.scss';
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTables3/BSBillingTable3.scss';
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBillingTable2.scss';
import {
GlobalSelectedFont,
getTemplateData,
@ -22,11 +31,17 @@ import {
GlobalprintDatas,
GlobalPrinterMappingDtls,
getPrinterMappingDetails,
getPrintSelectionComponentData,
// getPrintSelectionComponentData,
} from '../../../../../Features/ThemeChange/ThemeChange';
import SplitPayment from '../../BookingFunctionality/SplitPayment.jsx';
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 {
ChangeNavHoldData,
GlobalBookingType,
@ -162,10 +177,18 @@ import PozoHoldIcon from '../../UtillComponents/Pozo retail icons/PozoHoldIcon';
import PozoDineInIcon from '../../UtillComponents/Pozo retail icons/PozoDineIn.jsx';
import PozoUnpaidIcon from '../../UtillComponents/Pozo retail icons/PozoUnpaidIcon.jsx';
import PozoBillIcon from '../../UtillComponents/Pozo retail icons/PozoBIllIcon.jsx';
import PozoAddCustomerIcon from '../../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx';
import BsBillingCreditCustomer from '../../BookingFunctionality/BSBillingCreditCustomer.jsx';
const PozoAddCustomerIcon = lazy(
() =>
import('../../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx')
);
const BsBillingCreditCustomer = lazy(
() => import('../../BookingFunctionality/BSBillingCreditCustomer.jsx')
);
import PozoAdvanceIcon from '../../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx';
import BSCreditCustomer from '../../UtillComponents/BSCreditCustomer.jsx';
const BSCreditCustomer = lazy(
() => import('../../UtillComponents/BSCreditCustomer.jsx')
);
import { isMobile } from 'react-device-detect';
import MobilePrint from '../../BookingFunctionality/MobilePrint.jsx';
import CountUp from 'react-countup';
@ -178,13 +201,9 @@ import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js';
import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx';
import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx';
import {
Global_CoupenCodeAmount,
Global_loyaltyPointsDiscountAmount,
Global_OrderOfferDetail,
Global_OverallOfferAmount,
Global_SalesWiseOfferAmount,
} from '../../../../../Features/Offer/Offer.js';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip';
import { useAuth } from '../../../../../AuthContext.jsx';
import { GlobalBookingStatus } from '../../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js';
@ -192,24 +211,24 @@ import {
changeSalesPaymentoption,
GlobalSalesPaymentoption,
} 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 { getCombolist } from '../../../../../Features/ComboMaster/ComboMaster.js';
import WhatsAppShare from '../../../../WhatsAppShare/whatsAppShare.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 { 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 { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js';
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 {
ChangeFreeProductList,
ChangeFullFreeProductList,
changeFullOfferAppliedProducts,
changeLoyaltyConsumedQuantities,
@ -220,15 +239,27 @@ import {
import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js';
import UpiPopover from '../StandardTable/Utils/UpiPopOver.jsx';
import CardPopover from '../StandardTable/Utils/CardPopover.jsx';
import PaymentGatewayEmbedded from '../../UtillComponents/PaymentGatewayEmbedded.jsx';
import pozologoimg from '../../../../../Images/pozologoimg.png';
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 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 BSBilling4Payment = () => {
@ -241,7 +272,9 @@ const BSBilling4Payment = () => {
const navigate = useNavigate();
const salesBillEdit = useSelector(GlobalSalesBillEdit);
const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails);
const previousOrderOfferDetails = useSelector(
GlobalPreviousOrderOfferDetails
);
const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
const FreeProdList = useSelector(GlobalFreeProdList);
const offerAppliedProducts = useSelector(GlobalOfferAppliedProducts);
@ -271,7 +304,6 @@ const BSBilling4Payment = () => {
const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
const NavHoldData = useSelector(GlobalNavHoldData);
const SettingDataSelector = useSelector(PreferenceData);
const BranchFinancialStatus = useSelector(GlobalBranchFinancialStatus);
const RetailWSSalesType = useSelector(GlobalRetailWSSalesType);
const appPreferences = useSelector(ApplicationPreferences);
const bookingTypePreference = appPreferences?.find(
@ -282,10 +314,6 @@ const BSBilling4Payment = () => {
type?.PreferredSubCatName?.toLowerCase() === 'dine in' &&
type?.PreferredStatus === 'Y'
);
const preferenceOffer =
SettingDataSelector?.[0]?.['SettingDtlDetails']?.find(
(item) => item.SettingIdName === 'Offer'
)?.SettingValue === 'Y';
const allowDecimal = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
(setting) =>
setting?.SettingIdName?.toLowerCase() === 'decimal' &&
@ -305,9 +333,6 @@ const BSBilling4Payment = () => {
const ProdSubCat = useSelector(GlobalProductSubCategorie);
const templateData = useSelector(getTemplateData);
const [urlData, setUrlData] = useState();
const OfferCheckedInSetup = templateData?.BookingNavbar?.[1].some(
(item) => item?.OptionName == 'Offer'
);
// for customised invoice number
const { selectedDate, invoiceDate, clearInvoiceDate } = useDateStore();
@ -339,8 +364,6 @@ const BSBilling4Payment = () => {
const BranchId = SessionData?.BranchId;
const UserId = SessionData?.UserId;
const UserType = SessionData?.UserType;
const AuthToken = SessionData?.AuthToken;
const SessionMobileNo = SessionData?.SessionMobileNo;
const [refundPayBtns, setRefundPayBtns] = useState([]);
const [refundPaySelected, setRefundPaySelected] = useState();
const [refundPaySelectedName, setRefundPaySelectedName] = useState(null);
@ -485,8 +508,10 @@ const BSBilling4Payment = () => {
);
const PrinterDetails = useSelector(GlobalPrinterMappingDtls);
const [showCancelConfirm, setShowCancelConfirm] = useState(false);
const holdCheckedSalesSetup = tableOptions?.some(
(item) => item?.OptionName === 'Hold'
);
console.log(PrinterDetails, 'PrinterDetailsPrinterDetails');
const filteredSettingNames = SettingDataSelector?.[0]?.['SettingDtlDetails']
?.filter(
(item) =>
@ -521,7 +546,7 @@ const BSBilling4Payment = () => {
};
dispatch(getPrinterMappingDetails(data)).unwrap();
const Data1 = { AppId, CompId, BranchId };
dispatch(getPrintSelectionComponentData(Data1)).unwrap();
// dispatch(getPrintSelectionComponentData(Data1)).unwrap();
}, []);
useEffect(() => {
@ -531,7 +556,6 @@ const BSBilling4Payment = () => {
}, [salesBillEdit]);
useEffect(() => {
if (salesBillEdit) {
if (SelCustId) {
setRefundPayBtns(AllPaymentOptions);
@ -546,8 +570,7 @@ const BSBilling4Payment = () => {
setRefundPayBtns(withoutCustomer);
}
}
}, [AllPaymentOptions, SelCustId, salesBillEdit])
}, [AllPaymentOptions, SelCustId, salesBillEdit]);
useEffect(() => {
const fetchCreditCustomer = async () => {
@ -648,14 +671,21 @@ const BSBilling4Payment = () => {
const filteredPayments =
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 =
filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || [];
filteredPayments.length > 0
? filteredPayments
: previousOrderPayment || [];
const totalPreviouspayment = paymentsToUse?.reduce(
(acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
(acc, payment) =>
acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
0
);
@ -664,8 +694,7 @@ const BSBilling4Payment = () => {
0
);
const previousNetAmount =
(totalPreviouspayment) || 0;
const previousNetAmount = totalPreviouspayment || 0;
let withdiscTotal =
Total -
@ -677,12 +706,26 @@ const BSBilling4Payment = () => {
withdiscTotal >= 0
? (Number(withdiscTotal) + 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);
setPreviousNetAmount(previousNetAmount);
dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount));
dispatch(
changeSummeryTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
)
);
dispatch(changeSummeryComboOfferAmount(withComboSum));
@ -1235,8 +1278,10 @@ const BSBilling4Payment = () => {
}, [OrderCardDetail]);
useEffect(() => {
if (CompId && BranchId && AppId) {
if (holdCheckedSalesSetup) {
getHolddata();
getUnpaiddatas();
}
// getUnpaiddatas();
getCustomerData();
}
}, [CompId, BranchId, AppId]);
@ -1369,7 +1414,11 @@ const BSBilling4Payment = () => {
const handleButtonClick = () => {
if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) {
UpiPayment();
} else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) {
} else if (
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
!refundPaySelected
) {
setMessageType('warning');
setMessageData('Please Select Refund Payment Method');
return;
@ -1680,7 +1729,7 @@ const BSBilling4Payment = () => {
const handleRefundPaymentMode = (id, name) => {
setRefundPaySelected(id);
setRefundPaySelectedName(name);
}
};
const addUpiOption = async (id, name, UPIId) => {
await dispatch(changeUpiIDprint(UPIId));
@ -1899,7 +1948,9 @@ const BSBilling4Payment = () => {
setCurrentOrderNetAmount(0);
setPreviousNetAmount(0);
setUpinotSelected(false);
if (holdCheckedSalesSetup) {
getHolddata();
}
if (defaultBookingType === 'Both') {
await dispatch(changeBookingType('TakeAway'));
}
@ -2201,8 +2252,10 @@ const BSBilling4Payment = () => {
SalesPaymentType: 'normal',
PaymentDetail: [
{
PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected :
Paybtnnameselected?.toLowerCase() === 'upi'
PaymentType:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? refundPaySelected
: Paybtnnameselected?.toLowerCase() === 'upi'
? SelectedUPIPayOption?.toLowerCase() === 'pd'
? PaymentDeviceUPI?.[0]?.ModeId
: SelectedUPIPayOption?.toLowerCase() === 'pg'
@ -2215,15 +2268,25 @@ const BSBilling4Payment = () => {
: paybtnselected
? paybtnselected
: null,
Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount),
MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null :
Paybtnnameselected?.toLowerCase() === 'upi' &&
Amount:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? previousNetAmount - currentOrderNetAmount
: Math.round(TotalAmount),
MerchantId:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantId
: null,
PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' :
Paybtnnameselected?.toLowerCase() === 'cash'
PaymentOptionType:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'PC'
@ -2236,16 +2299,21 @@ const BSBilling4Payment = () => {
? 'BU'
: SelectedUPIPayOption
: null,
ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null :
SelectedUPIPayOption?.toLowerCase() === 'default'
ModeOfPayment:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: SelectedUPIPayOption?.toLowerCase() === 'default'
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
?.UPIDetailId
: SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantUPIId
? BusinessPayOption?.find(
(busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
: null,
AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] :
Paybtnnameselected?.toLowerCase() === 'upi' &&
AccountDtl:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? []
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default'
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
(upipay) => upipay?.UPIId === UpiId
@ -2261,8 +2329,10 @@ const BSBilling4Payment = () => {
SelectedCardOption?.toLowerCase() === 'pg')
? useOptions?.[0]?.PaymentDetails?.PaymentGateway
: [],
PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' :
Paybtnnameselected?.toLowerCase() === 'cash'
PaymentStatus:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? 'S'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'S'
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'S'
@ -2270,9 +2340,18 @@ const BSBilling4Payment = () => {
SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S'
: 'P',
Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0,
Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && Paybtnnameselected?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 :
Debit:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
? Math.round(previousNetAmount - currentOrderNetAmount)
: 0,
Credit: salesBillEdit
? currentOrderNetAmount > previousNetAmount &&
Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount)
: 0
: Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount)
: 0,
},
@ -3385,8 +3464,10 @@ const BSBilling4Payment = () => {
setDefaultPaymentMode([]);
}
};
if (salesBillEdit) {
setDefaultPaymentOption();
}, [defaultPaymentTrigger]);
}
}, [defaultPaymentTrigger, salesBillEdit]);
const Otherserviceprint = async () => {
if (OtherServicesPrintDetails?.length > 0) {
@ -3541,6 +3622,7 @@ const BSBilling4Payment = () => {
};
return (
<Suspense fallback={<span>Loading ...</span>}>
<div className="BSBilling4-price-full">
<div className="BSBilling4-price-content">
<div className="Table4-price-icon-container">
@ -3602,7 +3684,9 @@ const BSBilling4Payment = () => {
style={{
fontSize: '25px',
color:
selOption || GetCustId ? '#52c41a' : '#1292EE',
selOption || GetCustId
? '#52c41a'
: '#1292EE',
cursor: Custdisable ? 'not-allowed' : 'pointer',
}}
/>
@ -3691,8 +3775,9 @@ const BSBilling4Payment = () => {
/>
</div>
)}
{tableOptions?.filter((item) => item.OptionName === 'AddCustomer')
.length === 1 || navCust === true ? (
{tableOptions?.filter(
(item) => item.OptionName === 'AddCustomer'
).length === 1 || navCust === true ? (
<div style={{ width: '2rem' }}>
{Object.keys(useOptions)?.length > 0 &&
useOptions?.some((flow) =>
@ -3716,7 +3801,8 @@ const BSBilling4Payment = () => {
onClick={CreditCustomerFun}
style={{
cursor:
OrderCardDetail?.length > 0 && 'not-allowed',
OrderCardDetail?.length > 0 &&
'not-allowed',
color:
OrderCardDetail?.length > 0 ||
(selOption?.value === undefined &&
@ -3793,7 +3879,10 @@ const BSBilling4Payment = () => {
)}
{OtherServicesglobal && OrderCardDetail.length >= 1 && (
<TooltipWrapper title="Vehicle Number" isMobile={isMobile}>
<TooltipWrapper
title="Vehicle Number"
isMobile={isMobile}
>
{' '}
<div
className="BSBillingNav-icon-table-icon"
@ -3938,7 +4027,10 @@ const BSBilling4Payment = () => {
paybtns?.length > 0 &&
CheckBookingStatus != 'Close' &&
!addnewAccess && (
<TooltipWrapper title={'Hold'} isMobile={isMobile}>
<TooltipWrapper
title={'Hold'}
isMobile={isMobile}
>
{' '}
<PozoHoldIcon
className="BSBillingNav-icon-table-icon"
@ -3979,7 +4071,9 @@ const BSBilling4Payment = () => {
cursor: 'pointer',
color: Holddata ? '#52c41a' : 'default',
pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
OrderType === 'Failed'
? 'none'
: 'auto',
}}
/>
</Badge>
@ -4024,7 +4118,8 @@ const BSBilling4Payment = () => {
: 1,
}}
>
{paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? (
{paybtns?.length > 0 &&
currentOrderNetAmount >= previousNetAmount ? (
paybtns?.map((payment) => (
<div className="Table3-cash">
<button
@ -4104,7 +4199,9 @@ const BSBilling4Payment = () => {
</button>
</div>
))
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? (
) : currentOrderNetAmount < previousNetAmount &&
salesBillEdit &&
refundPayBtns.length > 0 ? (
refundPayBtns.map((payment) => (
<div className="Table3-cash">
<button
@ -4124,7 +4221,12 @@ const BSBilling4Payment = () => {
? 'blink-animation 0.5s infinite alternate'
: 'none',
}}
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)}
onClick={() =>
handleRefundPaymentMode(
payment?.ConfigId,
payment?.ConfigName
)
}
>
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
@ -4375,8 +4477,10 @@ const BSBilling4Payment = () => {
OrderCardDetail?.length > 0 &&
paybtnselected &&
CheckBookingStatus != 'Close'
? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
'Table4-Btn-final-price'
? !OrderStatus
? salesBillEdit &&
currentOrderNetAmount < previousNetAmount
? 'Table4-Btn-final-price'
: 'Table4-Btn-final-price'
: 'Table4-Btn-final-price order'
: 'Table4-Btn-final-price-disabled'
@ -4390,7 +4494,15 @@ const BSBilling4Payment = () => {
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-rate"
@ -4415,7 +4527,10 @@ const BSBilling4Payment = () => {
OrderType === 'Failed'
? FailedTotalAmt
: credit && overAllBal >= 0
? Math.max(0, TotalAmount - overAllBal)
? Math.max(
0,
TotalAmount - overAllBal
)
: TotalAmount
)}
/>
@ -4427,6 +4542,7 @@ const BSBilling4Payment = () => {
<BiRightArrowAlt />
</div>
</div>
)
) : (
<div className="billing-in-style-Order4">ORDER</div>
)}
@ -4524,7 +4640,9 @@ const BSBilling4Payment = () => {
)
}
CreatedDate={orderDetail?.CreatedDate}
PaymentStatus={PrintOrderDetails?.[0]?.PaymentOrderDtl}
PaymentStatus={
PrintOrderDetails?.[0]?.PaymentOrderDtl
}
Preference={SettingDataSelector}
printDatas={printDatas}
/>
@ -4549,7 +4667,9 @@ const BSBilling4Payment = () => {
)
}
CreatedDate={orderDetail?.CreatedDate}
PaymentStatus={PrintOrderDetails?.[0]?.PaymentOrderDtl}
PaymentStatus={
PrintOrderDetails?.[0]?.PaymentOrderDtl
}
/>
</div>
)
@ -4599,9 +4719,10 @@ const BSBilling4Payment = () => {
children={
<>
<div>
You have already selected a table. If you click 'OK,' the table
selection will be removed, and the unpaid flow will continue. If
you click 'Cancel,' the dine-in flow will proceed as selected.
You have already selected a table. If you click 'OK,' the
table selection will be removed, and the unpaid flow will
continue. If you click 'Cancel,' the dine-in flow will proceed
as selected.
</div>
</>
}
@ -4614,10 +4735,17 @@ const BSBilling4Payment = () => {
SplitPaymentModal={Splitpayment}
handlesplitpaymentclose={handlesplitpaymentclose}
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) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0)))
(Discount > 0 ? Discount : 0))
)
}
failedOrderData={failedOrderData}
/>
@ -4740,7 +4868,9 @@ const BSBilling4Payment = () => {
width: '100%',
padding: 8,
borderRadius: 4,
border: error ? '1px solid red' : '1px solid #ccc',
border: error
? '1px solid red'
: '1px solid #ccc',
}}
/>
{error && (
@ -4830,6 +4960,7 @@ const BSBilling4Payment = () => {
/>
)}
</div>
</Suspense>
);
};
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 { isMobile } from 'react-device-detect';
import { AiFillDelete, AiOutlineClose } from 'react-icons/ai';
@ -55,7 +55,9 @@ import {
ChangeTotalAmount,
globalExtraTotalAmount,
} 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 TakeAwayIcon from '../../../../../Images/Take away.svg';
import WebFont from 'webfontloader';
@ -66,8 +68,11 @@ import {
} from '../../../../../Features/BookingScreen/HoldOption/HoldOption.js';
import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import BSEditTotalAmt from '../BSEditTotalAmount/BSEditTotalAmt.jsx';
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx';
const BSEditTotalAmt = lazy(
() => import('../BSEditTotalAmount/BSEditTotalAmt.jsx')
);
const BSImeiDetails = lazy(() => import('../BSImeiDetails/BSImeiDetails.jsx'));
import {
ChangeFullFreeProductList,
changeFullOfferAppliedProducts,
@ -78,8 +83,9 @@ import {
import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js';
import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js';
import { useUtilsComponent } from '../../../../../Services/utils.js';
import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
const CustomerPriceHistory = lazy(
() => import('../../UtillComponents/CustomerPriceHistory.jsx')
);
const BSBillingTable4 = () => {
const { removeExtraCharge } = useUtilsComponent();
const dispatch = useDispatch();
@ -117,7 +123,6 @@ const BSBillingTable4 = () => {
const UnpaidData = useSelector(GlobalUnpaidData);
const tableData = useSelector(GlobalOrderCardDetails);
console.log(tableData, 'tableDatatableData');
const salesBillEdit = useSelector(GlobalSalesBillEdit);
const ReportholdData = useSelector(GlobalReorderHoldDetails);
const PreviousOrderLength = useSelector(GlobalPreviousOrderLength);
const HoldOrderDtl = useSelector(GlobalHoldOrderDtl);
@ -146,7 +151,8 @@ const BSBillingTable4 = () => {
const GetCustId = useSelector(GlobalCustId);
const selectedCustomer = useSelector(GlobalSelOption);
const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false);
const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] =
useState(false);
const [customerProduct, setCustomerProduct] = useState(null);
const [OpenEditTotalAmt, setOpenEditTotalAmt] = useState(false);
const [OpenImeiDetail, setOpenImeiDetail] = useState(false);
@ -312,7 +318,6 @@ const BSBillingTable4 = () => {
event.preventDefault();
handleShortcut('weightAmount');
}
};
window.addEventListener('keydown', handleKeyDown);
@ -329,142 +334,6 @@ const BSBillingTable4 = () => {
const handleImeiDetailClose = () => {
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 = (
OrderQty,
@ -2083,7 +1952,6 @@ const BSBillingTable4 = () => {
}
}
}
};
const UnblockSlots = async (newCartItem) => {
let BlockPostdata = {
@ -2145,7 +2013,7 @@ const BSBillingTable4 = () => {
const handleCustomerProductPriceHistory = (item) => {
setCustomerPriceHistoryOpen(true);
setCustomerProduct(item?.ProdId);
}
};
const getstockbadge = async () => {
let data = {
@ -2306,6 +2174,7 @@ const BSBillingTable4 = () => {
};
return (
<Suspense fallback={<div>Loading...</div>}>
<div
className={
isMobile ? 'BSBilling4-tablediv-mobile' : 'BSBilling4-tablediv'
@ -2520,7 +2389,8 @@ const BSBillingTable4 = () => {
{OldtableDataTakeAway?.map((item, index) => (
<tr
key={index}
className={`${item?.SalesId && OrderType !== 'Hold'
className={`${
item?.SalesId && OrderType !== 'Hold'
? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content'
}
@ -2541,7 +2411,8 @@ const BSBillingTable4 = () => {
: BookingType !== 'Dine In' &&
triggerAnimation &&
index === 0 &&
tableDataTakeAway?.length >= PreviousdataLength &&
tableDataTakeAway?.length >=
PreviousdataLength &&
!HoldOrderDtl &&
!UnpaidData
? 'wheat'
@ -2610,7 +2481,8 @@ const BSBillingTable4 = () => {
}
>
{item.ProdName}
&nbsp; {item?.BrandName !== null ? item?.BrandName : ''}
&nbsp;{' '}
{item?.BrandName !== null ? item?.BrandName : ''}
{item?.Type != 'C' && (
<>
<p
@ -2792,7 +2664,8 @@ const BSBillingTable4 = () => {
{OldtableDataDinein?.map((item, index) => (
<tr
key={OldtableDataTakeAway?.length + index}
className={`${item?.SalesId
className={`${
item?.SalesId
? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content'
}
@ -2880,7 +2753,8 @@ const BSBillingTable4 = () => {
}}
>
{item.ProdName}
&nbsp; {item?.BrandName !== null ? item?.BrandName : ''}
&nbsp;{' '}
{item?.BrandName !== null ? item?.BrandName : ''}
{item?.Type != 'C' && (
<>
<p
@ -3066,7 +2940,8 @@ const BSBillingTable4 = () => {
OldtableDataTakeAway?.length +
index
}
className={`${BookingType === 'Dine In' && item?.SalesId
className={`${
BookingType === 'Dine In' && item?.SalesId
? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content'
}
@ -3093,7 +2968,8 @@ const BSBillingTable4 = () => {
OldtableDataTakeAway?.length +
index ===
0 &&
tableDataTakeAway?.length >= PreviousdataLength &&
tableDataTakeAway?.length >=
PreviousdataLength &&
!HoldOrderDtl &&
!UnpaidData
? 'wheat'
@ -3104,7 +2980,9 @@ const BSBillingTable4 = () => {
0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.[
'OverallBackgroundColor'
]
: '#d6d6d6'
: (OldtableDataDinein?.length +
OldtableDataTakeAway?.length +
@ -3188,8 +3066,11 @@ const BSBillingTable4 = () => {
: editField && handleEditQuantity(item, index)
}
>
{item?.Type !== 'OS' ? item.ProdName : item.ServiceName}
&nbsp; {item?.BrandName !== null ? item?.BrandName : ''}
{item?.Type !== 'OS'
? item.ProdName
: item.ServiceName}
&nbsp;{' '}
{item?.BrandName !== null ? item?.BrandName : ''}
{item?.Type != 'C' && (
<>
<p
@ -3385,7 +3266,8 @@ const BSBillingTable4 = () => {
OldtableDataTakeAway?.length +
index
}
className={`${item?.SalesId && OrderType !== 'Hold'
className={`${
item?.SalesId && OrderType !== 'Hold'
? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content'
}
@ -3499,7 +3381,8 @@ const BSBillingTable4 = () => {
}}
>
{item.ProdName}
&nbsp; {item?.BrandName !== null ? item?.BrandName : ''}
&nbsp;{' '}
{item?.BrandName !== null ? item?.BrandName : ''}
{item?.Type != 'C' && (
<>
<p
@ -3690,7 +3573,7 @@ const BSBillingTable4 = () => {
ProductDetail={Modaldata}
/>
)}
{(customerPriceHistoryOpen && GetCustId) &&
{customerPriceHistoryOpen && GetCustId && (
<CustomerPriceHistory
open={customerPriceHistoryOpen}
custId={GetCustId}
@ -3699,8 +3582,9 @@ const BSBillingTable4 = () => {
setCustomerProduct={setCustomerProduct}
selectedCustomer={selectedCustomer}
/>
}
)}
</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 moment from 'moment';
import { Popover, Badge, Modal, Tooltip } from 'antd';
import { useNavigate } from 'react-router-dom';
import {
UpOutlined,
ArrowRightOutlined,
UpCircleOutlined,
DownCircleOutlined,
@ -15,7 +14,6 @@ import defaultupi from '../../../../../Images/defaultupi.png';
import pozologoimg from '../../../../../Images/pozologoimg.png';
import paydevice from '../../../../../Images/paydevice.png';
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable15.scss';
import BsBill from './BsBill';
import { isMobile } from 'react-device-detect';
import {
GlobalSelectedFont,
@ -29,7 +27,9 @@ import {
} from '../../../../../Features/ThemeChange/ThemeChange';
import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js';
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 {
GlobalOrderCardDetails,
@ -105,7 +105,6 @@ import {
GlobalOverAllDiscSales,
ChangeOverAllDiscSales,
ChangeOverAllDiscEstimate,
getAllCustomer,
GlobalBranchFinancialStatus,
changeSummeryComboOfferAmount,
ChangeComboCarddata,
@ -130,6 +129,7 @@ import {
changeBillEditingMode,
changePreviousOrderPayment,
changePreviousOrderOfferDetail,
GlobalAllBookingType,
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
import { ChangeTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges.js'; //Shifayth Date:27/12/2023
import {
@ -137,7 +137,6 @@ import {
globalholddata,
changeholddata,
} from '../../../../../Features/BookingScreen/HoldOption/HoldOption';
import PaymentPdfBooking from '../../../../paymentpdfPage/PaymentPdfBooking';
import { globalExtraTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges';
import {
encryptObject,
@ -154,34 +153,21 @@ import {
triggerCustomerRefresh,
} from '../../../../../Features/BookingScreen/Customer/addCustomer';
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 PozoBillIcon from '../../UtillComponents/Pozo retail icons/PozoBIllIcon.jsx';
import PozoAddCustomerIcon from '../../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx';
import QrComponent from '../../BookingFunctionality/DynamicQr.jsx';
import QrinScreen from '../../BookingFunctionality/DynamicScreenQr.jsx';
import Buttons from '../../../../../Components/Forms/Buttons';
import WpIcon from '../../../../../Images/message.png';
import BsBillingCreditCustomer from '../../BookingFunctionality/BSBillingCreditCustomer.jsx';
import BSCreditCustomer from '../../UtillComponents/BSCreditCustomer.jsx';
import PozoAdvanceIcon from '../../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx';
import MobilePrint from '../../BookingFunctionality/MobilePrint.jsx';
import CountUp from 'react-countup';
import { GlobalpreOrderOpen } from '../../../../../Features/BookingScreen/PreOrder/PreOrder.js';
import SplitPayment from '../../BookingFunctionality/SplitPayment.jsx';
import TokensinglePrint from '../../../../paymentpdfPage/TokenOnlyPrints/TokeninsinglePrint.jsx';
import SingleTokenMobilePrint from '../../BookingFunctionality/SingleTokenMobilePrint.jsx';
import IndividualTokenMobilePrint from '../../BookingFunctionality/IndividualTokenMobilePrint.jsx';
import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js';
import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx';
import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx';
import {
Global_CoupenCodeAmount,
Global_loyaltyPointsDiscountAmount,
Global_OrderOfferDetail,
Global_OverallOfferAmount,
Global_SalesWiseOfferAmount,
} from '../../../../../Features/Offer/Offer.js';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip';
@ -191,21 +177,13 @@ import {
changeSalesPaymentoption,
GlobalSalesPaymentoption,
} from '../../../../../Features/Payment/Paymentoptions/Paymentoptions.js';
import Paymentoption from '../../../../Payment/PaymentOptions/PaymentOptions.jsx';
import { getPaymentOptionsData } from '../../../../../Features/BookingScreen/BookingData/KioskBookingData.js';
import { getCombolist } from '../../../../../Features/ComboMaster/ComboMaster.js';
import WhatsAppShare from '../../../../WhatsAppShare/whatsAppShare.jsx';
import SMSShare from '../../../../WhatsAppShare/SmsShare.jsx';
import { MdSms } from 'react-icons/md';
import { FaWhatsapp, FaPrint, FaCartPlus } from 'react-icons/fa';
import BSTipAmount from '../../UtillComponents/BSTipAmount.jsx';
import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js';
import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js';
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 {
ChangeFullFreeProductList,
@ -217,14 +195,75 @@ import {
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import CardPopover from '../StandardTable/Utils/CardPopover.jsx';
import UpiPopover from '../StandardTable/Utils/UpiPopOver.jsx';
import PaymentGatewayEmbedded from '../../UtillComponents/PaymentGatewayEmbedded.jsx';
import MobileMultiPdfPrintTrigger from '../../UtillComponents/MobileMultiPdfPrintTrigger.jsx';
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 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');
@ -244,11 +283,12 @@ const BSBillingTable5 = () => {
const BranchId = SessionData?.BranchId;
const UserId = SessionData?.UserId;
const UserType = SessionData?.UserType;
const AuthToken = SessionData?.AuthToken;
const SessionMobileNo = SessionData?.SessionMobileNo;
const AllBookingType = useSelector(GlobalAllBookingType);
const salesBillEdit = useSelector(GlobalSalesBillEdit);
const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails);
const previousOrderOfferDetails = useSelector(
GlobalPreviousOrderOfferDetails
);
const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
const Discount = useSelector(GlobalOverAllOfferAmt);
const FreeProdList = useSelector(GlobalFreeProdList);
@ -485,6 +525,10 @@ const BSBillingTable5 = () => {
// for customised invoice number
const { invoiceDate, clearInvoiceDate } = useDateStore();
const CurrentOrderId = useSelector(GlobalCurrentOrderId);
const holdCheckedSalesSetup = tableOptions?.some(
(item) => item?.OptionName === 'Hold'
);
useEffect(() => {
if (salesBillEdit) {
dispatch(getPaymentOptions()).unwrap();
@ -492,7 +536,6 @@ const BSBillingTable5 = () => {
}, [salesBillEdit]);
useEffect(() => {
if (salesBillEdit) {
if (SelCustId) {
setRefundPayBtns(AllPaymentOptions);
@ -507,8 +550,7 @@ const BSBillingTable5 = () => {
setRefundPayBtns(withoutCustomer);
}
}
}, [AllPaymentOptions, SelCustId, salesBillEdit])
}, [AllPaymentOptions, SelCustId, salesBillEdit]);
useEffect(() => {
if (
@ -529,8 +571,8 @@ const BSBillingTable5 = () => {
UserId: UserId,
};
dispatch(getPrinterMappingDetails(data)).unwrap();
const Data1 = { AppId, CompId, BranchId };
dispatch(getPrintSelectionComponentData(Data1)).unwrap();
// const Data1 = { AppId, CompId, BranchId };
// dispatch(getPrintSelectionComponentData(Data1)).unwrap();
}, []);
useEffect(() => {
if (selOption) {
@ -634,17 +676,23 @@ const BSBillingTable5 = () => {
);
}
const filteredPayments =
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 =
filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || [];
filteredPayments.length > 0
? filteredPayments
: previousOrderPayment || [];
const totalPreviouspayment = paymentsToUse?.reduce(
(acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
(acc, payment) =>
acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
0
);
@ -653,8 +701,7 @@ const BSBillingTable5 = () => {
0
);
const previousNetAmount =
(totalPreviouspayment) || 0;
const previousNetAmount = totalPreviouspayment || 0;
let withdiscTotal =
Total -
@ -666,12 +713,26 @@ const BSBillingTable5 = () => {
withdiscTotal >= 0
? (Number(withdiscTotal) + 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);
setPreviousNetAmount(previousNetAmount);
dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount));
dispatch(
changeSummeryTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
)
);
dispatch(changeSummeryComboOfferAmount(withComboSum));
@ -696,8 +757,9 @@ const BSBillingTable5 = () => {
useEffect(() => {
if (CompId && BranchId && AppId) {
if (holdCheckedSalesSetup) {
getHolddata();
getUnpaiddatas();
}
getCustomerData();
}
}, [CompId, BranchId, AppId]);
@ -728,28 +790,6 @@ const BSBillingTable5 = () => {
setaddnewAccess(!hasAccess);
}, [empData, SAAccessCommonMaster, UserType]);
// useEffect(() => {
// const handleKeyPress = (event) => {
// if (event.shiftKey && event.code === 'KeyM') {
// if (
// document.activeElement.tagName !== 'INPUT' &&
// document.activeElement.tagName !== 'TEXTAREA'
// ) {
// event.preventDefault();
// setBlink(true);
// }
// }
// };
// const handleClickOutside = (event) => {
// setBlink(false);
// };
// window.addEventListener('keydown', handleKeyPress);
// window.addEventListener('mousedown', handleClickOutside);
// return () => {
// window.removeEventListener('keydown', handleKeyPress);
// window.addEventListener('mousedown', handleClickOutside);
// };
// }, []);
const formatAmount = (value) => {
return allowDecimal
? parseFloat(value || 0).toFixed(2)
@ -769,9 +809,6 @@ const BSBillingTable5 = () => {
setEmpData(datas?.[0]);
};
const getCustomerData = async () => {
await dispatch(
getAllCustomer({ CompId: CompId, AppId: AppId, branchId: BranchId })
);
await dispatch(
getAddCustomerDetails({
CompId: CompId,
@ -908,7 +945,11 @@ const BSBillingTable5 = () => {
const handleButtonClick = () => {
if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) {
UpiPayment();
} else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) {
} else if (
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
!refundPaySelected
) {
setMessageType('warning');
setMessageData('Please Select Refund Payment Method');
return;
@ -1554,20 +1595,12 @@ const BSBillingTable5 = () => {
};
const getBookingTypeId = async () => {
let tempconfigdata = await dispatch(
getConfigType({ TypeName: 'Booking Type' })
).unwrap();
if (tempconfigdata?.data?.statusCode == 1) {
setConfigDataList(tempconfigdata?.data?.data);
let configdata = tempconfigdata?.data?.data;
setConfigDataList(AllBookingType);
let configdata = AllBookingType;
let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType;
let filterconfigdata = configdata?.find(
(a) => a?.ConfigName === checkName
);
let filterconfigdata = configdata?.find((a) => a?.ConfigName === checkName);
setSelectedBookingType(filterconfigdata?.ConfigId);
}
};
const TotalItemsCalculation = async () => {
let tempTotalitems = OrderCardDetail?.length;
@ -1751,7 +1784,7 @@ const BSBillingTable5 = () => {
const handleRefundPaymentMode = (id, name) => {
setRefundPaySelected(id);
setRefundPaySelectedName(name);
}
};
const addUpiOption = async (id, name, UPIId) => {
await dispatch(changeUpiIDprint(UPIId));
@ -1814,12 +1847,7 @@ const BSBillingTable5 = () => {
const hideDefault = () => {
setUpiOptionOpen(false);
};
const handlePopoverVisibleChange = (visible) => {
setUpiOptionOpen(visible);
};
const handlePopoverVisibleChangeCard = (visible) => {
setCardOptionOpen(visible);
};
const getHolddata = async () => {
const data = { CompId: CompId, BranchId: BranchId, AppId: AppId };
let response = await dispatch(gettinghold(data)).unwrap();
@ -1915,7 +1943,9 @@ const BSBillingTable5 = () => {
setUpinotSelected(false);
setCurrentOrderNetAmount(0);
setPreviousNetAmount(0);
if (holdCheckedSalesSetup) {
getHolddata();
}
if (defaultBookingType === 'Both') {
await dispatch(changeBookingType('TakeAway'));
}
@ -2214,8 +2244,10 @@ const BSBillingTable5 = () => {
SalesPaymentType: 'normal',
PaymentDetail: [
{
PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected :
Paybtnnameselected?.toLowerCase() === 'upi'
PaymentType:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? refundPaySelected
: Paybtnnameselected?.toLowerCase() === 'upi'
? SelectedUPIPayOption?.toLowerCase() === 'pd'
? PaymentDeviceUPI?.[0]?.ModeId
: SelectedUPIPayOption?.toLowerCase() === 'pg'
@ -2228,15 +2260,25 @@ const BSBillingTable5 = () => {
: paybtnselected
? paybtnselected
: null,
Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount),
MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null :
Paybtnnameselected?.toLowerCase() === 'upi' &&
Amount:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? previousNetAmount - currentOrderNetAmount
: Math.round(TotalAmount),
MerchantId:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantId
: null,
PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' :
Paybtnnameselected?.toLowerCase() === 'cash'
PaymentOptionType:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'PC'
@ -2249,16 +2291,21 @@ const BSBillingTable5 = () => {
? 'BU'
: SelectedUPIPayOption
: null,
ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null :
SelectedUPIPayOption?.toLowerCase() === 'default'
ModeOfPayment:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: SelectedUPIPayOption?.toLowerCase() === 'default'
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
?.UPIDetailId
: SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantUPIId
? BusinessPayOption?.find(
(busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
: null,
AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] :
Paybtnnameselected?.toLowerCase() === 'upi' &&
AccountDtl:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? []
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default'
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
(upipay) => upipay?.UPIId === UpiId
@ -2274,8 +2321,10 @@ const BSBillingTable5 = () => {
SelectedCardOption?.toLowerCase() === 'pg')
? useOptions?.[0]?.PaymentDetails?.PaymentGateway
: [],
PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' :
Paybtnnameselected?.toLowerCase() === 'cash'
PaymentStatus:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? 'S'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'S'
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'S'
@ -2283,9 +2332,18 @@ const BSBillingTable5 = () => {
SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S'
: 'P',
Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0,
Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && Paybtnnameselected?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 :
Debit:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
? Math.round(previousNetAmount - currentOrderNetAmount)
: 0,
Credit: salesBillEdit
? currentOrderNetAmount > previousNetAmount &&
Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount)
: 0
: Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount)
: 0,
},
@ -3389,8 +3447,10 @@ const BSBillingTable5 = () => {
setDefaultPaymentMode([]);
}
};
if (salesBillEdit) {
setDefaultPaymentOption();
}, [defaultPaymentTrigger]);
}
}, [defaultPaymentTrigger, salesBillEdit]);
const Otherserviceprint = async () => {
if (OtherServicesPrintDetails?.length > 0) {
@ -3545,6 +3605,7 @@ const BSBillingTable5 = () => {
};
return (
<>
<Suspense fallback={<div>Loading</div>}>
<div
className={
templateData?.BookingLayout?.[0] === 'Layout6'
@ -3665,7 +3726,10 @@ const BSBillingTable5 = () => {
<div className="BSBillingTable-billtable">
<div className="BSBillingTable5-payOpt">
<div className="payrow1">
<Messages messageType={messageType} messageData={messageData} />
<Messages
messageType={messageType}
messageData={messageData}
/>
</div>
<div className="payrow2">
@ -3695,7 +3759,8 @@ const BSBillingTable5 = () => {
: 1,
}}
>
{paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? (
{paybtns?.length > 0 &&
currentOrderNetAmount >= previousNetAmount ? (
paybtns?.map((payment) => (
<div className="Table3-cash">
<button
@ -3704,7 +3769,8 @@ const BSBillingTable5 = () => {
(UpinotSelected || CardoptionnotSelected)
? 'Btn-payment-mode-notupisel'
: paybtnselected === payment.ModeId &&
(!UpinotSelected || !CardoptionnotSelected)
(!UpinotSelected ||
!CardoptionnotSelected)
? 'Btn-payment-mode'
: 'Btn-payment-mode-sel'
}
@ -3735,7 +3801,8 @@ const BSBillingTable5 = () => {
}}
>
{payment.ModeName}
{payment?.ModeName?.toLowerCase() === 'card' && (
{payment?.ModeName?.toLowerCase() ===
'card' && (
<CardPopover
CardPayOption={CardPayOption}
SelectedCardOption={SelectedCardOption}
@ -3773,7 +3840,9 @@ const BSBillingTable5 = () => {
</button>
</div>
))
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? (
) : currentOrderNetAmount < previousNetAmount &&
salesBillEdit &&
refundPayBtns.length > 0 ? (
refundPayBtns.map((payment) => (
<div className="Table3-cash">
<button
@ -3782,7 +3851,8 @@ const BSBillingTable5 = () => {
(UpinotSelected || CardoptionnotSelected)
? 'Btn-payment-mode-notupisel'
: refundPaySelected === payment.ConfigId &&
(!UpinotSelected || !CardoptionnotSelected)
(!UpinotSelected ||
!CardoptionnotSelected)
? 'Btn-payment-mode'
: 'Btn-payment-mode-sel'
}
@ -3793,7 +3863,12 @@ const BSBillingTable5 = () => {
? 'blink-animation 0.5s infinite alternate'
: 'none',
}}
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)}
onClick={() =>
handleRefundPaymentMode(
payment?.ConfigId,
payment?.ConfigName
)
}
>
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
@ -3943,7 +4018,10 @@ const BSBillingTable5 = () => {
</div>
</div>
</div>
<div style={{ justifyContent: 'center' }} className="CustomerAddSrch">
<div
style={{ justifyContent: 'center' }}
className="CustomerAddSrch"
>
<div style={{ height: '2.1rem' }}>
{tableOptions
.filter((item) => item.OptionName === 'AddCustomer')
@ -4280,8 +4358,10 @@ const BSBillingTable5 = () => {
OrderCardDetail?.length > 0 &&
paybtnselected &&
CheckBookingStatus != 'Close'
? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
'BSBIllingTable5-paybtn-noitems'
? !OrderStatus
? salesBillEdit &&
currentOrderNetAmount < previousNetAmount
? 'BSBIllingTable5-paybtn-noitems'
: 'BSBIllingTable5-paybtn-noitems'
: 'BSBIllingTable5-paybtn-noitems Order'
: 'BSBIllingTable5-paybtn-noitems-disable'
@ -4294,7 +4374,15 @@ const BSBillingTable5 = () => {
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)} */}
{isMobile ? (
@ -4323,6 +4411,7 @@ const BSBillingTable5 = () => {
)}
<ArrowRightOutlined />
</>
)
) : (
<div>ORDER</div>
)}
@ -4405,7 +4494,8 @@ const BSBillingTable5 = () => {
}
/>
{PrintOrderDetails?.length > 0 &&
PrintOrderDetails?.[0]?.OrderDetails?.map((orderDetail, index) => (
PrintOrderDetails?.[0]?.OrderDetails?.map(
(orderDetail, index) => (
<div style={{ display: 'none' }}>
<PaymentPdfBooking
index={index}
@ -4424,11 +4514,13 @@ const BSBillingTable5 = () => {
printDatas={printDatas}
/>
</div>
))}
)
)}
{PrintOrderDetails?.length > 0 &&
(TokenOnly?.SettingValue === 'Y' ||
IndividualToken?.SettingValue === 'Y') &&
PrintOrderDetails?.[0]?.OrderDetails?.map((orderDetail, index) => (
PrintOrderDetails?.[0]?.OrderDetails?.map(
(orderDetail, index) => (
<div style={{ display: 'none' }}>
<TokensinglePrint
index={index}
@ -4445,7 +4537,8 @@ const BSBillingTable5 = () => {
PaymentStatus={PrintOrderDetails?.[0]?.PaymentOrderDtl}
/>
</div>
))}
)
)}
{CreditCustomer && (
<div style={{ display: 'none' }}>
<BsBillingCreditCustomer
@ -4489,8 +4582,8 @@ const BSBillingTable5 = () => {
<div>
You have already selected a table. If you click 'OK,' the
table selection will be removed, and the unpaid flow will
continue. If you click 'Cancel,' the dine-in flow will proceed
as selected.
continue. If you click 'Cancel,' the dine-in flow will
proceed as selected.
</div>
</>
}
@ -4503,10 +4596,17 @@ const BSBillingTable5 = () => {
SplitPaymentModal={Splitpayment}
handlesplitpaymentclose={handlesplitpaymentclose}
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) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0)))
(Discount > 0 ? Discount : 0))
)
}
failedOrderData={failedOrderData}
/>
@ -4585,7 +4685,9 @@ const BSBillingTable5 = () => {
)
}
CreatedDate={OtherServicesPrintDetails?.CreatedDate}
PaymentStatus={OtherServicesPrintDetails?.[0]?.PaymentOrderDtl}
PaymentStatus={
OtherServicesPrintDetails?.[0]?.PaymentOrderDtl
}
Preference={SettingDataSelector}
printDatas={printDatas}
/>
@ -4695,7 +4797,9 @@ const BSBillingTable5 = () => {
color: '#fff',
border: 'none',
borderRadius: 4,
cursor: hasVehicleInputErrors() ? 'not-allowed' : 'pointer',
cursor: hasVehicleInputErrors()
? 'not-allowed'
: 'pointer',
}}
>
Submit
@ -4777,6 +4881,7 @@ const BSBillingTable5 = () => {
/>
)}
</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 { Popconfirm, Tooltip } from 'antd';
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBillingTable6.scss';
@ -60,7 +60,9 @@ import {
GlobalOfferAppliedProducts,
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
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 WebFont from 'webfontloader';
import dineInIcon from '../../../../../Images/Dine In.svg';
@ -71,11 +73,17 @@ import {
puttinghold,
} from '../../../../../Features/BookingScreen/HoldOption/HoldOption.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 { 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 { removeExtraCharge } = useUtilsComponent();
@ -134,7 +142,8 @@ const BSBillingTable6 = () => {
const GetCustId = useSelector(GlobalCustId);
const selectedCustomer = useSelector(GlobalSelOption);
const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false);
const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] =
useState(false);
const [customerProduct, setCustomerProduct] = useState(null);
const [OpenImeiDetail, setOpenImeiDetail] = useState(false);
const [shortKeyMethod, setshortKeyMethod] = useState(null);
@ -221,9 +230,6 @@ const BSBillingTable6 = () => {
}
}, [tableData]);
// useEffect(() => {
// setPreviousdataLength(PreviousOrderLength)
// }, [PreviousOrderLength])
useEffect(() => {
if (tableOptions?.length > 0) {
let editFieldValue = tableOptions?.filter(
@ -285,7 +291,6 @@ const BSBillingTable6 = () => {
event.preventDefault();
handleShortcut('weightAmount');
}
};
window.addEventListener('keydown', handleKeyDown);
@ -1715,7 +1720,6 @@ const BSBillingTable6 = () => {
OfferId: FreeProd?.OfferId,
CompleteRemove: true,
});
// await ChangeOfferAppliedProdsFn(isPaidproduct?.InwardDtlId, (isPaidproduct?.OrderRate * isPaidproduct?.OrderQty), isPaidproduct?.OrderQty, true, insideinwardDtlId true)
await ChangeOfferAppliedProdsFn({
inwardDtlId: item?.InwardDtlId,
OfferAmount: isPaidproduct?.OrderRate * isPaidproduct?.OrderQty,
@ -1725,8 +1729,6 @@ const BSBillingTable6 = () => {
});
}
} else {
//have to find if thereis two Booking Type is there
//Convert That Free Product To Paid Product
let ischeckBothBookingType = tableData?.find(
(e) =>
e?.InwardDtlId == inward &&
@ -1741,12 +1743,6 @@ const BSBillingTable6 = () => {
e?.BookingTypeName == item?.BookingTypeName
);
if (ischeckBothBookingType) {
//Convert That Free Product To Paid Product
//merge that paid product with same booking type
//decrease free prod list qty
//change offer applied product qty
// await ChangeOrderCardDetailsFn(item?.BookingTypeName, null, ischeckBothBookingType?.OrderQty + FreeProductSameBookingType?.OrderQty, false, ischeckBothBookingType?.InwardDtlId, item?.InwardDtlId, item?.Offer, true)
if (FreeProductSameBookingType?.OrderQty >= item?.OrderQty) {
await ChangeFreeprodlistFn({
OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
@ -1779,7 +1775,6 @@ const BSBillingTable6 = () => {
});
} else {
let data = isCheckFreeProductOutside?.FreeQty - item?.OrderQty;
//First i Calculate Another Booking Type Qty
let anotherBookingType = tableData?.find(
(e) =>
e?.InwardDtlId == item?.InwardDtlId &&
@ -1796,24 +1791,10 @@ const BSBillingTable6 = () => {
let diff =
item?.OrderQty - FreeProductSameBookingType?.OrderQty;
//SameBookingFreeQty
//FreeProductSameBookingType?.OrderQty
//Another BookingType Paid Qty
//anotherBookingType
//anotherBookingType?.Free OrderQty
//ischeckBothBookingType
//anotherBookingType?.OrderQty-ischeckBothBookingType?.OrderQty
//convert another Booking Type Qty also Free to Paid
if (
(anotherBookingType?.OrderQty || 0) <
anotherBookingTypeOffer?.OrderQty
) {
//paidproduct ischeckBothBookingType?.OrderQty-anotherBookingType?.OrderQty
//PaidProdcut Current BookingType FreeProductSameBookingType?.OrderQty
let paidproductAnotherType =
ischeckBothBookingType?.OrderQty -
anotherBookingType?.OrderQty;
@ -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) {
if (amountStr == null) return allowDecimal ? '0.00' : '0';
@ -2118,7 +1962,7 @@ const BSBillingTable6 = () => {
const handleCustomerProductPriceHistory = (item) => {
setCustomerPriceHistoryOpen(true);
setCustomerProduct(item?.ProdId);
}
};
const OpenEditTotalAmount = () => {
setOpenEditTotalAmt(true);
@ -2142,6 +1986,7 @@ const BSBillingTable6 = () => {
};
return (
<Suspense fallback={<div>Loading...</div>}>
<div
className={
true
@ -2384,7 +2229,8 @@ const BSBillingTable6 = () => {
? 'wheat'
: triggerAnimation &&
index === 0 &&
tableDataTakeAway?.length >= PreviousdataLength &&
tableDataTakeAway?.length >=
PreviousdataLength &&
!HoldOrderDtl &&
!UnpaidData
? 'wheat'
@ -2454,7 +2300,8 @@ const BSBillingTable6 = () => {
}
>
{item.ProdName}
&nbsp; {item?.BrandName !== null ? item?.BrandName : ''}
&nbsp;{' '}
{item?.BrandName !== null ? item?.BrandName : ''}
{item?.Type != 'C' && (
<>
<p
@ -2708,7 +2555,8 @@ const BSBillingTable6 = () => {
}}
>
{item.ProdName}
&nbsp; {item?.BrandName !== null ? item?.BrandName : ''}
&nbsp;{' '}
{item?.BrandName !== null ? item?.BrandName : ''}
{item?.Type != 'C' && (
<>
<p
@ -2905,7 +2753,8 @@ const BSBillingTable6 = () => {
OldtableDataTakeAway?.length +
index ===
0 &&
tableDataTakeAway?.length >= PreviousdataLength &&
tableDataTakeAway?.length >=
PreviousdataLength &&
!HoldOrderDtl &&
!UnpaidData
? 'wheat'
@ -2916,7 +2765,9 @@ const BSBillingTable6 = () => {
0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.[
'OverallBackgroundColor'
]
: '#d6d6d6'
: (OldtableDataDinein?.length +
OldtableDataTakeAway?.length +
@ -3000,7 +2851,8 @@ const BSBillingTable6 = () => {
}
>
{item.ProdName}
&nbsp; {item?.BrandName !== null ? item?.BrandName : ''}
&nbsp;{' '}
{item?.BrandName !== null ? item?.BrandName : ''}
{item?.Type != 'C' && (
<>
<p
@ -3288,7 +3140,8 @@ const BSBillingTable6 = () => {
}}
>
{item.ProdName}
&nbsp; {item?.BrandName !== null ? item?.BrandName : ''}
&nbsp;{' '}
{item?.BrandName !== null ? item?.BrandName : ''}
{item?.Type != 'C' && (
<>
<p
@ -3462,7 +3315,7 @@ const BSBillingTable6 = () => {
ProductDetail={Modaldata}
/>
)}
{(customerPriceHistoryOpen && GetCustId) &&
{customerPriceHistoryOpen && GetCustId && (
<CustomerPriceHistory
open={customerPriceHistoryOpen}
custId={GetCustId}
@ -3471,8 +3324,9 @@ const BSBillingTable6 = () => {
setCustomerProduct={setCustomerProduct}
selectedCustomer={selectedCustomer}
/>
}
)}
</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 { useNavigate } from 'react-router-dom';
import moment from 'moment';
import { AiOutlineClose, AiOutlineArrowRight } from 'react-icons/ai';
import { Tables } from '../../../../../Components/Tables/Table';
import { DefaultModal } from '../../../../../Components/Modal/DefaultModal.jsx';
import { UpCircleOutlined, UpOutlined } from '@ant-design/icons';
import { UpCircleOutlined } from '@ant-design/icons';
import { Popover, Badge, Modal, Tooltip } from 'antd';
import {
printDiv,
@ -38,7 +38,6 @@ import {
GlobalSelectedTableDetails,
GlobalBookingType,
changeBookingType,
getConfigType,
PutBookingData,
GlobalReorderHoldDetails,
getUnpaidData,
@ -61,7 +60,6 @@ import {
changeCustomerID,
changeSelectedCustId,
GlobalSelOption,
changefocusStatusBalrec,
changeUnpaidData,
ChangeSelectedCustDisable,
getSalesDetailData,
@ -104,7 +102,6 @@ import {
ChangeOverAllDiscEstimate,
GlobalScreenSize,
GlobalUnpaidListData,
getAllCustomer,
GlobalBranchFinancialStatus,
changeSummeryComboOfferAmount,
ChangeComboCarddata,
@ -129,6 +126,7 @@ import {
changeBillEditingMode,
changePreviousOrderPayment,
changePreviousOrderOfferDetail,
GlobalAllBookingType,
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities';
import {
@ -159,7 +157,6 @@ import QrinScreen from '../../BookingFunctionality/DynamicScreenQr.jsx';
import { ArrowRightOutlined } from '@ant-design/icons';
import Buttons from '../../../../../Components/Forms/Buttons';
import WpIcon from '../../../../../Images/message.png';
import BsBillingCreditCustomer from '../../BookingFunctionality/BSBillingCreditCustomer.jsx';
import BSCreditCustomer from '../../UtillComponents/BSCreditCustomer.jsx';
import PozoAdvanceIcon from '../../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx';
import { isMobile } from 'react-device-detect';
@ -174,17 +171,10 @@ import { getCustomerDisplayWindow } from '../../../../../Features/customerDispla
import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js';
import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx';
import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx';
import {
Global_CoupenCodeAmount,
Global_loyaltyPointsDiscountAmount,
Global_OrderOfferDetail,
Global_OverallOfferAmount,
Global_SalesWiseOfferAmount,
} 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 { useAuth } from '../../../../../AuthContext.jsx';
import PaymentInput from '../BSBillingTable1/BalanceAndReceived.jsx';
import { GlobalBookingStatus } from '../../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js';
import {
changeSalesPaymentoption,
@ -193,15 +183,11 @@ import {
import Paymentoption from '../../../../Payment/PaymentOptions/PaymentOptions.jsx';
import { getPaymentOptionsData } from '../../../../../Features/BookingScreen/BookingData/KioskBookingData.js';
import { getCombolist } from '../../../../../Features/ComboMaster/ComboMaster.js';
import WhatsAppShare from '../../../../WhatsAppShare/whatsAppShare.jsx';
import SMSShare from '../../../../WhatsAppShare/SmsShare.jsx';
import { MdSms } from 'react-icons/md';
import { FaWhatsapp, FaPrint, FaCartPlus } from 'react-icons/fa';
import BSTipAmount from '../../UtillComponents/BSTipAmount.jsx';
import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js';
import { TfiClipboard } from 'react-icons/tfi';
import { PostOtherServices } from '../../../../../Features/OtherServices/OtherServices.js';
import OtherServicePrintStyle1 from '../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx';
import OtherServiceMobilePrint from '../../BookingFunctionality/OtherServiceMobilePrint.jsx';
import BSOtherServiceClaim from '../../UtillComponents/BSOtherServiceClaim.jsx';
import { MobilePdfPrint } from '../../BookingFunctionality/MobilePdfPrint.js';
@ -221,10 +207,24 @@ import pozologoimg from '../../../../../Images/pozologoimg.png';
import MobileMultiPdfPrintTrigger from '../../UtillComponents/MobileMultiPdfPrintTrigger.jsx';
import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js';
import CustomerOrders from '../../BookingFunctionality/CustomerOrders.jsx';
// jsx Files
const BsBillingCreditCustomer = lazy(
() => import('../../BookingFunctionality/BSBillingCreditCustomer.jsx')
);
const PaymentInput = lazy(
() => import('../BSBillingTable1/BalanceAndReceived.jsx')
);
const WhatsAppShare = lazy(
() => import('../../../../WhatsAppShare/whatsAppShare.jsx')
);
const SMSShare = lazy(() => import('../../../../WhatsAppShare/SmsShare.jsx'));
const BSTipAmount = lazy(() => import('../../UtillComponents/BSTipAmount.jsx'));
const OtherServicePrintStyle1 = lazy(
() =>
import('../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx')
);
const subDirectory = import.meta.env.ENV_BASE_URL;
const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
const RetailApiurl = import.meta.env.ENV_API_URL;
const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
@ -239,6 +239,7 @@ const BST6Payment = () => {
const navigate = useNavigate();
const FreeProdList = useSelector(GlobalFreeProdList);
const offerAppliedProducts = useSelector(GlobalOfferAppliedProducts);
const AllBookingType = useSelector(GlobalAllBookingType);
const defaultBookingType = useSelector(GlobalDefaultBookingType);
const appPreferences = useSelector(ApplicationPreferences);
const bookingTypePreference = appPreferences?.find(
@ -251,7 +252,9 @@ const BST6Payment = () => {
);
const salesBillEdit = useSelector(GlobalSalesBillEdit);
const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails);
const previousOrderOfferDetails = useSelector(
GlobalPreviousOrderOfferDetails
);
const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
const screenwidth = useSelector(GlobalScreenSize);
const printerTemplateStyle = useSelector(SelectedPrintTemplate);
@ -298,7 +301,9 @@ const BST6Payment = () => {
const prodCat = useSelector(GlobalProductCategorie);
const ProdSubCat = useSelector(GlobalProductSubCategorie);
const templateData = useSelector(getTemplateData);
const BranchFinancialStatus = useSelector(GlobalBranchFinancialStatus);
const holdCheckedSalesSetup = tableOptions?.some(
(item) => item?.OptionName === 'Hold'
);
const tableOptions = templateData?.BookingBilling?.[1];
const OfferCheckedInSetup = templateData?.BookingNavbar?.[1].some(
(item) => item?.OptionName == 'Offer'
@ -484,7 +489,6 @@ const BST6Payment = () => {
}, [salesBillEdit]);
useEffect(() => {
if (salesBillEdit) {
if (SelCustId) {
setRefundPayBtns(AllPaymentOptions);
@ -499,8 +503,7 @@ const BST6Payment = () => {
setRefundPayBtns(withoutCustomer);
}
}
}, [AllPaymentOptions, SelCustId, salesBillEdit])
}, [AllPaymentOptions, SelCustId, salesBillEdit]);
console.log(PrintOrderDetails, 'PrintOrderDetails');
useEffect(() => {
if (selOption) {
@ -608,14 +611,21 @@ const BST6Payment = () => {
const filteredPayments =
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 =
filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || [];
filteredPayments.length > 0
? filteredPayments
: previousOrderPayment || [];
const totalPreviouspayment = paymentsToUse?.reduce(
(acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
(acc, payment) =>
acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
0
);
@ -624,8 +634,7 @@ const BST6Payment = () => {
0
);
const previousNetAmount =
(totalPreviouspayment) || 0;
const previousNetAmount = totalPreviouspayment || 0;
let withdiscTotal =
Total -
@ -637,12 +646,26 @@ const BST6Payment = () => {
withdiscTotal >= 0
? (Number(withdiscTotal) + 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);
setPreviousNetAmount(previousNetAmount);
dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount));
dispatch(
changeSummeryTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
)
);
dispatch(changeSummeryComboOfferAmount(withComboSum));
@ -672,8 +695,8 @@ const BST6Payment = () => {
UserId: UserId,
};
dispatch(getPrinterMappingDetails(data)).unwrap();
const Data1 = { AppId, CompId, BranchId };
dispatch(getPrintSelectionComponentData(Data1)).unwrap();
// const Data1 = { AppId, CompId, BranchId };
// dispatch(getPrintSelectionComponentData(Data1)).unwrap();
}, []);
//mohan stoped data
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(() => {
if (!PrintOrderDetails?.length) return;
@ -1047,8 +1049,10 @@ const BST6Payment = () => {
};
useEffect(() => {
if (CompId && BranchId && AppId) {
if (holdCheckedSalesSetup) {
getHolddata();
getUnpaiddatas();
}
// getUnpaiddatas();
getCustomerData();
}
}, [CompId, BranchId, AppId]);
@ -1136,9 +1140,6 @@ const BST6Payment = () => {
setEmpData(datas?.[0]);
};
const getCustomerData = async () => {
await dispatch(
getAllCustomer({ CompId: CompId, AppId: AppId, branchId: BranchId })
);
await dispatch(
getAddCustomerDetails({
CompId: CompId,
@ -1235,7 +1236,11 @@ const BST6Payment = () => {
const handleButtonClick = () => {
if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) {
UpiPayment();
} else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) {
} else if (
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
!refundPaySelected
) {
setMessageType('warning');
setMessageData('Please Select Refund Payment Method');
return;
@ -1564,28 +1569,7 @@ const BST6Payment = () => {
setPaybtnnameselected(PaymentOptionsModeName);
setPaybtnselected(PaymentOptionsModeId);
}, [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(() => {
getBookingTypeId();
}, [BookingType, BookingTypeBoth]);
@ -1610,20 +1594,12 @@ const BST6Payment = () => {
};
const getBookingTypeId = async () => {
let tempconfigdata = await dispatch(
getConfigType({ TypeName: 'Booking Type' })
).unwrap();
if (tempconfigdata?.data?.statusCode == 1) {
setConfigDataList(tempconfigdata?.data?.data);
let configdata = tempconfigdata?.data?.data;
setConfigDataList(AllBookingType);
let configdata = AllBookingType;
let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType;
let filterconfigdata = configdata?.find(
(a) => a?.ConfigName === checkName
);
let filterconfigdata = configdata?.find((a) => a?.ConfigName === checkName);
setSelectedBookingType(filterconfigdata?.ConfigId);
}
};
const gettodaydate = () => {
const currentDate = new Date();
@ -1702,7 +1678,7 @@ const BST6Payment = () => {
const handleRefundPaymentMode = (id, name) => {
setRefundPaySelected(id);
setRefundPaySelectedName(name);
}
};
const addUpiOption = async (id, name, UPIId) => {
await dispatch(changeUpiIDprint(UPIId));
@ -1957,7 +1933,9 @@ const BST6Payment = () => {
setUpinotSelected(false);
setCurrentOrderNetAmount(0);
setPreviousNetAmount(0);
if (holdCheckedSalesSetup) {
getHolddata();
}
if (defaultBookingType === 'Both') {
await dispatch(changeBookingType('TakeAway'));
}
@ -2254,8 +2232,10 @@ const BST6Payment = () => {
SalesPaymentType: 'normal',
PaymentDetail: [
{
PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected :
Paybtnnameselected?.toLowerCase() === 'upi'
PaymentType:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? refundPaySelected
: Paybtnnameselected?.toLowerCase() === 'upi'
? SelectedUPIPayOption?.toLowerCase() === 'pd'
? PaymentDeviceUPI?.[0]?.ModeId
: SelectedUPIPayOption?.toLowerCase() === 'pg'
@ -2268,15 +2248,25 @@ const BST6Payment = () => {
: paybtnselected
? paybtnselected
: null,
Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount),
MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null :
Paybtnnameselected?.toLowerCase() === 'upi' &&
Amount:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? previousNetAmount - currentOrderNetAmount
: Math.round(TotalAmount),
MerchantId:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantId
: null,
PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' :
Paybtnnameselected?.toLowerCase() === 'cash'
PaymentOptionType:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'PC'
@ -2289,16 +2279,21 @@ const BST6Payment = () => {
? 'BU'
: SelectedUPIPayOption
: null,
ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null :
SelectedUPIPayOption?.toLowerCase() === 'default'
ModeOfPayment:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: SelectedUPIPayOption?.toLowerCase() === 'default'
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
?.UPIDetailId
: SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantUPIId
? BusinessPayOption?.find(
(busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
: null,
AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] :
Paybtnnameselected?.toLowerCase() === 'upi' &&
AccountDtl:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? []
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default'
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
(upipay) => upipay?.UPIId === UpiId
@ -2314,8 +2309,10 @@ const BST6Payment = () => {
SelectedCardOption?.toLowerCase() === 'pg')
? useOptions?.[0]?.PaymentDetails?.PaymentGateway
: [],
PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' :
Paybtnnameselected?.toLowerCase() === 'cash'
PaymentStatus:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? 'S'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'S'
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'S'
@ -2323,9 +2320,18 @@ const BST6Payment = () => {
SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S'
: 'P',
Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0,
Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && Paybtnnameselected?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 :
Debit:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
? Math.round(previousNetAmount - currentOrderNetAmount)
: 0,
Credit: salesBillEdit
? currentOrderNetAmount > previousNetAmount &&
Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount)
: 0
: Paybtnnameselected?.toLowerCase() === 'credit'
? Math.round(TotalAmount)
: 0,
},
@ -3323,8 +3329,10 @@ const BST6Payment = () => {
setDefaultPaymentMode([]);
}
};
if (salesBillEdit) {
setDefaultPaymentOption();
}, [defaultPaymentTrigger]);
}
}, [defaultPaymentTrigger, salesBillEdit]);
const Otherserviceprint = async () => {
if (OtherServicesPrintDetails?.length > 0) {
@ -3478,6 +3486,7 @@ const BST6Payment = () => {
);
};
return (
<Suspense fallback={<div>Suspense Loading...</div>}>
<>
{(addcustomer || hold) && (
<FeaturesFunctionalities
@ -3764,7 +3773,8 @@ const BST6Payment = () => {
: 1,
}}
>
{paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? (
{paybtns?.length > 0 &&
currentOrderNetAmount >= previousNetAmount ? (
paybtns?.map((payment) => (
<div className="Table6-cash">
<button
@ -3844,7 +3854,9 @@ const BST6Payment = () => {
</button>
</div>
))
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? (
) : currentOrderNetAmount < previousNetAmount &&
salesBillEdit &&
refundPayBtns.length > 0 ? (
refundPayBtns.map((payment) => (
<div className="Table6-cash">
<button
@ -3864,7 +3876,12 @@ const BST6Payment = () => {
? 'blink-animation 0.5s infinite alternate'
: 'none',
}}
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)}
onClick={() =>
handleRefundPaymentMode(
payment?.ConfigId,
payment?.ConfigName
)
}
>
<div
style={{
@ -3902,8 +3919,10 @@ const BST6Payment = () => {
OrderCardDetail?.length > 0 &&
paybtnselected &&
CheckBookingStatus != 'Close'
? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
'BST6Payment-Button-pay'
? !OrderStatus
? salesBillEdit &&
currentOrderNetAmount < previousNetAmount
? 'BST6Payment-Button-pay'
: 'BST6Payment-Button-pay'
: 'BST6Payment-Button-pay Order'
: 'BST6Payment-Button-pay-disabled'
@ -3919,7 +3938,15 @@ const BST6Payment = () => {
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'] }}>
{isMobile ? (
@ -3951,6 +3978,7 @@ const BST6Payment = () => {
<AiOutlineArrowRight />
</>
)
) : (
<div>ORDER</div>
)}
@ -4389,7 +4417,9 @@ const BST6Payment = () => {
)
}
CreatedDate={OtherServicesPrintDetails?.CreatedDate}
PaymentStatus={OtherServicesPrintDetails?.[0]?.PaymentOrderDtl}
PaymentStatus={
OtherServicesPrintDetails?.[0]?.PaymentOrderDtl
}
Preference={SettingDataSelector}
printDatas={printDatas}
/>
@ -4424,8 +4454,8 @@ const BST6Payment = () => {
<div>
You have already selected a table. If you click 'OK,' the
table selection will be removed, and the unpaid flow will
continue. If you click 'Cancel,' the dine-in flow will proceed
as selected.
continue. If you click 'Cancel,' the dine-in flow will
proceed as selected.
</div>
</>
}
@ -4438,10 +4468,17 @@ const BST6Payment = () => {
SplitPaymentModal={Splitpayment}
handlesplitpaymentclose={handlesplitpaymentclose}
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) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0)))
(Discount > 0 ? Discount : 0))
)
}
failedOrderData={failedOrderData}
/>
@ -4621,7 +4658,9 @@ const BST6Payment = () => {
color: '#fff',
border: 'none',
borderRadius: 4,
cursor: hasVehicleInputErrors() ? 'not-allowed' : 'pointer',
cursor: hasVehicleInputErrors()
? 'not-allowed'
: 'pointer',
}}
>
Submit
@ -4683,7 +4722,9 @@ const BST6Payment = () => {
)
}
CreatedDate={OtherServicesPrintDetails?.CreatedDate}
PaymentStatus={OtherServicesPrintDetails?.[0]?.PaymentOrderDtl}
PaymentStatus={
OtherServicesPrintDetails?.[0]?.PaymentOrderDtl
}
Preference={SettingDataSelector}
printDatas={printDatas}
/>
@ -4798,6 +4839,7 @@ const BST6Payment = () => {
/>
</div>
</>
</Suspense>
);
};

View File

@ -7,7 +7,7 @@ import { BiRightArrowAlt } from 'react-icons/bi';
import { AiOutlineClose } from 'react-icons/ai';
import BSSummery from '../BSBillingTableSummery/BSSummery.jsx';
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 {
GlobalSelectedFont,
@ -17,7 +17,7 @@ import {
GlobalprintDatas,
GlobalPrinterMappingDtls,
getPrinterMappingDetails,
getPrintSelectionComponentData,
// getPrintSelectionComponentData,
} from '../../../../../Features/ThemeChange/ThemeChange.js';
import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js';
import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities.jsx';
@ -94,7 +94,7 @@ import {
GlobalOverAllDiscSales,
ChangeOverAllDiscSales,
ChangeOverAllDiscEstimate,
getAllCustomer,
GlobalBranchFinancialStatus,
changeSummeryComboOfferAmount,
ChangeComboCarddata,
@ -119,6 +119,7 @@ import {
changeBillEditingMode,
changePreviousOrderPayment,
changePreviousOrderOfferDetail,
GlobalAllBookingType,
} from '../../../../../Features/BookingScreen/BookingData/BookingData.js';
import {
globalExtraTotalAmount,
@ -174,11 +175,8 @@ import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js';
import PozoSplitPaymentIcon from '../../UtillComponents/Pozo retail icons/PozoSplitPaymentIcon.jsx';
import PozoCartIcon from '../../../../../Pages/BookingScreen/Components/UtillComponents/PozoCartIcon.jsx';
import {
Global_CoupenCodeAmount,
Global_loyaltyPointsDiscountAmount,
Global_OrderOfferDetail,
Global_OverallOfferAmount,
Global_SalesWiseOfferAmount,
Global_OverallOfferAmount
} from '../../../../../Features/Offer/Offer.js';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import TooltipWrapper from '../../../../../Components/Tooltip/Tooltip';
@ -242,6 +240,7 @@ const BSBilling7Payment = () => {
const screenwidth = useSelector(GlobalScreenSize);
const defaultBookingType = useSelector(GlobalDefaultBookingType);
const printerTemplateStyle = useSelector(SelectedPrintTemplate);
const AllBookingType=useSelector(GlobalAllBookingType)
const FontFamily = useSelector(GlobalSelectedFont);
const OrderCardDetail = useSelector(GlobalOrderCardDetails);
const GetCustId = useSelector(GlobalCustId);
@ -269,6 +268,9 @@ const BSBilling7Payment = () => {
const templateData = useSelector(getTemplateData);
const appPreferences = useSelector(ApplicationPreferences);
const Combodata = useSelector(GlobalCombocarddata, shallowEqual);
const holdCheckedSalesSetup = tableOptions?.some(
(item) => item?.OptionName === 'Hold'
);
const bookingTypePreference = appPreferences?.find(
(preference) => preference?.PreferredCatName === 'Booking Type'
)?.PreferenceCatDetails;
@ -306,11 +308,9 @@ const BSBilling7Payment = () => {
const offerAppliedProducts = useSelector(GlobalOfferAppliedProducts);
const GlobEstBooking = useSelector(GlobalEstimateBooking);
const GlobProdwisedata = useSelector(GlobalSelProdWiseEst);
const BranchFinancialStatus = useSelector(GlobalBranchFinancialStatus);
const preOrder = useSelector(GlobalpreOrderOpen);
const OrderType = useSelector(GlobalOrderType);
const FailedTotalAmt = useSelector(GlobalFailedTotalAmt);
const OrderOfferDetail = useSelector(Global_OrderOfferDetail, shallowEqual);
const defaultPaymentTrigger = useSelector(GlobalPaymentTrigger);
const [defaultPaymentMode, setDefaultPaymentMode] = useState([]);
const [defaultEnabled, setDefaultEnabled] = useState(false);
@ -324,8 +324,6 @@ const BSBilling7Payment = () => {
const BranchId = SessionData?.BranchId;
const UserId = SessionData?.UserId;
const UserType = SessionData?.UserType;
const AuthToken = SessionData?.AuthToken;
const SessionMobileNo = SessionData?.SessionMobileNo;
const [FirstPaymentclick, setFirstPaymentclick] = useState(false);
const [open, setOpen] = useState(false);
const [unpaidopen, setUnpaidOpen] = useState(false);
@ -692,13 +690,16 @@ const BSBilling7Payment = () => {
UserId: UserId,
};
dispatch(getPrinterMappingDetails(data)).unwrap();
const Data1 = { AppId, CompId, BranchId };
dispatch(getPrintSelectionComponentData(Data1)).unwrap();
// const Data1 = { AppId, CompId, BranchId };
// dispatch(getPrintSelectionComponentData(Data1)).unwrap();
}, []);
useEffect(() => {
if (CompId && BranchId && AppId) {
if(holdCheckedSalesSetup)
{
getHolddata();
getUnpaiddatas();
}
// getUnpaiddatas();
getCustomerData();
}
}, [CompId, BranchId, AppId]);
@ -814,9 +815,7 @@ const BSBilling7Payment = () => {
: parseInt(value || 0);
};
const getCustomerData = async () => {
await dispatch(
getAllCustomer({ CompId: CompId, AppId: AppId, branchId: BranchId })
);
await dispatch(
getAddCustomerDetails({
CompId: CompId,
@ -1627,20 +1626,14 @@ const BSBilling7Payment = () => {
};
const getBookingTypeId = async () => {
let tempconfigdata = await dispatch(
getConfigType({ TypeName: 'Booking Type' })
).unwrap();
if (tempconfigdata?.data?.statusCode == 1) {
setConfigDataList(tempconfigdata?.data?.data);
let configdata = tempconfigdata?.data?.data;
setConfigDataList(AllBookingType);
let configdata = AllBookingType;
let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType;
let filterconfigdata = configdata?.find(
(a) => a?.ConfigName === checkName
);
setSelectedBookingType(filterconfigdata?.ConfigId);
}
};
const gettodaydate = () => {
const currentDate = new Date();
@ -1932,7 +1925,10 @@ const BSBilling7Payment = () => {
setCurrentOrderNetAmount(0);
setPreviousNetAmount(0);
setUpinotSelected(false);
if(holdCheckedSalesSetup)
{
getHolddata();
}
if (defaultBookingType === 'Both') {
await dispatch(changeBookingType('TakeAway'));
}
@ -3331,8 +3327,10 @@ const BSBilling7Payment = () => {
setDefaultPaymentMode([]);
}
};
if(salesBillEdit){
setDefaultPaymentOption();
}, [defaultPaymentTrigger]);
}
}, [defaultPaymentTrigger,salesBillEdit]);
const Otherserviceprint = async () => {
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 '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7.scss';
import {
@ -14,7 +14,6 @@ import {
GlobalPreviousOrderLength,
GlobalUnpaidData,
changeOrderCardDetails,
ChangeSelectedCustDisable,
changeReorderHoldDetails,
changeBookingType,
changeSelectedOption,
@ -50,7 +49,9 @@ import {
GlobalOfferAppliedProducts,
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import BSBillingEditQuantity from '../BSBillingEditQuantity/BSBillingEditQuantity';
const BSBillingEditQuantity = lazy(
() => import('../BSBillingEditQuantity/BSBillingEditQuantity')
);
import {
ChangeTotalAmount,
globalExtraTotalAmount,
@ -61,11 +62,14 @@ import dineInIcon from '../../../../../Images/Dine In.svg';
import TakeAwayIcon from '../../../../../Images/Take away.svg';
import { getCustomerDisplayWindow } from '../../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import BSEditTotalAmt from '../BSEditTotalAmount/BSEditTotalAmt.jsx';
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx';
import { getSession } from '../../../../../Services/Others.js';
const BSEditTotalAmt = lazy(
() => import('../BSEditTotalAmount/BSEditTotalAmt.jsx')
);
const BSImeiDetails = lazy(() => import('../BSImeiDetails/BSImeiDetails.jsx'));
const CustomerPriceHistory = lazy(
() => import('../../UtillComponents/CustomerPriceHistory.jsx')
);
import { useUtilsComponent } from '../../../../../Services/utils.js';
import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
const BSBillingTable7 = () => {
const { removeExtraCharge } = useUtilsComponent();
@ -99,7 +103,8 @@ const BSBillingTable7 = () => {
const GetCustId = useSelector(GlobalCustId);
const selectedCustomer = useSelector(GlobalSelOption);
const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false);
const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] =
useState(false);
const [customerProduct, setCustomerProduct] = useState(null);
const [EditQuantity, setEditQuantity] = useState(false);
const [Modaldata, setModaldata] = useState([]);
@ -276,7 +281,6 @@ const BSBillingTable7 = () => {
event.preventDefault();
handleShortcut('weightAmount');
}
};
window.addEventListener('keydown', handleKeyDown);
@ -1309,9 +1313,6 @@ const BSBillingTable7 = () => {
});
}
}
//Change Remove OrderCartDetail
//Remove FreeprodList
//ChangeOfferApplied Products
}
} else {
///remove item wise offer
@ -1605,8 +1606,6 @@ const BSBillingTable7 = () => {
});
}
} else {
//have to find if thereis two Booking Type is there
//Convert That Free Product To Paid Product
let ischeckBothBookingType = tableData?.find(
(e) =>
e?.InwardDtlId == inward &&
@ -1621,12 +1620,6 @@ const BSBillingTable7 = () => {
e?.BookingTypeName == item?.BookingTypeName
);
if (ischeckBothBookingType) {
//Convert That Free Product To Paid Product
//merge that paid product with same booking type
//decrease free prod list qty
//change offer applied product qty
// await ChangeOrderCardDetailsFn(item?.BookingTypeName, null, ischeckBothBookingType?.OrderQty + FreeProductSameBookingType?.OrderQty, false, ischeckBothBookingType?.InwardDtlId, item?.InwardDtlId, item?.Offer, true)
if (FreeProductSameBookingType?.OrderQty >= item?.OrderQty) {
await ChangeFreeprodlistFn({
OverAllFreeQty: FreeProd?.OverAllFreeQty - item?.OrderQty,
@ -1676,24 +1669,10 @@ const BSBillingTable7 = () => {
let diff =
item?.OrderQty - FreeProductSameBookingType?.OrderQty;
//SameBookingFreeQty
//FreeProductSameBookingType?.OrderQty
//Another BookingType Paid Qty
//anotherBookingType
//anotherBookingType?.Free OrderQty
//ischeckBothBookingType
//anotherBookingType?.OrderQty-ischeckBothBookingType?.OrderQty
//convert another Booking Type Qty also Free to Paid
if (
(anotherBookingType?.OrderQty || 0) <
anotherBookingTypeOffer?.OrderQty
) {
//paidproduct ischeckBothBookingType?.OrderQty-anotherBookingType?.OrderQty
//PaidProdcut Current BookingType FreeProductSameBookingType?.OrderQty
let paidproductAnotherType =
ischeckBothBookingType?.OrderQty -
anotherBookingType?.OrderQty;
@ -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) {
if (amountStr == null) return allowDecimal ? '0.00' : '0';
@ -1997,11 +1837,10 @@ const BSBillingTable7 = () => {
return allowDecimal ? num.toFixed(2) : Math.round(num).toString();
}
const handleCustomerProductPriceHistory = (item) => {
setCustomerPriceHistoryOpen(true);
setCustomerProduct(item?.ProdId);
}
};
const handlechange33 = () => {
if (editdelete === 'Edit') {
@ -2055,6 +1894,7 @@ const BSBillingTable7 = () => {
};
return (
<Suspense fallback={<div>Loading...</div>}>
<>
<div
style={{
@ -2337,7 +2177,8 @@ const BSBillingTable7 = () => {
}
// 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'
}
@ -2393,7 +2234,10 @@ const BSBillingTable7 = () => {
'variant'
) && <span>{item?.ProdVariantName} </span>}
{item?.Size}
{item?.SinglePc == 'Y' ? 'PCS' : item?.UomName})
{item?.SinglePc == 'Y'
? 'PCS'
: item?.UomName}
)
</p>
{item?.OfferMessage &&
!Array.isArray(item.OfferMessage) && (
@ -2490,7 +2334,8 @@ const BSBillingTable7 = () => {
handleCustomerProductPriceHistory(item);
}
}}
style={{ fontFamily: 'Poppins' }}>
style={{ fontFamily: 'Poppins' }}
>
{safeRound(item?.TotalAmt)}
</td>
)}
@ -2521,7 +2366,8 @@ const BSBillingTable7 = () => {
: BookingType !== 'Dine In' &&
triggerAnimation &&
OldtableDataTakeAway?.length + index === 0 &&
tableDataDinein?.length >= PreviousdataLength &&
tableDataDinein?.length >=
PreviousdataLength &&
!HoldOrderDtl &&
!UnpaidData
? 'wheat'
@ -2561,7 +2407,8 @@ const BSBillingTable7 = () => {
}
// onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
className={`${item?.SalesId
className={`${
item?.SalesId
? 'BSBill-Table7-content-disabled'
: 'BSBill-Table7-content'
}
@ -2613,7 +2460,10 @@ const BSBillingTable7 = () => {
'variant'
) && <span>{item?.ProdVariantName} </span>}
{item?.Size}
{item?.SinglePc == 'Y' ? 'PCS' : item?.UomName})
{item?.SinglePc == 'Y'
? 'PCS'
: item?.UomName}
)
</p>
{item?.OfferMessage &&
!Array.isArray(item.OfferMessage) && (
@ -2703,12 +2553,15 @@ const BSBillingTable7 = () => {
</td>
)}
{tableitem.OptionName == 'Amount' && (
<td onClick={(e) => {
<td
onClick={(e) => {
e.stopPropagation();
if (GetCustId) {
handleCustomerProductPriceHistory(item);
}
}} style={{ fontFamily: 'Poppins' }}>
}}
style={{ fontFamily: 'Poppins' }}
>
{safeRound(item?.TotalAmt)}
</td>
)}
@ -2756,7 +2609,9 @@ const BSBillingTable7 = () => {
2 ===
0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
: SelectedBillColor?.[
'OverallBackgroundColor'
]
? SelectedBillColor?.[
'OverallBackgroundColor'
]
@ -2821,7 +2676,8 @@ const BSBillingTable7 = () => {
}
// 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'
}
@ -2878,17 +2734,14 @@ const BSBillingTable7 = () => {
className="Tbl3-Variant"
style={{ fontFamily: 'Poppins' }}
>
{/* (
{!item?.ProdVariantName?.toLowerCase()?.includes(
'variant'
) && <span>{item?.ProdVariantName} </span>}
{item?.Size}
{item?.SinglePc == 'Y' ? 'PCS' : item?.UomName}) */}
{' '}
{item?.Type !== 'OS' && (
<>
{!item?.ProdVariantName?.toLowerCase()?.includes(
'variant'
) && <span>{item?.ProdVariantName} </span>}
) && (
<span>{item?.ProdVariantName} </span>
)}
{item?.Size}
{item?.SinglePc == 'Y'
? 'PCS'
@ -2984,12 +2837,15 @@ const BSBillingTable7 = () => {
</td>
)}
{tableitem.OptionName == 'Amount' && (
<td onClick={(e) => {
<td
onClick={(e) => {
e.stopPropagation();
if (GetCustId) {
handleCustomerProductPriceHistory(item);
}
}} style={{ fontFamily: 'Poppins' }}>
}}
style={{ fontFamily: 'Poppins' }}
>
{item?.TotalAmt}
</td>
)}
@ -3030,7 +2886,8 @@ const BSBillingTable7 = () => {
tableDataTakeAway?.length +
index ===
0 &&
tableDataDinein?.length >= PreviousdataLength &&
tableDataDinein?.length >=
PreviousdataLength &&
!HoldOrderDtl &&
!UnpaidData
? 'wheat'
@ -3087,7 +2944,8 @@ const BSBillingTable7 = () => {
}
// 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'
}
@ -3143,7 +3001,10 @@ const BSBillingTable7 = () => {
'variant'
) && <span>{item?.ProdVariantName} </span>}
{item?.Size}
{item?.SinglePc == 'Y' ? 'PCS' : item?.UomName})
{item?.SinglePc == 'Y'
? 'PCS'
: item?.UomName}
)
</p>
{item?.OfferMessage &&
!Array.isArray(item.OfferMessage) && (
@ -3240,7 +3101,8 @@ const BSBillingTable7 = () => {
handleCustomerProductPriceHistory(item);
}
}}
style={{ fontFamily: 'Poppins' }}>
style={{ fontFamily: 'Poppins' }}
>
{safeRound(item?.TotalAmt)}
</td>
)}
@ -3274,7 +3136,7 @@ const BSBillingTable7 = () => {
ProductDetail={Modaldata}
/>
)}
{(customerPriceHistoryOpen && GetCustId) &&
{customerPriceHistoryOpen && GetCustId && (
<CustomerPriceHistory
open={customerPriceHistoryOpen}
custId={GetCustId}
@ -3283,8 +3145,9 @@ const BSBillingTable7 = () => {
setCustomerProduct={setCustomerProduct}
selectedCustomer={selectedCustomer}
/>
}
)}
</>
</Suspense>
);
};

View File

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

View File

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

View File

@ -1,5 +1,4 @@
import React, { useEffect, useRef, useState } from 'react';
import './ComboSalesBillTable.scss';
import React, { lazy, useEffect, useRef, useState } from 'react';
import { shallowEqual, useDispatch, useSelector } from 'react-redux';
import { Popconfirm, Tooltip } from 'antd';
import WebFont from 'webfontloader';
@ -9,16 +8,12 @@ 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 BSEditTotalAmt from '../BSEditTotalAmount/BSEditTotalAmt.jsx';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx';
import {
getTemplateData,
SelectedGlobalBillingColorDetail,
@ -66,8 +61,6 @@ import {
GlobalSalesBillEdit,
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
import {
ChangeOfferAppliedProducts,
ChangeFreeProductList,
ChangeFullFreeProductList,
GlobalFreeProdList,
GlobalOfferAppliedProducts,
@ -75,11 +68,24 @@ import {
changeLoyaltyConsumedQuantities,
ClearOfferAppliedProducts,
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import { useRemoveProducts } from '../BSBillingTable3/RemoveCartWithOffer.jsx';
import { useUtilsComponent } from '../../../../../Services/utils.js';
import ComboEditRate from '../ComboBillTableEdit/ComboEditRate.jsx';
import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
import ComboEditQtyAndRate from '../ComboBillTableEdit/ComboEditQtyAndRate.jsx';
import { useRemoveProducts } from '../BSBillingTable3/RemoveCartWithOffer.jsx';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.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 { removeExtraCharge } = useUtilsComponent();
@ -267,7 +273,9 @@ const ComboSalesBillTable = () => {
...sameItems[0],
OrderQty: totalQty,
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);
} else {
@ -313,12 +321,6 @@ const ComboSalesBillTable = () => {
};
}, [GetCustId, tableData]);
// useEffect(() => {
// const BillOrder = preferenceDatas?.[0]?.SettingDtlDetails?.find(
// (item) => item.SettingIdName === 'BillItemsOrder'
// );
// setBillOrderPre(BillOrder?.SettingValue);
// }, [preferenceDatas]);
useEffect(() => {
const getSelectedItem = () => {
const getItem = (data = []) => {
@ -463,6 +465,7 @@ const ComboSalesBillTable = () => {
BranchId: BranchId,
AppId: AppId,
};
await dispatch(getSelectedFavItems(data)).unwrap();
let data1 = {
@ -2136,7 +2139,6 @@ const ComboSalesBillTable = () => {
}
}
}
};
useEffect(() => {
@ -2476,7 +2478,8 @@ const ComboSalesBillTable = () => {
? 'wheat'
: 'inherit'
: 'none',
background: row?.SalesId && OrderType !== 'Hold'
background:
row?.SalesId && OrderType !== 'Hold'
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
GlobProdwisedata?.includes(
@ -2588,7 +2591,8 @@ const ComboSalesBillTable = () => {
}}
key={`qty-${index}`}
tabIndex={0}
className={`${EditQtyCombo && row?.localId === Index
className={`${
EditQtyCombo && row?.localId === Index
? 'EditQTYcomboTD'
: 'qtyTd'
} ${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 { Popconfirm, Tooltip } from 'antd';
import WebFont from 'webfontloader';
import { isMobile } from 'react-device-detect';
import { AiOutlineClose, AiFillDelete } from 'react-icons/ai';
import TakeAwayIcon from '../../../../../Images/Take away.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 BSEditTotalAmt from '../BSEditTotalAmount/BSEditTotalAmt.jsx';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx';
const BSEditTotalAmt = lazy(
() => import('../BSEditTotalAmount/BSEditTotalAmt.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 {
getTemplateData,
SelectedGlobalBillingColorDetail,
@ -70,9 +72,17 @@ import {
GlobalSelOption,
GlobalSalesBillEdit,
} 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 { IoClose } from 'react-icons/io5';
import StandardTablePayment from './StandardTablePayment.jsx';
import { FaAngleDown, FaAngleUp } from 'react-icons/fa';
import {
ChangeFullFreeProductList,
@ -82,10 +92,7 @@ import {
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.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 CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
const StandardTable = () => {
const { removeExtraCharge } = useUtilsComponent();
@ -139,18 +146,12 @@ const StandardTable = () => {
const OrderType = useSelector(GlobalOrderType);
const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
const OtherServicesglobal = useSelector(GlobalOtherSevices);
const totalItems = useSelector(GlobalSummeryTotalItems);
const GetCustId = useSelector(GlobalCustId);
const selectedCustomer = useSelector(GlobalSelOption);
const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false);
const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] =
useState(false);
const [customerProduct, setCustomerProduct] = useState(null);
const [tableCollapse, setTableCollapse] = useState(false);
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 tableDataDinein = OrderCardDetail?.filter(
@ -274,16 +275,7 @@ const StandardTable = () => {
}
return;
}
// 👉 CTRL shortcuts
if (!event.ctrlKey) return;
// if (key === 'q') {
// event.preventDefault();
// handleShortcut('qty');
// }
// if (key === 'e') {
// event.preventDefault();
// handleShortcut('price');
// }
if (key === 'q') {
event.preventDefault();
handleShortcut('qty');
@ -305,36 +297,6 @@ const StandardTable = () => {
};
}, [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 () => {
let data = {
CompId: CompId,
@ -576,7 +538,6 @@ const StandardTable = () => {
CompleteRemoveAndPaidToFreeOtherTypeWithoutMerge = false,
RemoveAndUpdateOtherBookingType = false,
BookingTypeName,
TotalAmt,
localid,
}) => {
let ModifiedOrderCardDetail = JSON.parse(JSON.stringify(OrderCardDetail));
@ -687,14 +648,7 @@ const StandardTable = () => {
}
if (CompleteRemove) {
const data = ModifiedOrderCardDetail?.filter(
(e) =>
!(
(e.localId === localid)
// e?.InwardDtlId === InwardDtlId &&
// e?.Offer === Offer &&
// e?.BookingTypeName === BookingTypeName &&
// e?.TotalAmt === TotalAmt
)
(e) => !(e.localId === localid)
);
return dispatch(changeOrderCardDetails(data));
}
@ -1915,7 +1869,6 @@ const StandardTable = () => {
insideinwardDtlId: false,
});
} else {
let data = isCheckFreeProductOutside?.FreeQty - item?.OrderQty;
//First i Calculate Another Booking Type Qty
let anotherBookingType = OrderCardDetail?.find(
(e) =>
@ -1930,27 +1883,10 @@ const StandardTable = () => {
e?.BookingTypeName != item?.BookingTypeName
);
let diff =
item?.OrderQty - FreeProductSameBookingType?.OrderQty;
//SameBookingFreeQty
//FreeProductSameBookingType?.OrderQty
//Another BookingType Paid Qty
//anotherBookingType
//anotherBookingType?.Free OrderQty
//ischeckBothBookingType
//anotherBookingType?.OrderQty-ischeckBothBookingType?.OrderQty
//convert another Booking Type Qty also Free to Paid
if (
(anotherBookingType?.OrderQty || 0) <
anotherBookingTypeOffer?.OrderQty
) {
//paidproduct ischeckBothBookingType?.OrderQty-anotherBookingType?.OrderQty
//PaidProdcut Current BookingType FreeProductSameBookingType?.OrderQty
let paidproductAnotherType =
ischeckBothBookingType?.OrderQty -
anotherBookingType?.OrderQty;
@ -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(() => {
// setTriggerAnimation(true);
@ -2296,16 +2093,12 @@ const StandardTable = () => {
const handleCustomerProductPriceHistory = (item) => {
setCustomerPriceHistoryOpen(true);
setCustomerProduct(item?.ProdId);
}
};
const handleEditQuantityCancel = () => {
setEditQuantity(false);
};
const handleToggle = () => {
setIsExpanded(!isExpanded);
};
const handleTableCart = () => {
if (window.innerWidth <= 768) {
setMobileTableVisible((prev) => !prev);
@ -2594,7 +2387,8 @@ const StandardTable = () => {
{OldtableDataTakeAway?.map((item, index) => (
<tr
key={index}
className={`${item?.SalesId && OrderType !== 'Hold'
className={`${
item?.SalesId && OrderType !== 'Hold'
? 'booking-billing-table-row-disabled'
: 'booking-billing-table-row'
}`}
@ -2652,7 +2446,7 @@ const StandardTable = () => {
index == 0 &&
tableitem.OptionName == 'Sl.No' && (
<td
rowspan={OrderCardDetail.length}
rowSpan={OrderCardDetail.length}
style={{ backgroundColor: '#CFB59D' }}
>
<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>
)}
{tableitem.OptionName == 'Delete' && (
@ -2914,7 +2710,8 @@ const StandardTable = () => {
{OldtableDataDinein?.map((item, index) => (
<tr
key={OldtableDataTakeAway?.length + index}
className={`${item?.SalesId
className={`${
item?.SalesId
? 'booking-billing-table-row-disabled'
: 'booking-billing-table-row'
}
@ -2975,7 +2772,7 @@ const StandardTable = () => {
index == 0 &&
tableitem.OptionName == 'Sl.No' && (
<td
rowspan={OrderCardDetail.length}
rowSpan={OrderCardDetail.length}
style={{ backgroundColor: '#A2C3CD' }}
>
<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>
)}
@ -3236,7 +3035,8 @@ const StandardTable = () => {
OldtableDataTakeAway?.length +
index
}
className={`${BookingType === 'Dine In' && item?.SalesId
className={`${
BookingType === 'Dine In' && item?.SalesId
? 'booking-billing-table-row-disabled'
: 'booking-billing-table-row'
}
@ -3328,7 +3128,7 @@ const StandardTable = () => {
index == 0 &&
tableitem.OptionName == 'Sl.No' && (
<td
rowspan={OrderCardDetail.length}
rowSpan={OrderCardDetail.length}
style={{ backgroundColor: '#CFB59D' }}
>
<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>
)}
@ -3601,7 +3403,8 @@ const StandardTable = () => {
tableDataTakeAway?.length +
index
}
className={`${BookingType === 'Dine In' && item?.SalesId
className={`${
BookingType === 'Dine In' && item?.SalesId
? 'booking-billing-table-row-disabled'
: 'booking-billing-table-row'
}
@ -3681,7 +3484,7 @@ const StandardTable = () => {
index == 0 &&
tableitem.OptionName == 'Sl.No' && (
<td
rowspan={OrderCardDetail.length}
rowSpan={OrderCardDetail.length}
style={{ backgroundColor: '#A2C3CD' }}
>
<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>
)}
@ -3929,6 +3734,7 @@ const StandardTable = () => {
</tbody>
)}
</table>
<Suspense fallback={<div>Loading...</div>}>
{OpenEditTotalAmt && (
<BSEditTotalAmt
EditTotalOpen={OpenEditTotalAmt}
@ -3942,7 +3748,7 @@ const StandardTable = () => {
ProductDetail={Modaldata}
/>
)}
{(customerPriceHistoryOpen && GetCustId) &&
{customerPriceHistoryOpen && GetCustId && (
<CustomerPriceHistory
open={customerPriceHistoryOpen}
custId={GetCustId}
@ -3952,10 +3758,13 @@ const StandardTable = () => {
selectedCustomer={selectedCustomer}
OrderCardDetail={OrderCardDetail}
/>
}
)}
</Suspense>
</div>
<div className="booking-table-footer">
<Suspense fallback={<div>Loading...</div>}>
<StandardTablePayment />
</Suspense>
</div>
</div>
</div>

View File

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

View File

@ -524,36 +524,6 @@ function BSCategoryHorizontal(props) {
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(() => {
if (productCardTrigger && FavSelected) {
@ -584,27 +554,15 @@ function BSCategoryHorizontal(props) {
}
: {}),
};
await dispatch(getSelectedFavItems(data1));
// await dispatch(getSelectedFavItems(data1));
await dispatch(ChangeFocusCatCard(!FocusStatus));
};
const handleClickOtherItems = async () => {
dispatch(ChangedraggingComponent(null));
dispatch(Changedragging(false));
let data = false;
setIndexVal(Infinity);
// setaccessToCard(true);
// dispatch(ChangeisFavClicked(true));
// setAccessOther(false);
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 () => {
@ -690,8 +648,10 @@ function BSCategoryHorizontal(props) {
};
useEffect(() => {
if (isModalOpen) {
holdnamedrop();
}, [AppId, CompId, BranchId]);
}
}, [isModalOpen]);
const holdnamedrop = async () => {
let data = {
@ -896,16 +856,16 @@ function BSCategoryHorizontal(props) {
formRef?.current?.resetFields();
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);
}
// 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) => {
@ -1702,7 +1662,7 @@ function BSCategoryHorizontal(props) {
}))}
className="field-DropDown"
// placeholder="ConfigType"
label={<label class="required">Tax</label>}
label={<label className="required">Tax</label>}
// optionsNames={{ value: "TaxPercentage", label: "TaxIdName" }}
onChangeFunction={(selectedValue) =>
onChangeFunction(selectedValue)
@ -1773,7 +1733,7 @@ function BSCategoryHorizontal(props) {
// }}
className="size-input"
label={
<label class="required">No.of.Units :</label>
<label className="required">No.of.Units :</label>
}
autocomplete="off"
onChange={(e) =>
@ -1885,7 +1845,7 @@ function BSCategoryHorizontal(props) {
]}
>
<InputField
label={<label class="required">Quantity</label>}
label={<label className="required">Quantity</label>}
valueData={defaultQuantity}
autocomplete="off"
onChange={(e) =>
@ -1953,7 +1913,9 @@ function BSCategoryHorizontal(props) {
>
<InputField
label={
<label class="required">Amount / Per Item</label>
<label className="required">
Amount / Per Item
</label>
}
autocomplete="off"
onChange={(e) =>

View File

@ -510,8 +510,10 @@ function BSCategoryVertical(props) {
};
useEffect(() => {
if (isModalOpen) {
holdnamedrop();
}, [AppId, CompId, BranchId]);
}
}, [isModalOpen]);
const holdnamedrop = async () => {
let data = {
@ -708,16 +710,16 @@ function BSCategoryVertical(props) {
formRef?.current?.resetFields();
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);
}
// 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) => {
@ -1422,7 +1424,7 @@ function BSCategoryVertical(props) {
<p
style={{
textTransform: Uppercase,
fontWeight: '600',
fontWeight: '500',
// paddingTop: !item.SmallIcon && "4px",
fontFamily: SelectedFontFamily ? SelectedFontFamily : '',
color: SelectedCatgColor

View File

@ -62,7 +62,10 @@ import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
import { BsSortAlphaDown } from 'react-icons/bs';
import { BsSortAlphaDownAlt } from 'react-icons/bs';
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) {
const formRef = useRef(null);
@ -93,7 +96,6 @@ function BSOtherServicesHorizontalcat(props) {
const draggingComponent = useSelector(GlobaldraggingComponent);
const alphabeticFormat = useSelector(GlobalisAlphabeticFormat);
const [isDragging, setIsDragging] = useState(false);
const [startX, setStartX] = useState(null);
const [accessToCard, setaccessToCard] = useState(false);
@ -375,14 +377,19 @@ function BSOtherServicesHorizontalcat(props) {
};
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 Filterdata2 = ComboCardata?.filter((item) => item?.ServiceCategory === ProdCat)
let Filterdata = ComboCardata?.filter((item) => item?.ServiceCategory === ProdCat)?.[0]?.ServiceDetails;
let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdCat)?.[0]?.ServiceDetails;
let Filterdata = ComboCardata?.filter(
(item) => item?.ServiceCategory === ProdCat
)?.[0]?.ServiceDetails;
let Filterdatas = ComboCardata?.filter(
(item) => item?.ServiceCategory === ProdCat
)?.[0]?.ServiceDetails;
let data1 = {
compId: CompId,
@ -430,7 +437,6 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
};
const handleClick2 = async () => {
getTaxname();
getUom();
setIndexVal(-1);
@ -511,8 +517,10 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
};
useEffect(() => {
if (isModalOpen) {
holdnamedrop();
}, [AppId, CompId, BranchId]);
}
}, [isModalOpen]);
const holdnamedrop = async () => {
let data = {
@ -526,12 +534,6 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
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(
(preference) => preference?.PreferredCatName === 'Product Uom'
@ -719,16 +721,6 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
formRef?.current?.resetFields();
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) => {
@ -873,7 +865,6 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
} else if (categoryData?.length > 0) {
setIndexVal(0);
}
}, [searchData, categoryData]);
useEffect(() => {
@ -893,14 +884,13 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
let Data = response?.data?.data;
setCombocardata(Data?.ServiceCategories);
}
};
return (
<>
<div className="CategoryHorizontal bs1"
<div
className="CategoryHorizontal bs1"
ref={containerRef}
style={{ maxWidth: '100%' }}
>
@ -1026,7 +1016,7 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
option,
selectedTaxPercentage === option.TaxId
),
// label: option.TaxIdName + ' - ' + option.TaxPercentage + ' % ',
// label: option.NameTaxIdName + ' - ' + option.TaxPercentage + ' % ',
}))}
className="field-DropDown"
// placeholder="ConfigType"
@ -1099,13 +1089,11 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
}
// inputMode="numeric"
// onInput={(e) => {
// e.target.value = e.target.value.replace(/\D/g, "");
// e.target.Namevalue = e.target.value.replace(/\D/g, "");
// }}
className="size-input"
label={
<label class="required">
No.of.Units :
</label>
<label class="required">No.of.Units :</label>
}
autocomplete="off"
onChange={(e) =>
@ -1148,31 +1136,6 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
</Form.Item>
</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
className="quantity-amt"
style={{
@ -1569,7 +1532,9 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
minWidth: 'max-content', // set a width if needed
}}
className="sampleCard"
onClick={(e) => handleClick(e, item.ServiceCategory, index)}
onClick={(e) =>
handleClick(e, item.ServiceCategory, index)
}
>
<div
style={{ flexDirection: Reverse1 }}
@ -1703,9 +1668,7 @@ let Filterdatas = ComboCardata?.filter((item) => item?.ServiceCategory === ProdC
</div>
)}
</div>
</div>
</>
);
}

View File

@ -58,7 +58,10 @@ import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
import { BsSortAlphaDown } from 'react-icons/bs';
import { BsSortAlphaDownAlt } from 'react-icons/bs';
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) {
const formRef = useRef(null);
@ -105,7 +108,7 @@ function BSOtherServicesVerticalcat(props) {
const [add, setAdd] = useState(false);
const [defaultQuantity, setdefaultQuantity] = useState(1);
const [isSortClicked, setIsSortClicked] = useState(false);
const [otherServiceCategoryData,setOtherServiceCategoryData] = useState([])
const [otherServiceCategoryData, setOtherServiceCategoryData] = useState([]);
const AppId = SessionData?.AppId;
const CompId = SessionData?.CompId;
const BranchId = SessionData?.BranchId;
@ -147,7 +150,7 @@ function BSOtherServicesVerticalcat(props) {
);
}
};
OtherServicesCategoryList()
OtherServicesCategoryList();
const container = scrollContainerRef?.current;
if (container) {
container.addEventListener('scroll', handleScroll);
@ -299,7 +302,9 @@ function BSOtherServicesVerticalcat(props) {
};
const handleClick = async (e, ProdCat, index) => {
const selectedOtherServiceCategory = otherServiceCategoryData?.filter(({ServiceCategory}) => ServiceCategory === ProdCat)
const selectedOtherServiceCategory = otherServiceCategoryData?.filter(
({ ServiceCategory }) => ServiceCategory === ProdCat
);
let data = false;
setaccessToCard(false);
setAccessOther(false);
@ -416,8 +421,10 @@ function BSOtherServicesVerticalcat(props) {
};
useEffect(() => {
if (isModalOpen) {
holdnamedrop();
}, [AppId, CompId, BranchId]);
}
}, [isModalOpen]);
const holdnamedrop = async () => {
let data = {
@ -614,16 +621,16 @@ function BSOtherServicesVerticalcat(props) {
formRef?.current?.resetFields();
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);
}
// 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) => {
@ -791,16 +798,17 @@ function BSOtherServicesVerticalcat(props) {
} else if (categoryData?.length > 0) {
setIndexVal(0);
}
}, [searchData, categoryData]);
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) {
setOtherServiceCategoryData(response?.data?.data?.ServiceCategories);
} else {
setMessageType("error")
setMessageData(response?.data?.response)
setMessageType('error');
setMessageData(response?.data?.response);
}
};
@ -919,7 +927,7 @@ function BSOtherServicesVerticalcat(props) {
),
// label:
// option.TaxIdName +
// " - " +
// " - " +Name
// 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();
},
Name,
},
]}
>
@ -1210,50 +1219,6 @@ function BSOtherServicesVerticalcat(props) {
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') &&
otherServiceCategoryData?.map((item, index) => (
@ -1418,90 +1383,6 @@ function BSOtherServicesVerticalcat(props) {
</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>
);

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 { useNavigate } from 'react-router-dom';
import { TiLocation } from 'react-icons/ti';
@ -24,30 +24,31 @@ import BSPrinterSetting from '../UtillComponents/BSPrinterSetting.jsx';
import { isMobile } from 'react-device-detect';
import { FaDisplay } from 'react-icons/fa6';
import {
FeatureAddon,
GlobalFeatAddOnData,
PreferenceData,
} from '../../../../Features/BookingScreen/BookingData/BookingData.js';
import {
setCustomerDisplayWindow,
closeCustomerDisplayWindow,
} from '../../../../Features/customerDisplayWindow/customerDisplayWindow';
import { setCustomerDisplayWindow } from '../../../../Features/customerDisplayWindow/customerDisplayWindow';
import TooltipWrapper from '../../../../Components/Tooltip/Tooltip';
import {
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 { userDataByUserId } from '../../../../Features/UserAccount/userData.js';
import { RiFullscreenExitFill, RiFullscreenFill } from 'react-icons/ri';
import { Popconfirm, Tooltip } from 'antd';
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 commonUrl = import.meta.env.ENV_COMMON_BASE_URL;
const BSC1NavBar = (props) => {
const BSComboData = props?.hasOwnProperty('data') ? props['data'] : null;
const divRef = useRef(null);
const navigate = useNavigate();
@ -109,16 +110,7 @@ const BSC1NavBar = (props) => {
).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 = () => {
setAccIsOpen(!isAccOpen);
};
@ -197,25 +189,6 @@ const BSC1NavBar = (props) => {
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 () => {
navigate(`${subDirectory}app-page/redirect-userprofile`);
};
@ -240,6 +213,7 @@ const BSC1NavBar = (props) => {
};
return (
<Suspense fallback={<div>Loading...</div>}>
<>
<div
className="BSC1NavBar-Container"
@ -306,7 +280,9 @@ const BSC1NavBar = (props) => {
<div className="BSC1NavBar-name">
{/* <PiStorefrontFill className="BSC1NavBar-name-icon" /> */}
<TooltipWrapper placement="bottom" title={branchName}>
<span className="BSC1NavBar-ellipsisname">{branchName}</span>{' '}
<span className="BSC1NavBar-ellipsisname">
{branchName}
</span>{' '}
</TooltipWrapper>
{BranchCity && (
<span className="BSC1NavBar-location">
@ -340,7 +316,9 @@ const BSC1NavBar = (props) => {
<Tooltip title={isFullscreen ? 'Exit Full Screen' : 'Full Screen'}>
<div
className={
isFullscreen ? 'BsNavbar1FullScreenExit' : 'BsNavbar1FullScreen'
isFullscreen
? 'BsNavbar1FullScreenExit'
: 'BsNavbar1FullScreen'
}
onClick={handleFullscreen}
>
@ -395,6 +373,7 @@ const BSC1NavBar = (props) => {
</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 { useDispatch, useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom';
import moment from 'moment';
import { Badge, Popover, Modal, Tooltip } from 'antd';
import { AiOutlineClose, AiOutlineArrowRight } from 'react-icons/ai';
import { GiBasket } from 'react-icons/gi';
import {
UpCircleOutlined,
UpOutlined,
TransactionOutlined,
} from '@ant-design/icons';
import { UpCircleOutlined } from '@ant-design/icons';
import {
printDiv,
extractLastNumberOrderId,
encryptObject,
} from '../../../../Services/Others';
import PaymentPdfBooking from '../../../paymentpdfPage/PaymentPdfBooking';
const PaymentPdfBooking = lazy(
() => import('../../../paymentpdfPage/PaymentPdfBooking')
);
import { Messages } from '../../../../Components/Notifications/Messages';
import { MdMoneyOff } from 'react-icons/md';
import paygate from '../../../../Images/paygate.png';
import defaultupi from '../../../../Images/defaultupi.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 { Tables } from '../../../../Components/Tables/Table';
import QrComponent from '../BookingFunctionality/DynamicQr.jsx';
import QrinScreen from '../BookingFunctionality/DynamicScreenQr.jsx';
const BSSummery1 = lazy(
() => 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 Buttons from '../../../../Components/Forms/Buttons';
import WpIcon from '../../../../Images/message.png';
@ -51,7 +52,6 @@ import {
GlobalReprintModal,
changeSelectedTableDetails,
GlobalNavHoldData,
getPreferenceData,
changeSelectedCustId,
GlobalSelCustId,
changeSelectedOption,
@ -64,8 +64,6 @@ import {
changeCreditFocus,
changeUpiIDprint,
GlobalSelectedCustDisable,
changeSummeryTotalItems,
changeSummeryQty,
changeSummeryTotalWithoutTaxAmount,
changeSummeryTotalTaxAmount,
GlobalEstimateBooking,
@ -80,16 +78,13 @@ import {
changeSelectChair,
GlobalOrderType,
changeReorderProductDetails,
FeatureAddon,
GlobalCommonPaymentOptions,
PostPaymentdevice,
changeUpiIDName,
changeUpiIDoptionId,
GetPaymentdeviceResponse,
PutBookingPaymentStatusChange,
changeCombosearch,
GlobalCombosearch,
Comboget,
GlobalPayementloader,
changePaymentloader,
PaymentGatewayGetdetail,
@ -108,7 +103,6 @@ import {
ChangeOverAllDiscEstimate,
GlobalUnpaidListData,
changeUnpaidData,
getAllCustomer,
GlobalBranchFinancialStatus,
changeSummeryComboOfferAmount,
changeTipAmount,
@ -116,7 +110,6 @@ import {
GlobalFeatAddOnData,
GlobalOtherServiceTicketClaim,
changeOtherServiceTicketClaim,
GlobalOtherSevices,
changeOtherServices,
changeComboRedirectionToDefaultLayoutForParking,
GlobalRetailWSSalesType,
@ -149,7 +142,7 @@ import {
GlobalprintDatas,
GlobalPrinterMappingDtls,
getPrinterMappingDetails,
getPrintSelectionComponentData,
// getPrintSelectionComponentData,
} from '../../../../Features/ThemeChange/ThemeChange';
import FeaturesFunctionalities from '../BookingFunctionality/FeaturesFunctionalities';
import {
@ -163,7 +156,6 @@ import {
ReprintDetails,
triggerCustomerRefresh,
} from '../../../../Features/BookingScreen/Customer/addCustomer';
import BSCustomerSelect from '../UtillComponents/BSSelectCustomer.jsx';
import PozoHoldIcon from '../UtillComponents/Pozo retail icons/PozoHoldIcon';
import PozoDineInIcon from '../UtillComponents/Pozo retail icons/PozoDineIn.jsx';
import PozoUnpaidIcon from '../UtillComponents/Pozo retail icons/PozoUnpaidIcon.jsx';
@ -173,16 +165,32 @@ import PozoQuickAddIcon from '../UtillComponents/Pozo retail icons/PozoQuickAddI
import PozoReprintIcon from '../UtillComponents/Pozo retail icons/PozoReprintIcon';
import PozoExtraChargesIcon from '../UtillComponents/Pozo retail icons/PozoExtraChargesIcon.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 BSCreditCustomer from '../UtillComponents/BSCreditCustomer.jsx';
const BSCreditCustomer = lazy(
() => import('../UtillComponents/BSCreditCustomer.jsx')
);
import PozoAdvanceIcon from '../UtillComponents/Pozo retail icons/PozoAdvanceIcon.jsx';
import { isMobile } from 'react-device-detect';
import MobilePrint from '../BookingFunctionality/MobilePrint.jsx';
import SplitPayment from '../BookingFunctionality/SplitPayment.jsx';
import BSNavBarEstimate from '../UtillComponents/BSNavBarEst.jsx';
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 TokensinglePrint from '../../../paymentpdfPage/TokenOnlyPrints/TokeninsinglePrint.jsx';
import SingleTokenMobilePrint from '../BookingFunctionality/SingleTokenMobilePrint.jsx';
@ -207,38 +215,48 @@ import {
changePreOrderDistrict,
changePreOrderState,
} 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 PozoFailedPaymentsIcon from '../UtillComponents/Pozo retail icons/PozoFailedPaymentsIcon.jsx';
import {
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 TooltipWrapper from '../../../../Components/Tooltip/Tooltip';
import BSNavBarOffer from '../UtillComponents/BSNavBarOffer/BSNavBarOffer.jsx';
import { getEmpAccess } from '../../../../Features/AppPage/CenterPage.js';
import { useAuth } from '../../../../AuthContext.jsx';
import { GlobalBookingStatus } from '../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js';
import WhatsAppShare from '../../../WhatsAppShare/whatsAppShare.jsx';
import CryptoJS from 'crypto-js';
import SMSShare from '../../../WhatsAppShare/SmsShare.jsx';
const BSNavBarOffer = lazy(
() => import('../UtillComponents/BSNavBarOffer/BSNavBarOffer.jsx')
);
const WhatsAppShare = lazy(
() => import('../../../WhatsAppShare/whatsAppShare.jsx')
);
const SMSShare = lazy(() => import('../../../WhatsAppShare/SmsShare.jsx'));
import { MdSms } from 'react-icons/md';
import {
changeSalesPaymentoption,
GlobalSalesPaymentoption,
} 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 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 { MobilePdfPrint } from '../BookingFunctionality/MobilePdfPrint.js';
import { PublicQrCodepost } from '../../../../Features/ConfigMasterPage/ConfigMasterPage.js';
import BSMembership from '../UtillComponents/BSMembership.jsx';
import CardPopover from '../BSBillingTables/StandardTable/Utils/CardPopover.jsx';
import UpiPopover from '../BSBillingTables/StandardTable/Utils/UpiPopOver.jsx';
import { useDateStore } from '../../../../Features/BookingScreen/BookingData/DateStore.js';
@ -248,13 +266,12 @@ import {
GlobalOfferAppliedProducts,
GlobalOverAllOfferAmt,
} from '../../../../Features/Offer/Offernew/BookingOffernew.js';
import BSNavBarTable from '../UtillComponents/BSNavBarTable.jsx';
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 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');
@ -275,7 +292,7 @@ const BSC1Payment = (props) => {
);
const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
const SessionData = useSelector(StoredSessionData);
const BranchFinancialStatus = useSelector(GlobalBranchFinancialStatus);
const globalTipAmount = useSelector(GlobaltipAmount);
const OtherServiceTicketClaim = useSelector(GlobalOtherServiceTicketClaim);
const RetailWSSalesType = useSelector(GlobalRetailWSSalesType);
@ -285,8 +302,7 @@ const BSC1Payment = (props) => {
const CompId = SessionData?.CompId;
const UserId = SessionData?.UserId;
const UserType = SessionData?.UserType;
const AuthToken = SessionData?.AuthToken;
const SessionMobileNo = SessionData?.SessionMobileNo;
const [open, setOpen] = useState(false);
const printerTemplateStyle = useSelector(SelectedPrintTemplate);
const SelectedTableDetails = useSelector(GlobalSelectedTableDetails);
@ -327,9 +343,7 @@ const BSC1Payment = (props) => {
const GlobEstBooking = useSelector(GlobalEstimateBooking);
const GlobProdwisedata = useSelector(GlobalSelProdWiseEst);
const preOrder = useSelector(GlobalpreOrderOpen);
const Comboglobal = useSelector(GlobalCombosearch);
const FailedTotalAmt = useSelector(GlobalFailedTotalAmt);
const OrderOfferDetail = useSelector(Global_OrderOfferDetail);
const [SelectedUpiOption, setSelectedUpiOption] = useState();
const [credit, setCredit] = useState(false);
const [overAllBal, setOverAllBal] = useState(0);
@ -359,11 +373,7 @@ const BSC1Payment = (props) => {
preference?.PreferredSubCatName === 'SportsApp' &&
preference?.PreferredStatus == 'Y'
);
console.log(
sportsAppPreference,
commonModulePreference,
'sportsAppPreference'
);
const bookingTypePreference = appPreferences?.find(
(preference) => preference?.PreferredCatName === 'Booking Type'
)?.PreferenceCatDetails;
@ -620,8 +630,10 @@ const BSC1Payment = (props) => {
setDefaultPaymentMode([]);
}
};
if (salesBillEdit) {
setDefaultPaymentOption();
}, [defaultPaymentTrigger]);
}
}, [defaultPaymentTrigger, salesBillEdit]);
useEffect(() => {
const getPrintData = async () => {
@ -846,11 +858,6 @@ const BSC1Payment = (props) => {
);
dispatch(changeSummeryComboOfferAmount(withComboSum));
// if (withdiscTotal <= 0) {
// dispatch(ChangeOverAllDiscSales(0));
// dispatch(ChangeOverAllDiscEstimate(0));
// }
} else {
setTotalAmount(0);
dispatch(changeSummeryTotalAmount(0));
@ -873,8 +880,8 @@ const BSC1Payment = (props) => {
UserId: UserId,
};
dispatch(getPrinterMappingDetails(data)).unwrap();
const Data1 = { AppId, CompId, BranchId };
dispatch(getPrintSelectionComponentData(Data1)).unwrap();
// const Data1 = { AppId, CompId, BranchId };
// dispatch(getPrintSelectionComponentData(Data1)).unwrap();
handleOtherData();
}, []);
useEffect(() => {
@ -960,28 +967,6 @@ const BSC1Payment = (props) => {
const paymentFailedStatusFun = async () => {
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 () => {
let data = {
@ -1011,7 +996,7 @@ const BSC1Payment = (props) => {
useEffect(() => {
if (CompId && BranchId && AppId) {
getHolddata();
getUnpaiddatas();
// getUnpaiddatas();
getCustomerData();
}
}, [CompId, BranchId, AppId]);
@ -1134,21 +1119,6 @@ const BSC1Payment = (props) => {
setPaybtnnameselected(PaymentOptionsModeName);
setPaybtnselected(PaymentOptionsModeId);
}, [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(() => {
if (!PrintOrderDetails?.length) return;
@ -1342,9 +1312,6 @@ const BSC1Payment = (props) => {
setEmpData(datas?.[0]);
};
const getCustomerData = async () => {
await dispatch(
getAllCustomer({ CompId: CompId, AppId: AppId, branchId: BranchId })
);
await dispatch(
getAddCustomerDetails({
CompId: CompId,
@ -2944,8 +2911,6 @@ const BSC1Payment = (props) => {
}
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;
}
@ -3029,20 +2994,6 @@ const BSC1Payment = (props) => {
clearInterval(intervalId); // Stop the loop when payment fails
CustomerDisplayRemovedData();
ClearAllGlobalStateDatas(value);
// const customerDisplayWindow = getCustomerDisplayWindow();
// if (customerDisplayWindow && !customerDisplayWindow.closed) {
// const updatedData = {
// userData: OrderCardDetail,
// ExtraCharges: GlobalExtraCharge,
// upi: GlobalUpiID,
// customer: selOption != null ? selOption : GetCustId,
// paymentMethod: Paybtnnameselected,
// Paymentgateway: false,
// OrderTotalAmount:PaymentGatewayfilter?.[0]?.Amount
// };
// customerDisplayWindow.postMessage(updatedData, '*');
// }
}
}
} catch (error) {
@ -3212,13 +3163,6 @@ const BSC1Payment = (props) => {
} else {
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);
setunpaidselectedindex(event);
} 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 () => {
setPreOrderOpen((prevState) => !prevState);
if (preOrderOpen) {
@ -3555,6 +3477,7 @@ const BSC1Payment = (props) => {
};
return (
<Suspense fallback={<div>Loading...</div>}>
<>
<div
className="BSC1Payment-Container"
@ -3645,7 +3568,8 @@ const BSC1Payment = (props) => {
BookingType !== 'TakeAway' && ChangeTakeAway()
}
style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}}
>
<PozoTakeAway
@ -3702,7 +3626,10 @@ const BSC1Payment = (props) => {
title="Alt + A"
open={isAltPressed}
>
<TooltipWrapper title={'Extra Charge'} isMobile={isMobile}>
<TooltipWrapper
title={'Extra Charge'}
isMobile={isMobile}
>
<div
className="BSC1Payment-div1-btns"
onClick={handleextraCharges}
@ -3723,7 +3650,10 @@ const BSC1Payment = (props) => {
{!isAltPressed && (
<div
style={{ fontSize: '9px', letterSpacing: '0.5px' }}
style={{
fontSize: '9px',
letterSpacing: '0.5px',
}}
>
(Alt + A)
</div>
@ -4006,7 +3936,10 @@ const BSC1Payment = (props) => {
}}
onClick={() =>
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)
}
>
@ -4215,7 +4148,10 @@ const BSC1Payment = (props) => {
>
<div style={{ width: '3rem' }}>Qty </div>
<div style={{ width: '4px' }}> : </div>
<div style={{ textAlign: 'right', width: '1rem' }}> {Qty} </div>
<div style={{ textAlign: 'right', width: '1rem' }}>
{' '}
{Qty}{' '}
</div>
</div>
<div
style={{ display: 'flex', alignItems: 'center' }}
@ -4321,7 +4257,9 @@ const BSC1Payment = (props) => {
>
<div
style={{
backgroundColor: Holddata ? '#52c41a' : 'default',
backgroundColor: Holddata
? '#52c41a'
: 'default',
color: Holddata ? '#ffffffff' : 'default',
height: '40px',
width: '45px',
@ -4350,11 +4288,16 @@ const BSC1Payment = (props) => {
{tabledata?.length > 0 && dinePreference && (
<>
{item?.OptionName == 'UnpaidBill' && (
<TooltipWrapper title="Unpaid Bills" isMobile={isMobile}>
<TooltipWrapper
title="Unpaid Bills"
isMobile={isMobile}
>
{' '}
<div
style={{
backgroundColor: unpaidFlow ? '#52c41a' : '#1292EE',
backgroundColor: unpaidFlow
? '#52c41a'
: '#1292EE',
color: unpaidFlow ? '#ffffffff' : '#ffffffff',
height: '40px',
width: '40px',
@ -4437,13 +4380,6 @@ const BSC1Payment = (props) => {
style={{
cursor:
OrderCardDetail?.length > 0 && 'not-allowed',
// color:
// OrderCardDetail?.length > 0 ||
// (selOption?.value === undefined &&
// GlobalAddCustomerDetails1?.length === 0 &&
// GetCustId?.CustMobile === undefined)
// ? 'gray'
// : '#1292eeff',
fontSize: '28px',
}}
/>{' '}
@ -4513,7 +4449,8 @@ const BSC1Payment = (props) => {
: ''
}
style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}}
/>
</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 && (
<TooltipWrapper title="Failed Payment" isMobile={isMobile}>
<div
@ -4615,10 +4525,17 @@ const BSC1Payment = (props) => {
open={isAltPressed}
>
<div
style={{ display: 'flex', gap: '0', alignItems: 'center' }}
style={{
display: 'flex',
gap: '0',
alignItems: 'center',
}}
>
<BSCustomerSelect />
<TooltipWrapper title={'Add Customer'} isMobile={isMobile}>
<TooltipWrapper
title={'Add Customer'}
isMobile={isMobile}
>
<div>
<PozoAddCustomerIcon
className="BSBillingNav-icon-table-icon bspaymentcomboAddCus"
@ -4922,9 +4839,10 @@ const BSC1Payment = (props) => {
children={
<>
<div>
You have already selected a table. If you click 'OK,' the table
selection will be removed, and the unpaid flow will continue. If
you click 'Cancel,' the dine-in flow will proceed as selected.
You have already selected a table. If you click 'OK,' the
table selection will be removed, and the unpaid flow will
continue. If you click 'Cancel,' the dine-in flow will proceed
as selected.
</div>
</>
}
@ -5063,6 +4981,7 @@ const BSC1Payment = (props) => {
</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 moment from 'moment';
import { BiBarcodeReader } from 'react-icons/bi';
@ -54,7 +61,9 @@ import { Messages } from '../../../../Components/Notifications/Messages';
import FormHeader from '../../../PageComponents/FormHeader';
import { DefaultModal } from '../../../../Components/Modal/DefaultModal';
import { Tables } from '../../../../Components/Tables/Table';
import FeaturesFunctionalities from '../BookingFunctionality/FeaturesFunctionalities';
const FeaturesFunctionalities = lazy(
() => import('../BookingFunctionality/FeaturesFunctionalities')
);
import { isMobile } from 'react-device-detect';
import BarcodeScanner from '../UtillComponents/BarcodeScanner.jsx';
import {
@ -80,8 +89,17 @@ import {
import { Global_PromoCodeOffers } from '../../../../Features/Offer/Offer.js';
import { validateOffers } from '../BSItemCards/ValidateOffer.jsx';
import { useSaleswiseOfferWatcher } from '../BSItemCards/SalesWiseOffer.jsx';
import ExpireConfirmModal from '../BookingFunctionality/ExpireConfirmModal.jsx';
import BarCodeScan from '../../../../Services/BarCodeScan.jsx';
const ExpireConfirmModal = lazy(
() => import('../BookingFunctionality/ExpireConfirmModal.jsx')
);
const BarcodeScanner = lazy(
() => import('../UtillComponents/BarcodeScanner.jsx')
);
const BSNavBarWeightScale = lazy(
() => import('../UtillComponents/BSNavBarWeightScale.jsx')
);
export default function BSC1Search(props) {
const dispatch = useDispatch();
@ -4499,6 +4517,7 @@ export default function BSC1Search(props) {
const widthBasedOnProdVariantDetails = getMaxBrandWidth();
return (
<Suspense fallback={<div>Loading...</div>}>
<>
<div
className="BSC1Search-container"
@ -4587,7 +4606,9 @@ export default function BSC1Search(props) {
</div>
{ProductSearch?.length > 5 &&
QuickAdd &&
GetmultipleSearchDatas.some((e) => e.toLowerCase() === 'qrcode') && (
GetmultipleSearchDatas.some(
(e) => e.toLowerCase() === 'qrcode'
) && (
<div>
<FeaturesFunctionalities
handleQuickAddCancel={handleQuickCancel}
@ -4662,8 +4683,11 @@ export default function BSC1Search(props) {
<div key={index}>
<div
className={
returnQtyCount(item?.ProdId, item, CartOrderDetails) >
0 || item?.StockAvailable !== 'Y'
returnQtyCount(
item?.ProdId,
item,
CartOrderDetails
) > 0 || item?.StockAvailable !== 'Y'
? 'ItemQtyCard'
: 'ItemQtyCard-disabled'
}
@ -4697,8 +4721,8 @@ export default function BSC1Search(props) {
<sup style={{ fontFamily: 'Gilroy' }}></sup>
&nbsp;
{
item?.ProdVariantDetails?.[0]?.StockDetails?.[0]
?.SellPrice
item?.ProdVariantDetails?.[0]
?.StockDetails?.[0]?.SellPrice
}
</p>
) : (
@ -4709,7 +4733,11 @@ export default function BSC1Search(props) {
</div>
))}
</div>
{brandId !== 'null' && brandId !== 'undefined' ? <hr></hr> : ''}
{brandId !== 'null' && brandId !== 'undefined' ? (
<hr></hr>
) : (
''
)}
</div>
))}
@ -4748,7 +4776,9 @@ export default function BSC1Search(props) {
className="EditQuantity-headingproductname"
style={{ marginLeft: '1rem' }}
>
<p className="EditQuantity-productname">{qtydata?.ProdName}</p>
<p className="EditQuantity-productname">
{qtydata?.ProdName}
</p>
</div>
</div>
<div style={{ display: 'flex' }}>
@ -4802,7 +4832,9 @@ export default function BSC1Search(props) {
className="EditQuantity-headingproductname"
style={{ marginLeft: '1rem' }}
>
<p className="EditQuantity-productname">{qtydata?.ProdName}</p>
<p className="EditQuantity-productname">
{qtydata?.ProdName}
</p>
</div>
</div>
<div style={{ display: 'flex' }}>
@ -4847,5 +4879,6 @@ export default function BSC1Search(props) {
</DefaultModal>
)} */}
</>
</Suspense>
);
}

View File

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

View File

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

View File

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

View File

@ -1,15 +1,16 @@
import React from 'react';
import React, { lazy, Suspense } from 'react';
import { MdEdit } from 'react-icons/md';
import { FaUserLarge } from 'react-icons/fa6';
import { BiSolidPhoneCall } from 'react-icons/bi';
import { PiSignOutLight } from 'react-icons/pi';
import user from '../../../../Images/dashboard/user.jpg';
import { clearSession, getSession } from '../../../../Services/Others';
import UserRelieveManager from '../../Template/RealivingUser';
import { GlobalCompBranchData } from '../../../../Features/BrachLogin/BranchLogin';
import { userDataByUserId } from '../../../../Features/UserAccount/userData';
import { useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom';
const UserRelieveManager = lazy(() => import('../../Template/RealivingUser'));
// Scss
import "../../../../Styles/BookingScreen/Components/BSNavbar/BSNavbar1.scss"
const subDirectory = import.meta.env.ENV_BASE_URL;
@ -37,6 +38,7 @@ const BSNavBarUserInfo = ({
navigate(`${subDirectory}app-page/branch-login`);
};
return (
<Suspense fallback={<div>Loading</div>}>
<div ref={divRef} className="BSNavBar1-Accmenu">
<div className="BSNavBar1-Acc-menu">
{CompBranchData?.length > 1 && (
@ -96,6 +98,7 @@ const BSNavBarUserInfo = ({
</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 { useNavigate } from 'react-router-dom';
import { Badge, Button, Popconfirm, Popover, Tooltip } from 'antd';
import { Badge, Popconfirm, Popover, Tooltip } from 'antd';
import {
FeatureAddon,
GlobalBookingType,
GlobalBookingTypeBoth,
PreferenceData,
changeCombosearch,
GlobalCombosearch,
getPreferenceData,
Comboget,
GlobalOrderCardDetails,
changeEstimateBooking,
GlobalOrderStatus,
@ -31,46 +35,8 @@ import {
changeComboRedirectionToDefaultLayoutForParking,
GlobalCommonPaymentOptions,
GlobalSelCustId,
} from '../../../../Features/BookingScreen/BookingData/BookingData';
import PozoPreOrderIcon from '../UtillComponents/Pozo retail icons/PozoPreOrderIcon.jsx';
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';
} from '../../../../Features/BookingScreen/BookingData/BookingData.js';
// js Files
import {
GlobalPreOrderPendingCount,
PreOrderGet,
@ -79,49 +45,125 @@ import {
changePreOrderAdditem,
changepreOrderList,
} from '../../../../Features/BookingScreen/PreOrder/PreOrder.js';
import {
ApplicationPreferences,
GenerateLogout,
GlobalCompBranchData,
getCompBranchData,
} from '../../../../Features/BrachLogin/BranchLogin.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 {
getPrintSelectionComponentData,
getTemplate,
getTemplateData,
StoredSessionData,
} from '../../../../Features/ThemeChange/ThemeChange.js';
import { IoMdClose } from 'react-icons/io';
import { GlobalBookingStatus } from '../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js';
import { getEmpAccess } from '../../../../Features/AppPage/CenterPage.js';
import { useAuth } from '../../../../AuthContext.jsx';
import BSNavBarDragItems from '../UtillComponents/BSNavBarDragItems.jsx';
import {
getUserProfile,
userDataByUserId,
} from '../../../../Features/UserAccount/userData.js';
import { FaUserLarge } from 'react-icons/fa6';
import { BiSolidPhoneCall } from 'react-icons/bi';
import { PiSignOutLight } from 'react-icons/pi';
import PozoSwapIcon from '../UtillComponents/Pozo retail icons/PozoSwapIcon.jsx';
import { MdEdit } from 'react-icons/md';
import { OtherServicesCardlistdata } from '../../../../Features/OtherServices/OtherServices.js';
import { clearSession, sessionStore } from '../../../../Services/Others.js';
import { setCustomerDisplayWindow } from '../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import BSMobilePrintSettings from '../UtillComponents/BSMobilePrintSettings.jsx';
// 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 UserRelieveManager from '../../Template/RealivingUser.jsx';
import user from '../../../../Images/dashboard/user.jpg';
import BSNavBarUserInfo from './BSNavBarUserInfo';
import { FaParking } from 'react-icons/fa';
import { OtherServicesCardlistdata } from '../../../../Features/OtherServices/OtherServices.js';
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 { isMobile } from 'react-device-detect';
import { DefaultModal } from '../../../../Components/Modal/DefaultModal.jsx';
import '../../../../Styles/BookingScreen/Components/BSNavbar/BSNavbar1.scss';
const subDirectory = import.meta.env.ENV_BASE_URL;
const commonUrl = import.meta.env.ENV_COMMON_BASE_URL;
@ -221,17 +263,28 @@ const BSNavbar1 = (props) => {
const comboRedirectionToDefaultLayoutForParking = useSelector(
GlobalComboRedirectionToDefaultLayoutForParking
);
const CartOrderDetails = useSelector(GlobalOrderCardDetails);
const divRef = useRef(null);
const handleClickOutside = (event) => {
if (divRef.current && !divRef.current.contains(event.target)) {
setAccIsOpen(false);
}
};
useEffect(() => {
if (!FeatureAddonData?.FeatureDtls?.length) return;
const preorderFeature = FeatureAddonData.FeatureDtls.find(
(item) => item?.FeatureAddonName?.toLowerCase() === 'preorder'
);
if (preorderFeature) {
BadgePendingApi();
}
}, [FeatureAddonData]);
useEffect(() => {
handleOtherData();
BadgePendingApi();
// if (UserType === "Employee") {
// fetchApi()
// }
@ -558,6 +611,7 @@ const BSNavbar1 = (props) => {
};
return (
<Suspense fallback={<div>Suspense Loading...</div>}>
<div
className="BSBillingNavBar1"
style={{
@ -581,7 +635,11 @@ const BSNavbar1 = (props) => {
isMobile={isMobile}
>
<PozoHomeIcon
style={{ color: '#1292EE', fontSize: '28px', cursor: 'pointer' }}
style={{
color: '#1292EE',
fontSize: '28px',
cursor: 'pointer',
}}
className="BSBillingNav2-toggle-icon"
/>
</TooltipWrapper>
@ -615,7 +673,9 @@ const BSNavbar1 = (props) => {
}}
>
<FaParking
fill={OtherServicesglobal === true ? '#52C41A' : '#1292EE'}
fill={
OtherServicesglobal === true ? '#52C41A' : '#1292EE'
}
/>
</div>
</TooltipWrapper>
@ -652,7 +712,10 @@ const BSNavbar1 = (props) => {
OrderType === 'Failed' ? 'none' : 'auto',
}}
>
<BSNavBarSearch nosearch={true} OrderType={OrderType} />
<BSNavBarSearch
nosearch={true}
OrderType={OrderType}
/>
</div>
)}
</>
@ -684,7 +747,8 @@ const BSNavbar1 = (props) => {
<TooltipWrapper title="RePrint (Alt+R)" isMobile={isMobile}>
<div
style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}}
>
<BSPrinterSetting />
@ -707,7 +771,8 @@ const BSNavbar1 = (props) => {
{item?.OptionName == 'QuickAdd' && (
<div
style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}}
>
<BSNavBarQuickAdd />
@ -732,7 +797,8 @@ const BSNavbar1 = (props) => {
{item?.OptionName == 'TakeAway' && takeAwayPreference && (
<div
style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}}
>
<BSNavBarHandbag />
@ -759,7 +825,8 @@ const BSNavbar1 = (props) => {
// CartOrderDetails?.length > 0 &&
<div
style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}}
>
<BSNavBarAddons />
@ -895,7 +962,10 @@ const BSNavbar1 = (props) => {
)}
{VerifyTheProducts && (
<TooltipWrapper title={'Verfied Products'} isMobile={isMobile}>
<TooltipWrapper
title={'Verfied Products'}
isMobile={isMobile}
>
<div>
<VerfiedProducts />
</div>
@ -962,11 +1032,16 @@ const BSNavbar1 = (props) => {
<div
style={{ fontSize: '1.5rem', color: 'rgb(18, 146, 238)' }}
>
<TooltipWrapper title="Other Services" isMobile={isMobile}>
<TooltipWrapper
title="Other Services"
isMobile={isMobile}
>
<div onClick={handleotherservices}>
<FaParking
fill={
OtherServicesglobal === true ? '#52C41A' : '#1292EE'
OtherServicesglobal === true
? '#52C41A'
: '#1292EE'
}
/>
</div>
@ -974,7 +1049,9 @@ const BSNavbar1 = (props) => {
</div>
)}
{!OtherServicesglobal &&
ScanLayoutScreen?.SettingValue === 'Y' && <BSScanTemplate />}
ScanLayoutScreen?.SettingValue === 'Y' && (
<BSScanTemplate />
)}
{!OtherServicesglobal && (
<>
@ -1136,7 +1213,8 @@ const BSNavbar1 = (props) => {
))}
{FeatureAddonData?.FeatureDtls?.find(
(item) =>
item?.FeatureAddonName?.toLowerCase() === 'Weight Scale'
item?.FeatureAddonName?.toLowerCase() ===
'Weight Scale'
) && (
<div
style={{
@ -1217,7 +1295,8 @@ const BSNavbar1 = (props) => {
<div
style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}}
>
<BSNavBarDragItems type="small-screen" />
@ -1290,6 +1369,7 @@ const BSNavbar1 = (props) => {
}
/>
</div>
</Suspense>
);
};
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 { useNavigate } from 'react-router-dom';
import { AiFillHome } from 'react-icons/ai';
@ -8,14 +15,10 @@ import {
getEditFavItems,
PreferenceData,
getPreferenceData,
GlobalCustId,
GlobalOrderCardDetails,
GlobalBookingType,
GlobalBookingTypeBoth,
FeatureAddon,
changeCombosearch,
GlobalCombosearch,
Comboget,
changeEstimateBooking,
changeSelectedOption,
changeSelectedCustId,
@ -37,23 +40,30 @@ import {
GlobalCommonPaymentOptions,
GlobalSelCustId,
} from '../../../../Features/BookingScreen/BookingData/BookingData';
import BSNavBarSearch from '../UtillComponents/BSNavBarSearch';
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';
const BSNavBarSearch = lazy(() => import('../UtillComponents/BSNavBarSearch'));
const BSNavBarHand = lazy(() => import('../UtillComponents/BSNavBarHand'));
const BSNavBarHandbag = lazy(
() => import('../UtillComponents/BSNavBarHandbag')
);
const BSNavBarAddons = lazy(() => import('../UtillComponents/BSNavBarAddons'));
const BSNavBarAddUser = lazy(
() => import('../UtillComponents/BSNavBarAddUser')
);
const BSNavBarQuickAdd = lazy(
() => import('../UtillComponents/BSNavBarQuickAdd')
);
const BSNavBarFavItems = lazy(
() => import('../UtillComponents/BSNavBarFavItems')
);
import BSNavBarWeightScale from '../UtillComponents/BSNavBarWeightScale';
import 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 FeaturesFunctionalities from '../BookingFunctionality/FeaturesFunctionalities.jsx';
import BSCustomerSelect from '../UtillComponents/BSSelectCustomer.jsx';
import PozoUserIcon from '../UtillComponents/Pozo retail icons/PozoUserIcon.jsx';
import {
ApplicationPreferences,
@ -73,48 +83,61 @@ import {
changePreOrderAdditem,
changepreOrderList,
} from '../../../../Features/BookingScreen/PreOrder/PreOrder.js';
import { DefaultModal } from '../../../../Components/Modal/DefaultModal.jsx';
import { getCustomerDisplayWindow } from '../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import PozoAddCustomerIcon from '../UtillComponents/Pozo retail icons/PozoAddCustomerIcon.jsx';
import PaymentFailedSales from '../../../Payment/PaymentFailedDetails/PaymentFailedSales.jsx';
import 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 TooltipWrapper from '../../../../Components/Tooltip/Tooltip';
import { Global_OfferStatus } from '../../../../Features/Offer/Offer.js';
import { IoMdClose } from 'react-icons/io';
import { isMobile } from 'react-device-detect';
import { useAuth } from '../../../../AuthContext.jsx';
import {
getPrintSelectionComponentData,
getTemplate,
getTemplateData,
StoredSessionData,
} from '../../../../Features/ThemeChange/ThemeChange.js';
import PozoPreOrderIcon from '../UtillComponents/Pozo retail icons/PozoPreOrderIcon.jsx';
import BSNavBarWholeSale from '../UtillComponents/BSNavBarWholeSale.jsx';
import { GlobalBookingStatus } from '../../../../Features/Payment/PaymentReceivedRetail/PaymentReceivedRetail.js';
import { 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 {
getUserProfile,
userDataByUserId,
} 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 UserRelieveManager from '../../Template/RealivingUser.jsx';
import { FaParking } from 'react-icons/fa';
import BSNavBarUserInfo from './BSNavBarUserInfo';
import { OtherServicesCardlistdata } from '../../../../Features/OtherServices/OtherServices.js';
import BSNavBarWholeSale from '../UtillComponents/BSNavBarWholeSale.jsx';
import BSMobilePrintSettings from '../UtillComponents/BSMobilePrintSettings.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 { 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 commonUrl = import.meta.env.ENV_COMMON_BASE_URL;
@ -222,6 +245,18 @@ const BSNavbar2 = () => {
(item) =>
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(() => {
handleOtherData();
BadgePendingApi();
@ -258,7 +293,7 @@ const BSNavbar2 = () => {
setisisHoldEnable(filterPayCounter?.[0]?.ModeDetails?.length > 0);
};
useEffect(() => {
fetchEditFavItems();
// fetchEditFavItems();
dispatch(
getPreferenceData({ CompId: CompId, AppId: AppId, BranchId: BranchId })
);
@ -294,27 +329,7 @@ const BSNavbar2 = () => {
setaddnewAccess(!hasAccess);
}, [empData, SAAccessCommonMaster, UserType]);
const fetchApi = async () => {
let data = {
CompId: CompId,
BranchId: BranchId,
AppId: AppId,
EmpId: UserId,
};
let response = await dispatch(getEmpAccess(data)).unwrap();
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
(item) => item.ConfigName === 'Sales'
);
setEmpData(datas?.[0]);
};
const fetchEditFavItems = async () => {
let data = {
CompId: CompId,
BranchId: BranchId,
AppId: AppId,
};
await dispatch(getEditFavItems(data)).unwrap();
};
const fetchBranchData = async () => {
if (UserType === 'Super Admin' || UserType === 'Super Admin User') {
await dispatch(
@ -341,11 +356,6 @@ const BSNavbar2 = () => {
}
};
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(
(item) =>
item.FeatureAddonName === 'Payment Gateway' ||
@ -575,8 +585,9 @@ const BSNavbar2 = () => {
};
return (
<Suspense fallback={<div>Loading</div>}>
<div className="BSBillingNavBar2" style={{ backgroundColor: 'white' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: '10px' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: '4px' }}>
<div>
<Popconfirm
title="Are you sure you want to go home?"
@ -621,7 +632,7 @@ const BSNavbar2 = () => {
</div>
{/* Multiple search */}
<Tooltip title={'Multiple Search'}>
<div className="MultiSearchIconDiv2">
<div className="MultiSearchIconDiv2" style={{ margin: '0 6px' }}>
<CgSearchLoading onClick={() => setMultiple(true)} />
</div>
</Tooltip>
@ -643,27 +654,6 @@ const BSNavbar2 = () => {
{Comboglobal === true && !OtherServicesglobal && (
<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 && (
<PaymentFailedSales
paymentFailedStatusFun={paymentFailedStatusFun}
@ -677,7 +667,8 @@ const BSNavbar2 = () => {
<div style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ display: 'flex', flexGrow: '1' }}>
<>
{item?.OptionName == 'RePrint' && !OtherServicesglobal && (
{item?.OptionName == 'RePrint' &&
!OtherServicesglobal && (
<TooltipWrapper
title="RePrint (Alt+R)"
isMobile={isMobile}
@ -908,20 +899,16 @@ const BSNavbar2 = () => {
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
}}
>
{/* <TfiHandDrag onClick={() => dispatch(Changedragging(!Isdragging))} style={{ color: Isdragging ? "green" : "#1292ee",fontSize:"25px" }} /> */}
<BSNavBarDragItems />
</div>
</>
)}
{FeatureAddonData?.FeatureDtls?.find(
(item) => item?.FeatureAddonName?.toLowerCase() === 'customer display'
(item) =>
item?.FeatureAddonName?.toLowerCase() === 'customer display'
) && (
<TooltipWrapper title="Customer Display" isMobile={isMobile}>
{/* <div onClick={openNewTab} style={{ display: "flex", alignItems: "center", cursor: "pointer" }} className="BSBillingNavBar2-AllIcons">
<FaDisplay />
</div> */}
<div
onClick={openNewTab}
className="BSBillingNavBar1-AllIcons"
@ -975,11 +962,16 @@ const BSNavbar2 = () => {
<div
style={{ fontSize: '1.5rem', color: 'rgb(18, 146, 238)' }}
>
<TooltipWrapper title="Other Services" isMobile={isMobile}>
<TooltipWrapper
title="Other Services"
isMobile={isMobile}
>
<div onClick={handleotherservices}>
<FaParking
fill={
OtherServicesglobal === true ? '#52C41A' : '#1292EE'
OtherServicesglobal === true
? '#52C41A'
: '#1292EE'
}
/>
</div>
@ -1016,7 +1008,8 @@ const BSNavbar2 = () => {
)} */}
{navbarOptions?.map((item) => (
<>
{item?.OptionName == 'RePrint' && !OtherServicesglobal && (
{item?.OptionName == 'RePrint' &&
!OtherServicesglobal && (
<div
style={{
pointerEvents:
@ -1151,7 +1144,8 @@ const BSNavbar2 = () => {
<>
{FeatureAddonData?.FeatureDtls?.find(
(item) =>
item?.FeatureAddonName?.toLowerCase() === 'Weight Scale'
item?.FeatureAddonName?.toLowerCase() ===
'Weight Scale'
) && (
<div
style={{
@ -1166,7 +1160,8 @@ const BSNavbar2 = () => {
<>
{FeatureAddonData?.FeatureDtls?.find(
(item) =>
item?.FeatureAddonName?.toLowerCase() === 'preorder'
item?.FeatureAddonName?.toLowerCase() ===
'preorder'
) && (
<div
style={{
@ -1238,7 +1233,8 @@ const BSNavbar2 = () => {
)}
<div
style={{
pointerEvents: OrderType === 'Failed' ? 'none' : 'auto',
pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}}
>
<BSNavBarDragItems type="small-screen" />
@ -1334,6 +1330,7 @@ const BSNavbar2 = () => {
}
/>
</div>
</Suspense>
);
};
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 { useDispatch, useSelector, shallowEqual } from 'react-redux';
import {
@ -38,7 +46,6 @@ import '../../../../Styles/BookingScreen/Components/BSNavbar/BSNavbar3.scss';
// UI Imports
import { Badge, Popconfirm, Tooltip } from 'antd';
import { AiFillHome } from 'react-icons/ai';
import { GoClockFill } from 'react-icons/go';
import {
FaPlus,
FaHandPaper,
@ -48,30 +55,23 @@ import {
FaParking,
} from 'react-icons/fa';
import { CiMenuBurger } from 'react-icons/ci';
import { IoClose, IoCloseOutline } from 'react-icons/io5';
import { FaCalendar } from 'react-icons/fa6';
import { IoCloseOutline } from 'react-icons/io5';
import {
RiFullscreenExitFill,
RiFullscreenFill,
RiPrinterFill,
} from 'react-icons/ri';
import { GiShoppingBag } from 'react-icons/gi';
import { PiSignOutFill } from 'react-icons/pi';
import { TfiHandDrag } from 'react-icons/tfi';
import { CgClose } from 'react-icons/cg';
import { DropDowns } from '../../../../Components/Forms/DropDown';
import PozoDineInIcon from '../UtillComponents/Pozo retail icons/PozoDineIn.jsx';
import BSNavBarFavItems from '../UtillComponents/BSNavBarFavItems.jsx';
import BSNavBarAddUser from '../UtillComponents/BSNavBarAddUser.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';
const BSNavBarAddUser = lazy(
() => import('../UtillComponents/BSNavBarAddUser.jsx')
);
const BSCustomerSelect = lazy(
() => import('../UtillComponents/BSSelectCustomer.jsx')
);
const FeaturesFunctionalities = lazy(
() => import('../BookingFunctionality/FeaturesFunctionalities.jsx')
);
import CustomerDisplayicon from '../UtillComponents/Pozo retail icons/PozoCustomerDisplayicon.jsx';
import BSNavBarPrinter from '../UtillComponents/BSNavBarPrinter.jsx';
import BSNavBarUserInfo from './BSNavBarUserInfo.jsx';
import {
getUserProfile,
userDataByUserId,
@ -81,8 +81,6 @@ import {
getSession,
sessionStore,
} from '../../../../Services/Others.js';
import UserRelieveManager from '../../Template/RealivingUser.jsx';
import BSNavbarSearchStandard from '../UtillComponents/BSNavbarSearchStandard.jsx';
import {
getTemplate,
getTemplateData,
@ -92,22 +90,12 @@ import {
CurrentTimeDisplay,
CurrentDateDisplay,
} from '../UtillComponents/CurrentDateTimeDisplay.jsx';
import BSPrinterSetting from '../UtillComponents/BSPrinterSetting.jsx';
import BSNavBarTable from '../UtillComponents/BSNavBarTable.jsx';
import TooltipWrapper from '../../../../Components/Tooltip/Tooltip.jsx';
import { isMobile } from 'react-device-detect';
import {
getCustomerDisplayWindow,
setCustomerDisplayWindow,
} 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 {
changepreOrder,
@ -126,6 +114,49 @@ import { CgSearchLoading } from 'react-icons/cg';
import { DefaultModal } from '../../../../Components/Modal/DefaultModal.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 commonUrl = import.meta.env.ENV_COMMON_BASE_URL;
@ -156,6 +187,7 @@ const BSNavbar3 = ({ optionNames }) => {
const [isUserAccOpen, setIsUserAccOpen] = useState(false);
const [quickAdd, setQuickAdd] = useState(false);
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
const [isFullscreen, setIsFullscreen] = useState(false);
const [multiple, setMultiple] = useState(false);
const GlobEstBooking = useSelector(GlobalEstimateBooking);
@ -563,6 +595,7 @@ const BSNavbar3 = ({ optionNames }) => {
};
return (
<Suspense fallback={<div>Loading</div>}>
<>
<div className="BSNavbar3Main">
<div className="homeTime">
@ -597,7 +630,9 @@ const BSNavbar3 = ({ optionNames }) => {
justifyContent: 'center',
cursor: 'pointer',
}}
fill={OtherServicesglobal === true ? '#52C41A' : '#1292EE'}
fill={
OtherServicesglobal === true ? '#52C41A' : '#1292EE'
}
/>
</div>
</TooltipWrapper>
@ -621,6 +656,7 @@ const BSNavbar3 = ({ optionNames }) => {
)}
{/* Customer Select - Always visible */}
{addCustomerOption && (
<div className="DropDownsCustomer always-visible">
<BSCustomerSelect
placeholder="Customer Name"
@ -631,8 +667,8 @@ const BSNavbar3 = ({ optionNames }) => {
{renderWithTooltip(<BSNavBarAddUser />, 'Add Customer')}
</span>
)}
{/* <IoClose className="DropDownsCustomerClose" strokeWidth={3} /> */}
</div>
)}
{offerOption && (
<div className="standard-extra-charges">
@ -675,12 +711,6 @@ const BSNavbar3 = ({ optionNames }) => {
)}
{/* Desktop CustomerActions */}
<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 && (
<div className="mobile-action-item">
<BSNavBarTable />
@ -761,7 +791,10 @@ const BSNavbar3 = ({ optionNames }) => {
)}
{!sportsAppPreference && (
<div className="FaTruckIconFavItem" style={{ padding: '4px 6px' }}>
<div
className="FaTruckIconFavItem"
style={{ padding: '4px 6px' }}
>
{renderWithTooltip(
<BSNavBarFavItems
size={41}
@ -772,14 +805,6 @@ const BSNavbar3 = ({ optionNames }) => {
)}
</div>
)}
{/*
{!sportsAppPreference &&
quickAddOption &&
renderWithTooltip(
<FaPlus className="FaTruckIcon" onClick={handleQuickAddOpen} />,
'QUICK ADD (SHIFT + Q)'
)} */}
{holdOption &&
((bookingType !== 'Dine In' && OrderCardDetail?.length != 0) ||
(bookingType !== 'Dine In' &&
@ -797,7 +822,9 @@ const BSNavbar3 = ({ optionNames }) => {
{ScanLayoutScreen?.SettingValue === 'Y' && <BSScanTemplate />}
<div
className="FaTruckIconDragItems"
style={{ pointerEvents: orderType === 'Failed' ? 'none' : 'auto' }}
style={{
pointerEvents: orderType === 'Failed' ? 'none' : 'auto',
}}
>
<BSNavBarDragItems />
</div>
@ -866,7 +893,9 @@ const BSNavbar3 = ({ optionNames }) => {
<Tooltip title={isFullscreen ? 'Exit Full Screen' : 'Full Screen'}>
<div
className={
isFullscreen ? 'BsNavbar3FullScreenExit' : 'BsNavbar3FullScreen'
isFullscreen
? 'BsNavbar3FullScreenExit'
: 'BsNavbar3FullScreen'
}
onClick={handleFullscreen}
>
@ -971,7 +1000,10 @@ const BSNavbar3 = ({ optionNames }) => {
</div>
)}
{quickAddOption && (
<div className="mobile-action-item" onClick={handleQuickAddOpen}>
<div
className="mobile-action-item"
onClick={handleQuickAddOpen}
>
{renderWithTooltip(<FaPlus size={30} />, 'Quick Add', 'top')}
<div>Quick Add</div>
</div>
@ -1070,7 +1102,10 @@ const BSNavbar3 = ({ optionNames }) => {
}
}}
>
<TooltipWrapper title={'Verfied Products'} isMobile={isMobile}>
<TooltipWrapper
title={'Verfied Products'}
isMobile={isMobile}
>
<div>
<VerfiedProducts
drawerOpen={drawerOpen}
@ -1134,7 +1169,8 @@ const BSNavbar3 = ({ optionNames }) => {
<div
className="BSBillingNavBar2-AllIcons"
style={{
pointerEvents: orderType === 'Failed' ? 'none' : 'auto',
pointerEvents:
orderType === 'Failed' ? 'none' : 'auto',
}}
>
<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 {
getConfigType,
@ -43,13 +50,17 @@ import {
validateSafeInput,
} from '../../../../Services/Others.js';
import WpIcon from '../../../../Images/message.png';
import QrinScreen from '../BookingFunctionality/DynamicScreenQr.jsx';
const QrinScreen = lazy(
() => import('../BookingFunctionality/DynamicScreenQr.jsx')
);
import {
getTemplateData,
SelectedPrintTemplate,
} from '../../../../Features/ThemeChange/ThemeChange.js';
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 { getCustomerDisplayWindow } from '../../../../Features/customerDisplayWindow/customerDisplayWindow.js';
import { getConfigTypeData } from '../../../../Features/ConfigMasterPage/ConfigMasterPage.js';
@ -1241,6 +1252,7 @@ const CreditCustSplitPayment = (props) => {
: 'Debit amount not available';
return (
<Suspense fallback={<div>Loading features...</div>}>
<>
<Messages messageType={messageType} messageData={messageData} />
<div className="splitmodal">
@ -1374,6 +1386,7 @@ const CreditCustSplitPayment = (props) => {
</div>
)}
</>
</Suspense>
);
};
export default CreditCustSplitPayment;

View File

@ -4,6 +4,7 @@ import React, {
useEffect,
useCallback,
useContext,
lazy,
} from 'react';
import { useDispatch, useSelector } from 'react-redux';
import {
@ -16,7 +17,6 @@ import {
Checkbox,
AutoComplete,
Switch,
Tooltip,
Popconfirm,
Tabs,
} from 'antd';
@ -58,7 +58,6 @@ import {
ChangeOverAllDiscSales,
PreferenceData,
ChangeComboCarddata,
getPreferenceData,
getCustomerForHold,
PostBlockSlots,
} from '../../../../Features/BookingScreen/BookingData/BookingData';
@ -68,7 +67,6 @@ import { ArrowRightOutlined, CloseSquareFilled } from '@ant-design/icons';
import { InputField } from '../../../../Components/Forms/InputField';
import { Messages } from '../../../../Components/Notifications/Messages';
import Buttons from '../../../../Components/Forms/Buttons';
import ProductForm from '../../../../Pages/BookingScreen/Forms/QuickAdd/QuickAdd.jsx';
import {
GlobalAddCustomerDetails,
getAddCustomerDetails,
@ -86,7 +84,6 @@ import {
ChangeTotalAmount,
globalExtraTotalAmount,
} from '../../../../Features/ExteraCharges/ExtraCharges.js';
import WeightScaleComp from '../../../../Components/WeightScale/weightScale.jsx';
import {
gettinghold,
puttinghold,
@ -98,7 +95,6 @@ import {
getProductsearch,
} from '../../../../Features/BookingScreen/BookingData/BookingData';
import { AiOutlineDownCircle, AiOutlineUpCircle } from 'react-icons/ai';
import '../../../../Styles/BookingScreen/Components/BookingFunctionality/FeaturesFunctionalities.scss';
import {
IoCloseSharp,
IoPersonAddSharp,
@ -111,7 +107,6 @@ import {
GlobalPreOrderList,
GlobalpreOrderOpen,
} from '../../../../Features/BookingScreen/PreOrder/PreOrder.js';
import Imageupload from '../../../../Components/Forms/Upload.jsx';
import { useApplyOfferto_CardDetail } from '../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import { getCombolist } from '../../../../Features/ComboMaster/ComboMaster.js';
import {
@ -122,9 +117,21 @@ import {
import { v4 as uuidv4 } from 'uuid';
import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin.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 { 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 { closeModal = () => {} } = props;
@ -141,7 +148,6 @@ const FeaturesFunctionalities = (props) => {
const formRefExtraCharges = useRef();
const ExtraChargesType = useSelector(globalExtraChargesType);
const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
console.log(GlobalExtraCharge, "GlobalExtraCharge")
const ReorderHoldDetails = useSelector(GlobalReorderHoldDetails);
const BookingType = useSelector(GlobalBookingType);
const BookingTypeBoth = useSelector(GlobalBookingTypeBoth);
@ -582,12 +588,6 @@ const FeaturesFunctionalities = (props) => {
useEffect(() => {
setWeightScale(props.WeightScale);
}, [props.WeightScale]);
// useEffect(() => {
// if (!props.addcustomer) {
// formRef.current?.resetFields();
// setZipCodeData(false);
// }
// }, [props.addcustomer]);
const ExtTabledata = async () => {
const data = {
CompId: CompId,
@ -1194,11 +1194,6 @@ const FeaturesFunctionalities = (props) => {
),
},
];
console.log(ReorderHoldDetails,
BookingType,
GlobalExtraCharge, "GlobalExtraCharge");
const defaultColumns1 = [
{
title: 'ExtraCharge Type',
@ -3316,7 +3311,9 @@ const FeaturesFunctionalities = (props) => {
<Popconfirm
title="Remove Address"
description="Are you sure you want to remove this address?"
onConfirm={() => handleRemoveAddress(idx)}
onConfirm={() =>
handleRemoveAddress(idx)
}
okText="Yes, Remove"
cancelText="Cancel"
okType="danger"
@ -3921,7 +3918,7 @@ const FeaturesFunctionalities = (props) => {
onChange={setActiveTab}
items={[
{ key: 'quickAdd', label: 'Quick Add' },
{ key: 'directSale', label: 'Direct Sale' }
{ key: 'directSale', label: 'Direct Sale' },
]}
/>
<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 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 {
getConfigType,
GlobalCommonPaymentOptions,
@ -58,54 +80,61 @@ import {
putSalesBillEdit,
changeBillEditingMode,
changePreviousOrderPayment,
changePreviousOrderOfferDetail
changePreviousOrderOfferDetail,
GlobalAllBookingType,
} 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 {
extractLastNumberOrderId,
getSession,
printDiv,
validateSafeInput,
} from '../../../../Services/Others.js';
import WpIcon from '../../../../Images/message.png';
import {
ChangeTotalAmount,
globalExtraTotalAmount,
} 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 {
getTemplateData,
GlobalprintDatas,
SelectedPrintTemplate,
} 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 { gettinghold } from '../../../../Features/BookingScreen/HoldOption/HoldOption.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 { 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 MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
@ -119,12 +148,13 @@ const SplitPayment = (props) => {
const AppId = getSession('AppId');
const UserId = getSession('UserId');
const appPreferences = useSelector(ApplicationPreferences);
const AllBookingType = useSelector(GlobalAllBookingType);
const applyOffer = useApplyOfferto_CardDetail();
const globalTipAmount = useSelector(GlobaltipAmount);
const TotalNetAmount = (props.hasOwnProperty('TotalNetAmount')
const TotalNetAmount = props.hasOwnProperty('TotalNetAmount')
? props['TotalNetAmount']
: null);
: null;
const TableOrderId = props.hasOwnProperty('TableBookingOrderId')
? props['TableBookingOrderId']
: null;
@ -138,10 +168,16 @@ const SplitPayment = (props) => {
const SelCustId = useSelector(GlobalSelCustId);
const salesBillEdit = useSelector(GlobalSalesBillEdit);
const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails);
const previousOrderOfferDetails = useSelector(
GlobalPreviousOrderOfferDetails
);
const filteredPayments =
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 =
filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || [];
@ -150,7 +186,8 @@ const SplitPayment = (props) => {
0
);
const totalPreviouspayment = paymentsToUse?.reduce(
(acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
(acc, payment) =>
acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
0
);
const [paybtns, setpaybtns] = useState([]);
@ -193,7 +230,11 @@ const SplitPayment = (props) => {
const OverAllSales = useSelector(GlobalOverAllDiscSales);
const OverAllEstimate = useSelector(GlobalOverAllDiscEstimate);
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(
(i) => i.SettingIdName === 'PrintUom'
)?.[0];
@ -223,7 +264,7 @@ const SplitPayment = (props) => {
(item) => item?.OptionName == 'Offer'
);
const [TotalAmount, setTotalAmount] = useState(0);
console.log(TotalAmount, "TotalSplitAmount", TotalSplitAmount)
console.log(TotalAmount, 'TotalSplitAmount', TotalSplitAmount);
const preferenceOffer =
SettingDataSelector?.[0]?.['SettingDtlDetails']?.find(
(item) => item.SettingIdName === 'Offer'
@ -237,9 +278,8 @@ const SplitPayment = (props) => {
}, []);
useEffect(() => {
if (salesBillEdit) {
const previousNetAmount = (totalPreviouspayment || 0);
const previousNetAmount = totalPreviouspayment || 0;
if (TotalNetAmount > previousNetAmount) {
setTotalAmount(TotalNetAmount - previousNetAmount);
} else {
@ -248,8 +288,7 @@ const SplitPayment = (props) => {
} else {
setTotalAmount(TotalNetAmount);
}
}, [totalPreviousOfferAmount, totalPreviouspayment, TotalNetAmount])
}, [totalPreviousOfferAmount, totalPreviouspayment, TotalNetAmount]);
useEffect(() => {
if (SelCustId) {
@ -272,7 +311,7 @@ const SplitPayment = (props) => {
}, [Splitpayment]);
useEffect(() => {
const totalPayAmount = Object.keys(SplitSelPayMode)
.filter(key => key.startsWith('PayAmount-'))
.filter((key) => key.startsWith('PayAmount-'))
.reduce((sum, key) => {
const value = parseInt(SplitSelPayMode[key], 10);
return sum + (isNaN(value) ? 0 : value);
@ -360,20 +399,12 @@ const SplitPayment = (props) => {
setUpiPayOption(options);
};
const getBookingTypeId = async () => {
let tempconfigdata = await dispatch(
getConfigType({ TypeName: 'Booking Type' })
).unwrap();
if (tempconfigdata?.data?.statusCode == 1) {
setConfigDataList(tempconfigdata?.data?.data);
let configdata = tempconfigdata?.data?.data;
setConfigDataList(AllBookingType);
let configdata = AllBookingType;
let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType;
let filterconfigdata = configdata?.find(
(a) => a?.ConfigName === checkName
);
let filterconfigdata = configdata?.find((a) => a?.ConfigName === checkName);
setSelectedBookingType(filterconfigdata?.ConfigId);
}
};
const gettodaydate = () => {
const currentDate = new Date();
@ -547,7 +578,8 @@ const SplitPayment = (props) => {
SingleTokenMobilePrint(PrintOrderDetails, SelUpiId, 'Booking');
}
} else {
MobilePrint(appPreferences,
MobilePrint(
appPreferences,
PrintOrderDetails,
SelUpiId,
'Booking',
@ -570,8 +602,9 @@ const SplitPayment = (props) => {
await Promise.all(
PrintOrderDetails?.[0]?.OrderDetails?.map(
async (orderDetail, index) => {
const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce(
(acc, item, idx) => {
const groupedTokens = orderDetail?.productDetails
?.filter((data) => data?.EditTokenAvailable !== 'N')
?.reduce((acc, item, idx) => {
if (item.TokenAvailable === 'Y') {
if (!item.CounterName) {
// If CounterName is null or empty
@ -584,9 +617,7 @@ const SplitPayment = (props) => {
}
}
return acc;
},
{}
);
}, {});
// Iterate over grouped tokens and print them
const tokensToPrint = Object.entries(groupedTokens).map(
@ -605,11 +636,11 @@ const SplitPayment = (props) => {
);
} else {
await Promise.all(
PrintOrderDetails?.[0]?.OrderDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.map(
async (orderDetail, index) => {
PrintOrderDetails?.[0]?.OrderDetails?.filter(
(data) => data?.EditTokenAvailable !== 'N'
)?.map(async (orderDetail, index) => {
await TokenPrint(`${index}-${orderDetail?.OrderId}`);
}
)
})
);
setPrintOrderDetails([]);
}
@ -650,8 +681,9 @@ const SplitPayment = (props) => {
async (orderDetail, index) => {
await printDiv(`${selectedStyle}-${index}`, style); // Use unique IDs for each print
if (orderDetail?.BookingTypeName !== 'Dine In') {
const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce(
(acc, item, idx) => {
const groupedTokens = orderDetail?.productDetails
?.filter((data) => data?.EditTokenAvailable !== 'N')
?.reduce((acc, item, idx) => {
if (item.TokenAvailable === 'Y') {
if (!item.CounterName) {
// If CounterName is null or empty
@ -664,9 +696,7 @@ const SplitPayment = (props) => {
}
}
return acc;
},
{}
);
}, {});
// Iterate over grouped tokens and print them
const tokensToPrint = Object.entries(groupedTokens).map(
@ -1448,7 +1478,14 @@ const SplitPayment = (props) => {
// SalesTableLinkDetails:
// SelectedTableDetails?.length > 0 ? SelectedTableDetails : null,
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,
// "Debit": 0,
@ -1635,10 +1672,16 @@ const SplitPayment = (props) => {
if (response?.data?.statusCode == 1) {
setSalesOrderId(response?.data?.OrderId);
const salesEditAmount = response?.data?.PaymentOrderDtl?.find(payment =>
payment?.LastOrderTran === 'Y' && payment?.AdjustmentType &&
payment?.AdjustmentType != null && payment?.AfterAdjustment && payment?.BeforeAdjustment && payment?.AfterAdjustment != null && payment?.BeforeAdjustment != null
)
const salesEditAmount = response?.data?.PaymentOrderDtl?.find(
(payment) =>
payment?.LastOrderTran === 'Y' &&
payment?.AdjustmentType &&
payment?.AdjustmentType != null &&
payment?.AfterAdjustment &&
payment?.BeforeAdjustment &&
payment?.AfterAdjustment != null &&
payment?.BeforeAdjustment != null
);
setBeforeAdjAmount(salesEditAmount?.BeforeAdjustment || null);
setAfterAdjAmount(salesEditAmount?.AfterAdjustment || null);
setAdjustmentType(salesEditAmount?.AdjustmentType || null);
@ -1722,7 +1765,13 @@ const SplitPayment = (props) => {
OrderId: props.hasOwnProperty('TableBookingOrderId')
? TableOrderId
: SalesOrderId,
...(i === 0 ? { SalesId: props.hasOwnProperty('TableBookingSalesId') ? TableSalesId : SalesOrderId } : {}),
...(i === 0
? {
SalesId: props.hasOwnProperty('TableBookingSalesId')
? TableSalesId
: SalesOrderId,
}
: {}),
PaymentType:
SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi'
? SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pd'
@ -1789,7 +1838,6 @@ const SplitPayment = (props) => {
BeforeAdjAmount: beforeAdjAmount || null,
AfterAdjAmount: afterAdjAmount || null,
AdjustmentType: adjustmentType || null,
};
let response = await dispatch(
@ -2125,6 +2173,7 @@ const SplitPayment = (props) => {
}
return (
<Suspense fallback={<div>Loading...</div>}>
<>
<Messages messageType={messageType} messageData={messageData} />
<div className="splitmodal">
@ -2141,7 +2190,10 @@ const SplitPayment = (props) => {
<div className="splitpaymentModal-content">
<p>Total Amount : {safeRound(TotalAmount)}</p>
<p>
Remaining Balance : {TotalAmount - (isNaN(TotalSplitAmount) ? 0 : TotalSplitAmount)} </p>
Remaining Balance :{' '}
{TotalAmount -
(isNaN(TotalSplitAmount) ? 0 : TotalSplitAmount)}{' '}
</p>
<>{calculateField()}</>
{TotalAmount > TotalSplitAmount &&
@ -2314,6 +2366,7 @@ const SplitPayment = (props) => {
/>
)}
</>
</Suspense>
);
};
export default SplitPayment;

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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