73 lines
3.3 KiB
Twig
73 lines
3.3 KiB
Twig
{% extends '@CadolesCore/base.html.twig' %}
|
|
|
|
{% block pagewrapper %}
|
|
<h1 class="page-header">Import Utilisateurs</h1>
|
|
|
|
<div class="panel panel-primary">
|
|
<div class="panel-heading">
|
|
<i class="fa fa-table fa-fw"></i>Importer votre fichier CSV
|
|
</div>
|
|
|
|
<div class="panel-body">
|
|
<div class="dataTable_wrapper">
|
|
<a class="btn btn-info" style="width:100%; margin-bottom:15px;" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Importuser','{{ path('cadoles_core_config_importuser_file') }}');" title='Ajouter un avatar'>Importer Fichier CSV</a>
|
|
<input type="text" id="file_value" name="file_value" required="required" class="form-control form-control" style="margin-bottom:15px">
|
|
</div>
|
|
|
|
Colonnes possibles<br>
|
|
<code>
|
|
login;prenom;nom;email;niveau01;niveau02;metier;fonction;nomusage;sexe;autreprenom;telephone;adresse;datenaissance;pays;ville;visible;role
|
|
</code><br><br>
|
|
Colonne obligatoire = login / nom / email / niveau01<br><br>
|
|
Sexe = vide / male / female<br>
|
|
Visible = vide / oui / non<br>
|
|
Rôle = vide / ROLE_USER / ROLE_MODO / ROLE_ADMIN<br><br>
|
|
Niveau01 & Niveau02 & Pays & Ville = doivent exister dans la base<br><br>
|
|
|
|
Importation impossible si login et/ou email déjà existant en base<br>
|
|
A chaque création un mail sera envoyé à l'utilisateur pour lui préciser qu'il est inscrit et qu'il devra suivre le process de reinitialisation de password pour ce connecter au portail.
|
|
</div>
|
|
</div>
|
|
|
|
<a id="exec" class="btn btn-danger" style="width:100%; margin-bottom:15px;" >EXECUTER L'IMPORT</a>
|
|
|
|
<div id='info'></div>
|
|
{% endblock %}
|
|
|
|
{% block localjavascript %}
|
|
$(document).ready(function() {
|
|
$( "#exec" ).click(function() {
|
|
if($("#file_value").val()=="")
|
|
alert( "Vous devez importer un fichier CSV" );
|
|
else {
|
|
$("#info").html("");
|
|
$("#info").append("<h1>Importation Utilisateur</h1>");
|
|
$("#info").append("<h2>Contrôle Cohérance du Fichier</h2>");
|
|
|
|
$.ajax({
|
|
method: "POST",
|
|
url: "{{ path('cadoles_core_config_importuser_filectrl') }}",
|
|
data: {
|
|
file:$("#file_value").val(),
|
|
},
|
|
success: function(data) {
|
|
console.log(data);
|
|
|
|
if(data.status=="OK") {
|
|
$("#info").append("<p>Fichier correct</p>");
|
|
|
|
$("#info").append("<h2>Importation</h2>");
|
|
$("#info").append("<p>"+data.users+"</p>");
|
|
}
|
|
else {
|
|
$("#info").append("<p style='color:red'>Fichier incorrect</p>");
|
|
$("#info").append("<p style='color:red'>Merci de corriger votre fichier</p>");
|
|
$("#info").append("<p style='color:red'>"+data.error+"</p>");
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
});
|
|
{% endblock %}
|