feat: add first_name and last_name to users and implement inline editing in user-list
All checks were successful
Staging Build / build (push) Successful in 2m40s
All checks were successful
Staging Build / build (push) Successful in 2m40s
This commit is contained in:
@@ -31,6 +31,8 @@ const userSchema = z.object({
|
||||
email: z.string().email('Ungültige E-Mail-Adresse'),
|
||||
role: z.enum(['admin', 'partner']),
|
||||
company_id: z.string().optional().or(z.literal('')),
|
||||
first_name: z.string().optional().or(z.literal('')),
|
||||
last_name: z.string().optional().or(z.literal('')),
|
||||
})
|
||||
|
||||
type UserFormValues = z.infer<typeof userSchema>
|
||||
@@ -63,6 +65,8 @@ export function UserDialog({ companies }: UserDialogProps) {
|
||||
email: '',
|
||||
role: 'partner',
|
||||
company_id: '',
|
||||
first_name: '',
|
||||
last_name: '',
|
||||
},
|
||||
})
|
||||
|
||||
@@ -72,6 +76,8 @@ export function UserDialog({ companies }: UserDialogProps) {
|
||||
email: values.email,
|
||||
role: values.role,
|
||||
company_id: values.company_id || undefined,
|
||||
first_name: values.first_name || undefined,
|
||||
last_name: values.last_name || undefined,
|
||||
}
|
||||
await createUser(payload)
|
||||
setOpen(false)
|
||||
@@ -119,6 +125,34 @@ export function UserDialog({ companies }: UserDialogProps) {
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="first_name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel className="text-white">Vorname</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="Vorname" className="bg-white/5 border-white/10 text-white" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="last_name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel className="text-white">Nachname</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="Nachname" className="bg-white/5 border-white/10 text-white" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="role"
|
||||
|
||||
Reference in New Issue
Block a user