{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
*  it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
*  License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
#}


{%  extends "@ChillMain/layout.html.twig" %}


{% block title %}{{"user.profile.title"|trans}}{% endblock %}

{% block content %}
    <div class="justify-content-center col-10">
        <h1>{{ 'user.profile.title'|trans }}</h1>


        <dl>
            <dt>{{ 'Job'|trans }}</dt>
            {% if user.getUserJob is not null %}
                <dd>{{ user.getUserJob.label|localize_translatable_string }}</dd>
            {% else %}
                <dd class="chill-no-data-statement">{{ 'user.profile.no job'|trans }}</dd>
            {% endif %}
            <dt>{{ 'Scope'|trans }}</dt>
            {% if user.getMainScope is not null %}
                <dd>{{ user.getMainScope.name|localize_translatable_string }}</dd>
            {% else %}
                <dd class="chill-no-data-statement">{{ 'user.profile.no scope'|trans }}</dd>
            {% endif %}
        </dl>
        <div>
            {{ form_start(form) }}
            {{ form_row(form.phonenumber) }}
            {{ form_row(form.locale) }}

            <h2 class="mb-4">{{ 'user.profile.notification_preferences'|trans }}</h2>
            <table class="table table-striped align-middle">
                <thead>
                <tr>
                    <th>{{ 'notification.flags.type'|trans }}</th>
                    <th class="text-center">{{ 'notification.flags.preferences.immediate_email'|trans }}</th>
                    <th class="text-center">{{ 'notification.flags.preferences.daily_email'|trans }}</th>
                </tr>
                </thead>
                <tbody class="table-hover table-group-divider">
                {% for flag in form.notificationFlags %}
                    <tr>
                        <td class="col-sm-6">
                           {{ form_label(flag, null, {'label_attr': {'div_col_width': false}}) }}
                        </td>
                        <td class="text-center">
                            {{ form_widget(flag.immediate_email, {'label_attr': { 'class': 'checkbox-inline checkbox-switch'}}) }}
                        </td>
                        <td class="text-center">
                            {{ form_widget(flag.daily_digest, {'label_attr': { 'class': 'checkbox-inline checkbox-switch'}}) }}
                        </td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>

            <ul class="record_actions">
                <li>
                    <button type="submit" class="btn btn-save">{{ 'Save'|trans }}</button>
                </li>
            </ul>

            {{ form_end(form) }}
        </div>
    </div>

{% endblock %}
