fix: add name attributes to input fields in FormEditOrder and SearchInput components
This commit is contained in:
parent
b4acbbaff9
commit
621d227760
2 changed files with 26 additions and 12 deletions
|
|
@ -67,6 +67,7 @@ function SearchInput<TData>() {
|
||||||
return (
|
return (
|
||||||
<Input
|
<Input
|
||||||
className="mt-0 h-8 w-37.5"
|
className="mt-0 h-8 w-37.5"
|
||||||
|
name={columnName}
|
||||||
onChange={(event) =>
|
onChange={(event) =>
|
||||||
table.getColumn(columnName)?.setFilterValue(event.target.value)
|
table.getColumn(columnName)?.setFilterValue(event.target.value)
|
||||||
}
|
}
|
||||||
|
|
@ -78,6 +79,7 @@ function SearchInput<TData>() {
|
||||||
return (
|
return (
|
||||||
<Input
|
<Input
|
||||||
className="mt-0 h-8 w-37.5"
|
className="mt-0 h-8 w-37.5"
|
||||||
|
name="globalSearch"
|
||||||
onChange={(event) => table.setGlobalFilter(String(event.target.value))}
|
onChange={(event) => table.setGlobalFilter(String(event.target.value))}
|
||||||
placeholder={searchColumn.placeholder}
|
placeholder={searchColumn.placeholder}
|
||||||
value={globalFilter ?? ""}
|
value={globalFilter ?? ""}
|
||||||
|
|
|
||||||
|
|
@ -87,9 +87,9 @@ export const FormEditOrder = ({ prezziario, data, close }: FormProps) => {
|
||||||
toast.error(`Errore durante la rimozione ordine: ${error.message}`);
|
toast.error(`Errore durante la rimozione ordine: ${error.message}`);
|
||||||
},
|
},
|
||||||
onSuccess: async () => {
|
onSuccess: async () => {
|
||||||
toast.success("Ordine rimosso con successo!");
|
|
||||||
await utils.servizio.invalidate();
|
|
||||||
close();
|
close();
|
||||||
|
toast.success("Ordine rimosso con successo!");
|
||||||
|
await utils.servizio.getOrdini.invalidate({});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -176,20 +176,21 @@ export const FormEditOrder = ({ prezziario, data, close }: FormProps) => {
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<div className="flex flex-wrap items-center gap-x-2">
|
<div className="flex flex-wrap items-center gap-x-2">
|
||||||
<FormLabel htmlFor="titolo">Tipologia</FormLabel>
|
<FormLabel htmlFor="tipologia">Tipologia</FormLabel>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</div>
|
</div>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Select
|
<Select
|
||||||
defaultValue={field.value || ""}
|
defaultValue={field.value || ""}
|
||||||
|
name="type"
|
||||||
onValueChange={field.onChange}
|
onValueChange={field.onChange}
|
||||||
>
|
>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<SelectTrigger className="w-full">
|
<SelectTrigger className="w-full" id="tipologia">
|
||||||
<SelectValue placeholder="Seleziona tipologia" />
|
<SelectValue placeholder="Seleziona tipologia" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<SelectContent id="select-color">
|
<SelectContent>
|
||||||
{Object.values(OrderTypeEnum).map((option) => (
|
{Object.values(OrderTypeEnum).map((option) => (
|
||||||
<SelectItem key={option} value={option}>
|
<SelectItem key={option} value={option}>
|
||||||
{option}
|
{option}
|
||||||
|
|
@ -262,6 +263,7 @@ export const FormEditOrder = ({ prezziario, data, close }: FormProps) => {
|
||||||
className="data-[state=checked]:bg-neutral-700"
|
className="data-[state=checked]:bg-neutral-700"
|
||||||
defaultChecked={field.value}
|
defaultChecked={field.value}
|
||||||
id="isActive"
|
id="isActive"
|
||||||
|
name="isActive"
|
||||||
onCheckedChange={field.onChange}
|
onCheckedChange={field.onChange}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
@ -279,20 +281,26 @@ export const FormEditOrder = ({ prezziario, data, close }: FormProps) => {
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<div className="flex flex-wrap items-center gap-x-2">
|
<div className="flex flex-wrap items-center gap-x-2">
|
||||||
<FormLabel htmlFor="titolo">Stato Pagameto</FormLabel>
|
<FormLabel htmlFor="select-paymentstatus">
|
||||||
|
Stato Pagameto
|
||||||
|
</FormLabel>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</div>
|
</div>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Select
|
<Select
|
||||||
defaultValue={field.value || ""}
|
defaultValue={field.value || ""}
|
||||||
|
name="paymentstatus"
|
||||||
onValueChange={field.onChange}
|
onValueChange={field.onChange}
|
||||||
>
|
>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<SelectTrigger className="w-full">
|
<SelectTrigger
|
||||||
|
className="w-full"
|
||||||
|
id="select-paymentstatus"
|
||||||
|
>
|
||||||
<SelectValue placeholder="Seleziona tipologia" />
|
<SelectValue placeholder="Seleziona tipologia" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<SelectContent id="select-paymentstatus">
|
<SelectContent>
|
||||||
{Object.values(PaymentStatusEnum).map((option) => (
|
{Object.values(PaymentStatusEnum).map((option) => (
|
||||||
<SelectItem key={option} value={option}>
|
<SelectItem key={option} value={option}>
|
||||||
{option}
|
{option}
|
||||||
|
|
@ -310,7 +318,7 @@ export const FormEditOrder = ({ prezziario, data, close }: FormProps) => {
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<div className="flex flex-wrap items-center gap-x-2">
|
<div className="flex flex-wrap items-center gap-x-2">
|
||||||
<FormLabel htmlFor="titolo">
|
<FormLabel htmlFor="select-paymentmethod">
|
||||||
Metodo di Pagamento
|
Metodo di Pagamento
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|
@ -318,14 +326,18 @@ export const FormEditOrder = ({ prezziario, data, close }: FormProps) => {
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Select
|
<Select
|
||||||
defaultValue={field.value || ""}
|
defaultValue={field.value || ""}
|
||||||
|
name="paymentmethod"
|
||||||
onValueChange={field.onChange}
|
onValueChange={field.onChange}
|
||||||
>
|
>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<SelectTrigger className="w-full">
|
<SelectTrigger
|
||||||
|
className="w-full"
|
||||||
|
id="select-paymentmethod"
|
||||||
|
>
|
||||||
<SelectValue placeholder="Seleziona tipologia" />
|
<SelectValue placeholder="Seleziona tipologia" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<SelectContent id="select-paymentmethod">
|
<SelectContent>
|
||||||
{PAYMENT_TYPES.map((option) => (
|
{PAYMENT_TYPES.map((option) => (
|
||||||
<SelectItem key={option} value={option}>
|
<SelectItem key={option} value={option}>
|
||||||
{option}
|
{option}
|
||||||
|
|
@ -353,7 +365,7 @@ export const FormEditOrder = ({ prezziario, data, close }: FormProps) => {
|
||||||
field.onChange(Number.parseInt(value));
|
field.onChange(Number.parseInt(value));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<SelectTrigger className="w-45">
|
<SelectTrigger className="w-45" id="sconto">
|
||||||
<SelectValue placeholder="Sconto" />
|
<SelectValue placeholder="Sconto" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue