diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php index 4e0a8c0..bbfce0e 100644 --- a/app/Http/Controllers/ClientController.php +++ b/app/Http/Controllers/ClientController.php @@ -25,7 +25,7 @@ class ClientController extends Controller } /** - * Requete + * update le client */ public function update(Request $request, $id) { $client = Client::findOrFail($id); diff --git a/app/Http/Controllers/FrontendController.php b/app/Http/Controllers/FrontendController.php index 2b8cca4..8ad0c84 100644 --- a/app/Http/Controllers/FrontendController.php +++ b/app/Http/Controllers/FrontendController.php @@ -27,5 +27,17 @@ class FrontendController extends Controller return view('clients'); } + public function supprimer($id){ + $client = Client::findOrFail($id); + $client->delete(); + return response()->noContent(); + } + public function update(Request $request, $id) { + $client = Client::findOrFail($id); + $client->update($request->all()); + return $client; + } + + public function unClient($id) { return view('majClient'); } } \ No newline at end of file diff --git a/public/css/style.css b/public/css/style.css index ef8aa12..c9f1c60 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -43,3 +43,75 @@ nav { nav a:hover { text-decoration: underline; } + + body { + font-family: "Inter", sans-serif; + background: #f5f6fa; + padding: 50px; + display: flex; + flex-direction: column; + align-items: center; + } + + h1 { + font-weight: 600; + margin-bottom: 35px; + color: #1d1d1f; + } + + .form-clean { + background: #58a198; + padding: 40px 45px; /* plus de padding */ + border-radius: 14px; + width: 100%; + max-width: 450px; + box-shadow: 0 6px 18px rgba(0,0,0,0.06); + display: flex; + flex-direction: column; + gap: 22px; /* spacing entre les champs */ + } + + .field { + display: flex; + flex-direction: column; + gap: 6px; + } + + .form-clean label { + font-size: 15px; + color: #333; + font-weight: 500; + } + + .form-clean input { + padding: 14px 16px; /* plus de padding dans les inputs */ + border-radius: 10px; + border: 1px solid #dcdce0; + background: #fafafa; + font-size: 15px; + transition: 0.25s; + } + + .form-clean input:focus { + border-color: #000; + background: #fff; + box-shadow: 0 0 0 3px rgba(0,0,0,0.07); + outline: none; + } + + .btn-submit { + margin-top: 10px; + padding: 14px 20px; + border-radius: 10px; + border: none; + background: #1d1d1f; + color: #fff; + font-size: 16px; + font-weight: 500; + cursor: pointer; + transition: 0.25s; + } + + .btn-submit:hover { + background: #000; + } \ No newline at end of file diff --git a/resources/views/authentification.blade.php b/resources/views/authentification.blade.php new file mode 100644 index 0000000..e69de29 diff --git a/resources/views/clients.blade.php b/resources/views/clients.blade.php index f50e479..3741f08 100644 --- a/resources/views/clients.blade.php +++ b/resources/views/clients.blade.php @@ -17,6 +17,7 @@
Erreur lors du chargement du client.
"; + } + } + + async function updateClient(id) { + try { + const nom = document.getElementById("edit-nom").value; + const prenom = document.getElementById("edit-prenom").value; + const email = document.getElementById("edit-email").value; + const telephone = document.getElementById("edit-ntelephone").value; + + const response = await fetch(`http://192.168.56.56:8000/api/clients/${id}`, { + method: 'PUT', + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ nom, prenom, email, telephone }) + }); + + if (!response.ok) { + throw new Error("Erreur de mise à jour"); + } + + alert("Client mis à jour !"); + loadClients(); + + } catch (err) { + console.error(err); + alert("Impossible de mettre à jour le client."); + } + } + + loadClients(); + + -@endsection \ No newline at end of file + +@endsection + diff --git a/resources/views/creationClient.blade.php b/resources/views/creationClient.blade.php index 23f43a7..7a7ab68 100644 --- a/resources/views/creationClient.blade.php +++ b/resources/views/creationClient.blade.php @@ -2,21 +2,30 @@ @section('content')