2019-11-23 09:49:18 +00:00
|
|
|
|
$(document).ready(function(){
|
|
|
|
|
$('.cancer_help_btn').append('<i aria-hidden="true" class="fa fa-question"></i>');
|
|
|
|
|
$('.cancer_help_btn').off("click").on('click',function(){
|
|
|
|
|
var modal_head = "";
|
|
|
|
|
try{ modal_head = $(this).parent().find(">label").html()}catch{};
|
|
|
|
|
var modal_body = "";
|
|
|
|
|
try{ modal_body = $(this).parent().find(">input.help_texts").attr('value')}catch{};
|
|
|
|
|
$('#show_help_modal').html("<div class='modal-dialog'><div class='modal-content'><div class='modal-header'><button type='button' aria-hidden='true' class='close'>×</button><h4 class='modal-title'>"+modal_head+"</h4>"+
|
|
|
|
|
"</div><div class='modal-body'>"+modal_body+"</div><div class='modal-footer'><button type='button' class='btn btn-default'>Close</button></div></div></div>")
|
|
|
|
|
$('#show_help_modal').modal('show');
|
|
|
|
|
$('#show_help_modal .close').off("click").on('click',function(){
|
|
|
|
|
$('#show_help_modal').modal('hide');
|
|
|
|
|
});
|
|
|
|
|
$('#show_help_modal .modal-footer button').off("click").on('click',function(){
|
|
|
|
|
$('#show_help_modal').modal('hide');
|
|
|
|
|
});
|
|
|
|
|
});
|
2019-12-03 13:17:09 +00:00
|
|
|
|
$('.btn-add').click(function(){
|
|
|
|
|
$(this).parent().find('.num_only').removeClass('cancertable_empty');
|
|
|
|
|
if($(this).parent().find('.num_only').val()!=""){
|
|
|
|
|
var input_value = Number($(this).parent().find('.num_only').val());
|
|
|
|
|
if(Array.isArray($(this).parent().find('.num_only').data('range'))){
|
|
|
|
|
var compare_value = $(this).parent().find('.num_only').data('range')[1];
|
|
|
|
|
if(compare_value != undefined){
|
|
|
|
|
if(input_value+1 <= Number(compare_value))
|
|
|
|
|
$(this).parent().find('.num_only').val(input_value+1);
|
|
|
|
|
else{
|
|
|
|
|
input_value = $(this).parent().find('.num_only').data('range')[0];
|
|
|
|
|
if(input_value != undefined)
|
|
|
|
|
$(this).parent().find('.num_only').val(input_value);
|
|
|
|
|
};
|
|
|
|
|
}else{
|
|
|
|
|
$(this).parent().find('.num_only').val(input_value+1);
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
}else{
|
|
|
|
|
try{
|
|
|
|
|
var input_value = $(this).parent().find('.num_only').data('range')[0];
|
|
|
|
|
if(input_value != undefined)
|
|
|
|
|
$(this).parent().find('.num_only').val(input_value);
|
|
|
|
|
}catch{
|
|
|
|
|
$(this).parent().find('.num_only').val(0);
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
$('.btn-sub').click(function(){
|
|
|
|
|
$(this).parent().find('.num_only').removeClass('cancertable_empty');
|
|
|
|
|
if($(this).parent().find('.num_only').val()!=""){
|
|
|
|
|
var input_value = Number($(this).parent().find('.num_only').val());
|
|
|
|
|
if(Array.isArray($(this).parent().find('.num_only').data('range'))){
|
|
|
|
|
var compare_value = $(this).parent().find('.num_only').data('range')[0];
|
|
|
|
|
if(compare_value != undefined){
|
|
|
|
|
if(input_value-1 >= Number(compare_value))
|
|
|
|
|
$(this).parent().find('.num_only').val(input_value-1);
|
|
|
|
|
else{
|
|
|
|
|
input_value = $(this).parent().find('.num_only').data('range')[1];
|
|
|
|
|
if(input_value != undefined)
|
|
|
|
|
$(this).parent().find('.num_only').val(input_value);
|
|
|
|
|
};
|
|
|
|
|
}else{
|
|
|
|
|
$(this).parent().find('.num_only').val(input_value-1);
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
}else{
|
|
|
|
|
try{
|
|
|
|
|
var input_value = $(this).parent().find('.num_only').data('range')[1];
|
|
|
|
|
if(input_value != undefined)
|
|
|
|
|
$(this).parent().find('.num_only').val(input_value);
|
|
|
|
|
}catch{
|
|
|
|
|
$(this).parent().find('.num_only').val(0);
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
$('.cancer_table_btn').click(function(){
|
|
|
|
|
var index = $(this).index()/2;
|
|
|
|
|
$(this).parent().find('>input').attr('value',0);
|
|
|
|
|
$(this).parent().find('>input').eq(index).attr('value',1);
|
|
|
|
|
$(this).parent().find('>button').removeClass('active');
|
|
|
|
|
$(this).addClass('active');
|
|
|
|
|
$(this).parent().removeClass('cancertable_empty');
|
|
|
|
|
});
|
|
|
|
|
$('#cancer_table_reset').click(function(){
|
|
|
|
|
$('.cancer_table_btn').removeClass('active');
|
|
|
|
|
$('.cancer-btn-group input').attr('value',0);
|
|
|
|
|
$('.num_only').val('');
|
|
|
|
|
$('.cancer_form_field').removeClass('cancertable_empty');
|
|
|
|
|
});
|
|
|
|
|
$('#cancer_table_submit').click(function(){
|
2019-12-07 04:12:33 +00:00
|
|
|
|
var flag;
|
|
|
|
|
flag = 1;
|
2019-12-03 13:17:09 +00:00
|
|
|
|
for(var i = 0;i < $('.cancer_form_field').length;i++){
|
|
|
|
|
if($('.cancer_form_field').eq(i).hasClass('num_only')){
|
|
|
|
|
if($('.cancer_form_field').eq(i).val()==""){
|
|
|
|
|
flag = 0;
|
|
|
|
|
$('.cancer_form_field').eq(i).addClass('cancertable_empty');
|
|
|
|
|
}else{
|
|
|
|
|
$('.cancer_form_field').eq(i).removeClass('cancertable_empty');
|
|
|
|
|
};
|
|
|
|
|
}else{
|
|
|
|
|
if($('.cancer_form_field').eq(i).find('[value="1"]').length == 0){
|
|
|
|
|
flag = 0;
|
|
|
|
|
$('.cancer_form_field').eq(i).addClass('cancertable_empty');
|
|
|
|
|
}else{
|
|
|
|
|
$('.cancer_form_field').eq(i).removeClass('cancertable_empty');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
if(flag == 1){
|
|
|
|
|
var post_json= {};
|
|
|
|
|
for(var i = 0;i < $('.cancer_form_field').length;i++){
|
|
|
|
|
var name = $('.cancer_form_field').eq(i).attr('id')
|
|
|
|
|
if($('.cancer_form_field').eq(i).hasClass('num_only'))
|
|
|
|
|
post_json[name] = $('.cancer_form_field').eq(i).val();
|
|
|
|
|
else{
|
|
|
|
|
var index = ($('.cancer_form_field').eq(i).find('[value="1"]').index()+1)/2;
|
|
|
|
|
post_json[name] = index;
|
|
|
|
|
};
|
|
|
|
|
};
|
2019-12-07 04:12:33 +00:00
|
|
|
|
var result = $.post("/cancerpredictResult",{"data":post_json});
|
|
|
|
|
result.done(function(){
|
|
|
|
|
$('#result_table_content').html(result.responseJSON.table);
|
|
|
|
|
})
|
2019-12-03 13:17:09 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
2019-12-07 04:12:33 +00:00
|
|
|
|
for(var i = 0;i < $('.result_tab').length;i++){
|
|
|
|
|
$('.result_tab').eq(i).attr('index',i)
|
|
|
|
|
};
|
|
|
|
|
for(var i = 0;i < $('.result_content').length;i++){
|
|
|
|
|
$('.result_content').eq(i).attr('index',i)
|
|
|
|
|
};
|
|
|
|
|
$('.result_tab').click(function(){
|
|
|
|
|
var index = $(this).attr('index');
|
|
|
|
|
$('.result_content').css('display','none');
|
|
|
|
|
$('.result_content[index="'+index+'"]').css('display','block');
|
|
|
|
|
})
|
2019-11-28 14:58:03 +00:00
|
|
|
|
$('.num_only').focus
|
|
|
|
|
for(var i=0;i<$('.num_only').length;i++)
|
|
|
|
|
$('.num_only').eq(i).data('range')
|
2019-11-23 09:49:18 +00:00
|
|
|
|
});
|