{% extends "SsoBackendSecurityBundle:User:base.html.twig" %}
{% block title %}{{ parent() }} - Show{% 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 View</h2>
    <ul class="list-group">
        <li class="list-group-item">
            <div class="labelview">Id</div>
            {{ entity.id }}&nbsp;
        </li>
        <li class="list-group-item">
            <div class="labelview">Email</div>
            {{ entity.Email }}&nbsp;
        </li>
        <li class="list-group-item">
            <div class="labelview">Username</div>
            {{ entity.Username }}&nbsp;
        </li>
        <li class="list-group-item">
            <div class="labelview">Enabled</div>
            {{ entity.Enabled ? 'yes' : 'no' }}&nbsp;
        </li>
        <li class="list-group-item">
            <div class="labelview">Last Login</div>
            {{ entity.LastLogin ? entity.LastLogin|date('Y-m-d H:i:s') : 'never' }}&nbsp;
        </li>
    </ul>
    <ul class="list-group">
        <li class="list-group-item">
            <strong>Roles:</strong><br/>
            <ul>
                {% for Role in entity.Roles %}
                    <li>
                        {{ Role }}
                    </li>
                {% endfor %}
            </ul>
        </li>
    </ul>
    <ul class="record_actions clearfix">
        <li>
            <a class="btn btn-success" href="{{ path('_sso_backend_security_user') }}">
                Back to the list
            </a>
        </li>
        <li>
            <a class="btn btn-primary" href="{{ path('_sso_backend_security_user_edit', { 'userId': entity.id }) }}">
                Edit User
            </a>
        </li>
        <li>
            <a class="btn btn-danger" data-toggle="modal" data-target="#confirm-delete"
               data-href="{{ path('_sso_backend_security_user_delete', { 'userId': entity.id}) }}" href="#">Delete
                User</a>
            {#{ form(delete_form) }#}
        </li>
    </ul>

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