From: marina Date: Tue, 3 Jun 2025 07:48:48 +0000 (+0300) Subject: ERP-417 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=3333bfa1d3ad358e3d2f19fd5bf6c0638b9f3c99;p=erp24_rep%2Fyii-erp24%2F.git ERP-417 --- diff --git a/erp24/web/js/validate/validateForm.js b/erp24/web/js/validate/validateForm.js index 3a994a9b..1f61e3ef 100755 --- a/erp24/web/js/validate/validateForm.js +++ b/erp24/web/js/validate/validateForm.js @@ -1,3 +1,5 @@ +let initialCommentValue = ''; + function updateCommentReadonly() { const currentUser = $('.admin-name').text().trim(); const selectedStoreId = $('#writeoffserp-store_id').val(); @@ -9,6 +11,8 @@ function updateCommentReadonly() { } $(document).ready(function () { + initialCommentValue = $('#writeoffserp-comment').val().trim(); + updateCommentReadonly(); $('#writeoffserp-store_id').on('change', function () { @@ -69,6 +73,11 @@ $(".form-validate button").click(function (e) { 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) {