Fixed role management while changing own role and removed No access from dashboard dropdown role

This commit is contained in:
Luka Radenovic 2022-06-15 14:50:35 +02:00
parent bca39f1091
commit 9cfb16a7e7

View file

@ -122,7 +122,8 @@ export const UserModal = ({ open, onClose, userId, setUserId }: UserModalProps)
<div className="sm:col-span-3">
<Input control={control} name="email" label="Email" type="email" onKeyPress={handleKeyPress} />
</div>
{isAdmin && (
<>
<div className="sm:col-span-3">
{fields
.filter((field) => field.name === 'dashboard')
@ -133,15 +134,12 @@ export const UserModal = ({ open, onClose, userId, setUserId }: UserModalProps)
name={`app_roles.${index}.role`}
label="Role"
options={[
{ value: UserRole.NoAccess, name: 'No access' },
{ value: UserRole.User, name: 'User' },
{ value: UserRole.Admin, name: 'Admin' },
]}
/>
))}
</div>
{isAdmin && (
<div className="sm:col-span-3 opacity-40 cursor-default pointer-events-none select-none">
<label htmlFor="status" className="block text-sm font-medium text-gray-700">
Status
@ -158,6 +156,7 @@ export const UserModal = ({ open, onClose, userId, setUserId }: UserModalProps)
</select>
</div>
</div>
</>
)}
</div>
</div>