<% data = action_data @application_form = data["application_form"] @application_form_signup = data["application_form_signup"] @time_now = data["time_now"] @form_index = 0 email_regex = @application_form.get_email_regex(true) if data["prefix_url"] prefix_url = data["prefix_url"] else prefix_url = OrbitHelper.url_to_show(@application_form.to_param) end %> <% if @application_form.application_form_start_date < @time_now and ( @application_form.application_form_end_date.nil? or @application_form.application_form_end_date+1.days > @time_now ) %> <%#= stylesheet_link_tag "lib/main-forms" %> <%= stylesheet_link_tag "basic/bootstrap-datetimepicker" %> <%= javascript_include_tag "lib/bootstrap-datetimepicker" %> <%= javascript_include_tag "lib/datetimepicker/date.time.picker.js" %> <%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %> <% notice = flash["notice"] || params[:notice] %> <% flash.each do |key, msg| %> <% next if key.to_s == "notice" %> <%= content_tag :p, msg, :class => [key, "alert alert-error in fade"], :style => "color: red; font-weight: bold;" %> <% end %> <% if notice.present? %> <%= content_tag :p, params[:notice], :class => ["notice alert alert-error in fade"], :style => "color: red; font-weight: bold;" %> <% end %> <%= form_for @application_form_signup, url: application_forms_path, html: {class: "content form-horizontal" , :id=>"new-application_form-signup"} do |f| %>
<%= @application_form.title %>
<% if !@application_form.signup_note.blank? %>
<%= @application_form.signup_note.html_safe %>
<% end %>
*(<%= t('application_form.required') %>)
<% if @application_form.application_form_signup_field_sets.count != 0 %> <% @application_form.application_form_signup_field_sets.each do |signup_field| %> <% if !(signup_field.disabled) && signup_field.field_name != 'recaptcha' %>
<% if signup_field.field_name == 'status' %> <% status_translations = ['G','C'].map{|c| [c, t("application_form.registration_status_#{c}")] }.to_h %> <% status_translations = {'G'=>'No','C'=>'Yes'} if (signup_field.name.values.select{|v| v.include?('?') || v.include?('是否')}.count != 0 rescue false) %>
<% if @application_form.registration_status.include?('G') %> <% end %> <% if @application_form.registration_status.include?('C') %> <% end %>
<% elsif signup_field.field_name == 'unit' %>
<%= f.text_field 'unit', :class=>"input-medium form-control", :value => (@application_form_signup.send("unit_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}", :required => true %>
<% elsif signup_field.field_name == 'address' %>
<% @site_in_use_locales.each_with_index do |locale, i| %>
" id="address_<%= locale %>"> <%= f.fields_for "address_translations".to_sym do |f| %> <%= f.text_field locale, :class=>"input-medium form-control", :value => (@application_form_signup.send("address_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}" %> <% end %>
<% end %>
<% @site_in_use_locales.each_with_index do |locale, i| %> " href="#address_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %> <% end %>
<% elsif signup_field.field_name == 'email' %>
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
<% elsif signup_field.field_name == 'note' %>
<% @site_in_use_locales.each_with_index do |locale, i| %>
" id="note_<%= locale %>"> <%= f.fields_for "note_translations".to_sym do |f| %> <%= f.text_area locale, rows: 5, :class=>"input-medium form-control", :value => (@application_form_signup.send("note_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}" %> <% end %>
<% end %>
<% @site_in_use_locales.each_with_index do |locale, i| %> " href="#note_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %> <% end %>
<% else %>
<%= f.text_field signup_field['field_name'], :class=>"input-medium form-control", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :required => (signup_field.field_name=='password' ? false : true) %>
<% end %>
<% end %> <% end %> <% else %>
<% if @application_form.registration_status.include?('G') %> <% end %> <% if @application_form.registration_status.include?('C') %> <% end %>
<%= f.text_field :name, :class=>"input-medium form-control", :id=>'name', :placeholder=> t('application_form_signup.name'), :required => true %>
<%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> t('application_form_signup.tel'), :required => true %>
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email), :required => true %>
<% end %> <% @application_form.reviewer_enables.each_with_index do |flag,k| %> <% if flag %>
<% tmp = Array(@application_form.reviewer_ids_list[k]) %> <% if @application_form.reviewer_type_list[k]=='fixed' %> <%= MemberProfile.where(:id.in=>tmp).collect{|m| m.name}.join(', ') %> <% else %> <%= render partial: 'application_forms/email_selection_box', locals: {field: "#{f.object_name}[reviewer_ids_list][#{k}][]", email_members: [], member_profiles: (tmp.count == 0 ? MemberProfile.all : MemberProfile.where(:id.in=>tmp)), index: "#{k+1}", select_name: "reviewer_ids_list_#{k}"} %> <% end %>
<% end %> <% end %> <% @application_form.application_form_signup_fields.asc(:_id).each do |rf| %>
<%= rf.block_helper(@application_form,@form_index,false,"application_form_signup",@application_form_signup, rf.to_require) %>
<% @form_index = @form_index +1 %> <% end %> <% if @application_form.application_form_signup_field_sets.count != 0 %> <% if !(@application_form.application_form_signup_field_sets.select{|v| v.field_name=='recaptcha'}[0].disabled) %>
<%= gotcha_error %> <%= gotcha %>
<% end %> <% end %>
"> <%= f.submit "Submit", class: 'btn btn-primary', :id => 'button-mail' %> <%= f.button "Delete", type: 'reset', class: 'btn' %>
<% end %> <% elsif @application_form.application_form_start_date > @time_now %> <%= t('application_form.sign_up_not_yet') %> <% else %> <%= t('application_form.sign_up_overdue') %> <% end %>