{{#if subscriptionPayment.IsPaymentReady}}
<div class="dialogBlock">
    <button type="button" class="textButton" {{action 'paymentClicked' subscriptionPayment.IdSubscription}}>
        {{#if isWorking}}
        {{icon 'loadingAnimation'}}
        {{else}}
        {{icon 'invoice'}}
        {{/if}}
        <div>{{translate 'payNow'}}</div>
    </button>
</div>
{{else if hasSubscriptionDetailsForPayment}}
<div>{{translate 'paymentNotPossible'}}</div>
{{else if hasInvoices}}
<div class="dialogBlock treeViewNode">
    <h4>{{translate 'invoices'}}</h4>
    <table class="dialogInfoTable">
        {{#each invoice in subscriptionPayment.OpenInvoices itemController='openInvoice'}}
        <tr>
            {{#if invoice.isPayed}}
            <td>{{translate 'invoice'}} {{invoice.Number}} - {{translate 'payed'}}</td>
            <td>{{crystal-report reportContext='Rechnung' caption=(translate 'downloadReceipt') reportId=subscriptionPayment.ReportId dataKey=invoice.Id target='_blank'}}</td>
            {{else}}
            {{#if subscriptionPayment.HasAutomaticInvoiceBalancing}}
            <td>
                {{#if invoice.IsPrinted}}
                {{translate 'invoice'}}
                {{invoice.Number}}
                {{else}}
                {{translate 'idinvoice'}}
                {{invoice.Id}}
                {{/if}} - {{#if invoice.PaymentConfirmationPending}}
                {{translate 'paymentPending'}}
                {{else}}
                {{translate 'paymentOpen'}}
                {{/if}}
            </td>
            <td>
                {{#unless invoice.PaymentConfirmationPending}}
                <button type="button" class="textButton" {{action 'invoiceClicked' invoice.Id}}>
                    {{#if isWorking}}
                    {{icon 'loadingAnimation'}}
                    {{else}}
                    {{icon 'invoice'}}
                    {{/if}}
                    <div>{{translate 'payNow'}}</div>
                </button>
                {{/unless}}
            </td>
            {{else if invoice.IsCreditCardPayment}}
            <td>
                {{#if invoice.IsPrinted}}
                {{translate 'invoice'}}
                {{invoice.Number}}
                {{else}}
                {{translate 'idinvoice'}}
                {{invoice.Id}}
                {{/if}} -
                {{#if invoice.PaymentConfirmationPending}}
                {{translate 'paymentPending'}}
                {{else}}
                {{translate 'paymentOpen'}}
                {{/if}}
            </td>
            <td>
                {{#unless invoice.PaymentConfirmationPending}}
                <button type="button" class="textButton" {{action 'invoiceClicked' invoice.Id}}>
                    {{#if isWorking}}
                    {{icon 'loadingAnimation'}}
                    {{else}}
                    {{icon 'invoice'}}
                    {{/if}}
                    <div>{{translate 'payNow'}}</div>
                </button>
                {{/unless}}
            </td>
            {{else}}
            <td>{{translate 'invoice'}} {{invoice.Number}}</td>
            <td>{{crystal-report reportContext='Rechnung' caption=(translate 'downloadReceipt') reportId=subscriptionPayment.ReportId dataKey=invoice.Id target='_blank'}}</td>
            {{/if}}
            {{/if}}
        </tr>
        {{/each}}
    </table>
</div>
{{else}}
<div class="dialogBlock treeViewNode">{{translate 'noCosts'}}</div>
{{/if}}