FEAT_MULTIEVENT_FILE_UPLOAD_AND_AUTO_SAVE_TERMS_AND_OTHERS ; RV

This commit is contained in:
VENKATESHWARAN 2025-08-29 21:15:01 +05:30
parent f8b507ec3e
commit 716d28f1ff
21 changed files with 3224 additions and 319 deletions

View File

@ -659,4 +659,12 @@ $routes->post("ticketSave", "ThzController::ticketSave");
$routes->get("ticketList", "ThzController::ticketList");
$routes->post("ticketConversationSave", "ThzController::ticketConversationSave");
$routes->get("ticketConversationList", "ThzController::ticketConversationList");
$routes->post('ticketAutoFetchDetails',"ThzController::ticketAutoFetchDetails");
$routes->post('ticketAutoFetchDetails',"ThzController::ticketAutoFetchDetails");
//for testing
$routes->group('test', function($routes) {
$routes->post('api/saveForm', 'TestingController::saveForm');
});

View File

@ -5060,9 +5060,10 @@ class ClientController extends AdminController
// ---------- TICKET SERVICE CONTROLLER --------------------------------------------------------------------------------
$ticketServiceController = new TicketServiceController();
// $response = $ticketServiceController->claimDumpExcelFileFormatValidation(["file_id" => 3]);
// $response = $ticketServiceController->claimDumpExcelFileDataValidation(["file_id" => 3]);
// $response = $ticketServiceController->claimDumpOnBoardProcess(["file_id" => 3]);
// $response = $ticketServiceController->claimDumpExcelFileFormatValidation(["file_id" => 34]);
// $response = $ticketServiceController->claimDumpExcelFileDataValidation(["file_id" => 34]);
// $response = $ticketServiceController->getClaimExcelErrorData(["file_id" => 41]);
// $response = $ticketServiceController->claimDumpOnBoardProcess(["file_id" => 17]);
// $response = $ticketServiceController->extractExcelData("claims_dump_form_client.xlsx");
// dd($response);
@ -5079,8 +5080,16 @@ class ClientController extends AdminController
// $res = $empServiceController->employeesCorrectionProcess(['file_id' => '1681']);
// dd( $res);
// $EmployeeMultiEventServiceController = new EmployeeMultiEventServiceController();
// $res = $EmployeeMultiEventServiceController->constructMultiEventData(['file_id' => '1056']);
$EmployeeMultiEventServiceController = new EmployeeMultiEventServiceController();
// $res = $EmployeeMultiEventServiceController->constructMultiEventData(['file_id' => '1069']);
// $res = $EmployeeMultiEventServiceController->excelMultieventFileFormateValidation(['file_id' => '1084']);
// $res = $EmployeeMultiEventServiceController->excelMultieventFileDataValidation(['file_id' => '1069']);
// $res = $EmployeeMultiEventServiceController->excelMultieventFileOnBoard(['file_id' => '1069']);
// dd($res);
// $res = $EmployeeMultiEventServiceController->getExcelErrorData(1069, $res);
// $res['file_id'] = 1069;
// echo view('excel_errors', $res);
// dd($res);
// ---------- POLICY TRANSACTION CONTROLLER --------------------------------------------------------------------------------
@ -5454,10 +5463,21 @@ class ClientController extends AdminController
}
}
public function getTheEmpDataForClaimSearchByMobile($param, $type = 'mobile', $client_policy_id = null, $client_id = null)
public function getTheEmpDataForClaimSearchByMobile($param, $type = 'mobile', $client_policy_id = null, $client_id = null, $ticket_type_id = null)
{
$field_name = 'employees.' . $type;
$policy_type_id = [];
if($ticket_type_id == 1){
$policy_type_id = [2, 3, 4, 5];
}else if($ticket_type_id == 2){
$policy_type_id = [1];
}else if($ticket_type_id == 3){
$policy_type_id = [6];
}else if($ticket_type_id == 4){
$policy_type_id = [7];
}
// Construct the base query
$query = $this->clientPolicyModel
->select("
@ -5481,7 +5501,7 @@ class ClientController extends AdminController
->join('insurers', 'client_policy.insurer_id = insurers.id')
->join('tpa', 'client_policy.tpa_id = tpa.id', 'left')
->join('employees', 'clients.id = employees.client_id')
->join('employee_polices', 'employees.id = employee_polices.employee_id')
->join('employee_polices', 'employees.id = employee_polices.employee_id AND client_policy.id = employee_polices.client_policy_id')
->where('client_policy.is_active', 1)
->where('insurers.is_active', 1)
->where('tpa.is_active', 1)
@ -5499,6 +5519,10 @@ class ClientController extends AdminController
if (!empty($client_policy_id)) {
$query->where('employee_polices.client_policy_id', $client_policy_id);
}
if($policy_type_id != null){
$query->whereIn('client_policy.policy_type_id', $policy_type_id);
}
$query->groupBy('employees.id')
->orderBy('employees.id', 'DESC');
@ -6612,268 +6636,6 @@ class ClientController extends AdminController
// ------------------- DEMO CLIENT FUNCTION --------------------------------------------------------------------------------
// public function wipeDemoClient()
// {
// // $this->myLogger->logme('error', "Wipe Demo Client function called");
// $this->myLogger->logme('error', "Wipe Demo Client function called"); // Red text
// $this->myLogger->logme('error', "Wipe Demo client Payload : " . json_encode($this->request->getPost() ?? []));
// $client_id = $this->request->getPost('client_id');
// if (empty($client_id)) {
// return $this->respond(['status' => false, 'message' => 'Client id required'], 404);
// }
// // 1. Client Model
// $client_data = $this->clientModel->where('id', $client_id)->where('is_active', 1)->first();
// $this->myLogger->logme('error', "Client data : " . json_encode($client_data ?? []));
// if (!empty($client_data)) {
// $is_deleted = $this->clientModel->where('id', $client_id)->delete();
// if ($is_deleted) {
// $this->myLogger->logme('error', "Client data removed successfully.");
// } else {
// $this->myLogger->logme('error', "Client record does not exist.");
// }
// } else {
// return $this->respond(['status' => false, 'message' => 'Client not found'], 404);
// }
// // 2. Client RM Model
// $client_rm_data = $this->clientRMModel->where('client_id', $client_id)->first();
// $this->myLogger->logme('error', "Client Relationship Manager data : " . json_encode($client_rm_data ?? []));
// if (!empty($client_rm_data)) {
// $is_deleted = $this->clientRMModel->where('client_id', $client_id)->delete();
// if ($is_deleted) {
// $this->myLogger->logme('error', "Client Relationship Manager data removed successfully.");
// } else {
// $this->myLogger->logme('error', "Client Relationship Manager record does not exist. To delete");
// }
// } else {
// $this->myLogger->logme('error', "Client Relationship Manager data not found.");
// }
// // 3. Client KYC Docs Model
// $client_kyc_data = $this->clientKYCDocsModel->where('client_id', $client_id)->findAll();
// $this->myLogger->logme('error', "Client KYC Docs data : " . json_encode($client_kyc_data ?? []));
// if (!empty($client_kyc_data)) {
// $is_deleted = $this->clientKYCDocsModel->where('client_id', $client_id)->delete();
// if ($is_deleted) {
// $this->myLogger->logme('error', "Client KYC Docs data removed successfully.");
// } else {
// $this->myLogger->logme('error', "Client KYC Docs record does not exist. To delete");
// }
// } else {
// $this->myLogger->logme('error', "Client KYC Docs data not found.");
// }
// // 4. Client Branch Model
// $client_branch_data = $this->clientBranchModel->where('client_id', $client_id)->findAll();
// $this->myLogger->logme('error', "Client Branch data : " . json_encode($client_branch_data ?? []));
// $branch_ids = array_column($client_branch_data, 'id') ?? [];
// $this->myLogger->logme('error', "Client Branch id count : " . count($branch_ids ?? []));
// if (!empty($client_branch_data)) {
// $is_deleted = $this->clientBranchModel->where('client_id', $client_id)->delete();
// if ($is_deleted) {
// $this->myLogger->logme('error', "Client Branch data removed successfully.");
// if(!empty($branch_ids)){
// $level_contact_data = $this->levelContactModel->where('contact_type', 'client')->whereIn('ref_id', $branch_ids)->findAll();
// $this->myLogger->logme('error', "Level Contact data : " . json_encode($level_contact_data ?? []));
// $is_deleted = $this->levelContactModel->where('contact_type', 'client')->whereIn('ref_id', $branch_ids)->delete();
// if ($is_deleted) {
// $this->myLogger->logme('error', "Level Contact data removed successfully.");
// } else {
// $this->myLogger->logme('error', "Level Contact record does not exist. To delete");
// }
// }else{
// $this->myLogger->logme('error', "Level Contact data not found.");
// }
// } else {
// $this->myLogger->logme('error', "Client Branch record does not exist. To delete");
// }
// } else {
// $this->myLogger->logme('error', "Client Branch data not found.");
// }
// // 5. Client Policy Model
// $client_policy_data = $this->clientPolicyModel->where('client_id', $client_id)->findAll();
// $this->myLogger->logme('error', "Client Policy data : " . json_encode($client_policy_data ?? []));
// $policy_ids = array_column($client_policy_data, 'id') ?? [];
// $this->myLogger->logme('error', "Client Policy id count : " . count($policy_ids ?? []));
// if (!empty($client_policy_data)) {
// $is_deleted = $this->clientPolicyModel->where('client_id', $client_id)->delete();
// if ($is_deleted) {
// $this->myLogger->logme('error', "Client Policy data removed successfully.");
// if(!empty($policy_ids)){
// $employee_policy_data = $this->employeePolicyModel->whereIn('client_policy_id', $policy_ids)->findAll();
// $this->myLogger->logme('error', "Employee Policy data count : " . count($employee_policy_data ?? []));
// $is_deleted = $this->employeePolicyModel->whereIn('client_policy_id', $policy_ids)->delete();
// if ($is_deleted) {
// $this->myLogger->logme('error', "Employee policy data removed successfully.");
// } else {
// $this->myLogger->logme('error', "Employee policy record does not exist. To delete");
// }
// }else{
// $this->myLogger->logme('error', "Employee policy data not found.");
// }
// } else {
// $this->myLogger->logme('error', "Client Policy record does not exist. To delete");
// }
// } else {
// $this->myLogger->logme('error', "Client Policy data not found.");
// }
// // 6. Employee Model
// $employee_data = $this->employeeModel->where('client_id', $client_id)->findAll();
// $this->myLogger->logme('error', "Employee data count : " . count($employee_data ?? []));
// if (!empty($employee_data)) {
// $is_deleted = $this->employeeModel->where('client_id', $client_id)->delete();
// if ($is_deleted) {
// $this->myLogger->logme('error', "Employee data removed successfully.");
// } else {
// $this->myLogger->logme('error', "Employee record does not exist. To delete");
// }
// } else {
// $this->myLogger->logme('error', "Employee data not found.");
// }
// // 7. Client Deposit Model
// $client_deposit_data = $this->clientDepositModel->where('client_id', $client_id)->findAll();
// $this->myLogger->logme('error', "Client Deposit data : " . json_encode($client_deposit_data ?? []));
// if (!empty($client_deposit_data)) {
// $is_deleted = $this->clientDepositModel->where('client_id', $client_id)->delete();
// if ($is_deleted) {
// $this->myLogger->logme('error', "Client Deposit data removed successfully.");
// } else {
// $this->myLogger->logme('error', "Client Deposit record does not exist. To delete");
// }
// } else {
// $this->myLogger->logme('error', "Client Deposit data not found.");
// }
// // 8. Policy Premium 1 Model
// $policy_premium1_data = $this->policyPremium1Model->where('client_id', $client_id)->findAll();
// $this->myLogger->logme('error', "Policy Premium 1 data count : " . count($policy_premium1_data ?? []));
// if (!empty($policy_premium1_data)) {
// $is_deleted = $this->policyPremium1Model->where('client_id', $client_id)->delete();
// if ($is_deleted) {
// $this->myLogger->logme('error', "Policy Premium 1 data removed successfully.");
// } else {
// $this->myLogger->logme('error', "Policy Premium 1 record does not exist. To delete");
// }
// } else {
// $this->myLogger->logme('error', "Policy Premium 1 data not found.");
// }
// // 9. Policy Premium 2 Model
// $policy_premium2_data = $this->policyPremium2Model->where('client_id', $client_id)->findAll();
// $this->myLogger->logme('error', "Policy Premium 2 data count: " . count($policy_premium2_data ?? []));
// if (!empty($policy_premium2_data)) {
// $is_deleted = $this->policyPremium2Model->where('client_id', $client_id)->delete();
// if ($is_deleted) {
// $this->myLogger->logme('error', "Policy Premium 2 data removed successfully.");
// } else {
// $this->myLogger->logme('error', "Policy Premium 2 record does not exist. To delete");
// }
// } else {
// $this->myLogger->logme('error', "Policy Premium 2 data not found.");
// }
// // 10. Notification Model
// $notification_data = $this->notificationModel->where('client_id', $client_id)->findAll();
// $this->myLogger->logme('error', "Notification data : " . json_encode($notification_data ?? []));
// if (!empty($notification_data)) {
// $is_deleted = $this->notificationModel->where('client_id', $client_id)->delete();
// if ($is_deleted) {
// $this->myLogger->logme('error', "Notification data removed successfully.");
// } else {
// $this->myLogger->logme('error', "Notification record does not exist. To delete");
// }
// } else {
// $this->myLogger->logme('error', "Notification data not found.");
// }
// // 11. CD Master Model
// $cd_master_data = $this->CDMasterModel->where('client_id', $client_id)->findAll();
// $this->myLogger->logme('error', "CD Master data : " . json_encode($cd_master_data ?? []));
// if (!empty($cd_master_data)) {
// $is_deleted = $this->CDMasterModel->where('client_id', $client_id)->delete();
// if ($is_deleted) {
// $this->myLogger->logme('error', "CD Master data removed successfully.");
// } else {
// $this->myLogger->logme('error', "CD Master record does not exist. To delete");
// }
// } else {
// $this->myLogger->logme('error', "CD Master data not found.");
// }
// // 12. Policy Transaction Model
// $policy_transaction_data = $this->policyTransactionModel->where('client_id', $client_id)->findAll();
// $this->myLogger->logme('error', "Policy Transaction data : " . json_encode($policy_transaction_data ?? []));
// $pt_ids = array_column($policy_transaction_data, 'id') ?? [];
// $this->myLogger->logme('error', "Policy Transaction id count : " . count($pt_ids ?? []));
// if (!empty($policy_transaction_data)) {
// $is_deleted = $this->policyTransactionModel->where('client_id', $client_id)->delete();
// if ($is_deleted) {
// $this->myLogger->logme('error', "Policy Transaction data removed successfully.");
// if(!empty($pt_ids)){
// $pt_co_share_data = $this->PTCOShareDetailsModel->whereIn('pt_id', $pt_ids)->findAll();
// $this->myLogger->logme('error', "PT CO Share data : " . json_encode($pt_co_share_data ?? []));
// $is_deleted = $this->PTCOShareDetailsModel->whereIn('pt_id', $pt_ids)->delete();
// if ($is_deleted) {
// $this->myLogger->logme('error', "PT CO Share data removed successfully.");
// } else {
// $this->myLogger->logme('error', "PT CO Share record does not exist. To delete");
// }
// }else{
// $this->myLogger->logme('error', "PT CO Share data not found.");
// }
// } else {
// $this->myLogger->logme('error', "Policy Transaction record does not exist. To delete");
// }
// } else {
// $this->myLogger->logme('error', "Policy Transaction data not found.");
// }
// $this->myLogger->logme('error', "Wipe Demo Client function closed");
// return $this->respond(['status' => true, 'message' => 'Demo client data wiped successfully'], 200);
// }
public function wipeDemoClient()
{
$this->myLogger->logme('error', "========================================");

View File

@ -277,22 +277,28 @@ class EmployeeController extends AdminController
$file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $loggedInUserID, 'status' => $status, 'action' => $action, 'client_branch_id' => $branch_id,'uploaded_by' => 1, 'hr_file_id' => $hr_file_id]); //here field policy_id have client_policy_id and not policy id from policy master
$this->myLogger->logme("error", '{file_id} uploaded success', ['file_id' => $file_id]);
//start validation process
if($fileSize < 1) // if file size less than 1
{
$empServiceController = new EmployeeServiceController();
$result = $empServiceController->excelFileFormatValidation(['file_id' => $file_id]);
$this->myLogger->logme("error", '{file_id} is less than 1MB, validating on the fly', ['file_id' => $file_id]);
//endof validation process
if (isset($result['error_summary']) && count($result['error_summary'])) {
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'file rejected with errors'], 200);
}
}
else //if file size greater than 1 add the file as job
{
$job_details = new Jobs();
$r = Jobs::addJob(['job_name' => 'excelFileFormatValidation','payload' => ['file_id' => $file_id]]);
if ($action == "all") {
$r = Jobs::addJob(['job_name' => 'excelMultieventFileFormateValidation', 'payload' => ['file_id' => $file_id]]);
$this->myLogger->logme("error", '{file_id} is greather than 1MB, validating with job queue', ['file_id' => $file_id]);
} else {
//start validation process
if ($fileSize < 1) // if file size less than 1
{
$empServiceController = new EmployeeServiceController();
$result = $empServiceController->excelFileFormatValidation(['file_id' => $file_id]);
$this->myLogger->logme("error", '{file_id} is less than 1MB, validating on the fly', ['file_id' => $file_id]);
//endof validation process
if (isset($result['error_summary']) && count($result['error_summary'])) {
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'file rejected with errors'], 200);
}
} else //if file size greater than 1 add the file as job
{
$job_details = new Jobs();
$r = Jobs::addJob(['job_name' => 'excelFileFormatValidation', 'payload' => ['file_id' => $file_id]]);
$this->myLogger->logme("error", '{file_id} is greather than 1MB, validating with job queue', ['file_id' => $file_id]);
}
}
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => 'file upload success'], 200);
@ -303,7 +309,7 @@ class EmployeeController extends AdminController
//for TPA/insurer upload
$data['events'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
//for inception upload
$data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
$data['actions'] = ['all' => 'All', 'inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
// $data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement','enrollment' => 'Enrolment'];
// $data['import_or_export'] = ['import' => 'Import', 'export' => 'Export'];
@ -469,6 +475,8 @@ class EmployeeController extends AdminController
$filePath = ROOTPATH . 'public/sample_excel/sample_inception.xls';
}else if ($actionType == 'member_data') {
$filePath = ROOTPATH . 'public/sample_excel/Sample_Member_Data.xlsx';
}else if ($actionType == 'all') {
$filePath = ROOTPATH . 'public/sample_excel/sample_multievent_file.xlsx';
}
// Check if the file exists

File diff suppressed because it is too large Load Diff

View File

@ -155,6 +155,18 @@ class JobWorker extends AdminController
'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\TicketServiceController',
],
'excelMultieventFileFormateValidation' => [
'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\EmployeeMultiEventServiceController',
],
'excelMultieventFileDataValidation' => [
'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\EmployeeMultiEventServiceController',
],
'excelMultieventFileOnBoard' => [
'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\EmployeeMultiEventServiceController',
],
];

View File

@ -383,6 +383,20 @@ class LeadsController extends BaseController
$data['source_policy_end_date'] = null;
}
//convert the date
if (!empty($data['next_reminder_date'])) {
$data['next_reminder_date'] = change_date_format($data['next_reminder_date']);
} else {
$data['next_reminder_date'] = null;
}
//convert 0 and 1
if (isset($data['is_insurer_auto_mail'])) {
$data['is_insurer_auto_mail'] = 1;
} else {
$data['is_insurer_auto_mail'] = 0;
}
// $file_name = file_Upload($files[$index], $uploadFilePath);
$last_3_years_claims = $data['finyear'];
@ -459,9 +473,12 @@ class LeadsController extends BaseController
'lead_form_type' => $data['lead_form_type'] ?? 1,
'custom_fields' => $data['custom_fields'] ?? null,
'source_policy_start_date' => $data['source_policy_start_date'] ?? null,
'source_policy_end_date' => $data['source_policy_end_date'] ?? null,
'claim_history' => $data['claim_history'] ?? 0
'source_policy_start_date' => $data['source_policy_start_date'] ?? null,
'source_policy_end_date' => $data['source_policy_end_date'] ?? null,
'claim_history' => $data['claim_history'] ?? 0,
'next_reminder_date' => $data['next_reminder_date'] ?? 0,
'is_insurer_auto_mail' => $data['is_insurer_auto_mail'] ?? 0
];
}
// print_r($processedData);die();
@ -3627,7 +3644,7 @@ class LeadsController extends BaseController
}
if (!empty($data['lead_edit_data'])) {
foreach (['policy_start_date', 'policy_end_date', 'source_policy_start_date', 'source_policy_end_date', 'incurred_claims_date'] as $dateField) {
foreach (['policy_start_date', 'policy_end_date', 'source_policy_start_date', 'source_policy_end_date', 'incurred_claims_date', 'next_reminder_date'] as $dateField) {
$data['lead_edit_data'][$dateField] = !empty($data['lead_edit_data'][$dateField])
? change_date_format($data['lead_edit_data'][$dateField], 'Y-m-d', 'd/m/Y')
: null;

View File

@ -0,0 +1,25 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\API\ResponseTrait;
class TestingController extends BaseController
{
use ResponseTrait;
public function saveForm()
{
// Get JSON input
$data = $this->request->getPost();
// For testing: just return the received data
return $this->respond([
'status' => 'success',
'message' => 'Form data received successfully!',
'data' => $data
]);
}
}

View File

@ -1868,18 +1868,40 @@ class TicketController extends BaseController
public function getPoliciesbyEmpID()
{
$received_data = $this->request->getPost();
$ticket_type_id = $this->request->getPost('ticket_type_id') ?? null;
$emp_id = $received_data['emp_id'];
// Get all client policy IDs for the given employee
$policies = $this->employeePolicyModel
->select('client_policy_id')
->where('employee_id', $emp_id)
->where('is_active', 1)
->where('status', 'active')
->findAll();
if ($ticket_type_id == 1) {
//get the self data for get the all policy list aginst the emp_code
$self_data = $this->employeeModel->where('is_active', 1)->where('id', $emp_id)->first();
$db = db_connect();
$builder = $db->table('employees e');
$builder->select('ep.*');
$builder->join('employee_polices ep', 'e.id = ep.employee_id');
$builder->join('client_policy cp', 'cp.id = ep.client_policy_id AND cp.policy_type_id IN (2,3,4,5)');
$builder->where('e.is_active', 1);
$builder->where('ep.is_active', 1);
$builder->where('e.emp_code', $self_data['emp_code']);
$builder->groupBy('client_policy_id');
$query = $builder->get();
$policies = $query->getResultArray();
} else {
$policies = $this->employeePolicyModel
->select('client_policy_id')
->where('employee_id', $emp_id)
->where('is_active', 1)
->where('status', 'active')
->findAll();
}
// Return empty if no policies found
if (empty($policies)) {
return []; // Return empty if no policies found
return [];
}
// Extract client policy IDs into an array
@ -1902,7 +1924,7 @@ class TicketController extends BaseController
->join('tpa', 'tpa.id = client_policy.tpa_id AND tpa.is_active = 1', 'left')
->where('client_policy.policy_status', 1)
->whereIn('client_policy.id', $policy_ids)
->findAll();
->findAll();
// dd($policyNameandID);
if ($policyNameandID){

View File

@ -7,5 +7,5 @@ use CodeIgniter\Model;
class GmailSentHistoryModel extends Model{
protected $table = 'gmail_sent_history';
protected $primaryKey = 'id';
protected $allowedFields = ["id", "mail", "bcc", "cc", "message", "attachments", "client_id", "client_branch_id", "client_policy_id", "employee_policy_id", "employee_id", "mail_type", "gmail_api_status", "gmail_api_id", "created_by", "created_at", "updated_by", "updated_at", "isactive","received_message"];
protected $allowedFields = ["id", "mail", "bcc", "cc", "message", "attachments", "client_id", "client_branch_id", "client_policy_id", "employee_policy_id", "employee_id", "mail_type", "gmail_api_status", "gmail_api_id", "created_by", "created_at", "updated_by", "updated_at", "isactive","received_message", "common"];
}

View File

@ -101,6 +101,10 @@ class LeadsModel extends Model
'total_lives_at_incept',
'premium_at_incept',
'next_reminder_date',
'is_insurer_auto_mail',
'quote_received_insurer',
];

View File

@ -33,7 +33,9 @@ class LevelContactModel extends Model
->select('
level_contacts.id,
insurers.short_name as insurer_name,
insurers.id as insurer_id,
insurer_branch.branch_code,
insurer_branch.id as insurer_branch_id,
level_contacts.name as contact_person_name,
level_contacts.email as contact_person_email
')
@ -51,7 +53,7 @@ class LevelContactModel extends Model
$query->where('insurer_branch.insurer_id', $insurer_id);
}
$result = $query->get()->getResultArray();
$result = $query->orderBy('insurers.id')->get()->getResultArray();
return $result;
}

View File

@ -332,6 +332,20 @@
</select>
</div>
<div class="form-group col-md-3">
<label for="">Next Reminder Date<span class="text-danger"></span></label>
<input type="text" class="form-control" id="next_reminder_date" name="next_reminder_date" placeholder="DD/MM/YYYY">
</div>
<div class="form-group col-md-3">
<label class="switch" style="position: relative;top: 33px;left: 0px;">
<input id="is_insurer_auto_mail" type="checkbox" name="is_insurer_auto_mail">
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="is_insurer_auto_mail" style="position: relative;top: 35px;left: 20px;">Insurer Auto Mail</label>
</div>
</div>
<div class="form-row">
@ -556,6 +570,12 @@
console.log('---- completed ----')
var next_reminder_date = flatpickr("#next_reminder_date", {
dateFormat: "d/m/Y",
allowInput: false,
maxDate: "today"
});
})
//------------------------------ GET DATA ( EDIT, BRANCH, POLICY ) ---------------------------------------------------------------------------

View File

@ -823,6 +823,13 @@ if (isset($selected_lead_type)) {
$('#entity_type_id').val(data.entity_type_id || '');
$('#lead_status').val(data.status || '');
$('#notes').val(data.notes || '');
$('#next_reminder_date').val(data.next_reminder_date || '');
if (data.is_insurer_auto_mail == 1) {
$('#is_insurer_auto_mail').prop('checked', true);
} else {
$('#is_insurer_auto_mail').prop('checked', false);
}
// setTimeout(() => {
// $('#client_id').val(data.client_id || '').change();
@ -1144,7 +1151,5 @@ if (isset($selected_lead_type)) {
});
}
</script>
<?php } ?>

View File

@ -229,6 +229,7 @@
});
var policy_type_id = "";
var other_auto_save_enable = false;
$('body').on('click', '.btnPolicyMaster', function() {
$("#append_html_for_other_policy_terms").empty();
@ -276,10 +277,12 @@
if (res.emp_count_by_policy != 0) {
$("#btnOtherTermsSubmit").hide();
$("#otherButtonSpecialCondition").hide();
other_auto_save_enable = false;
} else {
$("#btnOtherTermsSubmit").show();
$("#otherButtonSpecialCondition").show();
startAutoSubmit('OTHERS');
// startAutoSubmit('OTHERS');
other_auto_save_enable = true;
}
@ -760,12 +763,12 @@
}
function beautifyString(str) {
return str
.split('_') // Split the string by underscores
.map(word =>
word.charAt(0).toUpperCase() + word.slice(1).toLowerCase() // Capitalize each word
)
.join(' '); // Join with spaces instead of underscores
return str
.split('_') // Split the string by underscores
.map(word =>
word.charAt(0).toUpperCase() + word.slice(1).toLowerCase() // Capitalize each word
)
.join(' '); // Join with spaces instead of underscores
}
function autoSaveOtherTerms(){
@ -836,4 +839,42 @@
}
function debounceothers(fn, delay) {
let timeout;
return function () {
clearTimeout(timeout);
timeout = setTimeout(fn, delay);
};
}
$(document).ready(function () {
const form = document.querySelector("#otherPolicyTerms");
// MutationObserver (always runs)
const observer = new MutationObserver(() => {
$("#otherPolicyTerms").find("input, select, textarea").each(function () {
if (other_auto_save_enable) { // only bind autosave if enabled
if (!$(this).attr("data-observed")) {
const debouncedSave = debounceothers(autoSaveOtherTerms, 1000);
$(this).on("input change", debouncedSave);
$(this).attr("data-observed", "true");
}
}
});
});
observer.observe(form, { childList: true, subtree: true });
// Bind for existing fields (only if enabled)
if (other_auto_save_enable) {
const debouncedSave = debounceothers(autoSaveOtherTerms, 1000);
$("#otherPolicyTerms").find("input, select, textarea").each(function () {
$(this).on("input change", debouncedSave);
$(this).attr("data-observed", "true");
});
} else {
console.log("This policy has employee processed (autosave disabled) -- OTHERS") ;
}
});
</script>

View File

@ -887,6 +887,7 @@
<script>
var policy_grid_id = $('#client_id').val();
var grid_html = '';
var gmc_auto_save_enable = false;
$('.close').click(function() {
@ -1136,10 +1137,12 @@
if (response.emp_count_by_policy != 0) {
$('#btnGridSubmit1').hide();
$('#myButtonSpecialCondition').hide();
gmc_auto_save_enable = false;
} else {
$('#btnGridSubmit1').show();
$('#myButtonSpecialCondition').show();
startAutoSubmit('GMC');
// startAutoSubmit('GMC');
gmc_auto_save_enable = true;
}
let jsonObject = JSON.parse(response.data);
@ -1991,4 +1994,43 @@
}
function debounce(fn, delay) {
let timeout;
return function () {
clearTimeout(timeout);
timeout = setTimeout(fn, delay);
};
}
$(document).ready(function () {
const form = document.querySelector("#policyJsonForm");
// MutationObserver (always runs)
const observer = new MutationObserver(() => {
$("#policyJsonForm").find("input, select, textarea").each(function () {
if (gmc_auto_save_enable) { // only bind autosave if enabled
if (!$(this).attr("data-observed")) {
const debouncedSave = debounce(autoSaveGmcTerms, 1000);
$(this).on("input change", debouncedSave);
$(this).attr("data-observed", "true");
}
}
});
});
observer.observe(form, { childList: true, subtree: true });
// Bind for existing fields (only if enabled)
if (gmc_auto_save_enable) {
const debouncedSave = debounce(autoSaveGmcTerms, 1000);
$("#policyJsonForm").find("input, select, textarea").each(function () {
$(this).on("input change", debouncedSave);
$(this).attr("data-observed", "true");
});
} else {
console.log("This policy has employee processed (autosave disabled) -- GMC") ;
}
});
</script>

View File

@ -473,6 +473,7 @@
var policy_grid_id = $('#client_id').val();
var grid_html = '';
var gpa_auto_save_enable = false;
$("#policyGPATerms").submit(function(event) {
@ -603,10 +604,12 @@
if (res.emp_count_by_policy != 0) {
$("#btnGPATermsSubmit").hide();
$("#gpaButtonSpecialCondition").hide();
gpa_auto_save_enable = false;
} else {
$("#btnGPATermsSubmit").show();
$("#gpaButtonSpecialCondition").show();
startAutoSubmit('GPA');
gpa_auto_save_enable = true;
}
@ -720,7 +723,17 @@
// console.log('jsonObject value', jsonObject[key])
// console.log('jsonObject value type', typeof jsonObject[key])
let elements = document.getElementsByName(key);
let elements; // declare the element variable
if (key === "terrorism") {
let form = document.getElementById("policyGPATerms");
elements = form.querySelectorAll('[name="terrorism"]');
} else {
elements = document.getElementsByName(key);
}
// let elements = document.getElementsByName(key);
if (elements && elements.length > 0) {
let element = elements[0];
@ -1086,4 +1099,43 @@
});
}
function debouncegpa(fn, delay) {
let timeout;
return function () {
clearTimeout(timeout);
timeout = setTimeout(fn, delay);
};
}
$(document).ready(function () {
const form = document.querySelector("#policyGPATerms");
// MutationObserver (always runs)
const observer = new MutationObserver(() => {
$("#policyGPATerms").find("input, select, textarea").each(function () {
if (gpa_auto_save_enable) { // only bind autosave if enabled
if (!$(this).attr("data-observed")) {
const debouncedSave = debouncegpa(autoSaveGpaTerms, 1000);
$(this).on("input change", debouncedSave);
$(this).attr("data-observed", "true");
}
}
});
});
observer.observe(form, { childList: true, subtree: true });
// Bind for existing fields (only if enabled)
if (gpa_auto_save_enable) {
const debouncedSave = debouncegpa(autoSaveGpaTerms, 1000);
$("#policyGPATerms").find("input, select, textarea").each(function () {
$(this).on("input change", debouncedSave);
$(this).attr("data-observed", "true");
});
} else {
console.log("This policy has employee processed (autosave disabled) -- GPA");
}
});
</script>

View File

@ -916,8 +916,11 @@
hiddenData = $("#empIDHidden").val();
hiddenData = JSON.parse(hiddenData);
console.log('employee id ', hiddenData['emp_id']);
let ticket_type_id = $('#ticket_type_id').val();
console.log("ticket_type_id", ticket_type_id);
data = {
emp_id: hiddenData['emp_id']
emp_id: hiddenData['emp_id'],
ticket_type_id: ticket_type_id,
}
$.ajax({
url: '<?= base_url("/ticket/getPoliciesbyEmpID") ?>',

View File

@ -205,6 +205,7 @@
var client_list = ''; // local variable for storing the client branch list
var branch_list = ''; // local variable for storing the client branch list
var policy_list = ''; // local variable for storing the client policy list
var selected_ticket_type_id = `<?= $selected_ticket_type ?? null ?>`;
$(document).ready(function() {
getClientAndBranchAndPolicy();
@ -575,7 +576,8 @@
let type = $('#employee_data_points').val()
let param = $('#emp_mobile_number_for_claim').val()
let client_policy_id = $('#emp_client_policy_data_list').val()
let client_id = $('#mobile_emp_client_data_list').val()
let client_id = $('#mobile_emp_client_data_list').val();
console.log('selected_ticket_type_id', selected_ticket_type_id);
if (searchType == 'client') {
type = 'emp_code';
@ -583,7 +585,7 @@
client_id = $('#emp_client_data_list').val()
}
let url = '<?= base_url('util/getTheEmpDataForClaimSearchByMobile/') ?>' + param + '/' + type + '/' +
client_policy_id + '/' + client_id;
client_policy_id + '/' + client_id + '/'+ selected_ticket_type_id;
// Data to send in the AJAX request
let requestData = {
@ -591,6 +593,7 @@
type: type,
client_policy_id: client_policy_id,
client_id: client_id,
ticket_type_id: selected_ticket_type_id,
};
// Show loader

View File

@ -3667,7 +3667,7 @@ function appendInput(data) {
for (const id in contacts) {
const contact = contacts[id];
html += `
<option value="${contact.id}">${contact.insurer_name} - ${contact.branch_code} - ${contact.contact_person_name} - ${contact.contact_person_email}</option>
<option value="${contact.id}" data-value="${contact.insurer_branch_id}-${contact.insurer_id}" >${contact.insurer_name} - ${contact.branch_code} - ${contact.contact_person_name} - ${contact.contact_person_email}</option>
`;
}
@ -3839,13 +3839,21 @@ function constructURL_ForInsurerAndClientMailSend() {
} else {
var insurerContact = $('#insurerContact').val();
insurerContact = insurerContact.map(Number);
let insurerIds = [];
$("#insurerContact option:selected").each(function () {
insurerIds.push($(this).data("value"));
});
console.log(insurerIds);
formData.append('file_type', 'rfq');
formData.append('recipient_type', 'insurer');
formData.append('recipient_mail', JSON.stringify(insurerContact));
formData.append('insurer_ids', JSON.stringify(insurerIds));
}
ajaxRequest(formData)
console.log('formData', formData)
ajaxRequest(formData);
console.log('formData', formData);
}

Binary file not shown.

Binary file not shown.