donate/app/views/admin/nkuht_donates/_form.html.erb

243 lines
10 KiB
Plaintext
Raw Normal View History

2015-01-30 07:02:08 +00:00
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<!-- Input Area -->
<div class="input-area">
<!-- Language -->
<div class="tab-content language-area">
<div class="control-group input-is_alumni">
<label class="control-label muted"><%= t('nkuht_donate.is_alumni') %></label>
<div class="controls">
<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" class="<%= @nkuht_donate.is_alumni.blank? ? 'hide' : '' %>">
<div class="control-group input-department">
<label class="control-label muted"><%= t('nkuht_donate.graduation_department') %></label>
<div class="controls">
<%= 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="control-group input-graduation_year">
<label class="control-label muted"><%= t('nkuht_donate.graduation_year') %></label>
<div class="controls">
<%= f.text_field :graduation_year, :id=>'graduation_year', :placeholder=> t('nkuht_donate.graduation_year') %>
</div>
</div>
</div>
<div class="control-group input-name">
<label class="control-label muted">*<%= t('nkuht_donate.name') %></label>
<div class="controls">
<%= f.text_field :name, :class=>"input-block-level", :placeholder=> t('nkuht_donate.name'), :required => true %>
</div>
</div>
<div class="control-group input-donors_service_unit">
<label class="control-label muted"><%= t('nkuht_donate.donors_service_unit') %></label>
<div class="controls">
<%= f.text_field :donors_service_unit, :class=>"input-block-level", :id=>'donors_service_unit', :placeholder=> t('nkuht_donate.donors_service_unit') %>
</div>
</div>
<div class="control-group input-tel">
<label class="control-label muted">*<%= t('nkuht_donate.tel') %></label>
<div class="controls">
<%= f.text_field :tel, :class=>"input-block-level", :id=>'tel', :placeholder=> t('nkuht_donate.tel'), :required => true %>
</div>
</div>
<div class="control-group input-email">
<label class="control-label muted"><%= t('nkuht_donate.email') %></label>
<div class="controls">
<%= f.text_field :email, :class=>"input-block-level", :id=>'email', :placeholder=> t('nkuht_donate.email') %>
</div>
</div>
<div class="control-group input-donation_amount">
<label class="control-label muted">*<%= t('nkuht_donate.donation_amount') %></label>
<div class="controls">
新台幣<%= f.text_field :donation_amount, :id=>'donation_amount', :placeholder=> t('nkuht_donate.donation_amount'), :required => true %> 元(請輸入數字)
</div>
</div>
<div class="control-group input-donation_way">
<label class="control-label muted"><%= t('nkuht_donate.donation_way') %></label>
<div class="controls">
<% (1..6).each do |a| %>
<label class="radio inline">
<% if a == 5 %>
<%= f.radio_button :donation_way, a, :onclick => "$('#cheque_number').removeClass('hide');" %> <%= t("nkuht_donate_ways.ways#{a}") %>
<% else %>
<%= f.radio_button :donation_way, a, :onclick => "$('#cheque_number').addClass('hide');" %> <%= t("nkuht_donate_ways.ways#{a}") %>
<% end %>
</label>
<% end %>
</div>
</div>
<div class="control-group input-cheque_number <%= @nkuht_donate.donation_way == '5' ? '' : 'hide'%>" id="cheque_number">
<label class="control-label muted"><%= t('nkuht_donate.cheque_number') %></label>
<div class="controls">
<%= f.text_field :cheque_number, :placeholder=> t('nkuht_donate.cheque_number') %>
</div>
</div>
<div class="control-group input-donation_unit">
<label class="control-label muted"><%= t('nkuht_donate.donation_unit') %></label>
<div class="controls">
<%= f.select :nkuht_donate_unit_id, @nkuht_donate_units.collect{|t| [ t.title, t.id ]}, {prompt: 'Select'} %>
</div>
</div>
<div class="control-group input-donation_use">
<label class="control-label muted">*<%= t('nkuht_donate.donation_use') %></label>
<div class="controls">
<%= f.select :nkuht_donate_use_id, @nkuht_donate_uses.collect{|t| [ t.title, t.id ]}, {}, {:onChange=>"showOther(this)"} %>
<span id="donation_use_other" class="<%= @showother %>">
<%= t('nkuht_donate.donation_use_other') %>
<%= f.text_field :donation_use_other, :id=>'donation_use_other' %>
</span>
</div>
</div>
<div class="control-group input-has_receipt">
<label class="control-label muted"><%= t('nkuht_donate.has_receipt') %></label>
<div class="controls">
<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" class="<%= @nkuht_donate.has_receipt.blank? ? 'hide' : '' %>">
<div class="control-group input-receipt_title">
<label class="control-label muted">*<%= t('nkuht_donate.receipt_title') %></label>
<div class="controls">
<% (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="control-group input-receipt_number">
<label class="control-label muted"><%= t('nkuht_donate.receipt_number') %></label>
<div class="controls">
<%= f.text_field :receipt_number, :id=>'receipt_number', :placeholder=> t('nkuht_donate.receipt_number') %>
</div>
</div>
<div class="control-group input-receipt_address">
<label class="control-label muted"><%= t('nkuht_donate.receipt_address') %></label>
<div class="controls">
<% (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-block-level", :id=>'receipt_title_other' %>
</div>
</div>
</div>
<div class="control-group input-donate_public">
<label class="control-label muted"><%= t('nkuht_donate.donate_public') %></label>
<div class="controls">
<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">(將姓名及捐款金額公告於芳名錄)</label>
</div>
</div>
<div class="control-group input-note">
<label class="control-label muted"><%= t('nkuht_donate.note') %></label>
<div class="controls">
<%= f.text_area :note, rows: 5, :class=>"input-block-level", :placeholder=> t('nkuht_donate.note') %>
</div>
</div>
<div class="control-group input-donation_payment_status">
<label class="control-label muted"><%= t('nkuht_donate.donation_payment_status') %></label>
<div class="controls">
<label class="radio inline">
<%= f.radio_button :donation_payment_status, 'true' %> <%= t('nkuht_donate.yes_') %>
</label>
<label class="radio inline">
<%= f.radio_button :donation_payment_status, 'false' %> <%= t('nkuht_donate.no_') %>
</label>
</div>
</div>
<div class="control-group input-donation_write_off_status">
<label class="control-label muted"><%= t('nkuht_donate.donation_write_off_status') %></label>
<div class="controls">
<label class="radio inline">
<%= f.radio_button :donation_write_off_status, 'true' %> <%= t('nkuht_donate.yes_') %>
</label>
<label class="radio inline">
<%= f.radio_button :donation_write_off_status, 'false' %> <%= t('nkuht_donate.no_') %>
</label>
</div>
</div>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= get_referer_url[:action] rescue "" %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<% if !params['page'].blank? %>
<input type="hidden" name="referer_url" value="<%= get_referer_url + "?page=" + params['page'] %>">
<% else %>
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
<% end %>
<%= link_to t('cancel'), admin_nkuht_donates_path, :class=>"btn" %>
</div>
<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>