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 = () => {
|
||||
|
||||
Reference in New Issue
Block a user