const esiCashbackTypeOption = [
{
value: '--Please Select--',
label: '--Please Select--'
},
{
value: 'A',
label: 'Amount'
},
{
value: 'P',
label: 'Percentage'
},
{
value: 'R',
label: 'Reward Points'
},
];
//discountlabelType and cashbacklabelType are used to get the data from dropdown
const discountlabelType = [
{
value: '--Please Select--',
label: '--Please Select--'
},
{
value: 'UPTO',
label: 'UPTO'
},
{
value: 'FLAT',
label: 'FLAT'
},
];
const cashbacklabelType = [
{
value: '--Please Select--',
label: '--Please Select--'
},
{
value: 'UPTO',
label: 'UPTO'
},
{
value: 'FLAT',
label: 'FLAT'
},
];
const [disclabelDropDown, setdisclabelDropDown] = useState("");
const [cashbacklabelDropDown, setcashbacklabelDropDown] = useState("");
Discount_Label: '',
Cashback_Label: ''
Discount_Label: Yup.string().when("Discount", (Discount, schema) => {
if (Discount != "") {
return schema.required('Discount Label is required.');
}
}),
Cashback_Label: Yup.string().when("Esi_Cashback_Amount", (Esi_Cashback_Amount, schema) => {
if (Esi_Cashback_Amount != "") {
return schema.required('ESI Cashback Label is required.');
}
}),
{/* Discount Label field with validation*/}
Discount Label
{
props.setFieldValue('Discount_Label', item.value)
setdisclabelDropDown(false);
}}
/>
ESI Cashback Type
{/* ESI Cashback Type field with validation*/}
{
props.setFieldValue('Esi_Cashback_Type', item.value)
setcashbackDropDown(false);
}}
/>
{/* ESI Cashback Amount field with validation*/}
{/* ESI Cashback Label field with validation*/}
ESI Cashback Label
{
props.setFieldValue('Cashback_Label', item.value)
setcashbacklabelDropDown(false);
}}
/>
Discount_Label: data.Discount_Label,
Cashback_Label: data.Cashback_Label,