<tbody>
{% if stocks is defined %}
{% for stock in stocks %}
{% if stock.quantityMovement != 0 %}
<tr class="{% if loop.first %}table-row-big {% endif %}{% if stock.quantity <= paper.quantityMin %}table-danger{% endif %}">
<td>
{% if loop.first %}
<i class="far fa-calendar"></i>
{% elseif stock.quantityMovement > 0 %}
<i class="fa fa-arrow-right text-success"></i>
{% else %}
<i class="fa fa-arrow-left text-danger"></i>
{% endif %}
</td>
<td>{{ stock.createdAt|date('d/m/Y') }}</td>
<td>{% if not loop.first %}{% include "manager/stock/forecasting/_forecasting-label.html.twig" %}{% endif %}</td>
<td class="text-end">{% if not loop.first %}{% if stock.quantityMovement > 0 %}+{% endif %}{{ stock.quantityMovement }}kg{% endif %}</td>
<td class="text-end {% if stock.quantityTmp <= paper.quantityMin %}text-danger{% endif %}">{% if loop.first %}{{ stock.quantityPrevious }}{% else %}{{ stock.quantityTmp }}{% endif %}kg</td>
<td>{% if not loop.first %}{{ stock.comment }}{% endif %}</td>
<td class="text-end">
{% if not loop.first %}
<button class="btn btn-light btn-sm text-primary" data-bs-toggle="modal" data-bs-target="#forecastingEditModal" data-stock="{{ stock.id }}" data-type="{{ stock.type }}" data-url="{{path('stock_forecasting_edit', { id: paper.id })}}"><i class="fa fa-pen"></i></button>
{% endif %}
</td>
</tr>
{% endif %}
{% endfor %}
{% if hide_today == false and stocks|length or hide_today == false and stockOrders|length %}
<tr class="table-row-big" style="background: #eaeaea;">
<td><i class="far fa-calendar"></i></td>
<td>Aujourd'hui</td>
<td colspan="2"></td>
<td class="text-end"><b>{{paper.quantity}}kg</b></td>
<td colspan="2"></td>
</tr>
{% endif %}
{% endif %}
{% for stock in stockOrders %}
<tr class="{% if stock.archived %}table-warning{% elseif stock.quantity <= paper.quantityMin %}table-danger{% endif %}">
<td>
{% if stock.quantityMovement > 0 %}
<i class="fa fa-arrow-up text-success"></i>
{% else %}
<i class="fa fa-arrow-down text-danger"></i>
{% endif %}
</td>
<td>
{{stock.stockDate|date('d/m/Y H:i')}}
{% if stock.archived %}<span class="badge bg-warning text-dark">archivé</span>{% endif %}
{% if stock.stockDate|date('U') < 'now'|date('U') %}<span class="badge bg-warning text-dark">retardé</span>{% endif %}
</td>
<td>{% include "manager/stock/forecasting/_forecasting-label.html.twig" %}</td>
<td class="text-end">{% if stock.quantityMovement > 0 %}+{% endif %}{{ stock.quantityMovement }}kg</td>
<td class="text-end {% if stock.quantityTmp <= paper.quantityMin %}text-danger{% endif %}">{% if stock.archived == false %}{{ stock.quantityTmp }}kg{% endif %}</td>
{% if hide_today == null %}<td>{{ stock.comment }}</td>{% endif %}
<td class="text-end">
<button class="btn btn-light btn-sm text-primary" data-bs-toggle="modal" data-bs-target="#forecastingEditModal" data-paper="{{ paper.id }}" data-stock="{{ stock.id }}" data-type="{{ stock.type }}" data-url="{{path('stock_forecasting_edit', { id: paper.id })}}"><i class="fa fa-pen"></i></button>
</td>
</tr>
{% endfor %}
{% if stocks is not defined and stockOrders is empty or stocks is defined and stocks is empty and stockOrders is empty %}
<tr>
<td colspan="100%">Aucun mouvement de stock</td>
</tr>
{% endif %}
</tbody>