diff --git a/readme.md b/readme.md index 7a9cbdee..36a8ff31 100644 --- a/readme.md +++ b/readme.md @@ -70,6 +70,8 @@ Crater is a product of [Bytefury](https://bytefury.com) - [Birkhoff Lee](https://github.com/BirkhoffLee) - [Akaunting](https://github.com/akaunting/akaunting) - [MakerLab](https://github.com/MakerLab-Dev) +- [Sebastian Cretu](https://github.com/sebastiancretu) +- [Florian Gareis](https://github.com/TheZoker) ## Translate diff --git a/resources/assets/js/helpers/utilities.js b/resources/assets/js/helpers/utilities.js index b80f4593..23242eda 100644 --- a/resources/assets/js/helpers/utilities.js +++ b/resources/assets/js/helpers/utilities.js @@ -23,7 +23,13 @@ export default { amount = amount / 100 - let { precision, decimal_separator, thousand_separator, symbol, swap_currency_symbol } = currency + let { + precision, + decimal_separator, + thousand_separator, + symbol, + swap_currency_symbol, + } = currency try { precision = Math.abs(precision) @@ -37,15 +43,22 @@ export default { let j = i.length > 3 ? i.length % 3 : 0 let moneySymbol = `${symbol}` - let thousandText = (j ? i.substr(0, j) + thousand_separator : '') - let amountText = i.substr(j).replace(/(\d{3})(?=\d)/g, '$1' + thousand_separator) - let precisionText = (precision ? decimal_separator + Math.abs(amount - i).toFixed(precision).slice(2) : ''); - let combinedAmountText = negativeSign + thousandText + amountText + precisionText + let thousandText = j ? i.substr(0, j) + thousand_separator : '' + let amountText = i + .substr(j) + .replace(/(\d{3})(?=\d)/g, '$1' + thousand_separator) + let precisionText = precision + ? decimal_separator + + Math.abs(amount - i) + .toFixed(precision) + .slice(2) + : '' + let combinedAmountText = + negativeSign + thousandText + amountText + precisionText - return (swap_currency_symbol - ? combinedAmountText + ' ' + moneySymbol + return swap_currency_symbol + ? combinedAmountText + ' ' + moneySymbol : moneySymbol + ' ' + combinedAmountText - ) } catch (e) { console.log(e) } @@ -63,7 +76,13 @@ export default { amount = amount / 100 - let { precision, decimal_separator, thousand_separator, symbol, swap_currency_symbol } = currency + let { + precision, + decimal_separator, + thousand_separator, + symbol, + swap_currency_symbol, + } = currency try { precision = Math.abs(precision) @@ -77,15 +96,22 @@ export default { let j = i.length > 3 ? i.length % 3 : 0 let moneySymbol = `${symbol}` - let thousandText = (j ? i.substr(0, j) + thousand_separator : '') - let amountText = i.substr(j).replace(/(\d{3})(?=\d)/g, '$1' + thousand_separator) - let precisionText = (precision ? decimal_separator + Math.abs(amount - i).toFixed(precision).slice(2) : ''); - let combinedAmountText = negativeSign + thousandText + amountText + precisionText + let thousandText = j ? i.substr(0, j) + thousand_separator : '' + let amountText = i + .substr(j) + .replace(/(\d{3})(?=\d)/g, '$1' + thousand_separator) + let precisionText = precision + ? decimal_separator + + Math.abs(amount - i) + .toFixed(precision) + .slice(2) + : '' + let combinedAmountText = + negativeSign + thousandText + amountText + precisionText - return (swap_currency_symbol - ? combinedAmountText + ' ' + moneySymbol + return swap_currency_symbol + ? combinedAmountText + ' ' + moneySymbol : moneySymbol + ' ' + combinedAmountText - ) } catch (e) { console.log(e) } @@ -270,5 +296,5 @@ export default { return -1 } return 0 - } + }, }