Bläddra i källkod

Create and display modal for feedback.

Lee Morgan 5 år sedan
förälder
incheckning
f92872d98b

+ 0 - 1
controllers/passwordReset.js

@@ -1,6 +1,5 @@
 const Merchant = require("../models/merchant.js");
 
-const helper = require("./helper.js");
 const passwordReset = require("../emails/passwordReset.js");
 
 const mailgun = require("mailgun-js")({apiKey: process.env.MG_SUBLINE_APIKEY, domain: "mail.thesubline.net"});

+ 0 - 2
middleware.js

@@ -2,8 +2,6 @@ const Merchant = require("./models/merchant.js")
 
 const helper = require("./controllers/helper.js");
 
-const axios = require("axios");
-
 module.exports = {
     verifySession: function(req, res, next){
         if(req.session.user === undefined) {

+ 17 - 0
views/dashboardPage/dashboard.css

@@ -655,6 +655,23 @@ Modal
                 margin-top: 15px;
             }
 
+    #modalFeedback{
+        display: flex;
+        flex-direction: column;
+        background: white;
+        padding: 50px;
+    }
+
+        #modalFeedback > *{
+            margin: 15px;
+        }
+
+        #modalFeedback label{
+            display: flex;
+            flex-direction: column;
+
+        }
+
 @media screen and (orientation: portrait){
     @media screen and (max-width: 1400px){
         body{

+ 5 - 1
views/dashboardPage/ejs/menu.ejs

@@ -83,5 +83,9 @@
         <p>LOGOUT</p>
     </a>
 
-    <a href="/help">Help</a>
+    <div class="menuLinks">
+        <button id="feedbackButton">Leave Feedback</button>
+
+        <a href="/help">Help</a>
+    </div>
 </div>

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

@@ -214,6 +214,10 @@ controller = {
                 document.getElementById("modalSpreadsheetTitle").innerText = "transactions";
                 document.getElementById("spreadsheetDownload").href = "/transactions/download/spreadsheet";
                 content.onsubmit = newTransaction.submitSpreadsheet;
+                break;
+            case "feedback":
+                document.getElementById("modalFeedback").style.display = "flex";
+                break;
         }
     },
 
@@ -314,5 +318,6 @@ document.getElementById("analyticsBtn").onclick = ()=>{controller.openStrand("an
 document.getElementById("ordersBtn").onclick = async ()=>{controller.openStrand("orders")};
 document.getElementById("transactionsBtn").onclick = ()=>{controller.openStrand("transactions", merchant.getTransactions())};
 document.getElementById("accountBtn").onclick = ()=>{controller.openStrand("account")};
+document.getElementById("feedbackButton").onclick = ()=>{controller.openModal("feedback")};
 
 controller.openStrand("home");

+ 11 - 1
views/dashboardPage/modal.ejs

@@ -6,7 +6,7 @@
         </svg>
 
         <div id="modalContent">
-            <form id="modalSpreadsheetUpload" class="modalSpreadsheetUpload" method="post">
+            <form id="modalSpreadsheetUpload" class="modalSpreadsheetUpload" method="post" style="display:none;">
                 <h3>Choose a file to upload your <span id="modalSpreadsheetTitle"></span></h3>
                 <input id="spreadsheetInput" class="fileUpload" name="file" type="file">
                 <label id="" style="display:none;">
@@ -16,6 +16,16 @@
                 <input class="button" type="submit" value="SUBMIT">
                 <a id="spreadsheetDownload">download template</a>
             </form>
+
+            <form id="modalFeedback" style="display:none;" method="post" action="/feedback">
+                <label>Title:
+                    <input type="text" name="title" required>
+                </label>
+
+                <textarea name="content" placeholder="Your Feedback" rows="10" cols="50"></textarea>
+
+                <input class="button" type="submit" value="SUBMIT">
+            </form>
         </div>
     </div>
 </div>

+ 15 - 0
views/dashboardPage/sidebars.css

@@ -197,6 +197,21 @@
     margin: 25px;
 }
 
+.menuLinks{
+    display: flex;
+    justify-content: space-between;
+    width: 75%;
+}
+
+    .menuLinks > *{
+        background: none;
+        border: none;
+        color: white;
+        text-decoration: underline;
+        font-size: 16px;
+        cursor: pointer;
+    }
+
 /* 
 Ingredient Details 
 */