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([])
|
||||
|
||||
Reference in New Issue
Block a user