This commit is contained in:
Gowtham M 2025-10-16 14:50:27 +05:30
parent 80a168ec0e
commit 584e6e1f22

View File

@ -296,7 +296,7 @@ class StaffController extends ResourceController
$db = \Config\Database::connect();
$builder = $db->table('partner_staff_attendance');
$builder->select('DATE(login_datetime) AS login_date, MIN(login_datetime) AS first_login, MAX(logout_datetime) AS last_logout');
$builder->select('id, DATE(login_datetime) AS login_date, MIN(login_datetime) AS first_login, MAX(logout_datetime) AS last_logout');
$builder->where('staff_id', $staffId);
$builder->where('login_datetime >=', $startDateTime);
$builder->where('login_datetime <=', $endDateTime);
@ -309,6 +309,7 @@ class StaffController extends ResourceController
$formatted = [];
foreach ($records as $row) {
$formatted[] = [
'id' => $row['id'],
'login_date' => $row['first_login'] ? date('d, M Y h:i A', strtotime($row['first_login'])) : null,
'logout_date' => $row['last_logout'] ? date('d, M Y h:i A', strtotime($row['last_logout'])) : null,
];