Merge pull request 'subcontractor dashboard ui page create' (#9) from pankaj-dev into main

Reviewed-on: #9
This commit was merged in pull request #9.
This commit is contained in:
2026-01-17 12:12:03 +00:00
4 changed files with 64 additions and 2 deletions

View File

@@ -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()
)

View File

@@ -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(