Merge pull request 'Fix #264 Discount change based on preference' (#265) from March-3-deployment into main
Reviewed-on: Pozomind/pozo-retail-app#265
This commit is contained in:
commit
c170a32d9f
|
|
@ -12,6 +12,8 @@ import {
|
||||||
GlobalReorderProductDetails,
|
GlobalReorderProductDetails,
|
||||||
PreferenceData,
|
PreferenceData,
|
||||||
getConfigType,
|
getConfigType,
|
||||||
|
changeCombofocus,
|
||||||
|
changefocusStatusCust,
|
||||||
} 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';
|
||||||
|
|
@ -48,13 +50,14 @@ const BSBillingEditQuantity = (props) => {
|
||||||
const formRef = useRef(null);
|
const formRef = useRef(null);
|
||||||
const detailedFormRef = useRef(null);
|
const detailedFormRef = useRef(null);
|
||||||
const itemDiscountFormRef = useRef(null);
|
const itemDiscountFormRef = useRef(null);
|
||||||
|
const discountRef = 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")
|
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;
|
||||||
|
|
@ -68,13 +71,30 @@ const BSBillingEditQuantity = (props) => {
|
||||||
shallowEqual
|
shallowEqual
|
||||||
);
|
);
|
||||||
|
|
||||||
const overAllLimitPreferenece =
|
const overAllLimitPreferenece = preferenceDatas?.[0]?.[
|
||||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
'SettingDtlDetails'
|
||||||
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
]?.find(
|
||||||
const itemWiseLimitPreferenece =
|
(item) =>
|
||||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
item.SettingIdName?.toLowerCase() === 'overalllimit' &&
|
||||||
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y');
|
item?.SettingValue === 'Y'
|
||||||
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null;
|
);
|
||||||
|
const itemDiscount = preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) =>
|
||||||
|
item.SettingIdName?.toLowerCase() === 'itemdiscount' &&
|
||||||
|
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 =
|
const preferenceOffer =
|
||||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
(item) => item.SettingIdName === 'Offer'
|
(item) => item.SettingIdName === 'Offer'
|
||||||
|
|
@ -117,7 +137,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]) {
|
||||||
|
|
@ -142,9 +162,10 @@ 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('');
|
||||||
const [itemDiscountPercentageSelection, setItemDiscountPercentageSelection] = useState('Fixed');
|
const [itemDiscountPercentageSelection, setItemDiscountPercentageSelection] =
|
||||||
const [itemDiscountPrice, setItemDiscountPrice] = useState(0);
|
useState('Fixed');
|
||||||
|
const [itemDiscountPrice, setItemDiscountPrice] = useState('');
|
||||||
const allowDecimal = preferenceDatas?.[0]?.SettingDtlDetails?.find(
|
const allowDecimal = preferenceDatas?.[0]?.SettingDtlDetails?.find(
|
||||||
(setting) =>
|
(setting) =>
|
||||||
setting?.SettingIdName?.toLowerCase() === 'decimal' &&
|
setting?.SettingIdName?.toLowerCase() === 'decimal' &&
|
||||||
|
|
@ -178,8 +199,9 @@ const BSBillingEditQuantity = (props) => {
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(
|
useEffect(() => {
|
||||||
() => {
|
dispatch(changeCombofocus(true));
|
||||||
|
dispatch(changefocusStatusCust(true));
|
||||||
setEditOpen(props.BSBillingEditQuantity);
|
setEditOpen(props.BSBillingEditQuantity);
|
||||||
setItemData(props.Productdata);
|
setItemData(props.Productdata);
|
||||||
setQuantity(
|
setQuantity(
|
||||||
|
|
@ -188,9 +210,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
: props.Productdata.OrderQty
|
: props.Productdata.OrderQty
|
||||||
);
|
);
|
||||||
SellingPriceChange(parseFloat(props.Productdata?.SellingPrice || 0));
|
SellingPriceChange(parseFloat(props.Productdata?.SellingPrice || 0));
|
||||||
},
|
}, [props.BSBillingEditQuantity, props.Productdata]);
|
||||||
[props.BSBillingEditQuantity, props.Productdata]
|
|
||||||
);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (preferenceshortcutkey) {
|
if (preferenceshortcutkey) {
|
||||||
|
|
@ -272,7 +292,6 @@ const BSBillingEditQuantity = (props) => {
|
||||||
if (RadioBtnSelection === 'Price' && !RadioDetails) {
|
if (RadioBtnSelection === 'Price' && !RadioDetails) {
|
||||||
setEditedPrice(parseFloat(props.Productdata?.SellingPrice || 0));
|
setEditedPrice(parseFloat(props.Productdata?.SellingPrice || 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
}, [RadioBtnSelection, RadioDetails]);
|
}, [RadioBtnSelection, RadioDetails]);
|
||||||
|
|
||||||
const getBookingTypeId = async () => {
|
const getBookingTypeId = async () => {
|
||||||
|
|
@ -315,9 +334,9 @@ const BSBillingEditQuantity = (props) => {
|
||||||
const openRadioDetails = () => {
|
const openRadioDetails = () => {
|
||||||
// setDisableSubmitButton(false);
|
// setDisableSubmitButton(false);
|
||||||
setRadioDetails(!RadioDetails);
|
setRadioDetails(!RadioDetails);
|
||||||
setEditedPrice(0);
|
// setEditedPrice("");
|
||||||
// Clear ItemDiscount field and reset discount price
|
// Clear ItemDiscount field and reset discount price
|
||||||
setItemDiscountPrice(0);
|
setItemDiscountPrice('');
|
||||||
itemDiscountFormRef.current?.resetFields();
|
itemDiscountFormRef.current?.resetFields();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -357,7 +376,6 @@ const BSBillingEditQuantity = (props) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const calculateOverAllQty = (item, filterItems) => {
|
const calculateOverAllQty = (item, filterItems) => {
|
||||||
|
|
||||||
if (!item) return 0;
|
if (!item) return 0;
|
||||||
|
|
||||||
const totalUsedQty =
|
const totalUsedQty =
|
||||||
|
|
@ -438,8 +456,10 @@ const BSBillingEditQuantity = (props) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const AddProductQuantity = async () => {
|
const AddProductQuantity = async () => {
|
||||||
let disCountprice = safeRound(editedPrice) - itemDiscountPrice
|
let disCountprice = safeRound(editedPrice) - itemDiscountPrice;
|
||||||
let newPrice = safeRound(disCountprice > 0 ? disCountprice : props.Productdata.OrderRate);
|
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));
|
||||||
|
|
||||||
|
|
@ -461,17 +481,32 @@ const BSBillingEditQuantity = (props) => {
|
||||||
);
|
);
|
||||||
const editedProduct = CartOrderDetails[editedProductIndex];
|
const editedProduct = CartOrderDetails[editedProductIndex];
|
||||||
|
|
||||||
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
if (
|
||||||
|
(overAllLimitPreferenece || itemWiseLimitPreferenece) &&
|
||||||
|
maxQtyLimit
|
||||||
|
) {
|
||||||
if (overAllLimitPreferenece) {
|
if (overAllLimitPreferenece) {
|
||||||
const calculatedOverAllQty = calculateOverAllQtyLimit(CartOrderDetails?.filter((_, index) => index !== editedProductIndex));
|
const calculatedOverAllQty = calculateOverAllQtyLimit(
|
||||||
if ((calculatedOverAllQty + editedQty) > maxQtyLimit) {
|
CartOrderDetails?.filter((_, index) => index !== editedProductIndex)
|
||||||
setMessageData(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`);
|
);
|
||||||
|
if (calculatedOverAllQty + editedQty > maxQtyLimit) {
|
||||||
|
setMessageData(
|
||||||
|
`Overall Quantity Limit Exceeds than ${maxQtyLimit}`
|
||||||
|
);
|
||||||
setMessageType('warning');
|
setMessageType('warning');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (itemWiseLimitPreferenece) {
|
} else if (itemWiseLimitPreferenece) {
|
||||||
const exceptEditedItemCart = calculateOverAllQtyLimit(CartOrderDetails?.filter((_, index) => index !== editedProductIndex && _.ProdId === editedProduct?.ProdId && _.InwardDtlId === editedProduct?.InwardDtlId));
|
const exceptEditedItemCart = calculateOverAllQtyLimit(
|
||||||
const totalQtyForItem = ((exceptEditedItemCart || 0) + (editedQty || 0));
|
CartOrderDetails?.filter(
|
||||||
|
(_, index) =>
|
||||||
|
index !== editedProductIndex &&
|
||||||
|
_.ProdId === editedProduct?.ProdId &&
|
||||||
|
_.InwardDtlId === editedProduct?.InwardDtlId
|
||||||
|
)
|
||||||
|
);
|
||||||
|
const totalQtyForItem =
|
||||||
|
(exceptEditedItemCart || 0) + (editedQty || 0);
|
||||||
if (totalQtyForItem > maxQtyLimit) {
|
if (totalQtyForItem > maxQtyLimit) {
|
||||||
setMessageData(`Item Quantity Limit Exceeds than ${maxQtyLimit}`);
|
setMessageData(`Item Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||||
setMessageType('warning');
|
setMessageType('warning');
|
||||||
|
|
@ -745,7 +780,8 @@ const BSBillingEditQuantity = (props) => {
|
||||||
newPrice,
|
newPrice,
|
||||||
overrideQty = null
|
overrideQty = null
|
||||||
) => {
|
) => {
|
||||||
const editedQty = overrideQty !== null
|
const editedQty =
|
||||||
|
overrideQty !== null
|
||||||
? overrideQty
|
? overrideQty
|
||||||
: props?.Productdata?.ScaleType !== 'weight'
|
: props?.Productdata?.ScaleType !== 'weight'
|
||||||
? parseInt(Quantity)
|
? parseInt(Quantity)
|
||||||
|
|
@ -3164,10 +3200,12 @@ const BSBillingEditQuantity = (props) => {
|
||||||
const updatedProduct = {
|
const updatedProduct = {
|
||||||
...editedProduct,
|
...editedProduct,
|
||||||
OrderQty: fixedQty,
|
OrderQty: fixedQty,
|
||||||
OrderRate: editedPrice > 0 ? safeRound(editedPrice) : editedProduct?.OrderRate,
|
OrderRate:
|
||||||
|
editedPrice > 0 ? safeRound(editedPrice) : editedProduct?.OrderRate,
|
||||||
...calculateTaxAmounts({
|
...calculateTaxAmounts({
|
||||||
qty: qty,
|
qty: qty,
|
||||||
rate: editedPrice > 0 ? safeRound(editedPrice) : editedProduct?.OrderRate,
|
rate:
|
||||||
|
editedPrice > 0 ? safeRound(editedPrice) : editedProduct?.OrderRate,
|
||||||
taxPercentage: editedProduct?.TaxPercentage,
|
taxPercentage: editedProduct?.TaxPercentage,
|
||||||
type: editedProduct?.Type,
|
type: editedProduct?.Type,
|
||||||
product: editedProduct,
|
product: editedProduct,
|
||||||
|
|
@ -3177,26 +3215,23 @@ const BSBillingEditQuantity = (props) => {
|
||||||
...(offerApply && {
|
...(offerApply && {
|
||||||
Offer: qty * (editedPrice > 0 ? editedPrice : editedProduct?.OrderRate),
|
Offer: qty * (editedPrice > 0 ? editedPrice : editedProduct?.OrderRate),
|
||||||
}),
|
}),
|
||||||
...(
|
...(!offerApply && itemDiscountPrice > 0
|
||||||
!offerApply && itemDiscountPrice > 0
|
|
||||||
? {
|
? {
|
||||||
DiscountAmt: safeRound(itemDiscountPrice*fixedQty ),
|
DiscountAmt: safeRound(itemDiscountPrice * fixedQty),
|
||||||
DiscountType: itemDiscountPercentageSelection === 'Fixed' ? 'F' : 'P',
|
DiscountType:
|
||||||
|
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,7 +3291,6 @@ 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) =>
|
||||||
|
|
@ -3301,7 +3335,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
const { OfferType = null, OfferPrice = 0 } = product;
|
const { OfferType = null, OfferPrice = 0 } = product;
|
||||||
|
|
||||||
let totalAmount = qty * rate;
|
let totalAmount = qty * rate;
|
||||||
totalAmount = totalAmount - (itemDiscountPrice*qty|| 0);
|
totalAmount = totalAmount - (itemDiscountPrice * qty || 0);
|
||||||
const taxAmount = (
|
const taxAmount = (
|
||||||
(totalAmount * taxPercentage) /
|
(totalAmount * taxPercentage) /
|
||||||
(100 + taxPercentage)
|
(100 + taxPercentage)
|
||||||
|
|
@ -3327,6 +3361,8 @@ const BSBillingEditQuantity = (props) => {
|
||||||
const CloseModal = () => {
|
const CloseModal = () => {
|
||||||
props.handleEditQuantityCancel();
|
props.handleEditQuantityCancel();
|
||||||
setClearQuantity(false);
|
setClearQuantity(false);
|
||||||
|
dispatch(changeCombofocus(false));
|
||||||
|
dispatch(changefocusStatusCust(false));
|
||||||
};
|
};
|
||||||
const onComplete = useCallback(() => {
|
const onComplete = useCallback(() => {
|
||||||
setMessageData(null);
|
setMessageData(null);
|
||||||
|
|
@ -3347,12 +3383,13 @@ const BSBillingEditQuantity = (props) => {
|
||||||
itemDiscountFormRef.current?.resetFields();
|
itemDiscountFormRef.current?.resetFields();
|
||||||
};
|
};
|
||||||
const ItemDiscountChangefun = (data) => {
|
const ItemDiscountChangefun = (data) => {
|
||||||
|
|
||||||
const enteredDiscount = parseFloat(data?.target.value);
|
const enteredDiscount = parseFloat(data?.target.value);
|
||||||
|
|
||||||
if (enteredDiscount) {
|
if (enteredDiscount) {
|
||||||
let roundedrice = safeRound(editedPrice ? editedPrice : 0)
|
let roundedrice = safeRound(editedPrice ? editedPrice : 0);
|
||||||
const sellingPrice = parseFloat(roundedrice || props.Productdata?.SellingPrice || 0);
|
const sellingPrice = parseFloat(
|
||||||
|
roundedrice || props.Productdata?.SellingPrice || 0
|
||||||
|
);
|
||||||
if (itemDiscountPercentageSelection === 'Fixed') {
|
if (itemDiscountPercentageSelection === 'Fixed') {
|
||||||
if (parseFloat(enteredDiscount) < parseFloat(sellingPrice)) {
|
if (parseFloat(enteredDiscount) < parseFloat(sellingPrice)) {
|
||||||
setItemDiscountPrice(parseFloat(enteredDiscount));
|
setItemDiscountPrice(parseFloat(enteredDiscount));
|
||||||
|
|
@ -3364,7 +3401,8 @@ const BSBillingEditQuantity = (props) => {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (parseFloat(enteredDiscount) < 100) {
|
if (parseFloat(enteredDiscount) < 100) {
|
||||||
let discountAmt = (parseFloat(enteredDiscount) * parseFloat(sellingPrice)) / 100;
|
let discountAmt =
|
||||||
|
(parseFloat(enteredDiscount) * parseFloat(sellingPrice)) / 100;
|
||||||
setItemDiscountPrice(parseFloat(discountAmt));
|
setItemDiscountPrice(parseFloat(discountAmt));
|
||||||
} else {
|
} else {
|
||||||
setMessageType('error');
|
setMessageType('error');
|
||||||
|
|
@ -3379,8 +3417,13 @@ const BSBillingEditQuantity = (props) => {
|
||||||
};
|
};
|
||||||
const PriceChangefun = (data) => {
|
const PriceChangefun = (data) => {
|
||||||
const enteredDiscount = parseFloat(data?.target.value);
|
const enteredDiscount = parseFloat(data?.target.value);
|
||||||
|
const value = data?.target?.value;
|
||||||
// Clear ItemDiscount field and reset discount price
|
if (value === '') {
|
||||||
|
setEditedPrice('');
|
||||||
|
setDisableSubmitButton(false);
|
||||||
|
formRef.current?.resetFields();
|
||||||
|
return;
|
||||||
|
}
|
||||||
setItemDiscountPrice(0);
|
setItemDiscountPrice(0);
|
||||||
itemDiscountFormRef.current?.resetFields();
|
itemDiscountFormRef.current?.resetFields();
|
||||||
|
|
||||||
|
|
@ -3490,11 +3533,20 @@ const BSBillingEditQuantity = (props) => {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setDisableSubmitButton(false);
|
setDisableSubmitButton(false);
|
||||||
setEditedPrice(0);
|
setEditedPrice('');
|
||||||
formRef.current?.resetFields();
|
formRef.current?.resetFields();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const SellingPriceChange = (data) => {
|
const SellingPriceChange = (data) => {
|
||||||
|
if (data === '') {
|
||||||
|
setEditedPrice('');
|
||||||
|
setDisableSubmitButton(false);
|
||||||
|
formRef.current?.setFieldsValue({ SellPrice: '' });
|
||||||
|
|
||||||
|
setItemDiscountPrice('');
|
||||||
|
itemDiscountFormRef.current?.resetFields();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (data) {
|
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);
|
||||||
|
|
@ -3580,16 +3632,21 @@ const BSBillingEditQuantity = (props) => {
|
||||||
);
|
);
|
||||||
const editedProduct = {
|
const editedProduct = {
|
||||||
...CartOrderDetails[editedProductIndex],
|
...CartOrderDetails[editedProductIndex],
|
||||||
OrderQty: qty
|
OrderQty: qty,
|
||||||
};
|
};
|
||||||
|
|
||||||
await handleEditQuantity(editedProduct, editedProductIndex, editedProduct.OrderRate, qty);
|
await handleEditQuantity(
|
||||||
|
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">
|
||||||
|
|
@ -3688,7 +3745,8 @@ const BSBillingEditQuantity = (props) => {
|
||||||
Packing
|
Packing
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{isKg && (<button
|
{isKg && (
|
||||||
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className={
|
className={
|
||||||
RadioBtnSelection === 'weightAmount'
|
RadioBtnSelection === 'weightAmount'
|
||||||
|
|
@ -3698,8 +3756,8 @@ const BSBillingEditQuantity = (props) => {
|
||||||
onClick={() => onRadioBtnChange('weightAmount')}
|
onClick={() => onRadioBtnChange('weightAmount')}
|
||||||
>
|
>
|
||||||
Weight / Amount
|
Weight / Amount
|
||||||
</button>)}
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{RadioBtnSelection == 'Quantity' && (
|
{RadioBtnSelection == 'Quantity' && (
|
||||||
|
|
@ -3762,18 +3820,18 @@ const BSBillingEditQuantity = (props) => {
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{RadioBtnSelection == 'Price' && (
|
{RadioBtnSelection == 'Price' && (
|
||||||
<div style={{ display: "flex" }} >
|
<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: {props.Productdata.SellingPrice} / per
|
||||||
per item{' '}
|
item{' '}
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
{!RadioDetails && (
|
{!RadioDetails && (
|
||||||
<Form ref={formRef}>
|
<Form ref={formRef}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="SellPrice"
|
name="SellPrice"
|
||||||
initialValue={safeRound(editedPrice)}
|
initialValue={editedPrice}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
pattern: /^(0\d+|[1-9]\d*)(\.\d+)?$/,
|
pattern: /^(0\d+|[1-9]\d*)(\.\d+)?$/,
|
||||||
|
|
@ -3799,21 +3857,13 @@ const BSBillingEditQuantity = (props) => {
|
||||||
value={editedPrice}
|
value={editedPrice}
|
||||||
label="Price Override"
|
label="Price Override"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
onChange={(e) => { SellingPriceChange(e?.target?.value) }}
|
onChange={(e) => {
|
||||||
inputMode="decimal"
|
SellingPriceChange(e?.target?.value);
|
||||||
isOnChange={editedPrice > 0 ? true : false}
|
|
||||||
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;
|
|
||||||
}}
|
}}
|
||||||
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
|
inputMode="decimal"
|
||||||
|
isOnChange={
|
||||||
|
editedPrice !== '' && Number(editedPrice) > 0
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
@ -3841,7 +3891,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
<Form ref={detailedFormRef}>
|
<Form ref={detailedFormRef}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="SellPrice"
|
name="SellPrice"
|
||||||
initialValue={safeRound(editedPrice)}
|
// initialValue={safeRound(editedPrice)}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
pattern: /^[0-9]\d*(\.\d+)?$/,
|
pattern: /^[0-9]\d*(\.\d+)?$/,
|
||||||
|
|
@ -3863,23 +3913,12 @@ const BSBillingEditQuantity = (props) => {
|
||||||
label="Reduction"
|
label="Reduction"
|
||||||
fieldState={true}
|
fieldState={true}
|
||||||
fieldApi={true}
|
fieldApi={true}
|
||||||
// id="error2"
|
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
onChange={(e) => PriceChangefun(e)}
|
onChange={PriceChangefun}
|
||||||
inputMode="decimal"
|
inputMode="decimal"
|
||||||
isOnChange={editedPrice > 0 ? true : false}
|
isOnChange={
|
||||||
onInput={(e) => {
|
editedPrice !== '' && Number(editedPrice) > 0
|
||||||
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;
|
|
||||||
}}
|
|
||||||
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
|
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{/* <input type="text"
|
{/* <input type="text"
|
||||||
|
|
@ -3888,17 +3927,25 @@ const BSBillingEditQuantity = (props) => {
|
||||||
/> */}
|
/> */}
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
{editedPrice > 0 && <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" }}>
|
{itemDiscount && (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
borderLeft: '1px solid #ddd',
|
||||||
|
paddingLeft: '15px',
|
||||||
|
marginLeft: '15px',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<label className="EditQuantity-itemname">
|
<label className="EditQuantity-itemname">
|
||||||
Item Discount
|
Item Discount
|
||||||
</label>
|
</label>
|
||||||
|
|
@ -3935,6 +3982,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<InputField
|
<InputField
|
||||||
|
ref={discountRef}
|
||||||
field="ItemDiscount"
|
field="ItemDiscount"
|
||||||
name="ItemDiscount"
|
name="ItemDiscount"
|
||||||
value={itemDiscountPrice}
|
value={itemDiscountPrice}
|
||||||
|
|
@ -3942,35 +3990,29 @@ const BSBillingEditQuantity = (props) => {
|
||||||
fieldState={true}
|
fieldState={true}
|
||||||
fieldApi={true}
|
fieldApi={true}
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
onChange={(e) => ItemDiscountChangefun(e)}
|
onChange={ItemDiscountChangefun}
|
||||||
inputMode="decimal"
|
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.Item>
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
{itemDiscountPrice > 0 && safeRound(editedPrice) > 0 && <div className="EditQuantity-Quantity">
|
|
||||||
|
{Number(itemDiscountPrice) > 0 &&
|
||||||
|
safeRound(editedPrice) > 0 && (
|
||||||
|
<div className="EditQuantity-Quantity">
|
||||||
<div className="EditQuantity-itemname">
|
<div className="EditQuantity-itemname">
|
||||||
{' '}
|
Final Price:{' '}
|
||||||
{console.log(editedPrice, itemDiscountPrice, "itemDiscountPrice")}
|
{(
|
||||||
Final Price: {safeRound(editedPrice) - (itemDiscountPrice || 0)}
|
Number(safeRound(editedPrice)) -
|
||||||
|
Number(itemDiscountPrice || 0)
|
||||||
|
).toFixed(2)}
|
||||||
</div>
|
</div>
|
||||||
</div>}
|
</div>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
)}
|
)}
|
||||||
{RadioBtnSelection == 'Parcel' && (
|
{RadioBtnSelection == 'Parcel' && (
|
||||||
<>
|
<>
|
||||||
|
|
@ -3986,7 +4028,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{(RadioBtnSelection == 'weightAmount') && isKg && (
|
{RadioBtnSelection == 'weightAmount' && isKg && (
|
||||||
<>
|
<>
|
||||||
<WeightCalculatePrice
|
<WeightCalculatePrice
|
||||||
CartOrderDetails={CartOrderDetails}
|
CartOrderDetails={CartOrderDetails}
|
||||||
|
|
|
||||||
|
|
@ -58,9 +58,16 @@ const PreferenceList = () => {
|
||||||
const settingsList = tableValue[0]?.SettingDtlDetails ?? preferenceConfigs;
|
const settingsList = tableValue[0]?.SettingDtlDetails ?? preferenceConfigs;
|
||||||
|
|
||||||
const allSettingsMap = {};
|
const allSettingsMap = {};
|
||||||
settingsList?.forEach(({ SettingIdName, SettingValue, SettingCount, SettingTime,Comments }) => {
|
settingsList?.forEach(
|
||||||
allSettingsMap[SettingIdName?.toLowerCase()] = { value: SettingValue, count: SettingCount, time: SettingTime?.split(' ')?.[0], comments: Comments };
|
({ SettingIdName, SettingValue, SettingCount, SettingTime, Comments }) => {
|
||||||
});
|
allSettingsMap[SettingIdName?.toLowerCase()] = {
|
||||||
|
value: SettingValue,
|
||||||
|
count: SettingCount,
|
||||||
|
time: SettingTime?.split(' ')?.[0],
|
||||||
|
comments: Comments,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
console.log(featureaddDetails, 'featureaddDetails');
|
console.log(featureaddDetails, 'featureaddDetails');
|
||||||
|
|
||||||
|
|
@ -89,16 +96,35 @@ const PreferenceList = () => {
|
||||||
wholesaleshortname: allSettingsMap['wholesaleshortname']?.comments || 'WS',
|
wholesaleshortname: allSettingsMap['wholesaleshortname']?.comments || 'WS',
|
||||||
billitemsorder: allSettingsMap['billitemsorder']?.value === 'Y',
|
billitemsorder: allSettingsMap['billitemsorder']?.value === 'Y',
|
||||||
preorderpricechange: allSettingsMap['preorderpricechange']?.value === 'Y',
|
preorderpricechange: allSettingsMap['preorderpricechange']?.value === 'Y',
|
||||||
quantityrestriction: allSettingsMap['overalllimit']?.value === 'Y' || allSettingsMap['itemwiselimit']?.value === 'Y',
|
quantityrestriction:
|
||||||
quantityrestrictiontype: allSettingsMap['overalllimit']?.value === 'Y' ? 'overall' : allSettingsMap['itemwiselimit']?.value === 'Y' ? 'itemwise' : 'overall',
|
allSettingsMap['overalllimit']?.value === 'Y' ||
|
||||||
kiosktimelimit: allSettingsMap['hours']?.value === 'Y' || allSettingsMap['minutes']?.value === 'Y',
|
allSettingsMap['itemwiselimit']?.value === 'Y',
|
||||||
kiosktimelimittype: allSettingsMap['hours']?.value === 'Y' ? 'hours' : allSettingsMap['minutes']?.value === 'Y' ? 'minutes' : 'minutes',
|
quantityrestrictiontype:
|
||||||
maxquantity: allSettingsMap['overalllimit']?.value === 'Y' ? allSettingsMap['overalllimit']?.count || 1 : allSettingsMap['itemwiselimit']?.value === 'Y' ? allSettingsMap['itemwiselimit']?.count || 1 : 1,
|
allSettingsMap['overalllimit']?.value === 'Y'
|
||||||
|
? 'overall'
|
||||||
|
: allSettingsMap['itemwiselimit']?.value === 'Y'
|
||||||
|
? 'itemwise'
|
||||||
|
: 'overall',
|
||||||
|
kiosktimelimit:
|
||||||
|
allSettingsMap['hours']?.value === 'Y' ||
|
||||||
|
allSettingsMap['minutes']?.value === 'Y',
|
||||||
|
kiosktimelimittype:
|
||||||
|
allSettingsMap['hours']?.value === 'Y'
|
||||||
|
? 'hours'
|
||||||
|
: allSettingsMap['minutes']?.value === 'Y'
|
||||||
|
? 'minutes'
|
||||||
|
: 'minutes',
|
||||||
|
maxquantity:
|
||||||
|
allSettingsMap['overalllimit']?.value === 'Y'
|
||||||
|
? allSettingsMap['overalllimit']?.count || 1
|
||||||
|
: allSettingsMap['itemwiselimit']?.value === 'Y'
|
||||||
|
? allSettingsMap['itemwiselimit']?.count || 1
|
||||||
|
: 1,
|
||||||
maxtime:
|
maxtime:
|
||||||
allSettingsMap['hours']?.value === 'Y'
|
allSettingsMap['hours']?.value === 'Y'
|
||||||
? (allSettingsMap['hours']?.time
|
? allSettingsMap['hours']?.time
|
||||||
? parseFloat(allSettingsMap['hours']?.time / 60)
|
? parseFloat(allSettingsMap['hours']?.time / 60)
|
||||||
: 0.5)
|
: 0.5
|
||||||
: allSettingsMap['minutes']?.value === 'Y'
|
: allSettingsMap['minutes']?.value === 'Y'
|
||||||
? parseFloat(allSettingsMap['minutes']?.time || 30)
|
? parseFloat(allSettingsMap['minutes']?.time || 30)
|
||||||
: 30,
|
: 30,
|
||||||
|
|
@ -118,14 +144,19 @@ const PreferenceList = () => {
|
||||||
),
|
),
|
||||||
mobilea4: allSettingsMap['mobilea4']?.value === 'Y',
|
mobilea4: allSettingsMap['mobilea4']?.value === 'Y',
|
||||||
estimateSettings: [
|
estimateSettings: [
|
||||||
...(allSettingsMap['estimateprintheader']?.value === 'Y' ? ['estimateprintheader'] : []),
|
...(allSettingsMap['estimateprintheader']?.value === 'Y'
|
||||||
...(allSettingsMap['estimatetitle']?.value === 'Y' ? ['estimatetitle'] : []),
|
? ['estimateprintheader']
|
||||||
|
: []),
|
||||||
|
...(allSettingsMap['estimatetitle']?.value === 'Y'
|
||||||
|
? ['estimatetitle']
|
||||||
|
: []),
|
||||||
],
|
],
|
||||||
scanlayout: allSettingsMap['scanlayout']?.value === 'Y',
|
scanlayout: allSettingsMap['scanlayout']?.value === 'Y',
|
||||||
verifyproduct: allSettingsMap['verifyproduct']?.value === 'Y',
|
verifyproduct: allSettingsMap['verifyproduct']?.value === 'Y',
|
||||||
imeidetails: allSettingsMap['imeidetails']?.value === 'Y',
|
imeidetails: allSettingsMap['imeidetails']?.value === 'Y',
|
||||||
customisedbillnumber: allSettingsMap['customisedbillnumber']?.value === 'Y',
|
customisedbillnumber: allSettingsMap['customisedbillnumber']?.value === 'Y',
|
||||||
upiqr: allSettingsMap['upiqr']?.value === 'Y',
|
upiqr: allSettingsMap['upiqr']?.value === 'Y',
|
||||||
|
itemdiscount: allSettingsMap['itemdiscount']?.value === 'Y',
|
||||||
lowstockreport: allSettingsMap['lowstockreport']?.value === 'Y',
|
lowstockreport: allSettingsMap['lowstockreport']?.value === 'Y',
|
||||||
weeklysalesreport: allSettingsMap['weeklysalesreport']?.value === 'Y',
|
weeklysalesreport: allSettingsMap['weeklysalesreport']?.value === 'Y',
|
||||||
notificationblink: allSettingsMap['notificationblink']?.value === 'Y',
|
notificationblink: allSettingsMap['notificationblink']?.value === 'Y',
|
||||||
|
|
@ -245,7 +276,7 @@ const PreferenceList = () => {
|
||||||
res?.data?.data?.map((i) => ({
|
res?.data?.data?.map((i) => ({
|
||||||
SettingIdName: i.ConfigName,
|
SettingIdName: i.ConfigName,
|
||||||
SettingId: i.ConfigId,
|
SettingId: i.ConfigId,
|
||||||
Comments: i.Comments || "",
|
Comments: i.Comments || '',
|
||||||
SettingValue: 'N',
|
SettingValue: 'N',
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
|
|
@ -305,9 +336,9 @@ const PreferenceList = () => {
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
const values = formRef.current.getFieldsValue();
|
const values = formRef.current.getFieldsValue();
|
||||||
const salesMode = values.salesmode;
|
const salesMode = values.salesmode;
|
||||||
console.log("Sales Mode:", values.salesmode);
|
console.log('Sales Mode:', values.salesmode);
|
||||||
console.log("Retail Short Name:", values.retailshortname);
|
console.log('Retail Short Name:', values.retailshortname);
|
||||||
console.log("Wholesale Short Name:", values.wholesaleshortname);
|
console.log('Wholesale Short Name:', values.wholesaleshortname);
|
||||||
const settings = settingsList || [];
|
const settings = settingsList || [];
|
||||||
console.log(values, 'values');
|
console.log(values, 'values');
|
||||||
const updatedSettings = settings.map((setting) => {
|
const updatedSettings = settings.map((setting) => {
|
||||||
|
|
@ -336,14 +367,20 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
||||||
imeidetails: values.imeidetails,
|
imeidetails: values.imeidetails,
|
||||||
customisedbillnumber: values.customisedbillnumber,
|
customisedbillnumber: values.customisedbillnumber,
|
||||||
upiqr: values.upiqr,
|
upiqr: values.upiqr,
|
||||||
|
itemdiscount: values.itemdiscount,
|
||||||
lowstockreport: values.lowstockreport,
|
lowstockreport: values.lowstockreport,
|
||||||
weeklysalesreport: values.weeklysalesreport,
|
weeklysalesreport: values.weeklysalesreport,
|
||||||
notificationblink: values.notificationblink,
|
notificationblink: values.notificationblink,
|
||||||
editbill: values.editbill,
|
editbill: values.editbill,
|
||||||
overalllimit: values.quantityrestriction && values.quantityrestrictiontype === 'overall',
|
overalllimit:
|
||||||
itemwiselimit: values.quantityrestriction && values.quantityrestrictiontype === 'itemwise',
|
values.quantityrestriction &&
|
||||||
|
values.quantityrestrictiontype === 'overall',
|
||||||
|
itemwiselimit:
|
||||||
|
values.quantityrestriction &&
|
||||||
|
values.quantityrestrictiontype === 'itemwise',
|
||||||
hours: values.kiosktimelimit && values.kiosktimelimittype === 'hours',
|
hours: values.kiosktimelimit && values.kiosktimelimittype === 'hours',
|
||||||
minutes: values.kiosktimelimit && values.kiosktimelimittype === 'minutes',
|
minutes:
|
||||||
|
values.kiosktimelimit && values.kiosktimelimittype === 'minutes',
|
||||||
};
|
};
|
||||||
|
|
||||||
const arrayValues = {
|
const arrayValues = {
|
||||||
|
|
@ -376,33 +413,33 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
||||||
SettingId: setting.SettingId,
|
SettingId: setting.SettingId,
|
||||||
|
|
||||||
Comments:
|
Comments:
|
||||||
key === "retailshortname"
|
key === 'retailshortname'
|
||||||
? values.retailshortname || ""
|
? values.retailshortname || ''
|
||||||
: key === "wholesaleshortname"
|
: key === 'wholesaleshortname'
|
||||||
? values.wholesaleshortname || ""
|
? values.wholesaleshortname || ''
|
||||||
: setting.Comments || "",
|
: setting.Comments || '',
|
||||||
|
|
||||||
SettingValue:
|
SettingValue:
|
||||||
key === "retailshortname" || key === "wholesaleshortname"
|
key === 'retailshortname' || key === 'wholesaleshortname'
|
||||||
? salesMode
|
? salesMode
|
||||||
? "Y"
|
? 'Y'
|
||||||
: "N"
|
: 'N'
|
||||||
: isChecked
|
: isChecked
|
||||||
? "Y"
|
? 'Y'
|
||||||
: "N",
|
: 'N',
|
||||||
|
|
||||||
SettingCount:
|
SettingCount:
|
||||||
(key === "overalllimit" || key === "itemwiselimit") && isChecked
|
(key === 'overalllimit' || key === 'itemwiselimit') && isChecked
|
||||||
? parseFloat(values.maxquantity) || null
|
? parseFloat(values.maxquantity) || null
|
||||||
: null,
|
: null,
|
||||||
|
|
||||||
SettingTime:
|
SettingTime:
|
||||||
key === "hours" && isChecked
|
key === 'hours' && isChecked
|
||||||
? (parseFloat(values.maxtime) * 60).toFixed(2) + " Minutes"
|
? (parseFloat(values.maxtime) * 60).toFixed(2) + ' Minutes'
|
||||||
: key === "minutes" && isChecked
|
: key === 'minutes' && isChecked
|
||||||
? parseFloat(values.maxtime).toFixed(2) + " Minutes"
|
? parseFloat(values.maxtime).toFixed(2) + ' Minutes'
|
||||||
: null,
|
: null,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
|
|
@ -569,19 +606,47 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
{featureaddDetails?.find(
|
{featureaddDetails?.find(
|
||||||
(item) => item?.FeatureAddonName?.toLowerCase() === 'kiosk sales'
|
(item) =>
|
||||||
) && renderCheckbox('kioskotp', 'Enable OTP verification for Kiosk Orders?')}
|
item?.FeatureAddonName?.toLowerCase() === 'kiosk sales'
|
||||||
|
) &&
|
||||||
|
renderCheckbox(
|
||||||
|
'kioskotp',
|
||||||
|
'Enable OTP verification for Kiosk Orders?'
|
||||||
|
)}
|
||||||
{featureaddDetails?.find(
|
{featureaddDetails?.find(
|
||||||
(item) => item?.FeatureAddonName?.toLowerCase() === 'kiosk sales'
|
(item) =>
|
||||||
) && (allSettingsMap['hours'] !== undefined || allSettingsMap['minutes'] !== undefined) && <>
|
item?.FeatureAddonName?.toLowerCase() === 'kiosk sales'
|
||||||
<Form.Item name="kiosktimelimit" label="Restrict orders for the same customer within a time limit?" valuePropName="checked">
|
) &&
|
||||||
|
(allSettingsMap['hours'] !== undefined ||
|
||||||
|
allSettingsMap['minutes'] !== undefined) && (
|
||||||
|
<>
|
||||||
|
<Form.Item
|
||||||
|
name="kiosktimelimit"
|
||||||
|
label="Restrict orders for the same customer within a time limit?"
|
||||||
|
valuePropName="checked"
|
||||||
|
>
|
||||||
<Checkbox>Yes</Checkbox>
|
<Checkbox>Yes</Checkbox>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item noStyle shouldUpdate={(prev, curr) => prev.kiosktimelimit !== curr.kiosktimelimit}>
|
<Form.Item
|
||||||
{({ getFieldValue }) => getFieldValue('kiosktimelimit') && (
|
noStyle
|
||||||
|
shouldUpdate={(prev, curr) =>
|
||||||
|
prev.kiosktimelimit !== curr.kiosktimelimit
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{({ getFieldValue }) =>
|
||||||
|
getFieldValue('kiosktimelimit') && (
|
||||||
<>
|
<>
|
||||||
<Form.Item name="kiosktimelimittype" label="How would you like to apply the time restriction?">
|
<Form.Item
|
||||||
<Radio.Group onChange={() => formRef.current?.setFieldsValue({ maxtime: undefined })}>
|
name="kiosktimelimittype"
|
||||||
|
label="How would you like to apply the time restriction?"
|
||||||
|
>
|
||||||
|
<Radio.Group
|
||||||
|
onChange={() =>
|
||||||
|
formRef.current?.setFieldsValue({
|
||||||
|
maxtime: undefined,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
>
|
||||||
{allSettingsMap['minutes'] !== undefined && (
|
{allSettingsMap['minutes'] !== undefined && (
|
||||||
<Radio value="minutes">Minutes</Radio>
|
<Radio value="minutes">Minutes</Radio>
|
||||||
)}
|
)}
|
||||||
|
|
@ -594,11 +659,13 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
||||||
<Form.Item
|
<Form.Item
|
||||||
noStyle
|
noStyle
|
||||||
shouldUpdate={(prev, curr) =>
|
shouldUpdate={(prev, curr) =>
|
||||||
prev.kiosktimelimittype !== curr.kiosktimelimittype
|
prev.kiosktimelimittype !==
|
||||||
|
curr.kiosktimelimittype
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{({ getFieldValue }) => {
|
{({ getFieldValue }) => {
|
||||||
const type = getFieldValue('kiosktimelimittype');
|
const type =
|
||||||
|
getFieldValue('kiosktimelimittype');
|
||||||
|
|
||||||
const isHours = type === 'hours';
|
const isHours = type === 'hours';
|
||||||
|
|
||||||
|
|
@ -607,7 +674,10 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
||||||
name="maxtime"
|
name="maxtime"
|
||||||
label={`Maximum Time Limit (${isHours ? 'Hours' : 'Minutes'}):`}
|
label={`Maximum Time Limit (${isHours ? 'Hours' : 'Minutes'}):`}
|
||||||
rules={[
|
rules={[
|
||||||
{ required: true, message: 'Please enter maximum time' },
|
{
|
||||||
|
required: true,
|
||||||
|
message: 'Please enter maximum time',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
type: 'number',
|
type: 'number',
|
||||||
min: isHours ? 0.25 : 1,
|
min: isHours ? 0.25 : 1,
|
||||||
|
|
@ -628,9 +698,11 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
||||||
}}
|
}}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</>
|
</>
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</>}
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Divider />
|
<Divider />
|
||||||
|
|
@ -741,7 +813,7 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
||||||
{renderCheckbox('weightasquantity', 'Use Weight as Quantity?')}
|
{renderCheckbox('weightasquantity', 'Use Weight as Quantity?')}
|
||||||
{renderCheckbox('expiredselection', 'Show product expiry date?')}
|
{renderCheckbox('expiredselection', 'Show product expiry date?')}
|
||||||
{/* {renderCheckbox('sales mode', 'Retail or Wholesale mode?')} */}
|
{/* {renderCheckbox('sales mode', 'Retail or Wholesale mode?')} */}
|
||||||
{(allSettingsMap['sales mode'] !== undefined ) && (
|
{allSettingsMap['sales mode'] !== undefined && (
|
||||||
<>
|
<>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="salesmode"
|
name="salesmode"
|
||||||
|
|
@ -762,20 +834,27 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="retailshortname"
|
name="retailshortname"
|
||||||
label="Retail Short Name"
|
label="Retail Short Name"
|
||||||
|
|
||||||
rules={[
|
rules={[
|
||||||
{ required: true, message: "Please enter Retail Short Name" },
|
{
|
||||||
|
required: true,
|
||||||
|
message: 'Please enter Retail Short Name',
|
||||||
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<InputField placeholder="Enter Retail Short Name" style={{ width: 250 }} />
|
<InputField
|
||||||
|
placeholder="Enter Retail Short Name"
|
||||||
|
style={{ width: 250 }}
|
||||||
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="wholesaleshortname"
|
name="wholesaleshortname"
|
||||||
label="Wholesale Short Name"
|
label="Wholesale Short Name"
|
||||||
|
|
||||||
rules={[
|
rules={[
|
||||||
{ required: true, message: "Please enter Wholesale Short Name" },
|
{
|
||||||
|
required: true,
|
||||||
|
message: 'Please enter Wholesale Short Name',
|
||||||
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<InputField
|
<InputField
|
||||||
|
|
@ -809,24 +888,53 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
||||||
)}
|
)}
|
||||||
{renderCheckbox('scanlayout', 'Do you Want Scan Layout Page?')}
|
{renderCheckbox('scanlayout', 'Do you Want Scan Layout Page?')}
|
||||||
{renderCheckbox('upiqr', 'Do you want to show the UPI QR code?')}
|
{renderCheckbox('upiqr', 'Do you want to show the UPI QR code?')}
|
||||||
|
{renderCheckbox(
|
||||||
|
'itemdiscount',
|
||||||
|
'Do you want to show the Item Discount in Price OverRide?'
|
||||||
|
)}
|
||||||
{/* {renderCheckbox('editbill', 'Do you want to edit the previously created bill?')} */}
|
{/* {renderCheckbox('editbill', 'Do you want to edit the previously created bill?')} */}
|
||||||
|
|
||||||
{(allSettingsMap['overalllimit'] !== undefined || allSettingsMap['itemwiselimit'] !== undefined) && (
|
{(allSettingsMap['overalllimit'] !== undefined ||
|
||||||
|
allSettingsMap['itemwiselimit'] !== undefined) && (
|
||||||
<>
|
<>
|
||||||
<Form.Item name="quantityrestriction" label="Do you want to restrict the quantity that can be sold in a single order?" valuePropName="checked">
|
<Form.Item
|
||||||
|
name="quantityrestriction"
|
||||||
|
label="Do you want to restrict the quantity that can be sold in a single order?"
|
||||||
|
valuePropName="checked"
|
||||||
|
>
|
||||||
<Checkbox>Yes</Checkbox>
|
<Checkbox>Yes</Checkbox>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item noStyle shouldUpdate={(prev, curr) => prev.quantityrestriction !== curr.quantityrestriction}>
|
<Form.Item
|
||||||
{({ getFieldValue }) => getFieldValue('quantityrestriction') && (
|
noStyle
|
||||||
|
shouldUpdate={(prev, curr) =>
|
||||||
|
prev.quantityrestriction !== curr.quantityrestriction
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{({ getFieldValue }) =>
|
||||||
|
getFieldValue('quantityrestriction') && (
|
||||||
<>
|
<>
|
||||||
<Form.Item name="quantityrestrictiontype" label="How would you like to apply the quantity restriction?">
|
<Form.Item
|
||||||
<Radio.Group onChange={() => formRef.current?.setFieldsValue({ maxquantity: undefined })}>
|
name="quantityrestrictiontype"
|
||||||
|
label="How would you like to apply the quantity restriction?"
|
||||||
|
>
|
||||||
|
<Radio.Group
|
||||||
|
onChange={() =>
|
||||||
|
formRef.current?.setFieldsValue({
|
||||||
|
maxquantity: undefined,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
>
|
||||||
{allSettingsMap['overalllimit'] !== undefined && (
|
{allSettingsMap['overalllimit'] !== undefined && (
|
||||||
<Radio value="overall">Overall Order Quantity</Radio>
|
<Radio value="overall">
|
||||||
|
Overall Order Quantity
|
||||||
|
</Radio>
|
||||||
)}
|
)}
|
||||||
{allSettingsMap['itemwiselimit'] !== undefined && (
|
{allSettingsMap['itemwiselimit'] !==
|
||||||
<Radio value="itemwise">Item-wise Quantity</Radio>
|
undefined && (
|
||||||
|
<Radio value="itemwise">
|
||||||
|
Item-wise Quantity
|
||||||
|
</Radio>
|
||||||
)}
|
)}
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
@ -835,14 +943,22 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
||||||
name="maxquantity"
|
name="maxquantity"
|
||||||
label="Maximum quantity allowed:"
|
label="Maximum quantity allowed:"
|
||||||
rules={[
|
rules={[
|
||||||
{ required: true, message: 'Please enter maximum quantity' },
|
{
|
||||||
{ type: 'number', min: 1, message: 'Quantity must be greater than 0' }
|
required: true,
|
||||||
|
message: 'Please enter maximum quantity',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'number',
|
||||||
|
min: 1,
|
||||||
|
message: 'Quantity must be greater than 0',
|
||||||
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<InputNumber min={1} style={{ width: '200px' }} />
|
<InputNumber min={1} style={{ width: '200px' }} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</>
|
</>
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
@ -969,10 +1085,14 @@ console.log("Wholesale Short Name:", values.wholesaleshortname);
|
||||||
>
|
>
|
||||||
<Checkbox.Group>
|
<Checkbox.Group>
|
||||||
{allSettingsMap['estimateprintheader'] !== undefined && (
|
{allSettingsMap['estimateprintheader'] !== undefined && (
|
||||||
<Checkbox value="estimateprintheader">Show shop header (Name, Address, GST)</Checkbox>
|
<Checkbox value="estimateprintheader">
|
||||||
|
Show shop header (Name, Address, GST)
|
||||||
|
</Checkbox>
|
||||||
)}
|
)}
|
||||||
{allSettingsMap['estimatetitle'] !== undefined && (
|
{allSettingsMap['estimatetitle'] !== undefined && (
|
||||||
<Checkbox value="estimatetitle">Show “Estimate (R/W)” title</Checkbox>
|
<Checkbox value="estimatetitle">
|
||||||
|
Show “Estimate (R/W)” title
|
||||||
|
</Checkbox>
|
||||||
)}
|
)}
|
||||||
</Checkbox.Group>
|
</Checkbox.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue