@extends('layouts.app')

@section('content')
    <div class="container">
        <div class="row">
            @include('admin.sidebar')

            <div class="col-md-12">
                <div class="card">
                    <div class="card-body">
                        <a href="{{ url('/admin/membre-jury/create') }}" class="btn btn-success btn-sm" title="Ajouter MembreJury">
                            <i class="fa fa-plus" aria-hidden="true"></i> Ajouter
                        </a>

                        <form method="GET" action="{{ url('/admin/membre-jury') }}" accept-charset="UTF-8" class="form-inline my-2 my-lg-0 float-right" role="search">
                            <div class="input-group">
                                <input type="text" class="form-control" name="search" placeholder="Search..." value="{{ request('search') }}">
                                <span class="input-group-append">
                                    <button class="btn btn-secondary" type="submit">
                                        <i class="fa fa-search"></i>
                                    </button>
                                </span>
                            </div>
                        </form>

                        <br/>
                        <br/>
                        <div class="table-responsive">
                            <table class="table">
                                <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>Nom</th>
                                        <th>Prenoms</th>
                                        <th>Email</th>
                                        <th>Phone</th>
                                        <th>Sexe</th>
                                        <th>Description</th>
                                        <th>Grade</th>
                                        <th>Qualite</th>
                                        <th>Type</th>
                                        <th>Action</th>
                                    </tr>
                                </thead>
                                <tbody>
                                @foreach($membrejury as $item)
                                    <tr>
                                        <td>{{ $loop->iteration }}</td>
                                        <td>{{ $item->nom }}</td>
                                        <td>{{ $item->prenoms }}</td>
                                        <td>{{ $item->email }}</td>
                                        <td>{{ $item->phone }}</td>
                                        <td>{{ $item->sexe }}</td>
                                        <td>{{ $item->description }}</td>
                                        <td>{{ $item->nomGrade }}</td>
                                        <td>{{ $item->qualite }}</td>
                                        <td>{{ $item->type }}</td>
                                        <td>
                                            <form method="GET" action="{{ url('/admin/membre-jury/' . $item->id . '/edit') }}" accept-charset="UTF-8" style="display:inline">
                                                {{ method_field('DELETE') }}
                                                {{ csrf_field() }}
                                                <button
                                                    type="submit"
                                                    class="btn no-delete btn-primary btn-sm"
                                                    title="Delete MembreJury"
                                                    onclick="return confirm(&quot;Confirm delete?&quot;)"
                                                    {{ ($item->type == 'interne') ? '' : ''}}
                                                >
                                                    <i class="fa  fa-pencil-square-o" aria-hidden="true"></i> Edit
                                                </button>
                                            </form>
                                            
                                            <form method="POST" action="{{ url('/admin/membre-jury' . '/' . $item->id) }}" accept-charset="UTF-8" style="display:inline">
                                                {{ method_field('DELETE') }}
                                                {{ csrf_field() }}
                                                <button
                                                    type="submit"
                                                    class="btn btn-danger btn-sm"
                                                    title="Delete MembreJury"
                                                    onclick="return confirm(&quot;Confirm delete?&quot;)"
                                                    {{ ($item->type == 'interne') ? 'disabled' : ''}}
                                                >
                                                    <i class="fa fa-trash-o" aria-hidden="true"></i> Delete
                                                </button>
                                            </form>
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                            <div class="pagination-wrapper"> {!! $membrejury->appends(['search' => Request::get('search')])->render() !!} </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
