Skip to content

Commit

Permalink
add button to populate daily event to EventDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
jpdillingham committed Dec 13, 2018
1 parent 1db72f1 commit 02b4724
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions web/src/events/EventDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const styles = {
marginTop: 50,
height: 'fit-content',
},
deleteButton: {
leftButton: {
marginRight: 'auto',
},
spinner: {
Expand Down Expand Up @@ -117,6 +117,20 @@ class EventDialog extends Component {
this.setState({ confirmDialog: { open: true }});
}

handleDailyEventClick = () => {
let start = moment().startOf('day').add(8, 'hours');
let end = moment().startOf('day').add(8, 'hours').add(7, 'hours');

this.setState({
event: {
name: 'Daily Event for ' + start.format('M/DD/YY'),
startDate: start.format(),
endDate: end.format(),
},
validation: { ...initialState.validation },
});
}

handleDeleteConfirmClick = () => {
return this.execute(
() => this.props.context.api.delete('/v1/events/' + this.state.event.id),
Expand Down Expand Up @@ -264,13 +278,23 @@ class EventDialog extends Component {
<Button
onClick={this.handleDeleteClick}
color="primary"
className={classes.deleteButton}
className={classes.leftButton}
disabled={executing}
>
{deleting && <CircularProgress size={20} style={styles.spinner}/>}
Delete
</Button>
}
{intent === 'add' &&
<Button
onClick={this.handleDailyEventClick}
color="primary"
className={classes.leftButton}
disabled={executing}
>
Daily Event
</Button>
}
<Button
onClick={this.handleCancelClick}
color="primary"
Expand Down

0 comments on commit 02b4724

Please sign in to comment.