Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
seat-booking
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Syed Abdul Rahman
seat-booking
Commits
f4faf945
Commit
f4faf945
authored
Jun 16, 2025
by
Syed Abdul Rahman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
seat booking functionality completed
parent
479e16af
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
105 deletions
+31
-105
db.json
db.json
+3
-92
Index.jsx
src/components/Layout/BookingWrapper/Index.jsx
+0
-1
Index.jsx
src/pages/BookingPage/Index.jsx
+28
-12
No files found.
db.json
View file @
f4faf945
{
"users"
:
[
{
"id"
:
"
8329
"
,
"id"
:
"
594f
"
,
"email"
:
"syedabdul.rahman@krds.com"
,
"selectionCount"
:
"3"
},
{
"id"
:
"3450"
,
"email"
:
"abdul@gmail.com"
,
"selectionCount"
:
"4"
},
{
"id"
:
"06b5"
,
"email"
:
"lucy@gmail.com"
,
"selectionCount"
:
"3"
},
{
"id"
:
"d17b"
,
"email"
:
"test@gmail.com"
,
"selectionCount"
:
"3"
},
{
"id"
:
"84ca"
,
"email"
:
"anas@krds.fr"
,
"selectionCount"
:
"22"
}
],
"selectedSeats"
:
[
{
"id"
:
"
8329
"
,
"userid"
:
"
8329
"
,
"id"
:
"
594f
"
,
"userid"
:
"
594f
"
,
"selected"
:
[
{
"row"
:
8
,
...
...
@@ -37,81 +17,13 @@
},
{
"row"
:
8
,
"seat"
:
3
},
{
"row"
:
7
,
"seat"
:
1
}
]
},
{
"id"
:
"3450"
,
"userid"
:
"3450"
,
"selected"
:
[
{
"row"
:
7
,
"seat"
:
7
},
{
"row"
:
7
,
"seat"
:
8
},
{
"row"
:
1
,
"seat"
:
6
},
{
"row"
:
1
,
"seat"
:
5
}
]
},
{
"id"
:
"06b5"
,
"userid"
:
"06b5"
,
"selected"
:
[
{
"row"
:
8
,
"seat"
:
5
},
{
"row"
:
8
,
"seat"
:
4
},
{
"row"
:
8
,
"seat"
:
6
}
]
},
{
"id"
:
"d17b"
,
"userid"
:
"d17b"
,
"selected"
:
[
{
"row"
:
1
,
"seat"
:
2
},
{
"row"
:
1
,
"seat"
:
1
},
{
"row"
:
1
,
"seat"
:
3
}
]
},
{
"id"
:
"4d39"
,
"userid"
:
"4d39"
,
"selected"
:
[
{
"row"
:
2
,
"seat"
:
5
}
]
}
]
}
\ No newline at end of file
src/components/Layout/BookingWrapper/Index.jsx
View file @
f4faf945
...
...
@@ -8,7 +8,6 @@ const BookingWrapper = ({
seatData
,
currentSeats
})
=>
{
console
.
log
(
currentSeats
,
'currentSeats in CHILD'
);
const
aisleIndex
=
4
;
let
currentUser
=
getItem
(
'user'
);
const
selectedSeatMap
=
new
Map
();
...
...
src/pages/BookingPage/Index.jsx
View file @
f4faf945
...
...
@@ -29,6 +29,7 @@ const BookingPage = () => {
const
[
showSeatsConfirmationModal
,
setShowSeatsConfirmationModal
]
=
useState
(
false
);
const
[
noOfSeats
,
setNoOfSeats
]
=
useState
();
const
[
buttonState
,
setButtonState
]
=
useState
(
true
);
useEffect
(()
=>
{
const
fetchSelectedSeats
=
async
()
=>
{
...
...
@@ -36,7 +37,6 @@ const BookingPage = () => {
const
currentData
=
data
?.
find
((
e
)
=>
e
.
userid
==
userId
);
setSelectedSeats
(
data
);
setCurrentSeats
(
currentData
?.
selected
);
console
.
log
(
data
,
'currentSeats & selectedSeats'
,
currentSeats
.
length
);
};
const
fetchSeatSelectionCount
=
async
()
=>
{
const
data
=
await
getSeatSelectionCountApi
(
userId
);
...
...
@@ -365,22 +365,37 @@ const BookingPage = () => {
const
onSelectSeats
=
(
rowId
,
columnId
)
=>
{
setCurrentSeats
((
prev
)
=>
{
const
found
=
prev
?.
find
((
e
)
=>
e
.
row
==
rowId
&&
e
.
seat
==
columnId
);
const
found
=
prev
?.
find
((
e
)
=>
e
.
row
===
rowId
&&
e
.
seat
===
columnId
);
let
updatedSeats
;
if
(
found
)
{
return
currentSeats
.
filter
(
(
e
)
=>
!
(
e
.
row
==
rowId
&&
e
.
seat
==
columnId
)
updatedSeats
=
prev
?
.
filter
(
(
e
)
=>
!
(
e
.
row
==
=
rowId
&&
e
.
seat
=
==
columnId
)
);
if
(
updatedSeats
?.
length
===
parseInt
(
noOfSeats
))
{
setButtonState
(
false
);
}
else
{
setButtonState
(
true
);
}
}
else
{
if
(
currentSeats
?.
length
<
noOfSeats
)
{
let
obj
=
{
row
:
rowId
,
seat
:
columnId
};
return
[...
prev
,
obj
];
if
(
prev
?.
length
<
noOfSeats
)
{
updatedSeats
=
[...
prev
,
{
row
:
rowId
,
seat
:
columnId
}];
if
(
updatedSeats
?.
length
===
parseInt
(
noOfSeats
))
{
setButtonState
(
false
);
}
else
{
setButtonState
(
true
);
}
}
else
{
return
prev
?
[...
prev
]
:
[];
updatedSeats
=
prev
?
[...
prev
]
:
[];
// if (updatedSeats?.length === parseInt(noOfSeats)) {
// setButtonState(false);
// } else {
// setButtonState(true);
// }
}
}
return
updatedSeats
;
});
};
...
...
@@ -430,7 +445,8 @@ const BookingPage = () => {
<
Button
size=
{
'lg'
}
onClick=
{
onSeatsConfirm
}
disabled=
{
currentSeats
?.
length
==
noOfSeats
?
true
:
false
}
>
// disabled={currentSeats?.length == noOfSeats ? true : false}>
disabled=
{
buttonState
}
>
Confirm
</
Button
>
</
div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment