fix: enable saving in price-list's price edit modal

This commit is contained in:
Valentin Lab
2025-10-15 11:56:46 +02:00
parent 1f02c932a0
commit 29f46b7287

View File

@@ -75,12 +75,12 @@
if (typeof(tinyMCE) != 'undefined') { if (typeof(tinyMCE) != 'undefined') {
tinyMCE.triggerSave(); tinyMCE.triggerSave();
} }
$('form ' + form_id).submit(); getModalForm(form_id).trigger('submit');
status = 1; status = 1;
} }
function handlePostModal(form_id, url_save, callback) { function handlePostModal(form_id, url_save, callback) {
$('form ' + form_id).submit(function(e) { getModalForm(form_id).off('submit').on('submit', function(e) {
e.preventDefault(); e.preventDefault();
var formData = new FormData(this); var formData = new FormData(this);
$.ajax({ $.ajax({
@@ -98,8 +98,17 @@
}); });
}); });
} }
function getModalForm(form_id) {
var $form = $(form_id);
if (! $form.length) {
$form = $('form' + form_id);
}
return $form;
}
</script> </script>
@endpush @endpush
@php(define('LOAD_MODAL', true)) @php(define('LOAD_MODAL', true))
@endif @endif