Enhance Event admin UI and fix translations
- Remove default_locale and primary_join_token columns from event list - Add read-only join link field to event edit form - Add missing translations for used/remaining photos and join link - Fix array-to-string conversion error in join link modal
This commit is contained in:
@@ -60,6 +60,18 @@ class EventResource extends Resource
|
||||
->required()
|
||||
->unique(ignoreRecord: true)
|
||||
->maxLength(255),
|
||||
TextInput::make('join_link_display')
|
||||
->label(__('admin.events.fields.join_link'))
|
||||
->afterStateHydrated(function (TextInput $component, ?Event $record) {
|
||||
if (! $record) {
|
||||
return;
|
||||
}
|
||||
$token = $record->joinTokens()->latest()->first();
|
||||
$component->state($token ? url('/e/'.$token->token) : '-');
|
||||
})
|
||||
->readOnly()
|
||||
->dehydrated(false)
|
||||
->visibleOn('edit'),
|
||||
DatePicker::make('date')
|
||||
->label(__('admin.events.fields.date'))
|
||||
->required(),
|
||||
@@ -103,7 +115,6 @@ class EventResource extends Resource
|
||||
Tables\Columns\TextColumn::make('slug')->searchable(),
|
||||
Tables\Columns\TextColumn::make('date')->date(),
|
||||
Tables\Columns\IconColumn::make('is_active')->boolean(),
|
||||
Tables\Columns\TextColumn::make('default_locale'),
|
||||
Tables\Columns\TextColumn::make('eventPackage.package.name')
|
||||
->label(__('admin.events.table.package'))
|
||||
->badge()
|
||||
@@ -116,22 +127,6 @@ class EventResource extends Resource
|
||||
->badge()
|
||||
->color(fn ($state) => $state < 1 ? 'danger' : 'success')
|
||||
->getStateUsing(fn ($record) => $record->eventPackage?->remaining_photos ?? 0),
|
||||
Tables\Columns\TextColumn::make('primary_join_token')
|
||||
->label(__('admin.events.table.join'))
|
||||
->getStateUsing(function ($record) {
|
||||
$token = $record->joinTokens()->latest()->first();
|
||||
|
||||
return $token ? url('/e/'.$token->token) : __('admin.events.table.no_join_tokens');
|
||||
})
|
||||
->description(function ($record) {
|
||||
$total = $record->joinTokens()->count();
|
||||
|
||||
return $total > 0
|
||||
? __('admin.events.table.join_tokens_total', ['count' => $total])
|
||||
: __('admin.events.table.join_tokens_missing');
|
||||
})
|
||||
->copyable()
|
||||
->copyMessage(__('admin.events.messages.join_link_copied')),
|
||||
Tables\Columns\TextColumn::make('created_at')->since(),
|
||||
])
|
||||
->filters([])
|
||||
|
||||
@@ -365,13 +365,15 @@ return [
|
||||
'default_locale' => 'Standardsprache',
|
||||
'is_active' => 'Aktiv',
|
||||
'settings' => 'Einstellungen',
|
||||
'join_link' => 'Einladungslink',
|
||||
],
|
||||
'table' => [
|
||||
'tenant' => 'Mandant',
|
||||
'join' => 'Beitreten',
|
||||
'join_tokens_total' => 'Einladungen: :count',
|
||||
'join_tokens_missing' => 'Noch keine Einladungen erstellt',
|
||||
'package' => 'Paket',
|
||||
'used_photos' => 'Fotos',
|
||||
'remaining_photos' => 'Verbleibend',
|
||||
],
|
||||
'relation_managers' => [
|
||||
'event_packages' => [
|
||||
|
||||
@@ -363,16 +363,16 @@ return [
|
||||
'date' => 'Event Date',
|
||||
'type' => 'Event Type',
|
||||
'default_locale' => 'Default Locale',
|
||||
'is_active' => 'Is Active',
|
||||
'settings' => 'Settings',
|
||||
'join_link' => 'Invitation Link',
|
||||
],
|
||||
'table' => [
|
||||
'tenant' => 'Tenant',
|
||||
'join' => 'Join',
|
||||
'join_tokens_total' => 'Invitations: :count',
|
||||
'join_tokens_missing' => 'No invitations created yet',
|
||||
'package' => 'Package',
|
||||
],
|
||||
'used_photos' => 'Used Photos',
|
||||
'remaining_photos' => 'Remaining', ],
|
||||
'relation_managers' => [
|
||||
'event_packages' => [
|
||||
'title' => 'Event Packages',
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<div {{ $stacked }}>
|
||||
<x-filament::section
|
||||
:heading="__('admin.events.join_link.event_label')"
|
||||
:description="$event->name"
|
||||
:description="is_array($event->name) ? ($event->name['de'] ?? collect($event->name)->first() ?? '') : $event->name"
|
||||
:icon="Heroicon::InformationCircle"
|
||||
>
|
||||
<x-slot name="afterHeader">
|
||||
|
||||
Reference in New Issue
Block a user