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

{% block title %}Moderator Dashboard{% endblock %}

{% block content %}
<section class="section-moderator-dashboard">
    <div class="reports-column">
        <div class="box">
            <div class="title">Open User Reports</div>
            <table>
                <tr>
                    <th style="width: 120px">User ID</th>
                    <th>Reason</th>
                    <th style="width: 150px">Report Date</th>
                    <th style="width: 80px"></th>
                </tr>
                {% for report in userReports %}
                    <tr {{ report.status == 2 ? "class=\"inactive\"" : ""}}>
                        <td>{{ report.userId }}</td>
                        <td>{{ report.reason }}</td>
                        <td>{{ report.reportDate|date('d/m/Y') }}</td>
                        <td><a href="{{ path('moderation.reports.user', {reportId: report.id}) }}" class="button">Open</a></td>
                    </tr>
                {% endfor %}
            </table>
        </div>
        <div class="box">
            <div class="title">Open Song Reports</div>
            <table>
                <tr>
                    <th style="width: 120px">Song ID</th>
                    <th>Reason</th>
                    <th style="width: 150px">Report Date</th>
                    <th style="width: 80px"></th>
                </tr>
                {% for report in songReports %}
                    <tr {{ report.status == 2 ? "class=\"inactive\"" : ""}}>
                        <td>{{ report.songId }}</td>
                        <td>{{ report.reason }}</td>
                        <td>{{ report.reportDate|date('d/m/Y') }}</td>
                        <td><a href="{{ path('moderation.reports.song', {reportId: report.id}) }}" class="button">Open</a></td>
                    </tr>
                {% endfor %}
            </table>
        </div>
    </div>
    <div class="content-column">
        {% if is_granted('ROLE_ADMIN') %}
            <div class="box">
                <div class="title">Promos</div>
                <table>
                    <tr>
                        <th>Type</th>
                        <th>Title</th>
                        <th>Visible</th>
                        <th style="width: 110px"></th>
                    </tr>
                    {% for promo in promos %}
                        <tr {{ promo.isVisible ? "class=\"active\"" : ""}}>
                            <td>{{ promo.type }}</td>
                            <td>{{ promo.title }}</td>
                            <td>{{ promo.isVisible ? "Yes" : "No" }}</td>
                            <td><a href="{{ path('moderation.promos.remove', {promoId: promo.id}) }}" class="button">X</a> <a href="{{ path('moderation.promos.switchVisibility', {promoId: promo.id}) }}" class="button">Vis</a></td>
                        </tr>
                    {% endfor %}
                </table>
                <br />
                <a href="{{ path('moderation.promos.add') }}" class="button">New Promo</a>
            </div>
            <div class="box">
                <div class="title">Client Releases</div>
                <table>
                    <tr>
                        <th>Version</th>
                        <th>Platform</th>
                        <th>UploadDate</th>
                        <th style="width: 40px"></th>
                    </tr>
                    {% for release in clientReleases %}
                        <tr>
                            <td>{{ release.majorVersion }}.{{ release.minorVersion }}.{{ release.patchVersion }}</td>
                            <td>{{ release.platform }}</td>
                            <td>{{ release.uploadDate|date('d/m/Y') }}</td>
                            <td><a href="{{ path('moderation.clientreleases.remove', {releaseId: release.id}) }}" class="button">X</a></td>
                        </tr>
                    {% endfor %}
                </table>
                <br />
                <a href="{{ path('moderation.clientreleases.add') }}" class="button">New Release</a>
            </div>
            <div class="box">
                <div class="title">System</div>
                <p>Don't play around with these buttons!!!</p>
                <br />
                <a href="{{ path('moderation.system.deploy') }}" class="button">Deploy</a>
                <br /><br />
                <a href="{{ path('moderation.system.rollback') }}" class="button">Rollback</a>
            </div>
        {% endif %}
    </div>
</section>
{% endblock %}

{% block styles %}
    <link rel="stylesheet" href="{{ asset('assets/css/moderation.css') }}" />
{% endblock %}