From 7ea34423bc8296c983314222abe6aaed72b5acc5 Mon Sep 17 00:00:00 2001 From: FyloZ Date: Fri, 21 Feb 2020 09:40:38 -0500 Subject: [PATCH] =?UTF-8?q?D=C3=A9but=20am=C3=A9lioration=20inventaire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/templates/recipe/explore.html | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/resources/templates/recipe/explore.html b/src/main/resources/templates/recipe/explore.html index 5a9b6b7..f0e2192 100644 --- a/src/main/resources/templates/recipe/explore.html +++ b/src/main/resources/templates/recipe/explore.html @@ -97,7 +97,8 @@
+ th:id="'mix-' + ${mix.id}" + th:mixId="${mix.id}"> @@ -264,7 +265,17 @@ $("#useSubmit").on({ click: function () { - let formData = {}; + let formData = []; + + $(".mix").each(function() { + const mixId = $(this).data("mixid"); + const materials = []; + + let i = 0; + $(this).find(".quantityCustomizer").each(function() { + materials[i] = $(this).data("materialid") + }); + }); $(".quantityCustomizer").each(function () { const materialId = $(this).data("materialid"); @@ -274,8 +285,8 @@ formData[mixId] = {}; } - formData[mixId][materialId] = e.dataset.quantityml; - }); + formData[mixId][materialId] = e.dataset.quantityml; + }); clearNotEnoughClasses(); sendPost(formData, "/inventory/use", r => displayNotEnoughReason(r));