Commit eba85b39 authored by Hussain Kashef's avatar Hussain Kashef

Group offers add dates field with sorting and in xls

parent 95398b25
Pipeline #50226 passed with stage
in 41 minutes and 48 seconds
......@@ -50,6 +50,8 @@ table.table.table-striped
th= t_attr(:volunteers)
th= sort_link @q, :group_offer_category_category_name, t_attr(:group_offer_category)
th= sort_link @q, :offer_type, t_attr(:external, GroupOffer)
th= sort_link @q, :created_at
th= sort_link @q, :period_end, 'Aktualisiert am'
tbody
- @group_offers.each do |offer|
......@@ -97,6 +99,8 @@ table.table.table-striped
br
td= link_to offer.group_offer_category.category_name, url_for(q: search_parameters.merge(group_offer_category_id_eq: offer.group_offer_category.id))
td= t_attr(offer.external? ? :external : :internal, GroupOffer)
td= offer.created_at
td= offer.period_end
= bootstrap_paginate(@group_offers)
......
......@@ -24,7 +24,9 @@ wb.add_worksheet(name: t('group_offers', count: 2)) do |sheet|
t_attr(:duration),
t_attr(:offer_state),
'Verantwortliche/r',
t_attr(:volunteers)
t_attr(:volunteers),
t_attr(:created_at),
t_attr(:period_end)
]
sheet.add_row header_row, style: col_header
......@@ -46,6 +48,7 @@ wb.add_worksheet(name: t('group_offers', count: 2)) do |sheet|
type = t("offer_type.#{offer.offer_type}") if offer.offer_type?
state = t("offer_state.#{offer.offer_state}") if offer.offer_state?
creator = offer.creator if offer.creator
period_end = offer.period_end.to_date if offer.period_end
volunteers = offer.volunteers.map do |volunteer|
role_key = offer.responsible?(volunteer) ? 'responsible' : 'member'
"#{volunteer} (#{I18n.t("activerecord.attributes.group_assignment.#{role_key}")}) #{volunteer.contact.primary_email}"
......@@ -64,7 +67,9 @@ wb.add_worksheet(name: t('group_offers', count: 2)) do |sheet|
durations,
state,
creator,
volunteers.join("\r")
volunteers.join("\r"),
offer.created_at.to_date,
period_end
], types: :string, style: col_body
end
end
......@@ -23,7 +23,9 @@ class GroupOffersXlsxExportTest < ActionDispatch::IntegrationTest
'Dauer',
'FW-Nachfrage',
'Verantwortliche/r',
'Freiwillige'
'Freiwillige',
'Erstellt am',
'Angebotsenddatum'
)
assert_xls_cols_equal(wb, 2, 1, GroupOffer.first.title)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment