@extends('layouts.ecc.main')

@section('content')
<div class="row">
    <div class="col-md-12">
        <div class="card">
            <div class="content">
                <div class="row">
                    <div class="col-xs-2">
                        <div class="icon-big icon-info text-center">
                            <i class="ti-email"></i>
                        </div>
                    </div>
                    <div class="col-xs-10">
                        <div class="numbers">
                            <p>Messages</p>
                        </div>
                    </div>
                </div>
                <div class="row">
                    @foreach ($messages as $message)
                        <div class="col-md-6 col-sx-12 text-center" style="margin-top:15px;margin-bottom:70px;">
                            <p>{{$message->title}}<br><h5><small>par {{\App\User::find($message->user_id)->fullname()}}</small></h5></p>
                            <div style="height:21.5rem;overflow:hidden;">{!! $message->body !!}</div><br>
                            <a href="/ecc/message/{{$message->id}}" class="btn btn-primary">Afficher plus</a>
                        </div>
                    @endforeach
                </div>
                <div class="row text-center">
                <a class="btn btn-primary" href="/ecc/messages/{{$page-1}}" role="button"><i class="ti-arrow-left"></i></a>
                <a class="btn btn-primary" href="/ecc/messages/{{$page+1}}" role="button"><i class="ti-arrow-right"></i></a>
                </div>
            </div>
        </div>
    </div>
</div>  
@endsection

@section('active_page')
    <?php $active_page = "message" ?>
@endsection