@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-header">Jury {{ $jury->id }}</!--div-->
                    <div class="card-body">

                        <a href="{{ url('/admin/jury') }}" title="Back"><button class="btn btn-warning btn-sm"><i class="fa fa-arrow-left" aria-hidden="true"></i> Back</button></a>
                        <a href="{{ url('/admin/jury/' . $jury->id . '/edit') }}" title="Edit Jury"><button class="btn btn-primary btn-sm"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Edit</button></a>

                        <form method="POST" action="{{ url('admin/jury' . '/' . $jury->id) }}" accept-charset="UTF-8" style="display:inline">
                            {{ method_field('DELETE') }}
                            {{ csrf_field() }}
                            <button type="submit" class="btn btn-danger btn-sm" title="Delete Jury" onclick="return confirm(&quot;Confirm delete?&quot;)"><i class="fa fa-trash-o" aria-hidden="true"></i> Delete</button>
                        </form>
                        <br/>
                        <br/>
                        <div class="row" style="width: 100%">
                            <div class="col-md-2"></div>
                            <div class="col-md-9" style="">
                                <div class="table-responsive " style=" width: 100%">
                                    <form method="Post" action="{!! route('download_pdf') !!}" class="">
                                        <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
                                        <input type="hidden" name="_html" id="html_content" value="">
                                        <input type="hidden" name="_id_jury" id="html_content" value="{{ $jury->id }}">
                                        <input type="hidden" name="_filename" id="html_content" value="Note-de-service">
                                        <button type="submit" class="btn btn-info no-delete">
                                            Télecharger <i class="fa fa-download"></i>
                                        </button>
                                    </form>
                                    <div
                                        style="
                                            margin-top: 30px;
                                            border: 1px solid rgba(30, 57, 83, 0.5);
                                            border-radius: 3px; padding: 5%
                                        "
                                        id="note_de_service"
                                    >
                                        <table style="width: 100%; border-bottom: 2px solid">
                                            <tr style="position: relative; ">
                                                <td style="width: 13%; text-align: left;">
                                                <img src="https://modules.sigan.bj/Admin/{{ $jury->nameimguni }}" alt="user-img"  width="100" height="100">
                                                </td>
                                                <td style="width: 74%; text-align: center; " >
                                                    <div style="font-weight: bold;">REPUBLIQUE DU BENIN</div>
                                                    <div style="font-size: 0.7em" >*******************</div>
                                                    <div style="font-size: 0.8em; font-weight: bold; color: #24566d">{{ $jury->sigleuni }}</div>
                                                    <div style="font-size: 0.8em" >*******************</div>
                                                    <div style="font-size: 0.8em; font-weight: bold; margin-bottom: 10px; color: #d52e2e">{{ $jury->descreta }}</div>
                                                </td>
                                                <td style="width: 13%; text-align: right">
                                                    <img src="https://modules.sigan.bj/Admin/{{ $jury->nameimgeta }}" alt="user-img"  width="100" height="100">
                                                </td>
                                            </tr>
                                        </table>
                                        <table style="width: 100%; margin-top: 10px ">
                                            <tbody>
                                                <tr style="width: 100%">
                                                    <td style="text-align: left" colspan="3">
                                                        @if ($jury->type_numero == 'vide')
                                                            <span style="margin-right: 5%">N°</span>
                                                            <span>/{{ $jury->sigleuni }}/{{ $jury->sigleeta }}/CD-{{ $jury->sigledept }}</span> 
                                                        @else
                                                            N°   {{ sprintf('%05d', $jury->id) }}/{{ $jury->sigleuni }}/{{ $jury->sigleeta }}/CD-{{ $jury->sigledept }}
                                                        @endif
                                                    </td>
                                                </tr>
                                                <tr style="width: 100%">
                                                    <td style="text-align: right" colspan="3">
                                                    {{ $jury->ville }}, le {{ $jury->note_service_creation_date }}
                                                    </td>
                                                </tr>
                                                <tr style="width: 100%" >
                                                    <td style="text-align: center;  padding-top: 3%;" colspan="3">
                                                        <h3 style="font-weight: bold"> NOTE DE SERVICE </h3>
                                                    </td>
                                                </tr>
                                                <tr style="width: 100%">
                                                    <td style="width: 42%"></td>
                                                    <td style="text-align: center; border-bottom: 1px solid"></td>
                                                    <td style="width: 42%"></td>
                                                </tr>
                                                <tr style="width: 100%">
                                                    <td
                                                        style="
                                                            text-align: center;
                                                            padding-left: 15%;
                                                            padding-right: 15%;
                                                            padding-top: 2%;
                                                            padding-bottom: 0%;
                                                        "
                                                        colspan="3"
                                                    >
                                                        <h5 style="font-weight: bold">
                                                            Portant composition du Jury de soutenance de memoire
                                                            de fin de formation
                                                        </h5>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="text-align: left; width: 21%; padding-top: 5%;">
                                                        <h5 style="font-weight: bold">Departement</h5> 
                                                    </td>
                                                    <td style="text-align: left; padding-top: 5%" colspan="2">
                                                        <h5>: &nbsp  {{ $jury->desrdept }}  </h5>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="text-align: left; ">
                                                        <h5 style="font-weight: bold">Option</h5> 
                                                    </td>
                                                    <td style="text-align: left;" colspan="2">
                                                        <h5>: &nbsp   {{ $jury->filiere }} </h5>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="text-align: left;" colspan="3">
                                                         &nbsp
                                                    </td>
                                                </tr>
                                                
                                                <tr style="width: 100%">
                                                    <td style="text-align: left" colspan="3">
                                                        Le jury chargé de juger le memoire de fin d'études de
                                                        <span style="font-weight: bold">
                                                        @foreach($jury->etudiants as $key => $etudiant)
                                                            @if ($key != 0)
                                                            <span style="font-weight: normal"> et de </span>
                                                            @endif
                                                            {{ $etudiant->nom }} {{ $etudiant->prenom }}
                                                        @endforeach
                                                        </span>,  est compose comme suit:
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                        <table style="width: 100%; margin-top: 10px ">
                                            <tbody>
                                                <tr>
                                                    <td style="text-align: left; ">
                                                        <h5 style="font-weight: bold">President</h5> 
                                                    </td>
                                                    <td style="text-align: left;" colspan="2">
                                                        <h5>:  &nbsp  {{ $jury->president_prenom }} {{ $jury->president_nom }}  </h5>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="text-align: left; ">
                                                        <h5 style="font-weight: bold">Maitre memoire</h5> 
                                                    </td>
                                                    <td style="text-align: left;" colspan="2">
                                                        <h5>:  &nbsp  {{ $jury->maitre_memoire_prenom }} {{ $jury->maitre_memoire_nom }} </h5>
                                                    </td>
                                                </tr>
                                                @foreach($jury->membres as $key => $membre)
                                                <tr>
                                                    <td style="text-align: left; ">
                                                        <h5 style="font-weight: bold">
                                                        @if ($key == 0)
                                                            Membres
                                                        @endif
                                                        </h5> 
                                                    </td>
                                                    <td style="text-align: left;" colspan="2">
                                                        <h5>
                                                        :  &nbsp  {{ $membre->prenoms }} {{ $membre->nom }}
                                                        </h5>
                                                    </td>
                                                </tr>
                                                @endforeach
                                            </tbody>
                                        </table>
                                        <table style="width: 100%;">
                                            <tbody>
                                                <tr>
                                                    <td style="text-align: left; width: 10%; padding-top: 3%" colspan="3">
                                                        <h5 style="font-weight: bold">Sujet :  &nbsp  {{ $jury->sujet }}.</h5> 
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="text-align: left; width: 10%;" colspan="3">
                                                        <h5 style="padding-left: 0px"> Ce jury se reunira le  
                                                            <span style="font-weight: bold"> {{ $jury->date }} à {{ explode(':', $jury->heure_debut)[0] }}H{{ explode(':', $jury->heure_debut)[1] }}  </br> </br> Salle: {{ $jury->salle }}.</span>
                                                        </h5> 
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                        <table style="width: 100%;">
                                            <tbody>
                                                <tr>
                                                    <td style="text-align: left;  padding-top: 5%" colspan="2"></td>
                                                    <td style="text-align: left; width: 33%; padding-top: 5%">
                                                        <h5> 
                                                            {{ $jury->signataire_fonction }}    
                                                        </h5> 
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="text-align: left; padding-top: 5%" colspan="2"></td>
                                                    <td style="text-align: left; width: 33%; padding-top: 10%">
                                                        <h5 style="font-weight: bold">
                                                            {{ $jury->signataire_grade }}
                                                            {{ $jury->signataire_prenoms }}
                                                            {{ $jury->signataire_nom }}
                                                        </h5> 
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                        <table style="width: 100%; border-top: 2px solid; margin-top: 25px">
                                            <tr>
                                                <td style="width: 100%; text-align: center;">
                                                    {{ $jury->adresse }}
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<script src="{{ asset('ample-admin-new/plugins/bower_components/jquery/dist/jquery.min.js')}}"></script>
<script type="text/javascript">
    $('#html_content').val($('#note_de_service').html())
</script>
@endsection
