-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started work for chef order management
- Loading branch information
Showing
11 changed files
with
139 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{% extends 'dashboard-layout.html' %} | ||
{% block head %} | ||
<title>Dashboard: Home</title> | ||
<link href="/styles/chefprogress.css" rel="stylesheet" type="text/css"> | ||
{% endblock %} | ||
|
||
{% block body %} | ||
<div class="title"> | ||
<h2>Welcome to Dashboard</h2> | ||
<!-- will prob display different stuff here based on employee --> | ||
</div> | ||
|
||
{% if session.get('employeeType') == 'chef' %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
async function getCurrentOrders() { | ||
const response = await fetch('/api/order/inprogress'); | ||
const data = await response.json(); | ||
console.log(data['response']); | ||
|
||
return data['response']; | ||
} | ||
|
||
async function showOrders() { | ||
let container = document.getElementById('orderlist'); | ||
|
||
let orders = await getCurrentOrders(); | ||
|
||
if (orders.length > 0) { | ||
orders.forEach(order => { | ||
if ((order.status != "cancelled" && order.status != "completed") && ((order.deliveryMethod == "delivery" && order.employeeID != null) || (order.deliveryMethod == "pickup"))) { | ||
let orderdiv = createElement("a", {class: "orderdiv", href: `/dashboard/chefprogress/${order.orderID}`}); | ||
Array.from(["orderID", "datetime", "deliveryMethod", "status", "cost"]).forEach(attrib => { | ||
let element = createElement("p", {text: `${attrib.charAt(0).toUpperCase() + attrib.slice(1)} : ${order[attrib]}`, class: attrib}); | ||
orderdiv.appendChild(element); | ||
}); | ||
container.appendChild(orderdiv); | ||
} | ||
}); | ||
} | ||
else { | ||
let textdiv = createElement("div", {class : "noOrders"}); | ||
let text = createElement("p", {text: "There are no active orders available. Please check back in a minute.", class: "noOrdersText"}); | ||
textdiv.appendChild(text); | ||
container.appendChild(textdiv); | ||
} | ||
} | ||
|
||
function eraseOrders() { | ||
let orders = document.getElementsByClassName('orderdiv'); | ||
if (orders.length > 0){ | ||
Array.from(orders).forEach(element => { | ||
element.remove(); | ||
}); | ||
} | ||
} | ||
|
||
function reload() { | ||
eraseOrders(); | ||
showOrders(); | ||
} | ||
|
||
reload(); | ||
|
||
setInterval(() => { | ||
reload(); | ||
}, 10000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
function displaySidebar() { | ||
document.getElementsByClassName('sidebar')[0].classList.remove('sidebarHide'); | ||
document.getElementById('sidebar').style.width = "300px"; | ||
} | ||
|
||
function hideSidebar() { | ||
document.getElementsByClassName('sidebar')[0].classList.add('sidebarHide'); | ||
document.getElementById('sidebar').style.width = "0"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters