Ajout d'une 4ᵉ colonne avec un bouton radio pour inverser les montants et ajustements CSS
This commit is contained in:
@@ -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 = () => {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user