rev |
line source |
bsw/jbe@0
|
1 local id = param.get_id()
|
bsw/jbe@0
|
2
|
bsw@193
|
3 local member = Member:by_id(id)
|
bsw@193
|
4
|
bsw@1088
|
5 local deactivated = member and member.locked and member.login == nil and member.authority_login == nil
|
bsw@1088
|
6
|
bsw@1184
|
7 ui.titleAdmin(_"Member")
|
bsw/jbe@0
|
8
|
bsw@513
|
9 local units_selector = Unit:new_selector()
|
bsw@512
|
10
|
bsw@513
|
11 if member then
|
bsw@513
|
12 units_selector
|
bsw@513
|
13 :left_join("privilege", nil, { "privilege.member_id = ? AND privilege.unit_id = unit.id", member.id })
|
bsw@513
|
14 :add_field("privilege.voting_right", "voting_right")
|
bsw@1438
|
15 :add_order_by("unit.name")
|
bsw@513
|
16 end
|
bsw@513
|
17
|
bsw@513
|
18 local units = units_selector:exec()
|
bsw@512
|
19
|
bsw@1455
|
20 ui.grid{ content = function()
|
bsw@310
|
21
|
bsw@1455
|
22 ui.cell_main{ content = function()
|
bsw@1455
|
23 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
|
bsw@1455
|
24 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
|
bsw@1455
|
25 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Member" }
|
bsw@1455
|
26 end }
|
bsw@1455
|
27 ui.container{ attr = { class = "mdl-card__content" }, content = function()
|
bsw@1455
|
28 ui.form{
|
bsw@1455
|
29 attr = { class = "vertical section" },
|
bsw@1455
|
30 module = "admin",
|
bsw@1455
|
31 action = "member_update",
|
bsw@1455
|
32 id = member and member.id,
|
bsw@1455
|
33 record = member,
|
bsw@1455
|
34 readonly = not app.session.member.admin,
|
bsw@1455
|
35 routing = {
|
bsw@1455
|
36 default = {
|
bsw@1455
|
37 mode = "redirect",
|
bsw@1455
|
38 modules = "admin",
|
bsw@1455
|
39 view = "index"
|
bsw@1455
|
40 }
|
bsw@1455
|
41 },
|
bsw@1455
|
42 content = function()
|
bsw@1455
|
43
|
bsw@1455
|
44 ui.sectionHead( function()
|
bsw@1455
|
45 ui.heading { level = 1, content = member and (member.name or member.id) or _"New member" }
|
bsw@1455
|
46 if member and member.identification then
|
bsw@1455
|
47 ui.heading { level = 3, content = member.identification }
|
bsw@1455
|
48 end
|
bsw@1455
|
49 end )
|
bsw@1455
|
50
|
bsw@1455
|
51 ui.sectionRow( function()
|
bsw@1455
|
52 ui.field.text{ label = _"Identification", name = "identification" }
|
bsw@1455
|
53 ui.field.text{ label = _"Notification email (confirmed)", name = "notify_email" }
|
bsw@1455
|
54 ui.field.text{ label = _"Notification email (unconfirmed)", name = "notify_email_unconfirmed" }
|
bsw@1455
|
55 if member and member.activated then
|
bsw@1455
|
56 ui.field.text{ label = _"Screen name", name = "name" }
|
bsw@1455
|
57 end
|
bsw@1455
|
58
|
bsw@1455
|
59 if member and member.activated and not deactivated then
|
bsw@1455
|
60 ui.field.text{ label = _"Login name", name = "login" }
|
bsw@1455
|
61 end
|
bsw@1088
|
62
|
bsw@1455
|
63 for i, unit in ipairs(units) do
|
bsw@1455
|
64 ui.field.boolean{
|
bsw@1455
|
65 name = "unit_" .. unit.id,
|
bsw@1455
|
66 label = unit.name,
|
bsw@1455
|
67 value = unit.voting_right
|
bsw@1455
|
68 }
|
bsw@1455
|
69 end
|
bsw@1455
|
70 slot.put("<br /><br />")
|
bsw@1045
|
71
|
bsw@1455
|
72 if member then
|
bsw@1455
|
73 ui.field.text{ label = _"Activated", name = "activated", readonly = true }
|
bsw@1455
|
74 end
|
bsw@1455
|
75
|
bsw@1455
|
76 if not member or not member.activated then
|
bsw@1455
|
77 ui.field.boolean{ label = _"Send invite?", name = "invite_member" }
|
bsw@1455
|
78 end
|
bsw@1455
|
79
|
bsw@1455
|
80 if member then
|
bsw@1455
|
81 ui.field.boolean{
|
bsw@1455
|
82 label = _"Member inactive?", name = "deactivate",
|
bsw@1455
|
83 readonly = true,
|
bsw@1455
|
84 value = member and member.active == false
|
bsw@1455
|
85 }
|
bsw@1455
|
86 end
|
bsw@1455
|
87
|
bsw@1455
|
88 if member then
|
bsw@1455
|
89 ui.field.boolean{
|
bsw@1455
|
90 label = _"Lock member?", name = "locked",
|
bsw@1455
|
91 }
|
bsw@1455
|
92 end
|
bsw@1455
|
93
|
bsw@1455
|
94 slot.put("<br />")
|
bsw@1455
|
95 ui.field.boolean{ label = _"Admin?", name = "admin" }
|
bsw@1455
|
96 slot.put("<br />")
|
bsw@1455
|
97 ui.submit{ text = _"update member" }
|
bsw@1455
|
98 slot.put(" ")
|
bsw@1455
|
99 if member then
|
bsw@1455
|
100 ui.link { module = "admin", view = "member_deactivate", content = _"Deactivate member", id = member.id }
|
bsw@1455
|
101 slot.put(" ")
|
bsw@1455
|
102 end
|
bsw@1455
|
103 ui.link { module = "admin", view = "index", content = _"cancel" }
|
bsw@1455
|
104 end )
|
bsw@1455
|
105 end
|
bsw@1455
|
106 }
|
bsw@1455
|
107 end }
|
bsw@1455
|
108 end }
|
bsw@1455
|
109 end }
|