From 3333bfa1d3ad358e3d2f19fd5bf6c0638b9f3c99 Mon Sep 17 00:00:00 2001 From: marina Date: Tue, 3 Jun 2025 10:48:48 +0300 Subject: [PATCH] ERP-417 --- erp24/web/js/validate/validateForm.js | 9 +++++++++ 1 file changed, 9 insertions(+) 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) { -- 2.39.5