Use transformer in view.

This commit is contained in:
James Cole
2018-02-06 19:49:53 +01:00
parent 3aa922341c
commit 3de46f55fa
2 changed files with 26 additions and 28 deletions

View File

@@ -26,8 +26,6 @@
<div style="padding:8px;"> <div style="padding:8px;">
<a class="btn btn-success" href="{{ route('bills.create') }}"><i class="fa fa-plus fa-fw"></i> {{ 'create_new_bill'|_ }}</a> <a class="btn btn-success" href="{{ route('bills.create') }}"><i class="fa fa-plus fa-fw"></i> {{ 'create_new_bill'|_ }}</a>
</div> </div>
<bills-index></bills-index>
<p><hr /></p>
{% include 'list/bills' %} {% include 'list/bills' %}
</div> </div>
<div class="box-footer"> <div class="box-footer">

View File

@@ -10,14 +10,14 @@
<div class="col-lg-6 col-sm-12 col-md-12"> <div class="col-lg-6 col-sm-12 col-md-12">
<div class="box" id="billInfo"> <div class="box" id="billInfo">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title">{{ object.name }}</h3> <h3 class="box-title">{{ object.data.name }}</h3>
<div class="box-tools pull-right"> <div class="box-tools pull-right">
<div class="btn-group"> <div class="btn-group">
<button class="btn btn-box-tool dropdown-toggle" data-toggle="dropdown"><i class="fa fa-ellipsis-v"></i></button> <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"> <ul class="dropdown-menu" role="menu">
<li><a href="{{ route('bills.edit',object.id) }}"><i class="fa fa-fw fa-pencil"></i> {{ 'edit'|_ }}</a></li> <li><a href="{{ route('bills.edit',object.data.id) }}"><i class="fa fa-fw fa-pencil"></i> {{ 'edit'|_ }}</a></li>
<li><a href="{{ route('bills.delete',object.id) }}"><i class="fa fa-fw fa-trash-o"></i> {{ 'delete'|_ }}</a></li> <li><a href="{{ route('bills.delete',object.data.id) }}"><i class="fa fa-fw fa-trash-o"></i> {{ 'delete'|_ }}</a></li>
</ul> </ul>
</div> </div>
</div> </div>
@@ -28,18 +28,18 @@
<tr> <tr>
<td colspan="2"> <td colspan="2">
{{ 'matching_on'|_ }} {{ 'matching_on'|_ }}
{% for word in object.match %} {% for word in object.data.match %}
<span class="label label-info">{{ word }}</span> <span class="label label-info">{{ word }}</span>
{% endfor %} {% endfor %}
{{ trans('firefly.between_amounts', {low: object.amount_min|formatAmount, high: object.amount_max|formatAmount })|raw }} {{ trans('firefly.between_amounts', {low: object.data.amount_min|formatAmount, high: object.data.amount_max|formatAmount })|raw }}
{{ 'repeats'|_ }} {{ 'repeats'|_ }}
{{ trans('firefly.repeat_freq_' ~object.repeat_freq) }}. {{ trans('firefly.repeat_freq_' ~object.data.repeat_freq) }}.
</td> </td>
</tr> </tr>
<tr> <tr>
<td>{{ 'bill_is_active'|_ }}</td> <td>{{ 'bill_is_active'|_ }}</td>
<td> <td>
{% if object.active %} {% if object.data.active %}
<i class="fa fa-check fa-fw" title="{{ 'active'|_ }}"></i> {{ 'yes'|_ }} <i class="fa fa-check fa-fw" title="{{ 'active'|_ }}"></i> {{ 'yes'|_ }}
{% else %} {% else %}
<i class="fa fa-times fa-fw" title="{{ 'inactive'|_ }}"></i> {{ 'no'|_ }} <i class="fa fa-times fa-fw" title="{{ 'inactive'|_ }}"></i> {{ 'no'|_ }}
@@ -49,7 +49,7 @@
<tr> <tr>
<td>{{ 'bill_will_automatch'|_ }}</td> <td>{{ 'bill_will_automatch'|_ }}</td>
<td> <td>
{% if object.automatch %} {% if object.data.automatch %}
<i class="fa fa-check fa-fw" title="{{ 'auto_match_on'|_ }}"></i> {{ 'yes'|_ }} <i class="fa fa-check fa-fw" title="{{ 'auto_match_on'|_ }}"></i> {{ 'yes'|_ }}
{% else %} {% else %}
<i class="fa fa-times fa-fw" title="{{ 'auto_match_off'|_ }}"></i> {{ 'no'|_ }} <i class="fa fa-times fa-fw" title="{{ 'auto_match_off'|_ }}"></i> {{ 'no'|_ }}
@@ -59,8 +59,8 @@
<tr> <tr>
<td>{{ 'next_expected_match'|_ }}</td> <td>{{ 'next_expected_match'|_ }}</td>
<td> <td>
{% if object.next_expected_match|length > 0 %} {% if object.data.next_expected_match|length > 0 %}
{{ formatDate(object.next_expected_match, monthAndDayFormat) }} {{ formatDate(object.data.next_expected_match, monthAndDayFormat) }}
{% else %} {% else %}
{{ 'unknown'|_ }} {{ 'unknown'|_ }}
{% endif %} {% endif %}
@@ -88,48 +88,48 @@
<table class="table"> <table class="table">
<tr> <tr>
<td>{{ trans('list.notes') }}</td> <td>{{ trans('list.notes') }}</td>
<td class="markdown">{{ object.notes|markdown }}</td> <td class="markdown">{{ object.notes.data[0].markdown }}</td>
</tr> </tr>
</table> </table>
{% endif %} {% endif %}
</div> </div>
<div class="box-footer"> <div class="box-footer">
<a href="{{ route('bills.rescan',object.id) }}" class="btn btn-default">{{ 'rescan_old'|_ }}</a> <a href="{{ route('bills.rescan',object.data.id) }}" class="btn btn-default">{{ 'rescan_old'|_ }}</a>
</div> </div>
</div> </div>
{% if object.attachments_count > 0 %} {% if object.data.attachments_count > 0 %}
<div class="box"> <div class="box">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title">{{ 'attachments'|_ }}</h3> <h3 class="box-title">{{ 'attachments'|_ }}</h3>
</div> </div>
<div class="box-body table-responsive no-padding"> <div class="box-body table-responsive no-padding">
<table class="table table-hover"> <table class="table table-hover">
{% for att in bill.attachments %} {% for att in bill.data.attachments.data %}
<tr> <tr>
<td> <td>
<div class="btn-group btn-group-xs"> <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.edit', att.data.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> <a href="{{ route('attachments.delete', att.data.id) }}" class="btn btn-danger"><i class="fa fa-trash"></i></a>
</div> </div>
</td> </td>
<td> <td>
<i class="fa {{ att.mime|mimeIcon }}"></i> <i class="fa {{ att.data.mime|mimeIcon }}"></i>
<a href="{{ route('attachments.download', att.id) }}" title="{{ att.filename }}"> <a href="{{ route('attachments.download', att.data.id) }}" title="{{ att.data.filename }}">
{% if att.title %} {% if att.data.title %}
{{ att.title }} {{ att.data.title }}
{% else %} {% else %}
{{ att.filename }} {{ att.data.filename }}
{% endif %} {% endif %}
</a> </a>
({{ att.size|filesize }}) ({{ att.data.size|filesize }})
{% if att.description %} {% if att.data.description %}
<br/> <br/>
<em>{{ att.description }}</em> <em>{{ att.data.description }}</em>
{% endif %} {% endif %}
</td> </td>
<td style="width:100px;"> <td style="width:100px;">
<img src="{{ route('attachments.preview', att.id) }}"/> <img src="{{ route('attachments.preview', att.data.id) }}"/>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
@@ -170,7 +170,7 @@
{% block scripts %} {% block scripts %}
<script type="text/javascript"> <script type="text/javascript">
var billUri = '{{ route('chart.bill.single', [object.id]) }}'; var billUri = '{{ route('chart.bill.single', [object.data.id]) }}';
</script> </script>
<script type="text/javascript" src="js/lib/Chart.bundle.min.js?v={{ FF_VERSION }}"></script> <script type="text/javascript" src="js/lib/Chart.bundle.min.js?v={{ FF_VERSION }}"></script>
<script type="text/javascript" src="js/ff/charts.defaults.js?v={{ FF_VERSION }}"></script> <script type="text/javascript" src="js/ff/charts.defaults.js?v={{ FF_VERSION }}"></script>