-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[291/327/319] Amélioration administration - A review (#389)
* [291] La qualité peut être vide à l'édition d'un utilisateur * [327] Correction fil d'ariane groupe * Rename view Allusers * [319] Nouvelle vue utilisateurs * Improve UI
- Loading branch information
Showing
5 changed files
with
199 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
@import models._ | ||
@(currentUser: User)(userGroups: List[UserGroup], allUsers: List[User], applications: List[Application], selectedArea: Area, geoplusHost: String)(implicit webJarsUtil: org.webjars.play.WebJarsUtil, flash: Flash, request: RequestHeader) | ||
|
||
|
||
@main(currentUser, maxWidth = false)(s"Gestion des groupes utilisateurs - ${selectedArea.name}") { | ||
@webJarsUtil.locate("tabulator.min.css").css() | ||
@webJarsUtil.locate("tabulator.min.js").script() | ||
<style> | ||
.row--disabled { | ||
background-color: grey !important; | ||
text-decoration: line-through; | ||
} | ||
</style> | ||
}{ | ||
@if(currentUser.admin) { | ||
<a class="mdl-button mdl-js-button mdl-button--raised mdl-cell mdl-cell--4-offset mdl-cell--4-col mdl-cell--12-col-phone" href="@routes.UserController.all(selectedArea.id)?vue=classique">Vue utilisateurs classique</a> | ||
<a class="mdl-button mdl-js-button mdl-button--raised mdl-cell mdl-cell--4-col mdl-cell--12-col-phone" href="@routes.CSVImportController.importUsersFromCSV()">Importer utilisateurs</a> | ||
} | ||
@if(currentUser.areas.length > 1) { | ||
<p class="mdl-cell mdl-cell--12-col">Territoire : | ||
<select id="area-selector" name="area-selector" onchange="changeAreaApps()"> | ||
<option value="@Area.allArea.id" @if(selectedArea.id == Area.allArea.id) { selected }>tous les territoires</option> | ||
@for(area <- currentUser.areas.flatMap(Area.fromId)) { | ||
<option value="@area.id" @if(selectedArea.id == area.id) { selected }>@area</option> | ||
} | ||
</select> | ||
<script> | ||
function changeAreaApps() { | ||
var areaSelected = document.getElementById("area-selector").value; | ||
if(areaSelected != "@selectedArea.id") { | ||
document.location = jsRoutes.controllers.UserController.all(areaSelected).url + "?vue=nouvelle"; | ||
} | ||
} | ||
</script> | ||
</p> | ||
} | ||
<div id="users-table"></div> | ||
|
||
<script> | ||
var verticalHeader = false; | ||
var tabledata = [ | ||
@for(user <- allUsers) { | ||
{ | ||
id: "@user.id", | ||
name: "@user.name", | ||
email: "@user.email", | ||
qualite: "@user.qualite", | ||
helper: @user.helper, | ||
instructor: @user.instructor, | ||
areas: [ | ||
@for(area <- user.areas.flatMap(Area.fromId).map(_.toString)){ | ||
"@area", | ||
} | ||
], | ||
groups: [ | ||
@for(group <- user.groupIds.flatMap( groupId => userGroups.find( _.id == groupId ) ).map(_.name)){ | ||
"@group", | ||
} | ||
], | ||
groupAdmin: @user.groupAdmin, | ||
admin: @user.admin, | ||
expert: @user.expert, | ||
disabled: @user.disabled | ||
}, | ||
} | ||
]; | ||
|
||
var editIcon = function(cell, formatterParams) { | ||
//plain text value | ||
return "<i class='fas fa-user-edit'></i>"; | ||
}; | ||
|
||
var rawFormatter = function(row) { | ||
var element = row.getElement(), | ||
data = row.getData(); | ||
if (data.disabled) { | ||
element.classList.add("row--disabled"); | ||
} | ||
}; | ||
|
||
var table = new Tabulator("#users-table", { | ||
height: "80vh", // set height of table (in CSS or here), this enables the Virtual DOM and improves render speed dramatically (can be any valid css height value) | ||
data: tabledata, //assign data to table | ||
rowFormatter: rawFormatter, | ||
langs: { | ||
"fr-fr": { | ||
pagination: { | ||
page_size: "Taille de la page", | ||
first: "Premier", | ||
first_title: "Première Page", | ||
last: "Dernier", | ||
last_title: "Dernière Page", | ||
prev: "Précédent", | ||
prev_title: "Page Précédente", | ||
next: "Suivant", | ||
next_title: "Page Suivante" | ||
}, | ||
headerFilters: { | ||
default: "filtrer..." //default header filter placeholder text | ||
} | ||
} | ||
}, | ||
columns: [ | ||
{ | ||
formatter: editIcon, | ||
width: 40, | ||
align: "center", | ||
cellClick: function(e, cell) { | ||
var uuid = cell.getRow().getData().id; | ||
var url = jsRoutes.controllers.UserController.editUser(uuid).url; | ||
window.location = url; | ||
} | ||
}, | ||
{ title: "Nom et Prénom", field: "name", headerFilter: "input" }, | ||
{ title: "Email", field: "email", headerFilter: "input" }, | ||
{ title: "Qualité", field: "qualite", headerFilter: "input" }, | ||
{ | ||
title: "Droits", | ||
columns: [ | ||
{ | ||
title: "Aidant", | ||
field: "helper", | ||
formatter: "tickCross", | ||
headerFilter: "tickCross", | ||
headerFilterParams: { tristate: true }, | ||
headerVertical: verticalHeader, | ||
bottomCalc: "count" | ||
}, | ||
{ | ||
title: "Instructeur", | ||
field: "instructor", | ||
formatter: "tickCross", | ||
headerFilter: "tickCross", | ||
headerFilterParams: { tristate: true }, | ||
headerVertical: verticalHeader, | ||
bottomCalc: "count" | ||
}, | ||
{ | ||
title: "Responsable", | ||
field: "groupAdmin", | ||
formatter: "tickCross", | ||
headerFilter: "tickCross", | ||
headerFilterParams: { tristate: true }, | ||
headerVertical: verticalHeader, | ||
bottomCalc: "count" | ||
}, | ||
{ | ||
title: "Expert", | ||
field: "expert", | ||
formatter: "tickCross", | ||
headerFilter: "tickCross", | ||
headerFilterParams: { tristate: true }, | ||
headerVertical: verticalHeader, | ||
bottomCalc: "count" | ||
}, | ||
{ | ||
title: "Admin", | ||
field: "admin", | ||
formatter: "tickCross", | ||
headerFilter: "tickCross", | ||
headerFilterParams: { tristate: true }, | ||
headerVertical: verticalHeader, | ||
bottomCalc: "count" | ||
}, | ||
{ | ||
title: "Désactivé", | ||
field: "disabled", | ||
formatter: "tickCross", | ||
headerFilter: "tickCross", | ||
headerFilterParams: { tristate: true }, | ||
headerVertical: verticalHeader, | ||
bottomCalc: "count" | ||
} | ||
] | ||
}, | ||
{ title: "Groupes", field: "groups", headerFilter: "input" }, | ||
{ title: "Départements", field: "areas", headerFilter: "input" }, | ||
] | ||
}); | ||
table.setLocale("fr-fr"); | ||
table.setSort("name", "asc"); | ||
</script> | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
<script src='@routes.Assets.versioned("javascripts/group-autocomplete.js")'></script> | ||
}{ | ||
<div class="mdl-cell mdl-cell--12-col mdl-grid--no-spacing"> | ||
<span class="mdl-cell mdl-cell--12-col ariane">Territoires : @userGroup.areaIds.foreach{ areaId => | ||
<span class="mdl-cell mdl-cell--12-col ariane">Territoires : @for(areaId <- userGroup.areaIds) { | ||
<a href="@routes.UserController.all(areaId)#[email protected]">@{Area.fromId(areaId).get.name}</a> | ||
} / Groupe : @userGroup.name </span> | ||
@helper.form(routes.GroupController.editGroupPost(userGroup.id), 'method -> "post") { | ||
|