Commit d5559c02 by Manivasagam S

code changes

parent b0195a1b
...@@ -44,7 +44,7 @@ export const Selectseat = ({ onLogout }) => { ...@@ -44,7 +44,7 @@ export const Selectseat = ({ onLogout }) => {
setAvailableSeats(available); setAvailableSeats(available);
if (currentUser?.name && !hasWelcomed.current) { if (currentUser?.name && !hasWelcomed.current) {
toast.success(`Welcome, ${currentUser.name}`); toast.success(`Welcome😊, ${currentUser.name}`);
hasWelcomed.current = true; hasWelcomed.current = true;
} }
}) })
...@@ -61,11 +61,16 @@ export const Selectseat = ({ onLogout }) => { ...@@ -61,11 +61,16 @@ export const Selectseat = ({ onLogout }) => {
toast.warn("User not logged in"); toast.warn("User not logged in");
return; return;
} }
const unselectedReserved = selectedData.filter(seat => !selectedSeats.includes(seat));
const newlySelected = selectedSeats.filter(s => !selectedData.includes(s)); const newlySelected = selectedSeats.filter(s => !selectedData.includes(s));
if (unselectedReserved.length > 0 && newlySelected.length < unselectedReserved.length) {
toast.error(`You unselected ${unselectedReserved.length} reserved seat(s), so you must select ${unselectedReserved.length} new seat(s).`);
return;
}
if (newlySelected.length < seatCount - selectedData.length) { if (newlySelected.length < seatCount - selectedData.length) {
toast.error(`You must select exactly ${seatCount - selectedData.length} new seats`); toast.error(`You must select exactly ${seatCount - selectedData.length} new seats`);
hasWelcomed.current = true;
return; return;
} }
...@@ -87,6 +92,7 @@ export const Selectseat = ({ onLogout }) => { ...@@ -87,6 +92,7 @@ export const Selectseat = ({ onLogout }) => {
if (conflictSeats.length > 0) { if (conflictSeats.length > 0) {
toast.error(`The following seats were just taken: ${conflictSeats.join(", ")}`); toast.error(`The following seats were just taken: ${conflictSeats.join(", ")}`);
hasWelcomed.current = true;
return; return;
} }
...@@ -153,7 +159,7 @@ export const Selectseat = ({ onLogout }) => { ...@@ -153,7 +159,7 @@ export const Selectseat = ({ onLogout }) => {
<Modal <Modal
title={ title={
selectedData.length > 0 selectedData.length > 0
? `You have already booked ${selectedData.length} seat(s). Add more?` ? `You have already booked ${selectedData.length} seat(s) Add more?`
: "Choose Number of Seats" : "Choose Number of Seats"
} }
availableSeats={availableSeats} availableSeats={availableSeats}
......
...@@ -2,6 +2,7 @@ body { ...@@ -2,6 +2,7 @@ body {
background-color: #303fb6; background-color: #303fb6;
margin: 0; margin: 0;
font-family: 'Segoe UI'; font-family: 'Segoe UI';
overflow-x: hidden;
} }
.header { .header {
......
...@@ -20,15 +20,17 @@ ...@@ -20,15 +20,17 @@
"phoneNumber": "9361775481", "phoneNumber": "9361775481",
"name": "mani", "name": "mani",
"reservedSeats": [ "reservedSeats": [
"F3",
"F2", "F2",
"F1", "F1",
"F8", "F8",
"D8", "D8",
"G6", "G6",
"E7", "E7",
"D5", "G2",
"D6" "B3",
"A3",
"D6",
"A4"
] ]
}, },
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment