@extends('layouts.master')
@section('content')

<section class="our-events">
    <div class="container-fluid">
        
        <div class="bar-title">
            <h5>
                <a href=""><img src="img/leap-white.png" alt="" />
                    <span> Our Events </span>
                </a>
            </h5>
        </div>
        
        <div>
            <img src="{{url('public/images/soty.png')}}" alt="image not found"
                style="width:100%; height:50%;" />
        </div>

        {{-- Upcoming Events --}}
        @if($events->where('event_category', 'upcoming')->count())
            <div class="row">
                <div class="col-12">
                    <div class="titile">
                        <h4>Upcoming Events</h4>
                    </div>
                </div>
            </div>
            <div class="row g-3">
                @foreach($events->where('event_category', 'upcoming') as $event)
                    <div class="col-xl-4 col-lg-4 col-md-6 col-sm-12">
                        <div class="card">
                            <div class="card-body">
                                <div class="single-event">
                                    <div class="event-img">
                                        <img src="{{ URL::to('public/images/' . $event->image) }}" alt="{{ $event->title }}" />
                                    </div>
                                    <div class="event-content">
                                        <div class="schadule-badge">
                                            <span>{{ $event->start_date }}</span>
                                        </div>
                                        <div class="infos">
                                            <h5>{{ $event->session['title'] }}</h5>
                                            <p>
                                                <i class="fa fa-calendar"></i>
                                                <span>{{ $event->start_date }} - {{ $event->end_date }}</span>
                                            </p>
                                            <address>
                                                <i class="fa fa-map-marker"></i>
                                                <span>{{ $event->location }}</span>
                                            </address>
                                        </div>
                                        <div class="events-buttons">
                                            <a href="{{ url('eventdetails/'.$event->id) }}" class="btn">View event</a>
                                            <a href="#" class="btn" disabled>Register Now</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                @endforeach
            </div>
        @endif

        {{-- Running Events --}}
        @if($events->where('event_category', 'running')->count())
            <div class="row">
                <div class="col-12">
                    <div class="titile">
                        <h4>Running Events</h4>
                    </div>
                </div>
            </div>
            <div class="row g-3">
                @foreach($events->where('event_category', 'running') as $event)
                    <div class="col-xl-4 col-lg-4 col-md-6 col-sm-12">
                        <div class="card">
                            <div class="card-body">
                                <div class="single-event">
                                    <div class="event-img">
                                        <img src="{{ URL::to('public/images/' . $event->image) }}" alt="{{ $event->title }}" />
                                    </div>
                                    <div class="event-content">
                                        <div class="schadule-badge">
                                            <span>{{ $event->start_date }}</span>
                                        </div>
                                        <div class="infos">
                                            <h5>{{ $event->session['title'] }}</h5>
                                            <p>
                                                <i class="fa fa-calendar"></i>
                                                <span>{{ $event->start_date }} - {{ $event->end_date }}</span>
                                            </p>
                                            <address>
                                                <i class="fa fa-map-marker"></i>
                                                <span>{{ $event->location }}</span>
                                            </address>
                                        </div>
                                        <div class="events-buttons">
                                            <a href="{{ url('eventdetails/'.$event->id) }}" class="btn">View event</a>
                                            <a href="{{URL::to('/registration/')}}" class="btn">Register Now</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                @endforeach
            </div>
        @endif

        {{-- Completed Events --}}
        @if($events->where('event_category', 'completed')->count())
            <div class="row">
                <div class="col-12">
                    <div class="titile">
                        <h4>Completed Events</h4>
                    </div>
                </div>
            </div>

            
            <div class="row g-3">
                @foreach($events->where('event_category', 'completed') as $event)
                    <div class="col-xl-4 col-lg-4 col-md-6 col-sm-12">
                        <div class="card">
                            <div class="card-body">
                                <div class="single-event">
                                    <div class="event-img">
                                        <img src="{{ URL::to('public/images/' . $event->image) }}" alt="{{ $event->title }}" />
                                    </div>
                                    <div class="event-content">
                                        <div class="schadule-badge">
                                            <span>{{ $event->start_date }}</span>
                                        </div>
                                        <div class="infos">
                                            <h5>{{ $event->session['title'] }}</h5>
                                            <p>
                                                <i class="fa fa-calendar"></i>
                                                <span>{{ $event->start_date }} - {{ $event->end_date }}</span>
                                            </p>
                                            <address>
                                                <i class="fa fa-map-marker"></i>
                                                <span>{{ $event->location }}</span>
                                            </address>
                                        </div>
                                        <div class="events-buttons">
                                            <a href="{{ url('eventdetails/'.$event->id) }}" class="btn">View event</a>
                                            <a href="#" class="btn" disabled>Register Now</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                @endforeach
            </div>
        @endif

    </div>
</section>


@endsection

@section('footer')
    @include('layouts.footer')
@endsection
