changes of rate model of sub-cont and there functions #22
@@ -36,7 +36,8 @@ The Comparison Project is designed to:
|
||||
|
||||
## Tech Stack
|
||||
|
||||
**Backend Framework**: Flask
|
||||
**Frontend Framework**: HTML, CSS, Js, Bootstrap
|
||||
**Backend Framework**: Python Flask
|
||||
**Database**: SQL Database (MySQL/PostgreSQL/SQLite configured via environment variables)
|
||||
**ORM**: SQLAlchemy
|
||||
**File Processing**: Pandas, OpenPyXL, XlsxWriter
|
||||
@@ -580,4 +581,4 @@ Open browser: `http://127.0.0.1:5000/`
|
||||
|
||||
For issues, feature requests, or contributions, please contact the development team.
|
||||
|
||||
**Last Updated:** January 2026
|
||||
**Last Updated:** April 2026
|
||||
@@ -4,7 +4,7 @@ from flask import (
|
||||
request,
|
||||
redirect,
|
||||
url_for,
|
||||
flash
|
||||
flash, jsonify
|
||||
)
|
||||
|
||||
from app.models.subcontractor_model import Subcontractor
|
||||
@@ -27,25 +27,7 @@ def engineering_master():
|
||||
title="Engineering Masters"
|
||||
)
|
||||
|
||||
|
||||
@engi_bp.route("/subcontractor-rate")
|
||||
def add_subcontractor_rates():
|
||||
subcontractors = Subcontractor.query.filter_by(status="Active").all()
|
||||
|
||||
if request.method == "POST":
|
||||
try:
|
||||
SubcontractorRateService.save_rate(request.form)
|
||||
flash(SuccessMessage.SAVE, "success")
|
||||
return redirect(url_for("engineering.add_subcontractor_rates"))
|
||||
except Exception as e:
|
||||
flash(ErrorMessage.INTERNAL_SERVER_ERROR, "danger")
|
||||
|
||||
return render_template(
|
||||
"engineering/add_rate.html",
|
||||
title="Subcontractor Rate Master",
|
||||
subcontractors=subcontractors
|
||||
)
|
||||
|
||||
# Client rate model
|
||||
@engi_bp.route("/client-rate")
|
||||
def client_rates():
|
||||
|
||||
@@ -54,3 +36,72 @@ def client_rates():
|
||||
title="Client Rate Master"
|
||||
)
|
||||
|
||||
@engi_bp.route("/subcontractor-rate", methods=["GET", "POST"])
|
||||
def add_subcontractor_rates():
|
||||
|
||||
subcontractors = Subcontractor.query.filter_by(status="Active").all()
|
||||
|
||||
if request.method == "POST":
|
||||
result = SubcontractorRateService.save_or_update(request.form)
|
||||
if result["success"]:
|
||||
flash(result["message"], "success")
|
||||
return redirect(url_for("engineering.add_subcontractor_rates"))
|
||||
else:
|
||||
flash(result["message"], "danger")
|
||||
|
||||
rates = SubcontractorRateService.get_all_rates()
|
||||
|
||||
return render_template(
|
||||
"engineering/contractor_rate.html",
|
||||
title="Subcontractor Rate Master",
|
||||
subcontractors=subcontractors,
|
||||
rates=rates
|
||||
)
|
||||
|
||||
@engi_bp.route("/subcontractor-rate/edit/<int:rate_id>", methods=["GET", "POST"])
|
||||
def edit_rate(rate_id):
|
||||
|
||||
subcontractors = Subcontractor.query.filter_by(status="Active").all()
|
||||
|
||||
if request.method == "POST":
|
||||
|
||||
result = SubcontractorRateService.save_or_update(request.form)
|
||||
|
||||
if result["success"]:
|
||||
flash(result["message"], "success")
|
||||
return redirect(url_for("engineering.add_subcontractor_rates"))
|
||||
|
||||
flash(result["message"], "danger")
|
||||
|
||||
rate = SubcontractorRateService.get_rate(rate_id)
|
||||
|
||||
rates = SubcontractorRateService.get_all_rates()
|
||||
|
||||
return render_template(
|
||||
"engineering/contractor_rate.html",
|
||||
subcontractors=subcontractors,
|
||||
rate=rate,
|
||||
rates=rates
|
||||
)
|
||||
|
||||
@engi_bp.route("/subcontractor-rate/delete/<int:rate_id>")
|
||||
def delete_rate(rate_id):
|
||||
SubcontractorRateService.delete_rate(rate_id)
|
||||
flash("Rate deleted successfully.", "success")
|
||||
return redirect(url_for("engineering.add_subcontractor_rates"))
|
||||
|
||||
|
||||
@engi_bp.route("/check-rate")
|
||||
def check_rate():
|
||||
|
||||
exists = SubcontractorRateService.check_duplicate(
|
||||
subcontractor_id=request.args.get("subcontractor_id"),
|
||||
category=request.args.get("category"),
|
||||
item_name=request.args.get("item_name"),
|
||||
rate_id=request.args.get("rate_id")
|
||||
)
|
||||
|
||||
return jsonify({
|
||||
"exists": exists
|
||||
})
|
||||
|
||||
|
||||
@@ -29,17 +29,24 @@ def add_action_columns(df, model_key):
|
||||
if df.empty:
|
||||
return df
|
||||
|
||||
df.insert(0, "Select", df["Id"].apply(
|
||||
# Edit + Delete side by side in one "Action" column, both as icon buttons.
|
||||
df.insert(0, "Action", df["Id"].apply(
|
||||
lambda x: (
|
||||
f'<div class="d-flex gap-1">'
|
||||
f'<a href="/file/edit/{model_key}/{x}" class="btn btn-sm btn-warning edit-btn" title="Edit">'
|
||||
f'<i class="bi bi-pencil-square"></i></a>'
|
||||
f'<button class="btn btn-sm btn-danger delete-btn" data-id="{x}" data-model="{model_key}" title="Delete">'
|
||||
f'<i class="bi bi-trash"></i></button>'
|
||||
f'</div>'
|
||||
)
|
||||
))
|
||||
|
||||
df.insert(1, "Select", df["Id"].apply(
|
||||
lambda x: f'<input type="checkbox" class="row-check" data-id="{x}">'
|
||||
))
|
||||
|
||||
df["Update"] = df["Id"].apply(
|
||||
lambda x: f'<a href="/file/edit/{model_key}/{x}" class="btn btn-sm btn-warning edit-btn"><i class="bi bi-pencil-square"></i> Edit</a>'
|
||||
)
|
||||
|
||||
df["Delete"] = df["Id"].apply(
|
||||
lambda x: f'<button class="btn btn-sm btn-danger delete-btn" data-id="{x}" data-model="{model_key}">Delete</button>'
|
||||
)
|
||||
df["Id"] = range(1, len(df) + 1)
|
||||
df = df.rename(columns={"Id": "Sr No"})
|
||||
|
||||
return df
|
||||
|
||||
@@ -236,6 +243,30 @@ def report_file():
|
||||
else:
|
||||
bill.Fetch(ra_bill_no,subcontractor_id,location)
|
||||
|
||||
|
||||
# ---------------------------------------------------------
|
||||
if (
|
||||
bill.df_tr.empty and
|
||||
bill.df_mh.empty and
|
||||
bill.df_dc.empty and
|
||||
bill.df_laying.empty
|
||||
):
|
||||
flash(
|
||||
f"No records found for RA Bill No '{ra_bill_no}'. "
|
||||
"Please check the RA Bill No and try again."
|
||||
if ra_bill_no else
|
||||
"No records found for the selected filters.",
|
||||
"warning"
|
||||
)
|
||||
return render_template(
|
||||
"subcontractor_report.html",
|
||||
subcontractors=subcontractors,
|
||||
selected_sc_id=selected_sc_id,
|
||||
selected_ra_bill=ra_bill_no,
|
||||
selected_location=location,
|
||||
selected_category=category
|
||||
)
|
||||
|
||||
# -----------------------------------------
|
||||
# Generate Abstract Report for Web
|
||||
# -----------------------------------------
|
||||
@@ -256,6 +287,32 @@ def report_file():
|
||||
bill.df_tr = bill.df_mh = bill.df_dc = pd.DataFrame()
|
||||
|
||||
|
||||
if (
|
||||
category in ("tr", "mh", "dc", "laying")
|
||||
and bill.df_tr.empty and bill.df_mh.empty
|
||||
and bill.df_dc.empty and bill.df_laying.empty
|
||||
):
|
||||
category_labels = {
|
||||
"tr": "Trench Excavation",
|
||||
"mh": "Manhole Excavation",
|
||||
"dc": "Domestic Chamber",
|
||||
"laying": "Pipe Laying",
|
||||
}
|
||||
flash(
|
||||
f"No {category_labels[category]} records found for the "
|
||||
"selected filters.",
|
||||
"warning"
|
||||
)
|
||||
return render_template(
|
||||
"subcontractor_report.html",
|
||||
subcontractors=subcontractors,
|
||||
selected_sc_id=selected_sc_id,
|
||||
selected_ra_bill=ra_bill_no,
|
||||
selected_location=location,
|
||||
selected_category=category
|
||||
)
|
||||
|
||||
|
||||
# ===================================================
|
||||
# DOWNLOAD EXCEL
|
||||
# ===================================================
|
||||
@@ -267,16 +324,46 @@ def report_file():
|
||||
abstract = AbstractReportService(subcontractor_id=subcontractor_id,ra_bill_no=ra_bill_no)
|
||||
abstract.generate(workbook)
|
||||
|
||||
bill.df_tr.to_excel(writer,sheet_name="Tr.Ex",index=False)
|
||||
bill.df_mh.to_excel(writer,sheet_name="Mh.Ex",index=False)
|
||||
bill.df_dc.to_excel(writer,sheet_name="MH & DC",index=False)
|
||||
bill.df_laying.to_excel(writer,sheet_name="Pipe Laying",index=False)
|
||||
|
||||
sheet_map = [
|
||||
(bill.df_tr, "Tr.Ex"),
|
||||
(bill.df_mh, "Mh.Ex"),
|
||||
(bill.df_dc, "MH & DC"),
|
||||
(bill.df_laying, "Pipe Laying"),
|
||||
]
|
||||
for df, sheet_name in sheet_map:
|
||||
if not df.empty:
|
||||
df.to_excel(writer, sheet_name=sheet_name, index=False)
|
||||
writer.close()
|
||||
output.seek(0)
|
||||
|
||||
|
||||
sc_obj = next(
|
||||
(s for s in subcontractors if str(s.id) == str(subcontractor_id)),
|
||||
None
|
||||
)
|
||||
sc_name = sc_obj.subcontractor_name if sc_obj else "Subcontractor"
|
||||
sc_name = re.sub(r'[^A-Za-z0-9_-]+', '_', sc_name).strip('_')
|
||||
|
||||
name_parts = [sc_name]
|
||||
|
||||
if ra_bill_no:
|
||||
name_parts.append(f"RA{re.sub(r'[^A-Za-z0-9_-]+', '_', ra_bill_no)}")
|
||||
|
||||
if location:
|
||||
name_parts.append(re.sub(r'[^A-Za-z0-9_-]+', '_', location).strip('_'))
|
||||
|
||||
if category and category != "all":
|
||||
name_parts.append(category.upper())
|
||||
|
||||
if action == "excel_all":
|
||||
name_parts.append("All")
|
||||
|
||||
filename = "_".join(name_parts) + "_Report.xlsx"
|
||||
|
||||
return send_file(
|
||||
output,
|
||||
download_name= "subcontractor_Report.xlsx",
|
||||
download_name=filename,
|
||||
as_attachment=True
|
||||
)
|
||||
|
||||
|
||||
@@ -1,28 +1,66 @@
|
||||
from app.services.db_service import db
|
||||
from app.models.subcontractor_rate_model import SubcontractorRate
|
||||
from sqlalchemy import func
|
||||
|
||||
|
||||
class SubcontractorRateService:
|
||||
|
||||
@staticmethod
|
||||
def save_rate(form):
|
||||
def save_or_update(form):
|
||||
|
||||
rate = SubcontractorRate(
|
||||
subcontractor_id=form.get("subcontractor_id"),
|
||||
category=form.get("category"),
|
||||
item_code=form.get("item_code"),
|
||||
item_name=form.get("item_name"),
|
||||
unit=form.get("unit"),
|
||||
rate=form.get("rate"),
|
||||
effective_from=form.get("effective_from"),
|
||||
effective_to=form.get("effective_to") or None,
|
||||
status=form.get("status")
|
||||
rate_id = form.get("id")
|
||||
|
||||
subcontractor_id = form.get("subcontractor_id")
|
||||
category = form.get("category")
|
||||
item_name = form.get("item_name").strip()
|
||||
|
||||
# -----------------------------
|
||||
# Duplicate Validation
|
||||
# -----------------------------
|
||||
duplicate = (
|
||||
SubcontractorRate.query
|
||||
.filter(
|
||||
SubcontractorRate.subcontractor_id == subcontractor_id,
|
||||
SubcontractorRate.category == category,
|
||||
func.lower(SubcontractorRate.item_name) == item_name.lower()
|
||||
)
|
||||
.first()
|
||||
)
|
||||
|
||||
db.session.add(rate)
|
||||
db.session.commit()
|
||||
return rate
|
||||
# Ignore current record while editing
|
||||
if duplicate and (not rate_id or duplicate.id != int(rate_id)):
|
||||
return {
|
||||
"success": False,
|
||||
"message": "Category and Rate already exists for this Subcontractor."
|
||||
}
|
||||
|
||||
# -----------------------------
|
||||
# Insert / Update
|
||||
# -----------------------------
|
||||
if rate_id:
|
||||
rate = SubcontractorRate.query.get_or_404(rate_id)
|
||||
else:
|
||||
rate = SubcontractorRate()
|
||||
|
||||
rate.subcontractor_id = subcontractor_id
|
||||
rate.category = category
|
||||
rate.item_code = form.get("item_code")
|
||||
rate.item_name = item_name
|
||||
rate.unit = form.get("unit")
|
||||
rate.rate = form.get("rate")
|
||||
rate.effective_from = form.get("effective_from")
|
||||
rate.effective_to = form.get("effective_to") or None
|
||||
rate.status = form.get("status")
|
||||
|
||||
if not rate_id:
|
||||
db.session.add(rate)
|
||||
|
||||
db.session.commit()
|
||||
|
||||
return {
|
||||
"success": True,
|
||||
"message": "Saved Successfully."
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def get_all_rates():
|
||||
@@ -32,34 +70,33 @@ class SubcontractorRateService:
|
||||
.order_by(SubcontractorRate.created_at.desc())
|
||||
.all()
|
||||
)
|
||||
|
||||
|
||||
@staticmethod
|
||||
def get_rate(rate_id):
|
||||
|
||||
return SubcontractorRate.query.get_or_404(rate_id)
|
||||
|
||||
@staticmethod
|
||||
def update_rate(rate_id, form):
|
||||
|
||||
rate = SubcontractorRate.query.get_or_404(rate_id)
|
||||
|
||||
rate.subcontractor_id = form.get("subcontractor_id")
|
||||
rate.category = form.get("category")
|
||||
rate.item_code = form.get("item_code")
|
||||
rate.item_name = form.get("item_name")
|
||||
rate.unit = form.get("unit")
|
||||
rate.rate = form.get("rate")
|
||||
rate.effective_from = form.get("effective_from")
|
||||
rate.effective_to = form.get("effective_to") or None
|
||||
rate.status = form.get("status")
|
||||
|
||||
db.session.commit()
|
||||
return rate
|
||||
|
||||
@staticmethod
|
||||
def delete_rate(rate_id):
|
||||
|
||||
rate = SubcontractorRate.query.get_or_404(rate_id)
|
||||
|
||||
db.session.delete(rate)
|
||||
|
||||
db.session.commit()
|
||||
|
||||
|
||||
@staticmethod
|
||||
def check_duplicate(subcontractor_id, category, item_name, rate_id=None):
|
||||
|
||||
query = SubcontractorRate.query.filter(
|
||||
SubcontractorRate.subcontractor_id == subcontractor_id,
|
||||
SubcontractorRate.category == category,
|
||||
func.lower(SubcontractorRate.item_name) == item_name.strip().lower()
|
||||
)
|
||||
|
||||
if rate_id:
|
||||
query = query.filter(SubcontractorRate.id != int(rate_id))
|
||||
|
||||
return query.first() is not None
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -124,10 +124,21 @@
|
||||
<i class="bi bi-arrow-left-right me-2"></i> Client vs Subcontractor
|
||||
</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 -->
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/file_format">
|
||||
<i class="bi bi-file-earmark-text me-1"></i> Formats
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<!-- Masters -->
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="/engi">
|
||||
@@ -160,29 +171,26 @@
|
||||
|
||||
|
||||
<!-- USER DROPDOWN -->
|
||||
<li class="nav-item dropdown">
|
||||
{% if session.get("user_id") %}
|
||||
<li class="nav-item dropdown ms-lg-3">
|
||||
|
||||
<a class="nav-link dropdown-toggle d-flex align-items-center text-white"
|
||||
href="#" id="profileDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
|
||||
<i class="bi bi-person-circle fs-4"></i>
|
||||
<span class="ms-2 fw-semibold">
|
||||
<a class="nav-link dropdown-toggle d-flex align-items-center gap-2" href="#"
|
||||
data-bs-toggle="dropdown">
|
||||
<i class="bi bi-person-circle fs-5"></i>
|
||||
<span class="d-none d-lg-inline">
|
||||
{{ session.get("user_name") }}
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<ul class="dropdown-menu dropdown-menu-end dropdown-menu-dark border-0 shadow-lg bg-dark p-0"
|
||||
style="width:320px;">
|
||||
<ul class="dropdown-menu dropdown-menu-end dropdown-menu-dark shadow">
|
||||
|
||||
<!-- Profile Header -->
|
||||
<li class="text-center py-4 border-bottom border-secondary">
|
||||
<i class="bi bi-person-circle text-light" style="font-size:60px;"></i>
|
||||
<h5 class="mt-2 mb-0 fw-bold">
|
||||
<!-- User card -->
|
||||
<li class="px-3 py-3 text-center border-bottom">
|
||||
<i class="bi bi-person-circle fs-1"></i>
|
||||
<div class="fw-semibold mt-1">
|
||||
{{ session.get("user_name") }}
|
||||
</h5>
|
||||
<small class="text-secondary">
|
||||
{{ session.get("email") }}
|
||||
</small>
|
||||
</div>
|
||||
<small class="text-muted">Logged in user</small>
|
||||
</li>
|
||||
|
||||
<!-- Dashboard -->
|
||||
@@ -191,8 +199,6 @@
|
||||
<i class="bi bi-speedometer2 me-2"></i> Dashboard
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<!-- Activity Log page -->
|
||||
<li>
|
||||
<a class="dropdown-item text-light py-2" href="{{ url_for('activity.activity') }}">
|
||||
<i class="bi bi-clock-history me-2"></i> Activity Log
|
||||
@@ -210,23 +216,14 @@
|
||||
|
||||
<!-- Logout Account -->
|
||||
<li>
|
||||
<a class="dropdown-item text-warning py-2" href="{{ url_for('auth.logout') }}">
|
||||
<i class="bi bi-box-arrow-right me-2"></i>
|
||||
Logout
|
||||
<a class="dropdown-item text-warning" href="/logout">
|
||||
<i class="bi bi-box-arrow-right me-2"></i> Logout
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<!-- Footer -->
|
||||
<li class="text-center py-3 bg-secondary bg-opacity-10 border-top border-secondary">
|
||||
<small class="text-light">
|
||||
<i class="bi bi-shield-check text-success"></i>
|
||||
Secured by <strong>LCEPL</strong>
|
||||
</small>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
@@ -379,6 +376,7 @@
|
||||
|
||||
showLoader();
|
||||
const btn = this.querySelector("button[type='submit']");
|
||||
const originalBtnHtml = btn ? btn.innerHTML : null;
|
||||
|
||||
if(btn){
|
||||
btn.disabled = true;
|
||||
@@ -388,10 +386,24 @@
|
||||
`;
|
||||
}
|
||||
|
||||
|
||||
setTimeout(function () {
|
||||
hideLoader();
|
||||
if (btn) {
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = originalBtnHtml;
|
||||
}
|
||||
}, 3000);
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
window.addEventListener("pageshow", function () {
|
||||
hideLoader();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -31,6 +31,24 @@
|
||||
type="button">Tr.Ex </button>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<<<<<<< HEAD
|
||||
<button class="nav-link" id="mh-tab" data-bs-toggle="tab" data-bs-target="#mh" type="button">Mh.Ex
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<button class="nav-link" id="dc-tab" data-bs-toggle="tab" data-bs-target="#dc" type="button">MH & DC
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<<<<<<< HEAD
|
||||
<button class="nav-link" id="laying-tab" data-bs-toggle="tab" data-bs-target="#laying"
|
||||
type="button">Laying
|
||||
& Bedding Comparison</button>
|
||||
=======
|
||||
<button class="nav-link" id="laying-tab" data-bs-toggle="tab" data-bs-target="#laying" type="button">Laying
|
||||
& Bedding </button>
|
||||
>>>>>>> 1dceb640bd930c37888799f10f02fe90b219be67
|
||||
=======
|
||||
<button class="nav-link" id="mh-tab" data-bs-toggle="tab" data-bs-target="#mh" type="button">
|
||||
Mh.Ex</button>
|
||||
</li>
|
||||
@@ -41,6 +59,7 @@
|
||||
<li class="nav-item">
|
||||
<button class="nav-link" id="laying-tab" data-bs-toggle="tab" data-bs-target="#laying"type="button">
|
||||
Laying & Bedding </button>
|
||||
>>>>>>> pankaj-dev
|
||||
</ul>
|
||||
|
||||
<div class="tab-content mt-3" id="reportTabsContent">
|
||||
|
||||
@@ -1,236 +0,0 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<div class="container-fluid mt-4">
|
||||
|
||||
<div class="card shadow">
|
||||
|
||||
<div class="card-header bg-primary text-white">
|
||||
<h4 class="mb-0">
|
||||
<i class="bi bi-currency-rupee"></i>
|
||||
Subcontractor Rate Master
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<form method="POST">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<!-- Subcontractor -->
|
||||
<div class="col-md-4 mb-3">
|
||||
<label class="form-label fw-bold">
|
||||
Subcontractor
|
||||
</label>
|
||||
|
||||
<select name="subcontractor_id"
|
||||
class="form-select"
|
||||
required>
|
||||
|
||||
<option value="">
|
||||
Select Subcontractor
|
||||
</option>
|
||||
|
||||
{% for sub in subcontractors %}
|
||||
<option value="{{ sub.id }}">
|
||||
{{ sub.subcontractor_name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Category -->
|
||||
<div class="col-md-4 mb-3">
|
||||
|
||||
<label class="form-label fw-bold">
|
||||
Category
|
||||
</label>
|
||||
|
||||
<select name="category"
|
||||
class="form-select"
|
||||
required>
|
||||
|
||||
<option value="">
|
||||
Select Category
|
||||
</option>
|
||||
|
||||
<option value="TR_EX">
|
||||
Trench Excavation
|
||||
</option>
|
||||
|
||||
<option value="MH_EX">
|
||||
Manhole Excavation
|
||||
</option>
|
||||
|
||||
<option value="MH_DC">
|
||||
Manhole & Domestic Chamber
|
||||
</option>
|
||||
|
||||
<option value="LAYING">
|
||||
Pipe Laying
|
||||
</option>
|
||||
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Status -->
|
||||
<div class="col-md-4 mb-3">
|
||||
|
||||
<label class="form-label fw-bold">
|
||||
Status
|
||||
</label>
|
||||
|
||||
<select name="status"
|
||||
class="form-select">
|
||||
|
||||
<option value="Active">
|
||||
Active
|
||||
</option>
|
||||
|
||||
<option value="Inactive">
|
||||
Inactive
|
||||
</option>
|
||||
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<!-- Item Code -->
|
||||
<div class="col-md-3 mb-3">
|
||||
|
||||
<label class="form-label fw-bold">
|
||||
Item Code
|
||||
</label>
|
||||
|
||||
<input type="text"
|
||||
name="item_code"
|
||||
class="form-control"
|
||||
placeholder="SM01"
|
||||
required>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Item Name -->
|
||||
<div class="col-md-5 mb-3">
|
||||
|
||||
<label class="form-label fw-bold">
|
||||
Item Name
|
||||
</label>
|
||||
|
||||
<input type="text"
|
||||
name="item_name"
|
||||
class="form-control"
|
||||
placeholder="Soft Murum 0-1.5"
|
||||
required>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Unit -->
|
||||
<div class="col-md-2 mb-3">
|
||||
|
||||
<label class="form-label fw-bold">
|
||||
Unit
|
||||
</label>
|
||||
|
||||
<select name="unit"
|
||||
class="form-select">
|
||||
|
||||
<option value="Cum">Cum</option>
|
||||
<option value="Nos">Nos</option>
|
||||
<option value="Rmt">Rmt</option>
|
||||
<option value="Sqm">Sqm</option>
|
||||
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Rate -->
|
||||
<div class="col-md-2 mb-3">
|
||||
|
||||
<label class="form-label fw-bold">
|
||||
Rate (₹)
|
||||
</label>
|
||||
|
||||
<input type="number"
|
||||
step="0.01"
|
||||
min="0"
|
||||
name="rate"
|
||||
class="form-control"
|
||||
placeholder="0.00"
|
||||
required>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<!-- Effective From -->
|
||||
<div class="col-md-3 mb-3">
|
||||
|
||||
<label class="form-label fw-bold">
|
||||
Effective From
|
||||
</label>
|
||||
|
||||
<input type="date"
|
||||
name="effective_from"
|
||||
class="form-control"
|
||||
required>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Effective To -->
|
||||
<div class="col-md-3 mb-3">
|
||||
|
||||
<label class="form-label fw-bold">
|
||||
Effective To
|
||||
</label>
|
||||
|
||||
<input type="date"
|
||||
name="effective_to"
|
||||
class="form-control">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="text-end">
|
||||
|
||||
<button type="reset"
|
||||
class="btn btn-secondary">
|
||||
|
||||
<i class="bi bi-arrow-clockwise"></i>
|
||||
|
||||
Reset
|
||||
|
||||
</button>
|
||||
|
||||
<button type="submit"
|
||||
class="btn btn-success">
|
||||
|
||||
<i class="bi bi-check-circle"></i>
|
||||
|
||||
Save Rate
|
||||
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
20
app/templates/engineering/client_rate.html
Normal file
20
app/templates/engineering/client_rate.html
Normal file
@@ -0,0 +1,20 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
|
||||
<div class="container-fluid mt-4">
|
||||
|
||||
<div class="card shadow">
|
||||
|
||||
<div class="card-header bg-primary text-white d-flex justify-content-between align-items-center">
|
||||
|
||||
<h4 class="mb-0">
|
||||
<i class="bi bi-currency-rupee"></i>
|
||||
Client Rate Master
|
||||
</h4>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
384
app/templates/engineering/contractor_rate.html
Normal file
384
app/templates/engineering/contractor_rate.html
Normal file
@@ -0,0 +1,384 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
|
||||
<div class="container-fluid mt-4">
|
||||
|
||||
<div class="card shadow">
|
||||
|
||||
<div class="card-header bg-primary text-white d-flex justify-content-between align-items-center">
|
||||
|
||||
<h4 class="mb-0">
|
||||
<i class="bi bi-currency-rupee"></i>
|
||||
Subcontractor Rate Master
|
||||
</h4>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<form method="POST" id="rateForm">
|
||||
|
||||
<!-- Hidden ID -->
|
||||
<input type="hidden" id="rate_id" name="id" value="{{ rate.id if rate else '' }}">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<!-- Subcontractor -->
|
||||
<div class="col-md-4 mb-3">
|
||||
<label class="form-label fw-bold"> Subcontractor </label>
|
||||
<select id="subcontractor_id" name="subcontractor_id" class="form-select" required>
|
||||
<option value="">-- Select Subcontractor --</option>
|
||||
{% for sub in subcontractors %}
|
||||
<option value="{{ sub.id }}"
|
||||
{% if rate and rate.subcontractor_id==sub.id %}
|
||||
selected
|
||||
{% endif %}>
|
||||
{{ sub.subcontractor_name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Category -->
|
||||
<div class="col-md-4 mb-3">
|
||||
<label class="form-label fw-bold"> Category </label>
|
||||
<select id="category" name="category" class="form-select" required>
|
||||
<option value="">-- Select Category --</option>
|
||||
|
||||
<option value="trench_excavation"
|
||||
{% if rate and rate.category=="trench_excavation" %}selected{% endif %}>
|
||||
Trench Excavation
|
||||
</option>
|
||||
<option value="manhole_excavation"
|
||||
{% if rate and rate.category=="manhole_excavation" %}selected{% endif %}>
|
||||
Manhole Excavation
|
||||
</option>
|
||||
|
||||
<option value="Manhole_Domestic_Chamber"
|
||||
{% if rate and rate.category=="Manhole_Domestic_Chamber" %}selected{% endif %}>
|
||||
MH & Domestic Chamber
|
||||
</option>
|
||||
|
||||
<option value="Laying"
|
||||
{% if rate and rate.category=="Laying" %}selected{% endif %}>
|
||||
Pipe Laying
|
||||
</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Status -->
|
||||
<div class="col-md-4 mb-3">
|
||||
<label class="form-label fw-bold"> Status </label>
|
||||
|
||||
<select name="status" class="form-select">
|
||||
<option value="Active"
|
||||
{% if not rate or rate.status=="Active" %}selected{% endif %}>
|
||||
Active
|
||||
</option>
|
||||
|
||||
<option value="Inactive"
|
||||
{% if rate and rate.status=="Inactive" %}selected{% endif %}>
|
||||
Inactive
|
||||
</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<!-- Item Code -->
|
||||
<div class="col-md-3 mb-3">
|
||||
<label class="form-label fw-bold"> Item Code </label>
|
||||
<input type="text" name="item_code" class="form-control" value="{{ rate.item_code if rate else '' }}" required>
|
||||
</div>
|
||||
|
||||
<!-- Item Name -->
|
||||
<div class="col-md-5 mb-3">
|
||||
<label class="form-label fw-bold"> Item Name </label>
|
||||
<input type="text"
|
||||
id="item_name"
|
||||
name="item_name"
|
||||
class="form-control"
|
||||
autocomplete="off"
|
||||
value="{{ rate.item_name if rate else '' }}"
|
||||
required>
|
||||
|
||||
<small id="duplicateMessage"
|
||||
class="text-danger"
|
||||
style="display:none;">
|
||||
</small>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Unit -->
|
||||
<div class="col-md-2 mb-3">
|
||||
<label class="form-label fw-bold">Unit</label>
|
||||
<select name="unit" class="form-select">
|
||||
<option value="Cum"
|
||||
{% if not rate or rate.unit=="Cum" %}selected{% endif %}>
|
||||
Cum
|
||||
</option>
|
||||
<option value="Nos"
|
||||
{% if rate and rate.unit=="Nos" %}selected{% endif %}>
|
||||
Nos
|
||||
</option>
|
||||
<option value="Rmt"
|
||||
{% if rate and rate.unit=="Rmt" %}selected{% endif %}>
|
||||
Rmt
|
||||
</option>
|
||||
<option value="Sqm"
|
||||
{% if rate and rate.unit=="Sqm" %}selected{% endif %}>
|
||||
Sqm
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Rate -->
|
||||
<div class="col-md-2 mb-3">
|
||||
<label class="form-label fw-bold">Rate</label>
|
||||
<input type="number" step="0.01" name="rate" class="form-control" value="{{ rate.rate if rate else '' }}" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3 mb-3">
|
||||
<label class="form-label fw-bold"> Effective From </label>
|
||||
<input type="date" name="effective_from" class="form-control" value="{{ rate.effective_from if rate else '' }}" required>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 mb-3">
|
||||
<label class="form-label fw-bold"> Effective To </label>
|
||||
<input type="date" name="effective_to" class="form-control" value="{{ rate.effective_to if rate else '' }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="text-end">
|
||||
<a href="{{ url_for('engineering.add_subcontractor_rates') }}" class="btn btn-secondary">
|
||||
<i class="bi bi-arrow-clockwise"></i> Reset
|
||||
</a>
|
||||
|
||||
<button type="submit" id="saveBtn" class="btn btn-success">
|
||||
{% if rate %}
|
||||
<i class="bi bi-pencil-square"></i>
|
||||
Update Rate
|
||||
{% else %}
|
||||
<i class="bi bi-check-circle"></i>
|
||||
Save Rate
|
||||
{% endif %}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Table -->
|
||||
<div class="card shadow mt-4">
|
||||
<div class="card-header bg-dark text-white">
|
||||
<h5 class="mb-0">
|
||||
<i class="bi bi-table"></i>Rate List
|
||||
</h5>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<table class="table table-bordered table-hover table-striped" id="rateTable">
|
||||
<thead class="table-primary">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Subcontractor</th>
|
||||
<th>Category</th>
|
||||
<th>Item Code</th>
|
||||
<th>Item Name</th>
|
||||
<th>Unit</th>
|
||||
<th>Rate</th>
|
||||
<th>Status</th>
|
||||
<th width="130">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{% for row in rates %}
|
||||
<tr>
|
||||
<td>{{ loop.index }}</td>
|
||||
<td>{{ row.subcontractor.subcontractor_name }}</td>
|
||||
<td>{{ row.category }}</td>
|
||||
<td>{{ row.item_code }}</td>
|
||||
<td>{{ row.item_name }}</td>
|
||||
<td>{{ row.unit }}</td>
|
||||
<td>{{ row.rate }}</td>
|
||||
<td>
|
||||
{% if row.status=="Active" %}
|
||||
<span class="badge bg-success">
|
||||
Active
|
||||
</span>
|
||||
{% else %}
|
||||
<span class="badge bg-danger">
|
||||
Inactive
|
||||
</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<a href="{{ url_for('engineering.edit_rate', rate_id=row.id) }}" class="btn btn-warning btn-sm">
|
||||
<i class="bi bi-pencil-square"></i>
|
||||
</a>
|
||||
|
||||
<a href="{{ url_for('engineering.delete_rate', rate_id=row.id) }}"
|
||||
class="btn btn-danger btn-sm" onclick="return confirm('Delete this Item:{{row.item_name}} & Rate:{{row.rate}} ?')">
|
||||
<i class="bi bi-trash"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
// ----------------------------
|
||||
// DataTable
|
||||
// ----------------------------
|
||||
$("#rateTable").DataTable({
|
||||
responsive: true,
|
||||
pageLength: 10,
|
||||
destroy: true
|
||||
});
|
||||
|
||||
// ----------------------------
|
||||
// Validate on field change
|
||||
// ----------------------------
|
||||
$("#subcontractor_id, #category").on("change", function () {
|
||||
clearValidation();
|
||||
checkDuplicateRate();
|
||||
|
||||
});
|
||||
|
||||
// ----------------------------
|
||||
// Validate while typing
|
||||
// ----------------------------
|
||||
let timer;
|
||||
|
||||
$("#item_name").on("keyup input", function () {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function () {
|
||||
checkDuplicateRate();
|
||||
}, 300);
|
||||
|
||||
});
|
||||
|
||||
// Edit Mode
|
||||
checkDuplicateRate();
|
||||
|
||||
// ----------------------------
|
||||
// Prevent Submit
|
||||
// ----------------------------
|
||||
$("#rateForm").submit(function (e) {
|
||||
|
||||
if ($("#saveBtn").prop("disabled")) {
|
||||
e.preventDefault();
|
||||
$("#item_name").focus();
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
//=========================================
|
||||
// Reset Validation
|
||||
//=========================================
|
||||
function clearValidation() {
|
||||
$("#duplicateMessage")
|
||||
.hide()
|
||||
.text("")
|
||||
.removeClass("text-success text-danger");
|
||||
|
||||
$("#item_name")
|
||||
.removeClass("is-valid is-invalid");
|
||||
$("#saveBtn").prop("disabled", false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=========================================
|
||||
// Duplicate Validation
|
||||
//=========================================
|
||||
function checkDuplicateRate() {
|
||||
let subcontractor = $("#subcontractor_id").val();
|
||||
let category = $("#category").val();
|
||||
let item_name = $("#item_name").val().trim();
|
||||
let rate_id = $("#rate_id").val();
|
||||
|
||||
// Mandatory fields
|
||||
if (
|
||||
subcontractor == "" ||
|
||||
category == "" ||
|
||||
item_name.length < 2
|
||||
) {
|
||||
clearValidation();
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
|
||||
url: "{{ url_for('engineering.check_rate') }}",
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
data: {
|
||||
subcontractor_id: subcontractor,
|
||||
category: category,
|
||||
item_name: item_name,
|
||||
rate_id: rate_id
|
||||
},
|
||||
|
||||
success: function (response) {
|
||||
if (response.exists) {
|
||||
$("#duplicateMessage")
|
||||
.text("This Item Name already exists for the selected Subcontractor and Category.")
|
||||
.removeClass("text-success")
|
||||
.addClass("text-danger")
|
||||
.show();
|
||||
|
||||
$("#item_name")
|
||||
.removeClass("is-valid")
|
||||
.addClass("is-invalid");
|
||||
|
||||
$("#saveBtn").prop("disabled", true);
|
||||
|
||||
}
|
||||
else {
|
||||
$("#duplicateMessage")
|
||||
.text("Item Name is available.")
|
||||
.removeClass("text-danger")
|
||||
.addClass("text-success")
|
||||
.show();
|
||||
|
||||
$("#item_name")
|
||||
.removeClass("is-invalid")
|
||||
.addClass("is-valid");
|
||||
|
||||
$("#saveBtn").prop("disabled", false);
|
||||
}
|
||||
},
|
||||
|
||||
error: function () {
|
||||
clearValidation();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
@@ -88,7 +88,7 @@
|
||||
|
||||
<option value="dc"
|
||||
{% if request.form.get('category')=='dc' %}selected{% endif %}>
|
||||
Manhole Domestic Chamber
|
||||
Domestic Chamber
|
||||
</option>
|
||||
|
||||
<option value="laying"
|
||||
@@ -155,51 +155,61 @@
|
||||
</div>
|
||||
|
||||
{% if tables %}
|
||||
{% set show_all = (not selected_category) or selected_category == 'all' %}
|
||||
<!-- Tabs -->
|
||||
<div class="card shadow-sm border-0 mt-4">
|
||||
<div class="card-header bg-light">
|
||||
<ul class="nav nav-pills">
|
||||
<li class="nav-item">
|
||||
<button class="nav-link active" data-bs-toggle="tab" data-bs-target="#abstract">
|
||||
<button class="nav-link {% if show_all %}active{% endif %}" data-bs-toggle="tab" data-bs-target="#abstract">
|
||||
<i class="bi bi-file-earmark-text"></i> Abstract
|
||||
</button>
|
||||
</li>
|
||||
|
||||
{% if show_all or selected_category == 'tr' %}
|
||||
<li class="nav-item">
|
||||
<button class="nav-link " data-bs-toggle="tab" data-bs-target="#tr">
|
||||
<button class="nav-link {% if selected_category == 'tr' %}active{% endif %}" data-bs-toggle="tab" data-bs-target="#tr">
|
||||
<i class="bi bi-cone-striped"></i> Trench Excavation
|
||||
</button>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if show_all or selected_category == 'mh' %}
|
||||
<li class="nav-item">
|
||||
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#mh">
|
||||
<button class="nav-link {% if selected_category == 'mh' %}active{% endif %}" data-bs-toggle="tab" data-bs-target="#mh">
|
||||
<i class="bi bi-nut"></i> Manhole Excavation
|
||||
</button>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if show_all or selected_category == 'dc' %}
|
||||
<li class="nav-item">
|
||||
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#dc">
|
||||
<button class="nav-link {% if selected_category == 'dc' %}active{% endif %}" data-bs-toggle="tab" data-bs-target="#dc">
|
||||
<i class="bi bi-grid-3x3"></i> Manhole & Domestic Chambers Construction
|
||||
</button>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if show_all or selected_category == 'laying' %}
|
||||
<li class="nav-item">
|
||||
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#laying">
|
||||
<button class="nav-link {% if selected_category == 'laying' %}active{% endif %}" data-bs-toggle="tab" data-bs-target="#laying">
|
||||
<i class="bi bi-bezier2"></i> Pipe Laying
|
||||
</button>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="abstract">
|
||||
<div class="tab-pane fade {% if show_all %}show active{% endif %}" id="abstract">
|
||||
{{ abstract_html|safe }}
|
||||
</div>
|
||||
|
||||
{% if show_all or selected_category == 'tr' %}
|
||||
<!-- Trench -->
|
||||
<div class="tab-pane fade "id="tr">
|
||||
<div class="tab-pane fade {% if selected_category == 'tr' %}show active{% endif %}" id="tr">
|
||||
<div class="mb-3">
|
||||
<button onclick="deleteSelected('tr')" class="btn btn-danger">
|
||||
<i class="bi bi-trash"></i> Delete Selected
|
||||
@@ -209,9 +219,11 @@
|
||||
{{ tables.tr|safe }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if show_all or selected_category == 'mh' %}
|
||||
<!-- MH -->
|
||||
<div class="tab-pane fade" id="mh">
|
||||
<div class="tab-pane fade {% if selected_category == 'mh' %}show active{% endif %}" id="mh">
|
||||
<div class="mb-3">
|
||||
<button onclick="deleteSelected('mh')" class="btn btn-danger">
|
||||
<i class="bi bi-trash"></i>Delete Selected
|
||||
@@ -221,9 +233,11 @@
|
||||
{{ tables.mh|safe }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if show_all or selected_category == 'dc' %}
|
||||
<!-- DC -->
|
||||
<div class="tab-pane fade" id="dc">
|
||||
<div class="tab-pane fade {% if selected_category == 'dc' %}show active{% endif %}" id="dc">
|
||||
<div class="mb-3">
|
||||
<button onclick="deleteSelected('dc')"class="btn btn-danger">
|
||||
<i class="bi bi-trash"></i>
|
||||
@@ -234,9 +248,11 @@
|
||||
{{ tables.dc|safe }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if show_all or selected_category == 'laying' %}
|
||||
<!-- Laying -->
|
||||
<div class="tab-pane fade" id="laying">
|
||||
<div class="tab-pane fade {% if selected_category == 'laying' %}show active{% endif %}" id="laying">
|
||||
<div class="mb-3">
|
||||
<button onclick="deleteSelected('laying')"
|
||||
class="btn btn-danger">
|
||||
@@ -248,6 +264,7 @@
|
||||
{{ tables.laying|safe }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -256,31 +273,45 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Reset
|
||||
document.getElementById("resetBtn").addEventListener("click", function () {location.reload();});
|
||||
|
||||
document.getElementById("resetBtn").addEventListener("click", function () {
|
||||
window.location.href = window.location.pathname;
|
||||
});
|
||||
|
||||
// DATATABLE
|
||||
$(document).ready(function () {
|
||||
$('.datatable').DataTable({
|
||||
|
||||
$('.datatable').each(function () {
|
||||
$(this).DataTable({
|
||||
pageLength: 10,
|
||||
dom: 'Bfrtip',
|
||||
buttons: ['copy', 'csv', 'excel', 'print']
|
||||
buttons: ['copy', 'csv', 'excel', 'print'],
|
||||
initComplete: function () {
|
||||
|
||||
$(this).closest('.dataTables_wrapper')
|
||||
.find('thead tr th:first-child')
|
||||
.html('<input type="checkbox" class="select-all" title="Select All">');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
$("table thead tr th:first-child").html('<input type="checkbox" id="select-all">');
|
||||
}, 500);
|
||||
// SELECT ALL — scoped to the checkbox's own table only
|
||||
$(document).on("change", ".select-all", function () {
|
||||
$(this).closest("table").find(".row-check").prop("checked", this.checked);
|
||||
});
|
||||
|
||||
// SELECT ALL
|
||||
$(document).on("change", "#select-all", function () {
|
||||
$(".row-check").prop("checked", this.checked);
|
||||
// If a row checkbox is unchecked manually, uncheck that table's select-all
|
||||
$(document).on("change", ".row-check", function () {
|
||||
if (!this.checked) {
|
||||
$(this).closest("table").find(".select-all").prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
// GET IDS
|
||||
function getSelectedIds() {
|
||||
|
||||
function getSelectedIds(model) {
|
||||
let ids = [];
|
||||
$(".row-check:checked").each(function () {
|
||||
$("#" + model + " .row-check:checked").each(function () {
|
||||
ids.push($(this).data("id"));
|
||||
});
|
||||
return ids;
|
||||
@@ -288,7 +319,7 @@
|
||||
|
||||
// BULK DELETE
|
||||
function deleteSelected(model) {
|
||||
let ids = getSelectedIds();
|
||||
let ids = getSelectedIds(model);
|
||||
if (ids.length === 0) return alert("Select records");
|
||||
|
||||
if (!confirm(`Delete ${ids.length} record(s)?`)) return;
|
||||
|
||||
121
logs/app.log
121
logs/app.log
@@ -0,0 +1,121 @@
|
||||
2026-08-06 12:44:45 | INFO | User=System | IP=- | - | - | ======================================================================
|
||||
2026-08-06 12:44:45 | INFO | User=System | IP=- | - | - | Application Started Successfully
|
||||
2026-08-06 12:44:45 | INFO | User=System | IP=- | - | - | ======================================================================
|
||||
2026-08-07 11:46:57 | INFO | User=System | IP=- | - | - | ======================================================================
|
||||
2026-08-07 11:46:57 | INFO | User=System | IP=- | - | - | Application Started Successfully
|
||||
2026-08-07 11:46:57 | INFO | User=System | IP=- | - | - | ======================================================================
|
||||
2026-08-07 11:47:12 | INFO | User=System | IP=- | - | - | ======================================================================
|
||||
2026-08-07 11:47:12 | INFO | User=System | IP=- | - | - | Application Started Successfully
|
||||
2026-08-07 11:47:12 | INFO | User=System | IP=- | - | - | ======================================================================
|
||||
2026-08-07 11:47:14 | INFO | User=System | IP=- | - | - | ======================================================================
|
||||
2026-08-07 11:47:14 | INFO | User=System | IP=- | - | - | Application Started Successfully
|
||||
2026-08-07 11:47:14 | INFO | User=System | IP=- | - | - | ======================================================================
|
||||
2026-08-07 11:47:18 | INFO | User=Laxmi | IP=192.168.0.142 | POST | http://192.168.0.142:5015/file/Subcontractor_report | Request Started
|
||||
2026-08-07 11:47:18 | INFO | User=Laxmi | IP=192.168.0.142 | POST | http://192.168.0.142:5015/file/Subcontractor_report | Request Completed | Status=200
|
||||
2026-08-07 11:47:19 | INFO | User=Laxmi | IP=192.168.0.142 | GET | http://192.168.0.142:5015/static/images/lcepl.png | Request Started
|
||||
2026-08-07 11:47:19 | INFO | User=Laxmi | IP=192.168.0.142 | GET | http://192.168.0.142:5015/static/images/lcepl.png | Request Completed | Status=200
|
||||
2026-08-07 11:47:22 | INFO | User=Laxmi | IP=192.168.0.142 | GET | http://192.168.0.142:5015/logout | Request Started
|
||||
2026-08-07 11:47:22 | INFO | User=Anonymous | IP=192.168.0.142 | GET | http://192.168.0.142:5015/logout | Logout successful. User=Laxmi
|
||||
2026-08-07 11:47:22 | INFO | User=Anonymous | IP=192.168.0.142 | GET | http://192.168.0.142:5015/logout | Request Completed | Status=302
|
||||
2026-08-07 11:47:22 | INFO | User=Anonymous | IP=192.168.0.142 | GET | http://192.168.0.142:5015/login | Request Started
|
||||
2026-08-07 11:47:22 | INFO | User=Anonymous | IP=192.168.0.142 | GET | http://192.168.0.142:5015/login | Request Completed | Status=200
|
||||
2026-08-07 11:47:22 | INFO | User=Anonymous | IP=192.168.0.142 | GET | http://192.168.0.142:5015/static/images/lcepl.png | Request Started
|
||||
2026-08-07 11:47:22 | INFO | User=Anonymous | IP=192.168.0.142 | GET | http://192.168.0.142:5015/static/images/lcepl.png | Request Completed | Status=304
|
||||
2026-08-07 11:47:30 | INFO | User=Anonymous | IP=192.168.0.142 | POST | http://192.168.0.142:5015/login | Request Started
|
||||
2026-08-07 11:47:30 | INFO | User=Laxmi | IP=192.168.0.142 | POST | http://192.168.0.142:5015/login | Login successful. User=Laxmi
|
||||
2026-08-07 11:47:30 | INFO | User=Laxmi | IP=192.168.0.142 | POST | http://192.168.0.142:5015/login | Request Completed | Status=302
|
||||
2026-08-07 11:47:30 | INFO | User=Laxmi | IP=192.168.0.142 | GET | http://192.168.0.142:5015/dashboard/ | Request Started
|
||||
2026-08-07 11:47:30 | INFO | User=Laxmi | IP=192.168.0.142 | GET | http://192.168.0.142:5015/dashboard/ | Request Completed | Status=200
|
||||
2026-08-07 11:47:30 | INFO | User=Laxmi | IP=192.168.0.142 | GET | http://192.168.0.142:5015/dashboard/api/live-stats | Request Started
|
||||
2026-08-07 11:47:30 | INFO | User=Laxmi | IP=192.168.0.142 | GET | http://192.168.0.142:5015/dashboard/api/live-stats | Request Completed | Status=200
|
||||
2026-08-07 11:47:35 | INFO | User=Laxmi | IP=192.168.0.142 | GET | http://192.168.0.142:5015/file/Subcontractor_report | Request Started
|
||||
2026-08-07 11:47:35 | INFO | User=Laxmi | IP=192.168.0.142 | GET | http://192.168.0.142:5015/file/Subcontractor_report | Request Completed | Status=200
|
||||
2026-08-07 11:47:40 | INFO | User=Laxmi | IP=192.168.0.142 | POST | http://192.168.0.142:5015/file/Subcontractor_report | Request Started
|
||||
2026-08-07 11:47:40 | INFO | User=Laxmi | IP=192.168.0.142 | POST | http://192.168.0.142:5015/file/Subcontractor_report | Request Completed | Status=200
|
||||
2026-08-07 11:47:41 | INFO | User=Laxmi | IP=192.168.0.142 | POST | http://192.168.0.142:5015/file/Subcontractor_report | Request Started
|
||||
2026-08-07 11:47:42 | INFO | User=Laxmi | IP=192.168.0.142 | POST | http://192.168.0.142:5015/file/Subcontractor_report | Request Completed | Status=200
|
||||
2026-08-07 11:47:44 | INFO | User=Laxmi | IP=192.168.0.142 | POST | http://192.168.0.142:5015/file/Subcontractor_report | Request Started
|
||||
2026-08-07 11:47:44 | INFO | User=Laxmi | IP=192.168.0.142 | POST | http://192.168.0.142:5015/file/Subcontractor_report | Request Completed | Status=200
|
||||
2026-08-07 11:47:46 | INFO | User=Laxmi | IP=192.168.0.142 | POST | http://192.168.0.142:5015/file/Subcontractor_report | Request Started
|
||||
2026-08-07 11:47:46 | INFO | User=Laxmi | IP=192.168.0.142 | POST | http://192.168.0.142:5015/file/Subcontractor_report | Request Completed | Status=200
|
||||
2026-08-07 11:47:49 | INFO | User=Laxmi | IP=192.168.0.142 | GET | http://192.168.0.142:5015/file/Subcontractor_report | Request Started
|
||||
2026-08-07 11:47:49 | INFO | User=Laxmi | IP=192.168.0.142 | GET | http://192.168.0.142:5015/file/Subcontractor_report | Request Completed | Status=200
|
||||
2026-08-07 11:47:54 | INFO | User=Laxmi | IP=192.168.0.142 | POST | http://192.168.0.142:5015/file/Subcontractor_report | Request Started
|
||||
2026-08-07 11:47:54 | INFO | User=Laxmi | IP=192.168.0.142 | POST | http://192.168.0.142:5015/file/Subcontractor_report | Request Completed | Status=200
|
||||
2026-08-07 11:47:57 | INFO | User=Laxmi | IP=192.168.0.142 | POST | http://192.168.0.142:5015/file/Subcontractor_report | Request Started
|
||||
2026-08-07 11:47:57 | INFO | User=Laxmi | IP=192.168.0.142 | POST | http://192.168.0.142:5015/file/Subcontractor_report | Request Completed | Status=200
|
||||
2026-08-07 11:48:07 | INFO | User=Laxmi | IP=192.168.0.142 | POST | http://192.168.0.142:5015/file/Subcontractor_report | Request Started
|
||||
2026-08-07 11:48:07 | INFO | User=Laxmi | IP=192.168.0.142 | POST | http://192.168.0.142:5015/file/Subcontractor_report | Request Completed | Status=200
|
||||
2026-08-07 11:48:11 | INFO | User=Laxmi | IP=192.168.0.142 | POST | http://192.168.0.142:5015/file/Subcontractor_report | Request Started
|
||||
2026-08-07 11:48:11 | INFO | User=Laxmi | IP=192.168.0.142 | POST | http://192.168.0.142:5015/file/Subcontractor_report | Request Completed | Status=200
|
||||
2026-08-07 12:02:57 | INFO | User=System | IP=- | - | - | ======================================================================
|
||||
2026-08-07 12:02:57 | INFO | User=System | IP=- | - | - | Application Started Successfully
|
||||
2026-08-07 12:02:57 | INFO | User=System | IP=- | - | - | ======================================================================
|
||||
2026-08-07 12:03:04 | INFO | User=System | IP=- | - | - | ======================================================================
|
||||
2026-08-07 12:03:04 | INFO | User=System | IP=- | - | - | Application Started Successfully
|
||||
2026-08-07 12:03:04 | INFO | User=System | IP=- | - | - | ======================================================================
|
||||
2026-08-07 12:04:23 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/ | Request Started
|
||||
2026-08-07 12:04:23 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/ | Request Completed | Status=302
|
||||
2026-08-07 12:04:23 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/login | Request Started
|
||||
2026-08-07 12:04:23 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/login | User already logged in.
|
||||
2026-08-07 12:04:23 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/login | Request Completed | Status=302
|
||||
2026-08-07 12:04:23 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/dashboard/ | Request Started
|
||||
2026-08-07 12:04:23 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/dashboard/ | Request Completed | Status=200
|
||||
2026-08-07 12:04:23 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/dashboard/api/live-stats | Request Started
|
||||
2026-08-07 12:04:23 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/dashboard/api/live-stats | Request Completed | Status=200
|
||||
2026-08-07 12:04:33 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/dashboard/api/live-stats | Request Started
|
||||
2026-08-07 12:04:33 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/dashboard/api/live-stats | Request Completed | Status=200
|
||||
2026-08-07 12:04:37 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/engi/client-rate | Request Started
|
||||
2026-08-07 12:04:37 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/engi/client-rate | Request Completed | Status=200
|
||||
2026-08-07 12:04:39 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/file_format | Request Started
|
||||
2026-08-07 12:04:39 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/file_format | Request Completed | Status=200
|
||||
2026-08-07 12:04:40 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/file_format | Request Started
|
||||
2026-08-07 12:04:40 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/file_format | Request Completed | Status=200
|
||||
2026-08-07 12:04:41 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/file_format | Request Started
|
||||
2026-08-07 12:04:41 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/file_format | Request Completed | Status=200
|
||||
2026-08-07 12:04:42 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/file_format | Request Started
|
||||
2026-08-07 12:04:42 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/file_format | Request Completed | Status=200
|
||||
2026-08-07 12:04:42 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/file_format | Request Started
|
||||
2026-08-07 12:04:42 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/file_format | Request Completed | Status=200
|
||||
2026-08-07 12:04:44 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/file/import_client | Request Started
|
||||
2026-08-07 12:04:44 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/file/import_client | Request Completed | Status=200
|
||||
2026-08-07 12:04:46 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/file/Subcontractor_report | Request Started
|
||||
2026-08-07 12:04:46 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/file/Subcontractor_report | Request Completed | Status=200
|
||||
2026-08-07 12:04:49 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/file/Subcontractor_report | Request Started
|
||||
2026-08-07 12:04:49 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/file/Subcontractor_report | Request Completed | Status=200
|
||||
2026-08-07 12:04:52 | INFO | User=Admin | IP=192.168.0.118 | POST | http://192.168.0.118:5015/file/Subcontractor_report | Request Started
|
||||
2026-08-07 12:04:52 | INFO | User=Admin | IP=192.168.0.118 | POST | http://192.168.0.118:5015/file/Subcontractor_report | Request Completed | Status=200
|
||||
2026-08-07 12:04:54 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/file/Subcontractor_report | Request Started
|
||||
2026-08-07 12:04:54 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/file/Subcontractor_report | Request Completed | Status=200
|
||||
2026-08-07 12:05:01 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/dashboard/ | Request Started
|
||||
2026-08-07 12:05:01 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/dashboard/ | Request Completed | Status=200
|
||||
2026-08-07 12:05:01 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/dashboard/api/live-stats | Request Started
|
||||
2026-08-07 12:05:01 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/dashboard/api/live-stats | Request Completed | Status=200
|
||||
2026-08-07 12:05:02 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/activity/ | Request Started
|
||||
2026-08-07 12:05:02 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/activity/ | Request Completed | Status=200
|
||||
2026-08-07 12:07:06 | INFO | User=System | IP=- | - | - | ======================================================================
|
||||
2026-08-07 12:07:06 | INFO | User=System | IP=- | - | - | Application Started Successfully
|
||||
2026-08-07 12:07:06 | INFO | User=System | IP=- | - | - | ======================================================================
|
||||
2026-08-07 12:07:07 | INFO | User=System | IP=- | - | - | ======================================================================
|
||||
2026-08-07 12:07:07 | INFO | User=System | IP=- | - | - | Application Started Successfully
|
||||
2026-08-07 12:07:07 | INFO | User=System | IP=- | - | - | ======================================================================
|
||||
2026-08-07 12:07:09 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/activity/ | Request Started
|
||||
2026-08-07 12:07:09 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/activity/ | Request Completed | Status=200
|
||||
2026-08-07 12:07:10 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/engi/subcontractor-rate | Request Started
|
||||
2026-08-07 12:07:11 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/engi/subcontractor-rate | Request Completed | Status=200
|
||||
2026-08-07 12:07:11 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/static/images/lcepl.png | Request Started
|
||||
2026-08-07 12:07:11 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/static/images/lcepl.png | Request Completed | Status=304
|
||||
2026-08-07 12:07:14 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/engi/client-rate | Request Started
|
||||
2026-08-07 12:07:14 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/engi/client-rate | Request Completed | Status=200
|
||||
2026-08-07 12:07:16 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/file_format | Request Started
|
||||
2026-08-07 12:07:16 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/file_format | Request Completed | Status=200
|
||||
2026-08-07 12:07:16 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/engi/subcontractor-rate | Request Started
|
||||
2026-08-07 12:07:16 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/engi/subcontractor-rate | Request Completed | Status=200
|
||||
2026-08-07 12:07:18 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/engi/subcontractor-rate | Request Started
|
||||
2026-08-07 12:07:18 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/engi/subcontractor-rate | Request Completed | Status=200
|
||||
2026-08-07 12:07:23 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/dashboard/ | Request Started
|
||||
2026-08-07 12:07:23 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/dashboard/ | Request Completed | Status=200
|
||||
2026-08-07 12:07:23 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/dashboard/api/live-stats | Request Started
|
||||
2026-08-07 12:07:23 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/dashboard/api/live-stats | Request Completed | Status=200
|
||||
2026-08-07 12:07:24 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/engi/subcontractor-rate | Request Started
|
||||
2026-08-07 12:07:24 | INFO | User=Admin | IP=192.168.0.118 | GET | http://192.168.0.118:5015/engi/subcontractor-rate | Request Completed | Status=200
|
||||
|
||||
Reference in New Issue
Block a user