From 31f717641995c44f0f76278972b0c752a9cf7d7b Mon Sep 17 00:00:00 2001
From: Dave Welsh <dw927@drexel.edu>
Date: Tue, 24 Jan 2023 21:54:17 -0500
Subject: [PATCH] Added report detail page. Added link to report detail page
 from the reports page.

---
 front_end/dpath.py                            |  5 ++++
 .../templates/includes/reportDetail.html      | 28 ++++++++++++++++++
 front_end/templates/includes/reports.html     | 29 ++++++++++---------
 front_end/templates/reportDetail.html         | 14 +++++++++
 4 files changed, 63 insertions(+), 13 deletions(-)
 create mode 100644 front_end/templates/includes/reportDetail.html
 create mode 100644 front_end/templates/reportDetail.html

diff --git a/front_end/dpath.py b/front_end/dpath.py
index f546048..545f796 100644
--- a/front_end/dpath.py
+++ b/front_end/dpath.py
@@ -38,6 +38,11 @@ def reports():
     reports = requests.get(f'{REPORTS_SERVICE_URL}/dpath/report').json()
     return render_template('reports.html', reports=reports)
 
+@app.route(f'/{BASE_URL}/reports/<string:report_id>')
+def get_report(report_id):
+    report = requests.get(f'{REPORTS_SERVICE_URL}/dpath/report/{report_id}').json()
+    return render_template('reportDetail.html', report=report)
+
 
 @app.route('/', methods=['GET', "POST"])
 def upload_image():
diff --git a/front_end/templates/includes/reportDetail.html b/front_end/templates/includes/reportDetail.html
new file mode 100644
index 0000000..a1e0ffb
--- /dev/null
+++ b/front_end/templates/includes/reportDetail.html
@@ -0,0 +1,28 @@
+{% block content %}
+<table class="report-detail-table">
+    <th class="left">Details</th>
+    <tr>
+        <td>Id</td>
+        <td>{{ report.id }}</td>
+    </tr>
+    <tr>
+        <td>Report Date</td>
+        <td>{{ report.report.runDate }}</td>
+    </tr>
+    <tr>
+        <td>Report Status</td>
+        <td>Todo</td>
+    </tr>
+    <tr>
+        <td>Diagnosis</td>
+        <td>{{ report.report.diagnosis }}</td>
+    </tr>
+    <tr>
+        <td>Mild Chips</td>
+        <td>{{ report.report.chipPredictions.mild}}</td>
+    </tr>
+    <tr>
+        <td>Severe Chips</td>
+        <td>{{ report.report.chipPredictions.severe}}</td>
+    </tr>
+{% endblock %}
\ No newline at end of file
diff --git a/front_end/templates/includes/reports.html b/front_end/templates/includes/reports.html
index 00d5fbd..2186ea1 100644
--- a/front_end/templates/includes/reports.html
+++ b/front_end/templates/includes/reports.html
@@ -1,16 +1,19 @@
 {% block content %}
 <h1>{% block title %} Reports {% endblock %}</h1>
-  <table class="report-table">
-    <th class="left">Id</th>
-    <th class="left">Status</th>
-    <th class="right">Run Date</th>
-    {% for report in reports %}
-    <tr>
-      <td class="left">{{ report.id }}</td>
-      <td class="left">Completed</td>
-      <td class="right">{{ report.report.runDate }}</td>
-    </tr>
-    {% endfor %}
-  </table>
+<table class="report-table">
+  <th class="left">Id</th>
+  <th class="left">Status</th>
+  <th class="right">Run Date</th>
+  {% for report in reports %}
+  <tr>
 
-  {% endblock %}
\ No newline at end of file
+    <td class="left">
+      <a href="{{ url_for('get_report', report_id=report.id)}}">{{ report.id }}</a>
+    </td>
+    <td class="left">Completed</td>
+    <td class="right">{{ report.report.runDate }}</td>
+  </tr>
+  {% endfor %}
+</table>
+
+{% endblock %}
\ No newline at end of file
diff --git a/front_end/templates/reportDetail.html b/front_end/templates/reportDetail.html
new file mode 100644
index 0000000..54c56b7
--- /dev/null
+++ b/front_end/templates/reportDetail.html
@@ -0,0 +1,14 @@
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Reports</title>
+    {% include 'includes/stylesload.html' %}
+</head>
+
+<body>
+    {% include 'includes/navbar.html' %}
+    <div class="container">
+        {% include 'includes/reportDetail.html' %}
+    </div>
+</body>
+
-- 
GitLab