Pārlūkot izejas kodu

Update inventory check card on home strand

Lee Morgan 5 gadi atpakaļ
vecāks
revīzija
674f611448

+ 5 - 4
views/dashboardPage/bundle.js

@@ -1150,13 +1150,14 @@ let home = {
         for(let i = 0; i < rands.length; i++){
             let ingredientCheck = template.cloneNode(true);
             let input = ingredientCheck.children[1].children[1];
+            const ingredient = merchant.ingredients[rands[i]];
 
-            ingredientCheck.ingredient = merchant.ingredients[rands[i]];
-            ingredientCheck.children[0].innerText = merchant.ingredients[rands[i]].ingredient.name;
+            ingredientCheck.ingredient = ingredient;
+            ingredientCheck.children[0].innerText = ingredient.ingredient.name;
             ingredientCheck.children[1].children[0].onclick = ()=>{input.value--};
-            input.value = merchant.ingredients[rands[i]].quantity.toFixed(2);
+            input.value = ingredient.ingredient.convert(ingredient.quantity).toFixed(2);
             ingredientCheck.children[1].children[2].onclick = ()=>{input.value++}
-            ingredientCheck.children[2].innerText = merchant.ingredients[rands[i]].ingredient.unit.toUpperCase();
+            ingredientCheck.children[2].innerText = ingredient.ingredient.unit.toUpperCase();
 
             ul.appendChild(ingredientCheck);
         }

+ 4 - 4
views/dashboardPage/dashboard.css

@@ -262,20 +262,20 @@ Home Strand
     }
 
         .ingredientCheck p:first-of-type{
-            width: 37%;
+            width: 40%;
             font-weight: 300;
             font-size: 15px;
             margin-right: 25px;
         }
 
         .ingredientCheck p:last-of-type{
-            width: 25%
+            width: 15%
         }
 
         .numberInput{
             display: flex;
             justify-content: center;
-            width: 37%;
+            width: 45%;
             margin-right: 25px;
         }
 
@@ -300,7 +300,7 @@ Home Strand
             }
 
             .numberInput input{
-                width: 40%;
+                width: 55%;
                 font-size: 15px;
                 text-align: center;
             }

+ 5 - 4
views/dashboardPage/js/home.js

@@ -93,13 +93,14 @@ let home = {
         for(let i = 0; i < rands.length; i++){
             let ingredientCheck = template.cloneNode(true);
             let input = ingredientCheck.children[1].children[1];
+            const ingredient = merchant.ingredients[rands[i]];
 
-            ingredientCheck.ingredient = merchant.ingredients[rands[i]];
-            ingredientCheck.children[0].innerText = merchant.ingredients[rands[i]].ingredient.name;
+            ingredientCheck.ingredient = ingredient;
+            ingredientCheck.children[0].innerText = ingredient.ingredient.name;
             ingredientCheck.children[1].children[0].onclick = ()=>{input.value--};
-            input.value = merchant.ingredients[rands[i]].quantity.toFixed(2);
+            input.value = ingredient.ingredient.convert(ingredient.quantity).toFixed(2);
             ingredientCheck.children[1].children[2].onclick = ()=>{input.value++}
-            ingredientCheck.children[2].innerText = merchant.ingredients[rands[i]].ingredient.unit.toUpperCase();
+            ingredientCheck.children[2].innerText = ingredient.ingredient.unit.toUpperCase();
 
             ul.appendChild(ingredientCheck);
         }