1 | import {Col, Container, Row} from "react-bootstrap";
|
---|
2 | import React from "react";
|
---|
3 |
|
---|
4 | const ReservationListing = (props) => {
|
---|
5 |
|
---|
6 | const dateFormatter = (str) => {
|
---|
7 | const inputDate = new Date(str);
|
---|
8 |
|
---|
9 | const options = {
|
---|
10 | year: '2-digit',
|
---|
11 | month: '2-digit',
|
---|
12 | day: '2-digit',
|
---|
13 | };
|
---|
14 |
|
---|
15 | return inputDate.toLocaleString('de-DE', options);
|
---|
16 | }
|
---|
17 |
|
---|
18 | return(
|
---|
19 | <>
|
---|
20 | <Container className="py-3 px-1 my-4"
|
---|
21 | style={{
|
---|
22 | border: "4px solid #159895",
|
---|
23 | borderRadius: "1em",
|
---|
24 | boxShadow: "0 3px 5px #159895",
|
---|
25 | maxWidth: "90%",
|
---|
26 | }}>
|
---|
27 | <Row>
|
---|
28 | <Col md={8} className="d-flex flex-column justify-content-start ps-5">
|
---|
29 | <h3 style={{fontWeight: "bold"}} className={'text-start'}>Резервација за:</h3>
|
---|
30 | {props.type === 'hotel' && <h4 className={'text-start'}>{props.data.hotelRoom.hotelRoomName}</h4>}
|
---|
31 | {props.type === 'restaurant' && <h4 className={'text-start'}>{'Маса за ' + props.data.restaurantsTable.noSeats}</h4>}
|
---|
32 | {props.type === 'transport' && <h4 className={'text-start'}>{props.data.transportRoute.from + ' ' + props.data.transportRoute.to}</h4>}
|
---|
33 | {props.type === 'transport' && <h4 className={'text-start'}>{props.data.noSeats + ' ' + 'патници'}</h4>}
|
---|
34 | <h4 className={'text-start'}>{props.data.user.name + ' ' + props.data.user.surname}</h4>
|
---|
35 | {props.type !== 'transport' && <h5
|
---|
36 | className={'text-start'}>{dateFormatter(props.data.dateFrom) + ' - ' + dateFormatter(props.data.dateTo)}</h5>}
|
---|
37 | </Col>
|
---|
38 | <Col md={4} className="d-flex flex-column justify-content-center align-content-center">
|
---|
39 | {props.type === 'hotel' && <h3>Вкупна цена: <br></br>{props.data.hotelRoom.price}$</h3>}
|
---|
40 | </Col>
|
---|
41 | </Row>
|
---|
42 | </Container>
|
---|
43 | </>
|
---|
44 | )
|
---|
45 | }
|
---|
46 |
|
---|
47 | export default ReservationListing; |
---|