source: frontend/src/Pages/HotelDetailsPage.js@ e6c2521

Last change on this file since e6c2521 was e6c2521, checked in by darsov2 <62809499+darsov2@…>, 6 months ago

images upload/download impl, other fixes

  • Property mode set to 100644
File size: 6.7 KB
Line 
1import React from "react";
2import LoginForm from "../Components/Login/LoginForm";
3import {Container, Row, Col, Form, FloatingLabel, Modal, Button} from "react-bootstrap";
4import Navigation from "../Components/Layout/Navbar/Navigation";
5import Carousel from "react-bootstrap/Carousel";
6import { useState } from "react";
7import DescriptionContainer from "../Components/HotelDetails/DescriptionContainer";
8import ReviewsCarousel from "../Components/HotelDetails/ReviewsCarousel";
9import RoomsTable from "../Components/HotelDetails/RoomsTable";
10import ContactBar from "../Components/HotelDetails/ContactBar";
11import { useLocation } from "react-router-dom";
12
13const HotelDetailsPage = (props) => {
14 document.body.style.backgroundColor = "white";
15
16 const [index, setIndex] = useState(0);
17
18 const location = useLocation();
19 const { data, from, to } = location.state;
20 console.log(location)
21 console.log("DETAILS ")
22 console.log(data)
23
24 const handleSelect = (selectedIndex) => {
25 setIndex(selectedIndex);
26 };
27
28 return (
29 <>
30 <Navigation />
31 <Container className="my-3">
32 <Row className="d-flex justify-content-between">
33 <Col style={{textAlign: "left"}}>
34 <h2 style={{color: "#159895"}}>{data.hotelName}</h2>
35 </Col>
36 <Col>
37 <Container>
38 <Row className="mb-4">
39 <Col style={{textAlign: "right"}}>
40 <span
41 style={{
42 backgroundColor: "#159895",
43 padding: "0.75em",
44 fontWeight: "bold",
45 fontSize: "1.25rem",
46 borderRadius: "0.75em",
47 color: "white",
48 }}
49 >
50 {data.averageScore.toFixed(1)}
51 </span>
52 </Col>
53 </Row>
54 </Container>
55 </Col>
56 </Row>
57 <Row>
58 <Col
59 className="p-3 rounded-4"
60 sm={3}
61 style={{ backgroundColor: "#002B5B" }}
62 >
63 <Row>
64 <h3 className="mb-5 mt-3" style={{color: "white"}}>Критериуми од пребарувањето</h3>
65 <Form.Floating className="mb-3">
66 <Form.Control
67 size="md"
68 type="text"
69 placeholder="Каде ќе патувате?:"
70 id="location"
71 value={data.hotelLocation}
72 ></Form.Control>
73 <label style={{left: "10px"}} htmlFor="location">Локација:</label>
74 </Form.Floating>
75 </Row>
76 <Row>
77 <Form.Floating className="mb-3">
78 <Form.Control
79 size="md"
80 type="date"
81 placeholder="Датум на пристигнување:"
82 id="dateFrom"
83 value={from}
84 ></Form.Control>
85 <label style={{left: "10px"}} htmlFor="dateFrom">Датум на пристигнување:</label>
86 </Form.Floating>
87 </Row>
88 <Row>
89 <Form.Floating className="mb-3">
90 <Form.Control
91 size="md"
92 type="date"
93 placeholder="Датум на заминување:"
94 id="dateTo"
95 value={to}
96 ></Form.Control>
97 <label style={{left: "10px"}} htmlFor="dateTo">Датум на заминување:</label>
98 </Form.Floating>
99 </Row>
100 <Row>
101 <Form.Floating className="mb-3">
102 <Form.Control
103 size="md"
104 type="number"
105 placeholder="Број на гости:"
106 id="floatingPassengers"
107 ></Form.Control>
108 <label style={{left: "10px"}} htmlFor="floatingPassengers">Број на гости:</label>
109 </Form.Floating>
110 </Row>
111 </Col>
112 <Col>
113 <Container>
114 <Row>
115 <Carousel activeIndex={index} onSelect={handleSelect}>
116 {data.images.map((image) => {
117 let link = image.url;
118 console.log("SLIKATAAA")
119 console.log(image)
120 if (image.url.includes('Desktop')) {
121 link = 'http://localhost:8080/download?fileName=' + encodeURIComponent(image.url);
122 }
123 return (
124 <Carousel.Item>
125 <img
126 className="d-block w-100 h-400 rounded-5"
127 src={link}
128 alt="First slide"
129 style={{ height: "50vh" }}
130 />
131 </Carousel.Item>
132 )
133 })}
134 <Carousel.Item>
135 <img
136 className="d-block w-100 h-400 rounded-5"
137 src="https://www.kovz.gov.mk/articleImage.img/2022/08/05/JPG_010_-_Jovan_Kaneo_church_in_Ohrid__panorama-min.jpg"
138 alt="First slide"
139 style={{ height: "50vh" }}
140 />
141 </Carousel.Item>
142 <Carousel.Item>
143 <img
144 className="d-block w-100 rounded-5"
145 src="https://macedonia-timeless.com/wp-content/uploads/2018/08/dojran-ezero.jpg"
146 alt="Second slide"
147 style={{ height: "50vh" }}
148 />
149 </Carousel.Item>
150 <Carousel.Item>
151 <img
152 className="d-block w-100 rounded-5"
153 src="https://i.imgur.com/NFlxbqY.jpg"
154 alt="Third slide"
155 style={{ height: "50vh" }}
156 />
157 </Carousel.Item>
158 </Carousel>
159 </Row>
160 <Row>
161 <Container></Container>
162 </Row>
163 </Container>
164 </Col>
165 </Row>
166 <Row className="mb-5">
167 <Col className="col-md-8"><DescriptionContainer data={data.hotelDescripiton} type="hotel"></DescriptionContainer></Col>
168 <Col className="col-md-4"><ReviewsCarousel reviews={data.hotelReviews}></ReviewsCarousel></Col>
169 </Row>
170 <Row className="mb-3"><RoomsTable from={from} to={to} data={data.hotelRooms}></RoomsTable></Row>
171 <Row><ContactBar></ContactBar></Row>
172 </Container>
173 </>
174 );
175};
176
177export default HotelDetailsPage;
Note: See TracBrowser for help on using the repository browser.