- Timestamp:
- 01/13/24 23:19:50 (11 months ago)
- Branches:
- master
- Children:
- e85a562
- Parents:
- e9b4ba9
- Location:
- frontend
- Files:
-
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
frontend/package-lock.json
re9b4ba9 rac19a0c 13 13 "@testing-library/user-event": "^13.5.0", 14 14 "axios": "^1.5.0", 15 "axios-extensions": "^3.1.6", 15 16 "bootstrap": "^5.3.0", 16 17 "file-loader": "^6.2.0", … … 5349 5350 } 5350 5351 }, 5352 "node_modules/axios-extensions": { 5353 "version": "3.1.6", 5354 "resolved": "https://registry.npmjs.org/axios-extensions/-/axios-extensions-3.1.6.tgz", 5355 "integrity": "sha512-CmwMYxxAw4DcQDJ7/2Iv4GJj1Ao48lJEPieycgZQH6m1KcYZqf9zm2HM/CsULqheCpYxZbiGrCfZf5tVjXqoLg==", 5356 "dependencies": { 5357 "lru-cache": "^7.14.0", 5358 "tslib": "^2.1.0", 5359 "util": "^0.12.3" 5360 }, 5361 "peerDependencies": { 5362 "axios": "*" 5363 } 5364 }, 5365 "node_modules/axios-extensions/node_modules/lru-cache": { 5366 "version": "7.18.3", 5367 "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", 5368 "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", 5369 "engines": { 5370 "node": ">=12" 5371 } 5372 }, 5351 5373 "node_modules/axios/node_modules/form-data": { 5352 5374 "version": "4.0.0", … … 9425 9447 "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", 9426 9448 "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", 9427 "peer": true,9428 9449 "dependencies": { 9429 9450 "call-bind": "^1.0.2", … … 9564 9585 "engines": { 9565 9586 "node": ">=6" 9587 } 9588 }, 9589 "node_modules/is-generator-function": { 9590 "version": "1.0.10", 9591 "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", 9592 "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", 9593 "dependencies": { 9594 "has-tostringtag": "^1.0.0" 9595 }, 9596 "engines": { 9597 "node": ">= 0.4" 9598 }, 9599 "funding": { 9600 "url": "https://github.com/sponsors/ljharb" 9566 9601 } 9567 9602 }, … … 16800 16835 } 16801 16836 }, 16837 "node_modules/util": { 16838 "version": "0.12.5", 16839 "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", 16840 "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", 16841 "dependencies": { 16842 "inherits": "^2.0.3", 16843 "is-arguments": "^1.0.4", 16844 "is-generator-function": "^1.0.7", 16845 "is-typed-array": "^1.1.3", 16846 "which-typed-array": "^1.1.2" 16847 } 16848 }, 16802 16849 "node_modules/util-deprecate": { 16803 16850 "version": "1.0.2", -
frontend/package.json
re9b4ba9 rac19a0c 8 8 "@testing-library/user-event": "^13.5.0", 9 9 "axios": "^1.5.0", 10 "axios-extensions": "^3.1.6", 10 11 "bootstrap": "^5.3.0", 11 12 "file-loader": "^6.2.0", -
frontend/src/App.js
re9b4ba9 rac19a0c 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"; 31 35 32 36 33 37 function App() { 34 38 35 return ( 36 <div className="App" style={{overflow: 'hidden'}}> 37 <BrowserRouter> 38 <Routes> 39 <Route path='/login' element={<LoginPage/>}/> 40 <Route path='/register' element={<RegistrationPage/>}/> 41 <Route path='/profile' element={<ProfilePage/>}/> 42 <Route path="/resources" exact element={<NoBusinessRegisteredError hasRegistration="false"/>} /> 43 <Route path="/resources/hotel" element={<ResourcesPage tab="/hotel"/>}/> 44 <Route path="/resources/hotel/:hotelId" element={<HotelEditPage />}/> 45 <Route path="/resources/restaurant" element={<ResourcesPage tab="/restaurant"/>}/> 46 <Route path='/resources/restaurant/:restaurantId' element={<RestaurantEditPage />}/> 47 <Route path="/resources/transport" element={<ResourcesPage tab="/transport"/>}/> 48 <Route path="/resources/transport/:transportId" element={<TransportEditPage/>}/> 49 <Route path="/home" element={<HomePage/> }/> 50 <Route path="/error" element={<LoginErrorPage/> }/> 51 <Route path='/details/transport' element={<TransportDetailsPage></TransportDetailsPage>}/> 52 <Route path='/details/hotel' element={<HotelDetailsPage></HotelDetailsPage>}/> 53 <Route path='/details/restaurant' element={<RestaurantDetailsPage></RestaurantDetailsPage>}/> 54 <Route path="/search/hotel/:hotelLocation/:dateFrom/:dateTo/:numBeds" element={<SearchPage type="hotel"/> }/> 55 <Route path="/search/transport/:from/:to/:date" element={<SearchPage type="transport"/> }/> 56 </Routes> 57 </BrowserRouter> 58 </div> 59 ); 39 return ( 40 <div className="App" style={{overflow: 'hidden'}}> 41 <AuthProvider> 42 <BrowserRouter> 43 <Routes> 44 <Route path='/login' element={<LoginPage/>}/> 45 <Route path='/register' element={<RegistrationPage/>}/> 46 <Route path='/profile' element={<PrivateRoute><ProfilePage/></PrivateRoute>}/> 47 <Route path='/profiles' element={<PrivateRoute><ProfilesManagementPage/></PrivateRoute>}/> 48 <Route path='/reservations' element={<PrivateRoute><UserReservationsManagement/></PrivateRoute>}/> 49 <Route path="/resources" exact element={<PrivateRoute><NoBusinessRegisteredError 50 hasRegistration="false"/></PrivateRoute>}/> 51 <Route path="/resources/hotel" 52 element={<PrivateRoute><ResourcesPage tab="/hotel"/></PrivateRoute>}/> 53 <Route path="/resources/hotel/:hotelId" element={<PrivateRoute><HotelEditPage/></PrivateRoute>}/> 54 <Route path="/resources/restaurant" 55 element={<PrivateRoute><ResourcesPage tab="/restaurant"/></PrivateRoute>}/> 56 <Route path='/resources/restaurant/:restaurantId' 57 element={<PrivateRoute><RestaurantEditPage/></PrivateRoute>}/> 58 <Route path="/resources/transport" 59 element={<PrivateRoute><ResourcesPage tab="/transport"/></PrivateRoute>}/> 60 <Route path="/resources/transport/:transportId" 61 element={<PrivateRoute><TransportEditPage/></PrivateRoute>}/> 62 <Route path="/home" element={<HomePage/>}/> 63 <Route path="/error" element={<LoginErrorPage/>}/> 64 <Route path='/details/transport' element={<TransportDetailsPage></TransportDetailsPage>}/> 65 <Route path='/details/hotel' element={<HotelDetailsPage></HotelDetailsPage>}/> 66 <Route path='/details/restaurant' element={<RestaurantDetailsPage></RestaurantDetailsPage>}/> 67 <Route path="/search/hotel/:hotelLocation/:dateFrom/:dateTo/:numBeds" 68 element={<SearchPage type="hotel"/>}/> 69 <Route path="/search/transport/:from/:to/:date/:numPassengers" 70 element={<SearchPage type="transport"/>}/> 71 </Routes> 72 </BrowserRouter> 73 </AuthProvider> 74 </div> 75 ); 60 76 } 61 77 -
frontend/src/Components/Forms/AddHotelForm.js
re9b4ba9 rac19a0c 119 119 return prevState + 1; 120 120 }) 121 if(!edit) 122 props.closeModal() 121 123 }} 122 124 > -
frontend/src/Components/Forms/AddRestaurantForm.js
re9b4ba9 rac19a0c 85 85 return prevState + 1; 86 86 }) 87 props.closeModal() 87 88 }} 88 89 > -
frontend/src/Components/Forms/AddRoomForm.js
re9b4ba9 rac19a0c 13 13 hotelRoomDescription: "", 14 14 hotelRoomName: "", 15 num Beds: "",15 numOfBeds: "", 16 16 price: "", 17 17 kitchenAvailable: false, … … 58 58 type="number" 59 59 placeholder="Внесете го бројот на кревети" 60 value={formData.num Beds}61 name="num Beds"60 value={formData.numOfBeds} 61 name="numOfBeds" 62 62 onChange={onFormChange} 63 63 /> … … 117 117 style={{ backgroundColor: "#159895" }} 118 118 size="md" 119 onClick={() => { 120 console.log(formData); 119 onClick={(e) => { 120 e.preventDefault(); 121 props.refresh((prev) => { 122 return ++prev; 123 }) 121 124 createHotelRoom(formData); 125 props.closeModal(); 122 126 }} 123 127 > -
frontend/src/Components/Forms/AddTransportForm.js
re9b4ba9 rac19a0c 11 11 transportName: "", 12 12 carBrand: "", 13 carType: false,13 carType: "", 14 14 carManufacturedYear: 1900, 15 15 noPassengers: 0, … … 107 107 createTransport(formData, edit); 108 108 props.refresh((prev) => { 109 return prev + 1;109 return ++prev; 110 110 }) 111 if(!edit) 112 props.closeModal() 111 113 }} 112 114 > -
frontend/src/Components/Forms/EditRoomForm.js
re9b4ba9 rac19a0c 28 28 } = useGet(`/hotel/rooms/${props.room.hotelRoomId}/available`) 29 29 30 console.log(`/hotel/rooms/${props.room.hotelRoomId}/available`) 31 30 32 !isLoading && console.log(data) 31 33 … … 42 44 <tr> 43 45 <th>#</th> 44 <th>Достапно од</th> 45 <th>Достапно до</th> 46 <th>Број на соби</th> 46 <th>Oд</th> 47 <th>До</th> 48 <th>Време на тргнување</th> 49 <th>Време на пристигнување</th> 50 <th>Цена</th> 47 51 </tr> 48 52 </thead> -
frontend/src/Components/Hooks/Hotel/useCreateHotel.js
re9b4ba9 rac19a0c 6 6 const useCreateHotel = () => { 7 7 8 //const history = useNavigate();9 8 const createHotel = async (hotel, edit) => { 10 9 console.log({hotel}) 11 10 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: localStorage.getItem("userId")18 userId: JSON.parse(localStorage.getItem("user")).userId 19 19 } 20 20 }) -
frontend/src/Components/Hooks/Restaurant/useCreateRestaurant.js
re9b4ba9 rac19a0c 15 15 .post(`/restaurant/add`, restaurant, { 16 16 params: { 17 userId: localStorage.getItem('userId')17 userId: JSON.parse(localStorage.getItem('user')).userId, 18 18 } 19 19 }) -
frontend/src/Components/Hooks/Transport/useCreateTransport.js
re9b4ba9 rac19a0c 4 4 5 5 const useCreateTransport = () => { 6 6 const userId = JSON.parse(localStorage.getItem('user')).userId 7 7 const createTransport = async (transport, edit) => { 8 8 if(!edit) 9 9 { 10 10 await axios 11 .post(`/transport/add `, transport)11 .post(`/transport/add/` + userId, transport) 12 12 .then((res) => { 13 13 //history.push('/transport'); -
frontend/src/Components/Hooks/User/useLogin.js
re9b4ba9 rac19a0c 4 4 import { Navigate, useAsyncValue, useNavigate } from "react-router-dom"; 5 5 import LoginForm from "../../Login/LoginForm.js"; 6 import {useAuth} from "../../Context/AuthContext"; 6 7 7 8 const useLogin = () => { 8 9 9 10 const navigator = useNavigate() 11 const Auth = useAuth(); 10 12 //const history = useNavigate(); 11 13 const login = async (loginData) => { … … 22 24 }) 23 25 .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 } 24 41 const sessionId = res.data.auth.details.sessionId; 25 42 const userId = res.data.auth.principal.userID; 26 43 27 44 localStorage.setItem("sessionId", sessionId); 28 45 localStorage.setItem("userId", userId); -
frontend/src/Components/Hooks/useGet.js
re9b4ba9 rac19a0c 12 12 console.log("url od get " + uurl) 13 13 await axios. 14 get(uurl ).then((res) => {14 get(uurl, {maxRedirects: 0}).then((res) => { 15 15 setData(res.data); 16 }).catch((err ) => {17 console.log(err )16 }).catch((error) => { 17 console.log(error) 18 18 }) 19 19 .finally(() => { … … 26 26 getData(url); 27 27 }, [dep, url, changed]); 28 28 29 29 return { 30 30 data, -
frontend/src/Components/HotelEdit/HotelEditTab.js
re9b4ba9 rac19a0c 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"; 12 15 13 16 function HotelEditTab(props) { 14 const [activeTab, setActiveTab] = useState("/hotel");15 const [modalData, setModalData] = useState("");16 const [show, setShow] = useState(false);17 const [activeTab, setActiveTab] = useState("/hotel"); 18 const [modalData, setModalData] = useState(""); 19 const [show, setShow] = useState(false); 17 20 18 const handleClose = () => setShow(false); 19 const handleShow = () => { 20 //e.preventDefault(); 21 setShow(true); 21 console.log(props) 22 22 23 }; 23 const { 24 data, 25 isLoading, 26 setData, 27 getData, 28 setChanged 29 } = useGet(`/hotel/${props.displayRoom.hotelId}/reservations/active`) 24 30 25 const showModal = (modalData) => { 26 setModalData(modalData); 27 handleShow(); 28 } 29 console.log(props.displayRoom) 31 !isLoading && console.log(data) 30 32 31 const handleSelect = (eventKey) => { 32 setActiveTab(eventKey); 33 }; 33 const handleClose = () => setShow(false); 34 const handleShow = () => { 35 //e.preventDefault(); 36 setShow(true); 34 37 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"> 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"> 51 66 <span className="ikona"> 52 67 <FaHotel 53 color="#159895"54 style={{ lineHeight: "100em"}}55 size={"1.5em"}56 className="mx-3"68 color="#159895" 69 style={{lineHeight: "100em"}} 70 size={"1.5em"} 71 className="mx-3" 57 72 /> 58 73 </span> 59 <span className="ikona">Соби</span>60 </Nav.Link>61 </Nav.Item>62 <Nav.Item className="tab_item">63 <Nav.Link eventKey="/restaurant">74 <span className="ikona">Соби</span> 75 </Nav.Link> 76 </Nav.Item> 77 <Nav.Item className="tab_item"> 78 <Nav.Link eventKey="/restaurant"> 64 79 <span className="ikona"> 65 <MdOutlineStickyNote2 color="#159895" size={"1.5em"} className="mx-3" 80 <MdOutlineStickyNote2 color="#159895" size={"1.5em"} className="mx-3"/> 66 81 </span> 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">82 <span className="ikona">Резервации</span> 83 </Nav.Link> 84 </Nav.Item> 85 <Nav.Item className="tab_item rounded-5"> 86 <Nav.Link eventKey="/transport" className="text-left rounded-5"> 72 87 <span className="ikona"> 73 <BiData color="#159895" size={"1.5em"} className="mx-3" 88 <BiData color="#159895" size={"1.5em"} className="mx-3"/> 74 89 </span> 75 <span className="ikona">Општи податоци</span>76 </Nav.Link>77 </Nav.Item>78 </Nav>90 <span className="ikona">Општи податоци</span> 91 </Nav.Link> 92 </Nav.Item> 93 </Nav> 79 94 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 ); 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 ); 98 118 } 99 119 -
frontend/src/Components/Layout/Navbar/Navigation.js
re9b4ba9 rac19a0c 7 7 import useGet from "../../Hooks/useGet"; 8 8 import axios from "../../../axios.js"; 9 import {useAuth} from "../../Context/AuthContext"; 9 10 //import logo from 'assets/images/logo.png'; 10 11 //src="https://upload.wikimedia.org/wikipedia/commons/0/08/Vergina_Sun_-_Golden_Larnax.png" … … 12 13 function Navigation(props) { 13 14 const navigator = useNavigate(); 14 15 const { data, setData, isLoading, getData } = useGet("/username"); 16 15 const Auth = useAuth(); 16 const isLoggedIn = Auth.userIsAuthenticated(); 17 17 return ( 18 18 <> … … 24 24 > 25 25 <Container> 26 <Navbar.Brand href=" #home">26 <Navbar.Brand href="/home"> 27 27 <span className="ikona"> 28 28 <Image … … 50 50 Pricing 51 51 </Nav.Link> 52 {!isLo ading && !data&& (52 {!isLoggedIn && ( 53 53 <Button 54 54 className="m-2" … … 62 62 </Button> 63 63 )} 64 { !isLoading && data&& (64 {isLoggedIn && ( 65 65 <> 66 66 <Nav.Link className="m-2" href="/profile"> 67 { data}67 {Auth.getUser().username} 68 68 </Nav.Link> 69 69 <Button … … 74 74 await axios.get("/logout") 75 75 .then((res) => { 76 console.log(res) 76 console.log(res); 77 Auth.userLogout(); 77 78 }) 78 79 .catch((err) => { -
frontend/src/Components/Resources/AddNew.js
re9b4ba9 rac19a0c 56 56 </Modal.Header> 57 57 <Modal.Body> 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}/>}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}/>} 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
re9b4ba9 rac19a0c 31 31 </Modal.Header> 32 32 <Modal.Body> 33 {props.type === "hotel" && <AddHotelForm />}33 {props.type === "hotel" && <AddHotelForm refresh={props.refresh}/>} 34 34 {props.type === "room" && <EditRoomForm refresh={props.refresh} room={props.room}/>} 35 35 {props.type === "restaurant" && <AddRestaurantForm edit="false" refresh={props.refresh}/>} -
frontend/src/Components/Resources/ResourceListing.js
re9b4ba9 rac19a0c 6 6 7 7 const ResourceListing = (props) => { 8 9 console.log("props " + props.id)10 11 8 12 9 const type = props.type == "hotel" ? "сместувањето" : props.type == "restaurant" ? "ресторанот" : "превозот"; 13 10 const name = props.type == "hotel" ? props.data.hotelName : props.type == "restaurant" ? props.data.restaurantName : props.data.transportName 14 const id = props.type == "hotel" ? props.data.hotelId : props.type == "restaurant" ? props.data.resturantId : props.data.transportID 15 return(<> 11 const id = props.type == "hotel" ? props.data.hotelId : props.type == "restaurant" ? props.data.restaurantID : props.data.transportID 12 console.log(props.data) 13 return(<> 16 14 <a href={`${props.type}/${id}`} style={{textDecoration: "none", color:"black"}}> 17 15 <Container className="py-3 px-1 my-4" -
frontend/src/Components/Resources/ResourcesTab.js
re9b4ba9 rac19a0c 11 11 function ResourcesTab(props) { 12 12 const [activeTab, setActiveTab] = useState(props.tab); 13 // const [changed, setChanged] = useState(0); 14 const userId = localStorage.getItem("userId"); 13 const userId = JSON.parse(localStorage.getItem("user")).userId; 15 14 const { data, setData, isLoading, getData, setChanged } = useGet(`${props.tab}/user/${userId}`); 16 15 17 16 const handleSelect = (eventKey) => { 18 17 setActiveTab(eventKey); 19 console.log(props.refresh);20 18 props.refresh(eventKey); 21 console.log("refresh" + eventKey);22 19 }; 23 24 !isLoading && console.log(data);25 console.log(props.tab);26 20 27 21 return ( … … 78 72 data.map((hotel) => { 79 73 return ( 80 <Link key={hotel.hotelId} to={"/resources/hotel/" + hotel.hotelId}>74 <Link style={{textDecoration: "none"}} key={hotel.hotelId} to={"/resources/hotel/" + hotel.hotelId}> 81 75 <ResourceListing 82 76 key={hotel.hotelId} … … 93 87 {props.tab == "/restaurant" && !isLoading && data != null && 94 88 data.map((restaurant) => { 95 console.log("mapiranje " + restaurant)96 89 return ( 97 <Link key={restaurant.restaurantId} to={"/resources/restaurant/" + restaurant.restaurantID}>98 90 <ResourceListing 99 key={restaurant.restaurantI d}91 key={restaurant.restaurantID} 100 92 type="restaurant" 101 93 data={restaurant} 102 /> 103 </Link> 104 ); 94 />); 105 95 })} 106 96 <AddNew type="restaurant" refresh={setChanged}/> -
frontend/src/Components/RestaurantEdit/RestaurantEditTab.js
re9b4ba9 rac19a0c 100 100 return <MenuListing key={menu.menuId} data={menu} showModal={showModal}/> 101 101 })} 102 {activeTab === '/hotel' && <EditModal show={show} handleClose={handleClose} type="menu" menu={modalData}></EditModal>}102 {activeTab === '/hotel' && <EditModal show={show} refresh={props.refresh} 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
re9b4ba9 rac19a0c 2 2 import { Container, Form, Button, Row, Col } from "react-bootstrap"; 3 3 import useFormData from "../Hooks/useFormData"; 4 import SearchCriteriasHotel from "./SearchCriteriasHotel"; 5 import SearchCriteriasTransport from "./SearchCriteriasTransport"; 4 6 5 const SearchCriterias = (props) => {7 const SearchCriteriasBar = (props) => { 6 8 7 const { formData, onFormChange, onCheckBoxChange, setFormData} = useFormData(props.criterias) 8 console.log("KRITERIUMI") 9 console.log(formData) 9 const { criterias, type } = props 10 10 11 return ( 12 <> 13 <Container 14 className="p-1 pb-0 mb-5 mt-3 rounded-2" 15 style={{ backgroundColor: "#002B5B", width: "65%"}} 16 > 17 <Form className="rounded-5"> 18 <Row className="gx-1"> 19 <Col> 20 <Form.Floating className="mb-3"> 21 <Form.Control 22 size="md" 23 type="text" 24 placeholder="Каде ќе патувате?:" 25 id="location" 26 name="hotelLocation" 27 onChange={onFormChange} 28 value={formData.hotelLocation} 29 ></Form.Control> 30 <label htmlFor="location">Локација:</label> 31 </Form.Floating> 32 </Col> 33 <Col> 34 <Form.Floating className="mb-3"> 35 <Form.Control 36 size="md" 37 type="date" 38 placeholder="Датум на пристигнување:" 39 id="dateFrom" 40 name="dateFrom" 41 onChange={onFormChange} 42 value={formData.dateFrom} 43 ></Form.Control> 44 <label htmlFor="dateFrom">Датум на пристигнување:</label> 45 </Form.Floating> 46 </Col> 47 <Col> 48 <Form.Floating className="mb-3"> 49 <Form.Control 50 size="md" 51 type="date" 52 placeholder="Датум на заминување:" 53 id="dateTo" 54 name="dateTo" 55 onChange={onFormChange} 56 value={formData.dateTo} 57 ></Form.Control> 58 <label htmlFor="dateTo">Датум на заминување:</label> 59 </Form.Floating> 60 </Col> 61 <Col> 62 <Form.Floating className="mb-3"> 63 <Form.Control 64 size="md" 65 type="number" 66 placeholder="Број на гости:" 67 id="floatingPassengers" 68 name="numBeds" 69 onChange={onFormChange} 70 value={formData.numBeds} 71 ></Form.Control> 72 <label htmlFor="floatingPassengers">Број на гости:</label> 73 </Form.Floating> 74 </Col> 75 <Col> 76 <Form.Group className="my-1"> 77 <Button 78 type="submit" 79 style={{ backgroundColor: "#159895" }} 80 size="lg" 81 className="w-100" 82 onClick={(e) => { 83 e.preventDefault(); 84 window.location.href = `/search/hotel/${formData.hotelLocation}/${formData.dateFrom}/${formData.dateTo}/${formData.numBeds}` 85 }} 86 > 87 <span className="ikona mx-3">Пребарај</span> 88 </Button> 89 </Form.Group> 90 </Col> 91 </Row> 92 </Form> 93 </Container> 94 </> 95 ); 96 }; 11 return ( 12 <> 13 {type === 'hotel' && <SearchCriteriasHotel criterias={criterias}/>} 14 {type === 'transport' && <SearchCriteriasTransport criterias={criterias}/>} 15 </> 16 ) 17 } 97 18 98 export default SearchCriterias ;19 export default SearchCriteriasBar; -
frontend/src/Components/Tab/TabFormTransport.js
re9b4ba9 rac19a0c 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"; 4 5 5 6 function TabFormTransport() { 7 8 const { formData, onFormChange, setFormData } = useFormData({ 9 from: undefined, 10 to: undefined, 11 date: undefined, 12 numPassengers: 0 13 }) 14 6 15 return ( 7 16 <Form> … … 14 23 placeholder="Од:" 15 24 id="floatingFrom" 25 value={formData.from} 26 name={'from'} 27 onChange={onFormChange} 16 28 ></Form.Control> 17 29 <label htmlFor="floatingFrom">Од:</label> … … 25 37 placeholder="До:" 26 38 id="floatingTo" 39 name={'to'} 40 value={formData.to} 41 onChange={onFormChange} 27 42 ></Form.Control> 28 43 <label htmlFor="floatingTo">До:</label> … … 36 51 placeholder="Датум:" 37 52 id="floatingDate" 53 name={'date'} 54 value={formData.date} 55 onChange={onFormChange} 38 56 ></Form.Control> 39 57 <label htmlFor="floatingDate">Датум:</label> … … 46 64 type="number" 47 65 placeholder="Број на патници:" 66 name={'numPassengers'} 48 67 id="floatingPassengers" 68 value={formData.numPassengers} 69 onChange={onFormChange} 49 70 ></Form.Control> 50 71 <label htmlFor="floatingPassengers">Број на патници:</label> 51 72 </Form.Floating> 52 73 <Form.Group className="my-1"> 53 <Button type="submit" style={{backgroundColor: "#159895"}} size="lg"> 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 }}> 54 78 <span className="ikona my-1"><HiMagnifyingGlass/></span> 55 79 <span className="ikona mx-3">Пребарај</span> -
frontend/src/Components/TransportDetails/FinalPoint.js
re9b4ba9 rac19a0c 17 17 <> 18 18 <Row> 19 {props.left === "true" && <Col className="d-flex flex-column justify-content-center col- auto" style={{paddingLeft: "2.6rem"}}>19 {props.left === "true" && <Col className="d-flex flex-column justify-content-center col-md-4" style={{paddingLeft: "2.6rem"}}> 20 20 <h5 className="m-auto">{getTimeAsString(props.time)}</h5> 21 21 </Col> } -
frontend/src/Components/TransportDetails/Line.js
re9b4ba9 rac19a0c 2 2 3 3 const Line = (props) => { 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"}) 4 const left = props.left === "true" ? "1.8rem" : "1.85rem"; 7 5 return (<> 8 6 <div style={{borderLeft: "5px solid #159895", height: "3em", marginLeft: left, marginTop: "-1.4rem", marginBottom: "-1.4rem"}}></div> -
frontend/src/Components/TransportDetails/Waypoint.js
re9b4ba9 rac19a0c 17 17 <> 18 18 <Row className="d-flex flex-row gap-0"> 19 {props.left === "true" && <Col className="d-flex flex-column justify-content-center col- auto" style={{paddingLeft: "2.6rem"}}>19 {props.left === "true" && <Col className="d-flex flex-column justify-content-center col-md-4" style={{paddingLeft: "2.6rem"}}> 20 20 <h5 style={{color: props.routes === "true" ? "white" : "" }} className="m-auto">{getTimeAsString(props.time)}</h5> 21 21 </Col>} … … 30 30 </Col>} 31 31 </Row> 32 <Row> 33 <Line left={props.left}> </Line> 34 </Row> 32 <Row className="d-flex flex-row gap-0"> 33 {props.left === "true" && <Col className="d-flex flex-column justify-content-center col-md-4" style={{paddingLeft: "2.6rem"}}> 34 35 </Col>} 36 <Col md="auto"> 37 <Line left={props.left}> </Line> 38 </Col> 39 <Col className="d-flex flex-column justify-content-center"> 40 </Col> 41 {props.left !== "true" && <Col className="d-flex flex-column justify-content-center"> 42 43 </Col>} 44 </Row> 45 {/*<Row>*/} 46 {/*<Line left={props.left}> </Line>*/} 47 {/*</Row>*/} 35 48 </> 36 49 ); -
frontend/src/Components/TransportEdit/TransportEditTab.js
re9b4ba9 rac19a0c 12 12 function TransportEditTab(props) { 13 13 const [activeTab, setActiveTab] = useState("/hotel"); 14 const link = "/transport/" + props.displayRoute.transportID + "/available";15 14 console.log(props.displayRoute) 16 const [changed, setChanged] = useState(0)17 const { data, setData, isLoading, getData } = useGet(link, changed);18 15 19 16 -
frontend/src/Components/TransportEdit/TransportListing.js
re9b4ba9 rac19a0c 9 9 10 10 //const type = props.type == "hotel" ? "сместувањето" : props.type == "restaurant" ? "ресторанот" : "превозот"; 11 console.log(props.data)12 console.log(props.data.from)13 11 return (<> 14 12 <a href="#" style={{textDecoration: "none", color: "black"}}> … … 34 32 <Col className="d-flex flex-column justify-content-center" style={{textAlign: "left"}}> 35 33 <h2>{props.data.from} - {props.data.to}</h2> 36 {/* <h6>{props.data.routeCities}</h6> */}37 34 <h6>{props.data.routes.map(x => x).join(", ")}</h6> 38 35 </Col> … … 40 37 <Col className="d-flex flex-column justify-content-center align-content-center"> 41 38 <h5>Цена:</h5> 42 {/* <h4>{props.data.routePrice}</h4> */} 43 <h4>99$</h4> 39 <h4>{props.data.maxPrice}$</h4> 44 40 </Col> 45 41 </Row> -
frontend/src/Components/useFormNested.js
re9b4ba9 rac19a0c 7 7 console.log(e) 8 8 9 const dependantRoutes = e.target. parentElement.getAttribute('dependantRoutes').split(',')9 const dependantRoutes = e.target.name === 'freeSpace' ? e.target.parentElement.getAttribute('dependantRoutes').split(',') : undefined; 10 10 console.log(dependantRoutes) 11 11 -
frontend/src/Pages/HotelDetailsPage.js
re9b4ba9 rac19a0c 1 1 import React from "react"; 2 2 import LoginForm from "../Components/Login/LoginForm"; 3 import { Container, Row, Col, Form} from "react-bootstrap";3 import {Container, Row, Col, Form, FloatingLabel} from "react-bootstrap"; 4 4 import Navigation from "../Components/Layout/Navbar/Navigation"; 5 5 import Carousel from "react-bootstrap/Carousel"; … … 69 69 placeholder="Каде ќе патувате?:" 70 70 id="location" 71 value={data.hotelLocation} 71 72 ></Form.Control> 72 <label htmlFor="location">Локација:</label>73 <label style={{left: "10px"}} htmlFor="location">Локација:</label> 73 74 </Form.Floating> 74 75 </Row> … … 80 81 placeholder="Датум на пристигнување:" 81 82 id="dateFrom" 83 value={from} 82 84 ></Form.Control> 83 <label htmlFor="dateFrom">Датум на пристигнување:</label>85 <label style={{left: "10px"}} htmlFor="dateFrom">Датум на пристигнување:</label> 84 86 </Form.Floating> 85 87 </Row> … … 91 93 placeholder="Датум на заминување:" 92 94 id="dateTo" 95 value={to} 93 96 ></Form.Control> 94 <label htmlFor="dateTo">Датум на заминување:</label>97 <label style={{left: "10px"}} htmlFor="dateTo">Датум на заминување:</label> 95 98 </Form.Floating> 96 99 </Row> … … 103 106 id="floatingPassengers" 104 107 ></Form.Control> 105 <label htmlFor="floatingPassengers">Број на гости:</label>108 <label style={{left: "10px"}} htmlFor="floatingPassengers">Број на гости:</label> 106 109 </Form.Floating> 107 110 </Row> -
frontend/src/Pages/HotelEditPage.js
re9b4ba9 rac19a0c 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 { useParams } from "react-router-dom"; 7 import {Navigate, useParams} from "react-router-dom"; 8 import {useAuth} from "../Components/Context/AuthContext"; 8 9 9 10 10 11 const HotelEditPage = () => { 11 12 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);13 const params = useParams(); 14 const link = "/hotel/list/" + params.hotelId; 15 const [changed, setChanged] = useState(0) 16 const {data, setData, isLoading, getData} = useGet(link, changed); 16 17 17 18 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 <Col30 className="d-flex justify-content-center"31 style={{ maxWidth: "30%"}}32 >33 <Image34 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 );19 console.log(data) 20 return ( 21 <> 22 <Navigation/> 23 {!isLoading && <Container> 24 <Row className="mb-5"> 25 <h2 style={{color: "#159895", textAlign: "left"}}>Мои ресурси</h2> 26 </Row> 27 <Row className="mb-5"> 28 <Col> 29 <Row className="d-flex mb-3"> 30 <Col 31 className="d-flex justify-content-center" 32 style={{maxWidth: "30%"}} 33 > 34 <Image 35 src="https://t3.ftcdn.net/jpg/05/16/27/58/360_F_516275801_f3Fsp17x6HQK0xQgDQEELoTuERO4SsWV.jpg" 36 style={{ 37 height: "5em", 38 borderRadius: "50%", 39 maxWidth: "100%", 40 }} 41 className="m-auto" 42 ></Image> 43 </Col> 44 <Col className="d-flex justify-content-center"> 45 <Container className="pt-2" style={{textAlign: "left"}}> 46 <h4>{data.hotelName}</h4> 47 <h5>{data.hotelLocation}</h5> 48 </Container> 49 </Col> 50 </Row> 51 </Col> 52 </Row> 53 <Row> 54 <HotelEditTab refresh={setChanged} displayRoom={data}/> 55 </Row> 56 </Container>} 57 </> 58 ); 58 59 }; 59 60 -
frontend/src/Pages/LoginErrorPage.js
re9b4ba9 rac19a0c 11 11 const [show, setShow] = useState(false); 12 12 const [changed, setChanged] = useState(0); 13 const {data, isLoading} = useGet("/username")14 13 const userId = localStorage.getItem("userId") 15 14 const [registered, setRegistered] = useState(false); -
frontend/src/Pages/LoginPage.js
re9b4ba9 rac19a0c 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 5 8 6 9 const LoginPage = () => { … … 8 11 document.body.style.marginTop = "auto"; 9 12 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 10 21 return ( 11 22 <> -
frontend/src/Pages/NoBusinessRegisteredError.js
re9b4ba9 rac19a0c 6 6 import RegisterBusinessForm from "../Components/Forms/RegisterBusinessForm"; 7 7 import useGet from "../Components/Hooks/useGet"; 8 import { useNavigate } from "react-router-dom"; 8 import {Navigate, useNavigate} from "react-router-dom"; 9 import {useAuth} from "../Components/Context/AuthContext"; 9 10 10 11 const NoBusinessRegisteredError = (props) => { 11 12 const [show, setShow] = useState(false); 12 13 const [changed, setChanged] = useState(0); 13 const {data, isLoading} = useGet("/username") 14 const Auth = useAuth(); 15 const isLoggedIn = Auth.userIsAuthenticated(); 14 16 const userId = localStorage.getItem("userId") 15 17 const [registered, setRegistered] = useState(false); … … 45 47 46 48 47 console.log(data) 49 if(!isLoggedIn) 50 { 51 return <Navigate to={'/login'}/> 52 } 48 53 49 !isLoading && !data && navigator("/login")50 54 !firmaIsLoading && firma && firma.length > 0 && firma[0].approved && navigator("/resources/hotel") 51 55 -
frontend/src/Pages/ProfilePage.js
re9b4ba9 rac19a0c 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"; 10 12 11 13 const ProfilePage = () => { 12 14 13 const { data, setData, isLoading, getData } = useGet("/principal");15 const { data, setData, isLoading, getData } = useGet("/principal"); 14 16 15 17 18 16 19 const profileData = { 17 20 "name": "Марко", … … 19 22 "address": "ул. Раскрсница бр. 10", 20 23 "dateOfBirth": "2002-01-01", 21 "country": " Никогаш Северна само МАКЕДОНИЈА",24 "country": "Македонија", 22 25 "zip": "1000", 23 26 "city": "Скопје", … … 27 30 28 31 32 29 33 return ( 30 34 <> 31 35 <Navigation /> 32 {!isLoading && <Container>36 {!isLoading && <Container> 33 37 <Row className="mb-5"> 34 38 <h2 style={{ color: "#159895", textAlign: "left" }}>Мојот профил</h2> -
frontend/src/Pages/ResourcesPage.js
re9b4ba9 rac19a0c 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"; 7 9 8 10 const ResourcesPage = (props) => { 9 11 10 console.log(props.tab)11 const { data, setData, isLoading, getData } = useGet("/principal");12 const Auth = useAuth(); 13 const user = Auth.getUser(); 12 14 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 ); 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 ); 53 54 }; 54 55 -
frontend/src/Pages/RestaurantEditPage.js
re9b4ba9 rac19a0c 6 6 import RestaurantEditTab from "../Components/RestaurantEdit/RestaurantEditTab"; 7 7 import useGet from "../Components/Hooks/useGet"; 8 import { useParams, useSearchParams } from "react-router-dom"; 8 import {Navigate, useParams, useSearchParams} from "react-router-dom"; 9 import {useAuth} from "../Components/Context/AuthContext"; 9 10 10 11 const RestaurantEditPage = () => { -
frontend/src/Pages/SearchPage.js
re9b4ba9 rac19a0c 11 11 import BecomeAHost from "../Components/BecomeAHost/BecomeAHost" 12 12 import HotelLisitng from "../Components/Listings/HotelListing" 13 import SearchCriterias from "../Components/SearchCriterias/SearchCriteriasBar";13 import SearchCriteriasHotel from "../Components/SearchCriterias/SearchCriteriasHotel"; 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 import SearchCriteriasBar from "../Components/SearchCriterias/SearchCriteriasBar"; 19 20 20 21 … … 36 37 } 37 38 38 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}` : ""39 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}` : "" 39 40 console.log(link) 40 41 const { data, isLoading, getData, setData } = useGet(link); … … 43 44 <> 44 45 <Navigation></Navigation> 45 <SearchCriterias criterias={useParams()}></SearchCriterias>46 <SearchCriteriasBar type={props.type} criterias={useParams()}></SearchCriteriasBar> 46 47 <Container className="d-flex justify-content-end gx-5" style={{maxWidth: "60%"}}> 47 48 <Row> -
frontend/src/Pages/TransportEditPage.js
re9b4ba9 rac19a0c 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 { useParams } from "react-router-dom"; 9 import {Navigate, useParams} from "react-router-dom"; 10 import {useAuth} from "../Components/Context/AuthContext"; 10 11 11 12 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);17 13 18 !isLoading && console.log(data)14 const params = useParams(); 19 15 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 ); 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 ); 61 63 }; 62 64 -
frontend/src/axios.js
re9b4ba9 rac19a0c 1 1 import axios from "axios"; 2 2 3 3 4 const instance = axios.create({ 4 5 baseURL: "http://localhost:8080/", 5 6 withCredentials: true, 6 maxRedirects: 1 7 maxRedirects: 1, 8 beforeRedirect: (options, { headers }) => { 9 console.log(options) 10 if (options.hostname === "example.com") { 11 options.auth = "user:password"; 12 }} 13 7 14 }) 8 15 9 instance.interceptors.response.use(function (response) {10 // Any status code that lie within the range of 2xx cause this function to trigger11 // Do something with response data12 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 trigger17 // Do something with response error18 return Promise.reject(error);19 });20 21 16 export default instance
Note:
See TracChangeset
for help on using the changeset viewer.