浏览代码

Update editIngredient.js to work with the new bottle data structure.

Lee Morgan 5 年之前
父节点
当前提交
de56220553
共有 2 个文件被更改,包括 4 次插入18 次删除
  1. 2 9
      views/dashboardPage/bundle.js
  2. 2 9
      views/dashboardPage/js/sidebars/editIngredient.js

+ 2 - 9
views/dashboardPage/bundle.js

@@ -1610,7 +1610,7 @@ let editIngredient = {
         }
         
         //Make any changes for special ingredients
-        if(ingredient.ingredient.specialUnit === "bottle"){
+        if(ingredient.ingredient.unit === "bottle"){
             quantLabel.innerText = "CURRENT STOCK (BOTTLES):";
 
             specialLabel.style.display = "flex";
@@ -1655,14 +1655,7 @@ let editIngredient = {
             category: document.getElementById("editIngCategory").value
         }
 
-        //Add data based on unit type
-        if(ingredient.ingredient.specialUnit === "bottle"){
-            let unitSize = ingredient.convertToBase(parseFloat(document.getElementById("editSpecialLabel").children[0].value));
-            data.quantity = quantity * unitSize;
-            data.unitSize = unitSize;
-        }else{
-            data.quantity = quantity;
-        }
+        data.quantity = quantity;
 
         //Get the measurement unit
         let units = document.getElementById("unitButtons");

+ 2 - 9
views/dashboardPage/js/sidebars/editIngredient.js

@@ -32,7 +32,7 @@ let editIngredient = {
         }
         
         //Make any changes for special ingredients
-        if(ingredient.ingredient.specialUnit === "bottle"){
+        if(ingredient.ingredient.unit === "bottle"){
             quantLabel.innerText = "CURRENT STOCK (BOTTLES):";
 
             specialLabel.style.display = "flex";
@@ -77,14 +77,7 @@ let editIngredient = {
             category: document.getElementById("editIngCategory").value
         }
 
-        //Add data based on unit type
-        if(ingredient.ingredient.specialUnit === "bottle"){
-            let unitSize = ingredient.convertToBase(parseFloat(document.getElementById("editSpecialLabel").children[0].value));
-            data.quantity = quantity * unitSize;
-            data.unitSize = unitSize;
-        }else{
-            data.quantity = quantity;
-        }
+        data.quantity = quantity;
 
         //Get the measurement unit
         let units = document.getElementById("unitButtons");