|
4 | 4 |
|
5 | 5 | use App\Models\SecretSantaParticipant; |
6 | 6 | use Orchid\Screen\Actions\Link; |
| 7 | +use Orchid\Screen\Components\Cells\DateTimeSplit; |
7 | 8 | use Orchid\Screen\Screen; |
8 | 9 | use Orchid\Screen\TD; |
9 | 10 | use Orchid\Support\Facades\Layout; |
@@ -51,32 +52,41 @@ public function layout(): array |
51 | 52 | { |
52 | 53 | return [ |
53 | 54 | Layout::table('participants', [ |
54 | | - TD::make('user.name', 'Пользователь') |
55 | | - ->width('20%'), |
| 55 | + TD::make('user.name', 'Пользователь (Санта)'), |
56 | 56 |
|
57 | 57 | TD::make('receiver', 'Получатель') |
58 | | - ->width('20%') |
59 | | - ->render(fn (SecretSantaParticipant $participant) => $participant->receiver?->user->name ?? 'Не назначен' |
| 58 | + ->render(fn(SecretSantaParticipant $participant) => $participant->receiver?->user->name ?? 'Не назначен' |
60 | 59 | ), |
61 | 60 |
|
| 61 | + /* |
62 | 62 | 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 ?? 'Не назначен' |
66 | 64 | ), |
| 65 | + */ |
67 | 66 |
|
68 | | - TD::make('address', 'Адрес') |
69 | | - ->width('25%'), |
| 67 | + TD::make('receiver.address', 'Адрес'), |
70 | 68 |
|
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}") |
75 | 72 | : '—' |
76 | 73 | ), |
77 | 74 |
|
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(), |
80 | 90 | ]), |
81 | 91 | ]; |
82 | 92 | } |
|
0 commit comments