f
This commit is contained in:
parent
efb7744bd7
commit
f55884cc55
|
|
@ -341,39 +341,15 @@
|
||||||
<script>
|
<script>
|
||||||
// Configuration commune
|
// Configuration commune
|
||||||
(function() {
|
(function() {
|
||||||
// Récupération de la devise depuis PHP
|
// Format numérique simplifié (sans devise)
|
||||||
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
|
|
||||||
const formatMoney = (value) => {
|
const formatMoney = (value) => {
|
||||||
const currencyConfig = currencyFormats[userCurrency] || currencyFormats['FRW'];
|
return new Intl.NumberFormat('fr-FR').format(value);
|
||||||
return currencyConfig.format(value);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Format pourcentage sécurisé
|
// Format pourcentage sécurisé
|
||||||
const formatPercentage = (value, total) => {
|
const formatPercentage = (value, total) => {
|
||||||
if (total === 0) {
|
if (total === 0) {
|
||||||
return '0%'; // ou éventuellement 'N/A' selon ton besoin
|
return '0%'; // ou 'N/A' si tu préfères
|
||||||
}
|
}
|
||||||
const percentage = (value * 100 / total).toFixed(1);
|
const percentage = (value * 100 / total).toFixed(1);
|
||||||
return percentage + '%';
|
return percentage + '%';
|
||||||
|
|
@ -641,7 +617,7 @@
|
||||||
beginAtZero: true,
|
beginAtZero: true,
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: `Montant des dépenses (${userCurrency})`,
|
text: `Montant des dépenses`,
|
||||||
font: {
|
font: {
|
||||||
weight: 'bold'
|
weight: 'bold'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user