donate/app/views/nkuht_donates/index.html.erb

244 lines
10 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.

<% # encoding: utf-8 %>
<%
data = action_data
@nkuht_donate = data["nkuht_donate"]
@nkuht_donate_units = data["nkuht_donate_units"]
@nkuht_donate_departments = data["nkuht_donate_departments"]
@nkuht_donate_uses = data["nkuht_donate_uses"]
%>
<% flash.collect do |key, msg| %>
<% msg.each do |m|%>
<%=
content_tag :p do
content_tag :span, m, :class => [key, "alert alert-error in fade"]
end
%>
<% end %>
<% end %>
<%= form_for @nkuht_donate, url: nkuht_donates_path, html: {class: "content form-horizontal" , :id=>"new-nkuht-donate"} do |f| %>
<fieldset>
<div class="form-group">
<label for="is_alumni" class="col-sm-2 control-label"><%= t('nkuht_donate.is_alumni') %></label>
<div class="col-sm-10">
<label class="radio-inline">
<%= f.radio_button :is_alumni, 'true', :onclick => "$('#donation_is_alumni').removeClass('hide');" %> <%= t('nkuht_donate.yes_') %>
</label>
<label class="radio-inline">
<%= f.radio_button :is_alumni, 'false', :onclick => "$('#donation_is_alumni').addClass('hide');" %> <%= t('nkuht_donate.no_') %>
</label>
</div>
</div>
<div id="donation_is_alumni">
<div class="form-group">
<label for="graduation_department" class="col-sm-2 control-label"><%= t('nkuht_donate.graduation_department') %></label>
<div class="col-sm-10">
<%= t('nkuht_donate.department') %> <%= f.select :nkuht_donate_department_id, @nkuht_donate_departments.collect{|t| [ t.title, t.id ]}, {prompt: 'Select'} %>
</div>
</div>
<div class="form-group">
<label for="graduation_year" class="col-sm-2 control-label"><%= t('nkuht_donate.graduation_year') %></label>
<div class="col-xs-2">
<%= f.text_field :graduation_year, :id=>'graduation_year', :class=>"form-control", :placeholder=> t('nkuht_donate.graduation_year') %>
</div>
</div>
</div>
<!-- Name -->
<div class="form-group">
<label for="name" class="col-sm-2 control-label">*<%= t('nkuht_donate.name') %></label>
<div class="col-xs-5">
<%= f.text_field :name, :id=>'nkuht_donate_name', :class=>"form-control", :placeholder=> t('nkuht_donate.name'), :required => true %>
</div>
<div class="col-xs-5">
(<%= t('nkuht_donate.anonymous') %>) <input type="button" value="善心人士" class="btn btn-default" onclick="$('#nkuht_donate_name').val('善心人士');">
</div>
</div>
<div class="form-group">
<label for="donors_service_unit" class="col-sm-2 control-label"><%= t('nkuht_donate.donors_service_unit') %></label>
<div class="col-sm-10">
<%= f.text_field :donors_service_unit, :class=>"input-medium form-control", :id=>'donors_service_unit', :placeholder=> t('nkuht_donate.donors_service_unit') %>
</div>
</div>
<div class="form-group">
<label for="tel" class="col-sm-2 control-label">*<%= t('nkuht_donate.tel') %></label>
<div class="col-sm-10">
<%= f.text_field :tel, :class=>"input-medium form-control", :id=>'tel', :placeholder=> t('nkuht_donate.tel'), :required => true %>
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-2 control-label"><%= t('nkuht_donate.email') %></label>
<div class="col-sm-10">
<%= f.text_field :email, :class=>"input-medium form-control", :id=>'email', :placeholder=> t('nkuht_donate.email') %>
</div>
</div>
<div class="form-group">
<label for="donation_amount" class="col-sm-2 control-label">*<%= t('nkuht_donate.donation_amount') %></label>
<div class="col-sm-10">
<%= t('nkuht_donate.nt') %><%= f.number_field :donation_amount, :id=>'donation_amount', :min=>"1", :max=>"", :placeholder=> t('nkuht_donate.donation_amount'), :required => true %> <%= t('nkuht_donate.dollars') %><%= t('nkuht_donate.amount_note') %>)
</div>
</div>
<div class="form-group">
<label for="donation_way" class="col-sm-2 control-label"><%= t('nkuht_donate.donation_way') %></label>
<div class="col-sm-10">
<% (1..1).each do |a| %>
<label class="radio-inline">
<!-- <% if a == 2 %>
<%= f.radio_button :donation_way, a, :onclick => "$(\"input[type='number']\").prop('max',30000)" %> <%= t("nkuht_donate_ways.ways#{a}") %>
<% elsif a == 3 %>
<%= f.radio_button :donation_way, a, :onclick => "$(\"input[type='number']\").prop('max',20000)" %> <%= t("nkuht_donate_ways.ways#{a}") %>
<% else %>-->
<%= f.radio_button :donation_way, a, :onclick => "$(\"input[type='number']\").prop('max','')" %> <%= t("nkuht_donate_ways.ways#{a}") %>
<% end %>
</label>
<% end %>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
※<%= t('nkuht_donate.notice') %><br /><!--1. <%= t('nkuht_donate.notice1') %>(<a href="https://eatm.firstbank.com.tw/lio1000s8" target="_blank"><%= t('nkuht_donate.download_page') %></a>)<%= t('nkuht_donate.notice1_1') %><br />-->
<!-- 2. <%= t('nkuht_donate.notice2') %><br />-->
<!-- 3. <%= t('nkuht_donate.notice3') %><br />-->
其他捐款方式請參閱<a href="http://tku-alumni.pending.rulingcom.com/zh_tw/account/accmethod" target="_blank">捐款方式</a>
</div>
</div>
<div class="form-group">
<label for="donation_unit" class="col-sm-2 control-label"><%= t('nkuht_donate.donation_unit') %></label>
<div class="col-sm-10">
<%= f.select :nkuht_donate_unit_id, @nkuht_donate_units.collect{|t| [ t.title, t.id ]}, {prompt: 'Select'} %>
</div>
</div>
<div class="form-group">
<label for="donation_use" class="col-sm-2 control-label">*<%= t('nkuht_donate.donation_use') %></label>
<div class="col-sm-10">
<%= f.select :nkuht_donate_use_id, @nkuht_donate_uses.collect{|t| [ t.title, t.id ]}, {}, {:onChange=>"showOther(this)"} %>
<span id="donation_use_other" class="hide">
<%= t('nkuht_donate.donation_use_other') %>
<%= f.text_field :donation_use_other, :id=>'donation_use_other' %>
</span>
</div>
</div>
<div class="form-group">
<label for="has_receipt" class="col-sm-2 control-label"><%= t('nkuht_donate.has_receipt') %></label>
<div class="col-sm-10">
<label class="radio-inline">
<%= f.radio_button :has_receipt, 'true', :onclick => "$('#donation_has_receipt').removeClass('hide');" %> <%= t('nkuht_donate.yes_') %>
</label>
<label class="radio-inline">
<%= f.radio_button :has_receipt, 'false', :onclick => "$('#donation_has_receipt').addClass('hide');" %> <%= t('nkuht_donate.no_') %>
</label>
</div>
</div>
<div id="donation_has_receipt">
<div class="form-group">
<label for="receipt_title" class="col-sm-2 control-label">*<%= t('nkuht_donate.receipt_title') %></label>
<div class="col-sm-10">
<% (1..3).each do |a| %>
<label class="radio-inline">
<%= f.radio_button :receipt_title, a %> <%= t("nkuht_donate_receipt_title.title#{a}") %>
</label>
<% end %>
<%= f.text_field :receipt_title_other, :id=>'receipt_title_other' %>
</div>
</div>
<div class="form-group">
<label for="receipt_number" class="col-sm-2 control-label"><%= t('nkuht_donate.receipt_number') %></label>
<div class="col-xs-4">
<%= f.text_field :receipt_number, :id=>'receipt_number', :class=>"form-control", :placeholder=> t('nkuht_donate.receipt_number') %>
</div>
</div>
<div class="form-group">
<label for="receipt_address" class="col-sm-2 control-label">*<%= t('nkuht_donate.receipt_address') %></label>
<div class="col-sm-10">
<% (1..2).each do |a| %>
<label class="radio">
<%= f.radio_button :receipt_address, a %> <%= t("nkuht_donate_receipt_address.add#{a}") %>
</label>
<% end %>
<%= f.text_field :receipt_address_other, :class=>"input-medium form-control", :id=>'receipt_address_other' %>
</div>
</div>
</div>
<div class="form-group">
<label for="donate_public" class="col-sm-2 control-label"><%= t('nkuht_donate.donate_public') %></label>
<div class="col-sm-10">
<label class="radio-inline">
<%= f.radio_button :donate_public, 'true' %> <%= t('nkuht_donate.donate_public_yes_') %>
</label>
<label class="radio-inline">
<%= f.radio_button :donate_public, 'false' %> <%= t('nkuht_donate.donate_public_no_') %>
</label>
<label for="donate_public" class="radio-inline">(<%= t('nkuht_donate.donator_show') %>)</label>
</div>
</div>
<!-- Note -->
<div class="form-group">
<label for="note" class="col-sm-2 control-label"><%= t('nkuht_donate.note') %></label>
<div class="col-sm-10">
<%= f.text_area :note, rows: 5, :class=>"input-medium form-control", :placeholder=> t('nkuht_donate.note') %>
</div>
</div>
<div class="form-group">
<label for="note" class="col-sm-2 control-label"><%= t('nkuht_donate.recaptcha') %></label>
<div class="col-sm-10">
<%= show_simple_captcha %>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last %>">
<%= f.submit t('submit'), class: 'btn btn-primary', :id => 'button-mail' %>
<%= f.button t('cancel'), type: 'reset', class: 'btn' %>
</div>
</div>
</fieldset>
<% end %>
<script language="javascript">
function showOther() {
var text = $( "#nkuht_donate_main_nkuht_donate_use_id option:selected" ).text();
if ( text == "其他" || text == "Other" )
{
$('#donation_use_other').removeClass('hide');
}
else
{
$('#donation_use_other').addClass('hide');
}
}
</script>