{% extends 'layout.html.twig' %}
{% trans_default_domain 'ComponentInventoryItem' %}
{% import 'Document/macro.html.twig' as document %}
{% block title %}{{ 'ui.itemEventLog' | trans }} | {{ item.code }}{% endblock %}
{% block breadcrumb_wide %}
<ol class="breadcrumb">
<li><a href="{{ path('app.component_inventory.index') }}">{{ 'ui.componentInventory' | trans }}</a></li>
<li class="active">{{ 'ui.itemEventLog' | trans }}</li>
</ol>
{% endblock %}
{% block body %}
<div class="container-fluid">
<div class="row">
<div class="col-xs-12">
<div class="page-header">
<h1>{{ 'ui.itemEventLog' | trans }} <small>{{ item.code }} <span class="badge">{{ ('property.type_' ~ constant('App\\Entity\\ComponentInventoryItem::TYPE_COMPONENT')) | trans }}</span></small></h1>
</div>
</div>
</div>
<table class="table table-condensed">
<thead>
<tr>
<th style="width: 150px;"></th>
<th style="text-align: right; width: 75px;">Quantity<br/>Change</th>
<th style="text-align: right; width: 120px;">Previous<br/>Quantity</th>
<th style="text-align: right; width: 120px;">Previous<br/>Row Value</th>
<th style="text-align: right; width: 120px;">Updated<br/>Quantity</th>
<th style="text-align: right; width: 120px;">Batch<br/>Unit Price</th>
<th style="text-align: right; width: 140px;">Updated<br/>Unit Price</th>
<th style="text-align: right; width: 140px;">Updated<br/>Row Value</th>
<th style="width: 240px;">Purchase Order Number<br/>Excel File Name</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
{% for entry in item.logEntries %}
<tr>
<td>{{ entry.created | date('Y-m-d H:i') }}</td>
<td style="text-align: right;">{% if entry.quantityChange > 0 %}+{% endif %}{{ entry.quantityChange }}</td>
<td style="text-align: right;">{{ entry.previousQuantity is null ? '-' : entry.previousQuantity }}</td>
<td style="text-align: right;">{{ entry.previousTotalValue is null ? '-' : document.currency(entry.previousTotalValue, '€', 5) }}</td>
<td style="text-align: right;">{{ entry.updatedQuantity }}</td>
<td style="text-align: right;">{{ entry.batchUnitPrice is null ? '-' : document.currency(entry.batchUnitPrice, '€', 5) }}</td>
<td style="text-align: right;">{{ document.currency(entry.updatedUnitPrice, '€', 5) }}</td>
<td style="text-align: right;">{{ document.currency(entry.updatedTotalValue, '€', 5) }}</td>
<td>
{% if entry.purchaseOrderNumber is not null %}
<div>{{ entry.purchaseOrderNumber }}</div>
{% endif %}
{% if entry.excelFileName is not null %}
<div>{{ entry.excelFileName }}</div>
{% endif %}
</td>
<td>{{ entry.note }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}