File: /var/www/sectest.concertium.com/public_bak/wp-content/themes/dt-the7/js/script.js
jQuery(document).ready(function(){
var ajaxurl = jQuery("#ajax_url").val();
var homeurl = jQuery("#home_url").val();
jQuery('.scor-click').on('click', function() {
var categoryEnd = 0;
var nextQuestion = jQuery(this).closest('.scoring-box-panel').next('.scoring-box-panel');
if(nextQuestion.length == 0)
{
nextQuestion = jQuery(this).closest('.scoring-box-panel').next().next();
categoryEnd = 1;
}
var thisQuestion = jQuery(this).closest('.scoring-box-panel');
var answerValue = jQuery(this).val();
var answerMarks = jQuery(this).attr('data-score');
var questionType = jQuery(this).attr('data-category');
var questionId = jQuery(this).attr('data-question');
if(answerValue != '' && answerMarks != '')
{
jQuery.ajax({
url: ajaxurl,
dataType: 'json',
data: {
'action':'save_question_answer_temp',
'answerValue' : answerValue,
'answerMarks' : answerMarks,
'questionType' : questionType,
'questionId' : questionId,
'categoryEnd' : categoryEnd
},
success:function(data) {
// This outputs the result of the ajax request
//console.log(data);
if(categoryEnd == 1)
{
var chartdivID = 'scor-chart_'+questionType;
var isthumbsup = data.thumbs_up;
//var totalScoredivID = 'scor-bog-text_'+questionType;
var totalScore = data.total_score;
var maxScore = data.max_score;
jQuery('#category_result_'+questionType).show();
thisQuestion.removeClass('active');
jQuery('#scor-bog-text_'+questionType).text(totalScore);
if(isthumbsup == 0)
{
jQuery("#category_result_"+questionType).find('i').removeClass('fa fa-thumbs-up');
jQuery("#category_result_"+questionType).find('i').addClass('fa fa-thumbs-down');
}
_load_category_graph_AJAX(chartdivID,totalScore,maxScore);
jQuery("#question-type-cat_"+questionType).find('.scoring-box-panel').hide();
var helpusDiv = jQuery('#category_result_'+questionType).next('#help-us-container');
if(helpusDiv.length !== 0)
{
helpusDiv.find('.scoring-box-panel').show();
}
jQuery('html, body').animate({
scrollTop: 0
}, 100);
}
else
{
if (nextQuestion.length !== 0) {
jQuery('html, body').animate({
scrollTop: nextQuestion.offset().top - 78
}, 100, function(){
//thisQuestion.removeClass('active');
nextQuestion.addClass('active');
});
}
}
var progress_barHTML = data.progress_barHTML;
jQuery("#progress_barHTML").html(progress_barHTML);
},
error: function(errorThrown){
console.log(errorThrown);
}
});
}
});
jQuery("#question_start_button").on('click', function(){
jQuery("#question-answer-container").show();
//jQuery("#scoring_submit_button").show();
jQuery(".scoring-start-box").hide();
jQuery("#question-answer-container").find('.question-type-cat:eq(0)').show();
var questionAnswerContainer = jQuery("#question-answer-container");
jQuery('html, body').animate({
scrollTop: questionAnswerContainer.offset().top - 10
}, 200, function(){
});
});
// Save comments category wise
jQuery( ".scoring-button-category" ).each(function(index) {
jQuery(this).on("click", function(){
var questionType = jQuery(this).attr('data-category');
var categoryComments = jQuery('#category_comments_'+questionType).val();
var helpusDiv = jQuery('#category_result_'+questionType).next('#help-us-container');
if(helpusDiv.length !== 0)
{
var save_data_db = 0;
}
else
{
var save_data_db = 1;
}
jQuery.ajax({
url: ajaxurl,
dataType: 'json',
data: {
'action':'save_category_comments_temp',
'categoryComments' : categoryComments,
'questionType' : questionType,
'save_data_db' : save_data_db
},
success:function(data) {
// This outputs the result of the ajax request
//console.log(data);
if(data.res == 1)
{
var categoryDiv = jQuery('#category_result_'+questionType).parent();
var nextcategoryDiv = jQuery('#category_result_'+questionType).parent().next();
jQuery('#category_result_'+questionType).hide();
if(helpusDiv.length !== 0)
{
helpusDiv.show();
jQuery(".question-heading").hide();
}
else
{
categoryDiv.hide();
nextcategoryDiv.show();
var nextQuestion = nextcategoryDiv.find('.scoring-box-panel:eq(0)');
if(nextQuestion.length !== 0)
{
nextQuestion.addClass('active');
}
else
{
//jQuery("#scoring_submit_button").show();
}
}
jQuery('html, body').animate({
scrollTop: 0
}, 100);
}
},
error: function(errorThrown){
console.log(errorThrown);
}
});
});
});
jQuery("#helpus_text_button").on("click", function(){
var helpusFormDiv = jQuery(this).parent().next();
jQuery(this).parent().removeClass('active');
helpusFormDiv.addClass('active');
jQuery('html, body').animate({
scrollTop: jQuery(this).parent().offset().top
}, 700, function(){
});
});
// Save User contact / Help us data
jQuery("#helpus_button").on("click", function(){
var b_valid=true;
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})jQuery/;
var your_name = jQuery("#your_name").val();
var your_email = jQuery("#your_email").val();
var your_phone = jQuery("#your_phone").val();
if(your_name=="")
{
jQuery(".text-danger").show();
jQuery("#your_name").next('.text-danger').html('Please provide your name');
b_valid = false;
}
if(your_email=="")
{
jQuery(".text-danger").show();
jQuery("#your_email").next('.text-danger').html('Please provide your email');
b_valid = false;
}
else if(reg.test(jQuery.trim(your_email)) == false)
{
jQuery(".text-danger").show();
jQuery("#your_email").next('.text-danger').html("Please provide valid email");
basic_validation = 0;
b_valid=false;
}
if(your_phone=="")
{
jQuery(".text-danger").show();
jQuery("#your_phone").next('.text-danger').html('Please provide your phone no');
b_valid = false;
}
if(!b_valid)
{
return false;
}
else
{
jQuery.ajax({
url: ajaxurl,
dataType: 'json',
data: {
'action':'save_user_data',
'your_name' : your_name,
'your_email' : your_email,
'your_phone' : your_phone
},
success:function(data) {
// This outputs the result of the ajax request
//console.log(data);
if(data.res == 1)
{
var categoryDiv = jQuery('#help-us-container').parent();
jQuery('#help-us-container').hide();
categoryDiv.hide();
jQuery("#final_score").show();
jQuery("#final_score").find('.scor-chart-pan').show();
var chartdivID = 'scor-chart1';
var totalScore = data.all_total_score;
var is_thumbsup = data.thumbs_up;
var allcategoryHTML = data.allcategoryHTML;
var manage_it_score = data.manage_it_score;
var secure_it_score = data.secure_it_score;
var integrate_it_score = data.integrate_it_score;
var transforming_it_score = data.transforming_it_score;
var total_max_score = data.total_max_score;
var manage_it_max_score = data.manage_it_max_score;
var secure_it_max_score = data.secure_it_max_score;
var integrate_it_max_score = data.integrate_it_max_score;
var transforming_it_max_score = data.transforming_it_max_score;
jQuery('.scor-bog-text').text(totalScore);
if(is_thumbsup == 0)
{
jQuery('#final_score').find('i').removeClass('fa fa-thumbs-up');
jQuery('#final_score').find('i').addClass('fa fa-thumbs-down');
}
_load_category_graph_AJAX(chartdivID,totalScore,total_max_score);
jQuery('#all_category_result').html(allcategoryHTML);
jQuery("#final_comment").show();
_load_category_graph_AJAX('scor-chart_final_54',manage_it_score,manage_it_max_score);
_load_category_graph_AJAX('scor-chart_final_55',secure_it_score,secure_it_max_score);
_load_category_graph_AJAX('scor-chart_final_56',integrate_it_score,integrate_it_max_score);
_load_category_graph_AJAX('scor-chart_final_57',transforming_it_score,transforming_it_max_score);
/*
var helpusDiv = jQuery('#help-us-container').next();
var nextcategoryDiv = categoryDiv.next();
helpusDiv.hide();
categoryDiv.hide();
nextcategoryDiv.show();
var nextQuestion = nextcategoryDiv.find('.scoring-box-panel:eq(0)');
if(nextQuestion.length !== 0)
{
nextQuestion.addClass('active');
}
jQuery('html, body').animate({
scrollTop: nextcategoryDiv.offset().top
}, 300, function(){
});*/
}
},
error: function(errorThrown){
console.log(errorThrown);
}
});
}
});
// Save User contact / Help us data
jQuery("#complete_button").on("click", function(){
var finalComments = jQuery('#final_comments').val();
var contact_id = jQuery('#contact_id').val();
jQuery.ajax({
url: ajaxurl,
dataType: 'json',
data: {
'action':'save_final_comments_temp',
'finalComments' : finalComments,
'contact_id' : contact_id
},
success:function(data) {
// This outputs the result of the ajax request
//console.log(data);
if(data.res == 1)
{
window.location.href= homeurl;
}
},
error: function(errorThrown){
console.log(errorThrown);
}
});
});
jQuery('#question-answer-container').scroll(function() {
//alert('gg');
});
});
/**************************Document.ready end**************************/
jQuery(window).load(function(){
// jQuery("#question-answer-container").hide();
jQuery("#scoring_submit_button").hide();
jQuery(".scor-chart-pan").hide();
//jQuery(".question-type-cat").hide();
jQuery("#help-us-container").hide();
jQuery("#final_score").hide();
});
jQuery(window).resize(function(){
});
jQuery(window).scroll(function(){
});
function _load_category_graph_AJAX(divID,totalScore,maxScore) {
var opts = {
angle: 0, // The span of the gauge arc
lineWidth: 0.42, // The line thickness
radiusScale: 1, // Relative radius
pointer: {
length: 0.62, // // Relative to gauge radius
strokeWidth: 0.035, // The thickness
color: '#424243' // Fill color
},
limitMax: false, // If false, max value increases automatically if value > maxValue
limitMin: false, // If true, the min value of the gauge will be fixed
colorStart: '#FF671F', // Colors
colorStop: '#FF671F', // just experiment with them
strokeColor: '#D8D8D8', // to see which ones work best for you
generateGradient: true,
highDpiSupport: true, // High resolution support
};
var target = document.getElementById(divID); // your canvas element
var gauge = new Gauge(target).setOptions(opts); // create sexy gauge!
gauge.maxValue = maxScore; // set max gauge value
gauge.setMinValue(0); // Prefer setter over gauge.minValue = 0
gauge.animationSpeed = 1; // set animation speed (32 is default value)
gauge.set(totalScore); // set actual value
}