Skip to content

Commit 4835f8e

Browse files
committed
Update secret santa screen
1 parent fc041b6 commit 4835f8e

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

app/Orchid/Screens/SecretSantaScreen.php

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

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

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

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

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

71-
TD::make('telegram', 'Telegram')
72-
->width('15%')
73-
->render(fn (SecretSantaParticipant $participant) => $participant->telegram
74-
? Link::make($participant->telegram)->href("https://t.me/{$participant->telegram}")
69+
TD::make('receiver.telegram', 'Telegram')
70+
->render(fn(SecretSantaParticipant $participant) => $participant->receiver?->telegram
71+
? Link::make($participant->receiver?->telegram)->href("https://t.me/{$participant->receiver?->telegram}")
7572
: ''
7673
),
7774

78-
TD::make('tracking_number', 'Трек-номер')
79-
->width('20%'),
75+
TD::make('receiver.tracking_number', 'Трек-номер'),
76+
77+
TD::make('receiver.phone', 'Номер телефона'),
78+
79+
TD::make('status', 'Статус')
80+
->render(fn(SecretSantaParticipant $participant) => $participant->status === 'done'
81+
? '✅ Завершён'
82+
: '⏳ Ожидает'
83+
),
84+
85+
TD::make('updated_at', 'Последнее обновление')
86+
->defaultHidden()
87+
->usingComponent(DateTimeSplit::class)
88+
->align(TD::ALIGN_RIGHT)
89+
->sort(),
8090
]),
8191
];
8292
}

0 commit comments

Comments
 (0)