- Timestamp:
- 01/24/24 17:42:28 (10 months ago)
- Branches:
- master
- Children:
- 0f5aa27
- Parents:
- 5528b99
- Location:
- frontend
- Files:
-
- 66 edited
Legend:
- Unmodified
- Added
- Removed
-
frontend/package-lock.json
r5528b99 r07f4e8b 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
r5528b99 r07f4e8b 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
r5528b99 r07f4e8b 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 <<<<<<< HEAD36 39 return ( 37 40 <div className="App" style={{overflow: 'hidden'}}> … … 62 65 <Route path='/details/hotel' element={<HotelDetailsPage></HotelDetailsPage>}/> 63 66 <Route path='/details/restaurant' element={<RestaurantDetailsPage></RestaurantDetailsPage>}/> 64 <Route path="/search/hotel/:hotelLocation/:dateFrom/:dateTo/:numBeds "67 <Route path="/search/hotel/:hotelLocation/:dateFrom/:dateTo/:numBeds/:flexible" 65 68 element={<SearchPage type="hotel"/>}/> 66 69 <Route path="/search/transport/:from/:to/:date/:numPassengers" … … 73 76 </div> 74 77 ); 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)102 78 } 103 79 -
frontend/src/Components/AdminPanel/AllProfilesTable.js
r5528b99 r07f4e8b 52 52 {f.accountNonLocked && 53 53 <FaLock size={'2.2em'} color={'#159895'} onClick={() => { 54 approveProfile('/users/ lock/' + f.userID).then(() => {54 approveProfile('/users/unlock/' + f.userID).then(() => { 55 55 setChanged((prev) => { 56 56 return Math.random(); -
frontend/src/Components/Forms/AddHotelForm.js
r5528b99 r07f4e8b 119 119 return prevState + 1; 120 120 }) 121 if(!edit) 122 props.closeModal() 121 123 }} 122 124 > -
frontend/src/Components/Forms/AddRestaurantForm.js
r5528b99 r07f4e8b 82 82 e.preventDefault() 83 83 createRestaurant(formData, edit); 84 props.refresh((prevState) => { 85 return prevState + 1; 86 }) 84 props.refresh(Math.random()) 85 if(!edit) props.closeModal() 87 86 }} 88 87 > -
frontend/src/Components/Forms/AddRoomForm.js
r5528b99 r07f4e8b 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/AddTableAvailabilityForm.js
r5528b99 r07f4e8b 62 62 onClick={() => { 63 63 createTableAvailability(formData, props.table.tableId) 64 props.refresh(Math.random()) 65 props.close() 64 66 }} 65 67 > -
frontend/src/Components/Forms/AddTransportForm.js
r5528b99 r07f4e8b 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/AddTripForm.js
r5528b99 r07f4e8b 232 232 console.log(wayPointNames); 233 233 for (let i = 0; i < routeCount - 1; i++) { 234 console.log(wayPoints[i]) 234 235 wayPointNames.push(wayPoints[i].value); 235 236 } -
frontend/src/Components/Forms/EditRoomForm.js
r5528b99 r07f4e8b 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 <<<<<<< HEAD45 46 <th>Oд</th> 46 47 <th>До</th> 47 48 <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)53 49 </tr> 54 50 </thead> -
frontend/src/Components/Hooks/Hotel/useCreateHotel.js
r5528b99 r07f4e8b 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
r5528b99 r07f4e8b 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/Restaurant/useCreateTable.js
r5528b99 r07f4e8b 13 13 .then((res) => { 14 14 console.log(res) 15 refresh( prev => ++prev)15 refresh(Math.random()) 16 16 //history.push('/restaurant'); 17 17 }) -
frontend/src/Components/Hooks/Transport/useCreateTransport.js
r5528b99 r07f4e8b 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
r5528b99 r07f4e8b 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/useCreate.js
r5528b99 r07f4e8b 16 16 //history.push('/hotel'); 17 17 console.log(res) 18 console.log("gotovo") 18 19 getData(prev => ++prev) 19 20 getData2(prev => ++prev) -
frontend/src/Components/Hooks/useGet.js
r5528b99 r07f4e8b 11 11 console.log(localStorage.getItem("sessionId")) 12 12 console.log("url od get " + uurl) 13 <<<<<<< HEAD14 13 await axios.get(uurl, {maxRedirects: 0}).then((res) => { 15 14 console.log(res); … … 23 22 // window.location.href = '/error' 24 23 }) 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)33 24 .finally(() => { 34 25 setIsLoading(false); … … 40 31 getData(url); 41 32 }, [dep, url, changed]); 42 33 43 34 return { 44 35 data, -
frontend/src/Components/HotelDetails/RoomRow.js
r5528b99 r07f4e8b 8 8 const [getData, setData] = useState(0); 9 9 const room = props.room 10 console.log("dasdaskjdhaskdjashdkajk") 10 11 console.log(props.data) 12 console.log(Array(props.data.find(x => x.hotelRoom.hotelRoomId === room.hotelRoomId))) 11 13 return ( 12 14 <> … … 22 24 }}> 23 25 <option></option> 24 {[...Array(props.data.fi nd(x => x.hotelRoom.hotelRoomId === room.hotelRoomId).numberOfBeds).keys()].map(x => {26 {[...Array(props.data.filter(x => x.hotelRoom.hotelRoomId === room.hotelRoomId).reduce((sum, x) => x.numberOfBeds)).keys()].map(x => { 25 27 return ( 26 28 <option value={x+1} >{x + 1}</option> -
frontend/src/Components/HotelDetails/RoomsTable.js
r5528b99 r07f4e8b 7 7 8 8 const RoomsTable = (props) => { 9 10 9 11 10 return ( … … 21 20 </thead> 22 21 <tbody> 23 {Array.from(new Set(props.data.map(x => x.hotelRoom))).map((room) => { 22 {Array.from( 23 new Set(props.data.map((x) => JSON.stringify(x.hotelRoom))) 24 ).map((roomString) => JSON.parse(roomString)).map((room) => { 24 25 return ( 25 26 <> -
frontend/src/Components/HotelEdit/HotelEditTab.js
r5528b99 r07f4e8b 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 type={'hotel'} 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/HotelEdit/ReservationListing.js
r5528b99 r07f4e8b 3 3 4 4 const ReservationListing = (props) => { 5 6 const dateFormatter = (str) => { 7 const inputDate = new Date(str); 8 9 const options = { 10 year: '2-digit', 11 month: '2-digit', 12 day: '2-digit', 13 }; 14 15 return inputDate.toLocaleString('de-DE', options); 16 } 17 5 18 return( 6 19 <> … … 15 28 <Col md={8} className="d-flex flex-column justify-content-start ps-5"> 16 29 <h3 style={{fontWeight: "bold"}} className={'text-start'}>Резервација за:</h3> 17 <h4 className={'text-start'}>{props.data.hotelRoom.hotelRoomName}</h4> 30 {props.type === 'hotel' && <h4 className={'text-start'}>{props.data.hotelRoom.hotelRoomName}</h4>} 31 {props.type === 'restaurant' && <h4 className={'text-start'}>{'Маса за ' + props.data.restaurantsTable.noSeats}</h4>} 32 {props.type === 'transport' && <h4 className={'text-start'}>{props.data.transportRoute.from + ' ' + props.data.transportRoute.to}</h4>} 33 {props.type === 'transport' && <h4 className={'text-start'}>{props.data.noSeats + ' ' + 'патници'}</h4>} 18 34 <h4 className={'text-start'}>{props.data.user.name + ' ' + props.data.user.surname}</h4> 19 <h5 className={'text-start'}>{props.data.dateFrom + ' - ' + props.data.dateTo}</h5> 35 {props.type !== 'transport' && <h5 36 className={'text-start'}>{dateFormatter(props.data.dateFrom) + ' - ' + dateFormatter(props.data.dateTo)}</h5>} 20 37 </Col> 21 38 <Col md={4} className="d-flex flex-column justify-content-center align-content-center"> 22 <h3>Вкупна цена: <br></br>{props.data.hotelRoom.price}$</h3>39 {props.type === 'hotel' && <h3>Вкупна цена: <br></br>{props.data.hotelRoom.price}$</h3>} 23 40 </Col> 24 41 </Row> -
frontend/src/Components/Layout/Navbar/Navigation.js
r5528b99 r07f4e8b 7 7 import useGet from "../../Hooks/useGet"; 8 8 import axios from "../../../axios.js"; 9 <<<<<<< HEAD10 9 import {useAuth} from "../../Context/AuthContext"; 11 10 import ImageUpload from "../../ImageUpload/ImageUpload"; 12 =======13 >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)14 11 //import logo from 'assets/images/logo.png'; 15 12 //src="https://upload.wikimedia.org/wikipedia/commons/0/08/Vergina_Sun_-_Golden_Larnax.png" … … 17 14 function Navigation(props) { 18 15 const navigator = useNavigate(); 19 <<<<<<< HEAD20 16 const Auth = useAuth(); 21 17 const isLoggedIn = Auth.userIsAuthenticated(); … … 26 22 const handleShow = () => setShow(true); 27 23 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)33 24 return ( 34 25 <> … … 40 31 > 41 32 <Container> 42 <Navbar.Brand href=" #home">33 <Navbar.Brand href="/home"> 43 34 <span className="ikona"> 44 35 <Image … … 66 57 <Button onClick={handleShow}></Button> 67 58 </Nav.Link> 68 {!isLo ading && !data&& (59 {!isLoggedIn && ( 69 60 <Button 70 61 className="m-2" … … 78 69 </Button> 79 70 )} 80 { !isLoading && data&& (71 {isLoggedIn && ( 81 72 <> 82 73 <Nav.Link className="m-2" href="/profile"> 83 { data}74 {Auth.getUser().username} 84 75 </Nav.Link> 85 76 <Button … … 90 81 await axios.get("/logout") 91 82 .then((res) => { 92 console.log(res) 83 console.log(res); 84 Auth.userLogout(); 93 85 }) 94 86 .catch((err) => { -
frontend/src/Components/Listings/HotelListing.js
r5528b99 r07f4e8b 80 80 }} 81 81 > 82 {/* {props.data.hotelRating} */} 83 9.1 82 {(props.data.hotelReviews.reduce((sum, r) => sum + r.numStar, 0) / props.data.hotelReviews.length).toFixed(1)} 84 83 </span> 85 84 </Col> -
frontend/src/Components/Listings/SortButton.js
r5528b99 r07f4e8b 3 3 import { BsSortUp } from "react-icons/bs" 4 4 5 const SortButton = ( ) => {5 const SortButton = (props) => { 6 6 return ( 7 <Dropdown> 7 <Dropdown onSelect={(event, x) => { 8 console.log(event) 9 props.setSortingArg(event) 10 }}> 8 11 <Dropdown.Toggle variant="success" id="dropdown-basic" size="lg"> 9 12 <span className="ikona my-1"><BsSortUp/></span> … … 11 14 </Dropdown.Toggle> 12 15 13 <Dropdown.Menu >14 <Dropdown.Item href="#/action-1">Цена растечки</Dropdown.Item>15 <Dropdown.Item href="#/action-2">Цена опаѓачки</Dropdown.Item>16 <Dropdown.Item href="#/action-3">Име растечки</Dropdown.Item>17 <Dropdown.Item href="#/action-3">Име опаѓачки</Dropdown.Item>16 <Dropdown.Menu > 17 {props.type !== 'restaurant' && <Dropdown.Item eventKey={'priceDesc'}>Цена растечки</Dropdown.Item>} 18 {props.type !== 'restaurant' && <Dropdown.Item eventKey={'priceAsc'}>Цена опаѓачки</Dropdown.Item>} 19 {props.type !== 'transport' && <Dropdown.Item eventKey={'nameAsc'}>Име растечки</Dropdown.Item>} 20 {props.type !== 'transport' && <Dropdown.Item eventKey={'nameDesc'}>Име опаѓачки</Dropdown.Item>} 18 21 </Dropdown.Menu> 19 22 </Dropdown> -
frontend/src/Components/Listings/TransportListing.js
r5528b99 r07f4e8b 9 9 10 10 const TransportListing = (props) => { 11 11 12 12 13 13 … … 56 56 }} 57 57 > 58 9.158 {(props.data.reviews.reduce((sum, r) => sum + r.numStar, 0) / props.data.reviews.length).toFixed(1)} 59 59 </span> 60 60 </Col> -
frontend/src/Components/Resources/AddAvailability.js
r5528b99 r07f4e8b 1 import React from "react";1 import React from "react"; 2 2 import { Container, Row, Modal, Im } from "react-bootstrap"; 3 3 import { useState } from "react"; … … 42 42 <Modal.Body> 43 43 {props.type === "hotel" && <AddHotelForm/>} 44 {props.type === "room" && <AddRoomAvailablityForm hotelRoomId={props.hotelRoomId}/>}45 {props.type === "table" && <AddTableAvailablityForm table={props.table}/>}44 {props.type === "room" && <AddRoomAvailablityForm refresh={props.refresh} close={props.closeModal} hotelRoomId={props.hotelRoomId}/>} 45 {props.type === "table" && <AddTableAvailablityForm refresh={props.refresh} close={props.closeModal} table={props.table}/>} 46 46 {props.type === "restaurant" && <AddRestaurantForm/>} 47 47 {props.type === "transport" && <AddTransportForm/>} -
frontend/src/Components/Resources/AddImages.js
r5528b99 r07f4e8b 53 53 {!isLoading && data.map((image) => { 54 54 let link = image.url; 55 console.log("SLIKATAAA")56 console.log(image)57 55 if (image.url.includes('Desktop')) { 58 56 link = 'http://localhost:8080/download?fileName=' + encodeURIComponent(image.url); -
frontend/src/Components/Resources/AddNew.js
r5528b99 r07f4e8b 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
r5528b99 r07f4e8b 32 32 </Modal.Header> 33 33 <Modal.Body> 34 {props.type === "hotel" && <AddHotelForm />}34 {props.type === "hotel" && <AddHotelForm refresh={props.refresh}/>} 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
r5528b99 r07f4e8b 8 8 9 9 const ResourceListing = (props) => { 10 11 console.log("props " + props.id)12 13 10 14 11 const type = props.type == "hotel" ? "сместувањето" : props.type == "restaurant" ? "ресторанот" : "превозот"; 15 12 const name = props.type == "hotel" ? props.data.hotelName : props.type == "restaurant" ? props.data.restaurantName : props.data.transportName 16 <<<<<<< HEAD17 13 const id = props.type == "hotel" ? props.data.hotelId : props.type == "restaurant" ? props.data.restaurantID : props.data.transportID 18 14 console.log(props.data) … … 54 50 </Col> 55 51 56 <Col className="d-flex flex-column justify-content-center align-content-center">57 <AddImages type={props.type} Id={id} 58 </Col> 52 {props.type !== 'transport' && <Col className="d-flex flex-column justify-content-center align-content-center"> 53 <AddImages type={props.type} Id={id}/> 54 </Col>} 59 55 <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.transportID62 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 <Image74 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)100 56 <span 101 57 style={{ -
frontend/src/Components/Resources/ResourcesTab.js
r5528b99 r07f4e8b 10 10 11 11 function ResourcesTab(props) { 12 <<<<<<< HEAD13 12 const [activeTab, setActiveTab] = useState(props.tab); 14 13 const userId = JSON.parse(localStorage.getItem("user")).userId; … … 36 35 <Nav.Item className="tab_item rounded-5"> 37 36 <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.Container57 activeKey={activeTab}58 onSelect={handleSelect}59 className="bg-dark rounded-5"60 >61 <Nav62 fill63 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)71 37 <span className="ikona"> 72 38 <FaHotel … … 101 67 </Nav> 102 68 103 <<<<<<< HEAD104 69 <Tab.Content className="py-5 px-3 border rounded-bottom-5 bg-light"> 105 70 <Tab.Pane eventKey="/hotel" key="hotelPane"> … … 150 115 </Container> 151 116 ); 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 <ResourceListing160 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 <ResourceListing177 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 <ResourceListing191 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)205 117 } 206 118 -
frontend/src/Components/RestaurantDetails/Carousel.js
r5528b99 r07f4e8b 12 12 <Row className='d-flex justify-content-center align-items-center'><h2>Мени</h2></Row> 13 13 <hr className='m-2'></hr> 14 <Menu menu={props.menu}></Menu>14 <Menu images={props.images} menu={props.menu}></Menu> 15 15 </> 16 16 ); -
frontend/src/Components/RestaurantDetails/Menu.js
r5528b99 r07f4e8b 23 23 24 24 25 26 25 27 return (<> 26 28 <Carousel activeIndex={ind} onSelect={handleSelect} indicators={false}> … … 34 36 return ( 35 37 <Col> 36 <MenuItem data={menuItem}/> 38 <MenuItem images={ props.images.filter(x => { 39 console.log(x) 40 return x.menu.menuId === menuItem.menuId 41 })} data={menuItem}/> 37 42 </Col> 38 43 ) -
frontend/src/Components/RestaurantDetails/MenuItem.js
r5528b99 r07f4e8b 1 1 import React from "react"; 2 2 import {Col, Row, Image, Container} from "react-bootstrap"; 3 import Carousel from "react-bootstrap/Carousel"; 3 4 4 5 const MenuItem = (props) => { 5 6 6 7 const data = props.data; 8 console.log("dva orla") 9 console.log(props) 7 10 return (<> 8 11 … … 17 20 <Row> 18 21 <Col className="d-flex justify-content-center mb-3"> 19 <Image 20 src="https://www.tasteofhome.com/wp-content/uploads/2019/01/medium-rare-steak-shutterstock_706040446.jpg" 21 style={{ 22 height: "7em", 23 borderRadius: "1em", 24 boxShadow: "0 4px 20px lightblue", 25 maxWidth: "100%", 26 }} 27 ></Image> 22 <Carousel> 23 {props.images.map((image) => { 24 let link = image.url; 25 if (image.url.includes('Desktop')) { 26 link = 'http://localhost:8080/download?fileName=' + encodeURIComponent(image.url); 27 } 28 return ( 29 <Carousel.Item> 30 <img 31 className="d-block w-100 h-400 rounded-5" 32 src={link} 33 alt="First slide" 34 style={{ 35 height: "7em", 36 borderRadius: "1em", 37 boxShadow: "0 4px 20px lightblue", 38 maxWidth: "100%", 39 }} 40 /> 41 </Carousel.Item> 42 ) 43 })} 44 {props.images.length == 0 && <Carousel.Item> 45 <Image 46 src="https://www.tasteofhome.com/wp-content/uploads/2019/01/medium-rare-steak-shutterstock_706040446.jpg" 47 style={{ 48 height: "7em", 49 borderRadius: "1em", 50 boxShadow: "0 4px 20px lightblue", 51 maxWidth: "100%", 52 }} 53 ></Image> 54 </Carousel.Item>} 55 </Carousel> 28 56 </Col> 29 57 </Row> -
frontend/src/Components/RestaurantDetails/TablesTable.js
r5528b99 r07f4e8b 22 22 </thead> 23 23 <tbody> 24 {Array.from(new Set(props.data.map(x => x.restaurantTable))).map((table) => { 24 {Array.from( 25 new Set(props.data.map((x) => JSON.stringify(x.restaurantTable))) 26 ).map((roomString) => JSON.parse(roomString)).map((table) => { 25 27 return ( 26 28 <> -
frontend/src/Components/RestaurantEdit/MenuListing.js
r5528b99 r07f4e8b 6 6 import { AiOutlinePlusCircle } from "react-icons/ai" 7 7 import EditModal from "../Resources/EditModal"; 8 import AddImages from "../Resources/AddImages"; 8 9 9 10 const MenuListing = (props) => { … … 12 13 console.log(props.data) 13 14 return(<> 14 <a href="#" onClick={(e) => {e.preventDefault(); props.showModal(props.data); 15 console.log("kliknav")} } style={{textDecoration: "none", color:"black"}}> 15 <a href="#" style={{textDecoration: "none", color:"black"}}> 16 16 <Container className="py-3 px-1 my-4" 17 17 style={{ … … 23 23 <Row> 24 24 <Col className="d-flex justify-content-center"> 25 <Image 25 <Image onClick={(e) => { 26 e.preventDefault(); 27 props.showModal(props.data); 28 console.log("kliknav") 29 }} 26 30 src="https://www.tasteofhome.com/wp-content/uploads/2019/01/medium-rare-steak-shutterstock_706040446.jpg" 27 31 style={{ … … 37 41 <h6>{props.data.ingredients}</h6> 38 42 </Col> 43 <Col className="d-flex flex-column justify-content-center align-content-center"> 44 <AddImages type="menu" Id={props.data.menuId} /> 45 </Col> 39 46 40 47 <Col className="d-flex flex-column justify-content-center align-content-center"> -
frontend/src/Components/RestaurantEdit/RestaurantEditTab.js
r5528b99 r07f4e8b 10 10 import TableListing from "./TableListing"; 11 11 import EditModal from "../Resources/EditModal"; 12 import ReservationListing from "../HotelEdit/ReservationListing"; 13 import useGet from "../Hooks/useGet"; 12 14 13 15 function RestaurantEditTab(props) { … … 35 37 setActiveTab(eventKey); 36 38 }; 39 40 const { 41 data, 42 isLoading, 43 setData, 44 getData, 45 setChanged: dhanged 46 } = useGet(`/restaurant/${props.displayMenu.restaurantID}/reservations/active`) 37 47 38 48 console.log(props.displayMenu.restaurantID) … … 100 110 return <MenuListing key={menu.menuId} data={menu} showModal={showModal}/> 101 111 })} 102 {activeTab === '/hotel' && <EditModal show={show} handleClose={handleClose} type="menu" menu={modalData}></EditModal>}112 {activeTab === '/hotel' && <EditModal show={show} refresh={props.refresh} handleClose={handleClose} type="menu" menu={modalData}></EditModal>} 103 113 <AddNew Id={props.displayMenu.restaurantID} refresh={props.refresh} type="menu"/> 104 114 </Tab.Pane> 105 115 <Tab.Pane eventKey="/masi"> 106 116 {props.displayMenu.tables.map((table) => { 107 return <TableListing key={table.tableId} showModal={showModal} data={table}/>117 return <TableListing key={table.tableId} refresh={props.refresh} showModal={showModal} handleClose={handleClose} data={table}/> 108 118 })} 109 119 {activeTab === '/masi' && <EditModal show={show} handleClose={handleClose} refresh={props.refresh} type="table" … … 112 122 </Tab.Pane> 113 123 <Tab.Pane eventKey="/restaurant"> 114 <AddNew type="restaurant"/> 124 {!isLoading && data.map((res) => { 125 return ( 126 <ReservationListing type={'restaurant'} data={res}/> 127 ) 128 })} 115 129 </Tab.Pane> 116 130 <Tab.Pane eventKey="/transport"> -
frontend/src/Components/RestaurantEdit/TableListing.js
r5528b99 r07f4e8b 41 41 42 42 <Col className="d-flex flex-column justify-content-center align-content-center"> 43 <AddAvailability type="table" table={props.data}/>43 <AddAvailability type="table" refresh={props.refresh} closeModal={props.handleClose} table={props.data}/> 44 44 </Col> 45 45 -
frontend/src/Components/SearchCriterias/SearchCriteriasBar.js
r5528b99 r07f4e8b 2 2 import { Container, Form, Button, Row, Col } from "react-bootstrap"; 3 3 import useFormData from "../Hooks/useFormData"; 4 <<<<<<< HEAD5 4 import SearchCriteriasHotel from "./SearchCriteriasHotel"; 6 5 import SearchCriteriasTransport from "./SearchCriteriasTransport"; 7 6 import SearchCriteriasRestaurant from "./SearchCriteriasRestaurant"; 8 =======9 >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)10 7 11 const SearchCriterias = (props) => {8 const SearchCriteriasBar = (props) => { 12 9 13 const { formData, onFormChange, onCheckBoxChange, setFormData} = useFormData(props.criterias) 14 console.log("KRITERIUMI") 15 console.log(formData) 10 const { criterias, type } = props 16 11 17 <<<<<<< HEAD18 12 return ( 19 13 <> … … 24 18 ) 25 19 } 26 =======27 return (28 <>29 <Container30 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.Control38 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.Control52 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.Control66 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.Control80 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 <Button94 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)114 20 115 export default SearchCriterias ;21 export default SearchCriteriasBar; -
frontend/src/Components/Tab/TabFormHotel.js
r5528b99 r07f4e8b 1 1 import React from "react"; 2 import { Button, Col, Container, Form, Row} from "react-bootstrap";3 import { FaMagnet} from "react-icons/fa"4 import { HiMagnifyingGlass} from "react-icons/hi2"2 import {Button, Col, Container, Form, InputGroup, Row} from "react-bootstrap"; 3 import {FaMagnet} from "react-icons/fa" 4 import {HiMagnifyingGlass} from "react-icons/hi2" 5 5 import useFormData from "../Hooks/useFormData"; 6 6 7 7 function TabFormHotel() { 8 8 9 const { formData, onFormChange, setFormData } = useFormData({ 10 hotelLocation: undefined, 11 dateFrom: undefined, 12 dateTo: undefined, 13 numBeds: undefined 14 }) 9 const {formData, onFormChange, setFormData, onCheckBoxChange} = useFormData({ 10 hotelLocation: undefined, 11 dateFrom: undefined, 12 dateTo: undefined, 13 numBeds: undefined, 14 flexible: false, 15 }) 15 16 16 return ( 17 <Form className='rounded-5' > 18 <Row> 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 value={formData.hotelLocation} 28 onChange={onFormChange} 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 value={formData.dateFrom} 42 onChange={onFormChange} 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 value={formData.dateTo} 56 onChange={onFormChange} 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 value={formData.numBeds} 70 onChange={onFormChange} 71 ></Form.Control> 72 <label htmlFor="floatingPassengers">Број на гости:</label> 73 </Form.Floating> 17 return ( 18 <Form className='rounded-5'> 19 <Row> 20 <Col> 21 <Form.Floating className="mb-3"> 22 <Form.Control 23 size="md" 24 type="text" 25 placeholder="Каде ќе патувате?:" 26 id="location" 27 name="hotelLocation" 28 value={formData.hotelLocation} 29 onChange={onFormChange} 30 ></Form.Control> 31 <label htmlFor="location">Локација:</label> 32 </Form.Floating> 33 <div className="mb-3"> 34 <Form.Check 35 type={"checkbox"} 36 id={`default-checkbox}`} 37 label={`флексибилност +- 3 дена`} 38 onChange={onCheckBoxChange} 39 name={'flexible'} 40 value={formData.flexible} 41 /> 42 </div> 43 </Col> 44 <Col> 45 <Form.Floating className="mb-3"> 46 <Form.Control 47 size="md" 48 type="date" 49 placeholder="Датум на пристигнување:" 50 id="dateFrom" 51 name="dateFrom" 52 value={formData.dateFrom} 53 onChange={onFormChange} 54 ></Form.Control> 55 <label htmlFor="dateFrom">Датум на пристигнување:</label> 56 </Form.Floating> 57 </Col> 58 <Col> 59 <Form.Floating className="mb-3"> 60 <Form.Control 61 size="md" 62 type="date" 63 placeholder="Датум на заминување:" 64 id="dateTo" 65 name="dateTo" 66 value={formData.dateTo} 67 onChange={onFormChange} 68 ></Form.Control> 69 <label htmlFor="dateTo">Датум на заминување:</label> 70 </Form.Floating> 71 </Col> 72 <Col> 73 <Form.Floating className="mb-3"> 74 <Form.Control 75 size="md" 76 type="number" 77 placeholder="Број на гости:" 78 id="floatingPassengers" 79 name="numBeds" 80 value={formData.numBeds} 81 onChange={onFormChange} 82 ></Form.Control> 83 <label htmlFor="floatingPassengers">Број на гости:</label> 84 </Form.Floating> 74 85 75 <Form.Group className="my-1">76 <Button type="submit" style={{backgroundColor: "#159895"}} size="lg"77 onClick={(e) => {78 e.preventDefault();79 window.location.href = `/search/hotel/${formData.hotelLocation}/${formData.dateFrom}/${formData.dateTo}/${formData.numBeds}`80 }}>81 <span className="ikona my-1"><HiMagnifyingGlass/></span>82 <span className="ikona mx-3">Пребарај</span>83 </Button>84 </Form.Group>85 </Col>86 <Form.Group className="my-1"> 87 <Button type="submit" style={{backgroundColor: "#159895"}} size="lg" 88 onClick={(e) => { 89 e.preventDefault(); 90 window.location.href = `/search/hotel/${formData.hotelLocation}/${formData.dateFrom}/${formData.dateTo}/${formData.numBeds}/${formData.flexible}` 91 }}> 92 <span className="ikona my-1"><HiMagnifyingGlass/></span> 93 <span className="ikona mx-3">Пребарај</span> 94 </Button> 95 </Form.Group> 96 </Col> 86 97 87 </Row>88 </Form>89 );98 </Row> 99 </Form> 100 ); 90 101 } 91 102 -
frontend/src/Components/Tab/TabFormTransport.js
r5528b99 r07f4e8b 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
r5528b99 r07f4e8b 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
r5528b99 r07f4e8b 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
r5528b99 r07f4e8b 16 16 } 17 17 18 <<<<<<< HEAD19 18 return ( 20 19 <> … … 58 57 </> 59 58 ); 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)83 59 }; 84 60 -
frontend/src/Components/TransportEdit/TransportEditTab.js
r5528b99 r07f4e8b 9 9 import TransportListing from "./TransportListing"; 10 10 import useGet from "../Hooks/useGet"; 11 import ReservationListing from "../HotelEdit/ReservationListing"; 11 12 12 13 function TransportEditTab(props) { 13 14 const [activeTab, setActiveTab] = useState("/hotel"); 14 const link = "/transport/" + props.displayRoute.transportID + "/available"; 15 console.log(props.displayRoute) 16 const [changed, setChanged] = useState(0) 17 const { data, setData, isLoading, getData } = useGet(link, changed); 15 console.log(props) 16 17 18 const { 19 data, 20 isLoading, 21 setData, 22 getData, 23 setChanged: dhanged 24 } = useGet(`/transport/${props.displayRoute.transportID}/reservations/active`) 25 18 26 19 27 … … 75 83 </Tab.Pane> 76 84 <Tab.Pane eventKey="/restaurant"> 77 <AddNew type="restaurant"/> 85 {!isLoading && data.map((res) => { 86 return ( 87 <ReservationListing type={'transport'} data={res}/> 88 ) 89 })} 78 90 </Tab.Pane> 79 91 <Tab.Pane eventKey="/transport"> -
frontend/src/Components/TransportEdit/TransportListing.js
r5528b99 r07f4e8b 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/UserPanel/HotelReservationListing.js
r5528b99 r07f4e8b 12 12 import data from "bootstrap/js/src/dom/data"; 13 13 import {AiOutlinePlusCircle} from "react-icons/ai"; 14 import {MdOutlineRateReview} from "react-icons/md"; 14 import { MdCancel } from "react-icons/md"; 15 import { MdOutlineRateReview } from "react-icons/md" 15 16 import useFormData from "../Hooks/useFormData"; 16 17 import useCreate from "../Hooks/useCreate"; … … 26 27 27 28 console.log(props.data) 29 const { createEntity } = useCreate(); 28 30 const dateFormatter = (str) => { 29 31 const inputDate = new Date(str); … … 114 116 <h3>Вкупна цена: <br></br>{props.data.transportRoute.price}$</h3> 115 117 </Col>} 118 {(!props.past) && <Col className="d-flex flex-column justify-content-center align-content-center"> 119 {<Container id={'ocn'} onClick={(e) => { 120 console.log(e.target) 121 if (e.target.id === 'icon') { 122 createEntity(`/restaurant/${props.data.reservationId}/cancel`, props.setChanged, props.setChanged) 123 window.location.href="/reservations" 124 } 125 }}> 126 <h5 id={'icon'}>Откажи<br/>резервација</h5> 127 <div className="d-flex justify-content-center align-content-center"> 128 <MdCancel size={50} color="#159895"/></div> 129 130 </Container>} 131 </Col>} 116 132 {(props.past) && <Col className="d-flex flex-column justify-content-center align-content-center"> 117 133 {!props.data.reviewed && <Container id={'ocn'} onClick={(e) => { … … 132 148 </Row> 133 149 </Container> 134 {props.type === 'hotel' && <HotelReservationModal s how={show} handleClose={handleClose} data={props.data}/>}135 <ReviewModal type={props.type} showReview={showReview} handleCloseReview={handleCloseReview} data={props.data}/>150 {props.type === 'hotel' && <HotelReservationModal setChanged={props.setChanged} show={show} handleClose={handleClose} data={props.data}/>} 151 <ReviewModal setChanged={props.setChanged} type={props.type} showReview={showReview} handleCloseReview={handleCloseReview} data={props.data}/> 136 152 </>) 137 153 } -
frontend/src/Components/UserPanel/HotelReservationModal.js
r5528b99 r07f4e8b 5 5 import {TbToolsKitchen2} from "react-icons/tb"; 6 6 import React from "react"; 7 import useCreate from "../Hooks/useCreate"; 7 8 8 9 const HotelReservationModal = (props) => { 10 11 const {createEntity} = useCreate(); 9 12 10 13 const dateFormatter = (str) => { … … 17 20 hour12: false, 18 21 }; 22 23 console.log(props) 19 24 20 25 return inputDate.toLocaleString('de-DE', options); … … 189 194 Затвори 190 195 </Button> 196 <Button variant="danger" onClick={() => { 197 createEntity(`/hotel/${props.data.reservationId}/cancel`, props.setChanged) 198 props.handleClose() 199 } 200 }> 201 Откажи резервација 202 </Button> 191 203 </Modal.Footer> 192 204 </Modal> -
frontend/src/Components/UserPanel/PastHotelReservations.js
r5528b99 r07f4e8b 10 10 <> 11 11 {!isLoading && data.map((res) => { 12 return (<HotelReservationListing past={true} data={res} type={'hotel'}></HotelReservationListing>)12 return (<HotelReservationListing setChanged={setChanged} past={true} data={res} type={'hotel'}></HotelReservationListing>) 13 13 })} 14 14 {(!isLoading && data.length === 0) && <h3 className={'my-5'}>Нема податоци за одбраните критериуми!</h3>} -
frontend/src/Components/UserPanel/PastRestaurantReservations.js
r5528b99 r07f4e8b 11 11 <> 12 12 {!isLoading && data.map((res) => { 13 return (<HotelReservationListing past={true} data={res} type={'restaurant'}></HotelReservationListing>) 13 console.log(res) 14 return (<HotelReservationListing setChanged={setChanged} past={true} data={res} type={'restaurant'}></HotelReservationListing>) 14 15 })} 15 16 {(!isLoading && data.length === 0) && <h3 className={'my-5'}>Нема податоци за одбраните критериуми!</h3>} -
frontend/src/Components/UserPanel/PastTransportReservations.js
r5528b99 r07f4e8b 10 10 <> 11 11 {!isLoading && data.map((res) => { 12 return (<HotelReservationListing past={true} data={res} type={'transport'}></HotelReservationListing>)12 return (<HotelReservationListing setChanged={setChanged} past={true} data={res} type={'transport'}></HotelReservationListing>) 13 13 })} 14 14 -
frontend/src/Components/UserPanel/ReviewModal.js
r5528b99 r07f4e8b 10 10 description: "", 11 11 } 12 console.log(props) 12 13 13 14 const {createEntity} = useCreate(); … … 80 81 ...formData, 81 82 hotelId: props.data.hotelId, 82 userId: 1 83 userId: 1, 84 reservationId: props.data.reservationId 83 85 } : 84 86 props.type === 'restaurant' ? { 85 ...formData, 86 restaurantId: props.data.restaurantId, 87 userId: 1 88 } : { 87 ...formData, 88 restaurantId: props.data.restaurantId, 89 userId: 1, 90 reservationId: props.data.reservationId 91 } : { 89 92 ...formData, 90 93 transportId: props.data.transportId, 91 userId: 1 94 userId: 1, 95 reservationId: props.data.reservationId 92 96 } 93 createEntity('/review/add', dataToPost)97 createEntity('/review/add', dataToPost, props.setChanged) 94 98 setFormData(dummy) 95 99 props.handleCloseReview() -
frontend/src/Components/useFormNested.js
r5528b99 r07f4e8b 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
r5528b99 r07f4e8b 1 1 import React from "react"; 2 2 import LoginForm from "../Components/Login/LoginForm"; 3 <<<<<<< HEAD4 3 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)8 4 import Navigation from "../Components/Layout/Navbar/Navigation"; 9 5 import Carousel from "react-bootstrap/Carousel"; … … 73 69 placeholder="Каде ќе патувате?:" 74 70 id="location" 71 value={data.hotelLocation} 75 72 ></Form.Control> 76 <label htmlFor="location">Локација:</label>73 <label style={{left: "10px"}} htmlFor="location">Локација:</label> 77 74 </Form.Floating> 78 75 </Row> … … 84 81 placeholder="Датум на пристигнување:" 85 82 id="dateFrom" 83 value={from} 86 84 ></Form.Control> 87 <label htmlFor="dateFrom">Датум на пристигнување:</label>85 <label style={{left: "10px"}} htmlFor="dateFrom">Датум на пристигнување:</label> 88 86 </Form.Floating> 89 87 </Row> … … 95 93 placeholder="Датум на заминување:" 96 94 id="dateTo" 95 value={to} 97 96 ></Form.Control> 98 <label htmlFor="dateTo">Датум на заминување:</label>97 <label style={{left: "10px"}} htmlFor="dateTo">Датум на заминување:</label> 99 98 </Form.Floating> 100 99 </Row> … … 107 106 id="floatingPassengers" 108 107 ></Form.Control> 109 <label htmlFor="floatingPassengers">Број на гости:</label>108 <label style={{left: "10px"}} htmlFor="floatingPassengers">Број на гости:</label> 110 109 </Form.Floating> 111 110 </Row> … … 117 116 {data.images.map((image) => { 118 117 let link = image.url; 119 console.log("SLIKATAAA")120 console.log(image)121 118 if (image.url.includes('Desktop')) { 122 119 link = 'http://localhost:8080/download?fileName=' + encodeURIComponent(image.url); -
frontend/src/Pages/HotelEditPage.js
r5528b99 r07f4e8b 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/${params.hotelId}/list`; 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
r5528b99 r07f4e8b 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
r5528b99 r07f4e8b 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
r5528b99 r07f4e8b 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
r5528b99 r07f4e8b 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
r5528b99 r07f4e8b 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/RestaurantDetailsPage.js
r5528b99 r07f4e8b 133 133 <Row> 134 134 <Carousel activeIndex={index} onSelect={handleSelect}> 135 <Carousel.Item> 135 {data.images.map((image) => { 136 let link = image.url; 137 if (image.url.includes('Desktop')) { 138 link = 'http://localhost:8080/download?fileName=' + encodeURIComponent(image.url); 139 } 140 return ( 141 <Carousel.Item> 142 <img 143 className="d-block w-100 h-400 rounded-5" 144 src={link} 145 alt="First slide" 146 style={{ height: "50vh" }} 147 /> 148 </Carousel.Item> 149 ) 150 })} 151 {data.images.length == 0 && <Carousel.Item> 136 152 <img 137 153 className="d-block w-100 h-400 rounded-5" … … 140 156 style={{height: "50vh"}} 141 157 /> 142 </Carousel.Item> 143 <Carousel.Item> 144 <img 145 className="d-block w-100 rounded-5" 146 src="https://emagazin.mk/wp-content/uploads/2022/03/Karos_Photography-7871.jpg" 147 alt="Second slide" 148 style={{height: "50vh"}} 149 /> 150 </Carousel.Item> 151 <Carousel.Item> 152 <img 153 className="d-block w-100 rounded-5" 154 src="https://lh5.googleusercontent.com/p/AF1QipMQAwahuuJCJ2rDUYNrhnwiX1070adTsM6LmzV5=w480-h300-k-n" 155 alt="Third slide" 156 style={{height: "50vh"}} 157 /> 158 </Carousel.Item> 158 </Carousel.Item>} 159 159 </Carousel> 160 160 </Row> … … 169 169 <Col className="col-md-4"><ReviewsCarousel reviews={data.reviews}></ReviewsCarousel></Col> 170 170 </Row> 171 <Row className="mb-3"><MenuCarousel menu={data.menus}></MenuCarousel></Row>171 <Row className="mb-3"><MenuCarousel images={data.menuImages} menu={data.menus}></MenuCarousel></Row> 172 172 <Row><TablesTable params={formData} data={data.tables}></TablesTable></Row> 173 173 <Row><ContactBar></ContactBar></Row> -
frontend/src/Pages/RestaurantEditPage.js
r5528b99 r07f4e8b 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
r5528b99 r07f4e8b 1 import React from "react";1 import React, {useState} from "react"; 2 2 import Navigation from '../Components/Layout/Navbar/Navigation'; 3 3 import 'bootstrap/dist/css/bootstrap.css'; 4 4 import 'bootstrap/dist/js/bootstrap.js'; 5 5 import HomeCarousel from '../Components/Layout/CarouselHome/Carousel'; 6 import { Card, Container, Nav, Row, Col} from 'react-bootstrap';6 import {Card, Container, Nav, Row, Col} from 'react-bootstrap'; 7 7 import TabComponent from '../Components/Tab/Tab'; 8 8 import Offers from '../Components/Layout/Offers/Offers'; … … 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"; 16 16 import TransportListing from "../Components/Listings/TransportListing"; 17 17 import useGet from "../Components/Hooks/useGet"; 18 import { useParams } from "react-router-dom"; 19 <<<<<<< HEAD 18 import {useParams} from "react-router-dom"; 20 19 import SearchCriteriasBar from "../Components/SearchCriterias/SearchCriteriasBar"; 21 20 import RestaurantDetailsPage from "./RestaurantDetailsPage"; 22 21 import RestaurantListing from "../Components/Listings/RestaurantListing"; 23 =======24 >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)25 22 26 23 … … 29 26 const params = useParams(); 30 27 console.log(params) 31 28 const [sortingArg, setSortingArg] = useState("") 32 29 33 30 document.body.style.backgroundColor = "white" … … 41 38 42 39 } 43 44 <<<<<<< HEAD 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) 40 41 const getSortingFn = (type, arg) => { 42 if (type === 'hotel') { 43 if (arg === "priceAsc") 44 { 45 return (a, b) => { 46 return a.totalPrice - b.totalPrice; 47 } 48 } 49 else if (arg === "priceDesc") 50 { 51 return (a, b) => { 52 return -(a.totalPrice - b.totalPrice); 53 } 54 } 55 else if (arg === 'nameAsc') 56 { 57 return (a, b) => { 58 return a.hotelName.localeCompare(b.hotelName); 59 } 60 } 61 else if(arg === 'nameDesc') 62 { 63 return (a, b) => { 64 return -a.hotelName.localeCompare(b.hotelName); 65 } 66 } 67 } 68 else if (type === 'transport') 69 { 70 if (arg === "priceAsc") 71 { 72 return (a, b) => { 73 return a.price - b.price; 74 } 75 } 76 else if (arg === "priceDesc") 77 { 78 return (a, b) => { 79 return -(a.price - b.price); 80 } 81 } 82 } 83 else if (type === 'restaurant') 84 { 85 if (arg === 'nameAsc') 86 { 87 return (a, b) => { 88 return a.restaurantName.localeCompare(b.restaurantName); 89 } 90 } 91 else if(arg === 'nameDesc') 92 { 93 return (a, b) => { 94 return -a.restaurantName.localeCompare(b.restaurantName); 95 } 96 } 97 } 98 } 99 100 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}&flexible=${params.flexible}` : `/restaurant/search?restaurantLocation=${params.restaurantLocation}&date=${params.date}&hourFrom=${params.hourFrom}&hourTo=${params.hourTo}&numPeople=${params.numPeople}` 49 101 console.log(link) 50 102 console.log(params.date) 51 const { data, isLoading, getData, setData} = useGet(link);103 const {data, isLoading, getData, setData} = useGet(link); 52 104 !isLoading && console.log(data) 53 105 return ( 54 106 <> 55 107 <Navigation></Navigation> 56 <SearchCriterias criterias={useParams()}></SearchCriterias>108 <SearchCriteriasBar type={props.type} criterias={useParams()}></SearchCriteriasBar> 57 109 <Container className="d-flex justify-content-end gx-5" style={{maxWidth: "60%"}}> 58 110 <Row> … … 61 113 </Col> 62 114 <Col> 63 <SortButton ></SortButton>115 <SortButton setSortingArg={setSortingArg} type={props.type}></SortButton> 64 116 </Col> 65 117 </Row> 66 118 </Container> 67 119 {props.type === "hotel" && !isLoading && data && <Container fluid> 68 {data. map(hotel => {120 {data.sort(getSortingFn(props.type, sortingArg)).map(hotel => { 69 121 return <HotelLisitng from={params.dateFrom} to={params.dateTo} data={hotel}/> 70 122 })} 71 123 </Container>} 72 124 {props.type === "transport" && !isLoading && data && <Container fluid> 73 {data. map(transport => {125 {data.sort(getSortingFn(props.type, sortingArg)).map(transport => { 74 126 return <TransportListing params={params} data={transport}/> 75 127 })} 76 128 </Container>} 77 129 {props.type === "restaurant" && !isLoading && data && <Container fluid> 78 {data. map(restaurant => {130 {data.sort(getSortingFn(props.type, sortingArg)).map(restaurant => { 79 131 return <RestaurantListing params={params} data={restaurant}/> 80 132 })} -
frontend/src/Pages/TransportEditPage.js
r5528b99 r07f4e8b 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
r5528b99 r07f4e8b 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.