|
@@ -3,8 +3,6 @@ window.ordersStrandObj = {
|
|
|
|
|
|
|
|
display: async function(){
|
|
display: async function(){
|
|
|
if(!this.isFetched){
|
|
if(!this.isFetched){
|
|
|
- window.orders = [];
|
|
|
|
|
-
|
|
|
|
|
let loader = document.getElementById("loaderContainer");
|
|
let loader = document.getElementById("loaderContainer");
|
|
|
loader.style.display = "flex";
|
|
loader.style.display = "flex";
|
|
|
|
|
|
|
@@ -44,8 +42,31 @@ window.ordersStrandObj = {
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
populate: function(){
|
|
populate: function(){
|
|
|
- let listDiv = document.querySelector("#orderList");
|
|
|
|
|
- let template = document.querySelector("#order").content.children[0];
|
|
|
|
|
|
|
+ let listDiv = document.getElementById("orderList");
|
|
|
|
|
+ let template = document.getElementById("order").content.children[0];
|
|
|
|
|
+ let dateDropdown = document.getElementById("dateDropdownOrder");
|
|
|
|
|
+ let ingredientDropdown = document.getElementById("ingredientDropdown");
|
|
|
|
|
+
|
|
|
|
|
+ dateDropdown.style.display = "none";
|
|
|
|
|
+ ingredientDropdown.style.display = "none";
|
|
|
|
|
+
|
|
|
|
|
+ document.getElementById("dateFilterBtnOrder").onclick = ()=>{this.toggleDropdown(dateDropdown)};
|
|
|
|
|
+ document.getElementById("ingredientFilterBtn").onclick = ()=>{this.toggleDropdown(ingredientDropdown)};
|
|
|
|
|
+
|
|
|
|
|
+ for(let i = 0; i < merchant.ingredients.length; i++){
|
|
|
|
|
+ let checkbox = document.createElement("input");
|
|
|
|
|
+ checkbox.type = "checkbox";
|
|
|
|
|
+ checkbox.ingredient = merchant.ingredients[i];
|
|
|
|
|
+ ingredientDropdown.appendChild(checkbox);
|
|
|
|
|
+
|
|
|
|
|
+ let label = document.createElement("label");
|
|
|
|
|
+ label.innerText = merchant.ingredients[i].name;
|
|
|
|
|
+ label.for = checkbox;
|
|
|
|
|
+ ingredientDropdown.appendChild(label);
|
|
|
|
|
+
|
|
|
|
|
+ let brk = document.createElement("br");
|
|
|
|
|
+ ingredientDropdown.appendChild(brk);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
while(listDiv.children.length > 0){
|
|
while(listDiv.children.length > 0){
|
|
|
listDiv.removeChild(listDiv.firstChild);
|
|
listDiv.removeChild(listDiv.firstChild);
|
|
@@ -56,7 +77,6 @@ window.ordersStrandObj = {
|
|
|
let totalCost = 0;
|
|
let totalCost = 0;
|
|
|
|
|
|
|
|
for(let j = 0; j < merchant.orders[i].ingredients.length; j++){
|
|
for(let j = 0; j < merchant.orders[i].ingredients.length; j++){
|
|
|
-
|
|
|
|
|
totalCost += merchant.orders[i].ingredients[j].quantity * merchant.orders[i].ingredients[j].price;
|
|
totalCost += merchant.orders[i].ingredients[j].quantity * merchant.orders[i].ingredients[j].price;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -67,8 +87,26 @@ window.ordersStrandObj = {
|
|
|
row.order = merchant.orders[i];
|
|
row.order = merchant.orders[i];
|
|
|
row.onclick = ()=>{orderDetailsComp.display(merchant.orders[i])};
|
|
row.onclick = ()=>{orderDetailsComp.display(merchant.orders[i])};
|
|
|
|
|
|
|
|
- window.orders.push(row);
|
|
|
|
|
listDiv.appendChild(row);
|
|
listDiv.appendChild(row);
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ submitFilter: function(){
|
|
|
|
|
+ event.preventDefault();
|
|
|
|
|
+
|
|
|
|
|
+ console.log("something");
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ toggleDropdown: function(dropdown){
|
|
|
|
|
+ event.preventDefault();
|
|
|
|
|
+ let polyline = dropdown.parentElement.children[0].children[1].children[0].children[0];
|
|
|
|
|
+
|
|
|
|
|
+ if(dropdown.style.display === "none"){
|
|
|
|
|
+ dropdown.style.display = "block";
|
|
|
|
|
+ polyline.setAttribute("points", "18 15 12 9 6 15");
|
|
|
|
|
+ }else{
|
|
|
|
|
+ dropdown.style.display = "none";
|
|
|
|
|
+ polyline.setAttribute("points", "6 9 12 15 18 9");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|