Skip to content

Commit e7b5b30

Browse files
finished working site v2
1 parent d676bfc commit e7b5b30

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+5515
-204
lines changed

frontend/src/App.js

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Login from "./components/login";
99
import Signup from "./components/signup";
1010
import Hallselect from "./components/hallselect";
1111
import Seatselect from "./components/seatselection";
12+
import Finalbill from "./components/finalbill";
1213

1314
function PrivateRoute({ children }) {
1415
const isLoggedIn = localStorage.getItem('isLoggedIn') === 'true';
@@ -35,6 +36,7 @@ function App() {
3536
<Route path='/booking' element={<Seatbooking />} />
3637
<Route path='/seat' element={<Hallselect />} />
3738
<Route path='/seatselection' element={<Seatselect />} />
39+
<Route path='/finalbill' element={<Finalbill />} />
3840
</Routes>
3941
</BrowserRouter>
4042
</div>

frontend/src/components/finalbill.jsx

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import React, { useState, useEffect, useRef } from 'react';
2+
import { useParams,useLocation } from 'react-router-dom';
3+
import axios from 'axios';
4+
import toast, { Toaster } from 'react-hot-toast';
5+
import Searchbar from './searchbar';
6+
7+
const Finalbill = () => {
8+
const location = useLocation();
9+
const queryParams = new URLSearchParams(location.search);
10+
const objectId = queryParams.get('objectId');
11+
const [finalBill, setFinalBill] = useState({});
12+
const toastRef = useRef(false);
13+
14+
useEffect(() => {
15+
axios.post(`http://127.0.0.1:5001/get_finalbill`, {
16+
objectId: objectId // Pass the objectId to the request body
17+
})
18+
.then(response => {
19+
if (!toastRef.current) {
20+
toast.success('Tickets confirmed', {
21+
position: "top-center",
22+
style: {
23+
border: '1px solid #713200',
24+
padding: '24px',
25+
color: '#713200',
26+
tabSize:'20rem',
27+
borderRadius:'50px',
28+
},
29+
iconTheme: {
30+
primary: '#713200',
31+
secondary: '#FFFAEE',
32+
},
33+
duration:4000,
34+
});
35+
toastRef.current = true;
36+
}
37+
setFinalBill(response.data);
38+
})
39+
.catch(error => {
40+
console.error(error);
41+
});
42+
43+
}, [objectId]);
44+
45+
46+
return (
47+
<div className='text-white px-24 py-3 h-screen'>
48+
<Searchbar/>
49+
<Toaster/>
50+
<div className='flex justify-start pt-12'>
51+
<p className='inline text-center text-5xl font-semibold font-poppins mb-14'>Final Bill</p>
52+
</div>
53+
<div className='flex justify-between px-4'>
54+
<div className='border w-fit'>
55+
{Object.keys(finalBill).length > 0 && (
56+
<div className='p-12'>
57+
{Object.keys(finalBill).map(key => (
58+
<p key={key} className='w-fit text-4xl font-medium py-3'>
59+
<span className='text-yellow-300'>
60+
{key === 'Bill_id' ? 'Bill ID' : key}
61+
</span> : {finalBill[key]}
62+
</p>
63+
))}
64+
</div>
65+
)}
66+
</div>
67+
<div>
68+
<p className='text-4xl font-poppins font-semibold mb-3'>Thank you for choosing us</p>
69+
<p className='text-xl font-poppins font-medium text-center'>Make a note of your bill id</p>
70+
</div>
71+
</div>
72+
</div>
73+
);
74+
};
75+
76+
export default Finalbill;

0 commit comments

Comments
 (0)