This commit is contained in:
2024-11-21 13:54:47 +05:00
parent 04d9162fff
commit 9e9c7bffdd
18 changed files with 65 additions and 15 deletions
+14 -7
View File
@@ -106,7 +106,7 @@ $(document).ready(function(){
const ageAtPassportIssue = passportDate.getFullYear() - dob.getFullYear();
// Проверка на возраст, в котором может быть выдан паспорт
if (ageAtPassportIssue === 14 || ageAtPassportIssue === 20 || ageAtPassportIssue === 45) {
if (ageAtPassportIssue > 12) {
// Если возраст при выдаче паспорта соответствует требованиям, подсвечиваем ячейку как успешную
$(this).parent().removeClass('errors-field').addClass('success-field');
} else {
@@ -282,8 +282,8 @@ $(document).ready(function(){
return;
}
if ($('#passport_date').val().length !== 10 || ![14, 20, 45].includes(new Date($('#passport_date').val()).getFullYear() - new Date($('#dob').val()).getFullYear())) {
show_error('Дата выдачи паспорта должна быть в 14, 20 или 45 лет', false);
if ($('#passport_date').val().length !== 10 || (new Date($('#passport_date').val()).getFullYear() - new Date($('#dob').val()).getFullYear()) < 13) {
show_error('Проверьте дату выдачи паспорта, паспорт РФ может быть выдан с 14 лет', false);
$(this).children(".spinner-border").addClass('d-none');
$(this).removeAttr("disabled");
return;
@@ -350,10 +350,17 @@ $(document).ready(function(){
async: true,
data: JSON.stringify(message),
success: (data) => {
$(this).children(".spinner-border").addClass('d-none');
$(this).removeAttr("disabled");
console.log(data);
show_success("Данные сохранены!")
if(data.success==true){
$(this).children(".spinner-border").addClass('d-none');
$(this).removeAttr("disabled");
console.log(data);
show_success("Данные сохранены!")
}
else{
show_error(data.error);
$(this).children(".spinner-border").addClass('d-none');
$(this).removeAttr("disabled");
}
},
error:function (jqXHR, exception) {
$(this).children(".spinner-border").addClass('d-none');
File diff suppressed because one or more lines are too long