diff --git a/app_seed.py b/app_seed.py index 7a25f1d..69f1053 100644 --- a/app_seed.py +++ b/app_seed.py @@ -1,5 +1,5 @@ from application import db, app -from application.models import AllowedPlate +from application.dashboard.models import AllowedPlate with app.app_context(): AllowedPlate.query.delete() diff --git a/application/api/views.py b/application/api/views.py index 06e6f9b..2505323 100644 --- a/application/api/views.py +++ b/application/api/views.py @@ -1,6 +1,6 @@ from flask import Blueprint, request, jsonify from application import db -from application.models import AllowedPlate, LoggedItem +from application.dashboard.models import AllowedPlate, LoggedItem from application.api.image_processing import process_image from datetime import datetime import asyncio diff --git a/application/models.py b/application/dashboard/models.py similarity index 100% rename from application/models.py rename to application/dashboard/models.py diff --git a/application/dashboard/templates/base.html b/application/dashboard/templates/base.html index de2d2a7..ada9a2b 100644 --- a/application/dashboard/templates/base.html +++ b/application/dashboard/templates/base.html @@ -21,6 +21,9 @@ Dashboard + + Logs + Add numberplate diff --git a/application/dashboard/templates/dashboard.html b/application/dashboard/templates/dashboard.html index 4677a43..3f37ac2 100644 --- a/application/dashboard/templates/dashboard.html +++ b/application/dashboard/templates/dashboard.html @@ -4,26 +4,18 @@
-
Numberplate Logs
+
Registered Numberplates
- - + - - {% for form in recent_logs %} + {% for Plates in AllowedPlates %} - - - + {% endfor %} diff --git a/application/dashboard/templates/logs.html b/application/dashboard/templates/logs.html new file mode 100644 index 0000000..4677a43 --- /dev/null +++ b/application/dashboard/templates/logs.html @@ -0,0 +1,36 @@ +{%extends 'base.html' %} +{% block content %} + +
+
+
+
Numberplate Logs
+
+
Time
NumberplateGate Status
{{ form.timestamp.strftime('%H:%M:%S') }}{{ form.plate }} - - {{ form.allowed }} - - {{Plates.plate}}
+ + + + + + + + + {% for form in recent_logs %} + + + + + + {% endfor %} + +
TimeNumberplateGate Status
{{ form.timestamp.strftime('%H:%M:%S') }}{{ form.plate }} + + {{ form.allowed }} + +
+
+
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/application/dashboard/views.py b/application/dashboard/views.py index 4a18379..76bfd26 100644 --- a/application/dashboard/views.py +++ b/application/dashboard/views.py @@ -1,6 +1,6 @@ from flask import Blueprint, render_template from flask_login import login_required -from application.models import AllowedPlate, LoggedItem +from application.dashboard.models import AllowedPlate, LoggedItem from application import db, app from application.dashboard.forms import npForm @@ -11,8 +11,11 @@ dash_blueprint = Blueprint("dash", __name__, template_folder="templates") @dash_blueprint.route('/dashboard') #@login_required def dashboard(): - form = LoggedItem.query.all() - return render_template("dashboard.html", form=form) + #print("test123") + #with app.app_context(): + Plates = AllowedPlate.query.all() + print(Plates) + return render_template("dashboard.html", AllowedPlates = Plates) @dash_blueprint.route('/add', methods=['GET', 'POST']) #@login_required @@ -30,4 +33,10 @@ def add(): - return render_template("add.html", form=form) \ No newline at end of file + return render_template("add.html", form=form) + +@dash_blueprint.route('/logs', methods=['GET', 'POST']) +#@login_required +def logs(): + form = LoggedItem.query.all() + return render_template("logs.html", form=form) \ No newline at end of file