FrankProjects/UltimateWarfare

View on GitHub
templates/game/headquarter/army.html.twig

Summary

Maintainability
Test Coverage
{% extends 'game.html.twig' %}
{% block content %}
    <p class="text-center">
        Advanced stats: <a class="B" href="{{ path('Game/Headquarter/Income') }}">Income</a> - <a class="B" href="{{ path('Game/Headquarter/Army') }}">Army</a> - <a class="B" href="{{ path('Game/Headquarter/Infrastructure') }}">Infrastructure</a>
    </p>

    <table class="table text-center">
        <tr class="tabletop">
            <td colspan="2"><b>Army</b></td>
        </tr>
        {% for gameUnitType in gameUnitTypes %}
            <tr class="tabletop">
                <td colspan="2"><b>{{ gameUnitType.name }}</b></td>
            </tr>

            {% set gameUnitTypeExist = 0 %}
            {% for gameUnit in gameUnitType.gameUnits %}
                {% if gameUnitData[gameUnit.id] is defined and gameUnitData[gameUnit.id] > 0 %}
                    {% set gameUnitTypeExist = 1 %}
                    <tr>
                        <td width="350">{{ gameUnit.nameMulti }}:</td>
                        <td width="350">
                            {{ gameUnitData[gameUnit.id] }}
                        </td>
                    </tr>
                {% endif %}
            {% endfor %}

            {% if gameUnitTypeExist == 0 %}
                <tr>
                    <td colspan="2">You don't have any {{ gameUnitType.name }}</td>
                </tr>
            {% endif %}
        {% endfor %}
    </table>
{% endblock %}