Last change
on this file since efaa053 was e6c2521, checked in by darsov2 <62809499+darsov2@…>, 11 months ago |
images upload/download impl, other fixes
|
-
Property mode
set to
100644
|
File size:
2.3 KB
|
Line | |
---|
1 | import React from "react";
|
---|
2 | import {Col, Container, Row, Table} from "react-bootstrap";
|
---|
3 | import AddTableForm from "./AddTableForm";
|
---|
4 | import useGet from "../Hooks/useGet";
|
---|
5 |
|
---|
6 | const EditTableForm = (props) => {
|
---|
7 |
|
---|
8 | const {
|
---|
9 | data,
|
---|
10 | isLoading,
|
---|
11 | setData,
|
---|
12 | getData
|
---|
13 | } = useGet(`/restaurant/table/${props.table.tableId}/availible`)
|
---|
14 |
|
---|
15 | !isLoading && console.log(data)
|
---|
16 |
|
---|
17 | const dateFormatter = (str) => {
|
---|
18 | const inputDate = new Date(str);
|
---|
19 |
|
---|
20 | const options = {
|
---|
21 | year: '2-digit',
|
---|
22 | month: '2-digit',
|
---|
23 | day: '2-digit',
|
---|
24 | hour: '2-digit',
|
---|
25 | minute: '2-digit',
|
---|
26 | hour12: false,
|
---|
27 | };
|
---|
28 |
|
---|
29 | return inputDate.toLocaleString('en-GB', options);
|
---|
30 |
|
---|
31 | }
|
---|
32 |
|
---|
33 | return (
|
---|
34 | <>
|
---|
35 | <Row>
|
---|
36 | <Col>
|
---|
37 | <AddTableForm data={props.table}></AddTableForm>
|
---|
38 | </Col>
|
---|
39 | <Col>
|
---|
40 | <Container>
|
---|
41 | <Table>
|
---|
42 | <thead>
|
---|
43 | <tr>
|
---|
44 | <th>#</th>
|
---|
45 | <th>Достапно од</th>
|
---|
46 | <th>Достапно до</th>
|
---|
47 | <th>Број на маси</th>
|
---|
48 | </tr>
|
---|
49 | </thead>
|
---|
50 | <tbody>
|
---|
51 | {!isLoading && data != null && data.map((avail, i) => {
|
---|
52 | return (<tr>
|
---|
53 | <td>
|
---|
54 | {i + 1}
|
---|
55 | </td>
|
---|
56 | <td>
|
---|
57 | {dateFormatter(avail.hourFrom)}
|
---|
58 | </td>
|
---|
59 | <td>
|
---|
60 | {dateFormatter(avail.hourTo)}
|
---|
61 | </td>
|
---|
62 | <td>
|
---|
63 | {avail.numTables}
|
---|
64 | </td>
|
---|
65 | </tr>)
|
---|
66 | })}
|
---|
67 | </tbody>
|
---|
68 | </Table>
|
---|
69 | </Container>
|
---|
70 | </Col>
|
---|
71 | </Row>
|
---|
72 | </>
|
---|
73 | )
|
---|
74 | }
|
---|
75 |
|
---|
76 | export default EditTableForm; |
---|
Note:
See
TracBrowser
for help on using the repository browser.