|
|
|
@ -978,6 +978,101 @@ $(document).ready(function(){
|
|
|
|
|
$(this).attr("disabled", true); |
|
|
|
|
message = {} |
|
|
|
|
|
|
|
|
|
if(!(validate_length($('#fio1').val(), 3))) |
|
|
|
|
{ |
|
|
|
|
show_error('Введите ФИО пациента', false); |
|
|
|
|
$(this).children(".spinner-border").addClass('d-none'); |
|
|
|
|
$(this).removeAttr("disabled"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($('#dob1').val().length !== 10 || new Date().getFullYear() - new Date($('#dob1').val()).getFullYear() > 100) { |
|
|
|
|
show_error('Дата рождения пациента должна быть корректной и возраст не более 100 лет', false); |
|
|
|
|
$(this).children(".spinner-border").addClass('d-none'); |
|
|
|
|
$(this).removeAttr("disabled"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(!(validate_length($('#fional').val(), 3))) |
|
|
|
|
{ |
|
|
|
|
show_error('Введите ФИО налогоплательщика', false); |
|
|
|
|
$(this).children(".spinner-border").addClass('d-none'); |
|
|
|
|
$(this).removeAttr("disabled"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($('#dobnal').val().length !== 10 || new Date().getFullYear() - new Date($('#dobnal').val()).getFullYear() > 100) { |
|
|
|
|
show_error('Дата рождения налогоплательщика должна быть корректной и возраст не более 100 лет', false); |
|
|
|
|
$(this).children(".spinner-border").addClass('d-none'); |
|
|
|
|
$(this).removeAttr("disabled"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(!(validate_length($('#innnal').val(), 12))) |
|
|
|
|
{ |
|
|
|
|
show_error('Введите ИНН налогоплательщика', false); |
|
|
|
|
$(this).children(".spinner-border").addClass('d-none'); |
|
|
|
|
$(this).removeAttr("disabled"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!(validate_length($('#passportnal').val(), 11))) |
|
|
|
|
{ |
|
|
|
|
show_error('Введите серию и номер паспорта налогоплательщика', false); |
|
|
|
|
$(this).children(".spinner-border").addClass('d-none'); |
|
|
|
|
$(this).removeAttr("disabled"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($('#passport_datenal').val().length !== 10 || (new Date($('#passport_datenal').val()).getFullYear() - new Date($('#dobnal').val()).getFullYear()) < 13) { |
|
|
|
|
show_error('Проверьте дату выдачи паспорта, паспорт РФ может быть выдан с 14 лет', false); |
|
|
|
|
$(this).children(".spinner-border").addClass('d-none'); |
|
|
|
|
$(this).removeAttr("disabled"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!(validate_length($('#postal_codenal').val(), 7))) |
|
|
|
|
{ |
|
|
|
|
show_error('Введите код подразделения налогоплательщика', false); |
|
|
|
|
$(this).children(".spinner-border").addClass('d-none'); |
|
|
|
|
$(this).removeAttr("disabled"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($('#passport_issued_bynal').val() == null){ |
|
|
|
|
show_error("Выберите кем выдан паспорт налогоплательщика"); |
|
|
|
|
$(this).children(".spinner-border").addClass('d-none'); |
|
|
|
|
$(this).removeAttr("disabled"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!(validateEmail($('#email1').val()))){ |
|
|
|
|
show_error('Введите корректный Email', false); |
|
|
|
|
$(this).children(".spinner-border").addClass('d-none'); |
|
|
|
|
$(this).removeAttr("disabled"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($("input[name='god_zapros2']:checked").length === 0) { |
|
|
|
|
show_error("Выберите хотя бы один год запроса"); |
|
|
|
|
$(this).children(".spinner-border").addClass('d-none'); |
|
|
|
|
$(this).removeAttr("disabled"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let selectedYears = []; |
|
|
|
|
$("input[name='god_zapros2']:checked").each(function() { |
|
|
|
@ -998,29 +1093,33 @@ $(document).ready(function(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
|
type: "post", |
|
|
|
|
type: "POST", |
|
|
|
|
url: "/sending_patient2", |
|
|
|
|
processData: false, // tell jQuery not to process the data
|
|
|
|
|
contentType: false, // tell jQuery not to set contentType
|
|
|
|
|
async: true, |
|
|
|
|
contentType: "application/json", |
|
|
|
|
data: JSON.stringify(message), |
|
|
|
|
success: (data) => { |
|
|
|
|
if(data.success==true){ |
|
|
|
|
if (data.success) { |
|
|
|
|
$('.primary-field').hide(); |
|
|
|
|
$('.verification').hide(); |
|
|
|
|
$('.verificationpacient').hide(); |
|
|
|
|
$('.success_window').show(); |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
} else { |
|
|
|
|
show_error(data.error); |
|
|
|
|
$(this).children(".spinner-border").addClass('d-none'); |
|
|
|
|
$(this).removeAttr("disabled"); |
|
|
|
|
$("#code_submit2").children(".spinner-border").addClass('d-none'); |
|
|
|
|
$("#code_submit2").removeAttr("disabled"); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
error:function (jqXHR, exception) { |
|
|
|
|
$(this).children(".spinner-border").addClass('d-none'); |
|
|
|
|
$(this).removeAttr("disabled"); |
|
|
|
|
show_error('Что-то пошло не так', false) |
|
|
|
|
error: function (jqXHR) { |
|
|
|
|
$("#code_submit2").children(".spinner-border").addClass('d-none'); |
|
|
|
|
$("#code_submit2").removeAttr("disabled"); |
|
|
|
|
|
|
|
|
|
// Попробуем получить сообщение об ошибке из ответа сервера
|
|
|
|
|
let errorMessage = 'Что-то пошло не так'; |
|
|
|
|
if (jqXHR.responseJSON && jqXHR.responseJSON.error) { |
|
|
|
|
errorMessage = jqXHR.responseJSON.error; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
show_error(errorMessage, false); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|