venue_management/app/views/admin/venue_management_invitings/export.xlsx.axlsx

60 lines
2.5 KiB
Plaintext
Raw Normal View History

2020-11-12 13:51:31 +00:00
# encoding: utf-8
wb = xlsx_package.workbook
wb.add_worksheet(name: t('restful_actions.venue_management_invitings')) do |sheet|
row = []
row << t('venue_management.title') if @id.blank?
row << t('vm_inviting.type')
row << t('vm_inviting.case_no')
row << t('vm_inviting.publish_times')
row << t('vm_inviting.rents')
row << t('vm_inviting.royalty')
row << t('vm_inviting.house_land_tax_payer')
row << t('vm_inviting.contractor_manager')
row << t('vm_inviting.bid_result')
@site_in_use_locales.each do |locale|
row << t('vm_inviting.details') + "-" + t(locale)
end
row << t("link")
@site_in_use_locales.each do |locale|
row << t("link") + " " + t("url_alt") + " - " + t(locale)
end
row << t("file_")
@site_in_use_locales.each do |locale|
row << t("file_") + " " + t("description") + " - " + t(locale)
end
@site_in_use_locales.each do |locale|
row << t("file_") + " " + t("alternative") + " - " + t(locale)
end
sheet.add_row row
@invitings.each do |inviting|
row2 = []
row2 << inviting.venue_management_main.title if @id.blank?
row2 << inviting.tags.map{|t| t.name}.join(" , ")
row2 << inviting.case_no
row2 << inviting.publish_times
row2 << "#{inviting.early_rent} / #{inviting.operation_rent}"
row2 << inviting.royalty
row2 << t("vm_inviting.enums.#{inviting.house_tax_payer}")+"/"+t("vm_inviting.enums.#{inviting.land_tax_payer}")
row2 << inviting.contractor_manager
row2 << t("vm_inviting.enums.bid_result.#{inviting.bid_result}")
@site_in_use_locales.each do |locale|
row2 << Nokogiri::HTML(inviting.details_translations[locale].to_s).css("body").text
end
row2 << inviting.venue_management_links.map{|l| l.url.to_s.strip}.join(";")
@site_in_use_locales.each do |locale|
row2 << inviting.venue_management_links.map{|l| l.title_translations[locale].to_s.strip}.join(";")
end
row2 << inviting.venue_management_files.map{|f| @host + f.file.url rescue nil}.select{|s| !s.nil?}.join(";")
@site_in_use_locales.each do |locale|
row2 << inviting.venue_management_files.map{|f| f.description_translations[locale].to_s.strip}.join(";")
end
@site_in_use_locales.each do |locale|
row2 << inviting.venue_management_files.map{|f| f.title_translations[locale].to_s.strip}.join(";")
end
sheet.add_row row2
end
end