}
});
- if (!allRowsHaveImage) {
- if (!errors['__common']) errors['__common'] = [];
- errors['__common'].push('Пожалуйста, добавьте хотя бы одно фото к каждому списанию перед сохранением.');
- }
-
- // Отладка — логируем переменные
- const group = $('.group-name').text().trim();
- const currentUser = $('.admin-name').text().trim();
- const selectedStoreId = $('#writeoffserp-store_id').val();
- const commentValue = $('#writeoffserp-comment').val().trim();
-
- console.log('group:', group);
- console.log('currentUser:', currentUser);
- console.log('selectedStoreId:', selectedStoreId);
- console.log('commentValue:', commentValue);
-
const specialStoreIds = ['1', '9', '28'];
const allowedCommentUsers = ['Емельянова Ольга', 'Яшенкова Алена', 'Цветкова Ольга'];
if (group === 'IT' && specialStoreIds.includes(selectedStoreId)) {
+ if (!allRowsHaveImage) {
+ if (!errors['__common']) errors['__common'] = [];
+ errors['__common'].push('Пожалуйста, добавьте хотя бы одно фото к каждому списанию перед сохранением.');
+ }
+
if (commentValue.length > 0 && !allowedCommentUsers.includes(currentUser)) {
errors['WriteOffsErp[comment]'] = [
'Комментарий могут заполнять только: ' + allowedCommentUsers.join(', ') + '.'
];
- console.log('Ошибка комментария добавлена');
- } else {
- console.log('Комментарий корректен или пуст');
}
- } else {
- console.log('Условие для проверки комментария не выполнено');
}
if (Object.keys(errors).length > 0) {