source: frontend/src/Components/Forms/EditRoomForm.js@ efaa053

Last change on this file since efaa053 was 07f4e8b, checked in by darsov2 <62809499+darsov2@…>, 10 months ago

prefinal fixes

  • Property mode set to 100644
File size: 2.3 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 console.log(`/hotel/rooms/${props.room.hotelRoomId}/available`)
31
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>
46 <th>Oд</th>
47 <th>До</th>
48 <th>Цена</th>
49 </tr>
50 </thead>
51 <tbody>
52 {!isLoading && data != null && data.map((avail, i) => {
53 return (<tr>
54 <td>
55 {i + 1}
56 </td>
57 <td>
58 {dateFormatter(avail.dateFrom)}
59 </td>
60 <td>
61 {dateFormatter(avail.dateTo)}
62 </td>
63 <td>
64 {avail.numberOfBeds}
65 </td>
66 </tr>)
67 })}
68 </tbody>
69 </Table>
70 </Container>
71 </Col>
72 </Row>
73 </>
74 )
75}
76
77export default EditRoomForm
Note: See TracBrowser for help on using the repository browser.