@extends('layouts.app') @section('title', __('messages.live') . ' - ' . __('messages.app_name')) @section('description', __('messages.live_meta')) @section('content') @php use App\Services\Translator; $lang = app()->getLocale(); $selectedDate = request()->get('date', date('Y-m-d')); $isToday = $selectedDate === date('Y-m-d'); $dateFormatted = ''; try { $dateFormatted = \Carbon\Carbon::parse($selectedDate)->locale($lang)->translatedFormat('l d F Y'); } catch (\Exception $e) { $dateFormatted = $selectedDate; } $showOnlyLive = request()->get('live') === '1'; $liveLabel = $lang === 'ar' ? 'مباشر' : 'LIVE'; @endphp
{{-- ===== TOP BAR: Date chip + LIVE toggle ===== --}}
{{-- Date chip --}}
@if($showOnlyLive) @endif
{{-- LIVE toggle (only shown if today) --}} @if($isToday) {{ $liveLabel }} @endif
{{-- ===== MATCH LIST GROUPED BY LEAGUE ===== --}} @if(empty($groupedMatches))

{{ $showOnlyLive ? ($lang === 'ar' ? 'لا توجد مباريات مباشرة' : 'Aucun match en direct') : ($lang === 'ar' ? 'لا توجد مباريات اليوم' : 'Aucun match aujourd\'hui') }}

@else
@foreach($groupedMatches as $group) {{-- ===== LEAGUE HEADER ===== --}}
{{-- League logo --}}
@if(!empty($group['league_logo'])) @else @endif
{{-- League name --}} {{ Translator::league($group['league_name'], $group['country'] ?? null) }} {{-- Country --}} @if(!empty($group['country'])) {{ Translator::country($group['country']) }} @endif
{{-- ===== MATCH ROWS ===== --}} @foreach($group['matches'] as $match) {{-- Home: logo + name --}}
@if(!empty($match['home_logo'])) @else @endif
{{ Translator::team($match['home_name']) }}
{{-- Center: score/time/status --}}
@if($match['status'] === 'LIVE')
{{ $match['home_score'] ?? 0 }} {{-- Circular live timer --}}
{{-- Background circle --}} {{-- Progress arc --}} @php $elapsed = min(90, max(0, $match['elapsed'] ?? 0)); $circumference = 2 * M_PI * 15; $progress = ($elapsed / 90) * $circumference; $remaining = $circumference - $progress; @endphp {{ $match['elapsed'] ?? 0 }}'
{{ $match['away_score'] ?? 0 }}
@elseif($match['status'] === 'FT')
{{ __('messages.finished') }}
{{ $match['home_score'] ?? 0 }} - {{ $match['away_score'] ?? 0 }}
@elseif(in_array($match['status'], ['PST', 'CANC', 'ABD', 'SUSP']))
{{ $match['status'] === 'PST' ? ($lang === 'ar' ? 'مؤجلة' : 'Reportée') : strtoupper($match['status']) }}
@else {{ $match['time'] ?? '--:--' }} @endif
{{-- Away: name + logo --}}
{{ Translator::team($match['away_name']) }}
@if(!empty($match['away_logo'])) @else @endif
@endforeach @endforeach
@endif
@endsection