Merged pankaj-dev into main after resolving conflicts
This commit is contained in:
31
.env
31
.env
@@ -1,31 +0,0 @@
|
|||||||
# -----------------------------
|
|
||||||
# Flask App Configuration
|
|
||||||
# -----------------------------
|
|
||||||
FLASK_ENV=development
|
|
||||||
FLASK_DEBUG=True
|
|
||||||
FLASK_HOST=0.0.0.0
|
|
||||||
FLASK_PORT=5001
|
|
||||||
|
|
||||||
# -----------------------------
|
|
||||||
# Security
|
|
||||||
# -----------------------------
|
|
||||||
SECRET_KEY=change-this-to-strong-secret-key
|
|
||||||
|
|
||||||
# -----------------------------
|
|
||||||
# Database Configuration
|
|
||||||
# -----------------------------
|
|
||||||
DB_DIALECT=mysql
|
|
||||||
DB_DRIVER=pymysql
|
|
||||||
DB_HOST=127.0.0.1
|
|
||||||
DB_PORT=3306
|
|
||||||
DB_NAME=comparisondb
|
|
||||||
DB_USER=root
|
|
||||||
DB_PASSWORD=admin
|
|
||||||
|
|
||||||
# DATABASE_URL=mysql+pymysql://root:root@localhost/comparisondb
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -49,3 +49,4 @@ class ManholeDomesticChamber(db.Model):
|
|||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
return {c.name: getattr(self, c.name) for c in self.__table__.columns}
|
return {c.name: getattr(self, c.name) for c in self.__table__.columns}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,67 @@
|
|||||||
|
import matplotlib
|
||||||
|
matplotlib.use("Agg")
|
||||||
|
|
||||||
from flask import Blueprint, render_template, session, redirect, url_for
|
from flask import Blueprint, render_template, session, redirect, url_for
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import io
|
||||||
|
import base64
|
||||||
|
|
||||||
dashboard_bp = Blueprint("dashboard", __name__, url_prefix="/dashboard")
|
dashboard_bp = Blueprint("dashboard", __name__, url_prefix="/dashboard")
|
||||||
|
|
||||||
|
# charts
|
||||||
|
def plot_to_base64():
|
||||||
|
img = io.BytesIO()
|
||||||
|
plt.savefig(img, format="png", bbox_inches="tight")
|
||||||
|
plt.close()
|
||||||
|
img.seek(0)
|
||||||
|
return base64.b64encode(img.getvalue()).decode()
|
||||||
|
|
||||||
|
# bar chart
|
||||||
|
def bar_chart():
|
||||||
|
categories = ["Trench", "Manhole", "Pipe Laying", "Restoration"]
|
||||||
|
values = [120, 80, 150, 60]
|
||||||
|
|
||||||
|
plt.figure()
|
||||||
|
plt.bar(categories, values)
|
||||||
|
plt.title("Work Category Report")
|
||||||
|
plt.xlabel("Category")
|
||||||
|
plt.ylabel("Count")
|
||||||
|
|
||||||
|
return plot_to_base64()
|
||||||
|
|
||||||
|
# Pie chart
|
||||||
|
def pie_chart():
|
||||||
|
labels = ["Completed", "In Progress", "Pending"]
|
||||||
|
sizes = [65, 20, 15]
|
||||||
|
|
||||||
|
plt.figure()
|
||||||
|
plt.pie(sizes, labels=labels, autopct="%1.1f%%", startangle=140)
|
||||||
|
plt.title("Project Status")
|
||||||
|
|
||||||
|
return plot_to_base64()
|
||||||
|
|
||||||
|
# Histogram chart
|
||||||
|
def histogram_chart():
|
||||||
|
daily_work = [5, 10, 15, 20, 20, 25, 30, 35, 40, 45, 50]
|
||||||
|
|
||||||
|
plt.figure()
|
||||||
|
plt.hist(daily_work, bins=5)
|
||||||
|
plt.title("Daily Work Distribution")
|
||||||
|
plt.xlabel("Work Units")
|
||||||
|
plt.ylabel("Frequency")
|
||||||
|
|
||||||
|
return plot_to_base64()
|
||||||
|
|
||||||
|
# Dashboaed page
|
||||||
@dashboard_bp.route("/")
|
@dashboard_bp.route("/")
|
||||||
def dashboard():
|
def dashboard():
|
||||||
if not session.get("user_id"):
|
if not session.get("user_id"):
|
||||||
return redirect(url_for("auth.login"))
|
return redirect(url_for("auth.login"))
|
||||||
|
|
||||||
return render_template("dashboard.html", title="Dashboard")
|
return render_template(
|
||||||
|
"dashboard.html",
|
||||||
|
title="Dashboard",
|
||||||
|
bar_chart=bar_chart(),
|
||||||
|
pie_chart=pie_chart(),
|
||||||
|
histogram=histogram_chart()
|
||||||
|
)
|
||||||
|
|||||||
@@ -96,18 +96,18 @@ class FileService:
|
|||||||
if not location or not mh_no:
|
if not location or not mh_no:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
exists = TrenchExcavation.query.filter_by(
|
# exists = TrenchExcavation.query.filter_by(
|
||||||
subcontractor_id=subcontractor_id,
|
# subcontractor_id=subcontractor_id,
|
||||||
RA_Bill_No=RA_Bill_No,
|
# RA_Bill_No=RA_Bill_No,
|
||||||
Location=location,
|
# Location=location,
|
||||||
MH_NO=mh_no,
|
# MH_NO=mh_no,
|
||||||
).first()
|
# ).first()
|
||||||
|
|
||||||
if exists:
|
# if exists:
|
||||||
errors.append(
|
# errors.append(
|
||||||
f"Model-Tr.Ex. (Row {idx+1}): Duplicate → Location={location}, MH_NO={mh_no}"
|
# f"Model-Tr.Ex. (Row {idx+1}): Duplicate → Location={location}, MH_NO={mh_no}"
|
||||||
)
|
# )
|
||||||
continue
|
# continue
|
||||||
|
|
||||||
record_data = {}
|
record_data = {}
|
||||||
for col in df.columns:
|
for col in df.columns:
|
||||||
@@ -154,18 +154,18 @@ class FileService:
|
|||||||
if not location or not mh_no:
|
if not location or not mh_no:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
exists = ManholeExcavation.query.filter_by(
|
# exists = ManholeExcavation.query.filter_by(
|
||||||
subcontractor_id=subcontractor_id,
|
# subcontractor_id=subcontractor_id,
|
||||||
RA_Bill_No=RA_Bill_No,
|
# RA_Bill_No=RA_Bill_No,
|
||||||
Location=location,
|
# Location=location,
|
||||||
MH_NO=mh_no,
|
# MH_NO=mh_no,
|
||||||
).first()
|
# ).first()
|
||||||
|
|
||||||
if exists:
|
# if exists:
|
||||||
errors.append(
|
# errors.append(
|
||||||
f"Model-MH Ex. (Row {idx+1}): Duplicate → Location={location}, MH_NO={mh_no}"
|
# f"Model-MH Ex. (Row {idx+1}): Duplicate → Location={location}, MH_NO={mh_no}"
|
||||||
)
|
# )
|
||||||
continue
|
# continue
|
||||||
|
|
||||||
record_data = {}
|
record_data = {}
|
||||||
for col in df.columns:
|
for col in df.columns:
|
||||||
@@ -212,18 +212,18 @@ class FileService:
|
|||||||
if not location or not mh_no:
|
if not location or not mh_no:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
exists = ManholeDomesticChamber.query.filter_by(
|
# exists = ManholeDomesticChamber.query.filter_by(
|
||||||
subcontractor_id=subcontractor_id,
|
# subcontractor_id=subcontractor_id,
|
||||||
RA_Bill_No=RA_Bill_No,
|
# RA_Bill_No=RA_Bill_No,
|
||||||
Location=location,
|
# Location=location,
|
||||||
MH_NO=mh_no,
|
# MH_NO=mh_no,
|
||||||
).first()
|
# ).first()
|
||||||
|
|
||||||
if exists:
|
# if exists:
|
||||||
errors.append(
|
# errors.append(
|
||||||
f"Model-MH & DC (Row {idx+1}): Duplicate → Location={location}, MH_NO={mh_no}"
|
# f"Model-MH & DC (Row {idx+1}): Duplicate → Location={location}, MH_NO={mh_no}"
|
||||||
)
|
# )
|
||||||
continue
|
# continue
|
||||||
|
|
||||||
record_data = {}
|
record_data = {}
|
||||||
for col in df.columns:
|
for col in df.columns:
|
||||||
|
|||||||
@@ -40,10 +40,10 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<!-- Subcontractor -->
|
<!-- Subcontractor Model -->
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#">
|
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#">
|
||||||
<i class="bi bi-people-fill me-1"></i> Subcontractor
|
<i class="bi bi-people-fill me-1"></i> Subcontractor Model
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu dropdown-menu-dark">
|
<ul class="dropdown-menu dropdown-menu-dark">
|
||||||
<li>
|
<li>
|
||||||
@@ -59,10 +59,10 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<!-- File System -->
|
<!-- Subcontractor File System -->
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#">
|
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#">
|
||||||
<i class="bi bi-folder-fill me-1"></i> File System
|
<i class="bi bi-folder-fill me-1"></i>Subcontractor File System
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu dropdown-menu-dark">
|
<ul class="dropdown-menu dropdown-menu-dark">
|
||||||
<li>
|
<li>
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
<!-- Client System -->
|
<!-- Client System -->
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#">
|
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#">
|
||||||
<i class="bi bi-building me-1"></i> Client System
|
<i class="bi bi-building me-1"></i> Client File System
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu dropdown-menu-dark">
|
<ul class="dropdown-menu dropdown-menu-dark">
|
||||||
<li>
|
<li>
|
||||||
@@ -90,11 +90,6 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
|
||||||
<a class="dropdown-item" href="/report/comparison_report">
|
|
||||||
<i class="bi bi-arrow-left-right me-2"></i> client vs sub-cont. Comparison Report
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-item" href="/file/client_vs_subcont">
|
<a class="dropdown-item" href="/file/client_vs_subcont">
|
||||||
<i class="bi bi-arrow-left-right me-2"></i> Comparison Report
|
<i class="bi bi-arrow-left-right me-2"></i> Comparison Report
|
||||||
@@ -103,6 +98,27 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<!-- Reports -->
|
||||||
|
<li class="nav-item dropdown">
|
||||||
|
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#">
|
||||||
|
<i class="bi bi-building me-1"></i> Reports
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu dropdown-menu-dark">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a class="dropdown-item" href="/report/comparison_report">
|
||||||
|
<i class="bi bi-arrow-left-right me-2"></i> client vs sub-cont. Comparison Report
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<!-- <li>
|
||||||
|
<a class="dropdown-item" href="/file/client_vs_subcont">
|
||||||
|
<i class="bi bi-arrow-left-right me-2"></i> Comparison Report
|
||||||
|
</a>
|
||||||
|
</li> -->
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
<!-- Formats -->
|
<!-- Formats -->
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="/file_format">
|
<a class="nav-link" href="/file_format">
|
||||||
|
|||||||
@@ -1,10 +1,84 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2 class="mb-4">Dashboard</h2>
|
|
||||||
|
|
||||||
<div class="card p-4 shadow-sm">
|
<div class="container-fluid px-2 px-md-4">
|
||||||
<h5>Welcome to Comparison Project</h5>
|
|
||||||
<p>This is dashboard panel.</p>
|
<h4 class="mb-3 text-center text-md-start">Dashboard</h4>
|
||||||
|
|
||||||
|
<!-- Summary Cards -->
|
||||||
|
<div class="row g-3 mb-4">
|
||||||
|
|
||||||
|
<div class="col-12 col-md-4">
|
||||||
|
<div class="card text-white bg-primary shadow h-100">
|
||||||
|
<div class="card-body text-center text-md-start">
|
||||||
|
<h6>Total Work</h6>
|
||||||
|
<h3 class="fw-bold">410</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12 col-md-4">
|
||||||
|
<div class="card text-white bg-success shadow h-100">
|
||||||
|
<div class="card-body text-center text-md-start">
|
||||||
|
<h6>Completed</h6>
|
||||||
|
<h3 class="fw-bold">265</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12 col-md-4">
|
||||||
|
<div class="card text-dark bg-warning shadow h-100">
|
||||||
|
<div class="card-body text-center text-md-start">
|
||||||
|
<h6>Pending</h6>
|
||||||
|
<h3 class="fw-bold">145</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Charts -->
|
||||||
|
<div class="row g-3">
|
||||||
|
|
||||||
|
<!-- Bar Chart -->
|
||||||
|
<div class="col-12 col-md-6">
|
||||||
|
<div class="card shadow-sm h-100">
|
||||||
|
<div class="card-header bg-dark text-white text-center text-md-start">
|
||||||
|
Work Category Bar Chart
|
||||||
|
</div>
|
||||||
|
<div class="card-body text-center">
|
||||||
|
<img src="data:image/png;base64,{{ bar_chart }}" class="img-fluid" style="max-height:300px;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Pie Chart -->
|
||||||
|
<div class="col-12 col-md-6">
|
||||||
|
<div class="card shadow-sm h-100">
|
||||||
|
<div class="card-header bg-dark text-white text-center text-md-start">
|
||||||
|
Project Status Pie Chart
|
||||||
|
</div>
|
||||||
|
<div class="card-body text-center">
|
||||||
|
<img src="data:image/png;base64,{{ pie_chart }}" class="img-fluid" style="max-height:300px;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Histogram -->
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card shadow-sm">
|
||||||
|
<div class="card-header bg-dark text-white text-center text-md-start">
|
||||||
|
Daily Work Histogram
|
||||||
|
</div>
|
||||||
|
<div class="card-body text-center">
|
||||||
|
<img src="data:image/png;base64,{{ histogram }}" class="img-fluid" style="max-height:350px;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
Laxmi Civil Engineering Services Pvt Ltd
|
Laxmi Civil Engineering Services Pvt Ltd
|
||||||
</h4>
|
</h4>
|
||||||
<p class="text-muted mb-0">
|
<p class="text-muted mb-0">
|
||||||
Data Comparison System
|
Data Comparison Software Solapur(UGD)
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,13 @@
|
|||||||
|
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<div class="row mb-3 align-items-center">
|
<div class="row mb-3 align-items-center">
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6 ">
|
||||||
<h4 class="mb-2 mb-md-0 text-center text-md-start">
|
<h4 class="mb-2 mb-md-0 text-center text-md-start">
|
||||||
Subcontractor List
|
Subcontractor List
|
||||||
</h4>
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 col-md-6 text-center text-md-end">
|
<div class="col-12 col-md-3 text-center text-md-end">
|
||||||
<a href="/subcontractor/add" class="btn btn-success w-100 w-md-auto">
|
<a href="/subcontractor/add" class="btn btn-success w-100 w-md-auto">
|
||||||
➕ Add Subcontractor
|
➕ Add Subcontractor
|
||||||
</a>
|
</a>
|
||||||
@@ -65,8 +65,8 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
/tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
<!-- TOTAL ROW -->
|
<!-- TOTAL ROW -->
|
||||||
|
|||||||
@@ -6,3 +6,4 @@ Werkzeug
|
|||||||
python-dotenv
|
python-dotenv
|
||||||
cryptography
|
cryptography
|
||||||
xlsxwriter
|
xlsxwriter
|
||||||
|
matplotlib
|
||||||
|
|||||||
Reference in New Issue
Block a user