function updateCommentReadonly() {
const currentUser = $('.admin-name').text().trim();
- const selectedStoreId = $('#writeoffserp-store_id').val();
- const specialStoreIds = ['1', '9', '28', '30', '15', '44', '8'];
const allowedCommentUsers = ['Емельянова Ольга', 'Яшенкова Алёна', 'Ольга Цветкова'];
- const isReadonly = specialStoreIds.includes(selectedStoreId) && !allowedCommentUsers.includes(currentUser);
+ const isReadonly = !allowedCommentUsers.includes(currentUser);
$('#writeoffserp-comment').prop('readonly', isReadonly);
}
const selectedStoreId = $('#writeoffserp-store_id').val();
const commentValue = $('#writeoffserp-comment').val().trim();
- const specialStoreIds = [
- '1,',
- '8,',
- '9,',
- '13',
- '15',
- '19',
- '28',
- '30',
- '41',
- '44',
- ];
const allowedCommentUsers = ['Емельянова Ольга', 'Яшенкова Алёна', 'Ольга Цветкова'];
- if (specialStoreIds.includes(selectedStoreId)) {
- if (!allRowsHaveImage) {
- if (!errors['__common']) errors['__common'] = [];
- errors['__common'].push('Пожалуйста, добавьте хотя бы одно фото к каждому списанию перед сохранением.');
- }
+ if (!allRowsHaveImage) {
+ if (!errors['__common']) errors['__common'] = [];
+ errors['__common'].push('Пожалуйста, добавьте хотя бы одно фото к каждому списанию перед сохранением.');
+ }
- if (!allowedCommentUsers.includes(currentUser) && commentValue !== initialCommentValue) {
- if (!errors['__common']) errors['__common'] = [];
- errors['__common'].push('Вы не можете редактировать комментарий для данного магазина.');
- }
+ if (!allowedCommentUsers.includes(currentUser) && commentValue !== initialCommentValue) {
+ if (!errors['__common']) errors['__common'] = [];
+ errors['__common'].push('Вы не можете редактировать комментарий для данного магазина.');
}
if (Object.keys(errors).length > 0) {