Fixed device name input
This commit is contained in:
parent
557d18dfc1
commit
5d3a6fe99e
1 changed files with 6 additions and 5 deletions
|
@ -9,8 +9,8 @@ export default class ModalWindow extends Component {
|
||||||
this.state = {
|
this.state = {
|
||||||
id : "",
|
id : "",
|
||||||
selectedIcon: "",
|
selectedIcon: "",
|
||||||
name: "",
|
name: this.props.type === 'new' ? '' : this.props.idRoom.name,
|
||||||
img: "",
|
img: this.props.type === 'new' ? '' : this.props.idRoom.images,
|
||||||
openModal: false
|
openModal: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ export default class ModalWindow extends Component {
|
||||||
modifyRoomModal = (e) => {
|
modifyRoomModal = (e) => {
|
||||||
let data = {
|
let data = {
|
||||||
"icon" : this.state.selectedIcon === "" ? this.props.idRoom.icon : this.state.selectedIcon ,
|
"icon" : this.state.selectedIcon === "" ? this.props.idRoom.icon : this.state.selectedIcon ,
|
||||||
"name" : this.state.name === ""? this.props.idRoom.name : this.state.name,
|
"name" : this.state.name === "" ? this.props.idRoom.name : this.state.name,
|
||||||
"image" : this.state.img
|
"image" : this.state.img
|
||||||
}
|
}
|
||||||
this.props.updateRoom(data);
|
this.props.updateRoom(data);
|
||||||
|
@ -48,6 +48,7 @@ export default class ModalWindow extends Component {
|
||||||
let nam = event.target.name;
|
let nam = event.target.name;
|
||||||
let val = event.target.value;
|
let val = event.target.value;
|
||||||
this.setState({[nam]: val});
|
this.setState({[nam]: val});
|
||||||
|
console.log(this.state);
|
||||||
}
|
}
|
||||||
|
|
||||||
closeModal = (e) => {
|
closeModal = (e) => {
|
||||||
|
@ -108,12 +109,12 @@ export default class ModalWindow extends Component {
|
||||||
<p>Insert the name of the room:</p>
|
<p>Insert the name of the room:</p>
|
||||||
<Form.Field>
|
<Form.Field>
|
||||||
<Input label='Room name' placeholder='Room Name' name="name" type='text' onChange={this.changeSomething}
|
<Input label='Room name' placeholder='Room Name' name="name" type='text' onChange={this.changeSomething}
|
||||||
value={this.props.type === "new" ? "" : this.props.idRoom.name }/>
|
value={this.state.name}/>
|
||||||
</Form.Field>
|
</Form.Field>
|
||||||
<p>Insert an image of the room:</p>
|
<p>Insert an image of the room:</p>
|
||||||
<Form.Field>
|
<Form.Field>
|
||||||
<Input label='Room image' type='file' name="img" onChange={this.changeSomething}
|
<Input label='Room image' type='file' name="img" onChange={this.changeSomething}
|
||||||
value={this.props.type === "new" ? "" : this.props.idRoom.images }/>
|
value={this.state.img}/>
|
||||||
</Form.Field>
|
</Form.Field>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue