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

<div class="row">
    <div class="col-md-12">
        <h3>Rechnungen</h3>
    </div>
</div>
<div class="row">
    <div class="col-md-12">

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

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

                Keine Rechnungen vorhanden

                <% } else { %>

                <div class="table-responsive">
                    <table id="table_player_list"
                           class="table table-striped table-hover">
                        <thead>
                        <tr>
                            <th>R.Nr.</th>
                            <th>Team</th>
                            <th>Paket</th>
                            <th>Von</th>
                            <th>Bis</th>
                        </tr>
                        </thead>
                        <tbody>
                        <% var teamName; %>
                        <% for ( var ii = 0; ii < data.invoices.length; ii++ ) {    %>
                            <tr data-invoice-id="<%= data.invoices[ ii ].id %>">
                                <td><%= data.invoices[ ii ].billing_id %></td>
                                <td><%= data.invoices[ ii ].team_name %></td>
                                <td><%= data.invoices[ ii ].package_name %></td>
                                <td><%= data.invoices[ ii ].billing_period_start_dt ? moment( data.invoices[ ii ].billing_period_start_dt.date ).format( 'MMMM YYYY' ) : '---' %></td>
                                <td><%= data.invoices[ ii ].billing_period_end_dt ? moment( data.invoices[ ii ].billing_period_end_dt.date ).format( 'MMMM YYYY' ) : '---' %></td>
                            </tr>
                        <% }    %>
                        </tbody>
                    </table>
                </div>

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