|
@@ -2,6 +2,7 @@ import React from 'react'
|
|
|
import XLSX from 'xlsx'
|
|
|
import PlayerList from './player/player-list'
|
|
|
import MatchList from './match/match-list'
|
|
|
+import Player from './player/player.js'
|
|
|
|
|
|
class App extends React.Component {
|
|
|
constructor () {
|
|
@@ -11,6 +12,7 @@ class App extends React.Component {
|
|
|
}
|
|
|
|
|
|
handleChange (event) {
|
|
|
+ console.log(event.target)
|
|
|
const f = event.target.files[0]
|
|
|
console.log(f)
|
|
|
const reader = new FileReader()
|
|
@@ -19,7 +21,13 @@ class App extends React.Component {
|
|
|
const workbook = XLSX.read(data, {type: 'binary'})
|
|
|
const jsonWB = XLSX.utils.sheet_to_json(workbook.Sheets.Players, {header: 1})
|
|
|
console.log(jsonWB)
|
|
|
- this.setState({ players: jsonWB.slice(4, jsonWB.length) })
|
|
|
+ if (jsonWB[3][0] != 'Konkurrenz' & jsonWB[3][11] != 'bezahlt') {
|
|
|
+ throw Error('Wrong file.')
|
|
|
+ }
|
|
|
+ const players = jsonWB.slice(4, jsonWB.length) // .map((playerData) => Player(playerData))
|
|
|
+ console.log(players)
|
|
|
+ this.setState({ players })
|
|
|
+ console.log('state')
|
|
|
console.log(this.state)
|
|
|
}
|
|
|
reader.readAsBinaryString(f)
|
|
@@ -37,7 +45,7 @@ class App extends React.Component {
|
|
|
<input type='date' />
|
|
|
<button>Excel-Files generieren.</button>
|
|
|
</form>
|
|
|
- <PlayerList players={this.state.players} />
|
|
|
+ {/* <PlayerList players={this.state.players} /> */}
|
|
|
<MatchList matches={this.state.matches} />
|
|
|
</div>
|
|
|
)
|