f
This commit is contained in:
parent
e5d3ed0ca9
commit
efb7744bd7
|
|
@ -341,23 +341,47 @@
|
||||||
<script>
|
<script>
|
||||||
// Configuration commune
|
// Configuration commune
|
||||||
(function() {
|
(function() {
|
||||||
// Format monétaire simplifié (sans devise)
|
// 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
|
||||||
const formatMoney = (value) => {
|
const formatMoney = (value) => {
|
||||||
return new Intl.NumberFormat('fr-FR').format(value);
|
const currencyConfig = currencyFormats[userCurrency] || currencyFormats['FRW'];
|
||||||
|
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 'N/A' si tu préfères
|
return '0%'; // ou éventuellement 'N/A' selon ton besoin
|
||||||
}
|
}
|
||||||
const percentage = (value * 100 / total).toFixed(1);
|
const percentage = (value * 100 / total).toFixed(1);
|
||||||
return percentage + '%';
|
return percentage + '%';
|
||||||
};
|
};
|
||||||
|
|
||||||
// Détection mobile
|
// Détection mobile
|
||||||
const isMobile = window.matchMedia("(max-width: 768px)").matches;
|
const isMobile = window.matchMedia("(max-width: 768px)").matches;
|
||||||
|
|
||||||
// Génération des couleurs
|
// Génération des couleurs
|
||||||
const generateColors = (count) => {
|
const generateColors = (count) => {
|
||||||
const palette = [
|
const palette = [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user