Skip to content

Commit

Permalink
Merge pull request #53 from acharayaP03/booking_detail_booking_id_bug
Browse files Browse the repository at this point in the history
booking id is required for showing different booking depending on whi…
  • Loading branch information
acharayaP03 authored Oct 28, 2024
2 parents b671683 + 649933f commit d9f7f88
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/features/bookings/BookingDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function BookingDetail() {
<Button variation='secondary' onClick={moveBack}>
Back
</Button>
{status === 'unconfirmed' && <Button variation='primary'>Check in</Button>}
</ButtonGroup>
</>
);
Expand Down
10 changes: 10 additions & 0 deletions src/features/bookings/BookingRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Menus } from '@/ui/ActionControls';
import { formatCurrency, formatDistanceFromNow } from '@/utils/helpers';
import { HiEye } from 'react-icons/hi';
import { useNavigate } from 'react-router-dom';
import { HiArrowDownOnSquare } from 'react-icons/hi2';

const Cabin = styled.div`
font-size: 1.6rem;
Expand Down Expand Up @@ -86,6 +87,15 @@ export default function BookingRow({
<Menus.Button icon={<HiEye />} onClick={() => navigate(`/bookings/${bookingId}`)}>
See details
</Menus.Button>

{status === 'unconfirmed' && (
<Menus.Button
icon={<HiArrowDownOnSquare />}
onClick={() => navigate(`/checkin/${bookingId}/edit`)}
>
Check in
</Menus.Button>
)}
</Menus.List>
</Menus>
</Table.Row>
Expand Down
2 changes: 1 addition & 1 deletion src/features/bookings/useBooking.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function useBooking() {
data: booking,
error,
} = useQuery({
queryKey: ['bookings'],
queryKey: ['bookings', bookingId],
queryFn: () => getBooking(bookingId),
retry: false, // Disable retries, by default it's 3 tries, but in this case we don't want to retry because the booking might not exist
});
Expand Down

0 comments on commit d9f7f88

Please sign in to comment.