FrankProjects/UltimateWarfare

View on GitHub
templates/game/constructionSummary.html.twig

Summary

Maintainability
Test Coverage
{% extends 'game.html.twig' %}

{% block title %}Ultimate Warfare - Construction summary{% endblock title %}

{% block content %}
    <p class="text-center">
        <a class="B" href="{{ path('Game/Construction') }}">Summary</a>
        {% for gameUnitType in gameUnitTypes %}
            - <a class="B" href="{{ path('Game/Construction', {'type': gameUnitType.id}) }}">{{ gameUnitType.name }}</a>
        {% endfor %}
    </p>

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

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

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