mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-21 19:49:54 +00:00
First batch of code for recurring transactions #1469
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
{{ ExpandedForm.textarea('notes',null,{helpText: trans('firefly.field_supports_markdown')}) }}
|
||||
{{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
|
||||
{{ ExpandedForm.integer('skip',0) }}
|
||||
{{ ExpandedForm.checkbox('active',1,true) }}
|
||||
{{ ExpandedForm.checkbox('active',1, true) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@@ -98,6 +98,10 @@
|
||||
<a href="{{ route('rules.index') }}">
|
||||
<i class="fa fa-random fa-fw"></i> {{ 'rules'|_ }}</a>
|
||||
</li>
|
||||
<li class="{{ activeRoutePartial('recurring') }}">
|
||||
<a href="{{ route('recurring.index') }}">
|
||||
<i class="fa fa-paint-brush fa-fw"></i> {{ 'recurrences'|_ }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
150
resources/views/recurring/create.twig
Normal file
150
resources/views/recurring/create.twig
Normal file
@@ -0,0 +1,150 @@
|
||||
{% extends "./layout/default" %}
|
||||
{% block breadcrumbs %}
|
||||
{{ Breadcrumbs.render(Route.getCurrentRoute.getName) }}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
<form action="{{ route('recurring.store') }}" method="post" id="store" class="form-horizontal">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'mandatory_for_recurring'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{{ ExpandedForm.text('name') }}
|
||||
{{ ExpandedForm.date('first_date',null, {helpText: trans('firefly.help_first_date')}) }}
|
||||
{{ ExpandedForm.date('repeat_until',null) }}
|
||||
{{ ExpandedForm.select('repetition_type', [], null, {helpText: trans('firefly.change_date_other_options')}) }}
|
||||
{{ ExpandedForm.number('skip', 0) }}
|
||||
|
||||
{# three buttons to distinguish type of transaction#}
|
||||
<div class="form-group" id="name_holder">
|
||||
<label for="ffInput_type" class="col-sm-4 control-label">
|
||||
{{ trans('form.transaction_type') }}
|
||||
</label>
|
||||
|
||||
<div class="col-sm-8">
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="#" class="btn btn-default switch-button" data-value="withdrawal">{{ 'withdrawal'|_ }}</a>
|
||||
<a href="#" class="btn btn-default switch-button" data-value="deposit">{{ 'deposit'|_ }}</a>
|
||||
<a href="#" class="btn btn-default switch-button" data-value="transfer">{{ 'transfer'|_ }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'mandatory_for_transaction'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<p><em>{{ 'mandatory_fields_for_tranaction'|_ }}</em></p>
|
||||
{{ ExpandedForm.text('transaction_description') }}
|
||||
{# transaction information (mandatory) #}
|
||||
{{ ExpandedForm.currencyList('transaction_currency_id', defaultCurrency.id) }}
|
||||
{{ ExpandedForm.amountNoCurrency('amount', []) }}
|
||||
|
||||
{# source account if withdrawal, or if transfer: #}
|
||||
{{ ExpandedForm.assetAccountList('source_account_id', null, {label: trans('form.asset_source_account')}) }}
|
||||
|
||||
{# source account name for deposits: #}
|
||||
{{ ExpandedForm.text('source_account_name', null, {label: trans('form.revenue_account')}) }}
|
||||
|
||||
{# destination if deposit or transfer: #}
|
||||
{{ ExpandedForm.assetAccountList('destination_account_id', null, {label: trans('form.asset_destination_account')} ) }}
|
||||
|
||||
{# destination account name for withdrawals #}
|
||||
{{ ExpandedForm.text('destination_account_name', null, {label: trans('form.expense_account')}) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'expected_repetitions'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
Here.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'optional_for_recurring'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{{ ExpandedForm.textarea('recurring_description') }}
|
||||
|
||||
{{ ExpandedForm.checkbox('active',1) }}
|
||||
|
||||
{{ ExpandedForm.checkbox('apply_rules',1) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'optional_for_transaction'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{# transaction information (optional) #}
|
||||
{{ ExpandedForm.currencyList('foreign_currency_id', defaultCurrency.id) }}
|
||||
{{ ExpandedForm.amountNoCurrency('foreign_amount', []) }}
|
||||
|
||||
{# BUDGET ONLY WHEN CREATING A WITHDRAWAL #}
|
||||
{% if budgets|length > 1 %}
|
||||
{{ ExpandedForm.select('budget_id', budgets, null) }}
|
||||
{% else %}
|
||||
{{ ExpandedForm.select('budget_id', budgets, null, {helpText: trans('firefly.no_budget_pointer')}) }}
|
||||
{% endif %}
|
||||
|
||||
{# CATEGORY ALWAYS #}
|
||||
{{ ExpandedForm.text('category') }}
|
||||
|
||||
{# TAGS #}
|
||||
{{ ExpandedForm.text('tags') }}
|
||||
|
||||
{# RELATE THIS TRANSFER TO A PIGGY BANK #}
|
||||
{{ ExpandedForm.select('piggy_bank_id', [], '0') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'options'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{{ ExpandedForm.optionsList('create','recurrence') }}
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<button type="submit" class="btn pull-right btn-success">
|
||||
{{ ('store_new_recurrence')|_ }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script type="text/javascript" src="js/lib/modernizr-custom.js?v={{ FF_VERSION }}"></script>
|
||||
<script type="text/javascript" src="js/lib/bootstrap3-typeahead.min.js?v={{ FF_VERSION }}"></script>
|
||||
<script type="text/javascript" src="js/lib/bootstrap-tagsinput.min.js?v={{ FF_VERSION }}"></script>
|
||||
<script type="text/javascript" src="js/lib/jquery-ui.min.js?v={{ FF_VERSION }}"></script>
|
||||
<script type="text/javascript">
|
||||
var transactionType = "{{ preFilled.transaction_type }}";
|
||||
var suggestUri = "{{ route('recurring.suggest') }}";
|
||||
</script>
|
||||
<script type="text/javascript" src="js/ff/recurring/create.js?v={{ FF_VERSION }}"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block styles %}
|
||||
<link href="css/bootstrap-tagsinput.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all">
|
||||
<link href="css/jquery-ui/jquery-ui.structure.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all">
|
||||
<link href="css/jquery-ui/jquery-ui.theme.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all">
|
||||
{% endblock %}
|
120
resources/views/recurring/index.twig
Normal file
120
resources/views/recurring/index.twig
Normal file
@@ -0,0 +1,120 @@
|
||||
{% extends "./layout/default" %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
{{ Breadcrumbs.render(Route.getCurrentRoute.getName) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!-- block with list of recurring transaction -->
|
||||
{% if recurring|length > 0 %}
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">
|
||||
{{ 'recurrences'|_ }}
|
||||
</h3>
|
||||
<div class="box-tools pull-right">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-box-tool dropdown-toggle" data-toggle="dropdown"><i class="fa fa-ellipsis-v"></i></button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="{{ route('recurring.create') }}"><i class="fa fa-plus fa-fw"></i> {{ ('make_new_recurring')|_ }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box-body table-responsive no-padding">
|
||||
<div style="padding:8px;">
|
||||
<a href="{{ route('recurring.create') }}" class="btn btn-success"><i class="fa fa-plus fa-fw"></i> {{ ('make_new_recurring')|_ }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- list of recurring here -->
|
||||
<div style="padding-left:8px;">
|
||||
{{ recurring.render|raw }}
|
||||
</div>
|
||||
<table class="table table-hover sortable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="hidden-sm hidden-xs" data-defaultsort="disabled"> </th>
|
||||
<th data-defaultsign="az">{{ trans('list.title') }}</th>
|
||||
<th data-defaultsign="_19">{{ trans('list.transaction_s') }}</th>
|
||||
<th data-defaultsort="disabled">{{ trans('list.repetitions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for rt in recurring %}
|
||||
<tr>
|
||||
<td class="hidden-sm hidden-xs">
|
||||
<div class="btn-group btn-group-xs edit_tr_buttons">
|
||||
<a class="btn btn-default btn-xs" title="{{ 'edit'|_ }}" href="{{ route('recurring.edit',rt.id) }}"><i
|
||||
class="fa fa-fw fa-pencil"></i></a>
|
||||
<a class="btn btn-danger btn-xs" title="{{ 'delete'|_ }}" href="{{ route('recurring.delete',rt.id) }}"><i
|
||||
class="fa fa-fw fa-trash-o"></i></a>
|
||||
</div>
|
||||
</td>
|
||||
<td data-value="{{ rt.title }}">
|
||||
{{ rt.transaction_type|_ }}:
|
||||
|
||||
<a href="{{ route('recurring.show',rt.id) }}">{{ rt.title }}</a>
|
||||
{% if rt.description|length > 0 %}
|
||||
<small><br>{{ rt.description }}</small>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td data-value="0">
|
||||
<ol>
|
||||
{% for rtt in rt.transactions %}
|
||||
<li>
|
||||
{# normal amount + comma#}
|
||||
{{ formatAmountBySymbol(rtt['amount'],rtt['currency_symbol'],rtt['currency_dp']) }}{% if rtt['foreign_amount'] == null %},{% endif %}
|
||||
|
||||
{# foreign amount + comma #}
|
||||
{% if null != rtt['foreign_amount'] %}
|
||||
({{ formatAmountBySymbol(rtt['foreign_amount'],rtt['foreign_currency_symbol'],rtt['foreign_currency_dp']) }}),
|
||||
{% endif %}
|
||||
<a href="{{ route('accounts.show', rtt['source_account_id']) }}">{{ rtt['source_account_name'] }}</a>
|
||||
→
|
||||
<a href="{{ route('accounts.show', rtt['destination_account_id']) }}">{{ rtt['destination_account_name'] }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
</td>
|
||||
<td>
|
||||
<ul>
|
||||
{% for rep in rt.repetitions %}
|
||||
<li>{{ rep.description }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div style="padding-left:8px;">
|
||||
{{ recurring.render|raw }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<a href="{{ route('recurring.create') }}" class="btn btn-success"><i class="fa fa-plus fa-fw"></i> {{ ('make_new_recurring')|_ }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
|
||||
{% if recurring|length == 0 and page == 1 %}
|
||||
{% include 'partials.empty' with {what: 'default', type: 'recurring',route: route('recurring.create')} %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block styles %}
|
||||
<link rel="stylesheet" href="css/bootstrap-sortable.css?v={{ FF_VERSION }}" type="text/css" media="all"/>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script type="text/javascript" src="js/lib/bootstrap-sortable.js?v={{ FF_VERSION }}"></script>
|
||||
{% endblock %}
|
190
resources/views/recurring/show.twig
Normal file
190
resources/views/recurring/show.twig
Normal file
@@ -0,0 +1,190 @@
|
||||
{% extends "./layout/default" %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
{{ Breadcrumbs.render(Route.getCurrentRoute.getName, recurrence) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<!-- basic info -->
|
||||
<div class="col-lg-8 col-md-12 col-sm-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">
|
||||
{{ array.title }}
|
||||
</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<p><em>{{ array.description }}</em></p>
|
||||
<ul>
|
||||
{% for rep in array.repetitions %}
|
||||
<li>{{ rep.description }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<div class="btn-group">
|
||||
<a href="{{ route('recurring.edit', [array.id]) }}" class="btn btn-sm btn-default"><i class="fa fa-pencil"></i> {{ 'edit'|_ }}</a>
|
||||
<a href="{{ route('recurring.delete', [array.id]) }}" class="btn btn-sm btn-danger">{{ 'delete'|_ }} <i class="fa fa-trash"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- next and previous repetitions -->
|
||||
<div class="col-lg-4 col-md-12 col-sm-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">
|
||||
{{ 'expected_transactions'|_ }}
|
||||
</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
|
||||
<ul>
|
||||
{% for rep in array.repetitions %}
|
||||
<li>{{ rep.description }}
|
||||
<ul>
|
||||
{% for occ in rep.occurrences %}
|
||||
<li>{{ occ.formatLocalized(trans('config.month_and_date_day')) }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<small>
|
||||
<em>{{ 'warning_duplicates_repetitions'|_ }}</em>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<!-- transactions -->
|
||||
<div class="col-lg-8 col-md-12 col-sm-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">
|
||||
{{ 'transaction_data'|_ }}
|
||||
</h3>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<table class="table table-hover sortable">
|
||||
<thead>
|
||||
<th data-defaultsign="az">{{ trans('list.source') }}</th>
|
||||
<th data-defaultsign="az">{{ trans('list.destination') }}</th>
|
||||
<th data-defaultsign="_19">{{ trans('list.amount') }}</th>
|
||||
<th data-defaultsign="az">{{ trans('list.category') }}</th>
|
||||
<th data-defaultsign="az">{{ trans('list.budget') }}</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for transaction in array.transactions %}
|
||||
<tr>
|
||||
<td data-value="{{ transaction.source_account_name }}">
|
||||
<a href="{{ route('accounts.show', [transaction.source_account_id]) }}">{{ transaction.source_account_name }}</a>
|
||||
</td>
|
||||
<td data-value="{{ transaction.destination_account_name }}">
|
||||
<a href="{{ route('accounts.show', [transaction.destination_account_id]) }}">{{ transaction.destination_account_name }}</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ formatAmountBySymbol(transaction.amount,transaction.currency_symbol,transaction.currency_dp) }}
|
||||
{% if null != transaction.foreign_amount %}
|
||||
({{ formatAmountBySymbol(transaction.foreign_amount,transaction.foreign_currency_symbol,transaction.foreign_currency_dp) }})
|
||||
{% endif %}
|
||||
</td>
|
||||
<td data-value="{% for meta in transaction.meta %}{% if meta.name == 'category_name' %}{{ meta.category_id }}{% endif %}{% endfor %}">
|
||||
{% for meta in transaction.meta %}
|
||||
{% if meta.name == 'category_name' %}
|
||||
<a href="{{ route('categories.show', [meta.category_id]) }}">
|
||||
{{ meta.category_name }}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td data-value="{% for meta in transaction.meta %}{% if meta.name == 'budget_id' %}{{ meta.budget_id }}{% endif %}{% endfor %}">
|
||||
{% for meta in transaction.meta %}
|
||||
{% if meta.name == 'budget_id' %}
|
||||
<a href="{{ route('budgets.show', [meta.budget_id]) }}">
|
||||
{{ meta.budget_name }}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- meta data -->
|
||||
{% if array.meta|length > 0 %}
|
||||
<div class="col-lg-4 col-md-12 col-sm-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">
|
||||
{{ 'meta_data'|_ }}
|
||||
</h3>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<table class="table table-hover sortable">
|
||||
<thead>
|
||||
<th style="width:30%;" data-defaultsign="az">{{ trans('list.field') }}</th>
|
||||
<th data-defaultsign="az">{{ trans('list.value') }}</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for meta in array.meta %}
|
||||
<tr>
|
||||
<td>{{ trans('firefly.recurring_meta_field_'~meta.name) }}</td>
|
||||
<td>
|
||||
{% if meta.name == 'tags' %}
|
||||
{% for tag in meta.tags %}
|
||||
<span class="label label-info">{{ tag }}</span>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if meta.name == 'notes' %}
|
||||
{{ meta.value|markdown }}
|
||||
{% endif %}
|
||||
{% if meta.name == 'bill_id' %}
|
||||
<a href="{{ route('bills.show', [meta.bill_id]) }}">{{ meta.bill_name }}</a>
|
||||
{% endif %}
|
||||
{% if meta.name == 'piggy_bank_id' %}
|
||||
<a href="{{ route('piggy-banks.show', [meta.piggy_bank_id]) }}">{{ meta.piggy_bank_name }}</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="row">
|
||||
<!-- meta data -->
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">
|
||||
{{ 'transactions'|_ }}
|
||||
</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
Bla bla
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block styles %}
|
||||
<link rel="stylesheet" href="css/bootstrap-sortable.css?v={{ FF_VERSION }}" type="text/css" media="all"/>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script type="text/javascript" src="js/lib/bootstrap-sortable.js?v={{ FF_VERSION }}"></script>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user