source: frontend/src/Components/Forms/EditRoomForm.js@ 5528b99

Last change on this file since 5528b99 was 5528b99, checked in by darsov2 <62809499+darsov2@…>, 6 months ago

revert

  • Property mode set to 100644
File size: 2.6 KB
Line 
1import React from "react";
2import useGet from "../Hooks/useGet";
3import {Col, Container, Row, Table} from "react-bootstrap";
4import AddRoomForm from "./AddRoomForm";
5
6
7const 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
30 !isLoading && console.log(data)
31
32 return (
33 <>
34 <Row>
35 <Col>
36 <AddRoomForm roomId={props.room.hotelRoomId} refresh={props.refresh} room={props.room}/>
37 </Col>
38 <Col>
39 <Container>
40 <Table>
41 <thead>
42 <tr>
43 <th>#</th>
44<<<<<<< HEAD
45 <th>Oд</th>
46 <th>До</th>
47 <th>Цена</th>
48=======
49 <th>Достапно од</th>
50 <th>Достапно до</th>
51 <th>Број на соби</th>
52>>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
53 </tr>
54 </thead>
55 <tbody>
56 {!isLoading && data != null && data.map((avail, i) => {
57 return (<tr>
58 <td>
59 {i + 1}
60 </td>
61 <td>
62 {dateFormatter(avail.dateFrom)}
63 </td>
64 <td>
65 {dateFormatter(avail.dateTo)}
66 </td>
67 <td>
68 {avail.numberOfBeds}
69 </td>
70 </tr>)
71 })}
72 </tbody>
73 </Table>
74 </Container>
75 </Col>
76 </Row>
77 </>
78 )
79}
80
81export default EditRoomForm
Note: See TracBrowser for help on using the repository browser.