|
@@ -104,6 +104,9 @@ let recipeDetailsComp = {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ let loader = document.getElementById("loaderContainer");
|
|
|
|
|
+ loader.style.display = "flex";
|
|
|
|
|
+
|
|
|
fetch("/recipe/update", {
|
|
fetch("/recipe/update", {
|
|
|
method: "PUT",
|
|
method: "PUT",
|
|
|
headers: {
|
|
headers: {
|
|
@@ -113,6 +116,7 @@ let recipeDetailsComp = {
|
|
|
})
|
|
})
|
|
|
.then((response) => response.json())
|
|
.then((response) => response.json())
|
|
|
.then((response)=>{
|
|
.then((response)=>{
|
|
|
|
|
+ loader.style.display = "none";
|
|
|
if(typeof(response) === "string"){
|
|
if(typeof(response) === "string"){
|
|
|
banner.createError(response);
|
|
banner.createError(response);
|
|
|
}else{
|
|
}else{
|
|
@@ -267,6 +271,9 @@ let newOrderComp = {
|
|
|
date: document.getElementById("orderDate").value,
|
|
date: document.getElementById("orderDate").value,
|
|
|
ingredients: ingredients
|
|
ingredients: ingredients
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ let loader = document.getElementById("loaderContainer");
|
|
|
|
|
+ loader.style.display = "flex";
|
|
|
|
|
|
|
|
fetch("/order", {
|
|
fetch("/order", {
|
|
|
method: "POST",
|
|
method: "POST",
|
|
@@ -277,6 +284,7 @@ let newOrderComp = {
|
|
|
})
|
|
})
|
|
|
.then(response => response.json())
|
|
.then(response => response.json())
|
|
|
.then((response)=>{
|
|
.then((response)=>{
|
|
|
|
|
+ loader.style.display = "none";
|
|
|
if(typeof(response) === "string"){
|
|
if(typeof(response) === "string"){
|
|
|
banner.createError(response);
|
|
banner.createError(response);
|
|
|
}else{
|
|
}else{
|
|
@@ -319,6 +327,9 @@ let newIngredientComp = {
|
|
|
quantity: document.querySelector("#newIngQuantity").value
|
|
quantity: document.querySelector("#newIngQuantity").value
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ let loader = document.getElementById("loaderContainer");
|
|
|
|
|
+ loader.style.display = "flex";
|
|
|
|
|
+
|
|
|
if(validator.ingredient(newIngredient)){
|
|
if(validator.ingredient(newIngredient)){
|
|
|
fetch("/ingredients/create", {
|
|
fetch("/ingredients/create", {
|
|
|
method: "POST",
|
|
method: "POST",
|
|
@@ -329,6 +340,7 @@ let newIngredientComp = {
|
|
|
})
|
|
})
|
|
|
.then((response) => response.json())
|
|
.then((response) => response.json())
|
|
|
.then((response)=>{
|
|
.then((response)=>{
|
|
|
|
|
+ loader.style.display = "none";
|
|
|
if(typeof(response) === "string"){
|
|
if(typeof(response) === "string"){
|
|
|
banner.createError(response);
|
|
banner.createError(response);
|
|
|
}else{
|
|
}else{
|
|
@@ -384,6 +396,9 @@ let orderDetailsComp = {
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
remove: function(order){
|
|
remove: function(order){
|
|
|
|
|
+ let loader = document.getElementById("loaderContainer");
|
|
|
|
|
+ loader.style.display = "flex";
|
|
|
|
|
+
|
|
|
fetch(`/order/${order.id}`, {
|
|
fetch(`/order/${order.id}`, {
|
|
|
method: "DELETE",
|
|
method: "DELETE",
|
|
|
headers: {
|
|
headers: {
|
|
@@ -392,6 +407,7 @@ let orderDetailsComp = {
|
|
|
})
|
|
})
|
|
|
.then((response) => response.json())
|
|
.then((response) => response.json())
|
|
|
.then((response)=>{
|
|
.then((response)=>{
|
|
|
|
|
+ loader.style.display = "none";
|
|
|
if(typeof(response) === "string"){
|
|
if(typeof(response) === "string"){
|
|
|
banner.createError(response);
|
|
banner.createError(response);
|
|
|
}else{
|
|
}else{
|
|
@@ -414,9 +430,13 @@ let addIngredientsComp = {
|
|
|
let sidebar = document.querySelector("#addIngredients");
|
|
let sidebar = document.querySelector("#addIngredients");
|
|
|
|
|
|
|
|
if(!this.isPopulated){
|
|
if(!this.isPopulated){
|
|
|
|
|
+ let loader = document.getElementById("loaderContainer");
|
|
|
|
|
+ loader.style.display = "flex";
|
|
|
|
|
+
|
|
|
fetch("/ingredients")
|
|
fetch("/ingredients")
|
|
|
.then((response) => response.json())
|
|
.then((response) => response.json())
|
|
|
.then((response)=>{
|
|
.then((response)=>{
|
|
|
|
|
+ loader.style.display = "none";
|
|
|
if(typeof(response) === "string"){
|
|
if(typeof(response) === "string"){
|
|
|
banner.createError(response);
|
|
banner.createError(response);
|
|
|
}else{
|
|
}else{
|
|
@@ -571,6 +591,9 @@ let addIngredientsComp = {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ let loader = document.getElementById("loaderContainer");
|
|
|
|
|
+ loader.style.display = "flex";
|
|
|
|
|
+
|
|
|
fetch("/merchant/ingredients/add", {
|
|
fetch("/merchant/ingredients/add", {
|
|
|
method: "POST",
|
|
method: "POST",
|
|
|
headers: {
|
|
headers: {
|
|
@@ -579,6 +602,7 @@ let addIngredientsComp = {
|
|
|
body: JSON.stringify(fetchable)
|
|
body: JSON.stringify(fetchable)
|
|
|
})
|
|
})
|
|
|
.then((response)=>{
|
|
.then((response)=>{
|
|
|
|
|
+ loader.style.display = "none";
|
|
|
if(typeof(response) === "string"){
|
|
if(typeof(response) === "string"){
|
|
|
banner.createError(response);
|
|
banner.createError(response);
|
|
|
}else{
|
|
}else{
|
|
@@ -654,11 +678,15 @@ let ingredientDetailsComp = {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ let loader = document.getElementById("loaderContainer");
|
|
|
|
|
+ loader.style.display = "flex";
|
|
|
|
|
+
|
|
|
fetch(`/merchant/ingredients/remove/${this.ingredient.ingredient.id}`, {
|
|
fetch(`/merchant/ingredients/remove/${this.ingredient.ingredient.id}`, {
|
|
|
method: "DELETE",
|
|
method: "DELETE",
|
|
|
})
|
|
})
|
|
|
.then((response) => response.json())
|
|
.then((response) => response.json())
|
|
|
.then((response)=>{
|
|
.then((response)=>{
|
|
|
|
|
+ loader.style.display = "none";
|
|
|
if(typeof(response) === "string"){
|
|
if(typeof(response) === "string"){
|
|
|
banner.createError(response);
|
|
banner.createError(response);
|
|
|
}else{
|
|
}else{
|
|
@@ -682,6 +710,9 @@ let ingredientDetailsComp = {
|
|
|
quantity: this.ingredient.quantity
|
|
quantity: this.ingredient.quantity
|
|
|
}];
|
|
}];
|
|
|
|
|
|
|
|
|
|
+ let loader = document.getElementById("loaderContainer");
|
|
|
|
|
+ loader.style.display = "flex";
|
|
|
|
|
+
|
|
|
if(validator.ingredientQuantity(data[0].quantity)){
|
|
if(validator.ingredientQuantity(data[0].quantity)){
|
|
|
fetch("/merchant/ingredients/update", {
|
|
fetch("/merchant/ingredients/update", {
|
|
|
method: "PUT",
|
|
method: "PUT",
|
|
@@ -692,6 +723,7 @@ let ingredientDetailsComp = {
|
|
|
})
|
|
})
|
|
|
.then((response) => response.json())
|
|
.then((response) => response.json())
|
|
|
.then((response)=>{
|
|
.then((response)=>{
|
|
|
|
|
+ loader.style.display = "none";
|
|
|
if(typeof(response) === "string"){
|
|
if(typeof(response) === "string"){
|
|
|
banner.createError(response);
|
|
banner.createError(response);
|
|
|
}else{
|
|
}else{
|
|
@@ -773,6 +805,9 @@ let newRecipeComp = {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ let loader = document.getElementById("loaderContainer");
|
|
|
|
|
+ loader.style.display = "flex";
|
|
|
|
|
+
|
|
|
fetch("/recipe/create", {
|
|
fetch("/recipe/create", {
|
|
|
method: "POST",
|
|
method: "POST",
|
|
|
headers: {
|
|
headers: {
|
|
@@ -782,6 +817,7 @@ let newRecipeComp = {
|
|
|
})
|
|
})
|
|
|
.then((response) => response.json())
|
|
.then((response) => response.json())
|
|
|
.then((response)=>{
|
|
.then((response)=>{
|
|
|
|
|
+ loader.style.display = "none";
|
|
|
if(typeof(response) === "string"){
|
|
if(typeof(response) === "string"){
|
|
|
banner.createError(response);
|
|
banner.createError(response);
|
|
|
}else{
|
|
}else{
|