@if(($tabType ?? 'received') === 'sent')
Requests Sent
@else
Requests Received
@endif
@forelse($requests as $request)
@php
// Determine which user to display (inviter for received, invited for sent)
$displayUser = ($tabType ?? 'received') === 'received' ? $request->inviter : $request->invitedUser;
if (!$displayUser) {
continue;
}
// Get user info
$userName = $displayUser->full_name ?? 'Unknown User';
$initials = collect(explode(' ', $userName))->map(function($word) {
return strtoupper(substr($word, 0, 1));
})->take(2)->join('');
// Get user role
$userRole = $displayUser->role_slug ?? 'athlete';
$profile = ($userRole === 'team') ? $displayUser->teamProfile : $displayUser->athleteProfile;
// Get sport
$sport = 'N/A';
$primarySport = $displayUser->sports->first();
if ($primarySport && $primarySport->sport) {
$sport = $primarySport->sport->title;
}
// Determine request type text
if (($tabType ?? 'received') === 'received') {
$requestTypeText = ($userRole === 'team') ? 'Team wants to invite you' : 'Athlete wants to join your team';
$requestTypeClass = ($userRole === 'team') ? 'team-invite' : 'athlete-join';
} else {
$requestTypeText = ($userRole === 'team') ? 'You invited team' : 'You invited athlete';
$requestTypeClass = ($userRole === 'team') ? 'team-invite' : 'athlete-join';
}
// Avatar color
$colors = ['#3b82f6', '#8b5cf6', '#10b981', '#f59e0b', '#ef4444', '#ec4899'];
$avatarColor = $colors[($displayUser->id % 6)];
// Format date
$requestDate = $request->created_at ? \App\Helpers\Helper::showdate($request->created_at, false) : 'N/A';
// Get note/message
$note = $request->note ?? '';
@endphp
@if($note)
"{{ $note }}"
@endif
@if(($tabType ?? 'received') === 'received' && $request->status === 'pending')
@elseif(($tabType ?? 'received') === 'received')
{{ ucfirst($request->status) }}
@else
{{ ucfirst($request->status) }}
@endif
@empty
@if(($tabType ?? 'received') === 'sent')
@else
@endif
@endforelse