source: frontend/src/Components/SearchCriterias/SearchCriteriasRestaurant.js@ 0f5aa27

Last change on this file since 0f5aa27 was e6c2521, checked in by darsov2 <62809499+darsov2@…>, 10 months ago

images upload/download impl, other fixes

  • Property mode set to 100644
File size: 5.6 KB
Line 
1import React from "react";
2import {Container, Form, Button, Row, Col} from "react-bootstrap";
3import useFormData from "../Hooks/useFormData";
4import {HiMagnifyingGlass} from "react-icons/hi2";
5
6
7const timeOfArrival = () => {
8 let times = [];
9
10 for (let i = 0; i <= 23; i++) {
11 for (let j = 0; j <= 30; j += 30) {
12 let hour = i.toString().padStart(2, "0");
13 let minutes = j.toString().padStart(2, "0");
14 times.push(`${hour}:${minutes}`);
15 }
16 }
17
18 return times;
19};
20
21const SearchCriteriasRestaurant = (props) => {
22
23 const {formData, onFormChange, onCheckBoxChange, setFormData} = useFormData(props.criterias)
24 const a = timeOfArrival();
25
26 return (
27 <>
28 <Container
29 className="p-1 pb-0 mb-5 mt-3 rounded-2"
30 style={{backgroundColor: "#002B5B", width: "65%"}}
31 >
32 <Form>
33 <Row>
34 <Col>
35 <Form.Floating className="mb-3">
36 <Form.Control
37 size="lg"
38 type="text"
39 placeholder="Место:"
40 id="location"
41 name={'restaurantLocation'}
42 value={formData.restaurantLocation}
43 onChange={onFormChange}
44 ></Form.Control>
45 <label htmlFor="location">Место:</label>
46 </Form.Floating>
47 </Col>
48 <Col>
49 <Form.Floating className="mb-3">
50 <Form.Control
51 size="md"
52 type="date"
53 step={3600000}
54 placeholder="Час од:"
55 id="dateFrom"
56 name={'date'}
57 value={formData.date}
58 onChange={onFormChange}
59 ></Form.Control>
60 <label htmlFor="dateFrom">Датум:</label>
61 </Form.Floating>
62 </Col>
63 <Col>
64 <Form.Floating className="mb-3">
65 <Form.Select size="md"
66 name={'hourFrom'}
67 value={formData.hourFrom}
68 onChange={onFormChange}>
69 <option>Изберете време:</option>
70 {a.map((x) => {
71 return <option key={x}>{x}</option>;
72 })}
73 </Form.Select>
74 <label htmlFor="hour">Час од:</label>
75 </Form.Floating>
76 </Col>
77 <Col>
78 <Form.Floating className="mb-3">
79 <Form.Select size="md"
80 name={'hourTo'}
81 value={formData.hourTo}
82 onChange={onFormChange}>
83 <option>Изберете време:</option>
84 {a.filter((x) => x > formData.hourFrom).map((x) => {
85 return <option key={x}>{x}</option>;
86 })}
87 </Form.Select>
88 <label htmlFor="hour">Час до:</label>
89 </Form.Floating>
90 </Col>
91 <Col>
92 <Form.Floating className="mb-3">
93 <Form.Control
94 size="md"
95 type="number"
96 placeholder="Број на гости:"
97 id="floatingPassengers"
98 name={'numPeople'}
99 value={formData.numPeople}
100 onChange={onFormChange}
101 ></Form.Control>
102 <label htmlFor="floatingPassengers">Број на гости:</label>
103 </Form.Floating>
104 </Col>
105 <Col>
106 <Form.Group className="my-1">
107 <Button type="submit" style={{backgroundColor: "#159895"}} size="lg" onClick={(e) => {
108 e.preventDefault();
109 window.location.href = `/search/restaurant/${formData.restaurantLocation}/${formData.date}/${formData.hourFrom}/${formData.hourTo}/${formData.numPeople}`
110
111 }}>
112 <span className="ikona my-1"><HiMagnifyingGlass/></span>
113 <span className="ikona mx-3">Пребарај</span>
114 </Button>
115 </Form.Group>
116 </Col>
117 </Row>
118 </Form>
119 </Container>
120 </>
121 );
122};
123
124export default SearchCriteriasRestaurant;
Note: See TracBrowser for help on using the repository browser.