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";
|
---|
6 | import AddNew from "../Resources/AddNew";
|
---|
7 | import {BiData} from "react-icons/bi"
|
---|
8 | import RoomListing from "./RoomListing";
|
---|
9 | import HotelEditForm from "./HotelEditForm";
|
---|
10 | import AddHotelForm from "../Forms/AddHotelForm";
|
---|
11 | import EditModal from "../Resources/EditModal";
|
---|
12 | import AddAvailability from "../Resources/AddAvailability";
|
---|
13 | import useGet from "../Hooks/useGet";
|
---|
14 | import ReservationListing from "./ReservationListing";
|
---|
15 |
|
---|
16 | function HotelEditTab(props) {
|
---|
17 | const [activeTab, setActiveTab] = useState("/hotel");
|
---|
18 | const [modalData, setModalData] = useState("");
|
---|
19 | const [show, setShow] = useState(false);
|
---|
20 |
|
---|
21 | console.log(props)
|
---|
22 |
|
---|
23 | const {
|
---|
24 | data,
|
---|
25 | isLoading,
|
---|
26 | setData,
|
---|
27 | getData,
|
---|
28 | setChanged
|
---|
29 | } = useGet(`/hotel/${props.displayRoom.hotelId}/reservations/active`)
|
---|
30 |
|
---|
31 | !isLoading && console.log(data)
|
---|
32 |
|
---|
33 | const handleClose = () => setShow(false);
|
---|
34 | const handleShow = () => {
|
---|
35 | //e.preventDefault();
|
---|
36 | setShow(true);
|
---|
37 |
|
---|
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">
|
---|
66 | <span className="ikona">
|
---|
67 | <FaHotel
|
---|
68 | color="#159895"
|
---|
69 | style={{lineHeight: "100em"}}
|
---|
70 | size={"1.5em"}
|
---|
71 | className="mx-3"
|
---|
72 | />
|
---|
73 | </span>
|
---|
74 | <span className="ikona">Соби</span>
|
---|
75 | </Nav.Link>
|
---|
76 | </Nav.Item>
|
---|
77 | <Nav.Item className="tab_item">
|
---|
78 | <Nav.Link eventKey="/restaurant">
|
---|
79 | <span className="ikona">
|
---|
80 | <MdOutlineStickyNote2 color="#159895" size={"1.5em"} className="mx-3"/>
|
---|
81 | </span>
|
---|
82 | <span className="ikona">Резервации</span>
|
---|
83 | </Nav.Link>
|
---|
84 | </Nav.Item>
|
---|
85 | <Nav.Item className="tab_item rounded-5">
|
---|
86 | <Nav.Link eventKey="/transport" className="text-left rounded-5">
|
---|
87 | <span className="ikona">
|
---|
88 | <BiData color="#159895" size={"1.5em"} className="mx-3"/>
|
---|
89 | </span>
|
---|
90 | <span className="ikona">Општи податоци</span>
|
---|
91 | </Nav.Link>
|
---|
92 | </Nav.Item>
|
---|
93 | </Nav>
|
---|
94 |
|
---|
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 | );
|
---|
118 | }
|
---|
119 |
|
---|
120 | export default HotelEditTab;
|
---|