-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathSelectableRange.js
More file actions
97 lines (80 loc) · 2.54 KB
/
SelectableRange.js
File metadata and controls
97 lines (80 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
var React = require('react');
var Modal = require('./Modal');
module.exports = React.createClass({
getDefaultProps: function () {
return {
from: "from",
to: "to"
};
}
,
getInitialState: function () {
return {
from: this.props.from,
to: this.props.to,
value: (this.props.from + " - " + this.props.to)
};
}
,
onFromChange: function (e) {
this.setState({from: e.target.value});
}
,
onToChange: function (e) {
this.setState({to: e.target.value});
}
,
onClear: function (e) {
this.setState({from: "", to: ""});
}
,
okClick: function (e) {
console.log(this.state.from + " - " + this.state.to)
this.setState({
value: (this.state.from + " - " + this.state.to)
});
}
,
onClick: function (e) {
$('.modal').modal('show');
},
onChange: function (e) {
console.log(e.target.value);
this.setState({
value: e.target.value
});
},
render: function () {
var modalBody = (
<div className="row">
<div className="col-md-6">
<div className="form-group">
<label htmlFor="exampleInputEmail1">From</label>
<input type="number" className="form-control" id="exampleInputEmail1" placeholder="From"
value={this.state.from}
onChange={this.onFromChange}/>
</div>
</div>
<div className="col-md-6">
<div className="form-group">
<label htmlFor="exampleInputEmail1">To</label>
<input type="number" className="form-control" id="exampleInputEmail1" placeholder="To"
value={this.state.to}
onChange={this.onToChange}/>
</div>
</div>
</div>
);
return (
<div className="form-group">
<input id="call_range" type="text" className="form-control range" placeholder="Call No. Between"
name="call_range"
value={this.state.value}
onChange={this.onChange}
onClick={this.onClick}/>
<Modal body={modalBody} onClear={this.onClear} okClick={this.okClick}/>
</div>
);
}
})
;