Finish print page and export excel

This commit is contained in:
BoHung Chiu 2020-08-10 15:35:02 +08:00
parent af5a5ed8d3
commit e2450e96b1
8 changed files with 605 additions and 70 deletions

View File

@ -0,0 +1,6 @@
*{
display: none;
}
.print_text{
display: block;
}

View File

@ -60,13 +60,51 @@ class Admin::VenueManagementsController < Admin::VenueAdminController
end end
end end
def print_pdf
time_now = Time.now
venue_management = VenueManagementMain.find(params[:id])
if !venue_management.registration_status.blank? && venue_management.signup_start_date <= time_now && ( venue_management.signup_end_date.nil? || venue_management.signup_end_date+1 >= time_now )
sign_up = ('<a href="'+ OrbitHelper.url_to_show(venue_management.to_param) + '" target="_blank">' + t('venue_management.signup') + '</a>').html_safe
elsif venue_management.registration_status.blank?
sign_up = t('venue_management.sign_up_not_open')
elsif venue_management.signup_start_date > time_now
sign_up = t('venue_management.sign_up_not_yet')
else
sign_up = t('venue_management.sign_up_overdue')
end
if !venue_management.registration_status.blank? && venue_management.registration_status.include?('C') && venue_management.contribute_start_date <= time_now && ( venue_management.contribute_end_date.nil? || venue_management.contribute_end_date+1 >= time_now )
if !@@session[:venue_management_signup_id].blank?
if @@session[:venue_management_main_id] == venue_management.id
contribute_action = ('<a href="'+ OrbitHelper.url_to_show(venue_management.to_param) + '?method=con_upload">' + t('venue_management_signup.uploads') + '</a>').html_safe
else
contribute_action = ('<a href="'+ OrbitHelper.url_to_show(venue_management.to_param) + '?method=con_login">' + t('venue_management_signup.con_login') + '</a>').html_safe
end
else
contribute_action = ('<a href="'+ OrbitHelper.url_to_show(venue_management.to_param) + '?method=con_login">' + t('venue_management_signup.con_login') + '</a>').html_safe
end
end
@venue_management = venue_management
@sign_up = sign_up
@contribute_action = contribute_action
@time_now = time_now
@contribute_time_range = VenueManagementMain.time_range(venue_management.contribute_start_date, venue_management.contribute_end_date)
@sign_up_time_range = venue_management.display_signup_during
@venue_management_time_range = venue_management.display_event_during
@params = params
@venue_management_page_url = Page.where(:module =>"venue_management").last.url rescue ""
if params[:type] == "print"
render "print_pdf" , :layout => false
end
end
def export def export
@protocol = (request.referer.blank? ? "http" : URI(request.referer).scheme)
@host = "#{@protocol}://#{request.host_with_port}"
@venue_management = VenueManagementMain.find(params[:id]) @venue_management = VenueManagementMain.find(params[:id])
@venue_management_signups = VenueManagementSignup.where(:venue_management_main_id => params[:id]) @venue_management_signups = VenueManagementSignup.where(:venue_management_main_id => params[:id])
@site_in_use_locales = Site.first.in_use_locales @site_in_use_locales = Site.first.in_use_locales
filename = @venue_management.title.parameterize.underscore + "_export.xlsx" filename = @venue_management.title.to_s.strip + "_export.xlsx"
respond_to do |format| respond_to do |format|
format.xlsx { format.xlsx {
response.headers['Content-Disposition'] = 'attachment; filename="' + filename + '"' response.headers['Content-Disposition'] = 'attachment; filename="' + filename + '"'

View File

@ -33,6 +33,7 @@
--> -->
<li><a href="#" class="delete text-error" rel="/admin/venue_managements/<%=venue_management.id.to_s%>"><%= t(:delete_) %></a></li> <li><a href="#" class="delete text-error" rel="/admin/venue_managements/<%=venue_management.id.to_s%>"><%= t(:delete_) %></a></li>
<% end %> <% end %>
<li><a href="/admin/venue_managements/<%=venue_management.id.to_s%>/print_pdf"><%= t("venue_management.print_pdf") %></a></li>
</ul> </ul>
</div> </div>
</td> </td>

View File

@ -2,78 +2,177 @@
wb = xlsx_package.workbook wb = xlsx_package.workbook
wb.add_worksheet(name: (@venue_management.title.to_s[0..27]+'...')) do |sheet| wb.add_worksheet(name: t('restful_actions.venue_management_contracts')) do |sheet|
row = [t('vm_contract.case_no')]
row = [t(:category)] row << t('vm_inviting.type')
row << t('venue_management.contractor')
row << t('venue_management.manager') row << t('vm_inviting.rents')
row << t('vm_inviting.royalty')
row << t('venue_management.contractor') row << t('vm_inviting.house_land_tax_payer')
row << t('vm_contract.renewal_permission')
row << t('venue_management.venue_management_start_date') row << t('vm_contract.start_end')
row << t('vm_contract.construction_start_end')
row << t('venue_management.venue_management_end_date') row << t('vm_contract.operation_start_end')
row << t('vm_contract.free_period_start_end')
row << t('venue_management.title') row << t('vm_contract.sign_date')
row << t('vm_contract.handover_date')
row << t('venue_management_signup.address') row << t('vm_contract.deposit_payment_date')
row << t('vm_contract.deposit_type')
row << t('venue_management.land_number') row << t('vm_contract.deposit_exp_date')
row << t('vm_contract.insurance_type')
row << t('venue_management.area') row << t('vm_contract.insurance_payment_deadline')
row << t('venue_management.land_zoning') row << t('vm_contract.insurance_payment_date')
row << t('venue_management.content') @site_in_use_locales.each do |locale|
row << t('venue_management.act_place') row << t('vm_contract.other_commitment') + " - " + t(locale)
row << t("link") # Seperate with ';'
@site_in_use_locales.each do |locale|
row << t("link") + " " + t("url_alt") + " - " + t(locale)
end
row << t("file_") # Seperate with ';' Example: http://www.example.com/images/example.png; http://www.example.com/images/example2.png"
@site_in_use_locales.each do |locale|
row << t("file_") + " " + t("description") + " - " + t(locale) #"Seperate with ';' with respective to the links in the link columns. Example : Great view; Nice potrait"
end
@site_in_use_locales.each do |locale|
row << t("file_") + " " + t("alternative") + " - " + t(locale) #"Seperate with ';' with respective to the links in the link columns. Example : example1; example2"
end
@venue_management.venue_management_signup_fields.asc(:_id).each do |rf|
if rf.can_muti_lang_input?
@site_in_use_locales.each do |l|
row << rf.title + " (#{t(l.to_s)})"
end
else
row << rf.title
end end
end @site_in_use_locales.each do |locale|
row << t('vm_contract.note') + " - " + t(locale)
sheet.add_row row end
row << t("link")
@venue_management.venue_management_signups.each do |signup| @site_in_use_locales.each do |locale|
row << t("link") + " " + t("url_alt") + " - " + t(locale)
row2 = [] end
row << t("file_")
row2 << "#{signup.created_at} " @site_in_use_locales.each do |locale|
row2 << "#{signup[:name]} " row << t("file_") + " " + t("description") + " - " + t(locale)
row2 << "#{signup.unit} " end
row2 << "#{signup[:tel]} " @site_in_use_locales.each do |locale|
row2 << "#{signup[:phone]} " row << t("file_") + " " + t("alternative") + " - " + t(locale)
row2 << "#{signup[:fax]} " end
row2 << "#{signup.address} " sheet.add_row row
row2 << "#{signup[:email]} " @venue_management.venue_management_contracts.each do |contract|
row2 << "#{signup.note} " row2 = []
row2 << contract.venue_management_inviting.case_no
@venue_management.venue_management_signup_fields.asc(:_id).each do |rf| row2 << contract.display_tags
if rf.can_muti_lang_input? row2 << contract.display_contractors
@site_in_use_locales.each do |l| row2 << "#{contract.early_rent} / #{contract.operation_rent}"
row2 << nl2br(show_attribute_value(@venue_management.get_attribute_value(rf,signup.id).get_value_by_locale(l))) rescue ' ' row2 << contract.royalty
row2 << t("vm_inviting.enums.#{contract.house_tax_payer}")+"/"+t("vm_inviting.enums.#{contract.land_tax_payer}")
row2 << contract.renewal_permission.present? ? t("vm_contract.renewal.#{contract.renewal_permission}") : t("vm_contract.renewal.false")
row2 << "#{contract.contract_start_date} ~ #{contract.contract_end_date}"
row2 << "#{contract.construction_start_date} ~ #{contract.construction_end_date}"
row2 << "#{contract.operation_start_date} ~ #{contract.operation_end_date}"
row2 << "#{contract.free_period_start_date} ~ #{contract.free_period_end_date}"
row2 << contract.sign_date
row2 << contract.handover_date
row2 << contract.deposit_payment_date
row2 << contract.deposit_type
row2 << contract.deposit_exp_date
row2 << contract.insurance_type
row2 << contract.insurance_payment_deadline
row2 << contract.insurance_payment_date
@site_in_use_locales.each do |locale|
row2 << contract.other_commitment_translations[locale]
end end
else @site_in_use_locales.each do |locale|
row2 << nl2br(show_attribute_value(@venue_management.get_attribute_value(rf,signup.id).get_value_by_locale(I18n.locale))) rescue ' ' row2 << contract.note_translations[locale]
end end
row2 << contract.venue_management_links.map{|l| l.url.to_s.strip}.join(";")
@site_in_use_locales.each do |locale|
row2 << contract.venue_management_links.map{|l| l.title_translations[locale].to_s.strip}.join(";")
end
row2 << contract.venue_management_files.map{|f| @host + f.file.url rescue nil}.select{|s| !s.nil?}.join(";")
@site_in_use_locales.each do |locale|
row2 << contract.venue_management_files.map{|f| f.description_translations[locale].to_s.strip}.join(";")
end
@site_in_use_locales.each do |locale|
row2 << contract.venue_management_files.map{|f| f.title_translations[locale].to_s.strip}.join(";")
end
sheet.add_row row2
end end
sheet.add_row row2
end
end end
wb.add_worksheet(name: t('restful_actions.venue_management_invitings')) do |sheet|
row = []
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
@venue_management.venue_management_invitings.each do |inviting|
row2 = []
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 << inviting.details_translations[locale]
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
wb.add_worksheet(name: t('restful_actions.venue_management_memorabilias')) do |sheet|
row = []
row << t('vm_memorabilia.case_no')
row << t('vm_memorabilia.event_date')
@site_in_use_locales.each do |locale|
row << t('vm_memorabilia.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
@venue_management.venue_management_memorabilias.each do |memorabilia|
row2 = []
row2 << memorabilia.case_no
row2 << memorabilia.event_date
@site_in_use_locales.each do |locale|
row2 << memorabilia.details_translations[locale]
end
row2 << memorabilia.venue_management_links.map{|l| l.url.to_s.strip}.join(";")
@site_in_use_locales.each do |locale|
row2 << memorabilia.venue_management_links.map{|l| l.title_translations[locale].to_s.strip}.join(";")
end
row2 << memorabilia.venue_management_files.map{|f| @host + f.file.url rescue nil}.select{|s| !s.nil?}.join(";")
@site_in_use_locales.each do |locale|
row2 << memorabilia.venue_management_files.map{|f| f.description_translations[locale].to_s.strip}.join(";")
end
@site_in_use_locales.each do |locale|
row2 << memorabilia.venue_management_files.map{|f| f.title_translations[locale].to_s.strip}.join(";")
end
sheet.add_row row2
end
end

View File

@ -0,0 +1,386 @@
<% # encoding: utf-8 %>
<% if params[:type] == "print" %>
<!DOCTYPE html>
<html>
<head>
<title><%= @venue_management.title %></title>
<link rel="stylesheet" type="text/css" media="all" href="//stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<%= stylesheet_link_tag "bootstrap/bootstrap.min.css" ,:media => "all" %>
</head>
<body>
<style type="text/css">
.no-print, .no-print *
{
display: none;
}
@media print {
a[href]:after {
content: none !important;
}
}
</style>
<style type="text/css" media="print">
@page
{
size: auto;
margin: 0mm;
}
</style>
<% end %>
<script src="https://html2canvas.hertzen.com/dist/html2canvas.js"></script>
<%= javascript_include_tag "jspdf.min" %>
<style>
#print_btn {
outline: 0;
border-radius: 1.3em;
background: #d9e4f7;
font-weight: bold;
outline: 0;
}
#print_btn:hover {
background: #be8a8a;
}
.print_text{
padding: 2em;
width: 650px;
margin: auto;
}
@media print
{
.no-print, .no-print *
{
display: none !important;
}
}
</style>
<% @save_name = @venue_management.title %>
<div class="no-print" style="text-align: center;">
<a class="btn no-print" href="?type=print" id="print_btn"><%= I18n.t('venue_management.print_pdf') %></a>
</div>
<div class="print_text">
<table class="table table-striped venue_managementive-show-table">
<tbody >
<tr>
<th class="venue_managementive-title-field"><%= t(:category) %></th>
<td class="venue_managementive-title-value"><%= @venue_management.category.title %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('venue_management.event_during') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_time_range %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('venue_management.title') %></th>
<td class="venue_managementive-title-value"><%= @venue_management.title %></td>
</tr>
<% if !@venue_management.speaker.blank? %>
<tr>
<th class="venue_managementive-title-field"><%= t('venue_management.speaker') %></th>
<td class="venue_managementive-title-value"><%= @venue_management.speaker %></td>
</tr>
<% end %>
<% if !@venue_management.content.blank? %>
<tr>
<th class="venue_managementive-title-field"><%= t('venue_management.content') %></th>
<td class="venue_managementive-title-value"><%= nl2br(@venue_management.content) %></td>
</tr>
<% end %>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('venue_management.signup_during') %></th>
<td class="venue_managementive-title-value"><%= @sign_up_time_range %></td>
</tr>
<% if !@contribute_time_range.blank? %>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('venue_management.contribute_during') %></th>
<td class="venue_managementive-title-value"><%= @contribute_time_range %></td>
</tr>
<% end %>
<tr>
<th class="venue_managementive-title-field"><%= t('venue_management.signup') %></th>
<td class="venue_managementive-title-value"><%= @sign_up %><br /><%= @contribute_action %></td>
</tr>
<% if !@venue_management.act_place.blank? %>
<tr>
<th class="venue_managementive-title-field"><i class="icon-flag"></i><%= t('venue_management.act_place') %></th>
<td class="venue_managementive-title-value"><%= @venue_management.act_place %></td>
</tr>
<% end %>
<% if !@venue_management.venue_management_files.blank? %>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-fw fa-paperclip"></i><%= t(:file_) %></th>
<td class="venue_managementive-title-value">
<% @venue_management.venue_management_files.map do |file| %>
<%= link_to (file.title.blank? ? File.basename(file.file.path) : file.title) , file.file.url, {:target => '_blank', :title => file.description} if file.file.file %>
<% end %>
</td>
</tr>
<% end %>
<% if !@venue_management.venue_management_links.blank? %>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-fw fa-link"></i><%= t(:link) %></th>
<td class="venue_managementive-title-value">
<% @venue_management.venue_management_links.map do |link| %>
<%= link_to (link.title.blank? ? link.url : link.title), link.url, :target => '_blank' %>
<% end %>
</td>
</tr>
<% end %>
<% @venue_management.venue_management_item_contents.asc(:_id).each do |item_content| %>
<tr>
<th class="venue_managementive-title-field"><%= item_content.venue_management_item.title %></th>
<td class="venue_managementive-title-value"><%= item_content.content.html_safe %></td>
</tr>
<% end %>
<!-- 履約紀錄 -->
<% @venue_management_contract = @venue_management.venue_management_contracts.desc(:id).first %>
<% if !@venue_management_contract.nil? %>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_contract.case_no') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.venue_management_inviting.case_no %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_inviting.type') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.display_tags %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('venue_management.contractor') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.display_contractors %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_inviting.rents') %></th>
<td class="venue_managementive-title-value"><%= "#{@venue_management_contract.early_rent} / #{@venue_management_contract.operation_rent}" %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_inviting.royalty') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.royalty %></td>
</tr>
<tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_inviting.house_land_tax_payer') %></th>
<td class="venue_managementive-title-value"><%= t("vm_inviting.enums.#{@venue_management_contract.house_tax_payer}")+"/"+t("vm_inviting.enums.#{@venue_management_contract.land_tax_payer}") %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_contract.renewal_permission') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.renewal_permission.present? ? t("vm_contract.renewal.#{@venue_management_contract.renewal_permission}") : t("vm_contract.renewal.false") %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('vm_contract.start_end') %></th>
<td class="venue_managementive-title-value"><%= "#{@venue_management_contract.contract_start_date} ~ #{@venue_management_contract.contract_end_date}" %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('vm_contract.construction_start_end') %></th>
<td class="venue_managementive-title-value"><%= "#{@venue_management_contract.construction_start_date} ~ #{@venue_management_contract.construction_end_date}" %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('vm_contract.operation_start_end') %></th>
<td class="venue_managementive-title-value"><%= "#{@venue_management_contract.operation_start_date} ~ #{@venue_management_contract.operation_end_date}" %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('vm_contract.free_period_start_end') %></th>
<td class="venue_managementive-title-value"><%= "#{@venue_management_contract.free_period_start_date} ~ #{@venue_management_contract.free_period_end_date}" %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('vm_contract.sign_date') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.sign_date %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('vm_contract.handover_date') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.handover_date %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('vm_contract.deposit_payment_date') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.deposit_payment_date %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_contract.deposit_type') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.deposit_type %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('vm_contract.deposit_exp_date') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.deposit_exp_date %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_contract.insurance_type') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.insurance_type %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('vm_contract.insurance_payment_deadline') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.insurance_payment_deadline %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('vm_contract.insurance_payment_date') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.insurance_payment_date %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_contract.other_commitment') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.other_commitment %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_contract.note') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.note %></td>
</tr>
<% if !@venue_management_contract.venue_management_files.blank? %>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-fw fa-paperclip"></i><%= t(:file_) %></th>
<td class="venue_managementive-title-value">
<% @venue_management_contract.venue_management_files.map do |file| %>
<%= link_to (file.title.blank? ? File.basename(file.file.path) : file.title) , file.file.url, {:target => '_blank', :title => file.description} if file.file.file %>
<% end %>
</td>
</tr>
<% end %>
<% if !@venue_management_contract.venue_management_links.blank? %>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-fw fa-link"></i><%= t(:link) %></th>
<td class="venue_managementive-title-value">
<% @venue_management_contract.venue_management_links.map do |link| %>
<%= link_to (link.title.blank? ? link.url : link.title), link.url, :target => '_blank' %>
<% end %>
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
<br />
<% if params[:type] != "print" %>
<ul class="venue_management-plugins nav nav-pills" role="tablist" data-list="plugins" data-level="0">
<li class="active"><a href="#contract_history" role="tab" data-toggle="tab" title="<%=t('venue_management.contract_history')%>" aria-expanded="true"><%=t('venue_management.contract_history')%></a></li>
<li class=""><a href="#inviting_history" role="tab" data-toggle="tab" title="<%=t('venue_management.inviting_history')%>" aria-expanded="false"><%=t('venue_management.inviting_history')%></a></li>
<li class=""><a href="#memorabilia" role="tab" data-toggle="tab" title="<%=t('venue_management.memorabilia')%>" aria-expanded="false"><%=t('venue_management.memorabilia')%></a></li>
</ul>
<% end %>
<div class="tab-content" data-list="plugins" data-level="0">
<% if params[:type] == "print" %>
<h3><%=t('venue_management.contract_history')%></h3>
<% end %>
<div class="<%= (params[:type] == "print") ? "" : "tab-pane active" %>" id="contract_history">
<div class="info" data-list="plugin_data_intro" data-level="1">
</div>
<table class="table table-hover table-striped dt-responsive nowrap dataTable" id="table0">
<thead>
<tr data-list="pd_title" data-level="1">
<% @table_fields = [
'vm_contract.case_no',
'vm_contract.vendor',
'vm_contract.start_end',
'vm_contract.renewal_permission',
'vm_contract.note',
] %>
<% @table_fields.each do |th| %>
<th><%=t(th)%></th>
<% end %>
</tr>
</thead>
<tbody data-level="1" data-list="plugin_datas">
<% @contracts = @venue_management.venue_management_contracts.to_a %>
<% @contracts.each do |contract| %>
<tr>
<td>
<%= link_to contract.case_no, "/#{I18n.locale}"+@venue_management_page_url+"/#{contract.case_no.to_s.strip}-#{contract.id}?method=show_contract" , :target => '_blank' %>
</td>
<td><%= contract.display_contractors %></td>
<td><%= "#{contract.contract_start_date} / #{contract.contract_end_date}" %></td>
<td><%= contract.renewal_permission.present? ? t("vm_contract.renewal.#{contract.renewal_permission}") : t("vm_contract.renewal.false") %></td>
<td><%= contract.note %></td>
</tr>
<% end%>
</tbody>
</table>
</div>
<% if params[:type] == "print" %>
<h3><%=t('venue_management.inviting_history')%></h3>
<% end %>
<div class="<%= (params[:type] == "print") ? "" : "tab-pane" %>" id="memorabilia">
<div class="info" data-list="plugin_data_intro" data-level="1">
</div>
<%
@table_fields = [
'vm_memorabilia.case_no',
'vm_memorabilia.event_date',
'vm_memorabilia.details'
]
@memorabilias = @venue_management.venue_management_memorabilias.to_a
%>
<table class="table table-hover table-striped dt-responsive nowrap dataTable" id="table0">
<thead>
<tr data-list="pd_title" data-level="1">
<% @table_fields.each do |th| %>
<th><%=t(th)%></th>
<% end %>
</tr>
</thead>
<tbody data-level="1" data-list="plugin_datas">
<% @memorabilias.each do |memorabilia| %>
<tr data-level="2" data-list="pd_datas">
<td>
<%= link_to memorabilia.case_no, "/#{I18n.locale}"+@venue_management_page_url+"/#{memorabilia.case_no.to_s.strip}-#{memorabilia.id}?method=show_memorabilia", :target => '_blank' %>
</td>
<td><%= memorabilia.event_date %></td>
<td><%= memorabilia.details %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% if params[:type] == "print" %>
<h3><%=t('venue_management.memorabilia')%></h3>
<% end %>
<div class="<%= (params[:type] == "print") ? "" : "tab-pane" %>" id="inviting_history">
<div class="info" data-list="plugin_data_intro" data-level="1">
</div>
<%
@table_fields = [
'vm_inviting.case_no',
'vm_inviting.publish_times',
'vm_inviting.rents',
'vm_inviting.royalty',
'vm_inviting.house_land_tax_payer',
'vm_inviting.contractor_manager',
'vm_inviting.bid_result',
]
@invitings = @venue_management.venue_management_invitings.to_a
%>
<table class="table table-hover table-striped dt-responsive nowrap dataTable" id="table0">
<thead>
<tr data-list="pd_title" data-level="1">
<% @table_fields.each do |th| %>
<th><%=t(th)%></th>
<% end %>
</tr>
</thead>
<tbody data-level="1" data-list="plugin_datas">
<% @invitings.each do |inviting| %>
<tr data-level="2" data-list="pd_datas">
<td>
<%= link_to inviting.case_no, "/#{I18n.locale}"+@venue_management_page_url+"/#{inviting.case_no.strip}-#{inviting.id}?method=show_inviting", :target => '_blank' %>
</td>
<td><%= inviting.publish_times %></td>
<td><%= "#{inviting.early_rent} / #{inviting.operation_rent}" %></td>
<td><%= inviting.royalty %></td>
<td><%= t("vm_inviting.enums.#{inviting.house_tax_payer}") + "/" + t("vm_inviting.enums.#{inviting.land_tax_payer}") %></td>
<td><%= inviting.contractor_manager %></td>
<td><%= t("vm_inviting.enums.bid_result.#{inviting.bid_result}") %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
<% if params[:type] == "print" %>
<script type="text/javascript">
document.onreadystatechange = window.print();
</script>
</body>
</html>
<% end %>

View File

@ -5,6 +5,7 @@ en:
label: "" label: ""
empty: none empty: none
restful_actions: restful_actions:
print_pdf: Print
act_signup: Sign Up Info #報名資料 act_signup: Sign Up Info #報名資料
venue_management_submission_field: VenueManagement Submission Field venue_management_submission_field: VenueManagement Submission Field
venue_management_signup_field: VenueManagement Signup Field venue_management_signup_field: VenueManagement Signup Field
@ -20,6 +21,7 @@ en:
verification_failed: Verification Failed #驗證碼錯誤 verification_failed: Verification Failed #驗證碼錯誤
venue_management: venue_management:
print_pdf: Print
send_email_reminder: Send email reminder send_email_reminder: Send email reminder
before: Before before: Before
day_send_email: day send email day_send_email: day send email

View File

@ -5,6 +5,7 @@ zh_tw:
label: "" label: ""
empty: empty:
restful_actions: restful_actions:
print_pdf: 列印
act_signup: 報名資料 act_signup: 報名資料
venue_management_submission_field: 上傳介面欄位 venue_management_submission_field: 上傳介面欄位
venue_management_signup_field: 報名欄位 venue_management_signup_field: 報名欄位
@ -20,6 +21,7 @@ zh_tw:
verification_failed: 驗證碼錯誤 verification_failed: 驗證碼錯誤
venue_management: venue_management:
print_pdf: 列印
send_email_reminder: 寄送Email提醒 send_email_reminder: 寄送Email提醒
before: 提前 before: 提前
day_send_email: 天寄送 day_send_email: 天寄送

View File

@ -15,6 +15,7 @@ Rails.application.routes.draw do
get 'venue_management_invitings' get 'venue_management_invitings'
get 'venue_management_memorabilias' get 'venue_management_memorabilias'
get 'venue_management_contracts' get 'venue_management_contracts'
get 'print_pdf'
end end
end end
resources :venue_management_items do resources :venue_management_items do