Browse Source

Fix bugs on home page

Lee Morgan 6 năm trước cách đây
mục cha
commit
6b5e724fe0

+ 1 - 1
views/dashboardPage/Merchant.js

@@ -233,7 +233,7 @@ class Merchant{
         for(let i = indices[0]; i <= indices[1]; i++){
             for(let j = 0; j < this.transactions[i].recipes.length; j++){
                 for(let k = 0; k < this.recipes.length; k++){
-                    if(this.transactions[i].recipes[j].recipe === this.recipes[k]._id){
+                    if(this.transactions[i].recipes[j].recipe === this.recipes[k]){
                         total += this.transactions[i].recipes[j].quantity * this.recipes[k].price;
                     }
                 }

+ 2 - 1
views/dashboardPage/components/components.js

@@ -545,7 +545,6 @@ let ingredientDetailsComp = {
         this.ingredient = ingredient;
 
         sidebar = document.querySelector("#ingredientDetails");
-        openSidebar(sidebar);
 
         document.querySelector("#ingredientDetails p").innerText = category.name;
         document.querySelector("#ingredientDetails h1").innerText = ingredient.ingredient.name;
@@ -589,6 +588,8 @@ let ingredientDetailsComp = {
             }
             ul.appendChild(li);
         }
+
+        openSidebar(sidebar);
     },
 
     remove: function(){

+ 1 - 1
views/dashboardPage/home.js

@@ -125,7 +125,7 @@ window.homeStrandObj = {
 
                 dataArray.push({
                     num: max,
-                    label: `${ingredientList[index].name}: ${+ingredientList[index].quantity.toFixed(2)} ${ingredientList[index].unit}`
+                    label: `${ingredientList[index].ingredient.name}: ${+ingredientList[index].quantity.toFixed(2)} ${ingredientList[index].ingredient.unit}`
                 });
                 ingredientList.splice(index, 1);
             }