|
@@ -1,9 +1,29 @@
|
|
|
import components from './components'
|
|
|
|
|
|
-function normalize (item, type) {
|
|
|
+function normalize (item) {
|
|
|
return item ? String(item).replace(/\s+/g, ' ').trim() : null
|
|
|
}
|
|
|
|
|
|
+function normalizePhone (item) {
|
|
|
+ let phone = String(item).replace(/\s|\+|\(|\)|\/|,|-|'/g, '').replace(/^0+/, '')
|
|
|
+ if (phone.match(/[^\d*]/)) {
|
|
|
+ return `FEHLER: ${phone}`
|
|
|
+ }
|
|
|
+ if (phone.length === 9) {
|
|
|
+ // Missing 0
|
|
|
+ phone = `0${phone}`
|
|
|
+ }
|
|
|
+
|
|
|
+ const len = phone.length
|
|
|
+ if (phone[len - 10] === '0') {
|
|
|
+ return `${phone.substring(len - 10, len - 7)} ${phone.substring(len - 7, len - 4)} ${phone.substring(len - 4, len - 2)} ${phone.substring(len - 2, len)}`
|
|
|
+ }
|
|
|
+ if (len > 10) {
|
|
|
+ return `FEHLER: ${phone} ${phone.substring(0, len - 7)}`
|
|
|
+ }
|
|
|
+ return `${phone}`
|
|
|
+}
|
|
|
+
|
|
|
const state = {
|
|
|
players: [],
|
|
|
filtered: [],
|
|
@@ -27,6 +47,9 @@ class Player {
|
|
|
this.Name = normalize(data[5])
|
|
|
this.Vorname = normalize(data[6])
|
|
|
this.Geburtsdatum = data[7]
|
|
|
+ this.TelP = normalizePhone(data[13])
|
|
|
+ this.TelG = normalizePhone(data[14])
|
|
|
+ this.Mobile = normalizePhone(data[15])
|
|
|
this.Klassierung = normalize(data[17])
|
|
|
this.LizenzDP = normalize(data[23])
|
|
|
this.NameDP = normalize(data[24])
|