update
This commit is contained in:
@@ -61,7 +61,7 @@ import {
|
||||
function useCanWrite(): boolean {
|
||||
const { user } = useAuth();
|
||||
const groups: string[] = (user as any)?.groups ?? [];
|
||||
return groups.includes('feuerwehr-admin') || groups.includes('feuerwehr-kommandant');
|
||||
return groups.includes('dashboard_admin') || groups.includes('dashboard_kommando');
|
||||
}
|
||||
|
||||
function useCurrentUserId(): string | undefined {
|
||||
@@ -473,11 +473,36 @@ function MitgliedDetail() {
|
||||
</Box>
|
||||
|
||||
{!profile && (
|
||||
<Alert severity="info" sx={{ mt: 2 }}>
|
||||
<Alert
|
||||
severity="info"
|
||||
sx={{ mt: 2 }}
|
||||
action={
|
||||
canWrite ? (
|
||||
<Button
|
||||
color="inherit"
|
||||
size="small"
|
||||
disabled={saving}
|
||||
onClick={async () => {
|
||||
if (!userId) return;
|
||||
setSaving(true);
|
||||
setSaveError(null);
|
||||
try {
|
||||
await membersService.createMemberProfile(userId, { status: 'aktiv' });
|
||||
await loadMember();
|
||||
} catch {
|
||||
setSaveError('Profil konnte nicht erstellt werden.');
|
||||
} finally {
|
||||
setSaving(false);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{saving ? <CircularProgress size={16} /> : 'Profil erstellen'}
|
||||
</Button>
|
||||
) : undefined
|
||||
}
|
||||
>
|
||||
Für dieses Mitglied wurde noch kein Profil angelegt.
|
||||
{canWrite
|
||||
? ' Ein Kommandant kann das Profil unter "Stammdaten" erstellen.'
|
||||
: ' Wende dich an einen Administrator, um dein Profil anlegen zu lassen.'}
|
||||
{!canWrite && ' Wende dich an einen Administrator, um dein Profil anlegen zu lassen.'}
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user