Skip to content

Molly #68

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

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
c6a5ee8
Flask setup
SGathuku Jul 10, 2024
0b680df
Flask initiation
SGathuku Jul 10, 2024
4de8e6c
Flask Setup
SGathuku Jul 10, 2024
adb6ad8
Flask Setup
SGathuku Jul 10, 2024
bb56b95
Flask Setup
SGathuku Jul 10, 2024
f7c05ea
Route setup
SGathuku Jul 10, 2024
9a8d2df
Testing backend functionality
SGathuku Jul 10, 2024
5586ef3
Testing backend functionality
SGathuku Jul 10, 2024
ab7e87f
Testing backend functionality
SGathuku Jul 10, 2024
47b400c
Testing backend functionality
SGathuku Jul 10, 2024
60c744a
Adding Classes to models.py file
SGathuku Jul 10, 2024
5ed4da7
Flask re-initialization
SGathuku Jul 10, 2024
f5861fc
Flask re-initialization
SGathuku Jul 10, 2024
f3d8a82
Merge pull request #1 from SGathuku/main
SGathuku Jul 10, 2024
8d3b2e2
firstfront end commit
Mosh9098 Jul 10, 2024
76e7599
created homepage and order list
Molly-Mbugi Jul 10, 2024
bc1eef9
created menu table
Molly-Mbugi Jul 10, 2024
cc8c10d
created the two pages and routes
Molly-Mbugi Jul 10, 2024
fe5c9ab
styling menu table
Molly-Mbugi Jul 10, 2024
f4c2a38
created buttons
Molly-Mbugi Jul 10, 2024
2e2d987
validated using formik
Molly-Mbugi Jul 10, 2024
02ea21e
updated
Mosh9098 Jul 11, 2024
46c993b
edited menu
Molly-Mbugi Jul 11, 2024
cc19cae
server backend
tubisaffo Jul 11, 2024
640dd0b
app.js
Molly-Mbugi Jul 11, 2024
baf344a
Merge branch 'main' of github.com:tubisaffo/python-p4-Hotel-Menu-project
Molly-Mbugi Jul 11, 2024
e77c201
Merge branch 'main' into Molly
Molly-Mbugi Jul 12, 2024
97c73c2
server backend
tubisaffo Jul 12, 2024
3451058
Merge pull request #2 from tubisaffo/Molly
Molly-Mbugi Jul 12, 2024
c231f4d
server backend
tubisaffo Jul 12, 2024
383ef07
Merge remote-tracking branch 'origin/main'
tubisaffo Jul 12, 2024
7ad137e
resolved conflicts
Molly-Mbugi Jul 12, 2024
c285bd6
conflicts
Molly-Mbugi Jul 12, 2024
a51d692
solved respective links conflicts
Molly-Mbugi Jul 12, 2024
ecc2ee0
styling navbar
Molly-Mbugi Jul 12, 2024
2d27f47
adding log out button
Molly-Mbugi Jul 12, 2024
765982e
resizing form
Molly-Mbugi Jul 12, 2024
d790d69
created menu list un alterd
Molly-Mbugi Jul 12, 2024
c18247f
ctreated order list table
Molly-Mbugi Jul 12, 2024
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.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name = "pypi"
[packages]
ipdb = "0.13.9"
flask = "*"
flask-sqlalchemy = "3.0.3"
flask-sqlalchemy = "*"
Werkzeug = "2.2.2"
flask-migrate = "*"
sqlalchemy-serializer = "*"
Expand Down
529 changes: 529 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"formik": "^2.4.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
"web-vitals": "^2.1.4",
"yup": "^1.4.0"
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11"
},
"devDependencies": {"@babel/plugin-proposal-private-property-in-object":"^7.21.11"},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
Expand Down
65 changes: 60 additions & 5 deletions client/src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,63 @@
import React, { useEffect, useState } from "react";
import { Switch, Route } from "react-router-dom";
// src/components/App.js
import React from 'react';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import Navbar from './NavBar'; // Ensure the correct import path

function App() {
return <h1>Project Client</h1>;
}
import MenuTable from '../pages/MenuTable';
import OrderList from '../pages/OrderList';
import LoginPage from '../pages/LoginPage';
import MainPage from '../pages/MainPage';
import OrdersPage from '../pages/OrdersPage';
import MenuList from '../pages/MenuList'; // Import the MenuList component

const App = () => {
return (
<Router>
<div>
<Switch>
<Route exact path="/" component={LoginPage} />
<Route path="/main">
<MainPageWithNavbar />
</Route>
<Route path="/orders">
<OrdersPageWithoutNavbar />
</Route>
<Route path="/menu">
<div>
<Navbar />
<MenuTable />
</div>
</Route>
<Route path="/order-list">
<div>
<Navbar />
<OrderList />
</div>
</Route>
<Route path="/menu-list">
<div>
<Navbar />
<MenuList />
</div>
</Route>
</Switch>
</div>
</Router>
);
};

// Define MainPageWithNavbar component with Navbar
const MainPageWithNavbar = () => (
<div>
<MainPage />
</div>
);

// Define OrdersPageWithoutNavbar component without Navbar
const OrdersPageWithoutNavbar = () => (
<OrdersPage />
);

export default App;


49 changes: 49 additions & 0 deletions client/src/components/NavBar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React from 'react';
import { Link, useHistory } from 'react-router-dom'; // Import useHistory to navigate programmatically

const Navbar = () => {
const history = useHistory(); // Get history object for programmatic navigation

const handleLogout = () => {
// Perform logout actions if needed (e.g., clear session, tokens, etc.)
// Then navigate to the login page
history.push('/'); // Redirect to login page
};

return (
<nav>
<ul>
<li>
<Link to="/menu" className={window.location.pathname === '/menu' ? 'active' : ''}>
Menu
</Link>
</li>
<li>
<Link to="/menu-list" className={window.location.pathname === '/menu-list' ? 'active' : ''}>
Menu List
</Link>
</li>
<li>
<Link to="/order-list" className={window.location.pathname === '/order-list' ? 'active' : ''}>
Order List
</Link>
</li>
<li>
<button onClick={handleLogout} className="logout-button">
Logout
</button>
</li>
</ul>
</nav>
);
};

export default Navbar;








19 changes: 19 additions & 0 deletions client/src/components/Navbar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import { Link } from 'react-router-dom';

const Navbar = () => {
return (
<nav>
<ul>
<li>
<Link to="/main">Home</Link>
</li>
<li>
<Link to="/orders">Orders</Link>
</li>
</ul>
</nav>
);
};

export default Navbar;
217 changes: 217 additions & 0 deletions client/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,221 @@
--link: #61dafb;
--text: hsla(0, 0%, 100%, 0.88);
}
:root {
--bg: #282c34;
--header: #fff;
--link: #61dafb;
--text: hsla(0, 0%, 100%, 0.88);
}

/* MenuTable.css */

.menu-table {
margin: 20px;
padding: 20px;
border: 1px solid #ccc;
border-radius: 8px;
background-color: #f9f9f9;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.menu-header {
font-size: 24px;
text-align: center;
margin-bottom: 20px;
color: black;
}

form {
margin-bottom: 20px;
display: grid; /* Use grid layout for more control */
gap: 10px;
}

form label {
/* Grid settings for labels */
grid-column: 1 / 2;
grid-row: auto; /* Auto place */
margin-bottom: 10px;
}

form input,
form button {
/* Grid settings for inputs and buttons */
grid-column: 2 / 3;
grid-row: auto; /* Auto place */
width: 100%; /* Full width input fields */
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
}

.add-button {
background-color: blue;
color: white;
border: none;
padding: 10px 20px;
cursor: pointer;
border-radius: 4px;
}

.table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}

.table th,
.table td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}

.table th {
background-color: lightskyblue;
}

.table td {
vertical-align: top;
}

.table td:last-child {
text-align: center;
}

.delete-button {
background-color: #f30d0d;
color: white;
border: none;
padding: 8px 16px;
cursor: pointer;
border-radius: 4px;
}

/* Navbar.css */

nav {
background-color: #0dbbbb;
color: #fff;
padding: 10px 20px;
}

ul {
list-style-type: none;
padding: 0;
margin: 0;
display: flex;
}

li {
margin-right: 20px;
}

a {
text-decoration: none;
color: #fff;
font-weight: bold;
padding: 8px 12px;
border-radius: 4px;
}

a.active {
background-color: #000000;
}

.logout-button {
background-color: #dc3545;
color: #fff;
border: none;
padding: 8px 12px;
cursor: pointer;
border-radius: 4px;
}

/* Responsive Design */

@media (max-width: 768px) {
/* Adjust form layout for smaller screens */
form {
display: flex;
flex-wrap: wrap;
}

form label,
form input,
form button {
width: calc(50% - 5px); /* Two columns with gap */
}

form label {
margin-bottom: 5px;
}
}


/* Navbar.css */

nav {
background-color: #0dbbbb;
color: #fff;
padding: 10px 20px;
}

ul {
list-style-type: none;
padding: 0;
margin: 0;
display: flex;
}

li {
margin-right: 20px;
}

a {
text-decoration: none;
color: #fff;
font-weight: bold;
padding: 8px 12px;
border-radius: 4px;
}

a.active {
background-color: #000000;
}

.logout-button {
background-color: #dc3545;
color: #fff;
border: none;
padding: 8px 12px;
cursor: pointer;
border-radius: 4px;
}
.order-table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}

.order-table th, .order-table td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}

.order-table th {
background-color: lightskyblue;
}

.order-table tbody tr:nth-child(even) {
background-color: #f9f9f9;
}

.order-table tbody tr:hover {
background-color: #f2f2f2;
}



Loading