|
@@ -64,33 +64,34 @@ class GrantSelector extends React.Component {
|
|
|
changeGrantHandler() {
|
|
changeGrantHandler() {
|
|
|
const pageGrant = +this.grantSelectorInputEl.value;
|
|
const pageGrant = +this.grantSelectorInputEl.value;
|
|
|
|
|
|
|
|
- // show modal
|
|
|
|
|
|
|
+ // select group
|
|
|
if (pageGrant === 5) {
|
|
if (pageGrant === 5) {
|
|
|
this.showSelectGroupModal();
|
|
this.showSelectGroupModal();
|
|
|
|
|
+ /*
|
|
|
|
|
+ * reset grant selector to state
|
|
|
|
|
+ */
|
|
|
|
|
+ this.grantSelectorInputEl.value = this.state.pageGrant;
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
- // reset pageGrantGroup
|
|
|
|
|
- else {
|
|
|
|
|
- this.setState({ pageGrantGroup: null });
|
|
|
|
|
- this.dispatchOnDeterminePageGrantGroup('');
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- this.setState({ pageGrant });
|
|
|
|
|
|
|
|
|
|
|
|
+ this.setState({ pageGrant, pageGrantGroup: null });
|
|
|
// dispatch event
|
|
// dispatch event
|
|
|
- this.dispatchOnChange(pageGrant);
|
|
|
|
|
|
|
+ this.dispatchOnChangePageGrant(pageGrant);
|
|
|
|
|
+ this.dispatchOnDeterminePageGrantGroup(null);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
groupListItemClickHandler(pageGrantGroup) {
|
|
groupListItemClickHandler(pageGrantGroup) {
|
|
|
- this.setState({ pageGrantGroup });
|
|
|
|
|
|
|
+ this.setState({ pageGrant: 5, pageGrantGroup });
|
|
|
|
|
|
|
|
// dispatch event
|
|
// dispatch event
|
|
|
|
|
+ this.dispatchOnChangePageGrant(5);
|
|
|
this.dispatchOnDeterminePageGrantGroup(pageGrantGroup._id);
|
|
this.dispatchOnDeterminePageGrantGroup(pageGrantGroup._id);
|
|
|
|
|
|
|
|
// hide modal
|
|
// hide modal
|
|
|
this.hideSelectGroupModal();
|
|
this.hideSelectGroupModal();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- dispatchOnChange(pageGrant) {
|
|
|
|
|
|
|
+ dispatchOnChangePageGrant(pageGrant) {
|
|
|
if (this.props.onChangePageGrant != null) {
|
|
if (this.props.onChangePageGrant != null) {
|
|
|
this.props.onChangePageGrant(pageGrant);
|
|
this.props.onChangePageGrant(pageGrant);
|
|
|
}
|
|
}
|
|
@@ -114,11 +115,14 @@ class GrantSelector extends React.Component {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
let defaultValue = this.state.pageGrant;
|
|
let defaultValue = this.state.pageGrant;
|
|
|
-
|
|
|
|
|
// add specified group option
|
|
// add specified group option
|
|
|
const pageGrantGroup = this.state.pageGrantGroup;
|
|
const pageGrantGroup = this.state.pageGrantGroup;
|
|
|
if (pageGrantGroup != null) {
|
|
if (pageGrantGroup != null) {
|
|
|
defaultValue = SPECIFIED_GROUP_VALUE;
|
|
defaultValue = SPECIFIED_GROUP_VALUE;
|
|
|
|
|
+ /*
|
|
|
|
|
+ * set SPECIFIED_GROUP_VALUE to grant selector
|
|
|
|
|
+ * cz: bootstrap-select input element has the defferent state to React component
|
|
|
|
|
+ */
|
|
|
this.grantSelectorInputEl.value = SPECIFIED_GROUP_VALUE;
|
|
this.grantSelectorInputEl.value = SPECIFIED_GROUP_VALUE;
|
|
|
}
|
|
}
|
|
|
grantElems.push(
|
|
grantElems.push(
|