GWM : date format

This commit is contained in:
Gowtham M 2025-10-27 12:27:56 +05:30
parent 2c6572acf6
commit 0722bb56fe
4 changed files with 21 additions and 1 deletions

View File

@ -84,6 +84,11 @@ class ClaimController extends ResourceController
$data = $builder->get()->getResultArray(); $data = $builder->get()->getResultArray();
foreach ($data as $key => $row) {
$data[$key]['created_at'] = date('d-m-Y', strtotime($row['created_at']));
$data[$key]['updated_at'] = date('d-m-Y', strtotime($row['updated_at']));
}
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $data], 200); return $this->respond(['status' => 'success', 'code' => 200, 'data' => $data], 200);
} catch (\Exception $e) { } catch (\Exception $e) {
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $e->getMessage()], 500); return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $e->getMessage()], 500);

View File

@ -79,6 +79,11 @@ class EndorsementController extends ResourceController
$data = $builder->get()->getResultArray(); $data = $builder->get()->getResultArray();
foreach ($data as $key => $row) {
$data[$key]['created_at'] = date('d-m-Y', strtotime($row['created_at']));
$data[$key]['updated_at'] = date('d-m-Y', strtotime($row['updated_at']));
}
return $this->respond(['status' => 'success','code' => 200,'data' => $data], 200); return $this->respond(['status' => 'success','code' => 200,'data' => $data], 200);
} catch (\Exception $e) { } catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);

View File

@ -72,6 +72,12 @@ class EnquiryController extends ResourceController
$data = $this->enquiryModel->getEnquiry('ALL'); $data = $this->enquiryModel->getEnquiry('ALL');
} }
foreach ($data as $key => $row) {
$data[$key]['created_on'] = date('d-m-Y', strtotime($row['created_on']));
$data[$key]['updated_on'] = date('d-m-Y', strtotime($row['updated_on']));
}
if (!empty($from_date) || empty(!$to_date)) { if (!empty($from_date) || empty(!$to_date)) {
$from_date = DateTime::createFromFormat('Y-m-d 00:00:00', $from_date)->format('d-m-Y'); $from_date = DateTime::createFromFormat('Y-m-d 00:00:00', $from_date)->format('d-m-Y');
$to_date = DateTime::createFromFormat('Y-m-d 23:59:59', $to_date)->format('d-m-Y'); $to_date = DateTime::createFromFormat('Y-m-d 23:59:59', $to_date)->format('d-m-Y');

View File

@ -319,12 +319,16 @@ class StaffController extends ResourceController
$records = $builder->get()->getResultArray(); $records = $builder->get()->getResultArray();
//get Staff name
$staff = $this->StaffModel->where('id',$staffId)->first();
// Format result // Format result
$formatted = []; $formatted = [];
foreach ($records as $row) { foreach ($records as $row) {
$formatted[] = [ $formatted[] = [
'name' => $staff['name'],
'id' => $row['id'], 'id' => $row['id'],
'date' => $row['first_login'] ? date('d, M Y', strtotime($row['first_login'])) : null, 'date' => $row['first_login'] ? date('d-m-Y', strtotime($row['first_login'])) : null,
'login_time' => $row['first_login'] ? date('h:i A', strtotime($row['first_login'])) : null, 'login_time' => $row['first_login'] ? date('h:i A', strtotime($row['first_login'])) : null,
'logout_time' => $row['last_logout'] ? date('h:i A', strtotime($row['last_logout'])) : null, 'logout_time' => $row['last_logout'] ? date('h:i A', strtotime($row['last_logout'])) : null,
'no_of_logged_in_time' => $this->getLoginDuration($row['first_login'], $row['last_logout']) 'no_of_logged_in_time' => $this->getLoginDuration($row['first_login'], $row['last_logout'])