Skip to content

Commit

Permalink
Update secret santa screen
Browse files Browse the repository at this point in the history
  • Loading branch information
tabuna committed Dec 24, 2024
1 parent fc041b6 commit 4835f8e
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions app/Orchid/Screens/SecretSantaScreen.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Models\SecretSantaParticipant;
use Orchid\Screen\Actions\Link;
use Orchid\Screen\Components\Cells\DateTimeSplit;
use Orchid\Screen\Screen;
use Orchid\Screen\TD;
use Orchid\Support\Facades\Layout;
Expand Down Expand Up @@ -51,32 +52,41 @@ public function layout(): array
{
return [
Layout::table('participants', [
TD::make('user.name', 'Пользователь')
->width('20%'),
TD::make('user.name', 'Пользователь (Санта)'),

TD::make('receiver', 'Получатель')
->width('20%')
->render(fn (SecretSantaParticipant $participant) => $participant->receiver?->user->name ?? 'Не назначен'
->render(fn(SecretSantaParticipant $participant) => $participant->receiver?->user->name ?? 'Не назначен'
),

/*
TD::make('santa', 'Санта')
->width('20%')
->align(TD::ALIGN_CENTER)
->render(fn (SecretSantaParticipant $participant) => $participant->santa?->user->name ?? 'Не назначен'
->render(fn(SecretSantaParticipant $participant) => $participant->santa?->user->name ?? 'Не назначен'
),
*/

TD::make('address', 'Адрес')
->width('25%'),
TD::make('receiver.address', 'Адрес'),

TD::make('telegram', 'Telegram')
->width('15%')
->render(fn (SecretSantaParticipant $participant) => $participant->telegram
? Link::make($participant->telegram)->href("https://t.me/{$participant->telegram}")
TD::make('receiver.telegram', 'Telegram')
->render(fn(SecretSantaParticipant $participant) => $participant->receiver?->telegram
? Link::make($participant->receiver?->telegram)->href("https://t.me/{$participant->receiver?->telegram}")
: ''
),

TD::make('tracking_number', 'Трек-номер')
->width('20%'),
TD::make('receiver.tracking_number', 'Трек-номер'),

TD::make('receiver.phone', 'Номер телефона'),

TD::make('status', 'Статус')
->render(fn(SecretSantaParticipant $participant) => $participant->status === 'done'
? '✅ Завершён'
: '⏳ Ожидает'
),

TD::make('updated_at', 'Последнее обновление')
->defaultHidden()
->usingComponent(DateTimeSplit::class)
->align(TD::ALIGN_RIGHT)
->sort(),
]),
];
}
Expand Down

0 comments on commit 4835f8e

Please sign in to comment.