-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Staff router #33
base: staff
Are you sure you want to change the base?
Staff router #33
Changes from all commits
db8fafc
0d0140e
5522431
513b23d
ecac445
b1c4e70
fd4e748
687062b
cc5955e
0533afd
a8fdfcc
a95de0e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,4 +34,7 @@ built | |
package-lock.json | ||
|
||
### MAC ## | ||
.DS_Store | ||
.DS_Store | ||
|
||
### VSCODE ### | ||
.vscode |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ import React from "react"; | |
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"; | ||
|
||
/** ----- COMPONENT IMPORTS -----**/ | ||
import {CustomerDiningSessionSelect, StaffDiningSessionPage, StaffDiningSession} from "./subcomponents/DiningSession"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the purpose of importing |
||
|
||
/** ----- CSS/STYLING IMPORTS -----**/ | ||
import "../../resources/static/css/staff.css"; | ||
|
@@ -15,17 +16,33 @@ import "../../resources/static/css/staff.css"; | |
*/ | ||
|
||
export class Staff extends React.Component { | ||
|
||
constructor(props){ | ||
super(props); | ||
this.state = {pageSize: 30, selectedView: 'Staff'}; | ||
} | ||
render() { | ||
return ( | ||
<div className={"page staff-page"}> | ||
<StaffLanding orders={this.props.orders} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should not have been deleted. |
||
orderAttributes={this.props.orderAttributes} | ||
diningSessions={this.props.diningSessions} | ||
diningSessionsAttributes={this.props.diningSessionAttributes} | ||
selectedView={this.props.selectedView}/> | ||
<StaffDiningSessionPage | ||
selectedView={this.props.selectedView} | ||
diningSessions={this.props.diningSessions} | ||
// pageSize={this.state.pageSize} | ||
diningSessionAttributes={this.props. diningSessionAttributes} | ||
diningSessionLinks={this.props.diningSessionLinks} | ||
// onNavigate={this.props.onNavigate} | ||
// updatePageSize={this.props.updatePageSize} | ||
onUpdate={this.props.onUpdate} | ||
onDelete={this.props.onDelete} | ||
history={this.props.history}/> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
componentDidMount() { | ||
this.props.loadResourceFromServer('diningSessions', this.state.pageSize); | ||
} | ||
} | ||
|
||
class StaffLanding extends React.Component { | ||
|
@@ -66,22 +83,26 @@ class StaffLanding extends React.Component { | |
</header> | ||
<div className="content-wrap full-width"> | ||
/* Deleted the sample list of menu items as we do not need to see the menu items from staff*/ | ||
|
||
<footer> | ||
<div className="signature"> | ||
<h6>Sushi</h6> | ||
<h5>PotatoPeeps</h5> | ||
</div> | ||
</footer> | ||
</div> | ||
|
||
</main> | ||
</div> | ||
|
||
<ul id="slideshow"> | ||
<li id="staff-slideshow-element-first" className="staff-slideshow-elements"/> | ||
<li id="staff-slideshow-element-second" className="staff-slideshow-elements"/> | ||
<li id="staff-slideshow-element-third" className="staff-slideshow-elements"/> | ||
<li id="staff-slideshow-element-fourth" className="staff-slideshow-elements"/> | ||
<li id="staff-slideshow-element-fifth" className="staff-slideshow-elements"/> | ||
</ul> | ||
|
||
</div> | ||
) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,20 @@ | |
|
||
/** ----- NPM PACKAGE IMPORTS -----**/ | ||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
import Select from "react-select"; | ||
import Modal from "react-bootstrap/Modal"; | ||
import Button from "react-bootstrap/Button"; | ||
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"; | ||
import { | ||
faTrash, faEdit, faAngleDoubleLeft, | ||
faAngleDoubleRight, faAngleLeft, faAngleRight, | ||
faPlus | ||
} from "@fortawesome/free-solid-svg-icons"; | ||
|
||
|
||
/** ----- CSS/STYLING IMPORTS -----**/ | ||
import "../../../resources/static/css/staff.css" | ||
//TODO filter for active | ||
export class CustomerDiningSessionSelect extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
|
@@ -23,4 +35,109 @@ export class CustomerDiningSessionSelect extends React.Component { | |
</select> | ||
); | ||
} | ||
} | ||
|
||
export class StaffDiningSessionPage extends React.Component{ | ||
|
||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
show : false, | ||
orders : [] | ||
} | ||
} | ||
|
||
render(){ | ||
const sessions = this.props.diningSessions.map(session => | ||
<StaffDiningSession | ||
key={session.entity._links.self.href} | ||
diningSession={session} | ||
diningSessionAttributes={this.props.diningSessionAttributes} | ||
history = {this.props.history} | ||
onCreate={this.onCreate} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. onCreate does not need to be passed. |
||
onUpdate={this.onUpdate} | ||
onDelete={this.onDelete} | ||
onNavigate={this.onNavigate} | ||
/>) | ||
|
||
//TODO review how to get number of diningSessions. Test whether this.props.diningSessions.size returns a number or undefined | ||
return ( | ||
<div> | ||
<title>All Orders</title> | ||
{sessions} | ||
|
||
</div> | ||
) | ||
} | ||
|
||
handleClose(){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should redirect to the staff landing page |
||
//load orders | ||
// const orders; | ||
} | ||
|
||
} | ||
|
||
export class StaffDiningSession extends React.Component{ | ||
|
||
constructor(props){ | ||
super(props); | ||
this.handleListOrders = this.handleListOrders.bind(this); | ||
} | ||
|
||
requestOrders(){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function seems to be duplicated from |
||
fetch(this.props.diningSession.entity._links.orders.href, {method: 'GET', headers: {'Content-Type': 'application/json'}}) | ||
.then( | ||
response => { | ||
if (!response.ok) { | ||
console.log('Looks like there was a problem. Status Code: ' + | ||
response.status); | ||
return; | ||
} | ||
|
||
// Examine the text in the response | ||
response.json().then((data) => { | ||
console.log(data._embedded.orders); | ||
this.setState( | ||
{ | ||
orders : data._embedded.orders | ||
} | ||
); | ||
}); | ||
} | ||
) | ||
.catch(function(err) { | ||
console.log('Fetch Error :-S', err); | ||
}); | ||
} | ||
render(){ | ||
// console.log("Individual session:"); | ||
// console.log(this.props.diningSession); | ||
return ( | ||
<div className="gridViewItem"> | ||
<img className="itemImage" draggable="false" src="./img/3.jpg" /> | ||
<div className="overlay"> | ||
<div className="text">Table {this.props.diningSession.entity.tableNumber}</div> | ||
<div className="text">{this.props.diningSession.entity.price}</div> | ||
<div style={{display: 'flex', justifyContent: 'center'}}> | ||
<button className="view-detail-button" title="View details"> | ||
<i className="view-order" style={{fontSize: '20px'}} onClick={this.handleListOrders}>View</i> | ||
</button> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
handleListOrders(){ | ||
this.props.history.push | ||
( | ||
{ | ||
pathname: ('/orders/'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be a bit nit-picky but is there a reason/need for the terminal |
||
state: {diningSession : this.props.diningSession}, | ||
diningSession : this.props.diningSession | ||
} | ||
); | ||
|
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removal of testing functionality (order's should not be pre-populated)
marking as a reminder