{% extends "LifeStyleToolsBackendSecurityBundle:User:base.html.twig" %}

{% block title %}{{ parent() }} - List{% endblock %}

{% block body %}
    <div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
         aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h2>Do you really want to delete this user?</h2>
                </div>
                <div class="modal-body">
                    <p>You are about to delete one user, this procedure is irreversible.</p>
                    <p>Do you want to proceed?</p>
                    <p>We hope that you know what you do!</a>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                    <a href="#" class="btn btn-danger danger">Delete</a>
                </div>
            </div>
        </div>
    </div>
    <h2>Admin User</h2>
    <p><strong>This part is for administration of backend administration users!</strong></p>
    <div class="row">
        <div class="col-md-12 col-ld-12">
            <table class="table table-striped table-bordered table-condensed">
                <thead>
                <tr>
                    <th>Id</th>
                    <th>Username</th>
                    <th>Email</th>
                    <th>Name</th>
                    <th>Organisation</th>
                    <th>Status</th>
                    <th>Actions</th>
                </tr>
                </thead>
                <tbody>
                {% for entity in entities %}
                    <tr>
                        <td>{{ entity.Id }}</td>
                        <td>{{ entity.Username }}</td>
                        <td>{{ entity.Email }}</td>
                        <td>{{ entity.Firstname }} {{ entity.Lastname }}</td>
                        <td>{{ entity.Organisation }}</td>
                        <td>

                        <td>
                            <a class="btn btn-default btn-xs"
                               href="{{ path('_lifestyle_backend_security_user_edit', { 'userId': entity.id }) }}">
                                edit
                            </a>
                            <a class="btn btn-success btn-xs"
                               href="{{ path('_lifestyle_backend_security_user_show', { 'userId': entity.id }) }}">
                                show
                            </a>
                            <a class="btn btn-danger btn-xs" data-toggle="modal" data-target="#confirm-delete"
                               data-href="{{ path('_lifestyle_backend_security_user_delete', {'userId': entity.id}) }}"
                               href="#">
                                delete
                            </a>
                        </td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        </div>

        <div class="col-md-12 col-ld-12">
            <a class="btn btn-primary likepaginator" href="{{ path('_lifestyle_backend_security_user_new') }}">
                new User
            </a>
        </div>
    </div>

    <script>
        $(function () {
            $('#confirm-delete').on('show.bs.modal', function (e) {
                $(this).find('.danger').attr('href', $(e.relatedTarget).data('href'));
            });
        });
    </script>
{% endblock %}