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

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

<div class="panel panel-default">
    <div class="panel-heading">
        Detailansicht
    </div>
    <div class="panel-body">
        <div class="row">
            <div class="col-md-6">
                <h4>Gebuchtes Paket</h4>
                <h3>
                    <label class="label label-premium"><%= TB.Premium.getName( data.premium_log.package_id ) %> <i class="glyphicon glyphicon-star"></i></label>
                </h3>
                <table class="table table-settings-premium-detail-details">
                    <tr>
                        <td>
                            Status
                        </td>
                        <td>
                            <%= TB.Premium.getStatusHtml( data.premium_log.status ) %>
                        </td>
                    </tr>
                    <% if ( data.premium_log.status === 'CANCELLED' ) { %>

                        <tr>
                            <td>
                                Läuft aus
                            </td>
                            <td>
                                <%= moment( data.premium_log.valid_until_dt.date ).format( 'Do MMMM YYYY' ) %>
                            </td>
                        </tr>

                    <% } else if ( data.premium_log.status === 'DELETED' ) { %>


                    <% } else { %>
                        <tr>
                            <td>
                                Beginn
                            </td>
                            <td>
                                <%= moment( data.braintree_subscription.firstBillingDate.date ).format( 'Do MMMM YYYY' ) %>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Nächste Rechnung
                            </td>
                            <td>
                                <%= moment( data.braintree_subscription.nextBillingDate.date ).format( 'Do MMMM YYYY' ) %>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Preis
                            </td>
                            <td>
                                <%= TB.Premium.getPrice( data.premium_log.package_id ) %>
                            </td>
                        </tr>
                    <% }    %>
                </table>
            </div>
            <div class="col-md-6">
                <h4>Team</h4>
                <h3>
                    <%= data.team.display_name %>
                </h3>
                <strong>Rechnungsempfänger</strong>
                <p class="settings-premium-detail-billing-address">
                    <% if ( data.premium_log.billing_company_name.length ) {    %>

                        <%= data.premium_log.billing_company_name %> <%= data.premium_log.billing_company_tax_id.length ? '(' + data.premium_log.billing_company_tax_id + ')' : '' %><br />
                    <% }    %>
                    <%= data.premium_log.billing_first_name %> <%= data.premium_log.billing_last_name %><br />
                    <%= data.premium_log.billing_street %><br />
                    <%= data.premium_log.billing_zip %> <%= data.premium_log.billing_city %><br />
                    <%= data.premium_log.billing_email %>
                </p>

            </div>
        </div>
    </div>
</div>
<div class="row">
    <div class="col-md-6 col-sm-12">
        <a href="<%= TB.Controller.getUrl( 'Settings', 'premium' ) %>"
           class="btn btn-primary btn-block">
            Zurück
        </a>
    </div>
    <div class="col-md-6 col-sm-12">
        <a href="<%= TB.Controller.getUrl( 'Settings', 'premium_edit', { premium_log_id : data.premium_log.id } ) %>"
           class="btn btn-primary btn-block"
            <%= ( data.premium_log.status === 'CANCELLED' || data.premium_log.status === 'DELETED' ) ? 'disabled="disabled"' : '' %>
        >
            Bearbeiten
        </a>
    </div>
</div>