CHANGE_DASHMENT_ENROLLMENT_ENDORSEMENT : AADHAVAN

This commit is contained in:
aadhavan valli 2024-07-23 12:17:21 +05:30
parent fdfc0744cb
commit 7042dfb520

View File

@ -11,6 +11,7 @@ use Psr\Log\LoggerInterface;
use App\Models\EmployeeModel;
use App\Models\EmployeePolicyModel;
use App\Models\ClientModel;
use App\Models\ClientBranchModel;
use App\Models\PolicesModel;
use App\Models\FileModel;
use App\Models\BatchListModel;
@ -44,6 +45,7 @@ class EmployeeController extends AdminController
protected $employeeModel;
protected $employeePolicyModel;
protected $clientModel;
protected $clientBranchModel;
protected $fileModel;
protected $batchListModel;
protected $batchFileModel;
@ -60,6 +62,7 @@ class EmployeeController extends AdminController
$this->employeeModel = new EmployeeModel();
$this->employeePolicyModel = new EmployeePolicyModel();
$this->clientModel = new ClientModel();
$this->clientBranchModel = new ClientBranchModel();
$this->fileModel = new FileModel();
$this->batchListModel = new BatchListModel();
$this->batchFileModel = new BatchFileModel();
@ -609,6 +612,71 @@ class EmployeeController extends AdminController
$this->loadLayout('endorsement_list', $data);
}
/**
* Below function displays the Enrollment list page.
*
* This method retrieves filter data from the request and fetches the Enrollment list
* based on the provided filters such as client , client_branch , employee - ( Log-in-or-not , ENrolled-or-not).
*/
public function enrollmentClientList()
{
$data = [];
$client_list = $this->clientModel->findAll();
$branch_list = $this->clientBranchModel->findAll();
$data['client_list'] = $client_list;
$data['branch_list'] = $branch_list;
$this->myLogger->logme('error', 'list called');
$this->loadLayout('enrollment_list', $data);
}
public function empby_client_clientbranch($client_id, $branch_id)
{
$results = $this->clientModel->select('employees.id as employee_id, employees.name as employee_name,
employees.relationship, employees.emp_code,
employees.emp_status, auth_history.user_type')
->join('employees', $client_id .'= employees.client_id AND ' . $branch_id . '= employees.client_branch_id', 'left')
->join('auth_history', 'employees.id = auth_history.user_id AND "employee" = auth_history.user_type', 'left')
->findAll();
$groupedData = [];
$employeeId = '';
foreach ($results as $row) {
if($employeeId != $row['employee_id']){
$employeeId = $row['employee_id'];
}else{
$employeeId = null;
}
$employeeName = $row['employee_name'] ;
$employeeRelationship = $row['relationship'] ;
$employeeEmpCode = $row['emp_code'] ;
$employeeEmpStatus = $row['emp_status'];
$employeeUserType = $row['user_type'];
if ($employeeId !== null && $employeeRelationship == 'Self') {
// Append employee info to the branch's employees list
$groupedData[] = [
'employee_id' => $employeeId,
'employee_name' => $employeeName,
'relationship' => $employeeRelationship,
'emp_code' => $employeeEmpCode,
'emp_status' => $employeeEmpStatus,
'user_type' => $employeeUserType
];
}
$employeeId = $row['employee_id'];
}
return json_encode($groupedData);
}
/**
* Beleo function retrieves employee endorsement (emp_endorsement table) data.