bsw@273: local units = app.session.member.units_with_voting_right
bsw@273: local member = param.get("member", "table")
bsw@273: for i, unit in ipairs(units) do
bsw@273: local areas_selector = Area:new_selector()
bsw@273: :join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ?", member.id })
bsw@273: :add_where{ "area.unit_id = ?", unit.id }
bsw@273: :add_order_by("area.member_weight DESC")
bsw@273:
bsw@274: if areas_selector:count() > 0 then
bsw@274: execute.view{
bsw@274: module = "area", view = "_list",
bsw@278: params = { areas_selector = areas_selector, title = function()
bsw@278: ui.link{
bsw@278: attr = { class = "heading" },
bsw@278: text = unit.name,
bsw@278: module = "area", view = "list", params = { unit_id = unit.id }
bsw@278: }
bsw@278: end},
bsw@274: }
bsw@274: else
bsw@278: ui.link{
bsw@278: attr = { class = "heading" },
bsw@278: text = unit.name,
bsw@278: module = "area", view = "list", params = { unit_id = unit.id }
bsw@278: }
bsw@274: ui.tag{ content = _"You have voting privileges for this unit, but you are not member of any of its areas." }
bsw@274: slot.put(" ")
bsw@274: ui.link{
bsw@274: text = _"Show all areas of this unit",
bsw@274: module = "area", view = "list", params = { unit_id = unit.id }
bsw@274: }
bsw@274: end
bsw@274: slot.put("
")
bsw@278: slot.put("
")
bsw@274:
bsw@273: end
bsw@273: