1 | import React from "react";
|
---|
2 | import { Container, Form, Button, Row, Col } from "react-bootstrap";
|
---|
3 | import useFormData from "../Hooks/useFormData";
|
---|
4 |
|
---|
5 | const SearchCriteriasTransport = (props) => {
|
---|
6 |
|
---|
7 | const { formData, onFormChange, onCheckBoxChange, setFormData} = useFormData(props.criterias)
|
---|
8 |
|
---|
9 | return (
|
---|
10 | <>
|
---|
11 | <Container
|
---|
12 | className="p-1 pb-0 mb-5 mt-3 rounded-2"
|
---|
13 | style={{ backgroundColor: "#002B5B", width: "65%"}}
|
---|
14 | >
|
---|
15 | <Form className="rounded-5">
|
---|
16 | <Row className="gx-1">
|
---|
17 | <Col>
|
---|
18 | <Form.Floating className="mb-3">
|
---|
19 | <Form.Control
|
---|
20 | size="md"
|
---|
21 | type="text"
|
---|
22 | placeholder="Од?:"
|
---|
23 | id="location"
|
---|
24 | name="from"
|
---|
25 | onChange={onFormChange}
|
---|
26 | value={formData.from}
|
---|
27 | ></Form.Control>
|
---|
28 | <label htmlFor="location">Од:</label>
|
---|
29 | </Form.Floating>
|
---|
30 | </Col>
|
---|
31 | <Col>
|
---|
32 | <Form.Floating className="mb-3">
|
---|
33 | <Form.Control
|
---|
34 | size="md"
|
---|
35 | type="text"
|
---|
36 | placeholder="Од?:"
|
---|
37 | id="location"
|
---|
38 | name="to"
|
---|
39 | onChange={onFormChange}
|
---|
40 | value={formData.to}
|
---|
41 | ></Form.Control>
|
---|
42 | <label htmlFor="location">До:</label>
|
---|
43 | </Form.Floating>
|
---|
44 | </Col>
|
---|
45 | <Col>
|
---|
46 | <Form.Floating className="mb-3">
|
---|
47 | <Form.Control
|
---|
48 | size="md"
|
---|
49 | type="date"
|
---|
50 | placeholder="Датум на заминување:"
|
---|
51 | id="dateTo"
|
---|
52 | name="date"
|
---|
53 | onChange={onFormChange}
|
---|
54 | value={formData.date}
|
---|
55 | ></Form.Control>
|
---|
56 | <label htmlFor="dateTo">Датум:</label>
|
---|
57 | </Form.Floating>
|
---|
58 | </Col>
|
---|
59 | <Col>
|
---|
60 | <Form.Floating className="mb-3">
|
---|
61 | <Form.Control
|
---|
62 | size="md"
|
---|
63 | type="number"
|
---|
64 | placeholder="Број на патници:"
|
---|
65 | id="floatingPassengers"
|
---|
66 | name="numBeds"
|
---|
67 | onChange={onFormChange}
|
---|
68 | value={formData.numPassengers}
|
---|
69 | ></Form.Control>
|
---|
70 | <label htmlFor="floatingPassengers">Број на патници:</label>
|
---|
71 | </Form.Floating>
|
---|
72 | </Col>
|
---|
73 | {props.showButton !== false && <Col>
|
---|
74 | <Form.Group className="my-1">
|
---|
75 | <Button
|
---|
76 | type="submit"
|
---|
77 | style={{backgroundColor: "#159895"}}
|
---|
78 | size="lg"
|
---|
79 | className="w-100"
|
---|
80 | onClick={(e) => {
|
---|
81 | e.preventDefault();
|
---|
82 | window.location.href = `/search/transport/${formData.from}/${formData.to}/${formData.date}/${formData.numPassengers}`
|
---|
83 | }}
|
---|
84 | >
|
---|
85 | <span className="ikona mx-3">Пребарај</span>
|
---|
86 | </Button>
|
---|
87 | </Form.Group>
|
---|
88 | </Col>}
|
---|
89 | </Row>
|
---|
90 | </Form>
|
---|
91 | </Container>
|
---|
92 | </>
|
---|
93 | );
|
---|
94 | };
|
---|
95 |
|
---|
96 | export default SearchCriteriasTransport;
|
---|