{{-- Grid table with row selection. Expects: $grid, $rows (paginator), $columns, $editUrl (closure), $emptyTitle. Must be rendered inside an x-data="crmGrid(...)" element. --}} @php $key = $grid->engine->keyAlias(); $showTask = $grid->hasActivitySummary() && ! array_intersect(array_keys($columns), ['status', 'subject']); @endphp {{-- Selection bar --}}
selected (all matching records{{ $rows->total() > \App\Services\Crm\SavedViewGrid::MAX_SELECTION ? ', first '.number_format(\App\Services\Crm\SavedViewGrid::MAX_SELECTION) : '' }}) @if ($rows->total() > $rows->count()) @endif
@isset($actionsView) @include($actionsView) @endisset
@if ($rows->isEmpty()) @else
@foreach ($columns as $name => $c) @endforeach @if ($showTask)@endif @foreach ($rows as $row) @php($rid = (int) $row->{$key}) @foreach ($columns as $name => $c) @endforeach @if ($showTask) @endif @endforeach
@if ($c['sortable'])@else{{ $c['label'] }}@endif Latest task
@include('crm.partials.saved-view-cell', ['col' => $c]) @if ($a = $row->_activity ?? null) @php($tone = match (strtolower((string) $a->status)) { 'completed' => 'badge-green', 'in progress' => 'badge-amber', 'not started' => 'badge-blue', default => 'badge-gray' })
{{ $a->status ?: '—' }} {{ $a->user_name ?: 'User #'.$a->user_id }} @if ($a->count > 1)+{{ $a->count - 1 }}@endif
@else Not allocated @endif
@endif