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
This commit is contained in:
@@ -24,43 +24,48 @@ class EmotionResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Emotion::class;
|
||||
protected static BackedEnum|string|null $navigationIcon = 'heroicon-o-face-smile';
|
||||
protected static UnitEnum|string|null $navigationGroup = 'Library';
|
||||
protected static UnitEnum|string|null $navigationGroup = null;
|
||||
|
||||
public static function getNavigationGroup(): UnitEnum|string|null
|
||||
{
|
||||
return __('admin.nav.library');
|
||||
}
|
||||
protected static ?int $navigationSort = 10;
|
||||
|
||||
public static function form(Schema $form): Schema
|
||||
{
|
||||
return $form->schema([
|
||||
SchemaTabs::make('content_tabs')
|
||||
->label('Content Localization')
|
||||
->label(__('admin.emotions.sections.content_localization'))
|
||||
->tabs([
|
||||
SchemaTab::make('German')
|
||||
SchemaTab::make(__('admin.common.german'))
|
||||
->icon('heroicon-o-language')
|
||||
->schema([
|
||||
TextInput::make('name.de')
|
||||
->label('Name (German)')
|
||||
->label(__('admin.emotions.fields.name_de'))
|
||||
->required(),
|
||||
MarkdownEditor::make('description.de')
|
||||
->label('Description (German)')
|
||||
->label(__('admin.emotions.fields.description_de'))
|
||||
->columnSpanFull(),
|
||||
]),
|
||||
SchemaTab::make('English')
|
||||
SchemaTab::make(__('admin.common.english'))
|
||||
->icon('heroicon-o-language')
|
||||
->schema([
|
||||
TextInput::make('name.en')
|
||||
->label('Name (English)')
|
||||
->label(__('admin.emotions.fields.name_en'))
|
||||
->required(),
|
||||
MarkdownEditor::make('description.en')
|
||||
->label('Description (English)')
|
||||
->label(__('admin.emotions.fields.description_en'))
|
||||
->columnSpanFull(),
|
||||
]),
|
||||
])
|
||||
->columnSpanFull(),
|
||||
TextInput::make('icon')->label('Icon/Emoji')->maxLength(50),
|
||||
TextInput::make('icon')->label(__('admin.emotions.fields.icon_emoji'))->maxLength(50),
|
||||
TextInput::make('color')->maxLength(7)->helperText('#RRGGBB'),
|
||||
TextInput::make('sort_order')->numeric()->default(0),
|
||||
Toggle::make('is_active')->default(true),
|
||||
Select::make('eventTypes')
|
||||
->label('Event Types')
|
||||
->label(__('admin.emotions.fields.event_types'))
|
||||
->multiple()
|
||||
->searchable()
|
||||
->preload()
|
||||
@@ -72,12 +77,36 @@ class EmotionResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')->sortable(),
|
||||
Tables\Columns\TextColumn::make('name')->searchable(),
|
||||
Tables\Columns\TextColumn::make('icon'),
|
||||
Tables\Columns\TextColumn::make('color'),
|
||||
Tables\Columns\IconColumn::make('is_active')->boolean(),
|
||||
Tables\Columns\TextColumn::make('sort_order')->sortable(),
|
||||
Tables\Columns\TextColumn::make('id')
|
||||
->label('#')
|
||||
->sortable(),
|
||||
|
||||
Tables\Columns\TextColumn::make('name')
|
||||
->label(__('admin.emotions.table.name'))
|
||||
->getStateUsing(function ($record) {
|
||||
$value = $record->name;
|
||||
if (is_array($value)) {
|
||||
$loc = app()->getLocale();
|
||||
return $value[$loc] ?? ($value['de'] ?? ($value['en'] ?? ''));
|
||||
}
|
||||
return (string) $value;
|
||||
})
|
||||
->searchable(['name->de', 'name->en'])
|
||||
->limit(60),
|
||||
|
||||
Tables\Columns\TextColumn::make('icon')
|
||||
->label(__('admin.emotions.table.icon')),
|
||||
|
||||
Tables\Columns\TextColumn::make('color')
|
||||
->label(__('admin.emotions.table.color')),
|
||||
|
||||
Tables\Columns\IconColumn::make('is_active')
|
||||
->label(__('admin.emotions.table.is_active'))
|
||||
->boolean(),
|
||||
|
||||
Tables\Columns\TextColumn::make('sort_order')
|
||||
->label(__('admin.emotions.table.sort_order'))
|
||||
->sortable(),
|
||||
])
|
||||
->filters([])
|
||||
->actions([
|
||||
|
||||
Reference in New Issue
Block a user