From 891fee7c1120b881e86633e7b77156cc6610ba7f Mon Sep 17 00:00:00 2001 From: Gilles Soulier Date: Sat, 14 Dec 2024 13:55:58 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20d'une=204=E1=B5=89=20colonne=20avec=20u?= =?UTF-8?q?n=20bouton=20radio=20pour=20inverser=20les=20montants=20et=20aj?= =?UTF-8?q?ustements=20CSS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/script.js | 12 ++++++------ public/style.css | 14 ++++---------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/public/script.js b/public/script.js index 1b9d78a..5a2024b 100644 --- a/public/script.js +++ b/public/script.js @@ -50,16 +50,16 @@ document.addEventListener("DOMContentLoaded", () => { const totalCell = document.createElement("td"); totalCell.textContent = "0.00 €"; - // Bouton Option + // Radio Option const optionCell = document.createElement("td"); - const optionButton = document.createElement("button"); - optionButton.textContent = "Option"; - optionButton.addEventListener("click", () => { + const radioInput = document.createElement("input"); + radioInput.type = "radio"; + radioInput.addEventListener("change", () => { const montant = parseFloat(montantInput.value || "0"); - montantInput.value = montant > 0 ? -montant : Math.abs(montant); + montantInput.value = radioInput.checked ? -Math.abs(montant) : Math.abs(montant); updateRowTotal(); }); - optionCell.appendChild(optionButton); + optionCell.appendChild(radioInput); // Calculer le total de la ligne const updateRowTotal = () => { diff --git a/public/style.css b/public/style.css index 4c69a67..f0cbae0 100644 --- a/public/style.css +++ b/public/style.css @@ -42,7 +42,7 @@ body { right: 15px; z-index: 2000; padding: 10px 22px; - background-color: #007bff; /* Bleu */ + background-color: #007bff; color: white; border: none; border-radius: 5px; @@ -89,20 +89,14 @@ body { width: 25%; } -#articles-table td input { +#articles-table td input, +#articles-table td select { padding: 5px; - width: 90%; font-size: 16px; } -#articles-table td button { - background-color: #ffc107; - border: none; - border-radius: 5px; - color: white; +#articles-table td input[type="radio"] { cursor: pointer; - padding: 5px 10px; - font-size: 14px; } #articles-table tbody tr:nth-child(even) {