Updated Time Attendance functionality

This commit is contained in:
2025-10-06 17:23:30 -04:00
parent 769b3d706e
commit 3648c5ddda
6 changed files with 1147 additions and 430 deletions
+31 -1
View File
@@ -257,9 +257,19 @@
<td>
<div class="record-actions">
<a href="{{ url_for('time_attendance_records', import_batch=import_batch.import_batch_id) }}"
class="action-btn btn-view" title="View Records">
class="action-btn btn-view" title="View Records">
<i class="fas fa-eye"></i>
</a>
<a href="{{ url_for('view_import_batch', batch_id=import_batch.import_batch_id) }}"
class="action-btn btn-info" title="Batch Details">
<i class="fas fa-info-circle"></i>
</a>
{% if session.role == 'admin' %}
<button onclick="deleteBatch('{{ import_batch.import_batch_id }}')"
class="action-btn btn-delete" title="Delete Batch">
<i class="fas fa-trash"></i>
</button>
{% endif %}
</div>
</td>
</tr>
@@ -430,5 +440,25 @@ function deleteRecord(recordId, employeeName, date) {
form.submit();
}
}
function deleteBatch(batchId) {
if (confirm('Are you sure you want to delete this entire import batch? This action cannot be undone.')) {
const form = document.createElement('form');
form.method = 'POST';
form.action = `/time-attendance/import/batch/${batchId}/delete`;
const csrfToken = document.querySelector('meta[name="csrf-token"]');
if (csrfToken) {
const input = document.createElement('input');
input.type = 'hidden';
input.name = 'csrf_token';
input.value = csrfToken.content;
form.appendChild(input);
}
document.body.appendChild(form);
form.submit();
}
}
</script>
{% endblock %}