@extends('front.layouts.app') @section('content')

Explore Athletes / Teams

Discover and connect with top athletes and teams from around the world.

@if($currentRole === 'team') Teams @elseif($currentRole === 'athlete') Athletes @else Athletes & Teams @endif

@if($currentRole === 'team') Discover talented teams and explore their achievements, stats, and performance. @elseif($currentRole === 'athlete') Discover talented athletes and explore their skills, stats, and achievements. @else Discover talented athletes and teams and explore their skills, stats, and achievements. @endif
@if($data && (is_array($data) ? count($data) > 0 : $data->count() > 0)) @foreach($data as $user) @include('front.athletes.grid_list', ['user' => $user]) @endforeach
{{ $data->appends(request()->except('page'))->links() }}
@else

No results found.

@endif
@if($data && (is_array($data) ? count($data) > 0 : $data->count() > 0))
@foreach($data as $user) @php // Detect user's actual role from their data $userRole = isset($user->role_title) ? \Illuminate\Support\Str::slug($user->role_title) : ''; // Get appropriate profile based on detected user role (not global $currentRole) $profile = ($userRole === 'team') ? $user->teamProfile : $user->athleteProfile; // Avatar - get from accessor (returns array with 'original', 'thumb', etc.) $avatarData = $user->avatar ?? []; $avatar = is_array($avatarData) ? ($avatarData['original'] ?? asset('front/assets/images/thumb1.png')) : asset('front/assets/images/thumb1.png'); // Build location string $location = ''; if ($profile) { $locationParts = array_filter([ optional($profile->city)->city_name, optional($profile->state)->state_name, optional($profile->country)->country_name ]); $location = implode(', ', $locationParts); } // Get primary sport info from user_master_sport_maps -> master_sports $primarySport = $user->sports->first(); $sportName = 'N/A'; $sportIcon = asset('front/assets/images/default-sport.png'); if ($primarySport && $primarySport->sport) { // $primarySport is UserMasterSportMap, access ->sport for MasterSport $sportName = optional($primarySport->sport)->title ?? 'N/A'; // Get sport icon from master_sports -> files table (image accessor returns array) $sportImageData = optional($primarySport->sport)->image ?? []; if (is_array($sportImageData) && isset($sportImageData['original']) && is_string($sportImageData['original'])) { $sportIcon = $sportImageData['original']; } } // Position for athletes (use detected user role, not global currentRole) $position = ''; if ($userRole === 'athlete' && $profile && $profile->position) { $position = ' - ' . optional($profile->position)->title; } // Gender icon $genderIcon = ($user->gender == 1) ? asset('front/assets/images/male.svg') : asset('front/assets/images/female.svg'); // Bio text $bio = optional($profile)->athlete_bio ?? optional($profile)->team_bio_tagline ?? 'No bio available'; // School/Club name $schoolClub = optional($profile)->school_club_name ?? optional($profile)->team_club_name ?? 'N/A'; // Get first social link for display $socialLink = $user->socialLinks->first(); $socialIcon = ''; if ($socialLink) { switch($socialLink->social_link_type) { case 1: // YouTube $socialIcon = asset('front/assets/images/youtube.png'); break; case 2: // Instagram $socialIcon = asset('front/assets/images/instagram.png'); break; case 3: // Facebook $socialIcon = asset('front/assets/images/facebook.png'); break; default: $socialIcon = asset('front/assets/images/link.png'); } } // Get active campaign for this user $userCampaign = null; if (isset($activeCampaigns[$user->id]) && $activeCampaigns[$user->id]->count() > 0) { $userCampaign = $activeCampaigns[$user->id]->first(); } $userTypeBadge = ($userRole === 'team') ? asset('front/assets/images/team.png') : asset('front/assets/images/athelete.png'); @endphp
{{ ucfirst($userRole)}}
{{ $user->full_name }}
@if($userRole === 'team')

{{ $schoolClub }}

@else

{{ $user->full_name }}

@endif

{{ $sportName }}{{ $position }}

@if($location)

{{ $location }}

@endif

Short Bio

{{ Str::limit($bio, 150) }}

@if($socialIcon) @endif
{{ ucfirst($userRole)}}
@if($userRole === 'team')

Team Size

{{ $profile->team_size ?? 'N/A' }}

@else

School / Club

{{ $schoolClub }}

@endif
@if($userCampaign) @php $campaignProgress = $userCampaign->fund_target > 0 ? ($userCampaign->fund_raised / $userCampaign->fund_target) * 100 : 0; $campaignProgress = min(100, max(0, $campaignProgress)); $daysLeft = $userCampaign->campaign_finished_at ? now()->diffInDays(\Carbon\Carbon::parse($userCampaign->campaign_finished_at), false) : 0; @endphp

Campaign Summary

{{ Str::limit($userCampaign->title ?? $userCampaign->summary ?? 'Active Campaign', 100) }}

Raised : {!! \App\Helpers\Helper::price($userCampaign->fund_raised) !!}
{{ number_format($campaignProgress, 0) }}%
Goal : {!! \App\Helpers\Helper::price($userCampaign->fund_target) !!}
{{ max(0, round($daysLeft)) }} days left
View Profile
@else

Campaign Summary

No active campaign

Raised : {!! \App\Helpers\Helper::price(0) !!}
0%
Goal : {!! \App\Helpers\Helper::price(0) !!}
No active campaign
View Profile
@endif
@endforeach
{{ $data->appends(request()->except('page'))->links() }}
@else

No results found.

@endif
@endsection @push('page_script') @endpush