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