Fix: Заявки - номер, получатели, null-safe
✅ Номер заявки вместо организации в списке ✅ Столбец Получатели (пользователи/группы/организации) ✅ Null-safe для organization, user, group ✅ Бейджи с названиями в show.blade.php Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
parent
b01d8431c8
commit
729d48ac5a
|
|
@ -44,9 +44,10 @@
|
|||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Организация</th>
|
||||
<th>№</th>
|
||||
<th>Статус</th>
|
||||
<th>Курсов</th>
|
||||
<th>Получатели</th>
|
||||
<th>Создана</th>
|
||||
<th>Кем</th>
|
||||
<th>Действия</th>
|
||||
|
|
@ -55,7 +56,7 @@
|
|||
<tbody>
|
||||
@forelse($requests as $request)
|
||||
<tr>
|
||||
<td><strong>{{ $request->organization?->name ?? 'Без организации' }}</strong></td>
|
||||
<td><strong>#{{ $request->id }}</strong></td>
|
||||
<td>
|
||||
@if($request->isPending())
|
||||
<span class="badge bg-warning">Ожидает</span>
|
||||
|
|
@ -66,6 +67,24 @@
|
|||
@endif
|
||||
</td>
|
||||
<td><span class="badge bg-info">{{ $request->items->count() }}</span></td>
|
||||
<td>
|
||||
@php
|
||||
$recipients = [];
|
||||
if ($request->items->where('user_id')->count() > 0) {
|
||||
$recipients[] = '<span class="badge bg-success"><i class="bi bi-person"></i> ' . $request->items->where('user_id')->count() . '</span>';
|
||||
}
|
||||
if ($request->items->where('group_id')->count() > 0) {
|
||||
$recipients[] = '<span class="badge bg-info"><i class="bi bi-people"></i> ' . $request->items->where('group_id')->count() . '</span>';
|
||||
}
|
||||
if ($request->items->where('organization_id')->count() > 0) {
|
||||
$recipients[] = '<span class="badge bg-primary"><i class="bi bi-building"></i> ' . $request->items->where('organization_id')->count() . '</span>';
|
||||
}
|
||||
if (empty($recipients)) {
|
||||
$recipients[] = '<span class="text-muted">—</span>';
|
||||
}
|
||||
@endphp
|
||||
{!! implode(' ', $recipients) !!}
|
||||
</td>
|
||||
<td><small>{{ $request->created_at->format('d.m.Y H:i') }}</small></td>
|
||||
<td>{{ $request->requestedBy?->name ?? 'Удалён' }}</td>
|
||||
<td>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
<div class="card shadow-sm">
|
||||
<div class="card-header bg-primary text-white"><h5 class="mb-0">Информация</h5></div>
|
||||
<div class="card-body">
|
||||
<div><strong>Организация:</strong> {{ $courseRequest->organization->name }}</div>
|
||||
<div><strong>Организация:</strong> {{ $courseRequest->organization?->name ?? 'Без организации' }}</div>
|
||||
<div><strong>Статус:</strong>
|
||||
@if($courseRequest->isPending())
|
||||
<span class="badge bg-warning">Ожидает</span>
|
||||
|
|
@ -103,13 +103,13 @@
|
|||
</td>
|
||||
<td>
|
||||
@if($item->user_id)
|
||||
{{ $item->user?->name ?? '—' }}
|
||||
<span class="badge bg-success">{{ $item->user?->name ?? 'Пользователь #' . $item->user_id }}</span>
|
||||
@elseif($item->group_id)
|
||||
{{ $item->group?->name ?? '—' }}
|
||||
<span class="badge bg-info">{{ $item->group?->name ?? 'Группа #' . $item->group_id }}</span>
|
||||
@elseif($item->organization_id)
|
||||
{{ $item->organization?->name ?? '—' }}
|
||||
<span class="badge bg-primary">{{ $item->organization?->name ?? 'Организация #' . $item->organization_id }}</span>
|
||||
@else
|
||||
{{ $courseRequest->organization->name }}
|
||||
<span class="text-muted">—</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
|
|
|
|||
Loading…
Reference in New Issue