+let initialCommentValue = '';
+
function updateCommentReadonly() {
const currentUser = $('.admin-name').text().trim();
const selectedStoreId = $('#writeoffserp-store_id').val();
}
$(document).ready(function () {
+ initialCommentValue = $('#writeoffserp-comment').val().trim();
+
updateCommentReadonly();
$('#writeoffserp-store_id').on('change', function () {
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) {