Update: add Export by Building

This commit is contained in:
2025-12-27 14:04:35 -05:00
parent 8dd3fd9f2e
commit 68983887a4
2 changed files with 646 additions and 11 deletions
+41 -11
View File
@@ -37,6 +37,10 @@
<i class="fas fa-file-excel"></i>
Export to Excel
</button>
<button class="btn btn-secondary" onclick="exportByBuilding()">
<i class="fas fa-building"></i>
Export by Building
</button>
</div>
</div>
@@ -276,7 +280,7 @@
<span class="pagination-btn active">{{ page_num }}</span>
{% endif %}
{% else %}
<span class="pagination-ellipsis">...</span>
<span class="pagination-ellipsis">...</span>
{% endif %}
{% endfor %}
@@ -297,16 +301,9 @@
{% endif %}
{% else %}
<div class="empty-state">
<div class="empty-icon">
<i class="fas fa-inbox"></i>
</div>
<h3>No Records Found</h3>
<p>No time attendance records match your current filters.</p>
<a href="{{ url_for('time_attendance_records') }}" class="btn btn-primary">
<i class="fas fa-refresh"></i>
Clear Filters
</a>
<div class="no-records">
<i class="fas fa-folder-open"></i>
<p>No attendance records found matching your criteria.</p>
</div>
{% endif %}
</div>
@@ -369,6 +366,26 @@ function exportRecords(format) {
window.location.href = `/time-attendance/export?${params.toString()}`;
}
function exportByBuilding() {
// Get current filter values
const employeeId = document.querySelector('select[name="employee_id"]')?.value || '';
const locationName = document.querySelector('select[name="location_name"]')?.value || '';
const projectId = document.querySelector('select[name="project_id"]')?.value || '';
const startDate = document.querySelector('input[name="start_date"]')?.value || '';
const endDate = document.querySelector('input[name="end_date"]')?.value || '';
// Build query parameters
const params = new URLSearchParams();
if (employeeId) params.append('employee_id', employeeId);
if (locationName) params.append('location_name', locationName);
if (projectId) params.append('project_id', projectId);
if (startDate) params.append('start_date', startDate);
if (endDate) params.append('end_date', endDate);
// Redirect to export by building endpoint
window.location.href = `/time-attendance/export-by-building?${params.toString()}`;
}
// Close dropdown when clicking outside
document.addEventListener('click', function(event) {
const menu = document.getElementById('exportMenu');
@@ -489,6 +506,9 @@ document.addEventListener('DOMContentLoaded', function() {
.header-actions {
position: relative;
z-index: 100;
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
}
.export-dropdown-menu {
@@ -590,6 +610,16 @@ document.addEventListener('DOMContentLoaded', function() {
right: auto;
min-width: 100%;
}
.header-actions {
flex-direction: column;
width: 100%;
}
.header-actions .btn {
width: 100%;
justify-content: center;
}
}
</style>
{% endblock %}