const searchByOfferName = () => {
if (!offerTemplate) {
return customer.supportOffers.filter((offer) => offer);
}
return (
customer?.supportOffers?.filter(
(offer) =>
offer?.name &&
offerTemplate.length > 2 &&
offer?.name?.toLowerCase().includes(offerTemplate),
)
);
};
return {
...
<form onSubmit={handleSubmit}>
<DialogContent>
<Grid container spacing={2}>
<Grid item xs={12}>
<FormControl
variant="outlined"
className={classes.formControl}
error={hasSubmitted && !offerTemplate}
>
{searchByOfferName && (
<Autocomplete
...
)} |