05/25 Update inspectors contract assignment 2
This commit is contained in:
@@ -21,7 +21,11 @@
|
||||
<div class="card shadow-sm mb-4">
|
||||
<div class="card-header bg-light d-flex justify-content-between align-items-center">
|
||||
<span class="fw-semibold">Active Contracts</span>
|
||||
<span class="badge bg-primary">{{ assigned_pids|length }} assigned</span>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<span class="badge bg-primary" id="assignedCount">{{ assigned_pids|length }} assigned</span>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" onclick="setAll(true)">Select All</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" onclick="setAll(false)">Deselect All</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if projects %}
|
||||
@@ -60,3 +64,21 @@
|
||||
{% endif %}
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_js %}
|
||||
<script>
|
||||
function setAll(checked) {
|
||||
document.querySelectorAll('input[name="project_ids"]').forEach(cb => cb.checked = checked);
|
||||
updateCount();
|
||||
}
|
||||
|
||||
function updateCount() {
|
||||
const n = document.querySelectorAll('input[name="project_ids"]:checked').length;
|
||||
document.getElementById('assignedCount').textContent = n + ' assigned';
|
||||
}
|
||||
|
||||
document.querySelectorAll('input[name="project_ids"]').forEach(cb => {
|
||||
cb.addEventListener('change', updateCount);
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user