@extends('template')

@section('nav')
    <ul id="dropdown1" class="dropdown-content" style="top : 20px">
        <li><a href="/auth/logout" class="logout">Logout</a></li>
    </ul>
    <div class="navbar-fixed">
        <nav>
            <div class="nav-wrapper">
                <div class="col s12">
                    <a href="/session" class="breadcrumb">Session</a>
                    <a href="/session/{{$sessionId}}/examen" class="breadcrumb">Examen</a>
                    <a href="/session/{{$sessionId}}/examen/{{$examenId}}/station" class="breadcrumb">Station</a>
                    <ul class="right hide-on-med-and-down">
                        <li><a class="dropdown-button" href="#!"
                               data-activates="dropdown1">{{ \Illuminate\Support\Facades\Auth::user()->login  }}<i
                                        class="material-icons right">more_vert</i></a></li>
                    </ul>
                </div>
            </div>
        </nav>
    </div>
@endsection

@section('contenu')
    <table class="striped centered">
        <thead>
        <tr>
	<th data-field="delete"></th>
            <th data-field="id">Identifiant</th>
            <th data-field="ponderation">ponderation</th>
            <th data-field="label">label</th>
            <th data-field="view_station"></th>
        </tr>
        </thead>

        <tbody>
        @foreach ($stations as $station)
            <tr>
		
		<td><a	href="#modalDelete{{$station->id_Station}}" class="modal-trigger"
			style="color:red;"><i class="material-icons">clear</i></a></td>
                <td>{{$station->id_Station}}</td>
                <td><a href="#modalUpdate{{$station->id_Station}}" class="modal-trigger"
			style="color:blue;"><i class="material-icons">create</i></a>{{$station->ponderation}}</td>
                <td>{{$station->label}}</td>
                <td><a href="/session/{{$sessionId}}/examen/{{$examenId}}/station/{{$station->id_Station}}"
                       class="waves-effect waves-light btn">Afficher les details</a></td>
            <td>

  <!-- Modal Delete Structure -->
  <div id="modalDelete{{$station->id_Station}}" class="modal">
    <div class="modal-content">
      <h4>Voulez-Vous supprimer cet element</h4>
    </div>
    <div class="modal-footer">
	<a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat">Non</a>
      <a href="/session/{{$sessionId}}/examen/{{$examenId}}/station/{{$station->id_Station}}/delete" class=" modal-action modal-close waves-effect waves-green btn-flat">Oui</a>

    </div>
  </div>
</td>

<td>

  <!-- Modal Update Structure -->
  <div id="modalUpdate{{$station->id_Station}}" class="modal">
    <div class="modal-content">
      <form action="station/{{$station->id_Station}}/update" method="post">
    {!! csrf_field() !!}
	<label for="ponderation">Ponderation:</label>
      	<input type="number" name="ponderation" id="ponderation" value="{{$station->ponderation}}"/>
      	<input type="submit" value="done" class="waves-effect waves-light btn" />
	</form>
    </div>
    <div class="modal-footer">
    </div>
  </div>
</td>

</tr>
        @endforeach
        </tbody>
    </table>


    <div class="fixed-action-btn" style="bottom: 45px; right: 24px;">
        <a href="/session/{{$sessionId}}/examen/{{$examenId}}/station/create"
           class="btn-floating btn-large waves-effect waves-light red"><i class="material-icons">add</i></a>
    </div>
<script type="text/javascript">
$(document).ready(function(){
    $('.modal-trigger').leanModal();
  });
</script>

@stop
