commit
c1ecfecbac
3
app.py
3
app.py
@ -3,13 +3,10 @@ import random
|
||||
import string
|
||||
from flask import Flask
|
||||
from flask_bootstrap import Bootstrap
|
||||
from flask_login import LoginManager, UserMixin, login_user, login_required, logout_user, current_user, user_loader
|
||||
|
||||
app = Flask(__name__)
|
||||
app.secret_key = "4pFwRNNXs+xQSOEaHrq4iSBwl+mq1UTdRuxqhM+RQpo="
|
||||
Bootstrap(app)
|
||||
login_manager = LoginManager()
|
||||
login_manager.init_app(app)
|
||||
|
||||
def randomUrlSuffix(stringLength=6):
|
||||
lettersAndDigits = string.ascii_letters + string.digits
|
||||
|
||||
35
app.yaml
Normal file
35
app.yaml
Normal file
@ -0,0 +1,35 @@
|
||||
runtime: python27
|
||||
api_version: 1
|
||||
threadsafe: true
|
||||
|
||||
handlers:
|
||||
- url: /static
|
||||
static_dir: static
|
||||
- url: /.*
|
||||
script: main.app
|
||||
secure: always
|
||||
|
||||
|
||||
libraries:
|
||||
- name: ssl
|
||||
version: "latest"
|
||||
- name: MySQLdb
|
||||
version: "1.2.5"
|
||||
- name: flask
|
||||
version: latest
|
||||
|
||||
|
||||
env_variables:
|
||||
CLOUDSQL_CONNECTION_NAME: hk-hockey:asia-east2:hk-hockey-sql
|
||||
CLOUDSQL_USER: root
|
||||
CLOUDSQL_WRITE_USER: hockeyWrite
|
||||
CLOUDSQL_READ_USER: hockeyRead
|
||||
CLOUDSQL_PASSWORD: P8P1YopMlwg8TxhE
|
||||
CLOUDSQL_WRITE_PASSWORD: 1URYcxXXlQ6xOWgj
|
||||
CLOUDSQL_READ_PASSWORD: o4GWrbbkBKy3oR6u
|
||||
CLOUDSQL_DATABASE: 2020_hockeyResults
|
||||
CLOUDSQL_DATABASE_STATIC: hockeyResults
|
||||
CLOUDSQL_CHARSET: utf8
|
||||
BASIC_AUTH_USERNAME: admin
|
||||
BASIC_AUTH_PASSWORD: hATnNYriYN5ZrHvXcaImtXJ8SGMonNym
|
||||
|
||||
@ -12,7 +12,8 @@ CLOUDSQL_READ_USER = "hockeyRead"
|
||||
CLOUDSQL_PASSWORD = "P8P1YopMlwg8TxhE"
|
||||
CLOUDSQL_WRITE_PASSWORD = "1URYcxXXlQ6xOWgj"
|
||||
CLOUDSQL_READ_PASSWORD = "o4GWrbbkBKy3oR6u"
|
||||
CLOUDSQL_DATABASE = "2019_hockeyResults"
|
||||
CLOUDSQL_DATABASE = "20209_hockeyResults"
|
||||
LOCAL_DATABASE = "hockeyResults2020"
|
||||
CLOUDSQL_DATABASE_STATIC = "hockeyResults"
|
||||
CLOUDSQL_CHARSET = "utf8"
|
||||
|
||||
@ -36,7 +37,7 @@ def write_cloudsql():
|
||||
#
|
||||
else:
|
||||
# db = MySQLdb.connect(host='db.ipa.champion', user=CLOUDSQL_WRITE_USER, passwd=CLOUDSQL_WRITE_PASSWORD, db=CLOUDSQL_DATABASE, charset=CLOUDSQL_CHARSET)
|
||||
db = pymysql.connect(host='db.ipa.champion', user=CLOUDSQL_WRITE_USER, passwd=CLOUDSQL_WRITE_PASSWORD, db=CLOUDSQL_DATABASE, charset=CLOUDSQL_CHARSET)
|
||||
db = pymysql.connect(host='db.ipa.champion', user=CLOUDSQL_WRITE_USER, passwd=CLOUDSQL_WRITE_PASSWORD, db=LOCAL_DATABASE, charset=CLOUDSQL_CHARSET)
|
||||
return db
|
||||
|
||||
def write_cloudsql_static():
|
||||
@ -80,7 +81,7 @@ def read_cloudsql():
|
||||
#
|
||||
else:
|
||||
# db = MySQLdb.connect(host='db.ipa.champion', user=CLOUDSQL_READ_USER, passwd=CLOUDSQL_READ_PASSWORD, db=CLOUDSQL_DATABASE, charset=CLOUDSQL_CHARSET)
|
||||
db = pymysql.connect(host='db.ipa.champion', user=CLOUDSQL_READ_USER, passwd=CLOUDSQL_READ_PASSWORD, db=CLOUDSQL_DATABASE, charset=CLOUDSQL_CHARSET)
|
||||
db = pymysql.connect(host='db.ipa.champion', user=CLOUDSQL_READ_USER, passwd=CLOUDSQL_READ_PASSWORD, db=LOCAL_DATABASE, charset=CLOUDSQL_CHARSET)
|
||||
return db
|
||||
|
||||
def read_cloudsql_static():
|
||||
|
||||
8
forms.py
8
forms.py
@ -54,7 +54,7 @@ class playerDbCreateForm(FlaskForm):
|
||||
|
||||
class searchForm(FlaskForm):
|
||||
seasonStart = datetime.strptime('2018-09-01', '%Y-%m-%d')
|
||||
season = SelectField('Season data to search', choices=[('2019', '2019/20'), ('2018', '2018/19'), ('2017', '2017/18'), ('2016', '2016/17'), ('2015', '2015/16'), ('2014', '2014/15'), ('2013', '2013/14')])
|
||||
season = SelectField('Season data to search', choices=[('2020', '2020/21'), ('2019', '2019/20'), ('2018', '2018/19'), ('2017', '2017/18'), ('2016', '2016/17'), ('2015', '2015/16'), ('2014', '2014/15'), ('2013', '2013/14')])
|
||||
clubName = SelectField("Club to search", choices=[], coerce=str)
|
||||
teamName = SelectField("Select a Team", choices=[])
|
||||
startDate = DateField('DatePicker', format='%Y-%m-%d', default=seasonStart)
|
||||
@ -62,19 +62,19 @@ class searchForm(FlaskForm):
|
||||
submitButton = SubmitField("Submit")
|
||||
|
||||
class playerRecordsForm(FlaskForm):
|
||||
season = SelectField('Season data to search', choices=[('2019', '2019/20'), ('2018', '2018/19'), ('2017', '2017/18'), ('2016', '2016/17'), ('2015', '2015/16'), ('2014', '2014/15'), ('2013', '2013/14')])
|
||||
season = SelectField('Season data to search', choices=[('2020', '2020/21'), ('2019', '2019/20'), ('2018', '2018/19'), ('2017', '2017/18'), ('2016', '2016/17'), ('2015', '2015/16'), ('2014', '2014/15'), ('2013', '2013/14')])
|
||||
clubName = SelectField("Club to search", choices=[], coerce=str)
|
||||
teamName = SelectField("Select a Team", choices=[])
|
||||
submitButton = SubmitField("Submit")
|
||||
|
||||
class teamRecordsForm(FlaskForm):
|
||||
season = SelectField('Season data to search', choices=[('2019', '2019/20'), ('2018', '2018/19'), ('2017', '2017/18'), ('2016', '2016/17'), ('2015', '2015/16'), ('2014', '2014/15'), ('2013', '2013/14')])
|
||||
season = SelectField('Season data to search', choices=[('2020', '2020/21'), ('2019', '2019/20'), ('2018', '2018/19'), ('2017', '2017/18'), ('2016', '2016/17'), ('2015', '2015/16'), ('2014', '2014/15'), ('2013', '2013/14')])
|
||||
clubName = SelectField("Club to search", choices=[], coerce=str)
|
||||
teamName = SelectField("Select a Team", choices=[])
|
||||
submitButton = SubmitField("Submit")
|
||||
|
||||
class clubPlayingRecordsForm(FlaskForm):
|
||||
season = SelectField('Season data to search', choices=[('2019', '2019/20'), ('2018', '2018/19'), ('2017', '2017/18'), ('2016', '2016/17'), ('2015', '2015/16'), ('2014', '2014/15'), ('2013', '2013/14')])
|
||||
season = SelectField('Season data to search', choices=[('2020', '2020/21'), ('2019', '2019/20'), ('2018', '2018/19'), ('2017', '2017/18'), ('2016', '2016/17'), ('2015', '2015/16'), ('2014', '2014/15'), ('2013', '2013/14')])
|
||||
clubName = SelectField("Club to search", choices=[], coerce=str)
|
||||
submitButton = SubmitField("Submit")
|
||||
|
||||
|
||||
30
main.py
30
main.py
@ -10,7 +10,6 @@ from app import app
|
||||
from flask import Flask, flash, render_template, request, redirect, url_for
|
||||
from flask_wtf import FlaskForm
|
||||
from flask_bootstrap import Bootstrap
|
||||
from flask_login import LoginManager, UserMixin, login_user, login_required, logout_user, current_user
|
||||
from wtforms import StringField, PasswordField, BooleanField
|
||||
from wtforms.fields.html5 import DateField
|
||||
from wtforms.validators import InputRequired, Email, Length
|
||||
@ -20,35 +19,6 @@ from routes import *
|
||||
|
||||
app.register_blueprint(routes)
|
||||
|
||||
login_manager = LoginManager()
|
||||
|
||||
class User(UserMixin):
|
||||
# proxy for a database of users
|
||||
user_database = {"JohnDoe": ("JohnDoe", "John"), "JaneDoe": ("JaneDoe", "Jane")}
|
||||
|
||||
def __init__(self, username, password):
|
||||
self.id = username
|
||||
self.password = password
|
||||
|
||||
@classmethod
|
||||
def get(cls,id):
|
||||
return cls.user_database.get(id)
|
||||
|
||||
@login_manager.request_loader
|
||||
def load_user(request):
|
||||
token = request.headers.get('Authorization')
|
||||
if token is None:
|
||||
token = request.args.get('token')
|
||||
|
||||
if token is not None:
|
||||
username,password = token.split(":") # naive token
|
||||
user_entry = User.get(username)
|
||||
if (user_entry is not None):
|
||||
user = User(user_entry[0],user_entry[1])
|
||||
if (user.password == password):
|
||||
return user
|
||||
return None
|
||||
|
||||
|
||||
@app.route('/hkfc-d/vote-chart', methods=['GET', 'POST'])
|
||||
def hkfc_d_vote_chart():
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
Flask
|
||||
Werkzeug
|
||||
email-validator
|
||||
flask_table
|
||||
flask-mysql
|
||||
flask_login
|
||||
|
||||
@ -2,7 +2,6 @@ from flask import Blueprint
|
||||
routes = Blueprint('routes', __name__)
|
||||
|
||||
from .dashboard import *
|
||||
from ._search import *
|
||||
from ._matches import *
|
||||
from ._hkfcD_motm import *
|
||||
from ._convenor import *
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#import MySQLdb
|
||||
import pymysql
|
||||
import os
|
||||
from flask import render_template, request
|
||||
@ -8,11 +7,11 @@ from dbWrite import sql_read, sql_write, sql_read_static, sql_write_static
|
||||
from forms import addPlayerForm, addTeamForm, addClubForm, playerDbCreateForm, squadListForm
|
||||
from tables import clubList, convenorSquadListTable, convenorFixtureList
|
||||
from . import routes
|
||||
|
||||
from logging import error, info
|
||||
import json
|
||||
|
||||
BASIC_AUTH_USERNAME = 'admin'
|
||||
BASIC_AUTH_PASSWORD = 'letmein'
|
||||
BASIC_AUTH_PASSWORD = '7GcGJTRs1DoCCNYCTGK2yeXmTGxtxonQ'
|
||||
|
||||
basic_auth = BasicAuth(app)
|
||||
|
||||
@ -134,9 +133,7 @@ def convenorAddPlayerResult():
|
||||
_playerNumber = request.form['playerNumber']
|
||||
_playerTelNumber = request.form['playerTelNumber']
|
||||
if _team and _playerSurname and _playerHkid and _playerNumber and request.method == 'POST':
|
||||
sql = "INSERT INTO _" + _club + "_players (playerTeam, playerForenames, playerSurname, playerNickname, playerChineseName, playerEmail, playerDob, playerHkid, playerNumber, playerTelNumber) VALUES ('" + _team + "', '" + _playerForename + "', '" + _playerSurname + "', '" + _playerNickname + "', '" + _playerChineseName_enc + "', '" + _playerEmail + "', '" + _playerDob + "', '" + _playerHkid + "', '" + _playerNumber + "', '" + _playerTelNumber + "')"
|
||||
print(_team)
|
||||
print(sql)
|
||||
sql = "INSERT INTO _" + _club + "_players (playerTeam, playerForenames, playerSurname, playerNickname, playerEmail, playerDob, playerHkid, playerNumber, playerTelNumber) VALUES ('" + _team + "', '" + _playerForename + "', '" + _playerSurname + "', '" + _playerNickname + "', '" + _playerEmail + "', '" + _playerDob + "', '" + _playerHkid + "', '" + _playerNumber + "', '" + _playerTelNumber + "')"
|
||||
sql_write(sql)
|
||||
return render_template('_convenorPlayerAddResults.html', club=_club, firstname=_playerForename, nickname=_playerNickname, surname=_surname, shirt=_playerNumber)
|
||||
except Exception as e:
|
||||
@ -206,8 +203,6 @@ def convenorDeletePlayer():
|
||||
@basic_auth.required
|
||||
def convenorEditPlayerResult():
|
||||
try:
|
||||
# _year = request.form['year']
|
||||
_year = "2018"
|
||||
_club = request.form['playerClub']
|
||||
_team = request.form['playerTeam']
|
||||
_playerForename = request.form['playerForenames']
|
||||
@ -222,7 +217,7 @@ def convenorEditPlayerResult():
|
||||
_playerNumber = request.form['playerNumber']
|
||||
_playerTelNumber = request.form['playerTelNumber']
|
||||
if _team and _playerSurname and _playerHkid and _playerNumber and request.method == 'POST':
|
||||
sql = "UPDATE _" + _club + "_players SET playerTeam='" + _team + "', playerForenames='" + _playerForename + "', playerSurname='" + _playerSurname + "', playerNickname='" + _playerNickname + "', playerChineseName='" + _playerChineseName_enc + "', playerEmail='" + _playerEmail + "', playerDob='" + _playerDob + "', playerHkid='" + _playerHkid + "', playerTelNumber='" + _playerTelNumber + "' WHERE playerNumber='" + _playerNumber + "'"
|
||||
sql = "UPDATE _" + _club + "_players SET playerTeam='" + _team + "', playerForenames='" + _playerForename + "', playerSurname='" + _playerSurname + "', playerNickname='" + _playerNickname + "', playerEmail='" + _playerEmail + "', playerTelNumber='" + _playerTelNumber + "' WHERE playerHkid='" + _playerHkid + "'"
|
||||
sql_write(sql)
|
||||
return render_template('_convenorEditPlayerResults.html', club=_club, firstname=_playerForename, nickname=_playerNickname, surname=_playerSurname, shirt=_playerNumber)
|
||||
except Exception as e:
|
||||
|
||||
@ -31,7 +31,7 @@ def hkfcD_motm_vote(randomUrlSuffix):
|
||||
currMotM = nextInfo[0]['currMotM']
|
||||
currDotD = nextInfo[0]['currDotD']
|
||||
oppo = nextTeam
|
||||
sql3 = "SELECT 2019_hockeyResults.hockeyFixtures.date, hockeyResults.hkfcDAdminSettings.nextFixture FROM 2019_hockeyResults.hockeyFixtures INNER JOIN hockeyResults.hkfcDAdminSettings ON 2019_hockeyResults.hockeyFixtures.fixtureNumber = hockeyResults.hkfcDAdminSettings.nextFixture"
|
||||
sql3 = "SELECT hockeyResults2020.hockeyFixtures.date, hockeyResults.hkfcDAdminSettings.nextFixture FROM hockeyResults2020.hockeyFixtures INNER JOIN hockeyResults.hkfcDAdminSettings ON hockeyResults2020.hockeyFixtures.fixtureNumber = hockeyResults.hkfcDAdminSettings.nextFixture"
|
||||
nextMatchDate = sql_read(sql3)
|
||||
nextDate = nextMatchDate[0]['date']
|
||||
formatDate = datetime.strftime(nextDate, '%A, %d %B %Y')
|
||||
@ -60,8 +60,10 @@ def hkfcD_motm_vote(randomUrlSuffix):
|
||||
@routes.route('/hkfc-d/comments', methods=['GET', 'POST'])
|
||||
def hkfcd_match_comments():
|
||||
sql = "SELECT nextClub, nextTeam, nextDate, oppoLogo, hkfcLogo FROM hkfcDAdminSettings"
|
||||
row = sql_read(sql)
|
||||
_oppo = row[0]['nextClub'] + " " + row[0]['nextTeam']
|
||||
row = sql_read_static(sql)
|
||||
# nextTeam already seems to include all the team+club details
|
||||
# _oppo = row[0]['nextClub'] + " " + row[0]['nextTeam']
|
||||
_oppo = row[0]['nextClub']
|
||||
commentDate = row[0]['nextDate'].strftime('%Y-%m-%d')
|
||||
_matchDate = row[0]['nextDate'].strftime('%Y_%m_%d')
|
||||
hkfcLogo = row[0]['hkfcLogo']
|
||||
@ -137,7 +139,7 @@ def hkfcDMotmAdmin():
|
||||
print(urlSuffix)
|
||||
sql3 = "UPDATE hkfcDAdminSettings SET motmUrlSuffix='" + urlSuffix + "' WHERE userid='admin'"
|
||||
sql_write_static(sql3)
|
||||
flash('MotM URL https://hk-hockey.appspot.com/hkfc-d/motm/'+urlSuffix)
|
||||
flash('MotM URL https://hockey.ervine.cloud/hkfc-d/motm/'+urlSuffix)
|
||||
elif form.activateButton.data:
|
||||
sql4 = "ALTER TABLE _hkfc_d_motm ADD COLUMN motm_" + _nextFixture + " smallint DEFAULT 0, ADD COLUMN dotd_" + _nextFixture + " smallint DEFAULT 0, ADD COLUMN assists_" + _nextFixture + " smallint DEFAULT 0, ADD COLUMN goals_" + _nextFixture + " smallint DEFAULT 0 "
|
||||
sql_write(sql4)
|
||||
|
||||
@ -13,8 +13,8 @@ from datetime import date
|
||||
def search():
|
||||
sql = "SELECT hockeyClub FROM mensHockeyClubs ORDER BY hockeyClub"
|
||||
sql2 = "SELECT nextClub, oppoLogo FROM hkfcDAdminSettings"
|
||||
clubs = sql_read(sql)
|
||||
settings = sql_read(sql2)
|
||||
clubs = sql_read_static(sql)
|
||||
settings = sql_read_static(sql2)
|
||||
form = searchForm()
|
||||
form.clubName.choices = [(name['hockeyClub'], name['hockeyClub']) for name in clubs]
|
||||
clubLogo = settings[0]['oppoLogo']
|
||||
@ -42,10 +42,10 @@ def searchTeam():
|
||||
|
||||
@routes.route('/playerRecords')
|
||||
def playerRecords():
|
||||
sql = "SELECT hockeyClub FROM mensHockeyClubs ORDER BY hockeyClub"
|
||||
sql = "SELECT hockeyClub FROM mensHockeyClubs ORDER BY hockeyClub"`
|
||||
sql2 = "SELECT nextClub, oppoLogo FROM hkfcDAdminSettings"
|
||||
clubs = sql_read(sql)
|
||||
settings = sql_read(sql2)
|
||||
clubs = sql_read_static(sql)
|
||||
settings = sql_read_static(sql2)
|
||||
form = playerRecordsForm()
|
||||
form.clubName.choices = [(name['hockeyClub'], name['hockeyClub']) for name in clubs]
|
||||
clubLogo = settings[0]['oppoLogo']
|
||||
@ -60,12 +60,12 @@ def playerRecordSearchResults():
|
||||
_team = request.form['teamName']
|
||||
lookup_table = _club.lower() + _team
|
||||
if _club and _team and request.method == 'POST':
|
||||
sql = "SELECT * FROM _" + lookup_table + " ORDER BY playerNumber"
|
||||
sql2 = "SHOW COLUMNS FROM _" + lookup_table + ""
|
||||
sql3 = "SELECT matchNumber, matchHomeClub, matchHomeTeam, matchAwayClub, matchAwayTeam FROM _mensResults WHERE (matchHomeClub='" + _club + "' AND matchHomeTeam='" + _team + "') OR (matchAwayClub='" + _club + "' AND matchAwayTeam='" + _team + "')"
|
||||
rows = sql_read(sql)
|
||||
columns = sql_read(sql2)
|
||||
matches = sql_read(sql3)
|
||||
sql = "SELECT * FROM _" + _season + "_" + lookup_table + " ORDER BY playerNumber"
|
||||
sql2 = "SHOW COLUMNS FROM _" + _season + "_" + lookup_table + ""
|
||||
sql3 = "SELECT matchNumber, matchHomeClub, matchHomeTeam, matchAwayClub, matchAwayTeam FROM _" + _season + "_mensResults WHERE (matchHomeClub='" + _club + "' AND matchHomeTeam='" + _team + "') OR (matchAwayClub='" + _club + "' AND matchAwayTeam='" + _team + "')"
|
||||
rows = sql_read_static(sql)
|
||||
columns = sql_read_static(sql2)
|
||||
matches = sql_read_static(sql3)
|
||||
for match in matches:
|
||||
matchNumbersList.append(str(match['matchNumber']))
|
||||
if match['matchHomeClub'] == _club:
|
||||
@ -81,8 +81,8 @@ def playerRecordSearchResults():
|
||||
def teamRecords():
|
||||
sql = "SELECT hockeyClub FROM mensHockeyClubs ORDER BY hockeyClub"
|
||||
sql2 = "SELECT nextClub, oppoLogo FROM hkfcDAdminSettings"
|
||||
clubs = sql_read(sql)
|
||||
settings = sql_read(sql2)
|
||||
clubs = sql_read_static(sql)
|
||||
settings = sql_read_static(sql2)
|
||||
form = teamRecordsForm()
|
||||
form.clubName.choices = [(name['hockeyClub'], name['hockeyClub']) for name in clubs]
|
||||
clubLogo = settings[0]['oppoLogo']
|
||||
@ -95,9 +95,9 @@ def teamRecordResults():
|
||||
_team = request.form['teamName']
|
||||
lookup_table = _club.lower() + _team
|
||||
if _club and _team and request.method == 'POST':
|
||||
sql = "SELECT * FROM _record_" + lookup_table + " ORDER BY opposition"
|
||||
sql = "SELECT * FROM _" + _season + "_record_" + lookup_table + " ORDER BY opposition"
|
||||
print(sql)
|
||||
rows = sql_read(sql)
|
||||
rows = sql_read_static(sql)
|
||||
table = teamResults(rows)
|
||||
table.border = True
|
||||
table.classes = ['table-striped', 'table-condensed', 'table-hover']
|
||||
@ -110,8 +110,8 @@ def teamRecordResults():
|
||||
def clubPlayingRecords():
|
||||
sql = "SELECT hockeyClub FROM mensHockeyClubs ORDER BY hockeyClub"
|
||||
sql2 = "SELECT nextClub, oppoLogo FROM hkfcDAdminSettings"
|
||||
clubs = sql_read(sql)
|
||||
settings = sql_read(sql2)
|
||||
clubs = sql_read_static(sql)
|
||||
settings = sql_read_static(sql2)
|
||||
form = clubPlayingRecordsForm()
|
||||
form.clubName.choices = [(name['hockeyClub'], name['hockeyClub']) for name in clubs]
|
||||
clubLogo = settings[0]['oppoLogo']
|
||||
@ -122,10 +122,10 @@ def clubPlayingRecordRearchResults():
|
||||
_season = request.form['season']
|
||||
_club = request.form['clubName']
|
||||
if _club and request.method == 'POST':
|
||||
sql = "SELECT * FROM _playerRecord_" + _club.lower() + " ORDER BY playerNumber"
|
||||
sql2 = "SHOW COLUMNS FROM __playerRecord_" + _club.lower() + ""
|
||||
rows = sql_read(sql)
|
||||
columns = sql_read(sql2)
|
||||
sql = "SELECT * FROM _" + _season + "_playerRecord_" + _club.lower() + " ORDER BY playerNumber"
|
||||
sql2 = "SHOW COLUMNS FROM _" + _season + "_playerRecord_" + _club.lower() + ""
|
||||
rows = sql_read_static(sql)
|
||||
columns = sql_read_static(sql2)
|
||||
return render_template('_clubPlayingRecordResults.html', rows=rows, columns=columns)
|
||||
else:
|
||||
return 'Invalid search data entered'
|
||||
@ -135,8 +135,8 @@ def clubPlayingRecordRearchResults():
|
||||
def playerCheck():
|
||||
sql = "SELECT hockeyClub FROM mensHockeyClubs ORDER BY hockeyClub"
|
||||
sql2 = "SELECT nextClub, oppoLogo FROM hkfcDAdminSettings"
|
||||
clubs = sql_read(sql)
|
||||
settings = sql_read(sql2)
|
||||
clubs = sql_read_static(sql)
|
||||
settings = sql_read_static(sql2)
|
||||
form = clubPlayingRecordsForm()
|
||||
form.clubName.choices = [(name['hockeyClub'], name['hockeyClub']) for name in clubs]
|
||||
clubLogo = settings[0]['oppoLogo']
|
||||
@ -150,8 +150,8 @@ def playerCheckResults():
|
||||
if _club and request.method == 'POST':
|
||||
sql = "SELECT * FROM _playerRecord_" + _club.lower() + " ORDER BY playerNumber"
|
||||
sql2 = "SHOW COLUMNS FROM _playerRecord_" + _club.lower() + ""
|
||||
rows = sql_read(sql)
|
||||
columns = sql_read(sql2)
|
||||
rows = sql_read_static(sql)
|
||||
columns = sql_read_static(sql2)
|
||||
for row in rows:
|
||||
has_played = 0
|
||||
for column in columns:
|
||||
|
||||
@ -1,41 +0,0 @@
|
||||
<ooctype html>
|
||||
<head>
|
||||
<title>List of player team appearances from 2018/19 season - Python Flask MySQL app</title>
|
||||
<link rel="stylesheet" media="screen" href ="/static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/css/bootstrap-theme.min.css">
|
||||
<meta name="viewport" content = "width=device-width, initial-scale=1.0">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="/static/js/bootstrap.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<ul class=flashes>
|
||||
{% for message in messages %}
|
||||
<li>{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</p>
|
||||
<a class="btn btn-primary" href="/dashboard" role="button">Home</a>
|
||||
<table class="table table-striped table-bordered table-hover table-condensed">
|
||||
<thead>
|
||||
{%- for column in columns %}
|
||||
<th>{{ column['Field'] }}</th>
|
||||
{%- endfor %}
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{%- for row in rows %}
|
||||
<tr>
|
||||
{%- for column in columns %}
|
||||
<td>{{ row[column['Field']] }}</td>
|
||||
{%- endfor %}
|
||||
</tr>
|
||||
{%- endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<a class="btn btn-primary" href="/dashboard" role="button">Home</a>
|
||||
</body>
|
||||
@ -1,70 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Club Player Playing Record Search *TESTING*</title>
|
||||
<link rel="stylesheet" media="screen" href ="/static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/css/bootstrap-theme.min.css">
|
||||
<meta name="viewport" content = "width=device-width, initial-scale=1.0">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="/static/js/bootstrap.min.js"></script>
|
||||
</head>
|
||||
<h2>Search Parameters - select a club to search their playing record</h2>
|
||||
<body onload="myFunction()">
|
||||
<dl>
|
||||
<p>
|
||||
{{ form.csrf_token }}
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<form class="col-sm-6" method="post" action="/clubPlayingRecordSearch">
|
||||
<div class = "row">
|
||||
<div class = "col-sm-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="basic-addon1">Season data to search:</span>
|
||||
{{ form.season(class_="form-control") }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class = "row">
|
||||
<div class = "col-sm-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="basic-addon1">Club:</span>
|
||||
{{ form.clubName(class_="form-control") }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
{{ form.submitButton(class_="btn btn-success") }}
|
||||
<a class="btn btn-danger" href="/dashboard" role="button">Cancel</a>
|
||||
</p>
|
||||
</form>
|
||||
<div class="col-sm-0">
|
||||
<img src="{{ selectedClubLogo }}" height="120" id="selectedClubLogo"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
</dl>
|
||||
|
||||
<script>
|
||||
var club_select = document.getElementById("clubName");
|
||||
var club_logo = document.getElementById("selectedClubLogo");
|
||||
|
||||
club_select.onchange = function() {myFunction()};
|
||||
|
||||
function myFunction() {
|
||||
|
||||
club = club_select.value;
|
||||
|
||||
fetch('/hkfc-d/getLogo/' + club).then(function(response) {
|
||||
response.json().then(function(data) {
|
||||
var HTML = '';
|
||||
for (var logo of data) {
|
||||
HTML += logo.logoURL;
|
||||
}
|
||||
club_logo.src = HTML;
|
||||
})
|
||||
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,6 +1,6 @@
|
||||
<doctype html>
|
||||
<head>
|
||||
<title>Fixture List 2019/20 season</title>
|
||||
<title>Fixture List 2020/21 season</title>
|
||||
<link rel="stylesheet" media="screen" href ="/static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/css/bootstrap-theme.min.css">
|
||||
<meta name="viewport" content = "width=device-width, initial-scale=1.0">
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>HKFC Men's D Team - MotM and DotD online vote *TESTING*</title>
|
||||
<title>HKFC Men's D Team - MotM and DotD online vote</title>
|
||||
<link rel="stylesheet" media="screen" href ="/static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/css/bootstrap-theme.min.css">
|
||||
<meta name="viewport" content = "width=device-width, initial-scale=1.0">
|
||||
|
||||
@ -1,70 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Player Check *TESTING*</title>
|
||||
<link rel="stylesheet" media="screen" href ="/static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/css/bootstrap-theme.min.css">
|
||||
<meta name="viewport" content = "width=device-width, initial-scale=1.0">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="/static/js/bootstrap.min.js"></script>
|
||||
</head>
|
||||
<h2>Search Parameters - select a club to search for players who have played for 2 or more teams</h2>
|
||||
<body onload="myFunction()">
|
||||
<dl>
|
||||
<p>
|
||||
{{ form.csrf_token }}
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<form class="col-sm-6" method="post" action="/playerCheckResults">
|
||||
<div class = "row">
|
||||
<div class = "col-sm-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="basic-addon1">Season data to search:</span>
|
||||
{{ form.season(class_="form-control") }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class = "row">
|
||||
<div class = "col-sm-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="basic-addon1">Club:</span>
|
||||
{{ form.clubName(class_="form-control") }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
{{ form.submitButton(class_="btn btn-success") }}
|
||||
<a class="btn btn-danger" href="/dashboard" role="button">Cancel</a>
|
||||
</p>
|
||||
</form>
|
||||
<div class="col-sm-0">
|
||||
<img src="{{ selectedClubLogo }}" height="120" id="selectedClubLogo"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
</dl>
|
||||
|
||||
<script>
|
||||
var club_select = document.getElementById("clubName");
|
||||
var club_logo = document.getElementById("selectedClubLogo");
|
||||
|
||||
club_select.onchange = function() {myFunction()};
|
||||
|
||||
function myFunction() {
|
||||
|
||||
club = club_select.value;
|
||||
|
||||
fetch('/hkfc-d/getLogo/' + club).then(function(response) {
|
||||
response.json().then(function(data) {
|
||||
var HTML = '';
|
||||
for (var logo of data) {
|
||||
HTML += logo.logoURL;
|
||||
}
|
||||
club_logo.src = HTML;
|
||||
})
|
||||
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,41 +0,0 @@
|
||||
<ooctype html>
|
||||
<head>
|
||||
<title>List of player team appearances from 2018/19 season - Python Flask MySQL app</title>
|
||||
<link rel="stylesheet" media="screen" href ="/static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/css/bootstrap-theme.min.css">
|
||||
<meta name="viewport" content = "width=device-width, initial-scale=1.0">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="/static/js/bootstrap.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<ul class=flashes>
|
||||
{% for message in messages %}
|
||||
<li>{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</p>
|
||||
<a class="btn btn-primary" href="/dashboard" role="button">Home</a>
|
||||
<table class="table table-striped table-bordered table-hover table-condensed">
|
||||
<thead>
|
||||
{%- for column in columns %}
|
||||
<th>{{ column['Field'] }}</th>
|
||||
{%- endfor %}
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{%- for row in rows %}
|
||||
<tr>
|
||||
{%- for column in columns %}
|
||||
<td>{{ row[column['Field']] }}</td>
|
||||
{%- endfor %}
|
||||
</tr>
|
||||
{%- endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<a class="btn btn-primary" href="/dashboard" role="button">Home</a>
|
||||
</body>
|
||||
@ -1,90 +0,0 @@
|
||||
<doctype html>
|
||||
<head>
|
||||
<title>List of players from 2018/19 season - Python Flask MySQL app</title>
|
||||
<link rel="stylesheet" media="screen" href ="/static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/css/bootstrap-theme.min.css">
|
||||
<meta name="viewport" content = "width=device-width, initial-scale=1.0">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="/static/js/bootstrap.min.js"></script>
|
||||
</head>
|
||||
|
||||
<style>
|
||||
tbody td {
|
||||
border: 1px solid #ccc;
|
||||
padding: 0px 0px;
|
||||
}
|
||||
|
||||
th.rotate {
|
||||
/* Something you can count on */
|
||||
height: 120px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
th.rotate > div {
|
||||
transform:
|
||||
/* Magic Numbers */
|
||||
translate(23px, 0px)
|
||||
/* 45 is really 360 - 45 */
|
||||
rotate(315deg);
|
||||
width: 30px;
|
||||
}
|
||||
th.rotate > div > span {
|
||||
border-bottom: 1px solid #ccc;
|
||||
padding: 0px 0px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<p>
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<ul class=flashes>
|
||||
{% for message in messages %}
|
||||
<li>{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</p>
|
||||
<table class="table table-striped table-hover table-condensed">
|
||||
<thead>
|
||||
{%- for column in columns %}
|
||||
{% if column['Field'] == "playerNumber" %}
|
||||
<th><div><span>Player Number</span></div></th>
|
||||
{% elif column['Field'] == "playerName" %}
|
||||
<th><div><span>Player Name</span></div></th>
|
||||
{% elif column['Field'] == "appearances" %}
|
||||
<th><div><span>Appearances</span></div></th>
|
||||
{% elif column['Field'] == "goals" %}
|
||||
<th><div><span>Goals</span></div></th>
|
||||
{% elif column['Field'].startswith('22381goal') %}
|
||||
<th class="rotate"><div><span>NBC A goals</span></div></th>
|
||||
{% else %}
|
||||
{%- for match in matchesList %}
|
||||
{% if column['Field'].startswith(match) %}
|
||||
{% if column['Field'].endswith('played') %}
|
||||
<th class="rotate"><div><span>{{ matches[match] }} Played</span></div></th>
|
||||
{% elif column['Field'].endswith('goals') %}
|
||||
<th class="rotate"><div><span>{{ matches[match] }} Goals</span></div></th>
|
||||
{% elif column['Field'].endswith('capt') %}
|
||||
<th class="rotate"><div><span>{{ matches[match] }} Captain</span></div></th>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{%- endfor %}
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{%- for row in rows %}
|
||||
<tr>
|
||||
{%- for column in columns %}
|
||||
<td>{{ row[column['Field']] }}</td>
|
||||
{%- endfor %}
|
||||
</tr>
|
||||
{%- endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<a class="btn btn-primary" href="/dashboard" role="button">Home</a>
|
||||
</body>
|
||||
|
||||
@ -1,87 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Player Playing Record Results Search *TESTING*</title>
|
||||
<link rel="stylesheet" media="screen" href ="/static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/css/bootstrap-theme.min.css">
|
||||
<meta name="viewport" content = "width=device-width, initial-scale=1.0">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="/static/js/bootstrap.min.js"></script>
|
||||
</head>
|
||||
<h2>Search Parameters - select both a club and team</h2>
|
||||
<body onload="myFunction()">
|
||||
<dl>
|
||||
<p>
|
||||
{{ form.csrf_token }}
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<form class="col-sm-6" method="post" action="/playerRecordSearch">
|
||||
<div class = "row">
|
||||
<div class = "col-sm-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="basic-addon1">Season data to search:</span>
|
||||
{{ form.season(class_="form-control") }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class = "row">
|
||||
<div class = "col-sm-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="basic-addon1">Club:</span>
|
||||
{{ form.clubName(class_="form-control") }}
|
||||
</div>
|
||||
</div>
|
||||
<div class = "col-sm-4">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="basic-addon2">Team:</span>
|
||||
{{ form.teamName(class_="form-control") }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
{{ form.submitButton(class_="btn btn-success") }}
|
||||
<a class="btn btn-danger" href="/dashboard" role="button">Cancel</a>
|
||||
</p>
|
||||
</form>
|
||||
<div class="col-sm-0">
|
||||
<img src="{{ selectedClubLogo }}" height="120" id="selectedClubLogo"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
</dl>
|
||||
|
||||
<script>
|
||||
var club_select = document.getElementById("clubName");
|
||||
var club_logo = document.getElementById("selectedClubLogo");
|
||||
var team_select = document.getElementById("teamName");
|
||||
|
||||
club_select.onchange = function() {myFunction()};
|
||||
|
||||
function myFunction() {
|
||||
|
||||
club = club_select.value;
|
||||
|
||||
fetch('/hkfc-d/motmAdmin/' + club).then(function(response) {
|
||||
response.json().then(function(data) {
|
||||
var optionHTML = '';
|
||||
for (var team of data) {
|
||||
optionHTML += '<option value="' + team.team + '">' + team.team + '</option>';
|
||||
}
|
||||
team_select.innerHTML = optionHTML;
|
||||
})
|
||||
|
||||
});
|
||||
fetch('/hkfc-d/getLogo/' + club).then(function(response) {
|
||||
response.json().then(function(data) {
|
||||
var HTML = '';
|
||||
for (var logo of data) {
|
||||
HTML += logo.logoURL;
|
||||
}
|
||||
club_logo.src = HTML;
|
||||
})
|
||||
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,129 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Team Season Results Search *TESTING*</title>
|
||||
<link rel="stylesheet" media="screen" href ="/static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/css/bootstrap-theme.min.css">
|
||||
<meta name="viewport" content = "width=device-width, initial-scale=1.0">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="/static/js/bootstrap.min.js"></script>
|
||||
</head>
|
||||
<h2>Search Parameters - select both a club and team</h2>
|
||||
<body onload="myFunction()">
|
||||
<dl>
|
||||
<p>
|
||||
{{ form.csrf_token }}
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<form class="col-sm-6" method="post" action="/searchTeam">
|
||||
<div class = "row">
|
||||
<div class = "col-sm-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="basic-addon1">Season data to search:</span>
|
||||
{{ form.season(class_="form-control") }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class = "row">
|
||||
<div class = "col-sm-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="basic-addon2">Club:</span>
|
||||
{{ form.clubName(class_="form-control") }}
|
||||
</div>
|
||||
</div>
|
||||
<div class = "col-sm-4">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="basic-addon3">Team:</span>
|
||||
{{ form.teamName(class_="form-control") }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class = "row">
|
||||
<div class = "col-sm-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="basic-addon4">Start Date:</span>
|
||||
{{ form.startDate(class_="form-control") }}
|
||||
</div>
|
||||
</div>
|
||||
<div class = "col-sm-4">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="basic-addon5">End Date:</span>
|
||||
{{ form.endDate(class_="form-control") }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
{{ form.submitButton(class_="btn btn-success") }}
|
||||
<a class="btn btn-danger" href="/dashboard" role="button">Cancel</a>
|
||||
</p>
|
||||
</form>
|
||||
<div class="col-sm-0">
|
||||
<img src="{{ selectedClubLogo }}" height="120" id="selectedClubLogo"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
</dl>
|
||||
|
||||
<script>
|
||||
var season_select = document.getElementById("season");
|
||||
var season_start = document.getElementById("startDate");
|
||||
var club_select = document.getElementById("clubName");
|
||||
var club_logo = document.getElementById("selectedClubLogo");
|
||||
var team_select = document.getElementById("teamName");
|
||||
|
||||
season_select.onchange = function() {seasonFunction()};
|
||||
club_select.onchange = function() {myFunction()};
|
||||
|
||||
function myFunction() {
|
||||
|
||||
club = club_select.value;
|
||||
|
||||
fetch('/hkfc-d/motmAdmin/' + club).then(function(response) {
|
||||
response.json().then(function(data) {
|
||||
var optionHTML = '';
|
||||
for (var team of data) {
|
||||
optionHTML += '<option value="' + team.team + '">' + team.team + '</option>';
|
||||
}
|
||||
team_select.innerHTML = optionHTML;
|
||||
})
|
||||
|
||||
});
|
||||
fetch('/hkfc-d/getLogo/' + club).then(function(response) {
|
||||
response.json().then(function(data) {
|
||||
var HTML = '';
|
||||
for (var logo of data) {
|
||||
HTML += logo.logoURL;
|
||||
}
|
||||
club_logo.src = HTML;
|
||||
})
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function seasonFunction() {
|
||||
season = season_select.value;
|
||||
var startDate = '';
|
||||
if (season == '2018') {
|
||||
startDate = '2018-09-01'
|
||||
} else if (season == '2017') {
|
||||
startDate = '2017-01-09'
|
||||
} else if (season == '2016') {
|
||||
startDate = '2016-09-01'
|
||||
} else if (season == '2015') {
|
||||
startDate = '2015-09-01'
|
||||
} else if (season == '2014') {
|
||||
startDate = '2014-09-01'
|
||||
} else if (season == '2013') {
|
||||
startDate = '2013-09-01'
|
||||
} else if (season == '2012') {
|
||||
startDate = '2012-09-01'
|
||||
} else if (season == '2011') {
|
||||
startDate = '2011-09-01'
|
||||
} else if (season == '2010') {
|
||||
startDate = '2010-09-01'
|
||||
}
|
||||
season_start.value = startDate;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,26 +0,0 @@
|
||||
<doctype html>
|
||||
<head>
|
||||
<title>List of matches from 2018/19 season - Python Flask MySQL CRUD</title>
|
||||
<link rel="stylesheet" media="screen" href ="/static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/css/bootstrap-theme.min.css">
|
||||
<meta name="viewport" content = "width=device-width, initial-scale=1.0">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="/static/js/bootstrap.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<ul class=flashes>
|
||||
{% for message in messages %}
|
||||
<li>{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</p>
|
||||
<table class="table table-striped table-hover table-condensed">
|
||||
{{ table }}
|
||||
</table>
|
||||
<a class="btn btn-primary" href="/dashboard" role="button">Home</a>
|
||||
</body>
|
||||
@ -1,26 +0,0 @@
|
||||
<doctype html>
|
||||
<head>
|
||||
<title>Team Results from 2018/19 season - Python Flask MySQL app</title>
|
||||
<link rel="stylesheet" media="screen" href ="/static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/css/bootstrap-theme.min.css">
|
||||
<meta name="viewport" content = "width=device-width, initial-scale=1.0">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="/static/js/bootstrap.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<ul class=flashes>
|
||||
{% for message in messages %}
|
||||
<li>{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</p>
|
||||
<table class="table table-bordered table-striped table-hover table-condensed">
|
||||
{{ table }}
|
||||
</table>
|
||||
<a class="btn btn-primary" href="/dashboard" role="button">Home</a>
|
||||
</body>
|
||||
@ -1,85 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Team Results Record Search *TESTING*</title>
|
||||
<link rel="stylesheet" media="screen" href ="/static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/css/bootstrap-theme.min.css">
|
||||
<meta name="viewport" content = "width=device-width, initial-scale=1.0">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="/static/js/bootstrap.min.js"></script>
|
||||
</head>
|
||||
<h2>Search Parameters - select both a club and team</h2>
|
||||
<body onload="myFunction()">
|
||||
<dl>
|
||||
<p>
|
||||
{{ form.csrf_token }}
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<form class="col-sm-6" method="post" action="/teamRecordSearch">
|
||||
<div class = "row">
|
||||
<div class = "col-sm-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="basic-addon1">Season data to search:</span>
|
||||
{{ form.season(class_="form-control") }}
|
||||
</div>
|
||||
</div>
|
||||
<div class = "col-sm-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="basic-addon1">Club:</span>
|
||||
{{ form.clubName(class_="form-control") }}
|
||||
</div>
|
||||
</div>
|
||||
<div class = "col-sm-4">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="basic-addon2">Team:</span>
|
||||
{{ form.teamName(class_="form-control") }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
{{ form.submitButton(class_="btn btn-success") }}
|
||||
<a class="btn btn-danger" href="/dashboard" role="button">Cancel</a>
|
||||
</p>
|
||||
</form>
|
||||
<div class="col-sm-0">
|
||||
<img src="{{ selectedClubLogo }}" height="120" id="selectedClubLogo"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
</dl>
|
||||
|
||||
<script>
|
||||
var club_select = document.getElementById("clubName");
|
||||
var club_logo = document.getElementById("selectedClubLogo");
|
||||
var team_select = document.getElementById("teamName");
|
||||
|
||||
club_select.onchange = function() {myFunction()};
|
||||
|
||||
function myFunction() {
|
||||
|
||||
club = club_select.value;
|
||||
|
||||
fetch('/hkfc-d/motmAdmin/' + club).then(function(response) {
|
||||
response.json().then(function(data) {
|
||||
var optionHTML = '';
|
||||
for (var team of data) {
|
||||
optionHTML += '<option value="' + team.team + '">' + team.team + '</option>';
|
||||
}
|
||||
team_select.innerHTML = optionHTML;
|
||||
})
|
||||
|
||||
});
|
||||
fetch('/hkfc-d/getLogo/' + club).then(function(response) {
|
||||
response.json().then(function(data) {
|
||||
var HTML = '';
|
||||
for (var logo of data) {
|
||||
HTML += logo.logoURL;
|
||||
}
|
||||
club_logo.src = HTML;
|
||||
})
|
||||
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -12,18 +12,6 @@ Dashboard
|
||||
|
||||
{% block body %}
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="dropdown">
|
||||
<button class="dropbtn">Men's Hockey
|
||||
<i class="fa fa-caret-down"></i>
|
||||
</button>
|
||||
<div class="dropdown-content">
|
||||
<a href="/search">General Match Search</a>
|
||||
<a href="/playerRecords">Player Record Search</a>
|
||||
<a href="/teamRecords">Team Record Search</a>
|
||||
<a href="/clubPlayingRecords">Club Player Playing Record</a>
|
||||
<a href="/playerCheck">Played for multiple teams</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dropdown">
|
||||
<button class="dropbtn">HKFC D
|
||||
<i class="fa fa-caret-down"></i>
|
||||
|
||||
@ -1,52 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TESTING: Search Parameters - Python Flask Hockey Results Search App</title>
|
||||
<link rel="stylesheet" media="screen" href ="static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="static/css/bootstrap-theme.min.css">
|
||||
<meta name="viewport" content = "width=device-width, initial-scale=1.0">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="static/js/bootstrap.min.js"></script>
|
||||
</head>
|
||||
<h2>Search Parameters</h2>
|
||||
<body>
|
||||
Please select your search parameters - search for both club and team
|
||||
<form method="post" action="/search-results">
|
||||
<dl>
|
||||
<p>
|
||||
<label for="inputClub">Club:</label>
|
||||
<select class="form-control" name="inputClub" required>
|
||||
{% for item in data %}
|
||||
<option value={{ item.hockeyClub }}>{{ item.hockeyClub }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<label for="inputTeam">Team:</label>
|
||||
<select class="form-control" name="inputTeam" required>
|
||||
<option value="A">A</option>
|
||||
<option value="B">B</option>
|
||||
<option value="C">C</option>
|
||||
<option value="D">D</option>
|
||||
<option value="E">E</option>
|
||||
<option value="F">F</option>
|
||||
<option value="G">G</option>
|
||||
<option value="H">H</option>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<label for="startDate">Start Date:</label>
|
||||
<p/>
|
||||
<input type="date" name="startDate" data-date-format="DD-MM-YYYY"/>
|
||||
<p/>
|
||||
<label for="endDate">End Date:</label>
|
||||
<p/>
|
||||
<input type="date" name="endDate" data-date-format="DD-MM-YYYY"/>
|
||||
</p>
|
||||
</dl>
|
||||
<p>
|
||||
<button type="submit" class="btn btn-success">Submit</button>
|
||||
<a class="btn btn-danger" href="/dashboard" role="button">Cancel</a>
|
||||
</p>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue
Block a user