Merge pull request 'priceoveride' (#233) from priceoverride into main
Reviewed-on: Pozomind/pozo-retail-app#233
This commit is contained in:
commit
18121bc48b
|
|
@ -12,9 +12,6 @@ import {
|
||||||
GlobalReorderProductDetails,
|
GlobalReorderProductDetails,
|
||||||
PreferenceData,
|
PreferenceData,
|
||||||
getConfigType,
|
getConfigType,
|
||||||
changefocusStatusCust,
|
|
||||||
changeCombofocus,
|
|
||||||
GlobalfocusStatusCust,
|
|
||||||
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
|
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
import { ArrowRightOutlined } from '@ant-design/icons';
|
import { ArrowRightOutlined } from '@ant-design/icons';
|
||||||
import { Messages } from '../../../../../Components/Notifications/Messages';
|
import { Messages } from '../../../../../Components/Notifications/Messages';
|
||||||
|
|
@ -49,13 +46,15 @@ import { calculateOverAllQtyLimit } from '../../../../../utils/calculations.js';
|
||||||
const BSBillingEditQuantity = (props) => {
|
const BSBillingEditQuantity = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const formRef = useRef(null);
|
const formRef = useRef(null);
|
||||||
|
const detailedFormRef = useRef(null);
|
||||||
|
const itemDiscountFormRef = useRef(null);
|
||||||
const quantityInputRef = useRef(null);
|
const quantityInputRef = useRef(null);
|
||||||
const priceChangeInputRef = useRef(null);
|
const priceChangeInputRef = useRef(null);
|
||||||
const reductionInputRef = useRef(null);
|
const reductionInputRef = useRef(null);
|
||||||
|
|
||||||
const { setIndex = () => { } } = props;
|
const { setIndex = () => { } } = props;
|
||||||
|
|
||||||
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
|
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
|
||||||
|
console.log(disableSubmitButton, "disableSubmitButton")
|
||||||
const SessionData = useSelector(StoredSessionData);
|
const SessionData = useSelector(StoredSessionData);
|
||||||
// const AppId = SessionData?.AppId;
|
// const AppId = SessionData?.AppId;
|
||||||
// const CompId = SessionData?.CompId;
|
// const CompId = SessionData?.CompId;
|
||||||
|
|
@ -69,24 +68,13 @@ const BSBillingEditQuantity = (props) => {
|
||||||
shallowEqual
|
shallowEqual
|
||||||
);
|
);
|
||||||
|
|
||||||
const overAllLimitPreferenece = preferenceDatas?.[0]?.[
|
const overAllLimitPreferenece =
|
||||||
'SettingDtlDetails'
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
]?.find(
|
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||||
(item) =>
|
const itemWiseLimitPreferenece =
|
||||||
item.SettingIdName?.toLowerCase() === 'overalllimit' &&
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
item?.SettingValue === 'Y'
|
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y');
|
||||||
);
|
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null;
|
||||||
const itemWiseLimitPreferenece = preferenceDatas?.[0]?.[
|
|
||||||
'SettingDtlDetails'
|
|
||||||
]?.find(
|
|
||||||
(item) =>
|
|
||||||
item.SettingIdName?.toLowerCase() === 'itemwiselimit' &&
|
|
||||||
item?.SettingValue === 'Y'
|
|
||||||
);
|
|
||||||
const maxQtyLimit =
|
|
||||||
itemWiseLimitPreferenece?.SettingCount ||
|
|
||||||
overAllLimitPreferenece?.SettingCount ||
|
|
||||||
null;
|
|
||||||
const preferenceOffer =
|
const preferenceOffer =
|
||||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
(item) => item.SettingIdName === 'Offer'
|
(item) => item.SettingIdName === 'Offer'
|
||||||
|
|
@ -100,7 +88,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
);
|
);
|
||||||
console.log(preferenceshortcutkey, 'preferenceshortcutkey');
|
console.log(preferenceshortcutkey, 'preferenceshortcutkey');
|
||||||
const [PriceChangeaccess, setPriceChangeaccess] = useState(true);
|
const [PriceChangeaccess, setPriceChangeaccess] = useState(true);
|
||||||
const selectStatuscust = useSelector(GlobalfocusStatusCust);
|
|
||||||
const [ConfigDataList, setConfigDataList] = useState([]);
|
const [ConfigDataList, setConfigDataList] = useState([]);
|
||||||
const [messageType, setMessageType] = useState(null);
|
const [messageType, setMessageType] = useState(null);
|
||||||
const [messageData, setMessageData] = useState(null);
|
const [messageData, setMessageData] = useState(null);
|
||||||
|
|
@ -129,7 +117,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
price: 'Price',
|
price: 'Price',
|
||||||
quantity: 'qty',
|
quantity: 'qty',
|
||||||
Parcel: 'Parcel',
|
Parcel: 'Parcel',
|
||||||
weightAmount: 'weightAmount',
|
weightAmount: 'weightAmount'
|
||||||
};
|
};
|
||||||
const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
if (props?.shortKeyMethod && SHORTKEY_TO_RADIO[props.shortKeyMethod]) {
|
if (props?.shortKeyMethod && SHORTKEY_TO_RADIO[props.shortKeyMethod]) {
|
||||||
|
|
@ -155,6 +143,8 @@ const BSBillingEditQuantity = (props) => {
|
||||||
const [PercentageSelection, setPercentageSelection] = useState('Fixed');
|
const [PercentageSelection, setPercentageSelection] = useState('Fixed');
|
||||||
const [RadioDetails, setRadioDetails] = useState(false);
|
const [RadioDetails, setRadioDetails] = useState(false);
|
||||||
const [editedPrice, setEditedPrice] = useState(0);
|
const [editedPrice, setEditedPrice] = useState(0);
|
||||||
|
const [itemDiscountPercentageSelection, setItemDiscountPercentageSelection] = useState('Fixed');
|
||||||
|
const [itemDiscountPrice, setItemDiscountPrice] = useState(0);
|
||||||
const allowDecimal = preferenceDatas?.[0]?.SettingDtlDetails?.find(
|
const allowDecimal = preferenceDatas?.[0]?.SettingDtlDetails?.find(
|
||||||
(setting) =>
|
(setting) =>
|
||||||
setting?.SettingIdName?.toLowerCase() === 'decimal' &&
|
setting?.SettingIdName?.toLowerCase() === 'decimal' &&
|
||||||
|
|
@ -170,7 +160,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
shallowEqual
|
shallowEqual
|
||||||
);
|
);
|
||||||
const FreeProdList = useSelector(GlobalFreeProdList);
|
const FreeProdList = useSelector(GlobalFreeProdList);
|
||||||
console.log(CartOrderDetails, 'CartOrderDetails');
|
console.log(editedPrice, 'editedPrice');
|
||||||
|
|
||||||
const TakAwayId = ConfigDataList?.find(
|
const TakAwayId = ConfigDataList?.find(
|
||||||
(a) => a?.ConfigName === 'TakeAway'
|
(a) => a?.ConfigName === 'TakeAway'
|
||||||
|
|
@ -197,9 +187,9 @@ const BSBillingEditQuantity = (props) => {
|
||||||
? parseInt(props.Productdata.OrderQty)
|
? parseInt(props.Productdata.OrderQty)
|
||||||
: props.Productdata.OrderQty
|
: props.Productdata.OrderQty
|
||||||
);
|
);
|
||||||
|
SellingPriceChange(parseFloat(props.Productdata?.SellingPrice || 0));
|
||||||
},
|
},
|
||||||
[props.BSBillingEditQuantity],
|
[props.BSBillingEditQuantity, props.Productdata]
|
||||||
[props.Productdata]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -278,6 +268,13 @@ const BSBillingEditQuantity = (props) => {
|
||||||
}
|
}
|
||||||
}, [PackageDtl]);
|
}, [PackageDtl]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (RadioBtnSelection === 'Price' && !RadioDetails) {
|
||||||
|
setEditedPrice(parseFloat(props.Productdata?.SellingPrice || 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
}, [RadioBtnSelection, RadioDetails]);
|
||||||
|
|
||||||
const getBookingTypeId = async () => {
|
const getBookingTypeId = async () => {
|
||||||
let tempconfigdata = await dispatch(
|
let tempconfigdata = await dispatch(
|
||||||
getConfigType({ TypeName: 'Booking Type' })
|
getConfigType({ TypeName: 'Booking Type' })
|
||||||
|
|
@ -316,9 +313,12 @@ const BSBillingEditQuantity = (props) => {
|
||||||
setQuantity(tempremovedata);
|
setQuantity(tempremovedata);
|
||||||
};
|
};
|
||||||
const openRadioDetails = () => {
|
const openRadioDetails = () => {
|
||||||
setDisableSubmitButton(false);
|
// setDisableSubmitButton(false);
|
||||||
setRadioDetails(!RadioDetails);
|
setRadioDetails(!RadioDetails);
|
||||||
setEditedPrice(0);
|
setEditedPrice(0);
|
||||||
|
// Clear ItemDiscount field and reset discount price
|
||||||
|
setItemDiscountPrice(0);
|
||||||
|
itemDiscountFormRef.current?.resetFields();
|
||||||
};
|
};
|
||||||
|
|
||||||
// const AddQuantityonly = () => {
|
// const AddQuantityonly = () => {
|
||||||
|
|
@ -357,6 +357,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const calculateOverAllQty = (item, filterItems) => {
|
const calculateOverAllQty = (item, filterItems) => {
|
||||||
|
|
||||||
if (!item) return 0;
|
if (!item) return 0;
|
||||||
|
|
||||||
const totalUsedQty =
|
const totalUsedQty =
|
||||||
|
|
@ -437,7 +438,8 @@ const BSBillingEditQuantity = (props) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const AddProductQuantity = async () => {
|
const AddProductQuantity = async () => {
|
||||||
let newPrice = editedPrice > 0 ? editedPrice : props.Productdata.OrderRate;
|
let disCountprice = editedPrice - itemDiscountPrice
|
||||||
|
let newPrice = safeRound(disCountprice > 0 ? disCountprice : props.Productdata.OrderRate);
|
||||||
await dispatch(changeHoldOrderDtl(false));
|
await dispatch(changeHoldOrderDtl(false));
|
||||||
await dispatch(changePreviousOrderLength(CartOrderDetails?.length));
|
await dispatch(changePreviousOrderLength(CartOrderDetails?.length));
|
||||||
|
|
||||||
|
|
@ -459,18 +461,11 @@ const BSBillingEditQuantity = (props) => {
|
||||||
);
|
);
|
||||||
const editedProduct = CartOrderDetails[editedProductIndex];
|
const editedProduct = CartOrderDetails[editedProductIndex];
|
||||||
|
|
||||||
if (
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
(overAllLimitPreferenece || itemWiseLimitPreferenece) &&
|
|
||||||
maxQtyLimit
|
|
||||||
) {
|
|
||||||
if (overAllLimitPreferenece) {
|
if (overAllLimitPreferenece) {
|
||||||
const calculatedOverAllQty = calculateOverAllQtyLimit(
|
const calculatedOverAllQty = calculateOverAllQtyLimit(CartOrderDetails?.filter((_, index) => index !== editedProductIndex));
|
||||||
CartOrderDetails?.filter((_, index) => index !== editedProductIndex)
|
if ((calculatedOverAllQty + editedQty) > maxQtyLimit) {
|
||||||
);
|
setMessageData(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||||
if (calculatedOverAllQty + editedQty > maxQtyLimit) {
|
|
||||||
setMessageData(
|
|
||||||
`Overall Quantity Limit Exceeds than ${maxQtyLimit}`
|
|
||||||
);
|
|
||||||
setMessageType('warning');
|
setMessageType('warning');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -742,8 +737,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
newPrice,
|
newPrice,
|
||||||
overrideQty = null
|
overrideQty = null
|
||||||
) => {
|
) => {
|
||||||
const editedQty =
|
const editedQty = overrideQty !== null
|
||||||
overrideQty !== null
|
|
||||||
? overrideQty
|
? overrideQty
|
||||||
: props?.Productdata?.ScaleType !== 'weight'
|
: props?.Productdata?.ScaleType !== 'weight'
|
||||||
? parseInt(Quantity)
|
? parseInt(Quantity)
|
||||||
|
|
@ -3175,6 +3169,26 @@ const BSBillingEditQuantity = (props) => {
|
||||||
...(offerApply && {
|
...(offerApply && {
|
||||||
Offer: qty * (newPrice > 0 ? newPrice : editedProduct?.OrderRate),
|
Offer: qty * (newPrice > 0 ? newPrice : editedProduct?.OrderRate),
|
||||||
}),
|
}),
|
||||||
|
...(
|
||||||
|
!offerApply && itemDiscountPrice > 0
|
||||||
|
? {
|
||||||
|
DiscountAmt: safeRound(itemDiscountPrice),
|
||||||
|
DiscountType: itemDiscountPercentageSelection === 'Fixed' ? 'F' : 'P',
|
||||||
|
DiscountValue:
|
||||||
|
itemDiscountPercentageSelection === 'Fixed'
|
||||||
|
? itemDiscountPrice
|
||||||
|
: (
|
||||||
|
(itemDiscountPrice /
|
||||||
|
(newPrice > 0 ? newPrice : editedProduct?.OrderRate)) * 100
|
||||||
|
)
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
DiscountAmt: null,
|
||||||
|
DiscountType: null,
|
||||||
|
DiscountValue: null
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (hasOffer) {
|
if (hasOffer) {
|
||||||
|
|
@ -3234,6 +3248,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
OfferMessage: updatedProduct?.OfferMessage || bestOffer?.OfferMessage,
|
OfferMessage: updatedProduct?.OfferMessage || bestOffer?.OfferMessage,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
console.log(updatedProduct, 'updatedProduct');
|
console.log(updatedProduct, 'updatedProduct');
|
||||||
|
|
||||||
const shouldRemove = (c) =>
|
const shouldRemove = (c) =>
|
||||||
|
|
@ -3313,11 +3328,52 @@ const BSBillingEditQuantity = (props) => {
|
||||||
const onPercentageSelectionChange = (data) => {
|
const onPercentageSelectionChange = (data) => {
|
||||||
setPercentageSelection(data);
|
setPercentageSelection(data);
|
||||||
setEditedPrice(0);
|
setEditedPrice(0);
|
||||||
formRef.current?.resetFields();
|
detailedFormRef.current?.resetFields();
|
||||||
setDisableSubmitButton(false);
|
setDisableSubmitButton(false);
|
||||||
};
|
};
|
||||||
|
const onItemDiscountPercentageChange = (data) => {
|
||||||
|
setItemDiscountPercentageSelection(data);
|
||||||
|
setItemDiscountPrice(0);
|
||||||
|
itemDiscountFormRef.current?.resetFields();
|
||||||
|
};
|
||||||
|
const ItemDiscountChangefun = (data) => {
|
||||||
|
|
||||||
|
const enteredDiscount = parseFloat(data?.target.value);
|
||||||
|
|
||||||
|
if (enteredDiscount) {
|
||||||
|
let roundedrice = safeRound(editedPrice ? editedPrice : 0)
|
||||||
|
const sellingPrice = parseFloat(roundedrice || props.Productdata?.SellingPrice || 0);
|
||||||
|
if (itemDiscountPercentageSelection === 'Fixed') {
|
||||||
|
if (parseFloat(enteredDiscount) < parseFloat(sellingPrice)) {
|
||||||
|
setItemDiscountPrice(parseFloat(enteredDiscount));
|
||||||
|
} else {
|
||||||
|
setMessageType('error');
|
||||||
|
setMessageData('Discount cannot exceed selling price');
|
||||||
|
setItemDiscountPrice(0);
|
||||||
|
itemDiscountFormRef.current?.resetFields();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (parseFloat(enteredDiscount) < 100) {
|
||||||
|
let discountAmt = (parseFloat(enteredDiscount) * parseFloat(sellingPrice)) / 100;
|
||||||
|
setItemDiscountPrice(parseFloat(discountAmt));
|
||||||
|
} else {
|
||||||
|
setMessageType('error');
|
||||||
|
setMessageData('Percentage cannot exceed 100%');
|
||||||
|
setItemDiscountPrice(0);
|
||||||
|
itemDiscountFormRef.current?.resetFields();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setItemDiscountPrice(0);
|
||||||
|
}
|
||||||
|
};
|
||||||
const PriceChangefun = (data) => {
|
const PriceChangefun = (data) => {
|
||||||
const enteredDiscount = parseFloat(data?.target.value);
|
const enteredDiscount = parseFloat(data?.target.value);
|
||||||
|
|
||||||
|
// Clear ItemDiscount field and reset discount price
|
||||||
|
setItemDiscountPrice(0);
|
||||||
|
itemDiscountFormRef.current?.resetFields();
|
||||||
|
|
||||||
if (enteredDiscount) {
|
if (enteredDiscount) {
|
||||||
const sellingPrice = parseFloat(props.Productdata?.SellingPrice || 0);
|
const sellingPrice = parseFloat(props.Productdata?.SellingPrice || 0);
|
||||||
const limit = parseFloat(props.Productdata?.DiscountLimit || 0);
|
const limit = parseFloat(props.Productdata?.DiscountLimit || 0);
|
||||||
|
|
@ -3429,11 +3485,15 @@ const BSBillingEditQuantity = (props) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const SellingPriceChange = (data) => {
|
const SellingPriceChange = (data) => {
|
||||||
if (data?.target.value) {
|
if (data) {
|
||||||
const sellingPrice = parseFloat(props.Productdata?.SellingPrice || 0);
|
const sellingPrice = parseFloat(props.Productdata?.SellingPrice || 0);
|
||||||
const limit = parseFloat(props.Productdata?.DiscountLimit || 0);
|
const limit = parseFloat(props.Productdata?.DiscountLimit || 0);
|
||||||
const limitType = props.Productdata?.DiscountLimitType;
|
const limitType = props.Productdata?.DiscountLimitType;
|
||||||
const enteredDiscount = parseFloat(data?.target.value);
|
const enteredDiscount = parseFloat(data);
|
||||||
|
|
||||||
|
// Clear ItemDiscount field and reset discount price
|
||||||
|
setItemDiscountPrice(0);
|
||||||
|
itemDiscountFormRef.current?.resetFields();
|
||||||
|
|
||||||
if (limit === null || limit === undefined || limit === 0) {
|
if (limit === null || limit === undefined || limit === 0) {
|
||||||
// if (
|
// if (
|
||||||
|
|
@ -3441,6 +3501,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
// parseFloat(enteredDiscount) === parseFloat(sellingPrice)
|
// parseFloat(enteredDiscount) === parseFloat(sellingPrice)
|
||||||
// ) {
|
// ) {
|
||||||
setEditedPrice(enteredDiscount);
|
setEditedPrice(enteredDiscount);
|
||||||
|
formRef.current?.setFieldsValue({ SellPrice: enteredDiscount });
|
||||||
setDisableSubmitButton(true);
|
setDisableSubmitButton(true);
|
||||||
// } else {
|
// } else {
|
||||||
// setMessageType('error');
|
// setMessageType('error');
|
||||||
|
|
@ -3461,7 +3522,8 @@ const BSBillingEditQuantity = (props) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enteredDiscount === maxDiscount) {
|
if (enteredDiscount === maxDiscount) {
|
||||||
setEditedPrice(data?.target.value);
|
setEditedPrice(data);
|
||||||
|
formRef.current?.setFieldsValue({ SellPrice: data });
|
||||||
setDisableSubmitButton(true);
|
setDisableSubmitButton(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -3470,14 +3532,20 @@ const BSBillingEditQuantity = (props) => {
|
||||||
setMessageType('error');
|
setMessageType('error');
|
||||||
setMessageData(`You cannot sell below ₹${maxDiscount.toFixed(2)}`);
|
setMessageData(`You cannot sell below ₹${maxDiscount.toFixed(2)}`);
|
||||||
setEditedPrice(0);
|
setEditedPrice(0);
|
||||||
|
formRef.current?.setFieldsValue({ SellPrice: 0 });
|
||||||
setDisableSubmitButton(false);
|
setDisableSubmitButton(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setDisableSubmitButton(true);
|
setDisableSubmitButton(true);
|
||||||
setEditedPrice(data?.target.value);
|
setEditedPrice(data);
|
||||||
|
formRef.current?.setFieldsValue({ SellPrice: data });
|
||||||
} else {
|
} else {
|
||||||
setDisableSubmitButton(false);
|
setDisableSubmitButton(false);
|
||||||
setEditedPrice(0);
|
setEditedPrice(0);
|
||||||
|
formRef.current?.setFieldsValue({ SellPrice: 0 });
|
||||||
|
// Clear ItemDiscount field and reset discount price
|
||||||
|
setItemDiscountPrice(0);
|
||||||
|
itemDiscountFormRef.current?.resetFields();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -3502,21 +3570,16 @@ const BSBillingEditQuantity = (props) => {
|
||||||
);
|
);
|
||||||
const editedProduct = {
|
const editedProduct = {
|
||||||
...CartOrderDetails[editedProductIndex],
|
...CartOrderDetails[editedProductIndex],
|
||||||
OrderQty: qty,
|
OrderQty: qty
|
||||||
};
|
};
|
||||||
|
|
||||||
await handleEditQuantity(
|
await handleEditQuantity(editedProduct, editedProductIndex, editedProduct.OrderRate, qty);
|
||||||
editedProduct,
|
|
||||||
editedProductIndex,
|
|
||||||
editedProduct.OrderRate,
|
|
||||||
qty
|
|
||||||
);
|
|
||||||
props.handleEditQuantityCancel();
|
props.handleEditQuantityCancel();
|
||||||
setClearQuantity(false);
|
setClearQuantity(false);
|
||||||
};
|
};
|
||||||
const isKg =
|
const isKg =
|
||||||
props?.Productdata?.Size == 1 &&
|
props?.Productdata?.Size == 1 &&
|
||||||
['KG', 'KGS'].includes(props?.Productdata?.UomName?.toUpperCase());
|
["KG", "KGS"].includes(props?.Productdata?.UomName?.toUpperCase());
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="BSBilling-EditQuantity-Modal">
|
<div className="BSBilling-EditQuantity-Modal">
|
||||||
|
|
@ -3599,7 +3662,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Price Change
|
OverRide / Discount
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
@ -3615,8 +3678,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
Packing
|
Packing
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{isKg && (
|
{isKg && (<button
|
||||||
<button
|
|
||||||
type="button"
|
type="button"
|
||||||
className={
|
className={
|
||||||
RadioBtnSelection === 'weightAmount'
|
RadioBtnSelection === 'weightAmount'
|
||||||
|
|
@ -3626,19 +3688,13 @@ const BSBillingEditQuantity = (props) => {
|
||||||
onClick={() => onRadioBtnChange('weightAmount')}
|
onClick={() => onRadioBtnChange('weightAmount')}
|
||||||
>
|
>
|
||||||
Weight / Amount
|
Weight / Amount
|
||||||
</button>
|
</button>)}
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{RadioBtnSelection == 'Quantity' && (
|
{RadioBtnSelection == 'Quantity' && (
|
||||||
<>
|
<>
|
||||||
<div
|
<div className="EditQuantity-Quantity">
|
||||||
className="EditQuantity-Quantity"
|
|
||||||
onBlur={() => {
|
|
||||||
dispatch(changefocusStatusCust(!selectStatuscust));
|
|
||||||
dispatch(changeCombofocus(false));
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<label className="EditQuantity-itemname">
|
<label className="EditQuantity-itemname">
|
||||||
Item Quantity:
|
Item Quantity:
|
||||||
</label>
|
</label>
|
||||||
|
|
@ -3647,10 +3703,6 @@ const BSBillingEditQuantity = (props) => {
|
||||||
type="number"
|
type="number"
|
||||||
value={Quantity}
|
value={Quantity}
|
||||||
onChange={(e) => setQuantity(e.target.value)}
|
onChange={(e) => setQuantity(e.target.value)}
|
||||||
onBlur={() => {
|
|
||||||
dispatch(changefocusStatusCust(!selectStatuscust));
|
|
||||||
dispatch(changeCombofocus(false));
|
|
||||||
}}
|
|
||||||
className="EditQuantity-Quantitybox"
|
className="EditQuantity-Quantitybox"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
|
|
@ -3700,6 +3752,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{RadioBtnSelection == 'Price' && (
|
{RadioBtnSelection == 'Price' && (
|
||||||
|
<div style={{ display: "flex" }} >
|
||||||
<div className="EditQuantity-PriceChange">
|
<div className="EditQuantity-PriceChange">
|
||||||
<label className="EditQuantity-itemname">
|
<label className="EditQuantity-itemname">
|
||||||
Item Price: {safeRound(props.Productdata.SellingPrice)} /
|
Item Price: {safeRound(props.Productdata.SellingPrice)} /
|
||||||
|
|
@ -3707,8 +3760,10 @@ const BSBillingEditQuantity = (props) => {
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
{!RadioDetails && (
|
{!RadioDetails && (
|
||||||
|
<Form ref={formRef}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="SellPrice"
|
name="SellPrice"
|
||||||
|
initialValue={editedPrice}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
pattern: /^(0\d+|[1-9]\d*)(\.\d+)?$/,
|
pattern: /^(0\d+|[1-9]\d*)(\.\d+)?$/,
|
||||||
|
|
@ -3732,10 +3787,11 @@ const BSBillingEditQuantity = (props) => {
|
||||||
<InputField
|
<InputField
|
||||||
ref={priceChangeInputRef}
|
ref={priceChangeInputRef}
|
||||||
value={editedPrice}
|
value={editedPrice}
|
||||||
label="Selling Price"
|
label="Price Override"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
onChange={SellingPriceChange}
|
onChange={(e) => { SellingPriceChange(e?.target?.value) }}
|
||||||
inputMode="decimal"
|
inputMode="decimal"
|
||||||
|
isOnChange={editedPrice > 0 ? true : false}
|
||||||
onInput={(e) => {
|
onInput={(e) => {
|
||||||
const cleanedValue = e.target.value.replace(
|
const cleanedValue = e.target.value.replace(
|
||||||
/[^0-9.]/g,
|
/[^0-9.]/g,
|
||||||
|
|
@ -3750,6 +3806,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
|
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="prodAddDetails" onClick={openRadioDetails}>
|
<div className="prodAddDetails" onClick={openRadioDetails}>
|
||||||
|
|
@ -3771,12 +3828,13 @@ const BSBillingEditQuantity = (props) => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="EditQuantity-Quantity">
|
<div className="EditQuantity-Quantity">
|
||||||
<Form ref={formRef}>
|
<Form ref={detailedFormRef}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="SellPrice"
|
name="SellPrice"
|
||||||
|
initialValue={editedPrice}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
pattern: /^[1-9]\d*(\.\d+)?$/,
|
pattern: /^[0-9]\d*(\.\d+)?$/,
|
||||||
message: 'Please Enter Number Only',
|
message: 'Please Enter Number Only',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -3799,6 +3857,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
onChange={(e) => PriceChangefun(e)}
|
onChange={(e) => PriceChangefun(e)}
|
||||||
inputMode="decimal"
|
inputMode="decimal"
|
||||||
|
isOnChange={editedPrice > 0 ? true : false}
|
||||||
onInput={(e) => {
|
onInput={(e) => {
|
||||||
const cleanedValue = e.target.value.replace(
|
const cleanedValue = e.target.value.replace(
|
||||||
/[^0-9.]/g,
|
/[^0-9.]/g,
|
||||||
|
|
@ -3819,15 +3878,89 @@ const BSBillingEditQuantity = (props) => {
|
||||||
/> */}
|
/> */}
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
<div className="EditQuantity-Quantity">
|
{editedPrice > 0 && <div className="EditQuantity-Quantity">
|
||||||
<div className="EditQuantity-itemname">
|
<div className="EditQuantity-itemname">
|
||||||
{' '}
|
{' '}
|
||||||
Price: {safeRound(editedPrice ? editedPrice : 0)}
|
Price: {safeRound(editedPrice ? editedPrice : 0)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div style={{ borderLeft: "1px solid #ddd", paddingLeft: "15px", marginLeft: "15px" }}>
|
||||||
|
<label className="EditQuantity-itemname">
|
||||||
|
Item Discount
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<>
|
||||||
|
<div className="EditQuantity-Quantity">
|
||||||
|
<RadioGrpButton
|
||||||
|
content={[
|
||||||
|
{ value: 'Fixed', label: 'Fixed' },
|
||||||
|
{ value: 'Percentage', label: 'Percentage' },
|
||||||
|
]}
|
||||||
|
fieldState={true}
|
||||||
|
defaultSelect={itemDiscountPercentageSelection}
|
||||||
|
onSelectFuntion={(e) => {
|
||||||
|
onItemDiscountPercentageChange(e);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="EditQuantity-Quantity">
|
||||||
|
<Form ref={itemDiscountFormRef}>
|
||||||
|
<Form.Item
|
||||||
|
name="ItemDiscount"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
pattern: /^[1-9]\d*(\.\d+)?$/,
|
||||||
|
message: 'Please Enter Number Only',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
validator: async (_, value) => {
|
||||||
|
await validateSafeInput(value);
|
||||||
|
return Promise.resolve();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<InputField
|
||||||
|
field="ItemDiscount"
|
||||||
|
name="ItemDiscount"
|
||||||
|
value={itemDiscountPrice}
|
||||||
|
label="Discount Amount"
|
||||||
|
fieldState={true}
|
||||||
|
fieldApi={true}
|
||||||
|
autocomplete="off"
|
||||||
|
onChange={(e) => ItemDiscountChangefun(e)}
|
||||||
|
inputMode="decimal"
|
||||||
|
onInput={(e) => {
|
||||||
|
const cleanedValue = e.target.value.replace(
|
||||||
|
/[^0-9.]/g,
|
||||||
|
''
|
||||||
|
);
|
||||||
|
const parts = cleanedValue.split('.');
|
||||||
|
e.target.value =
|
||||||
|
parts.length > 2
|
||||||
|
? `${parts[0]}.${parts.slice(1).join('')}`
|
||||||
|
: cleanedValue;
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
</div>
|
||||||
|
{itemDiscountPrice > 0 && editedPrice > 0 && <div className="EditQuantity-Quantity">
|
||||||
|
<div className="EditQuantity-itemname">
|
||||||
|
{' '}
|
||||||
|
{console.log(editedPrice, itemDiscountPrice, "itemDiscountPrice")}
|
||||||
|
Final Price: {safeRound(editedPrice) - (itemDiscountPrice || 0)}
|
||||||
|
</div>
|
||||||
|
</div>}
|
||||||
|
</>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
)}
|
)}
|
||||||
{RadioBtnSelection == 'Parcel' && (
|
{RadioBtnSelection == 'Parcel' && (
|
||||||
<>
|
<>
|
||||||
|
|
@ -3843,7 +3976,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{RadioBtnSelection == 'weightAmount' && isKg && (
|
{(RadioBtnSelection == 'weightAmount') && isKg && (
|
||||||
<>
|
<>
|
||||||
<WeightCalculatePrice
|
<WeightCalculatePrice
|
||||||
CartOrderDetails={CartOrderDetails}
|
CartOrderDetails={CartOrderDetails}
|
||||||
|
|
|
||||||
|
|
@ -2599,7 +2599,7 @@ const BSBillingTable3 = () => {
|
||||||
{item?.Type != 'C'
|
{item?.Type != 'C'
|
||||||
? item.Offer && item.Offer > 0
|
? item.Offer && item.Offer > 0
|
||||||
? item.Offer
|
? item.Offer
|
||||||
: '-'
|
:item.DiscountAmt ? item.DiscountAmt : '-'
|
||||||
: item?.OfferPrice && item?.OfferPrice > 0
|
: item?.OfferPrice && item?.OfferPrice > 0
|
||||||
? item?.OfferType === 'F'
|
? item?.OfferType === 'F'
|
||||||
? `₹${safeRound(item.OfferPrice)}`
|
? `₹${safeRound(item.OfferPrice)}`
|
||||||
|
|
@ -2876,7 +2876,7 @@ const BSBillingTable3 = () => {
|
||||||
{item?.Type != 'C'
|
{item?.Type != 'C'
|
||||||
? item.Offer && item.Offer > 0
|
? item.Offer && item.Offer > 0
|
||||||
? item.Offer
|
? item.Offer
|
||||||
: '-'
|
: item.DiscountAmt ? item.DiscountAmt : '-'
|
||||||
: item?.OfferPrice && item?.OfferPrice > 0
|
: item?.OfferPrice && item?.OfferPrice > 0
|
||||||
? item?.OfferType === 'F'
|
? item?.OfferType === 'F'
|
||||||
? `₹${safeRound(item.OfferPrice)}`
|
? `₹${safeRound(item.OfferPrice)}`
|
||||||
|
|
@ -3201,7 +3201,7 @@ const BSBillingTable3 = () => {
|
||||||
{item?.Type != 'C'
|
{item?.Type != 'C'
|
||||||
? item.Offer && item.Offer > 0
|
? item.Offer && item.Offer > 0
|
||||||
? item.Offer
|
? item.Offer
|
||||||
: '-'
|
: item.DiscountAmt ? item.DiscountAmt : '-'
|
||||||
: item?.OfferPrice && item?.OfferPrice > 0
|
: item?.OfferPrice && item?.OfferPrice > 0
|
||||||
? item?.OfferType === 'F'
|
? item?.OfferType === 'F'
|
||||||
? `₹${safeRound(item.OfferPrice)}`
|
? `₹${safeRound(item.OfferPrice)}`
|
||||||
|
|
@ -3511,7 +3511,7 @@ const BSBillingTable3 = () => {
|
||||||
{item?.Type != 'C'
|
{item?.Type != 'C'
|
||||||
? item.Offer && item.Offer > 0
|
? item.Offer && item.Offer > 0
|
||||||
? item.Offer
|
? item.Offer
|
||||||
: '-'
|
: item.DiscountAmt ? item.DiscountAmt : '-'
|
||||||
: item?.OfferPrice && item?.OfferPrice > 0
|
: item?.OfferPrice && item?.OfferPrice > 0
|
||||||
? item?.OfferType === 'F'
|
? item?.OfferType === 'F'
|
||||||
? `₹${safeRound(item.OfferPrice)}`
|
? `₹${safeRound(item.OfferPrice)}`
|
||||||
|
|
|
||||||
|
|
@ -324,7 +324,7 @@ const BSBillingTable3Pay = () => {
|
||||||
const ProdSubCat = useSelector(GlobalProductSubCategorie);
|
const ProdSubCat = useSelector(GlobalProductSubCategorie);
|
||||||
const BSLayoutData = useSelector(getTemplateData);
|
const BSLayoutData = useSelector(getTemplateData);
|
||||||
const Combodata = useSelector(GlobalCombocarddata, shallowEqual);
|
const Combodata = useSelector(GlobalCombocarddata, shallowEqual);
|
||||||
|
console.log(PaymentOptions, "PaymentOptions")
|
||||||
const Custdisable = useSelector(GlobalSelectedCustDisable);
|
const Custdisable = useSelector(GlobalSelectedCustDisable);
|
||||||
const SettingDataSelector = useSelector(PreferenceData);
|
const SettingDataSelector = useSelector(PreferenceData);
|
||||||
|
|
||||||
|
|
@ -394,7 +394,6 @@ const BSBillingTable3Pay = () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(OrderCardDetail, 'OrderCardDetail');
|
console.log(OrderCardDetail, 'OrderCardDetail');
|
||||||
//Total calculation
|
|
||||||
const TotalItems = OrderCardDetail?.length;
|
const TotalItems = OrderCardDetail?.length;
|
||||||
const [formattedDate, setFormattedDate] = useState('');
|
const [formattedDate, setFormattedDate] = useState('');
|
||||||
const [UpiOptionOpen, setUpiOptionOpen] = useState(false);
|
const [UpiOptionOpen, setUpiOptionOpen] = useState(false);
|
||||||
|
|
@ -437,6 +436,7 @@ const BSBillingTable3Pay = () => {
|
||||||
const [PaymentgatewayUPI, setPaymentgatewayUPI] = useState([]);
|
const [PaymentgatewayUPI, setPaymentgatewayUPI] = useState([]);
|
||||||
const [PaymentDeviceUPI, setPaymentDeviceUPI] = useState([]);
|
const [PaymentDeviceUPI, setPaymentDeviceUPI] = useState([]);
|
||||||
const [UpiPayOption, setUpiPayOption] = useState([]);
|
const [UpiPayOption, setUpiPayOption] = useState([]);
|
||||||
|
console.log(UpiPayOption, "UpiPayOption")
|
||||||
const [BusinessPayOption, setBusinessPayoption] = useState([]);
|
const [BusinessPayOption, setBusinessPayoption] = useState([]);
|
||||||
const [CardPayOption, setCardPayOption] = useState([]);
|
const [CardPayOption, setCardPayOption] = useState([]);
|
||||||
const [Splitpayment, setSplitpayment] = useState(false);
|
const [Splitpayment, setSplitpayment] = useState(false);
|
||||||
|
|
@ -483,6 +483,7 @@ const BSBillingTable3Pay = () => {
|
||||||
|
|
||||||
const [OrderStatus, setOrderStatus] = useState(true);
|
const [OrderStatus, setOrderStatus] = useState(true);
|
||||||
const GlobaluseOptions = useSelector(GlobalCommonPaymentOptions);
|
const GlobaluseOptions = useSelector(GlobalCommonPaymentOptions);
|
||||||
|
console.log(GlobaluseOptions, "GlobaluseOptions")
|
||||||
const [useOptions, setuseOptions] = useState([]);
|
const [useOptions, setuseOptions] = useState([]);
|
||||||
const paymentloader = useSelector(GlobalPayementloader);
|
const paymentloader = useSelector(GlobalPayementloader);
|
||||||
const [UnpaidConfirmation, setUnpaidConfirmation] = useState(false);
|
const [UnpaidConfirmation, setUnpaidConfirmation] = useState(false);
|
||||||
|
|
@ -1632,6 +1633,7 @@ const BSBillingTable3Pay = () => {
|
||||||
//dhana
|
//dhana
|
||||||
|
|
||||||
const getPaymentOptionFeature = async () => {
|
const getPaymentOptionFeature = async () => {
|
||||||
|
|
||||||
const FiltersalesPayment = GlobaluseOptions?.filter(
|
const FiltersalesPayment = GlobaluseOptions?.filter(
|
||||||
(item) => item.FlowName?.toLowerCase() === 'sales'
|
(item) => item.FlowName?.toLowerCase() === 'sales'
|
||||||
);
|
);
|
||||||
|
|
@ -1666,6 +1668,7 @@ const BSBillingTable3Pay = () => {
|
||||||
filterpaymentdevice?.[0]?.ModeDetails?.filter((item) =>
|
filterpaymentdevice?.[0]?.ModeDetails?.filter((item) =>
|
||||||
item?.ModeName?.toLowerCase()?.includes('upi')
|
item?.ModeName?.toLowerCase()?.includes('upi')
|
||||||
) || [];
|
) || [];
|
||||||
|
|
||||||
setPaymentOptions(filterpaycounter?.[0]?.ModeDetails);
|
setPaymentOptions(filterpaycounter?.[0]?.ModeDetails);
|
||||||
setPaymentUpiOptions(
|
setPaymentUpiOptions(
|
||||||
FiltersalesPayment?.[0]?.PaymentDetails?.Payatthecounter
|
FiltersalesPayment?.[0]?.PaymentDetails?.Payatthecounter
|
||||||
|
|
@ -2207,6 +2210,7 @@ const BSBillingTable3Pay = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const Booking = async (value, pay) => {
|
const Booking = async (value, pay) => {
|
||||||
|
|
||||||
const TakAwayId = ConfigDataList?.find(
|
const TakAwayId = ConfigDataList?.find(
|
||||||
(a) => a?.ConfigName === 'TakeAway'
|
(a) => a?.ConfigName === 'TakeAway'
|
||||||
)?.ConfigId;
|
)?.ConfigId;
|
||||||
|
|
@ -2257,6 +2261,10 @@ const BSBillingTable3Pay = () => {
|
||||||
BatchRef: a.BatchRef,
|
BatchRef: a.BatchRef,
|
||||||
PackageDtl: a.PackageDtl,
|
PackageDtl: a.PackageDtl,
|
||||||
SetCount: a.SetCount,
|
SetCount: a.SetCount,
|
||||||
|
...(a?.DiscountValue && { DiscountValue: a.DiscountValue }),
|
||||||
|
...(a?.DiscountType && { DiscountType: a.DiscountType }),
|
||||||
|
...(a?.DiscountAmt && { DiscountAmt: a.DiscountAmt })
|
||||||
|
|
||||||
}));
|
}));
|
||||||
const NotSlectedTypeFind = temporderdetail?.find(
|
const NotSlectedTypeFind = temporderdetail?.find(
|
||||||
(a) => a?.BookingType != SelectedBookingType
|
(a) => a?.BookingType != SelectedBookingType
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue