liquid_feedback_frontend

view app/main/index/check_delegations.lua @ 1532:3c15fea3f1c0

Added FirstLife group mirroring
author bsw
date Sun Oct 04 16:31:47 2020 +0200 (2020-10-04)
parents 701a5cf6b067
children 86a45c381bd9
line source
1 local delegations = Delegation:delegations_to_check_for_member_id(app.session.member_id)
3 ui.title(_"Current unit and area delegations need confirmation")
5 ui.actions(function()
6 if not app.session.needs_delegation_check then
7 ui.link{ module = "index", view = "index", text = _"Cancel" }
8 end
9 end)
11 ui.form{
12 module = "index", action = "check_delegations",
13 routing = {
14 default = { mode = "redirect", module = "index", view = "index" },
15 error = { mode = "redirect", module = "index", view = "check_delegations" }
16 },
17 content = function()
19 ui.tag{ tag = "table", attr = { class = "striped" }, content = function()
21 ui.tag{ tag = "tr", content = function()
23 ui.tag{ tag = "th", content = _"unit / area" }
24 ui.tag{ tag = "th", content = _"delegated to" }
25 ui.tag{ tag = "th", content = _"action" }
27 end }
29 for i, delegation in ipairs(delegations) do
31 local unit = Unit:by_id(delegation.unit_id)
32 local area = Area:by_id(delegation.area_id)
33 local member = Member:by_id(delegation.trustee_id)
34 local info
35 if area then
36 area:load_delegation_info_once_for_member_id(app.session.member_id)
37 info = area.delegation_info
38 else
39 unit:load_delegation_info_once_for_member_id(app.session.member_id)
40 info = unit.delegation_info
41 end
43 ui.tag{ tag = "tr", content = function ()
45 ui.tag { tag = "td", content = function()
46 ui.tag{ tag = "span", attr = { class = "unit_link" }, content = delegation.unit_name }
47 ui.tag{ tag = "span", attr = { class = "area_link" }, content = delegation.area_name }
48 end }
50 ui.tag { tag = "td", content = function()
51 if (member) then
52 local text = _"delegates to"
53 ui.image{
54 attr = { class = "delegation_arrow", alt = text, title = text },
55 static = "delegation_arrow_24_horizontal.png"
56 }
57 execute.view{ module = "member_image", view = "_show", params = {
58 member = member, class = "micro_avatar", popup_text = member.name,
59 image_type = "avatar", show_dummy = true,
60 } }
61 slot.put(" ")
62 ui.tag { tag = "span", content = delegation.member_name }
63 else
64 ui.tag{ tag = "span", content = _"Abandon unit delegation" }
65 end
66 end }
68 ui.tag { tag = "td", content = function()
69 local checked = config.check_delegations_default
70 ui.tag{ tag = "input", attr = {
71 type = "radio",
72 id = "delegation_" .. delegation.id .. "_confirm",
73 name = "delegation_" .. delegation.id,
74 value = "confirm",
75 checked = checked == "confirm" and "checked" or nil
76 } }
77 ui.tag{
78 tag = "label",
79 attr = { ["for"] = "delegation_" .. delegation.id .. "_confirm" },
80 content = _"confirm"
81 }
82 ui.tag{ tag = "input", attr = {
83 type = "radio",
84 id = "delegation_" .. delegation.id .. "_revoke",
85 name = "delegation_" .. delegation.id,
86 value = "revoke",
87 checked = checked == "revoke" and "checked" or nil
88 } }
89 ui.tag{
90 tag = "label",
91 attr = { ["for"] = "delegation_" .. delegation.id .. "_revoke" },
92 content = _"revoke"
93 }
94 end}
96 end }
98 end
100 end}
103 slot.put("<br />")
105 ui.submit{ text = _"Finish delegation check" }
107 end
108 }

Impressum / About Us