FrankProjects/UltimateWarfare

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

Summary

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

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

{% block content %}
    <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 %}

    <br />
    <br />

    <table class="table text-center">
        <tr class="tabletop">
            <td colspan="5"><b>Construction</b></td>
        </tr>
        <tr>
            <td>Building</td>
            <td>Region</td>
            <td>Time left</td>
            <td>Finishing at</td>
            <td>Option</td>
        </tr>

        {% for construction in constructions %}
            <tr>
                {% set timestampFinished = construction.timestamp + construction.gameUnit.timestamp %}
                {% set timestampLeft = timestampFinished - date().timestamp %}

                {% if construction.number == 1 %}
                    <td>{{ construction.number }} {{ construction.gameUnit.name }}</td>
                {% else %}
                    <td>{{ construction.number }} {{ construction.gameUnit.nameMulti }}</td>
                {% endif %}
                <td><a class="B" href="{{ path('Game/World/Region', {'regionId': construction.worldRegion.id}) }}">{{ construction.worldRegion.x }}, {{ construction.worldRegion.y }}</a></td>
                <td><span class="timer">{{ timestampLeft }}</span></td>
                <td>{{ construction.timestamp|date("Y-m-d H:i:s") }}</td>
                <td><a class="B" href="{{ path('Game/Construction/Cancel', {'constructionId': construction.id}) }}">Cancel</a></td>
            </tr>
        {% else %}
            <tr>
                <td colspan="7">No {{ gameUnitType.name }} under construction....</td>
            </tr>
        {% endfor %}
    </table>
{% endblock %}