Changeset 5528b99


Ignore:
Timestamp:
01/16/24 16:34:03 (5 months ago)
Author:
darsov2 <62809499+darsov2@…>
Branches:
master
Children:
07f4e8b
Parents:
e6c2521
Message:

revert

Files:
66 edited

Legend:

Unmodified
Added
Removed
  • frontend/package-lock.json

    re6c2521 r5528b99  
    1313        "@testing-library/user-event": "^13.5.0",
    1414        "axios": "^1.5.0",
    15         "axios-extensions": "^3.1.6",
    1615        "bootstrap": "^5.3.0",
    1716        "file-loader": "^6.2.0",
     
    53505349      }
    53515350    },
    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     },
    53735351    "node_modules/axios/node_modules/form-data": {
    53745352      "version": "4.0.0",
     
    94479425      "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz",
    94489426      "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==",
     9427      "peer": true,
    94499428      "dependencies": {
    94509429        "call-bind": "^1.0.2",
     
    95859564      "engines": {
    95869565        "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"
    96019566      }
    96029567    },
     
    1683516800      }
    1683616801    },
    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     },
    1684916802    "node_modules/util-deprecate": {
    1685016803      "version": "1.0.2",
  • frontend/package.json

    re6c2521 r5528b99  
    88    "@testing-library/user-event": "^13.5.0",
    99    "axios": "^1.5.0",
    10     "axios-extensions": "^3.1.6",
    1110    "bootstrap": "^5.3.0",
    1211    "file-loader": "^6.2.0",
  • frontend/src/App.js

    re6c2521 r5528b99  
    55import 'bootstrap/dist/js/bootstrap.js';
    66import HomeCarousel from './Components/Layout/CarouselHome/Carousel';
    7 import {Card, Container} from 'react-bootstrap';
     7import { Card, Container } from 'react-bootstrap';
    88import TabComponent from './Components/Tab/Tab';
    99import Offers from './Components/Layout/Offers/Offers';
     
    2727import TransportEditPage from './Pages/TransportEditPage';
    2828import RestaurantDetailsPage from './Pages/RestaurantDetailsPage';
    29 import {BrowserRouter, Route, Routes} from 'react-router-dom';
     29import { BrowserRouter, Route, Routes } from 'react-router-dom';
    3030import 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";
    3531
    3632
    3733function App() {
    3834
     35<<<<<<< HEAD
    3936    return (
    4037        <div className="App" style={{overflow: 'hidden'}}>
     
    7673        </div>
    7774    );
     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)
    78102}
    79103
  • frontend/src/Components/Forms/AddHotelForm.js

    re6c2521 r5528b99  
    119119                  return prevState + 1;
    120120                })
    121                 if(!edit)
    122                   props.closeModal()
    123121              }}
    124122            >
  • frontend/src/Components/Forms/AddRestaurantForm.js

    re6c2521 r5528b99  
    8585                  return prevState + 1;
    8686                })
    87                 props.closeModal()
    8887              }}
    8988            >
  • frontend/src/Components/Forms/AddRoomForm.js

    re6c2521 r5528b99  
    1313    hotelRoomDescription: "",
    1414    hotelRoomName: "",
    15     numOfBeds: "",
     15    numBeds: "",
    1616    price: "",
    1717    kitchenAvailable: false,
     
    5858            type="number"
    5959            placeholder="Внесете го бројот на кревети"
    60             value={formData.numOfBeds}
    61             name="numOfBeds"
     60            value={formData.numBeds}
     61            name="numBeds"
    6262            onChange={onFormChange}
    6363            />
     
    117117              style={{ backgroundColor: "#159895" }}
    118118              size="md"
    119               onClick={(e) => {
    120                 e.preventDefault();
    121                 props.refresh((prev) => {
    122                   return ++prev;
    123                 })
     119              onClick={() => {
     120                console.log(formData);
    124121                createHotelRoom(formData);
    125                 props.closeModal();
    126122              }}
    127123            >
  • frontend/src/Components/Forms/AddTransportForm.js

    re6c2521 r5528b99  
    1111      transportName: "",
    1212      carBrand: "",
    13       carType: "",
     13      carType: false,
    1414      carManufacturedYear: 1900,
    1515      noPassengers: 0,
     
    107107                createTransport(formData, edit);
    108108                props.refresh((prev) => {
    109                   return ++prev;
     109                  return prev + 1;
    110110                })
    111                 if(!edit)
    112                     props.closeModal()
    113111              }}
    114112            >
  • frontend/src/Components/Forms/EditRoomForm.js

    re6c2521 r5528b99  
    2828    } = useGet(`/hotel/rooms/${props.room.hotelRoomId}/available`)
    2929
    30     console.log(`/hotel/rooms/${props.room.hotelRoomId}/available`)
    31 
    3230    !isLoading && console.log(data)
    3331
     
    4442                            <tr>
    4543                                <th>#</th>
     44<<<<<<< HEAD
    4645                                <th>Oд</th>
    4746                                <th>До</th>
    4847                                <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)
    4953                            </tr>
    5054                            </thead>
  • frontend/src/Components/Hooks/Hotel/useCreateHotel.js

    re6c2521 r5528b99  
    66const useCreateHotel = () => {
    77
     8    //const history = useNavigate();
    89    const createHotel = async (hotel, edit) => {
    910                console.log({hotel})
    1011                console.log(hotel)
    11                 console.log("vo createhotel")
    1212
    1313                if(!edit)
     
    1616                        .post(`/hotel/add`, hotel, {
    1717                                params: {
    18                                         userId: JSON.parse(localStorage.getItem("user")).userId
     18                                        userId: localStorage.getItem("userId")
    1919                                }
    2020                        })
  • frontend/src/Components/Hooks/Restaurant/useCreateRestaurant.js

    re6c2521 r5528b99  
    1515                        .post(`/restaurant/add`, restaurant, {
    1616                                params: {
    17                                         userId: JSON.parse(localStorage.getItem('user')).userId,
     17                                        userId: localStorage.getItem('userId')
    1818                                }
    1919                        })
  • frontend/src/Components/Hooks/Transport/useCreateTransport.js

    re6c2521 r5528b99  
    44
    55const useCreateTransport = () => {
    6         const userId = JSON.parse(localStorage.getItem('user')).userId
     6
    77    const createTransport = async (transport, edit) => {
    88                        if(!edit)
    99                        {
    1010                                await axios
    11                     .post(`/transport/add/` + userId, transport)
     11                    .post(`/transport/add`, transport)
    1212                    .then((res) => {
    1313                        //history.push('/transport');
  • frontend/src/Components/Hooks/User/useLogin.js

    re6c2521 r5528b99  
    44import { Navigate, useAsyncValue, useNavigate } from "react-router-dom";
    55import LoginForm from "../../Login/LoginForm.js";
    6 import {useAuth} from "../../Context/AuthContext";
    76
    87const useLogin = () => {
    98
    109    const navigator = useNavigate()
    11         const Auth = useAuth();
    1210    //const history = useNavigate();
    1311    const login = async (loginData) => {
     
    2422                })
    2523                    .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                                         }
    4124                                        const sessionId = res.data.auth.details.sessionId;
    4225                                        const userId = res.data.auth.principal.userID;
    43 
     26                                       
    4427                                        localStorage.setItem("sessionId", sessionId);
    4528                                        localStorage.setItem("userId", userId);
  • frontend/src/Components/Hooks/useGet.js

    re6c2521 r5528b99  
    1111        console.log(localStorage.getItem("sessionId"))
    1212        console.log("url od get " + uurl)
     13<<<<<<< HEAD
    1314        await axios.get(uurl, {maxRedirects: 0}).then((res) => {
    1415            console.log(res);
     
    2223            // window.location.href = '/error'
    2324        })
     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)
    2433            .finally(() => {
    2534                setIsLoading(false);
     
    3140        getData(url);
    3241    }, [dep, url, changed]);
    33 
     42   
    3443    return {
    3544        data,
  • frontend/src/Components/HotelEdit/HotelEditTab.js

    re6c2521 r5528b99  
    11import 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";
     2import { Container, Col, Row, Image, Nav, Tab } from "react-bootstrap";
     3import { useState } from "react";
     4import { FaTaxi, FaHotel } from "react-icons/fa";
     5import { MdOutlineStickyNote2 } from "react-icons/md";
    66import AddNew from "../Resources/AddNew";
    7 import {BiData} from "react-icons/bi"
     7import { BiData } from "react-icons/bi"
    88import RoomListing from "./RoomListing";
    99import HotelEditForm from "./HotelEditForm";
    1010import AddHotelForm from "../Forms/AddHotelForm";
    1111import EditModal from "../Resources/EditModal";
    12 import AddAvailability from "../Resources/AddAvailability";
    13 import useGet from "../Hooks/useGet";
    14 import ReservationListing from "./ReservationListing";
    1512
    1613function HotelEditTab(props) {
    17     const [activeTab, setActiveTab] = useState("/hotel");
    18     const [modalData, setModalData] = useState("");
    19     const [show, setShow] = useState(false);
     14  const [activeTab, setActiveTab] = useState("/hotel");
     15  const [modalData, setModalData] = useState("");
     16  const [show, setShow] = useState(false);
    2017
    21     console.log(props)
     18  const handleClose = () => setShow(false);
     19  const handleShow = () => {
     20    //e.preventDefault();
     21    setShow(true);
    2222
    23     const {
    24         data,
    25         isLoading,
    26         setData,
    27         getData,
    28         setChanged
    29     } = useGet(`/hotel/${props.displayRoom.hotelId}/reservations/active`)
     23  };
    3024
    31     !isLoading && console.log(data)
     25  const showModal = (modalData) => {
     26    setModalData(modalData);
     27    handleShow();
     28  }
     29  console.log(props.displayRoom)
    3230
    33     const handleClose = () => setShow(false);
    34     const handleShow = () => {
    35         //e.preventDefault();
    36         setShow(true);
     31  const handleSelect = (eventKey) => {
     32    setActiveTab(eventKey);
     33  };
    3734
    38     };
    39 
    40     const showModal = (modalData) => {
    41         setModalData(modalData);
    42         handleShow();
    43     }
    44     console.log(props.displayRoom)
    45 
    46     const handleSelect = (eventKey) => {
    47         setActiveTab(eventKey);
    48     };
    49 
    50     return (
    51         <Container className="rounded-5">
    52             <Tab.Container
    53                 activeKey={activeTab}
    54                 onSelect={handleSelect}
    55                 className="bg-dark rounded-5"
    56             >
    57                 <Nav
    58                     fill
    59                     variant="tabs"
    60                     className="bg-body rounded-top-5"
    61                     activeKey="/hotel"
    62                     id="tab_item"
    63                 >
    64                     <Nav.Item className="tab_item rounded-5">
    65                         <Nav.Link eventKey="/hotel" className="text-left rounded-5">
     35  return (
     36    <Container className="rounded-5">
     37      <Tab.Container
     38        activeKey={activeTab}
     39        onSelect={handleSelect}
     40        className="bg-dark rounded-5"
     41      >
     42        <Nav
     43          fill
     44          variant="tabs"
     45          className="bg-body rounded-top-5"
     46          activeKey="/hotel"
     47          id="tab_item"
     48        >
     49          <Nav.Item className="tab_item rounded-5">
     50            <Nav.Link eventKey="/hotel" className="text-left rounded-5">
    6651              <span className="ikona">
    6752                <FaHotel
    68                     color="#159895"
    69                     style={{lineHeight: "100em"}}
    70                     size={"1.5em"}
    71                     className="mx-3"
     53                  color="#159895"
     54                  style={{ lineHeight: "100em" }}
     55                  size={"1.5em"}
     56                  className="mx-3"
    7257                />
    7358              </span>
    74                             <span className="ikona">Соби</span>
    75                         </Nav.Link>
    76                     </Nav.Item>
    77                     <Nav.Item className="tab_item">
    78                         <Nav.Link eventKey="/restaurant">
     59              <span className="ikona">Соби</span>
     60            </Nav.Link>
     61          </Nav.Item>
     62          <Nav.Item className="tab_item">
     63            <Nav.Link eventKey="/restaurant">
    7964              <span className="ikona">
    80                 <MdOutlineStickyNote2 color="#159895" size={"1.5em"} className="mx-3"/>
     65                <MdOutlineStickyNote2 color="#159895" size={"1.5em"} className="mx-3" />
    8166              </span>
    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">
     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">
    8772              <span className="ikona">
    88                 <BiData color="#159895" size={"1.5em"} className="mx-3"/>
     73                <BiData color="#159895" size={"1.5em"} className="mx-3" />
    8974              </span>
    90                             <span className="ikona">Општи податоци</span>
    91                         </Nav.Link>
    92                     </Nav.Item>
    93                 </Nav>
     75              <span className="ikona">Општи податоци</span>
     76            </Nav.Link>
     77          </Nav.Item>
     78        </Nav>
    9479
    95                 <Tab.Content className="py-5 px-3 border rounded-bottom-5 bg-light">
    96                     <Tab.Pane eventKey="/hotel">
    97                         {props.displayRoom.hotelRooms.map((room) => {
    98                             return <RoomListing key={room.hotelRoomId} data={room} showModal={showModal}/>
    99                         })}
    100                         <EditModal show={show} handleClose={handleClose} type="room" room={modalData}></EditModal>
    101                         <AddNew Id={props.displayRoom.hotelId} refresh={props.refresh} type="room"/>
    102                     </Tab.Pane>
    103                     <Tab.Pane eventKey="/restaurant">
    104                         {!isLoading && data.map((res) => {
    105                             return (
    106                                 <ReservationListing data={res}/>
    107                             )
    108                         })}
    109                         {/*<AddNew type="restaurant"/>*/}
    110                     </Tab.Pane>
    111                     <Tab.Pane eventKey="/transport">
    112                         <AddHotelForm refresh={props.refresh} hotel={props.displayRoom}/>
    113                     </Tab.Pane>
    114                 </Tab.Content>
    115             </Tab.Container>
    116         </Container>
    117     );
     80        <Tab.Content className="py-5 px-3 border rounded-bottom-5 bg-light">
     81          <Tab.Pane eventKey="/hotel">
     82          {props.displayRoom.hotelRooms.map((room) => {
     83              return <RoomListing key={room.hotelRoomId} data={room} showModal={showModal}/>
     84            })}
     85            <EditModal show={show} handleClose={handleClose} type="room" room={modalData}></EditModal>
     86            <AddNew Id={props.displayRoom.hotelId} refresh={props.refresh} type="room"/>
     87          </Tab.Pane>
     88          <Tab.Pane eventKey="/restaurant">
     89            <AddNew type="restaurant"/>
     90          </Tab.Pane>
     91          <Tab.Pane eventKey="/transport">
     92            <AddHotelForm refresh={props.refresh} hotel={props.displayRoom}/>
     93          </Tab.Pane>
     94        </Tab.Content>
     95      </Tab.Container>
     96    </Container>
     97  );
    11898}
    11999
  • frontend/src/Components/Layout/Navbar/Navigation.js

    re6c2521 r5528b99  
    77import useGet from "../../Hooks/useGet";
    88import axios from "../../../axios.js";
     9<<<<<<< HEAD
    910import {useAuth} from "../../Context/AuthContext";
    1011import ImageUpload from "../../ImageUpload/ImageUpload";
     12=======
     13>>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
    1114//import logo from 'assets/images/logo.png';
    1215//src="https://upload.wikimedia.org/wikipedia/commons/0/08/Vergina_Sun_-_Golden_Larnax.png"
     
    1417function Navigation(props) {
    1518  const navigator = useNavigate();
     19<<<<<<< HEAD
    1620  const Auth = useAuth();
    1721  const isLoggedIn = Auth.userIsAuthenticated();
     
    2226  const handleShow = () => setShow(true);
    2327
     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)
    2433  return (
    2534    <>
     
    3140      >
    3241        <Container>
    33           <Navbar.Brand href="/home">
     42          <Navbar.Brand href="#home">
    3443            <span className="ikona">
    3544              <Image
     
    5766                <Button onClick={handleShow}></Button>
    5867              </Nav.Link>
    59               {!isLoggedIn && (
     68              {!isLoading && !data && (
    6069                <Button
    6170                  className="m-2"
     
    6978                </Button>
    7079              )}
    71               {isLoggedIn && (
     80              {!isLoading && data && (
    7281                <>
    7382                  <Nav.Link className="m-2" href="/profile">
    74                     {Auth.getUser().username}
     83                    {data}
    7584                  </Nav.Link>
    7685                  <Button
     
    8190                      await axios.get("/logout")
    8291                      .then((res) => {
    83                         console.log(res);
    84                         Auth.userLogout();
     92                        console.log(res)
    8593                      })
    8694                      .catch((err) => {
  • frontend/src/Components/Resources/AddNew.js

    re6c2521 r5528b99  
    5656        </Modal.Header>
    5757        <Modal.Body>
    58             {props.type === "hotel" && <AddHotelForm closeModal={handleClose} refresh={props.refresh}/>}
    59             {props.type === "room" && <AddRoomForm closeModal={handleClose} refresh={props.refresh} hotelId={props.Id}/>}
    60             {props.type === "restaurant" && <AddRestaurantForm edit="false" closeModal={handleClose} refresh={props.refresh}/>}
    61             {props.type === "transport" && <AddTransportForm closeModal={handleClose} refresh={props.refresh}/>}
     58            {props.type === "hotel" && <AddHotelForm refresh={props.refresh}/>}
     59            {props.type === "room" && <AddRoomForm refresh={props.refresh} hotelId={props.Id}/>}
     60            {props.type === "restaurant" && <AddRestaurantForm edit="false" refresh={props.refresh}/>}
     61            {props.type === "transport" && <AddTransportForm refresh={props.refresh}/>}
    6262            {props.type === "menu" && <AddItemMenuForm Id={props.Id} refresh={props.refresh}/>}
    6363            {props.type === "route" && <AddTripForm transportId={props.transport.transportID} setSize={setSizeXl} refresh={props.refresh}/>}
  • frontend/src/Components/Resources/EditModal.js

    re6c2521 r5528b99  
    3232        </Modal.Header>
    3333        <Modal.Body>
    34             {props.type === "hotel" && <AddHotelForm refresh={props.refresh}/>}
     34            {props.type === "hotel" && <AddHotelForm/>}
    3535            {props.type === "room" && <EditRoomForm refresh={props.refresh} room={props.room}/>}
    3636            {props.type === "restaurant" && <AddRestaurantForm edit="false" refresh={props.refresh}/>}
  • frontend/src/Components/Resources/ResourceListing.js

    re6c2521 r5528b99  
    88
    99const ResourceListing = (props) => {
     10 
     11    console.log("props " + props.id)
     12 
    1013
    1114    const type = props.type == "hotel" ? "сместувањето" : props.type == "restaurant" ? "ресторанот" : "превозот";
    1215    const name = props.type == "hotel" ? props.data.hotelName : props.type == "restaurant" ? props.data.restaurantName : props.data.transportName
     16<<<<<<< HEAD
    1317    const id = props.type == "hotel" ? props.data.hotelId : props.type == "restaurant" ? props.data.restaurantID : props.data.transportID
    1418    console.log(props.data)
     
    5458                    </Col>
    5559                    <Col className="d-flex justify-content-center align-content-center">
     60=======
     61    const id = props.type == "hotel" ? props.data.hotelId : props.type == "restaurant" ? props.data.resturantId : props.data.transportID
     62    return(<>
     63    <a href={`${props.type}/${id}`} style={{textDecoration: "none", color:"black"}}>
     64        <Container className="py-3 px-1 my-4"
     65        style={{
     66          border: "4px solid #159895",
     67          borderRadius: "1em",
     68          boxShadow: "0 3px 5px #159895",
     69          maxWidth: "90%",
     70        }}>
     71            <Row>
     72                <Col className="d-flex justify-content-center">
     73                    <Image
     74                    src="https://www.imgacademy.com/sites/default/files/legacyhotel.jpg"
     75                    style={{
     76                        height: "8em",
     77                        borderRadius: "1em",
     78                        boxShadow: "0 4px 20px lightblue",
     79                        maxWidth: "100%",
     80                    }}
     81                    ></Image>
     82                </Col>
     83                <Col >
     84                    <h2 style={{textAlign: "left"}}>{name}</h2>
     85                    {props.type === "hotel" && (<>
     86                      <h5 style={{textAlign: "left"}}>{props.data.hotelLocation}</h5>
     87                      <h5 style={{textAlign: "left"}}>{props.data.hotelEmail}</h5>
     88                    </>)}
     89                    {props.type === "restaurant" && (<>
     90                      <h5 style={{textAlign: "left"}}>{props.data.restaurantLocation}</h5>
     91                      <h5 style={{textAlign: "left"}}>{props.data.cousineType} кујна</h5>
     92                    </>)}
     93                    {props.type === "transport" && (<>
     94                      <h5 style={{textAlign: "left"}}>{props.data.carBrand}</h5>
     95                      <h5 style={{textAlign: "left"}}>{props.data.carPlate}</h5>
     96                    </>)}
     97                </Col>
     98                <Col className="d-flex justify-content-center align-content-center" >
     99>>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
    56100                  <span
    57101                      style={{
  • frontend/src/Components/Resources/ResourcesTab.js

    re6c2521 r5528b99  
    1010
    1111function ResourcesTab(props) {
     12<<<<<<< HEAD
    1213    const [activeTab, setActiveTab] = useState(props.tab);
    1314    const userId = JSON.parse(localStorage.getItem("user")).userId;
     
    3536                    <Nav.Item className="tab_item rounded-5">
    3637                        <Nav.Link href="/resources/hotel" className="text-left rounded-5">
     38=======
     39  const [activeTab, setActiveTab] = useState(props.tab);
     40  // const [changed, setChanged] = useState(0);
     41  const userId = localStorage.getItem("userId");
     42  const { data, setData, isLoading, getData, setChanged } = useGet(`${props.tab}/user/${userId}`);
     43
     44  const handleSelect = (eventKey) => {
     45    setActiveTab(eventKey);
     46    console.log(props.refresh);
     47    props.refresh(eventKey);
     48    console.log("refresh" + eventKey);
     49  };
     50
     51  !isLoading && console.log(data);
     52  console.log(props.tab);
     53
     54  return (
     55    <Container className="rounded-5">
     56      <Tab.Container
     57        activeKey={activeTab}
     58        onSelect={handleSelect}
     59        className="bg-dark rounded-5"
     60      >
     61        <Nav
     62          fill
     63          variant="tabs"
     64          className="bg-body rounded-top-5"
     65          activeKey="/hotel"
     66          id="tab_item"
     67        >
     68          <Nav.Item className="tab_item rounded-5">
     69            <Nav.Link href="/resources/hotel" className="text-left rounded-5">
     70>>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
    3771              <span className="ikona">
    3872                <FaHotel
     
    67101                </Nav>
    68102
     103<<<<<<< HEAD
    69104                <Tab.Content className="py-5 px-3 border rounded-bottom-5 bg-light">
    70105                    <Tab.Pane eventKey="/hotel" key="hotelPane">
     
    115150        </Container>
    116151    );
     152=======
     153        <Tab.Content className="py-5 px-3 border rounded-bottom-5 bg-light">
     154          <Tab.Pane eventKey="/hotel" key="hotelPane">
     155            {props.tab == "/hotel" && !isLoading && data != null &&
     156              data.map((hotel) => {
     157                return (
     158                  <Link key={hotel.hotelId} to={"/resources/hotel/" + hotel.hotelId}>
     159                    <ResourceListing
     160                      key={hotel.hotelId}
     161                      id={hotel.hotelId}
     162                      type="hotel"
     163                      data={hotel}
     164                    />
     165                  </Link>
     166                );
     167              })}
     168            <AddNew type="hotel" refresh={setChanged} />
     169          </Tab.Pane>
     170          <Tab.Pane eventKey="/restaurant" key="restaurantPane">
     171            {props.tab == "/restaurant" && !isLoading && data != null &&
     172              data.map((restaurant) => {
     173                console.log("mapiranje " + restaurant)
     174                return (
     175                  <Link key={restaurant.restaurantId} to={"/resources/restaurant/" + restaurant.restaurantID}>
     176                    <ResourceListing
     177                      key={restaurant.restaurantId}
     178                      type="restaurant"
     179                      data={restaurant}
     180                    />
     181                  </Link>
     182                );
     183              })}
     184            <AddNew type="restaurant" refresh={setChanged}/>
     185          </Tab.Pane>
     186          <Tab.Pane eventKey="/transport" key="transportPane">
     187            {props.tab == "/transport" && !isLoading && data.length > 0 &&
     188              data.map((transport) => {
     189                return (
     190                  <ResourceListing
     191                    key={transport.transportId}
     192                    id={transport.transportId}
     193                    type="transport"
     194                    data={transport}
     195                  />
     196                );
     197              })}
     198            <AddNew type="transport" refresh={setChanged}/>
     199          </Tab.Pane>
     200        </Tab.Content>
     201      </Tab.Container>
     202    </Container>
     203  );
     204>>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
    117205}
    118206
  • frontend/src/Components/RestaurantEdit/RestaurantEditTab.js

    re6c2521 r5528b99  
    100100              return <MenuListing key={menu.menuId} data={menu} showModal={showModal}/>
    101101            })}
    102             {activeTab === '/hotel' && <EditModal show={show} refresh={props.refresh} handleClose={handleClose} type="menu" menu={modalData}></EditModal>}
     102            {activeTab === '/hotel' && <EditModal show={show} handleClose={handleClose} type="menu" menu={modalData}></EditModal>}
    103103            <AddNew Id={props.displayMenu.restaurantID} refresh={props.refresh} type="menu"/>
    104104          </Tab.Pane>
  • frontend/src/Components/SearchCriterias/SearchCriteriasBar.js

    re6c2521 r5528b99  
    22import { Container, Form, Button, Row, Col } from "react-bootstrap";
    33import useFormData from "../Hooks/useFormData";
     4<<<<<<< HEAD
    45import SearchCriteriasHotel from "./SearchCriteriasHotel";
    56import SearchCriteriasTransport from "./SearchCriteriasTransport";
    67import SearchCriteriasRestaurant from "./SearchCriteriasRestaurant";
     8=======
     9>>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
    710
    8 const SearchCriteriasBar = (props) => {
     11const SearchCriterias = (props) => {
    912
    10     const { criterias, type } = props
     13  const { formData, onFormChange, onCheckBoxChange, setFormData} = useFormData(props.criterias)
     14  console.log("KRITERIUMI")
     15  console.log(formData)
    1116
     17<<<<<<< HEAD
    1218    return (
    1319        <>
     
    1824    )
    1925}
     26=======
     27  return (
     28    <>
     29      <Container
     30        className="p-1 pb-0 mb-5 mt-3 rounded-2"
     31        style={{ backgroundColor: "#002B5B", width: "65%"}}
     32      >
     33        <Form className="rounded-5">
     34          <Row className="gx-1">
     35            <Col>
     36              <Form.Floating className="mb-3">
     37                <Form.Control
     38                  size="md"
     39                  type="text"
     40                  placeholder="Каде ќе патувате?:"
     41                  id="location"
     42                  name="hotelLocation"
     43                  onChange={onFormChange}
     44                  value={formData.hotelLocation}
     45                ></Form.Control>
     46                <label htmlFor="location">Локација:</label>
     47              </Form.Floating>
     48            </Col>
     49            <Col>
     50              <Form.Floating className="mb-3">
     51                <Form.Control
     52                  size="md"
     53                  type="date"
     54                  placeholder="Датум на пристигнување:"
     55                  id="dateFrom"
     56                  name="dateFrom"
     57                  onChange={onFormChange}
     58                  value={formData.dateFrom}
     59                ></Form.Control>
     60                <label htmlFor="dateFrom">Датум на пристигнување:</label>
     61              </Form.Floating>
     62            </Col>
     63            <Col>
     64              <Form.Floating className="mb-3">
     65                <Form.Control
     66                  size="md"
     67                  type="date"
     68                  placeholder="Датум на заминување:"
     69                  id="dateTo"
     70                  name="dateTo"
     71                  onChange={onFormChange}
     72                  value={formData.dateTo}
     73                ></Form.Control>
     74                <label htmlFor="dateTo">Датум на заминување:</label>
     75              </Form.Floating>
     76            </Col>
     77            <Col>
     78              <Form.Floating className="mb-3">
     79                <Form.Control
     80                  size="md"
     81                  type="number"
     82                  placeholder="Број на гости:"
     83                  id="floatingPassengers"
     84                  name="numBeds"
     85                  onChange={onFormChange}
     86                  value={formData.numBeds}
     87                ></Form.Control>
     88                <label htmlFor="floatingPassengers">Број на гости:</label>
     89              </Form.Floating>
     90            </Col>
     91            <Col>
     92              <Form.Group className="my-1">
     93                <Button
     94                  type="submit"
     95                  style={{ backgroundColor: "#159895" }}
     96                  size="lg"
     97                  className="w-100"
     98                  onClick={(e) => {
     99                    e.preventDefault();
     100                    window.location.href = `/search/hotel/${formData.hotelLocation}/${formData.dateFrom}/${formData.dateTo}/${formData.numBeds}`
     101                  }}
     102                >
     103                  <span className="ikona mx-3">Пребарај</span>
     104                </Button>
     105              </Form.Group>
     106            </Col>
     107          </Row>
     108        </Form>
     109      </Container>
     110    </>
     111  );
     112};
     113>>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
    20114
    21 export default SearchCriteriasBar;
     115export default SearchCriterias;
  • frontend/src/Components/Tab/TabFormTransport.js

    re6c2521 r5528b99  
    22import { Button, Col, Container, Form, Row } from "react-bootstrap";
    33import { HiMagnifyingGlass } from "react-icons/hi2"
    4 import useFormData from "../Hooks/useFormData";
    54
    65function TabFormTransport() {
    7 
    8   const { formData, onFormChange, setFormData } = useFormData({
    9     from: undefined,
    10     to: undefined,
    11     date: undefined,
    12     numPassengers: 0
    13   })
    14 
    156  return (
    167    <Form>
     
    2314              placeholder="Од:"
    2415              id="floatingFrom"
    25               value={formData.from}
    26               name={'from'}
    27               onChange={onFormChange}
    2816            ></Form.Control>
    2917            <label htmlFor="floatingFrom">Од:</label>
     
    3725              placeholder="До:"
    3826              id="floatingTo"
    39               name={'to'}
    40               value={formData.to}
    41               onChange={onFormChange}
    4227            ></Form.Control>
    4328            <label htmlFor="floatingTo">До:</label>
     
    5136              placeholder="Датум:"
    5237              id="floatingDate"
    53               name={'date'}
    54               value={formData.date}
    55               onChange={onFormChange}
    5638            ></Form.Control>
    5739            <label htmlFor="floatingDate">Датум:</label>
     
    6446              type="number"
    6547              placeholder="Број на патници:"
    66               name={'numPassengers'}
    6748              id="floatingPassengers"
    68               value={formData.numPassengers}
    69               onChange={onFormChange}
    7049            ></Form.Control>
    7150            <label htmlFor="floatingPassengers">Број на патници:</label>
    7251          </Form.Floating>
    7352          <Form.Group className="my-1">
    74             <Button type="submit" style={{backgroundColor: "#159895"}} size="lg" onClick={(e) => {
    75               e.preventDefault();
    76               window.location.href = `/search/transport/${formData.from}/${formData.to}/${formData.date}/${formData.numPassengers}`
    77             }}>
     53            <Button type="submit" style={{backgroundColor: "#159895"}} size="lg">
    7854              <span className="ikona my-1"><HiMagnifyingGlass/></span>
    7955              <span className="ikona mx-3">Пребарај</span>
  • frontend/src/Components/TransportDetails/FinalPoint.js

    re6c2521 r5528b99  
    1717    <>
    1818      <Row>
    19         {props.left === "true" && <Col className="d-flex flex-column justify-content-center col-md-4" style={{paddingLeft: "2.6rem"}}>
     19        {props.left === "true" && <Col className="d-flex flex-column justify-content-center col-auto" style={{paddingLeft: "2.6rem"}}>
    2020            <h5 className="m-auto">{getTimeAsString(props.time)}</h5>
    2121        </Col>  }
  • frontend/src/Components/TransportDetails/Line.js

    re6c2521 r5528b99  
    22
    33const Line = (props) => {
    4     const left = props.left === "true" ? "1.8rem" : "1.85rem";
     4    console.log(props.left)
     5    const left = props.left === "true" ? "9.08rem" : "2.6rem";
     6    console.log({borderLeft: "5px solid #159895", height: "3em", marginLeft: left, marginTop: "-1.4rem", marginBottom: "-1.4rem"})
    57    return (<>
    68        <div style={{borderLeft: "5px solid #159895", height: "3em", marginLeft: left, marginTop: "-1.4rem", marginBottom: "-1.4rem"}}></div>
  • frontend/src/Components/TransportDetails/Waypoint.js

    re6c2521 r5528b99  
    1616    }
    1717
     18<<<<<<< HEAD
    1819    return (
    1920        <>
     
    5758        </>
    5859    );
     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)
    5983};
    6084
  • frontend/src/Components/TransportEdit/TransportEditTab.js

    re6c2521 r5528b99  
    1212function TransportEditTab(props) {
    1313  const [activeTab, setActiveTab] = useState("/hotel");
     14  const link = "/transport/" + props.displayRoute.transportID + "/available";
    1415  console.log(props.displayRoute)
     16  const [changed, setChanged] = useState(0)
     17  const { data, setData, isLoading, getData } = useGet(link, changed);
    1518
    1619
  • frontend/src/Components/TransportEdit/TransportListing.js

    re6c2521 r5528b99  
    99
    1010    //const type = props.type == "hotel" ? "сместувањето" : props.type == "restaurant" ? "ресторанот" : "превозот";
     11    console.log(props.data)
     12    console.log(props.data.from)
    1113    return (<>
    1214        <a href="#" style={{textDecoration: "none", color: "black"}}>
     
    3234                    <Col className="d-flex flex-column justify-content-center" style={{textAlign: "left"}}>
    3335                        <h2>{props.data.from} - {props.data.to}</h2>
     36                        {/* <h6>{props.data.routeCities}</h6> */}
    3437                        <h6>{props.data.routes.map(x => x).join(", ")}</h6>
    3538                    </Col>
     
    3740                    <Col className="d-flex flex-column justify-content-center align-content-center">
    3841                        <h5>Цена:</h5>
    39                          <h4>{props.data.maxPrice}$</h4>
     42                        {/* <h4>{props.data.routePrice}</h4> */}
     43                        <h4>99$</h4>
    4044                    </Col>
    4145                </Row>
  • frontend/src/Components/useFormNested.js

    re6c2521 r5528b99  
    77        console.log(e)
    88
    9         const dependantRoutes = e.target.name === 'freeSpace' ? e.target.parentElement.getAttribute('dependantRoutes').split(',') : undefined;
     9        const dependantRoutes = e.target.parentElement.getAttribute('dependantRoutes').split(',')
    1010        console.log(dependantRoutes)
    1111
  • frontend/src/Pages/HotelDetailsPage.js

    re6c2521 r5528b99  
    11import React from "react";
    22import LoginForm from "../Components/Login/LoginForm";
     3<<<<<<< HEAD
    34import {Container, Row, Col, Form, FloatingLabel, Modal, Button} from "react-bootstrap";
     5=======
     6import { Container, Row, Col, Form } from "react-bootstrap";
     7>>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
    48import Navigation from "../Components/Layout/Navbar/Navigation";
    59import Carousel from "react-bootstrap/Carousel";
     
    6973                  placeholder="Каде ќе патувате?:"
    7074                  id="location"
    71                   value={data.hotelLocation}
    7275                ></Form.Control>
    73                 <label style={{left: "10px"}} htmlFor="location">Локација:</label>
     76                <label htmlFor="location">Локација:</label>
    7477              </Form.Floating>
    7578            </Row>
     
    8184                  placeholder="Датум на пристигнување:"
    8285                  id="dateFrom"
    83                   value={from}
    8486                ></Form.Control>
    85                 <label style={{left: "10px"}} htmlFor="dateFrom">Датум на пристигнување:</label>
     87                <label htmlFor="dateFrom">Датум на пристигнување:</label>
    8688              </Form.Floating>
    8789            </Row>
     
    9395                  placeholder="Датум на заминување:"
    9496                  id="dateTo"
    95                   value={to}
    9697                ></Form.Control>
    97                 <label style={{left: "10px"}} htmlFor="dateTo">Датум на заминување:</label>
     98                <label htmlFor="dateTo">Датум на заминување:</label>
    9899              </Form.Floating>
    99100            </Row>
     
    106107                  id="floatingPassengers"
    107108                ></Form.Control>
    108                 <label style={{left: "10px"}} htmlFor="floatingPassengers">Број на гости:</label>
     109                <label htmlFor="floatingPassengers">Број на гости:</label>
    109110              </Form.Floating>
    110111            </Row>
  • frontend/src/Pages/HotelEditPage.js

    re6c2521 r5528b99  
    1 import React, {useState} from "react";
    2 import {Container, Col, Row, Image} from "react-bootstrap";
     1import React, { useState } from "react";
     2import { Container, Col, Row, Image } from "react-bootstrap";
    33import Navigation from "../Components/Layout/Navbar/Navigation";
    44import ResourcesTab from "../Components/Resources/ResourcesTab";
    55import HotelEditTab from "../Components/HotelEdit/HotelEditTab";
    66import useGet from "../Components/Hooks/useGet";
    7 import {Navigate, useParams} from "react-router-dom";
    8 import {useAuth} from "../Components/Context/AuthContext";
     7import { useParams } from "react-router-dom";
    98
    109
    1110const HotelEditPage = () => {
    1211
    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);
     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);
    1716
    1817
    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     );
     18  console.log(data)
     19  return (
     20    <>
     21      <Navigation />
     22      {!isLoading && <Container>
     23        <Row className="mb-5">
     24          <h2 style={{ color: "#159895", textAlign: "left" }}>Мои ресурси</h2>
     25        </Row>
     26        <Row className="mb-5">
     27          <Col>
     28            <Row className="d-flex mb-3">
     29              <Col
     30                className="d-flex justify-content-center"
     31                style={{ maxWidth: "30%" }}
     32              >
     33                <Image
     34                  src="https://t3.ftcdn.net/jpg/05/16/27/58/360_F_516275801_f3Fsp17x6HQK0xQgDQEELoTuERO4SsWV.jpg"
     35                  style={{
     36                    height: "5em",
     37                    borderRadius: "50%",
     38                    maxWidth: "100%",
     39                  }}
     40                  className="m-auto"
     41                ></Image>
     42              </Col>
     43              <Col className="d-flex justify-content-center">
     44                <Container className="pt-2" style={{ textAlign: "left" }}>
     45                  <h4>{data.hotelName}</h4>
     46                  <h5>{data.hotelLocation}</h5>
     47                </Container>
     48              </Col>
     49            </Row>
     50          </Col>
     51        </Row>
     52        <Row>
     53            <HotelEditTab refresh={setChanged} displayRoom={data}/>
     54        </Row>
     55      </Container>}
     56    </>
     57  );
    5958};
    6059
  • frontend/src/Pages/LoginErrorPage.js

    re6c2521 r5528b99  
    1111    const [show, setShow] = useState(false);
    1212    const [changed, setChanged] = useState(0);
     13    const {data, isLoading} = useGet("/username")
    1314    const userId = localStorage.getItem("userId")
    1415    const [registered, setRegistered] = useState(false);
  • frontend/src/Pages/LoginPage.js

    re6c2521 r5528b99  
    33import { Container } from "react-bootstrap";
    44import Navigation from "../Components/Layout/Navbar/Navigation";
    5 import {useAuth} from "../Components/Context/AuthContext";
    6 import {Navigate} from "react-router-dom";
    7 
    85
    96const LoginPage = () => {
     
    118  document.body.style.marginTop = "auto";
    129  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 
    2110  return (
    2211    <>
  • frontend/src/Pages/NoBusinessRegisteredError.js

    re6c2521 r5528b99  
    66import RegisterBusinessForm from "../Components/Forms/RegisterBusinessForm";
    77import useGet from "../Components/Hooks/useGet";
    8 import {Navigate, useNavigate} from "react-router-dom";
    9 import {useAuth} from "../Components/Context/AuthContext";
     8import { useNavigate } from "react-router-dom";
    109
    1110const NoBusinessRegisteredError = (props) => {
    1211  const [show, setShow] = useState(false);
    1312  const [changed, setChanged] = useState(0);
    14   const Auth = useAuth();
    15   const isLoggedIn = Auth.userIsAuthenticated();
     13  const {data, isLoading} = useGet("/username")
    1614  const userId = localStorage.getItem("userId")
    1715  const [registered, setRegistered] = useState(false);
     
    4745
    4846
    49   if(!isLoggedIn)
    50   {
    51     return <Navigate to={'/login'}/>
    52   }
     47  console.log(data)
    5348
     49  !isLoading && !data && navigator("/login")
    5450  !firmaIsLoading && firma && firma.length > 0 && firma[0].approved && navigator("/resources/hotel")
    5551 
  • frontend/src/Pages/ProfilePage.js

    re6c2521 r5528b99  
    88import ChangePasswordForm from "../Components/Forms/ChangePasswordForm";
    99import useGet from "../Components/Hooks/useGet";
    10 import {useAuth} from "../Components/Context/AuthContext";
    11 import {Navigate} from "react-router-dom";
    1210
    1311const ProfilePage = () => {
    1412
    15     const { data, setData, isLoading, getData } = useGet("/principal");
     13  const { data, setData, isLoading, getData } = useGet("/principal");
    1614
    17 
    18 
     15 
    1916    const profileData = {
    2017        "name": "Марко",
     
    2219        "address": "ул. Раскрсница бр. 10",
    2320        "dateOfBirth": "2002-01-01",
    24         "country": "Македонија",
     21        "country": "Никогаш Северна само МАКЕДОНИЈА",
    2522        "zip": "1000",
    2623        "city": "Скопје",
     
    3027
    3128
    32 
    3329  return (
    3430    <>
    3531      <Navigation />
    36     {!isLoading && <Container>
     32{      !isLoading && <Container>
    3733        <Row className="mb-5">
    3834          <h2 style={{ color: "#159895", textAlign: "left" }}>Мојот профил</h2>
  • frontend/src/Pages/ResourcesPage.js

    re6c2521 r5528b99  
    11import React from "react";
    2 import {Container, Col, Row, Image} from "react-bootstrap";
     2import { Container, Col, Row, Image } from "react-bootstrap";
    33import Navigation from "../Components/Layout/Navbar/Navigation";
    44import ResourcesTab from "../Components/Resources/ResourcesTab";
    5 import {useState} from "react";
     5import { useState } from "react";
    66import useGet from "../Components/Hooks/useGet";
    7 import {useAuth} from "../Components/Context/AuthContext";
    8 import {Navigate} from "react-router-dom";
    97
    108const ResourcesPage = (props) => {
    119
    12     const Auth = useAuth();
    13     const user = Auth.getUser();
     10  console.log(props.tab)
     11  const { data, setData, isLoading, getData } = useGet("/principal");
    1412
    15     return (
    16         <>
    17             <Navigation/>
    18             {<Container>
    19                 <Row className="mb-5">
    20                     <h2 style={{color: "#159895", textAlign: "left"}}>Мои ресурси</h2>
    21                 </Row>
    22                 <Row className="mb-5">
    23                     <Col>
    24                         <Row className="d-flex mb-3">
    25                             <Col
    26                                 className="d-flex justify-content-center"
    27                                 style={{maxWidth: "30%"}}
    28                             >
    29                                 <Image
    30                                     src="https://t3.ftcdn.net/jpg/05/16/27/58/360_F_516275801_f3Fsp17x6HQK0xQgDQEELoTuERO4SsWV.jpg"
    31                                     style={{
    32                                         height: "5em",
    33                                         borderRadius: "50%",
    34                                         maxWidth: "100%",
    35                                     }}
    36                                     className="m-auto"
    37                                 ></Image>
    38                             </Col>
    39                             <Col className="d-flex justify-content-center">
    40                                 <Container className="pt-2" style={{textAlign: "left"}}>
    41                                     <h4>{user.name + " " + user.surname}</h4>
    42                                     <h5>{user.username}</h5>
    43                                 </Container>
    44                             </Col>
    45                         </Row>
    46                     </Col>
    47                 </Row>
    48                 <Row>
    49                     <ResourcesTab tab={props.tab}></ResourcesTab>
    50                 </Row>
    51             </Container>}
    52         </>
    53     );
     13
     14  return (
     15    <>
     16      <Navigation />
     17{!isLoading && <Container>
     18        <Row className="mb-5">
     19          <h2 style={{ color: "#159895", textAlign: "left" }}>Мои ресурси</h2>
     20        </Row>
     21        <Row className="mb-5">
     22          <Col>
     23            <Row className="d-flex mb-3">
     24              <Col
     25                className="d-flex justify-content-center"
     26                style={{ maxWidth: "30%" }}
     27              >
     28                <Image
     29                  src="https://t3.ftcdn.net/jpg/05/16/27/58/360_F_516275801_f3Fsp17x6HQK0xQgDQEELoTuERO4SsWV.jpg"
     30                  style={{
     31                    height: "5em",
     32                    borderRadius: "50%",
     33                    maxWidth: "100%",
     34                  }}
     35                  className="m-auto"
     36                ></Image>
     37              </Col>
     38              <Col className="d-flex justify-content-center">
     39                <Container className="pt-2" style={{ textAlign: "left" }}>
     40                  <h4>{data.name + " " + data.surname}</h4>
     41                  <h5>{data.email}</h5>
     42                </Container>
     43              </Col>
     44            </Row>
     45          </Col>
     46        </Row>
     47        <Row>
     48            <ResourcesTab tab={props.tab}></ResourcesTab>
     49        </Row>
     50      </Container>}
     51    </>
     52  );
    5453};
    5554
  • frontend/src/Pages/RestaurantEditPage.js

    re6c2521 r5528b99  
    66import RestaurantEditTab from "../Components/RestaurantEdit/RestaurantEditTab";
    77import useGet from "../Components/Hooks/useGet";
    8 import {Navigate, useParams, useSearchParams} from "react-router-dom";
    9 import {useAuth} from "../Components/Context/AuthContext";
     8import { useParams, useSearchParams } from "react-router-dom";
    109
    1110const RestaurantEditPage = () => {
  • frontend/src/Pages/SearchPage.js

    re6c2521 r5528b99  
    1111import BecomeAHost from "../Components/BecomeAHost/BecomeAHost"
    1212import HotelLisitng from "../Components/Listings/HotelListing"
    13 import SearchCriteriasHotel from "../Components/SearchCriterias/SearchCriteriasHotel";
     13import SearchCriterias from "../Components/SearchCriterias/SearchCriteriasBar";
    1414import SortButton from "../Components/Listings/SortButton";
    1515import FilterButton from "../Components/Listings/FilterButton";
     
    1717import useGet from "../Components/Hooks/useGet";
    1818import { useParams } from "react-router-dom";
     19<<<<<<< HEAD
    1920import SearchCriteriasBar from "../Components/SearchCriterias/SearchCriteriasBar";
    2021import RestaurantDetailsPage from "./RestaurantDetailsPage";
    2122import RestaurantListing from "../Components/Listings/RestaurantListing";
     23=======
     24>>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
    2225
    2326
     
    3942    }
    4043   
     44<<<<<<< HEAD
    4145    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)
    4249    console.log(link)
    4350    console.log(params.date)
     
    4754        <>
    4855            <Navigation></Navigation>
    49             <SearchCriteriasBar type={props.type} criterias={useParams()}></SearchCriteriasBar>
     56            <SearchCriterias criterias={useParams()}></SearchCriterias>
    5057            <Container className="d-flex justify-content-end gx-5" style={{maxWidth: "60%"}}>
    5158                <Row>
  • frontend/src/Pages/TransportEditPage.js

    re6c2521 r5528b99  
    1 import React, {useState} from "react";
    2 import {Container, Col, Row, Image} from "react-bootstrap";
     1import React, { useState } from "react";
     2import { Container, Col, Row, Image } from "react-bootstrap";
    33import Navigation from "../Components/Layout/Navbar/Navigation";
    44import ResourcesTab from "../Components/Resources/ResourcesTab";
     
    77import TransportEditTab from "../Components/TransportEdit/TransportEditTab";
    88import useGet from "../Components/Hooks/useGet";
    9 import {Navigate, useParams} from "react-router-dom";
    10 import {useAuth} from "../Components/Context/AuthContext";
     9import { useParams } from "react-router-dom";
    1110
    1211const 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);
    1317
    14     const params = useParams();
     18  !isLoading && console.log(data)
    1519
    16     const link = "/transport/" + params.transportId;
    17 
    18     const {data, setData, isLoading, getData, setChanged} = useGet(link);
    19 
    20     !isLoading && console.log(data)
    21 
    22     return (
    23         <>
    24             <Navigation/>
    25             {!isLoading && (
    26                 <Container>
    27                     <Row className="mb-5">
    28                         <h2 style={{color: "#159895", textAlign: "left"}}>Мои ресурси</h2>
    29                     </Row>
    30                     <Row className="mb-5">
    31                         <Col>
    32                             <Row className="d-flex mb-3">
    33                                 <Col
    34                                     className="d-flex justify-content-center"
    35                                     style={{maxWidth: "30%"}}
    36                                 >
    37                                     <Image
    38                                         src="https://t3.ftcdn.net/jpg/05/16/27/58/360_F_516275801_f3Fsp17x6HQK0xQgDQEELoTuERO4SsWV.jpg"
    39                                         style={{
    40                                             height: "5em",
    41                                             borderRadius: "50%",
    42                                             maxWidth: "100%",
    43                                         }}
    44                                         className="m-auto"
    45                                     ></Image>
    46                                 </Col>
    47                                 <Col className="d-flex justify-content-center">
    48                                     <Container className="pt-2" style={{textAlign: "left"}}>
    49                                         <h4>{data.transportName}</h4>
    50                                         <h5>{data.carBrand + " " + data.carType}</h5>
    51                                     </Container>
    52                                 </Col>
    53                             </Row>
    54                         </Col>
    55                     </Row>
    56                     <Row>
    57                         {data && <TransportEditTab displayRoute={data} refresh={setChanged}/>}
    58                     </Row>
    59                 </Container>
    60             )}
    61         </>
    62     );
     20  return (
     21    <>
     22      <Navigation />
     23      {!isLoading && (
     24        <Container>
     25          <Row className="mb-5">
     26            <h2 style={{ color: "#159895", textAlign: "left" }}>Мои ресурси</h2>
     27          </Row>
     28          <Row className="mb-5">
     29            <Col>
     30              <Row className="d-flex mb-3">
     31                <Col
     32                  className="d-flex justify-content-center"
     33                  style={{ maxWidth: "30%" }}
     34                >
     35                  <Image
     36                    src="https://t3.ftcdn.net/jpg/05/16/27/58/360_F_516275801_f3Fsp17x6HQK0xQgDQEELoTuERO4SsWV.jpg"
     37                    style={{
     38                      height: "5em",
     39                      borderRadius: "50%",
     40                      maxWidth: "100%",
     41                    }}
     42                    className="m-auto"
     43                  ></Image>
     44                </Col>
     45                <Col className="d-flex justify-content-center">
     46                  <Container className="pt-2" style={{ textAlign: "left" }}>
     47                    <h4>{data.transportName}</h4>
     48                    <h5>{data.carBrand + " " + data.carType}</h5>
     49                  </Container>
     50                </Col>
     51              </Row>
     52            </Col>
     53          </Row>
     54          <Row>
     55            {data && <TransportEditTab displayRoute={data} refresh={setChanged}/>}
     56          </Row>
     57        </Container>
     58      )}
     59    </>
     60  );
    6361};
    6462
  • frontend/src/axios.js

    re6c2521 r5528b99  
    11import axios from "axios";
    2 
    32
    43const instance = axios.create({
    54    baseURL: "http://localhost:8080/",
    65    withCredentials: true,
    7     maxRedirects: 1,
    8     beforeRedirect: (options, { headers }) => {
    9         console.log(options)
    10         if (options.hostname === "example.com") {
    11             options.auth = "user:password";
    12         }}
    13 
     6    maxRedirects: 1
    147})
    158
     9instance.interceptors.response.use(function (response) {
     10    // Any status code that lie within the range of 2xx cause this function to trigger
     11    // Do something with response data
     12    return response;
     13  }, function (error) {
     14    console.log(error)
     15    //  window.location.href="/login"
     16    // Any status codes that falls outside the range of 2xx cause this function to trigger
     17    // Do something with response error
     18    return Promise.reject(error);
     19  });
     20
    1621export default instance
  • src/main/java/com/tourMate/config/SecurityConfig.java

    re6c2521 r5528b99  
    77import org.springframework.http.HttpHeaders;
    88import org.springframework.http.HttpMethod;
    9 import org.springframework.http.HttpStatus;
    109import org.springframework.security.config.annotation.web.builders.HttpSecurity;
    1110import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
     
    1514import org.springframework.security.web.SecurityFilterChain;
    1615import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
    17 import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler;
    1816import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
    1917import org.springframework.web.cors.CorsConfiguration;
     
    7674                                        .anyRequest().authenticated()
    7775                                        .and()
    78                                         .formLogin()
     76                                        .formLogin().loginPage("http://localhost:3000/login")
    7977                                        .loginProcessingUrl("/api/login").usernameParameter("username").passwordParameter("password")
    8078                                        .successHandler((request, response, authentication) -> {
    8179                                            response.setStatus(HttpServletResponse.SC_OK);
    82                                             response.setCharacterEncoding("UTF-8");
    8380                                            response.setContentType("application/json");
    8481                                            response.getWriter().print("{\"message\": \"Login successful\",");
     
    8885                                        .failureHandler((request, response, exception) -> {
    8986                                            response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
    90                                             response.sendRedirect("/login");
    91                                             response.getWriter().print("Neuspesna najava\n" + exception.getMessage());
     87                                            response.getWriter().print("Pukla veza\n" + exception.getMessage());
    9288                                            response.getWriter().flush();
    9389                                        })
     
    9793                                        .sessionCreationPolicy(SessionCreationPolicy.ALWAYS)
    9894                                        .and()
    99                                         .logout().logoutSuccessHandler((new HttpStatusReturningLogoutSuccessHandler(HttpStatus.OK)))
     95                                        .logout()
    10096                                        .permitAll();
    10197
  • src/main/java/com/tourMate/controllers/HotelController.java

    re6c2521 r5528b99  
    22
    33import com.tourMate.dto.HotelDto;
    4 import com.tourMate.dto.HotelReservationDto;
    5 import com.tourMate.dto.HotelReservationUserDto;
    64import com.tourMate.entities.*;
    75import com.tourMate.services.HotelManager;
     
    106104    //HOTEL ROOM CRUD
    107105    @PostMapping(path = "/hotel/rooms/add")
    108     public void addRoom(@RequestBody HotelRoom room,
    109                         @RequestParam(name = "hotelId") long hotelId) {
     106    public void addRoom(@RequestBody HotelRoom room, @RequestParam(name = "hotelId") long hotelId) {
    110107        Hotels h = hotelManager.findHotelByID(hotelId);
    111         hotelManager.createRoom(h, room.getHotelRoomDescription(), room.getHotelRoomName(), room.getKitchenAvailable(), room.getAirConditioning(), room.getBalcony(), room.getPrice(), room.getNumOfBeds());
     108        hotelManager.createRoom(h, room.getHotelRoomDescription(), room.getHotelRoomName(), room.getKitchenAvailable(), room.getAirConditioning(), room.getBalcony(), room.getPrice());
    112109    }
    113110
     
    152149        //HOTEL AVAILABILITY CRUD
    153150    @PostMapping(path = "/hotel/rooms/available/{id}/add")
    154     public void addRoomAvailible(@RequestBody HotelRoomAvailable hotelRoomAvailable,
    155                                  @PathVariable long id)
     151    public void addRoomAvailible(@RequestBody HotelRoomAvailable hotelRoomAvailable, @PathVariable long id)
    156152    {
    157153        HotelRoom hotelRoom = hotelManager.findRoomById(id);
     
    182178    public List<HotelRoomAvailable> getRoomAvailability(@PathVariable Long id)
    183179    {
    184         return hotelManager.getRoomsAvailableById(id);
     180        return hotelManager.getRoomsAvailibility();
    185181    }
    186182
    187183    @GetMapping(path = "/hotel/search")
    188     public List<HotelDto> searchAvailibleRooms(@RequestParam(name = "hotelLocation") String hotelLocation,
    189                                                @RequestParam(name = "dateFrom") @DateTimeFormat(pattern = "yyyy-MM-dd") Date dateFrom,
    190                                                @RequestParam(name = "dateTo") @DateTimeFormat(pattern = "yyyy-MM-dd") Date dateTo,
    191                                                @RequestParam(name = "numBeds") int numBeds)
     184    public List<HotelDto> searchAvailibleRooms(@RequestParam(name = "hotelLocation") String hotelLocation, @RequestParam(name = "dateFrom") @DateTimeFormat(pattern = "yyyy-MM-dd") Date dateFrom,
     185                                               @RequestParam(name = "dateTo") @DateTimeFormat(pattern = "yyyy-MM-dd") Date dateTo, @RequestParam(name = "numBeds") int numBeds)
    192186    {
    193187        System.out.println(hotelLocation);
     
    209203    }
    210204
     205<<<<<<< HEAD
    211206    @GetMapping(path = "/hotel/{id}/reservations/active")
    212207    public List<HotelReservationDto> getActiveReservationsForHotel(@PathVariable Long id)
     
    238233        return hotelManager.getRoomImages(id);
    239234    }
     235=======
     236>>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
    240237}
  • src/main/java/com/tourMate/controllers/TransportController.java

    re6c2521 r5528b99  
    2020
    2121    // TRANSPORT CRUD //
    22     @PostMapping(path = "/transport/add/{userId}")
    23     public void add(@RequestBody Transport transport,
    24                     @PathVariable Long userId) {
    25         transportManager.createTransport(transport.getTransportName(), transport.getCarBrand(), transport.getCarType(), transport.getCarManufacturedYear(), transport.getNoPassengers(), transport.getNoBags(), transport.getEMBG(), userId, transport.getCarPlate());
     22    @PostMapping(path = "/transport/add")
     23    public void add(@RequestBody Transport transport) {
     24        transportManager.createTransport(transport.getTransportName(), transport.getCarBrand(), transport.getCarType(), transport.getCarManufacturedYear(), transport.getNoPassengers(), transport.getNoBags(), transport.getEMBG(), new User(), transport.getCarPlate());
    2625
    2726    }
     
    4645    public TransportDto getTransport(@PathVariable(name = "id") long transportId)
    4746    {
     47        System.out.println("TUKA SUUUUUM");
    4848        return transportManager.findTransportById(transportId);
    4949    }
     
    8484    @PostMapping(path = "/transport/available/add")
    8585    public void add(@RequestBody TransportAvailible transportAvailable, @RequestParam(name = "transportId") long transportId) {
     86        System.out.println("OREEEEEL");
     87        System.out.println("DVA ORLA");
    8688        Transport t = transportManager.getTransportById(transportId);
    8789        List<TransportRoute> routes = transportAvailable.getRoutes().stream().toList();
     
    125127
    126128    @GetMapping(path = "/transport/search")
    127     public List<TransportListingDto> searchAvailableTransport(@RequestParam(name = "from") String from,
    128                                                               @RequestParam(name = "to") String to,
    129                                                               @RequestParam(name = "date") @DateTimeFormat(pattern = "yyyy-MM-dd") Date date,
    130                                                               @RequestParam(name = "numPassengers") int numPassengers){
    131         return transportManager.getTransportsAvailableByFilters(from, to, date, numPassengers);
     129    public List<TransportListingDto> searchAvailableTransport(@RequestParam(name = "from") String from, @RequestParam(name = "to") String to,
     130                                                              @RequestParam(name = "date") @DateTimeFormat(pattern = "yyyy-MM-dd") Date date){
     131        return transportManager.getTransportsAvailableByFilters(from, to, date);
    132132    }
    133133
  • src/main/java/com/tourMate/controllers/UsersController.java

    re6c2521 r5528b99  
    1111import org.springframework.web.bind.annotation.*;
    1212
     13import java.util.ArrayList;
    1314import java.util.List;
    1415
     
    3839    {
    3940        return businessManager.getUnapprovedBusinessesOfUser(userId);
    40     }
    41 
    42     @GetMapping(path = "/business/unapproved")
    43     public List<Business> getAllUnapprovedBusinesses()
    44     {
    45         return businessManager.getUnapprovedBusinesses();
    46     }
    47 
    48     @GetMapping(path = "/users/unapproved")
    49     public List<User> getAllUnapprovedUsers()
    50     {
    51         return usersManager.getUnapprovedUsers();
    52     }
    53 
    54     @GetMapping(path = "/users/approve/{userId}")
    55     public ResponseEntity<?> approveUserProfile(@PathVariable Long userId)
    56     {
    57         usersManager.approveUserProfile(userId);
    58         return new ResponseEntity<>(HttpStatus.OK);
    59 
    60 
    61     }
    62 
    63     @GetMapping(path = "/business/approve/{businessId}")
    64     public ResponseEntity<?> approveBusiness(@PathVariable Long businessId)
    65     {
    66         businessManager.approveBusiness(businessId);
    67         return new ResponseEntity<>(HttpStatus.OK);
    6841    }
    6942
  • src/main/java/com/tourMate/dao/BusinessDao.java

    re6c2521 r5528b99  
    1111    @Transactional
    1212    void createBusiness(Business business, long userId);
    13     List<Business> getUnapprovedBusinessesOfUser(long userId);
    14     void deleteBusiness(long businessId);
    15     List<Business> getCreatedBusinesses();
    16     Business findBusinessById (long businessId);
     13    public List<Business> getUnapprovedBusinessesOfUser(long userId);
     14    public void deleteBusiness(long businessId);
     15    public List<Business> getCreatedBusinesses();
     16    public Business findBusinessById (long businessId);
    1717
    1818    @Transactional
    1919    void editBusiness(long businessId, String name, String phone, String address, String edbs, User user, boolean approved);
    20     boolean hasBusiness(long userId);
     20    public boolean hasBusiness(long userId);
    2121
    22     List<Business> getUnapprovedBusinesses();
    23 
    24     void approveBusiness(Business business);
    2522}
  • src/main/java/com/tourMate/dao/HotelDao.java

    re6c2521 r5528b99  
    2222    public List<HotelRoomImages> getRoomImages(HotelRoom hotelRoom);
    2323
    24     public void createRoom(Hotels hotel, String hotelRoomDescription, String hotelRoomName, Boolean kitchenAvailable, Boolean airConditioning, Boolean balcony, double price, int numOfBeds);
     24    public void createRoom(Hotels hotel, String hotelRoomDescription, String hotelRoomName, Boolean kitchenAvailable, Boolean airConditioning, Boolean balcony, double price);
    2525    public void editRoom(long hotelRoomId, Hotels hotel, String hotelRoomDescription, String HotelRoomName, Boolean kitchenAvailable, Boolean airConditioning, Boolean balcony, double price);
    2626    public void deleteRoom(long hotelRoomId);
  • src/main/java/com/tourMate/dao/TransportDao.java

    re6c2521 r5528b99  
    1212public interface TransportDao {
    1313
    14     public void createTransport(String transportName, String carBrand, String carType, int carManufacturedYear, int noPassengers, int noBags, long EMBG, Long userId, String carPlate);
     14    public void createTransport(String transportName, String carBrand, String carType, int carManufacturedYear, int noPassengers, int noBags, long EMBG, User owner, String carPlate);
    1515
    1616    public void deleteTransport(long transportId);
     
    4747    public List<TransportAvailible> getTransportsAvailable();
    4848
    49     public List<TransportRoute> getTransportsAvailableByFilters (String from, String to, Date date, int numPassengers);
     49    public List<TransportRoute> getTransportsAvailableByFilters (String from,String to,Date date);
    5050
    5151    public void createTransportRoute(TransportAvailible parentRoute, String from, String to, double price, Date departure, Date arrival, int freeSpace, int order);
  • src/main/java/com/tourMate/dao/UsersDao.java

    re6c2521 r5528b99  
    2323
    2424    UserDetails findUserByUsername(String username);
    25 
    26     List<User> getUnapprovedUsers();
    27 
    28     void approveUserProfile(User u);
    2925}
  • src/main/java/com/tourMate/dao/impl/BusinessDaoImpl.java

    re6c2521 r5528b99  
    4646    }
    4747
    48     @Override
    49     public List<Business> getUnapprovedBusinesses() {
    50         return em.createQuery("select b from Business b where not b.approved").getResultList();
    51     }
    52 
    53     @Override
    54     @Transactional
    55     public void approveBusiness(Business b) {
    56         b.setApproved(true);
    57         em.persist(b);
    58     }
    59 
    6048
    6149    @Override
  • src/main/java/com/tourMate/dao/impl/HotelDaoImpl.java

    re6c2521 r5528b99  
    2828    public List<Hotels> getHotels() {
    2929        List<Hotels> hoteli = em.createQuery("select h from Hotels h order by h.hotelId").getResultList();
     30        System.out.println("OREEEEEEL");
    3031        return hoteli;
    3132        //return em.createQuery("select h from Hotels h order by h.hotelId").getResultList();
     
    122123    @Transactional
    123124    @Override
    124     public void createRoom(Hotels hotel, String hotelRoomDescription, String hotelRoomName, Boolean kitchenAvailable, Boolean airConditioning, Boolean balcony, double price, int numOfBeds) {
    125         HotelRoom hotelRoom = new HotelRoom(hotel, hotelRoomDescription, hotelRoomName, kitchenAvailable, airConditioning, balcony, price, numOfBeds);
     125    public void createRoom(Hotels hotel, String hotelRoomDescription, String hotelRoomName, Boolean kitchenAvailable, Boolean airConditioning, Boolean balcony, double price) {
     126        HotelRoom hotelRoom = new HotelRoom(hotel, hotelRoomDescription, hotelRoomName, kitchenAvailable, airConditioning, balcony, price);
    126127        em.persist(hotelRoom);
    127128    }
     
    191192    public List<HotelRoomAvailable> getRoomsAvailibilityByDateAndLocation(String hotelLocation, Date dateFrom, Date dateTo, int numberOfBeds) {
    192193        return em.createQuery("select hr from HotelRoomAvailable hr where hr.dateFrom <= :dateFrom and hr.dateTo >= :dateTo " +
     194<<<<<<< HEAD
    193195                        "and hr.hotelRoom.hotel.hotelLocation LIKE :hotelLocation and hr.hotelRoom.numOfBeds >= :numBeds")
     196=======
     197                "and hr.hotelRoom.hotel.hotelLocation LIKE :hotelLocation and hr.numberOfBeds >= :numBeds")
     198>>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
    194199                .setParameter("hotelLocation", hotelLocation)
    195200                .setParameter("dateFrom", dateFrom)
     
    240245    public List<HotelRoomReservations> findReservationByHotel(Hotels hotel) {
    241246        List<HotelRoom> hotelRooms = getRoomsOfHotel(hotel.getHotelId());
    242         return em.createQuery("select hr from HotelRoomReservations hr where hr.hotelRoom.hotel = :hotel").setParameter("hotel", hotel).getResultList();
     247        return em.createQuery("select hr from HotelRoomReservations hr where hr.hotelRoom in :hotelRooms").setParameter("hotelRooms", hotelRooms).getResultList();
    243248    }
    244249
  • src/main/java/com/tourMate/dao/impl/TransportDaoImpl.java

    re6c2521 r5528b99  
    2222    @Override
    2323    @Transactional
    24     public void createTransport(String transportName, String carBrand, String carType, int carManufacturedYear, int noPassengers, int noBags, long EMBG, Long userId, String carPlate) {
    25         User u = em.find(User.class, userId);
     24    public void createTransport(String transportName, String carBrand, String carType, int carManufacturedYear, int noPassengers, int noBags, long EMBG, User owner, String carPlate) {
     25        User u = em.find(User.class, 1);
    2626        Transport t=new Transport(transportName,carBrand,carType,carManufacturedYear,noPassengers,noBags,EMBG,u,carPlate);
    2727        em.persist(t);
     
    6262                        y.getFreeSpace(),
    6363                        y.getTime(),
    64                         y.getRoutes(),
    65                         y.getRoutes().stream()
    66                                 .mapToDouble(TransportRoute::getPrice)
    67                                 .max().orElse(0)
    68                 )).toList(),
    69                 x.getAvailableRoutes().stream()
    70                         .flatMapToDouble(y -> y.getRoutes()
    71                                 .stream()
    72                                 .mapToDouble(TransportRoute::getPrice)).max().orElseGet(() -> 0)
     64                        y.getRoutes()
     65                )).toList()
    7366        )).toList();
    7467    }
     
    8578                x.getFreeSpace(),
    8679                x.getTime(),
    87                 x.getRoutes(),
    88                 x.getRoutes().stream()
    89                         .mapToDouble(TransportRoute::getPrice)
    90                         .max().orElse(0)
     80                x.getRoutes()
    9181        )).toList();
    9282    }
     
    113103                        y.getFreeSpace(),
    114104                        y.getTime(),
    115                         y.getRoutes(),
    116                         y.getRoutes().stream()
    117                                 .mapToDouble(TransportRoute::getPrice)
    118                                 .max().orElse(0)
    119                 )).toList(),
    120                 x.getAvailableRoutes().stream()
    121                         .flatMapToDouble(y -> y.getRoutes()
    122                                                         .stream()
    123                                                         .mapToDouble(TransportRoute::getPrice)).max().orElseGet(() -> 0));
     105                        y.getRoutes()
     106                )).toList());
    124107    }
    125108
     
    167150
    168151    @Override
    169     public List<TransportRoute> getTransportsAvailableByFilters(String fromL, String toL, Date date, int numPassengers) {
     152    public List<TransportRoute> getTransportsAvailableByFilters(String fromL, String toL, Date date) {
    170153        System.out.println(fromL + " " + toL);
    171         return em.createQuery("select h from TransportRoute h where h.from = :froml and h.to = :tol and h.freeSpace >= :nump")
    172                 .setParameter("froml", fromL)
    173                 .setParameter("tol", toL)
    174                 .setParameter("nump", numPassengers)
    175                 .getResultList();
     154        return em.createQuery("select h from TransportRoute h where h.from = :froml and h.to = :tol").setParameter("froml", fromL).
     155                setParameter("tol", toL).getResultList();
    176156    }
    177157
  • src/main/java/com/tourMate/dao/impl/UsersDaoImpl.java

    re6c2521 r5528b99  
    7474    }
    7575
    76     @Override
    77     public List<User> getUnapprovedUsers() {
    78         return em.createQuery("select u from User u where not u.enabled").getResultList();
    79     }
    80 
    81     @Override
    82     @Transactional
    83     public void approveUserProfile(User u) {
    84         u.setEnabled(true);
    85         em.persist(u);
    86     }
    8776
    8877
  • src/main/java/com/tourMate/dto/RouteListingDto.java

    re6c2521 r5528b99  
    1818    private Date time;
    1919    private Collection<String> routes;
    20     private Double maxPrice;
    2120
    22     public RouteListingDto(long transportAvailibleId, String from, String to, Date date, int freeSpace, Date time, Collection<TransportRoute> routes, Double maxPrice) {
     21    public RouteListingDto(long transportAvailibleId, String from, String to, Date date, int freeSpace, Date time, Collection<TransportRoute> routes) {
    2322        this.transportAvailibleId = transportAvailibleId;
    2423        this.from = from;
     
    2827        this.time = time;
    2928        this.routes = routes.stream().map(x -> x.getFrom()).distinct().skip(1).toList();
    30         this.maxPrice = maxPrice;
    3129    }
    3230
     
    8684        this.routes = routes;
    8785    }
    88 
    89     public Double getMaxPrice() {
    90         return maxPrice;
    91     }
    9286}
  • src/main/java/com/tourMate/dto/TransportDto.java

    re6c2521 r5528b99  
    1616    private User owner;
    1717    private String carPlate;
    18     private Double maxPrice;
    1918    private Collection<RouteListingDto> availableRoutes;
    2019
    21     public TransportDto(long transportID, String transportName, String carBrand, String carType, int carManufacturedYear, int noPassengers, int noBags, long EMBG, User owner, String carPlate, Collection<RouteListingDto> availableRoutes, Double maxPrice) {
     20    public TransportDto(long transportID, String transportName, String carBrand, String carType, int carManufacturedYear, int noPassengers, int noBags, long EMBG, User owner, String carPlate, Collection<RouteListingDto> availableRoutes) {
    2221        this.transportID = transportID;
    2322        this.transportName = transportName;
     
    3130        this.carPlate = carPlate;
    3231        this.availableRoutes = availableRoutes;
    33         this.maxPrice = maxPrice;
    3432    }
    3533
  • src/main/java/com/tourMate/entities/Business.java

    re6c2521 r5528b99  
    8888    }
    8989
    90     @OneToOne(fetch = FetchType.EAGER)
     90    @OneToOne(fetch = FetchType.LAZY)
    9191    @JoinColumn(name = "owner_id", unique = false, nullable = false, foreignKey = @ForeignKey(name = "fk_ref_od_biznis_kon_korisnik"))
    9292    public User getUser() {
     
    107107        this.approved = approved;
    108108    }
    109 
    110109}
  • src/main/java/com/tourMate/entities/HotelRoom.java

    re6c2521 r5528b99  
     1<<<<<<< HEAD
    12package com.tourMate.entities;
    23
     
    159160    }
    160161}
     162=======
     163package com.tourMate.entities;
     164
     165import jakarta.persistence.*;
     166import com.fasterxml.jackson.annotation.JsonIgnore;
     167
     168import javax.validation.constraints.NotNull;
     169
     170@Entity
     171@Table(name="hotel_rooms", schema = "public")
     172public class HotelRoom {
     173    private long hotelRoomId;
     174    @JsonIgnore
     175    private Hotels hotel;
     176    private String hotelRoomDescription;
     177    @Enumerated(EnumType.STRING)
     178    private String hotelRoomName;
     179    private double price;
     180    private Boolean kitchenAvailable;
     181    private Boolean airConditioning;
     182    private Boolean balcony;
     183
     184    public HotelRoom(long hotelRoomId, Hotels hotel, String hotelRoomDescription, String hotelRoomName, double price, Boolean kitchenAvailable, Boolean airConditioning, Boolean balcony) {
     185        this.hotelRoomId = hotelRoomId;
     186        this.hotel = hotel;
     187        this.hotelRoomDescription = hotelRoomDescription;
     188        this.hotelRoomName = hotelRoomName;
     189        this.price = price;
     190        this.kitchenAvailable = kitchenAvailable;
     191        this.airConditioning = airConditioning;
     192        this.balcony = balcony;
     193    }
     194
     195    public HotelRoom(Hotels hotel, String hotelRoomDescription, String type,
     196                     Boolean kitchenAvailable, Boolean airConditioning, Boolean balcony, double price) {
     197        this.hotel = hotel;
     198        this.hotelRoomDescription = hotelRoomDescription;
     199        this.hotelRoomName = type;
     200        this.kitchenAvailable = kitchenAvailable;
     201        this.airConditioning = airConditioning;
     202        this.balcony = balcony;
     203        this.price = price;
     204    }
     205
     206    public HotelRoom(String hotelRoomDescription, String type,
     207                     Boolean kitchenAvailable, Boolean airConditioning, Boolean balcony, double price) {
     208        this.hotel = hotel;
     209        this.hotelRoomDescription = hotelRoomDescription;
     210        this.hotelRoomName = type;
     211        this.kitchenAvailable = kitchenAvailable;
     212        this.airConditioning = airConditioning;
     213        this.balcony = balcony;
     214        this.price = price;
     215    }
     216
     217    public HotelRoom() {
     218
     219    }
     220
     221    @Id
     222    @GeneratedValue(strategy = GenerationType.IDENTITY)
     223    @Column(name = "room_id",unique = true,nullable = false)
     224    public long getHotelRoomId() {
     225        return hotelRoomId;
     226    }
     227
     228    public void setHotelRoomId(long hotelRoomId) {
     229        this.hotelRoomId = hotelRoomId;
     230    }
     231
     232    @ManyToOne(fetch = FetchType.LAZY)
     233    @JoinColumn(name = "hotel_id", unique = false, nullable = false, foreignKey = @ForeignKey(name = "fk_ref_od_room_kon_hotel"))
     234    public Hotels getHotel() {
     235        return hotel;
     236    }
     237
     238    public void setHotel(Hotels hotelId) {
     239        this.hotel = hotelId;
     240    }
     241
     242    @Column(name="hotel_room_description",unique = false,nullable = false)
     243    @NotNull
     244    public String getHotelRoomDescription() {
     245        return hotelRoomDescription;
     246    }
     247
     248    public void setHotelRoomDescription(String hotelRoomDescription) {
     249        this.hotelRoomDescription = hotelRoomDescription;
     250    }
     251
     252    @Column(name="hotel_room_price",unique = false,nullable = false)
     253    @NotNull
     254    public double getPrice() {
     255        return price;
     256    }
     257
     258    @Column(name="hotel_room_name",unique = false,nullable = false)
     259    @NotNull
     260    public String getHotelRoomName() {
     261        return hotelRoomName;
     262    }
     263
     264
     265    public void setHotelRoomName(String name) {
     266        this.hotelRoomName = name;
     267    }
     268    public void setPrice(double type) {
     269        this.price = type;
     270    }
     271    @Column(name="hotel_room_kitchen",unique = false,nullable = false)
     272    @NotNull
     273    public Boolean getKitchenAvailable() {
     274        return kitchenAvailable;
     275    }
     276
     277    public void setKitchenAvailable(Boolean kitchenAvailable) {
     278        this.kitchenAvailable = kitchenAvailable;
     279    }
     280    @Column(name="hotel_room_ac",unique = false,nullable = false)
     281    @NotNull
     282    public Boolean getAirConditioning() {
     283        return airConditioning;
     284    }
     285
     286    public void setAirConditioning(Boolean airConditioning) {
     287        this.airConditioning = airConditioning;
     288    }
     289    @Column(name="hotel_room_balcony",unique = false,nullable = false)
     290    @NotNull
     291    public Boolean getBalcony() {
     292        return balcony;
     293    }
     294
     295    public void setBalcony(Boolean balcony) {
     296        this.balcony = balcony;
     297    }
     298}
     299>>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
  • src/main/java/com/tourMate/entities/HotelRoomReservations.java

    re6c2521 r5528b99  
    4343    }
    4444
    45     @ManyToOne(fetch = FetchType.EAGER)
     45    @ManyToOne(fetch = FetchType.LAZY)
    4646    @JoinColumn(name = "room_id", unique = false, nullable = false, foreignKey = @ForeignKey(name = "fk_ref_od_roomres_kon_room"))
    4747    public HotelRoom getHotelRoom() {
     
    5959    }
    6060
    61     @OneToOne(fetch = FetchType.EAGER)
     61    @OneToOne(fetch = FetchType.LAZY)
    6262    @JoinColumn(name = "user_id", unique = false, nullable = false, foreignKey = @ForeignKey(name = "fk_ref_od_roomres_kon_user"))
    6363    public User getUser() {
  • src/main/java/com/tourMate/entities/Reviews.java

    re6c2521 r5528b99  
    7575
    7676    @ManyToOne(fetch = FetchType.LAZY)
    77     @JoinColumn(name = "hotel_id", unique = false, nullable = true, foreignKey = @ForeignKey(name = "fk_ref_od_review_kon_hotel"))
     77    @JoinColumn(name = "hotel_id", unique = false, nullable = false, foreignKey = @ForeignKey(name = "fk_ref_od_review_kon_hotel"))
    7878    public Hotels getHotel () {
    7979        return hotel;
     
    8585
    8686    @ManyToOne(fetch = FetchType.LAZY)
    87     @JoinColumn(name = "restaurant_id", unique = false, nullable = true, foreignKey = @ForeignKey(name = "fk_ref_od_review_kon_restorani"))
     87    @JoinColumn(name = "restaurant_id", unique = false, nullable = false, foreignKey = @ForeignKey(name = "fk_ref_od_review_kon_restorani"))
    8888    public Restaurant getRestaurant () {
    8989        return restaurant;
     
    9595
    9696    @ManyToOne(fetch = FetchType.LAZY)
    97     @JoinColumn(name = "transport_id", unique = false, nullable = true, foreignKey = @ForeignKey(name = "fk_ref_od_review_kon_transport"))
     97    @JoinColumn(name = "transport_id", unique = false, nullable = false, foreignKey = @ForeignKey(name = "fk_ref_od_review_kon_transport"))
    9898    public Transport getTransport () {
    9999        return transport;
  • src/main/java/com/tourMate/entities/User.java

    re6c2521 r5528b99  
    5252    private Role role;
    5353    @Column(name = "locked", unique = false, nullable = false)
    54     boolean locked = false;
     54    boolean locked;
    5555
    5656    @Column(name = "enabled", unique = false, nullable = false)
     
    162162    @Override
    163163    public boolean isAccountNonLocked() {
    164         return locked;
     164        return true;
    165165    }
    166166
  • src/main/java/com/tourMate/services/BusinessManager.java

    re6c2521 r5528b99  
    99    public List<Business> getUnapprovedBusinessesOfUser(long userId);
    1010    public void deleteBusiness(long businessId);
    11     public List<Business> getUnapprovedBusinesses();
    12     public void approveBusiness(Long businessId);
     11    public List<Business> getCreatedBusinesses();
    1312    public Business findBusinessById (long businessId);
    1413    public void editBusiness(long businessId, String name, String phone, String address, String edbs, User user, boolean approved);
  • src/main/java/com/tourMate/services/HotelManager.java

    re6c2521 r5528b99  
    22
    33import com.tourMate.dto.HotelDto;
    4 import com.tourMate.dto.HotelReservationDto;
    5 import com.tourMate.dto.HotelReservationUserDto;
    64import com.tourMate.entities.*;
    75import org.springframework.web.multipart.MultipartFile;
     
    2624    public List<HotelRoom> getRoomsOfHotel (long hotelId);
    2725    public HotelRoom findRoomById (long hotelRoomId);
     26<<<<<<< HEAD
    2827    public List<HotelRoomImages> getRoomImages(Long hotelRoom);
    2928    public void createRoom(Hotels hotel, String hotelRoomDescription, String hotelRoomName, Boolean kitchenAvailable, Boolean airConditioning, Boolean balcony, double price, int numOfBeds);
     29=======
     30    public List<HotelRoomImages> getRoomImages(HotelRoom hotelRoom);
     31    public void createRoom(Hotels hotel, String hotelRoomDescription, String hotelRoomName, Boolean kitchenAvailable, Boolean airConditioning, Boolean balcony, double price);
     32>>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
    3033    public void editRoom(long hotelRoomId, Hotels hotel, String hotelRoomDescription, String hotelRoomName, Boolean kitchenAvailable, Boolean airConditioning, Boolean balcony, double price);
    3134    public void deleteRoom(long hotelRoomId);
     35    public List<HotelRoomAvailable> getRoomsAvailable(Long id);
    3236    public void createRoomAvailible(HotelRoom hotelRoom, Date dateFrom, Date dateTo, int numberOfBeds);
    3337    public void editRoomAvailible(long hotelRoomAvailableId, HotelRoom hotelRoom, Date dateFrom, Date dateTo, int numberOfBeds);
     
    3640    public HotelRoomAvailable findAvailibleRoomById(long hotelRoomAvailableId);
    3741    public List<HotelRoomAvailable> getRoomsAvailibility();
    38     public List<HotelRoomAvailable> getRoomsAvailableById(Long id);
    3942    public List<HotelRoomAvailable> getRoomsAvailibilityByHotel(Hotels hotel);
    4043    public List<HotelDto> getRoomsAvailibilityByDateAndLocation(String hotelLocation, Date dateFrom, Date dateTo, int numberOfBeds);
     
    4245    public void editReservation(long hotelRoomReservedId, User user, HotelRoom hotelRoom, Date dateFrom, Date dateTo, Integer numberOfBeds);
    4346    public void deleteReservation(long hotelRoomReservedId);
    44     public List<HotelReservationDto> findVaidReseravtionsByHotel(Long hotelId);
    45     public List<HotelReservationUserDto> findValidHotelReservationsByUser(Long userId);
    4647    public HotelRoomReservations findReservationById(long hotelRoomReservedId);
    4748    public List<HotelRoomReservations> findReservationByUser(User user);
  • src/main/java/com/tourMate/services/TransportManager.java

    re6c2521 r5528b99  
    1313public interface TransportManager {
    1414
    15     public void createTransport(String transportName, String carBrand, String carType, int carManufacturedYear, int noPassengers, int noBags, long EMBG, Long userId, String carPlate);
     15    public void createTransport(String transportName, String carBrand, String carType, int carManufacturedYear, int noPassengers, int noBags, long EMBG, User owner, String carPlate);
    1616
    1717    public void deleteTransport(long transportId);
     
    3535    public Transport getTransportById(long transportId);
    3636
     37<<<<<<< HEAD
    3738    List<Reviews> getReviewsForTransport(long transportId);
    3839
    3940    public List<TransportListingDto> getTransportsAvailableByFilters (String from, String to, Date date, int numPassengers);
     41=======
     42    public List<TransportListingDto> getTransportsAvailableByFilters (String from, String to, Date date);
     43>>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
    4044
    4145    public List<TransportReservation> getTransportsReservationsByUserID(long userID);
  • src/main/java/com/tourMate/services/UsersManager.java

    re6c2521 r5528b99  
    1616
    1717    public void editUser(long userID, String name, String surname, String email, Date birthDate, String address, String contact);
    18     public List<User> getUnapprovedUsers();
    19     public void approveUserProfile(long userId);
    2018}
  • src/main/java/com/tourMate/services/impl/BusinessManagerImpl.java

    re6c2521 r5528b99  
    3434
    3535    @Override
    36     public List<Business> getUnapprovedBusinesses() {
    37         return businessDao.getUnapprovedBusinesses();
     36    public boolean hasBusiness(long userId){
     37        return businessDao.hasBusiness(userId);
    3838    }
    3939
    4040    @Override
    41     public void approveBusiness(Long businessId) {
    42         Business b = findBusinessById(businessId);
    43         businessDao.approveBusiness(b);
    44     }
    45 
    46     @Override
    47     public boolean hasBusiness(long userId){
    48         return businessDao.hasBusiness(userId);
     41    public List<Business> getCreatedBusinesses() {
     42        return businessDao.getCreatedBusinesses();
    4943    }
    5044
  • src/main/java/com/tourMate/services/impl/HotelManagerImpl.java

    re6c2521 r5528b99  
    44import com.tourMate.dao.UsersDao;
    55import com.tourMate.dto.HotelDto;
    6 import com.tourMate.dto.HotelReservationDto;
    7 import com.tourMate.dto.HotelReservationUserDto;
    86import com.tourMate.entities.*;
    97import com.tourMate.services.HotelManager;
     
    1311
    1412import java.time.Duration;
     13import java.util.Collection;
    1514import java.util.Date;
    1615import java.util.List;
     
    109108
    110109    @Override
    111     public void createRoom(Hotels hotel, String hotelRoomDescription, String hotelRoomName, Boolean kitchenAvailable, Boolean airConditioning, Boolean balcony, double price, int numOfBeds) {
    112         hotelDao.createRoom(hotel, hotelRoomDescription, hotelRoomName, kitchenAvailable, airConditioning, balcony, price, numOfBeds);
     110    public void createRoom(Hotels hotel, String hotelRoomDescription, String hotelRoomName, Boolean kitchenAvailable, Boolean airConditioning, Boolean balcony, double price) {
     111        hotelDao.createRoom(hotel, hotelRoomDescription, hotelRoomName, kitchenAvailable, airConditioning, balcony, price);
    113112    }
    114113
     
    123122    }
    124123
    125 
    126     @Override
    127     public List<HotelRoomAvailable> getRoomsAvailableById(Long id) {
     124    @Override
     125    public List<HotelRoomAvailable> getRoomsAvailable(Long id) {
    128126        return hotelDao.getRoomsAvailable(id);
    129127    }
     
    212210
    213211    @Override
     212<<<<<<< HEAD
    214213    public List<HotelReservationDto> findVaidReseravtionsByHotel(Long hotelId) {
    215214        Hotels hotel = findHotelByID(hotelId);
     
    245244
    246245    @Override
     246=======
     247>>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
    247248    public HotelRoomReservations findReservationById(long hotelRoomReservedId) {
    248249        return hotelDao.findReservationById(hotelRoomReservedId);
  • src/main/java/com/tourMate/services/impl/TransportManagerImpl.java

    re6c2521 r5528b99  
    2525
    2626    @Override
    27     public void createTransport(String transportName, String carBrand, String carType, int carManufacturedYear, int noPassengers, int noBags, long EMBG, Long userId, String carPlate) {
    28         transportDao.createTransport(transportName, carBrand, carType, carManufacturedYear, noPassengers, noBags, EMBG, userId, carPlate);
     27    public void createTransport(String transportName, String carBrand, String carType, int carManufacturedYear, int noPassengers, int noBags, long EMBG, User owner, String carPlate) {
     28        transportDao.createTransport(transportName, carBrand, carType, carManufacturedYear, noPassengers, noBags, EMBG, owner, carPlate);
    2929    }
    3030
     
    9393
    9494    @Override
     95<<<<<<< HEAD
    9596    public List<Reviews> getReviewsForTransport(long transportId) {
    9697        Transport transport = getTransportById(transportId);
     
    101102    public List<TransportListingDto> getTransportsAvailableByFilters(String from, String to, Date date, int numPassengers) {
    102103        List<TransportRoute> transportAvailable = transportDao.getTransportsAvailableByFilters(from, to, date, numPassengers);
     104=======
     105    public List<TransportListingDto> getTransportsAvailableByFilters(String from, String to, Date date) {
     106        List<TransportRoute> transportAvailable = transportDao.getTransportsAvailableByFilters(from, to, date);
     107>>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
    103108        Map<TransportAvailible, List<TransportRoute>> transportsByTransporter = transportAvailable.stream().collect(Collectors.groupingBy(x -> x.getParentRoute()));
    104109        List<TransportListingDto> transportList = transportsByTransporter.keySet().stream().toList().stream()
  • src/main/java/com/tourMate/services/impl/UsersManagerImpl.java

    re6c2521 r5528b99  
    4545
    4646    @Override
    47     public List<User> getUnapprovedUsers() {
    48         return usersDao.getUnapprovedUsers();
    49     }
    50 
    51     @Override
    52     public void approveUserProfile(long userId) {
    53         User u = findUserByID(userId);
    54         usersDao.approveUserProfile(u);
    55     }
    56 
    57     @Override
    5847    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
    5948        return usersDao.findUserByUsername(username);
Note: See TracChangeset for help on using the changeset viewer.