{% if order.status == 'active' %}

<div class="row">
    <article class="span12 data-block">
        <div class="data-container">
            <header>
                <h1>{{ 'Centova Cast server'|trans }}</h1>
            </header>
            <section>
                <div class="row">
                    <article class="span12 data-block">
                        <div class="data-container">
                            <header>
                                <h2>{{ 'Details'|trans }}</h2>
                            </header>
                            <section>
                                <table class="table table-striped table-bordered table-condensed">
                                    <tbody>
                                    <tr>
                                        <td>{{ 'Username'|trans }}:</td>
                                        <td>{{ service.username }}</td>
                                    </tr>

                                    <tr>
                                        <td>{{ 'Password'|trans }}:</td>
                                        <td>{{ service.pass }}</td>
                                    </tr>
                                    </tbody>

                                    <tfoot>
                                    <tr>
                                        <td colspan="2">
                                            <a href="{{ client.servicecentovacast_control_panel_url({ 'order_id': order.id, 'try': 1 }) }}" target="_blank" class="btn btn-inverse btn-small">{{ 'Open Control panel'|trans }}</a>
                                            <a href="{{ 'api/client/servicecentovacast/start'|link({ 'order_id': order.id}) }}" data-api-msg="Started" class="btn btn-inverse btn-small api-link">{{ 'Start'|trans }}</a>
                                            <a href="{{ 'api/client/servicecentovacast/stop'|link({' order_id': order.id}) }}" data-api-msg="Stoped" class="btn btn-inverse btn-small api-link">{{ 'Stop'|trans }}</a>
                                            <a href="{{ 'api/client/servicecentovacast/restart'|link({ 'order_id': order.id}) }}" data-api-msg="Restarted" class="btn btn-inverse btn-small api-link">{{ 'Restart'|trans }}</a>
                                            <a href="{{ 'api/client/servicecentovacast/reload'|link({ 'order_id': order.id}) }}" data-api-msg="Reloaded" class="btn btn-inverse btn-small api-link"><{{ 'Reload'|trans }}</a>
                                        </td>
                                    </tr>
                                    </tfoot>
                                </table>
                            </section>
                        </div>
                    </article>
                    </div>

                    <div class="row">
                    <article class="span6 data-block">
                        <div class="data-container">
                            <header>
                                <h2>{{ 'Status'|trans }}</h2>
                            </header>
                            <section>
                                <table class="table table-striped table-bordered table-condensed">
                                    <tbody>
                                    {% for k,var in client.servicecentovacast_getstatus({ "order_id": order.id, "try": 1 }) %}
                                    {% if var|keys|length > 0 %}
                                    {# for subkey,subvalue in var %}
                                    <tr>
                                        <td>{{ k }}.{{ subkey }}</td>
                                        <td>{{ subvalue }}</td>
                                    </tr>
                                    {% endfor #}
                                    {% else %}
                                    <tr>
                                        <td>{{ k|title }}</td>
                                        <td>{{ var }}</td>
                                    </tr>
                                    {% endif %}
                                    {% else %}
                                    <tr>
                                        <td>{{ 'Unable to connect to server'|trans }}</td>
                                    </tr>
                                    {% endfor %}
                                    </tbody>
                                </table>
                            </section>
                        </div>
                    </article>

                    <article class="span6 data-block">
                        <div class="data-container">
                            <header>
                                <h2>{{ 'Recent tracks'|trans }}</h2>
                            </header>
                            <section>
                                <table class="table table-striped table-bordered table-condensed">
                                    <tbody>
                                    {% for song in client.servicecentovacast_getsongs({ "order_id": order.id, "try": 1 }) %}
                                    <tr>
                                        <td>{{ song.title }}</td>
                                        <td>{{ song.time|date('Y-m-d H:i:s') }}</td>
                                    </tr>
                                    {% else %}
                                    <tr>
                                        <td>{{ 'No recent tracks are available'|trans }}</td>
                                    </tr>
                                    {% endfor %}
                                    </tbody>
                                </table>
                            </section>
                        </div>
                    </article>
                </div>
            </section>
        </div>
    </article>
</div>
{% endif %}
