From 7e915423a3544d920664cbdb4bdb020f0b67dcc0 Mon Sep 17 00:00:00 2001 From: Yaro Kasear Date: Tue, 9 Sep 2025 09:53:05 -0500 Subject: [PATCH] Starting work on frontend. --- inventory/__init__.py | 9 +++---- inventory/routes/__init__.py | 0 inventory/routes/index.py | 10 ++++++++ inventory/templates/base.html | 46 +++++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 inventory/routes/__init__.py create mode 100644 inventory/routes/index.py create mode 100644 inventory/templates/base.html diff --git a/inventory/__init__.py b/inventory/__init__.py index 2bf2a61..6013957 100644 --- a/inventory/__init__.py +++ b/inventory/__init__.py @@ -9,7 +9,8 @@ from crudkit.core.service import CRUDService from crudkit.integrations.flask import init_app from .config import DevConfig -from .db import init_db, create_all_tables, get_session + +from .routes.index import init_index_routes def create_app(config_cls=DevConfig) -> Flask: app = Flask(__name__) @@ -49,14 +50,12 @@ def create_app(config_cls=DevConfig) -> Flask: app.register_blueprint(generate_crud_blueprint(_models.WorkLog, work_log_service), url_prefix="/api/work_log") app.register_blueprint(generate_crud_blueprint(_models.WorkNote, work_note_service), url_prefix="/api/work_note") + init_index_routes(app) + @app.teardown_appcontext def _remove_session(_exc): sess = app.extensions["crudkit"].get("Session") if sess is not None: sess.remove() - @app.get("/") - def index(): - return {"status": "ok", "db": str(runtime.engine.url)} - return app \ No newline at end of file diff --git a/inventory/routes/__init__.py b/inventory/routes/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/inventory/routes/index.py b/inventory/routes/index.py new file mode 100644 index 0000000..cc743d3 --- /dev/null +++ b/inventory/routes/index.py @@ -0,0 +1,10 @@ +from flask import Blueprint, request, jsonify, render_template + +bp_index = Blueprint("index", __name__) + +def init_index_routes(app): + @bp_index.get("/") + def index(): + return render_template("base.html") + + app.register_blueprint(bp_index) diff --git a/inventory/templates/base.html b/inventory/templates/base.html new file mode 100644 index 0000000..2788af2 --- /dev/null +++ b/inventory/templates/base.html @@ -0,0 +1,46 @@ + + + + + + + {% block title %}{{ title if title else "Inventory Manager" }}{% endblock %} + + + + + + +
+ +
+ +
+ {% block main %} +

{{ title if title else "Inventory Manager" }}

+ {% endblock %} +
+ + + + + + + + \ No newline at end of file