From 21258ce3f79cae9feba2fb9d67f987e93462dd66 Mon Sep 17 00:00:00 2001
From: shashankbajoria <s.bajoria@student.utwente.nl>
Date: Mon, 6 May 2024 14:49:56 +0200
Subject: [PATCH] Trainerspage added

---
 src/main/webapp/Trainerspage.html | 45 +++++++++++++++++++++++++++++++
 src/main/webapp/js/requests.js    |  1 +
 src/main/webapp/pokemonTypes.html |  4 +++
 3 files changed, 50 insertions(+)
 create mode 100644 src/main/webapp/Trainerspage.html

diff --git a/src/main/webapp/Trainerspage.html b/src/main/webapp/Trainerspage.html
new file mode 100644
index 0000000..7498a1c
--- /dev/null
+++ b/src/main/webapp/Trainerspage.html
@@ -0,0 +1,45 @@
+<!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 => {
+            pokemonTypes = data;
+            createPokemonTypesTable();
+        })
+        .catch(err => {
+            console.error(`Unable to fetch Pokemon Types: ${err.status}`);
+            console.error(err);
+        });
+</script>
+
+<h1>Pokemon Types</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>
+
+
+</body>
+</html>
\ No newline at end of file
diff --git a/src/main/webapp/js/requests.js b/src/main/webapp/js/requests.js
index 9f11ad9..94a2c36 100644
--- a/src/main/webapp/js/requests.js
+++ b/src/main/webapp/js/requests.js
@@ -59,5 +59,6 @@ function createPokemonTypesTable() {
                 }
             </tbody>
         </table>
+        
     `
 }
\ No newline at end of file
diff --git a/src/main/webapp/pokemonTypes.html b/src/main/webapp/pokemonTypes.html
index e25e4f3..48674bd 100644
--- a/src/main/webapp/pokemonTypes.html
+++ b/src/main/webapp/pokemonTypes.html
@@ -40,5 +40,9 @@
         </div>
     </div>
 
+    <a href="Trainerspage.html">
+        <button>Trainers Page</button>
+    </a>
+
 </body>
 </html>
\ No newline at end of file
-- 
GitLab