venue_management/app/views/admin/venue_managements/venue_management_signup.htm...

216 lines
9.6 KiB
Plaintext
Raw Permalink Normal View History

2020-05-07 15:26:34 +00:00
<span id="index_table">
<script>
if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
</script>
<form id="module-search-form">
<div class="sc-field">
<input id="filter-input" class="search-query input-medium" type="text" name="search" value="<%= params[:search] %>" placeholder="搜尋">
</div>
</form>
<h4><%= @venue_management.title %></h4>
<table class="table main-list">
<thead>
<tr class="sort-header">
<% if @venue_management.venue_management_signup_field_sets.count != 0 %>
<% @venue_management.venue_management_signup_field_sets.each do |field_set| %>
<% if !(field_set.hidden) %>
<th class='span2'><%= field_set.name[I18n.locale] %></th>
<% end %>
<% end %>
<% else %>
<th class='span2'><%= t('venue_management_signup.name')%></th>
<th class='span2'><%= t('venue_management_signup.tel')%></th>
<th class='span2'><%= t('venue_management.registration_status')%></th>
<% end %>
<% if @venue_management.venue_management_signup_field_customs.count != 0 %>
<% @venue_management.venue_management_signup_field_customs.each do |field_set| %>
<% if !(field_set.hidden) %>
<th class='span2'><%= VenueManagementSignupField.where(id:field_set.venue_management_signup_field_id).first.title rescue '' %></th>
<% end %>
<% end %>
<% end %>
<% if @venue_management.venue_management_submission_field_sets.count != 0 %>
<% show1 = !(@venue_management.venue_management_submission_field_sets.select{|v| v.field_name=='title'}[0].hidden)
show2 = !(@venue_management.venue_management_submission_field_sets.select{|v| v.field_name=='file'}[0].hidden)
show3 = !(@venue_management.venue_management_submission_field_sets.select{|v| v.field_name=='description'}[0].hidden)
%>
<% else %>
<% show1 = true
show2 = true
show3 = true
%>
<% end %>
<% if show1 %>
<th class='span2'><%= t('venue_management_signup.title')%></th>
<% end %>
<% if show2 %>
<th class='span2'><%= t('venue_management_signup.file')%></th>
<% end %>
<% if show3 %>
<th class='span2'><%= t('venue_management_signup.description')%></th>
<% end %>
<% @venue_management.venue_management_submission_fields.asc(:_id).each do |submission_field| %>
<th class='span2'><%= submission_field.title %></th>
<% end %>
</tr>
</thead>
<tbody>
<% @venue_management_signups.each do |venue_management_signup| %>
<% len = venue_management_signup.venue_management_signup_contributes.count %>
<tr>
<% if @venue_management.venue_management_signup_field_sets.count != 0 %>
<% @venue_management.venue_management_signup_field_sets.each do |field_set| %>
<% if !(field_set.hidden) %>
<td rowspan="<%= len==0? 1 : len %>">
<% if field_set.field_name== 'name' %>
<%= venue_management_signup.name %>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if can_edit_or_delete?(venue_management_signup) %>
<li><a href="/admin/venue_management_signups/<%=venue_management_signup.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/venue_management_signups/<%=venue_management_signup.id.to_s%>"><%= t(:delete_) %></a></li>
<% end %>
</ul>
</div>
<% elsif field_set.field_name== 'status' %>
<%= t("venue_management.registration_status_#{venue_management_signup.status}") if !venue_management_signup.status.blank? %>
<% elsif field_set.field_name != 'recaptcha' %>
<%= venue_management_signup.send("#{field_set.field_name}") %>
<% end %>
</td>
<% end %>
<% end %>
<% else %>
<td rowspan="<%= len==0? 1 : len %>">
<%= venue_management_signup.name %>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if can_edit_or_delete?(venue_management_signup) %>
<li><a href="/admin/venue_management_signups/<%=venue_management_signup.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/venue_management_signups/<%=venue_management_signup.id.to_s%>"><%= t(:delete_) %></a></li>
<% end %>
</ul>
</div>
</td>
<td rowspan="<%= len==0? 1 : len %>"><%= venue_management_signup.tel %></td>
<td rowspan="<%= len==0? 1 : len %>"><%= t("venue_management.registration_status_#{venue_management_signup.status}") if !venue_management_signup.status.blank? %>
</td>
<% end %>
<% if @venue_management.venue_management_signup_field_customs.count != 0 %>
<% @venue_management.venue_management_signup_field_customs.each do |field_set| %>
<% if !(field_set.hidden) %>
<td rowspan="<%= len==0? 1 : len %>">
<% venue_management_signup.venue_management_signup_values.each do |venue_management_signup_values| %>
<% if venue_management_signup_values.venue_management_signup_field_id == field_set.venue_management_signup_field_id %>
<% if venue_management_signup_values.value.class == String || venue_management_signup_values.value.nil? %>
<%= venue_management_signup_values.get_value_by_locale(I18n.locale,venue_management_signup_values) %>
<% else %>
<% venue_management_signup_values.value.each do |key,v| %>
<%= "#{I18n.t(key)}:#{venue_management_signup_values.get_value_by_locale(key,venue_management_signup_values)}" %>
<br>
<% end %>
<% end %>
<% end %>
<% end %>
</td>
<% end %>
<% end %>
<% end %>
<% count_set = 0 %>
<% if @venue_management.venue_management_submission_field_sets.count != 0 %>
<% show1 = !(@venue_management.venue_management_submission_field_sets.select{|v| v.field_name=='title'}[0].hidden)
show2 = !(@venue_management.venue_management_submission_field_sets.select{|v| v.field_name=='file'}[0].hidden)
show3 = !(@venue_management.venue_management_submission_field_sets.select{|v| v.field_name=='description'}[0].hidden)
%>
<% @venue_management.venue_management_submission_field_sets.each do |field_set| %>
<% if !(field_set.hidden) %>
<% count_set+=1 %>
<% end %>
<% end %>
<% else %>
<% show1 = true
show2 = true
show3 = true
%>
<% count_set = 2 %>
<% end %>
<% if len==0 %>
<%
count_field = @venue_management.venue_management_submission_fields.count
%>
<ul>
<% for i in 1..count_field+count_set %>
<td rowspan="1">
</td>
<% end %>
</ul>
</tr>
<% end %>
<ul>
<% venue_management_signup.venue_management_signup_contributes.collect do |venue_management_signup_contribute| %>
<% if show1 %>
<td>
<li><%= venue_management_signup_contribute.title.to_s %></li>
</td>
<% end %>
<% if show2 %>
<td>
<li>
<%= link_to (venue_management_signup_contribute.title.blank? ? File.basename(venue_management_signup_contribute.file.path) : venue_management_signup_contribute.title) , venue_management_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(venue_management_signup_contribute.description).text} if venue_management_signup_contribute.file.file %>
</li>
</td>
<% end %>
<% if show3 %>
<td>
<li><%= venue_management_signup_contribute.description.to_s.html_safe %></li>
</td>
<% end %>
<%
count_value = venue_management_signup_contribute.venue_management_submission_values.count
count_field = @venue_management.venue_management_submission_fields.count
%>
<% if count_value == count_field %>
<% venue_management_signup_contribute.venue_management_submission_values.asc(:venue_management_submission_field_id).each do |value| %>
<td>
<span style="display: list-item;">
<% if value.value.class == String || value.value.nil? %>
<%= value.get_value_by_locale(I18n.locale,value) %>
<% else %>
<% value.value.each do |key,v| %>
<%= "#{I18n.t(key)}:#{value.get_value_by_locale(key,value)}" %>
<br>
<% end %>
<% end %>
</span>
</td>
<% end %>
<% else %>
<% for i in 1..(count_field-count_value) %>
<td>
</td>
<% end %>
<% end %>
</tr>
<tr>
<% end %>
</ul>
</tr>
<% end %>
</tbody>
</table>
<%=
content_tag :div, class: "bottomnav clearfix" do
content_tag :div, paginate(@venue_management_signups), class: "pagination pagination-centered"
end
%>
</span>
<%= render 'layouts/delete_modal', delete_options: @delete_options %>