rev |
line source |
bsw/jbe@1309
|
1 local mode = param.get("mode")
|
bsw/jbe@1309
|
2
|
bsw/jbe@1309
|
3 ui.title(function()
|
bsw@1326
|
4 ui.link { module = "registration_admin", view = "index", content = _"User management" }
|
bsw/jbe@1309
|
5 slot.put ( " ยป " )
|
bsw/jbe@1309
|
6 ui.tag { tag = "span", content = "Accredited users"}
|
bsw/jbe@1309
|
7 end)
|
bsw@1326
|
8 app.html_title.title = _"User management"
|
bsw/jbe@1309
|
9
|
bsw/jbe@1309
|
10 ui.container{ attr = { class = "mdl-grid" }, content = function()
|
bsw/jbe@1309
|
11 ui.container{ attr = { class = "mdl-cell mdl-cell--12-col" }, content = function()
|
bsw/jbe@1309
|
12
|
bsw/jbe@1309
|
13 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
|
bsw/jbe@1309
|
14 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
|
bsw/jbe@1309
|
15 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = function()
|
bsw/jbe@1309
|
16 ui.tag{ content = _"Accredited users" }
|
bsw/jbe@1309
|
17 end }
|
bsw/jbe@1309
|
18 end }
|
bsw/jbe@1309
|
19
|
bsw/jbe@1309
|
20 ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
|
bsw/jbe@1309
|
21
|
bsw/jbe@1309
|
22 local verifications_selector = Verification:new_selector()
|
bsw/jbe@1309
|
23 :join("member", nil, "member.id = verification.verified_member_id")
|
bsw/jbe@1309
|
24 :add_where("member.deleted ISNULL")
|
bsw/jbe@1309
|
25
|
bsw/jbe@1309
|
26 if mode == "activated" then
|
bsw/jbe@1309
|
27 verifications_selector:add_where("member.activated NOTNULL")
|
bsw/jbe@1309
|
28 end
|
bsw/jbe@1309
|
29
|
bsw/jbe@1309
|
30 if mode ~= "not_activated" then
|
bsw/jbe@1309
|
31 verifications_selector:add_order_by("member.identification")
|
bsw/jbe@1309
|
32 local verifications = verifications_selector:exec()
|
bsw/jbe@1309
|
33
|
bsw/jbe@1309
|
34 if #verifications > 0 then
|
bsw/jbe@1309
|
35 ui.list{
|
bsw/jbe@1309
|
36 records = verifications,
|
bsw/jbe@1309
|
37 columns = {
|
bsw/jbe@1309
|
38 {
|
bsw/jbe@1309
|
39 label = _"Name",
|
bsw/jbe@1309
|
40 content = function(record)
|
bsw/jbe@1309
|
41 ui.container{ content = function()
|
bsw/jbe@1309
|
42 local member = Member:by_id(record.verified_member_id)
|
bsw/jbe@1309
|
43 if member then
|
bsw/jbe@1309
|
44 ui.link{ module = "registration_admin", view = "verification", id = record.id, content = member.identification }
|
bsw/jbe@1309
|
45 end
|
bsw/jbe@1309
|
46 end }
|
bsw/jbe@1309
|
47 end
|
bsw/jbe@1309
|
48 },
|
bsw/jbe@1309
|
49 --[[
|
bsw/jbe@1309
|
50 {
|
bsw/jbe@1309
|
51 label = _"City",
|
bsw/jbe@1309
|
52 content = function(record)
|
bsw/jbe@1309
|
53 ui.container{ content = (record.verification_data or record.request_data).zip_code }
|
bsw/jbe@1309
|
54 ui.tag{ content = " " }
|
bsw/jbe@1309
|
55 ui.tag{ content = (record.verification_data or record.request_data).city }
|
bsw/jbe@1309
|
56 end
|
bsw/jbe@1309
|
57 },
|
bsw/jbe@1309
|
58 --]]
|
bsw/jbe@1309
|
59 {
|
bsw/jbe@1309
|
60 label = _"Account",
|
bsw/jbe@1309
|
61 content = function(record)
|
bsw/jbe@1309
|
62 local member = Member:by_id(record.verified_member_id)
|
bsw/jbe@1309
|
63 if member and member.activated then
|
bsw/jbe@1309
|
64 ui.link{ module = "member", view = "show", id = record.verified_member_id, content = "ID " .. record.verified_member_id }
|
bsw/jbe@1309
|
65 else
|
bsw/jbe@1309
|
66 ui.tag{ content = "ID " }
|
bsw/jbe@1309
|
67 ui.tag{ content = record.verified_member_id }
|
bsw/jbe@1309
|
68 ui.tag{ content = ", " }
|
bsw/jbe@1309
|
69 ui.tag{ content = _"not activated (yet)" }
|
bsw/jbe@1309
|
70
|
bsw/jbe@1309
|
71 end
|
bsw/jbe@1309
|
72 end
|
bsw/jbe@1309
|
73 },
|
bsw/jbe@1309
|
74 {
|
bsw/jbe@1309
|
75 label = _"Verified at",
|
bsw/jbe@1309
|
76 content = function(record)
|
bsw/jbe@1309
|
77 ui.tag{ content = format.timestamp(record.verified) }
|
bsw/jbe@1309
|
78 end
|
bsw/jbe@1309
|
79 },
|
bsw/jbe@1309
|
80 {
|
bsw/jbe@1309
|
81 label = _"Verified by",
|
bsw/jbe@1309
|
82 content = function(record)
|
bsw/jbe@1309
|
83 if record.verifying_member_id then
|
bsw/jbe@1309
|
84 local member = Member:by_id(record.verifying_member_id)
|
bsw/jbe@1309
|
85 ui.link{ module = "member", view = "show", id = member.id, content = member.identification or (member.id .. " " .. member.name) }
|
bsw/jbe@1309
|
86 local state = string.match(record.comment, "[^/]+$")
|
bsw/jbe@1309
|
87 slot.put(" ")
|
bsw/jbe@1309
|
88 ui.tag{ content = state }
|
bsw/jbe@1309
|
89 elseif record.verified then
|
bsw/jbe@1309
|
90 ui.tag{ content = _"SMS" }
|
bsw/jbe@1309
|
91 end
|
bsw/jbe@1309
|
92
|
bsw/jbe@1309
|
93 end
|
bsw/jbe@1309
|
94 },
|
bsw/jbe@1309
|
95 }
|
bsw/jbe@1309
|
96 }
|
bsw/jbe@1309
|
97 end
|
bsw/jbe@1309
|
98 elseif mode == "not_activated" then
|
bsw/jbe@1309
|
99 verifications_selector:add_where("member.activated ISNULL")
|
bsw/jbe@1309
|
100 :add_order_by("verification.id DESC")
|
bsw/jbe@1309
|
101 local verifications = verifications_selector:exec()
|
bsw/jbe@1309
|
102 execute.view{ module = "registration_admin", view = "_verification_list", params = { verifications = verifications } }
|
bsw/jbe@1309
|
103 end
|
bsw/jbe@1309
|
104
|
bsw/jbe@1309
|
105 end }
|
bsw/jbe@1309
|
106 end }
|
bsw/jbe@1309
|
107
|
bsw/jbe@1309
|
108 end }
|
bsw/jbe@1309
|
109 end }
|
bsw/jbe@1309
|
110
|