1 | import React from "react";
|
---|
2 | import { Form, Button, Container } from "react-bootstrap";
|
---|
3 | import { GiConfirmed } from "react-icons/gi";
|
---|
4 | import useCreateRoomAvailiability from "../Hooks/Hotel/useCreateRoomAvailability";
|
---|
5 | import useFormData from "../Hooks/useFormData";
|
---|
6 |
|
---|
7 | const AddRoomAvailablityForm = (props) => {
|
---|
8 |
|
---|
9 | const { createRoomAvailability } = useCreateRoomAvailiability(props.hotelRoomId);
|
---|
10 | console.log(props.hotelRoomId)
|
---|
11 | const { formData, onFormChange, onCheckBoxChange, setFormData } = useFormData(
|
---|
12 | {
|
---|
13 | dateFrom: Date.now(),
|
---|
14 | dateTo: Date.now(),
|
---|
15 | numberOfBeds: 0,
|
---|
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="date"
|
---|
30 | placeholder="Внесете го датумот на сместување"
|
---|
31 | value={formData.dateFrom}
|
---|
32 | onChange={onFormChange}
|
---|
33 | name="dateFrom"
|
---|
34 | />
|
---|
35 | </Form.Group>
|
---|
36 |
|
---|
37 | <Form.Group className="mb-3" controlId="roomAvailabilityTo">
|
---|
38 | <Form.Label>Датум до</Form.Label>
|
---|
39 | <Form.Control
|
---|
40 | type="date"
|
---|
41 | placeholder="Внесете го датумот на напуштање"
|
---|
42 | name="dateTo"
|
---|
43 | value={formData.dateTo}
|
---|
44 | onChange={onFormChange}
|
---|
45 | />
|
---|
46 | </Form.Group>
|
---|
47 |
|
---|
48 | <Form.Group className="mb-3" controlId="roomAvailabilityNumRooms">
|
---|
49 | <Form.Label>Број на соби</Form.Label>
|
---|
50 | <Form.Control
|
---|
51 | type="num"
|
---|
52 | placeholder="Внесете го бројот на соби"
|
---|
53 | value={formData.numberOfBeds}
|
---|
54 | onChange={onFormChange}
|
---|
55 | name="numberOfBeds"
|
---|
56 | />
|
---|
57 | </Form.Group>
|
---|
58 |
|
---|
59 | <Form.Group className="my-1 justify-content-center">
|
---|
60 | <Button
|
---|
61 | type="button"
|
---|
62 | style={{ backgroundColor: "#159895" }}
|
---|
63 | size="md"
|
---|
64 | onClick={() => {
|
---|
65 | createRoomAvailability(formData, props.hotelRoomId)
|
---|
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 AddRoomAvailablityForm;
|
---|