Skip to content

Firefly III: a personal finances manager

Last templates. Should cover everything. [skip ci]

James Coleefe6f59f793f
diff --git a/app/Providers/ConfigServiceProvider.php b/app/Providers/ConfigServiceProvider.php
index 1f55469074..bd01842727 100644
--- a/app/Providers/ConfigServiceProvider.php
+++ b/app/Providers/ConfigServiceProvider.php
@@ -167,12 +167,13 @@ class ConfigServiceProvider extends ServiceProvider
'Config',
'ExpandedForm' => [
'is_safe' => [
- 'date', 'text', 'select', 'balance', 'optionsList', 'checkbox', 'amount', 'tags', 'integer'
+ 'date', 'text', 'select', 'balance', 'optionsList', 'checkbox', 'amount', 'tags', 'integer', 'textarea', 'location',
+ 'multiRadio'
]
],
'Form' => [
'is_safe' => [
- 'input', 'select', 'checkbox', 'model', 'open'
+ 'input', 'select', 'checkbox', 'model', 'open','radio','textarea'
]
],
],
diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php
index ff7851dd66..f5faf71981 100644
--- a/app/Support/Twig/General.php
+++ b/app/Support/Twig/General.php
@@ -5,6 +5,7 @@ namespace FireflyIII\Support\Twig;
use App;
use Config;
use FireflyIII\Models\Account;
+use FireflyIII\Models\Transaction;
use Route;
use Twig_Extension;
use Twig_SimpleFilter;
@@ -31,6 +32,13 @@ class General extends Twig_Extension
return App::make('amount')->format($string);
}, ['is_safe' => ['html']]
);
+
+ $filters[] = new Twig_SimpleFilter(
+ 'formatTransaction', function (Transaction $transaction) {
+ return App::make('amount')->formatTransaction($transaction);
+ }, ['is_safe' => ['html']]
+ );
+
$filters[] = new Twig_SimpleFilter(
'formatAmountPlain', function ($string) {
return App::make('amount')->format($string, false);
diff --git a/phpunit.xml b/phpunit.xml
index 677b0226c7..b1eba9eb5a 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -20,10 +20,11 @@
</whitelist>
</filter>
- <!-- code coverage -->
+ <!-- code coverage
<logging>
<log type="coverage-clover" target="./storage/coverage/clover.xml" charset="UTF-8" />
</logging>
+ -->
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
diff --git a/resources/twig/form/location.twig b/resources/twig/form/location.twig
new file mode 100644
index 0000000000..efb95bb6c3
--- /dev/null
+++ b/resources/twig/form/location.twig
@@ -0,0 +1,14 @@
+<div class="{{ classes }}">
+ <label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label>
+ <div class="col-sm-8">
+ <div id="map-canvas" style="width:100%;height:300px;"></div>
+ <p class="help-block">Right-click to set the tag's location.
+ <a href="#" id="clearLocation">Clear location</a>
+ </p>
+ <input type="hidden" name="latitude" value="" />
+ <input type="hidden" name="longitude" value="" />
+ <input type="hidden" name="zoomLevel" value="6" />
+ <input type="hidden" name="setTag" value="" />
+ {% include 'form/feedback.twig' %}
+ </div>
+</div>
diff --git a/resources/twig/form/multiRadio.twig b/resources/twig/form/multiRadio.twig
new file mode 100644
index 0000000000..b79ff1559c
--- /dev/null
+++ b/resources/twig/form/multiRadio.twig
@@ -0,0 +1,16 @@
+<div class="{{ classes }}">
+ <label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label>
+ <div class="col-sm-8">
+ {% for value,description in list %}
+ <div class="radio">
+ <label>
+ {{ Form.radio(name, value, (selected == value), options) }}
+ {{ description }}
+ </label>
+ </div>
+ {% endfor %}
+ {% include 'form/help.twig' %}
+ {% include 'form/feedback.twig' %}
+
+ </div>
+</div>
diff --git a/resources/twig/form/textarea.twig b/resources/twig/form/textarea.twig
new file mode 100644
index 0000000000..6d1d950a04
--- /dev/null
+++ b/resources/twig/form/textarea.twig
@@ -0,0 +1,7 @@
+<div class="{{ classes }}">
+ <label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label>
+ <div class="col-sm-8">
+ {{ Form.textarea(name, value, options) }}
+ {% include 'form/feedback.twig' %}
+ </div>
+</div>
diff --git a/resources/twig/tags/create.twig b/resources/twig/tags/create.twig
new file mode 100644
index 0000000000..ab957ce3bf
--- /dev/null
+++ b/resources/twig/tags/create.twig
@@ -0,0 +1,85 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
+ {{ Form.open({'class' : 'form-horizontal','id' : 'store','route' : 'tags.store'}) }}
+
+<div class="row">
+ <div class="col-lg-5 col-md-5 col-sm-12">
+ <div class="panel panel-primary">
+ <div class="panel-heading">
+ <i class="fa fa-tag"></i> Mandatory fields
+ </div>
+ <div class="panel-body">
+ {{ ExpandedForm.text('tag') }}
+ {{ ExpandedForm.multiRadio('tagMode',tagOptions) }}
+ </div>
+ </div>
+ </div>
+
+ <div class="col-lg-7 col-md-7 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">
+ {{ ExpandedForm.date('date') }}
+ {{ ExpandedForm.textarea('description') }}
+ {{ ExpandedForm.location('tagPosition') }}
+ </div>
+ </div>
+
+ <!-- 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','tag') }}
+ </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 tag
+ </button>
+ </p>
+ </div>
+</div>
+
+</form>
+{% endblock %}
+{% block scripts %}
+ <script type="text/javascript">
+ {% if Input.old('latitude') %}
+ var latitude = "{{Input.old('latitude')}}";
+ {% else %}
+ var latitude = "52.3167";
+ {% endif %}
+
+ {% if Input.old('latitude') and Input.old('longitude') and Input.old('zoomLevel') %}
+ var doPlaceMarker = true;
+ {% else %}
+ var doPlaceMarker = false;
+ {% endif %}
+
+ {% if Input.old('longitude') %}
+ var longitude = "{{Input.old('longitude')}}";
+ {% else %}
+ var longitude = "5.5500";
+ {% endif %}
+
+ {% if Input.old('zoomLevel') %}
+ var zoomLevel = {{Input.old('zoomLevel')}};
+ {% else %}
+ var zoomLevel = 6;
+ {% endif %}
+
+ </script>
+ <script src="https://maps.googleapis.com/maps/api/js?v=3"></script>
+ <script src="js/tags.js"></script>
+{% endblock %}
\ No newline at end of file
diff --git a/resources/twig/tags/delete.twig b/resources/twig/tags/delete.twig
new file mode 100644
index 0000000000..82ea36f45d
--- /dev/null
+++ b/resources/twig/tags/delete.twig
@@ -0,0 +1,33 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, tag) }}
+ {{ Form.open({'class' : 'form-horizontal','id' : 'destroy','url' : route('tags.destroy',tag.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 tag "{{ tag.tag }}"
+ </div>
+ <div class="panel-body">
+ <p>
+ Are you sure that you want to delete tag "{{ tag.tag }}"?
+ </p>
+
+ {% if tag.transactionjournals|length > 0 %}
+ <p class="text-info">
+ Tag "{{ tag.tag }}" still has {{ tag.transactionjournals|length }} transaction(s) connected
+ to it. These will <strong>not</strong> be removed but will lose their connection to this tag.
+ </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>
+{% endblock %}
diff --git a/resources/twig/tags/edit.twig b/resources/twig/tags/edit.twig
new file mode 100644
index 0000000000..85f5e3503f
--- /dev/null
+++ b/resources/twig/tags/edit.twig
@@ -0,0 +1,87 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, tag) }}
+ {{ Form.model(tag, {'class' : 'form-horizontal','id' : 'update','url' : route('tags.update',tag.id)}) }}
+
+ <input type="hidden" name="id" value="{{ tag.id }}" />
+
+<div class="row">
+ <div class="col-lg-5 col-md-5 col-sm-12">
+ <div class="panel panel-primary">
+ <div class="panel-heading">
+ <i class="fa fa-tag"></i> Mandatory fields
+ </div>
+ <div class="panel-body">
+ {{ ExpandedForm.text('tag') }}
+ {{ ExpandedForm.multiRadio('tagMode',tagOptions) }}
+ </div>
+ </div>
+ </div>
+
+ <div class="col-lg-7 col-md-7 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">
+ {{ ExpandedForm.date('date') }}
+ {{ ExpandedForm.textarea('description') }}
+ {{ ExpandedForm.location('tagPosition') }}
+ </div>
+ </div>
+
+ <!-- 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','tag') }}
+ </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> Update tag
+ </button>
+ </p>
+ </div>
+</div>
+
+</form>
+{% endblock %}
+{% block scripts %}
+ <script type="text/javascript">
+ {% if Input.old('latitude') %}
+ var latitude = "{{Input.old('latitude')}}";
+ {% else %}
+ var latitude = "52.3167";
+ {% endif %}
+
+ {% if Input.old('latitude') and Input.old('longitude') and Input.old('zoomLevel') %}
+ var doPlaceMarker = true;
+ {% else %}
+ var doPlaceMarker = false;
+ {% endif %}
+
+ {% if Input.old('longitude') %}
+ var longitude = "{{Input.old('longitude')}}";
+ {% else %}
+ var longitude = "5.5500";
+ {% endif %}
+
+ {% if Input.old('zoomLevel') %}
+ var zoomLevel = {{Input.old('zoomLevel')}};
+ {% else %}
+ var zoomLevel = 6;
+ {% endif %}
+
+ </script>
+ <script src="https://maps.googleapis.com/maps/api/js?v=3"></script>
+ <script src="js/tags.js"></script>
+{% endblock %}
\ No newline at end of file
diff --git a/resources/twig/tags/index.twig b/resources/twig/tags/index.twig
new file mode 100644
index 0000000000..9b520969a5
--- /dev/null
+++ b/resources/twig/tags/index.twig
@@ -0,0 +1,75 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
+<div class="row">
+ <div class="col-lg-12">
+ <div class="panel panel-default">
+ <div class="panel-heading"><i class="fa fa-fw fa-tags"></i> Tags</div>
+ <div class="panel-body">
+ <div id="tagHelp" class="collapse
+ {% if not helpHidden %}
+ in
+ {% endif %}
+ ">
+ <p>
+ Usually tags are singular words, designed to quickly band items together
+ using things like <span class="label label-info">expensive</span>,
+ <span class="label label-info">bill</span> or
+ <span class="label label-info">for-party</span>. In Firefly III, tags can have more properties
+ such as a date, description and location. This allows you to join transactions together in a more meaningful
+ way. For example, you could make a tag called <span class="label label-success">Christmas dinner with friends</span>
+ and add information about the restaurant. Such tags are "singular", you would only use them for a single occasion,
+ perhaps with multiple transactions.
+ </p>
+ <p>
+ Tags group transactions together, which makes it possible to store reimbursements
+ (in case you front money for others) and other "balancing acts" where expenses
+ are summed up (the payments on your new TV) or where expenses and deposits
+ are cancelling each other out (buying something with saved money). It's all up to you.
+ Using tags the old-fashioned way is of course always possible.
+ </p>
+ <p>
+ Create a tag to get started or enter tags when creating new transactions.
+ </p>
+ </div>
+ <p>
+ <a data-toggle="collapse" id="tagHelpButton" href="#tagHelp" aria-expanded="false" aria-controls="tagHelp">
+ {% if not helpHidden %}
+ Hide help
+ {% else %}
+ Show help
+ {% endif %}
+ </a>
+ </p>
+ <p>
+ <a href="{{route('tags.create')}}" title="New tag" class="btn btn-info"><i class="fa fa-fw fa-plus"></i> Create new tag</a>
+ </p>
+ <p>
+ {% if tags|length == 0 %}
+ <em>No tags</em>
+ {% else %}
+ {% for tag in tags %}
+
+ <h4 style="display: inline;"><a class="label label-success" href="{{route('tags.show',tag.id)}}">
+ {% if tag.tagMode == 'nothing' %}
+ <i class="fa fa-fw fa-tag"></i>
+ {% endif %}
+ {% if tag.tagMode == 'balancingAct' %}
+ <i class="fa fa-fw fa-refresh"></i>
+ {% endif %}
+ {% if tag.tagMode == 'advancePayment' %}
+ <i class="fa fa-fw fa-sort-numeric-desc"></i>
+ {% endif %}
+ {{tag.tag}}</a>
+ </h4>
+ {% endfor %}
+ {% endif %}
+ </p>
+ </div>
+ </div>
+ </div>
+</div>
+{% endblock %}
+{% block scripts %}
+<script type="text/javascript" src="js/tags.js"></script>
+{% endblock %}
\ No newline at end of file
diff --git a/resources/twig/tags/show.twig b/resources/twig/tags/show.twig
new file mode 100644
index 0000000000..ae61d5b587
--- /dev/null
+++ b/resources/twig/tags/show.twig
@@ -0,0 +1,77 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, tag) }}
+ <!-- show this block only when the tag has some meta-data -->
+ {% if tag.latitude and tag.longitude and tag.zoomLevel %}
+ <div class="row">
+ <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-fw {{subTitleIcon}} fa-fw"></i> {{ tag.tag }}
+ {% if tag.date %}
+ on {{tag.date.format('jS F Y')}}
+ {% endif %}
+ <!-- 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('tags.edit',tag.id)}}"><i class="fa fa-pencil fa-fw"></i> Edit tag</a></li>
+ <li><a href="{{route('tags.delete',tag.id)}}"><i class="fa fa-trash fa-fw"></i> Delete tag</a></li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ <div class="panel-body">
+ {% if tag.description %}
+ <p class="text-info">
+ {{tag.description}}
+ </p>
+ {% endif %}
+ {% if tag.latitude and tag.longitude and tag.zoomLevel %}
+ <p>
+ <img src="https://maps.googleapis.com/maps/api/staticmap?center={{tag.latitude}},{{tag.longitude}}&zoom={{tag.zoomLevel}}&size=600x300">
+ </p>
+ {% endif %}
+ </div>
+ </div>
+ </div>
+ </div>
+ {% endif %}
+ <!-- if no such thing, show another block maybe? -->
+<div class="row">
+ <div class="col-lg-612 col-md-12 col-sm-12 col-xs-12">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-repeat fa-fw"></i> Transactions
+ <!-- here is the edit menu when there is no meta-data -->
+ {% if not (tag.latitude and tag.longitude and tag.zoomLevel) %}
+ <!-- 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('tags.edit',tag.id)}}"><i class="fa fa-pencil fa-fw"></i> Edit tag</a></li>
+ <li><a href="{{route('tags.delete',tag.id)}}"><i class="fa fa-trash fa-fw"></i> Delete tag</a></li>
+ </ul>
+ </div>
+ </div>
+ {% endif %}
+ </div>
+ {% include 'list/journals.twig' with {'journals': tag.transactionjournals} %}
+ </div>
+ </div>
+</div>
+
+{% endblock %}
+{% block scripts %}
+<script type="text/javascript">
+ var tagID = {{tag.id}};
+</script>
+{% endblock %}
diff --git a/resources/twig/transactions/create.twig b/resources/twig/transactions/create.twig
new file mode 100644
index 0000000000..01ef307391
--- /dev/null
+++ b/resources/twig/transactions/create.twig
@@ -0,0 +1,107 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, what) }}
+ {{ Form.open({'class' : 'form-horizontal','id' : 'store','url' : route('transactions.store',what)}) }}
+ <input type="hidden" name="reminder_id" value="{{ Input.get('reminder_id') }}" />
+ <input type="hidden" name="what" value="{{ what }}" />
+ <div class="row">
+ <div class="col-lg-6 col-md-12 col-sm-12">
+ <!-- panel for mandatory fields -->
+ <div class="panel panel-primary">
+ <div class="panel-heading">
+ <i class="fa fa-exclamation-circle"></i> Mandatory fields
+ </div>
+ <div class="panel-body">
+ <!-- DESCRIPTION ALWAYS AVAILABLE -->
+ {{ ExpandedForm.text('description') }}
+ {% if what == 'deposit' or what == 'withdrawal' %}
+ {{ ExpandedForm.select('account_id',accounts) }}
+ {% endif %}
+
+
+ <!-- SHOW EXPENSE ACCOUNT ONLY FOR WITHDRAWALS -->
+ {% if what == 'withdrawal' %}
+ {{ ExpandedForm.text('expense_account') }}
+ {% endif %}
+
+ <!-- SHOW REVENUE ACCOUNT ONLY FOR DEPOSITS -->
+ {% if what == 'deposit' %}
+ {{ ExpandedForm.text('revenue_account') }}
+ {% endif %}
+
+
+ <!-- ONLY SHOW FROM/TO ACCOUNT WHEN CREATING TRANSFER -->
+ {% if what == 'transfer' %}
+ {{ ExpandedForm.select('account_from_id',accounts) }}
+ {{ ExpandedForm.select('account_to_id',accounts) }}
+ {% endif %}
+
+
+ <!-- ALWAYS SHOW AMOUNT -->
+ {{ ExpandedForm.amount('amount') }}
+
+ <!-- ALWAYS SHOW DATE -->
+ {{ ExpandedForm.date('date', phpdate('Y-m-d')) }}
+ </div>
+ </div>
+ </div>
+ <div class="col-lg-6 col-md-12 col-sm-12">
+ <!-- panel for optional fields -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-smile-o"></i> Optional fields
+ </div>
+ <div class="panel-body">
+ <!-- BUDGET ONLY WHEN CREATING A WITHDRAWAL -->
+ {% if what == 'withdrawal' %}
+ {{ ExpandedForm.select('budget_id',budgets,0) }}
+ {% endif %}
+ <!-- CATEGORY ALWAYS -->
+ {{ ExpandedForm.text('category') }}
+
+ <!-- TAGS -->
+ {{ ExpandedForm.text('tags') }}
+
+
+ <!-- RELATE THIS TRANSFER TO A PIGGY BANK -->
+ {% if what == 'withdrawal' and piggies|length > 0 %}
+ {{ ExpandedForm.select('piggy_bank_id',piggies) }}
+ {% endif %}
+ </div>
+ </div>
+
+ <!-- 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','transaction') }}
+ </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 }}
+ </button>
+ </p>
+ </div>
+ </div>
+</form>
+
+{% endblock %}
+{% block scripts %}
+ <script type="text/javascript">
+ var what = "{{ what }}";
+ </script>
+ <script type="text/javascript" src="js/bootstrap3-typeahead.min.js"></script>
+ <script type="text/javascript" src="js/bootstrap-tagsinput.min.js"></script>
+ <script type="text/javascript" src="js/transactions.js"></script>
+{% endblock %}
+
+{% block styles %}
+ <link href="css/bootstrap-tagsinput.css" type="text/css" rel="stylesheet" media="all">
+{% endblock %}
diff --git a/resources/twig/transactions/delete.twig b/resources/twig/transactions/delete.twig
new file mode 100644
index 0000000000..b10a9a83a0
--- /dev/null
+++ b/resources/twig/transactions/delete.twig
@@ -0,0 +1,43 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, journal) }}
+ {{ Form.open({'class' : 'form-horizontal','id' : 'destroy','url' : route('transactions.destroy',journal.id)}) }}
+
+<div class="row">
+ <div class="col-lg-6 col-md-6 col-sm-12">
+ <!-- panel for mandatory fields -->
+ <div class="panel panel-danger">
+ <div class="panel-heading">
+ <i class="fa fa-exclamation-circle"></i> Destroy "{{ journal.description }}"
+ </div>
+ <div class="panel-body">
+ <p>
+ Deleting stuff from Firefly is <em>permanent</em>. This action will remove the transaction and all
+ associated data.
+ </p>
+ <p class="text-success">
+ This action will not destroy categories, piggy banks, accounts, etc.
+ </p>
+ <p class="text-danger">
+ Are you sure?
+ </p>
+ <div class="btn-group">
+ <input type="submit" name="submit" value="Delete transaction" class="btn btn-danger" />
+ {% if journal.transactiontype.type == 'Withdrawal' %}
+ <a href="{{route('transactions.index','withdrawal')}}" class="btn-default btn">Cancel</a>
+ {% endif %}
+ {% if journal.transactiontype.type == 'Deposit' %}
+ <a href="{{route('transactions.index','deposit')}}" class="btn-default btn">Cancel</a>
+ {% endif %}
+ {% if journal.transactiontype.type == 'Transfer' %}
+ <a href="{{route('transactions.index','transfers')}}" class="btn-default btn">Cancel</a>
+ {% endif %}
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+
+</form>
+
+{% endblock %}
diff --git a/resources/twig/transactions/edit.twig b/resources/twig/transactions/edit.twig
new file mode 100644
index 0000000000..5ac5f371bd
--- /dev/null
+++ b/resources/twig/transactions/edit.twig
@@ -0,0 +1,111 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, journal) }}
+ {{ Form.open({'class' : 'form-horizontal','id' : 'update','url' : route('transactions.update',journal.id)}) }}
+
+<input type="hidden" name="id" value="{{journal.id}}" />
+<input type="hidden" name="what" value="{{what}}" />
+
+<div class="row">
+ <div class="col-lg-6 col-md-12 col-sm-12">
+ <!-- panel for mandatory fields -->
+ <div class="panel panel-primary">
+ <div class="panel-heading">
+ <i class="fa fa-exclamation-circle"></i> Mandatory fields
+ </div>
+ <div class="panel-body">
+ <!-- ALWAYS AVAILABLE -->
+ {{ ExpandedForm.text('description',journal.description) }}
+
+ <!-- SHOW ACCOUNT (FROM) ONLY FOR WITHDRAWALS AND DEPOSITS -->
+ {% if what == 'deposit' or what == 'withdrawal' %}
+ {{ ExpandedForm.select('account_id',accounts,data['account_id']) }}
+ {% endif %}
+
+ <!-- SHOW EXPENSE ACCOUNT ONLY FOR WITHDRAWALS -->
+ {% if what == 'withdrawal' %}
+ {{ ExpandedForm.text('expense_account',data['expense_account']) }}
+ {% endif %}
+
+ <!-- SHOW REVENUE ACCOUNT ONLY FOR DEPOSITS -->
+ {% if what == 'deposit' %}
+ {{ ExpandedForm.text('revenue_account',data['revenue_account']) }}
+ {% endif %}
+
+ <!-- ONLY SHOW FROM/TO ACCOUNT WHEN CREATING TRANSFER -->
+ {% if what == 'transfer' %}
+ {{ ExpandedForm.select('account_from_id',accounts,data['account_from_id']) }}
+ {{ ExpandedForm.select('account_to_id',accounts,data['account_to_id']) }}
+ {% endif %}
+
+ <!-- ALWAYS SHOW AMOUNT -->
+ {{ ExpandedForm.amount('amount',data.amount,{'currency' : journal.transactionCurrency}) }}
+
+ <!-- ALWAYS SHOW DATE -->
+ {{ ExpandedForm.date('date',data['date']) }}
+ </div>
+ </div> <!-- close panel -->
+
+ </div>
+ <div class="col-lg-6 col-md-12 col-sm-12">
+ <!-- panel for optional fields -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-smile-o"></i> Optional fields
+ </div>
+ <div class="panel-body">
+ <!-- BUDGET ONLY WHEN CREATING A WITHDRAWAL -->
+ {% if what == 'withdrawal' %}
+ {{ ExpandedForm.select('budget_id',budgets,data['budget_id']) }}
+ {% endif %}
+
+ <!-- CATEGORY ALWAYS -->
+ {{ ExpandedForm.text('category',data['category']) }}
+
+ <!-- TAGS -->
+ {{ ExpandedForm.text('tags') }}
+
+ <!-- RELATE THIS TRANSFER TO A PIGGY BANK -->
+ {% if what == 'withdrawal' and piggies|length > 0 %}
+ {{ ExpandedForm.select('piggy_bank_id',piggies,data['piggy_bank_id']) }}
+ {% endif %}
+
+ </div>
+ </div><!-- end of panel for options-->
+
+ <!-- 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','transaction') }}
+ </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-pencil"></i> Update transaction
+ </button>
+ </p>
+ </div>
+</div>
+</form>
+
+
+{% endblock %}
+{% block scripts %}
+<script type="text/javascript">
+ var what = "{{what}}";
+</script>
+<script type="text/javascript" src="js/bootstrap3-typeahead.min.js"></script>
+<script type="text/javascript" src="js/bootstrap-tagsinput.min.js"></script>
+<script type="text/javascript" src="js/transactions.js"></script>
+{% endblock %}
+{% block styles %}
+ <link href="css/bootstrap-tagsinput.css" type="text/css" rel="stylesheet" media="all">
+{% endblock %}
diff --git a/resources/twig/transactions/index.twig b/resources/twig/transactions/index.twig
new file mode 100644
index 0000000000..25b11854a9
--- /dev/null
+++ b/resources/twig/transactions/index.twig
@@ -0,0 +1,19 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, what) }}
+<div class="row">
+ <div class="col-lg-12 col-sm-12 col-md-12">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa {{ subTitleIcon }}"></i> {{ subTitle }}
+ </div>
+ {% include 'list.journals' %}
+ </div>
+ </div>
+</div>
+
+{% endblock %}
+{% block scripts %}
+ <script src="js/jquery-ui.min.js" type="text/javascript"></script>
+ <script src="js/transactions.js" type="text/javascript"></script>
+{% endblock %}
diff --git a/resources/twig/transactions/show.twig b/resources/twig/transactions/show.twig
new file mode 100644
index 0000000000..7c58bed910
--- /dev/null
+++ b/resources/twig/transactions/show.twig
@@ -0,0 +1,133 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, journal) }}
+<div class="row">
+ <div class="col-lg-6 col-md-6 col-sm-12">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-info-circle fa-fw"></i>
+ Metadata
+ </div>
+ <table class="table table-striped table-bordered">
+ <tr>
+ <td>Date</td>
+ <td>{{ journal.date.format('jS F Y') }}</td>
+ </tr>
+ <tr>
+ <td>Type</td>
+ <td>{{ journal.transactiontype.type }}</td>
+ </tr>
+ <tr>
+ <td>Completed</td>
+ <td>
+ {% if journal.completed %}
+ <span class="text-success">Yes</span>
+ {% else %}
+ <span class="text-danger">No</span>
+ {% endif %}
+ </td>
+ </tr>
+ {% for budget in journal.budgets %}
+ <tr>
+ <td>Budget</td>
+ <td><a href="{{route('budgets.show',budget.id)}}">{{ budget.name }}</a></td>
+ </tr>
+ {% endfor %}
+ {% for category in journal.categories %}
+ <tr>
+ <td>Category</td>
+ <td><a href="{{route('categories.show',category.id)}}">{{ category.name }}</a></td>
+ </tr>
+ {% endfor %}
+ {% if journal.tags|length > 0 %}
+ <tr>
+ <td>Tags</td>
+ <td>
+ {% for tag in journal.tags %}
+
+ <h4 style="display: inline;"><a class="label label-success" href="{{route('tags.show',tag)}}">
+ {% if tag.tagMode == 'nothing' %}
+ <i class="fa fa-fw fa-tag"></i>
+ {% endif %}
+ {% if tag.tagMode == 'balancingAct' %}
+ <i class="fa fa-fw fa-refresh"></i>
+ {% endif %}
+ {% if tag.tagMode == 'advancePayment' %}
+ <i class="fa fa-fw fa-sort-numeric-desc"></i>
+ {% endif %}
+ {{tag.tag}}</a>
+ </h4>
+ {% endfor %}
+ </td>
+ </tr>
+ {% endif %}
+ </table>
+ </div>
+ <!-- events, if present -->
+ {% if journal.piggyBankEvents|length > 0 %}
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Piggy banks
+ </div>
+ <div class="panel-body">
+ {% include 'list/piggy-bank-events' with {'events': journal.piggyBankEvents, 'showPiggyBank':true} %}
+ </div>
+ </div>
+ {% endif %}
+ </div>
+ <div class="col-lg-6 col-md-6 col-sm-12">
+
+ {% for t in journal.transactions %}
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ {% if t.account.accounttype.type == 'Asset account' %}
+ <i class="fa fa-money fa-fw"></i>
+ {% endif %}
+ {% if t.account.accounttype.type == 'Default account' %}
+ <i class="fa fa-money fa-fw"></i>
+ {% endif %}
+ {% if t.account.accounttype.type == 'Expense account' %}
+ <i class="fa fa-shopping-cart fa-fw"></i>
+ {% endif %}
+ {% if t.account.accounttype.type == 'Beneficiary account' %}
+ <i class="fa fa-shopping-cart fa-fw"></i>
+ {% endif %}
+
+ {% if t.account.accounttype.type == 'Revenue account' %}
+ <i class="fa fa-download fa-fw"></i>
+ {% endif %}
+ <a href="{{route('accounts.show',t.account.id)}}">{{ t.account.name }}</a><br /><small>{{ t.account.accounttype.description }}</small>
+ </div>
+ <table class="table table-striped table-bordered">
+ <tr>
+ <td>Amount</td>
+ <td>{{ t|formatTransaction }}</td>
+ </tr>
+ <tr>
+ <td>New balance</td>
+ <td>{{ t.before|formatAmount }} &rarr; {{ t.after|formatAmount }}</td>
+ </tr>
+ {% if t.description %}
+ <tr>
+ <td>Description</td>
+ <td>{{ t.description }}</td>
+ </tr>
+ {% endif %}
+ </table>
+ </div>
+ {% endfor %}
+ </div>
+</div>
+
+<div class="row">
+ <div class="col-lg-6 col-md-6 col-sm-12">
+ <div class="btn-group">
+ <a class="btn btn-default" href="{{route('transactions.edit',journal.id)}}"><i class="fa fa-fw fa-pencil"></i> Edit</a> <a href="{{route('transactions.delete',journal.id)}}" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> Delete</a>
+ </div>
+ </div>
+</div>
+
+{% endblock %}
+{% block scripts %}
+<script type="text/javascript" src="js/transactions.js"></script>
+{% endblock %}