diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index e5c6a9ab..2770ea29 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -87,22 +87,31 @@ class EmployeeController extends AdminController { // $model = new UserModel(); $data = []; - $data['status'] = ['draft' => 'Draft', 'active' => 'Active', 'inactive' => 'In-Active', 'pending' => 'Pending']; + $data['status'] = ['draft' => 'Draft', 'enrolled' => 'Enrolled', 'active' => 'Active', 'inactive' => 'In-Active', 'pending' => 'Pending']; + if (count($this->request->getGet())) { $filterData = $this->request->getGet(); + + // Convert the status field to an array if it exists in the request data + if (isset($filterData['status'])) { + $filterData['status'] = explode(",", $filterData['status']); + } + + // Fetch employees with the modified $filterData array $data['employees'] = $this->employeePolicyModel->getEmployeePolicy( - client_id: $filterData['client_id'], - policy_id: $filterData['policy_id'], - branch_id: $filterData['branch_id'], - emp_code : $filterData['emp_code'], - emp_name : $filterData['emp_name'], - status : $filterData['status'], + client_id: $filterData['client_id'] ?? null, + policy_id: $filterData['policy_id'] ?? null, + branch_id: $filterData['branch_id'] ?? null, + emp_code : $filterData['emp_code'] ?? null, + emp_name : $filterData['emp_name'] ?? null, + status : $filterData['status'] ?? [], ); - // dd($this->employeePolicyModel->getLastQuery()); - + + // Set getData in $data array with the processed $filterData $data['getData'] = $filterData; } - + + // dd($this->employeeModel->getLastQuery()); // dd( $data['getData']); // dd($this->request->getGet()); diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 2d4a68ef..9d2c246c 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -500,26 +500,31 @@ class LeadsController extends BaseController $rowNumber++; } - + // Leave two blank rows $rowNumber += 2; - + // Set headers and subheaders starting from current row $headers = $data['table_data']['headers']; $subHeaderRow = $rowNumber + 1; $columnLetter = 'A'; - - // Add headers in the first row and subheaders in the second row + + // Set column width and apply word wrap to headers and subheaders foreach ($headers as $header) { if ($header['parentHeader'] === 'Item Key' || $header['parentHeader'] == 'Action') { continue; // Skip "Item Key" and "Action" columns } - - if($header['parentHeader'] === 'Sno'){ + + if ($header['parentHeader'] === 'Sno') { $header['parentHeader'] = 'S.No.'; } - + + // Set the header cell value $sheet->setCellValue("{$columnLetter}{$rowNumber}", $header['parentHeader']); + + // Set column width for header + $sheet->getColumnDimension($columnLetter)->setWidth(20); // Adjust width as needed + $sheet->getStyle("{$columnLetter}{$rowNumber}")->getAlignment()->setWrapText(true); // Apply bold style to the header $sheet->getStyle("{$columnLetter}{$rowNumber}")->applyFromArray([ @@ -528,9 +533,13 @@ class LeadsController extends BaseController ], ]); + // Add subheaders in the second row foreach ($header['subHeaders'] as $subHeader) { $sheet->setCellValue("{$columnLetter}{$subHeaderRow}", $subHeader); + // Enable word wrap for subheaders + $sheet->getStyle("{$columnLetter}{$subHeaderRow}")->getAlignment()->setWrapText(true); + // Apply bold style to the subheader $sheet->getStyle("{$columnLetter}{$subHeaderRow}")->applyFromArray([ 'font' => [ @@ -541,11 +550,11 @@ class LeadsController extends BaseController $columnLetter++; } } - + // Move to next row for data entries $rowNumber = $subHeaderRow + 1; - - // Add data rows + + // Add data rows and enable word wrap for data cells foreach ($data['table_data']['data'] as $dataRow) { $columnLetter = 'A'; foreach ($dataRow['data'] as $cellData) { @@ -553,11 +562,20 @@ class LeadsController extends BaseController continue; // Skip "Item Key" data } $sheet->setCellValue("{$columnLetter}{$rowNumber}", $cellData['value']); + + // Enable word wrap for data cells + $sheet->getStyle("{$columnLetter}{$rowNumber}")->getAlignment()->setWrapText(true); + $columnLetter++; } $rowNumber++; } - + + // Auto-size all columns after data is entered + foreach ($sheet->getColumnIterator() as $column) { + $sheet->getColumnDimension($column->getColumnIndex())->setAutoSize(true); + } + // Set filename based on type $string = ($type == 2) ? 'QCR' : 'RFQ'; $filename = $string . '_' . $rfq_data['client_short_name'] . '_' . $rfq_data['policy_type'] . '_' . date('Ymdhis') . '.xlsx'; @@ -586,7 +604,8 @@ class LeadsController extends BaseController $recipient_type = $params['recipient_type'];//insurer or client $recipient_mail = $params['recipient_mail'];// - only primary key of contacts $recipient_mail = json_decode($params['recipient_mail'], true);;// - only primary key of contacts - $cc = 'velz1990@gmail.com,vitvelz@gmail.com'; + // $cc = 'velz1990@gmail.com,vitvelz@gmail.com'; + $cc = ""; $result_data = []; // dd($recipient_mail); diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index 5eabd0bb..00dff6ca 100755 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -78,6 +78,7 @@ class EmployeePolicyModel extends Model // ---------------------------------------------------------------------------------------------------------- public function getEmployeePolicy($client_id = 0, $policy_id=0, $status=0, $branch_id=0, $emp_code="", $emp_name="") { + // dd($status); $result = $this->select([ 'employee_polices.*', @@ -132,17 +133,39 @@ class EmployeePolicyModel extends Model if ($policy_id !=0 && !empty($policy_id)) { $result->where('employee_polices.client_policy_id', $policy_id); } - if ($status !=0 && !empty($status)) { - if($status == 'active'){ + + if (is_array($status) && count($status) > 0) { + + $result->where('employee_polices.status !=', 'expired'); + + if (in_array("active", $status)) { + $result->where('employee_polices.tpa_id IS NOT NULL'); - $result->where('employee_polices.uhid IS NOT NULL'); - }else if($status == 'pending'){ - $status = 'active'; - $result->where('employee_polices.status', $status); - }else{ - $result->where('employee_polices.status', $status); + $result->where('employee_polices.uhid IS NOT NULL'); + $result->whereIn('employee_polices.status', $status); + + } elseif (in_array("pending", $status)) { + + $result->where('employee_polices.tpa_id IS NULL'); + $result->where('employee_polices.uhid IS NULL'); + $result->whereIn('employee_polices.status', array_merge($status, ['active'])); + + } else { + + $result->whereIn('employee_polices.status', $status); } + + // if($status == 'active'){ + // $result->where('employee_polices.tpa_id IS NOT NULL'); + // $result->where('employee_polices.uhid IS NOT NULL'); + // }else if($status == 'pending'){ + // $status = 'active'; + // $result->where('employee_polices.status', $status); + // }else{ + // $result->where('employee_polices.status', $status); + // } } + if (!empty($emp_code)) { $result->where('emp.emp_code', $emp_code); } diff --git a/app/Views/employee_list.php b/app/Views/employee_list.php index fed29d5d..b6d77d34 100755 --- a/app/Views/employee_list.php +++ b/app/Views/employee_list.php @@ -7,6 +7,17 @@ table.dataTable tbody td { padding: 4px 4px !important; } + +.select2-selection__choice { + background-color: #0a8794 !important; + color: white !important; + font-weight: bold; +} + +.select2-selection__choice__remove { + color: white !important; + margin-right: 5px; +}