This commit is contained in:
omenem 2020-05-07 09:29:22 +02:00
parent b61148b24a
commit 74d5be7967

View file

@ -8,6 +8,7 @@ import {
Icon,
Responsive,
Image,
Confirm,
} from "semantic-ui-react";
import SelectIcons from "./SelectIcons";
import { connect } from "react-redux";
@ -34,6 +35,7 @@ class RoomModal extends Component {
name: this.type === "new" ? "New Room" : this.props.room.name,
img: this.type === "new" ? null : this.props.room.image,
openModal: false,
sure: false,
};
}
@ -91,6 +93,14 @@ class RoomModal extends Component {
.catch((err) => console.error("error in deleting room", err));
};
setSureTrue = () => {
this.setState({sure: true})
}
setSureFalse= () => {
this.setState({sure: false})
}
changeSomething = (event) => {
let nam = event.target.name;
let val = event.target.value;
@ -220,16 +230,22 @@ class RoomModal extends Component {
</div>
{this.type === "modify" ? (
<div>
<Button
icon
labelPosition="left"
inverted
color="red"
onClick={this.deleteRoom}
onClick={this.setSureTrue}
>
<Icon name="trash alternate" />
Delete room
</Button>
Delete Room </Button>
<Confirm
open={this.state.sure}
onCancel={this.setSureFalse}
onConfirm={this.deleteRoom}/>
</div>
) : null}
</Modal.Content>
<Modal.Actions>