hps_member/app/views/member_counselors/_form.html.erb

62 lines
2.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<table width="100%" border="1">
<tr>
<th>學年度</th>
<td>
<%
yearnow = Time.now.strftime("%Y").to_i - 1
total = yearnow - 1911
min = total - 10
%>
<%= f.select :year, (0..10).collect{|i|[(total - i),(total - i)]} %>
<% if current_counselor_user.user_type == 0 %>
<span style="color: red;">此為學年度非年度例如103年上半年為102學年度103年下半年為103學年度請注意填選</span>
<% end %>
</td>
</tr>
<tr>
<th>檔案來源</th>
<td>
<%= f.file_field :file %>
<span>
<% if !@hpsfile.file.url.nil? %>
<br />
<a href="<%= @hpsfile.file.url %>" target="_blank"><%= File.basename(@hpsfile.file.url) %></a>
<% end %>
</span>
</td>
</tr>
<tr>
<th>計畫書名稱</th>
<td>
<% if @hpsfile.new_record? %>
<% case current_counselor_user.user_type %>
<% when 0 %>
<% title = HpsCity.find(current_counselor_user.hps_city_id).name + " " + HpsCounty.find(current_counselor_user.hps_county_id).name + " " + HpsSchool.find(current_counselor_user.hps_school_id).name %>
<div id="year-span"><%= title %> <span>105</span>推動計劃書</div>
<input type="hidden" id="hps_file_title" name="hps_file[title]" value="<%= title %> 105推動計劃書">
<% when 1 %>
<div id="year-span"><span>105</span>健康促進縣市推動計劃書</div>
<input type="hidden" id="hps_file_title" name="hps_file[title]" value="105健康促進縣市推動計劃書">
<% when 2 %>
<% end %>
<% else %>
<% year = @hpsfile.title.scan(/\d/).join() %>
<div id="year-span"><%= @hpsfile.title.gsub(year, "<span>#{year}</span>").html_safe %></div>
<input type="hidden" id="hps_file_title" name="hps_file[title]" value="<%= @hpsfile.title %>">
<% end %>
</td>
</tr>
<tr>
<th>&nbsp;</th>
<td><%= f.submit "Submit", :class => "btn btn-primary" %><a href="<%= member_dash_path(current_counselor_user.account) %>" class="btn btn-default">Back</a></td>
</tr>
</table>
<script type="text/javascript">
$("#hps_file_year").on("change",function(){
var val = $(this).val();
$("#year-span span").text(val);
$("#hps_file_title").val($("#year-span").text());
})
</script>