Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css"
integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
<title>Title</title>
<link rel="icon" type="image/x-icon" href="/pokemon/favicon.ico">
</head>
<body>
<script src="js/requests.js"></script>
<script>
tableParentId = "tableDiv";
detailsParentId = "detailsDiv";
fetch('/pokemon/api/trainers')
.then(res => res.json())
.then(data => {
pokemonTrainers = data;
createPokemonTrainersTable();
})
.catch(err => {
console.error(`Unable to fetch Pokemon Trainers: ${err.status}`);
console.error(err);
});
</script>
<h1>Pokemon Trainers</h1>
<div class="container">
<div class="row">
<div id="tableDiv" class="col-8">No data</div>
<div id="detailsDiv" class="col-4">No data</div>
</div>
</div>
</br>
<h1>Create Trainer</h1>
<form id="createTrainerForm" onsubmit="createTrainer();">
<div class="form-group col-md-6">
<label for="trainerName">Name</label>
<input type="text" class="form-control" id="trainerName" required>
</div>
<div class="form-group col-md-6">
<label for="trainerProfileUrl">Profile URL (optional)</label>
<input type="text" class="form-control" id="trainerProfileUrl">
</div>
<button type="submit" class="btn btn-primary">Create Trainer</button>
</form>
</br>
<h1>Update Trainer</h1>
<form id="updateTrainerForm" onsubmit="updateTrainer();">
<div class="form-group col-md-6">
<label for="updateTrainerId">ID</label>
<input type="text" class="form-control" id="updateTrainerId" required>
</div>
<div class="form-group col-md-6">
<label for="updateTrainerName">Name</label>
<input type="text" class="form-control" id="updateTrainerName" required>
</div>
<div class="form-group col-md-6">
<label for="updateTrainerProfileUrl">Profile URL (optional)</label>
<input type="text" class="form-control" id="updateTrainerProfileUrl">
</div>
<button type="submit" class="btn btn-primary">Update Trainer</button>
</form>