повторная отправка звонка

This commit is contained in:
2024-12-25 16:15:48 +05:00
parent 9ffeab6b3a
commit a85d48028d
4 changed files with 57 additions and 28 deletions
+26 -17
View File
@@ -99,10 +99,9 @@ $(document).ready(function(){
}
});
$("#form_submit").click(function(){
$(this).children(".spinner-border").removeClass('d-none');
$(this).attr("disabled", true);
function verification(){
$("#form_submit").children(".spinner-border").removeClass('d-none');
$("#form_submit").attr("disabled", true);
message = {}
@@ -110,30 +109,30 @@ $(document).ready(function(){
if(!(validate_length($('#fio').val(), 3)))
{
show_error('Введите ФИО', false);
$(this).children(".spinner-border").addClass('d-none');
$(this).removeAttr("disabled");
$("#form_submit").children(".spinner-border").addClass('d-none');
$("#form_submit").removeAttr("disabled");
return;
}
if(!(validate_length($('#tel').val(), 16)))
{
show_error('Введите Телефон', false);
$(this).children(".spinner-border").addClass('d-none');
$(this).removeAttr("disabled");
$("#form_submit").children(".spinner-border").addClass('d-none');
$("#form_submit").removeAttr("disabled");
return;
}
if ($('#dob').val().length !== 10 || new Date().getFullYear() - new Date($('#dob').val()).getFullYear() > 100) {
show_error('Дата рождения должна быть корректной и возраст не более 80 лет', false);
$(this).children(".spinner-border").addClass('d-none');
$(this).removeAttr("disabled");
$("#form_submit").children(".spinner-border").addClass('d-none');
$("#form_submit").removeAttr("disabled");
return;
}
if ($('#dob').val().length !== 10 || new Date().getFullYear() < new Date($('#dob').val()).getFullYear()) {
show_error('Проверьте дату ввода, вы указали дату больше чем сегодняшняя дата', false);
$(this).children(".spinner-border").addClass('d-none');
$(this).removeAttr("disabled");
$("#form_submit").children(".spinner-border").addClass('d-none');
$("#form_submit").removeAttr("disabled");
return;
}
@@ -155,16 +154,21 @@ $(document).ready(function(){
}
else{
show_error(data.error);
$(this).children(".spinner-border").addClass('d-none');
$(this).removeAttr("disabled");
$("#form_submit").children(".spinner-border").addClass('d-none');
$("#form_submit").removeAttr("disabled");
}
},
error:function (jqXHR, exception) {
$(this).children(".spinner-border").addClass('d-none');
$(this).removeAttr("disabled");
$("#form_submit").children(".spinner-border").addClass('d-none');
$("#form_submit").removeAttr("disabled");
show_error('Что-то пошло не так', false)
}
});
}
$("#form_submit").click(function(){
verification();
});
$("#code_submit").click(function(){
@@ -221,7 +225,8 @@ $(document).ready(function(){
success: (data) => {
if(data.success==true){
$('.primary-field').hide();
$('.verification').show();
$('.verification').hide();
$('.success_window').show();
}
else{
show_error(data.error);
@@ -237,6 +242,10 @@ $(document).ready(function(){
});
});
$("#repeat_call").click(function(){
verification();
});
$('#clear_tel').click(function(){
phoneStr = '';
phoneInput.value = formatPhoneString();