Archived
1
0
Fork 0

Users management rework

This commit is contained in:
Ethanell 2020-09-29 14:56:47 +02:00
parent 3c5cb22975
commit 41dad395b2
4 changed files with 88 additions and 73 deletions

View file

@ -1,4 +1,4 @@
document.querySelectorAll("a.remove")
document.querySelectorAll(".delete")
.forEach(e => e.addEventListener("click", ev => {
if (!confirm("Do you really want to remove this user ?"))
ev.preventDefault();

View file

@ -1,34 +1,41 @@
extends ../../layout
block content
div.card#usersManagement
div.container
h1=__("admin.new")+" "+__("admin.user")
div.row
form(action="/admin/users/add" method="POST")
h1=__("register.title")
div.field
label(for="username")=__("username") + ":"
div.row
div.input-field.col.s12
input#username(type="text" name="username" required)
div.field
label(for="email")=__("email") + ":"
label(for="username")=__("username") + ":"
div.row
div.input-field.col.s12
input#email(type="email" name="email" required)
div.field
label(for="firstName")=__("firstName") + ":"
label(for="email")=__("email") + ":"
div.row
div.input-field.col.s6
input#firstName(type="text" name="firstName" required)
div.field
label(for="lastName")=__("lastName") + ":"
label(for="firstName")=__("firstName") + ":"
div.input-field.col.s6
input#lastName(type="text" name="lastName" required)
div.field
label(for="department")=__("department") + ":"
+list("department", "department-list", "department", "", "off", true)
div.field
label(for="password")=__("password") + ":"
input#password(type="password" name="password" required)
div.field
label(for="permissions")=__("admin.permissions")
input#permissions(type="number" min="0" max="3" value="0" name="permissions")
div.field
input(type="submit" value=__("register.submit"))
datalist#department-list
label(for="lastName")=__("lastName") + ":"
div.row
div.input-field.col.s12
select(name="department" required)
option(value="" disabled selected hidden)=__("chooseDepartment")
each department in departments
option(value=department.name)
option(value=department.name)=department.name
label=__("department") + ":"
div.row
div.input-field.col.s12
input#password(type="password" name="password" required)
label(for="password")=__("password") + ":"
div.row
div.input-field.col.s12
input#permissions(type="number" min="0" max="3" value="0" name="permissions")
label(for="permissions")=__("admin.permissions")
div.row.center
div.input-field.col.s12
+submit(__("register.submit"))

View file

@ -1,35 +1,41 @@
extends ../../layout
block content
div.card#sandwichesManagement
div.container
h1=__("admin.edit")+" "+targetUser.username
div.row
form(action="/admin/users/edit" method="POST")
h2=__("profile.infos")
input.hide(type="text" name="oldUsername" value=targetUser.username required)
div.field
label(for="username")=__("username") + ":"
div.row
div.input-field.col.s12
input#username(type="text" name="username" value=targetUser.username required)
div.field
label(for="email")=__("email") + ":"
label(for="username")=__("username") + ":"
div.row
div.input-field.col.s12
input#email(type="email" name="email" value=targetUser.email required)
div.field
label(for="firstName")=__("firstName") + ":"
label(for="email")=__("email") + ":"
div.row
div.input-field.col.s6
input#firstName(type="text" name="firstName" value=targetUser.firstName required)
div.field
label(for="lastName")=__("lastName") + ":"
label(for="firstName")=__("firstName") + ":"
div.input-field.col.s6
input#lastName(type="text" name="lastName" value=targetUser.lastName required)
div.field
label(for="department")=__("department") + ":"
+list("department", "department-list", "department", targetUser.DepartmentName, "off", true)
div.field
label(for="password")=__("password") + ":"
input#password(type="password" name="password")
div.field
label(for="permissions")=__("admin.permissions")
input#permissions(type="number" min="0" max="3" value=targetUser.permissions name="permissions")
div.field
input(type="submit" value=__("save"))
datalist#department-list
label(for="lastName")=__("lastName") + ":"
div.row
div.input-field.col.s12
select(name="department" required=)
each department in departments
option(value=department.name)
option(value=department.name selected=department.name === targetUser.DepartmentName)=department.name
label=__("department") + ":"
div.row
div.input-field.col.s12
input#password(type="password" name="password")
label(for="password")=__("password") + ":"
div.row
div.input-field.col.s12
input#permissions(type="number" min="0" max="3" value=targetUser.permissions name="permissions")
label(for="permissions")=__("admin.permissions")
div.row.center
div.input-field.col.s12
+submit(__("save"))

View file

@ -1,18 +1,20 @@
extends ../../layout
block content
div.card#usersManagement
div.container
h1=__("admin.userManagement")
a.add(href="/admin/users/add")
button=__("admin.add")
div
ul.collection
each user in users
div.user
h2=user.username
div.buttons
a.edit(href="/admin/users/edit?name="+user.username)
button=__("admin.edit")
a.remove(href="/admin/users/delete?name="+user.username)
button=__("admin.remove")
li.collection-item
div=user.username
div.secondary-content
a(href="/admin/users/edit?name="+user.username)
i.material-icons edit
a.delete(href="/admin/users/delete?name="+user.username)
i.material-icons remove
div.fixed-action-btn
a.btn-floating.btn-large.blue(href="/admin/users/add")
i.large.material-icons add
script(src="/javascripts/admin/users.js")