Skip to content

Firefly III: a personal finances manager

Made it almost to the accounts.

James Cole3e5e5b376fd7
diff --git a/app/Providers/ConfigServiceProvider.php b/app/Providers/ConfigServiceProvider.php
index c4deebb1d1..77dd2eef93 100644
--- a/app/Providers/ConfigServiceProvider.php
+++ b/app/Providers/ConfigServiceProvider.php
@@ -161,7 +161,9 @@ class ConfigServiceProvider extends ServiceProvider
]
],
'Session',
- 'Route'
+ 'Route',
+ 'Config',
+ 'ExpandedForm'
],
/*
diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.php
index 844db98847..b9d5601eaa 100644
--- a/app/Providers/FireflyServiceProvider.php
+++ b/app/Providers/FireflyServiceProvider.php
@@ -9,7 +9,8 @@ use FireflyIII\Support\ExpandedForm;
use FireflyIII\Support\Navigation;
use FireflyIII\Support\Preferences;
use FireflyIII\Support\Steam;
-use FireflyIII\Support\TwigSupport;
+use FireflyIII\Support\Twig\General;
+use FireflyIII\Support\Twig\Journals;
use FireflyIII\Validation\FireflyValidator;
use Illuminate\Support\ServiceProvider;
use Twig;
@@ -36,7 +37,8 @@ class FireflyServiceProvider extends ServiceProvider
$config = App::make('config');
Twig::addExtension(new Functions($config));
- Twig::addExtension(new TwigSupport);
+ Twig::addExtension(new General);
+ Twig::addExtension(new Journals);
}
public function register()
diff --git a/app/Support/TwigSupport.php b/app/Support/Twig/General.php
similarity index 54%
rename from app/Support/TwigSupport.php
rename to app/Support/Twig/General.php
index 9e09690a3a..e80e327bdc 100644
--- a/app/Support/TwigSupport.php
+++ b/app/Support/Twig/General.php
@@ -1,8 +1,9 @@
<?php
-namespace FireflyIII\Support;
+namespace FireflyIII\Support\Twig;
use App;
+use Config;
use FireflyIII\Models\Account;
use Route;
use Twig_Extension;
@@ -14,10 +15,13 @@ use Twig_SimpleFunction;
*
* @package FireflyIII\Support
*/
-class TwigSupport extends Twig_Extension
+class General extends Twig_Extension
{
+ /**
+ * @return array
+ */
public function getFilters()
{
$filters = [];
@@ -40,18 +44,17 @@ class TwigSupport extends Twig_Extension
return 'NULL';
}
- return App::make('amount')->format(App::make('steam')->balance($account));
- }, ['is_safe' => ['html']]
+ return App::make('steam')->balance($account);
+ }
);
- $filters[] = new Twig_SimpleFilter(
- 'activeRoute', function ($string) {
- if (Route::getCurrentRoute()->getName() == $string) {
- return 'active';
- }
- return '';
+ // should be a function but OK
+ $filters[] = new Twig_SimpleFilter(
+ 'getAccountRole', function ($name) {
+ return Config::get('firefly.accountRoles.' . $name);
}
);
+
return $filters;
}
@@ -68,12 +71,34 @@ class TwigSupport extends Twig_Extension
}
);
+
$functions[] = new Twig_SimpleFunction(
'env', function ($name, $default) {
return env($name, $default);
}
);
+ $functions[] = new Twig_SimpleFunction(
+ 'activeRoute', function ($context) {
+ $args = func_get_args();
+ $route = $args[1];
+ $what = isset($args[2]) ? $args[2] : false;
+ $activeWhat = isset($context['what']) ? $context['what'] : false;
+ // activeRoute
+ if (!($what === false)) {
+ if ($what == $activeWhat && Route::getCurrentRoute()->getName() == $route) {
+ return 'active because-active-what';
+ }
+ } else {
+ if (Route::getCurrentRoute()->getName() == $route) {
+ return 'active because-route-matches';
+ }
+ }
+
+ return 'not-xxx-at-all';
+ }, ['needs_context' => true]
+ );
+
return $functions;
@@ -84,7 +109,7 @@ class TwigSupport extends Twig_Extension
*/
public function getName()
{
- return 'FireflyIII\Support\TwigSupport';
+ return 'FireflyIII\Support\Twig\General';
}
}
\ No newline at end of file
diff --git a/app/Support/Twig/Journals.php b/app/Support/Twig/Journals.php
new file mode 100644
index 0000000000..a8c2105832
--- /dev/null
+++ b/app/Support/Twig/Journals.php
@@ -0,0 +1,78 @@
+<?php
+
+namespace FireflyIII\Support\Twig;
+
+
+use FireflyIII\Models\TransactionJournal;
+use Twig_Extension;
+use Twig_SimpleFilter;
+use Twig_SimpleFunction;
+
+/**
+ * Class Journals
+ *
+ * @package FireflyIII\Support\Twig
+ */
+class Journals extends Twig_Extension
+{
+
+ public function getFilters()
+ {
+ $filters = [];
+
+ $filters[] = new Twig_SimpleFilter(
+ 'typeIcon', function (TransactionJournal $journal) {
+ $type = $journal->transactionType->type;
+ if ($type == 'Withdrawal') {
+ return '<span class="glyphicon glyphicon-arrow-left" title="Withdrawal"></span>';
+ }
+ if ($type == 'Deposit') {
+ return '<span class="glyphicon glyphicon-arrow-right" title="Deposit"></span>';
+ }
+ if ($type == 'Transfer') {
+ return '<i class="fa fa-fw fa-exchange" title="Transfer"></i>';
+ }
+ if ($type == 'Opening balance') {
+ return '<span class="glyphicon glyphicon-ban-circle" title="Opening balance"></span>';
+ }
+
+
+ }, ['is_safe' => ['html']]
+ );
+
+ return $filters;
+ }
+
+ public function getFunctions()
+ {
+ $functions = [];
+
+ $functions[] = new Twig_SimpleFunction(
+ 'invalidJournal', function (TransactionJournal $journal) {
+ if (!isset($journal->transactions[1]) || !isset($journal->transactions[0])) {
+ return true;
+ }
+
+ return false;
+ }
+ );
+
+ $functions[] = new Twig_SimpleFunction(
+ 'relevantTags', function (TransactionJournal $journal) {
+ return 'TODO'.$journal->amount;
+ }
+ );
+
+ return $functions;
+ }
+
+ /**
+ * Returns the name of the extension.
+ *
+ * @return string The extension name
+ */
+ public function getName()
+ {
+ return 'FireflyIII\Support\Twig\Journals';
+ }
+}
\ No newline at end of file
diff --git a/public/js/sb-admin-2.js b/public/js/sb-admin-2.js
index 5be2c883ad..469460fd16 100755
--- a/public/js/sb-admin-2.js
+++ b/public/js/sb-admin-2.js
@@ -29,8 +29,8 @@ $(function() {
var url = window.location;
var element = $('ul.nav a').filter(function() {
return this.href == url || url.href.indexOf(this.href) == 0;
- }).addClass('active').parent().parent().addClass('in').parent();
+ }).parent().parent().addClass('in').parent();/*addClass('active')*/
if (element.is('li')) {
- element.addClass('active');
+ //element.addClass('active');
}
});
diff --git a/resources/twig/accounts/create.twig b/resources/twig/accounts/create.twig
new file mode 100644
index 0000000000..9439400236
--- /dev/null
+++ b/resources/twig/accounts/create.twig
@@ -0,0 +1,61 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, what) }}
+ <form action="{{ route('accounts.store') }}" method="post" id="store" class="form-horizontal">
+ <input type="hidden" name="what" value="{{ what }}" />
+
+<div class="row">
+ <div class="col-lg-6 col-md-6 col-sm-12">
+ <div class="panel panel-primary">
+ <div class="panel-heading">
+ <i class="fa {{ subTitleIcon }}"></i> Mandatory fields
+ </div>
+ <div class="panel-body">
+ {{ ExpandedForm.text('name') }}
+ </div>
+ </div>
+ </div>
+
+ <div class="col-lg-6 col-md-6 col-sm-12">
+
+ @if(what == 'asset')
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-smile-o"></i> Optional fields
+ </div>
+ <div class="panel-body">
+
+ {{ ExpandedForm.balance('openingBalance') }}
+ {{ ExpandedForm.date('openingBalanceDate', date('Y-m-d')) }}
+ {{ ExpandedForm.select('accountRole',Config.get('firefly.accountRoles'), null, {'helpText' : 'Any extra options resulting from your choice can be set later.'}) }}
+ {{ ExpandedForm.balance('virtualBalance') }}
+
+ </div>
+ </div>
+ @endif
+
+ <!-- panel for options -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-bolt"></i> Options
+ </div>
+ <div class="panel-body">
+ {{ ExpandedForm.optionsList('create','account') }}
+ </div>
+ </div>
+
+ </div>
+</div>
+<div class="row">
+ <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
+ <p>
+ <button type="submit" class="btn btn-lg btn-success">
+ <i class="fa fa-plus-circle"></i> Store new {{ what }} account
+ </button>
+ </p>
+ </div>
+</div>
+
+</form>
+-->
+{% endblock %}
\ No newline at end of file
diff --git a/resources/twig/accounts/delete.twig b/resources/twig/accounts/delete.twig
new file mode 100644
index 0000000000..f6ee597cdb
--- /dev/null
+++ b/resources/twig/accounts/delete.twig
@@ -0,0 +1,36 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $account) !!}
+{!! Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('accounts.destroy',$account->id)]) !!}
+<div class="row">
+ <div class="col-lg-6 col-md-12 col-sm-12">
+ <div class="panel panel-red">
+ <div class="panel-heading">
+ Delete account "{{{$account->name}}}"
+ </div>
+ <div class="panel-body">
+ <p>
+ Are you sure that you want to delete the {{strtolower($account->accountType->type)}} "{{$account->name}}"?
+ </p>
+
+ @if($account->transactions()->count() > 0)
+ <p class="text-danger">
+ {{ucfirst($account->accountType->type)}} "{{{$account->name}}}" still has {{$account->transactions()->count()}} transaction(s) associated to it. These will be deleted as well.
+ </p>
+ @endif
+ @if($account->piggyBanks()->count() > 0)
+ <p class="text-danger">
+ {{ucfirst($account->accountType->type)}} "{{{$account->name}}}" still has {{$account->piggyBanks()->count()}} piggy bank(s) associated to it. These will be deleted as well.
+ </p>
+ @endif
+ <p>
+ <button type="submit" class="btn btn-default btn-danger">Delete permanently</button>
+ <a href="{{URL::previous()}}" class="btn-default btn">Cancel</a >
+ </p>
+ </div>
+ </div>
+ </div>
+</div>
+
+{!! Form::close() !!}
+{% endblock %}
diff --git a/resources/twig/accounts/edit.twig b/resources/twig/accounts/edit.twig
new file mode 100644
index 0000000000..0ecfceb939
--- /dev/null
+++ b/resources/twig/accounts/edit.twig
@@ -0,0 +1,72 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $account) !!}
+{!! Form::model($account, ['class' => 'form-horizontal','id' => 'update','url' => route('accounts.update',$account->id)]) !!}
+
+<input type="hidden" name="id" value="{{$account->id}}" />
+
+<div class="row">
+ <div class="col-lg-6 col-md-6 col-sm-12">
+ <div class="panel panel-primary">
+ <div class="panel-heading">
+ <i class="fa {{{$subTitleIcon}}}"></i> Mandatory fields
+ </div>
+ <div class="panel-body">
+ {!! ExpandedForm::text('name') !!}
+ </div>
+ </div>
+
+ </div>
+ <div class="col-lg-6 col-md-6 col-sm-12">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-smile-o"></i> Optional fields
+ </div>
+ <div class="panel-body">
+ @if($account->accounttype->type == 'Default account' || $account->accounttype->type == 'Asset account')
+ {!! ExpandedForm::balance('openingBalance',null, ['currency' => $openingBalance ? $openingBalance->transactionCurrency : null]) !!}
+ {!! ExpandedForm::date('openingBalanceDate') !!}
+ {!! ExpandedForm::select('accountRole',Config::get('firefly.accountRoles')) !!}
+ {!! ExpandedForm::balance('virtualBalance',null) !!}
+ {!! Form::hidden('id',$account->id) !!}
+ @endif
+ {!! ExpandedForm::checkbox('active','1') !!}
+ </div>
+ </div>
+
+ <!-- panel for credit card options -->
+ @if(Session::get('preFilled')['accountRole'] == 'ccAsset')
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-credit-card"></i> Credit card options
+ </div>
+ <div class="panel-body">
+ {!! ExpandedForm::select('ccType',Config::get('firefly.ccTypes')) !!}
+ {!! ExpandedForm::date('ccMonthlyPaymentDate',null,['helpText' => 'Select any year and any month, it will be ignored anway. Only the day of the month is relevant.']) !!}
+ </div>
+ </div>
+ @endif
+
+ <!-- panel for options -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-bolt"></i> Options
+ </div>
+ <div class="panel-body">
+ {!! ExpandedForm::optionsList('update','account') !!}
+ </div>
+ </div>
+ </div>
+</div>
+<div class="row">
+ <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
+ <p>
+ <button type="submit" class="btn btn-lg btn-success">
+ Update account
+ </button>
+ </p>
+ </div>
+</div>
+
+{!! Form::close() !!}
+{% endblock %}
diff --git a/resources/twig/accounts/index.twig b/resources/twig/accounts/index.twig
new file mode 100644
index 0000000000..a596dd3111
--- /dev/null
+++ b/resources/twig/accounts/index.twig
@@ -0,0 +1,46 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, what) }}
+<div class="row">
+ <div class="col-lg-12 col-md-12 col-sm-12">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa {{ subTitleIcon }}"></i> {{ subTitle}}
+
+ <!-- ACTIONS MENU -->
+ <div class="pull-right">
+ <div class="btn-group">
+ <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
+ Actions
+ <span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu pull-right" role="menu">
+ <li><a href="{{route('accounts.create', what)}}"><i class="fa fa-plus fa-fw"></i> New {{ what }} account</a></li>
+ </ul>
+ </div>
+ </div>
+
+
+ </div>
+ {% include 'list/accounts.twig' %}
+ </div>
+ </div>
+</div>
+{% endblock %}
+
+{% block styles %}
+ <link rel="stylesheet" href="css/bootstrap-sortable.css" type="text/css" media="all" />
+{% endblock %}
+
+{% block scripts %}
+<script type="text/javascript">
+ var what = '{{ what }}';
+</script>
+
+<!-- load the libraries and scripts necessary for Google Charts: -->
+<script type="text/javascript" src="https://www.google.com/jsapi"></script>
+<script type="text/javascript" src="js/gcharts.options.js"></script>
+<script type="text/javascript" src="js/gcharts.js"></script>
+<script type="text/javascript" src="js/bootstrap-sortable.js"></script>
+<script type="text/javascript" src="js/accounts.js"></script>
+{% endblock %}
diff --git a/resources/twig/accounts/show.twig b/resources/twig/accounts/show.twig
new file mode 100644
index 0000000000..59ea7654ae
--- /dev/null
+++ b/resources/twig/accounts/show.twig
@@ -0,0 +1,60 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, account) }}
+ <div class="row">
+ <div class="col-lg-12 col-md-12 col-sm-12">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-fw {{ subTitleIcon }} fa-fw"></i> {{ account.name }}
+
+
+ <!-- ACTIONS MENU -->
+ <div class="pull-right">
+ <div class="btn-group">
+ <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
+ Actions
+ <span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu pull-right" role="menu">
+ <li><a href="{{route('accounts.edit', account.id)}}"><i class="fa fa-pencil fa-fw"></i> Edit</a></li>
+ <li><a href="{{route('accounts.delete', account.id)}}"><i class="fa fa-trash fa-fw"></i> Delete</a></li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ <div class="panel-body">
+ <div id="overview-chart"></div>
+ </div>
+ </div>
+ </div>
+</div>
+
+
+<div class="row">
+ <div class="col-lg-12 col-md-12 col-sm-12">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-repeat fa-fw"></i> Transactions
+ </div>
+ <div class="panel-body">
+ {% include 'list/journals.twig' with {sorting:true} %}
+ </div>
+ </div>
+</div>
+
+
+
+{% endblock %}
+
+{% block scripts %}
+<script type="text/javascript">
+ var accountID = {{ account.id }};
+</script>
+<!-- load the libraries and scripts necessary for Google Charts: -->
+<script type="text/javascript" src="https://www.google.com/jsapi"></script>
+<script type="text/javascript" src="js/gcharts.options.js"></script>
+<script type="text/javascript" src="js/gcharts.js"></script>
+<script src="js/jquery-ui.min.js" type="text/javascript"></script>
+<script src="js/accounts.js" type="text/javascript"></script>
+
+{% endblock %}
\ No newline at end of file
diff --git a/resources/twig/index.twig b/resources/twig/index.twig
index c767243e4c..91956567ad 100644
--- a/resources/twig/index.twig
+++ b/resources/twig/index.twig
@@ -204,9 +204,6 @@
{% endblock %}
{% block scripts %}
- <script type="text/javascript">
- var currencyCode = '{{getCurrencyCode }}';
- </script>
<!-- load the libraries and scripts necessary for Google Charts: -->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="js/gcharts.options.js"></script>
diff --git a/resources/twig/layout/default.twig b/resources/twig/layout/default.twig
index 58d5289c8e..cfe1190903 100644
--- a/resources/twig/layout/default.twig
+++ b/resources/twig/layout/default.twig
@@ -11,19 +11,19 @@
{% endif %}
{% if subTitle %}
- // {{subTitle}}
+ // {{ subTitle }}
{% endif %}
</title>
- <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,700,300italic" type="ext/css" media="all" />
- <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css" type="text/css" media="all" />
- <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" type="text/css" media="all" />
- <link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css" type="text/css" media="all" />
- <link rel="stylesheet" href="css/metisMenu.min.css" type="text/css" media="all" />
- <link rel="stylesheet" href="css/sb-admin-2.css" type="text/css" media="all" />
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,700,300italic" type="ext/css" media="all"/>
+ <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css" type="text/css" media="all"/>
+ <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" type="text/css" media="all"/>
+ <link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css" type="text/css" media="all"/>
+ <link rel="stylesheet" href="css/metisMenu.min.css" type="text/css" media="all"/>
+ <link rel="stylesheet" href="css/sb-admin-2.css" type="text/css" media="all"/>
<!-- date range -->
- <link rel="stylesheet" href="css/daterangepicker-bs3.css" type="text/css" media="all" />
+ <link rel="stylesheet" href="css/daterangepicker-bs3.css" type="text/css" media="all"/>
- <link rel="stylesheet" href="css/firefly.css" type="text/css" media="all" />
+ <link rel="stylesheet" href="css/firefly.css" type="text/css" media="all"/>
{% block styles %}{% endblock %}
@@ -52,7 +52,7 @@
<body>
<div id="wrapper">
- {% include('partials/menu.twig') %}
+ {% include 'partials/menu.twig' %}
<div id="page-wrapper">
@@ -60,20 +60,21 @@
<div class="col-lg-12">
<h1 class="page-header">
{% if mainTitleIcon %}
- <i class="fa {{ mainTitleIcon }}"></i>
+ <i class="fa {{ mainTitleIcon }}"></i>
{% endif %}
{{ title }}
{% if subTitle %}
- <small>
- {% if subTitleIcon %}
- <i class="fa {{subTitleIcon}}"></i>
- {% endif %}
- {{ subTitle }}
- </small>
+ <small>
+ {% if subTitleIcon %}
+ <i class="fa {{ subTitleIcon }}"></i>
+ {% endif %}
+ {{ subTitle }}
+ </small>
{% endif %}
- <small class="pull-right"><a href="#" id="help" data-route="{{ Route.getCurrentRoute.getName }}"><i data-route="{{Route.getCurrentRoute.getName}}" class="fa fa-question-circle"></i></a></small>
+ <small class="pull-right"><a href="#" id="help" data-route="{{ Route.getCurrentRoute.getName }}"><i
+ data-route="{{ Route.getCurrentRoute.getName }}" class="fa fa-question-circle"></i></a></small>
</h1>
</div>
@@ -88,18 +89,20 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
- <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
+ <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
+ </button>
<h4 class="modal-title" id="helpTitle">Please hold...</h4>
</div>
<div class="modal-body" id="helpBody">
- <i class="fa fa-refresh fa-spin"></i>
+ <i class="fa fa-refresh fa-spin"></i>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
- </div><!-- /.modal -->
+ </div>
+ <!-- /.modal -->
</div>
</div>
@@ -130,26 +133,34 @@
var token = "{{csrf_token()}}";
var firstDate = moment("{{Session.get('first').format('Y-m-d')}}");
var currentMonthName = "{{ currentMonthName }}";
- var previousMonthName = "{{ previousMonthName }}";
- var nextMonthName = "{{ nextMonthName }}";
- $('#daterange span').text(titleString);
+ var previousMonthName = "{{ previousMonthName }}";
+ var nextMonthName = "{{ nextMonthName }}";
+ var currencyCode = '{{getCurrencyCode() }}';
+ $('#daterange span').text(titleString);
</script>
<script type="text/javascript" src="js/firefly.js"></script>
{% block scripts %}{% endblock %}
<script>
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+ (function (i, s, o, g, r, a, m) {
+ i['GoogleAnalyticsObject'] = r;
+ i[r] = i[r] || function () {
+ (i[r].q = i[r].q || []).push(arguments)
+ }, i[r].l = 1 * new Date();
+ a = s.createElement(o),
+ m = s.getElementsByTagName(o)[0];
+ a.async = 1;
+ a.src = g;
+ m.parentNode.insertBefore(a, m)
+ })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', '{{ env('ANALYTICS_ID', 'XXX-XX-X') }}', 'auto');
ga('send', 'pageview');
// send an event if relevant:
{% if Session.has('gaEventCategory') and Session.has('gaEventAction') %}
- ga('send','event','{{Session.get('gaEventCategory')}}','{{Session.get('gaEventAction')}}');
+ ga('send', 'event', '{{Session.get('gaEventCategory')}}', '{{Session.get('gaEventAction')}}');
{% endif %}
</script>
diff --git a/resources/twig/list/accounts.twig b/resources/twig/list/accounts.twig
new file mode 100644
index 0000000000..200f09eb04
--- /dev/null
+++ b/resources/twig/list/accounts.twig
@@ -0,0 +1,59 @@
+<table class="table table-striped table-bordered sortable">
+ <thead>
+ <tr>
+ <th data-defaultsort="disabled">&nbsp;</th>
+ <th>Name</th>
+ {% if what == 'asset' %}
+ <th>Role</th>
+ {% endif %}
+ <th>Current balance</th>
+ <th>Active</th>
+ <th>Last activity</th>
+ <th>Balance difference between {{ Session.get('start').format('jS F Y') }} and {{ Session.get('end').format('jS F Y') }}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for account in accounts %}
+ <tr>
+ <td>
+ <div class="btn-group btn-group-xs">
+ <a class="btn btn-default btn-xs" href="{{route('accounts.edit',account.id)}}"><i class="fa fa-fw fa-pencil"></i></a>
+ <a class="btn btn-danger btn-xs" href="{{route('accounts.delete',account.id)}}"><i class="fa fa-fw fa-trash-o"></i></a>
+ </div>
+ </td>
+ <td><a href="{{route('accounts.show',account.id)}}">{{ account.name }}</a></td>
+ {% if what == "asset" %}
+ <td>
+ {% for entry in account.accountmeta %}
+ {% if entry.name == 'accountRole' %}
+ {{ entry.data|getAccountRole }}
+ {% endif %}
+ {% endfor %}
+ </td>
+ {% endif %}
+ <td data-value="{{ account|balance }}">{{ account|balance|formatAmount }}</td>
+ <td data-value="{{account.active}}">
+ {% if account.active %}
+ <i class="fa fa-fw fa-check"></i>
+ {% else %}
+ <i class="fa fa-fw fa-ban"></i>
+ {% endif %}
+ </td>
+ {% if account.lastActivityDate %}
+ <td data-value="{{ account.lastActivityDate.format('U') }} ">
+ {{ account.lastActivityDate.format('j F Y') }}
+ </td>
+ {% else %}
+ <td data-value="0">
+ <em>Never</em>
+ </td>
+ {% endif %}
+ <td data-value="{{account.endBalance - account.startBalance}}">
+ {{ (account.endBalance - account.startBalance)|formatAmount }}
+ </td>
+
+ </tr>
+
+ {% endfor %}
+ </tbody>
+</table>
\ No newline at end of file
diff --git a/resources/twig/list/journals.twig b/resources/twig/list/journals.twig
new file mode 100644
index 0000000000..34ff958003
--- /dev/null
+++ b/resources/twig/list/journals.twig
@@ -0,0 +1,113 @@
+{{ journals.render }}
+
+<table class="table table-striped table-bordered sortable-table">
+ <tr class="ignore">
+ <th colspan="2">&nbsp;</th>
+ <th>Description</th>
+ <th>Amount</th>
+ <th>Date</th>
+ <th>From</th>
+ <th>To</th>
+ <!-- Hide budgets? -->
+ {% if not hideBudgets %}
+ <th><i class="fa fa-tasks fa-fw" title="Budget"></i></th>
+ {% endif %}
+
+ <!-- Hide categories? -->
+ {% if not hideCategories %}
+ <th><i class="fa fa-bar-chart fa-fw" title="Category"></i></th>
+ {% endif %}
+
+ <!-- Hide bills? -->
+ {% if not hideBills %}
+ <th><i class="fa fa-fw fa-rotate-right" title="Bill"></i></th>
+ {% endif %}
+ </tr>
+ {% for journal in journals %}
+ {% if invalidJournal(journal) %}
+ <tr class="ignore">
+ <td>
+ <div class="btn-group btn-group-xs">
+ <a href="{{ route("transactions.delete",journal.id) }}" class="btn btn-xs btn-danger"><i class="fa fa-fw fa-trash-o"></i></a>
+ </div>
+ </td>
+ <td>&nbsp;</td>
+ <td>{{ journal.description }}</td>
+ <td colspan="7"><em>Invalid journal: Found {{journal.transactions.count() }} transaction(s)</em></td>
+ </tr>
+ {% else %}
+ <tr class="drag" data-date="{{journal.date.format('Y-m-d')}}" data-id="{{journal.id}}">
+ <td>
+ <div class="btn-group btn-group-xs">
+ {% if sorting %}
+ <a href="#" class="handle btn btn-default btn-xs"><i class="fa fa-fw fa-arrows-v"></i></a>
+ {% endif %}
+ <a href="{{ route('transactions.edit',journal.id)}}" class="btn btn-xs btn-default"><i class="fa fa-fw fa-pencil"></i></a>
+ <a href="{{ route('transactions.delete',journal.id)}}" class="btn btn-xs btn-danger"><i class="fa fa-fw fa-trash-o"></i></a>
+ </div>
+ </td>
+
+ <td>
+ {{ journal|typeIcon }}
+ </td>
+ <td>
+ <a href="{{route('transactions.show',journal.id)}}" title="{{journal.description}}">{{journal.description}}</a>
+ </td>
+ <td>
+ {% if not hideTags %}
+ {{ relevantTags(journal) }}
+ {% else %}
+ {{ journal|formatJournal }}
+ {% endif %}
+ </td>
+ <td>
+ {{journal.date.format('j F Y')}}
+ </td>
+ <td>
+ {% if journal.transactions[0].account.accountType.type == 'Cash account' %}
+ <span class="text-success">(cash)</span>
+ {% else %}
+ <a href="{{route('accounts.show',journal.transactions[0].account_id)}}">{{journal.transactions[0].account.name}}</a>
+ {% endif %}
+ </td>
+ <td>
+ {% if journal.transactions[1].account.accountType.type == 'Cash account' %}
+ <span class="text-success">(cash)</span>
+ {% else %}
+ <a href="{{route('accounts.show',journal.transactions[1].account_id)}}">{{journal.transactions[1].account.name}}</a>
+ {% endif %}
+ </td>
+
+ <!-- Do NOT hide the budget? -->
+ {% if not hideBudgets %}
+ <td>
+ {% if journal.budgets[0] %}
+ <a href="{{route('budgets.show',journal.budgets[0].id)}}">{{journal.budgets[0].name}}</a>
+ {% endif %}
+ </td>
+ {% endif %}
+
+ <!-- Do NOT hide the category? -->
+ {% if not hideCategories %}
+ <td>
+ {% if journal.categories[0] %}
+ <a href="{{route('categories.show',journal.categories[0].id)}}">{{journal.categories[0].name}}</a>
+ {% endif %}
+ </td>
+ {% endif %}
+
+ <!-- Do NOT hide the bill? -->
+ {% if not hideBills %}
+ <td>
+ {% if journal.bill %}
+ <a href="{{ route('bills.show',journal.bill_id) }}">{{journal.bill.name}}</a>
+ {% endif %}
+ </td>
+ {% endif %}
+ </tr>
+ {% endif %}
+
+ {% endfor %}
+</table>
+
+{{ journals.render }}
diff --git a/resources/twig/partials/menu.twig b/resources/twig/partials/menu.twig
index 2c6dfe5056..91eec49241 100644
--- a/resources/twig/partials/menu.twig
+++ b/resources/twig/partials/menu.twig
@@ -90,86 +90,86 @@
<!-- /input-group -->
</li>
<li>
- <a class="{{ 'index'|activeRoute }}" href="{{ route('index') }}"><i class="fa fa-dashboard fa-fw"></i> Dashboard</a>
+ <a class="{{ activeRoute('index') }}" href="{{ route('index') }}"><i class="fa fa-dashboard fa-fw"></i> Dashboard</a>
</li>
- <li class="{{ 'accounts.index'|activeRoute }}">
+ <li class="{{ activeRoute('accounts.index') }}">
<a href="#"><i class="fa fa-credit-card fa-fw"></i> Accounts <span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li>
- <a class="{{ 'accounts.index'|activeRoute }}" href="{{ route('accounts.index','asset') }}"><i class="fa fa-money fa-fw"></i> Asset
+ <a class="{{ activeRoute('accounts.index', 'asset') }}" href="{{ route('accounts.index','asset') }}"><i class="fa fa-money fa-fw"></i> Asset
accounts</a>
</li>
<li>
- <a class="{{ 'accounts.index'|activeRoute }}" href="{{ route('accounts.index','expense') }}"><i
+ <a class="{{ activeRoute('accounts.index', 'expense') }}" href="{{ route('accounts.index','expense') }}"><i
class="fa fa-shopping-cart fa-fw"></i> Expense accounts</a>
</li>
<li>
- <a class="{{ 'accounts.index'|activeRoute }}" href="{{ route('accounts.index','revenue') }}"><i class="fa fa-download fa-fw"></i>
+ <a class="{{ activeRoute('accounts.index', 'revenue') }}" href="{{ route('accounts.index','revenue') }}"><i class="fa fa-download fa-fw"></i>
Revenue accounts</a>
</li>
</ul>
<!-- /.nav-second-level -->
</li>
<li>
- <a class="{{ 'budgets'|activeRoute }}" href="{{ route('budgets.index') }}"><i class="fa fa-tasks fa-fw"></i> Budgets</a>
+ <a class="{{ activeRoute('budgets') }}" href="{{ route('budgets.index') }}"><i class="fa fa-tasks fa-fw"></i> Budgets</a>
</li>
<li>
- <a class="{{ 'categories'|activeRoute }}" href="{{ route('categories.index') }}"><i class="fa fa-bar-chart fa-fw"></i> Categories</a>
+ <a class="{{ activeRoute('categories') }}" href="{{ route('categories.index') }}"><i class="fa fa-bar-chart fa-fw"></i> Categories</a>
</li>
<li>
- <a class="{{ 'tags'|activeRoute }}" href="{{ route('tags.index') }}"><i class="fa fa-tags fa-fw"></i> Tags</a>
+ <a class="{{ activeRoute('tags') }}" href="{{ route('tags.index') }}"><i class="fa fa-tags fa-fw"></i> Tags</a>
</li>
<li>
- <a class="{{ 'reports'|activeRoute }}" href="{{ route('reports.index') }}"><i class="fa fa-line-chart fa-fw"></i> Reports</a>
+ <a class="{{ activeRoute('reports') }}" href="{{ route('reports.index') }}"><i class="fa fa-line-chart fa-fw"></i> Reports</a>
</li>
- <li class="{{ 'transactions'|activeRoute }}">
+ <li class="{{ activeRoute('transactions') }}">
<a href="#"><i class="fa fa-repeat fa-fw"></i> Transactions<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li>
- <a class="{{ 'transactions'|activeRoute }}" href="{{ route('transactions.index','withdrawal') }}"><i
+ <a class="{{ activeRoute('transactions','withdrawal') }}" href="{{ route('transactions.index','withdrawal') }}"><i
class="fa fa-long-arrow-left fa-fw"></i> Expenses</a>
</li>
<li>
- <a class="{{ 'transactions'|activeRoute }}" href="{{ route('transactions.index','deposit') }}"><i
+ <a class="{{ activeRoute('transactions','deposit') }}" href="{{ route('transactions.index','deposit') }}"><i
class="fa fa-long-arrow-right fa-fw"></i> Revenue / income</a>
</li>
<li>
- <a class="{{ 'transactions'|activeRoute }}" href="{{ route('transactions.index','transfers') }}"><i class="fa fa-fw fa-exchange"
+ <a class="{{ activeRoute('transactions','transfers') }}" href="{{ route('transactions.index','transfers') }}"><i class="fa fa-fw fa-exchange"
title="Transfer"></i> Transfers</a>
</li>
</ul>
</li>
- <li class="{{ 'piggy-banks'|activeRoute }}">
+ <li class="{{ activeRoute('piggy-banks') }}">
<a href="#"><i class="fa fa-euro fa-fw"></i> Money management<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li>
- <a class="{{ 'piggy-banks'|activeRoute }}" href="{{ route('piggy-banks.index') }}"><i class="fa fa-sort-amount-asc fa-fw"></i> Piggy
+ <a class="{{ activeRoute('piggy-banks') }}" href="{{ route('piggy-banks.index') }}"><i class="fa fa-sort-amount-asc fa-fw"></i> Piggy
banks</a>
</li>
<li>
- <a class="{{ 'bills'|activeRoute }}" href="{{ route('bills.index') }}"><i class="fa fa-calendar-o fa-fw"></i> Bills</a>
+ <a class="{{ activeRoute('bills') }}" href="{{ route('bills.index') }}"><i class="fa fa-calendar-o fa-fw"></i> Bills</a>
</li>
</ul>
<!-- /.nav-second-level -->
</li>
- <li class="{{ 'transactions.create'|activeRoute }}">
+ <li class="{{ activeRoute('transactions.create') }}">
<a href="#"><i class="fa fa-plus fa-fw"></i> Create new<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li>
- <a class="{{ 'transactions.create'|activeRoute }}" href="{{ route('transactions.create','withdrawal') }}"><i
+ <a class="{{ activeRoute('transactions.create','withdrawal') }}" href="{{ route('transactions.create','withdrawal') }}"><i
class="fa fa-long-arrow-left fa-fw"></i> Withdrawal</a>
</li>
<li>
- <a class="{{ 'transactions.create'|activeRoute }}" href="{{ route('transactions.create','deposit') }}"><i
+ <a class="{{ activeRoute('transactions.create','deposit') }}" href="{{ route('transactions.create','deposit') }}"><i
class="fa fa-long-arrow-right fa-fw"></i> Deposit</a>
</li>
<li>
- <a class="{{ 'transactions.create'|activeRoute }}" href="{{ route('transactions.create','transfer') }}"><i class="fa fa-fw fa-exchange"
+ <a class="{{ activeRoute('transactions.create','transfer') }}" href="{{ route('transactions.create','transfer') }}"><i class="fa fa-fw fa-exchange"
title="Transfer"></i> Transfer</a>
</li>
<li>
- <a class="{{ 'transactions.create'|activeRoute }}" href="{{ route('bills.create') }}"><i class="fa fa-calendar-o fa-fw"></i> Bill</a>
+ <a class="{{ activeRoute('bills.create') }}" href="{{ route('bills.create') }}"><i class="fa fa-calendar-o fa-fw"></i> Bill</a>
</li>
</ul>
<!-- /.nav-second-level -->