Skip to content

Commit

Permalink
Merge pull request #127 from Vincent440/development-testing
Browse files Browse the repository at this point in the history
Development testing
  • Loading branch information
Vincent440 committed Jul 28, 2020
2 parents c0b87f8 + abfe057 commit d28bc73
Show file tree
Hide file tree
Showing 65 changed files with 16,676 additions and 2,430 deletions.
29 changes: 8 additions & 21 deletions client/package.json
Expand Up @@ -5,35 +5,22 @@
"private": true,
"proxy": "http://localhost:3001/",
"dependencies": {
"axios": "^0.19.0",
"browserslist": "^4.6.3",
"core-js": "^3.1.4",
"dependency": "0.0.1",
"file-saver": "^2.0.2",
"final-form": "^4.18.2",
"axios": "^0.19.2",
"greensock": "^1.20.2",
"gsap": "^2.1.3",
"moment": "^2.24.0",
"react": "^16.8.6",
"react-background-slider": "^1.2.0",
"react-bootstrap": "^1.0.0-beta.9",
"react": "^16.13.1",
"react-background-slider": "^2.0.0",
"react-bootstrap": "^1.3.0",
"react-credit-card-input": "^1.1.5",
"react-dates": "^20.2.5",
"react-day-picker": "^7.3.0",
"react-dom": "^16.8.6",
"react-final-form": "^6.3.0",
"react-fontawesome": "^1.6.1",
"react-dom": "^16.13.1",
"react-grid-system": "^4.4.10",
"react-helmet": "^5.2.1",
"react-image": "^2.1.3",
"react-moment": "^0.9.2",
"react-number-format": "^4.0.8",
"react-open-weather": "^0.4.0",
"react-particles-js": "^2.6.0",
"react-router-dom": "^5.0.1",
"react-scripts": "^3.0.1",
"react-select": "^3.0.4",
"styled-components": "^4.3.2"
"react-router-dom": "^5.2.0",
"react-scripts": "^3.4.1",
"styled-components": "^5.1.1"
},
"scripts": {
"start": "react-scripts start",
Expand Down
73 changes: 23 additions & 50 deletions client/public/index.html
@@ -1,52 +1,25 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<!-- CDNs for jQuery, Popper.js and Bootstrap JS -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.0.2/TweenMax.min.js"></script>
<script src="https://cdn.rawgit.com/progers/pathseg/master/pathseg.js"></script>
<script src="https://cdn.jsdelivr.net/momentjs/2.12.0/moment.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons.min.css"
type="text/css" />
<link href="https://fonts.googleapis.com/css?family=Barlow&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Nanum+Myeongjo:700&display=swap" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!-- CDNs for fontawesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"
integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<title>Hotel Worx</title>
</head>

<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"></script>
</body>

</html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<!-- Bootstrap 4.3.1 CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<!-- Google Fonts CDNS -->
<link href="https://fonts.googleapis.com/css?family=Nanum+Myeongjo:700&display=swap" rel="stylesheet">
<!-- CDNs for Font Awesome 5.8.2 -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<title>Hotel Worx</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<!-- Bootstrap 4.3.1 CDNs for jQuery, Popper.js and Bootstrap JS -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>
165 changes: 82 additions & 83 deletions client/src/App.js
@@ -1,27 +1,27 @@
import React, { Component } from "react";
import { BrowserRouter as Router, Route, Switch, Redirect } from "react-router-dom";
import { Row, Col } from 'react-grid-system';
import Container from "react-bootstrap/Container";
import Particles from "react-particles-js";
import UserContext from "./UserContext";
import InfoPart from "./components/infoPart";
import authapi from "./utils/authapi";
import ReserveNew from "./pages/newreservation/newreservation";
import ReserveUpdate from "./pages/updatereservation/updatereservation";
import Dashboard from "./pages/dashboard/dashboard";
import UpdateReservation from "./pages/allreservations/allreservations";
import Arrivals from "./pages/arrivals/arrivals";
import Billing from "./pages/billing/billing";
import Payment from "./pages/payment/payment";
import Inhouse from "./pages/inhouse/inhouse";
import Login from "./pages/login/login";
import ReservationTest from "./pages/newreservation/reservationTest";
import Housekeeping from "./pages/housekeeping/housekeeping";
import DetailedAvailability from "./pages/detailedAvailability/detailedAvailability";
import HouseStatus from "./pages/houseStatus/houseStatus";
import Maintenance from "./pages/maintenance/maintenance";
import React, { Component } from 'react'
import { BrowserRouter as Router, Route, Switch, Redirect } from 'react-router-dom'
import { Row, Col } from 'react-grid-system'
import Container from 'react-bootstrap/Container'
import Particles from 'react-particles-js'
import UserContext from './UserContext'
import InfoPart from './components/infoPart'
import authapi from './utils/authapi'
import ReserveNew from './pages/newreservation/newreservation'
import ReserveUpdate from './pages/updatereservation/updatereservation'
import Dashboard from './pages/dashboard/dashboard'
import UpdateReservation from './pages/allreservations/allreservations'
import Arrivals from './pages/arrivals/arrivals'
import Billing from './pages/billing/billing'
import Payment from './pages/payment/payment'
import Inhouse from './pages/inhouse/inhouse'
import Login from './pages/login/login'
import ReservationTest from './pages/newreservation/reservationTest'
import Housekeeping from './pages/housekeeping/housekeeping'
import DetailedAvailability from './pages/detailedAvailability/detailedAvailability'
import HouseStatus from './pages/houseStatus/houseStatus'
import Maintenance from './pages/maintenance/maintenance'

const particleOptions = { particles: { number: { value: 120, density: { enable: true, value_area: 1000 } } } };
const particleOptions = { particles: { number: { value: 120, density: { enable: true, value_area: 1000 } } } }

const PrivateAccessRoute = ({ component: Component, aId, ...rest }) => (
<UserContext.Consumer>
Expand All @@ -34,102 +34,101 @@ const PrivateAccessRoute = ({ component: Component, aId, ...rest }) => (
) : (
<Redirect
to={{
pathname: "/",
pathname: '/',
state: { from: props.location }
}}
/>
)
}
)}
/>
)}
</UserContext.Consumer>
);
)

class App extends Component {
constructor(props) {
super(props);
constructor (props) {
super(props)
this.postUserLogin = userData => {
if (userData) {
authapi.postUserLogin(userData, (err, res) => {
if (err === true) {
return console.log("Failed to log in");
return console.log('Failed to log in')
}
this.setState({ user: res.user });
});
this.setState({ user: res.user })
})
}
};
}
this.getUserLogout = event => {
event.preventDefault();
authapi.getLoggedOut().then(this.getUserStatus);
};
event.preventDefault()
authapi.getLoggedOut().then(this.getUserStatus)
}
this.getUserStatus = () => {
authapi.getLoginStatus().then(res => {
if (res) {
this.setState(()=>(
this.setState(() => (
{ user: res.user }
)
);
)
)
}
});
};
})
}
this.state = {
user: {
access_id: 0,
type: "Guest",
type: 'Guest',
user_id: 0,
username: "guest"
username: 'guest'
},
getUserStatus: this.getUserStatus,
getUserLogout: this.getUserLogout,
postUserLogin: this.postUserLogin
};
}
}
render() {
let { user } = this.state;

render () {
const { user } = this.state
return (
<UserContext.Provider value={this.state}>
<Router>
{ user.access_id === 0 ? (
<Router>
{user.access_id === 0 ? (
<div>
<Redirect to="/" />
<Redirect to='/' />
<Login />
</div> ) :
(
<Container className="m-0 p-0">
<Particles params={particleOptions} />
<Row className="m-0 py-2">
<Col xs={6} sm={4} md={3} lg={3} xl={2} >
<Row className="pt-3"><span></span></Row>
</div>)
: (
<Container className='m-0 p-0'>
<Particles params={particleOptions} />
<Row className='m-0 py-2'>
<Col xs={6} sm={4} md={3} lg={3} xl={2}>
<Row className='pt-3'><span /></Row>
<InfoPart />
</Col>
<Col xs={6} sm={8} md={9} lg={9} xl={10}>
<Row className="pt-3"><span></span></Row>
<div className="pl-2 m-0 py-0">
<Switch>
<PrivateAccessRoute exact strict path="/" component={Dashboard} aId="1" />
<PrivateAccessRoute exact path="/reserve/new" component={ReserveNew} aId="1" />
<PrivateAccessRoute exact path="/reserve/allreservations" component={UpdateReservation} aId="1" />
<PrivateAccessRoute exact path="/reserve/testUpdatereservation" component={ReserveUpdate} aId="1" />
<PrivateAccessRoute exact path="/reserve/testreservation" component={ReservationTest} aId="1" />
<PrivateAccessRoute exact path="/frontdesk/arrivals" component={Arrivals} aId="1" />
<PrivateAccessRoute exact path="/frontdesk/inhouse" component={Inhouse} aId="1" />
<PrivateAccessRoute exact path="/frontdesk/maintenance" component={Maintenance} aId="1" />
<PrivateAccessRoute exact path="/cashiering/billing" component={Billing} aId="1" />
<PrivateAccessRoute exact path="/cashiering/payment" component={Payment} aId="1" />
<PrivateAccessRoute exact path="/reports/housekeeping" component={Housekeeping} aId="1" />
<PrivateAccessRoute exact path="/reports/detailedAvailability" component={DetailedAvailability} aId="1" />
<PrivateAccessRoute exact path="/reports/houseStatus" component={HouseStatus} aId="1" />
</Switch>
</div>
</Col>
</Row>
</Container>
)
}
</Col>
<Col xs={6} sm={8} md={9} lg={9} xl={10}>
<Row className='pt-3'><span /></Row>
<div className='pl-2 m-0 py-0'>
<Switch>
<PrivateAccessRoute exact strict path='/' component={Dashboard} aId='1' />
<PrivateAccessRoute exact path='/reserve/new' component={ReserveNew} aId='1' />
<PrivateAccessRoute exact path='/reserve/allreservations' component={UpdateReservation} aId='1' />
<PrivateAccessRoute exact path='/reserve/testUpdatereservation' component={ReserveUpdate} aId='1' />
<PrivateAccessRoute exact path='/reserve/testreservation' component={ReservationTest} aId='1' />
<PrivateAccessRoute exact path='/frontdesk/arrivals' component={Arrivals} aId='1' />
<PrivateAccessRoute exact path='/frontdesk/inhouse' component={Inhouse} aId='1' />
<PrivateAccessRoute exact path='/frontdesk/maintenance' component={Maintenance} aId='1' />
<PrivateAccessRoute exact path='/cashiering/billing' component={Billing} aId='1' />
<PrivateAccessRoute exact path='/cashiering/payment' component={Payment} aId='1' />
<PrivateAccessRoute exact path='/reports/housekeeping' component={Housekeeping} aId='1' />
<PrivateAccessRoute exact path='/reports/detailedAvailability' component={DetailedAvailability} aId='1' />
<PrivateAccessRoute exact path='/reports/houseStatus' component={HouseStatus} aId='1' />
</Switch>
</div>
</Col>
</Row>
</Container>
)}
</Router>
</UserContext.Provider>
);
)
}
}

export default App;
export default App
14 changes: 7 additions & 7 deletions client/src/App.test.js
@@ -1,8 +1,8 @@
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'

it("renders without crashing", () => {
const div = document.createElement("div");
ReactDOM.render(<App />, div);
});
it('renders without crashing', () => {
const div = document.createElement('div')
ReactDOM.render(<App />, div)
})
12 changes: 6 additions & 6 deletions client/src/UserContext.js
@@ -1,16 +1,16 @@
import React from "react";
import React from 'react'

// Make sure the shape of the default value passed to
// createContext matches the shape that the consumers expect!
const UserContext = React.createContext({
user: {
access_id: 0,
type: "Guest",
type: 'Guest',
user_id: 0,
username: "guest"
username: 'guest'
},
getUserStatus: () => {},
postUserLogin: () => {},
getUserLogout: () => {},
});
export default UserContext;
getUserLogout: () => {}
})
export default UserContext

0 comments on commit d28bc73

Please sign in to comment.