diff --git a/scripts/fonctions.js b/scripts/fonctions.js index e7f4f10..c05c1cf 100644 --- a/scripts/fonctions.js +++ b/scripts/fonctions.js @@ -184,12 +184,33 @@ function convertCurrency(urlFixerIO, currency, euroValue) { dataType : "jsonp", success: function (jsonFixer) { switch(currency) { - case '$': - $('.results').html(formatNumberResult(euroValue) + ' € = ' + (formatNumberResult(parseFloat(jsonFixer.rates.USD) * euroValue)).toFixed(2) + ' ' + currency); - break; case '£': - $('.results').html(formatNumberResult(euroValue) + ' € = ' + (formatNumberResult(parseFloat(jsonFixer.rates.GBP) * euroValue)).toFixed(2) + ' ' + currency); + $('.results').html(formatNumberResult(euroValue) + ' € = ' + ((parseFloat(jsonFixer.rates.GBP) * euroValue)).toFixed(2) + ' ' + currency); break; + case '$ Américain': + $('.results').html(formatNumberResult(euroValue) + ' € = ' + ((parseFloat(jsonFixer.rates.USD) * euroValue)).toFixed(2) + ' ' + currency); + break; + case '$ Canadien': + $('.results').html(formatNumberResult(euroValue) + ' € = ' + ((parseFloat(jsonFixer.rates.CAD) * euroValue)).toFixed(2) + ' ' + currency); + break; + case '$ Australien': + $('.results').html(formatNumberResult(euroValue) + ' € = ' + ((parseFloat(jsonFixer.rates.AUD) * euroValue)).toFixed(2) + ' ' + currency); + break; + case '$ Mexicain': + $('.results').html(formatNumberResult(euroValue) + ' € = ' + ((parseFloat(jsonFixer.rates.MXN) * euroValue)).toFixed(2) + ' ' + currency); + break; + case 'Fr': + $('.results').html(formatNumberResult(euroValue) + ' € = ' + ((parseFloat(jsonFixer.rates.CHF) * euroValue)).toFixed(2) + ' ' + currency); + break; + case '₽': + $('.results').html(formatNumberResult(euroValue) + ' € = ' + ((parseFloat(jsonFixer.rates.RUB) * euroValue)).toFixed(2) + ' ' + currency); + break; + case 'R$': + $('.results').html(formatNumberResult(euroValue) + ' € = ' + ((parseFloat(jsonFixer.rates.BRL) * euroValue)).toFixed(2) + ' ' + currency); + break; + case '¥': + $('.results').html(formatNumberResult(euroValue) + ' € = ' + ((parseFloat(jsonFixer.rates.JPY) * euroValue)).toFixed(2) + ' ' + currency); + break; default: $('.results').html(formatNumberResult(euroValue) + ' €'); break; @@ -203,6 +224,7 @@ function convertCurrency(urlFixerIO, currency, euroValue) { }); } + ///////////////////////////////////////////////////////////////// /* Fonctions Annexes */ diff --git a/views/function-views/convertCurrency.php b/views/function-views/convertCurrency.php index 5235094..d2fc04d 100644 --- a/views/function-views/convertCurrency.php +++ b/views/function-views/convertCurrency.php @@ -16,8 +16,15 @@