Ver código fonte

Add landing page. Create buttons for login/reg. Add POS options for reg.

Lee Morgan 6 anos atrás
pai
commit
1e3d181165

+ 5 - 1
controllers/home.js

@@ -11,6 +11,10 @@ const merchantId = "YHVPCQMVB1P81";
 const token = "b48068eb-411a-918e-ea64-52007147e42c";
 
 module.exports = {
+    landingPage: function(req, res){
+        return res.render("landingPage/landing");
+    },
+
     displayInventory: function(req, res){
         Merchant.findOne({posId: merchantId})
             .populate("inventory.ingredient")
@@ -221,7 +225,7 @@ module.exports = {
                         }
                         newMerchant.save()
                                 .then((merchant)=>{
-                                    return res.redirect("/");
+                                    return res.redirect("/inventory");
                                 })
                                 .catch((err)=>{
                                     console.log(err);

+ 13 - 0
models/merchant.js

@@ -5,6 +5,19 @@ const MerchantSchema = new mongoose.Schema({
         type: String,
         required: true
     },
+    email: {
+        type: String,
+        required: true
+    },
+    password: {
+        type: String,
+        required: true,
+        minlength: [15, "Password must contain at least 15 characters"]
+    },
+    pos: {
+        type: String,
+        required: true
+    },
     posId: {
         type: String,
         required: true

+ 2 - 1
routes.js

@@ -2,7 +2,8 @@ const home = require("./controllers/home");
 
 module.exports = function(app){
     //Render page
-    app.get("/", home.displayInventory);
+    app.get("/", home.landingPage);
+    app.get("/inventory", home.displayInventory);
     app.get("/merchant/new", home.merchantSetup);
     app.get("/recipes", home.displayRecipes);
 

+ 0 - 85
views/inventory/inventory.ejs

@@ -1,85 +0,0 @@
-<!DOCTYPE html>
-<html>
-    <head>
-        <link rel="stylesheet" href="/inventoryPage/inventory.css">
-        <link rel="stylesheet" href="/shared/shared.css">
-    </head>
-    <body>
-        <% include ../shared/header %>
-
-        <% include ../shared/banner %>
-
-        <div class="container">
-            <h1><%= merchant.name %> inventory</h1>
-
-            <a href="/recipes">View Recipes</a>
-
-            <button onclick="inventoryPage.displayAdd()">Add Ingredient</button>
-
-            <input id="filter" onkeyup="inventoryPage.filter()" type="text" placeholder="Start typing to filter">
-
-            <table>
-                <thead>
-                    <tr>
-                        <th onclick="inventoryPage.sortIngredients('name')">Item</th>
-                        <th onclick="inventoryPage.sortIngredients('category')">Category</th>
-                        <th onclick="inventoryPage.sortIngredients('quantity')">Quantity</th>
-                        <th onclick="inventoryPage.sortIngredients('unit')">Unit</th>
-                        <th></th>
-                    </tr>
-                    <tbody></tbody>
-                </thead>
-            </table>
-        </div>
-
-        <div class="add-ingredient">
-            <div class="modal-content" onclick="event.stopPropagation()">
-                <div id="existingIngredient">
-                    <button id="createNew">Create New</button>
-                    <table>
-                        <thead>
-                            <tr>
-                                <th>Ingredient</th>
-                                <th>Category</th>
-                                <th>Unit</th>
-                                <th></th>
-                            </tr>
-                        </thead>
-                        <tbody></tbody>
-                    </table>
-                </div>
-
-                <div id="quantityInput">
-                    <h3 id="quantityInputTitle"></h3>
-                    <input type="number" step="0.01" required>
-                    <button id="addIngredient">Add Ingredient</button>
-                </div>
-
-                <div id="newIngredient">
-                    <label>Ingredient Name:
-                        <input id="newName" type="text">
-                    </label>
-
-                    <label>Category:
-                        <input id="newCategory" type="text">
-                    </label>
-
-                    <label>Quantity:
-                        <input id="newQuantity" type="number" step="0.01">
-                    </label>
-
-                    <label>Unit:
-                        <input id="newUnit" type="text">
-                    </label>
-
-                    <button id="createIngredient">Create Ingredient</button>
-                </div>
-            </div>
-        </div>
-
-        <script>let merchant = <%- JSON.stringify(merchant) %>;</script>
-        <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
-        <script src="../shared/validation.js"></script>
-        <script src="/inventoryPage/inventory.js"></script>
-    </body>
-</html>

+ 58 - 0
views/landingPage/landing.css

@@ -0,0 +1,58 @@
+*{margin:0;padding:0;}
+
+body{
+    font-family: 'Saira', sans-serif;
+}
+
+#register{
+    display: none;
+}
+
+#login{
+    display: none;
+}
+
+/* Displaying the choice for the POS system */
+#pos{
+    display: none;
+    flex-direction: column;
+    align-items: center;
+}
+
+    .cards{
+        display: flex;
+        justify-content: space-around;
+    }
+
+        .cards > *{
+            display: flex;
+            flex-direction: column;
+            justify-content: space-around;
+            text-align: center;
+            width: 300px;
+            height: 200px;
+            border-radius: 25px;
+            border: 2px solid black;
+            padding: 50px;
+            cursor: pointer;
+            margin: 25px;
+            box-shadow: 0 0 20px black;
+        }
+
+            .cards > *:hover{
+                box-shadow: 0 0 25px #ff626b;
+            }
+
+            .cards > *:active{
+                box-shadow: 0 0 10px #ff626b;
+            }
+
+            .cards p{
+                margin-top: 25px;
+                font-size: 25px;
+                font-weight: bold;
+            }
+
+        .cards img{
+            margin: auto 10px;
+        }

+ 52 - 0
views/landingPage/landing.ejs

@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>The Subline</title>
+        <link rel="stylesheet" href="/landingPage/landing.css">
+        <link rel="stylesheet" href="/shared/shared.css">
+    </head>
+    <body>
+        <% include ../shared/header %>
+
+        <% include ../shared/banner %>
+
+        <div id="main">
+            <button>Login</button>
+            <button onclick="landingPage.choosePos()">Register</button>
+        </div>
+
+        <form id="login">
+
+        </form>
+
+        <div id="pos">
+            <h1>Choose your POS System</h1>
+            <div class="cards">
+                <div>
+                    <img src="../shared/images/clover-logo.jpeg">
+                </div>
+                <div>
+                    <img src="../shared/images/logo.png">
+                    <p>None</p>
+                </div>
+            </div>
+        </div>
+
+        <form id="register" onsubmit="landingPage.register()">
+            <label>Email
+                <input id="regEmail" type="email" required>
+            </label>
+
+            <label>Password
+                <input id="regPass" type="password" required>
+            </label>
+
+            <label>Confirm Password
+                <input id="regConfirmPass" type="password" required>
+            </label>
+        </form>
+
+        <script src="../shared/validation.js"></script>
+        <script src="/landingPage/landing.js"></script>
+    </body>
+</html>

+ 14 - 0
views/landingPage/landing.js

@@ -0,0 +1,14 @@
+let landingPage = {
+    clearScreen: function(){
+        document.querySelector("#main").style.display = "none";
+        document.querySelector("#login").style.display = "none";
+        document.querySelector("#pos").style.display = "none";
+        document.querySelector("#register").style.display = "none";
+
+    },
+
+    choosePos: function(){
+        this.clearScreen();
+        document.querySelector("#pos").style.display = "flex";
+    }
+}

BIN
views/shared/images/clover-logo.jpeg