{% extends 'base.html.twig' %}

{% block title %}Inventory Overview{% endblock %}

{% block body %}
    <div class="container">
        <h1>Drink Inventory</h1>
        <div class="card">
            <div class="card-header">
                <h5 class="card-title">Drink Inventory Overview</h5>
            </div>
            <div class="card-body">
                <table class="table table-striped">
                    <thead>
                    <tr>
                        <th>Drink Name</th>
                        <th>Current Stock</th>
                        <th>Desired Stock</th>
                        <th>Status</th>
                        <th>Description</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for drinkStock in drinkStocks %}
                        {% set rowClass = '' %}
                        {% if drinkStock.stock.value == 'critical' %}
                            {% set rowClass = 'table-danger' %}
                        {% elseif drinkStock.stock.value == 'low' %}
                            {% set rowClass = 'table-warning' %}
                        {% elseif drinkStock.stock.value == 'high' %}
                            {% set rowClass = 'table-success' %}
                        {% endif %}
                        <tr class="{{ rowClass }}">
                            <td>{{ drinkStock.record.drinkType.name }}</td>
                            <td>{{ drinkStock.record.quantity }}</td>
                            <td>{{ drinkStock.record.drinkType.desiredStock }}</td>
                            <td>{{ drinkStock.stock.value|capitalize }}</td>
                            <td>{{ drinkStock.record.drinkType.description }}</td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>
                <div class="mt-3">
                    <a href="{{ path('app_drink_type_index') }}" class="btn btn-primary">View All Drinks</a>
                </div>

            </div>
        </div>
    </div>
{% endblock %}
