Ignore:
Timestamp:
01/24/24 17:42:28 (5 months ago)
Author:
darsov2 <62809499+darsov2@…>
Branches:
master
Children:
0f5aa27
Parents:
5528b99
Message:

prefinal fixes

Location:
frontend/src/Components
Files:
51 edited

Legend:

Unmodified
Added
Removed
  • frontend/src/Components/AdminPanel/AllProfilesTable.js

    r5528b99 r07f4e8b  
    5252                            {f.accountNonLocked &&
    5353                                <FaLock size={'2.2em'} color={'#159895'} onClick={() => {
    54                                     approveProfile('/users/lock/' + f.userID).then(() => {
     54                                    approveProfile('/users/unlock/' + f.userID).then(() => {
    5555                                        setChanged((prev) => {
    5656                                            return Math.random();
  • frontend/src/Components/Forms/AddHotelForm.js

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

    r5528b99 r07f4e8b  
    8282                e.preventDefault()
    8383                createRestaurant(formData, edit);
    84                 props.refresh((prevState) => {
    85                   return prevState + 1;
    86                 })
     84                props.refresh(Math.random())
     85                if(!edit) props.closeModal()
    8786              }}
    8887            >
  • frontend/src/Components/Forms/AddRoomForm.js

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

    r5528b99 r07f4e8b  
    6262              onClick={() => {
    6363                createTableAvailability(formData, props.table.tableId)
     64                props.refresh(Math.random())
     65                props.close()
    6466              }}
    6567            >
  • frontend/src/Components/Forms/AddTransportForm.js

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

    r5528b99 r07f4e8b  
    232232                                    console.log(wayPointNames);
    233233                                    for (let i = 0; i < routeCount - 1; i++) {
     234                                        console.log(wayPoints[i])
    234235                                        wayPointNames.push(wayPoints[i].value);
    235236                                    }
  • frontend/src/Components/Forms/EditRoomForm.js

    r5528b99 r07f4e8b  
    2828    } = useGet(`/hotel/rooms/${props.room.hotelRoomId}/available`)
    2929
     30    console.log(`/hotel/rooms/${props.room.hotelRoomId}/available`)
     31
    3032    !isLoading && console.log(data)
    3133
     
    4244                            <tr>
    4345                                <th>#</th>
    44 <<<<<<< HEAD
    4546                                <th>Oд</th>
    4647                                <th>До</th>
    4748                                <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)
    5349                            </tr>
    5450                            </thead>
  • frontend/src/Components/Hooks/Hotel/useCreateHotel.js

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

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

    r5528b99 r07f4e8b  
    1313                    .then((res) => {
    1414                                        console.log(res)
    15                                         refresh(prev => ++prev)
     15                                        refresh(Math.random())
    1616                        //history.push('/restaurant');
    1717                    })
  • frontend/src/Components/Hooks/Transport/useCreateTransport.js

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

    r5528b99 r07f4e8b  
    44import { Navigate, useAsyncValue, useNavigate } from "react-router-dom";
    55import LoginForm from "../../Login/LoginForm.js";
     6import {useAuth} from "../../Context/AuthContext";
    67
    78const useLogin = () => {
    89
    910    const navigator = useNavigate()
     11        const Auth = useAuth();
    1012    //const history = useNavigate();
    1113    const login = async (loginData) => {
     
    2224                })
    2325                    .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                                        }
    2441                                        const sessionId = res.data.auth.details.sessionId;
    2542                                        const userId = res.data.auth.principal.userID;
    26                                        
     43
    2744                                        localStorage.setItem("sessionId", sessionId);
    2845                                        localStorage.setItem("userId", userId);
  • frontend/src/Components/Hooks/useCreate.js

    r5528b99 r07f4e8b  
    1616                //history.push('/hotel');
    1717                console.log(res)
     18                console.log("gotovo")
    1819                getData(prev => ++prev)
    1920                getData2(prev => ++prev)
  • frontend/src/Components/Hooks/useGet.js

    r5528b99 r07f4e8b  
    1111        console.log(localStorage.getItem("sessionId"))
    1212        console.log("url od get " + uurl)
    13 <<<<<<< HEAD
    1413        await axios.get(uurl, {maxRedirects: 0}).then((res) => {
    1514            console.log(res);
     
    2322            // window.location.href = '/error'
    2423        })
    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)
    3324            .finally(() => {
    3425                setIsLoading(false);
     
    4031        getData(url);
    4132    }, [dep, url, changed]);
    42    
     33
    4334    return {
    4435        data,
  • frontend/src/Components/HotelDetails/RoomRow.js

    r5528b99 r07f4e8b  
    88    const [getData, setData] = useState(0);
    99    const room = props.room
     10    console.log("dasdaskjdhaskdjashdkajk")
    1011    console.log(props.data)
     12    console.log(Array(props.data.find(x => x.hotelRoom.hotelRoomId === room.hotelRoomId)))
    1113    return (
    1214        <>
     
    2224                    }}>
    2325                        <option></option>
    24                         {[...Array(props.data.find(x => x.hotelRoom.hotelRoomId === room.hotelRoomId).numberOfBeds).keys()].map(x => {
     26                        {[...Array(props.data.filter(x => x.hotelRoom.hotelRoomId === room.hotelRoomId).reduce((sum, x) => x.numberOfBeds)).keys()].map(x => {
    2527                            return (
    2628                                <option value={x+1}  >{x + 1}</option>
  • frontend/src/Components/HotelDetails/RoomsTable.js

    r5528b99 r07f4e8b  
    77
    88const RoomsTable = (props) => {
    9 
    109
    1110    return (
     
    2120                </thead>
    2221                <tbody>
    23                 {Array.from(new Set(props.data.map(x => x.hotelRoom))).map((room) => {
     22                {Array.from(
     23                    new Set(props.data.map((x) => JSON.stringify(x.hotelRoom)))
     24                ).map((roomString) => JSON.parse(roomString)).map((room) => {
    2425                    return (
    2526                        <>
  • frontend/src/Components/HotelEdit/HotelEditTab.js

    r5528b99 r07f4e8b  
    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";
     12import AddAvailability from "../Resources/AddAvailability";
     13import useGet from "../Hooks/useGet";
     14import ReservationListing from "./ReservationListing";
    1215
    1316function HotelEditTab(props) {
    14   const [activeTab, setActiveTab] = useState("/hotel");
    15   const [modalData, setModalData] = useState("");
    16   const [show, setShow] = useState(false);
     17    const [activeTab, setActiveTab] = useState("/hotel");
     18    const [modalData, setModalData] = useState("");
     19    const [show, setShow] = useState(false);
    1720
    18   const handleClose = () => setShow(false);
    19   const handleShow = () => {
    20     //e.preventDefault();
    21     setShow(true);
     21    console.log(props)
    2222
    23   };
     23    const {
     24        data,
     25        isLoading,
     26        setData,
     27        getData,
     28        setChanged
     29    } = useGet(`/hotel/${props.displayRoom.hotelId}/reservations/active`)
    2430
    25   const showModal = (modalData) => {
    26     setModalData(modalData);
    27     handleShow();
    28   }
    29   console.log(props.displayRoom)
     31    !isLoading && console.log(data)
    3032
    31   const handleSelect = (eventKey) => {
    32     setActiveTab(eventKey);
    33   };
     33    const handleClose = () => setShow(false);
     34    const handleShow = () => {
     35        //e.preventDefault();
     36        setShow(true);
    3437
    35   return (
    36     <Container className="rounded-5">
    37       <Tab.Container
    38         activeKey={activeTab}
    39         onSelect={handleSelect}
    40         className="bg-dark rounded-5"
    41       >
    42         <Nav
    43           fill
    44           variant="tabs"
    45           className="bg-body rounded-top-5"
    46           activeKey="/hotel"
    47           id="tab_item"
    48         >
    49           <Nav.Item className="tab_item rounded-5">
    50             <Nav.Link eventKey="/hotel" className="text-left rounded-5">
     38    };
     39
     40    const showModal = (modalData) => {
     41        setModalData(modalData);
     42        handleShow();
     43    }
     44    console.log(props.displayRoom)
     45
     46    const handleSelect = (eventKey) => {
     47        setActiveTab(eventKey);
     48    };
     49
     50    return (
     51        <Container className="rounded-5">
     52            <Tab.Container
     53                activeKey={activeTab}
     54                onSelect={handleSelect}
     55                className="bg-dark rounded-5"
     56            >
     57                <Nav
     58                    fill
     59                    variant="tabs"
     60                    className="bg-body rounded-top-5"
     61                    activeKey="/hotel"
     62                    id="tab_item"
     63                >
     64                    <Nav.Item className="tab_item rounded-5">
     65                        <Nav.Link eventKey="/hotel" className="text-left rounded-5">
    5166              <span className="ikona">
    5267                <FaHotel
    53                   color="#159895"
    54                   style={{ lineHeight: "100em" }}
    55                   size={"1.5em"}
    56                   className="mx-3"
     68                    color="#159895"
     69                    style={{lineHeight: "100em"}}
     70                    size={"1.5em"}
     71                    className="mx-3"
    5772                />
    5873              </span>
    59               <span className="ikona">Соби</span>
    60             </Nav.Link>
    61           </Nav.Item>
    62           <Nav.Item className="tab_item">
    63             <Nav.Link eventKey="/restaurant">
     74                            <span className="ikona">Соби</span>
     75                        </Nav.Link>
     76                    </Nav.Item>
     77                    <Nav.Item className="tab_item">
     78                        <Nav.Link eventKey="/restaurant">
    6479              <span className="ikona">
    65                 <MdOutlineStickyNote2 color="#159895" size={"1.5em"} className="mx-3" />
     80                <MdOutlineStickyNote2 color="#159895" size={"1.5em"} className="mx-3"/>
    6681              </span>
    67               <span className="ikona">Резервации</span>
    68             </Nav.Link>
    69           </Nav.Item>
    70           <Nav.Item className="tab_item rounded-5">
    71             <Nav.Link eventKey="/transport" className="text-left rounded-5">
     82                            <span className="ikona">Резервации</span>
     83                        </Nav.Link>
     84                    </Nav.Item>
     85                    <Nav.Item className="tab_item rounded-5">
     86                        <Nav.Link eventKey="/transport" className="text-left rounded-5">
    7287              <span className="ikona">
    73                 <BiData color="#159895" size={"1.5em"} className="mx-3" />
     88                <BiData color="#159895" size={"1.5em"} className="mx-3"/>
    7489              </span>
    75               <span className="ikona">Општи податоци</span>
    76             </Nav.Link>
    77           </Nav.Item>
    78         </Nav>
     90                            <span className="ikona">Општи податоци</span>
     91                        </Nav.Link>
     92                    </Nav.Item>
     93                </Nav>
    7994
    80         <Tab.Content className="py-5 px-3 border rounded-bottom-5 bg-light">
    81           <Tab.Pane eventKey="/hotel">
    82           {props.displayRoom.hotelRooms.map((room) => {
    83               return <RoomListing key={room.hotelRoomId} data={room} showModal={showModal}/>
    84             })}
    85             <EditModal show={show} handleClose={handleClose} type="room" room={modalData}></EditModal>
    86             <AddNew Id={props.displayRoom.hotelId} refresh={props.refresh} type="room"/>
    87           </Tab.Pane>
    88           <Tab.Pane eventKey="/restaurant">
    89             <AddNew type="restaurant"/>
    90           </Tab.Pane>
    91           <Tab.Pane eventKey="/transport">
    92             <AddHotelForm refresh={props.refresh} hotel={props.displayRoom}/>
    93           </Tab.Pane>
    94         </Tab.Content>
    95       </Tab.Container>
    96     </Container>
    97   );
     95                <Tab.Content className="py-5 px-3 border rounded-bottom-5 bg-light">
     96                    <Tab.Pane eventKey="/hotel">
     97                        {props.displayRoom.hotelRooms.map((room) => {
     98                            return <RoomListing key={room.hotelRoomId} data={room} showModal={showModal}/>
     99                        })}
     100                        <EditModal show={show} handleClose={handleClose} type="room" room={modalData}></EditModal>
     101                        <AddNew Id={props.displayRoom.hotelId} refresh={props.refresh} type="room"/>
     102                    </Tab.Pane>
     103                    <Tab.Pane eventKey="/restaurant">
     104                        {!isLoading && data.map((res) => {
     105                            return (
     106                                <ReservationListing type={'hotel'} data={res}/>
     107                            )
     108                        })}
     109                        {/*<AddNew type="restaurant"/>*/}
     110                    </Tab.Pane>
     111                    <Tab.Pane eventKey="/transport">
     112                        <AddHotelForm refresh={props.refresh} hotel={props.displayRoom}/>
     113                    </Tab.Pane>
     114                </Tab.Content>
     115            </Tab.Container>
     116        </Container>
     117    );
    98118}
    99119
  • frontend/src/Components/HotelEdit/ReservationListing.js

    r5528b99 r07f4e8b  
    33
    44const ReservationListing = (props) => {
     5
     6    const dateFormatter = (str) => {
     7        const inputDate = new Date(str);
     8
     9        const options = {
     10            year: '2-digit',
     11            month: '2-digit',
     12            day: '2-digit',
     13        };
     14
     15        return inputDate.toLocaleString('de-DE', options);
     16    }
     17
    518    return(
    619        <>
     
    1528                    <Col md={8} className="d-flex flex-column justify-content-start ps-5">
    1629                        <h3 style={{fontWeight: "bold"}} className={'text-start'}>Резервација за:</h3>
    17                         <h4 className={'text-start'}>{props.data.hotelRoom.hotelRoomName}</h4>
     30                        {props.type === 'hotel' && <h4 className={'text-start'}>{props.data.hotelRoom.hotelRoomName}</h4>}
     31                        {props.type === 'restaurant' && <h4 className={'text-start'}>{'Маса за ' + props.data.restaurantsTable.noSeats}</h4>}
     32                        {props.type === 'transport' && <h4 className={'text-start'}>{props.data.transportRoute.from + ' ' + props.data.transportRoute.to}</h4>}
     33                        {props.type === 'transport' && <h4 className={'text-start'}>{props.data.noSeats + ' ' + 'патници'}</h4>}
    1834                        <h4 className={'text-start'}>{props.data.user.name + ' ' + props.data.user.surname}</h4>
    19                         <h5 className={'text-start'}>{props.data.dateFrom + ' - ' + props.data.dateTo}</h5>
     35                        {props.type !== 'transport' && <h5
     36                            className={'text-start'}>{dateFormatter(props.data.dateFrom) + ' - ' + dateFormatter(props.data.dateTo)}</h5>}
    2037                    </Col>
    2138                    <Col md={4} className="d-flex flex-column justify-content-center align-content-center">
    22                         <h3>Вкупна цена: <br></br>{props.data.hotelRoom.price}$</h3>
     39                        {props.type === 'hotel' && <h3>Вкупна цена: <br></br>{props.data.hotelRoom.price}$</h3>}
    2340                    </Col>
    2441                </Row>
  • frontend/src/Components/Layout/Navbar/Navigation.js

    r5528b99 r07f4e8b  
    77import useGet from "../../Hooks/useGet";
    88import axios from "../../../axios.js";
    9 <<<<<<< HEAD
    109import {useAuth} from "../../Context/AuthContext";
    1110import ImageUpload from "../../ImageUpload/ImageUpload";
    12 =======
    13 >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
    1411//import logo from 'assets/images/logo.png';
    1512//src="https://upload.wikimedia.org/wikipedia/commons/0/08/Vergina_Sun_-_Golden_Larnax.png"
     
    1714function Navigation(props) {
    1815  const navigator = useNavigate();
    19 <<<<<<< HEAD
    2016  const Auth = useAuth();
    2117  const isLoggedIn = Auth.userIsAuthenticated();
     
    2622  const handleShow = () => setShow(true);
    2723
    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)
    3324  return (
    3425    <>
     
    4031      >
    4132        <Container>
    42           <Navbar.Brand href="#home">
     33          <Navbar.Brand href="/home">
    4334            <span className="ikona">
    4435              <Image
     
    6657                <Button onClick={handleShow}></Button>
    6758              </Nav.Link>
    68               {!isLoading && !data && (
     59              {!isLoggedIn && (
    6960                <Button
    7061                  className="m-2"
     
    7869                </Button>
    7970              )}
    80               {!isLoading && data && (
     71              {isLoggedIn && (
    8172                <>
    8273                  <Nav.Link className="m-2" href="/profile">
    83                     {data}
     74                    {Auth.getUser().username}
    8475                  </Nav.Link>
    8576                  <Button
     
    9081                      await axios.get("/logout")
    9182                      .then((res) => {
    92                         console.log(res)
     83                        console.log(res);
     84                        Auth.userLogout();
    9385                      })
    9486                      .catch((err) => {
  • frontend/src/Components/Listings/HotelListing.js

    r5528b99 r07f4e8b  
    8080                      }}
    8181                  >
    82                     {/* {props.data.hotelRating} */}
    83                       9.1
     82                        {(props.data.hotelReviews.reduce((sum, r) => sum + r.numStar, 0) / props.data.hotelReviews.length).toFixed(1)}
    8483                  </span>
    8584                                </Col>
  • frontend/src/Components/Listings/SortButton.js

    r5528b99 r07f4e8b  
    33import { BsSortUp } from "react-icons/bs"
    44
    5 const SortButton = () => {
     5const SortButton = (props) => {
    66    return (
    7         <Dropdown>
     7        <Dropdown onSelect={(event, x) => {
     8            console.log(event)
     9            props.setSortingArg(event)
     10        }}>
    811          <Dropdown.Toggle variant="success" id="dropdown-basic" size="lg">
    912          <span className="ikona my-1"><BsSortUp/></span>
     
    1114          </Dropdown.Toggle>
    1215   
    13           <Dropdown.Menu>
    14             <Dropdown.Item href="#/action-1">Цена растечки</Dropdown.Item>
    15             <Dropdown.Item href="#/action-2">Цена опаѓачки</Dropdown.Item>
    16             <Dropdown.Item href="#/action-3">Име растечки</Dropdown.Item>
    17             <Dropdown.Item href="#/action-3">Име опаѓачки</Dropdown.Item>
     16          <Dropdown.Menu >
     17              {props.type !== 'restaurant' && <Dropdown.Item eventKey={'priceDesc'}>Цена растечки</Dropdown.Item>}
     18              {props.type !== 'restaurant' && <Dropdown.Item eventKey={'priceAsc'}>Цена опаѓачки</Dropdown.Item>}
     19              {props.type !== 'transport' && <Dropdown.Item eventKey={'nameAsc'}>Име растечки</Dropdown.Item>}
     20              {props.type !== 'transport' && <Dropdown.Item eventKey={'nameDesc'}>Име опаѓачки</Dropdown.Item>}
    1821          </Dropdown.Menu>
    1922        </Dropdown>
  • frontend/src/Components/Listings/TransportListing.js

    r5528b99 r07f4e8b  
    99
    1010const TransportListing = (props) => {
    11  
     11
    1212
    1313
     
    5656                    }}
    5757                  >
    58                     9.1
     58                      {(props.data.reviews.reduce((sum, r) => sum + r.numStar, 0) / props.data.reviews.length).toFixed(1)}
    5959                  </span>
    6060                </Col>
  • frontend/src/Components/Resources/AddAvailability.js

    r5528b99 r07f4e8b  
    1 import React from "react";
     1 import React from "react";
    22import { Container, Row, Modal, Im } from "react-bootstrap";
    33import { useState } from "react";
     
    4242        <Modal.Body>
    4343            {props.type === "hotel" && <AddHotelForm/>}
    44             {props.type === "room" && <AddRoomAvailablityForm hotelRoomId={props.hotelRoomId}/>}
    45             {props.type === "table" && <AddTableAvailablityForm table={props.table}/>}
     44            {props.type === "room" && <AddRoomAvailablityForm refresh={props.refresh} close={props.closeModal}  hotelRoomId={props.hotelRoomId}/>}
     45            {props.type === "table" && <AddTableAvailablityForm refresh={props.refresh} close={props.closeModal} table={props.table}/>}
    4646            {props.type === "restaurant" && <AddRestaurantForm/>}
    4747            {props.type === "transport" && <AddTransportForm/>}
  • frontend/src/Components/Resources/AddImages.js

    r5528b99 r07f4e8b  
    5353                    {!isLoading && data.map((image) => {
    5454                        let link = image.url;
    55                         console.log("SLIKATAAA")
    56                         console.log(image)
    5755                        if (image.url.includes('Desktop')) {
    5856                            link = 'http://localhost:8080/download?fileName=' + encodeURIComponent(image.url);
  • frontend/src/Components/Resources/AddNew.js

    r5528b99 r07f4e8b  
    5656        </Modal.Header>
    5757        <Modal.Body>
    58             {props.type === "hotel" && <AddHotelForm refresh={props.refresh}/>}
    59             {props.type === "room" && <AddRoomForm refresh={props.refresh} hotelId={props.Id}/>}
    60             {props.type === "restaurant" && <AddRestaurantForm edit="false" refresh={props.refresh}/>}
    61             {props.type === "transport" && <AddTransportForm refresh={props.refresh}/>}
     58            {props.type === "hotel" && <AddHotelForm closeModal={handleClose} refresh={props.refresh}/>}
     59            {props.type === "room" && <AddRoomForm closeModal={handleClose} refresh={props.refresh} hotelId={props.Id}/>}
     60            {props.type === "restaurant" && <AddRestaurantForm edit="false" closeModal={handleClose} refresh={props.refresh}/>}
     61            {props.type === "transport" && <AddTransportForm closeModal={handleClose} refresh={props.refresh}/>}
    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

    r5528b99 r07f4e8b  
    3232        </Modal.Header>
    3333        <Modal.Body>
    34             {props.type === "hotel" && <AddHotelForm/>}
     34            {props.type === "hotel" && <AddHotelForm refresh={props.refresh}/>}
    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

    r5528b99 r07f4e8b  
    88
    99const ResourceListing = (props) => {
    10  
    11     console.log("props " + props.id)
    12  
    1310
    1411    const type = props.type == "hotel" ? "сместувањето" : props.type == "restaurant" ? "ресторанот" : "превозот";
    1512    const name = props.type == "hotel" ? props.data.hotelName : props.type == "restaurant" ? props.data.restaurantName : props.data.transportName
    16 <<<<<<< HEAD
    1713    const id = props.type == "hotel" ? props.data.hotelId : props.type == "restaurant" ? props.data.restaurantID : props.data.transportID
    1814    console.log(props.data)
     
    5450                    </Col>
    5551
    56                     <Col className="d-flex flex-column justify-content-center align-content-center">
    57                         <AddImages type={props.type} Id={id} />
    58                     </Col>
     52                    {props.type !== 'transport' && <Col className="d-flex flex-column justify-content-center align-content-center">
     53                        <AddImages type={props.type} Id={id}/>
     54                    </Col>}
    5955                    <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)
    10056                  <span
    10157                      style={{
  • frontend/src/Components/Resources/ResourcesTab.js

    r5528b99 r07f4e8b  
    1010
    1111function ResourcesTab(props) {
    12 <<<<<<< HEAD
    1312    const [activeTab, setActiveTab] = useState(props.tab);
    1413    const userId = JSON.parse(localStorage.getItem("user")).userId;
     
    3635                    <Nav.Item className="tab_item rounded-5">
    3736                        <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)
    7137              <span className="ikona">
    7238                <FaHotel
     
    10167                </Nav>
    10268
    103 <<<<<<< HEAD
    10469                <Tab.Content className="py-5 px-3 border rounded-bottom-5 bg-light">
    10570                    <Tab.Pane eventKey="/hotel" key="hotelPane">
     
    150115        </Container>
    151116    );
    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)
    205117}
    206118
  • frontend/src/Components/RestaurantDetails/Carousel.js

    r5528b99 r07f4e8b  
    1212            <Row className='d-flex justify-content-center align-items-center'><h2>Мени</h2></Row>
    1313            <hr className='m-2'></hr>
    14             <Menu menu={props.menu}></Menu>
     14            <Menu images={props.images} menu={props.menu}></Menu>
    1515        </>
    1616    );
  • frontend/src/Components/RestaurantDetails/Menu.js

    r5528b99 r07f4e8b  
    2323
    2424
     25
     26
    2527    return (<>
    2628        <Carousel activeIndex={ind} onSelect={handleSelect} indicators={false}>
     
    3436                                        return (
    3537                                            <Col>
    36                                                 <MenuItem data={menuItem}/>
     38                                                <MenuItem images={    props.images.filter(x => {
     39                                                    console.log(x)
     40                                                    return x.menu.menuId === menuItem.menuId
     41                                                })} data={menuItem}/>
    3742                                            </Col>
    3843                                        )
  • frontend/src/Components/RestaurantDetails/MenuItem.js

    r5528b99 r07f4e8b  
    11import React from "react";
    22import {Col, Row, Image, Container} from "react-bootstrap";
     3import Carousel from "react-bootstrap/Carousel";
    34
    45const MenuItem = (props) => {
    56
    67    const data = props.data;
     8    console.log("dva orla")
     9    console.log(props)
    710    return (<>
    811
     
    1720                <Row>
    1821                    <Col className="d-flex justify-content-center mb-3">
    19                         <Image
    20                             src="https://www.tasteofhome.com/wp-content/uploads/2019/01/medium-rare-steak-shutterstock_706040446.jpg"
    21                             style={{
    22                                 height: "7em",
    23                                 borderRadius: "1em",
    24                                 boxShadow: "0 4px 20px lightblue",
    25                                 maxWidth: "100%",
    26                             }}
    27                         ></Image>
     22                        <Carousel>
     23                            {props.images.map((image) => {
     24                                let link = image.url;
     25                                if (image.url.includes('Desktop')) {
     26                                    link = 'http://localhost:8080/download?fileName=' + encodeURIComponent(image.url);
     27                                }
     28                                return (
     29                                    <Carousel.Item>
     30                                        <img
     31                                            className="d-block w-100 h-400 rounded-5"
     32                                            src={link}
     33                                            alt="First slide"
     34                                            style={{
     35                                                height: "7em",
     36                                                borderRadius: "1em",
     37                                                boxShadow: "0 4px 20px lightblue",
     38                                                maxWidth: "100%",
     39                                            }}
     40                                        />
     41                                    </Carousel.Item>
     42                                )
     43                            })}
     44                            {props.images.length == 0 && <Carousel.Item>
     45                                <Image
     46                                    src="https://www.tasteofhome.com/wp-content/uploads/2019/01/medium-rare-steak-shutterstock_706040446.jpg"
     47                                    style={{
     48                                        height: "7em",
     49                                        borderRadius: "1em",
     50                                        boxShadow: "0 4px 20px lightblue",
     51                                        maxWidth: "100%",
     52                                    }}
     53                                ></Image>
     54                            </Carousel.Item>}
     55                        </Carousel>
    2856                    </Col>
    2957                </Row>
  • frontend/src/Components/RestaurantDetails/TablesTable.js

    r5528b99 r07f4e8b  
    2222                </thead>
    2323                <tbody>
    24                 {Array.from(new Set(props.data.map(x => x.restaurantTable))).map((table) => {
     24                {Array.from(
     25                    new Set(props.data.map((x) => JSON.stringify(x.restaurantTable)))
     26                ).map((roomString) => JSON.parse(roomString)).map((table) => {
    2527                    return (
    2628                        <>
  • frontend/src/Components/RestaurantEdit/MenuListing.js

    r5528b99 r07f4e8b  
    66import { AiOutlinePlusCircle } from "react-icons/ai"
    77import EditModal from "../Resources/EditModal";
     8import AddImages from "../Resources/AddImages";
    89
    910const MenuListing = (props) => {
     
    1213    console.log(props.data)
    1314    return(<>
    14     <a href="#" onClick={(e) => {e.preventDefault(); props.showModal(props.data);
    15     console.log("kliknav")} } style={{textDecoration: "none", color:"black"}}>
     15    <a href="#" style={{textDecoration: "none", color:"black"}}>
    1616        <Container className="py-3 px-1 my-4"
    1717        style={{
     
    2323            <Row>
    2424                <Col className="d-flex justify-content-center">
    25                     <Image
     25                    <Image onClick={(e) => {
     26                        e.preventDefault();
     27                        props.showModal(props.data);
     28                        console.log("kliknav")
     29                    }}
    2630                    src="https://www.tasteofhome.com/wp-content/uploads/2019/01/medium-rare-steak-shutterstock_706040446.jpg"
    2731                    style={{
     
    3741                    <h6>{props.data.ingredients}</h6>
    3842                </Col>
     43                <Col className="d-flex flex-column justify-content-center align-content-center">
     44                    <AddImages type="menu" Id={props.data.menuId} />
     45                </Col>
    3946               
    4047                <Col className="d-flex flex-column justify-content-center align-content-center">
  • frontend/src/Components/RestaurantEdit/RestaurantEditTab.js

    r5528b99 r07f4e8b  
    1010import TableListing from "./TableListing";
    1111import EditModal from "../Resources/EditModal";
     12import ReservationListing from "../HotelEdit/ReservationListing";
     13import useGet from "../Hooks/useGet";
    1214
    1315function RestaurantEditTab(props) {
     
    3537    setActiveTab(eventKey);
    3638  };
     39
     40  const {
     41    data,
     42    isLoading,
     43    setData,
     44    getData,
     45    setChanged: dhanged
     46  } = useGet(`/restaurant/${props.displayMenu.restaurantID}/reservations/active`)
    3747
    3848  console.log(props.displayMenu.restaurantID)
     
    100110              return <MenuListing key={menu.menuId} data={menu} showModal={showModal}/>
    101111            })}
    102             {activeTab === '/hotel' && <EditModal show={show} handleClose={handleClose} type="menu" menu={modalData}></EditModal>}
     112            {activeTab === '/hotel' && <EditModal show={show} refresh={props.refresh} handleClose={handleClose} type="menu" menu={modalData}></EditModal>}
    103113            <AddNew Id={props.displayMenu.restaurantID} refresh={props.refresh} type="menu"/>
    104114          </Tab.Pane>
    105115          <Tab.Pane eventKey="/masi">
    106116           {props.displayMenu.tables.map((table) => {
    107               return <TableListing key={table.tableId} showModal={showModal} data={table}/>
     117              return <TableListing key={table.tableId} refresh={props.refresh} showModal={showModal} handleClose={handleClose} data={table}/>
    108118            })}
    109119            {activeTab === '/masi' && <EditModal show={show} handleClose={handleClose} refresh={props.refresh} type="table"
     
    112122          </Tab.Pane>
    113123          <Tab.Pane eventKey="/restaurant">
    114             <AddNew type="restaurant"/>
     124            {!isLoading && data.map((res) => {
     125              return (
     126                  <ReservationListing type={'restaurant'} data={res}/>
     127              )
     128            })}
    115129          </Tab.Pane>
    116130          <Tab.Pane eventKey="/transport">
  • frontend/src/Components/RestaurantEdit/TableListing.js

    r5528b99 r07f4e8b  
    4141               
    4242                <Col className="d-flex flex-column justify-content-center align-content-center">
    43                   <AddAvailability type="table" table={props.data}/>
     43                  <AddAvailability type="table" refresh={props.refresh} closeModal={props.handleClose} table={props.data}/>
    4444                </Col>
    4545
  • frontend/src/Components/SearchCriterias/SearchCriteriasBar.js

    r5528b99 r07f4e8b  
    22import { Container, Form, Button, Row, Col } from "react-bootstrap";
    33import useFormData from "../Hooks/useFormData";
    4 <<<<<<< HEAD
    54import SearchCriteriasHotel from "./SearchCriteriasHotel";
    65import SearchCriteriasTransport from "./SearchCriteriasTransport";
    76import SearchCriteriasRestaurant from "./SearchCriteriasRestaurant";
    8 =======
    9 >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
    107
    11 const SearchCriterias = (props) => {
     8const SearchCriteriasBar = (props) => {
    129
    13   const { formData, onFormChange, onCheckBoxChange, setFormData} = useFormData(props.criterias)
    14   console.log("KRITERIUMI")
    15   console.log(formData)
     10    const { criterias, type } = props
    1611
    17 <<<<<<< HEAD
    1812    return (
    1913        <>
     
    2418    )
    2519}
    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)
    11420
    115 export default SearchCriterias;
     21export default SearchCriteriasBar;
  • frontend/src/Components/Tab/TabFormHotel.js

    r5528b99 r07f4e8b  
    11import React from "react";
    2 import { Button, Col, Container, Form, Row } from "react-bootstrap";
    3 import { FaMagnet } from "react-icons/fa"
    4 import { HiMagnifyingGlass } from "react-icons/hi2"
     2import {Button, Col, Container, Form, InputGroup, Row} from "react-bootstrap";
     3import {FaMagnet} from "react-icons/fa"
     4import {HiMagnifyingGlass} from "react-icons/hi2"
    55import useFormData from "../Hooks/useFormData";
    66
    77function TabFormHotel() {
    88
    9   const { formData, onFormChange, setFormData } = useFormData({
    10     hotelLocation: undefined,
    11     dateFrom: undefined,
    12     dateTo: undefined,
    13     numBeds: undefined
    14   })
     9    const {formData, onFormChange, setFormData, onCheckBoxChange} = useFormData({
     10        hotelLocation: undefined,
     11        dateFrom: undefined,
     12        dateTo: undefined,
     13        numBeds: undefined,
     14        flexible: false,
     15    })
    1516
    16   return (
    17     <Form className='rounded-5' >
    18       <Row>
    19         <Col>
    20           <Form.Floating className="mb-3">
    21             <Form.Control
    22               size="md"
    23               type="text"
    24               placeholder="Каде ќе патувате?:"
    25               id="location"
    26               name="hotelLocation"
    27               value={formData.hotelLocation}
    28               onChange={onFormChange}
    29             ></Form.Control>
    30             <label htmlFor="location">Локација:</label>
    31           </Form.Floating>
    32         </Col>
    33         <Col>
    34           <Form.Floating className="mb-3">
    35             <Form.Control
    36               size="md"
    37               type="date"
    38               placeholder="Датум на пристигнување:"
    39               id="dateFrom"
    40               name="dateFrom"
    41               value={formData.dateFrom}
    42               onChange={onFormChange}
    43             ></Form.Control>
    44             <label htmlFor="dateFrom">Датум на пристигнување:</label>
    45           </Form.Floating>
    46         </Col>
    47         <Col>
    48           <Form.Floating className="mb-3">
    49             <Form.Control
    50               size="md"
    51               type="date"
    52               placeholder="Датум на заминување:"
    53               id="dateTo"
    54               name="dateTo"
    55               value={formData.dateTo}
    56               onChange={onFormChange}
    57             ></Form.Control>
    58             <label htmlFor="dateTo">Датум на заминување:</label>
    59           </Form.Floating>
    60         </Col>
    61         <Col>
    62           <Form.Floating className="mb-3">
    63             <Form.Control
    64               size="md"
    65               type="number"
    66               placeholder="Број на гости:"
    67               id="floatingPassengers"
    68               name="numBeds"
    69               value={formData.numBeds}
    70               onChange={onFormChange}
    71             ></Form.Control>
    72             <label htmlFor="floatingPassengers">Број на гости:</label>
    73           </Form.Floating>
     17    return (
     18        <Form className='rounded-5'>
     19            <Row>
     20                <Col>
     21                    <Form.Floating className="mb-3">
     22                        <Form.Control
     23                            size="md"
     24                            type="text"
     25                            placeholder="Каде ќе патувате?:"
     26                            id="location"
     27                            name="hotelLocation"
     28                            value={formData.hotelLocation}
     29                            onChange={onFormChange}
     30                        ></Form.Control>
     31                        <label htmlFor="location">Локација:</label>
     32                    </Form.Floating>
     33                    <div className="mb-3">
     34                        <Form.Check
     35                            type={"checkbox"}
     36                            id={`default-checkbox}`}
     37                            label={`флексибилност +- 3 дена`}
     38                            onChange={onCheckBoxChange}
     39                            name={'flexible'}
     40                            value={formData.flexible}
     41                        />
     42                    </div>
     43                </Col>
     44                <Col>
     45                    <Form.Floating className="mb-3">
     46                        <Form.Control
     47                            size="md"
     48                            type="date"
     49                            placeholder="Датум на пристигнување:"
     50                            id="dateFrom"
     51                            name="dateFrom"
     52                            value={formData.dateFrom}
     53                            onChange={onFormChange}
     54                        ></Form.Control>
     55                        <label htmlFor="dateFrom">Датум на пристигнување:</label>
     56                    </Form.Floating>
     57                </Col>
     58                <Col>
     59                    <Form.Floating className="mb-3">
     60                        <Form.Control
     61                            size="md"
     62                            type="date"
     63                            placeholder="Датум на заминување:"
     64                            id="dateTo"
     65                            name="dateTo"
     66                            value={formData.dateTo}
     67                            onChange={onFormChange}
     68                        ></Form.Control>
     69                        <label htmlFor="dateTo">Датум на заминување:</label>
     70                    </Form.Floating>
     71                </Col>
     72                <Col>
     73                    <Form.Floating className="mb-3">
     74                        <Form.Control
     75                            size="md"
     76                            type="number"
     77                            placeholder="Број на гости:"
     78                            id="floatingPassengers"
     79                            name="numBeds"
     80                            value={formData.numBeds}
     81                            onChange={onFormChange}
     82                        ></Form.Control>
     83                        <label htmlFor="floatingPassengers">Број на гости:</label>
     84                    </Form.Floating>
    7485
    75           <Form.Group className="my-1">
    76             <Button type="submit" style={{backgroundColor: "#159895"}} size="lg"
    77             onClick={(e) => {
    78               e.preventDefault();
    79               window.location.href = `/search/hotel/${formData.hotelLocation}/${formData.dateFrom}/${formData.dateTo}/${formData.numBeds}`
    80             }}>
    81               <span className="ikona my-1"><HiMagnifyingGlass/></span>
    82               <span className="ikona mx-3">Пребарај</span>
    83             </Button>
    84           </Form.Group>
    85         </Col>
     86                    <Form.Group className="my-1">
     87                        <Button type="submit" style={{backgroundColor: "#159895"}} size="lg"
     88                                onClick={(e) => {
     89                                    e.preventDefault();
     90                                    window.location.href = `/search/hotel/${formData.hotelLocation}/${formData.dateFrom}/${formData.dateTo}/${formData.numBeds}/${formData.flexible}`
     91                                }}>
     92                            <span className="ikona my-1"><HiMagnifyingGlass/></span>
     93                            <span className="ikona mx-3">Пребарај</span>
     94                        </Button>
     95                    </Form.Group>
     96                </Col>
    8697
    87       </Row>
    88     </Form>
    89   );
     98            </Row>
     99        </Form>
     100    );
    90101}
    91102
  • frontend/src/Components/Tab/TabFormTransport.js

    r5528b99 r07f4e8b  
    22import { Button, Col, Container, Form, Row } from "react-bootstrap";
    33import { HiMagnifyingGlass } from "react-icons/hi2"
     4import useFormData from "../Hooks/useFormData";
    45
    56function TabFormTransport() {
     7
     8  const { formData, onFormChange, setFormData } = useFormData({
     9    from: undefined,
     10    to: undefined,
     11    date: undefined,
     12    numPassengers: 0
     13  })
     14
    615  return (
    716    <Form>
     
    1423              placeholder="Од:"
    1524              id="floatingFrom"
     25              value={formData.from}
     26              name={'from'}
     27              onChange={onFormChange}
    1628            ></Form.Control>
    1729            <label htmlFor="floatingFrom">Од:</label>
     
    2537              placeholder="До:"
    2638              id="floatingTo"
     39              name={'to'}
     40              value={formData.to}
     41              onChange={onFormChange}
    2742            ></Form.Control>
    2843            <label htmlFor="floatingTo">До:</label>
     
    3651              placeholder="Датум:"
    3752              id="floatingDate"
     53              name={'date'}
     54              value={formData.date}
     55              onChange={onFormChange}
    3856            ></Form.Control>
    3957            <label htmlFor="floatingDate">Датум:</label>
     
    4664              type="number"
    4765              placeholder="Број на патници:"
     66              name={'numPassengers'}
    4867              id="floatingPassengers"
     68              value={formData.numPassengers}
     69              onChange={onFormChange}
    4970            ></Form.Control>
    5071            <label htmlFor="floatingPassengers">Број на патници:</label>
    5172          </Form.Floating>
    5273          <Form.Group className="my-1">
    53             <Button type="submit" style={{backgroundColor: "#159895"}} size="lg">
     74            <Button type="submit" style={{backgroundColor: "#159895"}} size="lg" onClick={(e) => {
     75              e.preventDefault();
     76              window.location.href = `/search/transport/${formData.from}/${formData.to}/${formData.date}/${formData.numPassengers}`
     77            }}>
    5478              <span className="ikona my-1"><HiMagnifyingGlass/></span>
    5579              <span className="ikona mx-3">Пребарај</span>
  • frontend/src/Components/TransportDetails/FinalPoint.js

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

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

    r5528b99 r07f4e8b  
    1616    }
    1717
    18 <<<<<<< HEAD
    1918    return (
    2019        <>
     
    5857        </>
    5958    );
    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)
    8359};
    8460
  • frontend/src/Components/TransportEdit/TransportEditTab.js

    r5528b99 r07f4e8b  
    99import TransportListing from "./TransportListing";
    1010import useGet from "../Hooks/useGet";
     11import ReservationListing from "../HotelEdit/ReservationListing";
    1112
    1213function TransportEditTab(props) {
    1314  const [activeTab, setActiveTab] = useState("/hotel");
    14   const link = "/transport/" + props.displayRoute.transportID + "/available";
    15   console.log(props.displayRoute)
    16   const [changed, setChanged] = useState(0)
    17   const { data, setData, isLoading, getData } = useGet(link, changed);
     15  console.log(props)
     16
     17
     18  const {
     19    data,
     20    isLoading,
     21    setData,
     22    getData,
     23    setChanged: dhanged
     24  } = useGet(`/transport/${props.displayRoute.transportID}/reservations/active`)
     25
    1826
    1927
     
    7583          </Tab.Pane>
    7684          <Tab.Pane eventKey="/restaurant">
    77             <AddNew type="restaurant"/>
     85            {!isLoading && data.map((res) => {
     86              return (
     87                  <ReservationListing type={'transport'} data={res}/>
     88              )
     89            })}
    7890          </Tab.Pane>
    7991          <Tab.Pane eventKey="/transport">
  • frontend/src/Components/TransportEdit/TransportListing.js

    r5528b99 r07f4e8b  
    99
    1010    //const type = props.type == "hotel" ? "сместувањето" : props.type == "restaurant" ? "ресторанот" : "превозот";
    11     console.log(props.data)
    12     console.log(props.data.from)
    1311    return (<>
    1412        <a href="#" style={{textDecoration: "none", color: "black"}}>
     
    3432                    <Col className="d-flex flex-column justify-content-center" style={{textAlign: "left"}}>
    3533                        <h2>{props.data.from} - {props.data.to}</h2>
    36                         {/* <h6>{props.data.routeCities}</h6> */}
    3734                        <h6>{props.data.routes.map(x => x).join(", ")}</h6>
    3835                    </Col>
     
    4037                    <Col className="d-flex flex-column justify-content-center align-content-center">
    4138                        <h5>Цена:</h5>
    42                         {/* <h4>{props.data.routePrice}</h4> */}
    43                         <h4>99$</h4>
     39                         <h4>{props.data.maxPrice}$</h4>
    4440                    </Col>
    4541                </Row>
  • frontend/src/Components/UserPanel/HotelReservationListing.js

    r5528b99 r07f4e8b  
    1212import data from "bootstrap/js/src/dom/data";
    1313import {AiOutlinePlusCircle} from "react-icons/ai";
    14 import {MdOutlineRateReview} from "react-icons/md";
     14import { MdCancel } from "react-icons/md";
     15import { MdOutlineRateReview } from "react-icons/md"
    1516import useFormData from "../Hooks/useFormData";
    1617import useCreate from "../Hooks/useCreate";
     
    2627
    2728    console.log(props.data)
     29    const { createEntity } = useCreate();
    2830    const dateFormatter = (str) => {
    2931        const inputDate = new Date(str);
     
    114116                        <h3>Вкупна цена: <br></br>{props.data.transportRoute.price}$</h3>
    115117                    </Col>}
     118                {(!props.past) && <Col className="d-flex flex-column justify-content-center align-content-center">
     119                    {<Container id={'ocn'} onClick={(e) => {
     120                        console.log(e.target)
     121                        if (e.target.id === 'icon') {
     122                            createEntity(`/restaurant/${props.data.reservationId}/cancel`, props.setChanged, props.setChanged)
     123                            window.location.href="/reservations"
     124                        }
     125                    }}>
     126                        <h5 id={'icon'}>Откажи<br/>резервација</h5>
     127                        <div className="d-flex justify-content-center align-content-center">
     128                            <MdCancel size={50} color="#159895"/></div>
     129
     130                    </Container>}
     131                </Col>}
    116132                {(props.past) && <Col className="d-flex flex-column justify-content-center align-content-center">
    117133                    {!props.data.reviewed && <Container id={'ocn'} onClick={(e) => {
     
    132148            </Row>
    133149        </Container>
    134         {props.type === 'hotel' && <HotelReservationModal show={show} handleClose={handleClose} data={props.data}/>}
    135         <ReviewModal type={props.type} showReview={showReview} handleCloseReview={handleCloseReview} data={props.data}/>
     150        {props.type === 'hotel' && <HotelReservationModal setChanged={props.setChanged} show={show} handleClose={handleClose} data={props.data}/>}
     151        <ReviewModal setChanged={props.setChanged} type={props.type} showReview={showReview} handleCloseReview={handleCloseReview} data={props.data}/>
    136152    </>)
    137153}
  • frontend/src/Components/UserPanel/HotelReservationModal.js

    r5528b99 r07f4e8b  
    55import {TbToolsKitchen2} from "react-icons/tb";
    66import React from "react";
     7import useCreate from "../Hooks/useCreate";
    78
    89const HotelReservationModal = (props) => {
     10
     11    const {createEntity} = useCreate();
    912
    1013    const dateFormatter = (str) => {
     
    1720            hour12: false,
    1821        };
     22
     23        console.log(props)
    1924
    2025        return inputDate.toLocaleString('de-DE', options);
     
    189194                        Затвори
    190195                    </Button>
     196                    <Button variant="danger" onClick={() => {
     197                        createEntity(`/hotel/${props.data.reservationId}/cancel`, props.setChanged)
     198                        props.handleClose()
     199                    }
     200                    }>
     201                        Откажи резервација
     202                    </Button>
    191203                </Modal.Footer>
    192204            </Modal>
  • frontend/src/Components/UserPanel/PastHotelReservations.js

    r5528b99 r07f4e8b  
    1010        <>
    1111            {!isLoading && data.map((res) => {
    12                 return (<HotelReservationListing past={true} data={res} type={'hotel'}></HotelReservationListing>)
     12                return (<HotelReservationListing setChanged={setChanged} past={true} data={res} type={'hotel'}></HotelReservationListing>)
    1313            })}
    1414            {(!isLoading && data.length === 0) && <h3 className={'my-5'}>Нема податоци за одбраните критериуми!</h3>}
  • frontend/src/Components/UserPanel/PastRestaurantReservations.js

    r5528b99 r07f4e8b  
    1111        <>
    1212            {!isLoading && data.map((res) => {
    13                 return (<HotelReservationListing past={true} data={res} type={'restaurant'}></HotelReservationListing>)
     13                console.log(res)
     14                return (<HotelReservationListing setChanged={setChanged} past={true} data={res} type={'restaurant'}></HotelReservationListing>)
    1415            })}
    1516            {(!isLoading && data.length === 0) && <h3 className={'my-5'}>Нема податоци за одбраните критериуми!</h3>}
  • frontend/src/Components/UserPanel/PastTransportReservations.js

    r5528b99 r07f4e8b  
    1010        <>
    1111            {!isLoading && data.map((res) => {
    12                 return (<HotelReservationListing past={true} data={res} type={'transport'}></HotelReservationListing>)
     12                return (<HotelReservationListing setChanged={setChanged} past={true} data={res} type={'transport'}></HotelReservationListing>)
    1313            })}
    1414
  • frontend/src/Components/UserPanel/ReviewModal.js

    r5528b99 r07f4e8b  
    1010        description: "",
    1111    }
     12    console.log(props)
    1213
    1314    const {createEntity} = useCreate();
     
    8081                                ...formData,
    8182                                hotelId: props.data.hotelId,
    82                                 userId: 1
     83                                userId: 1,
     84                                reservationId: props.data.reservationId
    8385                            } :
    8486                            props.type === 'restaurant' ? {
    85                                     ...formData,
    86                                     restaurantId: props.data.restaurantId,
    87                                     userId: 1
    88                                 } : {
     87                                ...formData,
     88                                restaurantId: props.data.restaurantId,
     89                                userId: 1,
     90                                reservationId: props.data.reservationId
     91                            } : {
    8992                                ...formData,
    9093                                transportId: props.data.transportId,
    91                                 userId: 1
     94                                userId: 1,
     95                                reservationId: props.data.reservationId
    9296                            }
    93                                 createEntity('/review/add', dataToPost)
     97                        createEntity('/review/add', dataToPost, props.setChanged)
    9498                        setFormData(dummy)
    9599                        props.handleCloseReview()
  • frontend/src/Components/useFormNested.js

    r5528b99 r07f4e8b  
    77        console.log(e)
    88
    9         const dependantRoutes = e.target.parentElement.getAttribute('dependantRoutes').split(',')
     9        const dependantRoutes = e.target.name === 'freeSpace' ? e.target.parentElement.getAttribute('dependantRoutes').split(',') : undefined;
    1010        console.log(dependantRoutes)
    1111
Note: See TracChangeset for help on using the changeset viewer.