From abed17b3f0271a1be9845a41acfa6c619fb05ae1 Mon Sep 17 00:00:00 2001 From: Ludovic CANDELLIER Date: Mon, 27 Feb 2023 22:02:19 +0100 Subject: [PATCH] fix modal --- .../partials/ArticleAddBasket.blade.php | 6 +- resources/views/load/layout/modal.blade.php | 284 ++++++------------ 2 files changed, 95 insertions(+), 195 deletions(-) diff --git a/resources/views/Shop/Articles/partials/ArticleAddBasket.blade.php b/resources/views/Shop/Articles/partials/ArticleAddBasket.blade.php index f5e7dde4..fba7ea52 100644 --- a/resources/views/Shop/Articles/partials/ArticleAddBasket.blade.php +++ b/resources/views/Shop/Articles/partials/ArticleAddBasket.blade.php @@ -1,7 +1,7 @@ @if ($article['offers']['semences'] ?? false) @include('Shop.Articles.partials.addBasket', [ 'data' => $article['offers']['semences'], - 'title' => 'Semence', + 'title' => 'Semences', 'model' => 'semences', 'bgClass' => 'bg-green-light', ]) @@ -10,7 +10,7 @@ @if ($article['offers']['plants'] ?? false) @include('Shop.Articles.partials.addBasket', [ 'data' => $article['offers']['plants'], - 'title' => 'Plant', + 'title' => 'Plants', 'model' => 'plants', 'bgClass' => 'bg-green-light', ]) @@ -19,7 +19,7 @@ @if ($article['offers']['legumes'] ?? false) @include('Shop.Articles.partials.addBasket', [ 'data' => $article['offers']['legumes'], - 'title' => 'Légume', + 'title' => 'Légumes', 'model' => 'legumes', 'bgClass' => 'bg-green-light', ]) diff --git a/resources/views/load/layout/modal.blade.php b/resources/views/load/layout/modal.blade.php index 8f6db853..eb850bbb 100644 --- a/resources/views/load/layout/modal.blade.php +++ b/resources/views/load/layout/modal.blade.php @@ -1,205 +1,105 @@ @if(!defined('LOAD_MODAL')) @push('js') - @component('boilerplate::minify') - - @endcomponent + function handlePostModal(form_id, url_save, callback) { + $('form ' + form_id).submit(function(e) { + e.preventDefault(); + var formData = new FormData(this); + $.ajax({ + url: url_save, + type: 'POST', + data: formData, + success: function (data) { + if (callback) { + eval(callback); + } + }, + cache: false, + contentType: false, + processData: false + }); + }); + } + @endpush @php(define('LOAD_MODAL', true)) -@endif +@endif \ No newline at end of file