Files
fotospiel-app/app/Filament/Pages/SuperAdminProfile.php
SEB Fotografie - soeren fc1e64fea3 feat(profile): add username + preferred_locale; wire to Inertia + middleware
- DB: users.username (unique), users.preferred_locale (default from app.locale)
- Backend: validation, model fillable; share supportedLocales; SetLocaleFromUser
- Frontend: profile page fields + types
- Filament: SuperAdmin profile page with username/language

feat(admin-nav): move Tasks to Bibliothek and add menu labels

fix(tasks-table): show localized title/emotion/event type; add translated headers

feat(l10n): add missing table headers for emotions and event types; normalize en/de files

refactor: tidy translations for tasks/emotions/event types
2025-09-11 21:17:19 +02:00

60 lines
1.7 KiB
PHP

<?php
namespace App\Filament\Pages;
use Filament\Auth\Pages\EditProfile as BaseEditProfile;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Component;
use Filament\Schemas\Schema;
class SuperAdminProfile extends BaseEditProfile
{
protected function getUsernameFormComponent(): Component
{
return TextInput::make('username')
->label(__('Username'))
->maxLength(32)
->unique(ignoreRecord: true);
}
protected function getPreferredLocaleFormComponent(): Component
{
$supported = collect(explode(',', (string) env('APP_SUPPORTED_LOCALES', 'de,en')))
->map(fn ($l) => trim((string) $l))
->filter()
->unique()
->values()
->all();
if (empty($supported)) {
$supported = array_values(array_unique(array_filter([
config('app.locale'),
config('app.fallback_locale'),
])));
}
$options = collect($supported)->mapWithKeys(fn ($l) => [$l => strtoupper($l)])->all();
return Select::make('preferred_locale')
->label(__('Language'))
->required()
->options($options);
}
public function form(Schema $schema): Schema
{
return $schema
->components([
$this->getNameFormComponent(),
$this->getEmailFormComponent(),
$this->getUsernameFormComponent(),
$this->getPreferredLocaleFormComponent(),
$this->getPasswordFormComponent(),
$this->getPasswordConfirmationFormComponent(),
$this->getCurrentPasswordFormComponent(),
]);
}
}