priceoveride
This commit is contained in:
parent
2bdba61c17
commit
6720cc48ab
|
|
@ -46,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;
|
||||||
|
|
@ -141,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' &&
|
||||||
|
|
@ -156,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'
|
||||||
|
|
@ -183,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(() => {
|
||||||
|
|
@ -264,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' })
|
||||||
|
|
@ -302,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 = () => {
|
||||||
|
|
@ -424,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));
|
||||||
|
|
||||||
|
|
@ -3154,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) {
|
||||||
|
|
@ -3213,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) =>
|
||||||
|
|
@ -3292,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);
|
||||||
|
|
@ -3408,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 (
|
||||||
|
|
@ -3420,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');
|
||||||
|
|
@ -3440,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;
|
||||||
}
|
}
|
||||||
|
|
@ -3449,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();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -3573,7 +3662,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Price Change
|
OverRide / Discount
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
@ -3663,62 +3752,147 @@ const BSBillingEditQuantity = (props) => {
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{RadioBtnSelection == 'Price' && (
|
{RadioBtnSelection == 'Price' && (
|
||||||
<div className="EditQuantity-PriceChange">
|
<div style={{ display: "flex" }} >
|
||||||
<label className="EditQuantity-itemname">
|
<div className="EditQuantity-PriceChange">
|
||||||
Item Price: {safeRound(props.Productdata.SellingPrice)} /
|
<label className="EditQuantity-itemname">
|
||||||
per item{' '}
|
Item Price: {safeRound(props.Productdata.SellingPrice)} /
|
||||||
</label>
|
per item{' '}
|
||||||
|
</label>
|
||||||
|
|
||||||
{!RadioDetails && (
|
{!RadioDetails && (
|
||||||
<Form.Item
|
<Form ref={formRef}>
|
||||||
name="SellPrice"
|
<Form.Item
|
||||||
rules={[
|
name="SellPrice"
|
||||||
{
|
initialValue={editedPrice}
|
||||||
pattern: /^(0\d+|[1-9]\d*)(\.\d+)?$/,
|
rules={[
|
||||||
message: 'Please Enter Number Only',
|
{
|
||||||
},
|
pattern: /^(0\d+|[1-9]\d*)(\.\d+)?$/,
|
||||||
{
|
message: 'Please Enter Number Only',
|
||||||
validator: async (_, value) => {
|
},
|
||||||
await validateSafeInput(value);
|
{
|
||||||
|
validator: async (_, value) => {
|
||||||
|
await validateSafeInput(value);
|
||||||
|
|
||||||
if (value && value.length > 10) {
|
if (value && value.length > 10) {
|
||||||
return Promise.reject(
|
return Promise.reject(
|
||||||
'Selling Price should not exceed 10 characters'
|
'Selling Price should not exceed 10 characters'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.resolve();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<InputField
|
||||||
|
ref={priceChangeInputRef}
|
||||||
|
value={editedPrice}
|
||||||
|
label="Price Override"
|
||||||
|
autocomplete="off"
|
||||||
|
onChange={(e) => { SellingPriceChange(e?.target?.value) }}
|
||||||
|
inputMode="decimal"
|
||||||
|
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}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
)}
|
||||||
|
|
||||||
return Promise.resolve();
|
<div className="prodAddDetails" onClick={openRadioDetails}>
|
||||||
},
|
More
|
||||||
},
|
</div>
|
||||||
]}
|
{RadioDetails && (
|
||||||
>
|
<>
|
||||||
<InputField
|
<div className="EditQuantity-Quantity">
|
||||||
ref={priceChangeInputRef}
|
<RadioGrpButton
|
||||||
value={editedPrice}
|
content={[
|
||||||
label="Selling Price"
|
{ value: 'Fixed', label: 'Fixed' },
|
||||||
autocomplete="off"
|
{ value: 'Percentage', label: 'Percentage' },
|
||||||
onChange={SellingPriceChange}
|
]}
|
||||||
inputMode="decimal"
|
fieldState={true}
|
||||||
onInput={(e) => {
|
defaultSelect={PercentageSelection}
|
||||||
const cleanedValue = e.target.value.replace(
|
onSelectFuntion={(e) => {
|
||||||
/[^0-9.]/g,
|
onPercentageSelectionChange(e);
|
||||||
''
|
}}
|
||||||
);
|
/>
|
||||||
const parts = cleanedValue.split('.');
|
</div>
|
||||||
e.target.value =
|
<div className="EditQuantity-Quantity">
|
||||||
parts.length > 2
|
<Form ref={detailedFormRef}>
|
||||||
? `${parts[0]}.${parts.slice(1).join('')}`
|
<Form.Item
|
||||||
: cleanedValue;
|
name="SellPrice"
|
||||||
}}
|
initialValue={editedPrice}
|
||||||
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
|
rules={[
|
||||||
/>
|
{
|
||||||
</Form.Item>
|
pattern: /^[0-9]\d*(\.\d+)?$/,
|
||||||
)}
|
message: 'Please Enter Number Only',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
validator: async (_, value) => {
|
||||||
|
await validateSafeInput(value); // To block HTML tags & SQL keywords
|
||||||
|
return Promise.resolve();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<InputField
|
||||||
|
ref={reductionInputRef}
|
||||||
|
field="SellPrice"
|
||||||
|
name="SellPrice"
|
||||||
|
value={editedPrice}
|
||||||
|
label="Reduction"
|
||||||
|
fieldState={true}
|
||||||
|
fieldApi={true}
|
||||||
|
// id="error2"
|
||||||
|
autocomplete="off"
|
||||||
|
onChange={(e) => PriceChangefun(e)}
|
||||||
|
inputMode="decimal"
|
||||||
|
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}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
{/* <input type="text"
|
||||||
|
onChange={(e)=>PriceChangefun(e)}
|
||||||
|
className="EditQuantity-Pricebox"
|
||||||
|
/> */}
|
||||||
|
</Form>
|
||||||
|
</div>
|
||||||
|
{editedPrice > 0 && <div className="EditQuantity-Quantity">
|
||||||
|
<div className="EditQuantity-itemname">
|
||||||
|
{' '}
|
||||||
|
Price: {safeRound(editedPrice ? editedPrice : 0)}
|
||||||
|
</div>
|
||||||
|
</div>}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="prodAddDetails" onClick={openRadioDetails}>
|
|
||||||
More
|
|
||||||
</div>
|
</div>
|
||||||
{RadioDetails && (
|
<div style={{ borderLeft: "1px solid #ddd", paddingLeft: "15px", marginLeft: "15px" }}>
|
||||||
|
<label className="EditQuantity-itemname">
|
||||||
|
Item Discount
|
||||||
|
</label>
|
||||||
|
|
||||||
<>
|
<>
|
||||||
<div className="EditQuantity-Quantity">
|
<div className="EditQuantity-Quantity">
|
||||||
<RadioGrpButton
|
<RadioGrpButton
|
||||||
|
|
@ -3727,16 +3901,16 @@ const BSBillingEditQuantity = (props) => {
|
||||||
{ value: 'Percentage', label: 'Percentage' },
|
{ value: 'Percentage', label: 'Percentage' },
|
||||||
]}
|
]}
|
||||||
fieldState={true}
|
fieldState={true}
|
||||||
defaultSelect={PercentageSelection}
|
defaultSelect={itemDiscountPercentageSelection}
|
||||||
onSelectFuntion={(e) => {
|
onSelectFuntion={(e) => {
|
||||||
onPercentageSelectionChange(e);
|
onItemDiscountPercentageChange(e);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="EditQuantity-Quantity">
|
<div className="EditQuantity-Quantity">
|
||||||
<Form ref={formRef}>
|
<Form ref={itemDiscountFormRef}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="SellPrice"
|
name="ItemDiscount"
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
pattern: /^[1-9]\d*(\.\d+)?$/,
|
pattern: /^[1-9]\d*(\.\d+)?$/,
|
||||||
|
|
@ -3744,23 +3918,21 @@ const BSBillingEditQuantity = (props) => {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
validator: async (_, value) => {
|
validator: async (_, value) => {
|
||||||
await validateSafeInput(value); // To block HTML tags & SQL keywords
|
await validateSafeInput(value);
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<InputField
|
<InputField
|
||||||
ref={reductionInputRef}
|
field="ItemDiscount"
|
||||||
field="SellPrice"
|
name="ItemDiscount"
|
||||||
name="SellPrice"
|
value={itemDiscountPrice}
|
||||||
value={editedPrice}
|
label="Discount Amount"
|
||||||
label="Reduction"
|
|
||||||
fieldState={true}
|
fieldState={true}
|
||||||
fieldApi={true}
|
fieldApi={true}
|
||||||
// id="error2"
|
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
onChange={(e) => PriceChangefun(e)}
|
onChange={(e) => ItemDiscountChangefun(e)}
|
||||||
inputMode="decimal"
|
inputMode="decimal"
|
||||||
onInput={(e) => {
|
onInput={(e) => {
|
||||||
const cleanedValue = e.target.value.replace(
|
const cleanedValue = e.target.value.replace(
|
||||||
|
|
@ -3773,24 +3945,22 @@ const BSBillingEditQuantity = (props) => {
|
||||||
? `${parts[0]}.${parts.slice(1).join('')}`
|
? `${parts[0]}.${parts.slice(1).join('')}`
|
||||||
: cleanedValue;
|
: cleanedValue;
|
||||||
}}
|
}}
|
||||||
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
|
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{/* <input type="text"
|
|
||||||
onChange={(e)=>PriceChangefun(e)}
|
|
||||||
className="EditQuantity-Pricebox"
|
|
||||||
/> */}
|
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
<div className="EditQuantity-Quantity">
|
{itemDiscountPrice > 0 && editedPrice > 0 && <div className="EditQuantity-Quantity">
|
||||||
<div className="EditQuantity-itemname">
|
<div className="EditQuantity-itemname">
|
||||||
{' '}
|
{' '}
|
||||||
Price: {safeRound(editedPrice ? editedPrice : 0)}
|
{console.log(editedPrice, itemDiscountPrice, "itemDiscountPrice")}
|
||||||
|
Final Price: {safeRound(editedPrice) - (itemDiscountPrice || 0)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>}
|
||||||
</>
|
</>
|
||||||
)}
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
)}
|
)}
|
||||||
{RadioBtnSelection == 'Parcel' && (
|
{RadioBtnSelection == 'Parcel' && (
|
||||||
<>
|
<>
|
||||||
|
|
|
||||||
|
|
@ -2596,7 +2596,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)}`
|
||||||
|
|
@ -2873,7 +2873,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)}`
|
||||||
|
|
@ -3198,7 +3198,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)}`
|
||||||
|
|
@ -3508,7 +3508,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)}`
|
||||||
|
|
|
||||||
|
|
@ -321,7 +321,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);
|
||||||
|
|
||||||
|
|
@ -379,7 +379,7 @@ const BSBillingTable3Pay = () => {
|
||||||
const OrderCardDetail = useSelector(GlobalOrderCardDetails);
|
const OrderCardDetail = useSelector(GlobalOrderCardDetails);
|
||||||
const [customerPreviesOrders, setCustomerPreviesOrders] = useState(false);
|
const [customerPreviesOrders, setCustomerPreviesOrders] = useState(false);
|
||||||
|
|
||||||
console.log(OrderCardDetail, 'OrderCardDetail');
|
console.log(paybtns, 'paybtns');
|
||||||
//Total calculation
|
//Total calculation
|
||||||
const TotalItems = OrderCardDetail?.length;
|
const TotalItems = OrderCardDetail?.length;
|
||||||
const [formattedDate, setFormattedDate] = useState('');
|
const [formattedDate, setFormattedDate] = useState('');
|
||||||
|
|
@ -423,6 +423,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);
|
||||||
|
|
@ -469,6 +470,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);
|
||||||
|
|
@ -993,7 +995,7 @@ const BSBillingTable3Pay = () => {
|
||||||
|
|
||||||
const selectedStyle =
|
const selectedStyle =
|
||||||
stylesMap[
|
stylesMap[
|
||||||
printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle
|
printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle
|
||||||
];
|
];
|
||||||
|
|
||||||
if (selectedStyle) {
|
if (selectedStyle) {
|
||||||
|
|
@ -1072,9 +1074,9 @@ const BSBillingTable3Pay = () => {
|
||||||
setDefaultPaymentMode([]);
|
setDefaultPaymentMode([]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (salesBillEdit) {
|
// if (salesBillEdit) {
|
||||||
setDefaultPaymentOption();
|
setDefaultPaymentOption();
|
||||||
}
|
// }
|
||||||
}, [defaultPaymentTrigger, salesBillEdit]);
|
}, [defaultPaymentTrigger, salesBillEdit]);
|
||||||
|
|
||||||
const TokenPrint = async (index) => {
|
const TokenPrint = async (index) => {
|
||||||
|
|
@ -1614,6 +1616,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'
|
||||||
);
|
);
|
||||||
|
|
@ -1648,6 +1651,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
|
||||||
|
|
@ -2189,6 +2193,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;
|
||||||
|
|
@ -2214,15 +2219,15 @@ const BSBillingTable3Pay = () => {
|
||||||
OrderStatus: 'O',
|
OrderStatus: 'O',
|
||||||
OrderType:
|
OrderType:
|
||||||
BookingType === 'Dine In' ||
|
BookingType === 'Dine In' ||
|
||||||
BookingTypeBoth ||
|
BookingTypeBoth ||
|
||||||
Estimation?.SettingValue == 'N'
|
Estimation?.SettingValue == 'N'
|
||||||
? 'S'
|
? 'S'
|
||||||
: GlobEstBooking === 'OvrAllEst'
|
: GlobEstBooking === 'OvrAllEst'
|
||||||
? 'E'
|
? 'E'
|
||||||
: GlobEstBooking === 'ParEst'
|
: GlobEstBooking === 'ParEst'
|
||||||
? GlobProdwisedata?.includes(
|
? GlobProdwisedata?.includes(
|
||||||
a.InwardDtlId + ' ' + a?.BookingTypeName
|
a.InwardDtlId + ' ' + a?.BookingTypeName
|
||||||
)
|
)
|
||||||
? 'E'
|
? 'E'
|
||||||
: 'S'
|
: 'S'
|
||||||
: 'S',
|
: 'S',
|
||||||
|
|
@ -2239,6 +2244,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
|
||||||
|
|
@ -2314,7 +2323,7 @@ const BSBillingTable3Pay = () => {
|
||||||
: Paybtnnameselected?.toLowerCase() === 'credit'
|
: Paybtnnameselected?.toLowerCase() === 'credit'
|
||||||
? 'S'
|
? 'S'
|
||||||
: Paybtnnameselected?.toLowerCase() === 'upi' &&
|
: Paybtnnameselected?.toLowerCase() === 'upi' &&
|
||||||
SelectedUPIPayOption?.toLowerCase() === 'default'
|
SelectedUPIPayOption?.toLowerCase() === 'default'
|
||||||
? 'S'
|
? 'S'
|
||||||
: 'P',
|
: 'P',
|
||||||
OrderDtlDetails:
|
OrderDtlDetails:
|
||||||
|
|
@ -2331,9 +2340,9 @@ const BSBillingTable3Pay = () => {
|
||||||
? globalTipAmount === 0
|
? globalTipAmount === 0
|
||||||
? SelectedTableDetails
|
? SelectedTableDetails
|
||||||
: SelectedTableDetails?.map((item) => ({
|
: SelectedTableDetails?.map((item) => ({
|
||||||
...item,
|
...item,
|
||||||
TipsAmount: globalTipAmount,
|
TipsAmount: globalTipAmount,
|
||||||
}))
|
}))
|
||||||
: null,
|
: null,
|
||||||
SalesPaymentType: 'normal',
|
SalesPaymentType: 'normal',
|
||||||
PaymentDetail: [
|
PaymentDetail: [
|
||||||
|
|
@ -2348,8 +2357,8 @@ const BSBillingTable3Pay = () => {
|
||||||
? PaymentgatewayUPI?.[0]?.ModeId
|
? PaymentgatewayUPI?.[0]?.ModeId
|
||||||
: SelectedUPIPayOption?.toLowerCase() === 'business'
|
: SelectedUPIPayOption?.toLowerCase() === 'business'
|
||||||
? BusinessPayOption?.find(
|
? BusinessPayOption?.find(
|
||||||
(busupi) => busupi?.ModeId === UpiId
|
(busupi) => busupi?.ModeId === UpiId
|
||||||
)?.ModeId
|
)?.ModeId
|
||||||
: paybtnselected
|
: paybtnselected
|
||||||
: paybtnselected
|
: paybtnselected
|
||||||
? paybtnselected
|
? paybtnselected
|
||||||
|
|
@ -2362,15 +2371,15 @@ const BSBillingTable3Pay = () => {
|
||||||
salesBillEdit && currentOrderNetAmount < previousNetAmount
|
salesBillEdit && currentOrderNetAmount < previousNetAmount
|
||||||
? null
|
? null
|
||||||
: Paybtnnameselected?.toLowerCase() === 'upi' &&
|
: Paybtnnameselected?.toLowerCase() === 'upi' &&
|
||||||
SelectedUPIPayOption?.toLowerCase() === 'business'
|
SelectedUPIPayOption?.toLowerCase() === 'business'
|
||||||
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
|
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
|
||||||
?.MerchantId
|
?.MerchantId
|
||||||
: null,
|
: null,
|
||||||
PaymentOptionType:
|
PaymentOptionType:
|
||||||
salesBillEdit &&
|
salesBillEdit &&
|
||||||
currentOrderNetAmount < previousNetAmount &&
|
currentOrderNetAmount < previousNetAmount &&
|
||||||
(refundPaySelectedName?.toLowerCase() === 'cash' ||
|
(refundPaySelectedName?.toLowerCase() === 'cash' ||
|
||||||
refundPaySelectedName?.toLowerCase() === 'credit')
|
refundPaySelectedName?.toLowerCase() === 'credit')
|
||||||
? 'PC'
|
? 'PC'
|
||||||
: Paybtnnameselected?.toLowerCase() === 'cash'
|
: Paybtnnameselected?.toLowerCase() === 'cash'
|
||||||
? 'PC'
|
? 'PC'
|
||||||
|
|
@ -2390,29 +2399,29 @@ const BSBillingTable3Pay = () => {
|
||||||
? null
|
? null
|
||||||
: SelectedUPIPayOption?.toLowerCase() === 'default'
|
: SelectedUPIPayOption?.toLowerCase() === 'default'
|
||||||
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
|
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
|
||||||
?.UPIDetailId
|
?.UPIDetailId
|
||||||
: SelectedUPIPayOption?.toLowerCase() === 'business'
|
: SelectedUPIPayOption?.toLowerCase() === 'business'
|
||||||
? BusinessPayOption?.find(
|
? BusinessPayOption?.find(
|
||||||
(busupi) => busupi?.ModeId === UpiId
|
(busupi) => busupi?.ModeId === UpiId
|
||||||
)?.MerchantUPIId
|
)?.MerchantUPIId
|
||||||
: null,
|
: null,
|
||||||
AccountDtl:
|
AccountDtl:
|
||||||
salesBillEdit && currentOrderNetAmount < previousNetAmount
|
salesBillEdit && currentOrderNetAmount < previousNetAmount
|
||||||
? []
|
? []
|
||||||
: Paybtnnameselected?.toLowerCase() === 'upi' &&
|
: Paybtnnameselected?.toLowerCase() === 'upi' &&
|
||||||
SelectedUPIPayOption?.toLowerCase() === 'default'
|
SelectedUPIPayOption?.toLowerCase() === 'default'
|
||||||
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
|
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
|
||||||
(upipay) => upipay?.UPIId === UpiId
|
(upipay) => upipay?.UPIId === UpiId
|
||||||
)
|
)
|
||||||
: (Paybtnnameselected?.toLowerCase() === 'upi' &&
|
: (Paybtnnameselected?.toLowerCase() === 'upi' &&
|
||||||
SelectedUPIPayOption?.toLowerCase() === 'pd') ||
|
SelectedUPIPayOption?.toLowerCase() === 'pd') ||
|
||||||
(Paybtnnameselected?.toLowerCase() === 'card' &&
|
(Paybtnnameselected?.toLowerCase() === 'card' &&
|
||||||
SelectedCardOption?.toLowerCase() === 'pd')
|
SelectedCardOption?.toLowerCase() === 'pd')
|
||||||
? useOptions?.[0]?.PaymentDetails?.PaymentDevice
|
? useOptions?.[0]?.PaymentDetails?.PaymentDevice
|
||||||
: (Paybtnnameselected?.toLowerCase() === 'upi' &&
|
: (Paybtnnameselected?.toLowerCase() === 'upi' &&
|
||||||
SelectedUPIPayOption?.toLowerCase() === 'pg') ||
|
SelectedUPIPayOption?.toLowerCase() === 'pg') ||
|
||||||
(Paybtnnameselected?.toLowerCase() === 'card' &&
|
(Paybtnnameselected?.toLowerCase() === 'card' &&
|
||||||
SelectedCardOption?.toLowerCase() === 'pg')
|
SelectedCardOption?.toLowerCase() === 'pg')
|
||||||
? useOptions?.[0]?.PaymentDetails?.PaymentGateway
|
? useOptions?.[0]?.PaymentDetails?.PaymentGateway
|
||||||
: [],
|
: [],
|
||||||
PaymentStatus:
|
PaymentStatus:
|
||||||
|
|
@ -2423,13 +2432,13 @@ const BSBillingTable3Pay = () => {
|
||||||
: Paybtnnameselected?.toLowerCase() === 'credit'
|
: Paybtnnameselected?.toLowerCase() === 'credit'
|
||||||
? 'S'
|
? 'S'
|
||||||
: Paybtnnameselected?.toLowerCase() === 'upi' &&
|
: Paybtnnameselected?.toLowerCase() === 'upi' &&
|
||||||
SelectedUPIPayOption?.toLowerCase() === 'default'
|
SelectedUPIPayOption?.toLowerCase() === 'default'
|
||||||
? 'S'
|
? 'S'
|
||||||
: 'P',
|
: 'P',
|
||||||
Debit:
|
Debit:
|
||||||
salesBillEdit &&
|
salesBillEdit &&
|
||||||
currentOrderNetAmount < previousNetAmount &&
|
currentOrderNetAmount < previousNetAmount &&
|
||||||
refundPaySelectedName?.toLowerCase() === 'credit'
|
refundPaySelectedName?.toLowerCase() === 'credit'
|
||||||
? Math.round(previousNetAmount - currentOrderNetAmount)
|
? Math.round(previousNetAmount - currentOrderNetAmount)
|
||||||
: 0,
|
: 0,
|
||||||
Credit: salesBillEdit
|
Credit: salesBillEdit
|
||||||
|
|
@ -2507,14 +2516,14 @@ const BSBillingTable3Pay = () => {
|
||||||
setMessageType('success');
|
setMessageType('success');
|
||||||
setMessageData(
|
setMessageData(
|
||||||
response?.data?.response +
|
response?.data?.response +
|
||||||
' ' +
|
' ' +
|
||||||
(response?.data?.OrderDetails?.length > 0
|
(response?.data?.OrderDetails?.length > 0
|
||||||
? response?.data?.OrderId &&
|
? response?.data?.OrderId &&
|
||||||
extractLastNumberOrderId(
|
extractLastNumberOrderId(
|
||||||
response?.data?.OrderId,
|
response?.data?.OrderId,
|
||||||
response?.data?.OrderDetails?.[0]?.FYStatus
|
response?.data?.OrderDetails?.[0]?.FYStatus
|
||||||
)
|
)
|
||||||
: '')
|
: '')
|
||||||
);
|
);
|
||||||
response?.data?.OrderDetails?.length > 0 &&
|
response?.data?.OrderDetails?.length > 0 &&
|
||||||
setPrintOrderDetails([response?.data]);
|
setPrintOrderDetails([response?.data]);
|
||||||
|
|
@ -2674,14 +2683,14 @@ const BSBillingTable3Pay = () => {
|
||||||
setMessageType('success');
|
setMessageType('success');
|
||||||
setMessageData(
|
setMessageData(
|
||||||
response?.data?.response +
|
response?.data?.response +
|
||||||
' ' +
|
' ' +
|
||||||
(response?.data?.OrderDetails?.length > 0
|
(response?.data?.OrderDetails?.length > 0
|
||||||
? response?.data?.OrderId &&
|
? response?.data?.OrderId &&
|
||||||
extractLastNumberOrderId(
|
extractLastNumberOrderId(
|
||||||
response?.data?.OrderId,
|
response?.data?.OrderId,
|
||||||
response?.data?.OrderDetails?.[0]?.FYStatus
|
response?.data?.OrderDetails?.[0]?.FYStatus
|
||||||
)
|
)
|
||||||
: '')
|
: '')
|
||||||
);
|
);
|
||||||
response?.data?.OrderDetails?.length > 0 &&
|
response?.data?.OrderDetails?.length > 0 &&
|
||||||
setPrintOrderDetails([response?.data]);
|
setPrintOrderDetails([response?.data]);
|
||||||
|
|
@ -2784,14 +2793,14 @@ const BSBillingTable3Pay = () => {
|
||||||
}
|
}
|
||||||
setMessageData(
|
setMessageData(
|
||||||
response?.data?.response +
|
response?.data?.response +
|
||||||
' ' +
|
' ' +
|
||||||
(response?.data?.OrderDetails?.length > 0
|
(response?.data?.OrderDetails?.length > 0
|
||||||
? response?.data?.OrderId &&
|
? response?.data?.OrderId &&
|
||||||
extractLastNumberOrderId(
|
extractLastNumberOrderId(
|
||||||
response?.data?.OrderId,
|
response?.data?.OrderId,
|
||||||
response?.data?.OrderDetails?.[0]?.FYStatus
|
response?.data?.OrderDetails?.[0]?.FYStatus
|
||||||
)
|
)
|
||||||
: '')
|
: '')
|
||||||
);
|
);
|
||||||
if (response?.data?.OrderDetails?.length > 0) {
|
if (response?.data?.OrderDetails?.length > 0) {
|
||||||
setPrintOrderDetails([response?.data]);
|
setPrintOrderDetails([response?.data]);
|
||||||
|
|
@ -2968,14 +2977,14 @@ const BSBillingTable3Pay = () => {
|
||||||
setMessageType('success');
|
setMessageType('success');
|
||||||
setMessageData(
|
setMessageData(
|
||||||
bookingpaymentupdate?.data?.response +
|
bookingpaymentupdate?.data?.response +
|
||||||
' ' +
|
' ' +
|
||||||
(bookingpaymentupdate?.data?.OrderDetails?.length > 0
|
(bookingpaymentupdate?.data?.OrderDetails?.length > 0
|
||||||
? bookingpaymentupdate?.data?.OrderId &&
|
? bookingpaymentupdate?.data?.OrderId &&
|
||||||
extractLastNumberOrderId(
|
extractLastNumberOrderId(
|
||||||
bookingpaymentupdate?.data?.OrderId,
|
bookingpaymentupdate?.data?.OrderId,
|
||||||
bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus
|
bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus
|
||||||
)
|
)
|
||||||
: '')
|
: '')
|
||||||
);
|
);
|
||||||
bookingpaymentupdate?.data?.OrderDetails?.length > 0 &&
|
bookingpaymentupdate?.data?.OrderDetails?.length > 0 &&
|
||||||
setPrintOrderDetails([bookingpaymentupdate?.data]);
|
setPrintOrderDetails([bookingpaymentupdate?.data]);
|
||||||
|
|
@ -2994,7 +3003,7 @@ const BSBillingTable3Pay = () => {
|
||||||
if (
|
if (
|
||||||
Date.now() - startTime >
|
Date.now() - startTime >
|
||||||
useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes *
|
useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes *
|
||||||
60000
|
60000
|
||||||
) {
|
) {
|
||||||
// 60,000 ms = 1 minute
|
// 60,000 ms = 1 minute
|
||||||
|
|
||||||
|
|
@ -3713,9 +3722,9 @@ const BSBillingTable3Pay = () => {
|
||||||
'not-allowed',
|
'not-allowed',
|
||||||
color:
|
color:
|
||||||
OrderCardDetail?.length > 0 ||
|
OrderCardDetail?.length > 0 ||
|
||||||
(selOption?.value === undefined &&
|
(selOption?.value === undefined &&
|
||||||
GlobalAddCustomerDetails1?.length === 0 &&
|
GlobalAddCustomerDetails1?.length === 0 &&
|
||||||
GetCustId?.CustMobile === undefined)
|
GetCustId?.CustMobile === undefined)
|
||||||
? 'gray'
|
? 'gray'
|
||||||
: 'rgb(18, 146, 238)',
|
: 'rgb(18, 146, 238)',
|
||||||
fontSize: '28px',
|
fontSize: '28px',
|
||||||
|
|
@ -3737,16 +3746,16 @@ const BSBillingTable3Pay = () => {
|
||||||
(BookingType === 'Dine In' ||
|
(BookingType === 'Dine In' ||
|
||||||
BookingTypeBoth ||
|
BookingTypeBoth ||
|
||||||
CheckOrderType?.length > 0) &&
|
CheckOrderType?.length > 0) &&
|
||||||
!unpaidFlow &&
|
!unpaidFlow &&
|
||||||
OrderStatus
|
OrderStatus
|
||||||
? 'none'
|
? 'none'
|
||||||
: 'auto',
|
: 'auto',
|
||||||
opacity:
|
opacity:
|
||||||
(BookingType === 'Dine In' ||
|
(BookingType === 'Dine In' ||
|
||||||
BookingTypeBoth ||
|
BookingTypeBoth ||
|
||||||
CheckOrderType?.length > 0) &&
|
CheckOrderType?.length > 0) &&
|
||||||
!unpaidFlow &&
|
!unpaidFlow &&
|
||||||
OrderStatus
|
OrderStatus
|
||||||
? 0.5
|
? 0.5
|
||||||
: 1,
|
: 1,
|
||||||
width: '2rem',
|
width: '2rem',
|
||||||
|
|
@ -3769,14 +3778,14 @@ const BSBillingTable3Pay = () => {
|
||||||
width: '1.5rem',
|
width: '1.5rem',
|
||||||
cursor:
|
cursor:
|
||||||
OrderCardDetail?.length === 0 ||
|
OrderCardDetail?.length === 0 ||
|
||||||
CheckBookingStatus == 'Close' ||
|
CheckBookingStatus == 'Close' ||
|
||||||
addnewAccess
|
addnewAccess
|
||||||
? 'not-allowed'
|
? 'not-allowed'
|
||||||
: 'pointer',
|
: 'pointer',
|
||||||
color:
|
color:
|
||||||
OrderCardDetail?.length === 0 ||
|
OrderCardDetail?.length === 0 ||
|
||||||
CheckBookingStatus == 'Close' ||
|
CheckBookingStatus == 'Close' ||
|
||||||
addnewAccess
|
addnewAccess
|
||||||
? 'gray'
|
? 'gray'
|
||||||
: 'rgb(18, 146, 238)',
|
: 'rgb(18, 146, 238)',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
|
|
@ -3809,8 +3818,8 @@ const BSBillingTable3Pay = () => {
|
||||||
cursor: OrderCardDetail?.length > 0 && 'not-allowed',
|
cursor: OrderCardDetail?.length > 0 && 'not-allowed',
|
||||||
color:
|
color:
|
||||||
OrderCardDetail?.length > 0 ||
|
OrderCardDetail?.length > 0 ||
|
||||||
(OrderCardDetail?.length > 0 &&
|
(OrderCardDetail?.length > 0 &&
|
||||||
GetCustId?.CustMobile === undefined)
|
GetCustId?.CustMobile === undefined)
|
||||||
? 'gray'
|
? 'gray'
|
||||||
: 'rgb(18, 146, 238)',
|
: 'rgb(18, 146, 238)',
|
||||||
fontSize: '25px',
|
fontSize: '25px',
|
||||||
|
|
@ -3897,65 +3906,65 @@ const BSBillingTable3Pay = () => {
|
||||||
<>
|
<>
|
||||||
{unpaidFlow == false
|
{unpaidFlow == false
|
||||||
? item?.OptionName == 'Hold' &&
|
? item?.OptionName == 'Hold' &&
|
||||||
BookingType !== 'Dine In' &&
|
BookingType !== 'Dine In' &&
|
||||||
!BookingTypeBoth &&
|
!BookingTypeBoth &&
|
||||||
OrderCardDetail?.length != 0 &&
|
OrderCardDetail?.length != 0 &&
|
||||||
CheckOrderType?.length === 0 &&
|
CheckOrderType?.length === 0 &&
|
||||||
OrderType != 'Failed' &&
|
OrderType != 'Failed' &&
|
||||||
CheckBookingStatus != 'Close' &&
|
CheckBookingStatus != 'Close' &&
|
||||||
paybtns?.length > 0 &&
|
paybtns?.length > 0 &&
|
||||||
!addnewAccess && (
|
!addnewAccess && (
|
||||||
<TooltipWrapper
|
<TooltipWrapper
|
||||||
title={'Hold (Alt+W)'}
|
title={'Hold (Alt+W)'}
|
||||||
isMobile={isMobile}
|
isMobile={isMobile}
|
||||||
>
|
>
|
||||||
{' '}
|
{' '}
|
||||||
<PozoHoldIcon
|
<PozoHoldIcon
|
||||||
className="BSBillingNav-icon-table-icon"
|
className="BSBillingNav-icon-table-icon"
|
||||||
onClick={() => AddBookingDetails('Hold', false)}
|
onClick={() => AddBookingDetails('Hold', false)}
|
||||||
style={{
|
style={{
|
||||||
fontSize: '30px',
|
fontSize: '30px',
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
color: '' ? '#52c41a' : '#1292EE',
|
color: '' ? '#52c41a' : '#1292EE',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</TooltipWrapper>
|
</TooltipWrapper>
|
||||||
)
|
)
|
||||||
: ''}
|
: ''}
|
||||||
|
|
||||||
{unpaidFlow == false
|
{unpaidFlow == false
|
||||||
? item?.OptionName == 'Hold' &&
|
? item?.OptionName == 'Hold' &&
|
||||||
paybtns?.length > 0 &&
|
paybtns?.length > 0 &&
|
||||||
BookingType !== 'Dine In' &&
|
BookingType !== 'Dine In' &&
|
||||||
!BookingTypeBoth &&
|
!BookingTypeBoth &&
|
||||||
Holddata?.length > 0 &&
|
Holddata?.length > 0 &&
|
||||||
OrderCardDetail?.length == 0 &&
|
OrderCardDetail?.length == 0 &&
|
||||||
CheckBookingStatus != 'Close' &&
|
CheckBookingStatus != 'Close' &&
|
||||||
!addnewAccess && (
|
!addnewAccess && (
|
||||||
<TooltipWrapper
|
<TooltipWrapper
|
||||||
title={'Recall (Alt+W)'}
|
title={'Recall (Alt+W)'}
|
||||||
isMobile={isMobile}
|
isMobile={isMobile}
|
||||||
|
>
|
||||||
|
{' '}
|
||||||
|
<Badge
|
||||||
|
count={Holddata?.length}
|
||||||
|
size={'small'}
|
||||||
|
offset={[0, 7]}
|
||||||
>
|
>
|
||||||
{' '}
|
<PozoHoldIcon
|
||||||
<Badge
|
className="BSBillingNav-icon-table-icon"
|
||||||
count={Holddata?.length}
|
onClick={() => HandleholdModelOpen()}
|
||||||
size={'small'}
|
style={{
|
||||||
offset={[0, 7]}
|
fontSize: '28px',
|
||||||
>
|
cursor: 'pointer',
|
||||||
<PozoHoldIcon
|
color: Holddata ? '#52c41a' : 'default',
|
||||||
className="BSBillingNav-icon-table-icon"
|
pointerEvents:
|
||||||
onClick={() => HandleholdModelOpen()}
|
OrderType === 'Failed' ? 'none' : 'auto',
|
||||||
style={{
|
}}
|
||||||
fontSize: '28px',
|
/>
|
||||||
cursor: 'pointer',
|
</Badge>
|
||||||
color: Holddata ? '#52c41a' : 'default',
|
</TooltipWrapper>
|
||||||
pointerEvents:
|
)
|
||||||
OrderType === 'Failed' ? 'none' : 'auto',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Badge>
|
|
||||||
</TooltipWrapper>
|
|
||||||
)
|
|
||||||
: ''}
|
: ''}
|
||||||
</>
|
</>
|
||||||
))}
|
))}
|
||||||
|
|
@ -4001,14 +4010,14 @@ const BSBillingTable3Pay = () => {
|
||||||
width: '1.5rem',
|
width: '1.5rem',
|
||||||
cursor:
|
cursor:
|
||||||
OrderCardDetail?.length === 0 ||
|
OrderCardDetail?.length === 0 ||
|
||||||
CheckBookingStatus == 'Close' ||
|
CheckBookingStatus == 'Close' ||
|
||||||
addnewAccess
|
addnewAccess
|
||||||
? 'not-allowed'
|
? 'not-allowed'
|
||||||
: 'pointer',
|
: 'pointer',
|
||||||
color:
|
color:
|
||||||
OrderCardDetail?.length === 0 ||
|
OrderCardDetail?.length === 0 ||
|
||||||
CheckBookingStatus == 'Close' ||
|
CheckBookingStatus == 'Close' ||
|
||||||
addnewAccess
|
addnewAccess
|
||||||
? 'gray'
|
? 'gray'
|
||||||
: 'rgb(18, 146, 238)',
|
: 'rgb(18, 146, 238)',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
|
|
@ -4070,31 +4079,31 @@ const BSBillingTable3Pay = () => {
|
||||||
(BookingType === 'Dine In' ||
|
(BookingType === 'Dine In' ||
|
||||||
BookingTypeBoth ||
|
BookingTypeBoth ||
|
||||||
CheckOrderType?.length > 0) &&
|
CheckOrderType?.length > 0) &&
|
||||||
!unpaidFlow &&
|
!unpaidFlow &&
|
||||||
OrderStatus
|
OrderStatus
|
||||||
? 'none'
|
? 'none'
|
||||||
: 'auto',
|
: 'auto',
|
||||||
opacity:
|
opacity:
|
||||||
(BookingType === 'Dine In' ||
|
(BookingType === 'Dine In' ||
|
||||||
BookingTypeBoth ||
|
BookingTypeBoth ||
|
||||||
CheckOrderType?.length > 0) &&
|
CheckOrderType?.length > 0) &&
|
||||||
!unpaidFlow &&
|
!unpaidFlow &&
|
||||||
OrderStatus
|
OrderStatus
|
||||||
? 0.5
|
? 0.5
|
||||||
: 1,
|
: 1,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{paybtns?.length > 0 &&
|
{paybtns?.length > 0 &&
|
||||||
currentOrderNetAmount >= previousNetAmount ? (
|
currentOrderNetAmount >= previousNetAmount ? (
|
||||||
paybtns?.map((payment) => (
|
paybtns?.map((payment) => (
|
||||||
<div className="Table3-cash">
|
<div className="Table3-cash">
|
||||||
<button
|
<button
|
||||||
className={
|
className={
|
||||||
paybtnselected === payment.ModeId &&
|
paybtnselected === payment.ModeId &&
|
||||||
(UpinotSelected || CardoptionnotSelected)
|
(UpinotSelected || CardoptionnotSelected)
|
||||||
? 'Btn-payment-mode-notupisel'
|
? 'Btn-payment-mode-notupisel'
|
||||||
: paybtnselected === payment.ModeId &&
|
: paybtnselected === payment.ModeId &&
|
||||||
(!UpinotSelected || !CardoptionnotSelected)
|
(!UpinotSelected || !CardoptionnotSelected)
|
||||||
? 'Btn-payment-mode'
|
? 'Btn-payment-mode'
|
||||||
: 'Btn-payment-mode-sel'
|
: 'Btn-payment-mode-sel'
|
||||||
}
|
}
|
||||||
|
|
@ -4108,13 +4117,13 @@ const BSBillingTable3Pay = () => {
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
payment?.ModeName?.toLowerCase() === 'upi' // Change the condition to payment.Id
|
payment?.ModeName?.toLowerCase() === 'upi' // Change the condition to payment.Id
|
||||||
? handleUPIButtonClick(
|
? handleUPIButtonClick(
|
||||||
payment.ModeId,
|
payment.ModeId,
|
||||||
payment.ModeName
|
payment.ModeName
|
||||||
)
|
)
|
||||||
: handlePaymentMode(
|
: handlePaymentMode(
|
||||||
payment.ModeId,
|
payment.ModeId,
|
||||||
payment.ModeName
|
payment.ModeName
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
|
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
|
||||||
|
|
@ -4174,10 +4183,10 @@ const BSBillingTable3Pay = () => {
|
||||||
<button
|
<button
|
||||||
className={
|
className={
|
||||||
refundPaySelected === payment.ConfigId &&
|
refundPaySelected === payment.ConfigId &&
|
||||||
(UpinotSelected || CardoptionnotSelected)
|
(UpinotSelected || CardoptionnotSelected)
|
||||||
? 'Btn-payment-mode-notupisel'
|
? 'Btn-payment-mode-notupisel'
|
||||||
: refundPaySelected === payment.ConfigId &&
|
: refundPaySelected === payment.ConfigId &&
|
||||||
(!UpinotSelected || !CardoptionnotSelected)
|
(!UpinotSelected || !CardoptionnotSelected)
|
||||||
? 'Btn-payment-mode'
|
? 'Btn-payment-mode'
|
||||||
: 'Btn-payment-mode-sel'
|
: 'Btn-payment-mode-sel'
|
||||||
}
|
}
|
||||||
|
|
@ -4449,9 +4458,9 @@ const BSBillingTable3Pay = () => {
|
||||||
addnewAccess
|
addnewAccess
|
||||||
? 'BSBillingTable3-paybtn-deactive'
|
? 'BSBillingTable3-paybtn-deactive'
|
||||||
: FirstPaymentclick === false &&
|
: FirstPaymentclick === false &&
|
||||||
OrderCardDetail?.length > 0 &&
|
OrderCardDetail?.length > 0 &&
|
||||||
paybtnselected &&
|
paybtnselected &&
|
||||||
CheckBookingStatus != 'Close'
|
CheckBookingStatus != 'Close'
|
||||||
? !OrderStatus
|
? !OrderStatus
|
||||||
? salesBillEdit &&
|
? salesBillEdit &&
|
||||||
currentOrderNetAmount < previousNetAmount
|
currentOrderNetAmount < previousNetAmount
|
||||||
|
|
@ -4469,7 +4478,7 @@ const BSBillingTable3Pay = () => {
|
||||||
// financialYearError:
|
// financialYearError:
|
||||||
handleButtonClick
|
handleButtonClick
|
||||||
}
|
}
|
||||||
//dhana
|
//dhana
|
||||||
>
|
>
|
||||||
{!OrderStatus ? (
|
{!OrderStatus ? (
|
||||||
salesBillEdit && currentOrderNetAmount < previousNetAmount ? (
|
salesBillEdit && currentOrderNetAmount < previousNetAmount ? (
|
||||||
|
|
@ -4698,14 +4707,14 @@ const BSBillingTable3Pay = () => {
|
||||||
OrderType === 'Failed'
|
OrderType === 'Failed'
|
||||||
? FailedTotalAmt
|
? FailedTotalAmt
|
||||||
: Math.round(
|
: Math.round(
|
||||||
OrderCardDetail?.reduce(
|
OrderCardDetail?.reduce(
|
||||||
(acc, data) => data?.TotalAmt + acc,
|
(acc, data) => data?.TotalAmt + acc,
|
||||||
0
|
0
|
||||||
) -
|
) -
|
||||||
((OverAllSales > 0 ? OverAllSales : 0) +
|
((OverAllSales > 0 ? OverAllSales : 0) +
|
||||||
(OverAllEstimate > 0 ? OverAllEstimate : 0) +
|
(OverAllEstimate > 0 ? OverAllEstimate : 0) +
|
||||||
(Discount > 0 ? Discount : 0))
|
(Discount > 0 ? Discount : 0))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
failedOrderData={failedOrderData}
|
failedOrderData={failedOrderData}
|
||||||
/>
|
/>
|
||||||
|
|
@ -4781,9 +4790,9 @@ const BSBillingTable3Pay = () => {
|
||||||
|
|
||||||
const qty = isGroup
|
const qty = isGroup
|
||||||
? OrderCardDetail.filter((o) => o.id === groupKey).reduce(
|
? OrderCardDetail.filter((o) => o.id === groupKey).reduce(
|
||||||
(sum, o) => sum + (o.OrderQty || 1),
|
(sum, o) => sum + (o.OrderQty || 1),
|
||||||
0
|
0
|
||||||
)
|
)
|
||||||
: item.OrderQty || 1;
|
: item.OrderQty || 1;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue