log changes
This commit is contained in:
@@ -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