{% extends '@LcShop/backend/default/show.html.twig' %}

{% trans_default_domain 'lcshop' %}
{% block main %}

    <div class="row">
        <div class="col-12">
            <div class="card card-outline card-primary">
                <div class="card-header">
                    <h2 class="card-title text-lg ">
                        {{ entity.user.summary }} : <strong>{{ entity.credit }}€</strong>
                    </h2>
                    <button type="button" class="btn btn-primary float-right" data-toggle="modal"
                            data-target="#modal-add-credit-history">
                        {{ "action.credit.add"|trans }}
                    </button>
                </div>

                <div class="card-body p-0">

                    <table class="table datatable-simple table-bordered table-hover table-striped">

                        <thead>
                        <tr>
                            <th data-index="0" class="" data-searchable="text">Id</th>
                            <th data-index="1" class="" data-searchable="select-text">Type</th>
                            <th data-index="2" class="" data-searchable="input">Amount</th>
                            <th data-index="3" class="" data-searchable="input">MeanPayment</th>
                            <th data-index="4" class="" data-searchable="date">PaidAt</th>
                            <th data-index="5" class="" data-searchable="input">Reference</th>
                            <th data-index="6" class="" data-searchable="text">Comment</th>
                        </tr>
                        </thead>
                        <tbody>
                        {% for creditHistory in entity.creditHistories %}
                            <tr draggable="true" rel="{{ creditHistory.id }}" data-id="{{ creditHistory.id }}">

                                <td class="sorted">{{ creditHistory.id }}</td>
                                <td class="association">{{ creditHistory.type }}</td>
                                <td class="">{{ creditHistory.amountInherited }} €</td>
                                <td class="">{{ creditHistory.meanPaymentInherited  }}</td>
                                <td class="">{{ creditHistory.paidAtInherited |date('d-m-y') }}</td>
                                <td class="">{{ creditHistory.referenceInherited  }}</td>
                                <td class="">{{ creditHistory.commentInherited  }}</td>
                            </tr>

                        {% else %}
                            <tr>
                                <td class="no-results" colspan="7">
                                    {{ 'search.no_results'|trans(_trans_parameters, 'EasyAdminBundle') }}
                                </td>
                            </tr>
                        {% endfor %}

                        </tbody>
                        <tfoot></tfoot>
                    </table>
                </div>
            </div>
        </div>
    </div>
    {% include 'LcShopBundle:backend/usermerchant:modal_addcredithistory.html.twig' %}
{% endblock main %}

{% block head_stylesheets %}
    {{ parent() }}
    <link rel="stylesheet" href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/datatables/fixedHeader.dataTables.min.css') }}">
    <link rel="stylesheet"
          href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/datatables/dataTables.bootstrap4.min.css') }}">
{% endblock %}

{% block plugin_javascript %}
    {{ parent() }}

    <script src="{{ asset('bundles/lcshop/js/backend/plugin/datatables/jquery.dataTables.min.js') }}"></script>
    <script src="{{ asset('bundles/lcshop/js/backend/plugin/datatables/dataTables.bootstrap4.min.js') }}"></script>
    <script src="{{ asset('bundles/lcshop/js/backend/plugin/datatables/dataTables.responsive.min.js') }}"></script>
    <script src="{{ asset('bundles/lcshop/js/backend/plugin/datatables/jquery.highlight.js') }}"></script>
    <script src="{{ asset('bundles/lcshop/js/backend/plugin/datatables/responsive.bootstrap4.min.js') }}"></script>
    <script src="{{ asset('bundles/lcshop/js/backend/plugin/datatables/dataTables.fixedHeader.min.js') }}"></script>
{% endblock %}

{% block script_javascript %}
    {{ parent() }}
    <script src="{{ asset('bundles/lcshop/js/backend/script/default/init-list.js') }}"></script>
{% endblock %}


