Last change
on this file since ac19a0c was ac19a0c, checked in by darsov2 <62809499+darsov2@…>, 9 months ago |
authContext impl, admin panel impl, search bar fixes, reservations listings impl
|
-
Property mode
set to
100644
|
File size:
2.5 KB
|
Rev | Line | |
---|
[e9b4ba9] | 1 | import React from "react";
|
---|
| 2 | import useGet from "../Hooks/useGet";
|
---|
| 3 | import {Col, Container, Row, Table} from "react-bootstrap";
|
---|
| 4 | import AddRoomForm from "./AddRoomForm";
|
---|
| 5 |
|
---|
| 6 |
|
---|
| 7 | const EditRoomForm = (props) => {
|
---|
| 8 |
|
---|
| 9 | console.log(props.room)
|
---|
| 10 |
|
---|
| 11 | const dateFormatter = (str) => {
|
---|
| 12 | const inputDate = new Date(str);
|
---|
| 13 |
|
---|
| 14 | const options = {
|
---|
| 15 | year: '2-digit',
|
---|
| 16 | month: '2-digit',
|
---|
| 17 | day: '2-digit'
|
---|
| 18 | };
|
---|
| 19 |
|
---|
| 20 | return inputDate.toLocaleString('en-GB', options);
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | const {
|
---|
| 24 | data,
|
---|
| 25 | isLoading,
|
---|
| 26 | setData,
|
---|
| 27 | getData
|
---|
| 28 | } = useGet(`/hotel/rooms/${props.room.hotelRoomId}/available`)
|
---|
| 29 |
|
---|
[ac19a0c] | 30 | console.log(`/hotel/rooms/${props.room.hotelRoomId}/available`)
|
---|
| 31 |
|
---|
[e9b4ba9] | 32 | !isLoading && console.log(data)
|
---|
| 33 |
|
---|
| 34 | return (
|
---|
| 35 | <>
|
---|
| 36 | <Row>
|
---|
| 37 | <Col>
|
---|
| 38 | <AddRoomForm roomId={props.room.hotelRoomId} refresh={props.refresh} room={props.room}/>
|
---|
| 39 | </Col>
|
---|
| 40 | <Col>
|
---|
| 41 | <Container>
|
---|
| 42 | <Table>
|
---|
| 43 | <thead>
|
---|
| 44 | <tr>
|
---|
| 45 | <th>#</th>
|
---|
[ac19a0c] | 46 | <th>Oд</th>
|
---|
| 47 | <th>До</th>
|
---|
| 48 | <th>Време на тргнување</th>
|
---|
| 49 | <th>Време на пристигнување</th>
|
---|
| 50 | <th>Цена</th>
|
---|
[e9b4ba9] | 51 | </tr>
|
---|
| 52 | </thead>
|
---|
| 53 | <tbody>
|
---|
| 54 | {!isLoading && data != null && data.map((avail, i) => {
|
---|
| 55 | return (<tr>
|
---|
| 56 | <td>
|
---|
| 57 | {i + 1}
|
---|
| 58 | </td>
|
---|
| 59 | <td>
|
---|
| 60 | {dateFormatter(avail.dateFrom)}
|
---|
| 61 | </td>
|
---|
| 62 | <td>
|
---|
| 63 | {dateFormatter(avail.dateTo)}
|
---|
| 64 | </td>
|
---|
| 65 | <td>
|
---|
| 66 | {avail.numberOfBeds}
|
---|
| 67 | </td>
|
---|
| 68 | </tr>)
|
---|
| 69 | })}
|
---|
| 70 | </tbody>
|
---|
| 71 | </Table>
|
---|
| 72 | </Container>
|
---|
| 73 | </Col>
|
---|
| 74 | </Row>
|
---|
| 75 | </>
|
---|
| 76 | )
|
---|
| 77 | }
|
---|
| 78 |
|
---|
| 79 | export default EditRoomForm |
---|
Note:
See
TracBrowser
for help on using the repository browser.