rev |
line source |
bsw@988
|
1 local delegations = Delegation:delegations_to_check_for_member_id(app.session.member_id)
|
bsw@988
|
2
|
bsw@988
|
3 ui.title(_"Current unit and area delegations need confirmation")
|
bsw@988
|
4
|
bsw@988
|
5
|
bsw@1630
|
6 ui.grid{ content = function()
|
bsw@988
|
7
|
bsw@1630
|
8 ui.cell_main{ content = function()
|
bsw@988
|
9
|
bsw@1630
|
10 ui.container { attr = { class = "mdl-card mdl-shadow--2dp mdl-card__fullwidth" }, content = function()
|
bsw@1630
|
11 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
|
bsw@1630
|
12 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _("Current unit and area delegations need confirmation") }
|
bsw@988
|
13 end }
|
bsw@1630
|
14 ui.container{ attr = { class = "mdl-card__content" }, content = function()
|
bsw@988
|
15
|
bsw@1630
|
16 ui.form{
|
bsw@1630
|
17 module = "index", action = "check_delegations",
|
bsw@1630
|
18 routing = {
|
bsw@1630
|
19 default = { mode = "redirect", module = "index", view = "index" },
|
bsw@1630
|
20 error = { mode = "redirect", module = "index", view = "check_delegations" }
|
bsw@1630
|
21 },
|
bsw@1630
|
22 content = function()
|
bsw@988
|
23
|
bsw@1630
|
24 ui.tag{
|
bsw@1630
|
25 tag = "table", attr = {
|
bsw@1630
|
26 class = "mdl-data-table mdl-js-data-table mdl-shadow--2dp"
|
bsw@1630
|
27 },
|
bsw@1630
|
28 content = function()
|
bsw@1630
|
29 ui.tag{ tag = "tr", content = function()
|
bsw@1630
|
30
|
bsw@1630
|
31 ui.tag{
|
bsw@1630
|
32 tag = "th", attr = {
|
bsw@1630
|
33 class = "mdl-data-table__cell--non-numeric"
|
bsw@1630
|
34 },
|
bsw@1630
|
35 content = _"unit"
|
bsw@1630
|
36 }
|
bsw@1630
|
37 ui.tag{
|
bsw@1630
|
38 tag = "th", attr = {
|
bsw@1630
|
39 class = "mdl-data-table__cell--non-numeric"
|
bsw@1630
|
40 },
|
bsw@1630
|
41 content = _"area"
|
bsw@1630
|
42 }
|
bsw@1630
|
43 ui.tag{
|
bsw@1630
|
44 tag = "th", attr = {
|
bsw@1630
|
45 class = "mdl-data-table__cell--non-numeric"
|
bsw@1630
|
46 },
|
bsw@1630
|
47 content = _"delegated to"
|
bsw@1630
|
48 }
|
bsw@1630
|
49 ui.tag{
|
bsw@1630
|
50 tag = "th", attr = {
|
bsw@1630
|
51 class = "mdl-data-table__cell--non-numeric"
|
bsw@1630
|
52 },
|
bsw@1630
|
53 content = _"action"
|
bsw@1630
|
54 }
|
bsw@1630
|
55 end }
|
bsw@1630
|
56
|
bsw@1630
|
57 for i, delegation in ipairs(delegations) do
|
bsw@1630
|
58
|
bsw@1630
|
59 local unit = Unit:by_id(delegation.unit_id)
|
bsw@1630
|
60 local area = Area:by_id(delegation.area_id)
|
bsw@1630
|
61 local member = Member:by_id(delegation.trustee_id)
|
bsw@1630
|
62 local info
|
bsw@1630
|
63 if area then
|
bsw@1630
|
64 area:load_delegation_info_once_for_member_id(app.session.member_id)
|
bsw@1630
|
65 info = area.delegation_info
|
bsw@1630
|
66 else
|
bsw@1630
|
67 unit:load_delegation_info_once_for_member_id(app.session.member_id)
|
bsw@1630
|
68 info = unit.delegation_info
|
bsw@1630
|
69 end
|
bsw@1630
|
70
|
bsw@1630
|
71 ui.tag{ tag = "tr", content = function ()
|
bsw@1630
|
72
|
bsw@1630
|
73 ui.tag {
|
bsw@1630
|
74 tag = "td",
|
bsw@1630
|
75 attr = {
|
bsw@1630
|
76 class = "mdl-data-table__cell--non-numeric"
|
bsw@1630
|
77 },
|
bsw@1630
|
78 content = delegation.unit_name
|
bsw@1630
|
79 }
|
bsw@1630
|
80 ui.tag {
|
bsw@1630
|
81 tag = "td",
|
bsw@1630
|
82 attr = {
|
bsw@1630
|
83 class = "mdl-data-table__cell--non-numeric"
|
bsw@1630
|
84 },
|
bsw@1630
|
85 content = delegation.area_name
|
bsw@1630
|
86 }
|
bsw@1630
|
87 ui.tag {
|
bsw@1630
|
88 tag = "td",
|
bsw@1630
|
89 attr = {
|
bsw@1630
|
90 class = "mdl-data-table__cell--non-numeric"
|
bsw@1630
|
91 },
|
bsw@1630
|
92 content = function()
|
bsw@1630
|
93 if (member) then
|
bsw@1630
|
94 local text = _"delegates to"
|
bsw@1630
|
95 ui.image{
|
bsw@1630
|
96 attr = { class = "delegation_arrow", alt = text, title = text },
|
bsw@1630
|
97 static = "delegation_arrow_24_horizontal.png"
|
bsw@1630
|
98 }
|
bsw@1630
|
99 execute.view{ module = "member_image", view = "_show", params = {
|
bsw@1630
|
100 member = member, class = "micro_avatar", popup_text = member.name,
|
bsw@1630
|
101 image_type = "avatar", show_dummy = true,
|
bsw@1630
|
102 } }
|
bsw@1630
|
103 slot.put(" ")
|
bsw@1630
|
104 ui.tag { tag = "span", content = delegation.member_name }
|
bsw@1630
|
105 else
|
bsw@1630
|
106 ui.tag{ tag = "span", content = _"Abandon unit delegation" }
|
bsw@1630
|
107 end
|
bsw@1630
|
108 end
|
bsw@1630
|
109 }
|
bsw@1630
|
110
|
bsw@1630
|
111 ui.tag {
|
bsw@1630
|
112 tag = "td",
|
bsw@1630
|
113 attr = {
|
bsw@1630
|
114 class = "mdl-data-table__cell--non-numeric"
|
bsw@1630
|
115 },
|
bsw@1630
|
116 content = function()
|
bsw@1630
|
117 local checked = config.check_delegations_default
|
bsw@1630
|
118 ui.tag{ tag = "input", attr = {
|
bsw@1630
|
119 type = "radio",
|
bsw@1630
|
120 id = "delegation_" .. delegation.id .. "_confirm",
|
bsw@1630
|
121 name = "delegation_" .. delegation.id,
|
bsw@1630
|
122 value = "confirm",
|
bsw@1630
|
123 checked = checked == "confirm" and "checked" or nil
|
bsw@1630
|
124 } }
|
bsw@1630
|
125 ui.tag{
|
bsw@1630
|
126 tag = "label",
|
bsw@1630
|
127 attr = { ["for"] = "delegation_" .. delegation.id .. "_confirm" },
|
bsw@1630
|
128 content = _"confirm"
|
bsw@1630
|
129 }
|
bsw@1630
|
130 ui.tag{ tag = "input", attr = {
|
bsw@1630
|
131 type = "radio",
|
bsw@1630
|
132 id = "delegation_" .. delegation.id .. "_revoke",
|
bsw@1630
|
133 name = "delegation_" .. delegation.id,
|
bsw@1630
|
134 value = "revoke",
|
bsw@1630
|
135 checked = checked == "revoke" and "checked" or nil
|
bsw@1630
|
136 } }
|
bsw@1630
|
137 ui.tag{
|
bsw@1630
|
138 tag = "label",
|
bsw@1630
|
139 attr = { ["for"] = "delegation_" .. delegation.id .. "_revoke" },
|
bsw@1630
|
140 content = _"revoke"
|
bsw@1630
|
141 }
|
bsw@1630
|
142 end
|
bsw@1630
|
143 }
|
bsw@1630
|
144
|
bsw@1630
|
145 end }
|
bsw@1630
|
146
|
bsw@1630
|
147 end
|
bsw@1630
|
148
|
bsw@1630
|
149 end
|
bsw@988
|
150 }
|
bsw@988
|
151
|
bsw@988
|
152
|
bsw@1630
|
153 slot.put("<br />")
|
bsw@1630
|
154
|
bsw@1630
|
155 ui.submit{
|
bsw@1630
|
156 attr = { class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored" },
|
bsw@1630
|
157 text = _"Finish delegation check"
|
bsw@1630
|
158 }
|
bsw@1630
|
159 if not app.session.needs_delegation_check then
|
bsw@1630
|
160 slot.put(" ")
|
bsw@1630
|
161 ui.link{
|
bsw@1630
|
162 attr = { class = "mdl-button mdl-js-button" },
|
bsw@1630
|
163 module = "index", view = "index", text = _"Cancel"
|
bsw@1630
|
164 }
|
bsw@1630
|
165 end
|
bsw@988
|
166
|
bsw@1630
|
167
|
bsw@1630
|
168 end
|
bsw@1630
|
169 }
|
bsw@1630
|
170
|
bsw@1630
|
171
|
bsw@1630
|
172 end }
|
bsw@1630
|
173 end }
|
bsw@1630
|
174 end }
|
bsw@1630
|
175
|
bsw@1630
|
176 end }
|
bsw@1630
|
177
|
bsw@1630
|
178
|
bsw@1630
|
179
|
bsw@1630
|
180
|
bsw@1630
|
181
|
bsw@1630
|
182
|