Réalisation du tp3, tp4, tp5 et tp6 avec documentation.
This commit is contained in:
@@ -1,19 +1,45 @@
|
||||
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<h2> Liste des clients : </h2>
|
||||
<h2>Liste des clients</h2>
|
||||
{{-- TP4 : total, date et actions ; TP6 : total de tous les résultats, même sur plusieurs pages. --}}
|
||||
<p>Nombre total de clients : {{ $clients->total() }}</p>
|
||||
<p><a href="{{ route('clients.create') }}">Ajouter un client</a></p>
|
||||
{{-- TP6 : GET rend la recherche visible dans l'URL sans modifier la base. --}}
|
||||
<form method="GET" action="{{ route('clients.index') }}">
|
||||
<label for="client-search">Rechercher par nom, email ou ville</label>
|
||||
<input id="client-search" type="search" name="search" value="{{ $search }}" placeholder="Rechercher un client">
|
||||
<button type="submit">Rechercher</button>
|
||||
<a href="{{ route('clients.index') }}">Effacer</a>
|
||||
</form>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
<!-- <th>Email</th>
|
||||
<th>Ville</th> -->
|
||||
<th>Email</th>
|
||||
<th>Téléphone</th>
|
||||
<th>Ville</th>
|
||||
<th>Client créé le</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
|
||||
<!-- @foreach($clients as $client) -->
|
||||
@foreach($clients as $client)
|
||||
<tr>
|
||||
<td>{{ $clients->name }}</td>
|
||||
|
||||
<td>{{ $client->name }}</td>
|
||||
<td>{{ $client->email }}</td>
|
||||
<td>{{ $client->phone ?? '—' }}</td>
|
||||
<td>{{ $client->city ?? '—' }}</td>
|
||||
<td>{{ $client->created_at->format('d/m/Y') }}</td>
|
||||
<td>
|
||||
<a href="{{ route('clients.show', $client) }}">Voir</a>
|
||||
<a href="{{ route('clients.edit', $client) }}">Modifier</a>
|
||||
<form method="POST" action="{{ route('clients.destroy', $client) }}" style="display: inline">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit">Supprimer</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- @endforeach -->
|
||||
@endforeach
|
||||
</table>
|
||||
{{-- TP6 : liens générés pour les dix résultats de chaque page. --}}
|
||||
{{ $clients->links() }}
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user