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