فهرست منبع

Creating an order no longer creates an error.

Lee Morgan 4 سال پیش
والد
کامیت
4773e767d5

+ 4 - 3
app.js

@@ -21,7 +21,7 @@ let mongooseOptions = {
 };
 
 let sessionOptions = {
-    secret: "Super Secret Subline Subliminally Saving Secrets So Sneaky Snakes Stay Sullen. Simply Superb.",
+    secret: "Super Secret Subline Subliminally Saving Secrets So Sneaky Snakes Stay Sullen. Simply Superbly Sublime.",
     sameSite: "lax",
     saveUninitialized: true,
     resave: false,
@@ -36,7 +36,8 @@ let esbuildOptions = {
     entryPoints: ["./views/dashboardPage/js/dashboard.js"],
     bundle: true,
     minify: false,
-    outfile: "./views/dashboardPage/bundle.js"
+    outfile: "./views/dashboardPage/bundle.js",
+    sourcemap: true
 };
 
 app.use(express.static(__dirname + "/views"));
@@ -62,6 +63,7 @@ if(process.env.NODE_ENV === "production"){
     mongooseOptions.user = "website";
     mongooseOptions.pass = process.env.SUBLINE_DB_PASS;
     esbuildOptions.minify = true;
+    esbuildOptions.sourcemap = false;
 }
 
 mongoose.connect(`mongodb://127.0.0.1:27017/inventory-management`, mongooseOptions);
@@ -87,5 +89,4 @@ cssmerger([
 if(process.env.NODE_ENV === "production"){
     httpsServer.listen(process.env.HTTPS_PORT, ()=>{});
 }
-
 app.listen(process.env.PORT, ()=>{});

+ 2 - 0
controllers/orderData.js

@@ -67,6 +67,7 @@ module.exports = {
     } 
     */ 
     createOrder: function(req, res){
+        console.log(req.body);
         let newOrder = new Order(req.body);
         newOrder.merchant = res.locals.merchant._id;
         newOrder.save()
@@ -74,6 +75,7 @@ module.exports = {
                 res.json(response);
             })
             .catch((err)=>{
+                console.error(err);
                 if(typeof(err) === "string"){
                     return res.json(err);
                 }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 3 - 0
views/dashboardPage/bundle.js.map


+ 0 - 4
views/dashboardPage/js/classes/Order.js

@@ -109,10 +109,6 @@ class Order{
         return this._fees / 100;
     }
 
-    get ingredients(){
-        return this.ingredients;
-    }
-
     getIngredientCost(){
         let sum = 0;
         for(let i = 0; i < this.ingredients.length; i++){

+ 2 - 2
views/dashboardPage/js/sidebars/newOrder.js

@@ -10,7 +10,7 @@ let newOrder = {
 
         let ingredientList = document.getElementById("newOrderIngredients");
         ingredientList.children[0].onkeyup = ()=>{this.searchIngredients()};
-        while(ingredientList.children.length > 1){
+        while(ingredientList.children.length > 0){
             ingredientList.removeChild(ingredientList.firstChild);
         }
 
@@ -76,7 +76,6 @@ let newOrder = {
             };
 
             if(ingredients[i].ingredient.ingredient.unit === "bottle"){
-                let unitMultiplier = controller.unitMultiplier(unit, controller.getBaseUnit(unit));
                 let toBottle = ingredients[i].ingredient.ingredient.convert.toBottle;
                 newIngredient.quantity = quantity / toBottle;
                 newIngredient.pricePerUnit = toBottle * (price * 100);
@@ -112,6 +111,7 @@ let newOrder = {
                 }
             })
             .catch((err)=>{
+                console.error(err);
                 controller.createBanner("SOMETHING WENT WRONG. PLEASE REFRESH THE PAGE", "error");
             })
             .finally(()=>{

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است