Update remove attendance record actions from Payroll staff

This commit is contained in:
Nguyen Ngo
2025-09-11 17:14:01 -04:00
parent 286fd1ea43
commit 43b8e34f5b
2 changed files with 10 additions and 10 deletions
+3 -3
View File
@@ -459,7 +459,7 @@ function editRecord(recordId) {
// Check permissions before allowing edit // Check permissions before allowing edit
if (!hasEditPermission) { if (!hasEditPermission) {
alert( alert(
"Access denied. Only administrators and payroll staff can edit attendance records." "Access denied. Only administrators can edit attendance records."
); );
return; return;
} }
@@ -476,7 +476,7 @@ function deleteRecord(recordId, employeeId) {
// Check permissions before allowing delete // Check permissions before allowing delete
if (!hasEditPermission) { if (!hasEditPermission) {
alert( alert(
"Access denied. Only administrators and payroll staff can delete attendance records." "Access denied. Only administrators can delete attendance records."
); );
return; return;
} }
@@ -864,7 +864,7 @@ function createTableRow(record, displayIndex) {
</button> </button>
` `
: ` : `
<span class="text-muted" title="Admin or Payroll access required"> <span class="text-muted" title="Admin access required">
<i class="fas fa-lock"></i> <i class="fas fa-lock"></i>
</span> </span>
` `
+7 -7
View File
@@ -293,7 +293,7 @@
</td> </td>
<td> <td>
<div class="record-actions"> <div class="record-actions">
{% if session.role in ['admin', 'payroll'] %} {% if session.role in ['admin'] %}
<button onclick="editRecord('{{ record.id }}')" <button onclick="editRecord('{{ record.id }}')"
class="action-btn btn-edit" class="action-btn btn-edit"
title="Edit Record"> title="Edit Record">
@@ -305,7 +305,7 @@
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</button> </button>
{% else %} {% else %}
<span class="text-muted" title="Admin or Payroll access required"> <span class="text-muted" title="Admin access required">
<i class="fas fa-lock"></i> <i class="fas fa-lock"></i>
</span> </span>
{% endif %} {% endif %}
@@ -393,7 +393,7 @@
<script> <script>
// Template variables (processed by Flask) // Template variables (processed by Flask)
const userRole = '{{ session.role }}'; const userRole = '{{ session.role }}';
const hasEditPermission = ['admin', 'payroll'].includes(userRole); const hasEditPermission = ['admin'].includes(userRole);
// Enhanced JavaScript for new functionality // Enhanced JavaScript for new functionality
const hasLocationAccuracy = {{ 'true' if has_location_accuracy_feature else 'false' }}; const hasLocationAccuracy = {{ 'true' if has_location_accuracy_feature else 'false' }};
@@ -524,7 +524,7 @@ function editRecord(recordId) {
// Check permissions before allowing edit // Check permissions before allowing edit
if (!hasEditPermission) { if (!hasEditPermission) {
alert('Access denied. Only administrators and payroll staff can edit attendance records.'); alert('Access denied. Only administrators can edit attendance records.');
return; return;
} }
@@ -539,7 +539,7 @@ function deleteRecord(recordId, employeeId) {
// Check permissions before allowing delete // Check permissions before allowing delete
if (!hasEditPermission) { if (!hasEditPermission) {
alert('Access denied. Only administrators and payroll staff can delete attendance records.'); alert('Access denied. Only administrators and can delete attendance records.');
return; return;
} }
@@ -598,7 +598,7 @@ document.addEventListener('keydown', function(event) {
} }
}); });
// Force update buttons on page load for admin/payroll users // Force update buttons on page load for admin users
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
if (hasEditPermission) { if (hasEditPermission) {
@@ -628,7 +628,7 @@ document.addEventListener('DOMContentLoaded', function() {
`; `;
} }
}); });
console.log('✅ Admin/Payroll edit/delete buttons have been activated'); console.log('✅ Admin edit/delete buttons have been activated');
} }
}); });
window.userRole = '{{ session.role }}'; window.userRole = '{{ session.role }}';