Bladeren bron

Fix ingredient details sidebar to working state

Lee Morgan 6 jaren geleden
bovenliggende
commit
2ff8e52f40

+ 4 - 2
views/dashboardPage/bundle.js

@@ -987,7 +987,6 @@ controller = {
             case "unit":
                 home.isPopulated = false;
                 ingredients.populateByProperty("category");
-                document.getElementById("ingredientStock").innerText = `${this.ingredient.ingredient.convert(this.ingredient.quantity).toFixed(2)} ${this.ingredient.ingredient.unit.toUpperCase()}`;
                 break;
         }
     }
@@ -1391,6 +1390,7 @@ module.exports = {
         newActive.classList.add("unitActive");
 
         controller.updateData("unit");
+        document.getElementById("ingredientStock").innerText = `${this.ingredient.ingredient.convert(this.ingredient.quantity).toFixed(2)} ${this.ingredient.ingredient.unit.toUpperCase()}`;
     },
 
     changeUnitDefault: function(){
@@ -2222,7 +2222,9 @@ module.exports = {
         if(!this.isPopulated){
             this.populateRecipes();
 
-            document.getElementById("posUpdateRecipe").onclick = ()=>{this.posUpdate()};
+            if(merchant.pos === "clover"){
+                document.getElementById("posUpdateRecipe").onclick = ()=>{this.posUpdate()};
+            }
             document.getElementById("recipeSearch").oninput = ()=>{this.search()};
             document.getElementById("recipeClearButton").onclick = ()=>{this.clearSorting()};
 

+ 0 - 1
views/dashboardPage/js/dashboard.js

@@ -234,7 +234,6 @@ controller = {
             case "unit":
                 home.isPopulated = false;
                 ingredients.populateByProperty("category");
-                document.getElementById("ingredientStock").innerText = `${this.ingredient.ingredient.convert(this.ingredient.quantity).toFixed(2)} ${this.ingredient.ingredient.unit.toUpperCase()}`;
                 break;
         }
     }

+ 1 - 0
views/dashboardPage/js/ingredientDetails.js

@@ -171,6 +171,7 @@ module.exports = {
         newActive.classList.add("unitActive");
 
         controller.updateData("unit");
+        document.getElementById("ingredientStock").innerText = `${this.ingredient.ingredient.convert(this.ingredient.quantity).toFixed(2)} ${this.ingredient.ingredient.unit.toUpperCase()}`;
     },
 
     changeUnitDefault: function(){

+ 3 - 1
views/dashboardPage/js/recipeBook.js

@@ -6,7 +6,9 @@ module.exports = {
         if(!this.isPopulated){
             this.populateRecipes();
 
-            document.getElementById("posUpdateRecipe").onclick = ()=>{this.posUpdate()};
+            if(merchant.pos === "clover"){
+                document.getElementById("posUpdateRecipe").onclick = ()=>{this.posUpdate()};
+            }
             document.getElementById("recipeSearch").oninput = ()=>{this.search()};
             document.getElementById("recipeClearButton").onclick = ()=>{this.clearSorting()};