From dd4b4944358d7a6feb7a3018967f1f850b3d83b0 Mon Sep 17 00:00:00 2001 From: pjpatil12 Date: Fri, 16 Jan 2026 13:04:59 +0530 Subject: [PATCH] static Menubar apply boostrap css --- app/routes/file_report.py | 34 +++++--- app/static/css/subcontractor.css | 35 -------- app/templates/base.html | 45 ++++++---- app/templates/report.html | 145 +++++++++++++++---------------- 4 files changed, 116 insertions(+), 143 deletions(-) delete mode 100644 app/static/css/subcontractor.css diff --git a/app/routes/file_report.py b/app/routes/file_report.py index 9f81dc6..bed133d 100644 --- a/app/routes/file_report.py +++ b/app/routes/file_report.py @@ -1,42 +1,49 @@ import pandas as pd import io from flask import Blueprint, render_template, request, send_file, flash +from app.utils.helpers import login_required + from app.models.subcontractor_model import Subcontractor + from app.models.manhole_excavation_model import ManholeExcavation from app.models.trench_excavation_model import TrenchExcavation from app.models.manhole_domestic_chamber_model import ManholeDomesticChamber +from app.models.laying_model import Laying + from app.models.mh_ex_client_model import ManholeExcavationClient from app.models.tr_ex_client_model import TrenchExcavationClient from app.models.mh_dc_client_model import ManholeDomesticChamberClient -from app.utils.helpers import login_required +from app.models.laying_client_model import LayingClient + # --- BLUEPRINT DEFINITION --- file_report_bp = Blueprint("file_report", __name__, url_prefix="/file") -# --- DATA WRAPPERS --- +# --- Client class --- class ClientBill: def __init__(self): self.df_tr = pd.DataFrame() self.df_mh = pd.DataFrame() self.df_dc = pd.DataFrame() + self.df_laying = pd.DataFrame() def Fetch(self, RA_Bill_No): trench = TrenchExcavationClient.query.filter_by(RA_Bill_No=RA_Bill_No).all() mh = ManholeExcavationClient.query.filter_by(RA_Bill_No=RA_Bill_No).all() dc = ManholeDomesticChamberClient.query.filter_by(RA_Bill_No=RA_Bill_No).all() + lay = LayingClient.query.filter_by(RA_Bill_No=RA_Bill_No).all() self.df_tr = pd.DataFrame([c.serialize() for c in trench]) self.df_mh = pd.DataFrame([c.serialize() for c in mh]) self.df_dc = pd.DataFrame([c.serialize() for c in dc]) - - if not self.df_dc.empty and "MH_NO" in self.df_dc.columns: - self.df_dc.rename(columns={"MH_NO": "Node_No"}, inplace=True) - + self.df_laying = pd.DataFrame([c.serialize() for c in lay]) + drop_cols = ["id", "created_at", "_sa_instance_state"] - for df in [self.df_tr, self.df_mh, self.df_dc]: + for df in [self.df_tr, self.df_mh, self.df_dc, self.df_laying]: if not df.empty: df.drop(columns=drop_cols, errors="ignore", inplace=True) +# --- Subcontractor class --- class SubcontractorBill: def __init__(self): self.df_tr = pd.DataFrame() @@ -54,22 +61,19 @@ class SubcontractorBill: trench = TrenchExcavation.query.filter_by(**filters).all() mh = ManholeExcavation.query.filter_by(**filters).all() dc = ManholeDomesticChamber.query.filter_by(**filters).all() - lay = ManholeDomesticChamber.query.filter_by(**filters).all() + lay = Laying.query.filter_by(**filters).all() self.df_tr = pd.DataFrame([c.serialize() for c in trench]) self.df_mh = pd.DataFrame([c.serialize() for c in mh]) self.df_dc = pd.DataFrame([c.serialize() for c in dc]) self.df_laying = pd.DataFrame([c.serialize() for c in lay]) - - # if not self.df_dc.empty and "MH_NO" in self.df_dc.columns: - # self.df_dc.rename(columns={"MH_NO": "Node_No"}, inplace=True) - + drop_cols = ["id", "created_at", "_sa_instance_state"] for df in [self.df_tr, self.df_mh, self.df_dc, self.df_laying]: if not df.empty: df.drop(columns=drop_cols, errors="ignore", inplace=True) - +# --- subcontractor report only --- @file_report_bp.route("/report", methods=["GET", "POST"]) @login_required def report_file(): @@ -118,7 +122,8 @@ def report_file(): return send_file(output, download_name=file_name, as_attachment=True) # We add bootstrap classes directly to the pandas output - table_classes = "table table-hover table-bordered table-striped" + # table_classes = "table table-hover table-bordered table-striped" + table_classes = "table table-bordered table-striped table-hover table-sm mb-0" tables = { "tr": bill_gen.df_tr.to_html(classes=table_classes, index=False), "mh": bill_gen.df_mh.to_html(classes=table_classes, index=False), @@ -136,6 +141,7 @@ def report_file(): download_all=download_all ) +# --- client comparison --- @file_report_bp.route("/client_vs_subcont", methods=["GET", "POST"]) @login_required def client_vs_all_subcontractor(): diff --git a/app/static/css/subcontractor.css b/app/static/css/subcontractor.css deleted file mode 100644 index 26f4913..0000000 --- a/app/static/css/subcontractor.css +++ /dev/null @@ -1,35 +0,0 @@ -body { - background: #f5f7fa; - font-family: Arial; - padding: 40px; -} - -form { - width: 420px; - padding: 20px; - background: #fff; - border-radius: 8px; - box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); -} - -label { - margin-top: 10px; - display: block; - font-weight: bold; -} - -input, -textarea { - width: 100%; - padding: 8px; - margin-top: 4px; -} - -button { - margin-top: 20px; - padding: 10px 20px; - background: #0055ff; - color: #fff; - border: 0; - cursor: pointer; -} \ No newline at end of file diff --git a/app/templates/base.html b/app/templates/base.html index affe12d..9d20ef5 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -16,7 +16,9 @@ -