@props([ 'proposals', 'columns' => [], 'showIndex' => true, 'searchId' => 'searchField', 'rowData' => null, 'rowClass' => null, // closure($proposal) => string of extra classes 'rowTitle' => null, // closure($proposal) => string for title attr 'headerClasses' => null ]) @php // Default data-* attributes used by the search filter, unless the caller overrides them. $rowData = $rowData ?? fn ($p) => [ 'title' => mb_strtolower($p->title ?? ''), 'applicant' => mb_strtolower($p->applicant?->fullname ?? ''), ]; @endphp
    {{-- Header row --}}
  • @if ($showIndex)
    #
    @endif @foreach ($columns as $column)
    {{ $column['label'] ?? '' }}
    @endforeach
  • {{-- Data rows --}} @foreach ($proposals as $proposal)
  • $value) data-{{ $key }}="{{ $value }}" @endforeach @if($rowTitle) title="{{ $rowTitle($proposal) }}" @endif > @if ($showIndex)
    {{ $loop->iteration }}
    @endif @foreach ($columns as $column) @isset($column['cell']) {{-- raw cell: closure controls the whole element (e.g. action links) --}} {!! $column['cell']($proposal) !!} @else @php $title = $column['title'] ?? ''; if ($title instanceof Closure) { $title = $title($proposal); } @endphp
    {{ ($column['value'] ?? fn () => '')($proposal) }}
    @endisset @endforeach
  • @endforeach