Skip to content

Commit

Permalink
Added cancellation order button (#18)
Browse files Browse the repository at this point in the history
Added cancellation order button
  • Loading branch information
Nancy-Chauhan authored Jan 27, 2020
2 parents 9a8cbd1 + 25aa3f5 commit 19dc860
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Hotel app/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.8.2",
"@material-ui/core": "^4.9.0",
"@material-ui/icons": "^4.5.1",
"material-table": "^1.54.2",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-qr-reader": "^2.2.1",
"react-scripts": "0.9.5",
"semantic-ui-react-form-validator": "^1.0.2"
"react-router-dom": "^5.1.2",
"react-scripts": "0.9.5"
},
"devDependencies": {},
"scripts": {
Expand Down
7 changes: 7 additions & 0 deletions Hotel app/frontend/src/components/Customermenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ export default class Customermenu extends React.Component {
const item = this.state.food[i].price;
this.setState(prevState => {
let fooditem = {...prevState.food}
console.log(fooditem);
fooditem[i].quantity = fooditem[i].quantity - 1;
/*if(fooditem[i].quantity === 0){
return {food: this.state.food.filter((row,j) => j!==i)}
}
else{
return { fooditem }
}*/
return { fooditem }
})
this.setState(prevState => {
Expand Down
2 changes: 1 addition & 1 deletion Hotel app/frontend/src/components/Food.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from "react";
import MuiThemeProvider from "material-ui/styles/MuiThemeProvider";
import { ThemeProvider as MuiThemeProvider } from '@material-ui/core/styles';
import Table from "./Table";


Expand Down
2 changes: 1 addition & 1 deletion Hotel app/frontend/src/components/Order.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState,useEffect } from "react";
import MuiThemeProvider from "material-ui/styles/MuiThemeProvider";
import { ThemeProvider as MuiThemeProvider } from '@material-ui/core/styles';
import Ordertable from "./Ordertable";


Expand Down
20 changes: 18 additions & 2 deletions Hotel app/frontend/src/components/Pay.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,27 @@ const handleClick = () => {
}
}

const handleCancel = () => {
const sessid = sessionStorage.getItem("customer_access_token");
fetch("/order_cancel",{
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({'sessionid':sessid})
}).then(res => {
if(res.ok){
alert("Order cancelled");
window.location.replace("/place_order")
}
})
}

return (
<div className="bg3">
<Card className={classes.card}>
<CardContent>
<Button variant="outlined" color="primary" onClick={() => {window.location.replace("/place_order")}}>Go back to Menu</Button>
<button style={{display:"block", margin: "auto" ,backgroundColor:'red',color:"white",fontSize:"16px",marginBottom: "20px", height: "40px",width: 200}} onClick={() => handleCancel()}>Cancel Order</button>
<Typography variant="h5" component="h2">
{data1.name}
</Typography>
Expand Down Expand Up @@ -131,7 +147,7 @@ const handleClick = () => {
</div>
</CardContent>
<CardActions>
<button style={{display:"block", width: "100%", backgroundColor:'green',color:"white", padding:" 15px 32px",fontSize:"16px", pointerEvents: "cursor",marginBottom: "20px"}} onClick={() => handleClick()}>Pay</button>
<button pointer="cursor" style={{display:"block", width: "100%", backgroundColor:'green',color:"white", padding:" 15px 32px",fontSize:"16px", pointer:"cursor", marginBottom: "20px"}} onClick={() => handleClick()}>Pay</button>
</CardActions>
</Card>
</div>
Expand Down
Binary file added Hotel app/screenshots/Logo-PixTeller.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Hotel app/screenshots/logo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion Hotel app/server/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.db
static/
templates/
__pycache__
__pycache__
venv/
19 changes: 19 additions & 0 deletions Hotel app/server/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
certifi==2019.11.28
chardet==3.0.4
Click==7.0
docopt==0.6.2
Flask==1.1.1
Flask-JWT-Extended==3.24.1
Flask-SQLAlchemy==2.4.1
idna==2.8
itsdangerous==1.1.0
Jinja2==2.10.3
MarkupSafe==1.1.1
pipreqs==0.4.10
PyJWT==1.7.1
requests==2.22.0
six==1.14.0
SQLAlchemy==1.3.13
urllib3==1.25.8
Werkzeug==0.16.0
yarg==0.1.9
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,42 @@
# DINE-IN
<p>
<h1 align="center">DINE-IN</h1>
</p>
<p align="center"><img width="500px" height="300px" src="https://github.com/kbindra/DINE-IN/blob/K-xoxo-commits/Hotel%20app/screenshots/logo.gif" />
</p>
Customers Place order while scanning QR code on tables , Check menu and place orders. Hotel Manager / staff checks the orders and serve it to customers . Customers check out with payment.

## Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

### Prerequisites
Requires Nodejs and Python3 to run locally. See instructions to setup [Python3](https://www.python.org/downloads/) and [Nodejs](https://nodejs.org/en/download/) .

### Installation
#### Frontend(React)
* Clone the repository in a folder and write the following commands
```
1.git clone https://github.com/WooTechnology/DINE-IN.git
2.cd DINE-IN/Hotel App/frontend/
3.npm install
```
* Start Development Server
```
4.npm start
```
Open [localhost:3000](https://localhost:3000)
#### Backend(Flask)
* Setup virtual environment
```
1.pip install virtualenv
2.virtualenv venv --python=python3.6
3.source venv/bin/activate
```
* Install all dependencies
```
pip install -r requirements.txt
```
* Run Server
```
python3 app.py
```

0 comments on commit 19dc860

Please sign in to comment.