Skip to content

Firefly III: a personal finances manager

Fixed bills [skip ci]

James Cole184ec13f9938
diff --git a/app/Providers/ConfigServiceProvider.php b/app/Providers/ConfigServiceProvider.php
index c7ebe0e489..cc915d0f6f 100644
--- a/app/Providers/ConfigServiceProvider.php
+++ b/app/Providers/ConfigServiceProvider.php
@@ -166,7 +166,7 @@ class ConfigServiceProvider extends ServiceProvider
'Config',
'ExpandedForm' => [
'is_safe' => [
- 'date', 'text', 'select', 'balance', 'optionsList', 'checkbox', 'amount'
+ 'date', 'text', 'select', 'balance', 'optionsList', 'checkbox', 'amount', 'tags', 'integer'
]
],
'Form' => [
diff --git a/resources/twig/bills/create.twig b/resources/twig/bills/create.twig
new file mode 100644
index 0000000000..f7719b3214
--- /dev/null
+++ b/resources/twig/bills/create.twig
@@ -0,0 +1,69 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, piggyBank) }}
+ {{ Form.open({'class' : 'form-horizontal','id' : 'store','url' : route('bills.store')}) }}
+
+<div class="row">
+ <div class="col-lg-6 col-md-12 col-sm-6">
+ <!-- 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">
+ {{ ExpandedForm.text('name') }}
+ {{ ExpandedForm.tags('match') }}
+ {{ ExpandedForm.amount('amount_min') }}
+ {{ ExpandedForm.amount('amount_max') }}
+ {{ ExpandedForm.date('date',phpdate('Y-m-d')) }}
+ {{ ExpandedForm.select('repeat_freq',periods,'monthly') }}
+ </div>
+ </div>
+
+ </div>
+ <div class="col-lg-6 col-md-12 col-sm-6">
+ <!-- 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">
+ {{ ExpandedForm.integer('skip',0) }}
+ {{ ExpandedForm.checkbox('automatch',1,true) }}
+ {{ ExpandedForm.checkbox('active',1,true) }}
+ </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','bill') }}
+ </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 bill
+ </button>
+ </p>
+ </div>
+</div>
+
+</form>
+
+{% endblock %}
+
+{% block styles %}
+ <link href="css/bootstrap-tagsinput.css" type="text/css" rel="stylesheet" media="all">
+{% endblock %}
+{% block scripts %}
+ <script type="text/javascript" src="js/bootstrap-tagsinput.min.js"></script>
+{% endblock %}
diff --git a/resources/twig/bills/delete.twig b/resources/twig/bills/delete.twig
new file mode 100644
index 0000000000..f58fd3db68
--- /dev/null
+++ b/resources/twig/bills/delete.twig
@@ -0,0 +1,32 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, bill) }}
+ {{ Form.open({'class' : 'form-horizontal','id' : 'destroy','url' : route('bills.destroy',bill.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 bill "{{ bill.name }}"
+ </div>
+ <div class="panel-body">
+ <p>
+ Are you sure that you want to delete bill "{{ bill.name }}"?
+ </p>
+
+ {% if bill.transactionjournals|length > 0 %}
+ <p class="text-info">
+ Bill "{{ bill.name }}" still has {{ bill.transactionjournals|length }} transactions connected
+ to it. These will <strong>not</strong> be removed but will lose their connection to this bill.
+ </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 %}
\ No newline at end of file
diff --git a/resources/twig/bills/edit.twig b/resources/twig/bills/edit.twig
new file mode 100644
index 0000000000..5fd7e02a0e
--- /dev/null
+++ b/resources/twig/bills/edit.twig
@@ -0,0 +1,66 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, bill) }}
+ {{ Form.model(bill, {'class' : 'form-horizontal','id' : 'update','url' : route('bills.update', bill.id)}) }}
+
+<input type="hidden" name="id" value="{{bill.id}}" />
+
+<div class="row">
+ <div class="col-lg-6 col-md-12 col-sm-6">
+ <div class="panel panel-primary">
+ <div class="panel-heading">
+ <i class="fa fa-exclamation-circle"></i> Mandatory fields
+ </div>
+ <div class="panel-body">
+ {{ ExpandedForm.text('name') }}
+ {{ ExpandedForm.tags('match') }}
+ {{ ExpandedForm.amount('amount_min') }}
+ {{ ExpandedForm.amount('amount_max') }}
+ {{ ExpandedForm.date('date',bill.date.format('Y-m-d')) }}
+ {{ ExpandedForm.select('repeat_freq',periods) }}
+ </div>
+ </div>
+
+
+</div>
+ <div class="col-lg-6 col-md-12 col-sm-6">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-smile-o"></i> Optional fields
+ </div>
+ <div class="panel-body">
+ {{ ExpandedForm.integer('skip') }}
+ {{ ExpandedForm.checkbox('automatch',1) }}
+ {{ ExpandedForm.checkbox('active',1) }}
+
+ </div>
+ </div>
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-bolt"></i> Options
+ </div>
+ <div class="panel-body">
+ {{ ExpandedForm.optionsList('update','bill') }}
+ </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 bill
+ </button>
+ </p>
+ </div>
+</div>
+</form>
+
+{% endblock %}
+{% block styles %}
+ <link href="css/bootstrap-tagsinput.css" type="text/css" rel="stylesheet" media="all">
+{% endblock %}
+{% block scripts %}
+ <script type="text/javascript" src="js/bootstrap-tagsinput.min.js"></script>
+{% endblock %}
diff --git a/resources/twig/bills/index.twig b/resources/twig/bills/index.twig
new file mode 100644
index 0000000000..ef488037a5
--- /dev/null
+++ b/resources/twig/bills/index.twig
@@ -0,0 +1,27 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, piggyBank) }}
+ <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 {{ mainTitleIcon }}"></i> {{ title }}
+
+ <!-- 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('bills.create')}}"><i class="fa fa-plus fa-fw"></i> New bill</a></li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ {% include 'list/bills.twig' %}
+ </div>
+ </div>
+ </div>
+{% endblock %}
\ No newline at end of file
diff --git a/resources/twig/bills/show.twig b/resources/twig/bills/show.twig
new file mode 100644
index 0000000000..e6297668a7
--- /dev/null
+++ b/resources/twig/bills/show.twig
@@ -0,0 +1,113 @@
+{% extends "./layout/default.twig" %}
+{% block content %}
+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, bill) }}
+<div class="row">
+ <div class="col-lg-6 col-sm-12 col-md-12">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <i class="fa fa-rotate-right"></i> {{ bill.name }}
+
+ {% if bill.active %}
+ <i class="fa fa-check fa-fw" title="Active"></i>
+ {% else %}
+ <i class="fa fa-times fa-fw" title="Inactive"></i>
+ {% endif %}
+
+ {% if bill.automatch %}
+ <i class="fa fa-check fa-fw" title="Automatically matched by Firefly"></i>
+ {% else %}
+ <i class="fa fa-times fa-fw" title="Not automatically matched by Firefly"></i>
+ {% endif %}
+
+ <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('bills.edit',bill.id)}}"><i class="fa fa-fw fa-pencil"></i> edit</a></li>
+ <li><a href="{{route('bills.delete',bill.id)}}"><i class="fa fa-fw fa-trash-o"></i> delete</a></li>
+ </ul>
+ </div>
+ </div>
+
+ </div>
+ <div class="panel-body">
+ <table class="table">
+ <tr>
+ <td colspan="2">
+ Matching on
+ {% for word in bill.match|split(',') %}
+ <span class="label label-info">{{ word }}</span>
+ {% endfor %}
+ between {{ bill.amount_min|formatAmount }} and {{ bill.amount_max|formatAmount }}.
+ Repeats {{ bill.repeat_freq }}.</td>
+
+ </tr>
+ <tr>
+ <td>Next expected match</td>
+ <td>
+ {% if bill.nextExpectedMatch %}
+ {{bill.nextExpectedMatch.format('j F Y')}}
+ {% else %}
+ <em>Unknown</em>
+ {% endif %}
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </div>
+ <div class="col-lg-6 col-sm-12 col-md-12">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ More
+ </div>
+ <div class="panel-body">
+ <p>
+ <a href="{{route('bills.rescan',bill.id)}}" class="btn btn-default">Rescan old transactions</a>
+ </p>
+ </div>
+ </div>
+ </div>
+</div>
+
+<div class="row">
+ <div class="col-lg-12 col-sm-12 col-md-12">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Chart
+ </div>
+ <div class="panel-body">
+ <div id="bill-overview"></div>
+ </div>
+ </div>
+ </div>
+</div>
+
+<div class="row">
+ <div class="col-lg-12 col-sm-12 col-md-12">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ Connected transaction journals
+ </div>
+ <div class="panel-body">
+ {% include 'list/journals' %}
+ </div>
+ </div>
+ </div>
+</div>
+
+{% endblock %}
+
+{% block scripts %}
+<script type="text/javascript">
+ var billID = {{ bill.id }};
+</script>
+<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/bills.js"></script>
+{% endblock %}
\ No newline at end of file
diff --git a/resources/twig/form/integer.twig b/resources/twig/form/integer.twig
new file mode 100644
index 0000000000..527a5b2fea
--- /dev/null
+++ b/resources/twig/form/integer.twig
@@ -0,0 +1,9 @@
+<div class="{{ classes }}">
+ <label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label>
+ <div class="col-sm-8">
+ <div class="input-group">
+ {{ Form.input('number', name, value, options) }}
+ {% include 'form/feedback.twig' %}
+ </div>
+ </div>
+</div>
diff --git a/resources/twig/form/tags.twig b/resources/twig/form/tags.twig
new file mode 100644
index 0000000000..9160512040
--- /dev/null
+++ b/resources/twig/form/tags.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.input('text', name, value, options) }}
+ {% include 'form/feedback.twig' %}
+ </div>
+</div>
diff --git a/resources/twig/list/bills.twig b/resources/twig/list/bills.twig
new file mode 100644
index 0000000000..2432efaf88
--- /dev/null
+++ b/resources/twig/list/bills.twig
@@ -0,0 +1,78 @@
+<table class="table table-bordered table-striped">
+ <tr>
+ <th>&nbsp;</th>
+ <th>Name</th>
+ <th>Matches on</th>
+ <th colspan="2">Matching amount</th>
+ <th>Last seen match</th>
+ <th>Next expected match</th>
+ <th>Is active</th>
+ <th>Will be automatched</th>
+ <th>Repeats every</th>
+ <th>&nbsp;</th>
+ </tr>
+ {% for entry in bills %}
+ <tr>
+ <td>
+ <div class="btn-group btn-group-xs">
+ <a href="{{route('bills.edit',entry.id)}}" class="btn btn-default btn-xs"><i class="fa fa-fw fa-pencil"></i></a>
+ <a href="{{route('bills.delete',entry.id)}}" class="btn btn-danger btn-xs"><i class="fa fa-fw fa-trash-o"></i></a>
+ </div>
+ </td>
+ <td>
+ <a href="{{route('bills.show',entry.id)}}" title="{{ entry.name }}">{{ entry.name }}</a>
+ </td>
+ <td>
+ {% for match in entry.match|split(',') %}
+ <span class="label label-info">{{ match }}</span>
+ {% endfor %}
+ </td>
+ <td>
+ {{ entry.amount_min|formatAmount }}
+ </td>
+ <td>
+ {{ entry.amount_max|formatAmount }}
+ </td>
+ <td>
+ {% if entry.lastFoundMatch %}
+ {{entry.lastFoundMatch.format('j F Y')}}
+ {% else %}
+ <em>Unknown</em>
+ {% endif %}
+ </td>
+ <td>
+ {% if entry.nextExpectedMatch%}
+ {{entry.nextExpectedMatch.format('j F Y')}}
+ {% else %}
+ <em>Unknown</em>
+ {% endif %}
+ </td>
+ <td>
+ {% if entry.active %}
+ <i class="fa fa-fw fa-check"></i>
+ {% else %}
+ <i class="fa fa-fw fa-ban"></i>
+ {% endif %}
+ </td>
+ <td>
+ {% if entry.automatch %}
+ <i class="fa fa-fw fa-check"></i>
+ {% else %}
+ <i class="fa fa-fw fa-ban"></i>
+ {% endif %}
+ </td>
+ <td>
+ {{ entry.repeat_freq }}
+ {% if entry.skip > 0 %}
+ skips over {{entry.skip}}
+ {% endif %}
+ </td>
+ <td>
+ {% if entry.active %}
+ <a href="{{route('bills.add',entry.id)}}" class="btn btn-success btn-xs"><i class="fa fa-fw fa-plus-circle"></i></a>
+ {% endif %}
+ </td>
+ </tr>
+
+ {% endfor %}
+</table>