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