Skip to content

Commit 62386d1

Browse files
committed
dashboard fixed
1 parent 0746f2a commit 62386d1

1 file changed

Lines changed: 26 additions & 9 deletions

File tree

PunchClock/static/punch/js/admin/dashboard.js

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -522,19 +522,24 @@ document.addEventListener('DOMContentLoaded', function () {
522522
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${statusClass}">
523523
${entry.status.charAt(0).toUpperCase() + entry.status.slice(1)}
524524
</span>
525-
</td>
526-
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
527-
${entry.status === 'pending' ?
528-
`<a href="#" class="approve-btn text-indigo-600 hover:text-indigo-900 mr-3" data-entry-id="${entry.id}">Approve</a>
529-
<a href="#" class="reject-btn text-red-600 hover:text-red-900" data-entry-id="${entry.id}">Reject</a>` :
530-
`<span class="text-gray-400">Already ${entry.status}</span>`
531-
}
525+
</td> <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
526+
<div class="flex items-center justify-between">
527+
<div>
528+
${entry.status === 'pending' ?
529+
`<a href="#" class="approve-btn text-indigo-600 hover:text-indigo-900 mr-3" data-entry-id="${entry.id}">Approve</a>
530+
<a href="#" class="reject-btn text-red-600 hover:text-red-900" data-entry-id="${entry.id}">Reject</a>` :
531+
`<span class="text-gray-400">Already ${entry.status}</span>`
532+
}
533+
</div>
534+
<a href="#" class="delete-btn text-red-500 hover:text-red-700 hover:bg-red-50 ml-4 p-2 rounded-full transition-colors duration-200" data-entry-id="${entry.id}" title="Delete entry">
535+
<i class="fas fa-trash"></i>
536+
</a>
537+
</div>
532538
</td>
533539
`;
534540
tableBody.appendChild(tr);
535541
});
536-
537-
// Add event listeners to approve/reject buttons
542+
// Add event listeners to approve/reject buttons
538543
document.querySelectorAll('.approve-btn').forEach(btn => {
539544
btn.addEventListener('click', function(e) {
540545
e.preventDefault();
@@ -548,6 +553,18 @@ document.addEventListener('DOMContentLoaded', function () {
548553
rejectTimeEntry(this.dataset.entryId);
549554
});
550555
});
556+
557+
// Add event listeners to delete buttons
558+
document.querySelectorAll('.delete-btn').forEach(btn => {
559+
btn.addEventListener('click', function(e) {
560+
e.preventDefault();
561+
showConfirmDialog(
562+
'Delete Time Entry',
563+
'Are you sure you want to delete this time entry? This action cannot be undone.',
564+
() => deleteTimeEntry(this.dataset.entryId)
565+
);
566+
});
567+
});
551568
}
552569

553570
// Function to update a specific entry in the table

0 commit comments

Comments
 (0)