2020-01-28 12:48:13 +00:00
|
|
|
$(document).ready(function(){
|
2020-01-29 11:26:44 +00:00
|
|
|
$('.class_setting_block input[type="reset"]').off('click').on('click',function(){
|
2020-01-28 12:48:13 +00:00
|
|
|
$('.col_input').val('');
|
|
|
|
});
|
2020-01-29 11:26:44 +00:00
|
|
|
$('.class_setting_block input[type="submit"]').off('click').on('click',function(){
|
2020-01-28 12:48:13 +00:00
|
|
|
var class_number_range = [];
|
2020-01-29 11:26:44 +00:00
|
|
|
class_number_range.push(Number($('.class_setting_block .col_input[name="MinClass"]').val()));
|
|
|
|
class_number_range.push(Number($('.class_setting_block .col_input[name="MaxClass"]').val()));
|
|
|
|
var enrollment_available = $('.class_setting_block .col_input#Person').val();
|
2020-01-28 12:48:13 +00:00
|
|
|
class_number_range.sort();
|
2020-01-29 11:26:44 +00:00
|
|
|
var params_array = (window.location.search.substring(1)=="") ? [] : window.location.search.substring(1).split('&').map(function(el){return el.split('=')});
|
|
|
|
var params = {};
|
|
|
|
params_array.forEach(function(el){params[el[0]] = el[1]});
|
|
|
|
var params_to_send = {'type':'class_setting','class_number_range':class_number_range,'enrollment_available':enrollment_available};
|
|
|
|
params_to_send = Object.assign(params,params_to_send);
|
|
|
|
var post_data = $.post('/admin/olympiamanagements/update_school_data',params_to_send);
|
|
|
|
post_data.done(function(){
|
|
|
|
window.location.search="";
|
|
|
|
});
|
2020-01-28 12:48:13 +00:00
|
|
|
});
|
2020-01-31 10:52:53 +00:00
|
|
|
$('.fieldset_block input[type="submit"]').click(function(){
|
|
|
|
$el = $('.fieldset_block li.required');
|
|
|
|
for(var i = 0; i< $el.length ; i++){
|
|
|
|
if($el.eq(i).siblings('.col_r').find('.required').val() == ""){
|
|
|
|
$el.eq(i).addClass('errFld');
|
|
|
|
if($el.eq(i).siblings('.col_r').find('.errMsg').length == 0)
|
|
|
|
$el.eq(i).siblings('.col_r').append('<div id="SchoolName-E" class="errMsg"> '+((I18n.locale == "en") ? 'Required field': '必填欄位')+'</div>');
|
|
|
|
}else{
|
|
|
|
$el.eq(i).removeClass('errFld');
|
|
|
|
$el.eq(i).siblings('.col_r').find('.errMsg').remove();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
if($('.fieldset_block .required.errFld').length != 0)
|
|
|
|
return false;
|
|
|
|
else
|
|
|
|
return true;
|
|
|
|
})
|
2020-01-29 11:26:44 +00:00
|
|
|
var $el = $('.fieldset_block select');
|
|
|
|
for(var i = 0 ; i < $el.length ; i++)
|
2020-01-31 10:52:53 +00:00
|
|
|
if($el.eq(i).attr('value') != "" && $el.eq(i).attr('value') != undefined)
|
|
|
|
$el.eq(i).find('option[value='+$el.eq(i).attr('value')+']').attr('selected','selected');
|
|
|
|
CKEDITOR.replaceAll();
|
2020-01-28 12:48:13 +00:00
|
|
|
});
|