forked from spen/seminar
341 lines
16 KiB
Plaintext
341 lines
16 KiB
Plaintext
<%= form_for @seminar_signup, url: admin_seminar_signup_path(@seminar_signup), html: {class: "form-horizontal main-forms", multipart: true} do |f| %>
|
|
<fieldset>
|
|
|
|
<% content_for :page_specific_css do %>
|
|
<%= stylesheet_link_tag "lib/main-forms" %>
|
|
<%= stylesheet_link_tag "lib/fileupload" %>
|
|
<%= stylesheet_link_tag "lib/main-list" %>
|
|
<% end %>
|
|
<% content_for :page_specific_javascript do %>
|
|
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
|
|
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
|
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
|
|
<%= javascript_include_tag "lib/datetimepicker/date.time.picker.js" %>
|
|
<%= javascript_include_tag "lib/file-type" %>
|
|
<%= javascript_include_tag "lib/module-area" %>
|
|
<% end %>
|
|
<style type="text/css">
|
|
.emails_sent_groups{
|
|
display: inline-block;
|
|
}
|
|
.emails_sent_time{
|
|
min-height: 1em;
|
|
display: inline-block;
|
|
}
|
|
</style>
|
|
<!-- Input Area -->
|
|
<div class="input-area">
|
|
|
|
<!-- Language -->
|
|
<div class="tab-content">
|
|
|
|
|
|
<!-- Title -->
|
|
<div class="control-group">
|
|
<label for="title" class="control-label muted"><%= t('seminar.title') %></label>
|
|
<div class="controls">
|
|
<%= @seminar.title %>
|
|
</div>
|
|
</div>
|
|
<% if @seminar.seminar_signup_field_sets.count != 0 %>
|
|
<% @seminar.seminar_signup_field_sets.each do |signup_field| %>
|
|
<% if !(signup_field.disabled) && signup_field.field_name != 'recaptcha' %>
|
|
<div class="control-group<%= (@seminar.registration_status[0] == 'G' && signup_field.field_name == 'password') ? ' hide' : '' %>" id="<%= signup_field.field_name == 'password' ? 'registration_status' : '' %>">
|
|
<label for="<%= signup_field['name'][I18n.locale] %>" class="control-label muted">
|
|
<%= signup_field['name'][I18n.locale] %>
|
|
</label>
|
|
<% if signup_field.field_name == 'status' %>
|
|
|
|
<div class="controls">
|
|
<% if @seminar.registration_status.include?('G') %>
|
|
<label class="radio-inline">
|
|
<%= f.radio_button :status, 'G', :checked => (@seminar_signup.status=='G'), :onclick => "$('#registration_status').addClass('hide');" %> <%= t('seminar.registration_status_G') %>
|
|
</label>
|
|
<% end %>
|
|
<% if @seminar.registration_status.include?('C') %>
|
|
<label class="radio-inline">
|
|
<%= f.radio_button :status, 'C', :onclick => "$('#registration_status').removeClass('hide');", :checked => (@seminar_signup.status=='C') %> <%= t('seminar.registration_status_C') %>
|
|
</label>
|
|
<% end %>
|
|
</div>
|
|
<% elsif signup_field.field_name == 'unit' %>
|
|
<div class="controls">
|
|
<div class="input-append">
|
|
<div class="tab-content">
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="unit_<%= locale %>">
|
|
<%= f.fields_for "unit_translations".to_sym do |f| %>
|
|
<%= f.text_field locale, :class=>"input-block-level", :value => (@seminar_signup.send("unit_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}", :required => true %>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<div class="btn-group" data-toggle="buttons-radio">
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#unit_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% elsif signup_field.field_name == 'address' %>
|
|
<div class="controls">
|
|
<div class="input-append">
|
|
<div class="tab-content">
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="address_<%= locale %>">
|
|
<%= f.fields_for "address_translations".to_sym do |f| %>
|
|
<%= f.text_field locale, :class=>"input-block-level", :value => (@seminar_signup.send("address_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}" %>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<div class="btn-group" data-toggle="buttons-radio">
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#address_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% elsif signup_field.field_name == 'email' %>
|
|
<div class="controls">
|
|
<%= f.email_field :email, :class=>"input-block-level", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
|
|
</div>
|
|
<div class="controls">
|
|
<label class="radio-inline">
|
|
<%= f.check_box :is_confirmed, :checked => (@seminar_signup.is_confirmed)%>
|
|
<%= f.hidden_field :is_confirmed_date %>
|
|
<%= t('seminar_signup.is_confirmed') %>
|
|
</label>
|
|
</div>
|
|
<br />
|
|
<div class="controls">
|
|
<label for="send_email" class="control-label muted"><%= t("seminar_signup.send_email") %></label>
|
|
<div class="controls">
|
|
<select name="send_email" id="send_email">
|
|
<option value=""><%= t("seminar.select_email_type") %></option>
|
|
<option value="reset_password"><%= t("seminar.reset_password") %></option>
|
|
<option value="special_reminder"><%= t("seminar.special_reminder") %></option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<br />
|
|
<div class="controls">
|
|
<label class="control-label muted"><%= t("seminar_signup.predefined_text") %></label>
|
|
<div class="controls">
|
|
<p id="predefined_text"> </p>
|
|
</div>
|
|
</div>
|
|
<br />
|
|
<div class="controls">
|
|
<label for="send_email_text" class="control-label muted"><%= t("seminar_signup.send_email_text") %></label>
|
|
<div class="controls">
|
|
<textarea class="" name="send_email_text" id="send_email_text" row="20" col="30"></textarea>
|
|
</div>
|
|
</div>
|
|
<br />
|
|
<div class="controls">
|
|
<div class="controls">
|
|
<a class="btn" id="send_email_button"><%= t("seminar.send_email_button") %></a>
|
|
</div>
|
|
</div>
|
|
<br />
|
|
<div class="controls">
|
|
<label for="" class="control-label muted"><%= t("seminar_signup.emails_already_sent") %></label>
|
|
<div class="controls" id="emails_sent">
|
|
<% @seminar_signup.emails_sent_groups.each do |em, em_date| %>
|
|
<span class="emails_sent_groups">
|
|
<span class="label label-success">
|
|
<%= t("seminar.#{em}") %>
|
|
</span>
|
|
<br />
|
|
<span class="emails_sent_time">
|
|
<% if em_date %>
|
|
<%= em_date.strftime("%Y/%m/%d %H:%M") %>
|
|
<% end %>
|
|
</span>
|
|
</span>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% elsif signup_field.field_name == 'note' %>
|
|
<div class="controls">
|
|
<div class="input-append">
|
|
<div class="tab-content">
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="note_<%= locale %>">
|
|
<%= f.fields_for "note_translations".to_sym do |f| %>
|
|
<%= f.text_area locale, rows: 5, :class=>"input-block-level", :value => (@seminar_signup.send("note_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}" %>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<div class="btn-group" data-toggle="buttons-radio">
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#note_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% else %>
|
|
<div class="controls">
|
|
<%= f.text_field signup_field['field_name'], :class=>"input-block-level", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :required => (signup_field.field_name=='password' ? false : true) %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
<% else %>
|
|
<div class="control-group">
|
|
<label for="status" class="control-label muted"><%= t('seminar.registration_status') %></label>
|
|
<div class="controls">
|
|
<% if @seminar.registration_status.include?('G') %>
|
|
<label class="radio-inline">
|
|
<%= f.radio_button :status, 'G', :checked => true , :onclick => "$('#registration_status').addClass('hide');" %> <%= t('seminar.registration_status_G') %>
|
|
</label>
|
|
<% end %>
|
|
<% if @seminar.registration_status.include?('C') %>
|
|
<label class="radio-inline">
|
|
<%= f.radio_button :status, 'C', :onclick => "$('#registration_status').removeClass('hide');", :checked => (@seminar.registration_status.count == 1 and @seminar.registration_status.include?('C') ? true : false) %> <%= t('seminar.registration_status_C') %>
|
|
</label>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<div class="col-sm-12"> *(required) </div>
|
|
</div>
|
|
|
|
<!-- Name to Last Name -->
|
|
<div class="control-group">
|
|
<label for="name" class="control-label muted">*<%= t('seminar_signup.name') %></label>
|
|
<div class="controls">
|
|
<%= f.text_field :name, :class=>"input-block-level", :id=>'name', :placeholder=> t('seminar_signup.name'), :required => true %>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Tel to First Name -->
|
|
<div class="control-group">
|
|
<label for="tel" class="control-label muted">*<%= t('seminar_signup.tel') %></label>
|
|
<div class="controls">
|
|
<%= f.text_field :tel, :class=>"input-block-level", :placeholder=> t('seminar_signup.tel'), :required => true %>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Email -->
|
|
<div class="control-group">
|
|
<label for="email" class="control-label muted">*<%= t(:email) %></label>
|
|
<div class="controls">
|
|
<%= f.email_field :email, :class=>"input-block-level", :placeholder=> t(:email), :required => true %> <a href="#" onclick="window.open(' <%= OrbitHelper.url_to_show(@seminar.to_param) %>?method=check_email&no=<%=@seminar.id%>&layout=false&email='+ $('input[type=email]').val() , 'check mail', config='height=100,width=300');" class="btn btn-primary">check mail</a>
|
|
</div>
|
|
</div>
|
|
|
|
<% end %>
|
|
<% @form_index = 0 %>
|
|
<% @seminar.seminar_signup_fields.where(:disabled=>false).asc(:sort_number, :_id).each do |rf| %>
|
|
|
|
<div class="control-group">
|
|
|
|
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.markup == "file_field" ? false : rf.to_require) %>
|
|
|
|
</div>
|
|
|
|
<% @form_index = @form_index +1 %>
|
|
|
|
<% end %>
|
|
|
|
<div class="controls">
|
|
<label class="radio-inline">
|
|
<%= f.check_box :signup_confirmed, :checked => (@seminar_signup.signup_confirmed)%>
|
|
<%= f.hidden_field :signup_confirmed_date %>
|
|
<%= t('seminar_signup.registration_complete') %>
|
|
</label>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- Form Actions -->
|
|
<div class="form-actions">
|
|
<%#= get_referer_url[:action] rescue "" %>
|
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
|
<%= link_to t('cancel'), "/admin/seminars/#{@seminar.id}/seminar_signup", :class=>"btn" %>
|
|
</div>
|
|
|
|
|
|
</fieldset>
|
|
<% end %>
|
|
<script>
|
|
$(document).ready(function(){
|
|
$("#send_email").on("change", function(){
|
|
if($(this).val() != ""){
|
|
let type = $(this).val();
|
|
$.ajax({
|
|
url : "/admin/seminars/get_predefined_text",
|
|
data : {"type" : type, "seminar_id": "<%= @seminar.id %>"},
|
|
dataType : "json",
|
|
type : "get",
|
|
success : function(data){
|
|
if (type === 'reset_password'){
|
|
$('#seminar_signup_status_c').click();
|
|
}
|
|
if( data.success == true ){
|
|
$("#predefined_text").html(data.html);
|
|
}
|
|
}
|
|
})
|
|
}
|
|
})
|
|
$("#send_email_button").on("click",function(){
|
|
if($("#seminar_signup_email").val() == ""){
|
|
alert("No email");
|
|
return false;
|
|
}
|
|
if($("#send_email").val() != ""){
|
|
$.ajax({
|
|
url : "/admin/seminars/send_notifying_email",
|
|
data : {
|
|
"type" : $("#send_email").val(),
|
|
"email" : $("#seminar_signup_email").val(),
|
|
"text" : $("#send_email_text").val(),
|
|
"seminar_id": "<%= @seminar.id %>"
|
|
},
|
|
dataType : "json",
|
|
type : "post",
|
|
success : function(data){
|
|
if( data.success == true ){
|
|
alert("Email Sent");
|
|
$("#emails_sent").append('<span class="emails_sent_groups"><span class="label label-success">'+ data.type +'</span><br/><span class="emails_sent_time">' +data.sent_time +'</span></span>');
|
|
}
|
|
}
|
|
})
|
|
}
|
|
return false;
|
|
})
|
|
})
|
|
$(".upload").on("change",function(){
|
|
filenamedom = $(this).parent().parent().find(".filename");
|
|
filenameA = $(this).val().split('\\');
|
|
filenamedom.text(filenameA[filenameA.length - 1]);
|
|
})
|
|
$("#seminar_signup_signup_confirmed").on("change",function () {
|
|
if(this.checked){
|
|
dt = new Date();
|
|
format = dt.getFullYear() + "/" + dt.getMonth() + "/" + dt.getDate() + " " + dt.getHours() + ":" + dt.getMinutes();
|
|
$("#seminar_signup_signup_confirmed_date").val(format);
|
|
}else{
|
|
$("#seminar_signup_signup_confirmed_date").val("");
|
|
}
|
|
})
|
|
|
|
$("#seminar_signup_is_confirmed").on("change",function () {
|
|
if(this.checked){
|
|
dt = new Date();
|
|
format = dt.getFullYear() + "/" + dt.getMonth() + "/" + dt.getDate() + " " + dt.getHours() + ":" + dt.getMinutes();
|
|
$("#seminar_signup_is_confirmed_date").val(format);
|
|
}else{
|
|
$("#seminar_signup_is_confirmed_date").val("");
|
|
}
|
|
})
|
|
|
|
</script> |