Last change
on this file since efaa053 was e6c2521, checked in by darsov2 <62809499+darsov2@…>, 10 months ago |
images upload/download impl, other fixes
|
-
Property mode
set to
100644
|
File size:
2.9 KB
|
Line | |
---|
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 | import AddTripForm from "./AddTripForm";
|
---|
6 |
|
---|
7 |
|
---|
8 | const EditMainRouteForm = (props) => {
|
---|
9 |
|
---|
10 | console.log(props.route)
|
---|
11 |
|
---|
12 | const dateFormatter = (str) => {
|
---|
13 | const inputDate = new Date(str);
|
---|
14 |
|
---|
15 | const options = {
|
---|
16 | year: '2-digit',
|
---|
17 | month: '2-digit',
|
---|
18 | day: '2-digit',
|
---|
19 | hours: '2-digit',
|
---|
20 | minutes: '2-digit'
|
---|
21 | };
|
---|
22 |
|
---|
23 | return inputDate.toLocaleString('en-GB', options);
|
---|
24 | }
|
---|
25 |
|
---|
26 | const {
|
---|
27 | data,
|
---|
28 | isLoading,
|
---|
29 | setData,
|
---|
30 | getData
|
---|
31 | } = useGet(`/transport/${props.route.id}/available`)
|
---|
32 |
|
---|
33 | !isLoading && console.log(data)
|
---|
34 |
|
---|
35 | return (
|
---|
36 | <>
|
---|
37 | <Row>
|
---|
38 | <Col>
|
---|
39 | <AddTripForm transportId={props.route.id} refresh={props.refresh}/>
|
---|
40 | </Col>
|
---|
41 | <Col>
|
---|
42 | <Container>
|
---|
43 | <Table>
|
---|
44 | <thead>
|
---|
45 | <tr>
|
---|
46 | <th>#</th>
|
---|
47 | <th>Од - До</th>
|
---|
48 | <th>Време тргање</th>
|
---|
49 | <th>Време пристигање</th>
|
---|
50 | <th>Број патници</th>
|
---|
51 | <th>Цена</th>
|
---|
52 | </tr>
|
---|
53 | </thead>
|
---|
54 | <tbody>
|
---|
55 | {!isLoading && data != null && data.map((avail) => {
|
---|
56 | return (
|
---|
57 | avail.routes.map((route, i) => {
|
---|
58 | return (<tr>
|
---|
59 | <td>
|
---|
60 | {i + 1}
|
---|
61 | </td>
|
---|
62 | <td>
|
---|
63 | {route.from} - {route.to}
|
---|
64 | </td>
|
---|
65 | <td>
|
---|
66 | {dateFormatter(route.departure)}
|
---|
67 | </td>
|
---|
68 | <td>
|
---|
69 | {dateFormatter(route.arrival)}
|
---|
70 | </td>
|
---|
71 | <td>
|
---|
72 | {route.freeSpace}
|
---|
73 | </td>
|
---|
74 | </tr>)
|
---|
75 | }))})}
|
---|
76 | </tbody>
|
---|
77 | </Table>
|
---|
78 | </Container>
|
---|
79 | </Col>
|
---|
80 | </Row>
|
---|
81 | </>
|
---|
82 | )
|
---|
83 | }
|
---|
84 |
|
---|
85 | export default EditMainRouteForm |
---|
Note:
See
TracBrowser
for help on using the repository browser.