<%= tmpl( 'tpl_settings_tab', { data : { activeTab : 'premium' } } ) %>

<?php
/*
<% if ( data.showSuccess && true === data.showSuccess ) { %>

    <div class="panel panel-premium panel-pricetable">
        <div class="panel-heading">
            <h3 class="text-center">
                Kauf erfolgreich abgeschlossen
            </h3>
        </div>
        <div class="panel-body text-center">
            <p>
                <strong>Vielen Dank, dass du dich für TBuddy Premium entschieden hast.</strong>
            </p>
            <p>
                Viel Spass weiterhin mit TBuddy!
            </p>
        </div>
    </div>

<% }    %>
*/
?>

<div class="row">
    <div class="col-md-12">
        <h3>Deine aktiven Premium Pakete</h3>
    </div>
</div>
<div class="row">
    <div class="col-md-12">

        <div class="panel panel-default">
            <div class="panel-body">

                <% if ( !data.premium_logs || data.premium_logs.length === 0 ) {   %>

                    Keine aktiven Premium Pakete gefunden.

                <% } else { %>

                    <div class="table-responsive">
                        <table id="table_player_list"
                               class="table table-striped">
                            <thead>
                            <tr>
                                <th>Team</th>
                                <th>Paket</th>
                                <th>Status</th>
                                <th>&nbsp;</th>
                            </tr>
                            </thead>
                            <tbody>
                                <% for ( var pli = 0; pli < data.premium_logs.length; pli++ ) { %>
                                    <tr>
                                        <td><%= data.premium_logs[ pli ].__teamName %></td>
                                        <td>
                                            <label class="label label-premium"><%= TB.Premium.getName( data.premium_logs[ pli ].package_id ) %> <i class="glyphicon glyphicon-star"></i></label>
                                        </td>
                                        <td>
                                            <%= TB.Premium.getStatusHtml( data.premium_logs[ pli ].status ) %>
                                        </td>
                                        <td class="text-center">
                                            <a href="<%= TB.Controller.getUrl( 'Settings', 'premium_detail', { premium_log_id : data.premium_logs[ pli ].id } ) %>"
                                               class="btn btn-primary btn-xs">
                                                Details
                                            </a>
                                        </td>
                                    </tr>
                                <% }    %>
                            </tbody>
                        </table>
                    </div>

                <% }    %>
            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-md-12">
        <h3>Teams, ohne oder auslaufenden Premium Paketen</h3>
    </div>
</div>
<div class="row">
    <div class="col-md-12">

        <div class="panel panel-default">
            <div class="panel-body">

                <% if ( !data.teams_for_premium || data.teams_for_premium.length === 0 ) {   %>

                    <% if ( 0 === ( data.premium_logs.length - data.teams.length ) )  { %>

                        <p>
                            Du bist derzeit in keinen weiteren Teams.
                        </p>

                    <% } else { %>

                        <p>
                            Alle anderen deiner Teams besitzen schon einen Premium Status.
                        </p>

                    <% }    %>

                <% } else { %>

                    <div class="table-responsive">
                        <table id="table_player_list"
                               class="table table-striped">
                            <thead>
                            <tr>
                                <th>Team</th>
                                <th>&nbsp;</th>
                            </tr>
                            </thead>
                            <tbody>

                            <% for ( var tpi = 0; tpi < data.teams_for_premium.length; tpi++ ) {  %>

                                <tr>
                                    <td>
                                        <%= data.teams_for_premium[ tpi ].team.display_name %>
                                    </td>
                                    <td class="text-center">
                                        <button
                                           data-type="book-premium"
                                           data-team-id="<%= data.teams_for_premium[ tpi ].team.id %>"
                                           class="btn btn-premium">
                                            Premium buchen <i class="glyphicon glyphicon-star"></i>
                                        </button>
                                    </td>
                                </tr>

                            <% }    %>

                            </tbody>
                        </table>
                    </div>

                <% }    %>
            </div>
        </div>
    </div>
</div>