project-tracker-pro / script.js
gtkh's picture
Je veux que le tableau soit un plus moderne
83e14b4 verified
Raw
History Blame Contribute Delete
2.34 kB
document.addEventListener('DOMContentLoaded', function() {
// Format currency cells
document.querySelectorAll('td').forEach(cell => {
if (cell.textContent.includes(',')) {
const value = parseFloat(cell.textContent.replace(/,/g, ''));
// Format as currency
cell.textContent = new Intl.NumberFormat('fr-FR', {
style: 'currency',
currency: 'EUR',
minimumFractionDigits: 0,
maximumFractionDigits: 0
}).format(value).replace('€', '') + ' €';
// Color coding based on value
if (value > 200000) {
cell.classList.add('cell-danger');
} else if (value > 100000) {
cell.classList.add('cell-warning');
} else {
cell.classList.add('cell-positive');
}
}
});
// Modern hover effects and click events for rows
document.querySelectorAll('tbody tr').forEach(row => {
row.style.cursor = 'pointer';
row.addEventListener('mouseenter', function() {
this.style.transform = 'translateY(-2px)';
this.style.boxShadow = '0 4px 12px rgba(59, 130, 246, 0.1)';
});
row.addEventListener('mouseleave', function() {
this.style.transform = '';
this.style.boxShadow = '';
});
row.addEventListener('click', function() {
const projectId = this.querySelector('td:first-child').textContent;
console.log('Navigating to project detail:', projectId);
// Modern visual feedback
this.style.transform = 'scale(0.99)';
this.style.boxShadow = '0 0 0 2px rgba(59, 130, 246, 0.3)';
setTimeout(() => {
this.style.transform = '';
this.style.boxShadow = '';
}, 200);
});
});
// Add subtle animation to table headers
document.querySelectorAll('thead th').forEach((th, index) => {
th.style.opacity = '0';
th.style.transform = 'translateY(-10px)';
th.style.animation = `fadeInUp 0.4s ease-out ${index * 0.05}s forwards`;
});
// Initialize Feather icons
if (feather) {
feather.replace();
}
});