Skip to content

Commit 4050eea

Browse files
committed
Improve admin secret santa
1 parent 8ea5d53 commit 4050eea

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

app/Orchid/Screens/SecretSantaScreen.php

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Orchid\Screens;
44

5+
use App\Models\Post;
56
use App\Models\SecretSantaParticipant;
67
use App\Models\User;
78
use Illuminate\Http\Request;
@@ -84,38 +85,35 @@ public function layout(): array
8485
->deferred('loadParticipant'),
8586

8687
Layout::table('participants', [
87-
TD::make('user.name', 'Пользователь (Санта)')
88+
TD::make('user.name', 'Санта')
89+
->width(100)
8890
->render(fn (SecretSantaParticipant $participant) => ModalToggle::make($participant->user->name)
8991
->modalTitle($participant->user->name)
9092
->modal('edit-participant', [
91-
'participant' => $participant,
93+
'participant' => $participant->id,
9294
])
9395
),
9496

9597
TD::make('receiver', 'Получатель')
98+
->width(100)
9699
->render(fn (SecretSantaParticipant $participant) => $participant->receiver?->user->name ?? 'Не назначен'
97100
),
98101

99-
/*
100-
TD::make('santa', 'Санта')
101-
->render(fn(SecretSantaParticipant $participant) => $participant->santa?->user->name ?? 'Не назначен'
102-
),
103-
*/
104-
105102
TD::make('receiver.address', 'Адрес')
103+
->defaultHidden()
106104
->width(200),
107105

108-
TD::make('receiver.telegram', 'Telegram')
109-
->render(fn (SecretSantaParticipant $participant) => $participant->receiver?->telegram
110-
? Link::make($participant->receiver?->telegram)->href("https://t.me/{$participant->receiver?->telegram}")
111-
: ''
112-
),
106+
TD::make('receiver.telegram', 'Контакты')
107+
->width(200)
108+
->render(function (SecretSantaParticipant $participant) {
109+
return "<strong class='d-block'>".e($participant->receiver?->telegram).'</strong>'
110+
. "<span>".e($participant->receiver?->phone)."</span>";
111+
}),
113112

114113
TD::make('receiver.tracking_number', 'Трек-номер'),
115114

116-
TD::make('receiver.phone', 'Номер телефона'),
117-
118115
TD::make('status', 'Статус')
116+
->width(100)
119117
->render(fn (SecretSantaParticipant $participant) => $participant->status === 'done'
120118
? '✅ Завершён'
121119
: '⏳ Ожидает'

0 commit comments

Comments
 (0)