From e94333f8777e362175a604188373fb470f9683bd Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 2 May 2015 08:28:24 +0200 Subject: [PATCH] Can view budgets [skip ci] --- app/Support/Twig/General.php | 6 + resources/twig/budgets/index.twig | 192 ++++++++++++++++++++++++++++++ 2 files changed, 198 insertions(+) create mode 100644 resources/twig/budgets/index.twig diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php index 3f0410e7ab..cf9c8cef88 100644 --- a/app/Support/Twig/General.php +++ b/app/Support/Twig/General.php @@ -71,6 +71,12 @@ class General extends Twig_Extension } ); + $functions[] = new Twig_SimpleFunction( + 'getCurrencySymbol', function () { + return App::make('amount')->getCurrencySymbol(); + } + ); + $functions[] = new Twig_SimpleFunction( 'phpdate', function ($str) { return date($str); diff --git a/resources/twig/budgets/index.twig b/resources/twig/budgets/index.twig new file mode 100644 index 0000000000..383e71f74d --- /dev/null +++ b/resources/twig/budgets/index.twig @@ -0,0 +1,192 @@ +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }} +
+
+
+
+ + {{ Session.get('start').format('F Y') }} +
+
+
+
+ Budgeted: +
+
+ Available in {{ Session.get('start').format('F Y') }}: + {{ amount|formatAmount }} +
+
+ +
+
+
+
+
+
+
+
+
+
+
+ Spent: {{ spent|formatAmount }} +
+
+
+
+
+ {% if overspent %} +
+
+ {% else %} +
+ {% endif %} +
+
+
+ +
+
+
+
+ +
+
+ + Transactions without a budget +
+ +
+
+ +
+ +
+ {% for budget in budgets %} +
+
+
+ + {% if budget.currentRep %} + {{ budget.name }} + {% else %} + {{ budget.name }} + {% endif %} + + + +
+
+ + +
+
+ +
+
+ +

+ {% if budget.currentRep %} + + {% else %} + + {% endif %} +

+ +

+ + + {% if budget.currentRep %} + + Budgeted: + + + {% if budget.currentRep.amount > budget.spent %} + {{ getCurrencySymbol() }} + {% else %} + {{ getCurrencySymbol() }} + {% endif %} + + {% else %} + No budget + + + + {% endif %} + +

+ +

+ Spent: {{ budget.spent|formatAmount }} +

+
+
+
+ {% endfor %} +
+
+
+ + Create budget +
+ +
+
+ {% if inactive|length > 0 %} +
+
+
+ + Inactive budgets +
+
+ {% for index,budget in inactive %} + {% if index != inactive|length-1 %} + {{ budget.name }}, + {% else %} + {{ budget.name }} + {% endif %} + {% endfor %} +
+
+
+ {% endif %} +
+ + + + +{% endblock %} +{% block scripts %} + +{% endblock %}