Skip to content

Instantly share code, notes, and snippets.

@rafael-metractive
Created August 6, 2019 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafael-metractive/bca67982528a0fa60c21c759e6a29a47 to your computer and use it in GitHub Desktop.
Save rafael-metractive/bca67982528a0fa60c21c759e6a29a47 to your computer and use it in GitHub Desktop.
reservation-actions
_renderTopBarActions() {
if(!this.props.dashboardReservation.status || this.props.dashboardReservation.status == 4)
return null
if(this.props.dashboardReservation.status == 1)
return (
<React.Fragment>
<button
className='btn btn-outline-primary'
onClick={() => this.props.cancelReservation(this.props.match.params.id)}
>
Cancelar reserva
</button>
{
moment()
.isBetween(
moment(this.props.dashboardReservation.date_withdrawal).subtract(10, 'minutes'),
moment(this.props.dashboardReservation.date_devolution)
) && (
<button
className='btn btn-success'
style={{ marginLeft: 8 }}
onClick={() => this.props.initiateReservation(this.props.match.params.id)}
>
Iniciar viagem
</button>
)
}
</React.Fragment>
)
if(this.props.dashboardReservation.status == 2)
return (
<button
className='btn btn-outline-primary'
onClick={() => this.props.finishReservation(this.props.match.params.id)}
>
Encerrar viagem
</button>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment