Jelajahi Sumber

Display merchant name on menu.
Display owner name on settings page instead of merchant's.

Lee Morgan 5 tahun lalu
induk
melakukan
22c772b332

+ 4 - 2
controllers/merchantData.js

@@ -28,7 +28,8 @@ module.exports = {
                 let responseOwner = {
                     _id: response[0]._id,
                     email: response[0].email,
-                    merchants: response[0].merchants
+                    merchants: response[0].merchants,
+                    name: response[0].name
                 };
 
                 for(let i = 0; i < responseOwner.merchants.length; i++){
@@ -153,7 +154,8 @@ module.exports = {
                 let owner = {
                     _id: response[0]._id,
                     email: response[0].email,
-                    merchants: response[0].merchants
+                    merchants: response[0].merchants,
+                    name: response[0].name
                 }
 
                 req.session.merchant = response[1]._id;

+ 2 - 1
controllers/squareData.js

@@ -331,7 +331,8 @@ module.exports = {
                 res.json([{
                     _id: res.locals.owner._id,
                     email: res.locals.owner.email,
-                    merchants: res.locals.owner.merchants
+                    merchants: res.locals.owner.merchants,
+                    name: res.locals.owner.name
                 }, merchant]);
 
                 helper.getAllMerchantTransactions(merchant, res.locals.owner.square.accessToken);

+ 2 - 0
views/dashboardPage/ejs/menu.ejs

@@ -8,6 +8,8 @@
         <button class="menuShifter" onclick="controller.changeMenu()">&#8801;</button>
     </div>
 
+    <p id="menuLocationName"></p>
+
     <div id="min" class="menuHead menuHeadMin">
         <a href="/">
             <img class="menuLogoMin" src="/shared/images/logo.png" alt="The Subline">

+ 2 - 1
views/dashboardPage/js/classes/Merchant.js

@@ -88,7 +88,8 @@ class Merchant{
         this._owner = {
             id: owner._id,
             email: owner.email,
-            merchants: owner.merchants
+            merchants: owner.merchants,
+            name: owner.name
         };
         
         //populate ingredients

+ 3 - 0
views/dashboardPage/js/dashboard.js

@@ -358,6 +358,7 @@ window.state = {
         this.updateRecipes();
         this.updateTransactions();
         this.updateOrders();
+        document.getElementById("menuLocationName").innerText = merchant.name;
     }
 }
 
@@ -371,4 +372,6 @@ document.getElementById("transactionsBtn").onclick = ()=>{controller.openStrand(
 document.getElementById("accountBtn").onclick = ()=>{controller.openStrand("account")};
 document.getElementById("feedbackButton").onclick = ()=>{controller.openModal("feedback")};
 
+document.getElementById("menuLocationName").innerText = merchant.name;
+
 controller.openStrand("home");

+ 1 - 1
views/dashboardPage/js/strands/account.js

@@ -2,7 +2,7 @@ const Merchant = require("../classes/Merchant");
 
 let account = {
     display: function(){
-        document.getElementById("accountStrandTitle").innerText = merchant.name;
+        document.getElementById("accountStrandTitle").innerText = merchant.owner.name;
         document.getElementById("accountEmail").value = merchant.owner.email;
 
         document.getElementById("accountUpdate").onclick = ()=>{this.updateData()};

+ 6 - 13
views/dashboardPage/sidebars.css

@@ -23,7 +23,6 @@
         margin-top: 10px;
         font-size: 22px;
         font-weight: bold;
-        margin-bottom: 50px;
         text-decoration: none;
     }
 
@@ -61,6 +60,12 @@
         border: 0;
     }
 
+    #menuLocationName{
+        color: white;
+        font-size: 22px;
+        font-weight: bold;
+    }
+
     .menuButton{
         display: flex;
         align-items: center;
@@ -90,27 +95,15 @@
 
         .menuButton:hover{
             background: rgb(179, 191, 209);
-            /* color: black; */
-            /* fill: black; */
-        }
-
-        .menuButton:hover svg{
-            /* stroke: black; */
         }
 
     .menu > .active{
         background: rgb(240, 252, 255);
-        /* color: black; */
         cursor: default;
     }
 
     .menu > .active:hover{
         background: rgb(240, 252, 255);
-        /* color: black; */
-    }
-
-    .menu > .active:hover svg{
-        /* stroke: black; */
     }
 
 /* Minimized menu */