@extends('layouts.master')
@section('title', $listTitle ?? 'Matters')
@section('content')
{{ $listTitle ?? 'Matters' }}
{{ $listSubtitle ?? 'Track, filter, and manage legal engagements.' }}
{{ isset($matters) ? count($matters) : 0 }}
Records
Matter Number
Matter Title
Primary Client
Type
Status
Priority
Assigned Lawyers
Conflict Status
Last Activity
Actions
@forelse($matters ?? [] as $matter)
@php
$primaryClientName = '—';
$primaryClient = $matter->clients->firstWhere('pivot.is_primary_client', true) ?? $matter->clients->first();
$primaryClientName = $primaryClient
? trim(($primaryClient->first_name ?? '') . ' ' . ($primaryClient->last_name ?? ''))
: '—';
$lawyers = $matter->lawyers->pluck('name')->filter()->take(2)->implode(', ');
$lawyerLabel = $lawyers !== '' ? $lawyers : '—';
$typeLabel = $matter->type?->name ?? '—';
$statusLabel = $matter->status?->name ?? '—';
$priorityLabel = $matter->priority?->name ?? '—';
$conflictLabel = $matter->conflict_status ?? 'Cleared';
$activityLabel = $matter->updated_at ? $matter->updated_at->diffForHumans() : '—';
@endphp
{{ $matter->matter_number }}
{{ $matter->matter_title }}
{{ $primaryClientName ?? '—' }}
{{ $typeLabel }}
{{ $statusLabel }}
{{ $priorityLabel }}
{{ $lawyerLabel }}
{{ $conflictLabel }}
{{ $activityLabel }}
@empty
No matters found.
@endforelse
@if(isset($matters) && method_exists($matters, 'links'))
{{ $matters->links('pagination::bootstrap-5') }}
@endif
{{-- Server-side filtering enabled. --}}
@endsection