mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-29 10:24:20 +01:00
add organization infos to members xlsx export
This commit is contained in:
parent
33358c2fb5
commit
af94b62ff1
@ -46,7 +46,7 @@ class UsersExportService
|
||||
|
||||
# export members
|
||||
def export_members(export)
|
||||
@members = User.with_role(:member).includes(:group, :trainings, :tags, :invoices, :projects, :subscriptions => [:plan], :profile => [:address])
|
||||
@members = User.with_role(:member).includes(:group, :trainings, :tags, :invoices, :projects, :subscriptions => [:plan], :profile => [:address, :organization => [:address]])
|
||||
|
||||
ActionController::Base.prepend_view_path './app/views/'
|
||||
# place data in view_assigns
|
||||
|
@ -13,7 +13,8 @@ wb.add_worksheet(name: t('export_members.members')) do |sheet|
|
||||
t('export_members.cad_software_mastered'), t('export_members.group'), t('export_members.subscription'),
|
||||
t('export_members.subscription_end_date'), t('export_members.validated_trainings'), t('export_members.tags'),
|
||||
t('export_members.number_of_invoices'), t('export_members.projects'), t('export_members.facebook'),
|
||||
t('export_members.twitter'), t('export_members.echo_sciences')]
|
||||
t('export_members.twitter'), t('export_members.echo_sciences'),
|
||||
t('export_members.organization'), t('export_members.organization_address')]
|
||||
sheet.add_row columns, :style => header
|
||||
|
||||
# data rows
|
||||
@ -27,7 +28,8 @@ wb.add_worksheet(name: t('export_members.members')) do |sheet|
|
||||
(member.subscription and member.subscription.expired_at > Time.now) ? member.subscription.expired_at.to_date : nil,
|
||||
member.trainings.map(&:name).join("\n"), member.tags.map(&:name).join("\n"), member.invoices.size,
|
||||
member.projects.map(&:name).join("\n"), member.profile.facebook || '', member.profile.twitter || '',
|
||||
member.profile.echosciences || ''
|
||||
member.profile.echosciences || '',
|
||||
member.profile.organization ? member.profile.organization.name : '', member.profile.organization ? member.profile.organization.address.address : ''
|
||||
]
|
||||
styles = [nil, nil, nil,
|
||||
nil, nil, nil, nil,
|
||||
@ -37,7 +39,9 @@ wb.add_worksheet(name: t('export_members.members')) do |sheet|
|
||||
date,
|
||||
nil, nil, nil,
|
||||
nil, nil, nil,
|
||||
nil]
|
||||
nil,
|
||||
nil, nil
|
||||
]
|
||||
types = [:integer, :string, :string,
|
||||
:string, :boolean, :string, :integer,
|
||||
:string, :string, :string,
|
||||
@ -46,7 +50,8 @@ wb.add_worksheet(name: t('export_members.members')) do |sheet|
|
||||
:date,
|
||||
:string, :string, :integer,
|
||||
:string, :string, :string,
|
||||
:string]
|
||||
:string,
|
||||
:string, :string]
|
||||
|
||||
sheet.add_row data, :style => styles, :types => types
|
||||
end
|
||||
|
@ -140,6 +140,8 @@ en:
|
||||
facebook: "Facebook"
|
||||
twitter: "Twitter"
|
||||
echo_sciences: "Echosciences"
|
||||
organization: "Organization"
|
||||
organization_address: "Organization address"
|
||||
man: "Man"
|
||||
woman: "Woman"
|
||||
without_subscriptions: "Without subscriptions"
|
||||
|
@ -140,6 +140,8 @@ fr:
|
||||
facebook: "Facebook"
|
||||
twitter: "Twitter"
|
||||
echo_sciences: "Echosciences"
|
||||
organization: "Structure"
|
||||
organization_address: "Adresse de la structure"
|
||||
man: "Homme"
|
||||
woman: "Femme"
|
||||
without_subscriptions: "Sans Abonnement"
|
||||
|
Loading…
Reference in New Issue
Block a user