diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.php index 539c2e2441..2990b32e35 100644 --- a/app/Http/Controllers/BillController.php +++ b/app/Http/Controllers/BillController.php @@ -200,7 +200,10 @@ class BillController extends Controller /** @var Collection $bills */ $bills = $paginator->getCollection()->map( function (Bill $bill) use ($transformer) { - return $transformer->transform($bill); + $return = $transformer->transform($bill); + $return['currency'] = $bill->transactionCurrency; + + return $return; } ); $bills = $bills->sortBy( @@ -291,8 +294,9 @@ class BillController extends Controller $parameters = new ParameterBag(); $parameters->set('start', $start); $parameters->set('end', $end); - $resource = new Item($bill, new BillTransformer($parameters), 'bill'); - $object = $manager->createData($resource)->toArray(); + $resource = new Item($bill, new BillTransformer($parameters), 'bill'); + $object = $manager->createData($resource)->toArray(); + $object['data']['currency'] = $bill->transactionCurrency; // use collector: /** @var TransactionCollectorInterface $collector */ diff --git a/app/Http/Controllers/Chart/BillController.php b/app/Http/Controllers/Chart/BillController.php index c0477edcba..9936e2125a 100644 --- a/app/Http/Controllers/Chart/BillController.php +++ b/app/Http/Controllers/Chart/BillController.php @@ -109,9 +109,9 @@ class BillController extends Controller } ); $chartData = [ - ['type' => 'bar', 'label' => (string)trans('firefly.min-amount'), 'entries' => []], - ['type' => 'bar', 'label' => (string)trans('firefly.max-amount'), 'entries' => []], - ['type' => 'line', 'label' => (string)trans('firefly.journal-amount'), 'entries' => []], + ['type' => 'bar', 'label' => (string)trans('firefly.min-amount'),'currency_symbol' => $bill->transactionCurrency->symbol, 'entries' => []], + ['type' => 'bar', 'label' => (string)trans('firefly.max-amount'),'currency_symbol' => $bill->transactionCurrency->symbol, 'entries' => []], + ['type' => 'line', 'label' => (string)trans('firefly.journal-amount'),'currency_symbol' => $bill->transactionCurrency->symbol, 'entries' => []], ]; /** @var Transaction $entry */ diff --git a/app/Transformers/BillTransformer.php b/app/Transformers/BillTransformer.php index 68b1b0559f..acc49db569 100644 --- a/app/Transformers/BillTransformer.php +++ b/app/Transformers/BillTransformer.php @@ -174,6 +174,7 @@ class BillTransformer extends TransformerAbstract 'name' => $bill->name, 'currency_id' => $bill->transaction_currency_id, 'currency_code' => $bill->transactionCurrency->code, + 'currency_symbol' => $bill->transactionCurrency->symbol, 'amount_min' => round((float)$bill->amount_min, 2), 'amount_max' => round((float)$bill->amount_max, 2), 'date' => $bill->date->format('Y-m-d'), diff --git a/public/js/ff/bills/show.js b/public/js/ff/bills/show.js index 39ef1ca95e..f2838cbf5f 100644 --- a/public/js/ff/bills/show.js +++ b/public/js/ff/bills/show.js @@ -22,6 +22,7 @@ $(function () { "use strict"; + configAccounting(billCurrencySymbol); columnChart(billUri, 'bill-overview'); } ); \ No newline at end of file diff --git a/public/js/ff/charts.defaults.js b/public/js/ff/charts.defaults.js index 3070d20e5c..ad00dd96fa 100644 --- a/public/js/ff/charts.defaults.js +++ b/public/js/ff/charts.defaults.js @@ -85,7 +85,7 @@ var defaultChartOptions = { display: false }, ticks: { - // Include a dollar sign in the ticks + // break ticks when too long. callback: function (value, index, values) { return formatLabel(value, 20); } diff --git a/public/js/ff/charts.js b/public/js/ff/charts.js index 275f3fb144..301b9a3d6d 100644 --- a/public/js/ff/charts.js +++ b/public/js/ff/charts.js @@ -202,7 +202,6 @@ function columnChart(URI, container) { var chartType = 'bar'; drawAChart(URI, container, chartType, options, colorData); - } /** diff --git a/resources/views/bills/show.twig b/resources/views/bills/show.twig index 571fe05780..a5c6c12816 100644 --- a/resources/views/bills/show.twig +++ b/resources/views/bills/show.twig @@ -27,7 +27,7 @@
- {{ trans('firefly.match_between_amounts', {low: object.data.amount_min|formatAmount, high: object.data.amount_max|formatAmount })|raw }} + {{ trans('firefly.match_between_amounts', {low: formatAmountByCurrency(object.data.currency,object.data.amount_min), high: formatAmountByCurrency(object.data.currency,object.data.amount_max) })|raw }} {{ 'repeats'|_ }} {{ trans('firefly.repeat_freq_' ~object.data.repeat_freq) }}. | @@ -55,11 +55,11 @@||
{{ trans('firefly.average_bill_amount_year', {year: year}) }} | -{{ yearAverage|formatAmount }} | +{{ formatAmountByCurrency(object.data.currency,yearAverage) }} |
{{ 'average_bill_amount_overall'|_ }} | -{{ overallAverage|formatAmount }} | +{{ formatAmountByCurrency(object.data.currency, overallAverage) }} |