{% extends "account/base.html.twig" %}

{% import "common/macros.html.twig" as auth_macro %}

{% set selected = "informations" %}

{% block stylesheet %}
    <link rel="stylesheet" type="text/css" href="{{ path('minifier', { 'f' : 'skins/geonames/geonames.css' }) }}">
    {{ parent() }}
{% endblock %}

{% block javascript %}
    {{ parent() }}
    <script type="text/javascript" language="javascript" src="{{ path('minifier', { 'f' : '/skins/account/account.js,assets/geonames-server-jquery-plugin/jquery.geonames.js,scripts/common/geonames.js' }) }}"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            geonames.init($("#form_geonameid"), {
                "server": "{{ app['geonames.server-uri'] }}",
                "limit": 40
            });
        });
    </script>
{% endblock %}

{% block title %}
    {% trans "login:: Mon compte" %}
{% endblock %}

{% block content_account %}
    <div class="row-fluid">
        <div class="span12">
            {{ auth_macro.flashes() }}

            <form name="account" id="account" class="form-horizontal" action="{{ path("submit_update_account") }}" method="post">
                <div class="row-fluid">
                    <div class="span12 well well-small" id="phr-account">
                        <legend>{% trans "Informations personnelles" %}</legend>
                        <div class="control-group">
                            <label class="form_label control-label" for="form_login"><strong>{% trans "admin::compte-utilisateur identifiant" %}</strong></label>
                            <div class="controls">
                                <span class="control-span">{{ app["authentication"].getUser().get_login() }}</span>
                                <p class="form_alert help-block"></p>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="form_label control-label" for="form_gender"><strong>{% trans "admin::compte-utilisateur sexe" %}</strong></label>
                            <div class="controls">
                                <select name="form_gender" class="input-xlarge">
                                    <option value=""></option>
                                    <option {% if app["authentication"].getUser().get_gender() == "0" %}selected{% endif %} value="0" >
                                        {% trans "admin::compte-utilisateur:sexe: mademoiselle" %}
                                    </option>
                                    <option {% if app["authentication"].getUser().get_gender() == "1" %}selected{% endif %} value="1" >
                                        {% trans "admin::compte-utilisateur:sexe: madame" %}
                                    </option>
                                    <option {% if app["authentication"].getUser().get_gender() == "2" %}selected{% endif %} value="2" >
                                        {% trans "admin::compte-utilisateur:sexe: monsieur" %}
                                    </option>
                                </select>
                                <p class="form_alert help-block"></p>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="form_label control-label" for="form_lastname"><strong>{% trans "admin::compte-utilisateur nom" %}</strong></label>
                            <div class="controls">
                                <input class="input_element input-xlarge" type="text" name="form_lastname" id="form_lastname" value="{{ app["authentication"].getUser().get_lastname() }}" />
                                <p class="form_alert help-block"></p>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="form_label control-label" for="form_firstname"><strong>{% trans "admin::compte-utilisateur prenom" %}</strong></label>
                            <div class="controls">
                                <input class="input_element input-xlarge" type="text" name="form_firstname" id="form_firstname" value="{{ app["authentication"].getUser().get_firstname() }}" />
                                <p class="form_alert help-block"></p>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="form_label control-label" for="form_firstname"><strong>{% trans "admin::compte-utilisateur email" %}</strong></label>
                            <div class="controls">
                                <span class="control-span">{{ app["authentication"].getUser().get_email() }} <a href="{{ path("account_reset_email") }}" target="_self">{% trans "login:: Changer mon adresse email" %}</a></span>
                                <p class="form_alert help-block"></p>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><strong>{% trans "Password" %}</strong></label>
                            <div class="controls">
                                <span class="control-span"><a href="{{ path("reset_password") }}" target="_self">{% trans "admin::compte-utilisateur changer mon mot de passe" %}</a></span>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="form_label control-label" for="form_address"><strong>{% trans "admin::compte-utilisateur adresse" %}</strong></label>
                            <div class="controls">
                                <input class="input_element input-xlarge" type="text" name="form_address" id="form_address" value="{{ app["authentication"].getUser().get_address() }}" />
                                <p class="form_alert help-block"></p>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="form_label control-label" for="form_zip"><strong>{% trans "admin::compte-utilisateur code postal" %}</strong></label>
                            <div class="controls">
                                <input class="input_element input-xlarge" type="text" name="form_zip" id="form_zip" value="{{ app["authentication"].getUser().get_zipcode() }}" />
                                <p class="form_alert help-block"></p>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="form_label control-label" for="form_city"><strong>{% trans "admin::compte-utilisateur ville" %}</strong></label>
                            <div class="controls">
                                <input class="input_element input-xlarge geoname_field" type="text" name="form_geonameid" id="form_geonameid" value="{{ app["authentication"].getUser().get_geonameid() }}" />
                                <p class="form_alert help-block"></p>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="form_label control-label" for="form_function"><strong>{% trans "admin::compte-utilisateur poste" %}</strong></label>
                            <div class="controls">
                                <input class="input_element input-xlarge" type="text" name="form_function" id="form_function" value="{{ app["authentication"].getUser().get_position() }}" />
                                <p class="form_alert help-block"></p>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="form_label control-label" for="form_company"><strong>{% trans "admin::compte-utilisateur societe" %}</strong></label>
                            <div class="controls">
                                <input class="input_element input-xlarge" type="text" name="form_company" id="form_company" value="{{ app["authentication"].getUser().get_company() }}" />
                                <p class="form_alert help-block"></p>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="form_label control-label" for="form_activity"><strong>{% trans "admin::compte-utilisateur activite" %}</strong></label>
                            <div class="controls">
                                <input class="input_element input-xlarge" type="text" name="form_activity" id="form_activity" value="{{ app["authentication"].getUser().get_job() }}" />
                                <p class="form_alert help-block"></p>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="form_label control-label" for="form_phone"><strong>{% trans "admin::compte-utilisateur telephone" %}</strong></label>
                            <div class="controls">
                                <input class="input_element input-xlarge" type="text" name="form_phone" id="form_phone" value="{{ app["authentication"].getUser().get_tel() }}" />
                                <p class="form_alert help-block"></p>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="form_label control-label" for="form_fax"><strong>{% trans "admin::compte-utilisateur fax" %}</strong></label>
                            <div class="controls">
                                <input class="input_element input-xlarge" type="text" name="form_fax" id="form_fax" value="{{ app["authentication"].getUser().get_fax() }}" />
                                <p class="form_alert help-block"></p>
                            </div>
                        </div>

                        <legend>{% trans "Notification par email" %}</legend>

                        {% for notification_group, nots in notifications%}
                            <div class="control-group">
                                <span class="pull-left"><strong>{{ notification_group }}</strong></span>
                                <div class="controls">
                                    <ul class="unstyled well">
                                        {% for notification in nots %}
                                            <li>
                                                <label class="checkbox" for="notif_{{ notification["id"] }}">
                                                    <input type="checkbox" id="notif_{{ notification["id"] }}" name="notifications[{{ notification["id"] }}]" {% if not app["authentication"].getUser().get_notifications_preference(app, notification["id"]) == "0" %}checked{% endif %} value="1"/>
                                                    {{ notification["description"] }}
                                                </label>
                                                <p class="form_alert help-block"></p>
                                            </li>
                                        {% endfor %}
                                    </ul>
                                </div>
                            </div>
                        {% endfor %}

                        <legend>{% trans "FTP" %}</legend>

                        <div class="control-group">
                            <div class="controls">
                                <label class="form_label checkbox" for="form_activeFTP">{% trans "admin::compte-utilisateur:ftp: Activer le compte FTP" %}
                                    <input class="input_element input-xlarge" type="checkbox" name="form_activeFTP" id="form_activeFTP" {% if app["authentication"].getUser().get_activeftp() %}checked{% endif %} onchange="if(this.checked){$('#ftpinfos').slideDown();}else{$('#ftpinfos').slideUp();}" />
                                </label>
                                <p class="form_alert help-block"></p>
                            </div>
                        </div>

                        <div id="ftpinfos" style="display:{% if app["authentication"].getUser().get_activeftp() %}block{% else %}none{% endif %}">
                            <div class="control-group">
                                <label class="form_label control-label" for="form_addrFTP"><strong>{% trans "phraseanet:: adresse" %}</strong></label>
                                <div class="controls">
                                    <input class="input_element input-xlarge" type="text" name="form_addrFTP" id="form_addrFTP" value="{{ app["authentication"].getUser().get_ftp_address() }}" />
                                    <p class="form_alert help-block"></p>
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="form_label control-label" for="form_loginFTP"><strong>{% trans "admin::compte-utilisateur identifiant" %}</strong></label>
                                <div class="controls">
                                    <input class="input_element input-xlarge" type="text" name="form_loginFTP" id="form_loginFTP" value="{{ app["authentication"].getUser().get_ftp_login() }}" />
                                    <p class="form_alert help-block"></p>
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="form_label control-label" for="form_pwdFTP"><strong>{% trans "admin::compte-utilisateur mot de passe" %}</strong></label>
                                <div class="controls">
                                    <input class="input_element input-xlarge" type="text" name="form_pwdFTP" id="form_pwdFTP" value="{{ app["authentication"].getUser().get_ftp_password() }}" />
                                    <p class="form_alert help-block"></p>
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="form_label control-label" for="form_destFTP"><strong>{% trans "admin::compte-utilisateur:ftp:  repertoire de destination ftp" %}</strong></label>
                                <div class="controls">
                                    <input class="input_element input-xlarge" type="text" name="form_destFTP" id="form_destFTP" value="{{ app["authentication"].getUser().get_ftp_dir() }}" />
                                    <p class="form_alert help-block"></p>
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="form_label control-label" for="form_prefixFTPfolder"><strong>{% trans "admin::compte-utilisateur:ftp: prefixe des noms de dossier ftp" %}</strong></label>
                                <div class="controls">
                                    <input class="input_element input-xlarge" type="text" name="form_prefixFTPfolder" id="form_prefixFTPfolder" value="{{ app["authentication"].getUser().get_ftp_dir_prefix() }}" />
                                    <p class="form_alert help-block"></p>
                                </div>
                            </div>
                            <div class="control-group">
                                <div class="controls">
                                    <label class="form_label checkbox" for="form_passifFTP">
                                        {% trans "admin::compte-utilisateur:ftp: Utiliser le mode passif" %}
                                        <input class="input_element input-xlarge" type="checkbox" name="form_passifFTP" id="form_passifFTP" {% if app["authentication"].getUser().get_ftp_passif() == "1" %}checked{% endif %} />
                                    </label>
                                    <p class="form_alert help-block"></p>
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="form_label control-label" for="form_retryFTP"><strong>{% trans "admin::compte-utilisateur:ftp: Nombre d\'essais max" %}</strong></label>
                                <div class="controls">
                                    <input class="input_element input-xlarge" type="text" name="form_retryFTP" id="form_retryFTP" value="5" />
                                    <p class="form_alert help-block"></p>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-actions">
                        <input type="submit" class="btn btn-info btn-" value="{% trans "boutton::valider" %}">
                    </div>
                </div>
            </form>
        </div>
    </div>
{% endblock %}
