ninegate/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Group/users.html.twig

171 lines
6.3 KiB
Twig

{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
<h1 class="page-header">Gestion des Utilisateurs</h1>
<h2>Groupe = {{ group.label }}</h2>
{% if idreturn is empty %}
<a class="btn btn-default" href={{ path('cadoles_core_'~access~'_group') }}>Fermer</a>
{% else %}
<a class="btn btn-default" href={{ path('cadoles_core_home',{'id':idreturn}) }}>Fermer</a>
{% endif %}
{% if moderegistration!="none" and masteridentity=="SQL"%}
<a class="btn btn-primary" style="cursor:pointer" onClick="showMail();">Inviter des personnes non listées ci-dessous</a>
{%endif%}
<a class="btn btn-default pull-right" href={{ path('cadoles_core_'~access~'_group_usergroup_export',{'id':group.id}) }}>Exporter CSV</a>
<br><br>
<div class="col-sm-6">
<div class="panel panel-danger">
<div class="panel-heading">
<i class="fa fa-table fa-fw"></i> Liste des Utilisateurs non affectés au groupe
</div>
<div class="panel-body">
<div class="dataTable_wrapper">
<table class="table table-striped table-bordered table-hover" id="dataTablesnotin" style="width:100%">
<thead>
<tr>
<th width="70px" class="no-sort">Action</th>
<th width="70px" class="no-sort">Avatar</th>
<th width="200px">Login</th>
<th>Email</th>
<th class="no-sort">Visite</th>
{% if group.fgcanshare %}
<th class="no-sort">Manager</th>
{% endif %}
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-table fa-fw"></i> Liste des Utilisateurs affectés au groupe
</div>
<div class="panel-body">
<div class="dataTable_wrapper">
<table class="table table-striped table-bordered table-hover" id="dataTablesin" style="width:100%">
<thead>
<tr>
<th width="70px" class="no-sort">Action</th>
<th width="70px" class="no-sort">Avatar</th>
<th width="200px">Login</th>
<th>Email</th>
<th class="no-sort">Visite</th>
{% if group.fgcanshare %}
<th class="no-sort">Manager</th>
{% endif %}
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
$('#dataTablesnotin').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false },{ "targets": 'no-visible', "visible": false } ],
responsive: true,
iDisplayLength: 100,
order: [[ 2, "asc" ]],
processing: true,
serverSide: true,
ajax: "{{ path('cadoles_core_'~access~'_group_ajax_usersnotin',{'id':group.id}) }}",
});
$('#dataTablesin').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false },{ "targets": 'no-visible', "visible": false } ],
responsive: true,
iDisplayLength: 100,
order: [[ 2, "asc" ]],
processing: true,
serverSide: true,
ajax: {
"url": "{{ path('cadoles_core_'~access~'_group_ajax_usersin',{'id':group.id}) }}",
"data": function ( d ) {
return $.extend( {}, d, {
"fgcanshare": "{{ group.fgcanshare }}"
});
}
},
"drawCallback": function(settings) {
$(".switch").bootstrapSwitch();
},
});
});
function addUsers(userid) {
$.ajax({
rowId: 2,
method: "POST",
url: "{{ path('cadoles_core_'~access~'_group_ajax_usergroup_add') }}",
data: "userid="+userid+"&groupid="+{{ group.id }},
success: function(data, dataType)
{
var row=$("#dataTablesnotin").DataTable().row("#user"+userid);
var rowNode = row.node();
row.remove().draw();
$("#dataTablesin").DataTable().row.add(rowNode).draw();
},
error: function(XMLHttpRequest, textStatus, errorThrown)
{
}
});
}
function delUsers(userid) {
$.ajax({
rowId: 2,
method: "POST",
url: "{{ path('cadoles_core_'~access~'_group_ajax_usergroup_del') }}",
data: "userid="+userid+"&groupid="+{{ group.id }},
success: function(data, dataType)
{
var row=$("#dataTablesin").DataTable().row("#user"+userid);
var rowNode = row.node();
row.remove().draw();
$("#dataTablesnotin").DataTable().row.add(rowNode).draw();
},
error: function(XMLHttpRequest, textStatus, errorThrown)
{
}
});
}
function switchManager(id) {
$.ajax({
method: "POST",
url: "{{ path('cadoles_core_'~access~'_group_ajax_switchmanager') }}",
data: {
"group": {{ group.id }},
"user": id,
}
});
}
function showMail() {
$("#mymodal").find(".modal-title").html("INVITATION");
var url="{{ path('cadoles_core_mail_invitationgroup',{id:group.id}) }}";
$("#mymodal").find("#framemodal").attr("src",url);
$("#mymodal").modal().show();
}
{% endblock %}