From 29f46b7287248967b1c938685fca7902f73adbf9 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Wed, 15 Oct 2025 11:56:46 +0200 Subject: [PATCH] fix: enable saving in price-list's price edit modal --- resources/views/load/layout/modal.blade.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/resources/views/load/layout/modal.blade.php b/resources/views/load/layout/modal.blade.php index eb850bbb..8e4554cc 100644 --- a/resources/views/load/layout/modal.blade.php +++ b/resources/views/load/layout/modal.blade.php @@ -75,12 +75,12 @@ if (typeof(tinyMCE) != 'undefined') { tinyMCE.triggerSave(); } - $('form ' + form_id).submit(); + getModalForm(form_id).trigger('submit'); status = 1; } function handlePostModal(form_id, url_save, callback) { - $('form ' + form_id).submit(function(e) { + getModalForm(form_id).off('submit').on('submit', function(e) { e.preventDefault(); var formData = new FormData(this); $.ajax({ @@ -98,8 +98,17 @@ }); }); } + + function getModalForm(form_id) { + var $form = $(form_id); + if (! $form.length) { + $form = $('form' + form_id); + } + + return $form; + } @endpush @php(define('LOAD_MODAL', true)) -@endif \ No newline at end of file +@endif