{% extends 'layout.twig' %}

{% import 'messagesysteme.twig' as msgSyst %}
{% import 'champs.twig' as form %}

{% block css %}
	<link rel="stylesheet" href="../vendor/almasaeed2010/adminlte/plugins/toastr/toastr.min.css">
{% endblock %}

{% block content %}
	<div class="row">
        <div class="col col-12 col-sm-12">
            <div class="card card-primary card-outline card-tabs">
              <div class="card-header p-0 pt-1 border-bottom-0">
                <ul class="nav nav-tabs" id="custom-tabs-three-tab" role="tablist">
                  <li class="nav-item">
                    <a class="nav-link" id="custom-tabs-three-home-tab" href="?p=admin_config">{{ trad.admin_config1 }}</a>
                  </li>
                  <li class="nav-item">
                    <a class="nav-link" id="custom-tabs-three-profile-tab" href="?p=admin_config6">{{ trad.admin_config6 }}</a>
                  </li>
                  <li class="nav-item">
                    <a class="nav-link" id="custom-tabs-three-messages-tab" href="?p=admin_config2">{{ trad.admin_config2 }}</a>
                  </li>
                  <li class="nav-item">
                    <a class="nav-link" id="custom-tabs-three-settings-tab" href="?p=admin_config3">{{ trad.admin_config3 }}</a>
                  </li>
				  <li class="nav-item">
                    <a class="nav-link" id="custom-tabs-three-profile-tab" href="?p=admin_config7">{{ trad.admin_config7 }}</a>
                  </li>
				  <li class="nav-item">
                    <a class="nav-link active" id="custom-tabs-three-settings-tab" href="?p=admin_config4">{{ trad.admin_config4 }}</a>
                  </li>
				  <li class="nav-item">
                    <a class="nav-link" id="custom-tabs-three-settings-tab" href="?p=admin_config5" >{{ trad.admin_config5 }}</a>
                  </li>
                </ul>
              </div>
              <div class="card-body">
				  <div class="tab-pane active" id="fa-icons">
					{% if trad.dDbSys == "mysql" %}
						<section id="sauvegarde">
							<form action="admin_save_mysql.php" method="get">
								<input type="hidden" name="flag_connect" value="yes" />
								<h4 class="page-header">{{ trad.title_backup }}</h4>
								<p>{{ trad.explain_backup }}</p>
								<p><i>{{ trad.warning_message_backup }}</i></p>
								<input class="btn btn-primary" type="submit" value="{{ trad.submit_backup }}" />
							</form>
						</section>
						{% if trad.dRestaureBBD == 1 %}
							<hr>
							<section id="restauration">
								<form method="post" enctype="multipart/form-data" action="?p=admin_open_mysql">
									<input type="hidden" name="p" value="admin_open_mysql" />
									<h4 class="page-header">{{ trad.Restauration_de_la_base_GRR }}</h4>
									<p>En cas de perte de donnée ou de problème sur la base GRR, cette fonction vous permet de la retrouver dans l'état antérieur lors d'une sauvegarde. Vous devez sélectionner un fichier créé à l'aide de la fonction Lancer une sauvegarde.</p>
									<p><i>Attention! Restaurer la base vous fera perdre toutes les données qu'elle contient actuellement. De plus, tous les utilisateurs présentement connectés, ainsi que vous-mêmes, serez déconnectés. Alors, il est conseillé de créer d'abord une sauvegarde et de vous assurer que vous êtes le seul connecté.</i></p>
									<br><input type="file" name="sql_file" size="30" /><br>
									<input class="btn btn-danger" type="submit" value="{{ trad.Restaurer_la_sauvegarde }}" />
								</form>
							</section>
						{% endif %}
					{% endif %}
					<form action="?p=admin_config4" method="get">
						<input type="hidden" name="p" value="admin_config4" />
						<hr>
						<section id="sauvegardeautomatique">
							<h4 class="page-header">{{ trad.execution_automatique_backup }}</h4>
							<p>{{ trad.execution_automatique_backup_explications |raw }}</p>
							{{ form.input('motdepasse_backup', trad.execution_automatique_backup_mdp, settings.motdepasse_backup, {classGroup: 'col-sm-12', classLabel: 'col-sm-6', classInput: 'col-sm-6 control-label', type: 'password'}) }}
						</section>
						<hr>
						<section id="desactiveconnexion">
							<h4 class="page-header">{{ trad.title_disable_login }}</h4>
							<p>{{ trad.explain_disable_login }}</p>
							<input type="radio" name="disable_login" value="yes" id="label_1" {% if settings.disable_login == 'yes' %} checked {% endif %} /> <label for="label_1">{{ trad.disable_login_on }}</label><br>
							<input type="radio" name="disable_login" value="no" id="label_2" {% if settings.disable_login == 'no' %} checked {% endif %} /> <label for="label_2">{{ trad.disable_login_off }}</label>
						</section>
						<hr>
						<section id="diverssecurite">
							<h4 class="page-header">{{ trad.admin_menu_various }}</h4>
							<table class="table table-condensed">
								<tbody>
									<tr>
										<th style="width: 300px"></th>
										<th style="width: 100px">NON</th>
										<th>OUI</th>
									</tr>
									<tr>
										<td>{{ trad.redirection_https }}</td>
										<td><input type="radio" name="redirection_https" value="no" id="label_3a" {% if settings.redirection_https == 'no' %} checked {% endif %} /></td>
										<td><input type="radio" name="redirection_https" value="yes" id="label_3b" {% if settings.redirection_https == 'yes' %} checked {% endif %} /></td>
									</tr>
									<tr>
										<td>{{ trad.Activer_log_email }}</td>
										<td><input type="radio" name="log_mail" value="0" id="label_4a" {% if settings.log_mail == '0' %} checked {% endif %} /></td>
										<td><input type="radio" name="log_mail" value="1" id="label_4b" {% if settings.log_mail == '1' %} checked {% endif %} /></td>
									</tr>
								</tbody>
							</table>
						</section>
						<hr>
						<section id="ipautorise">
							<h4 class="page-header">{{ trad.title_ip_autorise }}</h4>
							<p>{{ trad.explain_ip_autorise }}</p>
							{{ form.input('ip_autorise', '', settings.ip_autorise, {classGroup: 'col-sm-12', classLabel: 'col-sm-0', classInput: 'col-sm-12 control-label'}) }}
						</section>
						<section id="ipautorise">
							<h4 class="page-header">{{ trad.title_horaire_autorise }}</h4>
							<p>{{ trad.explain_horaire_autorise }}</p>
							<div class="col col-sm-12">
							{{ form.input('horaireconnexionde', 'De', settings.horaireconnexionde, {classGroup: 'col-sm-6', classLabel: 'col-sm-2', classInput: 'col-sm-4 control-label', type: 'time'}) }}
							{{ form.input('horaireconnexiona', 'A', settings.horaireconnexiona, {classGroup: 'col-sm-6', classLabel: 'col-sm-2', classInput: 'col-sm-4 control-label', type: 'time'}) }}
							</div>
						</section>
						<hr>
						<section id="dureesession">
							<h4 class="page-header">{{ trad.title_session_max_length }}</h4>
							<p>{{ trad.explain_session_max_length }}</p>
							{{ form.input('sessionMaxLength', trad.session_max_length, settings.sessionMaxLength, {classGroup: 'col-sm-12', classLabel: 'col-sm-6', classInput: 'col-sm-6 control-label', type: 'number'}) }}
						</section>
						<hr>
						<section id="motdepasse">
							<h4 class="page-header">{{ trad.pwd }}</h4>
							{{ form.input('pass_leng', trad.pass_leng_explain, settings.pass_leng, {classGroup: 'col-sm-12', classLabel: 'col-sm-6', classInput: 'col-sm-6 control-label', type: 'number'}) }}
							{{ form.input('pass_nb_min', trad.pass_nb_min, settings.pass_nb_min, {classGroup: 'col-sm-12', classLabel: 'col-sm-6', classInput: 'col-sm-6 control-label', type: 'number'}) }}
							{{ form.input('pass_nb_maj', trad.pass_nb_maj, settings.pass_nb_maj, {classGroup: 'col-sm-12', classLabel: 'col-sm-6', classInput: 'col-sm-6 control-label', type: 'number'}) }}
							{{ form.input('pass_nb_ch', trad.pass_nb_ch, settings.pass_nb_ch, {classGroup: 'col-sm-12', classLabel: 'col-sm-6', classInput: 'col-sm-6 control-label', type: 'number'}) }}
							{{ form.input('pass_nb_sp', trad.pass_nb_sp, settings.pass_nb_sp, {classGroup: 'col-sm-12', classLabel: 'col-sm-6', classInput: 'col-sm-6 control-label', type: 'number'}) }}
						</section>
						<hr>
						<section id="urldeconnexion">
							<h4 class="page-header">{{ trad.Url_de_deconnexion }}</h4>
							<p>{{ trad.Url_de_deconnexion_explain }}</p>
							<p><i>{{ trad.Url_de_deconnexion_explain2 }}</i></p>
							{{ form.input('url_disconnect', '', settings.url_disconnect, {classGroup: 'col-sm-12', classLabel: 'col-sm-0', classInput: 'col-sm-12 control-label'}) }}
						</section>
						<br>
						<div style="text-align:center;"><input class="btn btn-primary" type="submit" name="ok" value="{{ trad.save }}" /></div>
					</form>
				  </div><!-- /.tab-pan -->
			  </div><!-- /.card-body -->

			</div><!-- /.card-primary -->
		</div><!-- /.col -->
	</div><!-- /.row -->

{% endblock %}

{% block javascript %}
	<script src="../vendor/almasaeed2010/adminlte/plugins/toastr/toastr.min.js"></script>
	<script>
		$(function () {
			{%if d.enregistrement%}
				{%if d.enregistrement == 1 %}
					toastr.success("{{trad.message_records}}")
				{% else %}
					toastr.warning("{{d.enregistrement|raw}}")
				{%endif%}
			{%endif%}
		}); 
	</script>
{% endblock %}