<div class="row mb-4">
	<div class="col-lg-12 col-md-12 mb-md-0">
		<div class="card">
			<div class="card-header pb-0">
				<div class="row">
					<div class="col-lg-6 col-7">
						<h6>Manage Sports Category</h6>
					</div>
				</div>
			</div>
			<div class="card-body px-0 pb-2">
				<div class="container">
					<div class="row">
						<div class="col-xl-12 col-lg-12 col-md-12 d-flex flex-column ms-auto me-auto ms-lg-auto me-lg-12">
							<div class="card card-plain">
								<div class="card-body">
									<form action="action.php" method="post" role="form">
										<div class="input-group input-group-outline mb-3 is-filled">
											<label class="form-label">Title</label>
											<input name="id" type="hidden" value="<?php echo $haxCategoryEditInfo['id'] ?>" />
											<input name="title" type="text" class="form-control" value="<?php echo $haxCategoryEditInfo['title'] ?>">
										</div>
										<div class="input-group input-group-outline mb-3 is-filled">
											<label class="form-label">League ID</label>
											<input name="league_id" type="text" class="form-control" value="<?php echo $haxCategoryEditInfo['league_id'] ?>">
										</div>
										<div class="text-center">
											<button name="updatehaxsportscategory" type="submit" class="btn btn-lg bg-gradient-secondary btn-lg w-100 mt-4 mb-0">Update</button>
										</div>
									</form>
									<div>
									<br><b style="font-size:20pt;">
									Available League IDs (Please note all leagues have varying levels of data, some do not have images and some do not have complete info. It can be trial and error and you may have to fill in some blanks):
										</b><br><?php
										if(!$sportsApiKey)
										{
											require_once("db.php");
											require_once("functions.php");
										}
									function getLeagueData()
									{
										global $sportsApiKey;
										$leagues = file_curl_contents("https://andyhax.uk/sports/" . $sportsApiKey . "/leagues/",true);
										if($leagues['headers']['cache-name'])
										{
											file_put_contents($leagues['headers']['cache-name'],$leagues['data']);
										}
										$leaguesInfo = json_decode($leagues['data'],true);
										return $leaguesInfo;
									}
										$leaguesInfo = getLeagueData();
										$allSports = array();
										foreach($leaguesInfo as $thisLeague)
										{
											if(!isset($allSports[$thisLeague['sport']]))
											{
												$allSports[$thisLeague['sport']] = array();
											}
											
											$allSports[$thisLeague['sport']][] = $thisLeague;
										}
										foreach($allSports as $thisSport => $leagues)
										{
											echo "<br><b>" . $thisSport . "</b><br><br>";
											foreach($leagues as $league)
											{
												echo $league['id']  . " - " . $league['name'] . "<br>";
											}
										}
										?>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>