fixing absensi

This commit is contained in:
2025-10-23 15:56:00 +07:00
parent 166cea767b
commit 49bfdeeb53

View File

@@ -65,14 +65,15 @@ const create = async (req, res) => {
date: today,
}, { transaction: t });
await t.commit();
return response.success(res, attendance, 'Izin berhasil disimpan');
}
if (attendance && ['sick', 'permission'].includes(attendance.type)) {
await t.rollback()
return response.failed(res, 400, `Hari ini Anda sudah absen ${attendance.type}`);
}
await t.commit();
return response.success(res, attendance, 'Izin berhasil disimpan');
}
if (attendance && attendance.clock_in) {
// 🕛 Jika branch tidak mengaktifkan absen siang
if (!branch.lunch_attendance) {