Sjokode's picture
Fais moi une aJe veux que tu me conçoives une interface HTML moderne, professionnelle et responsive pour une page de création de facture/devis, style application SaaS.
901c055 verified
Raw History Blame Contribute Delete
1.8 kB
// Simple demo functionality (not meant for production)
document.addEventListener('DOMContentLoaded', function() {
// This would be replaced with real functionality in a production environment
console.log('Invoice editor loaded');
// Example: Calculate line totals when quantity or price changes
const quantityInputs = document.querySelectorAll('input[type="number"][min="0"]');
quantityInputs.forEach(input => {
input.addEventListener('change', function() {
const row = this.closest('tr');
if (row) {
const quantity = parseFloat(this.value) || 0;
const priceInput = row.querySelector('input[type="number"][step="0.01"]:not([min="0"])');
const price = parseFloat(priceInput?.value) || 0;
const totalCell = row.querySelector('td:nth-child(6)');
if (totalCell) {
totalCell.textContent = (quantity * price).toFixed(2) + ' €';
}
}
});
});
// Similar for price inputs
const priceInputs = document.querySelectorAll('input[type="number"][step="0.01"]:not([min="0"])');
priceInputs.forEach(input => {
input.addEventListener('change', function() {
const row = this.closest('tr');
if (row) {
const price = parseFloat(this.value) || 0;
const quantityInput = row.querySelector('input[type="number"][min="0"]');
const quantity = parseFloat(quantityInput?.value) || 0;
const totalCell = row.querySelector('td:nth-child(6)');
if (totalCell) {
totalCell.textContent = (quantity * price).toFixed(2) + ' €';
}
}
});
});
});