{#
 # This file is part of SolidInvoice package.
 #
 # (c) Pierre du Plessis <open-source@solidworx.co>
 #
 # This source file is subject to the MIT license that is bundled
 # with this source code in the file LICENSE.
 #}

<div class="col-6">
    <div class="card mt-2">
        <div class="card-header{% if payments is not empty%} border-bottom-0{% endif %}">
            <h5 class="card-title">
                {{ icon('credit-card') }} {{ 'dashboard.payment.recent'|trans }}
            </h5>
        </div>
        {% if payments is not empty %}
            <div class="card-body p-0 border-0">
                <ul class="list-group dashboard-widget">
                    {% for payment in payments %}
                        <li class="list-group-item">
                            {{ payment_label(payment.status) }}

                            <a href="{{ path('_clients_view', {'id' : payment.client_id}) }}">
                                {{ payment.client }}
                            </a>

                            <div class="float-right">
                                {{ payment.amount|formatCurrency(payment.client.currency) }}
                                <br />
                                <small>
                                    <strong>
                                        {{ 'dashboard.payment.actions.created'|trans }}
                                    </strong>
                                    {{ payment.created|diff }}
                                </small>
                            </div>
                            <br />
                            <small>
                                <strong>
                                    {{ 'dashboard.payment.actions.invoice'|trans }}
                                </strong>
                                <a href="{{ path('_invoices_view', {'id' : payment.invoice}) }}">
                                    #{{ payment.invoice }}
                                </a>
                            </small>
                            <br class="clear" />
                        </li>
                    {% endfor %}
                </ul>
            </div>
            <div class="card-footer text-center border-top-0">
                <a href="{{ path('_payments_index') }}" class="uppercase">
                    {{ 'dashboard.payment.view_all'|trans }}
                </a>
            </div>
        {% else %}
            <div class="card-body">
                <div class="text-center">
                    <h6>
                        {{ 'dashboard.payment.no_payments'|trans }}
                    </h6>
                </div>
            </div>
        {% endif %}
    </div>
</div>
