firefly-iii/resources/views/transactions/show.twig

488 lines
27 KiB
Twig

{% extends "./layout/default" %}
{% block breadcrumbs %}
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, journal) }}
{% endblock %}
{% block content %}
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'transaction_journal_information'|_ }}</h3>
<div class="box-tools pull-right">
<div class="btn-group">
<button id="transaction_menu" 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('transactions.edit',journal.id) }}"><i class="fa fa-pencil fa-fw"></i> {{ 'edit'|_ }}</a></li>
<li><a href="{{ route('transactions.delete',journal.id) }}"><i class="fa fa-trash fa-fw"></i> {{ 'delete'|_ }}</a></li>
{# convert to withdrawal #}
{% if journal.transactionType.type != "Withdrawal" %}
<li>
<a href="{{ route('transactions.convert.index', ['withdrawal', journal.id]) }}">
<i class="fa fa-exchange fa-fw"></i> {{ ('convert_'~journal.transactionType.type~'_to_withdrawal')|_ }}
</a>
</li>
{% endif %}
{# convert to deposit #}
{% if journal.transactionType.type != "Deposit" %}
<li>
<a href="{{ route('transactions.convert.index', ['deposit', journal.id]) }}">
<i class="fa fa-exchange fa-fw"></i> {{ ('convert_'~journal.transactionType.type~'_to_deposit')|_ }}
</a>
</li>
{% endif %}
{# convert to transfer#}
{% if journal.transactionType.type != "Transfer" %}
<li>
<a href="{{ route('transactions.convert.index', ['transfer', journal.id]) }}">
<i class="fa fa-exchange fa-fw"></i> {{ ('convert_'~journal.transactionType.type~'_to_transfer')|_ }}
</a>
</li>
{% endif %}
{# other options #}
<li>
<a href="{{ route('transactions.clone', [journal.id]) }}">
<i class="fa fa-copy fa-fw"></i> {{ ('clone_'~journal.transactionType.type|lower)|_ }}
</a>
</li>
<li>
<a href="{{ route('transactions.split.edit', journal.id) }}">
<i class="fa fa-unsorted fa-fw"></i> {{ ('split_this_'~what)|_ }}
</a>
</li>
<li>
<a href="#" data-toggle="modal" data-target="#linkJournalModal"><i class="fa fa-fw fa-link"></i> {{ 'link_transaction'|_ }}
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="box-body no-padding">
<table class="table table-hover">
<tbody>
<tr>
<td>{{ trans('list.type') }}</td>
<td>{{ journal.transactiontype.type|_ }}</td>
</tr>
<tr>
<td>{{ trans('list.description') }}</td>
<td>{{ journal.description }}</td>
</tr>
<!-- source(s) -->
<tr>
<td>{{ 'source_accounts'|_ }}</td>
<td>{{ sourceAccount(journal)|raw }}</td>
</tr>
<!-- destination(s) -->
<tr>
<td>{{ 'destination_accounts'|_ }}</td>
<td>{{ destinationAccount(journal)|raw }}</td>
</tr>
<!-- total amount -->
<tr>
<td>{{ 'total_amount'|_ }}</td>
<td>
{{ journal|journalTotalAmount }}
{# if more transactions, list each one: #}
{% if transactions|length > 1 %}
({% for transaction in transactions %}{{ transaction|transactionArrayAmount }}{% if loop.index != loop.length %}, {% endif %}{% endfor %})
{% endif %}
</td>
</tr>
<tr>
<td style="width:30%;">{{ trans('list.date') }}</td>
<td>{{ journal.date.formatLocalized(monthAndDayFormat) }}</td>
</tr>
</tbody>
</table>
</div>
<div class="box-footer">
<div class="pull-right">
<div class="btn-group">
<a class="btn btn-default" href="{{ route('transactions.edit',journal.id) }}"><i class="fa fa-pencil fa-fw"></i> {{ 'edit'|_ }}</a>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-cog fa-fw"></i> {{ 'options'|_ }} <span class="caret"></span>
</button>
<ul class="dropdown-menu">
{# convert to withdrawal #}
{% if journal.transactionType.type != "Withdrawal" %}
<li>
<a href="{{ route('transactions.convert.index', ['withdrawal', journal.id]) }}">
<i class="fa fa-exchange fa-fw"></i> {{ ('convert_'~journal.transactionType.type~'_to_withdrawal')|_ }}
</a>
</li>
{% endif %}
{# convert to deposit #}
{% if journal.transactionType.type != "Deposit" %}
<li>
<a href="{{ route('transactions.convert.index', ['deposit', journal.id]) }}">
<i class="fa fa-exchange fa-fw"></i> {{ ('convert_'~journal.transactionType.type~'_to_deposit')|_ }}
</a>
</li>
{% endif %}
{# convert to transfer#}
{% if journal.transactionType.type != "Transfer" %}
<li>
<a href="{{ route('transactions.convert.index', ['transfer', journal.id]) }}">
<i class="fa fa-exchange fa-fw"></i> {{ ('convert_'~journal.transactionType.type~'_to_transfer')|_ }}
</a>
</li>
{% endif %}
{# other options #}
<li>
<a href="{{ route('transactions.clone', [journal.id]) }}">
<i class="fa fa-copy fa-fw"></i> {{ ('clone_'~journal.transactionType.type|lower)|_ }}
</a>
</li>
<li>
<a href="{{ route('transactions.split.edit', journal.id) }}">
<i class="fa fa-unsorted fa-fw"></i> {{ ('split_this_'~what)|_ }}
</a>
</li>
<li>
<a href="#" data-toggle="modal" data-target="#linkJournalModal"><i class="fa fa-fw fa-link"></i> {{ 'link_transaction'|_ }}
</a>
</li>
</ul>
<a href="{{ route('transactions.delete',journal.id) }}" class="btn btn-danger"><i class="fa fa-trash fa-fw"></i> {{ 'delete'|_ }}
</a>
</div>
</div>
</div>
</div>
<!-- events, if present -->
{% if journal.piggyBankEvents|length > 0 %}
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'piggyBanks'|_ }}</h3>
</div>
<div class="box-body table-responsive no-padding">
{% include 'list/piggy-bank-events' with {'events': events, 'showPiggyBank':true} %}
</div>
</div>
{% endif %}
</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">{{ 'transaction_journal_meta'|_ }}</h3>
</div>
<div class="box-body table-responsive no-padding">
<table class="table table-hover">
<tbody>
<tr>
<td>{{ 'categories'|_ }}</td>
<td>{{ journalCategories(journal)|raw }}</td>
</tr>
<tr>
<td>{{ 'budgets'|_ }}</td>
<td>{{ journalBudgets(journal)|raw }}</td>
</tr>
{% if journal.hasMeta('interest_date') %}
<tr>
<td>{{ trans('list.interest_date') }}</td>
<td>{{ journal.getMeta('interest_date').formatLocalized(monthAndDayFormat) }}</td>
</tr>
{% endif %}
{% if journal.hasMeta('book_date') %}
<tr>
<td>{{ trans('list.book_date') }}</td>
<td>{{ journal.getMeta('book_date').formatLocalized(monthAndDayFormat) }}</td>
</tr>
{% endif %}
{% if journal.hasMeta('process_date') %}
<tr>
<td>{{ trans('list.process_date') }}</td>
<td>{{ journal.getMeta('process_date').formatLocalized(monthAndDayFormat) }}</td>
</tr>
{% endif %}
{% if journal.hasMeta('due_date') %}
<tr>
<td>{{ trans('list.due_date') }}</td>
<td>{{ journal.getMeta('due_date').formatLocalized(monthAndDayFormat) }}</td>
</tr>
{% endif %}
{% if journal.hasMeta('payment_date') %}
<tr>
<td>{{ trans('list.payment_date') }}</td>
<td>{{ journal.getMeta('payment_date').formatLocalized(monthAndDayFormat) }}</td>
</tr>
{% endif %}
{% if journal.hasMeta('invoice_date') %}
<tr>
<td>{{ trans('list.invoice_date') }}</td>
<td>{{ journal.getMeta('invoice_date').formatLocalized(monthAndDayFormat) }}</td>
</tr>
{% endif %}
{% if journal.hasMeta('internal_reference') and journal.getMeta('internal_reference') != "" %}
<tr>
<td>{{ trans('list.internal_reference') }}</td>
<td>{{ journal.getMeta('internal_reference') }}</td>
</tr>
{% endif %}
{% if journal.notes.count == 1 %}
<tr>
<td>{{ trans('list.notes') }}</td>
<td>{{ journal.notes.first.markdown|raw }}</td>
</tr>
{% endif %}
{% if journal.bill %}
<tr>
<td>{{ 'bill'|_ }}</td>
<td><a href="{{ route('bills.show', journal.bill_id) }}">{{ journal.bill.name }}</a></td>
</tr>
{% endif %}
{% 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 %}
</tbody>
</table>
</div>
</div>
{% if journal.attachments|length > 0 %}
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'attachments'|_ }}</h3>
</div>
<div class="box-body table-responsive no-padding">
<table class="table table-hover">
{% for att in journal.attachments %}
<tr>
<td>
<div class="btn-group btn-group-xs">
<a href="{{ route('attachments.edit', att.id) }}" class="btn btn-default"><i class="fa fa-pencil"></i></a>
<a href="{{ route('attachments.delete', att.id) }}" class="btn btn-danger"><i class="fa fa-trash"></i></a>
</div>
</td>
<td>
<i class="fa {{ att.mime|mimeIcon }}"></i>
<a href="{{ route('attachments.download', att.id) }}" title="{{ att.filename }}">
{% if att.title %}
{{ att.title }}
{% else %}
{{ att.filename }}
{% endif %}
</a>
({{ att.size|filesize }})
{% if att.description %}
<br/>
<em>{{ att.description }}</em>
{% endif %}
</td>
<td style="width:100px;">
<img src="{{ route('attachments.preview', att.id) }}"/>
</td>
</tr>
{% endfor %}
</table>
</div>
</div>
{% endif %}
{# show links: #}
{% if links.count > 0 %}
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'journal_links'|_ }}</h3>
</div>
<div class="box-body table-responsive no-padding">
<table class="table table-hover">
{% for link in links %}
<tr>
<td>
<div class="btn-group btn-group-xs">
<a href="{{ route('transactions.link.delete', [link.id]) }}" class="btn btn-danger"><i class="fa fa-trash"></i></a>
<a href="{{ route('transactions.link.switch', [link.id]) }}" class="btn btn-default"><i class="fa fa-fw fa-arrows-h"></i></a>
</div>
</td>
<td>
{{ ('this_'~(what|lower))|_ }}
{% if link.source.id == journal.id %}
{{ journalLinkTranslation('outward', link.linkType.outward) }}
<a href="{{ route('transactions.show',link.destination.id) }}">
#{{ link.destination.id }}: {{ link.destination.description }}
</a>
({{ link.destination|journalTotalAmount }})
{% else %}
{{ journalLinkTranslation('inward', link.linkType.inward) }}
<a href="{{ route('transactions.show',link.source.id) }}">
#{{ link.source.id }}: {{ link.source.description }}</a>
({{ link.source|journalTotalAmount }})
{% endif %}
{% if link.comment != "" %}
<br/><em>{{ link.comment }}</em>
{% endif %}
</td>
</tr>
{% endfor %}
</table>
</div>
</div>
<p>
</p>
{% endif %}
</div>
</div>
<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">{{ 'transactions'|_ }}</h3>
</div>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="hidden-md hidden-sm hidden-xs">{{ trans('list.description') }}</th>
<th>{{ trans('list.source_account') }}</th>
<th class="hidden-sm hidden-xs">&#916;</th>
<th>{{ trans('list.destination_account') }}</th>
<th class="hidden-sm hidden-xs">&#916;</th>
<th>{{ trans('list.amount') }}</th>
<th class="hidden-md hidden-xs">{{ trans('list.budget') }}</th>
<th class="hidden-md hidden-xs">{{ trans('list.category') }}</th>
</tr>
</thead>
<tbody>
{% for transaction in transactions %}
<tr>
<td class="hidden-md hidden-sm hidden-xs">
{% if transaction.description == "" %}
{{ journal.description }}
{% else %}
{{ transaction.description }}
{% endif %}
</td>
<td>
{% if transaction.source_account_type == 'Cash account' %}
<span class="text-success">({{ 'cash'|_ }})</span>
{% else %}
<a href="{{ route('accounts.show', transaction.source_account_id) }}">{{ transaction.source_account_name }}</a>
{% endif %}
</td>
<td class="hidden-sm hidden-xs">
{{ formatSourceBefore(transaction) }} &rarr; {{ formatSourceAfter(transaction) }}
</td>
<td>
{% if transaction.destination_account_type == 'Cash account' %}
<span class="text-success">({{ 'cash'|_ }})</span>
{% else %}
<a href="{{ route('accounts.show', transaction.destination_account_id) }}">{{ transaction.destination_account_name }}</a>
{% endif %}
</td>
<td class="hidden-sm hidden-xs">
{{ formatDestinationBefore(transaction) }} &rarr; {{ formatDestinationAfter(transaction) }}
</td>
<td>
{{ transaction|transactionArrayAmount }}
</td>
<td class="hidden-md hidden-xs">
{{ transaction.source|transactionBudgets }}
</td>
<td class="hidden-md hidden-xs">
{{ transaction.source|transactionCategories }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{# link journal modal:#}
<div class="modal fade" tabindex="-1" role="dialog" id="linkJournalModal">
<form action="{{ route('transactions.link.store', [journal.id]) }}" method="post" class="form-horizontal">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">{{ 'link_to_other_transaction'|_ }}</h4>
</div>
<div class="modal-body" id="helpBody">
<p>{{ 'select_transaction_to_link'|_ }}</p>
<div class="form-group">
<label for="link_type" class="col-sm-2 control-label">{{ 'this_transaction'|_ }}</label>
<div class="col-sm-10">
<select id="link_type" class="form-control" name="link_type">
{% for linkType in linkTypes %}
<option label="{{ linkType.inward }}" value="{{ linkType.id }}_inward">{{ linkType.inward }}</option>
<option label="{{ linkType.outward }}" value="{{ linkType.id }}_outward">{{ linkType.outward }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-group">
<label for="link_other" class="col-sm-2 control-label">{{ 'transaction'|_ }}</label>
<div class="col-sm-10">
<input type="text" name="link_other" autocomplete="off" id="link_other" value="" class="form-control">
<p class="help-block">{{ 'to_link_not_found'|_ }}</p>
<input type="hidden" name="link_journal_id" value="0">
</div>
</div>
<div class="form-group">
<label for="comments" class="col-sm-2 control-label">{{ 'comments'|_ }}</label>
<div class="col-sm-10">
<textarea id="comments" name="comments" class="form-control"></textarea>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ 'close'|_ }}</button>
<button type="submit" class="btn btn-primary">{{ 'submit'|_ }}</button>
</div>
</div>
</div>
</form>
</div>
{% endblock %}
{% block scripts %}
<script type="text/javascript">
var autoCompleteUri = "{{ route('json.journals-with-id',[journal.id]) }}";
</script>
<script type="text/javascript" src="js/lib/bootstrap3-typeahead.min.js?v={{ FF_VERSION }}"></script>
<script type="text/javascript" src="js/ff/transactions/show.js?v={{ FF_VERSION }}"></script>
{% endblock %}