combo screen edit qty and rate added
This commit is contained in:
parent
1d7944d28c
commit
4c10e36840
|
|
@ -48,6 +48,8 @@ const BSBillingEditQuantity = (props) => {
|
|||
const priceChangeInputRef = useRef(null);
|
||||
const reductionInputRef = useRef(null);
|
||||
|
||||
const { setIndex = () => {} } = props;
|
||||
|
||||
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
|
||||
const SessionData = useSelector(StoredSessionData);
|
||||
// const AppId = SessionData?.AppId;
|
||||
|
|
@ -670,6 +672,7 @@ const BSBillingEditQuantity = (props) => {
|
|||
props.handleEditQuantityCancel();
|
||||
setClearQuantity(false);
|
||||
}
|
||||
setIndex(null);
|
||||
};
|
||||
|
||||
const handleEditQuantity = async (
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
.EditQTYcomboInput {
|
||||
width: 80px;
|
||||
height: 25px;
|
||||
border: none;
|
||||
outline: none !important;
|
||||
padding: 2px;
|
||||
text-align: center;
|
||||
font-family: "Poppins", sans-serif;
|
||||
font-weight: 500;
|
||||
vertical-align: middle;
|
||||
background-color: #1292ee;
|
||||
color: #fff;
|
||||
border-radius: 4px;
|
||||
|
||||
&::placeholder {
|
||||
color: #bdd4ff;
|
||||
}
|
||||
}
|
||||
|
||||
.EditQTYcomboInputRate {
|
||||
width: 80px;
|
||||
height: 25px;
|
||||
border: none;
|
||||
outline: none !important;
|
||||
padding: 2px !important;
|
||||
text-align: center;
|
||||
font-family: "Poppins", sans-serif;
|
||||
font-weight: 500;
|
||||
vertical-align: middle;
|
||||
background-color: #1292ee;
|
||||
color: #fff;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
margin-top: 0 !important;
|
||||
padding-top: unset !important;
|
||||
|
||||
&::placeholder {
|
||||
color: #bdd4ff;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: #1292ee !important;
|
||||
padding: 2px !important;
|
||||
}
|
||||
}
|
||||
// .EditQuantity-Content .ant-form-item
|
||||
|
||||
.rateTdEditRate {
|
||||
.ant-form-item {
|
||||
padding-bottom: 0 !important;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
.ant-form-item-control-input {
|
||||
min-height: unset;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,4 +1,4 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import './ComboSalesBillTable.scss';
|
||||
import { shallowEqual, useDispatch, useSelector } from 'react-redux';
|
||||
import { Popconfirm, Tooltip } from 'antd';
|
||||
|
|
@ -73,6 +73,8 @@ import {
|
|||
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
|
||||
import { useRemoveProducts } from '../BSBillingTable3/RemoveCartWithOffer.jsx';
|
||||
import { useUtilsComponent } from '../../../../../Services/utils.js';
|
||||
import ComboEditQty from '../ComboBillTableEdit/ComboEditQty.jsx';
|
||||
import ComboEditRate from '../ComboBillTableEdit/ComboEditRate.jsx';
|
||||
import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
|
||||
|
||||
const ComboSalesBillTable = () => {
|
||||
|
|
@ -131,7 +133,8 @@ const ComboSalesBillTable = () => {
|
|||
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(
|
||||
|
|
@ -145,16 +148,18 @@ const ComboSalesBillTable = () => {
|
|||
OrderType === 'Hold'
|
||||
? tableData?.filter((a, b) => a.BookingTypeName === 'TakeAway')
|
||||
: tableData?.filter(
|
||||
(a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
|
||||
);
|
||||
(a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
|
||||
);
|
||||
const OldtableDataTakeAway =
|
||||
OrderType != 'Hold'
|
||||
? tableData?.filter(
|
||||
(a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
|
||||
)
|
||||
(a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
|
||||
)
|
||||
: [];
|
||||
|
||||
const [EditQuantity, setEditQuantity] = useState(false);
|
||||
const [EditQtyCombo, setEditQtyCombo] = useState(false);
|
||||
const [EditRateCombo, setEditRateCombo] = useState(false);
|
||||
const [Modaldata, setModaldata] = useState([]);
|
||||
const [triggerAnimation, setTriggerAnimation] = useState(true);
|
||||
// const editField =
|
||||
|
|
@ -169,6 +174,32 @@ const ComboSalesBillTable = () => {
|
|||
// const [BillOrderPre, setBillOrderPre] = useState();
|
||||
// console.log(BillOrderPre,'BillOrderPre');
|
||||
|
||||
const [qtyEdit, setQtyEdit] = useState(false);
|
||||
const qtyTdRef = useRef(null);
|
||||
const qtyInputRef = useRef(null);
|
||||
|
||||
const handleEditQTYcombo = () => {
|
||||
if (!qtyEdit) {
|
||||
setQtyEdit(true);
|
||||
}
|
||||
};
|
||||
|
||||
// Outside click handler for quantity edit
|
||||
|
||||
useEffect(() => {
|
||||
const handleOutsideClick = (e) => {
|
||||
if (qtyEdit && qtyTdRef.current && !qtyTdRef.current.contains(e.target)) {
|
||||
setQtyEdit(false); // 👈 outside click → close edit
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener('mousedown', handleOutsideClick);
|
||||
return () => {
|
||||
document.removeEventListener('mousedown', handleOutsideClick);
|
||||
};
|
||||
}, [qtyEdit]);
|
||||
// Outside click handler for quantity edit End
|
||||
|
||||
useEffect(() => {
|
||||
if (tableOptions?.length > 0) {
|
||||
let editFieldValue = tableOptions?.filter(
|
||||
|
|
@ -255,7 +286,7 @@ const ComboSalesBillTable = () => {
|
|||
const handleCustomerProductPriceHistory = (item) => {
|
||||
setCustomerPriceHistoryOpen(true);
|
||||
setCustomerProduct(item?.ProdId);
|
||||
}
|
||||
};
|
||||
|
||||
const handleEditQuantity = (value) => {
|
||||
if (OtherServicesglobal && value.Type == 'OS' && value.ServiceType == 'I') {
|
||||
|
|
@ -270,10 +301,43 @@ const ComboSalesBillTable = () => {
|
|||
}
|
||||
}
|
||||
};
|
||||
const handleEditQuantityCombo = (value) => {
|
||||
if (OtherServicesglobal && value.Type == 'OS' && value.ServiceType == 'I') {
|
||||
setEditQtyCombo(false);
|
||||
} else {
|
||||
if (value?.SalesId) {
|
||||
setEditQtyCombo(false);
|
||||
} else {
|
||||
setEditQtyCombo(true);
|
||||
setEditRateCombo(false);
|
||||
setModaldata(value);
|
||||
setIndex(value?.localId);
|
||||
}
|
||||
}
|
||||
};
|
||||
const handleEditRateCombo = (value) => {
|
||||
if (OtherServicesglobal && value.Type == 'OS' && value.ServiceType == 'I') {
|
||||
setEditRateCombo(false);
|
||||
} else {
|
||||
if (value?.SalesId) {
|
||||
setEditRateCombo(false);
|
||||
} else {
|
||||
setEditRateCombo(true);
|
||||
setModaldata(value);
|
||||
setIndex(value?.localId);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleEditQuantityCancel = () => {
|
||||
setEditQuantity(false);
|
||||
};
|
||||
const handleEditQuantityComboCancel = () => {
|
||||
setEditQtyCombo(false);
|
||||
};
|
||||
const handleEditRateComboCancel = () => {
|
||||
setEditRateCombo(false);
|
||||
};
|
||||
|
||||
const OpenEditTotalAmount = () => {
|
||||
setOpenEditTotalAmt(true);
|
||||
|
|
@ -1058,9 +1122,9 @@ const ComboSalesBillTable = () => {
|
|||
)?.map((item, idx) =>
|
||||
idx === 0
|
||||
? {
|
||||
...item,
|
||||
FreeQty,
|
||||
}
|
||||
...item,
|
||||
FreeQty,
|
||||
}
|
||||
: item
|
||||
),
|
||||
};
|
||||
|
|
@ -2115,9 +2179,11 @@ const ComboSalesBillTable = () => {
|
|||
|
||||
{/* Delete */}
|
||||
{item.OptionName === 'Delete' && (
|
||||
<th className="deleteTh"
|
||||
<th
|
||||
className="deleteTh"
|
||||
style={{ textAlign: 'center', width: '80px' }}
|
||||
key={item.OptionId}>
|
||||
key={item.OptionId}
|
||||
>
|
||||
{tableData?.length > 0 ? (
|
||||
<Popconfirm
|
||||
title="Delete the items"
|
||||
|
|
@ -2180,20 +2246,20 @@ const ComboSalesBillTable = () => {
|
|||
tableDataDinein?.length >= PreviousdataLength
|
||||
? 'wheat'
|
||||
: BookingType !== 'Dine In' &&
|
||||
triggerAnimation &&
|
||||
OldtableDataTakeAway?.length + index === 0 &&
|
||||
tableDataDinein?.length >= PreviousdataLength &&
|
||||
!HoldOrderDtl &&
|
||||
!UnpaidData
|
||||
triggerAnimation &&
|
||||
OldtableDataTakeAway?.length + index === 0 &&
|
||||
tableDataDinein?.length >= PreviousdataLength &&
|
||||
!HoldOrderDtl &&
|
||||
!UnpaidData
|
||||
? 'wheat'
|
||||
: 'inherit'
|
||||
: 'none',
|
||||
background: row?.SalesId
|
||||
? 'rgb(243, 248, 213)'
|
||||
: GlobEstBooking === 'ParEst' &&
|
||||
GlobProdwisedata?.includes(
|
||||
row?.InwardDtlId + ' ' + row?.BookingTypeName
|
||||
)
|
||||
GlobProdwisedata?.includes(
|
||||
row?.InwardDtlId + ' ' + row?.BookingTypeName
|
||||
)
|
||||
? '#b2d1f7'
|
||||
: (OldtableDataTakeAway?.length + index) % 2 === 0
|
||||
? 'white'
|
||||
|
|
@ -2228,39 +2294,37 @@ const ComboSalesBillTable = () => {
|
|||
{/* Product Name / Item */}
|
||||
{(item.OptionName === 'Item' ||
|
||||
item.OptionName === 'Product Name') && (
|
||||
<td
|
||||
key={`prod-${index}`}
|
||||
className="productNameTd"
|
||||
onClick={() =>
|
||||
row.FullProductIdentifierDtls?.length > 0 ||
|
||||
row.ProductIdentifierDtls?.length > 0
|
||||
? handleImeiDetails(row)
|
||||
: editField && handleEditQuantity(row)
|
||||
}
|
||||
>
|
||||
{row?.Type !== 'OS' ? row.ProdName : row.ServiceName}
|
||||
{row?.BrandName ? ` ${row.BrandName}` : ''}
|
||||
{row?.Type !== 'C' && (
|
||||
<p className="Tbl3-Variant">
|
||||
{/* {row?.ProdVariantName} {row?.Size} {row?.UomName} */}
|
||||
(
|
||||
{!row?.ProdVariantName?.toLowerCase()?.includes(
|
||||
'variant'
|
||||
) && <span>{row?.ProdVariantName} </span>}
|
||||
{row?.Size}
|
||||
{row?.SinglePc == 'Y' ? 'PCS' : row?.UomName}
|
||||
|
||||
)
|
||||
<td
|
||||
key={`prod-${index}`}
|
||||
className="productNameTd"
|
||||
onClick={() =>
|
||||
row.FullProductIdentifierDtls?.length > 0 ||
|
||||
row.ProductIdentifierDtls?.length > 0
|
||||
? handleImeiDetails(row)
|
||||
: editField && handleEditQuantity(row)
|
||||
}
|
||||
>
|
||||
{row?.Type !== 'OS' ? row.ProdName : row.ServiceName}
|
||||
{row?.BrandName ? ` ${row.BrandName}` : ''}
|
||||
{row?.Type !== 'C' && (
|
||||
<p className="Tbl3-Variant">
|
||||
{/* {row?.ProdVariantName} {row?.Size} {row?.UomName} */}
|
||||
(
|
||||
{!row?.ProdVariantName?.toLowerCase()?.includes(
|
||||
'variant'
|
||||
) && <span>{row?.ProdVariantName} </span>}
|
||||
{row?.Size}
|
||||
{row?.SinglePc == 'Y' ? 'PCS' : row?.UomName})
|
||||
</p>
|
||||
)}
|
||||
{row?.Type === 'C' &&
|
||||
row.ProdDetail?.map((prod, idx) => (
|
||||
<p key={idx}>
|
||||
{prod.ProdName} - {prod.Size} {prod.UomName}
|
||||
</p>
|
||||
)}
|
||||
{row?.Type === 'C' &&
|
||||
row.ProdDetail?.map((prod, idx) => (
|
||||
<p key={idx}>
|
||||
{prod.ProdName} - {prod.Size} {prod.UomName}
|
||||
</p>
|
||||
))}
|
||||
</td>
|
||||
)}
|
||||
))}
|
||||
</td>
|
||||
)}
|
||||
|
||||
{/* Barcode */}
|
||||
{item.OptionName === 'Barcode' && (
|
||||
|
|
@ -2276,11 +2340,36 @@ const ComboSalesBillTable = () => {
|
|||
{/* Quantity */}
|
||||
{item.OptionName === 'Quantity' && (
|
||||
<td
|
||||
ref={qtyTdRef}
|
||||
key={`qty-${index}`}
|
||||
className="qtyTd"
|
||||
onClick={() => editField && handleEditQuantity(row)}
|
||||
// className="qtyTd"
|
||||
className={
|
||||
EditQtyCombo && row?.localId === Index
|
||||
? 'EditQTYcomboTD'
|
||||
: 'qtyTd'
|
||||
}
|
||||
onClick={() =>
|
||||
editField && handleEditQuantityCombo(row)
|
||||
}
|
||||
// onClick={() => handleEditQTYcombo()}
|
||||
>
|
||||
{row.OrderQty}
|
||||
{(!EditQtyCombo || row?.localId !== Index) && (
|
||||
<>{row.OrderQty}</>
|
||||
)}
|
||||
{EditQtyCombo && row?.localId === Index && (
|
||||
<ComboEditQty
|
||||
key={`edit-qty-${Index}`}
|
||||
handleEditQuantityCancel={
|
||||
handleEditQuantityComboCancel
|
||||
}
|
||||
BSBillingEditQuantity={EditQtyCombo}
|
||||
Productdata={Modaldata}
|
||||
Index={Index}
|
||||
setIndex={setIndex}
|
||||
setEditQtyCombo={setEditQtyCombo}
|
||||
// id={`qty-${index}`}
|
||||
/>
|
||||
)}
|
||||
</td>
|
||||
)}
|
||||
|
||||
|
|
@ -2288,12 +2377,31 @@ const ComboSalesBillTable = () => {
|
|||
{item.OptionName === 'Rate' && (
|
||||
<td
|
||||
key={`rate-${index}`}
|
||||
className="rateTd"
|
||||
onClick={() => editField && handleEditQuantity(row)}
|
||||
// className="rateTd"
|
||||
className={EditRateCombo ? 'rateTdEditRate' : 'rateTd'}
|
||||
// onClick={() => editField && handleEditQuantity(row)}
|
||||
onClick={() => editField && handleEditRateCombo(row)}
|
||||
>
|
||||
{allowDecimal
|
||||
? Number(row?.OrderRate).toFixed(2)
|
||||
: Number(row?.OrderRate)}
|
||||
{!EditRateCombo || row?.localId !== Index ? (
|
||||
<>
|
||||
{allowDecimal
|
||||
? Number(row?.OrderRate).toFixed(2)
|
||||
: Number(row?.OrderRate)}
|
||||
</>
|
||||
) : null}
|
||||
{EditRateCombo && row?.localId === Index && (
|
||||
<ComboEditRate
|
||||
key={`edit-rate-${Index}`}
|
||||
handleEditRateComboCancel={
|
||||
handleEditRateComboCancel
|
||||
}
|
||||
BSBillingEditRate={EditRateCombo}
|
||||
Productdata={Modaldata}
|
||||
Index={Index}
|
||||
setIndex={setIndex}
|
||||
setEditRateCombo={setEditRateCombo}
|
||||
/>
|
||||
)}
|
||||
</td>
|
||||
)}
|
||||
|
||||
|
|
@ -2306,9 +2414,9 @@ const ComboSalesBillTable = () => {
|
|||
>
|
||||
{row?.Offer > 0
|
||||
? `${(
|
||||
(row.Offer / (row?.OrderQty * row?.OrderRate)) *
|
||||
100
|
||||
).toFixed(2)}%`
|
||||
(row.Offer / (row?.OrderQty * row?.OrderRate)) *
|
||||
100
|
||||
).toFixed(2)}%`
|
||||
: '-'}
|
||||
</td>
|
||||
)}
|
||||
|
|
@ -2411,9 +2519,10 @@ const ComboSalesBillTable = () => {
|
|||
BSBillingEditQuantity={EditQuantity}
|
||||
Productdata={Modaldata}
|
||||
Index={Index}
|
||||
setIndex={setIndex}
|
||||
/>
|
||||
)}
|
||||
{(customerPriceHistoryOpen && GetCustId) &&
|
||||
{customerPriceHistoryOpen && GetCustId && (
|
||||
<CustomerPriceHistory
|
||||
open={customerPriceHistoryOpen}
|
||||
custId={GetCustId}
|
||||
|
|
@ -2422,7 +2531,7 @@ const ComboSalesBillTable = () => {
|
|||
setCustomerProduct={setCustomerProduct}
|
||||
selectedCustomer={selectedCustomer}
|
||||
/>
|
||||
}
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');
|
||||
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap");
|
||||
|
||||
.combo-sales-bill-table {
|
||||
width: 100%;
|
||||
font-family: 'Inter', sans-serif;
|
||||
font-family: "Inter", sans-serif;
|
||||
|
||||
.bill-table {
|
||||
width: 100%;
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
border: 1px solid #9c9c9c;
|
||||
font-size: 13px;
|
||||
white-space: nowrap;
|
||||
font-family: 'Poppins', sans-serif !important;
|
||||
font-family: "Poppins", sans-serif !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -102,7 +102,7 @@
|
|||
}
|
||||
.rateTd {
|
||||
width: 90px;
|
||||
text-align: right;
|
||||
text-align: center;
|
||||
}
|
||||
.discPerTh {
|
||||
text-align: center;
|
||||
|
|
@ -119,7 +119,7 @@
|
|||
text-align: right;
|
||||
}
|
||||
.totalTh {
|
||||
text-align: center;
|
||||
text-align: right;
|
||||
width: 170px;
|
||||
}
|
||||
.totalTd {
|
||||
|
|
@ -161,3 +161,31 @@
|
|||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
.EditQTYcomboInput {
|
||||
width: 80px;
|
||||
height: 25px;
|
||||
border: none;
|
||||
outline: none !important;
|
||||
padding: 2px;
|
||||
text-align: center;
|
||||
font-family: "Poppins", sans-serif;
|
||||
font-weight: 500;
|
||||
vertical-align: middle;
|
||||
background-color: #1292ee;
|
||||
color: #fff;
|
||||
border-radius: 4px;
|
||||
|
||||
&::placeholder {
|
||||
color: #bdd4ff;
|
||||
}
|
||||
}
|
||||
|
||||
.EditQTYcomboTD {
|
||||
padding: 1px !important;
|
||||
text-align: center;
|
||||
}
|
||||
.rateTdEditRate {
|
||||
padding: 1px !important;
|
||||
text-align: center;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -243,7 +243,11 @@ import CardPopover from '../BSBillingTables/StandardTable/Utils/CardPopover.jsx'
|
|||
import UpiPopover from '../BSBillingTables/StandardTable/Utils/UpiPopOver.jsx';
|
||||
import { useDateStore } from '../../../../Features/BookingScreen/BookingData/DateStore.js';
|
||||
import { getPaymentOptionsData } from '../../../../Features/BookingScreen/BookingData/KioskBookingData.js';
|
||||
import { GlobalFreeProdList, GlobalOfferAppliedProducts, GlobalOverAllOfferAmt } from '../../../../Features/Offer/Offernew/BookingOffernew.js';
|
||||
import {
|
||||
GlobalFreeProdList,
|
||||
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';
|
||||
|
|
@ -266,7 +270,9 @@ const BSC1Payment = (props) => {
|
|||
const navigate = useNavigate();
|
||||
const salesBillEdit = useSelector(GlobalSalesBillEdit);
|
||||
const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
|
||||
const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails);
|
||||
const previousOrderOfferDetails = useSelector(
|
||||
GlobalPreviousOrderOfferDetails
|
||||
);
|
||||
const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
|
||||
const SessionData = useSelector(StoredSessionData);
|
||||
const BranchFinancialStatus = useSelector(GlobalBranchFinancialStatus);
|
||||
|
|
@ -349,11 +355,15 @@ const BSC1Payment = (props) => {
|
|||
(preference) => preference?.PreferredCatName === 'Common Module'
|
||||
)?.PreferenceCatDetails;
|
||||
const sportsAppPreference = commonModulePreference?.find(
|
||||
(preference) => preference?.PreferredSubCatName === 'SportsApp'
|
||||
&&
|
||||
(preference) =>
|
||||
preference?.PreferredSubCatName === 'SportsApp' &&
|
||||
preference?.PreferredStatus == 'Y'
|
||||
);
|
||||
console.log(sportsAppPreference,commonModulePreference,"sportsAppPreference")
|
||||
console.log(
|
||||
sportsAppPreference,
|
||||
commonModulePreference,
|
||||
'sportsAppPreference'
|
||||
);
|
||||
const bookingTypePreference = appPreferences?.find(
|
||||
(preference) => preference?.PreferredCatName === 'Booking Type'
|
||||
)?.PreferenceCatDetails;
|
||||
|
|
@ -683,7 +693,6 @@ const BSC1Payment = (props) => {
|
|||
}, [salesBillEdit]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
if (salesBillEdit) {
|
||||
if (SelCustId) {
|
||||
setRefundPayBtns(AllPaymentOptions);
|
||||
|
|
@ -698,8 +707,7 @@ const BSC1Payment = (props) => {
|
|||
setRefundPayBtns(withoutCustomer);
|
||||
}
|
||||
}
|
||||
|
||||
}, [AllPaymentOptions, SelCustId, salesBillEdit])
|
||||
}, [AllPaymentOptions, SelCustId, salesBillEdit]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!preOrder) {
|
||||
|
|
@ -760,14 +768,21 @@ const BSC1Payment = (props) => {
|
|||
|
||||
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
|
||||
);
|
||||
|
||||
|
|
@ -776,23 +791,38 @@ const BSC1Payment = (props) => {
|
|||
0
|
||||
);
|
||||
|
||||
const previousNetAmount =
|
||||
(totalPreviouspayment) || 0;
|
||||
const previousNetAmount = totalPreviouspayment || 0;
|
||||
|
||||
let withdiscTotal =
|
||||
Total - ((OverAllSales || 0) + (OverAllEstimate || 0) +
|
||||
Total -
|
||||
((OverAllSales || 0) +
|
||||
(OverAllEstimate || 0) +
|
||||
(Discount > 0 ? Discount : 0));
|
||||
|
||||
const currentOrderNetAmount = formatAmount(
|
||||
withdiscTotal >= 0
|
||||
? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2)
|
||||
: (Number(Total) + Number(globalTipAmount)).toFixed(2)
|
||||
)
|
||||
);
|
||||
|
||||
setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount);
|
||||
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));
|
||||
|
||||
|
|
@ -812,7 +842,7 @@ const BSC1Payment = (props) => {
|
|||
OverAllEstimate,
|
||||
globalTipAmount,
|
||||
OtherServiceTicketClaim,
|
||||
Discount
|
||||
Discount,
|
||||
]);
|
||||
useEffect(() => {
|
||||
let data = {
|
||||
|
|
@ -1233,7 +1263,11 @@ const BSC1Payment = (props) => {
|
|||
const handleButtonClick = () => {
|
||||
if (qrCode && SelectedUPIPayOption === 'Default') {
|
||||
UpiPayment();
|
||||
} else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) {
|
||||
} else if (
|
||||
salesBillEdit &&
|
||||
currentOrderNetAmount < previousNetAmount &&
|
||||
!refundPaySelected
|
||||
) {
|
||||
setMessageType('warning');
|
||||
setMessageData('Please Select Refund Payment Method');
|
||||
return;
|
||||
|
|
@ -1425,7 +1459,7 @@ const BSC1Payment = (props) => {
|
|||
const handleRefundPaymentMode = (id, name) => {
|
||||
setRefundPaySelected(id);
|
||||
setRefundPaySelectedName(name);
|
||||
}
|
||||
};
|
||||
|
||||
const AddCardOption = (data) => {
|
||||
setSelectedCardOption(data);
|
||||
|
|
@ -1774,7 +1808,7 @@ const BSC1Payment = (props) => {
|
|||
|
||||
const selectedStyle =
|
||||
stylesMap[
|
||||
printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle
|
||||
printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle
|
||||
];
|
||||
|
||||
if (selectedStyle) {
|
||||
|
|
@ -2171,15 +2205,15 @@ const BSC1Payment = (props) => {
|
|||
OrderStatus: 'O',
|
||||
OrderType:
|
||||
BookingType === 'Dine In' ||
|
||||
BookingTypeBoth ||
|
||||
Estimation?.SettingValue == 'N'
|
||||
BookingTypeBoth ||
|
||||
Estimation?.SettingValue == 'N'
|
||||
? 'S'
|
||||
: GlobEstBooking === 'OvrAllEst'
|
||||
? 'E'
|
||||
: GlobEstBooking === 'ParEst'
|
||||
? GlobProdwisedata?.includes(
|
||||
a.InwardDtlId + ' ' + a?.BookingTypeName
|
||||
)
|
||||
a.InwardDtlId + ' ' + a?.BookingTypeName
|
||||
)
|
||||
? 'E'
|
||||
: 'S'
|
||||
: 'S',
|
||||
|
|
@ -2263,7 +2297,7 @@ const BSC1Payment = (props) => {
|
|||
: Paybtnnameselected?.toLowerCase() === 'credit'
|
||||
? 'S'
|
||||
: Paybtnnameselected?.toLowerCase() === 'upi' &&
|
||||
SelectedUPIPayOption?.toLowerCase() === 'default'
|
||||
SelectedUPIPayOption?.toLowerCase() === 'default'
|
||||
? 'S'
|
||||
: 'P',
|
||||
OrderDtlDetails:
|
||||
|
|
@ -2280,87 +2314,115 @@ const BSC1Payment = (props) => {
|
|||
? globalTipAmount === 0
|
||||
? SelectedTableDetails
|
||||
: SelectedTableDetails?.map((item) => ({
|
||||
...item,
|
||||
TipsAmount: globalTipAmount,
|
||||
}))
|
||||
...item,
|
||||
TipsAmount: globalTipAmount,
|
||||
}))
|
||||
: null,
|
||||
// "Credit": TotalAmount,
|
||||
// "Debit": 0,
|
||||
SalesPaymentType: 'normal',
|
||||
PaymentDetail: [
|
||||
{
|
||||
PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected :
|
||||
Paybtnnameselected?.toLowerCase() === 'upi'
|
||||
? SelectedUPIPayOption?.toLowerCase() === 'pd'
|
||||
? PaymentDeviceUPI?.[0]?.ModeId
|
||||
: SelectedUPIPayOption?.toLowerCase() === 'pg'
|
||||
? PaymentgatewayUPI?.[0]?.ModeId
|
||||
: SelectedUPIPayOption?.toLowerCase() === 'business'
|
||||
? BusinessPayOption?.find(
|
||||
(busupi) => busupi?.ModeId === UpiId
|
||||
)?.ModeId
|
||||
: paybtnselected
|
||||
: paybtnselected
|
||||
? paybtnselected
|
||||
: null,
|
||||
Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount),
|
||||
MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null :
|
||||
Paybtnnameselected?.toLowerCase() === 'upi' &&
|
||||
SelectedUPIPayOption?.toLowerCase() === 'business'
|
||||
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
|
||||
?.MerchantId
|
||||
: null,
|
||||
PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' :
|
||||
Paybtnnameselected?.toLowerCase() === 'cash'
|
||||
? 'PC'
|
||||
: Paybtnnameselected?.toLowerCase() === 'credit'
|
||||
? 'PC'
|
||||
: Paybtnnameselected?.toLowerCase() === 'card'
|
||||
? SelectedCardOption
|
||||
: Paybtnnameselected?.toLowerCase() === 'upi'
|
||||
? SelectedUPIPayOption?.toLowerCase() === 'default'
|
||||
? 'PC'
|
||||
: SelectedUPIPayOption?.toLowerCase() === 'business'
|
||||
? 'BU'
|
||||
: SelectedUPIPayOption
|
||||
: null,
|
||||
ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null :
|
||||
SelectedUPIPayOption?.toLowerCase() === 'default'
|
||||
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
|
||||
?.UPIDetailId
|
||||
: SelectedUPIPayOption?.toLowerCase() === 'business'
|
||||
PaymentType:
|
||||
salesBillEdit && currentOrderNetAmount < previousNetAmount
|
||||
? refundPaySelected
|
||||
: Paybtnnameselected?.toLowerCase() === 'upi'
|
||||
? SelectedUPIPayOption?.toLowerCase() === 'pd'
|
||||
? PaymentDeviceUPI?.[0]?.ModeId
|
||||
: SelectedUPIPayOption?.toLowerCase() === 'pg'
|
||||
? PaymentgatewayUPI?.[0]?.ModeId
|
||||
: SelectedUPIPayOption?.toLowerCase() === 'business'
|
||||
? BusinessPayOption?.find(
|
||||
(busupi) => busupi?.ModeId === UpiId
|
||||
)?.ModeId
|
||||
: paybtnselected
|
||||
: paybtnselected
|
||||
? paybtnselected
|
||||
: null,
|
||||
Amount:
|
||||
salesBillEdit && currentOrderNetAmount < previousNetAmount
|
||||
? previousNetAmount - currentOrderNetAmount
|
||||
: Math.round(TotalAmount),
|
||||
MerchantId:
|
||||
salesBillEdit && currentOrderNetAmount < previousNetAmount
|
||||
? null
|
||||
: Paybtnnameselected?.toLowerCase() === 'upi' &&
|
||||
SelectedUPIPayOption?.toLowerCase() === 'business'
|
||||
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
|
||||
?.MerchantUPIId
|
||||
?.MerchantId
|
||||
: null,
|
||||
AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] :
|
||||
Paybtnnameselected?.toLowerCase() === 'upi' &&
|
||||
SelectedUPIPayOption?.toLowerCase() === 'default'
|
||||
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
|
||||
(upipay) => upipay?.UPIId === UpiId
|
||||
)
|
||||
: (Paybtnnameselected?.toLowerCase() === 'upi' &&
|
||||
SelectedUPIPayOption?.toLowerCase() === 'pd') ||
|
||||
(Paybtnnameselected?.toLowerCase() === 'card' &&
|
||||
SelectedCardOption?.toLowerCase() === 'pd')
|
||||
? useOptions?.[0]?.PaymentDetails?.PaymentDevice
|
||||
: (Paybtnnameselected?.toLowerCase() === 'upi' &&
|
||||
SelectedUPIPayOption?.toLowerCase() === 'pg') ||
|
||||
(Paybtnnameselected?.toLowerCase() === 'card' &&
|
||||
SelectedCardOption?.toLowerCase() === 'pg')
|
||||
? useOptions?.[0]?.PaymentDetails?.PaymentGateway
|
||||
: [],
|
||||
PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' :
|
||||
Paybtnnameselected?.toLowerCase() === 'cash'
|
||||
? 'S'
|
||||
: Paybtnnameselected?.toLowerCase() === 'credit'
|
||||
? 'S'
|
||||
: Paybtnnameselected?.toLowerCase() === 'upi' &&
|
||||
PaymentOptionType:
|
||||
salesBillEdit &&
|
||||
currentOrderNetAmount < previousNetAmount &&
|
||||
(refundPaySelectedName?.toLowerCase() === 'cash' ||
|
||||
refundPaySelectedName?.toLowerCase() === 'credit')
|
||||
? 'PC'
|
||||
: Paybtnnameselected?.toLowerCase() === 'cash'
|
||||
? 'PC'
|
||||
: Paybtnnameselected?.toLowerCase() === 'credit'
|
||||
? 'PC'
|
||||
: Paybtnnameselected?.toLowerCase() === 'card'
|
||||
? SelectedCardOption
|
||||
: Paybtnnameselected?.toLowerCase() === 'upi'
|
||||
? SelectedUPIPayOption?.toLowerCase() === 'default'
|
||||
? 'PC'
|
||||
: SelectedUPIPayOption?.toLowerCase() === 'business'
|
||||
? 'BU'
|
||||
: SelectedUPIPayOption
|
||||
: null,
|
||||
ModeOfPayment:
|
||||
salesBillEdit && currentOrderNetAmount < previousNetAmount
|
||||
? null
|
||||
: SelectedUPIPayOption?.toLowerCase() === 'default'
|
||||
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
|
||||
?.UPIDetailId
|
||||
: SelectedUPIPayOption?.toLowerCase() === 'business'
|
||||
? BusinessPayOption?.find(
|
||||
(busupi) => busupi?.ModeId === UpiId
|
||||
)?.MerchantUPIId
|
||||
: null,
|
||||
AccountDtl:
|
||||
salesBillEdit && currentOrderNetAmount < previousNetAmount
|
||||
? []
|
||||
: Paybtnnameselected?.toLowerCase() === 'upi' &&
|
||||
SelectedUPIPayOption?.toLowerCase() === 'default'
|
||||
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
|
||||
(upipay) => upipay?.UPIId === UpiId
|
||||
)
|
||||
: (Paybtnnameselected?.toLowerCase() === 'upi' &&
|
||||
SelectedUPIPayOption?.toLowerCase() === 'pd') ||
|
||||
(Paybtnnameselected?.toLowerCase() === 'card' &&
|
||||
SelectedCardOption?.toLowerCase() === 'pd')
|
||||
? useOptions?.[0]?.PaymentDetails?.PaymentDevice
|
||||
: (Paybtnnameselected?.toLowerCase() === 'upi' &&
|
||||
SelectedUPIPayOption?.toLowerCase() === 'pg') ||
|
||||
(Paybtnnameselected?.toLowerCase() === 'card' &&
|
||||
SelectedCardOption?.toLowerCase() === 'pg')
|
||||
? useOptions?.[0]?.PaymentDetails?.PaymentGateway
|
||||
: [],
|
||||
PaymentStatus:
|
||||
salesBillEdit && currentOrderNetAmount < previousNetAmount
|
||||
? 'S'
|
||||
: Paybtnnameselected?.toLowerCase() === 'cash'
|
||||
? 'S'
|
||||
: Paybtnnameselected?.toLowerCase() === 'credit'
|
||||
? 'S'
|
||||
: 'P',
|
||||
Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0,
|
||||
Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 :
|
||||
Paybtnnameselected?.toLowerCase() === 'credit'
|
||||
: Paybtnnameselected?.toLowerCase() === 'upi' &&
|
||||
SelectedUPIPayOption?.toLowerCase() === 'default'
|
||||
? 'S'
|
||||
: 'P',
|
||||
Debit:
|
||||
salesBillEdit &&
|
||||
currentOrderNetAmount < previousNetAmount &&
|
||||
refundPaySelectedName?.toLowerCase() === 'credit'
|
||||
? Math.round(previousNetAmount - currentOrderNetAmount)
|
||||
: 0,
|
||||
Credit: salesBillEdit
|
||||
? currentOrderNetAmount > previousNetAmount &&
|
||||
refundPaySelectedName?.toLowerCase() === 'credit'
|
||||
? Math.round(TotalAmount)
|
||||
: 0
|
||||
: Paybtnnameselected?.toLowerCase() === 'credit'
|
||||
? Math.round(TotalAmount)
|
||||
: 0,
|
||||
},
|
||||
|
|
@ -2425,14 +2487,14 @@ const BSC1Payment = (props) => {
|
|||
setMessageType('success');
|
||||
setMessageData(
|
||||
response?.data?.response +
|
||||
' ' +
|
||||
(response?.data?.OrderDetails?.length > 0
|
||||
? response?.data?.OrderId &&
|
||||
extractLastNumberOrderId(
|
||||
response?.data?.OrderId,
|
||||
response?.data?.OrderDetails?.[0]?.FYStatus
|
||||
)
|
||||
: '')
|
||||
' ' +
|
||||
(response?.data?.OrderDetails?.length > 0
|
||||
? response?.data?.OrderId &&
|
||||
extractLastNumberOrderId(
|
||||
response?.data?.OrderId,
|
||||
response?.data?.OrderDetails?.[0]?.FYStatus
|
||||
)
|
||||
: '')
|
||||
);
|
||||
response?.data?.OrderDetails?.length > 0 &&
|
||||
setPrintOrderDetails([response?.data]);
|
||||
|
|
@ -2583,20 +2645,21 @@ const BSC1Payment = (props) => {
|
|||
item?.PaymentStatus === 'P'
|
||||
);
|
||||
|
||||
if (PayatCounterfilter?.length === 1 ||
|
||||
if (
|
||||
PayatCounterfilter?.length === 1 ||
|
||||
response?.data?.PaymentOrderDtl?.length === 0
|
||||
) {
|
||||
setMessageType('success');
|
||||
setMessageData(
|
||||
response?.data?.response +
|
||||
' ' +
|
||||
(response?.data?.OrderDetails?.length > 0
|
||||
? response?.data?.OrderId &&
|
||||
extractLastNumberOrderId(
|
||||
response?.data?.OrderId,
|
||||
response?.data?.OrderDetails?.[0]?.FYStatus
|
||||
)
|
||||
: '')
|
||||
' ' +
|
||||
(response?.data?.OrderDetails?.length > 0
|
||||
? response?.data?.OrderId &&
|
||||
extractLastNumberOrderId(
|
||||
response?.data?.OrderId,
|
||||
response?.data?.OrderDetails?.[0]?.FYStatus
|
||||
)
|
||||
: '')
|
||||
);
|
||||
response?.data?.OrderDetails?.length > 0 &&
|
||||
setPrintOrderDetails([response?.data]);
|
||||
|
|
@ -2700,14 +2763,14 @@ const BSC1Payment = (props) => {
|
|||
}
|
||||
setMessageData(
|
||||
response?.data?.response +
|
||||
' ' +
|
||||
(response?.data?.OrderDetails?.length > 0
|
||||
? response?.data?.OrderId &&
|
||||
extractLastNumberOrderId(
|
||||
response?.data?.OrderId,
|
||||
response?.data?.OrderDetails?.[0]?.FYStatus
|
||||
)
|
||||
: '')
|
||||
' ' +
|
||||
(response?.data?.OrderDetails?.length > 0
|
||||
? response?.data?.OrderId &&
|
||||
extractLastNumberOrderId(
|
||||
response?.data?.OrderId,
|
||||
response?.data?.OrderDetails?.[0]?.FYStatus
|
||||
)
|
||||
: '')
|
||||
);
|
||||
if (response?.data?.OrderDetails?.length > 0) {
|
||||
setPrintOrderDetails([response?.data]);
|
||||
|
|
@ -2804,14 +2867,14 @@ const BSC1Payment = (props) => {
|
|||
setMessageType('success');
|
||||
setMessageData(
|
||||
bookingpaymentupdate?.data?.response +
|
||||
' ' +
|
||||
(bookingpaymentupdate?.data?.OrderDetails?.length > 0
|
||||
? bookingpaymentupdate?.data?.OrderId &&
|
||||
extractLastNumberOrderId(
|
||||
bookingpaymentupdate?.data?.OrderId,
|
||||
bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus
|
||||
)
|
||||
: '')
|
||||
' ' +
|
||||
(bookingpaymentupdate?.data?.OrderDetails?.length > 0
|
||||
? bookingpaymentupdate?.data?.OrderId &&
|
||||
extractLastNumberOrderId(
|
||||
bookingpaymentupdate?.data?.OrderId,
|
||||
bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus
|
||||
)
|
||||
: '')
|
||||
);
|
||||
bookingpaymentupdate?.data?.OrderDetails?.length > 0 &&
|
||||
setPrintOrderDetails([bookingpaymentupdate?.data]);
|
||||
|
|
@ -2829,7 +2892,7 @@ const BSC1Payment = (props) => {
|
|||
if (
|
||||
Date.now() - startTime >
|
||||
useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes *
|
||||
60000
|
||||
60000
|
||||
) {
|
||||
// 60,000 ms = 1 minute
|
||||
|
||||
|
|
@ -3848,30 +3911,31 @@ const BSC1Payment = (props) => {
|
|||
(BookingType === 'Dine In' ||
|
||||
BookingTypeBoth ||
|
||||
CheckOrderType?.length > 0) &&
|
||||
!unpaidFlow &&
|
||||
OrderStatus
|
||||
!unpaidFlow &&
|
||||
OrderStatus
|
||||
? 'none'
|
||||
: 'auto',
|
||||
opacity:
|
||||
(BookingType === 'Dine In' ||
|
||||
BookingTypeBoth ||
|
||||
CheckOrderType?.length > 0) &&
|
||||
!unpaidFlow &&
|
||||
OrderStatus
|
||||
!unpaidFlow &&
|
||||
OrderStatus
|
||||
? 0.5
|
||||
: 1,
|
||||
}}
|
||||
>
|
||||
{paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? (
|
||||
{paybtns?.length > 0 &&
|
||||
currentOrderNetAmount >= previousNetAmount ? (
|
||||
paybtns?.map((payment) => (
|
||||
<div className="Table3-cash">
|
||||
<button
|
||||
className={
|
||||
paybtnselected === payment.ModeId &&
|
||||
(UpinotSelected || CardoptionnotSelected)
|
||||
(UpinotSelected || CardoptionnotSelected)
|
||||
? 'Btn-payment-mode-notupisel'
|
||||
: paybtnselected === payment.ModeId &&
|
||||
(!UpinotSelected || !CardoptionnotSelected)
|
||||
(!UpinotSelected || !CardoptionnotSelected)
|
||||
? 'Btn-payment-mode'
|
||||
: 'Btn-payment-mode-sel'
|
||||
}
|
||||
|
|
@ -3936,16 +4000,18 @@ const BSC1Payment = (props) => {
|
|||
</button>
|
||||
</div>
|
||||
))
|
||||
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? (
|
||||
) : currentOrderNetAmount < previousNetAmount &&
|
||||
salesBillEdit &&
|
||||
refundPayBtns.length > 0 ? (
|
||||
refundPayBtns.map((payment) => (
|
||||
<div className="Table3-cash">
|
||||
<button
|
||||
className={
|
||||
refundPaySelected === payment.ConfigId &&
|
||||
(UpinotSelected || CardoptionnotSelected)
|
||||
(UpinotSelected || CardoptionnotSelected)
|
||||
? 'Btn-payment-mode-notupisel'
|
||||
: refundPaySelected === payment.ConfigId &&
|
||||
(!UpinotSelected || !CardoptionnotSelected)
|
||||
(!UpinotSelected || !CardoptionnotSelected)
|
||||
? 'Btn-payment-mode'
|
||||
: 'Btn-payment-mode-sel'
|
||||
}
|
||||
|
|
@ -3955,7 +4021,12 @@ const BSC1Payment = (props) => {
|
|||
? '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>} */}
|
||||
|
||||
|
|
@ -3988,16 +4059,16 @@ const BSC1Payment = (props) => {
|
|||
(BookingType === 'Dine In' ||
|
||||
BookingTypeBoth ||
|
||||
CheckOrderType?.length > 0) &&
|
||||
!unpaidFlow &&
|
||||
OrderStatus
|
||||
!unpaidFlow &&
|
||||
OrderStatus
|
||||
? 'none'
|
||||
: 'auto',
|
||||
opacity:
|
||||
(BookingType === 'Dine In' ||
|
||||
BookingTypeBoth ||
|
||||
CheckOrderType?.length > 0) &&
|
||||
!unpaidFlow &&
|
||||
OrderStatus
|
||||
!unpaidFlow &&
|
||||
OrderStatus
|
||||
? 0.5
|
||||
: 1,
|
||||
}}
|
||||
|
|
@ -4017,14 +4088,14 @@ const BSC1Payment = (props) => {
|
|||
style={{
|
||||
cursor:
|
||||
OrderCardDetail?.length === 0 ||
|
||||
CheckBookingStatus == 'Close' ||
|
||||
addnewAccess
|
||||
CheckBookingStatus == 'Close' ||
|
||||
addnewAccess
|
||||
? 'not-allowed'
|
||||
: 'pointer',
|
||||
color:
|
||||
OrderCardDetail?.length === 0 ||
|
||||
CheckBookingStatus == 'Close' ||
|
||||
addnewAccess
|
||||
CheckBookingStatus == 'Close' ||
|
||||
addnewAccess
|
||||
? '#fff'
|
||||
: '#ffffffff',
|
||||
alignItems: 'center',
|
||||
|
|
@ -4087,6 +4158,17 @@ const BSC1Payment = (props) => {
|
|||
<div style={{ width: '4px' }}> : </div>
|
||||
<div style={{ textAlign: 'right', width: '1rem' }}> {Qty} </div>
|
||||
</div>
|
||||
<div
|
||||
style={{ display: 'flex', alignItems: 'center' }}
|
||||
className="BSC1Payment-div4-naming"
|
||||
>
|
||||
<div style={{ width: '3rem' }}>Dis </div>
|
||||
<div style={{ width: '4px' }}> : </div>
|
||||
<div style={{ textAlign: 'right', width: '1rem' }}>
|
||||
{' '}
|
||||
{Discount}{' '}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -4120,61 +4202,19 @@ const BSC1Payment = (props) => {
|
|||
{/* {item?.OptionName=="Hold" && */}
|
||||
{unpaidFlow == false
|
||||
? item?.OptionName == 'Hold' &&
|
||||
BookingType !== 'Dine In' &&
|
||||
!BookingTypeBoth &&
|
||||
OrderCardDetail?.length != 0 &&
|
||||
CheckOrderType?.length === 0 &&
|
||||
OrderType != 'Failed' &&
|
||||
CheckBookingStatus != 'Close' &&
|
||||
!addnewAccess && (
|
||||
<TooltipWrapper title={'Hold'} isMobile={isMobile}>
|
||||
{' '}
|
||||
<div
|
||||
style={{
|
||||
backgroundColor: '' ? '#52c41a' : '#1292EE',
|
||||
color: '' ? '#52c41a' : '#ffffffff',
|
||||
height: '40px',
|
||||
width: '45px',
|
||||
borderRadius: '6px',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
padding: '8px 8px 12px 8px',
|
||||
}}
|
||||
>
|
||||
<PozoHoldIcon
|
||||
className="BSBillingNav-icon-table-icon"
|
||||
onClick={() => AddBookingDetails('Hold')}
|
||||
style={{
|
||||
cursor: 'pointer',
|
||||
// color: '' ? '#52c41a' : '#1292EE',
|
||||
}}
|
||||
/>{' '}
|
||||
{/* <p className="payOptionDecition"> Hold</p> */}
|
||||
</div>
|
||||
</TooltipWrapper>
|
||||
)
|
||||
: ''}
|
||||
|
||||
{unpaidFlow == false
|
||||
? item?.OptionName == 'Hold' &&
|
||||
BookingType !== 'Dine In' &&
|
||||
!BookingTypeBoth &&
|
||||
Holddata?.length > 0 &&
|
||||
OrderCardDetail?.length == 0 &&
|
||||
CheckBookingStatus != 'Close' &&
|
||||
!addnewAccess && (
|
||||
<TooltipWrapper title={'Recall'} isMobile={isMobile}>
|
||||
{' '}
|
||||
<Badge
|
||||
count={Holddata?.length}
|
||||
size={'small'}
|
||||
offset={[0, 7]}
|
||||
>
|
||||
BookingType !== 'Dine In' &&
|
||||
!BookingTypeBoth &&
|
||||
OrderCardDetail?.length != 0 &&
|
||||
CheckOrderType?.length === 0 &&
|
||||
OrderType != 'Failed' &&
|
||||
CheckBookingStatus != 'Close' &&
|
||||
!addnewAccess && (
|
||||
<TooltipWrapper title={'Hold'} isMobile={isMobile}>
|
||||
{' '}
|
||||
<div
|
||||
style={{
|
||||
backgroundColor: Holddata ? '#52c41a' : 'default',
|
||||
color: Holddata ? '#ffffffff' : 'default',
|
||||
backgroundColor: '' ? '#52c41a' : '#1292EE',
|
||||
color: '' ? '#52c41a' : '#ffffffff',
|
||||
height: '40px',
|
||||
width: '45px',
|
||||
borderRadius: '6px',
|
||||
|
|
@ -4186,18 +4226,60 @@ const BSC1Payment = (props) => {
|
|||
>
|
||||
<PozoHoldIcon
|
||||
className="BSBillingNav-icon-table-icon"
|
||||
onClick={() => HandleholdModelOpen()}
|
||||
onClick={() => AddBookingDetails('Hold')}
|
||||
style={{
|
||||
cursor: 'pointer',
|
||||
// color: Holddata ? '#52c41a' : 'default',
|
||||
pointerEvents:
|
||||
OrderType === 'Failed' ? 'none' : 'auto',
|
||||
// color: '' ? '#52c41a' : '#1292EE',
|
||||
}}
|
||||
/>
|
||||
/>{' '}
|
||||
{/* <p className="payOptionDecition"> Hold</p> */}
|
||||
</div>
|
||||
</Badge>
|
||||
</TooltipWrapper>
|
||||
)
|
||||
</TooltipWrapper>
|
||||
)
|
||||
: ''}
|
||||
|
||||
{unpaidFlow == false
|
||||
? item?.OptionName == 'Hold' &&
|
||||
BookingType !== 'Dine In' &&
|
||||
!BookingTypeBoth &&
|
||||
Holddata?.length > 0 &&
|
||||
OrderCardDetail?.length == 0 &&
|
||||
CheckBookingStatus != 'Close' &&
|
||||
!addnewAccess && (
|
||||
<TooltipWrapper title={'Recall'} isMobile={isMobile}>
|
||||
{' '}
|
||||
<Badge
|
||||
count={Holddata?.length}
|
||||
size={'small'}
|
||||
offset={[0, 7]}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
backgroundColor: Holddata ? '#52c41a' : 'default',
|
||||
color: Holddata ? '#ffffffff' : 'default',
|
||||
height: '40px',
|
||||
width: '45px',
|
||||
borderRadius: '6px',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
padding: '8px 8px 12px 8px',
|
||||
}}
|
||||
>
|
||||
<PozoHoldIcon
|
||||
className="BSBillingNav-icon-table-icon"
|
||||
onClick={() => HandleholdModelOpen()}
|
||||
style={{
|
||||
cursor: 'pointer',
|
||||
// color: Holddata ? '#52c41a' : 'default',
|
||||
pointerEvents:
|
||||
OrderType === 'Failed' ? 'none' : 'auto',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Badge>
|
||||
</TooltipWrapper>
|
||||
)
|
||||
: ''}
|
||||
{tabledata?.length > 0 && dinePreference && (
|
||||
<>
|
||||
|
|
@ -4266,9 +4348,9 @@ const BSC1Payment = (props) => {
|
|||
style={{
|
||||
backgroundColor:
|
||||
OrderCardDetail?.length > 0 ||
|
||||
(selOption?.value === undefined &&
|
||||
GlobalAddCustomerDetails1?.length === 0 &&
|
||||
GetCustId?.CustMobile === undefined)
|
||||
(selOption?.value === undefined &&
|
||||
GlobalAddCustomerDetails1?.length === 0 &&
|
||||
GetCustId?.CustMobile === undefined)
|
||||
? 'gray'
|
||||
: '#1292eeff',
|
||||
color: '#fff',
|
||||
|
|
@ -4311,36 +4393,36 @@ const BSC1Payment = (props) => {
|
|||
{FeatureAddonData?.FeatureDtls?.find(
|
||||
(item) => item?.FeatureAddonName?.toLowerCase() === 'preorder'
|
||||
) && (
|
||||
<>
|
||||
{
|
||||
<div
|
||||
style={{
|
||||
pointerEvents:
|
||||
OrderCardDetail?.length > 0 || OrderType === 'Failed'
|
||||
? 'none'
|
||||
: 'auto',
|
||||
opacity: OrderCardDetail?.length > 0 ? 0.5 : 1,
|
||||
}}
|
||||
>
|
||||
<TooltipWrapper title={'Pre Order'} isMobile={isMobile}>
|
||||
<Badge
|
||||
count={preOrderPendingCount}
|
||||
offset={[-5, 10]}
|
||||
size="small"
|
||||
>
|
||||
<PozoPreOrderIcon
|
||||
className="BSBillingNav-icon"
|
||||
fill={preOrderOpen ? '#52C41A' : '#1292EE'}
|
||||
onClick={() => {
|
||||
openPreOrder();
|
||||
}}
|
||||
/>
|
||||
</Badge>
|
||||
</TooltipWrapper>
|
||||
</div>
|
||||
}
|
||||
</>
|
||||
)}
|
||||
<>
|
||||
{
|
||||
<div
|
||||
style={{
|
||||
pointerEvents:
|
||||
OrderCardDetail?.length > 0 || OrderType === 'Failed'
|
||||
? 'none'
|
||||
: 'auto',
|
||||
opacity: OrderCardDetail?.length > 0 ? 0.5 : 1,
|
||||
}}
|
||||
>
|
||||
<TooltipWrapper title={'Pre Order'} isMobile={isMobile}>
|
||||
<Badge
|
||||
count={preOrderPendingCount}
|
||||
offset={[-5, 10]}
|
||||
size="small"
|
||||
>
|
||||
<PozoPreOrderIcon
|
||||
className="BSBillingNav-icon"
|
||||
fill={preOrderOpen ? '#52C41A' : '#1292EE'}
|
||||
onClick={() => {
|
||||
openPreOrder();
|
||||
}}
|
||||
/>
|
||||
</Badge>
|
||||
</TooltipWrapper>
|
||||
</div>
|
||||
}
|
||||
</>
|
||||
)}
|
||||
{preOrderOpen && <BSNavBarPreOrder />}
|
||||
{sportsAppPreference && <BSMembership />}
|
||||
{dinePreference &&
|
||||
|
|
@ -4498,12 +4580,14 @@ const BSC1Payment = (props) => {
|
|||
addnewAccess
|
||||
? 'BSC1Payment-div4-button-disable'
|
||||
: FirstPaymentclick === false &&
|
||||
OrderCardDetail?.length > 0 &&
|
||||
paybtnselected &&
|
||||
CheckBookingStatus != 'Close'
|
||||
? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
|
||||
'BSC1Payment-div4-button'
|
||||
: 'BSC1Payment-div4-button'
|
||||
OrderCardDetail?.length > 0 &&
|
||||
paybtnselected &&
|
||||
CheckBookingStatus != 'Close'
|
||||
? !OrderStatus
|
||||
? salesBillEdit &&
|
||||
currentOrderNetAmount < previousNetAmount
|
||||
? 'BSC1Payment-div4-button'
|
||||
: 'BSC1Payment-div4-button'
|
||||
: 'BSC1Payment-div4-button Order'
|
||||
: 'BSC1Payment-div4-button-disable'
|
||||
}
|
||||
|
|
@ -4513,34 +4597,41 @@ const BSC1Payment = (props) => {
|
|||
onClick={handleButtonClick}
|
||||
style={{ borderRadius: '6px 0 0 6px' }}
|
||||
>
|
||||
{!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? <div className="Table4-Order">Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</div> : (
|
||||
<>
|
||||
{isMobile ? (
|
||||
`₹ ${safeRound(
|
||||
OrderType === 'Failed'
|
||||
? FailedTotalAmt
|
||||
: credit && overAllBal >= 0
|
||||
? Math.max(0, TotalAmount - overAllBal)
|
||||
: TotalAmount
|
||||
)}`
|
||||
) : (
|
||||
<div>
|
||||
₹
|
||||
<CountUp
|
||||
duration={0.4}
|
||||
className="counter"
|
||||
end={safeRound(
|
||||
OrderType === 'Failed'
|
||||
? FailedTotalAmt
|
||||
: credit && overAllBal >= 0
|
||||
? Math.max(0, TotalAmount - overAllBal)
|
||||
: TotalAmount
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<AiOutlineArrowRight width="25px" height="25px" />
|
||||
</>
|
||||
{!OrderStatus ? (
|
||||
salesBillEdit && currentOrderNetAmount < previousNetAmount ? (
|
||||
<div className="Table4-Order">
|
||||
Refund: ₹
|
||||
{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
{isMobile ? (
|
||||
`₹ ${safeRound(
|
||||
OrderType === 'Failed'
|
||||
? FailedTotalAmt
|
||||
: credit && overAllBal >= 0
|
||||
? Math.max(0, TotalAmount - overAllBal)
|
||||
: TotalAmount
|
||||
)}`
|
||||
) : (
|
||||
<div>
|
||||
₹
|
||||
<CountUp
|
||||
duration={0.4}
|
||||
className="counter"
|
||||
end={safeRound(
|
||||
OrderType === 'Failed'
|
||||
? FailedTotalAmt
|
||||
: credit && overAllBal >= 0
|
||||
? Math.max(0, TotalAmount - overAllBal)
|
||||
: TotalAmount
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<AiOutlineArrowRight width="25px" height="25px" />
|
||||
</>
|
||||
)
|
||||
) : (
|
||||
<div className="Table4-Order">ORDER</div>
|
||||
)}
|
||||
|
|
@ -4730,8 +4821,8 @@ const BSC1Payment = (props) => {
|
|||
columns={columns}
|
||||
data={TableData}
|
||||
dataSource={TableData}
|
||||
// pagination={handlePageChange}
|
||||
// onChange={handleChange}
|
||||
// pagination={handlePageChange}
|
||||
// onChange={handleChange}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
|
|
@ -4762,10 +4853,17 @@ const BSC1Payment = (props) => {
|
|||
SplitPaymentModal={Splitpayment}
|
||||
handlesplitpaymentclose={handlesplitpaymentclose}
|
||||
TotalNetAmount={
|
||||
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)))
|
||||
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))
|
||||
)
|
||||
}
|
||||
failedOrderData={failedOrderData}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue