Fix admin user edit select values
This commit is contained in:
parent
11efad0312
commit
016fef34d3
1 changed files with 9 additions and 6 deletions
|
|
@ -22,6 +22,7 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
|
||||||
import { ROLE_OPTIONS, type RoleOption } from "@/lib/authz"
|
import { ROLE_OPTIONS, type RoleOption } from "@/lib/authz"
|
||||||
|
|
||||||
type AdminRole = RoleOption | "machine"
|
type AdminRole = RoleOption | "machine"
|
||||||
|
const NO_COMPANY_ID = "__none__"
|
||||||
|
|
||||||
type AdminUser = {
|
type AdminUser = {
|
||||||
id: string
|
id: string
|
||||||
|
|
@ -393,10 +394,10 @@ export function AdminUsersManager({ initialUsers, initialInvites, roleOptions, d
|
||||||
}
|
}
|
||||||
|
|
||||||
const isMachineEditing = editUser?.role === "machine"
|
const isMachineEditing = editUser?.role === "machine"
|
||||||
const companyOptions = useMemo(() => [
|
const companyOptions = useMemo(
|
||||||
{ id: "", name: "Sem empresa vinculada" },
|
() => [{ id: NO_COMPANY_ID, name: "Sem empresa vinculada" }, ...companies],
|
||||||
...companies,
|
[companies]
|
||||||
], [companies])
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
@ -768,8 +769,10 @@ export function AdminUsersManager({ initialUsers, initialInvites, roleOptions, d
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label>Empresa vinculada</Label>
|
<Label>Empresa vinculada</Label>
|
||||||
<Select
|
<Select
|
||||||
value={editForm.companyId}
|
value={editForm.companyId ? editForm.companyId : NO_COMPANY_ID}
|
||||||
onValueChange={(value) => setEditForm((prev) => ({ ...prev, companyId: value }))}
|
onValueChange={(value) =>
|
||||||
|
setEditForm((prev) => ({ ...prev, companyId: value === NO_COMPANY_ID ? "" : value }))
|
||||||
|
}
|
||||||
disabled={isSavingUser}
|
disabled={isSavingUser}
|
||||||
>
|
>
|
||||||
<SelectTrigger>
|
<SelectTrigger>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue