penambahan All Total Time dan Warna Badge

di active menu attendance monthly
This commit is contained in:
2026-06-02 10:37:49 +07:00
parent 77a65abdb5
commit 6439eb79a1
@@ -16,8 +16,33 @@
.calendar-card .badge{
font-size:10px;
}
}
.badge-custom {
background-color: #ff8874;
color: #fff;
}
.badge-custom1{
background-color: #27F549;
color: #fff;
}
.badge-custom2 {
background-color: #CB21FF;
color: #fff;
}
.badge-custom3 {
background-color: #94A600;
color: #fff;
}
.badge-custom4 {
background-color: #8200C7;
color: #fff;
}
</style>
<div class="container mt-4">
@@ -121,7 +146,7 @@
</tr>
<tr>
<th><span class="badge bg-primary">Izin</span></th>
<td id="d_leave_count"></td>
<td id="d_total_permit"></td>
</tr>
<tr>
<th><span class="badge bg-danger">Alpha</span></th>
@@ -131,6 +156,10 @@
<th><span class="badge bg-warning">Terlambat</span></th>
<td id="d_late_count"></td>
</tr>
<tr>
<th><span class="badge badge-custom">Total Early Leave Minutes</span></th>
<td id="d_total_early_leave_minutes"></td>
</tr>
</tbody>
</table>
</div>
@@ -138,29 +167,34 @@
<table class="table mb-3">
<tbody>
<tr>
<th width="100"><span class="badge bg-success">Total Hari Kerja</span></th>
<th width="100"><span class="badge badge-custom1">Total Hari Kerja</span></th>
<td id="d_total_hari_kerja"></td>
<th width="180">Hari</th>
</tr>
<tr>
<th><span class="badge bg-dark">Cuti</span></th>
<td id="d_total_permit"></td>
<td id="d_total_annual"></td>
<th width="180">Hari</th>
</tr>
<tr>
<th><span class="badge bg-secondary">Total Jam Kerja</span></th>
<td id="d_total_work_hours"></td>
<th width="180">Jam</th>
</tr>
<tr>
<th><span class="badge badge-custom2">Total Late Minutes</span></th>
<td id="d_total_late_minutes"></td>
<th width="180">Menit</th>
</tr>
<tr>
<th><span class="badge bg-danger">Total Overtime Hours</span></th>
<td id="d_overtime_hours"></td>
<th><span class="badge badge-custom4">Total Overtime Hours</span></th>
<td id="d_total_overtime_hours"></td>
<th width="180">Jam</th>
</tr>
<tr>
<th><span class="badge bg-warning">Total Terlambat / Menit</span></th>
<td id="d_total_late_minutes"></td>
<th width="180">Menit</th>
<th><span class="badge badge-custom3">Total Alpha</span></th>
<td id="d_total_alpha"></td>
<th width="180">Hari</th>
</tr>
</tbody>
</table>
@@ -224,34 +258,25 @@
$('#d_status').text(res.header.status);
// Header - perhitungan
$('#d_total_hari_kerja').text(res.detail.length);
$('#d_present_count').text(res.detail.filter(d => d.attendance_status === 'present').length);
$('#d_total_hadir').text(res.detail.filter(d => d.attendance_status === 'present').length);
$('#d_late_count').text(res.detail.filter(d => d.attendance_status === 'late').length);
$('#d_total_permit').text(res.detail.filter(d => d.attendance_status === 'permit').length);
$('#d_total_hari_kerja').text(res.header.total_hari_kerja);
$('#d_present_count').text(res.header.total_present);
$('#d_total_hadir').text(res.header.total_hadir);
$('#d_late_count').text(res.header.total_late);
$('#d_total_permit').text(res.header.total_permit);
$('#d_sick_count').text(res.detail.filter(d => d.attendance_status === 'sick').length);
$('#d_total_work_hours').text(res.detail.filter(d => d.attendance_status === 'present').length * 8); // Asumsi 8 jam kerja per hari
$('#d_late_minutes').text(res.detail.reduce((total, d) => {
if (d.attendance_status === 'late') {
return total + parseInt(d.late_minutes);
}
return total;
}, 0));
const totalLateMinutes = res.detail
.filter(d => d.attendance_status === 'late')
.reduce((sum, d) => sum + (Number(d.total_late_minutes) || 0), 0);
$('#d_total_late_minutes').text(totalLateMinutes);
$('#d_sick_count').text(res.header.total_sick);
$('#d_total_overtime_hours').text(res.header.total_overtime_hours);
$('#d_total_work_hours').text(res.header.total_work_hours);
$('#d_total_annual').text(res.header.total_annual);
$('#d_total_late_minutes').text(res.header.total_late_minutes);
$('#d_total_early_leave_minutes').text(res.header.total_early_leave_minutes);
$('#d_overtime_hours').text(res.detail.filter(d => d.attendance_status === 'present' && d.overtime_hours)
.reduce((total, d) => total + parseFloat(d.overtime_hours || 0), 0)
);
$('#d_leave_count').text(res.detail.filter(d => d.attendance_status === 'permit').length);
$('#d_absent_count').text(res.detail.filter(d => d.attendance_status === 'alpha').length);
$('#d_late_count').text(res.detail.filter(d => d.attendance_status === 'late').length);
$('#d_leave_count').text(res.header.total_leave);
$('#d_absent_count').text(res.header.total_alpha);
$('#d_late_count').text(res.header.total_late);
$('#d_total_alpha').text(res.header.total_alpha);
// Mapping data absensi berdasarkan tanggal