1 | import React from "react";
|
---|
2 | import { Form, Button, Container } from "react-bootstrap";
|
---|
3 | import { GiConfirmed } from "react-icons/gi";
|
---|
4 | import useFormData from "../Hooks/useFormData";
|
---|
5 | import useCreateTableAvailability from "../Hooks/Restaurant/useCreateTableAvailability";
|
---|
6 |
|
---|
7 | const AddTableAvailablityForm = (props) => {
|
---|
8 | const { createTableAvailability } = useCreateTableAvailability();
|
---|
9 | console.log(props.hotelRoomId);
|
---|
10 | const { formData, onFormChange, onCheckBoxChange, setFormData } = useFormData(
|
---|
11 | {
|
---|
12 | numTables: "",
|
---|
13 | hourFrom: new Date().getTime(),
|
---|
14 | hourTo: new Date().getTime(),
|
---|
15 | restaurantTable: props.table,
|
---|
16 | }
|
---|
17 | );
|
---|
18 |
|
---|
19 | return (
|
---|
20 | <>
|
---|
21 | <Container
|
---|
22 | className="rounded-5 m-5 my-auto mx-auto py-2 px-5"
|
---|
23 | style={{ backgroundColor: "#ffffff" }}
|
---|
24 | >
|
---|
25 | <Form>
|
---|
26 | <Form.Group className="mb-3" controlId="roomAvailabilityFrom">
|
---|
27 | <Form.Label>Време од</Form.Label>
|
---|
28 | <Form.Control
|
---|
29 | type="datetime-local"
|
---|
30 | placeholder="Внесете го времето на доаѓање"
|
---|
31 | value={formData.hourFrom}
|
---|
32 | onChange={onFormChange}
|
---|
33 | name="hourFrom"
|
---|
34 | />
|
---|
35 | </Form.Group>
|
---|
36 |
|
---|
37 | <Form.Group className="mb-3" controlId="roomAvailabilityTo">
|
---|
38 | <Form.Label>Време до</Form.Label>
|
---|
39 | <Form.Control
|
---|
40 | type="datetime-local"
|
---|
41 | placeholder="Внесете го времето на напуштање"
|
---|
42 | value={formData.hourTo}
|
---|
43 | onChange={onFormChange}
|
---|
44 | name="hourTo"
|
---|
45 | />
|
---|
46 | </Form.Group>
|
---|
47 |
|
---|
48 | <Form.Group className="mb-3" controlId="roomAvailabilityNumRooms">
|
---|
49 | <Form.Label>Број на маси</Form.Label>
|
---|
50 | <Form.Control type="num" placeholder="Внесете го бројот на особи"
|
---|
51 | value={formData.numTables}
|
---|
52 | onChange={onFormChange}
|
---|
53 | name="numTables"
|
---|
54 | />
|
---|
55 | </Form.Group>
|
---|
56 |
|
---|
57 | <Form.Group className="my-1 justify-content-center">
|
---|
58 | <Button
|
---|
59 | type="button"
|
---|
60 | style={{ backgroundColor: "#159895" }}
|
---|
61 | size="md"
|
---|
62 | onClick={() => {
|
---|
63 | createTableAvailability(formData, props.table.tableId)
|
---|
64 | props.refresh(Math.random())
|
---|
65 | props.close()
|
---|
66 | }}
|
---|
67 | >
|
---|
68 | <span className="ikona my-1">
|
---|
69 | <GiConfirmed />
|
---|
70 | </span>
|
---|
71 | <span className="ikona mx-3">Поднеси апликација</span>
|
---|
72 | </Button>
|
---|
73 | </Form.Group>
|
---|
74 | </Form>
|
---|
75 | </Container>
|
---|
76 | </>
|
---|
77 | );
|
---|
78 | };
|
---|
79 | export default AddTableAvailablityForm;
|
---|