Users management rework
This commit is contained in:
parent
3c5cb22975
commit
41dad395b2
4 changed files with 88 additions and 73 deletions
|
@ -1,4 +1,4 @@
|
||||||
document.querySelectorAll("a.remove")
|
document.querySelectorAll(".delete")
|
||||||
.forEach(e => e.addEventListener("click", ev => {
|
.forEach(e => e.addEventListener("click", ev => {
|
||||||
if (!confirm("Do you really want to remove this user ?"))
|
if (!confirm("Do you really want to remove this user ?"))
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
|
|
@ -1,34 +1,41 @@
|
||||||
extends ../../layout
|
extends ../../layout
|
||||||
|
|
||||||
block content
|
block content
|
||||||
div.card#usersManagement
|
div.container
|
||||||
h1=__("admin.new")+" "+__("admin.user")
|
h1=__("admin.new")+" "+__("admin.user")
|
||||||
form(action="/admin/users/add" method="POST")
|
div.row
|
||||||
h1=__("register.title")
|
form(action="/admin/users/add" method="POST")
|
||||||
div.field
|
h1=__("register.title")
|
||||||
label(for="username")=__("username") + ":"
|
div.row
|
||||||
input#username(type="text" name="username" required)
|
div.input-field.col.s12
|
||||||
div.field
|
input#username(type="text" name="username" required)
|
||||||
label(for="email")=__("email") + ":"
|
label(for="username")=__("username") + ":"
|
||||||
input#email(type="email" name="email" required)
|
div.row
|
||||||
div.field
|
div.input-field.col.s12
|
||||||
label(for="firstName")=__("firstName") + ":"
|
input#email(type="email" name="email" required)
|
||||||
input#firstName(type="text" name="firstName" required)
|
label(for="email")=__("email") + ":"
|
||||||
div.field
|
div.row
|
||||||
label(for="lastName")=__("lastName") + ":"
|
div.input-field.col.s6
|
||||||
input#lastName(type="text" name="lastName" required)
|
input#firstName(type="text" name="firstName" required)
|
||||||
div.field
|
label(for="firstName")=__("firstName") + ":"
|
||||||
label(for="department")=__("department") + ":"
|
div.input-field.col.s6
|
||||||
+list("department", "department-list", "department", "", "off", true)
|
input#lastName(type="text" name="lastName" required)
|
||||||
div.field
|
label(for="lastName")=__("lastName") + ":"
|
||||||
label(for="password")=__("password") + ":"
|
div.row
|
||||||
input#password(type="password" name="password" required)
|
div.input-field.col.s12
|
||||||
div.field
|
select(name="department" required)
|
||||||
label(for="permissions")=__("admin.permissions")
|
option(value="" disabled selected hidden)=__("chooseDepartment")
|
||||||
input#permissions(type="number" min="0" max="3" value="0" name="permissions")
|
each department in departments
|
||||||
div.field
|
option(value=department.name)=department.name
|
||||||
input(type="submit" value=__("register.submit"))
|
label=__("department") + ":"
|
||||||
|
div.row
|
||||||
datalist#department-list
|
div.input-field.col.s12
|
||||||
each department in departments
|
input#password(type="password" name="password" required)
|
||||||
option(value=department.name)
|
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"))
|
||||||
|
|
|
@ -1,35 +1,41 @@
|
||||||
extends ../../layout
|
extends ../../layout
|
||||||
|
|
||||||
block content
|
block content
|
||||||
div.card#sandwichesManagement
|
div.container
|
||||||
h1=__("admin.edit")+" "+targetUser.username
|
h1=__("admin.edit")+" "+targetUser.username
|
||||||
form(action="/admin/users/edit" method="POST")
|
div.row
|
||||||
h2=__("profile.infos")
|
form(action="/admin/users/edit" method="POST")
|
||||||
input.hide(type="text" name="oldUsername" value=targetUser.username required)
|
h2=__("profile.infos")
|
||||||
div.field
|
input.hide(type="text" name="oldUsername" value=targetUser.username required)
|
||||||
label(for="username")=__("username") + ":"
|
div.row
|
||||||
input#username(type="text" name="username" value=targetUser.username required)
|
div.input-field.col.s12
|
||||||
div.field
|
input#username(type="text" name="username" value=targetUser.username required)
|
||||||
label(for="email")=__("email") + ":"
|
label(for="username")=__("username") + ":"
|
||||||
input#email(type="email" name="email" value=targetUser.email required)
|
div.row
|
||||||
div.field
|
div.input-field.col.s12
|
||||||
label(for="firstName")=__("firstName") + ":"
|
input#email(type="email" name="email" value=targetUser.email required)
|
||||||
input#firstName(type="text" name="firstName" value=targetUser.firstName required)
|
label(for="email")=__("email") + ":"
|
||||||
div.field
|
div.row
|
||||||
label(for="lastName")=__("lastName") + ":"
|
div.input-field.col.s6
|
||||||
input#lastName(type="text" name="lastName" value=targetUser.lastName required)
|
input#firstName(type="text" name="firstName" value=targetUser.firstName required)
|
||||||
div.field
|
label(for="firstName")=__("firstName") + ":"
|
||||||
label(for="department")=__("department") + ":"
|
div.input-field.col.s6
|
||||||
+list("department", "department-list", "department", targetUser.DepartmentName, "off", true)
|
input#lastName(type="text" name="lastName" value=targetUser.lastName required)
|
||||||
div.field
|
label(for="lastName")=__("lastName") + ":"
|
||||||
label(for="password")=__("password") + ":"
|
div.row
|
||||||
input#password(type="password" name="password")
|
div.input-field.col.s12
|
||||||
div.field
|
select(name="department" required=)
|
||||||
label(for="permissions")=__("admin.permissions")
|
each department in departments
|
||||||
input#permissions(type="number" min="0" max="3" value=targetUser.permissions name="permissions")
|
option(value=department.name selected=department.name === targetUser.DepartmentName)=department.name
|
||||||
div.field
|
label=__("department") + ":"
|
||||||
input(type="submit" value=__("save"))
|
div.row
|
||||||
|
div.input-field.col.s12
|
||||||
datalist#department-list
|
input#password(type="password" name="password")
|
||||||
each department in departments
|
label(for="password")=__("password") + ":"
|
||||||
option(value=department.name)
|
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"))
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
extends ../../layout
|
extends ../../layout
|
||||||
|
|
||||||
block content
|
block content
|
||||||
div.card#usersManagement
|
div.container
|
||||||
h1=__("admin.userManagement")
|
h1=__("admin.userManagement")
|
||||||
a.add(href="/admin/users/add")
|
ul.collection
|
||||||
button=__("admin.add")
|
|
||||||
div
|
|
||||||
each user in users
|
each user in users
|
||||||
div.user
|
li.collection-item
|
||||||
h2=user.username
|
div=user.username
|
||||||
div.buttons
|
div.secondary-content
|
||||||
a.edit(href="/admin/users/edit?name="+user.username)
|
a(href="/admin/users/edit?name="+user.username)
|
||||||
button=__("admin.edit")
|
i.material-icons edit
|
||||||
a.remove(href="/admin/users/delete?name="+user.username)
|
a.delete(href="/admin/users/delete?name="+user.username)
|
||||||
button=__("admin.remove")
|
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")
|
script(src="/javascripts/admin/users.js")
|
||||||
|
|
Reference in a new issue