This commit is contained in:
KONE SOREL 2026-01-12 11:57:58 +00:00
parent 314c54bab4
commit e5d3ed0ca9

View File

@ -341,47 +341,23 @@
<script>
// Configuration commune
(function() {
// Récupération de la devise depuis PHP
const userCurrency = '<?= isset($_SESSION['devise_C']) ? $_SESSION['devise_C'] : 'FRW' ?>';
// Configuration des devises
const currencyFormats = {
'FRW': {
symbol: 'FRW',
format: (value) => new Intl.NumberFormat('fr-FR').format(value) + ' FRW'
},
'€': {
symbol: '€',
format: (value) => new Intl.NumberFormat('fr-FR', {style: 'currency', currency: 'EUR'}).format(value)
},
'$': {
symbol: '$',
format: (value) => new Intl.NumberFormat('fr-FR', {style: 'currency', currency: 'USD'}).format(value)
},
'XOF': {
symbol: 'FRW',
format: (value) => new Intl.NumberFormat('fr-FR').format(value) + ' FRW'
}
};
// Format monétaire dynamique
// Format monétaire simplifié (sans devise)
const formatMoney = (value) => {
const currencyConfig = currencyFormats[userCurrency] || currencyFormats['FRW'];
return currencyConfig.format(value);
return new Intl.NumberFormat('fr-FR').format(value);
};
// Format pourcentage sécurisé
const formatPercentage = (value, total) => {
if (total === 0) {
return '0%'; // ou éventuellement 'N/A' selon ton besoin
}
const percentage = (value * 100 / total).toFixed(1);
return percentage + '%';
};
const formatPercentage = (value, total) => {
if (total === 0) {
return '0%'; // ou 'N/A' si tu préfères
}
const percentage = (value * 100 / total).toFixed(1);
return percentage + '%';
};
// Détection mobile
const isMobile = window.matchMedia("(max-width: 768px)").matches;
// Génération des couleurs
const generateColors = (count) => {
const palette = [