{% extends 'base.html.twig' %}

{% block body %}
    <h1>Kullanıcı Düzenleme</h1>
    <ul>
        <li>
            <a href="{{ path('person_index') }}">Listeye Geri Dön</a>
        </li>

    </ul>
    <script type="text/javascript">
        $(document).ready(function () {
            var allRoles = [];
            {% for role in person.roles %}
            allRoles.push("{{ role }}");
            {% endfor %}
            $("#person_roles option").each(function () {
                for(var i=0; i<allRoles.length; i++){
                    if ($(this).text() === allRoles[i]) {
                        $(this).attr('selected', 'selected');
                    }
                }

            });
        });
    </script>
    {{ form_start(edit_form) }}
    {{ form_widget(edit_form) }}
    <input type="submit" value="Düzenle"/>
    {{ form_end(edit_form) }}
    <ul>
        <li>
            {{ form_start(delete_form) }}
            <input type="submit" onclick="return confirm('Silmek istediğinize emin misiniz?');" value="Sil">
            {{ form_end(delete_form) }}
        </li>
    </ul>
{% endblock %}
