From 35d10b708c658bc0f1ce623c929a0b663ccb74c9 Mon Sep 17 00:00:00 2001 From: fomichev Date: Tue, 21 Apr 2026 15:18:37 +0300 Subject: [PATCH] fix button --- erp24/web/js/supplier/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/erp24/web/js/supplier/index.js b/erp24/web/js/supplier/index.js index b96db249..873ed71e 100644 --- a/erp24/web/js/supplier/index.js +++ b/erp24/web/js/supplier/index.js @@ -12,7 +12,7 @@ url: urls.index, type: 'GET', success: function (html) { - var $grid = $('
').html(html).find('#supplier-pjax'); + var $grid = $('
').append($.parseHTML(html, document, false)).find('#supplier-pjax'); if ($grid.length) { $('#supplier-pjax').replaceWith($grid); } @@ -55,6 +55,10 @@ // Сохранение $(document).on('click', '#btn-supplier-save', function () { + var $saveBtn = $(this); + if ($saveBtn.prop('disabled')) return; + $saveBtn.prop('disabled', true); + var $form = $('#supplier-form'); var url = editingId ? urls.update + '?id=' + editingId : urls.create; @@ -71,6 +75,7 @@ supplierModal.hide(); reloadGrid(); } else if (resp.errors) { + $saveBtn.prop('disabled', false); $.each(resp.errors, function (field, messages) { var $input = $form.find('[name="Supplier[' + field + ']"]'); $input.addClass('is-invalid'); @@ -79,6 +84,7 @@ } }, error: function () { + $saveBtn.prop('disabled', false); alert('Ошибка сервера'); } }); -- 2.39.5