@extends ('includes.main-layout')

@section('styles')

@endsection

@section('header')
    @include('includes.admin-header')
@endsection

@section('content')
    <div class="row">
        <div class="col-md-6 mx-auto">
        @include('includes.errors')
            <div class="card mt-4">
                <div class="card-body">
                    <h3 class="card-title text-primary">Produits</h3>
                    <hr>
                    <table class="table table-hover table-inverse table-responsive mx-auto">
                        <thead class="thead-default">
                            <tr>
                                <th>Libellé</th>
                                <th>Prix</th>
                                <th>Image</th>
                                <th>Action</th>
                            </tr>
                            </thead>
                            <tbody>
                                @foreach($products as $product)
                                <tr>
                                    <td scope="row">{{$product->name}}</td>
                                    <td>{{$product->prix}} dh</td>
                                    <td><img src="{{URL::to('images/'.$product->file)}}" class="img-fluid" alt="" height="50" width="50"></td>
                                    <td><a href="{{route('product.delete',['id'=>$product->id])}}" class="btn btn-danger btn-xs"><i class="fa fa-trash"></i></a> <a href="{{route('products.edit',['id'=>$product->id])}}" class="btn btn-warning btn-xs"><i class="fas fa-pencil-alt"></i></a></td>
                                </tr> 
                                @endforeach
                            </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('footer')

@endsection

@section('scripts')

@endsection
