Restrict visibility of 'skipOrdine' field to admin users in FormNewServizioAcquisto

This commit is contained in:
Marco Pedone 2025-08-10 16:21:57 +02:00
parent 099773b161
commit b0bbeba2bb

View file

@ -1460,31 +1460,33 @@ export const FormNewServizioAcquisto = ({
</CardContent> </CardContent>
</Card> </Card>
<div className="flex w-full items-center justify-center gap-2 pb-8 sm:justify-end"> <div className="flex w-full items-center justify-center gap-2 pb-8 sm:justify-end">
<FormField {isAdmin && (
control={form.control} <FormField
name="skipOrdine" control={form.control}
render={({ field }) => ( name="skipOrdine"
<FormItem className="py-2"> render={({ field }) => (
<div className="flex items-center justify-start gap-x-4"> <FormItem className="py-2">
<FormLabel htmlFor="skipOrdine"> <div className="flex items-center justify-start gap-x-4">
Vuoi saltare la creazione dell&apos;ordine e impostare il <FormLabel htmlFor="skipOrdine">
servizio come attivo? Vuoi saltare la creazione dell&apos;ordine e impostare il
</FormLabel> servizio come attivo?
<FormControl> </FormLabel>
<Switch <FormControl>
checked={field.value} <Switch
onCheckedChange={(v) => { checked={field.value}
field.onChange(v); onCheckedChange={(v) => {
}} field.onChange(v);
id="skipOrdine" }}
className="data-[state=checked]:bg-neutral-700" id="skipOrdine"
/> className="data-[state=checked]:bg-neutral-700"
</FormControl> />
<FormMessage /> </FormControl>
</div> <FormMessage />
</FormItem> </div>
)} </FormItem>
/> )}
/>
)}
<Button type="submit" className="w-full sm:w-auto"> <Button type="submit" className="w-full sm:w-auto">
Salva e Procedi Salva e Procedi
</Button> </Button>