mirror of
https://github.com/R0m1k3/Regisflow.git
synced 2026-10-11 17:29:48 +02:00
Conditionally show store selector for user administration form
Removes the store selector from the user edit form when editing self, adding conditional rendering. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 91318273-c764-4fd4-be04-bdc12c38af32 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/9d9e1107-c416-4124-a939-a91c612c56a1.jpg
This commit is contained in:
1 parent
4dbdda2071
commit
2194d5914e
1 file changed
+8
-14
@@ -867,12 +867,11 @@ export default function Administration() {
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<FormField
|
||||
control={editUserForm.control}
|
||||
name="storeId"
|
||||
render={({ field }) => {
|
||||
const isEditingSelf = editingUser?.id === currentUser?.id;
|
||||
return (
|
||||
{editingUser?.id !== currentUser?.id && (
|
||||
<FormField
|
||||
control={editUserForm.control}
|
||||
name="storeId"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Magasin</FormLabel>
|
||||
<Select value={field.value?.toString() || "none"} onValueChange={(value) => field.onChange(value === "none" ? undefined : parseInt(value))}>
|
||||
@@ -890,16 +889,11 @@ export default function Administration() {
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
{isEditingSelf && (
|
||||
<p className="text-sm text-muted-foreground">
|
||||
En tant qu'administrateur, vous pouvez accéder à tous les magasins
|
||||
</p>
|
||||
)}
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex justify-end space-x-2">
|
||||
<Button type="button" variant="outline" onClick={() => setEditingUser(null)}>
|
||||
|
||||
Reference in new issue
Block a user