From f21cfd94c18955ab7c6fcf7a0680be8240b7b076 Mon Sep 17 00:00:00 2001 From: FyloZ Date: Fri, 20 Dec 2019 10:50:46 -0500 Subject: [PATCH] =?UTF-8?q?#=20v1.1.2=20###=20Corrections=20*=20Am=C3=A9li?= =?UTF-8?q?oration=20du=20style=20du=20site.=20*=20Correction=20d'un=20bug?= =?UTF-8?q?=20qui=20permettait=20de=20supprimer=20des=20images=20sans=20mo?= =?UTF-8?q?t=20de=20passe.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Ajouts * Il n'est plus possible de modifier la quantité des produits utilisant les pourcentages dans l'explorateur de recette. * La quantité initiale d'un produit peut maintenant être cachée dans l'explorateur de recette. * La quantité minimum d'un produit dans un mélange est maintenant de 0.001. * La quantité de chaque produit d'un mélange peut maintenant être calculée depuis la quantitée totale du mélange. * Ajout de boîtes de notification améliorées. --- pom.xml | 2 +- .../controller/RecipeExplorerController.java | 2 + src/main/resources/static/css/main.css | 145 ++++++++++++- src/main/resources/static/css/mix.css | 6 +- src/main/resources/static/icons/error.svg | 6 + src/main/resources/static/icons/success.svg | 5 + src/main/resources/static/icons/warning.svg | 5 + src/main/resources/static/js/main.js | 56 ++++- src/main/resources/static/js/mix.js | 21 +- .../resources/templates/company/creator.html | 4 +- .../resources/templates/company/remover.html | 5 +- src/main/resources/templates/fragments.html | 40 +++- src/main/resources/templates/images/add.html | 6 +- src/main/resources/templates/index.html | 8 +- src/main/resources/templates/inventory.html | 22 +- .../resources/templates/material/creator.html | 4 +- .../resources/templates/material/edit.html | 4 +- .../resources/templates/material/editor.html | 5 +- .../resources/templates/material/remover.html | 5 +- .../resources/templates/material/simdut.html | 4 +- .../templates/materialType/creator.html | 4 +- .../templates/materialType/edit.html | 4 +- .../templates/materialType/editor.html | 5 +- .../templates/materialType/remover.html | 5 +- src/main/resources/templates/mix/creator.html | 4 +- src/main/resources/templates/mix/editor.html | 25 +-- .../resources/templates/recipe/created.html | 4 +- .../resources/templates/recipe/creator.html | 4 +- src/main/resources/templates/recipe/edit.html | 52 ++--- .../resources/templates/recipe/editor.html | 3 +- .../resources/templates/recipe/explore.html | 200 +++++++++++++++--- .../resources/templates/recipe/remover.html | 3 +- src/main/resources/templates/updates.html | 5 +- src/main/resources/updates.md | 17 +- 34 files changed, 531 insertions(+), 159 deletions(-) create mode 100644 src/main/resources/static/icons/error.svg create mode 100644 src/main/resources/static/icons/success.svg create mode 100644 src/main/resources/static/icons/warning.svg diff --git a/pom.xml b/pom.xml index 8309979..51e84a3 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ dev.fyloz.trial.colorrecipesexplorer ColorRecipesExplorer - 1.1.1 + 1.1.2 Color Recipes Explorer diff --git a/src/main/java/dev/fyloz/trial/colorrecipesexplorer/web/controller/RecipeExplorerController.java b/src/main/java/dev/fyloz/trial/colorrecipesexplorer/web/controller/RecipeExplorerController.java index 1e41a3b..5902c18 100644 --- a/src/main/java/dev/fyloz/trial/colorrecipesexplorer/web/controller/RecipeExplorerController.java +++ b/src/main/java/dev/fyloz/trial/colorrecipesexplorer/web/controller/RecipeExplorerController.java @@ -66,11 +66,13 @@ public class RecipeExplorerController { .build(); } + // TODO convertir form en DTO @PostMapping(value = EXPLORER_RECIPE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public Map saveRecipeInformations(@RequestBody Map form) { JSONResponseBuilder responseBuilder = new JSONResponseBuilder(); + int recipeID = Integer.parseInt(form.get("recipeID").toString()); Map location = (Map) form.get("locations"); String note = form.get("note").toString(); diff --git a/src/main/resources/static/css/main.css b/src/main/resources/static/css/main.css index 7bc0c8d..9c60191 100644 --- a/src/main/resources/static/css/main.css +++ b/src/main/resources/static/css/main.css @@ -7,6 +7,13 @@ td { vertical-align: top; } +th { + background-color: black; + color: white; + font-weight: normal; + font-size: large; +} + h1 { text-decoration: underline; } @@ -49,6 +56,71 @@ nav a { text-decoration: none; } +footer a { + color: white; + text-decoration: none; +} + +button, +select { + background-color: #d7dedc; + border-style: solid; + border-color: #d7dedc; + border-width: 1px; + padding: 2px 4px; + margin: 2px; +} + +select { + padding: 1px 0; +} + +select:after { + background-color: red; +} + +button:hover { + background-color: #bec4c3; +} + +input { + background-color: rgba(0, 0, 0, 0); + border-style: solid; + border-width: 1px; + border-color: #7a7a7a; +} + +input[type=file] { + border-style: none; +} + +input[disabled] { + border-style: none; + color: black; +} + +input::-webkit-outer-spin-button, +input::-webkit-inner-spin-button { + -webkit-appearance: none; + margin: 0; +} + +input[type=number] { + -moz-appearance: textfield; +} + +table { + border-collapse: collapse; +} + +textarea { + font-family: 'Open Sans', sans-serif; + background-color: #fafafa; + border-style: solid; + border-color: #7a7a7a; + border-width: 1px; +} + .dropdown { margin-top: 22px; float: left; @@ -120,6 +192,10 @@ nav a:hover, .dropdown:hover .dropbtn { background-color: #ffc299; } +.nosimdut input:not(:disabled) { + background-color: #fafafa; +} + .unapproved { background-color: #fff0b3; } @@ -131,4 +207,71 @@ nav a:hover, .dropdown:hover .dropbtn { #researchBox { margin-top: 10px; margin-right: 50px; -} \ No newline at end of file +} + +.errorBox { + background-color: #ef9a9a; + color: #e53935; + font-weight: bold; +} + +.successBox { + background-color: #a5d6a7; + color: #4caf50; + font-weight: bold; +} + +.warningBox { + background-color: #fff59d; + color: #fdd835; + font-weight: bold; +} + +.messageBox { + display: inline-block; + margin: 20px auto auto; +} + +.messageBox .messageBoxContainer { + display: inline-block; + height: 24px; + padding: 16px; + text-align: left; +} + +.messageBox .messageBoxInnerBox { + display: inline-block; + height: 24px; +} + +.messageBox img { + float: left; +} + +.messageBox p { + display: inline-block; + /*padding: 3px 0;*/ + margin: 0 0 0 16px; + line-height: 24px; +} + +/*.errorBox div {*/ +/* height: 24px;*/ +/* !*padding: 20px;*!*/ +/* margin: auto;*/ +/* vertical-align: middle;*/ +/*}*/ + +/*.errorBox img {*/ +/* display: inline-block;*/ +/* float: left;*/ +/* height: 25px;*/ +/*}*/ + +/*.errorBox p {*/ +/* !*float: left;*!*/ +/* display: inline-block;*/ +/* font-size: 18px;*/ +/* margin: auto;*/ +/* padding: 2px 0;*/ +/*}*/ diff --git a/src/main/resources/static/css/mix.css b/src/main/resources/static/css/mix.css index dc687cb..ac7471f 100644 --- a/src/main/resources/static/css/mix.css +++ b/src/main/resources/static/css/mix.css @@ -34,4 +34,8 @@ .materialSelector p:hover { background-color: #e6e6e6; -} \ No newline at end of file +} + +.unitsColumn { + vertical-align: middle; +} diff --git a/src/main/resources/static/icons/error.svg b/src/main/resources/static/icons/error.svg new file mode 100644 index 0000000..3eaebfb --- /dev/null +++ b/src/main/resources/static/icons/error.svg @@ -0,0 +1,6 @@ + + + + + diff --git a/src/main/resources/static/icons/success.svg b/src/main/resources/static/icons/success.svg new file mode 100644 index 0000000..5894558 --- /dev/null +++ b/src/main/resources/static/icons/success.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/resources/static/icons/warning.svg b/src/main/resources/static/icons/warning.svg new file mode 100644 index 0000000..0065683 --- /dev/null +++ b/src/main/resources/static/icons/warning.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/resources/static/js/main.js b/src/main/resources/static/js/main.js index dd916f6..8d3c09c 100644 --- a/src/main/resources/static/js/main.js +++ b/src/main/resources/static/js/main.js @@ -1,6 +1,12 @@ const body = document.querySelector("body"); -const errorP = document.querySelector(".error"); +const errorMsgBox = document.querySelector(".errorBox"); +const errorMsgBoxText = errorMsgBox.querySelector("p"); +const warningMsgBox = document.querySelector(".warningBox"); +const warningMsgBoxText = warningMsgBox.querySelector("p"); +const successMsgBox = document.querySelector(".successBox"); +const successMsgBoxText = successMsgBox.querySelector("p"); +// Ne fonctionne pas dans window#load (() => { // Ajoute Axios const axiosElement = document.createElement("script"); @@ -21,6 +27,12 @@ const errorP = document.querySelector(".error"); }); }; + // Placé ici pour un chargement plus rapide + document.querySelectorAll(".messageBox").forEach(e => checkMessageBoxesDisplay(e)); +})(); + +window.addEventListener("load", () => { + document.querySelectorAll(".returnIndex").forEach((e) => { e.addEventListener("click", () => { document.location.href = "/"; @@ -72,19 +84,29 @@ const errorP = document.querySelector(".error"); }); }); + window.addEventListener("change", e => { + if (e.target) { + if (e.target.classList.contains("toSave")) { + // TODO traductions + warningMsgBoxText.innerText = "Des modifications ne sont pas été sauvegardées"; + showElement(warningMsgBox); + } + } + }); + // Ajoute le favicon let faviconElement = document.createElement("link"); faviconElement.rel = "icon"; faviconElement.href = "/favicon.png"; document.querySelector("head").appendChild(faviconElement); -})(); +}); function askDatabaseExport() { return confirm("Voulez-vous vraiment exporter toutes les couleurs? Cela peut prendre un certain temps et ralentir l'application pendant un certain temps."); } -function checkPassword(form) { - errorP.innerHTML = ""; +function checkPassword(form, callback) { + hideElement(errorMsgBox); const password = prompt("Quel est votre mot de passe?"); @@ -94,18 +116,34 @@ function checkPassword(form) { axios.post("/password/valid", data) .then(r => { if (r.data) { - form.submit(); + if (form != null) form.submit(); + if (callback != null) callback(); return true; } else { - errorP.innerHTML = "Votre mot de passe n'est pas valide"; + errorMsgBoxText.innerText = "Votre mot de passe n'est pas valide"; + showElement(errorMsgBox); + return false; } }) .catch(e => { - errorP.innerHTML = "Une erreur est survenue lors de l'envoie des informations vers le serveur."; + errorMsgBoxText.innerText = "Une erreur est survenue lors de l'envoie des informations vers le serveur."; + showElement(errorMsgBox); console.log(e); + return false; }); +} - return false; +function checkMessageBoxesDisplay(element) { + if (!element.querySelector("p").innerText) hideElement(element); + else showElement(element); +} + +function hideElement(element) { + element.style.display = "none"; +} + +function showElement(element) { + element.style.display = "inline-block"; } const lTomL = 1000; @@ -146,4 +184,4 @@ function round(x) { function percentageOf(percentage, number) { return (percentage / 100) * number; -} \ No newline at end of file +} diff --git a/src/main/resources/static/js/mix.js b/src/main/resources/static/js/mix.js index 52c1a81..8acd44f 100644 --- a/src/main/resources/static/js/mix.js +++ b/src/main/resources/static/js/mix.js @@ -16,7 +16,8 @@ window.addEventListener("load", () => { init(); }) .catch(e => { - errorP.innerHTML = "Une erreur est survenue lors de la récupération des produits"; + errorMsgBoxText.innerText = "Une erreur est survenue lors de la récupération des produits"; + showElement(errorMsgBox); console.log(e); }); }); @@ -44,13 +45,13 @@ document.querySelector("#materials button").addEventListener("click", () => { function addMaterial(materialCode, quantity) { let row = addRow(); - let materialSelectionColumn = addColumn(row); - let quantityInputColumn = addColumn(row); - - let removeButtonColumn = addColumn(row); + let materialSelectionColumn = addColumn(row, null); + let quantityInputColumn = addColumn(row, null); + let unitsColumn = addColumn(row, "unitsColumn"); + let removeButtonColumn = addColumn(row, null); addInput(quantityInputColumn, quantity); - addSpan(quantityInputColumn); + addSpan(unitsColumn); addButton(removeButtonColumn); materialSelectionColumn.innerHTML = materialSelectorHtml; @@ -73,12 +74,13 @@ function addMaterial(materialCode, quantity) { function addInput(parent, quantity) { let input = document.createElement("input"); - if (quantity === null) quantity = 0; + if (quantity === null) quantity = 1; input.type = "number"; input.name = "quantities"; input.value = quantity; input.step = 0.001; + input.min = 0.001; input.required = true; parent.appendChild(input); @@ -114,8 +116,9 @@ function addRow() { return row; } -function addColumn(parent) { +function addColumn(parent, className) { let column = document.createElement("td"); + if (className != null) column.className = className; parent.appendChild(column); return column; @@ -165,4 +168,4 @@ function checkUnits(materialSelector, row) { const quantityUnits = row.querySelector(".quantityUnit"); if (materialSelector.dataset.usepercentages === "true") quantityUnits.innerText = "%"; else quantityUnits.innerText = "mL"; -} \ No newline at end of file +} diff --git a/src/main/resources/templates/company/creator.html b/src/main/resources/templates/company/creator.html index 09bc65e..34eb105 100644 --- a/src/main/resources/templates/company/creator.html +++ b/src/main/resources/templates/company/creator.html @@ -12,7 +12,7 @@
-

+

@@ -41,4 +41,4 @@ - \ No newline at end of file + diff --git a/src/main/resources/templates/company/remover.html b/src/main/resources/templates/company/remover.html index 6690fcd..4839abf 100644 --- a/src/main/resources/templates/company/remover.html +++ b/src/main/resources/templates/company/remover.html @@ -25,7 +25,7 @@
-

+

@@ -36,6 +36,7 @@ + @@ -60,4 +61,4 @@ - \ No newline at end of file + diff --git a/src/main/resources/templates/fragments.html b/src/main/resources/templates/fragments.html index a4b4d0b..29e53a9 100644 --- a/src/main/resources/templates/fragments.html +++ b/src/main/resources/templates/fragments.html @@ -55,10 +55,40 @@ -
-

-

+
+
+
+
+
+ +
+
+
+ error icon +

+

+
+
+
+ +
+
+
+ success icon +

+

+
+
+
+ +
+
+
+ warning icon +

+

+
+
@@ -77,4 +107,4 @@
- \ No newline at end of file + diff --git a/src/main/resources/templates/images/add.html b/src/main/resources/templates/images/add.html index 744e0cf..14f5e57 100644 --- a/src/main/resources/templates/images/add.html +++ b/src/main/resources/templates/images/add.html @@ -9,14 +9,14 @@
-

+

- +
@@ -25,4 +25,4 @@ - \ No newline at end of file + diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 56be013..759cff8 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -51,7 +51,7 @@
-

+
+ @@ -121,7 +122,7 @@ return; } - errorP.innerText = ""; + hideElement(errorMsgBox); axios.get(`/search?searchString=${searchString}`) .then(r => { const result = r.data.result; @@ -149,7 +150,8 @@ .catch(e => { console.log(e); - errorP.innerText = /*[[#{error.serverError}]]*/ "Erreur"; + errorMsgBoxText.innerText = /*[[#{error.serverError}]]*/ "Erreur"; + showElement(errorMsgBox); }); } diff --git a/src/main/resources/templates/inventory.html b/src/main/resources/templates/inventory.html index daaedec..095d110 100644 --- a/src/main/resources/templates/inventory.html +++ b/src/main/resources/templates/inventory.html @@ -61,7 +61,7 @@ -

+
@@ -71,13 +71,13 @@ - + - + - + +
+ { const result = r.data.result; @@ -217,21 +217,13 @@ console.log(`.materialRow[data-materialID=\"${m}\"]`); const materialRow = document.querySelector(`.materialRow[data-materialID=\"${m}\"]`); materialRow.classList.add("researchResult"); - - // const companyTab = document.querySelector(`.companyTab[data-companyID=\"${c}\"]`); - // companyTab.classList.add("researchResult"); - // companyTab.querySelector(".recipesList").style.display = "table"; - // - // for (let r = 0; r < result[c].length; r++) { - // const recipeRow = companyTab.querySelector(`.recipeRow[data-recipeID=\"${result[c][r]}\"]`); - // recipeRow.classList.add("researchResult"); - // } }); }) .catch(e => { console.log(e); - errorP.innerText = /*[[#{error.serverError}]]*/ "Erreur"; + errorMsgBoxText.innerText = /*[[#{error.serverError}]]*/ "Erreur"; + showElement(errorMsgBox); }); } diff --git a/src/main/resources/templates/material/creator.html b/src/main/resources/templates/material/creator.html index 409996d..467e93e 100644 --- a/src/main/resources/templates/material/creator.html +++ b/src/main/resources/templates/material/creator.html @@ -13,7 +13,7 @@

-

+

@@ -104,4 +104,4 @@ } - \ No newline at end of file + diff --git a/src/main/resources/templates/material/edit.html b/src/main/resources/templates/material/edit.html index 53b9743..9c67d2b 100644 --- a/src/main/resources/templates/material/edit.html +++ b/src/main/resources/templates/material/edit.html @@ -11,7 +11,7 @@
-

+

@@ -115,4 +115,4 @@ } - \ No newline at end of file + diff --git a/src/main/resources/templates/material/editor.html b/src/main/resources/templates/material/editor.html index 39a7005..f625d93 100644 --- a/src/main/resources/templates/material/editor.html +++ b/src/main/resources/templates/material/editor.html @@ -20,7 +20,7 @@
-

+

@@ -30,6 +30,7 @@
*/ - \ No newline at end of file + diff --git a/src/main/resources/templates/material/remover.html b/src/main/resources/templates/material/remover.html index 3f9af80..dc08ba4 100644 --- a/src/main/resources/templates/material/remover.html +++ b/src/main/resources/templates/material/remover.html @@ -20,7 +20,7 @@
-

+

@@ -30,6 +30,7 @@
- \ No newline at end of file + diff --git a/src/main/resources/templates/material/simdut.html b/src/main/resources/templates/material/simdut.html index 2626266..ead0a5c 100644 --- a/src/main/resources/templates/material/simdut.html +++ b/src/main/resources/templates/material/simdut.html @@ -9,7 +9,7 @@
-

+

@@ -32,4 +32,4 @@ - \ No newline at end of file + diff --git a/src/main/resources/templates/materialType/creator.html b/src/main/resources/templates/materialType/creator.html index 6092ab7..f1107e7 100644 --- a/src/main/resources/templates/materialType/creator.html +++ b/src/main/resources/templates/materialType/creator.html @@ -11,7 +11,7 @@
-

+

@@ -52,4 +52,4 @@ - \ No newline at end of file + diff --git a/src/main/resources/templates/materialType/edit.html b/src/main/resources/templates/materialType/edit.html index 0a10ed1..955f161 100644 --- a/src/main/resources/templates/materialType/edit.html +++ b/src/main/resources/templates/materialType/edit.html @@ -12,7 +12,7 @@
-

+

@@ -57,4 +57,4 @@ - \ No newline at end of file + diff --git a/src/main/resources/templates/materialType/editor.html b/src/main/resources/templates/materialType/editor.html index 1f67c3e..61fa43b 100644 --- a/src/main/resources/templates/materialType/editor.html +++ b/src/main/resources/templates/materialType/editor.html @@ -20,7 +20,7 @@
-

+

@@ -29,6 +29,7 @@ +
*/ - \ No newline at end of file + diff --git a/src/main/resources/templates/materialType/remover.html b/src/main/resources/templates/materialType/remover.html index 8d73514..aff5349 100644 --- a/src/main/resources/templates/materialType/remover.html +++ b/src/main/resources/templates/materialType/remover.html @@ -20,7 +20,7 @@
-

+

@@ -29,6 +29,7 @@ + + diff --git a/src/main/resources/templates/recipe/explore.html b/src/main/resources/templates/recipe/explore.html index bd5f2a8..cbbfed6 100644 --- a/src/main/resources/templates/recipe/explore.html +++ b/src/main/resources/templates/recipe/explore.html @@ -1,6 +1,8 @@ + + - - @@ -78,7 +117,7 @@
-

+

@@ -137,7 +176,8 @@
@@ -154,22 +194,37 @@ + placeholder="N/A" + type="text"/> + @@ -248,6 +321,8 @@ /* { document.querySelector("#modifyRecipe").addEventListener("click", () => { const recipeID = document.querySelector("#recipeID").value; @@ -293,6 +368,29 @@ }); }); + document.querySelectorAll(".totalQuantityCustomizer").forEach(e => { + e.addEventListener("change", () => { + console.log(e); + const value = e.valueAsNumber; + const oldValue = e.defaultValue; + const mixID = e.dataset.mixid; + const mixTable = document.querySelector(`#mix-${mixID}`); + + mixTable.querySelectorAll(".quantityCustomizer").forEach(elem => { + if (elem.dataset.usepercentages === "false") { + const defaultValue = elem.defaultValue; + const newValue = (defaultValue * value) / oldValue; + + console.log(value + "/" + oldValue + "/" + defaultValue + "/" + newValue); + + elem.value = round(newValue); + } + }); + + doCalculations(mixTable); + }) + }); + document.querySelector("#formSubmit").addEventListener("click", () => { let formData = {}; @@ -307,7 +405,8 @@ formData.note = document.querySelector("#note").value; - sendPost(formData, "/recipe/explore"); + sendPost(formData, "/recipe/explore", () => showElement(warningMsgBox)); + hideElement(warningMsgBox); }); document.querySelector("#useSubmit").addEventListener("click", () => { @@ -376,34 +475,64 @@ const mixID = splitReason[0]; const materialID = splitReason[1]; - document.querySelector(`#recipe-${mixID}`).querySelector(`#material-${materialID}`).classList.add("notEnough"); + document.querySelector(`#mix-${mixID}`).querySelector(`#material-${materialID}`).classList.add("notEnough"); + } + + function hideQuantities(button) { + let hidden = button.dataset.hidden; + + if (hidden === "true") hidden = "false"; + else hidden = "true"; + + + button.parentElement.parentElement.parentElement.querySelectorAll(".inventoryQuantity").forEach(e => { + if (hidden === "true") { + e.style.display = "none"; + e.parentElement.setAttribute("style", "min-width: auto !important"); + button.parentElement.setAttribute("style", "min-width: auto !important"); + + button.innerText = "->"; + } else { + e.style.display = "inline"; + + e.parentElement.setAttribute("style", "min-width: 100px !important"); + button.parentElement.setAttribute("style", "min-width: 100px !important"); + + button.innerText = quantityKeyword; + } + }); + + button.dataset.hidden = hidden; } function sendPost(data, url, errorCallback) { - const successP = document.querySelector(".success"); - const errorP = document.querySelector(".error"); - - successP.innerHTML = ""; - errorP.innerHTML = ""; + hideElement(successMsgBox); + hideElement(errorMsgBox); axios.post(url, data) .then(r => { - console.log(r); const data = r.data; if (data.success !== undefined) { - successP.innerHTML = data.success.message; + successMsgBoxText.innerHTML = data.success.message; + showElement(successMsgBox); + return true; } else if (data.error !== undefined) { - errorP.innerHTML = data.error.message; + errorMsgBoxText.innerText = data.error.message; + showElement(errorMsgBox); if (typeof errorCallback !== 'undefined') { errorCallback(data.reason); } + + return false; } }) .catch(e => { console.log(e); - errorP.innerHTML = "[[#{error.serverError}]]"; + errorMsgBoxText.innerText = "[[#{error.serverError}]]"; + showElement(errorMsgBox); + return false; }); } @@ -418,7 +547,6 @@ const p = parent.querySelector(`.calculation[data-materialid='${materialID}'][data-mixid='${mixID}']`); let totalQuantity = round(lastQuantity + parseFloat(quantity)); - // p.innerText = `+${quantity} (${totalQuantity})`; p.dataset.quantity = quantity; p.dataset.totalQuantity = totalQuantity; @@ -426,6 +554,10 @@ lastQuantity = totalQuantity; }); + + const totalQuantityCustomizer = parent.querySelector(".totalQuantityCustomizer"); + totalQuantityCustomizer.value = lastQuantity; + totalQuantityCustomizer.defaultValue = lastQuantity; } function changeCalculations() { diff --git a/src/main/resources/templates/recipe/remover.html b/src/main/resources/templates/recipe/remover.html index e41ffc0..0d140b6 100644 --- a/src/main/resources/templates/recipe/remover.html +++ b/src/main/resources/templates/recipe/remover.html @@ -44,7 +44,7 @@
-

+

@@ -60,6 +60,7 @@
+ diff --git a/src/main/resources/templates/updates.html b/src/main/resources/templates/updates.html index 30c3c8b..b4e1ae7 100644 --- a/src/main/resources/templates/updates.html +++ b/src/main/resources/templates/updates.html @@ -17,7 +17,7 @@
-

+

@@ -34,7 +34,8 @@ document.querySelector("#markdown").innerHTML = r.data; }) .catch(e => { - errorP.innerText = "Une erreur est survenue lors de la récupération des mises à jour"; + errorMsgBoxText.innerText = "Une erreur est survenue lors de la récupération des mises à jour"; + showElement(errorMsgBox); console.log(e); }); }); diff --git a/src/main/resources/updates.md b/src/main/resources/updates.md index 8c54f74..67f9e1d 100644 --- a/src/main/resources/updates.md +++ b/src/main/resources/updates.md @@ -1,3 +1,18 @@ +# v1.1.3 + + +# v1.1.2 +### Corrections +* Amélioration du style du site. +* Correction d'un bug qui permettait de supprimer des images sans mot de passe. + +### Ajouts +* Il n'est plus possible de modifier la quantité des produits utilisant les pourcentages dans l'explorateur de recette. +* La quantité initiale d'un produit peut maintenant être cachée dans l'explorateur de recette. +* La quantité minimum d'un produit dans un mélange est maintenant de 0.001. +* La quantité de chaque produit d'un mélange peut maintenant être calculée depuis la quantitée totale du mélange. +* Ajout de boîtes de notification améliorées. + # v1.1.1 ### Corrections * Désactivation de l'autocomplétion dans les étapes des recettes (permet d'éviter un bug qui affiche les suggestion par dessus toutes les étapes sur Edge) @@ -14,4 +29,4 @@ * Ajout de la journalisation. ### Dépendances -* Ajout de Lombok \ No newline at end of file +* Ajout de Lombok
- \ No newline at end of file + diff --git a/src/main/resources/templates/mix/creator.html b/src/main/resources/templates/mix/creator.html index de71e1e..ada7f71 100644 --- a/src/main/resources/templates/mix/creator.html +++ b/src/main/resources/templates/mix/creator.html @@ -18,7 +18,7 @@
-

+

@@ -78,4 +78,4 @@ /*]]*/ - \ No newline at end of file + diff --git a/src/main/resources/templates/mix/editor.html b/src/main/resources/templates/mix/editor.html index a291f35..88c76e2 100644 --- a/src/main/resources/templates/mix/editor.html +++ b/src/main/resources/templates/mix/editor.html @@ -17,7 +17,7 @@
-

+


@@ -72,26 +72,9 @@ removeText = "[[#{keyword.remove}]]"; document.querySelector("#removeMix").addEventListener("click", () => { - let errorP = document.querySelector(".error"); - errorP.innerHTML = ""; + showElement(errorMsgBox); - const password = prompt("[[#{password.ask}]]"); - - let data = {}; - data.password = password; - - axios.post("/password/valid", data) - .then(r => { - if (r.data) { - document.location.href = `/mix/remover/${mix.mixID}`; - } else { - errorP.innerHTML = "[[#{password.notValid}]]"; - } - }) - .catch(e => { - errorP.innerHTML = "[[#{error.serverError}]]"; - console.log(e); - }); + checkPassword(null, () => document.location.href = `/mix/remover/${mix.mixID}`); }); })(); @@ -108,4 +91,4 @@ /*]]*/ - \ No newline at end of file + diff --git a/src/main/resources/templates/recipe/created.html b/src/main/resources/templates/recipe/created.html index 9810c84..902b084 100644 --- a/src/main/resources/templates/recipe/created.html +++ b/src/main/resources/templates/recipe/created.html @@ -9,7 +9,7 @@
-

+

@@ -22,4 +22,4 @@ - \ No newline at end of file + diff --git a/src/main/resources/templates/recipe/creator.html b/src/main/resources/templates/recipe/creator.html index 1baf468..6f03a56 100644 --- a/src/main/resources/templates/recipe/creator.html +++ b/src/main/resources/templates/recipe/creator.html @@ -11,7 +11,7 @@
-

+

@@ -64,4 +64,4 @@ - \ No newline at end of file + diff --git a/src/main/resources/templates/recipe/edit.html b/src/main/resources/templates/recipe/edit.html index 190f844..2bd611e 100644 --- a/src/main/resources/templates/recipe/edit.html +++ b/src/main/resources/templates/recipe/edit.html @@ -10,10 +10,14 @@ display: inline; } + table { + border-collapse: separate !important; + } + .recipe table { background-color: #fafafa; border: 1px solid #7a7a7a; - border-collapse: collapse; + border-collapse: collapse !important; } .recipe td, .recipe th { @@ -42,7 +46,7 @@
-

+

@@ -225,8 +229,6 @@ let stepNbr = 0; (() => { - const errorP = document.querySelector(".error"); - document.querySelector("#gotoRecipe").addEventListener("click", () => { window.open("/recipe/explore/" + document.querySelector("#recipeID").value, "_blank"); }); @@ -246,28 +248,30 @@ }); document.querySelectorAll(".deleteImg").forEach(e => { - e.addEventListener("click", () => { - let data = {}; + e.addEventListener("click", async () => { + checkPassword(null, () => { + let data = {}; - data['image'] = e.getAttribute("data-image"); - data['password'] = prompt("[[#{password.ask}]]"); + data['image'] = e.getAttribute("data-image"); + hideElement(errorMsgBox); - errorP.innerHTML = ""; + axios.post("/images/delete", data) + .then(r => { + const data = r.data; - axios.post("/images/delete", data) - .then(r => { - const data = r.data; - - if (data['error'] !== undefined) { - errorP.innerHTML = data['error']; - } else { - document.location.reload(); - } - }) - .catch(e => { - console.log(e); - errorP.innerHTML = "[[#{error.serverError}]]"; - }); + if (data['error'] !== undefined) { + errorMsgBoxText.innerText = data['error']; + showElement(errorMsgBox); + } else { + document.location.reload(); + } + }) + .catch(e => { + console.log(e); + errorMsgBoxText.innerText = "[[#{error.serverError}]]"; + showElement(errorMsgBox); + }); + }); }); }); @@ -325,4 +329,4 @@ /*]]*/ - \ No newline at end of file + diff --git a/src/main/resources/templates/recipe/editor.html b/src/main/resources/templates/recipe/editor.html index 621abf5..4d7e24a 100644 --- a/src/main/resources/templates/recipe/editor.html +++ b/src/main/resources/templates/recipe/editor.html @@ -45,7 +45,7 @@
-

+

@@ -60,6 +60,7 @@
- +


- + + +
- +
- + - +

- - - - + + + + + +
+ +
+

+ -

-
+

mL

%

+

+
+ Total: + + + +

mL

+