@extends('layouts.app')

@section('content')
    <div class="bg-body-light">
        <div class="content content-full">
            <div class="d-flex flex-column flex-sm-row justify-content-sm-between align-items-sm-center">
                <h1 class="flex-grow-1 fs-3 fw-semibold my-2 my-sm-3">Liste des concours à venir ({{$count}})</h1>
                <nav class="flex-shrink-0 my-2 my-sm-0 ms-sm-3" aria-label="breadcrumb">
                    <ol class="breadcrumb">

                    </ol>
                </nav>
            </div>
        </div>
    </div>
    <div class="content">
        <div class="row">
            @foreach($contests as $contest)
            <div class="col-md-6 my-2">
                <div class="block block-rounded block-link-pop">
                    @if(isset($contest->picture))
                        <div class="block-content pb-8 bg-image" style="background-image: url('{{$contest->picture}}');">
                            @if($contest->participated)
                                <span class="badge bg-danger fw-bold p-2 text-uppercase">
                                    Participé
                                </span>
                            @endif
                        </div>
                    @endif
                    <div class="block-content text-center">
                        <h4 class="mb-1">{{$contest->name}}</h4>
                        <p class="fs-sm">
                            Fin le <span class="text-primary"> {{ \Carbon\Carbon::parse($contest->fin)->format('d/m/y') }}</span>
                        </p>
                        <p>
                            {!! $contest->description !!}
                        </p>
                        <a href="{{$contest->url}}" target="_blank" class="btn btn-alt-info me-1 mb-3">
                            <i class="fa fa-fw fa-eye opacity-50 me-1"></i> Voir
                        </a>
                        <a href="https://myx.ovh/nova/resources/contests/{{$contest->id}}/edit" target="_blank" class="btn btn-alt-success me-1 mb-3">
                            <i class="fa fa-fw fa-pen opacity-50 me-1"></i> Editer
                        </a>
                    </div>
                    <div class="block-content block-content-full bg-body-light">
                        <div class="row g-0 fs-sm text-center">
                            <div class="col-4">
                                  <span class="text-muted fw-semibold">
                                    <i class="fa fa-fw fa-heart opacity-50 me-1"></i> {{$contest->nblike}}
                                  </span>
                            </div>
                            <div class="col-4">
                                  <span class="text-muted fw-semibold">
                                    <i class="fa fa-retweet fa-heart opacity-50 me-1"></i> {{$contest->nbreply}}
                                  </span>
                            </div>
                            <div class="col-4">
                                  <span class="text-muted fw-semibold">
                                    <i class="fa fa-reply fa-comments opacity-50 me-1"></i> {{$contest->nbtweet}}
                                  </span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        @endforeach
        </div>
        <div class="mb-3">
            {!! $contests->links() !!}
        </div>
    </div>
@endsection
