|
|
@@ -1621,43 +1621,8 @@ controller = {
|
|
|
document.getElementById("mobileMenuSelector").onclick = ()=>{this.openMenu()};
|
|
|
},
|
|
|
|
|
|
- /*
|
|
|
- Converts the price of unit back to the price per default unit
|
|
|
- unitType = type of the unit (i.e. mass, volume)
|
|
|
- unit = exact unit to convert to
|
|
|
- price = price of the ingredient per unit in cents
|
|
|
- */
|
|
|
- reconvertPrice(unitType, unit, price){
|
|
|
- if(unitType === "mass"){
|
|
|
- switch(unit){
|
|
|
- case "g": break;
|
|
|
- case "kg": price *= 1000; break;
|
|
|
- case "oz": price *= 28.3495; break;
|
|
|
- case "lb": price *= 453.5924; break;
|
|
|
- }
|
|
|
- }else if(unitType === "volume"){
|
|
|
- switch(unit){
|
|
|
- case "ml": price /= 1000; break;
|
|
|
- case "l": break;
|
|
|
- case "tsp": price /= 202.8842; break;
|
|
|
- case "tbsp": price /= 67.6278; break;
|
|
|
- case "ozfl": price /= 33.8141; break;
|
|
|
- case "cup": price /= 4.1667; break;
|
|
|
- case "pt": price /= 2.1134; break;
|
|
|
- case "qt": price /= 1.0567; break;
|
|
|
- case "gal": price *= 3.7854; break;
|
|
|
- }
|
|
|
- }else if(unitType === "length"){
|
|
|
- switch(unit){
|
|
|
- case "mm": price /= 1000; break;
|
|
|
- case "cm": price /= 100; break;
|
|
|
- case "m": break;
|
|
|
- case "in": price /= 39.3701; break;
|
|
|
- case "ft": price /= 3.2808; break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return price;
|
|
|
+ updateAnalytics: function(){
|
|
|
+ analytics.isPopulated = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -2584,6 +2549,7 @@ let newTransaction = {
|
|
|
}else{
|
|
|
merchant.addTransaction(response);
|
|
|
|
|
|
+ controller.updateAnalytics();
|
|
|
controller.openStrand("transactions", merchant.getTransactions());
|
|
|
controller.createBanner("TRANSACTION CREATED", "success");
|
|
|
}
|
|
|
@@ -2622,6 +2588,7 @@ let newTransaction = {
|
|
|
response.recipes[i].recipe = response.recipes[i].recipe._id;
|
|
|
}
|
|
|
merchant.addTransaction(response);
|
|
|
+ controller.updateAnalytics();
|
|
|
|
|
|
controller.openStrand("transactions", merchant.transactions);
|
|
|
controller.createBanner("TRANSACTION SUCCESSFULLY CREATED. INGREDIENTS UPDATED", "success");
|
|
|
@@ -2991,6 +2958,7 @@ let transactionDetails = {
|
|
|
controller.createBanner(response, "error");
|
|
|
}else{
|
|
|
merchant.removeTransaction(this.transaction);
|
|
|
+ controller.updateAnalytics();
|
|
|
|
|
|
controller.openStrand("transactions", merchant.getTransactions());
|
|
|
controller.createBanner("TRANSACTION REMOVED", "success");
|