From b1ad0668cc5b8dd12f10fcb1ee8ecb4fca9412f2 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 7 Apr 2018 05:58:59 +0200 Subject: [PATCH] Clean overview for bills. --- app/Http/Controllers/BillController.php | 9 +++++-- resources/views/list/bills.twig | 34 ++++++------------------- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.php index 1aeeb7b8bb..0ce8312fcd 100644 --- a/app/Http/Controllers/BillController.php +++ b/app/Http/Controllers/BillController.php @@ -80,7 +80,7 @@ class BillController extends Controller { $periods = []; foreach (config('firefly.bill_periods') as $current) { - $periods[$current] = trans('firefly.' . $current); + $periods[$current] = strtolower((string)trans('firefly.repeat_freq_' . $current)); } $subTitle = trans('firefly.create_new_bill'); @@ -186,6 +186,11 @@ class BillController extends Controller return $transformer->transform($bill); } ); + $bills = $bills->sortBy( + function (array $bill) { + return (int)!$bill['active'] . strtolower($bill['name']); + } + ); $paginator->setPath(route('bills.index')); @@ -238,7 +243,7 @@ class BillController extends Controller $overallAverage = $repository->getOverallAverage($bill); $manager = new Manager(); $manager->setSerializer(new DataArraySerializer()); - $manager->parseIncludes(['attachments','notes']); + $manager->parseIncludes(['attachments', 'notes']); // Make a resource out of the data and $parameters = new ParameterBag(); diff --git a/resources/views/list/bills.twig b/resources/views/list/bills.twig index 0d37fddde7..128476957b 100644 --- a/resources/views/list/bills.twig +++ b/resources/views/list/bills.twig @@ -7,11 +7,9 @@   {{ trans('list.name') }} {{ trans('list.matchesOn') }} - {{ trans('list.matchingAmount') }} + {{ trans('list.matchingAmount') }} {{ trans('list.paid_current_period') }} {{ trans('list.next_expected_match') }} - {{ trans('list.active') }} - {{ trans('list.automatch') }} {{ trans('list.repeat_freq') }} @@ -34,6 +32,9 @@ class="fa fa-fw fa-trash-o"> + {% if not entry.active %} + + {% endif %} {{ entry.name }} {# count attachments #} {% if entry.attachments_count > 0 %} @@ -47,13 +48,8 @@ {% endfor %} - - {{ entry.amount_min|formatAmount }} - - - - - {{ entry.amount_max|formatAmount }} + + ~ {{ ((entry.amount_max+ entry.amount_min)/2)|formatAmount }} @@ -108,22 +104,8 @@ ~ {% endif %} - - {% if entry.active %} - - {% else %} - - {% endif %} - - - {% if entry.automatch %} - - {% else %} - - {% endif %} - - {{ entry.repeat_freq|_ }} + {{ ('repeat_freq_'~entry.repeat_freq)|_ }} {% if entry.skip > 0 %} {{ 'skips_over'|_ }} {{ entry.skip }} {% endif %} @@ -174,7 +156,7 @@ {{ 'expected_total'|_ }} ({{ 'active_bills_only'|_ }}) - {{ expected_total|formatAmount }} + ~ {{ expected_total|formatAmount }}