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