fix: category filter, action icons, download filename, reset button,
This commit is contained in:
@@ -124,109 +124,66 @@
|
||||
<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>
|
||||
|
||||
<!-- Masters -->
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="/engi">
|
||||
<i class="bi bi-gear me-2"></i> Masters
|
||||
|
||||
<!-- Formats -->
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/file_format">
|
||||
<i class="bi bi-file-earmark-text me-1"></i> Formats
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-dark">
|
||||
<!-- Client Standard Rates -->
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/engi/subcontractor-rate">
|
||||
<i class="bi bi-file-earmark-text me-1"></i> Rate Master
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<!-- Client Standard Rates -->
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/engi/client-rate">
|
||||
<i class="bi bi-file-earmark-text me-1"></i> Client Standard Rates
|
||||
</a>
|
||||
</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>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!-- USER DROPDOWN -->
|
||||
{% if session.get("user_id") %}
|
||||
<li class="nav-item dropdown ms-lg-3">
|
||||
|
||||
<!-- USER DROPDOWN -->
|
||||
<li class="nav-item dropdown">
|
||||
|
||||
<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 -->
|
||||
<li>
|
||||
<a class="dropdown-item text-light py-2" href="{{ url_for('dashboard.dashboard') }}">
|
||||
<a class="dropdown-item" href="/dashboard">
|
||||
<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
|
||||
<a class="dropdown-item" href="{{ url_for('activity.activity') }}">
|
||||
<i class="bi bi-clock-history me-2"></i>
|
||||
Activity Log
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<!-- Manage Account -->
|
||||
<li>
|
||||
<a class="dropdown-item py-2" href="#">
|
||||
<i class="bi bi-gear me-2"></i> Manage Account
|
||||
<a class="dropdown-item text-warning" href="/logout">
|
||||
<i class="bi bi-box-arrow-right me-2"></i> Logout
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li><hr class="dropdown-divider border-secondary m-0"></li>
|
||||
|
||||
<!-- 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>
|
||||
</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 +336,7 @@
|
||||
|
||||
showLoader();
|
||||
const btn = this.querySelector("button[type='submit']");
|
||||
const originalBtnHtml = btn ? btn.innerHTML : null;
|
||||
|
||||
if(btn){
|
||||
btn.disabled = true;
|
||||
@@ -388,10 +346,24 @@
|
||||
`;
|
||||
}
|
||||
|
||||
|
||||
setTimeout(function () {
|
||||
hideLoader();
|
||||
if (btn) {
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = originalBtnHtml;
|
||||
}
|
||||
}, 3000);
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
window.addEventListener("pageshow", function () {
|
||||
hideLoader();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -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({
|
||||
pageLength: 10,
|
||||
dom: 'Bfrtip',
|
||||
buttons: ['copy', 'csv', 'excel', 'print']
|
||||
|
||||
$('.datatable').each(function () {
|
||||
$(this).DataTable({
|
||||
pageLength: 10,
|
||||
dom: 'Bfrtip',
|
||||
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
|
||||
$(document).on("change", "#select-all", function () {
|
||||
$(".row-check").prop("checked", this.checked);
|
||||
// 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);
|
||||
});
|
||||
|
||||
// GET IDS
|
||||
function getSelectedIds() {
|
||||
// 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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user