Added subscriptions cancel

This commit is contained in:
vjrj 2018-03-02 12:53:03 +01:00
parent f17fd13c2a
commit 38b4769806
3 changed files with 10 additions and 5 deletions

View file

@ -244,7 +244,7 @@ class SelectionMap extends Component {
bsStyle="warning"
onClick={event => this.onSndBtn(event)}
>
{this.props.sndBtn}
{this.props.sndBtn.match(/^fa-/) ? <i className={`fa ${this.props.sndBtn}`} /> : this.props.sndBtn }
</Button>
}
<Button

View file

@ -68,6 +68,7 @@ class SubscriptionEditor extends React.Component {
zoom={this.state.zoom}
distance={doc.distance}
focusInput={focus}
history={this.props.history}
disableFstBtn={this.state.disableFstBtn}
subsBtn={isEdit ? t('Actualizar') : t(isAnyMobile ? 'Suscribirme a este radio' : 'Suscribirme a fuegos en este radio')}
onSubs={state => this.onSubs(state)}

View file

@ -20,10 +20,7 @@ class FireSubscription extends React.Component {
zoom: this.props.zoom,
distance: this.props.distance
};
/* if (props.location) {
console.log(props.location.state);
}
console.log(this.state); */
this.onCancel = this.onCancel.bind(this);
}
componentDidMount() {
@ -62,6 +59,10 @@ class FireSubscription extends React.Component {
this.props.onSubs(value);
}
onCancel() {
this.props.history.push('/subscriptions');
}
centerOnUserLocation(value) {
this.setState({ center: value.center });
}
@ -103,6 +104,8 @@ class FireSubscription extends React.Component {
distance={this.state.distance}
fstBtn={this.props.subsBtn}
onFstBtn={state => this.onSubs(state)}
sndBtn="fa-times"
onSndBtn={this.onCancel}
onSelection={state => this.onSelection(state)}
action={action.add}
disableFstBtn={this.props.disableFstBtn}
@ -119,6 +122,7 @@ FireSubscription.propTypes = {
focusInput: PropTypes.bool.isRequired,
subsBtn: PropTypes.string.isRequired,
onSubs: PropTypes.func.isRequired,
history: PropTypes.object.isRequired,
disableFstBtn: PropTypes.bool.isRequired
};