olympiamanagement/app/views/olympiamanagements/print_registration_form.htm...

73 lines
3.1 KiB
Plaintext

<!DOCTYPE html>
<html>
<head>
<%=@head%>
<link href="/assets/contest.css" rel="stylesheet" type="text/css">
<%= stylesheet_link_tag "template/template" , :media=>'print' %>
</head>
<body style="background-color: white;margin: 0.8em;">
<div id="main1"><div id="main2"><div id="main">
<%=@breadcumb%>
<table class="print_contest1"><tbody>
<tr><th colspan="4"><font face="標楷體, cursive"><font size="6" style="font-size: 1.67em;"><%=@record_form_title%></font></font></th></tr>
<% @record_fields.each_with_index do |record_block,i| %>
<tr>
<% record_block.each_with_index do |record_item,td_index| %>
<td <%=((i==@record_fields.count-1) ? "style=line-height:80px;" : "")%>><%=t('olympiamanagement.'+record_item.to_s)%></td>
<% if record_item == "enrollment_limited"%>
<% @olympia_school_data_field = OlympiaSchoolDataFields.find(@olympia_school_data_fields_id)%>
<% if(@olympia_school_data_field.enrollment_limited.to_i == 0) %>
<td><%= ClassSettingFields.all.select{|class_setting_field| class_setting_field.class_number_range[0] <= @olympia_school_data_field.class_number && class_setting_field.class_number_range[1] >= @olympia_school_data_field.class_number}.first.enrollment_available.to_s rescue ClassSettingFields.all.desc(:enrollment_available).first.enrollment_available.to_s %></td>
<% else %>
<td><%= @olympia_school_data_field.enrollment_limited %></td>
<% end %>
<% else %>
<td <%= ((td_index == record_block.count-1) ? "colspan=#{3-td_index*2}" : "") %> <%=((i==@record_fields.count-1) ? "style=line-height:80px;" : "")%>><%=(@school_data[record_item.to_s].nil? ? '&nbsp;'.html_safe : @school_data[record_item.to_s]) %></td>
<% end %>
<% end %>
</tr>
<% end %>
</tbody></table>
<table class="print_contest2">
<tbody>
<tr><td><%=@remark_texts%><br></td></tr>
</tbody>
</table>
<table class="print_contest3"><tbody>
<tr>
<% @student_fields.each do |field_name| %>
<td><%=t('olympiamanagement.'+field_name.to_s)%></td>
<% end %>
</tr>
<% @student_data_list.each_with_index do |field,i| %>
<tr>
<% @student_fields.each do |th_name|%>
<% if th_name == 'serial_number' %>
<td><%= "#{i+1}" %></td>
<%elsif th_name != 'birth_date'%>
<% @value = field[th_name] %>
<% @index = @field_infos.map{|hash| hash.keys[0]}.index(th_name) rescue nil%>
<% if !@index.nil? %>
<% @value = @field_infos.map{|hash| hash.values[0]}[@index]['choices'].index(@value) if @field_infos.map{|hash| hash.values[0]}[@index]['type'] == 'radio' %>
<% (['String','Year','select_num','File'].include?(@field_infos.map{|hash| hash.values[0]}[@index]['type'])) ? (nil) : (@value=(@field_infos.map{|hash| hash.values[0]}[@index]['values'][I18n.locale.to_s][@value.to_i].to_s rescue @value))%>
<% end %>
<td><%= @value %></td>
<% else %>
<td><%= "#{field.StudentBirthYear}-#{field.StudentBirthMonth}-#{field.StudentBirthDay}" %></td>
<% end %>
<% end %>
</tr>
<%end%>
</tbody></table>
<script type="text/javascript">
window.onload = function (){
text = document;
print(text);
};
</script>
</div></div></div></div></div></div></div>
</body>
</html>