Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
907327b
.env.test*
venyustech May 28, 2022
1ecaf18
Update .gitignore
LeslyeSF May 28, 2022
088d551
feat: update
LeslyeSF May 28, 2022
376c675
Merge pull request #1 from top-drivent/TicketModality
venyustech May 28, 2022
52bcc27
feat: reserve orders online
venyustech May 30, 2022
4044da6
feat: reserve orders presential
venyustech May 30, 2022
b712bfe
chore: cleaning code
venyustech May 30, 2022
563d13f
Merge pull request #2 from top-drivent/feature/reserveOrders
Alan-A-Andrade Jun 1, 2022
5b6f300
feat: :sparkles: addded ticket info to payment form
neves-gabriel Jun 2, 2022
350153a
Merge pull request #3 from top-drivent/feat/payment
Alan-A-Andrade Jun 2, 2022
28c2137
feat: credit card form
Alan-A-Andrade Jun 3, 2022
ad0a4ba
Merge pull request #4 from top-drivent/feat/credit-card-form
Alan-A-Andrade Jun 4, 2022
1721540
feat: :sparkles: added Payment confirmation
neves-gabriel Jun 9, 2022
68b3d08
feat: hotel page
Alan-A-Andrade Jun 10, 2022
6ee8ba6
refactor: :zap: improved Paymente Confirmation
neves-gabriel Jun 10, 2022
ac84e25
Merge pull request #7 from top-drivent/feat-hotel
venyustech Jun 10, 2022
feb5e81
feat: select room
LeslyeSF Jun 11, 2022
502aac1
feat: select room
LeslyeSF Jun 11, 2022
b9df95c
fix: select room update
LeslyeSF Jun 11, 2022
e885323
Merge pull request #9 from top-drivent/feat/select-room
venyustech Jun 12, 2022
c46e9f6
chore: back to hotel choices by click on trocar hotel
venyustech Jun 12, 2022
ce7cacf
chore: add change hotel rental option and clean code
venyustech Jun 12, 2022
6e58590
Merge branch 'main' into feat/PaymentConf
neves-gabriel Jun 13, 2022
df69800
Merge pull request #10 from top-drivent/feat/changeHotel
LeslyeSF Jun 13, 2022
d7deaa5
fix: :bug: fixed conflicts in payment confirmation
neves-gabriel Jun 13, 2022
4d53160
Merge branch 'main' into feat/PaymentConf
neves-gabriel Jun 13, 2022
21c5b8b
fix: :ambulance: fixed bugs in payment confirmation
neves-gabriel Jun 13, 2022
8b5e661
Merge pull request #11 from top-drivent/feat/PaymentConf
LeslyeSF Jun 13, 2022
57824fd
feat: messages
LeslyeSF Jun 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23,024 changes: 44 additions & 22,980 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
<title>Driven.t</title>
</head>
<body>
Expand Down
Binary file added src/assets/images/CreditCardMockUp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/checkVector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions src/components/Activities/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import Message from '../Message';
import styled from 'styled-components';
import Typography from '@material-ui/core/Typography';
import useEnrollment from '../../hooks/api/useEnrollment';

export default function ActivitiesPage() {
const { enrollment } = useEnrollment();

return (
<Container>
<StyledTypography variant='h4'>Escolha de atividades</StyledTypography>
{(enrollment?.payment)?
(enrollment.payment.ticketModality !== 'PRESENTIAL')?
<Message
text='Sua modalidade de ingresso não necessita escolher atividade. Você terá acesso a todas as atividades.'
/>:
'colocar o formulario aqui':
<Message
text='Você precisa ter confirmado pagamento antes de fazer a escolha de atividades'
/>
}
</Container>
);
}

const Container = styled.div`
width: 100%;
height: 100%;

padding: 0 0 50px 0;

display: flex;
flex-direction: column;
align-items: start;
gap: 37px;
`;

const StyledTypography = styled(Typography)`
margin-bottom: 20px !important;
`;
8 changes: 4 additions & 4 deletions src/components/Dashboard/NavigationBar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,28 @@ export default function NavigationBar() {
</Link>

<Link to="/dashboard/payment">
<NavigationButton active={isActive('/dashboard/paymen')}>
<NavigationButton active={isActive('/dashboard/payment')}>
<FaMoneyBill />
<span>Pagamento</span>
</NavigationButton>
</Link>

<Link to="/dashboard/hotel">
<NavigationButton active={isActive('/dashboard/hote')}>
<NavigationButton active={isActive('/dashboard/hotel')}>
<FaBed />
<span>Hotel</span>
</NavigationButton>
</Link>

<Link to="/dashboard/activities">
<NavigationButton active={isActive('/dashboard/activitie')}>
<NavigationButton active={isActive('/dashboard/activities')}>
<FaCalendarWeek />
<span>Atividades</span>
</NavigationButton>
</Link>

<Link to="/dashboard/certificate">
<NavigationButton active={isActive('/dashboard/certificat')}>
<NavigationButton active={isActive('/dashboard/certificate')}>
<FaCertificate />
<span>Certificado</span>
</NavigationButton>
Expand Down
134 changes: 134 additions & 0 deletions src/components/Hotels/FormHotel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import styled from 'styled-components';
import useHotel from '../../hooks/api/useHotel';
import HotelInfo from './HotelInfo';
import { toast } from 'react-toastify';
import { useState } from 'react';
import RoomInfo from './RoomInfo';
import Button from '../Form/Button';
import useBookHotelRoom from '../../hooks/api/useBookHotelRoom';
import useEnrollment from '../../hooks/api/useEnrollment';
import useToken from '../../hooks/useToken';
import useDeleteBedRental from '../../hooks/api/useDeleteBedRental';

export default function FormHotel({ setRoomSelected, changeHotelButton, setChangeHotelButton }) {
const token = useToken();
const { hotels } = useHotel();
const { selectRoom } = useBookHotelRoom();
const { deleteRental } = useDeleteBedRental();
const { enrollment } = useEnrollment();
const [hotel, setHotel] = useState({
id: null,
name: null
});
const [rooms, setRooms] = useState([]);
const [selectedRoom, setSelectedRoom] = useState({
id: null
});

async function submit() {
if (changeHotelButton.selected === false) {
try {
await selectRoom({
id: selectedRoom.id,
enrollmentId: enrollment.id
}, token);
setRoomSelected(true);
toast('Hotel reservado com sucesso!');
} catch {
toast('Falha ao reservar o hotel!');
}
}
else {
const lastHotel = {
roomId: changeHotelButton.lastHotel.roomId,
enrollmentId: changeHotelButton.lastHotel.enrollmentId
};
let changeHotel = {
selected: false,
lastHotel: {
id: null,
enrollmentId: null,
roomId: null,
}
};

try {
await deleteRental(lastHotel, token);
await selectRoom({
id: selectedRoom.id,
enrollmentId: enrollment.id
}, token);
setRoomSelected(true);
setChangeHotelButton(changeHotel);
toast('Troca realizada com sucesso!');
} catch {
toast('Falha ao trocar seu quarto!');
}
}
}

return (
<Container>
<StyleLabel>Primeiro, escolha seu hotel</StyleLabel>
<List>
{hotels?.map((el) => (
<HotelInfo key={el.id} data={el} hotel={hotel} setHotel={setHotel} setRooms={setRooms} />
))}
</List>
{(hotel.id) ?
<>
<StyleLabel>Ótima pedida! Agora escolha seu quarto</StyleLabel>
<RoomList>
{rooms.map((el) => (
<RoomInfo key={el.id} data={el} selectedRoom={selectedRoom} setSelectedRoom={setSelectedRoom} />
))}
</RoomList>
</>
: ''}
{(selectedRoom.id) ?
<Button onClick={submit}>

{(changeHotelButton.selected) ? 'CONFIRMAR TROCA DE QUARTO'
:'RESERVAR QUARTO'}
</Button>
: ''
}
</Container>
);
}
const Container = styled.div`
padding: 0 0 30px 0;
display: flex;
flex-direction: column;
align-items: start;
gap: 37px;
`;

const List = styled.div`
width: 100%;

margin-bottom: 15px;

display: flex;
flex-direction: row;
align-items: start;
gap: 37px;
`;

const RoomList = styled.div`
width: 100%;

margin-bottom: 15px;

display: flex;
flex-wrap: wrap;
align-items: start;
gap: 17px;
`;

const StyleLabel = styled.p`
font-family: 'Roboto', sans-serif;
font-size: 20px;
font-weight: 400;
color: #8e8e8e;
`;
104 changes: 104 additions & 0 deletions src/components/Hotels/HotelInfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import styled from 'styled-components';

export default function HotelInfo({ data, hotel, setHotel, setRooms }) {
const { id, name, imageUrl, room, accomodationsHotel } = data;

const accomodations = accomodationsHotel.map((el) => capitalizeFirstLetter(el.accomodationsType.type)).join(', ');

function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}

const beds = room.map((el) => el.bed);

const vacancyBeds = beds.map((el) =>
el.reduce((prev, curr) => {
if (!curr.enrollmentId) {
return prev + 1;
} else {
return prev + 0;
}
}, 0)
);
const vacancyNumber = vacancyBeds.reduce((prev, curr) => curr + prev, 0);

return (
<Hotel hotelSelected={hotel.id} id={id} onClick={() => {
hotel.id = id;
hotel.name = name;

setHotel( { ...hotel } );
setRooms(room);
} }>
<HotelPicture src={imageUrl} />
<HotelName>{name}</HotelName>
<div>
<InfoTitle>Tipos de acomodação</InfoTitle>
<InfoText>{accomodations}</InfoText>
</div>
<div>
<InfoTitle>Vagas disponíveis:</InfoTitle>
<InfoText>{vacancyNumber}</InfoText>
</div>
</Hotel>
);
}

const Hotel = styled.div`
width: 196px;
height: 264px;

padding: 16px 14px;
border-radius: 10px;
background: ${( { id, hotelSelected } ) => (id === hotelSelected)? '#FFEED2': '#f1f1f1'};
border: #cecece;
display: flex;
justify-content: space-between;
align-items: left;
flex-direction: column;
gap: 3px;

font-family: 'Roboto', sans-serif;
font-size: 14px;
font-weight: 400;
color: #8e8e8e;
&:hover{
cursor:pointer;
}
`;

const HotelName = styled.h1`
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
font-size: 20px;
line-height: 23px;

color: #343434;
`;

const InfoTitle = styled.h2`
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
font-size: 12px;
line-height: 14px;
color: #3c3c3c;
`;

const InfoText = styled.p`
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
font-size: 12px;
line-height: 14px;

color: #3c3c3c;
`;

const HotelPicture = styled.img`
width: 168px;
height: 109px;
object-fit: cover;
border-radius: 10px;
`;
Loading