diff --git a/app/__init__.py b/app/__init__.py index c909bed..3eb635b 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -29,7 +29,7 @@ # return app -from flask import Flask +from flask import Flask, redirect, url_for from app.config import Config from app.services.db_service import db @@ -42,10 +42,14 @@ def create_app(): # Register blueprints register_blueprints(app) - # Register error handlers register_error_handlers(app) + # ROOT → LOGIN + @app.route("/") + def index(): + return redirect(url_for("auth.login")) + return app diff --git a/app/routes/auth.py b/app/routes/auth.py index 4a79e12..9916348 100644 --- a/app/routes/auth.py +++ b/app/routes/auth.py @@ -3,9 +3,11 @@ from app.services.user_service import UserService auth_bp = Blueprint("auth", __name__) -@auth_bp.route("/", methods=["GET", "POST"]) @auth_bp.route("/login", methods=["GET", "POST"]) def login(): + if session.get("user_id"): + return redirect(url_for("dashboard.dashboard")) + if request.method == "POST": email = request.form.get("email") password = request.form.get("password") @@ -21,6 +23,7 @@ def login(): return render_template("login.html", title="Login") + @auth_bp.route("/logout") def logout(): session.clear() diff --git a/app/routes/dashboard.py b/app/routes/dashboard.py index 40d6089..04a4544 100644 --- a/app/routes/dashboard.py +++ b/app/routes/dashboard.py @@ -1,9 +1,11 @@ -from flask import Blueprint, render_template -from app.utils.helpers import login_required + +from flask import Blueprint, render_template, session, redirect, url_for dashboard_bp = Blueprint("dashboard", __name__, url_prefix="/dashboard") @dashboard_bp.route("/") -@login_required def dashboard(): + if not session.get("user_id"): + return redirect(url_for("auth.login")) + return render_template("dashboard.html", title="Dashboard") diff --git a/app/static/downloads/format/subcontractor_format.xlsx b/app/static/downloads/format/subcontractor_format.xlsx index 2affce4..1a24522 100644 Binary files a/app/static/downloads/format/subcontractor_format.xlsx and b/app/static/downloads/format/subcontractor_format.xlsx differ diff --git a/app/static/images/lcepl.png b/app/static/images/lcepl.png new file mode 100644 index 0000000..b4aa03b Binary files /dev/null and b/app/static/images/lcepl.png differ diff --git a/app/templates/base.html b/app/templates/base.html index b4ba845..9c74e29 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -7,7 +7,7 @@ {{ title if title else "ComparisonSoftware" }} - + diff --git a/app/templates/login.html b/app/templates/login.html index 988bd47..f704ef7 100644 --- a/app/templates/login.html +++ b/app/templates/login.html @@ -1,17 +1,82 @@ -{% extends "base.html" %} -{% block content %} -

Login

+ + -
-
+ + + LCEPL | Login + - - + + + - - + - -
-
-{% endblock %} \ No newline at end of file +
+
+ + +
+ +
+ +
+ + +
+ LCEPL Logo + +

+ Laxmi Civil Engineering Services Pvt Ltd +

+

+ Data Comparison System +

+
+ + + {% with messages = get_flashed_messages(with_categories=true) %} + {% if messages %} + {% for category, message in messages %} + + {% endfor %} + {% endif %} + {% endwith %} + + +
+ +
+ + +
+ +
+ + +
+ + +
+ +
+
+ +
+ +
+
+ + + + + + \ No newline at end of file diff --git a/app/templates/subcontractor/list.html b/app/templates/subcontractor/list.html index 2ad86f0..aff7776 100644 --- a/app/templates/subcontractor/list.html +++ b/app/templates/subcontractor/list.html @@ -1,38 +1,90 @@ {% extends "base.html" %} {% block content %} -
-

Subcontractor List

+
- - - - - - - - - - - + +
+
+

+ Subcontractor List +

+
+ + +
+ + +
+
IDNameMobileEmailGST NoAction
+ + + + + + + + + + + + + + {% for s in subcontractors %} + + + + + + + + + + + + + + + {% endfor %} + + + + + + + + + + +
IDNameMobileEmailGST NoAction
{{ s.id }} + {{ s.subcontractor_name }} + + {{ s.mobile_no }} + + {{ s.email_id }} + + {{ s.gst_no }} + + +
+ Total Subcontractors + + {{ subcontractors|length }} +
+
- - {% for s in subcontractors %} - - {{ s.id }} - {{ s.subcontractor_name }} - {{ s.mobile_no }} - {{ s.email_id }} - {{ s.gst_no }} - - Edit - Delete - - - {% endfor %} - -
{% endblock %} \ No newline at end of file