Changeset 5528b99 for frontend/src
- Timestamp:
- 01/16/24 16:34:03 (10 months ago)
- Branches:
- master
- Children:
- 07f4e8b
- Parents:
- e6c2521
- Location:
- frontend/src
- Files:
-
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
frontend/src/App.js
re6c2521 r5528b99 5 5 import 'bootstrap/dist/js/bootstrap.js'; 6 6 import HomeCarousel from './Components/Layout/CarouselHome/Carousel'; 7 import { Card, Container} from 'react-bootstrap';7 import { Card, Container } from 'react-bootstrap'; 8 8 import TabComponent from './Components/Tab/Tab'; 9 9 import Offers from './Components/Layout/Offers/Offers'; … … 27 27 import TransportEditPage from './Pages/TransportEditPage'; 28 28 import RestaurantDetailsPage from './Pages/RestaurantDetailsPage'; 29 import { BrowserRouter, Route, Routes} from 'react-router-dom';29 import { BrowserRouter, Route, Routes } from 'react-router-dom'; 30 30 import LoginErrorPage from "./Pages/LoginErrorPage"; 31 import {AuthProvider} from "./Components/Context/AuthContext";32 import PrivateRoute from "./Components/Misc/PrivateRoute";33 import ProfilesManagementPage from "./Pages/ProfilesManagementPage";34 import UserReservationsManagement from "./Pages/UserReservationsManagement";35 31 36 32 37 33 function App() { 38 34 35 <<<<<<< HEAD 39 36 return ( 40 37 <div className="App" style={{overflow: 'hidden'}}> … … 76 73 </div> 77 74 ); 75 ======= 76 return ( 77 <div className="App" style={{overflow: 'hidden'}}> 78 <BrowserRouter> 79 <Routes> 80 <Route path='/login' element={<LoginPage/>}/> 81 <Route path='/register' element={<RegistrationPage/>}/> 82 <Route path='/profile' element={<ProfilePage/>}/> 83 <Route path="/resources" exact element={<NoBusinessRegisteredError hasRegistration="false"/>} /> 84 <Route path="/resources/hotel" element={<ResourcesPage tab="/hotel"/>}/> 85 <Route path="/resources/hotel/:hotelId" element={<HotelEditPage />}/> 86 <Route path="/resources/restaurant" element={<ResourcesPage tab="/restaurant"/>}/> 87 <Route path='/resources/restaurant/:restaurantId' element={<RestaurantEditPage />}/> 88 <Route path="/resources/transport" element={<ResourcesPage tab="/transport"/>}/> 89 <Route path="/resources/transport/:transportId" element={<TransportEditPage/>}/> 90 <Route path="/home" element={<HomePage/> }/> 91 <Route path="/error" element={<LoginErrorPage/> }/> 92 <Route path='/details/transport' element={<TransportDetailsPage></TransportDetailsPage>}/> 93 <Route path='/details/hotel' element={<HotelDetailsPage></HotelDetailsPage>}/> 94 <Route path='/details/restaurant' element={<RestaurantDetailsPage></RestaurantDetailsPage>}/> 95 <Route path="/search/hotel/:hotelLocation/:dateFrom/:dateTo/:numBeds" element={<SearchPage type="hotel"/> }/> 96 <Route path="/search/transport/:from/:to/:date" element={<SearchPage type="transport"/> }/> 97 </Routes> 98 </BrowserRouter> 99 </div> 100 ); 101 >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl) 78 102 } 79 103 -
frontend/src/Components/Forms/AddHotelForm.js
re6c2521 r5528b99 119 119 return prevState + 1; 120 120 }) 121 if(!edit)122 props.closeModal()123 121 }} 124 122 > -
frontend/src/Components/Forms/AddRestaurantForm.js
re6c2521 r5528b99 85 85 return prevState + 1; 86 86 }) 87 props.closeModal()88 87 }} 89 88 > -
frontend/src/Components/Forms/AddRoomForm.js
re6c2521 r5528b99 13 13 hotelRoomDescription: "", 14 14 hotelRoomName: "", 15 num OfBeds: "",15 numBeds: "", 16 16 price: "", 17 17 kitchenAvailable: false, … … 58 58 type="number" 59 59 placeholder="Внесете го бројот на кревети" 60 value={formData.num OfBeds}61 name="num OfBeds"60 value={formData.numBeds} 61 name="numBeds" 62 62 onChange={onFormChange} 63 63 /> … … 117 117 style={{ backgroundColor: "#159895" }} 118 118 size="md" 119 onClick={(e) => { 120 e.preventDefault(); 121 props.refresh((prev) => { 122 return ++prev; 123 }) 119 onClick={() => { 120 console.log(formData); 124 121 createHotelRoom(formData); 125 props.closeModal();126 122 }} 127 123 > -
frontend/src/Components/Forms/AddTransportForm.js
re6c2521 r5528b99 11 11 transportName: "", 12 12 carBrand: "", 13 carType: "",13 carType: false, 14 14 carManufacturedYear: 1900, 15 15 noPassengers: 0, … … 107 107 createTransport(formData, edit); 108 108 props.refresh((prev) => { 109 return ++prev;109 return prev + 1; 110 110 }) 111 if(!edit)112 props.closeModal()113 111 }} 114 112 > -
frontend/src/Components/Forms/EditRoomForm.js
re6c2521 r5528b99 28 28 } = useGet(`/hotel/rooms/${props.room.hotelRoomId}/available`) 29 29 30 console.log(`/hotel/rooms/${props.room.hotelRoomId}/available`)31 32 30 !isLoading && console.log(data) 33 31 … … 44 42 <tr> 45 43 <th>#</th> 44 <<<<<<< HEAD 46 45 <th>Oд</th> 47 46 <th>До</th> 48 47 <th>Цена</th> 48 ======= 49 <th>Достапно од</th> 50 <th>Достапно до</th> 51 <th>Број на соби</th> 52 >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl) 49 53 </tr> 50 54 </thead> -
frontend/src/Components/Hooks/Hotel/useCreateHotel.js
re6c2521 r5528b99 6 6 const useCreateHotel = () => { 7 7 8 //const history = useNavigate(); 8 9 const createHotel = async (hotel, edit) => { 9 10 console.log({hotel}) 10 11 console.log(hotel) 11 console.log("vo createhotel")12 12 13 13 if(!edit) … … 16 16 .post(`/hotel/add`, hotel, { 17 17 params: { 18 userId: JSON.parse(localStorage.getItem("user")).userId18 userId: localStorage.getItem("userId") 19 19 } 20 20 }) -
frontend/src/Components/Hooks/Restaurant/useCreateRestaurant.js
re6c2521 r5528b99 15 15 .post(`/restaurant/add`, restaurant, { 16 16 params: { 17 userId: JSON.parse(localStorage.getItem('user')).userId,17 userId: localStorage.getItem('userId') 18 18 } 19 19 }) -
frontend/src/Components/Hooks/Transport/useCreateTransport.js
re6c2521 r5528b99 4 4 5 5 const useCreateTransport = () => { 6 const userId = JSON.parse(localStorage.getItem('user')).userId 6 7 7 const createTransport = async (transport, edit) => { 8 8 if(!edit) 9 9 { 10 10 await axios 11 .post(`/transport/add /` + userId, transport)11 .post(`/transport/add`, transport) 12 12 .then((res) => { 13 13 //history.push('/transport'); -
frontend/src/Components/Hooks/User/useLogin.js
re6c2521 r5528b99 4 4 import { Navigate, useAsyncValue, useNavigate } from "react-router-dom"; 5 5 import LoginForm from "../../Login/LoginForm.js"; 6 import {useAuth} from "../../Context/AuthContext";7 6 8 7 const useLogin = () => { 9 8 10 9 const navigator = useNavigate() 11 const Auth = useAuth();12 10 //const history = useNavigate(); 13 11 const login = async (loginData) => { … … 24 22 }) 25 23 .then((res) => { 26 console.log("RES LOGIN")27 console.log(res)28 if(res.status === 200)29 {30 const user = {31 sessionId: res.data.auth.details.sessionId,32 userId: res.data.auth.principal.userID,33 username: res.data.auth.principal.username,34 role: res.data.auth.principal.role,35 name: res.data.auth.principal.name,36 surname: res.data.auth.principal.surname,37 }38 Auth.userLogin(user);39 console.log(user)40 }41 24 const sessionId = res.data.auth.details.sessionId; 42 25 const userId = res.data.auth.principal.userID; 43 26 44 27 localStorage.setItem("sessionId", sessionId); 45 28 localStorage.setItem("userId", userId); -
frontend/src/Components/Hooks/useGet.js
re6c2521 r5528b99 11 11 console.log(localStorage.getItem("sessionId")) 12 12 console.log("url od get " + uurl) 13 <<<<<<< HEAD 13 14 await axios.get(uurl, {maxRedirects: 0}).then((res) => { 14 15 console.log(res); … … 22 23 // window.location.href = '/error' 23 24 }) 25 ======= 26 await axios. 27 get(uurl).then((res) => { 28 setData(res.data); 29 }).catch((err) => { 30 console.log(err) 31 }) 32 >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl) 24 33 .finally(() => { 25 34 setIsLoading(false); … … 31 40 getData(url); 32 41 }, [dep, url, changed]); 33 42 34 43 return { 35 44 data, -
frontend/src/Components/HotelEdit/HotelEditTab.js
re6c2521 r5528b99 1 1 import React from "react"; 2 import { Container, Col, Row, Image, Nav, Tab} from "react-bootstrap";3 import { useState} from "react";4 import { FaTaxi, FaHotel} from "react-icons/fa";5 import { MdOutlineStickyNote2} from "react-icons/md";2 import { Container, Col, Row, Image, Nav, Tab } from "react-bootstrap"; 3 import { useState } from "react"; 4 import { FaTaxi, FaHotel } from "react-icons/fa"; 5 import { MdOutlineStickyNote2 } from "react-icons/md"; 6 6 import AddNew from "../Resources/AddNew"; 7 import { BiData} from "react-icons/bi"7 import { BiData } from "react-icons/bi" 8 8 import RoomListing from "./RoomListing"; 9 9 import HotelEditForm from "./HotelEditForm"; 10 10 import AddHotelForm from "../Forms/AddHotelForm"; 11 11 import EditModal from "../Resources/EditModal"; 12 import AddAvailability from "../Resources/AddAvailability";13 import useGet from "../Hooks/useGet";14 import ReservationListing from "./ReservationListing";15 12 16 13 function HotelEditTab(props) { 17 18 19 14 const [activeTab, setActiveTab] = useState("/hotel"); 15 const [modalData, setModalData] = useState(""); 16 const [show, setShow] = useState(false); 20 17 21 console.log(props) 18 const handleClose = () => setShow(false); 19 const handleShow = () => { 20 //e.preventDefault(); 21 setShow(true); 22 22 23 const { 24 data, 25 isLoading, 26 setData, 27 getData, 28 setChanged 29 } = useGet(`/hotel/${props.displayRoom.hotelId}/reservations/active`) 23 }; 30 24 31 !isLoading && console.log(data) 25 const showModal = (modalData) => { 26 setModalData(modalData); 27 handleShow(); 28 } 29 console.log(props.displayRoom) 32 30 33 const handleClose = () => setShow(false); 34 const handleShow = () => { 35 //e.preventDefault(); 36 setShow(true); 31 const handleSelect = (eventKey) => { 32 setActiveTab(eventKey); 33 }; 37 34 38 }; 39 40 const showModal = (modalData) => { 41 setModalData(modalData); 42 handleShow(); 43 } 44 console.log(props.displayRoom) 45 46 const handleSelect = (eventKey) => { 47 setActiveTab(eventKey); 48 }; 49 50 return ( 51 <Container className="rounded-5"> 52 <Tab.Container 53 activeKey={activeTab} 54 onSelect={handleSelect} 55 className="bg-dark rounded-5" 56 > 57 <Nav 58 fill 59 variant="tabs" 60 className="bg-body rounded-top-5" 61 activeKey="/hotel" 62 id="tab_item" 63 > 64 <Nav.Item className="tab_item rounded-5"> 65 <Nav.Link eventKey="/hotel" className="text-left rounded-5"> 35 return ( 36 <Container className="rounded-5"> 37 <Tab.Container 38 activeKey={activeTab} 39 onSelect={handleSelect} 40 className="bg-dark rounded-5" 41 > 42 <Nav 43 fill 44 variant="tabs" 45 className="bg-body rounded-top-5" 46 activeKey="/hotel" 47 id="tab_item" 48 > 49 <Nav.Item className="tab_item rounded-5"> 50 <Nav.Link eventKey="/hotel" className="text-left rounded-5"> 66 51 <span className="ikona"> 67 52 <FaHotel 68 69 style={{lineHeight: "100em"}}70 71 53 color="#159895" 54 style={{ lineHeight: "100em" }} 55 size={"1.5em"} 56 className="mx-3" 72 57 /> 73 58 </span> 74 75 76 77 78 59 <span className="ikona">Соби</span> 60 </Nav.Link> 61 </Nav.Item> 62 <Nav.Item className="tab_item"> 63 <Nav.Link eventKey="/restaurant"> 79 64 <span className="ikona"> 80 <MdOutlineStickyNote2 color="#159895" size={"1.5em"} className="mx-3" />65 <MdOutlineStickyNote2 color="#159895" size={"1.5em"} className="mx-3" /> 81 66 </span> 82 83 84 85 86 67 <span className="ikona">Резервации</span> 68 </Nav.Link> 69 </Nav.Item> 70 <Nav.Item className="tab_item rounded-5"> 71 <Nav.Link eventKey="/transport" className="text-left rounded-5"> 87 72 <span className="ikona"> 88 <BiData color="#159895" size={"1.5em"} className="mx-3" />73 <BiData color="#159895" size={"1.5em"} className="mx-3" /> 89 74 </span> 90 91 92 93 75 <span className="ikona">Општи податоци</span> 76 </Nav.Link> 77 </Nav.Item> 78 </Nav> 94 79 95 <Tab.Content className="py-5 px-3 border rounded-bottom-5 bg-light"> 96 <Tab.Pane eventKey="/hotel"> 97 {props.displayRoom.hotelRooms.map((room) => { 98 return <RoomListing key={room.hotelRoomId} data={room} showModal={showModal}/> 99 })} 100 <EditModal show={show} handleClose={handleClose} type="room" room={modalData}></EditModal> 101 <AddNew Id={props.displayRoom.hotelId} refresh={props.refresh} type="room"/> 102 </Tab.Pane> 103 <Tab.Pane eventKey="/restaurant"> 104 {!isLoading && data.map((res) => { 105 return ( 106 <ReservationListing data={res}/> 107 ) 108 })} 109 {/*<AddNew type="restaurant"/>*/} 110 </Tab.Pane> 111 <Tab.Pane eventKey="/transport"> 112 <AddHotelForm refresh={props.refresh} hotel={props.displayRoom}/> 113 </Tab.Pane> 114 </Tab.Content> 115 </Tab.Container> 116 </Container> 117 ); 80 <Tab.Content className="py-5 px-3 border rounded-bottom-5 bg-light"> 81 <Tab.Pane eventKey="/hotel"> 82 {props.displayRoom.hotelRooms.map((room) => { 83 return <RoomListing key={room.hotelRoomId} data={room} showModal={showModal}/> 84 })} 85 <EditModal show={show} handleClose={handleClose} type="room" room={modalData}></EditModal> 86 <AddNew Id={props.displayRoom.hotelId} refresh={props.refresh} type="room"/> 87 </Tab.Pane> 88 <Tab.Pane eventKey="/restaurant"> 89 <AddNew type="restaurant"/> 90 </Tab.Pane> 91 <Tab.Pane eventKey="/transport"> 92 <AddHotelForm refresh={props.refresh} hotel={props.displayRoom}/> 93 </Tab.Pane> 94 </Tab.Content> 95 </Tab.Container> 96 </Container> 97 ); 118 98 } 119 99 -
frontend/src/Components/Layout/Navbar/Navigation.js
re6c2521 r5528b99 7 7 import useGet from "../../Hooks/useGet"; 8 8 import axios from "../../../axios.js"; 9 <<<<<<< HEAD 9 10 import {useAuth} from "../../Context/AuthContext"; 10 11 import ImageUpload from "../../ImageUpload/ImageUpload"; 12 ======= 13 >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl) 11 14 //import logo from 'assets/images/logo.png'; 12 15 //src="https://upload.wikimedia.org/wikipedia/commons/0/08/Vergina_Sun_-_Golden_Larnax.png" … … 14 17 function Navigation(props) { 15 18 const navigator = useNavigate(); 19 <<<<<<< HEAD 16 20 const Auth = useAuth(); 17 21 const isLoggedIn = Auth.userIsAuthenticated(); … … 22 26 const handleShow = () => setShow(true); 23 27 28 ======= 29 30 const { data, setData, isLoading, getData } = useGet("/username"); 31 32 >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl) 24 33 return ( 25 34 <> … … 31 40 > 32 41 <Container> 33 <Navbar.Brand href=" /home">42 <Navbar.Brand href="#home"> 34 43 <span className="ikona"> 35 44 <Image … … 57 66 <Button onClick={handleShow}></Button> 58 67 </Nav.Link> 59 {!isLo ggedIn&& (68 {!isLoading && !data && ( 60 69 <Button 61 70 className="m-2" … … 69 78 </Button> 70 79 )} 71 { isLoggedIn&& (80 {!isLoading && data && ( 72 81 <> 73 82 <Nav.Link className="m-2" href="/profile"> 74 { Auth.getUser().username}83 {data} 75 84 </Nav.Link> 76 85 <Button … … 81 90 await axios.get("/logout") 82 91 .then((res) => { 83 console.log(res); 84 Auth.userLogout(); 92 console.log(res) 85 93 }) 86 94 .catch((err) => { -
frontend/src/Components/Resources/AddNew.js
re6c2521 r5528b99 56 56 </Modal.Header> 57 57 <Modal.Body> 58 {props.type === "hotel" && <AddHotelForm closeModal={handleClose}refresh={props.refresh}/>}59 {props.type === "room" && <AddRoomForm closeModal={handleClose}refresh={props.refresh} hotelId={props.Id}/>}60 {props.type === "restaurant" && <AddRestaurantForm edit="false" closeModal={handleClose}refresh={props.refresh}/>}61 {props.type === "transport" && <AddTransportForm closeModal={handleClose}refresh={props.refresh}/>}58 {props.type === "hotel" && <AddHotelForm refresh={props.refresh}/>} 59 {props.type === "room" && <AddRoomForm refresh={props.refresh} hotelId={props.Id}/>} 60 {props.type === "restaurant" && <AddRestaurantForm edit="false" refresh={props.refresh}/>} 61 {props.type === "transport" && <AddTransportForm refresh={props.refresh}/>} 62 62 {props.type === "menu" && <AddItemMenuForm Id={props.Id} refresh={props.refresh}/>} 63 63 {props.type === "route" && <AddTripForm transportId={props.transport.transportID} setSize={setSizeXl} refresh={props.refresh}/>} -
frontend/src/Components/Resources/EditModal.js
re6c2521 r5528b99 32 32 </Modal.Header> 33 33 <Modal.Body> 34 {props.type === "hotel" && <AddHotelForm refresh={props.refresh}/>}34 {props.type === "hotel" && <AddHotelForm/>} 35 35 {props.type === "room" && <EditRoomForm refresh={props.refresh} room={props.room}/>} 36 36 {props.type === "restaurant" && <AddRestaurantForm edit="false" refresh={props.refresh}/>} -
frontend/src/Components/Resources/ResourceListing.js
re6c2521 r5528b99 8 8 9 9 const ResourceListing = (props) => { 10 11 console.log("props " + props.id) 12 10 13 11 14 const type = props.type == "hotel" ? "сместувањето" : props.type == "restaurant" ? "ресторанот" : "превозот"; 12 15 const name = props.type == "hotel" ? props.data.hotelName : props.type == "restaurant" ? props.data.restaurantName : props.data.transportName 16 <<<<<<< HEAD 13 17 const id = props.type == "hotel" ? props.data.hotelId : props.type == "restaurant" ? props.data.restaurantID : props.data.transportID 14 18 console.log(props.data) … … 54 58 </Col> 55 59 <Col className="d-flex justify-content-center align-content-center"> 60 ======= 61 const id = props.type == "hotel" ? props.data.hotelId : props.type == "restaurant" ? props.data.resturantId : props.data.transportID 62 return(<> 63 <a href={`${props.type}/${id}`} style={{textDecoration: "none", color:"black"}}> 64 <Container className="py-3 px-1 my-4" 65 style={{ 66 border: "4px solid #159895", 67 borderRadius: "1em", 68 boxShadow: "0 3px 5px #159895", 69 maxWidth: "90%", 70 }}> 71 <Row> 72 <Col className="d-flex justify-content-center"> 73 <Image 74 src="https://www.imgacademy.com/sites/default/files/legacyhotel.jpg" 75 style={{ 76 height: "8em", 77 borderRadius: "1em", 78 boxShadow: "0 4px 20px lightblue", 79 maxWidth: "100%", 80 }} 81 ></Image> 82 </Col> 83 <Col > 84 <h2 style={{textAlign: "left"}}>{name}</h2> 85 {props.type === "hotel" && (<> 86 <h5 style={{textAlign: "left"}}>{props.data.hotelLocation}</h5> 87 <h5 style={{textAlign: "left"}}>{props.data.hotelEmail}</h5> 88 </>)} 89 {props.type === "restaurant" && (<> 90 <h5 style={{textAlign: "left"}}>{props.data.restaurantLocation}</h5> 91 <h5 style={{textAlign: "left"}}>{props.data.cousineType} кујна</h5> 92 </>)} 93 {props.type === "transport" && (<> 94 <h5 style={{textAlign: "left"}}>{props.data.carBrand}</h5> 95 <h5 style={{textAlign: "left"}}>{props.data.carPlate}</h5> 96 </>)} 97 </Col> 98 <Col className="d-flex justify-content-center align-content-center" > 99 >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl) 56 100 <span 57 101 style={{ -
frontend/src/Components/Resources/ResourcesTab.js
re6c2521 r5528b99 10 10 11 11 function ResourcesTab(props) { 12 <<<<<<< HEAD 12 13 const [activeTab, setActiveTab] = useState(props.tab); 13 14 const userId = JSON.parse(localStorage.getItem("user")).userId; … … 35 36 <Nav.Item className="tab_item rounded-5"> 36 37 <Nav.Link href="/resources/hotel" className="text-left rounded-5"> 38 ======= 39 const [activeTab, setActiveTab] = useState(props.tab); 40 // const [changed, setChanged] = useState(0); 41 const userId = localStorage.getItem("userId"); 42 const { data, setData, isLoading, getData, setChanged } = useGet(`${props.tab}/user/${userId}`); 43 44 const handleSelect = (eventKey) => { 45 setActiveTab(eventKey); 46 console.log(props.refresh); 47 props.refresh(eventKey); 48 console.log("refresh" + eventKey); 49 }; 50 51 !isLoading && console.log(data); 52 console.log(props.tab); 53 54 return ( 55 <Container className="rounded-5"> 56 <Tab.Container 57 activeKey={activeTab} 58 onSelect={handleSelect} 59 className="bg-dark rounded-5" 60 > 61 <Nav 62 fill 63 variant="tabs" 64 className="bg-body rounded-top-5" 65 activeKey="/hotel" 66 id="tab_item" 67 > 68 <Nav.Item className="tab_item rounded-5"> 69 <Nav.Link href="/resources/hotel" className="text-left rounded-5"> 70 >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl) 37 71 <span className="ikona"> 38 72 <FaHotel … … 67 101 </Nav> 68 102 103 <<<<<<< HEAD 69 104 <Tab.Content className="py-5 px-3 border rounded-bottom-5 bg-light"> 70 105 <Tab.Pane eventKey="/hotel" key="hotelPane"> … … 115 150 </Container> 116 151 ); 152 ======= 153 <Tab.Content className="py-5 px-3 border rounded-bottom-5 bg-light"> 154 <Tab.Pane eventKey="/hotel" key="hotelPane"> 155 {props.tab == "/hotel" && !isLoading && data != null && 156 data.map((hotel) => { 157 return ( 158 <Link key={hotel.hotelId} to={"/resources/hotel/" + hotel.hotelId}> 159 <ResourceListing 160 key={hotel.hotelId} 161 id={hotel.hotelId} 162 type="hotel" 163 data={hotel} 164 /> 165 </Link> 166 ); 167 })} 168 <AddNew type="hotel" refresh={setChanged} /> 169 </Tab.Pane> 170 <Tab.Pane eventKey="/restaurant" key="restaurantPane"> 171 {props.tab == "/restaurant" && !isLoading && data != null && 172 data.map((restaurant) => { 173 console.log("mapiranje " + restaurant) 174 return ( 175 <Link key={restaurant.restaurantId} to={"/resources/restaurant/" + restaurant.restaurantID}> 176 <ResourceListing 177 key={restaurant.restaurantId} 178 type="restaurant" 179 data={restaurant} 180 /> 181 </Link> 182 ); 183 })} 184 <AddNew type="restaurant" refresh={setChanged}/> 185 </Tab.Pane> 186 <Tab.Pane eventKey="/transport" key="transportPane"> 187 {props.tab == "/transport" && !isLoading && data.length > 0 && 188 data.map((transport) => { 189 return ( 190 <ResourceListing 191 key={transport.transportId} 192 id={transport.transportId} 193 type="transport" 194 data={transport} 195 /> 196 ); 197 })} 198 <AddNew type="transport" refresh={setChanged}/> 199 </Tab.Pane> 200 </Tab.Content> 201 </Tab.Container> 202 </Container> 203 ); 204 >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl) 117 205 } 118 206 -
frontend/src/Components/RestaurantEdit/RestaurantEditTab.js
re6c2521 r5528b99 100 100 return <MenuListing key={menu.menuId} data={menu} showModal={showModal}/> 101 101 })} 102 {activeTab === '/hotel' && <EditModal show={show} refresh={props.refresh}handleClose={handleClose} type="menu" menu={modalData}></EditModal>}102 {activeTab === '/hotel' && <EditModal show={show} handleClose={handleClose} type="menu" menu={modalData}></EditModal>} 103 103 <AddNew Id={props.displayMenu.restaurantID} refresh={props.refresh} type="menu"/> 104 104 </Tab.Pane> -
frontend/src/Components/SearchCriterias/SearchCriteriasBar.js
re6c2521 r5528b99 2 2 import { Container, Form, Button, Row, Col } from "react-bootstrap"; 3 3 import useFormData from "../Hooks/useFormData"; 4 <<<<<<< HEAD 4 5 import SearchCriteriasHotel from "./SearchCriteriasHotel"; 5 6 import SearchCriteriasTransport from "./SearchCriteriasTransport"; 6 7 import SearchCriteriasRestaurant from "./SearchCriteriasRestaurant"; 8 ======= 9 >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl) 7 10 8 const SearchCriterias Bar= (props) => {11 const SearchCriterias = (props) => { 9 12 10 const { criterias, type } = props 13 const { formData, onFormChange, onCheckBoxChange, setFormData} = useFormData(props.criterias) 14 console.log("KRITERIUMI") 15 console.log(formData) 11 16 17 <<<<<<< HEAD 12 18 return ( 13 19 <> … … 18 24 ) 19 25 } 26 ======= 27 return ( 28 <> 29 <Container 30 className="p-1 pb-0 mb-5 mt-3 rounded-2" 31 style={{ backgroundColor: "#002B5B", width: "65%"}} 32 > 33 <Form className="rounded-5"> 34 <Row className="gx-1"> 35 <Col> 36 <Form.Floating className="mb-3"> 37 <Form.Control 38 size="md" 39 type="text" 40 placeholder="Каде ќе патувате?:" 41 id="location" 42 name="hotelLocation" 43 onChange={onFormChange} 44 value={formData.hotelLocation} 45 ></Form.Control> 46 <label htmlFor="location">Локација:</label> 47 </Form.Floating> 48 </Col> 49 <Col> 50 <Form.Floating className="mb-3"> 51 <Form.Control 52 size="md" 53 type="date" 54 placeholder="Датум на пристигнување:" 55 id="dateFrom" 56 name="dateFrom" 57 onChange={onFormChange} 58 value={formData.dateFrom} 59 ></Form.Control> 60 <label htmlFor="dateFrom">Датум на пристигнување:</label> 61 </Form.Floating> 62 </Col> 63 <Col> 64 <Form.Floating className="mb-3"> 65 <Form.Control 66 size="md" 67 type="date" 68 placeholder="Датум на заминување:" 69 id="dateTo" 70 name="dateTo" 71 onChange={onFormChange} 72 value={formData.dateTo} 73 ></Form.Control> 74 <label htmlFor="dateTo">Датум на заминување:</label> 75 </Form.Floating> 76 </Col> 77 <Col> 78 <Form.Floating className="mb-3"> 79 <Form.Control 80 size="md" 81 type="number" 82 placeholder="Број на гости:" 83 id="floatingPassengers" 84 name="numBeds" 85 onChange={onFormChange} 86 value={formData.numBeds} 87 ></Form.Control> 88 <label htmlFor="floatingPassengers">Број на гости:</label> 89 </Form.Floating> 90 </Col> 91 <Col> 92 <Form.Group className="my-1"> 93 <Button 94 type="submit" 95 style={{ backgroundColor: "#159895" }} 96 size="lg" 97 className="w-100" 98 onClick={(e) => { 99 e.preventDefault(); 100 window.location.href = `/search/hotel/${formData.hotelLocation}/${formData.dateFrom}/${formData.dateTo}/${formData.numBeds}` 101 }} 102 > 103 <span className="ikona mx-3">Пребарај</span> 104 </Button> 105 </Form.Group> 106 </Col> 107 </Row> 108 </Form> 109 </Container> 110 </> 111 ); 112 }; 113 >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl) 20 114 21 export default SearchCriterias Bar;115 export default SearchCriterias; -
frontend/src/Components/Tab/TabFormTransport.js
re6c2521 r5528b99 2 2 import { Button, Col, Container, Form, Row } from "react-bootstrap"; 3 3 import { HiMagnifyingGlass } from "react-icons/hi2" 4 import useFormData from "../Hooks/useFormData";5 4 6 5 function TabFormTransport() { 7 8 const { formData, onFormChange, setFormData } = useFormData({9 from: undefined,10 to: undefined,11 date: undefined,12 numPassengers: 013 })14 15 6 return ( 16 7 <Form> … … 23 14 placeholder="Од:" 24 15 id="floatingFrom" 25 value={formData.from}26 name={'from'}27 onChange={onFormChange}28 16 ></Form.Control> 29 17 <label htmlFor="floatingFrom">Од:</label> … … 37 25 placeholder="До:" 38 26 id="floatingTo" 39 name={'to'}40 value={formData.to}41 onChange={onFormChange}42 27 ></Form.Control> 43 28 <label htmlFor="floatingTo">До:</label> … … 51 36 placeholder="Датум:" 52 37 id="floatingDate" 53 name={'date'}54 value={formData.date}55 onChange={onFormChange}56 38 ></Form.Control> 57 39 <label htmlFor="floatingDate">Датум:</label> … … 64 46 type="number" 65 47 placeholder="Број на патници:" 66 name={'numPassengers'}67 48 id="floatingPassengers" 68 value={formData.numPassengers}69 onChange={onFormChange}70 49 ></Form.Control> 71 50 <label htmlFor="floatingPassengers">Број на патници:</label> 72 51 </Form.Floating> 73 52 <Form.Group className="my-1"> 74 <Button type="submit" style={{backgroundColor: "#159895"}} size="lg" onClick={(e) => { 75 e.preventDefault(); 76 window.location.href = `/search/transport/${formData.from}/${formData.to}/${formData.date}/${formData.numPassengers}` 77 }}> 53 <Button type="submit" style={{backgroundColor: "#159895"}} size="lg"> 78 54 <span className="ikona my-1"><HiMagnifyingGlass/></span> 79 55 <span className="ikona mx-3">Пребарај</span> -
frontend/src/Components/TransportDetails/FinalPoint.js
re6c2521 r5528b99 17 17 <> 18 18 <Row> 19 {props.left === "true" && <Col className="d-flex flex-column justify-content-center col- md-4" style={{paddingLeft: "2.6rem"}}>19 {props.left === "true" && <Col className="d-flex flex-column justify-content-center col-auto" style={{paddingLeft: "2.6rem"}}> 20 20 <h5 className="m-auto">{getTimeAsString(props.time)}</h5> 21 21 </Col> } -
frontend/src/Components/TransportDetails/Line.js
re6c2521 r5528b99 2 2 3 3 const Line = (props) => { 4 const left = props.left === "true" ? "1.8rem" : "1.85rem"; 4 console.log(props.left) 5 const left = props.left === "true" ? "9.08rem" : "2.6rem"; 6 console.log({borderLeft: "5px solid #159895", height: "3em", marginLeft: left, marginTop: "-1.4rem", marginBottom: "-1.4rem"}) 5 7 return (<> 6 8 <div style={{borderLeft: "5px solid #159895", height: "3em", marginLeft: left, marginTop: "-1.4rem", marginBottom: "-1.4rem"}}></div> -
frontend/src/Components/TransportDetails/Waypoint.js
re6c2521 r5528b99 16 16 } 17 17 18 <<<<<<< HEAD 18 19 return ( 19 20 <> … … 57 58 </> 58 59 ); 60 ======= 61 return ( 62 <> 63 <Row className="d-flex flex-row gap-0"> 64 {props.left === "true" && <Col className="d-flex flex-column justify-content-center col-auto" style={{paddingLeft: "2.6rem"}}> 65 <h5 style={{color: props.routes === "true" ? "white" : "" }} className="m-auto">{getTimeAsString(props.time)}</h5> 66 </Col>} 67 <Col md="auto"> 68 <RxDot size={"4rem"} color="#159895"></RxDot> 69 </Col> 70 <Col className="d-flex flex-column justify-content-center"> 71 <h3 className="my-auto" style={{...style, fontSize: props.routes === "true" ? "1.3rem" : "", color: props.routes === "true" ? "#708090 " : ""}}>{props.city}</h3> 72 </Col> 73 {props.left !== "true" && <Col className="d-flex flex-column justify-content-center"> 74 <h5>{getTimeAsString(props.time)}</h5> 75 </Col>} 76 </Row> 77 <Row> 78 <Line left={props.left}> </Line> 79 </Row> 80 </> 81 ); 82 >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl) 59 83 }; 60 84 -
frontend/src/Components/TransportEdit/TransportEditTab.js
re6c2521 r5528b99 12 12 function TransportEditTab(props) { 13 13 const [activeTab, setActiveTab] = useState("/hotel"); 14 const link = "/transport/" + props.displayRoute.transportID + "/available"; 14 15 console.log(props.displayRoute) 16 const [changed, setChanged] = useState(0) 17 const { data, setData, isLoading, getData } = useGet(link, changed); 15 18 16 19 -
frontend/src/Components/TransportEdit/TransportListing.js
re6c2521 r5528b99 9 9 10 10 //const type = props.type == "hotel" ? "сместувањето" : props.type == "restaurant" ? "ресторанот" : "превозот"; 11 console.log(props.data) 12 console.log(props.data.from) 11 13 return (<> 12 14 <a href="#" style={{textDecoration: "none", color: "black"}}> … … 32 34 <Col className="d-flex flex-column justify-content-center" style={{textAlign: "left"}}> 33 35 <h2>{props.data.from} - {props.data.to}</h2> 36 {/* <h6>{props.data.routeCities}</h6> */} 34 37 <h6>{props.data.routes.map(x => x).join(", ")}</h6> 35 38 </Col> … … 37 40 <Col className="d-flex flex-column justify-content-center align-content-center"> 38 41 <h5>Цена:</h5> 39 <h4>{props.data.maxPrice}$</h4> 42 {/* <h4>{props.data.routePrice}</h4> */} 43 <h4>99$</h4> 40 44 </Col> 41 45 </Row> -
frontend/src/Components/useFormNested.js
re6c2521 r5528b99 7 7 console.log(e) 8 8 9 const dependantRoutes = e.target. name === 'freeSpace' ? e.target.parentElement.getAttribute('dependantRoutes').split(',') : undefined;9 const dependantRoutes = e.target.parentElement.getAttribute('dependantRoutes').split(',') 10 10 console.log(dependantRoutes) 11 11 -
frontend/src/Pages/HotelDetailsPage.js
re6c2521 r5528b99 1 1 import React from "react"; 2 2 import LoginForm from "../Components/Login/LoginForm"; 3 <<<<<<< HEAD 3 4 import {Container, Row, Col, Form, FloatingLabel, Modal, Button} from "react-bootstrap"; 5 ======= 6 import { Container, Row, Col, Form } from "react-bootstrap"; 7 >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl) 4 8 import Navigation from "../Components/Layout/Navbar/Navigation"; 5 9 import Carousel from "react-bootstrap/Carousel"; … … 69 73 placeholder="Каде ќе патувате?:" 70 74 id="location" 71 value={data.hotelLocation}72 75 ></Form.Control> 73 <label style={{left: "10px"}}htmlFor="location">Локација:</label>76 <label htmlFor="location">Локација:</label> 74 77 </Form.Floating> 75 78 </Row> … … 81 84 placeholder="Датум на пристигнување:" 82 85 id="dateFrom" 83 value={from}84 86 ></Form.Control> 85 <label style={{left: "10px"}}htmlFor="dateFrom">Датум на пристигнување:</label>87 <label htmlFor="dateFrom">Датум на пристигнување:</label> 86 88 </Form.Floating> 87 89 </Row> … … 93 95 placeholder="Датум на заминување:" 94 96 id="dateTo" 95 value={to}96 97 ></Form.Control> 97 <label style={{left: "10px"}}htmlFor="dateTo">Датум на заминување:</label>98 <label htmlFor="dateTo">Датум на заминување:</label> 98 99 </Form.Floating> 99 100 </Row> … … 106 107 id="floatingPassengers" 107 108 ></Form.Control> 108 <label style={{left: "10px"}}htmlFor="floatingPassengers">Број на гости:</label>109 <label htmlFor="floatingPassengers">Број на гости:</label> 109 110 </Form.Floating> 110 111 </Row> -
frontend/src/Pages/HotelEditPage.js
re6c2521 r5528b99 1 import React, { useState} from "react";2 import { Container, Col, Row, Image} from "react-bootstrap";1 import React, { useState } from "react"; 2 import { Container, Col, Row, Image } from "react-bootstrap"; 3 3 import Navigation from "../Components/Layout/Navbar/Navigation"; 4 4 import ResourcesTab from "../Components/Resources/ResourcesTab"; 5 5 import HotelEditTab from "../Components/HotelEdit/HotelEditTab"; 6 6 import useGet from "../Components/Hooks/useGet"; 7 import {Navigate, useParams} from "react-router-dom"; 8 import {useAuth} from "../Components/Context/AuthContext"; 7 import { useParams } from "react-router-dom"; 9 8 10 9 11 10 const HotelEditPage = () => { 12 11 13 14 15 16 const {data, setData, isLoading, getData} = useGet(link, changed);12 const params = useParams(); 13 const link = "/hotel/list/" + params.hotelId; 14 const [changed, setChanged] = useState(0) 15 const { data, setData, isLoading, getData } = useGet(link, changed); 17 16 18 17 19 20 21 22 <Navigation/>23 24 25 <h2 style={{color: "#159895", textAlign: "left"}}>Мои ресурси</h2>26 27 28 29 30 31 32 style={{maxWidth: "30%"}}33 34 35 36 37 38 39 40 41 42 43 44 45 <Container className="pt-2" style={{textAlign: "left"}}>46 47 48 49 50 51 52 53 54 55 56 57 58 18 console.log(data) 19 return ( 20 <> 21 <Navigation /> 22 {!isLoading && <Container> 23 <Row className="mb-5"> 24 <h2 style={{ color: "#159895", textAlign: "left" }}>Мои ресурси</h2> 25 </Row> 26 <Row className="mb-5"> 27 <Col> 28 <Row className="d-flex mb-3"> 29 <Col 30 className="d-flex justify-content-center" 31 style={{ maxWidth: "30%" }} 32 > 33 <Image 34 src="https://t3.ftcdn.net/jpg/05/16/27/58/360_F_516275801_f3Fsp17x6HQK0xQgDQEELoTuERO4SsWV.jpg" 35 style={{ 36 height: "5em", 37 borderRadius: "50%", 38 maxWidth: "100%", 39 }} 40 className="m-auto" 41 ></Image> 42 </Col> 43 <Col className="d-flex justify-content-center"> 44 <Container className="pt-2" style={{ textAlign: "left" }}> 45 <h4>{data.hotelName}</h4> 46 <h5>{data.hotelLocation}</h5> 47 </Container> 48 </Col> 49 </Row> 50 </Col> 51 </Row> 52 <Row> 53 <HotelEditTab refresh={setChanged} displayRoom={data}/> 54 </Row> 55 </Container>} 56 </> 57 ); 59 58 }; 60 59 -
frontend/src/Pages/LoginErrorPage.js
re6c2521 r5528b99 11 11 const [show, setShow] = useState(false); 12 12 const [changed, setChanged] = useState(0); 13 const {data, isLoading} = useGet("/username") 13 14 const userId = localStorage.getItem("userId") 14 15 const [registered, setRegistered] = useState(false); -
frontend/src/Pages/LoginPage.js
re6c2521 r5528b99 3 3 import { Container } from "react-bootstrap"; 4 4 import Navigation from "../Components/Layout/Navbar/Navigation"; 5 import {useAuth} from "../Components/Context/AuthContext";6 import {Navigate} from "react-router-dom";7 8 5 9 6 const LoginPage = () => { … … 11 8 document.body.style.marginTop = "auto"; 12 9 document.body.style.marginBottom = "auto"; 13 14 const Auth = useAuth();15 const isLoggedIn = Auth.userIsAuthenticated();16 17 if (isLoggedIn) {18 return <Navigate to={'/home'}/>19 }20 21 10 return ( 22 11 <> -
frontend/src/Pages/NoBusinessRegisteredError.js
re6c2521 r5528b99 6 6 import RegisterBusinessForm from "../Components/Forms/RegisterBusinessForm"; 7 7 import useGet from "../Components/Hooks/useGet"; 8 import {Navigate, useNavigate} from "react-router-dom"; 9 import {useAuth} from "../Components/Context/AuthContext"; 8 import { useNavigate } from "react-router-dom"; 10 9 11 10 const NoBusinessRegisteredError = (props) => { 12 11 const [show, setShow] = useState(false); 13 12 const [changed, setChanged] = useState(0); 14 const Auth = useAuth(); 15 const isLoggedIn = Auth.userIsAuthenticated(); 13 const {data, isLoading} = useGet("/username") 16 14 const userId = localStorage.getItem("userId") 17 15 const [registered, setRegistered] = useState(false); … … 47 45 48 46 49 if(!isLoggedIn) 50 { 51 return <Navigate to={'/login'}/> 52 } 47 console.log(data) 53 48 49 !isLoading && !data && navigator("/login") 54 50 !firmaIsLoading && firma && firma.length > 0 && firma[0].approved && navigator("/resources/hotel") 55 51 -
frontend/src/Pages/ProfilePage.js
re6c2521 r5528b99 8 8 import ChangePasswordForm from "../Components/Forms/ChangePasswordForm"; 9 9 import useGet from "../Components/Hooks/useGet"; 10 import {useAuth} from "../Components/Context/AuthContext";11 import {Navigate} from "react-router-dom";12 10 13 11 const ProfilePage = () => { 14 12 15 13 const { data, setData, isLoading, getData } = useGet("/principal"); 16 14 17 18 15 19 16 const profileData = { 20 17 "name": "Марко", … … 22 19 "address": "ул. Раскрсница бр. 10", 23 20 "dateOfBirth": "2002-01-01", 24 "country": " Македонија",21 "country": "Никогаш Северна само МАКЕДОНИЈА", 25 22 "zip": "1000", 26 23 "city": "Скопје", … … 30 27 31 28 32 33 29 return ( 34 30 <> 35 31 <Navigation /> 36 {!isLoading && <Container>32 { !isLoading && <Container> 37 33 <Row className="mb-5"> 38 34 <h2 style={{ color: "#159895", textAlign: "left" }}>Мојот профил</h2> -
frontend/src/Pages/ResourcesPage.js
re6c2521 r5528b99 1 1 import React from "react"; 2 import { Container, Col, Row, Image} from "react-bootstrap";2 import { Container, Col, Row, Image } from "react-bootstrap"; 3 3 import Navigation from "../Components/Layout/Navbar/Navigation"; 4 4 import ResourcesTab from "../Components/Resources/ResourcesTab"; 5 import { useState} from "react";5 import { useState } from "react"; 6 6 import useGet from "../Components/Hooks/useGet"; 7 import {useAuth} from "../Components/Context/AuthContext";8 import {Navigate} from "react-router-dom";9 7 10 8 const ResourcesPage = (props) => { 11 9 12 const Auth = useAuth();13 const user = Auth.getUser();10 console.log(props.tab) 11 const { data, setData, isLoading, getData } = useGet("/principal"); 14 12 15 return ( 16 <> 17 <Navigation/> 18 {<Container> 19 <Row className="mb-5"> 20 <h2 style={{color: "#159895", textAlign: "left"}}>Мои ресурси</h2> 21 </Row> 22 <Row className="mb-5"> 23 <Col> 24 <Row className="d-flex mb-3"> 25 <Col 26 className="d-flex justify-content-center" 27 style={{maxWidth: "30%"}} 28 > 29 <Image 30 src="https://t3.ftcdn.net/jpg/05/16/27/58/360_F_516275801_f3Fsp17x6HQK0xQgDQEELoTuERO4SsWV.jpg" 31 style={{ 32 height: "5em", 33 borderRadius: "50%", 34 maxWidth: "100%", 35 }} 36 className="m-auto" 37 ></Image> 38 </Col> 39 <Col className="d-flex justify-content-center"> 40 <Container className="pt-2" style={{textAlign: "left"}}> 41 <h4>{user.name + " " + user.surname}</h4> 42 <h5>{user.username}</h5> 43 </Container> 44 </Col> 45 </Row> 46 </Col> 47 </Row> 48 <Row> 49 <ResourcesTab tab={props.tab}></ResourcesTab> 50 </Row> 51 </Container>} 52 </> 53 ); 13 14 return ( 15 <> 16 <Navigation /> 17 {!isLoading && <Container> 18 <Row className="mb-5"> 19 <h2 style={{ color: "#159895", textAlign: "left" }}>Мои ресурси</h2> 20 </Row> 21 <Row className="mb-5"> 22 <Col> 23 <Row className="d-flex mb-3"> 24 <Col 25 className="d-flex justify-content-center" 26 style={{ maxWidth: "30%" }} 27 > 28 <Image 29 src="https://t3.ftcdn.net/jpg/05/16/27/58/360_F_516275801_f3Fsp17x6HQK0xQgDQEELoTuERO4SsWV.jpg" 30 style={{ 31 height: "5em", 32 borderRadius: "50%", 33 maxWidth: "100%", 34 }} 35 className="m-auto" 36 ></Image> 37 </Col> 38 <Col className="d-flex justify-content-center"> 39 <Container className="pt-2" style={{ textAlign: "left" }}> 40 <h4>{data.name + " " + data.surname}</h4> 41 <h5>{data.email}</h5> 42 </Container> 43 </Col> 44 </Row> 45 </Col> 46 </Row> 47 <Row> 48 <ResourcesTab tab={props.tab}></ResourcesTab> 49 </Row> 50 </Container>} 51 </> 52 ); 54 53 }; 55 54 -
frontend/src/Pages/RestaurantEditPage.js
re6c2521 r5528b99 6 6 import RestaurantEditTab from "../Components/RestaurantEdit/RestaurantEditTab"; 7 7 import useGet from "../Components/Hooks/useGet"; 8 import {Navigate, useParams, useSearchParams} from "react-router-dom"; 9 import {useAuth} from "../Components/Context/AuthContext"; 8 import { useParams, useSearchParams } from "react-router-dom"; 10 9 11 10 const RestaurantEditPage = () => { -
frontend/src/Pages/SearchPage.js
re6c2521 r5528b99 11 11 import BecomeAHost from "../Components/BecomeAHost/BecomeAHost" 12 12 import HotelLisitng from "../Components/Listings/HotelListing" 13 import SearchCriterias Hotel from "../Components/SearchCriterias/SearchCriteriasHotel";13 import SearchCriterias from "../Components/SearchCriterias/SearchCriteriasBar"; 14 14 import SortButton from "../Components/Listings/SortButton"; 15 15 import FilterButton from "../Components/Listings/FilterButton"; … … 17 17 import useGet from "../Components/Hooks/useGet"; 18 18 import { useParams } from "react-router-dom"; 19 <<<<<<< HEAD 19 20 import SearchCriteriasBar from "../Components/SearchCriterias/SearchCriteriasBar"; 20 21 import RestaurantDetailsPage from "./RestaurantDetailsPage"; 21 22 import RestaurantListing from "../Components/Listings/RestaurantListing"; 23 ======= 24 >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl) 22 25 23 26 … … 39 42 } 40 43 44 <<<<<<< HEAD 41 45 let link = props.type === "transport" ? `/transport/search?from=${params.from}&to=${params.to}&date=${params.date}&numPassengers=${params.numPassengers}` : props.type === "hotel" ? `/hotel/search?hotelLocation=${params.hotelLocation}&dateFrom=${params.dateFrom}&dateTo=${params.dateTo}&numBeds=${params.numBeds}` : `/restaurant/search?restaurantLocation=${params.restaurantLocation}&date=${params.date}&hourFrom=${params.hourFrom}&hourTo=${params.hourTo}&numPeople=${params.numPeople}` 46 ======= 47 let link = props.type === "transport" ? `/transport/search?from=${params.from}&to=${params.to}&date=${params.date}` : props.type === "hotel" ? `/hotel/search?hotelLocation=${params.hotelLocation}&dateFrom=${params.dateFrom}&dateTo=${params.dateTo}&numBeds=${params.numBeds}` : "" 48 >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl) 42 49 console.log(link) 43 50 console.log(params.date) … … 47 54 <> 48 55 <Navigation></Navigation> 49 <SearchCriterias Bar type={props.type} criterias={useParams()}></SearchCriteriasBar>56 <SearchCriterias criterias={useParams()}></SearchCriterias> 50 57 <Container className="d-flex justify-content-end gx-5" style={{maxWidth: "60%"}}> 51 58 <Row> -
frontend/src/Pages/TransportEditPage.js
re6c2521 r5528b99 1 import React, { useState} from "react";2 import { Container, Col, Row, Image} from "react-bootstrap";1 import React, { useState } from "react"; 2 import { Container, Col, Row, Image } from "react-bootstrap"; 3 3 import Navigation from "../Components/Layout/Navbar/Navigation"; 4 4 import ResourcesTab from "../Components/Resources/ResourcesTab"; … … 7 7 import TransportEditTab from "../Components/TransportEdit/TransportEditTab"; 8 8 import useGet from "../Components/Hooks/useGet"; 9 import {Navigate, useParams} from "react-router-dom"; 10 import {useAuth} from "../Components/Context/AuthContext"; 9 import { useParams } from "react-router-dom"; 11 10 12 11 const TransportEditPage = () => { 12 const params = useParams(); 13 console.log("transportot ima id " + params.transportId); 14 const link = "/transport/" + params.transportId; 15 const [changed, setChanged] = useState(0); 16 const { data, setData, isLoading, getData } = useGet(link, changed); 13 17 14 const params = useParams();18 !isLoading && console.log(data) 15 19 16 const link = "/transport/" + params.transportId; 17 18 const {data, setData, isLoading, getData, setChanged} = useGet(link); 19 20 !isLoading && console.log(data) 21 22 return ( 23 <> 24 <Navigation/> 25 {!isLoading && ( 26 <Container> 27 <Row className="mb-5"> 28 <h2 style={{color: "#159895", textAlign: "left"}}>Мои ресурси</h2> 29 </Row> 30 <Row className="mb-5"> 31 <Col> 32 <Row className="d-flex mb-3"> 33 <Col 34 className="d-flex justify-content-center" 35 style={{maxWidth: "30%"}} 36 > 37 <Image 38 src="https://t3.ftcdn.net/jpg/05/16/27/58/360_F_516275801_f3Fsp17x6HQK0xQgDQEELoTuERO4SsWV.jpg" 39 style={{ 40 height: "5em", 41 borderRadius: "50%", 42 maxWidth: "100%", 43 }} 44 className="m-auto" 45 ></Image> 46 </Col> 47 <Col className="d-flex justify-content-center"> 48 <Container className="pt-2" style={{textAlign: "left"}}> 49 <h4>{data.transportName}</h4> 50 <h5>{data.carBrand + " " + data.carType}</h5> 51 </Container> 52 </Col> 53 </Row> 54 </Col> 55 </Row> 56 <Row> 57 {data && <TransportEditTab displayRoute={data} refresh={setChanged}/>} 58 </Row> 59 </Container> 60 )} 61 </> 62 ); 20 return ( 21 <> 22 <Navigation /> 23 {!isLoading && ( 24 <Container> 25 <Row className="mb-5"> 26 <h2 style={{ color: "#159895", textAlign: "left" }}>Мои ресурси</h2> 27 </Row> 28 <Row className="mb-5"> 29 <Col> 30 <Row className="d-flex mb-3"> 31 <Col 32 className="d-flex justify-content-center" 33 style={{ maxWidth: "30%" }} 34 > 35 <Image 36 src="https://t3.ftcdn.net/jpg/05/16/27/58/360_F_516275801_f3Fsp17x6HQK0xQgDQEELoTuERO4SsWV.jpg" 37 style={{ 38 height: "5em", 39 borderRadius: "50%", 40 maxWidth: "100%", 41 }} 42 className="m-auto" 43 ></Image> 44 </Col> 45 <Col className="d-flex justify-content-center"> 46 <Container className="pt-2" style={{ textAlign: "left" }}> 47 <h4>{data.transportName}</h4> 48 <h5>{data.carBrand + " " + data.carType}</h5> 49 </Container> 50 </Col> 51 </Row> 52 </Col> 53 </Row> 54 <Row> 55 {data && <TransportEditTab displayRoute={data} refresh={setChanged}/>} 56 </Row> 57 </Container> 58 )} 59 </> 60 ); 63 61 }; 64 62 -
frontend/src/axios.js
re6c2521 r5528b99 1 1 import axios from "axios"; 2 3 2 4 3 const instance = axios.create({ 5 4 baseURL: "http://localhost:8080/", 6 5 withCredentials: true, 7 maxRedirects: 1, 8 beforeRedirect: (options, { headers }) => { 9 console.log(options) 10 if (options.hostname === "example.com") { 11 options.auth = "user:password"; 12 }} 13 6 maxRedirects: 1 14 7 }) 15 8 9 instance.interceptors.response.use(function (response) { 10 // Any status code that lie within the range of 2xx cause this function to trigger 11 // Do something with response data 12 return response; 13 }, function (error) { 14 console.log(error) 15 // window.location.href="/login" 16 // Any status codes that falls outside the range of 2xx cause this function to trigger 17 // Do something with response error 18 return Promise.reject(error); 19 }); 20 16 21 export default instance
Note:
See TracChangeset
for help on using the changeset viewer.