Changeset 07f4e8b for frontend/src/Components/HotelEdit
- Timestamp:
- 01/24/24 17:42:28 (10 months ago)
- Branches:
- master
- Children:
- 0f5aa27
- Parents:
- 5528b99
- Location:
- frontend/src/Components/HotelEdit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
frontend/src/Components/HotelEdit/HotelEditTab.js
r5528b99 r07f4e8b 1 1 import React from "react"; 2 import { Container, Col, Row, Image, Nav, Tab} from "react-bootstrap";3 import { useState} from "react";4 import { FaTaxi, FaHotel} from "react-icons/fa";5 import { MdOutlineStickyNote2} from "react-icons/md";2 import {Container, Col, Row, Image, Nav, Tab} from "react-bootstrap"; 3 import {useState} from "react"; 4 import {FaTaxi, FaHotel} from "react-icons/fa"; 5 import {MdOutlineStickyNote2} from "react-icons/md"; 6 6 import AddNew from "../Resources/AddNew"; 7 import { BiData} from "react-icons/bi"7 import {BiData} from "react-icons/bi" 8 8 import RoomListing from "./RoomListing"; 9 9 import HotelEditForm from "./HotelEditForm"; 10 10 import AddHotelForm from "../Forms/AddHotelForm"; 11 11 import EditModal from "../Resources/EditModal"; 12 import AddAvailability from "../Resources/AddAvailability"; 13 import useGet from "../Hooks/useGet"; 14 import ReservationListing from "./ReservationListing"; 12 15 13 16 function HotelEditTab(props) { 14 const [activeTab, setActiveTab] = useState("/hotel");15 const [modalData, setModalData] = useState("");16 const [show, setShow] = useState(false);17 const [activeTab, setActiveTab] = useState("/hotel"); 18 const [modalData, setModalData] = useState(""); 19 const [show, setShow] = useState(false); 17 20 18 const handleClose = () => setShow(false); 19 const handleShow = () => { 20 //e.preventDefault(); 21 setShow(true); 21 console.log(props) 22 22 23 }; 23 const { 24 data, 25 isLoading, 26 setData, 27 getData, 28 setChanged 29 } = useGet(`/hotel/${props.displayRoom.hotelId}/reservations/active`) 24 30 25 const showModal = (modalData) => { 26 setModalData(modalData); 27 handleShow(); 28 } 29 console.log(props.displayRoom) 31 !isLoading && console.log(data) 30 32 31 const handleSelect = (eventKey) => { 32 setActiveTab(eventKey); 33 }; 33 const handleClose = () => setShow(false); 34 const handleShow = () => { 35 //e.preventDefault(); 36 setShow(true); 34 37 35 return ( 36 <Container className="rounded-5"> 37 <Tab.Container 38 activeKey={activeTab} 39 onSelect={handleSelect} 40 className="bg-dark rounded-5" 41 > 42 <Nav 43 fill 44 variant="tabs" 45 className="bg-body rounded-top-5" 46 activeKey="/hotel" 47 id="tab_item" 48 > 49 <Nav.Item className="tab_item rounded-5"> 50 <Nav.Link eventKey="/hotel" className="text-left rounded-5"> 38 }; 39 40 const showModal = (modalData) => { 41 setModalData(modalData); 42 handleShow(); 43 } 44 console.log(props.displayRoom) 45 46 const handleSelect = (eventKey) => { 47 setActiveTab(eventKey); 48 }; 49 50 return ( 51 <Container className="rounded-5"> 52 <Tab.Container 53 activeKey={activeTab} 54 onSelect={handleSelect} 55 className="bg-dark rounded-5" 56 > 57 <Nav 58 fill 59 variant="tabs" 60 className="bg-body rounded-top-5" 61 activeKey="/hotel" 62 id="tab_item" 63 > 64 <Nav.Item className="tab_item rounded-5"> 65 <Nav.Link eventKey="/hotel" className="text-left rounded-5"> 51 66 <span className="ikona"> 52 67 <FaHotel 53 color="#159895"54 style={{ lineHeight: "100em"}}55 size={"1.5em"}56 className="mx-3"68 color="#159895" 69 style={{lineHeight: "100em"}} 70 size={"1.5em"} 71 className="mx-3" 57 72 /> 58 73 </span> 59 <span className="ikona">Соби</span>60 </Nav.Link>61 </Nav.Item>62 <Nav.Item className="tab_item">63 <Nav.Link eventKey="/restaurant">74 <span className="ikona">Соби</span> 75 </Nav.Link> 76 </Nav.Item> 77 <Nav.Item className="tab_item"> 78 <Nav.Link eventKey="/restaurant"> 64 79 <span className="ikona"> 65 <MdOutlineStickyNote2 color="#159895" size={"1.5em"} className="mx-3" 80 <MdOutlineStickyNote2 color="#159895" size={"1.5em"} className="mx-3"/> 66 81 </span> 67 <span className="ikona">Резервации</span>68 </Nav.Link>69 </Nav.Item>70 <Nav.Item className="tab_item rounded-5">71 <Nav.Link eventKey="/transport" className="text-left rounded-5">82 <span className="ikona">Резервации</span> 83 </Nav.Link> 84 </Nav.Item> 85 <Nav.Item className="tab_item rounded-5"> 86 <Nav.Link eventKey="/transport" className="text-left rounded-5"> 72 87 <span className="ikona"> 73 <BiData color="#159895" size={"1.5em"} className="mx-3" 88 <BiData color="#159895" size={"1.5em"} className="mx-3"/> 74 89 </span> 75 <span className="ikona">Општи податоци</span>76 </Nav.Link>77 </Nav.Item>78 </Nav>90 <span className="ikona">Општи податоци</span> 91 </Nav.Link> 92 </Nav.Item> 93 </Nav> 79 94 80 <Tab.Content className="py-5 px-3 border rounded-bottom-5 bg-light"> 81 <Tab.Pane eventKey="/hotel"> 82 {props.displayRoom.hotelRooms.map((room) => { 83 return <RoomListing key={room.hotelRoomId} data={room} showModal={showModal}/> 84 })} 85 <EditModal show={show} handleClose={handleClose} type="room" room={modalData}></EditModal> 86 <AddNew Id={props.displayRoom.hotelId} refresh={props.refresh} type="room"/> 87 </Tab.Pane> 88 <Tab.Pane eventKey="/restaurant"> 89 <AddNew type="restaurant"/> 90 </Tab.Pane> 91 <Tab.Pane eventKey="/transport"> 92 <AddHotelForm refresh={props.refresh} hotel={props.displayRoom}/> 93 </Tab.Pane> 94 </Tab.Content> 95 </Tab.Container> 96 </Container> 97 ); 95 <Tab.Content className="py-5 px-3 border rounded-bottom-5 bg-light"> 96 <Tab.Pane eventKey="/hotel"> 97 {props.displayRoom.hotelRooms.map((room) => { 98 return <RoomListing key={room.hotelRoomId} data={room} showModal={showModal}/> 99 })} 100 <EditModal show={show} handleClose={handleClose} type="room" room={modalData}></EditModal> 101 <AddNew Id={props.displayRoom.hotelId} refresh={props.refresh} type="room"/> 102 </Tab.Pane> 103 <Tab.Pane eventKey="/restaurant"> 104 {!isLoading && data.map((res) => { 105 return ( 106 <ReservationListing type={'hotel'} data={res}/> 107 ) 108 })} 109 {/*<AddNew type="restaurant"/>*/} 110 </Tab.Pane> 111 <Tab.Pane eventKey="/transport"> 112 <AddHotelForm refresh={props.refresh} hotel={props.displayRoom}/> 113 </Tab.Pane> 114 </Tab.Content> 115 </Tab.Container> 116 </Container> 117 ); 98 118 } 99 119 -
frontend/src/Components/HotelEdit/ReservationListing.js
r5528b99 r07f4e8b 3 3 4 4 const ReservationListing = (props) => { 5 6 const dateFormatter = (str) => { 7 const inputDate = new Date(str); 8 9 const options = { 10 year: '2-digit', 11 month: '2-digit', 12 day: '2-digit', 13 }; 14 15 return inputDate.toLocaleString('de-DE', options); 16 } 17 5 18 return( 6 19 <> … … 15 28 <Col md={8} className="d-flex flex-column justify-content-start ps-5"> 16 29 <h3 style={{fontWeight: "bold"}} className={'text-start'}>Резервација за:</h3> 17 <h4 className={'text-start'}>{props.data.hotelRoom.hotelRoomName}</h4> 30 {props.type === 'hotel' && <h4 className={'text-start'}>{props.data.hotelRoom.hotelRoomName}</h4>} 31 {props.type === 'restaurant' && <h4 className={'text-start'}>{'Маса за ' + props.data.restaurantsTable.noSeats}</h4>} 32 {props.type === 'transport' && <h4 className={'text-start'}>{props.data.transportRoute.from + ' ' + props.data.transportRoute.to}</h4>} 33 {props.type === 'transport' && <h4 className={'text-start'}>{props.data.noSeats + ' ' + 'патници'}</h4>} 18 34 <h4 className={'text-start'}>{props.data.user.name + ' ' + props.data.user.surname}</h4> 19 <h5 className={'text-start'}>{props.data.dateFrom + ' - ' + props.data.dateTo}</h5> 35 {props.type !== 'transport' && <h5 36 className={'text-start'}>{dateFormatter(props.data.dateFrom) + ' - ' + dateFormatter(props.data.dateTo)}</h5>} 20 37 </Col> 21 38 <Col md={4} className="d-flex flex-column justify-content-center align-content-center"> 22 <h3>Вкупна цена: <br></br>{props.data.hotelRoom.price}$</h3>39 {props.type === 'hotel' && <h3>Вкупна цена: <br></br>{props.data.hotelRoom.price}$</h3>} 23 40 </Col> 24 41 </Row>
Note:
See TracChangeset
for help on using the changeset viewer.