<div class="modal-content">
    <div class="modal-header">
        <h5 class="modal-title">
            {{ __('Zahlungen / Einkaufsguthaben') }} 
            <strong>
                @if($user->account)
                {{ $user->account->first_name }}
                {{ $user->account->last_name }}
                @endif
            </strong>
        </h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
    </div>
    <div class="modal-body">
        <input type="hidden" name="action" value="{{$data['action']}}">
        <input type="hidden" name="id" value="{{$data['id']}}">
        <input type="hidden" name="view" value="{{$data['view']}}">


            <table class="table table-striped" style="border-top: 0">
                <thead>
                <tr>
                    <th style="width: 55%">Mitteilung</th>
                    <th>Betrag</th>
                    <th>altes Guthaben</th>
                    <th>neues Guthaben</th>
                    <th>Datum</th>
                    <th>Aktion</th>
                </tr>
                </thead>
                <tbody>
                @if($user && $user->user_pay_credits)
                    @foreach($user->user_pay_credits as $user_pay_credit)
                        <tr>
                            @if($user_pay_credit->status === 3)
                                <th scope="row"> {!! nl2br($user_pay_credit->message) !!}</th>
                            @else
                                <th scope="row">{{ trans('payment.'.$user_pay_credit->message) }}</th>
                            @endif
                            <td><div class="no-line-break">{{ formatNumber($user_pay_credit->credit) }} €</div></td>
                            <td><div class="no-line-break">{{ formatNumber($user_pay_credit->old_credit_total) }} €</div></td>
                            <td><div class="no-line-break">{{ formatNumber($user_pay_credit->new_credit_total) }} €</div></td>
                            <td><div class="no-line-break">{{ formatDate($user_pay_credit->created_at) }}</div></td>

                            @if($user_pay_credit->shopping_order_id)
                                <td><a class="btn btn-secondary btn-xs" href="{{ route('admin_sales_detail', [$user_pay_credit->shopping_order_id]) }}"><i class="ion ion-md-eye"></i></a></td>
                            @else
                                @if($user_pay_credit->status === 3 && $deleteTime = $user_pay_credit->deleteTime())
                                    <td>
                                        <div class="no-line-break">
                                        <a class="btn btn-danger btn-xs" href="{{ route('admin_payments_paycredit_delete', [$user_pay_credit->id]) }}"  onclick="return confirm('Wirklich löschen?');">
                                            <i class="ion ion-ios-trash"></i>
                                        </a> noch {{ $deleteTime }} min.
                                        </div>
                                    </td>
                                @else
                                    <td>-</td>
                                @endif
                            @endif
                        </tr>
                     @endforeach
                @endif
                </tbody>
            </table>
    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">schließen</button>
    </div>
</div>
<script type="text/javascript">

    $( document ).ready(function() {

    });


</script>
