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

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.6 KB
RevLine 
[e6c2521]1import React from "react";
2import { Form, Button, Container } from "react-bootstrap";
3import { GiConfirmed } from "react-icons/gi"
4import useCreateTable from "../Hooks/Restaurant/useCreateTable";
5import useFormData from "../Hooks/useFormData";
6
7const AddTableForm = (props) => {
8
9 const { createTable } = useCreateTable();
10
11 console.log("OD FORMATA")
12 console.log(props.data)
13
14 const dummy = {
15 numberOfSeats: ""
16 }
17
18 const { formData, onFormChange, onCheckBoxChange, setFormData } = useFormData(
19 props.data ? props.data : dummy
20 );
21
22 return (<>
23 <Container
24 className="rounded-5 m-5 my-auto mx-auto py-2 px-5"
25 style={{ backgroundColor: "#ffffff" }}
26 >
27 <Form>
28 <Form.Group className="mb-3" controlId="numPeople">
29 <Form.Label>Број на луѓе</Form.Label>
30 <Form.Control
31 type="number"
32 value={formData.noSeats}
33 onChange={onFormChange}
34 name={'noSeats'}
35 placeholder="Внесете го бројот на луѓе" />
36 </Form.Group>
37
38 {/*<Form.Group className="mb-3" controlId="tableStartingTime">*/}
39 {/* <Form.Label>Време на резервација</Form.Label>*/}
40 {/* <Form.Control */}
41 {/* type="time"*/}
42 {/* value={formData.startTime}*/}
43 {/* onChange={onFormChange} */}
44 {/* placeholder="Внесете времето на резервацијата" />*/}
45 {/*</Form.Group>*/}
46
47 {/*<Form.Group className="mb-3" controlId="tableTimeReservation">*/}
48 {/* <Form.Label>Времетраење на резервација</Form.Label>*/}
49 {/* <Form.Control */}
50 {/* type="time"*/}
51 {/* value={formData.endTime}*/}
52 {/* onChange={onFormChange} */}
53 {/* placeholder="Внесете го времетраењето на резервацијата" />*/}
54 {/*</Form.Group>*/}
55
56 <Form.Group className="my-1 justify-content-center">
57 <Button
58 type="submit"
59 style={{ backgroundColor: "#159895" }}
60 size="md"
61 onClick={(e) => {
62 e.preventDefault();
63 console.log(formData);
64 createTable(props.restaurantId, formData, props.refresh);
65 }}
66 >
67 <span className="ikona my-1">
68 <GiConfirmed />
69 </span>
70 <span className="ikona mx-3">Поднеси апликација</span>
71 </Button>
72 </Form.Group>
73 </Form>
74 </Container>
75 </>)
76}
77
78export default AddTableForm;
Note: See TracBrowser for help on using the repository browser.