Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
85 changes: 11 additions & 74 deletions UI/full_menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,98 +69,34 @@
<div id="header">
<h2>Fast-Foood-Fast Full Menu</h2>
</div>
<div class="category_title"><h3>Snacks</h3></div>
<table class="orders">
<tr>
<th>ID</th>
<th>Image</th>
<th>Item</th>
<th>Price</th>
<th>Action</th>
</tr>
<tr>
<td>1</td>
<td><img src="./images/hamburger.jpeg"></td>
<td>Ham Burger</td>
<td>300</td>
<td><button id="order" class="call_to" onclick="location.href='order.html';">Order</button></td>
</tr>
<tr>
<td>2</td>
<td><img src="./images/fries.jpeg"></td>
<td>Fries</td>
<td>200</td>
<td><button id="order" class="call_to" onclick="location.href='order.html';">Order</button></td>
</tr>
<tr>
<td>3</td>
<td><img src="./images/sausage.jpeg"></td>
<td>Sausage</td>
<td>100</td>
<td><button id="order" class="call_to" onclick="location.href='order.html';">Order</button></td>
</tr>
<div class="category_title" id="title"><h3>Snacks</h3></div>
<table class="orders" id="snacks">
<tr>
<th>Image</th>
<th>Item</th>
<th>Price</th>
<th>Action</th>
</tr>
</table>
<div class="category_title"><h3>Main Dish</h3></div>
<table class="orders">
<table class="orders" id="main-dish">
<tr>
<th>ID</th>
<th>Image</th>
<th>Item</th>
<th>Price</th>
<th>Action</th>
</tr>
<tr>
<td>1</td>
<td><img src="./images/beefsteak.jpeg"></td>
<td>Beef Steak</td>
<td>1000</td>
<td><button id="order" class="call_to" onclick="location.href='order.html';">Order</button></td>
</tr>
<tr>
<td>2</td>
<td><img src="./images/rice.jpeg"></td>
<td>Vegetable Rice</td>
<td>500</td>
<td><button id="order" class="call_to" onclick="location.href='order.html';">Order</button></td>
</tr>
<tr>
<td>3</td>
<td><img src="./images/brocoli.jpeg"></td>
<td>Basil Brocoli</td>
<td>800</td>
<td><button id="order" class="call_to" onclick="location.href='order.html';">Order</button></td>
</tr>
</table>
<div class="category_title"><h3>Drinks</h3></div>
<table class="orders">
<table class="orders" id="drinks">
<tr>
<th>ID</th>
<th>Image</th>
<th>Item</th>
<th>Price</th>
<th>Action</th>
</tr>
<tr>
<td>1</td>
<td><img src="./images/coffee.jpeg"></td>
<td>Black Coffee</td>
<td>300</td>
<td><button id="order" class="call_to" onclick="location.href='order.html';">Order</button></td>
</tr>
<tr>
<td>2</td>
<td><img src="./images/juice.jpeg"></td>
<td>Fruti Juice</td>
<td>100</td>
<td><button id="order" class="call_to" onclick="location.href='order.html';">Order</button></td>
</tr>
<tr>
<td>3</td>
<td><img src="./images/milkshake.jpeg"></td>
<td>Milk Shake</td>
<td>200</td>
<td><button id="order" class="call_to" onclick="location.href='order.html';">Order</button></td>
</tr>
</table>

</div>
Expand All @@ -170,5 +106,6 @@ <h2>Fast-Foood-Fast Full Menu</h2>
</footer>

<script src="./js/main.js" type="text/javascript"></script>
<script src="./js/fetchFullMenu.js" text="text/javasript"></script>
</body>
</html>
64 changes: 1 addition & 63 deletions UI/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,75 +105,12 @@ <h3>Dessert</h3>
</section>
<section id="content">
<div class="container" id="main-dish">
<div class="item">
<a href="#content"></a><img src="./images/rice.jpeg"></a>
<h3>Vegetable Rice</h3>
<p>Beetroot water spinach chestnut ricebean pea.</p>
<b>KES. 500.00</b><br><br>
<button class="call_to" onclick="location.href='order.html';">Order Now</button>
</div>
<div class="item">
<a href="#content"><img src="./images/brocoli.jpeg"><a/>
<h3>Baked Basil Brocoli</h3>
<p>Beetroot water spinach chestnut ricebean pea.</p>
<b>KES. 800.00</b><br><br>
<button class="call_to" onclick="location.href='order.html';">Order Now</button>
</div>
<div class="item">
<a href="#content"><img src="./images/beefsteak.jpeg"></a>
<h3>Beef Steak W/ Sauce</h3>
<p>Beetroot water spinach chestnut ricebean pea.</p>
<b>KES. 1000.00</b><br><br>
<button class="call_to" onclick="location.href='order.html';">Order Now</button>
</div>
</div>
<hr>
<div class="container" id="snacks">
<div class="item">
<a href="#content"></a><img src="./images/hamburger.jpeg"></a>
<h3>Ham Burger</h3>
<p>Beetroot water spinach chestnut ricebean pea.</p>
<b>KES. 300.00</b><br><br>
<button class="call_to" onclick="location.href='order.html';">Order Now</button>
</div>
<div class="item">
<a href="#content"><img src="./images/fries.jpeg"><a/>
<h3>French Fries</h3>
<p>Beetroot water spinach chestnut ricebean pea.</p>
<b>KES. 200.00</b><br><br>
<button class="call_to" onclick="location.href='order.html';">Order Now</button>
</div>
<div class="item">
<a href="#content"><img src="./images/sausage.jpeg"></a>
<h3>Sausages</h3>
<p>Beetroot water spinach chestnut ricebean pea.</p>
<b>KES. 100.00</b><br><br>
<button class="call_to" onclick="location.href='order.html';">Order Now</button>
</div>
</div>
<hr>
<div class="container" id="drinks">
<div class="item">
<a href="#content"><img src="./images/juice.jpeg"></a>
<h3>Fruit Juice</h3>
<p>Beetroot water spinach chestnut ricebean pea.</p>
<b>KES. 100.00</b><br><br>
<button class="call_to" onclick="location.href='order.html';">Order Now</button>
</div>
<div class="item">
<a href="#content"><img src="./images/coffee.jpeg"></a>
<h3>Black Coffee</h3>
<p>Beetroot water spinach chestnut ricebean pea.</p>
<b>KES. 300.00</b><br><br>
<button class="call_to" onclick="location.href='order.html';">Order Now</button>
</div>
<div class="item">
<a href="#content"><img src="./images/milkshake.jpeg" alt="Milk Shake"></a>
<h3>Milk Shake</h3>
<p>Beetroot water spinach chestnut ricebean pea.</p>
<b>KES. 200.00</b><br><br>
<button class="call_to" onclick="location.href='order.html';">Order Now</button>
</div>
</div>
</section>
<hr>
Expand Down Expand Up @@ -222,5 +159,6 @@ <h1>Testimonials</h1>
</footer>

<script src="./js/main.js" type="text/javascript"></script>
<script src="./js/fetchMenu.js" type="text/javascript"></script>
</body>
</html>
61 changes: 61 additions & 0 deletions UI/js/fetchFullMenu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
const baseURL = 'https://fastfoodfast-api.herokuapp.com/api/v2/menu'
window.onload = function getFullMenu(){
fetch(baseURL, {
method: 'GET',
headers: {
'Accept': 'application/json, text/plain, */*',
'Content-type': 'application/json'
}

})
.then(res => {
statusCode = res.status
return res.json()
})
.then((data) => {
if (statusCode == 200){
let snacksOutput = '';
let mainOutput = '';
let drinksOutput = '';
data['Full Menu'].forEach((menu) => {
if (menu.category == 'main'){
mainOutput +=`
<tr>
<td><img src="./images/beefsteak.jpeg"></td>
<td>${menu.name}</td>
<td>${menu.price}</td>
<td><button id="order" class="call_to" onclick="location.href='order.html';">Order</button></td>
</tr>
`;
}
if (menu.category == 'snacks'){
snacksOutput +=`
<tr>
<td><img src="./images/sausage.jpeg"></td>
<td>${menu.name}</td>
<td>${menu.price}</td>
<td><button id="order" class="call_to" onclick="location.href='order.html';">Order</button></td>
</tr>
`;
}
if (menu.category == 'drinks'){
drinksOutput +=`
<tr>
<td><img src="./images/smoothie.jpeg"></td>
<td>${menu.name}</td>
<td>${menu.price}</td>
<td><button id="order" class="call_to" onclick="location.href='order.html';">Order</button></td>
</tr>
`;
}
});
document.getElementById('main-dish').innerHTML = mainOutput;
document.getElementById('snacks').innerHTML = snacksOutput;
document.getElementById('drinks').innerHTML = drinksOutput;
}
else{
document.getElementById('title').innerHTML = res.Message;
}
})
.catch((err)=>console.log(err))
}
64 changes: 64 additions & 0 deletions UI/js/fetchMenu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
const baseURL = 'https://fastfoodfast-api.herokuapp.com/api/v2/menu'
window.onload = function getMenu(){
fetch(baseURL, {
method: 'GET',
headers: {
'Accept': 'application/json, text/plain, */*',
'Content-type': 'application/json'
}

})
.then(res => {
statusCode = res.status
return res.json()
})
.then((data) => {
if (statusCode == 200){
let snacksOutput = '';
let mainOutput = '';
let drinksOutput = '';
data['Full Menu'].forEach((menu) => {
if (menu.category == 'main'){
mainOutput +=`
<div class="item">
<a href="#content"><img src="./images/beefsteak.jpeg"></a>
<h3>${menu.name}</h3>
<p> ${menu.name} for that heavy meal </p>
<b>KES. ${menu.price}</b><br><br>
<button class="call_to" onclick="location.href='order.html';">Order Now</button>
</div>
`;
}
if (menu.category == 'snacks'){
snacksOutput +=`
<div class="item">
<a href="#content"><img src="./images/hamburger.jpeg"></a>
<h3>${menu.name}</h3>
<p> ${menu.name} for your grab and go meal </p>
<b>KES. ${menu.price}</b><br><br>
<button class="call_to" onclick="location.href='order.html';">Order Now</button>
</div>
`;
}
if (menu.category == 'drinks'){
drinksOutput +=`
<div class="item">
<a href="#content"><img src="./images/coffee..jpeg"></a>
<h3>${menu.name}</h3>
<p> ${menu.name} for your thirst </p>
<b>KES. ${menu.price}</b><br><br>
<button class="call_to" onclick="location.href='order.html';">Order Now</button>
</div>
`;
}
});
document.getElementById('main-dish').innerHTML = mainOutput;
document.getElementById('snacks').innerHTML = snacksOutput;
document.getElementById('drinks').innerHTML = drinksOutput;
}
else {
document.getElementById('content').innerHTML = res.Message;
}
})
.catch((err)=>console.log(err))
}
2 changes: 1 addition & 1 deletion UI/js/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function($) { // Begin jQuery
$(function() { // DOM ready
// If a link has a dropdown, add sub menu toggle.
$('nav ul li a:not(:only-child)').click(function(e) {
$('nav ul li a:not(:only-child)').mouseover(function(e) {
$(this).siblings('.nav-dropdown').toggle();
// Close one dropdown when selecting another
$('.nav-dropdown').not($(this).siblings()).hide();
Expand Down
59 changes: 59 additions & 0 deletions UI/js/signUp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
const baseURL = 'https://fastfoodfast-api.herokuapp.com/api/v2/auth/register'
document.getElementById('signUp').addEventListener('submit', signUp)

function signUp(e){
e.preventDefault();
let first_name = document.getElementById('full_name').value.split(" ")[0];
let last_name = document.getElementById('full_name').value.split(" ")[1];
let username = document.getElementById('username').value;
let email = document.getElementById('email').value;
let password = document.getElementById('password').value;
let password_confirm = document.getElementById('pass_confirm').value;

if (password != password_confirm){
document.getElementById('errors').innerHTML = "Passwords don't match";
return
}
if (last_name == undefined){
let element = document.getElementById('errors');
element.style.color = '#CC0000';
element.innerHTML = "First Name and Last Name"
+ " is required in the format 'Firstname Lastname'";
return
}
else{
user = JSON.stringify({
"first_name": first_name,
"last_name": last_name,
"username": username,
"email": email,
"password": password
})
}
fetch(baseURL, {
method: 'POST',
headers: {
'Accept': 'application/json, text/plain, */*',
'Content-type': 'application/json'
},
body: user
})
.then(res => {
statusCode = res.status
return res.json()
})
.then(res => {
if (statusCode == 201 ){
let element = document.getElementById('success');
element.style.color = '#00C851';
element.innerHTML = res.Message;
window.setTimeout(() => window.location = 'login.html', 900);
}
else {
let element = document.getElementById('errors');
element.style.color = '#CC0000';
element.innerHTML = res.Message;
}
})
.catch((err) => console.log(err))
}
Loading