From ac9d964ef45ee3bb8094995d43dca6f458eb9f0b Mon Sep 17 00:00:00 2001 From: pjpatil12 Date: Sat, 17 Jan 2026 17:39:31 +0530 Subject: [PATCH] subcontractor dashboard ui page create --- app/routes/dashboard.py | 14 +++++++++++ app/routes/generate_comparison_report.py | 16 ++++++++++-- app/templates/base.html | 7 ++++++ app/templates/subcontractor_dashboard.html | 29 ++++++++++++++++++++++ 4 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 app/templates/subcontractor_dashboard.html diff --git a/app/routes/dashboard.py b/app/routes/dashboard.py index 3aebc4c..59c16f7 100644 --- a/app/routes/dashboard.py +++ b/app/routes/dashboard.py @@ -66,3 +66,17 @@ def dashboard(): pie_chart=pie_chart(), histogram=histogram_chart() ) + +# subcontractor dashboard +@dashboard_bp.route("/subcontractor_dashboard") +def subcontractor_dashboard(): + if not session.get("user_id"): + return redirect(url_for("auth.login")) + + return render_template( + "subcontractor_dashboard.html", + title="Dashboard", + bar_chart=bar_chart(), + pie_chart=pie_chart(), + histogram=histogram_chart() + ) diff --git a/app/routes/generate_comparison_report.py b/app/routes/generate_comparison_report.py index a2ed92d..3992134 100644 --- a/app/routes/generate_comparison_report.py +++ b/app/routes/generate_comparison_report.py @@ -4,11 +4,15 @@ import io from app.models.subcontractor_model import Subcontractor from app.models.trench_excavation_model import TrenchExcavation -from app.models.tr_ex_client_model import TrenchExcavationClient from app.models.manhole_excavation_model import ManholeExcavation -from app.models.mh_ex_client_model import ManholeExcavationClient from app.models.manhole_domestic_chamber_model import ManholeDomesticChamber +from app.models.laying_model import Laying + +from app.models.tr_ex_client_model import TrenchExcavationClient +from app.models.mh_ex_client_model import ManholeExcavationClient from app.models.mh_dc_client_model import ManholeDomesticChamberClient +from app.models.laying_client_model import LayingClient + from app.utils.helpers import login_required generate_report_bp = Blueprint("generate_report", __name__, url_prefix="/report") @@ -191,6 +195,13 @@ def comparison_report(): ).all()] df_dc = build_comparison(dc_client, dc_sub, "MH_NO") + lay_client = [r.serialize() for r in LayingClient.query.all()] + lay_sub = [r.serialize() for r in Laying.query.filter_by( + subcontractor_id=subcontractor_id + ).all()] + df_lay = build_comparison(lay_client, lay_sub, "MH_NO") + + # -------- EXCEL -------- output = io.BytesIO() filename = f"{subcontractor.subcontractor_name}_Comparison_Report.xlsx" @@ -199,6 +210,7 @@ def comparison_report(): write_sheet(writer, df_tr, "Tr.Ex", subcontractor.subcontractor_name) write_sheet(writer, df_mh, "Mh.Ex", subcontractor.subcontractor_name) write_sheet(writer, df_dc, "MH & DC", subcontractor.subcontractor_name) + write_sheet(writer, df_lay, "Laying", subcontractor.subcontractor_name) output.seek(0) return send_file( diff --git a/app/templates/base.html b/app/templates/base.html index e2fe209..1472d63 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -77,6 +77,13 @@ Show Reports + +
  • + + Subcontractor Dashboard + +
  • + diff --git a/app/templates/subcontractor_dashboard.html b/app/templates/subcontractor_dashboard.html new file mode 100644 index 0000000..f1aa700 --- /dev/null +++ b/app/templates/subcontractor_dashboard.html @@ -0,0 +1,29 @@ +{% extends "base.html" %} + +{% block content %} + +
    + +

    Subcontractor Dashboard

    + + +
    + + +
    +
    +
    + Work Category Bar Chart +
    +
    + +
    +
    +
    + + +
    + +
    + +{% endblock %} \ No newline at end of file -- 2.49.1