Browse Source

Test and fix bugs on enter transactions action

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

+ 1 - 1
controllers/merchantData.js

@@ -433,7 +433,7 @@ module.exports = {
                 updateIngredient.quantity = (updateIngredient.quantity + req.body.quantityChange).toFixed(2);
                 merchant.save()
                     .then((newMerchant)=>{
-                        res.json(req.body.quantityChange);
+                        res.json({});
                     })
                     .catch((err)=>{
                         let errorMessage = "Error: your data could not be saved";

+ 2 - 2
views/inventoryPage/enterPurchase.js

@@ -11,7 +11,7 @@ window.enterPurchaseObj = {
     },
 
     populateTable: function(){
-        let tbody = document.querySelector("#enterPurchaseStrand tbody");
+        let tbody = document.querySelector("#enterPurchaseAction tbody");
 
         while(tbody.children.length > 0){
             tbody.removeChild(tbody.firstChild);
@@ -38,7 +38,7 @@ window.enterPurchaseObj = {
     },
 
     submit: function(){
-        let tbody = document.querySelector("#enterPurchaseStrand tbody");
+        let tbody = document.querySelector("#enterPurchaseAction tbody");
 
         let purchases = [];
 

+ 6 - 2
views/inventoryPage/enterTransactions.js

@@ -5,6 +5,10 @@ window.enterTransactionsObj = {
         clearScreen();
         document.querySelector("#enterTransactionsAction").style.display = "flex";
 
+        console.log(typeof(merchant.lastUpdatedTime));
+
+        document.querySelector("#updated").innerText = new Date(Number(merchant.lastUpdatedTime)).toDateString();
+
         if(!this.isPopulated){
             this.populateRecipes();
             this.isPopulated = true;
@@ -12,7 +16,7 @@ window.enterTransactionsObj = {
     },
 
     populateRecipes: function(){
-        let tbody = document.querySelector("#enterTransactionsStrand tbody");
+        let tbody = document.querySelector("#enterTransactionsAction tbody");
 
         for(let recipe of merchant.recipes){
             let row = document.createElement("tr");
@@ -35,7 +39,7 @@ window.enterTransactionsObj = {
     },
 
     submit: function(){
-        let tbody = document.querySelector("#enterTransactionsStrand tbody");
+        let tbody = document.querySelector("#enterTransactionsAction tbody");
 
         let recipes = [];
 

+ 5 - 3
views/inventoryPage/inventory.css

@@ -1,4 +1,6 @@
 #title{
+    font-size: 45px;
+    color: rgb(255, 99, 107);
     text-align: center;
     margin-top: 25px;
 }
@@ -105,13 +107,13 @@
         margin: 10px;
     }
 
-/* Enter Purchases Action */
-#enterPurchasesAction{
+/* Enter Purchase Action */
+#enterPurchaseAction{
     flex-direction: column;
     align-items: center;
 }
 
-    #enterPurchasesAction > *{
+    #enterPurchaseAction > *{
         margin: 10px;
     }
 

+ 2 - 5
views/inventoryPage/inventory.ejs

@@ -99,10 +99,9 @@
         </div>
 
         <div id="enterTransactionsAction" class="action">
-            <h1>Enter items sold since (Date)</h1>
+            <h1>Enter all sales</h1>
+            <h3>Last updated: <span id="updated"></span></h3>
             
-            <button class="button" onclick="inventoryObj.display()">Back to inventory</button>
-
             <table>
                 <thead>
                     <tr>
@@ -119,8 +118,6 @@
         <div id="enterPurchaseAction" class="action">
             <h1>Enter Purchases</h1>
             
-            <button class="button" onclick="inventoryObj.display()">Back to inventory</button>
-
             <table>
                 <thead>
                     <tr>

+ 4 - 2
views/shared/shared.css

@@ -59,10 +59,11 @@ form{
     border: 5px solid rgb(255, 99, 107);
     text-decoration: none;
     border-radius: 10px;
-    padding: 10px 5px;
+    padding: 5px;
     color: rgb(0, 27, 45);
     cursor: pointer;
-    font-size: 25px;
+    font-size: 20px;
+    font-weight: bold;
     box-shadow: 2px 2px 2px black;
     transition: 0.3s;
     text-align: center;
@@ -120,6 +121,7 @@ form{
 strand-selector{
     display: flex;
     justify-content: center;
+    border-bottom: 1px solid rgb(255, 99, 107);
 }
 
     strand-selector button{