Complete TP7 TP8 authentication authorization and classic CSS

This commit is contained in:
2026-10-21 00:48:38 +02:00
parent 4a84a17cbf
commit ffe85d5f0d
101 changed files with 7643 additions and 110 deletions
+6
View File
@@ -0,0 +1,6 @@
@extends('layouts.app')
@section('content')
<h2>Administration</h2>
<p>Cette page est réservée aux administrateurs.</p>
@endsection
@@ -0,0 +1,26 @@
@extends('layouts.app')
@section('content')
<h2>Connexion</h2>
@if ($errors->any())
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
@endif
<form method="POST" action="{{ route('login.store') }}">
@csrf
<div>
<label for="email">E-mail</label>
<input id="email" type="email" name="email" value="{{ old('email') }}" required autofocus>
</div>
<div>
<label for="password">Mot de passe</label>
<input id="password" type="password" name="password" required>
</div>
<button type="submit">Se connecter</button>
</form>
@endsection
@@ -30,12 +30,16 @@
<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>
@can('update', $client)
<a href="{{ route('clients.edit', $client) }}">Modifier</a>
@endcan
@can('delete', $client)
<form method="POST" action="{{ route('clients.destroy', $client) }}" style="display: inline">
@csrf
@method('DELETE')
<button type="submit">Supprimer</button>
</form>
@endcan
</td>
</tr>
@endforeach
@@ -0,0 +1,7 @@
@extends('layouts.app')
@section('content')
<h2>Tableau de bord</h2>
<p>Bienvenue {{ Auth::user()->name }} !</p>
<p>Vous pouvez maintenant gérer les clients et les produits du Mini-CRM.</p>
@endsection
+24 -14
View File
@@ -3,30 +3,40 @@
<head>
<meta charset="UTF-8">
<title>Mini-CRM</title>
{{-- TP6 : taille lisible des flèches SVG utilisées par la pagination Laravel. --}}
<style>
main nav[role="navigation"] svg { width: 1rem; height: 1rem; }
main nav[role="navigation"] a, main nav[role="navigation"] span { margin-right: .35rem; }
</style>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
</head>
<body>
<header>
<h1>Mini-CRM</h1>
<nav>
<a href="/">Accueil</a>
<header class="site-header">
<div class="container header-inner">
<h1 class="brand"><a href="{{ route('home') }}">Mini-CRM</a></h1>
<nav class="main-nav" aria-label="Navigation principale">
@auth
<a href="{{ route('home') }}">Accueil</a>
<a href="{{ route('dashboard') }}">Tableau de bord</a>
<a href="{{ route('clients.index') }}">Clients</a>
<a href="{{ route('clients.create') }}">Ajouter un client</a>
<a href="{{ route('products.index') }}">Produits</a>
<a href="/contacts">Contacts</a>
@can('viewAdmin')
<a href="{{ route('admin') }}">Administration</a>
@endcan
<span>Bonjour {{ Auth::user()->name }}</span>
<form method="POST" action="{{ route('logout') }}" style="display: inline">
@csrf
<button type="submit">Se déconnecter</button>
</form>
@else
<a href="{{ route('login') }}">Se connecter</a>
@endauth
</nav>
</div>
</header>
<main>
<main class="container page-content">
@yield('content')
</main>
<footer>
Mini-CRM
<footer class="site-footer">
<div class="container">Mini-CRM - Gestion simple des clients et produits</div>
</footer>
</body>
</html>
@@ -33,12 +33,16 @@
</td>
<td>
<a href="{{ route('products.show', $produit) }}">Voir</a>
<a href="{{ route('products.edit', $produit) }}">Modifier</a>
@can('update', $produit)
<a href="{{ route('products.edit', $produit) }}">Modifier</a>
@endcan
@can('delete', $produit)
<form method="POST" action="{{ route('products.destroy', $produit) }}" style="display: inline">
@csrf
@method('DELETE')
<button type="submit">Supprimer</button>
</form>
@endcan
</td>
</tr>
@endforeach