From 634f65ec96089541b8db7cc4407699c282f3d422 Mon Sep 17 00:00:00 2001 From: velz Date: Mon, 14 Jul 2025 14:34:11 +0530 Subject: [PATCH] FIX_HD_CESUMMARY_API --- app/Controllers/EmployeeRestController.php | 46 ++++++++++--------- .../RestAuthenticationController.php | 10 ++++ app/Models/UserActivityHistoryModel.php | 18 ++++++++ 3 files changed, 53 insertions(+), 21 deletions(-) create mode 100644 app/Models/UserActivityHistoryModel.php diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 8a77865c..78e99a86 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -2376,41 +2376,45 @@ class EmployeeRestController extends AdminController $hr_id = $this->request->getGet('hr_id'); $HRAccessData = $this->getHRAccessData($hr_id,'post_enrollment'); - - if(isset($HRAccessData['allowed_active_policies'])) + // print_rr($HRAccessData);die(); + if(isset($HRAccessData['allowed_cd'])) { - $policyId = json_decode($HRAccessData['allowed_active_policies'],true); + $allowed_cd = json_decode($HRAccessData['allowed_cd'],true); }else{ - $policyId = []; + $allowed_cd = []; } - - if(count($policyId) == 0){ - return $this->respond(['status' => 'failed','code' => (count($policyId) ? 200 : 404),'data' => [] ], 200); + // $allowed_cd = [125]; + // print_r($allowed_cd);die(); + if(count($allowed_cd) == 0){ + return $this->respond(['status' => 'failed','code' => (count($allowed_cd) ? 200 : 404),'data' => [] ], 200); } $clientId = $this->request->getGet('client_id'); $clientController = new ClientController; - $result = $clientController->deposit($clientId , $requestFrom = 'rest' , $policyId); - + $result = $clientController->deposit($clientId , $requestFrom = 'rest' , []); + // print_rr($result);die(); $data = []; foreach ($result['clientData'] as $key => $value) { - $temp['client_id'] = $value->client_id; - $temp['insurer_id'] = $value->insurer_id; - $temp['cd_ac_pk'] = $value->cd_ac_pk; - $temp['insurer_name'] = $value->insurer_name; - $temp['cd_master_account_no'] = $value->cd_master_account_no; - if (isset($result['balances'][$temp['insurer_id']])) { - $balance = $result['balances'][$temp['insurer_id']]->balance; - $temp['balance'] = $balance; - } else { - $temp['balance'] = "N/A"; + if( in_array($value->cd_ac_pk, $allowed_cd) ) + { + $temp['client_id'] = $value->client_id; + $temp['insurer_id'] = $value->insurer_id; + $temp['cd_ac_pk'] = $value->cd_ac_pk; + $temp['insurer_name'] = $value->insurer_name; + $temp['cd_master_account_no'] = $value->cd_master_account_no; + if (isset($result['balances'][$temp['insurer_id']])) { + $balance = $result['balances'][$temp['insurer_id']]->balance; + $temp['balance'] = $balance; + } else { + $temp['balance'] = "N/A"; + } + + array_push($data,$temp); } - - array_push($data,$temp); } diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index 4aa0d89d..478d563b 100755 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -23,6 +23,7 @@ use App\Models\AuthHistoryModel; use App\Models\LevelContactModel; use App\Models\HRAccessControlModel; use App\Models\ClientModel; +use App\Models\UserActivityHistoryModel; use Firebase\JWT\JWT; // require_once('../vendor/autoload.php'); @@ -39,6 +40,7 @@ class RestAuthenticationController extends AdminController protected $hrModel; protected $hrAccessControlModel; protected $clientModel; + protected $userActivityHistoryModel; public function __construct() @@ -51,6 +53,7 @@ class RestAuthenticationController extends AdminController $this->hrModel = new LevelContactModel(); $this->hrAccessControlModel = new HRAccessControlModel(); $this->clientModel = new ClientModel(); + $this->userActivityHistoryModel = new UserActivityHistoryModel(); } @@ -1231,6 +1234,13 @@ class RestAuthenticationController extends AdminController ], 404); } + public function logHrActivity() + { + $json = $this->request->getJSON(); + print_r($json);die(); + // $this->userActivityHistoryModel->insert(); + } + } \ No newline at end of file diff --git a/app/Models/UserActivityHistoryModel.php b/app/Models/UserActivityHistoryModel.php new file mode 100644 index 00000000..e56fcadd --- /dev/null +++ b/app/Models/UserActivityHistoryModel.php @@ -0,0 +1,18 @@ +