import React from 'react' import { Link } from 'react-router-dom' import moment from 'moment' class Matches extends React.Component { constructor() { super() this.handleChange = this.handleChange.bind(this) } componentDidMount () { console.log('Matches did mount', this) const { matchesGetMatchesRequest } = this.props.matchesActions matchesGetMatchesRequest() } handleChange (event) { event.preventDefault() const { matchesSetFilter } = this.props.matchesActions const nextFilter = { category: this.category.value, date: this.date.value, time: this.time.value, place: this.place.value, player: this.player.value, result: this.result.value } matchesSetFilter(nextFilter) } render () { const state = this.props.matches const actions = this.props.matchesActions const { setRecipients } = this.props.smsActions const { matches, filteredMatches, filter } = state const participatingPlayers = [] filteredMatches.forEach(match => { if (match.player1) participatingPlayers.push(match.player1) if (match.player2) participatingPlayers.push(match.player2) }) return (

{filteredMatches.length}/{matches.length} Spiele, {participatingPlayers.length} Spieler > setRecipients(participatingPlayers)}>SMS

{filteredMatches.map((match, key) => )}
KategorieDatumZeitOrtSpieler 1Spieler 2Resultat
{this.category = input}} id="category" value={filter.category} placeholder="Kategorie" onChange={this.handleChange}> {this.date = input}} id="date" value={filter.date} placeholder="Datum" onChange={this.handleChange}> {this.time = input}} id="time" value={filter.time} placeholder="Zeit" onChange={this.handleChange}> {this.place = input}} id="place" value={filter.place} placeholder="Ort" onChange={this.handleChange}> {this.player = input}} id="player" value={filter.player} placeholder="Spieler" onChange={this.handleChange}> {this.result = input}} id="result" value={filter.result} placeholder="Resultat" onChange={this.handleChange}>
{match.category} {moment(match.date).format('DD.MM.YYYY')} {moment(match.date).format('HH:mm')} {match.place} {match.player1 ? match.player1.fullName : ''} {match.player2 ? match.player2.fullName : ''} {match.result}
) } } export default Matches