153 lines
3.7 KiB
JavaScript
153 lines
3.7 KiB
JavaScript
var captchaWidgetId;
|
|
var onloadCallback = function() {
|
|
var recaptchaId = $("#recaptchaId").val();
|
|
|
|
if ($('#captcha').length) {
|
|
captchaWidgetId = grecaptcha.render('captcha', {
|
|
'sitekey': recaptchaId,
|
|
'callback': captchaVerifyCallback,
|
|
'expired-callback': function() { },
|
|
'theme': 'light'
|
|
});
|
|
|
|
}
|
|
};
|
|
|
|
var captchaVerifyCallback = function(response) {
|
|
$('.captchaError').remove();
|
|
};
|
|
|
|
$(document).ready(function() {
|
|
$(".otp-new").otp({
|
|
callback: function() {
|
|
location.href = contextPath + "/login";
|
|
}
|
|
});
|
|
|
|
$("a.proj-flow").click(function() {
|
|
location.href = $(this).attr("href");
|
|
});
|
|
|
|
setFormValidation('#cmpRegisterValidation');
|
|
setFormValidation("#agencyRegistrationValidation");
|
|
setFormValidation('#saRegisterValidation');
|
|
});
|
|
|
|
$("form").submit(function() {
|
|
$('.captchaError').remove();
|
|
if (grecaptcha.getResponse(captchaWidgetId) == "") {
|
|
$("#captcha").append('<label class="captchaError">Please verify that you are not a robot.</label>');
|
|
return false;
|
|
}
|
|
});
|
|
|
|
// Wizard Initialization
|
|
$('.card-wizard').bootstrapWizard({
|
|
'tabClass': 'nav nav-pills',
|
|
|
|
onInit: function(tab, navigation, index) {
|
|
//check number of tabs and fill the entire row
|
|
var $wizard = navigation.closest('.card-wizard');
|
|
|
|
$first_li = navigation.find('li:first-child a').html();
|
|
$moving_div = $('<div class="moving-tab">' + $first_li + '</div>');
|
|
$('.card-wizard .wizard-navigation').append($moving_div);
|
|
|
|
refreshAnimation($wizard, index);
|
|
$('.moving-tab').css('transition', 'transform 0s');
|
|
},
|
|
|
|
onTabShow: function(tab, navigation, index) {
|
|
var $total = navigation.find('li').length;
|
|
var $current = index + 1;
|
|
|
|
var $wizard = navigation.closest('.card-wizard');
|
|
|
|
// If it's the last tab then hide the last button and show the finish instead
|
|
if ($current >= $total) {
|
|
$($wizard).find('.btn-next').hide();
|
|
$($wizard).find('.btn-finish').show();
|
|
} else {
|
|
$($wizard).find('.btn-next').show();
|
|
$($wizard).find('.btn-finish').hide();
|
|
}
|
|
|
|
button_text = navigation.find('li:nth-child(' + $current + ') a').html();
|
|
|
|
setTimeout(function() {
|
|
$('.moving-tab').text(button_text);
|
|
}, 150);
|
|
|
|
refreshAnimation($wizard, index);
|
|
}
|
|
});
|
|
|
|
|
|
$('.set-full-height').css('height', 'auto');
|
|
|
|
$(window).resize(function() {
|
|
$('.card-wizard').each(function() {
|
|
$wizard = $(this);
|
|
|
|
index = $wizard.bootstrapWizard('currentIndex');
|
|
refreshAnimation($wizard, index);
|
|
|
|
$('.moving-tab').css({
|
|
'transition': 'transform 0s'
|
|
});
|
|
});
|
|
});
|
|
|
|
function refreshAnimation($wizard, index) {
|
|
$total = $wizard.find('.nav li').length;
|
|
$li_width = 100 / $total;
|
|
|
|
total_steps = $wizard.find('.nav li').length;
|
|
move_distance = $wizard.width() / total_steps;
|
|
index_temp = index;
|
|
vertical_level = 0;
|
|
|
|
mobile_device = $(document).width() < 600 && $total > 3;
|
|
|
|
if (mobile_device) {
|
|
move_distance = $wizard.width() / 2;
|
|
index_temp = index % 2;
|
|
$li_width = 50;
|
|
}
|
|
|
|
$wizard.find('.nav li').css('width', $li_width + '%');
|
|
|
|
step_width = move_distance;
|
|
move_distance = move_distance * index_temp;
|
|
|
|
$current = index + 1;
|
|
|
|
if ($current == 1 || (mobile_device == true && (index % 2 == 0))) {
|
|
move_distance -= 8;
|
|
} else if ($current == total_steps || (mobile_device == true && (index % 2 == 1))) {
|
|
move_distance += 8;
|
|
}
|
|
|
|
if (mobile_device) {
|
|
vertical_level = parseInt(index / 2);
|
|
vertical_level = vertical_level * 38;
|
|
}
|
|
|
|
$wizard.find('.moving-tab').css('width', step_width);
|
|
$('.moving-tab').css({
|
|
'transform': 'translate3d(' + move_distance + 'px, ' + vertical_level + 'px, 0)',
|
|
'transition': 'all 0.5s cubic-bezier(0.29, 1.42, 0.79, 1)'
|
|
|
|
});
|
|
}
|
|
|
|
function hidePic(e) {
|
|
var checkbox = e.target;
|
|
if (checkbox.checked) {
|
|
document.getElementById('picOwner').hidden = true;
|
|
} else {
|
|
$('#sameAsOwner').val("false");
|
|
document.getElementById('picOwner').hidden = false;
|
|
}
|
|
}
|