Merge pull request 'same product offer message display' (#312) from bug-fix-260326 into main
Reviewed-on: Pozomind/pozo-retail-app#312
This commit is contained in:
commit
5c4f867a4a
|
|
@ -54,7 +54,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
const quantityInputRef = useRef(null);
|
const quantityInputRef = useRef(null);
|
||||||
const priceChangeInputRef = useRef(null);
|
const priceChangeInputRef = useRef(null);
|
||||||
const reductionInputRef = useRef(null);
|
const reductionInputRef = useRef(null);
|
||||||
const { setIndex = () => {} } = props;
|
const { setIndex = () => { } } = props;
|
||||||
|
|
||||||
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
|
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
|
||||||
console.log(disableSubmitButton, 'disableSubmitButton');
|
console.log(disableSubmitButton, 'disableSubmitButton');
|
||||||
|
|
@ -522,7 +522,15 @@ const BSBillingEditQuantity = (props) => {
|
||||||
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
||||||
cartItem?.BookingTypeName === editedProduct?.BookingTypeName &&
|
cartItem?.BookingTypeName === editedProduct?.BookingTypeName &&
|
||||||
!cartItem?.SalesId
|
!cartItem?.SalesId && ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
|
||||||
|
? true
|
||||||
|
: cartItem?.OfferMode !== 'B') &&
|
||||||
|
cartItem?.OfferMode !== 'P' &&
|
||||||
|
cartItem?.OfferMode !== 'C' &&
|
||||||
|
cartItem?.OfferMode !== 'O' &&
|
||||||
|
cartItem?.OfferMode !== 'L'
|
||||||
|
? true
|
||||||
|
: cartItem?.Offer === 0)
|
||||||
);
|
);
|
||||||
// changing for one piece stock checking
|
// changing for one piece stock checking
|
||||||
const isItemInCartfilter = CartOrderDetails?.filter(
|
const isItemInCartfilter = CartOrderDetails?.filter(
|
||||||
|
|
@ -530,7 +538,15 @@ const BSBillingEditQuantity = (props) => {
|
||||||
cartItem?.ProdId === editedProduct?.ProdId &&
|
cartItem?.ProdId === editedProduct?.ProdId &&
|
||||||
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
cartItem?.OrderRate !== editedProduct?.OrderRate &&
|
cartItem?.OrderRate !== editedProduct?.OrderRate &&
|
||||||
!cartItem?.SalesId
|
!cartItem?.SalesId && ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
|
||||||
|
? true
|
||||||
|
: cartItem?.OfferMode !== 'B') &&
|
||||||
|
cartItem?.OfferMode !== 'P' &&
|
||||||
|
cartItem?.OfferMode !== 'C' &&
|
||||||
|
cartItem?.OfferMode !== 'O' &&
|
||||||
|
cartItem?.OfferMode !== 'L'
|
||||||
|
? true
|
||||||
|
: cartItem?.Offer === 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
const isItemInCartHold = CartOrderDetails?.find(
|
const isItemInCartHold = CartOrderDetails?.find(
|
||||||
|
|
@ -538,7 +554,15 @@ const BSBillingEditQuantity = (props) => {
|
||||||
cartItem?.ProdId === editedProduct?.ProdId &&
|
cartItem?.ProdId === editedProduct?.ProdId &&
|
||||||
cartItem?.InwardDtlId === editedProduct.InwardDtlId &&
|
cartItem?.InwardDtlId === editedProduct.InwardDtlId &&
|
||||||
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
||||||
cartItem?.BookingTypeName === editedProduct?.BookingTypeName
|
cartItem?.BookingTypeName === editedProduct?.BookingTypeName && ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
|
||||||
|
? true
|
||||||
|
: cartItem?.OfferMode !== 'B') &&
|
||||||
|
cartItem?.OfferMode !== 'P' &&
|
||||||
|
cartItem?.OfferMode !== 'C' &&
|
||||||
|
cartItem?.OfferMode !== 'O' &&
|
||||||
|
cartItem?.OfferMode !== 'L'
|
||||||
|
? true
|
||||||
|
: cartItem?.Offer === 0)
|
||||||
); // check if the item is already in the cart
|
); // check if the item is already in the cart
|
||||||
const isItemInCartHoldfilter = CartOrderDetails?.filter(
|
const isItemInCartHoldfilter = CartOrderDetails?.filter(
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
|
|
@ -547,7 +571,15 @@ const BSBillingEditQuantity = (props) => {
|
||||||
!(
|
!(
|
||||||
(cartItem?.OrderRate === editedProduct?.OrderRate)
|
(cartItem?.OrderRate === editedProduct?.OrderRate)
|
||||||
// && cartItem?.BookingTypeName === editedProduct?.BookingTypeName
|
// && cartItem?.BookingTypeName === editedProduct?.BookingTypeName
|
||||||
)
|
) && ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
|
||||||
|
? true
|
||||||
|
: cartItem?.OfferMode !== 'B') &&
|
||||||
|
cartItem?.OfferMode !== 'P' &&
|
||||||
|
cartItem?.OfferMode !== 'C' &&
|
||||||
|
cartItem?.OfferMode !== 'O' &&
|
||||||
|
cartItem?.OfferMode !== 'L'
|
||||||
|
? true
|
||||||
|
: cartItem?.Offer === 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
@ -809,7 +841,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
return (
|
return (
|
||||||
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
cartItem?.OfferMessage?.[0]?.OfferId ===
|
cartItem?.OfferMessage?.[0]?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
cartItem?.OfferMode === editedProduct?.OfferMode &&
|
cartItem?.OfferMode === editedProduct?.OfferMode &&
|
||||||
cartItem?.BookingTypeName !== editedProduct?.BookingTypeName
|
cartItem?.BookingTypeName !== editedProduct?.BookingTypeName
|
||||||
);
|
);
|
||||||
|
|
@ -943,7 +975,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
||||||
cartItem?.BookingTypeName !==
|
cartItem?.BookingTypeName !==
|
||||||
editedProduct?.BookingTypeName &&
|
editedProduct?.BookingTypeName &&
|
||||||
!cartItem?.OfferMode &&
|
!cartItem?.OfferMode &&
|
||||||
cartItem?.Offer === 0
|
cartItem?.Offer === 0
|
||||||
);
|
);
|
||||||
|
|
@ -957,7 +989,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
||||||
cartItem?.BookingTypeName !==
|
cartItem?.BookingTypeName !==
|
||||||
editedProduct?.BookingTypeName &&
|
editedProduct?.BookingTypeName &&
|
||||||
cartItem?.OfferMode === editedProduct?.OfferMode &&
|
cartItem?.OfferMode === editedProduct?.OfferMode &&
|
||||||
cartItem?.Offer > 0
|
cartItem?.Offer > 0
|
||||||
);
|
);
|
||||||
|
|
@ -1090,7 +1122,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
)
|
)
|
||||||
) &&
|
) &&
|
||||||
product?.OfferId ===
|
product?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
product?.OfferMode === editedProduct?.OfferMode
|
product?.OfferMode === editedProduct?.OfferMode
|
||||||
) {
|
) {
|
||||||
const freeQty =
|
const freeQty =
|
||||||
|
|
@ -1123,7 +1155,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
|
|
@ -1206,7 +1238,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
)
|
)
|
||||||
) &&
|
) &&
|
||||||
product?.OfferId ===
|
product?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
product?.OfferMode === editedProduct?.OfferMode
|
product?.OfferMode === editedProduct?.OfferMode
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
|
|
@ -1236,7 +1268,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
|
|
@ -1423,7 +1455,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
|
|
@ -1525,7 +1557,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
|
|
@ -1679,7 +1711,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
) &&
|
) &&
|
||||||
cartItem?.Offer &&
|
cartItem?.Offer &&
|
||||||
isFreeProductApplicable?.OfferId ===
|
isFreeProductApplicable?.OfferId ===
|
||||||
cartItem?.OfferMessage?.[0]?.OfferId
|
cartItem?.OfferMessage?.[0]?.OfferId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -1968,11 +2000,11 @@ const BSBillingEditQuantity = (props) => {
|
||||||
product?.ProdId === editedProduct?.ProdId &&
|
product?.ProdId === editedProduct?.ProdId &&
|
||||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
product?.OfferId ===
|
product?.OfferId ===
|
||||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
||||||
product?.OfferMode ===
|
product?.OfferMode ===
|
||||||
(sameBookingTypeProduct?.OfferMode ||
|
(sameBookingTypeProduct?.OfferMode ||
|
||||||
otherBookingTypeProduct?.OfferMode)
|
otherBookingTypeProduct?.OfferMode)
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
...product,
|
...product,
|
||||||
|
|
@ -2006,11 +2038,11 @@ const BSBillingEditQuantity = (props) => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
||||||
offerProduct?.OfferMode ===
|
offerProduct?.OfferMode ===
|
||||||
(sameBookingTypeProduct?.OfferMode ||
|
(sameBookingTypeProduct?.OfferMode ||
|
||||||
otherBookingTypeProduct?.OfferMode);
|
otherBookingTypeProduct?.OfferMode);
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
// Get loyalty points from the matching free product
|
// Get loyalty points from the matching free product
|
||||||
|
|
@ -2151,7 +2183,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
cartItem?.Offer > 0 &&
|
cartItem?.Offer > 0 &&
|
||||||
isFreeProductApplicable?.OfferMode === cartItem?.OfferMode &&
|
isFreeProductApplicable?.OfferMode === cartItem?.OfferMode &&
|
||||||
isFreeProductApplicable?.OfferId ===
|
isFreeProductApplicable?.OfferId ===
|
||||||
cartItem?.OfferMessage?.[0]?.OfferId
|
cartItem?.OfferMessage?.[0]?.OfferId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -2254,11 +2286,11 @@ const BSBillingEditQuantity = (props) => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
otherBookingTypeProduct.InwardDtlId &&
|
otherBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
otherBookingTypeProduct.BookingTypeName &&
|
otherBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
otherBookingTypeProduct.OrderRate &&
|
otherBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2329,12 +2361,12 @@ const BSBillingEditQuantity = (props) => {
|
||||||
product?.ProdId === editedProduct?.ProdId &&
|
product?.ProdId === editedProduct?.ProdId &&
|
||||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
product?.OfferId ===
|
product?.OfferId ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId) &&
|
?.OfferId) &&
|
||||||
product?.OfferMode ===
|
product?.OfferMode ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||||
otherBookingTypeFreeProduct?.OfferMode)
|
otherBookingTypeFreeProduct?.OfferMode)
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
...product,
|
...product,
|
||||||
|
|
@ -2368,13 +2400,13 @@ const BSBillingEditQuantity = (props) => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]
|
(sameBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId ||
|
?.OfferId ||
|
||||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId) &&
|
?.OfferId) &&
|
||||||
offerProduct?.OfferMode ===
|
offerProduct?.OfferMode ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||||
otherBookingTypeFreeProduct?.OfferMode);
|
otherBookingTypeFreeProduct?.OfferMode);
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
// Get loyalty points from the matching free product
|
// Get loyalty points from the matching free product
|
||||||
|
|
@ -2456,11 +2488,11 @@ const BSBillingEditQuantity = (props) => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
sameBookingTypeProduct.InwardDtlId &&
|
sameBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
sameBookingTypeProduct.BookingTypeName &&
|
sameBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
sameBookingTypeProduct.OrderRate &&
|
sameBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2513,11 +2545,11 @@ const BSBillingEditQuantity = (props) => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
sameBookingTypeProduct.InwardDtlId &&
|
sameBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
sameBookingTypeProduct.BookingTypeName &&
|
sameBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
sameBookingTypeProduct.OrderRate &&
|
sameBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2606,11 +2638,11 @@ const BSBillingEditQuantity = (props) => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
otherBookingTypeProduct.InwardDtlId &&
|
otherBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem?.BookingTypeName ===
|
cartItem?.BookingTypeName ===
|
||||||
otherBookingTypeProduct.BookingTypeName &&
|
otherBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem?.OrderRate ===
|
cartItem?.OrderRate ===
|
||||||
otherBookingTypeProduct.OrderRate &&
|
otherBookingTypeProduct.OrderRate &&
|
||||||
cartItem?.OfferMode &&
|
cartItem?.OfferMode &&
|
||||||
cartItem?.Offer > 0
|
cartItem?.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2639,11 +2671,11 @@ const BSBillingEditQuantity = (props) => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
otherBookingTypeProduct.InwardDtlId &&
|
otherBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
otherBookingTypeProduct.BookingTypeName &&
|
otherBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
otherBookingTypeProduct.OrderRate &&
|
otherBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2673,11 +2705,11 @@ const BSBillingEditQuantity = (props) => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
otherBookingTypeProduct.InwardDtlId &&
|
otherBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
otherBookingTypeProduct.BookingTypeName &&
|
otherBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
otherBookingTypeProduct.OrderRate &&
|
otherBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2776,12 +2808,12 @@ const BSBillingEditQuantity = (props) => {
|
||||||
product?.ProdId === editedProduct?.ProdId &&
|
product?.ProdId === editedProduct?.ProdId &&
|
||||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
product?.OfferId ===
|
product?.OfferId ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId) &&
|
?.OfferId) &&
|
||||||
product?.OfferMode ===
|
product?.OfferMode ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||||
otherBookingTypeFreeProduct?.OfferMode)
|
otherBookingTypeFreeProduct?.OfferMode)
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
...product,
|
...product,
|
||||||
|
|
@ -2815,12 +2847,12 @@ const BSBillingEditQuantity = (props) => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeProduct?.OfferMessage?.[0]
|
otherBookingTypeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId) &&
|
?.OfferId) &&
|
||||||
offerProduct?.OfferMode ===
|
offerProduct?.OfferMode ===
|
||||||
(sameBookingTypeProduct?.OfferMode ||
|
(sameBookingTypeProduct?.OfferMode ||
|
||||||
otherBookingTypeProduct?.OfferMode);
|
otherBookingTypeProduct?.OfferMode);
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
// Get loyalty points from the matching free product
|
// Get loyalty points from the matching free product
|
||||||
|
|
@ -2899,11 +2931,11 @@ const BSBillingEditQuantity = (props) => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
sameBookingTypeProduct.InwardDtlId &&
|
sameBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
sameBookingTypeProduct.BookingTypeName &&
|
sameBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
sameBookingTypeProduct.OrderRate &&
|
sameBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2962,11 +2994,11 @@ const BSBillingEditQuantity = (props) => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
otherBookingTypeProduct.InwardDtlId &&
|
otherBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
otherBookingTypeProduct.BookingTypeName &&
|
otherBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
otherBookingTypeProduct.OrderRate &&
|
otherBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -3038,12 +3070,12 @@ const BSBillingEditQuantity = (props) => {
|
||||||
product?.ProdId === editedProduct?.ProdId &&
|
product?.ProdId === editedProduct?.ProdId &&
|
||||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
product?.OfferId ===
|
product?.OfferId ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId) &&
|
?.OfferId) &&
|
||||||
product?.OfferMode ===
|
product?.OfferMode ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||||
otherBookingTypeFreeProduct?.OfferMode)
|
otherBookingTypeFreeProduct?.OfferMode)
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
...product,
|
...product,
|
||||||
|
|
@ -3077,12 +3109,12 @@ const BSBillingEditQuantity = (props) => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeProduct?.OfferMessage?.[0]
|
otherBookingTypeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId) &&
|
?.OfferId) &&
|
||||||
offerProduct?.OfferMode ===
|
offerProduct?.OfferMode ===
|
||||||
(sameBookingTypeProduct?.OfferMode ||
|
(sameBookingTypeProduct?.OfferMode ||
|
||||||
otherBookingTypeProduct?.OfferMode);
|
otherBookingTypeProduct?.OfferMode);
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
// Get loyalty points from the matching free product
|
// Get loyalty points from the matching free product
|
||||||
|
|
@ -3217,21 +3249,21 @@ const BSBillingEditQuantity = (props) => {
|
||||||
}),
|
}),
|
||||||
...(!offerApply && itemDiscountPrice > 0
|
...(!offerApply && itemDiscountPrice > 0
|
||||||
? {
|
? {
|
||||||
DiscountAmt: safeRound(itemDiscountPrice * fixedQty),
|
DiscountAmt: safeRound(itemDiscountPrice * fixedQty),
|
||||||
DiscountType:
|
DiscountType:
|
||||||
itemDiscountPercentageSelection === 'Fixed' ? 'F' : 'P',
|
itemDiscountPercentageSelection === 'Fixed' ? 'F' : 'P',
|
||||||
DiscountValue:
|
DiscountValue:
|
||||||
itemDiscountPercentageSelection === 'Fixed'
|
itemDiscountPercentageSelection === 'Fixed'
|
||||||
? itemDiscountPrice * fixedQty
|
? itemDiscountPrice * fixedQty
|
||||||
: ((itemDiscountPrice * fixedQty) /
|
: ((itemDiscountPrice * fixedQty) /
|
||||||
(newPrice > 0 ? newPrice : editedProduct?.OrderRate)) *
|
(newPrice > 0 ? newPrice : editedProduct?.OrderRate)) *
|
||||||
100,
|
100,
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
DiscountAmt: null,
|
DiscountAmt: null,
|
||||||
DiscountType: null,
|
DiscountType: null,
|
||||||
DiscountValue: null,
|
DiscountValue: null,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (hasOffer) {
|
if (hasOffer) {
|
||||||
|
|
@ -3256,17 +3288,17 @@ const BSBillingEditQuantity = (props) => {
|
||||||
changeOrderCardDetails(
|
changeOrderCardDetails(
|
||||||
CartOrderDetails?.map((i) =>
|
CartOrderDetails?.map((i) =>
|
||||||
i?.InwardDtlId == updatedProduct?.InwardDtlId &&
|
i?.InwardDtlId == updatedProduct?.InwardDtlId &&
|
||||||
i?.BookingTypeName == updatedProduct?.BookingTypeName &&
|
i?.BookingTypeName == updatedProduct?.BookingTypeName &&
|
||||||
i?.localId === updatedProduct?.localId
|
i?.localId === updatedProduct?.localId
|
||||||
? {
|
? {
|
||||||
...updatedProduct,
|
...updatedProduct,
|
||||||
Offer: 0,
|
Offer: 0,
|
||||||
OfferType:
|
OfferType:
|
||||||
updatedProduct?.Type === 'C'
|
updatedProduct?.Type === 'C'
|
||||||
? updatedProduct?.OfferType
|
? updatedProduct?.OfferType
|
||||||
: null,
|
: null,
|
||||||
OfferMessage: null,
|
OfferMessage: null,
|
||||||
}
|
}
|
||||||
: i
|
: i
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -3302,10 +3334,10 @@ const BSBillingEditQuantity = (props) => {
|
||||||
((c?.OfferModeType && c?.OfferMode === 'B'
|
((c?.OfferModeType && c?.OfferMode === 'B'
|
||||||
? true
|
? true
|
||||||
: c?.OfferMode !== 'B') &&
|
: c?.OfferMode !== 'B') &&
|
||||||
c?.OfferMode !== 'P' &&
|
c?.OfferMode !== 'P' &&
|
||||||
c?.OfferMode !== 'C' &&
|
c?.OfferMode !== 'C' &&
|
||||||
c?.OfferMode !== 'O' &&
|
c?.OfferMode !== 'O' &&
|
||||||
c?.OfferMode !== 'L'
|
c?.OfferMode !== 'L'
|
||||||
? true
|
? true
|
||||||
: c?.Offer === 0);
|
: c?.Offer === 0);
|
||||||
|
|
||||||
|
|
@ -4040,14 +4072,14 @@ const BSBillingEditQuantity = (props) => {
|
||||||
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
|
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
|
||||||
{((RadioBtnSelection == 'Price' && disableSubmitButton) ||
|
{((RadioBtnSelection == 'Price' && disableSubmitButton) ||
|
||||||
RadioBtnSelection == 'Quantity') && (
|
RadioBtnSelection == 'Quantity') && (
|
||||||
<Buttons
|
<Buttons
|
||||||
buttonText="Submit"
|
buttonText="Submit"
|
||||||
color="901D77"
|
color="901D77"
|
||||||
htmlType
|
htmlType
|
||||||
// handleSubmit={AddProductQuantity}
|
// handleSubmit={AddProductQuantity}
|
||||||
icon={<ArrowRightOutlined />}
|
icon={<ArrowRightOutlined />}
|
||||||
></Buttons>
|
></Buttons>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -217,16 +217,16 @@ const BSBillingTable3 = (Props) => {
|
||||||
OrderType === 'Hold'
|
OrderType === 'Hold'
|
||||||
? tableData?.filter((a, b) => a.BookingTypeName === 'TakeAway')
|
? tableData?.filter((a, b) => a.BookingTypeName === 'TakeAway')
|
||||||
: tableData?.filter(
|
: tableData?.filter(
|
||||||
(a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
|
(a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
|
||||||
);
|
);
|
||||||
const OldtableDataDinein = tableData?.filter(
|
const OldtableDataDinein = tableData?.filter(
|
||||||
(a, b) => a.BookingTypeName === 'Dine In' && a?.SalesId
|
(a, b) => a.BookingTypeName === 'Dine In' && a?.SalesId
|
||||||
);
|
);
|
||||||
const OldtableDataTakeAway =
|
const OldtableDataTakeAway =
|
||||||
OrderType != 'Hold'
|
OrderType != 'Hold'
|
||||||
? tableData?.filter(
|
? tableData?.filter(
|
||||||
(a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
|
(a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
|
||||||
)
|
)
|
||||||
: [];
|
: [];
|
||||||
const [EditQuantity, setEditQuantity] = useState(false);
|
const [EditQuantity, setEditQuantity] = useState(false);
|
||||||
const [Modaldata, setModaldata] = useState([]);
|
const [Modaldata, setModaldata] = useState([]);
|
||||||
|
|
@ -473,27 +473,27 @@ const BSBillingTable3 = (Props) => {
|
||||||
) {
|
) {
|
||||||
if (BillOrderPre === 'Y') {
|
if (BillOrderPre === 'Y') {
|
||||||
const UpdatedCartItem =
|
const UpdatedCartItem =
|
||||||
// if the item is already in the cart, increase the quantity of the item
|
// if the item is already in the cart, increase the quantity of the item
|
||||||
{
|
{
|
||||||
...isItemInCart,
|
...isItemInCart,
|
||||||
OrderQty: isItemInCart?.OrderQty - 1,
|
OrderQty: isItemInCart?.OrderQty - 1,
|
||||||
TotalAmt:
|
TotalAmt:
|
||||||
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
|
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((isItemInCart?.OrderQty - 1) *
|
||||||
|
isItemInCart?.OrderRate *
|
||||||
|
isItemInCart?.TaxPercentage) /
|
||||||
|
(100 + isItemInCart?.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
|
||||||
|
(
|
||||||
((isItemInCart?.OrderQty - 1) *
|
((isItemInCart?.OrderQty - 1) *
|
||||||
isItemInCart?.OrderRate *
|
isItemInCart?.OrderRate *
|
||||||
isItemInCart?.TaxPercentage) /
|
isItemInCart?.TaxPercentage) /
|
||||||
(100 + isItemInCart?.TaxPercentage)
|
(100 + isItemInCart?.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
};
|
||||||
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
|
|
||||||
(
|
|
||||||
((isItemInCart?.OrderQty - 1) *
|
|
||||||
isItemInCart?.OrderRate *
|
|
||||||
isItemInCart?.TaxPercentage) /
|
|
||||||
(100 + isItemInCart?.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
};
|
|
||||||
|
|
||||||
const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal];
|
const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal];
|
||||||
|
|
||||||
|
|
@ -504,27 +504,27 @@ const BSBillingTable3 = (Props) => {
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
const UpdatedCartItem =
|
const UpdatedCartItem =
|
||||||
// if the item is already in the cart, increase the quantity of the item
|
// if the item is already in the cart, increase the quantity of the item
|
||||||
{
|
{
|
||||||
...isItemInCart,
|
...isItemInCart,
|
||||||
OrderQty: isItemInCart?.OrderQty - 1,
|
OrderQty: isItemInCart?.OrderQty - 1,
|
||||||
TotalAmt:
|
TotalAmt:
|
||||||
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
|
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((isItemInCart?.OrderQty - 1) *
|
||||||
|
isItemInCart?.OrderRate *
|
||||||
|
isItemInCart?.TaxPercentage) /
|
||||||
|
(100 + isItemInCart?.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
|
||||||
|
(
|
||||||
((isItemInCart?.OrderQty - 1) *
|
((isItemInCart?.OrderQty - 1) *
|
||||||
isItemInCart?.OrderRate *
|
isItemInCart?.OrderRate *
|
||||||
isItemInCart?.TaxPercentage) /
|
isItemInCart?.TaxPercentage) /
|
||||||
(100 + isItemInCart?.TaxPercentage)
|
(100 + isItemInCart?.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
};
|
||||||
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
|
|
||||||
(
|
|
||||||
((isItemInCart?.OrderQty - 1) *
|
|
||||||
isItemInCart?.OrderRate *
|
|
||||||
isItemInCart?.TaxPercentage) /
|
|
||||||
(100 + isItemInCart?.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
};
|
|
||||||
|
|
||||||
const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem];
|
const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem];
|
||||||
|
|
||||||
|
|
@ -543,27 +543,27 @@ const BSBillingTable3 = (Props) => {
|
||||||
) {
|
) {
|
||||||
if (BillOrderPre === 'Y') {
|
if (BillOrderPre === 'Y') {
|
||||||
const UpdatedCartItem =
|
const UpdatedCartItem =
|
||||||
// if the item is already in the cart, increase the quantity of the item
|
// if the item is already in the cart, increase the quantity of the item
|
||||||
{
|
{
|
||||||
...isItemInCart,
|
...isItemInCart,
|
||||||
OrderQty: isItemInCart?.OrderQty - 1,
|
OrderQty: isItemInCart?.OrderQty - 1,
|
||||||
TotalAmt:
|
TotalAmt:
|
||||||
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
|
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((isItemInCart?.OrderQty - 1) *
|
||||||
|
isItemInCart?.OrderRate *
|
||||||
|
isItemInCart?.TaxPercentage) /
|
||||||
|
(100 + isItemInCart?.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
|
||||||
|
(
|
||||||
((isItemInCart?.OrderQty - 1) *
|
((isItemInCart?.OrderQty - 1) *
|
||||||
isItemInCart?.OrderRate *
|
isItemInCart?.OrderRate *
|
||||||
isItemInCart?.TaxPercentage) /
|
isItemInCart?.TaxPercentage) /
|
||||||
(100 + isItemInCart?.TaxPercentage)
|
(100 + isItemInCart?.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
};
|
||||||
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
|
|
||||||
(
|
|
||||||
((isItemInCart?.OrderQty - 1) *
|
|
||||||
isItemInCart?.OrderRate *
|
|
||||||
isItemInCart?.TaxPercentage) /
|
|
||||||
(100 + isItemInCart?.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
};
|
|
||||||
const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal];
|
const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal];
|
||||||
|
|
||||||
// if (OfferCheckedInSetup && preferenceOffer) {
|
// if (OfferCheckedInSetup && preferenceOffer) {
|
||||||
|
|
@ -573,27 +573,27 @@ const BSBillingTable3 = (Props) => {
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
const UpdatedCartItem =
|
const UpdatedCartItem =
|
||||||
// if the item is already in the cart, increase the quantity of the item
|
// if the item is already in the cart, increase the quantity of the item
|
||||||
{
|
{
|
||||||
...isItemInCart,
|
...isItemInCart,
|
||||||
OrderQty: isItemInCart?.OrderQty - 1,
|
OrderQty: isItemInCart?.OrderQty - 1,
|
||||||
TotalAmt:
|
TotalAmt:
|
||||||
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
|
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((isItemInCart?.OrderQty - 1) *
|
||||||
|
isItemInCart?.OrderRate *
|
||||||
|
isItemInCart?.TaxPercentage) /
|
||||||
|
(100 + isItemInCart?.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
|
||||||
|
(
|
||||||
((isItemInCart?.OrderQty - 1) *
|
((isItemInCart?.OrderQty - 1) *
|
||||||
isItemInCart?.OrderRate *
|
isItemInCart?.OrderRate *
|
||||||
isItemInCart?.TaxPercentage) /
|
isItemInCart?.TaxPercentage) /
|
||||||
(100 + isItemInCart?.TaxPercentage)
|
(100 + isItemInCart?.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
};
|
||||||
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
|
|
||||||
(
|
|
||||||
((isItemInCart?.OrderQty - 1) *
|
|
||||||
isItemInCart?.OrderRate *
|
|
||||||
isItemInCart?.TaxPercentage) /
|
|
||||||
(100 + isItemInCart?.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
};
|
|
||||||
|
|
||||||
const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem];
|
const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem];
|
||||||
|
|
||||||
|
|
@ -606,29 +606,29 @@ const BSBillingTable3 = (Props) => {
|
||||||
} else if (isItemInCartHold && OrderType === 'Hold') {
|
} else if (isItemInCartHold && OrderType === 'Hold') {
|
||||||
if (BillOrderPre === 'Y') {
|
if (BillOrderPre === 'Y') {
|
||||||
const UpdatedCartItem =
|
const UpdatedCartItem =
|
||||||
// if the item is already in the cart, increase the quantity of the item
|
// if the item is already in the cart, increase the quantity of the item
|
||||||
{
|
{
|
||||||
...isItemInCartHold,
|
...isItemInCartHold,
|
||||||
OrderQty: isItemInCartHold?.OrderQty - 1,
|
OrderQty: isItemInCartHold?.OrderQty - 1,
|
||||||
TotalAmt:
|
TotalAmt:
|
||||||
(isItemInCartHold?.OrderQty - 1) *
|
(isItemInCartHold?.OrderQty - 1) *
|
||||||
isItemInCartHold?.OrderRate,
|
isItemInCartHold?.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((isItemInCartHold?.OrderQty - 1) *
|
||||||
|
isItemInCartHold?.OrderRate *
|
||||||
|
isItemInCartHold?.TaxPercentage) /
|
||||||
|
(100 + isItemInCartHold?.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(isItemInCartHold?.OrderQty - 1) *
|
||||||
|
isItemInCartHold?.OrderRate -
|
||||||
|
(
|
||||||
((isItemInCartHold?.OrderQty - 1) *
|
((isItemInCartHold?.OrderQty - 1) *
|
||||||
isItemInCartHold?.OrderRate *
|
isItemInCartHold?.OrderRate *
|
||||||
isItemInCartHold?.TaxPercentage) /
|
isItemInCartHold?.TaxPercentage) /
|
||||||
(100 + isItemInCartHold?.TaxPercentage)
|
(100 + isItemInCartHold?.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
};
|
||||||
(isItemInCartHold?.OrderQty - 1) *
|
|
||||||
isItemInCartHold?.OrderRate -
|
|
||||||
(
|
|
||||||
((isItemInCartHold?.OrderQty - 1) *
|
|
||||||
isItemInCartHold?.OrderRate *
|
|
||||||
isItemInCartHold?.TaxPercentage) /
|
|
||||||
(100 + isItemInCartHold?.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
};
|
|
||||||
|
|
||||||
const UpdatedData = [
|
const UpdatedData = [
|
||||||
UpdatedCartItem,
|
UpdatedCartItem,
|
||||||
|
|
@ -642,29 +642,29 @@ const BSBillingTable3 = (Props) => {
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
const UpdatedCartItem =
|
const UpdatedCartItem =
|
||||||
// if the item is already in the cart, increase the quantity of the item
|
// if the item is already in the cart, increase the quantity of the item
|
||||||
{
|
{
|
||||||
...isItemInCartHold,
|
...isItemInCartHold,
|
||||||
OrderQty: isItemInCartHold?.OrderQty - 1,
|
OrderQty: isItemInCartHold?.OrderQty - 1,
|
||||||
TotalAmt:
|
TotalAmt:
|
||||||
(isItemInCartHold?.OrderQty - 1) *
|
(isItemInCartHold?.OrderQty - 1) *
|
||||||
isItemInCartHold?.OrderRate,
|
isItemInCartHold?.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((isItemInCartHold?.OrderQty - 1) *
|
||||||
|
isItemInCartHold?.OrderRate *
|
||||||
|
isItemInCartHold?.TaxPercentage) /
|
||||||
|
(100 + isItemInCartHold?.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(isItemInCartHold?.OrderQty - 1) *
|
||||||
|
isItemInCartHold?.OrderRate -
|
||||||
|
(
|
||||||
((isItemInCartHold?.OrderQty - 1) *
|
((isItemInCartHold?.OrderQty - 1) *
|
||||||
isItemInCartHold?.OrderRate *
|
isItemInCartHold?.OrderRate *
|
||||||
isItemInCartHold?.TaxPercentage) /
|
isItemInCartHold?.TaxPercentage) /
|
||||||
(100 + isItemInCartHold?.TaxPercentage)
|
(100 + isItemInCartHold?.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
};
|
||||||
(isItemInCartHold?.OrderQty - 1) *
|
|
||||||
isItemInCartHold?.OrderRate -
|
|
||||||
(
|
|
||||||
((isItemInCartHold?.OrderQty - 1) *
|
|
||||||
isItemInCartHold?.OrderRate *
|
|
||||||
isItemInCartHold?.TaxPercentage) /
|
|
||||||
(100 + isItemInCartHold?.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
};
|
|
||||||
|
|
||||||
const UpdatedData = [
|
const UpdatedData = [
|
||||||
...OtherorderDataforNormalWithoutSalesId,
|
...OtherorderDataforNormalWithoutSalesId,
|
||||||
|
|
@ -968,26 +968,26 @@ const BSBillingTable3 = (Props) => {
|
||||||
if (isItemInCart && BookingTypeProd != 'Dine In' && OrderType != 'Hold') {
|
if (isItemInCart && BookingTypeProd != 'Dine In' && OrderType != 'Hold') {
|
||||||
if (BillOrderPre === 'Y') {
|
if (BillOrderPre === 'Y') {
|
||||||
const UpdatedCartItem =
|
const UpdatedCartItem =
|
||||||
// if the item is already in the cart, increase the quantity of the item
|
// if the item is already in the cart, increase the quantity of the item
|
||||||
{
|
{
|
||||||
...isItemInCart,
|
...isItemInCart,
|
||||||
OrderQty: isItemInCart?.OrderQty + 1,
|
OrderQty: isItemInCart?.OrderQty + 1,
|
||||||
TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
|
TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((isItemInCart?.OrderQty + 1) *
|
||||||
|
isItemInCart?.OrderRate *
|
||||||
|
isItemInCart?.TaxPercentage) /
|
||||||
|
(100 + isItemInCart?.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
|
||||||
|
(
|
||||||
((isItemInCart?.OrderQty + 1) *
|
((isItemInCart?.OrderQty + 1) *
|
||||||
isItemInCart?.OrderRate *
|
isItemInCart?.OrderRate *
|
||||||
isItemInCart?.TaxPercentage) /
|
isItemInCart?.TaxPercentage) /
|
||||||
(100 + isItemInCart?.TaxPercentage)
|
(100 + isItemInCart?.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
};
|
||||||
(isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
|
|
||||||
(
|
|
||||||
((isItemInCart?.OrderQty + 1) *
|
|
||||||
isItemInCart?.OrderRate *
|
|
||||||
isItemInCart?.TaxPercentage) /
|
|
||||||
(100 + isItemInCart?.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
};
|
|
||||||
|
|
||||||
const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal];
|
const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal];
|
||||||
|
|
||||||
|
|
@ -998,26 +998,26 @@ const BSBillingTable3 = (Props) => {
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
const UpdatedCartItem =
|
const UpdatedCartItem =
|
||||||
// if the item is already in the cart, increase the quantity of the item
|
// if the item is already in the cart, increase the quantity of the item
|
||||||
{
|
{
|
||||||
...isItemInCart,
|
...isItemInCart,
|
||||||
OrderQty: isItemInCart?.OrderQty + 1,
|
OrderQty: isItemInCart?.OrderQty + 1,
|
||||||
TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
|
TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((isItemInCart?.OrderQty + 1) *
|
||||||
|
isItemInCart?.OrderRate *
|
||||||
|
isItemInCart?.TaxPercentage) /
|
||||||
|
(100 + isItemInCart?.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
|
||||||
|
(
|
||||||
((isItemInCart?.OrderQty + 1) *
|
((isItemInCart?.OrderQty + 1) *
|
||||||
isItemInCart?.OrderRate *
|
isItemInCart?.OrderRate *
|
||||||
isItemInCart?.TaxPercentage) /
|
isItemInCart?.TaxPercentage) /
|
||||||
(100 + isItemInCart?.TaxPercentage)
|
(100 + isItemInCart?.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
};
|
||||||
(isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
|
|
||||||
(
|
|
||||||
((isItemInCart?.OrderQty + 1) *
|
|
||||||
isItemInCart?.OrderRate *
|
|
||||||
isItemInCart?.TaxPercentage) /
|
|
||||||
(100 + isItemInCart?.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
};
|
|
||||||
|
|
||||||
const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem];
|
const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem];
|
||||||
|
|
||||||
|
|
@ -1036,26 +1036,26 @@ const BSBillingTable3 = (Props) => {
|
||||||
) {
|
) {
|
||||||
if (BillOrderPre === 'Y') {
|
if (BillOrderPre === 'Y') {
|
||||||
const UpdatedCartItem =
|
const UpdatedCartItem =
|
||||||
// if the item is already in the cart, increase the quantity of the item
|
// if the item is already in the cart, increase the quantity of the item
|
||||||
{
|
{
|
||||||
...isItemInCart,
|
...isItemInCart,
|
||||||
OrderQty: isItemInCart?.OrderQty + 1,
|
OrderQty: isItemInCart?.OrderQty + 1,
|
||||||
TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
|
TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((isItemInCart?.OrderQty + 1) *
|
||||||
|
isItemInCart?.OrderRate *
|
||||||
|
isItemInCart?.TaxPercentage) /
|
||||||
|
(100 + isItemInCart?.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
|
||||||
|
(
|
||||||
((isItemInCart?.OrderQty + 1) *
|
((isItemInCart?.OrderQty + 1) *
|
||||||
isItemInCart?.OrderRate *
|
isItemInCart?.OrderRate *
|
||||||
isItemInCart?.TaxPercentage) /
|
isItemInCart?.TaxPercentage) /
|
||||||
(100 + isItemInCart?.TaxPercentage)
|
(100 + isItemInCart?.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
};
|
||||||
(isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
|
|
||||||
(
|
|
||||||
((isItemInCart?.OrderQty + 1) *
|
|
||||||
isItemInCart?.OrderRate *
|
|
||||||
isItemInCart?.TaxPercentage) /
|
|
||||||
(100 + isItemInCart?.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
};
|
|
||||||
|
|
||||||
const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal];
|
const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal];
|
||||||
|
|
||||||
|
|
@ -1066,26 +1066,26 @@ const BSBillingTable3 = (Props) => {
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
const UpdatedCartItem =
|
const UpdatedCartItem =
|
||||||
// if the item is already in the cart, increase the quantity of the item
|
// if the item is already in the cart, increase the quantity of the item
|
||||||
{
|
{
|
||||||
...isItemInCart,
|
...isItemInCart,
|
||||||
OrderQty: isItemInCart?.OrderQty + 1,
|
OrderQty: isItemInCart?.OrderQty + 1,
|
||||||
TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
|
TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((isItemInCart?.OrderQty + 1) *
|
||||||
|
isItemInCart?.OrderRate *
|
||||||
|
isItemInCart?.TaxPercentage) /
|
||||||
|
(100 + isItemInCart?.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
|
||||||
|
(
|
||||||
((isItemInCart?.OrderQty + 1) *
|
((isItemInCart?.OrderQty + 1) *
|
||||||
isItemInCart?.OrderRate *
|
isItemInCart?.OrderRate *
|
||||||
isItemInCart?.TaxPercentage) /
|
isItemInCart?.TaxPercentage) /
|
||||||
(100 + isItemInCart?.TaxPercentage)
|
(100 + isItemInCart?.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
};
|
||||||
(isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
|
|
||||||
(
|
|
||||||
((isItemInCart?.OrderQty + 1) *
|
|
||||||
isItemInCart?.OrderRate *
|
|
||||||
isItemInCart?.TaxPercentage) /
|
|
||||||
(100 + isItemInCart?.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
};
|
|
||||||
|
|
||||||
const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem];
|
const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem];
|
||||||
|
|
||||||
|
|
@ -1098,27 +1098,27 @@ const BSBillingTable3 = (Props) => {
|
||||||
} else if (isItemInCartHold && OrderType === 'Hold') {
|
} else if (isItemInCartHold && OrderType === 'Hold') {
|
||||||
if (BillOrderPre === 'Y') {
|
if (BillOrderPre === 'Y') {
|
||||||
const UpdatedCartItem =
|
const UpdatedCartItem =
|
||||||
// if the item is already in the cart, increase the quantity of the item
|
// if the item is already in the cart, increase the quantity of the item
|
||||||
{
|
{
|
||||||
...isItemInCartHold,
|
...isItemInCartHold,
|
||||||
OrderQty: isItemInCartHold?.OrderQty + 1,
|
OrderQty: isItemInCartHold?.OrderQty + 1,
|
||||||
TotalAmt:
|
TotalAmt:
|
||||||
(isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate,
|
(isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((isItemInCartHold?.OrderQty + 1) *
|
||||||
|
isItemInCartHold?.OrderRate *
|
||||||
|
isItemInCartHold?.TaxPercentage) /
|
||||||
|
(100 + isItemInCartHold?.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate -
|
||||||
|
(
|
||||||
((isItemInCartHold?.OrderQty + 1) *
|
((isItemInCartHold?.OrderQty + 1) *
|
||||||
isItemInCartHold?.OrderRate *
|
isItemInCartHold?.OrderRate *
|
||||||
isItemInCartHold?.TaxPercentage) /
|
isItemInCartHold?.TaxPercentage) /
|
||||||
(100 + isItemInCartHold?.TaxPercentage)
|
(100 + isItemInCartHold?.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
};
|
||||||
(isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate -
|
|
||||||
(
|
|
||||||
((isItemInCartHold?.OrderQty + 1) *
|
|
||||||
isItemInCartHold?.OrderRate *
|
|
||||||
isItemInCartHold?.TaxPercentage) /
|
|
||||||
(100 + isItemInCartHold?.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
};
|
|
||||||
|
|
||||||
const UpdatedData = [
|
const UpdatedData = [
|
||||||
UpdatedCartItem,
|
UpdatedCartItem,
|
||||||
|
|
@ -1132,27 +1132,27 @@ const BSBillingTable3 = (Props) => {
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
const UpdatedCartItem =
|
const UpdatedCartItem =
|
||||||
// if the item is already in the cart, increase the quantity of the item
|
// if the item is already in the cart, increase the quantity of the item
|
||||||
{
|
{
|
||||||
...isItemInCartHold,
|
...isItemInCartHold,
|
||||||
OrderQty: isItemInCartHold?.OrderQty + 1,
|
OrderQty: isItemInCartHold?.OrderQty + 1,
|
||||||
TotalAmt:
|
TotalAmt:
|
||||||
(isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate,
|
(isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((isItemInCartHold?.OrderQty + 1) *
|
||||||
|
isItemInCartHold?.OrderRate *
|
||||||
|
isItemInCartHold?.TaxPercentage) /
|
||||||
|
(100 + isItemInCartHold?.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate -
|
||||||
|
(
|
||||||
((isItemInCartHold?.OrderQty + 1) *
|
((isItemInCartHold?.OrderQty + 1) *
|
||||||
isItemInCartHold?.OrderRate *
|
isItemInCartHold?.OrderRate *
|
||||||
isItemInCartHold?.TaxPercentage) /
|
isItemInCartHold?.TaxPercentage) /
|
||||||
(100 + isItemInCartHold?.TaxPercentage)
|
(100 + isItemInCartHold?.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
};
|
||||||
(isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate -
|
|
||||||
(
|
|
||||||
((isItemInCartHold?.OrderQty + 1) *
|
|
||||||
isItemInCartHold?.OrderRate *
|
|
||||||
isItemInCartHold?.TaxPercentage) /
|
|
||||||
(100 + isItemInCartHold?.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
};
|
|
||||||
|
|
||||||
const UpdatedData = [
|
const UpdatedData = [
|
||||||
...OtherorderDataforNormalWithoutSalesId,
|
...OtherorderDataforNormalWithoutSalesId,
|
||||||
|
|
@ -1990,9 +1990,9 @@ const BSBillingTable3 = (Props) => {
|
||||||
)?.map((item, idx) =>
|
)?.map((item, idx) =>
|
||||||
idx === 0
|
idx === 0
|
||||||
? {
|
? {
|
||||||
...item,
|
...item,
|
||||||
FreeQty,
|
FreeQty,
|
||||||
}
|
}
|
||||||
: item
|
: item
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
@ -3155,7 +3155,7 @@ const BSBillingTable3 = (Props) => {
|
||||||
} = section;
|
} = section;
|
||||||
|
|
||||||
if (!data?.length) return null;
|
if (!data?.length) return null;
|
||||||
|
console.log(data, "OrderCart")
|
||||||
// ── Disabled check ──────────────────────────────────────────────────────────
|
// ── Disabled check ──────────────────────────────────────────────────────────
|
||||||
const isDisabled = (item) => {
|
const isDisabled = (item) => {
|
||||||
if (isOld) {
|
if (isOld) {
|
||||||
|
|
@ -3395,8 +3395,8 @@ const BSBillingTable3 = (Props) => {
|
||||||
style={{ fontFamily: 'Poppins' }}
|
style={{ fontFamily: 'Poppins' }}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
item.FullProductIdentifierDtls?.length > 0 ||
|
item.FullProductIdentifierDtls?.length > 0 ||
|
||||||
item.ProductIdentifierDtls?.length > 0 ||
|
item.ProductIdentifierDtls?.length > 0 ||
|
||||||
imeiModal
|
imeiModal
|
||||||
? handleImeiDetails(item)
|
? handleImeiDetails(item)
|
||||||
: editField && handleEditQuantity(item, index)
|
: editField && handleEditQuantity(item, index)
|
||||||
}
|
}
|
||||||
|
|
@ -3427,7 +3427,7 @@ const BSBillingTable3 = (Props) => {
|
||||||
<p
|
<p
|
||||||
className={`offermessageTag ${!isMobile ? 'desktop' : ''}`}
|
className={`offermessageTag ${!isMobile ? 'desktop' : ''}`}
|
||||||
>
|
>
|
||||||
{item.OfferMessage?.split('>')?.[0] +
|
{item?.OfferModeType === true ? item.OfferMessage : item.OfferMessage?.split('>')?.[0] +
|
||||||
`> ${item?.OrderQty} Eligible Free`}
|
`> ${item?.OrderQty} Eligible Free`}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|
@ -3448,21 +3448,21 @@ const BSBillingTable3 = (Props) => {
|
||||||
{productBasedExtraCharges?.find(
|
{productBasedExtraCharges?.find(
|
||||||
(f) => f.ProdId === item.ProdId
|
(f) => f.ProdId === item.ProdId
|
||||||
) !== undefined && (
|
) !== undefined && (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
fontSize: '10px',
|
fontSize: '10px',
|
||||||
fontWeight: '500',
|
fontWeight: '500',
|
||||||
whiteSpace: 'nowrap',
|
whiteSpace: 'nowrap',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Extra Charges :{' '}
|
Extra Charges :{' '}
|
||||||
{
|
{
|
||||||
productBasedExtraCharges.find(
|
productBasedExtraCharges.find(
|
||||||
(f) => f.ProdId === item.ProdId
|
(f) => f.ProdId === item.ProdId
|
||||||
)?.TotalAmt
|
)?.TotalAmt
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2672,6 +2672,7 @@ const BSItemCard = (props) => {
|
||||||
let OfferNeedToApply = true;
|
let OfferNeedToApply = true;
|
||||||
let updatedFreeProductList = [];
|
let updatedFreeProductList = [];
|
||||||
let sameProduct = false;
|
let sameProduct = false;
|
||||||
|
let TotalDiscount = 0;
|
||||||
for (const offer of offers) {
|
for (const offer of offers) {
|
||||||
if (offer.OfferMode === 'B') {
|
if (offer.OfferMode === 'B') {
|
||||||
const {
|
const {
|
||||||
|
|
@ -2680,6 +2681,7 @@ const BSItemCard = (props) => {
|
||||||
OfferApply,
|
OfferApply,
|
||||||
updatedFreeProdList,
|
updatedFreeProdList,
|
||||||
ProductOfferType,
|
ProductOfferType,
|
||||||
|
otherTotalDiscount
|
||||||
} = applyBuyNGetFreeOffer(cartData, offer, item);
|
} = applyBuyNGetFreeOffer(cartData, offer, item);
|
||||||
|
|
||||||
offer.OfferAmount = OfferAmount;
|
offer.OfferAmount = OfferAmount;
|
||||||
|
|
@ -2687,6 +2689,7 @@ const BSItemCard = (props) => {
|
||||||
OfferNeedToApply = OfferApply;
|
OfferNeedToApply = OfferApply;
|
||||||
updatedFreeProductList = updatedFreeProdList;
|
updatedFreeProductList = updatedFreeProdList;
|
||||||
sameProduct = ProductOfferType;
|
sameProduct = ProductOfferType;
|
||||||
|
TotalDiscount = otherTotalDiscount;
|
||||||
}
|
}
|
||||||
if (!bestOffer || offer.OfferAmount > bestOffer.OfferAmount) {
|
if (!bestOffer || offer.OfferAmount > bestOffer.OfferAmount) {
|
||||||
bestOffer = offer;
|
bestOffer = offer;
|
||||||
|
|
@ -2702,9 +2705,9 @@ const BSItemCard = (props) => {
|
||||||
? bestOffer?.OfferAmount || item.Offer
|
? bestOffer?.OfferAmount || item.Offer
|
||||||
: item.Offer || bestOffer?.OfferAmount,
|
: item.Offer || bestOffer?.OfferAmount,
|
||||||
OfferType: item?.OfferType || bestOffer?.OfferType,
|
OfferType: item?.OfferType || bestOffer?.OfferType,
|
||||||
OfferMessage: item?.OfferMessage || bestOffer?.OfferMessage,
|
OfferMessage: sameProduct ? (bestOffer?.OfferMessage || item?.OfferMessage) : (item?.OfferMessage || bestOffer?.OfferMessage),
|
||||||
OfferMode: item?.OfferMode || bestOffer?.OfferMode,
|
OfferMode: item?.OfferMode || bestOffer?.OfferMode,
|
||||||
OfferModeType: sameProduct,
|
OfferModeType: sameProduct
|
||||||
};
|
};
|
||||||
|
|
||||||
const shouldRemove = (c) =>
|
const shouldRemove = (c) =>
|
||||||
|
|
@ -2729,6 +2732,12 @@ const BSItemCard = (props) => {
|
||||||
: [...filteredCart, UpdatedCartItemWithOffer];
|
: [...filteredCart, UpdatedCartItemWithOffer];
|
||||||
|
|
||||||
if (bestOffer && OfferNeedToApply) {
|
if (bestOffer && OfferNeedToApply) {
|
||||||
|
if (TotalDiscount > 0) {
|
||||||
|
bestOffer = {
|
||||||
|
...bestOffer,
|
||||||
|
OfferAmount: TotalDiscount
|
||||||
|
}
|
||||||
|
}
|
||||||
dispatch(ChangeOfferAppliedProducts(bestOffer));
|
dispatch(ChangeOfferAppliedProducts(bestOffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3118,6 +3127,7 @@ const BSItemCard = (props) => {
|
||||||
|
|
||||||
function applyBuyNGetFreeOffer(cartItem, offer, item) {
|
function applyBuyNGetFreeOffer(cartItem, offer, item) {
|
||||||
const freeList = offer.FreeProductsList || [];
|
const freeList = offer.FreeProductsList || [];
|
||||||
|
let otherTotalDiscount = 0;
|
||||||
let totalDiscount = 0;
|
let totalDiscount = 0;
|
||||||
let offerMessage = '';
|
let offerMessage = '';
|
||||||
let OfferApply = true;
|
let OfferApply = true;
|
||||||
|
|
@ -3171,20 +3181,45 @@ const BSItemCard = (props) => {
|
||||||
0.5;
|
0.5;
|
||||||
sameProductOffer = true;
|
sameProductOffer = true;
|
||||||
} else if (isSameProduct) {
|
} else if (isSameProduct) {
|
||||||
// 🔥 Buy N Get M (same product)
|
// 🔥 Buy N Get N (same product)
|
||||||
const buyQty = offer.BuyQty || 1;
|
const totalQty = freeCartItem?.reduce(
|
||||||
|
(acc, fc) => acc + (fc?.OrderQty || 0),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
const buyQty = offer.MinQty || 1;
|
||||||
const getQty = freeProd.FreeQty || 0;
|
const getQty = freeProd.FreeQty || 0;
|
||||||
|
|
||||||
const cycleSize = buyQty + getQty;
|
const groupSize = buyQty + getQty;
|
||||||
const fullCycles = Math.floor(
|
|
||||||
freeCartItem?.reduce((acc, fc) => acc + (fc?.OrderQty || 0), 0) /
|
// ✅ Discount logic (your existing correct logic)
|
||||||
cycleSize
|
const paidQty = Math.ceil(totalQty / groupSize);
|
||||||
);
|
const totalFreeQty = totalQty - paidQty;
|
||||||
const totalFreeQty = fullCycles * getQty;
|
|
||||||
|
|
||||||
totalDiscount += totalFreeQty * freeCartItem?.[0].OrderRate;
|
totalDiscount += totalFreeQty * freeCartItem?.[0].OrderRate;
|
||||||
|
|
||||||
|
// check the offer applied for same product in different booking type
|
||||||
|
const differentBookTypeProd = freeCartItem?.filter((prod) => prod?.BookingTypeName !== item?.BookingTypeName && (prod?.Offer || 0) > 0 && prod?.OfferMode === offer?.OfferMode);
|
||||||
|
if (differentBookTypeProd?.length > 0) {
|
||||||
|
const diffBookTypeDis = differentBookTypeProd?.reduce(
|
||||||
|
(acc, fc) => acc + (fc?.Offer || 0),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
otherTotalDiscount = totalDiscount;
|
||||||
|
totalDiscount = totalDiscount - diffBookTypeDis;
|
||||||
|
}
|
||||||
|
|
||||||
sameProductOffer = true;
|
sameProductOffer = true;
|
||||||
// offerMessage = `${freeProd.FreeProdName} -> ${Math.ceil(totalFreeQty / 2)} qty Free Eligible`;
|
|
||||||
|
// ✅ Message logic (NEW)
|
||||||
|
const messageGroups = Math.ceil(totalQty / groupSize);
|
||||||
|
const eligibleFreeQty = messageGroups * getQty;
|
||||||
|
|
||||||
|
|
||||||
|
offerMessage = `${freeProd.FreeProdName} -> ${eligibleFreeQty} Eligible Free`;
|
||||||
|
// offerMessage = `${freeProd.FreeProdName} ->
|
||||||
|
// ( ${paidQty} Paid + ${eligibleFreeQty} Free Eligible ). \n
|
||||||
|
// saved ₹${otherTotalDiscount > 0 ? otherTotalDiscount : totalDiscount}`;
|
||||||
} else {
|
} else {
|
||||||
// 🔥 Different product free
|
// 🔥 Different product free
|
||||||
const buyQty = offer.BuyQty || 1;
|
const buyQty = offer.BuyQty || 1;
|
||||||
|
|
@ -3284,6 +3319,7 @@ const BSItemCard = (props) => {
|
||||||
OfferApply: OfferApply,
|
OfferApply: OfferApply,
|
||||||
updatedFreeProdList: updatedFreeProdList,
|
updatedFreeProdList: updatedFreeProdList,
|
||||||
ProductOfferType: sameProductOffer ? true : false,
|
ProductOfferType: sameProductOffer ? true : false,
|
||||||
|
otherTotalDiscount: otherTotalDiscount,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue