Last change
on this file since efaa053 was 07f4e8b, checked in by darsov2 <62809499+darsov2@…>, 10 months ago |
prefinal fixes
|
-
Property mode
set to
100644
|
File size:
2.1 KB
|
Line | |
---|
1 | import React, {useState} from "react";
|
---|
2 | import Room from "./Room";
|
---|
3 | import Form from "react-bootstrap/Form";
|
---|
4 | import {Button} from "react-bootstrap";
|
---|
5 | import useCreate from "../Hooks/useCreate";
|
---|
6 | const RoomRow = (props) => {
|
---|
7 | const {createEntity} = useCreate()
|
---|
8 | const [getData, setData] = useState(0);
|
---|
9 | const room = props.room
|
---|
10 | console.log("dasdaskjdhaskdjashdkajk")
|
---|
11 | console.log(props.data)
|
---|
12 | console.log(Array(props.data.find(x => x.hotelRoom.hotelRoomId === room.hotelRoomId)))
|
---|
13 | return (
|
---|
14 | <>
|
---|
15 | <tr>
|
---|
16 | <td>
|
---|
17 | <Room data={room}></Room>
|
---|
18 | </td>
|
---|
19 | <td>{room.price}$</td>
|
---|
20 | <td>
|
---|
21 | <Form.Select aria-label="Default select example" name={'numberOfBeds'}
|
---|
22 | onChange={(e) => {
|
---|
23 | setData(e.target.value);
|
---|
24 | }}>
|
---|
25 | <option></option>
|
---|
26 | {[...Array(props.data.filter(x => x.hotelRoom.hotelRoomId === room.hotelRoomId).reduce((sum, x) => x.numberOfBeds)).keys()].map(x => {
|
---|
27 | return (
|
---|
28 | <option value={x+1} >{x + 1}</option>
|
---|
29 | )
|
---|
30 | })}
|
---|
31 | </Form.Select>
|
---|
32 | </td>
|
---|
33 | <td>
|
---|
34 | <Button
|
---|
35 | onClick={() => {
|
---|
36 | createEntity('hotel/reserve', {
|
---|
37 | hotelRoomId: room.hotelRoomId,
|
---|
38 | userId: 1,
|
---|
39 | hotelRoomAvailableId: props.availableId,
|
---|
40 | from: props.from,
|
---|
41 | to: props.to,
|
---|
42 | numberOfBeds: getData
|
---|
43 | })
|
---|
44 | }}
|
---|
45 | className="m-2"
|
---|
46 | size="md"
|
---|
47 | style={{backgroundColor: "#159895"}}
|
---|
48 | >
|
---|
49 | Резервирај
|
---|
50 | </Button>
|
---|
51 | </td>
|
---|
52 | </tr>
|
---|
53 | </>
|
---|
54 | )
|
---|
55 | }
|
---|
56 |
|
---|
57 | export default RoomRow |
---|
Note:
See
TracBrowser
for help on using the repository browser.