-
@@ -37,7 +36,6 @@
@@ -46,7 +44,7 @@
id="quantity"
min="0"
name="quantity"
- onchange="calculateMilliliters(this.value, this.dataset.unit)"
+ onchange="calculateMilliliters(this)"
required
step="0.001"
th:value="${material.inventoryQuantity}"
@@ -54,7 +52,7 @@
style="margin-right: 10px; width: 50px">
+ th:field="*{inventoryQuantity}" required/>
+ type="file"
+ style="width: 145px"/>
@@ -91,10 +90,14 @@
const quantityElem = $("#quantity");
quantityElem.data({unit: unitSelect.val()});
- calculateMilliliters(quantityElem.val(), unitSelect.val());
+ calculateMilliliters(quantityElem);
}
- function calculateMilliliters(quantity, unit) {
+ function calculateMilliliters(input) {
+ input = $(input);
+ const quantity = input.val();
+ const unit = $("#units").val();
+
let convertedQuantity = quantity;
switch (unit) {
diff --git a/src/main/resources/templates/material/edit.html b/src/main/resources/templates/material/edit.html
index 850754f..f7e16e0 100644
--- a/src/main/resources/templates/material/edit.html
+++ b/src/main/resources/templates/material/edit.html
@@ -1,10 +1,7 @@
-
-
-
+
@@ -14,7 +11,7 @@