Merge branch 'dev' of bitbucket.org:jubilian/nhance-enrollment into dev
@ -71,6 +71,20 @@ class Database extends Config
|
|||||||
'busyTimeout' => 1000,
|
'busyTimeout' => 1000,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public $postDB = [
|
||||||
|
'DSN' => '',
|
||||||
|
'hostname' => 'localhost',
|
||||||
|
'username' => 'root',
|
||||||
|
'password' => 'root',
|
||||||
|
'database' => 'other_db',
|
||||||
|
'DBDriver' => 'MySQLi',
|
||||||
|
'DBPrefix' => '',
|
||||||
|
'pConnect' => false,
|
||||||
|
'DBDebug' => (ENVIRONMENT !== 'production'),
|
||||||
|
'charset' => 'utf8',
|
||||||
|
'DBCollat' => 'utf8_general_ci',
|
||||||
|
];
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|||||||
@ -70,6 +70,7 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get('deposit/(:num)', 'ClientController::deposit/$1');
|
$routes->get('deposit/(:num)', 'ClientController::deposit/$1');
|
||||||
$routes->get('remove/(:num)', 'ClientController::removeClient/$1');
|
$routes->get('remove/(:num)', 'ClientController::removeClient/$1');
|
||||||
$routes->get("list/(:any)", "ClientController::editClientOnboarding/$1");
|
$routes->get("list/(:any)", "ClientController::editClientOnboarding/$1");
|
||||||
|
$routes->post('wipe', 'ClientController::wipeDemoClient');
|
||||||
// application/config/routes.php
|
// application/config/routes.php
|
||||||
|
|
||||||
// Add a route for the view_Deposit method
|
// Add a route for the view_Deposit method
|
||||||
@ -157,6 +158,8 @@ $routes->group("/employee", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->post("test-rack-rate", "EmployeeController::testRackRate");
|
$routes->post("test-rack-rate", "EmployeeController::testRackRate");
|
||||||
$routes->get('test_members_list', 'EmployeeController::test_members_list');
|
$routes->get('test_members_list', 'EmployeeController::test_members_list');
|
||||||
$routes->post('get_emp_history','EmployeeController::getEmpHistory');
|
$routes->post('get_emp_history','EmployeeController::getEmpHistory');
|
||||||
|
$routes->post('download_inception','EmployeeController::download_inception');
|
||||||
|
$routes->get('download_file','EmployeeController::download_file');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -344,7 +347,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->post('saveSIMapping','ClientController::saveSIMapping');
|
$routes->post('saveSIMapping','ClientController::saveSIMapping');
|
||||||
$routes->post('checkSIMapping','ClientController::checkSIMapping');
|
$routes->post('checkSIMapping','ClientController::checkSIMapping');
|
||||||
$routes->post('deleteMapping','ClientController::deleteMapping');
|
$routes->post('deleteMapping','ClientController::deleteMapping');
|
||||||
|
$routes->get('removeLevelContacts','ClientController::removeLevelContacts');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -445,6 +448,7 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
|
|||||||
|
|
||||||
$routes->post("employeeRest/saveMpin", "RestAuthenticationController::saveMpin");
|
$routes->post("employeeRest/saveMpin", "RestAuthenticationController::saveMpin");
|
||||||
$routes->post("employeeRest/updateMpin", "RestAuthenticationController::updateMpin");
|
$routes->post("employeeRest/updateMpin", "RestAuthenticationController::updateMpin");
|
||||||
|
$routes->post("employeeRest/forgotMPIN", "RestAuthenticationController::forgotMPIN");
|
||||||
$routes->post("calculatePremium", "EmployeeRestController::calculatePremium");
|
$routes->post("calculatePremium", "EmployeeRestController::calculatePremium");
|
||||||
|
|
||||||
// $routes->post("employeeRest/createOrUpdateEmployeePolicySiAmount", "EmployeeRestController::createOrUpdateEmployeePolicySiAmount");
|
// $routes->post("employeeRest/createOrUpdateEmployeePolicySiAmount", "EmployeeRestController::createOrUpdateEmployeePolicySiAmount");
|
||||||
@ -489,10 +493,13 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
|||||||
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
|
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
|
||||||
$routes->get("getFEContent", "EmployeeRestController::getFEContent");
|
$routes->get("getFEContent", "EmployeeRestController::getFEContent");
|
||||||
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
|
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
|
||||||
|
$routes->post("logHrActivity", "RestAuthenticationController::logHrActivity");
|
||||||
|
|
||||||
});
|
});
|
||||||
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
|
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
|
||||||
$routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification");
|
$routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification");
|
||||||
$routes->post("sendEmail", "EmployeeRestController::send_email");
|
$routes->post("sendEmail", "EmployeeRestController::send_email");
|
||||||
|
$routes->get("getPolicyLevelEmployeeSummaryData", "EmployeeRestController::getPolicyLevelEmployeeSummaryData");
|
||||||
|
|
||||||
$routes->get("getBackToEnrolledDetails", "EmployeeRestController::getBackToEnrolledDetails");
|
$routes->get("getBackToEnrolledDetails", "EmployeeRestController::getBackToEnrolledDetails");
|
||||||
|
|
||||||
@ -505,5 +512,7 @@ $routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderM
|
|||||||
$routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
|
$routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
|
||||||
$routes->get("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy");
|
$routes->get("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy");
|
||||||
$routes->post("addEmployeeAndDependence", "EmployeeRestController::addEmployeeAndDependence");
|
$routes->post("addEmployeeAndDependence", "EmployeeRestController::addEmployeeAndDependence");
|
||||||
|
$routes->post("getPreEmployeePolicyCount", "EmployeeRestController::getPreEmployeePolicyCount");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -138,7 +138,7 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
// Perform the query
|
// Perform the query
|
||||||
$builder = $db->table($table);
|
$builder = $db->table($table);
|
||||||
$isDuplicate = $builder->where($field, $value)->countAllResults() > 0;
|
$isDuplicate = $builder->where($field, $value)->where('is_active', 1)->countAllResults() > 0;
|
||||||
|
|
||||||
// Return the result
|
// Return the result
|
||||||
return $this->response->setJSON(['isDuplicate' => $isDuplicate]);
|
return $this->response->setJSON(['isDuplicate' => $isDuplicate]);
|
||||||
@ -866,6 +866,12 @@ class ClientController extends AdminController
|
|||||||
$data['created_by'] = get_session_userid();
|
$data['created_by'] = get_session_userid();
|
||||||
$insert = $this->clientBranchModel->insert($data);
|
$insert = $this->clientBranchModel->insert($data);
|
||||||
|
|
||||||
|
if ($insert) {
|
||||||
|
$level_contact_data = $this->request->getPost('level_contect_data');
|
||||||
|
$level_contact_data = !empty($level_contact_data) ? json_decode($level_contact_data, true) : null;
|
||||||
|
$this->saveLevelContacts($level_contact_data, $insert);
|
||||||
|
}
|
||||||
|
|
||||||
// if ($insert) {
|
// if ($insert) {
|
||||||
// for ($i = 0; $i < count($this->request->getPost('name')); $i++) {
|
// for ($i = 0; $i < count($this->request->getPost('name')); $i++) {
|
||||||
// // Prepare data to insert
|
// // Prepare data to insert
|
||||||
@ -968,6 +974,11 @@ class ClientController extends AdminController
|
|||||||
$insert = $this->clientBranchModel->update($id, $data);
|
$insert = $this->clientBranchModel->update($id, $data);
|
||||||
$this->myLogger->logme('error', 'Client branch EDITED by {data}', ['data' => get_session_userid()]);
|
$this->myLogger->logme('error', 'Client branch EDITED by {data}', ['data' => get_session_userid()]);
|
||||||
|
|
||||||
|
if ($insert) {
|
||||||
|
$level_contact_data = $this->request->getPost('level_contect_data');
|
||||||
|
$level_contact_data = !empty($level_contact_data) ? json_decode($level_contact_data, true) : null;
|
||||||
|
$this->saveLevelContacts($level_contact_data, $id);
|
||||||
|
}
|
||||||
|
|
||||||
// if ($insert) {
|
// if ($insert) {
|
||||||
|
|
||||||
@ -1005,6 +1016,57 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function saveLevelContacts($level_contact_data, $branch_id)
|
||||||
|
{
|
||||||
|
if (!empty($level_contact_data) && is_array($level_contact_data)) {
|
||||||
|
foreach ($level_contact_data as $value) {
|
||||||
|
if (!empty($value['id'])) {
|
||||||
|
$id = $value['id'];
|
||||||
|
unset($value['id']);
|
||||||
|
$this->levelContactModel->update($id, $value);
|
||||||
|
} else {
|
||||||
|
unset($value['id']);
|
||||||
|
$value['contact_type'] = "client";
|
||||||
|
$value['ref_id'] = $branch_id ?? null;
|
||||||
|
$this->levelContactModel->insert($value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeLevelContacts()
|
||||||
|
{
|
||||||
|
$id = $this->request->getGet('id');
|
||||||
|
try {
|
||||||
|
if (empty($id)) {
|
||||||
|
return $this->respond([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Invalid ID provided. ID is empty',
|
||||||
|
'data' => $id
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$updated = $this->levelContactModel->update($id, ['is_active' => 0]);
|
||||||
|
|
||||||
|
if ($updated === false) {
|
||||||
|
return $this->respond([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Failed to remove contact'
|
||||||
|
], 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Contact removed successfully'
|
||||||
|
]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->respond([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'An error occurred: ' . $e->getMessage()
|
||||||
|
], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function createClientPolicy()
|
public function createClientPolicy()
|
||||||
@ -4435,11 +4497,13 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$employeeRestController = new EmployeeServiceController();
|
$employeeRestController = new EmployeeServiceController();
|
||||||
// $employeeRestController->excelFileDataValidation(['file_id' => 823]);
|
// $employeeRestController->excelFileDataValidation(['file_id' => 823]);
|
||||||
|
// $res = $employeeRestController->excelFileFormatValidation(['file_id' => 897]);
|
||||||
|
// $res = $employeeRestController->getExcelErrorData(['file_id' => 897]);
|
||||||
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 644]);
|
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 644]);
|
||||||
// $employeeRestController->employeesOnboardProcess(['file_id' => 835]);
|
// $employeeRestController->employeesOnboardProcess(['file_id' => 835]);
|
||||||
// $employeeRestController->employeesEnrollmentInsert(['file_id' => 836]);
|
// $employeeRestController->employeesEnrollmentInsert(['file_id' => 836]);
|
||||||
// $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]);
|
// $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]);
|
||||||
|
// dd($res);
|
||||||
|
|
||||||
// ----------EMP DATA SERVICE CONTROLLER--------------------------------------------------------------------------------
|
// ----------EMP DATA SERVICE CONTROLLER--------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -4816,4 +4880,246 @@ class ClientController extends AdminController
|
|||||||
return $this->respond(['status'=> false,'code'=>404,'message'=>'Mapping Deletion Failed'],200);
|
return $this->respond(['status'=> false,'code'=>404,'message'=>'Mapping Deletion Failed'],200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------- DEMO CLIENT FUNCTION --------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public function wipeDemoClient()
|
||||||
|
{
|
||||||
|
$this->myLogger->logme('error', "========================================");
|
||||||
|
$this->myLogger->logme('error', "WIPE DEMO CLIENT FUNCTION STARTED");
|
||||||
|
$this->myLogger->logme('error', "========================================");
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', "Request Payload: " . json_encode($this->request->getPost() ?? []));
|
||||||
|
$client_id = $this->request->getPost('client_id');
|
||||||
|
|
||||||
|
if (empty($client_id)) {
|
||||||
|
$this->myLogger->logme('error', "ERROR: Client ID is required");
|
||||||
|
return $this->respond(['status' => false, 'message' => 'Client id required'], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', "Client ID to wipe: " . $client_id);
|
||||||
|
$this->myLogger->logme('error', "----------------------------------------");
|
||||||
|
|
||||||
|
// ========================================
|
||||||
|
// 1. CLIENT MODEL DELETION
|
||||||
|
// ========================================
|
||||||
|
$this->myLogger->logme('error', "1. PROCESSING CLIENT MODEL");
|
||||||
|
$client_data = $this->clientModel->where('id', $client_id)->where('is_active', 1)->first();
|
||||||
|
$this->myLogger->logme('error', " Found 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', " ✗ Failed to delete client record");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->myLogger->logme('error', " ✗ Client not found or inactive");
|
||||||
|
return $this->respond(['status' => false, 'message' => 'Client not found'], 404);
|
||||||
|
}
|
||||||
|
$this->myLogger->logme('error', "----------------------------------------");
|
||||||
|
|
||||||
|
// ========================================
|
||||||
|
// 2. CLIENT RM MODEL DELETION
|
||||||
|
// ========================================
|
||||||
|
$this->myLogger->logme('error', "2. PROCESSING CLIENT RM MODEL");
|
||||||
|
$client_rm_data = $this->clientRMModel->where('client_id', $client_id)->first();
|
||||||
|
$this->myLogger->logme('error', " Found Client RM 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 RM data removed successfully");
|
||||||
|
} else {
|
||||||
|
$this->myLogger->logme('error', " ✗ Failed to delete Client RM record");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->myLogger->logme('error', " ℹ No Client RM data found");
|
||||||
|
}
|
||||||
|
$this->myLogger->logme('error', "----------------------------------------");
|
||||||
|
|
||||||
|
// ========================================
|
||||||
|
// 3. CLIENT KYC DOCS MODEL DELETION
|
||||||
|
// ========================================
|
||||||
|
$this->myLogger->logme('error', "3. PROCESSING CLIENT KYC DOCS MODEL");
|
||||||
|
$client_kyc_data = $this->clientKYCDocsModel->where('client_id', $client_id)->findAll();
|
||||||
|
$this->myLogger->logme('error', " Found Client KYC Records: " . count($client_kyc_data ?? []));
|
||||||
|
$this->myLogger->logme('error', " Client KYC 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', " ✗ Failed to delete Client KYC Docs records");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->myLogger->logme('error', " ℹ No Client KYC Docs data found");
|
||||||
|
}
|
||||||
|
$this->myLogger->logme('error', "----------------------------------------");
|
||||||
|
|
||||||
|
// ========================================
|
||||||
|
// 4. CLIENT BRANCH MODEL DELETION
|
||||||
|
// ========================================
|
||||||
|
$this->myLogger->logme('error', "4. PROCESSING CLIENT BRANCH MODEL");
|
||||||
|
$client_branch_data = $this->clientBranchModel->where('client_id', $client_id)->findAll();
|
||||||
|
$branch_ids = array_column($client_branch_data, 'id') ?? [];
|
||||||
|
$this->myLogger->logme('error', " Found Client Branch Records: " . count($client_branch_data ?? []));
|
||||||
|
$this->myLogger->logme('error', " Branch IDs: " . json_encode($branch_ids));
|
||||||
|
$this->myLogger->logme('error', " Client Branch Data: " . json_encode($client_branch_data ?? []));
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
// Delete related Level Contact data
|
||||||
|
if (!empty($branch_ids)) {
|
||||||
|
$this->myLogger->logme('error', " 4a. PROCESSING RELATED LEVEL CONTACT DATA");
|
||||||
|
$level_contact_data = $this->levelContactModel->where('contact_type', 'client')->whereIn('ref_id', $branch_ids)->findAll();
|
||||||
|
$this->myLogger->logme('error', " Found Level Contact Records: " . count($level_contact_data ?? []));
|
||||||
|
$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', " ✗ Failed to delete Level Contact records");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->myLogger->logme('error', " ℹ No Branch IDs available for Level Contact deletion");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->myLogger->logme('error', " ✗ Failed to delete Client Branch records");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->myLogger->logme('error', " ℹ No Client Branch data found");
|
||||||
|
}
|
||||||
|
$this->myLogger->logme('error', "----------------------------------------");
|
||||||
|
|
||||||
|
// ========================================
|
||||||
|
// 5. CLIENT POLICY MODEL DELETION
|
||||||
|
// ========================================
|
||||||
|
$this->myLogger->logme('error', "5. PROCESSING CLIENT POLICY MODEL");
|
||||||
|
$client_policy_data = $this->clientPolicyModel->where('client_id', $client_id)->findAll();
|
||||||
|
$policy_ids = array_column($client_policy_data, 'id') ?? [];
|
||||||
|
$this->myLogger->logme('error', " Found Client Policy Records: " . count($client_policy_data ?? []));
|
||||||
|
$this->myLogger->logme('error', " Policy IDs: " . json_encode($policy_ids));
|
||||||
|
$this->myLogger->logme('error', " Client Policy Data: " . json_encode($client_policy_data ?? []));
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
// Delete related Employee Policy data
|
||||||
|
if (!empty($policy_ids)) {
|
||||||
|
$this->myLogger->logme('error', " 5a. PROCESSING RELATED EMPLOYEE POLICY DATA");
|
||||||
|
$employee_policy_data = $this->employeePolicyModel->whereIn('client_policy_id', $policy_ids)->findAll();
|
||||||
|
$this->myLogger->logme('error', " Found Employee Policy Records: " . 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', " ✗ Failed to delete Employee Policy records");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->myLogger->logme('error', " ℹ No Policy IDs available for Employee Policy deletion");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->myLogger->logme('error', " ✗ Failed to delete Client Policy records");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->myLogger->logme('error', " ℹ No Client Policy data found");
|
||||||
|
}
|
||||||
|
$this->myLogger->logme('error', "----------------------------------------");
|
||||||
|
|
||||||
|
// ========================================
|
||||||
|
// 6. EMPLOYEE MODEL DELETION
|
||||||
|
// ========================================
|
||||||
|
$this->myLogger->logme('error', "6. PROCESSING EMPLOYEE MODEL");
|
||||||
|
$employee_data = $this->employeeModel->where('client_id', $client_id)->findAll();
|
||||||
|
$this->myLogger->logme('error', " Found Employee Records: " . 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', " ✗ Failed to delete Employee records");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->myLogger->logme('error', " ℹ No Employee data found");
|
||||||
|
}
|
||||||
|
$this->myLogger->logme('error', "----------------------------------------");
|
||||||
|
|
||||||
|
|
||||||
|
// ========================================
|
||||||
|
// 7. POLICY PREMIUM 1 MODEL DELETION
|
||||||
|
// ========================================
|
||||||
|
$this->myLogger->logme('error', "8. PROCESSING POLICY PREMIUM 1 MODEL");
|
||||||
|
$policy_premium1_data = $this->policyPremium1Model->where('client_id', $client_id)->findAll();
|
||||||
|
$this->myLogger->logme('error', " Found Policy Premium 1 Records: " . 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', " ✗ Failed to delete Policy Premium 1 records");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->myLogger->logme('error', " ℹ No Policy Premium 1 data found");
|
||||||
|
}
|
||||||
|
$this->myLogger->logme('error', "----------------------------------------");
|
||||||
|
|
||||||
|
// ========================================
|
||||||
|
// 8. POLICY PREMIUM 2 MODEL DELETION
|
||||||
|
// ========================================
|
||||||
|
$this->myLogger->logme('error', "9. PROCESSING POLICY PREMIUM 2 MODEL");
|
||||||
|
$policy_premium2_data = $this->policyPremium2Model->where('client_id', $client_id)->findAll();
|
||||||
|
$this->myLogger->logme('error', " Found Policy Premium 2 Records: " . 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', " ✗ Failed to delete Policy Premium 2 records");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->myLogger->logme('error', " ℹ No Policy Premium 2 data found");
|
||||||
|
}
|
||||||
|
$this->myLogger->logme('error', "----------------------------------------");
|
||||||
|
|
||||||
|
// ========================================
|
||||||
|
// 9. NOTIFICATION MODEL DELETION
|
||||||
|
// ========================================
|
||||||
|
$this->myLogger->logme('error', "10. PROCESSING NOTIFICATION MODEL");
|
||||||
|
$notification_data = $this->notificationModel->where('client_id', $client_id)->findAll();
|
||||||
|
$this->myLogger->logme('error', " Found Notification Records: " . count($notification_data ?? []));
|
||||||
|
$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', " ✗ Failed to delete Notification records");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->myLogger->logme('error', " ℹ No Notification data found");
|
||||||
|
}
|
||||||
|
$this->myLogger->logme('error', "----------------------------------------");
|
||||||
|
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', "========================================");
|
||||||
|
$this->myLogger->logme('error', "WIPE DEMO CLIENT FUNCTION COMPLETED");
|
||||||
|
$this->myLogger->logme('error', "Client ID: " . $client_id . " - Successfully processed");
|
||||||
|
$this->myLogger->logme('error', "========================================");
|
||||||
|
|
||||||
|
return $this->respond(['status' => true, 'message' => 'Demo client data wiped successfully'], 200);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,6 +41,10 @@ use CodeIgniter\API\ResponseTrait;
|
|||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Style\Alignment;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Style\Fill;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Style\Border;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||||
|
|
||||||
use Dompdf\Dompdf;
|
use Dompdf\Dompdf;
|
||||||
use Dompdf\Options;
|
use Dompdf\Options;
|
||||||
@ -1325,7 +1329,7 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
//STEP:3 - Update files table status
|
//STEP:3 - Update files table status
|
||||||
$this->fileModel->where('id', $file_id)->set(['status' => 'truncated'])->update();
|
$this->fileModel->where('id', $file_id)->set(['status' => 'truncated','updated_by' => $loggedInUserID])->update();
|
||||||
$this->myLogger->logme('error', '---- files table updated ----');
|
$this->myLogger->logme('error', '---- files table updated ----');
|
||||||
|
|
||||||
//FINAL STEP - Update reverse entry in cash_deposite table
|
//FINAL STEP - Update reverse entry in cash_deposite table
|
||||||
@ -1407,7 +1411,7 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
// dd($affectedRows);
|
// dd($affectedRows);
|
||||||
$affectedRows = $affectedRows * 2;
|
$affectedRows = $affectedRows * 2;
|
||||||
$this->fileModel->where('id', $file_id)->set(['status' => 'truncated'])->update();
|
$this->fileModel->where('id', $file_id)->set(['status' => 'truncated','updated_by' => $loggedInUserID])->update();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1472,7 +1476,7 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
// STEP 3:
|
// STEP 3:
|
||||||
//update files table status to "truncated"
|
//update files table status to "truncated"
|
||||||
$this->fileModel->where('id', $file_id)->set(['status' => 'truncated'])->update();
|
$this->fileModel->where('id', $file_id)->set(['status' => 'truncated','updated_by' => $loggedInUserID])->update();
|
||||||
$this->myLogger->logme('error', 'files table updated');
|
$this->myLogger->logme('error', 'files table updated');
|
||||||
|
|
||||||
|
|
||||||
@ -2473,7 +2477,8 @@ class EmployeeController extends AdminController
|
|||||||
//------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
public function test_members_list(){
|
public function test_members_list()
|
||||||
|
{
|
||||||
// $model = new EmployeeModel();
|
// $model = new EmployeeModel();
|
||||||
// $list = [
|
// $list = [
|
||||||
// ['relationship' => 'spouse','emp_code' => 'TEST002', 'name' => 'Lakshmi','email_personal' => 'lakshmi@gmail.com','mobile'=>'6382156701','gender'=>'female','dob'=>'1996-05-19','doj'=>'2022-02-01','basic_pay'=>'100000','emp_status'=>'enrolled'],
|
// ['relationship' => 'spouse','emp_code' => 'TEST002', 'name' => 'Lakshmi','email_personal' => 'lakshmi@gmail.com','mobile'=>'6382156701','gender'=>'female','dob'=>'1996-05-19','doj'=>'2022-02-01','basic_pay'=>'100000','emp_status'=>'enrolled'],
|
||||||
@ -2496,7 +2501,8 @@ class EmployeeController extends AdminController
|
|||||||
return $this->loadLayout('test_members_list',$data);
|
return $this->loadLayout('test_members_list',$data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mapEmployees(){
|
public function mapEmployees()
|
||||||
|
{
|
||||||
$client_id = $this->request->getPost('client_id');
|
$client_id = $this->request->getPost('client_id');
|
||||||
$branch_id = $this->request->getPost('branch_id');
|
$branch_id = $this->request->getPost('branch_id');
|
||||||
$policy_id = $this->request->getPost('client_policy_id');
|
$policy_id = $this->request->getPost('client_policy_id');
|
||||||
@ -2530,7 +2536,8 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDataForMapping(){
|
public function getDataForMapping()
|
||||||
|
{
|
||||||
$policy_id = $this->request->getPost('policy_id');log_message('error',$policy_id);
|
$policy_id = $this->request->getPost('policy_id');log_message('error',$policy_id);
|
||||||
$data['policy_start_date'] = $this->clientPolicyModel->select('policy_start_date')->where('id',$policy_id)->first()['policy_start_date'];
|
$data['policy_start_date'] = $this->clientPolicyModel->select('policy_start_date')->where('id',$policy_id)->first()['policy_start_date'];
|
||||||
$data['si_amt'] = $this->PolicyPremium2Model->select('si')->where('client_policy_id', $policy_id)->groupBy('si')->findAll();
|
$data['si_amt'] = $this->PolicyPremium2Model->select('si')->where('client_policy_id', $policy_id)->groupBy('si')->findAll();
|
||||||
@ -2538,7 +2545,8 @@ class EmployeeController extends AdminController
|
|||||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $data], 200);
|
return $this->respond(['status' => true, 'code' => 200, 'data' => $data], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function unmapEmployees($actionType){
|
public function unmapEmployees($actionType)
|
||||||
|
{
|
||||||
$selected_employees = (array)$this->request->getPost('selected');
|
$selected_employees = (array)$this->request->getPost('selected');
|
||||||
if($actionType == 0){
|
if($actionType == 0){
|
||||||
for($i = 0;$i<count($selected_employees);$i++){log_message('error',$selected_employees[$i]);
|
for($i = 0;$i<count($selected_employees);$i++){log_message('error',$selected_employees[$i]);
|
||||||
@ -2632,7 +2640,6 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
public function generateAcmAndMForEcard($client_id)
|
public function generateAcmAndMForEcard($client_id)
|
||||||
{
|
{
|
||||||
$db = db_connect();
|
$db = db_connect();
|
||||||
@ -2671,9 +2678,8 @@ class EmployeeController extends AdminController
|
|||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getEmpHistory()
|
||||||
|
{
|
||||||
public function getEmpHistory(){
|
|
||||||
|
|
||||||
$emp_id = $this->request->getPost('emp_id');
|
$emp_id = $this->request->getPost('emp_id');
|
||||||
|
|
||||||
@ -2708,7 +2714,8 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function formatFieldName($unformattedString){
|
public function formatFieldName($unformattedString)
|
||||||
|
{
|
||||||
|
|
||||||
if (str_contains($unformattedString, '_')) {
|
if (str_contains($unformattedString, '_')) {
|
||||||
$data = str_replace('_', ' ', $unformattedString);
|
$data = str_replace('_', ' ', $unformattedString);
|
||||||
@ -2722,4 +2729,100 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public function download_inception()
|
||||||
|
{
|
||||||
|
$client = $this->request->getPost('client');
|
||||||
|
$branch = $this->request->getPost('branch');
|
||||||
|
$policies = $this->request->getPost('policies');
|
||||||
|
$status = $this->request->getPost('status');
|
||||||
|
$empCode = $this->request->getPost('empCode');
|
||||||
|
$empName = $this->request->getPost('empName');
|
||||||
|
|
||||||
|
$result = $this->employeePolicyModel->download_inception(
|
||||||
|
$client, $branch, $policies, $status, $empCode, $empName
|
||||||
|
);
|
||||||
|
|
||||||
|
if (empty($result)) {
|
||||||
|
return $this->response->setStatusCode(204)->setBody('No data found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$formatted = [];
|
||||||
|
foreach ($result as $index => $row) {
|
||||||
|
$rowWithSerial = ['S.NO' => $index + 1] + $row;
|
||||||
|
$formatted[] = $rowWithSerial;
|
||||||
|
}
|
||||||
|
$result = $formatted;
|
||||||
|
|
||||||
|
$spreadsheet = new Spreadsheet();
|
||||||
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
|
$headers = array_keys($result[0]);
|
||||||
|
$columnWidth = 20; // standard column width
|
||||||
|
|
||||||
|
$colIndex = 1;
|
||||||
|
foreach ($headers as $header) {
|
||||||
|
$columnLetter = Coordinate::stringFromColumnIndex($colIndex);
|
||||||
|
$cellCoordinate = $columnLetter . '1';
|
||||||
|
|
||||||
|
$sheet->setCellValue($cellCoordinate, ucfirst(str_replace('_', ' ', $header)));
|
||||||
|
|
||||||
|
$sheet->getColumnDimension($columnLetter)->setWidth($columnWidth);
|
||||||
|
|
||||||
|
$style = $sheet->getStyle($cellCoordinate);
|
||||||
|
$style->getFont()->setBold(true);
|
||||||
|
$style->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
|
||||||
|
$style->getBorders()->getAllBorders()->setBorderStyle(Border::BORDER_THIN);
|
||||||
|
|
||||||
|
$colIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rowNum = 2;
|
||||||
|
foreach ($result as $row) {
|
||||||
|
$colIndex = 1;
|
||||||
|
foreach ($row as $cell) {
|
||||||
|
$columnLetter = Coordinate::stringFromColumnIndex($colIndex);
|
||||||
|
$cellCoordinate = $columnLetter . $rowNum;
|
||||||
|
$sheet->setCellValue($cellCoordinate, $cell);
|
||||||
|
$colIndex++;
|
||||||
|
}
|
||||||
|
$rowNum++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$exportDir = WRITEPATH . 'exports';
|
||||||
|
if (!is_dir($exportDir)) {
|
||||||
|
mkdir($exportDir, 0777, true);
|
||||||
|
} else {
|
||||||
|
chmod($exportDir, 0777);
|
||||||
|
}
|
||||||
|
|
||||||
|
$filename = 'inception_export_' . date('Ymd_His') . '.xlsx';
|
||||||
|
$filepath = $exportDir . '/' . $filename;
|
||||||
|
|
||||||
|
$writer = new Xlsx($spreadsheet);
|
||||||
|
$writer->save($filepath);
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'status' => 'success',
|
||||||
|
'downloadUrl' => base_url('employee/download_file?file=' . urlencode($filename))
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function download_file()
|
||||||
|
{
|
||||||
|
$filename = $this->request->getGet('file');
|
||||||
|
$filepath = WRITEPATH . 'exports/' . $filename;
|
||||||
|
|
||||||
|
if (!file_exists($filepath)) {
|
||||||
|
return $this->response->setStatusCode(404)->setBody('File not found.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->response->download($filepath, null)->setFileName($filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,7 @@ use App\Models\AddImgModel;
|
|||||||
use App\Models\ClientBranchModel;
|
use App\Models\ClientBranchModel;
|
||||||
use App\Models\AuditHistoryModel;
|
use App\Models\AuditHistoryModel;
|
||||||
use App\Models\SIMappingModel;
|
use App\Models\SIMappingModel;
|
||||||
|
use App\Models\InsurerModel;
|
||||||
|
|
||||||
|
|
||||||
use App\Controllers\Jobs ;
|
use App\Controllers\Jobs ;
|
||||||
@ -77,6 +78,7 @@ class EmployeeRestController extends AdminController
|
|||||||
protected $auditHistoryModel;
|
protected $auditHistoryModel;
|
||||||
protected $siMappingModel;
|
protected $siMappingModel;
|
||||||
protected $employeeHelper;
|
protected $employeeHelper;
|
||||||
|
protected $insurerModel;
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@ -103,6 +105,7 @@ class EmployeeRestController extends AdminController
|
|||||||
$this->auditHistoryModel = new AuditHistoryModel();
|
$this->auditHistoryModel = new AuditHistoryModel();
|
||||||
$this->siMappingModel = new SIMappingModel();
|
$this->siMappingModel = new SIMappingModel();
|
||||||
$this->employeeHelper = new EmployeeHelper();
|
$this->employeeHelper = new EmployeeHelper();
|
||||||
|
$this->insurerModel = new InsurerModel();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -748,7 +751,7 @@ class EmployeeRestController extends AdminController
|
|||||||
$jwt = $this->request->getHeaderLine('Authorization');
|
$jwt = $this->request->getHeaderLine('Authorization');
|
||||||
$jwtParts = explode(' ', $jwt);
|
$jwtParts = explode(' ', $jwt);
|
||||||
|
|
||||||
$token = $jwtParts[2];
|
$token = $jwtParts[1];
|
||||||
|
|
||||||
$decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
|
$decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
|
||||||
|
|
||||||
@ -1072,6 +1075,7 @@ class EmployeeRestController extends AdminController
|
|||||||
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Client id and Client Policy id is Not Match!" ], 404);
|
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Client id and Client Policy id is Not Match!" ], 404);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
$this->myLogger->logme("error", ($e->getMessage().' --- '.$e->getLine() . '----' . $e->getTraceAsString()));
|
||||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1709,22 +1713,128 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public function getClientDetails()
|
||||||
|
// {
|
||||||
|
// try {
|
||||||
|
|
||||||
|
// $jwt = $this->request->getHeaderLine('Authorization');
|
||||||
|
// $jwtParts = explode(' ', $jwt);
|
||||||
|
// $token = $jwtParts[1];
|
||||||
|
// $decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
|
||||||
|
// $token_type = $decodedPayload['token_type'];
|
||||||
|
|
||||||
|
// if ($token_type == 'pre') {
|
||||||
|
// $client = $this->clientModel->where('id', $this->request->getGet('client_id'))->first();
|
||||||
|
// if ($client) {
|
||||||
|
// $client['client_logo'] = base_url() . 'public/uploads/logo/' . $client['client_logo'];
|
||||||
|
// $clientPolicy = $this->clientPolicyModel->where('client_id', $this->request->getGet('client_id'))
|
||||||
|
// ->where('client_branch_id', $this->request->getGet('client_branch_id'))->findAll();
|
||||||
|
// return $this->respond(['status' => 'success', 'code' => 200, 'data' => ['client' => $client, 'client_policy' => $clientPolicy]], 200);
|
||||||
|
// } else if ($token_type == 'post') {
|
||||||
|
|
||||||
|
// $restAuthController = new RestAuthenticationController;
|
||||||
|
|
||||||
|
// //call and get Client Details data from post enrollment
|
||||||
|
// $queryParams = [
|
||||||
|
// 'client_id' => $this->request->getGet('client_id'),
|
||||||
|
// 'client_branch_id' => $this->request->getGet('client_branch_id')
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// return $restAuthController->callThirdPartyGETAPI($queryParams, 'getClientDetails');
|
||||||
|
// } else {
|
||||||
|
// return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404);
|
||||||
|
// }
|
||||||
|
// } catch (\Exception $e) {
|
||||||
|
// return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $e->getMessage()], 500);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
public function getClientDetails()
|
public function getClientDetails()
|
||||||
{
|
{
|
||||||
|
log_message('error', 'STEP 1: getClientDetails called');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// STEP 2: Extract Authorization header
|
||||||
|
$jwt = $this->request->getHeaderLine('Authorization');
|
||||||
|
log_message('error', 'STEP 2: Authorization header: ' . $jwt);
|
||||||
|
|
||||||
$client = $this->clientModel->where('id',$this->request->getGet('client_id'))->first();
|
$jwtParts = explode(' ', $jwt);
|
||||||
if($client) {
|
if (count($jwtParts) < 2) {
|
||||||
$client['client_logo'] = base_url().'public/uploads/logo/'.$client['client_logo'];
|
log_message('error', 'STEP 2.1: Invalid Authorization header format');
|
||||||
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))
|
return $this->respond(['status' => 'failed', 'code' => 400, 'data' => 'Invalid Authorization header'], 400);
|
||||||
->where('client_branch_id',$this->request->getGet('client_branch_id'))->findAll();
|
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => ['client'=>$client,'client_policy'=>$clientPolicy]], 200);
|
|
||||||
|
|
||||||
}else{
|
|
||||||
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$token = $jwtParts[1];
|
||||||
|
log_message('error', 'STEP 3: Extracted JWT token');
|
||||||
|
|
||||||
|
$tokenParts = explode('.', $token);
|
||||||
|
if (count($tokenParts) !== 3) {
|
||||||
|
log_message('error', 'STEP 3.1: Invalid JWT structure');
|
||||||
|
return $this->respond(['status' => 'failed', 'code' => 400, 'data' => 'Invalid JWT token'], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$decodedPayload = json_decode(base64_decode($tokenParts[1]), true);
|
||||||
|
log_message('error', 'STEP 4: Decoded JWT payload: ' . json_encode($decodedPayload));
|
||||||
|
|
||||||
|
$token_type = $decodedPayload['token_type'] ?? null;
|
||||||
|
log_message('error', 'STEP 5: Token type = ' . $token_type);
|
||||||
|
|
||||||
|
$client_id = $this->request->getGet('client_id');
|
||||||
|
$client_branch_id = $this->request->getGet('client_branch_id');
|
||||||
|
log_message('error', 'STEP 6: Query params - client_id: ' . $client_id . ', client_branch_id: ' . $client_branch_id);
|
||||||
|
|
||||||
|
if ($token_type === 'pre') {
|
||||||
|
log_message('error', 'STEP 7: Handling "pre" token type');
|
||||||
|
|
||||||
|
$client = $this->clientModel->where('id', $client_id)->first();
|
||||||
|
if ($client) {
|
||||||
|
log_message('error', 'STEP 8: Found client: ' . json_encode($client));
|
||||||
|
|
||||||
|
$client['client_logo'] = base_url() . 'public/uploads/logo/' . $client['client_logo'];
|
||||||
|
|
||||||
|
$clientPolicy = $this->clientPolicyModel
|
||||||
|
->where('client_id', $client_id)
|
||||||
|
->where('client_branch_id', $client_branch_id)
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
log_message('error', 'STEP 9: Found client policy count: ' . count($clientPolicy));
|
||||||
|
|
||||||
|
return $this->respond([
|
||||||
|
'status' => 'success',
|
||||||
|
'code' => 200,
|
||||||
|
'data' => [
|
||||||
|
'client' => $client,
|
||||||
|
'client_policy' => $clientPolicy
|
||||||
|
]
|
||||||
|
], 200);
|
||||||
|
} else {
|
||||||
|
log_message('error', 'STEP 10: No client found for client_id: ' . $client_id);
|
||||||
|
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404);
|
||||||
|
}
|
||||||
|
} elseif ($token_type === 'post') {
|
||||||
|
log_message('error', 'STEP 11: Handling "post" token type');
|
||||||
|
|
||||||
|
$restAuthController = new RestAuthenticationController;
|
||||||
|
|
||||||
|
$queryParams = [
|
||||||
|
'client_id' => $client_id,
|
||||||
|
'client_branch_id' => $client_branch_id
|
||||||
|
];
|
||||||
|
|
||||||
|
log_message('error', 'STEP 12: Calling post enrollment API with params: ' . json_encode($queryParams));
|
||||||
|
|
||||||
|
return $restAuthController->callThirdPartyGETAPI($queryParams, 'getClientDetails', ['token' => $jwt]);
|
||||||
|
} else {
|
||||||
|
log_message('error', 'STEP 13: Unknown token_type: ' . $token_type);
|
||||||
|
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
log_message('error', 'STEP 14: Exception occurred - ' . $e->getMessage());
|
||||||
|
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $e->getMessage()], 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2511,8 +2621,7 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, client_policy.policy_type_id as policy_type_id, client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type, client_policy.policy_no as policy_no, client_policy.insurer_id as insurer_id, DATE_FORMAT(client_policy.policy_end_date, "%d-%m-%Y") AS policy_expiry_date ')
|
||||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, client_policy.policy_type_id as policy_type_id, client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type ')
|
|
||||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
||||||
->where('client_policy.is_active', 1 )
|
->where('client_policy.is_active', 1 )
|
||||||
@ -2524,8 +2633,12 @@ class EmployeeRestController extends AdminController
|
|||||||
foreach ($ClientPolicyData as $key => $value)
|
foreach ($ClientPolicyData as $key => $value)
|
||||||
{
|
{
|
||||||
$policyTypeData = $this->policyTypeModel->where('id',$value['policy_type_id'])->get()->getRow();
|
$policyTypeData = $this->policyTypeModel->where('id',$value['policy_type_id'])->get()->getRow();
|
||||||
|
$insurerData = $this->insurerModel->where('id',$value['insurer_id'])->get()->getRow();
|
||||||
|
|
||||||
$value['type'] = $policyTypeData->policy_type;
|
$value['type'] = $policyTypeData->policy_type;
|
||||||
$value['policy_name'] = $policyTypeData->long_name;
|
$value['policy_name'] = $policyTypeData->long_name;
|
||||||
|
$value['insurer_name'] = $insurerData->name ?? null;
|
||||||
|
$value['insurer_short_name'] = $insurerData->short_name ?? null;
|
||||||
$employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0,branch_id:$this->request->getGet('client_branch_id'));
|
$employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0,branch_id:$this->request->getGet('client_branch_id'));
|
||||||
$enrolledCount = 0;
|
$enrolledCount = 0;
|
||||||
$draftCount = 0;
|
$draftCount = 0;
|
||||||
@ -3308,10 +3421,77 @@ class EmployeeRestController extends AdminController
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function getPreEmployeePolicyCount()
|
||||||
|
{
|
||||||
|
log_message('error', 'STEP 1: getPreEmployeePolicyCount API called');
|
||||||
|
|
||||||
|
$request = $this->request->getJSON(true);
|
||||||
|
$mobile_no = $request['mobile_number'] ?? null;
|
||||||
|
$client_short_name = $request['client_short_name'] ?? null;
|
||||||
|
|
||||||
|
log_message('error', 'STEP 2: Received input - ' . json_encode($request));
|
||||||
|
|
||||||
|
// Step 3: Fetch client ID based on short name
|
||||||
|
$clientId = null;
|
||||||
|
if (!empty($client_short_name)) {
|
||||||
|
log_message('error', 'STEP 3: Looking up client with short_name: ' . $client_short_name);
|
||||||
|
$client_data = $this->clientModel
|
||||||
|
->where('is_active', 1)
|
||||||
|
->where('short_name', $client_short_name)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($client_data) {
|
||||||
|
$clientId = $client_data['id'];
|
||||||
|
log_message('error', 'STEP 4: Found client ID: ' . $clientId);
|
||||||
|
} else {
|
||||||
|
log_message('error', 'STEP 4: No client found for short_name: ' . $client_short_name);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log_message('error', 'STEP 3: client_short_name is empty.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 5: Validate mobile number
|
||||||
|
if (empty($mobile_no)) {
|
||||||
|
log_message('error', 'STEP 5: Mobile number is empty or null. Returning 0.');
|
||||||
|
return $this->respond(['data' => 0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
log_message('error', 'STEP 6: Building employee policy count query');
|
||||||
|
|
||||||
|
$builder = $this->employeeModel
|
||||||
|
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||||
|
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id')
|
||||||
|
->where('employees.is_active', 1)
|
||||||
|
->whereIn('employees.emp_status', ['draft', 'enrolled'])
|
||||||
|
->where('employee_polices.is_active', 1)
|
||||||
|
->whereIn('employee_polices.status', ['draft', 'enrolled'])
|
||||||
|
->where('cp.enrolment_visibility', 1)
|
||||||
|
->where('cp.open_for_enrollment', 1)
|
||||||
|
->where('cp.policy_status', 1)
|
||||||
|
->whereIn('cp.policy_type_id', [1, 2, 6, 7])
|
||||||
|
->where('employees.mobile', $mobile_no)
|
||||||
|
->orderBy('employees.created_at', 'desc')
|
||||||
|
->groupBy('employee_polices.client_policy_id');
|
||||||
|
|
||||||
|
if (!empty($clientId)) {
|
||||||
|
$builder->where('employees.client_id', $clientId);
|
||||||
|
log_message('error', 'STEP 7: Applied client ID filter: ' . $clientId);
|
||||||
|
} else {
|
||||||
|
log_message('error', 'STEP 7: No client ID filter applied.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$count = $builder->get()->getNumRows();
|
||||||
|
log_message('error', 'STEP 8: Final policy count = ' . $count);
|
||||||
|
|
||||||
|
return $this->respond(['data' => $count]);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
log_message('error', 'STEP 9: Exception occurred - ' . $e->getMessage());
|
||||||
|
return $this->respond(['data' => 0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -24,6 +24,7 @@ use App\Helpers\sendMailNotification;
|
|||||||
|
|
||||||
use App\Controllers\Jobs ;
|
use App\Controllers\Jobs ;
|
||||||
use App\Controllers\JobWorker ;
|
use App\Controllers\JobWorker ;
|
||||||
|
use App\Controllers\EmpDataServiceController;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
use Kint\Kint;
|
use Kint\Kint;
|
||||||
@ -1804,9 +1805,10 @@ class EmployeeServiceController extends AdminController
|
|||||||
public function getExcelErrorData($file_id){
|
public function getExcelErrorData($file_id){
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$file = $this->fileModel->find($file_id);
|
// $file = $this->fileModel->find($file_id);
|
||||||
$error_data = json_decode($file['reason']);
|
$file = $this->fileModel->where('id', $file_id)->first();
|
||||||
// dd($error_data);
|
$error_data = json_decode($file['reason']);
|
||||||
|
// dd($error_data);
|
||||||
// return $error_data;
|
// return $error_data;
|
||||||
|
|
||||||
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
|
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
|
||||||
@ -1822,10 +1824,21 @@ class EmployeeServiceController extends AdminController
|
|||||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
||||||
$sheet = $spreadsheet->getActiveSheet();
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
$excel_data = $sheet->rangeToArray('A1:' . 'N' . $highestRowAndColumn['row']);
|
||||||
$excelErrorData['excel_header'] = $excel_data[0];
|
$excelErrorData['excel_header'] = $excel_data[0];
|
||||||
unset($excel_data[0]);
|
unset($excel_data[0]);
|
||||||
|
|
||||||
|
$excel_data = array_filter($excel_data, function($row) {
|
||||||
|
// Check if all cells in the row are empty or null
|
||||||
|
foreach ($row as $cell) {
|
||||||
|
if (!is_null($cell) && $cell !== '') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
// echo '<pre>';
|
// echo '<pre>';
|
||||||
// Kint::dump($excel_data);
|
// Kint::dump($excel_data);
|
||||||
if($error_data->error_type == 1){
|
if($error_data->error_type == 1){
|
||||||
|
|||||||
436
app/Helpers/RestAuthHelper.php
Normal file
@ -0,0 +1,436 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Helpers;
|
||||||
|
|
||||||
|
use App\Models\ClientModel;
|
||||||
|
use App\Models\ClientPolicyModel;
|
||||||
|
use App\Models\EmployeeModel;
|
||||||
|
use App\Models\EmployeePolicyModel;
|
||||||
|
|
||||||
|
|
||||||
|
class RestAuthHelper
|
||||||
|
{
|
||||||
|
// public static function getPreAndPostDataByEmailOrMobile($params)
|
||||||
|
// {
|
||||||
|
// // print_r($params); die;
|
||||||
|
// $mobile_number = $params['mobile_number'] ?? null;
|
||||||
|
// $email_id = $params['email_id'] ?? null;
|
||||||
|
// $otp = $params['otp'] ?? null;
|
||||||
|
// $old_mpin = $params['$old_mpin'] ?? null;
|
||||||
|
|
||||||
|
// // Return null if both inputs are empty
|
||||||
|
// if (empty($mobile_number) && empty($email_id)) {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $params = [
|
||||||
|
// 'mobile_number' => $mobile_number,
|
||||||
|
// 'email_id' => $email_id,
|
||||||
|
// 'otp' => $otp,
|
||||||
|
// '$old_mpin' => $old_mpin,
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// $pre_data = self::getPreEmployeeData($params);
|
||||||
|
// $post_data = self::getPostEmployeeData($params);
|
||||||
|
|
||||||
|
// // Return empty array if both are missing
|
||||||
|
// if (empty($pre_data) && empty($post_data)) {
|
||||||
|
// return [];
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // Determine the latest record
|
||||||
|
// $latest_key = null;
|
||||||
|
// if (!empty($pre_data) && !empty($post_data)) {
|
||||||
|
// $latest_key = strtotime($pre_data['created_at']) > strtotime($post_data['created_at']) ? 'pre' : 'post';
|
||||||
|
// } elseif (!empty($pre_data)) {
|
||||||
|
// $latest_key = 'pre';
|
||||||
|
// } elseif (!empty($post_data)) {
|
||||||
|
// $latest_key = 'post';
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // Compare client_short_name only if both records exist
|
||||||
|
// if (!empty($pre_data) && !empty($post_data)) {
|
||||||
|
// $latest_data = $latest_key === 'pre' ? $pre_data : $post_data;
|
||||||
|
// $other_data = $latest_key === 'pre' ? $post_data : $pre_data;
|
||||||
|
|
||||||
|
// if ($latest_data['client_short_name'] === $other_data['client_short_name']) {
|
||||||
|
// return [
|
||||||
|
// 'pre' => $pre_data,
|
||||||
|
// 'post' => $post_data,
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // If one of the data is missing or client names mismatch
|
||||||
|
// return [
|
||||||
|
// 'pre' => $latest_key === 'pre' ? $pre_data : [],
|
||||||
|
// 'post' => $latest_key === 'post' ? $post_data : [],
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public static function getPreEmployeeData(array $params)
|
||||||
|
// {
|
||||||
|
// $employeeModel = new EmployeeModel();
|
||||||
|
|
||||||
|
// $mobile_number = $params['mobile_number'] ?? null;
|
||||||
|
// $email_id = $params['email_id'] ?? null;
|
||||||
|
// $otp = $params['otp'] ?? null;
|
||||||
|
// $old_mpin = $params['old_mpin'] ?? null;
|
||||||
|
|
||||||
|
// if (!empty($mobile_number)) {
|
||||||
|
// $builder = $employeeModel
|
||||||
|
// ->select('employees.id as employee_id, employees.*')
|
||||||
|
// ->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
|
||||||
|
// ->where('employees.is_active', 1)
|
||||||
|
// ->where("TRIM(employees.relationship) = 'self'", null, false)
|
||||||
|
// ->whereIn('employees.emp_status', ['draft', 'enrolled'])
|
||||||
|
// ->where('employees.mobile', $mobile_number)
|
||||||
|
// ->where('EP.is_active', 1)
|
||||||
|
// ->whereIn('EP.status', ['draft', 'enrolled']);
|
||||||
|
|
||||||
|
// if (!empty($old_mpin)) {
|
||||||
|
// $builder->where('employees.mpin', $old_mpin);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||||
|
|
||||||
|
// } elseif (!empty($email_id)) {
|
||||||
|
// $builder = $employeeModel
|
||||||
|
// ->select('employees.id as employee_id, employees.*')
|
||||||
|
// ->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
|
||||||
|
// ->where('employees.is_active', 1)
|
||||||
|
// ->where("TRIM(employees.relationship) = 'self'", null, false)
|
||||||
|
// ->whereIn('employees.emp_status', ['draft', 'enrolled'])
|
||||||
|
// ->where('employees.email_corporate', $email_id)
|
||||||
|
// ->where('EP.is_active', 1)
|
||||||
|
// ->whereIn('EP.status', ['draft', 'enrolled']);
|
||||||
|
|
||||||
|
// if (!empty($otp)) {
|
||||||
|
// $builder->where('employees.otp', $otp);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (!empty($old_mpin)) {
|
||||||
|
// $builder->where('employees.mpin', $old_mpin);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||||
|
|
||||||
|
// } else {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if($employeeData){
|
||||||
|
// $clientModel = new ClientModel;
|
||||||
|
// $client_data = $clientModel->where('is_active', 1)->where('id', $employeeData['client_id'])->first();
|
||||||
|
// $employeeData['client_short_name'] = $client_data['short_name'];
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return $employeeData;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public static function getPostEmployeeData(array $params)
|
||||||
|
// {
|
||||||
|
// // print_r($params); die;
|
||||||
|
// $mobile_number = $params['mobile_number'] ?? null;
|
||||||
|
// $email_id = $params['email_id'] ?? null;
|
||||||
|
// $otp = $params['otp'] ?? null;
|
||||||
|
// $old_mpin = $params['old_mpin'] ?? null;
|
||||||
|
|
||||||
|
|
||||||
|
// if (!empty($mobile_number) || !empty($email_id)) {
|
||||||
|
|
||||||
|
// $client = \Config\Services::curlrequest();
|
||||||
|
// $endPoint = 'getPostEmployeeDataForAuth';
|
||||||
|
// $url = env('POST_ENROLLMENT_BASEURL') . $endPoint;
|
||||||
|
|
||||||
|
// $postData = [];
|
||||||
|
|
||||||
|
// if (!empty($mobile_number)) {
|
||||||
|
// $postData['mobile_number'] = $mobile_number;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (!empty($email_id)) {
|
||||||
|
// $postData['email_id'] = $email_id;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (!empty($otp)) {
|
||||||
|
// $postData['otp'] = $otp;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (!empty($old_mpin)) {
|
||||||
|
// $postData['old_mpin'] = $old_mpin;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $response = $client->post( $url, ['json' => $postData, 'http_errors' => false]);
|
||||||
|
// $post_json = $response->getBody();
|
||||||
|
// $post_data = json_decode($post_json, true);
|
||||||
|
|
||||||
|
// return $post_data['data'];
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
public static function getPreAndPostDataByEmailOrMobile($params)
|
||||||
|
{
|
||||||
|
log_message('error', 'Function getPreAndPostDataByEmailOrMobile called with: ' . json_encode($params));
|
||||||
|
|
||||||
|
$mobile_number = $params['mobile_number'] ?? null;
|
||||||
|
$email_id = $params['email_id'] ?? null;
|
||||||
|
$otp = $params['otp'] ?? null;
|
||||||
|
$old_mpin = $params['old_mpin'] ?? null;
|
||||||
|
$check_mpin = $params['check_mpin'] ?? null;
|
||||||
|
|
||||||
|
if (empty($mobile_number) && empty($email_id)) {
|
||||||
|
log_message('error', 'Both mobile_number and email_id are empty. Returning null.');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$params = [
|
||||||
|
'mobile_number' => $mobile_number,
|
||||||
|
'email_id' => $email_id,
|
||||||
|
'otp' => $otp,
|
||||||
|
'old_mpin' => $old_mpin,
|
||||||
|
];
|
||||||
|
|
||||||
|
$pre_data = self::getPreEmployeeData($params);
|
||||||
|
$post_data = self::getPostEmployeeData($params);
|
||||||
|
|
||||||
|
log_message('error', 'Pre Data: ' . json_encode($pre_data));
|
||||||
|
log_message('error', 'Post Data: ' . json_encode($post_data));
|
||||||
|
|
||||||
|
if (empty($pre_data) && empty($post_data)) {
|
||||||
|
log_message('error', 'Both pre_data and post_data are empty. Returning empty array.');
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$latest_key = null;
|
||||||
|
if (!empty($pre_data) && !empty($post_data)) {
|
||||||
|
$latest_key = strtotime($pre_data['created_at']) > strtotime($post_data['created_at']) ? 'pre' : 'post';
|
||||||
|
} elseif (!empty($pre_data)) {
|
||||||
|
$latest_key = 'pre';
|
||||||
|
} elseif (!empty($post_data)) {
|
||||||
|
$latest_key = 'post';
|
||||||
|
}
|
||||||
|
|
||||||
|
log_message('error', 'Latest key determined as: ' . $latest_key);
|
||||||
|
|
||||||
|
if (!empty($pre_data) && !empty($post_data)) {
|
||||||
|
$latest_data = $latest_key === 'pre' ? $pre_data : $post_data;
|
||||||
|
$other_data = $latest_key === 'pre' ? $post_data : $pre_data;
|
||||||
|
|
||||||
|
if ($latest_data['client_short_name'] === $other_data['client_short_name']) {
|
||||||
|
log_message('error', 'client_short_name match. Returning both records.');
|
||||||
|
|
||||||
|
if ($check_mpin !== null && ($pre_data['mpin'] !== null || $post_data['mpin'] !== null)) {
|
||||||
|
|
||||||
|
// Case: Pre MPIN is missing, update it from Post
|
||||||
|
if ($pre_data['mpin'] === null && $post_data['mpin'] !== null) {
|
||||||
|
$data = [
|
||||||
|
'client_id' => $pre_data['client_id'],
|
||||||
|
'employee_id' => $pre_data['id'],
|
||||||
|
'mpin' => $post_data['mpin'],
|
||||||
|
'is_mpin_skipped' => $post_data['is_mpin_skipped'],
|
||||||
|
'is_biometric_enabled' => $post_data['is_biometric_enabled'],
|
||||||
|
];
|
||||||
|
$response = self::updatePreMpin($data);
|
||||||
|
|
||||||
|
// Case: Post MPIN is missing, update it from Pre
|
||||||
|
} elseif ($post_data['mpin'] === null && $pre_data['mpin'] !== null) {
|
||||||
|
$data = [
|
||||||
|
'client_id' => $post_data['client_id'],
|
||||||
|
'employee_id' => $post_data['id'],
|
||||||
|
'mpin' => $pre_data['mpin'],
|
||||||
|
'is_mpin_skipped' => $pre_data['is_mpin_skipped'],
|
||||||
|
'is_biometric_enabled' => $pre_data['is_biometric_enabled'],
|
||||||
|
];
|
||||||
|
$response = self::updatePostMpin($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['pre' => $pre_data, 'post' => $post_data];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = [
|
||||||
|
'pre' => $latest_key === 'pre' ? $pre_data : [],
|
||||||
|
'post' => $latest_key === 'post' ? $post_data : [],
|
||||||
|
];
|
||||||
|
|
||||||
|
log_message('error', 'Returning data: ' . json_encode($result));
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPreEmployeeData(array $params)
|
||||||
|
{
|
||||||
|
log_message('error', 'Function getPreEmployeeData called with: ' . json_encode($params));
|
||||||
|
|
||||||
|
$employeeModel = new EmployeeModel();
|
||||||
|
|
||||||
|
$mobile_number = $params['mobile_number'] ?? null;
|
||||||
|
$email_id = $params['email_id'] ?? null;
|
||||||
|
$otp = $params['otp'] ?? null;
|
||||||
|
$old_mpin = $params['old_mpin'] ?? null;
|
||||||
|
|
||||||
|
$employeeData = null;
|
||||||
|
|
||||||
|
if (!empty($mobile_number)) {
|
||||||
|
log_message('error', 'Searching employee by mobile_number: ' . $mobile_number);
|
||||||
|
|
||||||
|
$builder = $employeeModel
|
||||||
|
->select('employees.id as employee_id, employees.*')
|
||||||
|
->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
|
||||||
|
->where('employees.is_active', 1)
|
||||||
|
->where("TRIM(employees.relationship) = 'self'", null, false)
|
||||||
|
->whereIn('employees.emp_status', ['draft', 'enrolled'])
|
||||||
|
->where('employees.mobile', $mobile_number)
|
||||||
|
->where('EP.is_active', 1)
|
||||||
|
->whereIn('EP.status', ['draft', 'enrolled']);
|
||||||
|
|
||||||
|
if (!empty($old_mpin)) {
|
||||||
|
$builder->where('employees.mpin', $old_mpin);
|
||||||
|
}
|
||||||
|
|
||||||
|
$employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||||
|
} elseif (!empty($email_id)) {
|
||||||
|
log_message('error', 'Searching employee by email_id: ' . $email_id);
|
||||||
|
|
||||||
|
$builder = $employeeModel
|
||||||
|
->select('employees.id as employee_id, employees.*')
|
||||||
|
->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
|
||||||
|
->where('employees.is_active', 1)
|
||||||
|
->where("TRIM(employees.relationship) = 'self'", null, false)
|
||||||
|
->whereIn('employees.emp_status', ['draft', 'enrolled'])
|
||||||
|
->where('employees.email_corporate', $email_id)
|
||||||
|
->where('EP.is_active', 1)
|
||||||
|
->whereIn('EP.status', ['draft', 'enrolled']);
|
||||||
|
|
||||||
|
if (!empty($otp)) {
|
||||||
|
$builder->where('employees.otp', $otp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($old_mpin)) {
|
||||||
|
$builder->where('employees.mpin', $old_mpin);
|
||||||
|
}
|
||||||
|
|
||||||
|
$employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||||
|
} else {
|
||||||
|
log_message('warning', 'No mobile or email found. Returning null.');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
log_message('error', 'Pre employee data fetched: ' . json_encode($employeeData));
|
||||||
|
|
||||||
|
if ($employeeData) {
|
||||||
|
$clientModel = new ClientModel;
|
||||||
|
$client_data = $clientModel->where('is_active', 1)->where('id', $employeeData['client_id'])->first();
|
||||||
|
$employeeData['client_short_name'] = $client_data['short_name'] ?? '';
|
||||||
|
log_message('error', 'Client short name attached: ' . $employeeData['client_short_name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $employeeData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPostEmployeeData(array $params)
|
||||||
|
{
|
||||||
|
log_message('error', 'Function getPostEmployeeData called with: ' . json_encode($params));
|
||||||
|
|
||||||
|
$mobile_number = $params['mobile_number'] ?? null;
|
||||||
|
$email_id = $params['email_id'] ?? null;
|
||||||
|
$otp = $params['otp'] ?? null;
|
||||||
|
$old_mpin = $params['old_mpin'] ?? null;
|
||||||
|
|
||||||
|
if (!empty($mobile_number) || !empty($email_id)) {
|
||||||
|
$client = \Config\Services::curlrequest();
|
||||||
|
$endPoint = 'getPostEmployeeDataForAuth';
|
||||||
|
$url = env('POST_ENROLLMENT_BASEURL') . $endPoint;
|
||||||
|
|
||||||
|
$postData = [];
|
||||||
|
|
||||||
|
if (!empty($mobile_number)) {
|
||||||
|
$postData['mobile_number'] = $mobile_number;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($email_id)) {
|
||||||
|
$postData['email_id'] = $email_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($otp)) {
|
||||||
|
$postData['otp'] = $otp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($old_mpin)) {
|
||||||
|
$postData['old_mpin'] = $old_mpin;
|
||||||
|
}
|
||||||
|
|
||||||
|
log_message('error', 'Sending POST to external API: ' . $url);
|
||||||
|
log_message('error', 'POST payload: ' . json_encode($postData));
|
||||||
|
|
||||||
|
$response = $client->post($url, ['json' => $postData, 'http_errors' => false]);
|
||||||
|
|
||||||
|
$post_json = $response->getBody();
|
||||||
|
// log_message('error', 'Response from API: ' . $post_json);
|
||||||
|
|
||||||
|
$post_data = json_decode($post_json, true);
|
||||||
|
|
||||||
|
$data = $post_data['data'] ?? [];
|
||||||
|
log_message('error', 'Parsed post_data: ' . json_encode($data));
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
log_message('warning', 'No mobile or email present in params for post fetch.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function updatePreMpin(array $params)
|
||||||
|
{
|
||||||
|
log_message('info', 'Function updatePostMpin called with: ' . json_encode($params));
|
||||||
|
|
||||||
|
$employee_id = $params['employee_id'] ?? null;
|
||||||
|
$mpin = $params['mpin'] ?? null;
|
||||||
|
|
||||||
|
if (empty($employee_id) || empty($mpin)) {
|
||||||
|
log_message('error', 'Missing employee_id or mpin in updatePreMpin');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$employeeModel = new EmployeeModel();
|
||||||
|
$result = $employeeModel
|
||||||
|
->where('id', $employee_id)
|
||||||
|
->set('mpin', $mpin)
|
||||||
|
->update();
|
||||||
|
|
||||||
|
log_message('info', 'MPIN update status (Pre): ' . var_export($result, true));
|
||||||
|
return $result;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
log_message('error', 'Exception in updatePreMpin: ' . $e->getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function updatePostMpin(array $params)
|
||||||
|
{
|
||||||
|
if (isset($params['mpin']) && isset($params['employee_id'])) {
|
||||||
|
|
||||||
|
$client = \Config\Services::curlrequest();
|
||||||
|
$endPoint = 'updateEmpMPIN';
|
||||||
|
$url = env('POST_ENROLLMENT_BASEURL') . $endPoint;
|
||||||
|
|
||||||
|
log_message('info', '[updatePostMpin] Sending POST to external API: ' . $url);
|
||||||
|
log_message('debug', '[updatePostMpin] Request Payload: ' . json_encode($params));
|
||||||
|
|
||||||
|
$response = $client->post($url, ['json' => $params, 'http_errors' => false]);
|
||||||
|
|
||||||
|
$post_json = $response->getBody();
|
||||||
|
log_message('info', '[updatePostMpin] Raw API Response: ' . $post_json);
|
||||||
|
|
||||||
|
$post_data = json_decode($post_json, true);
|
||||||
|
|
||||||
|
$data = $post_data['data'] ?? [];
|
||||||
|
log_message('debug', '[updatePostMpin] Parsed Response Data: ' . json_encode($data));
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
log_message('warning', '[updatePostMpin] Missing required parameters: employee_id or mpin');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -42,7 +42,9 @@ class EmployeeModel extends Model
|
|||||||
"token_time_out",
|
"token_time_out",
|
||||||
"emp_type",
|
"emp_type",
|
||||||
"unit",
|
"unit",
|
||||||
"mpin"
|
"mpin",
|
||||||
|
"is_mpin_skipped",
|
||||||
|
"is_biometric_enabled",
|
||||||
];
|
];
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
|
|||||||
@ -1849,4 +1849,99 @@ class EmployeePolicyModel extends Model
|
|||||||
|
|
||||||
return $result[0];
|
return $result[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function download_inception($client_id = 0, $branch_id = 0, $policy_id = 0, $status = [], $emp_code = "", $emp_name = ""){
|
||||||
|
|
||||||
|
$result = $this->select([
|
||||||
|
|
||||||
|
'emp.emp_code AS `Emp ID`',
|
||||||
|
'emp.name AS `Name of Emp/Dep`',
|
||||||
|
"DATE_FORMAT(emp.dob, '%d-%b-%Y') AS `DOB`",
|
||||||
|
'emp.gender As `Gender`',
|
||||||
|
'emp.relationship As `Relationship`',
|
||||||
|
|
||||||
|
'employee_polices.basic_cover_si As `Basic cover SI`',
|
||||||
|
|
||||||
|
"DATE_FORMAT(employee_polices.date_coverage, '%d-%b-%Y') AS `Date of Coverage`",
|
||||||
|
"DATE_FORMAT(emp.doj, '%d-%b-%Y') AS `DOJ`",
|
||||||
|
'emp.basic_pay As `Basic Pay`',
|
||||||
|
'emp.band As `Band/Grade`',
|
||||||
|
'emp.designation As `Designation`',
|
||||||
|
|
||||||
|
'emp.mobile as Phone',
|
||||||
|
'emp.email_corporate As Email',
|
||||||
|
|
||||||
|
'COALESCE(employee_polices.pre_existing_alignments, 0) as `PRE EXISTING AILMENTS`',
|
||||||
|
|
||||||
|
'emp.change_event',
|
||||||
|
'employee_polices.date_of_exit',
|
||||||
|
'employee_polices.reason_for_exit',
|
||||||
|
|
||||||
|
'emp.unit'
|
||||||
|
|
||||||
|
])
|
||||||
|
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||||
|
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
|
||||||
|
->join('policies pm', 'cp.policy_id = pm.id', 'left') //pm - policy master
|
||||||
|
->join('policy_type', 'policy_type.id = cp.policy_type_id')
|
||||||
|
->join('insurers im', 'cp.insurer_id = im.id', 'left') //im - insurer master
|
||||||
|
->join('insurer_branch ib', 'cp.insurer_branch_id = ib.id', 'left') //ib - insurer branch
|
||||||
|
->join('tpa tpam', 'cp.tpa_id = tpam.id', 'left') //tpam - tpa master
|
||||||
|
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id', 'left') //tpab - tpa branch
|
||||||
|
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
|
||||||
|
->join('client_branch', 'emp.client_branch_id = client_branch.id') //cm - client master
|
||||||
|
->orderBy('emp.emp_code', 'ASC')
|
||||||
|
->orderBy('employee_polices.employee_id', 'ASC');
|
||||||
|
|
||||||
|
|
||||||
|
// Conditionally add where clauses
|
||||||
|
if ($client_id != 0 && !empty(trim($client_id))) {
|
||||||
|
$result->where('emp.client_id', $client_id);
|
||||||
|
}
|
||||||
|
if ($branch_id != 0 && !empty(trim($branch_id))) {
|
||||||
|
$result->where('emp.client_branch_id', $branch_id);
|
||||||
|
}
|
||||||
|
if ($policy_id != 0 && !empty(trim($policy_id))) {
|
||||||
|
$result->where('employee_polices.client_policy_id', $policy_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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');
|
||||||
|
// $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);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
$result->where('employee_polices.status =', 'enrolled');
|
||||||
|
|
||||||
|
if (!empty(trim($emp_code))) {
|
||||||
|
$result->where('emp.emp_code', $emp_code);
|
||||||
|
}
|
||||||
|
if (!empty(trim($emp_name))) {
|
||||||
|
$result->like('emp.name', $emp_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Always check these conditions
|
||||||
|
$result->where('employee_polices.is_active', 1)
|
||||||
|
->where('emp.is_active', 1);
|
||||||
|
|
||||||
|
$res = $result->findAll();
|
||||||
|
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -19,7 +19,8 @@ class FileModel extends Model
|
|||||||
"client_id",
|
"client_id",
|
||||||
"policy_id",
|
"policy_id",
|
||||||
"client_branch_id",
|
"client_branch_id",
|
||||||
"uploaded_by"
|
"uploaded_by",
|
||||||
|
"updated_by"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -98,7 +98,7 @@ input:checked + .slider:before {
|
|||||||
<label for="short_name">Client Short Name<span
|
<label for="short_name">Client Short Name<span
|
||||||
class="text-danger">*</span></label>
|
class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="short_name"
|
<input type="text" class="form-control" id="short_name"
|
||||||
placeholder="Enter Short Name" value="<?= isset($client['short_name']) ? $client['short_name'] : '' ?>" name="short_name" required>
|
placeholder="Enter Short Name" value="<?= isset($client['short_name']) ? $client['short_name'] : '' ?>" name="short_name" onkeyup="validateInput(this, 'clients', 'short_name', 'clientBtnSubmit')" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ input:checked + .slider:before {
|
|||||||
|
|
||||||
<div class="form-group text-right m-b-0">
|
<div class="form-group text-right m-b-0">
|
||||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||||
id="btnSubmit">Submit</button>
|
id="clientBtnSubmit">Submit</button>
|
||||||
<button type="button" class="btn btn-secondary waves-effect btnBack"
|
<button type="button" class="btn btn-secondary waves-effect btnBack"
|
||||||
id="btnBack">Cancel</button>
|
id="btnBack">Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -160,7 +160,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
<!--
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label>Contact 1</label>
|
<label>Contact 1</label>
|
||||||
@ -168,6 +168,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
|
<input type="hidden" name="branch_table_pk[]" id="branch_table_pk" >
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="first_name">Name<span class="text-danger">*</span></label>
|
<label for="first_name">Name<span class="text-danger">*</span></label>
|
||||||
<input value="" type="text" class="form-control" placeholder="Enter Contact Name"
|
<input value="" type="text" class="form-control" placeholder="Enter Contact Name"
|
||||||
@ -179,22 +180,24 @@
|
|||||||
name="designation[]" id="designation" required>
|
name="designation[]" id="designation" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="last_name">Email<span class="text-danger">*</span></label>
|
<label for="last_name">Email<span class="text-danger">*</span></label>
|
||||||
<input value="" type="text" class="form-control" placeholder="Enter Contact Email"
|
<input value="" type="text" class="form-control" placeholder="Enter Contact Email"
|
||||||
name="email[]" id="email" data-parsley-trigger="change" data-parsley-type="email" required>
|
name="email[]" id="email" data-parsley-trigger="change" data-parsley-type="email" onkeyup="validateInput(this, 'level_contacts', 'email', 'branchBtnSubmit')" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="mobile">Mobile<span class="text-danger">*</span></label>
|
<label for="mobile">Mobile<span class="text-danger">*</span></label>
|
||||||
<input value="" type="text" class="form-control" placeholder="Enter Contact Mobile"
|
<input value="" type="text" class="form-control" placeholder="Enter Contact Mobile"
|
||||||
name="mobile[]" id="mobile" onchange="checkMobileNumber(this)"
|
name="mobile[]" id="mobile" onkeyup="validateInput(this, 'level_contacts', 'mobile', 'branchBtnSubmit')"
|
||||||
onkeypress="return onlyNumbers(event)" maxlength="10" minlength="10"
|
onkeypress="return onlyNumbers(event)" maxlength="10" minlength="10"
|
||||||
data-parsley-type-message="Please enter a valid 10-digit mobile number."
|
data-parsley-type-message="Please enter a valid 10-digit mobile number."
|
||||||
data-parsley-required-message="Please enter a valid 10-digit mobile number."
|
data-parsley-required-message="Please enter a valid 10-digit mobile number."
|
||||||
required>
|
required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group" style="display: flex;">
|
<div class="form-group" style="display: flex;">
|
||||||
<button style="margin-right: 10px;" type="button" class="btn btn-primary btn-sm ac"
|
<button style="margin-right: 10px;" type="button" class="btn btn-primary btn-sm ac"
|
||||||
onclick="appendContactHtml()" id="add">Add Contact</button>
|
onclick="appendContactHtml()" id="add">Add Contact</button>
|
||||||
@ -202,12 +205,12 @@
|
|||||||
id="remove_btn">Remove</button>
|
id="remove_btn">Remove</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="container"></div> -->
|
<div id="container"></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group text-right m-b-0">
|
<div class="form-group text-right m-b-0">
|
||||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||||
id="btnSubmit">Submit</button>
|
id="branchBtnSubmit">Submit</button>
|
||||||
<button type="button" class="btn btn-secondary waves-effect btnBack"
|
<button type="button" class="btn btn-secondary waves-effect btnBack"
|
||||||
id="btnBack">Cancel</button>
|
id="btnBack">Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
@ -352,6 +355,9 @@ $("#branch_form").submit(function(event) {
|
|||||||
var selectedValues = $("#selected").val();
|
var selectedValues = $("#selected").val();
|
||||||
console.log(selectedValues, selectedValues);
|
console.log(selectedValues, selectedValues);
|
||||||
|
|
||||||
|
let level_contect_data = getContactsData();
|
||||||
|
console.log('level_contect_data', level_contect_data);
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
branch_PrimaryKey = $('#client_id_branch').val();
|
branch_PrimaryKey = $('#client_id_branch').val();
|
||||||
|
|
||||||
@ -375,11 +381,14 @@ $("#branch_form").submit(function(event) {
|
|||||||
var formData = new FormData($('#branch_form')[0]);
|
var formData = new FormData($('#branch_form')[0]);
|
||||||
|
|
||||||
const jsonString = JSON.stringify(selectedValues);
|
const jsonString = JSON.stringify(selectedValues);
|
||||||
|
const level_contect_data_json_string = JSON.stringify(level_contect_data);
|
||||||
console.log('jsonString', jsonString);
|
console.log('jsonString', jsonString);
|
||||||
|
console.log('level_contect_data_json_string', level_contect_data_json_string);
|
||||||
|
|
||||||
|
|
||||||
// Append the JSON string to the FormData object
|
// Append the JSON string to the FormData object
|
||||||
formData.append('units', jsonString);
|
formData.append('units', jsonString);
|
||||||
|
formData.append('level_contect_data', level_contect_data_json_string);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: formData,
|
data: formData,
|
||||||
@ -500,6 +509,8 @@ $('body').on('click', '.btnBranchEdit', function() {
|
|||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
|
||||||
|
console.log('client branch edit data response : ', res);
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
@ -530,10 +541,24 @@ $('body').on('click', '.btnBranchEdit', function() {
|
|||||||
|
|
||||||
appendOption(res.data.units)
|
appendOption(res.data.units)
|
||||||
|
|
||||||
$('#name').val(res.contact[0].name);
|
// $('#name').val(res.contact[0].name);
|
||||||
$('#email').val(res.contact[0].email);
|
// $('#email').val(res.contact[0].email);
|
||||||
$('#mobile').val(res.contact[0].mobile);
|
// $('#mobile').val(res.contact[0].mobile);
|
||||||
$('#designation').val(res.contact[0].designation);
|
// $('#designation').val(res.contact[0].designation);
|
||||||
|
|
||||||
|
if (res.contact && res.contact.length > 0 && res.contact[0]) {
|
||||||
|
$('#branch_table_pk').val(res.contact[0].id || '');
|
||||||
|
$('#name').val(res.contact[0].name || '');
|
||||||
|
$('#email').val(res.contact[0].email || '');
|
||||||
|
$('#mobile').val(res.contact[0].mobile || '');
|
||||||
|
$('#designation').val(res.contact[0].designation || '');
|
||||||
|
} else {
|
||||||
|
$('#branch_table_pk').val('');
|
||||||
|
$('#name').val('');
|
||||||
|
$('#email').val('');
|
||||||
|
$('#mobile').val('');
|
||||||
|
$('#designation').val('');
|
||||||
|
}
|
||||||
|
|
||||||
res.contact.shift();
|
res.contact.shift();
|
||||||
// console.log(res.contact.length)
|
// console.log(res.contact.length)
|
||||||
@ -559,12 +584,12 @@ $('body').on('click', '.btnBranchEdit', function() {
|
|||||||
console.log(branch_form_action);
|
console.log(branch_form_action);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#remove_btn").click(function() {
|
// $("#remove_btn").click(function() {
|
||||||
$("#name").val('');
|
// $("#name").val('');
|
||||||
$("#email").val('');
|
// $("#email").val('');
|
||||||
$("#mobile").val('');
|
// $("#mobile").val('');
|
||||||
$("#designation").val('');
|
// $("#designation").val('');
|
||||||
})
|
// })
|
||||||
|
|
||||||
// Initialize the contact count
|
// Initialize the contact count
|
||||||
function appendContactHtml(contact = false, reset = false) {
|
function appendContactHtml(contact = false, reset = false) {
|
||||||
@ -584,6 +609,7 @@ function appendContactHtml(contact = false, reset = false) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
|
<input type="hidden" name="branch_table_pk[]" id="${uniqueId}_branch_table_pk" value="${contact !== undefined && contact !== false ? contact.id : ''}">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="${uniqueId}_first_name">Name<span class="text-danger">*</span></label>
|
<label for="${uniqueId}_first_name">Name<span class="text-danger">*</span></label>
|
||||||
<input value="${contact !== undefined && contact !== false ? contact.name : ''}" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="${uniqueId}_name" required>
|
<input value="${contact !== undefined && contact !== false ? contact.name : ''}" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="${uniqueId}_name" required>
|
||||||
@ -596,11 +622,11 @@ function appendContactHtml(contact = false, reset = false) {
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="${uniqueId}_last_name">Email<span class="text-danger">*</span></label>
|
<label for="${uniqueId}_last_name">Email<span class="text-danger">*</span></label>
|
||||||
<input value="${contact !== undefined && contact !== false ? contact.email : ''}" type="text" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" data-parsley-trigger="change" data-parsley-type="email" required>
|
<input value="${contact !== undefined && contact !== false ? contact.email : ''}" type="text" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" data-parsley-trigger="change" data-parsley-type="email" onchange="validateInput(this, 'level_contacts', 'email', 'branchBtnSubmit')" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
|
<label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
|
||||||
<input value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="text" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" onchange="checkMobileNumber(this)" onkeypress = "return onlyNumbers(event)" maxlength="10" min="10" data-parsley-type-message="Please enter a valid 10-digit mobile number." data-parsley-required-message="Please enter a valid 10-digit mobile number." required>
|
<input value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="text" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" onkeyup="validateInput(this, 'level_contacts', 'mobile', 'branchBtnSubmit')" onkeypress = "return onlyNumbers(event)" maxlength="10" min="10" data-parsley-type-message="Please enter a valid 10-digit mobile number." data-parsley-required-message="Please enter a valid 10-digit mobile number." required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" style="display: flex;">
|
<div class="form-group" style="display: flex;">
|
||||||
@ -623,20 +649,50 @@ function appendContactHtml(contact = false, reset = false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeContact(button) {
|
function removeContact(button) {
|
||||||
|
|
||||||
var uniqueId = button.id.split("_")[0];
|
var uniqueId = button.id.split("_")[0];
|
||||||
|
console.log('uniqueId', uniqueId);
|
||||||
var contactSection = document.getElementById(uniqueId);
|
var contactSection = document.getElementById(uniqueId);
|
||||||
|
console.log('contactSection', contactSection);
|
||||||
|
|
||||||
if (contactSection) {
|
confirmActionSweertAlert("Do you want to remove this contact?", "Yes, Proceed!", "No, Cancel").then((confirmed) => {
|
||||||
contactSection.parentNode.removeChild(contactSection);
|
if(confirmed){
|
||||||
contactCount--;
|
if (contactSection) {
|
||||||
|
|
||||||
if (contactCount < 3) {
|
let unique_param = uniqueId + '_branch_table_pk';
|
||||||
var addButton = document.querySelector('.ac');
|
console.log('unique_param', unique_param);
|
||||||
if (addButton) {
|
let other_id = $('#' + unique_param).val();
|
||||||
addButton.style.display = 'block';
|
console.log('other_id', other_id);
|
||||||
|
|
||||||
|
contactSection.parentNode.removeChild(contactSection);
|
||||||
|
contactCount--;
|
||||||
|
|
||||||
|
if (contactCount < 3) {
|
||||||
|
var addButton = document.querySelector('.ac');
|
||||||
|
if (addButton) {
|
||||||
|
addButton.style.display = 'block';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(other_id){
|
||||||
|
removeLevelContacts(other_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$("#name").val('');
|
||||||
|
$("#email").val('');
|
||||||
|
$("#mobile").val('');
|
||||||
|
$("#designation").val('');
|
||||||
|
|
||||||
|
let first_id = $('#branch_table_pk').val();
|
||||||
|
console.log('first_id', first_id);
|
||||||
|
if(first_id){
|
||||||
|
removeLevelContacts(first_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function storeButtonId(id) {
|
function storeButtonId(id) {
|
||||||
@ -772,6 +828,75 @@ function checkMobileNumber(input) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function validateInput(input, table, field, submitBtnId){
|
||||||
|
|
||||||
|
let value = $(input).val();
|
||||||
|
let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim();
|
||||||
|
|
||||||
|
let message = "Value is duplicate!";
|
||||||
|
if(label){
|
||||||
|
message = label + " already exists!";
|
||||||
|
}
|
||||||
|
|
||||||
|
checkDuplicateTableFieldValue(table, field, value, function(isDuplicate) {
|
||||||
|
if (isDuplicate) {
|
||||||
|
toastr.warning(message, 'WARNING');
|
||||||
|
// $(input).val('')
|
||||||
|
$('#'+submitBtnId).prop('disabled', true);
|
||||||
|
} else{
|
||||||
|
$('#'+submitBtnId).prop('disabled', false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function getContactsData() {
|
||||||
|
const contacts = [];
|
||||||
|
|
||||||
|
const ids = $('input[name="branch_table_pk[]"]');
|
||||||
|
const names = $('input[name="name[]"]');
|
||||||
|
const mobiles = $('input[name="mobile[]"]');
|
||||||
|
const emails = $('input[name="email[]"]');
|
||||||
|
const designations = $('input[name="designation[]"]');
|
||||||
|
|
||||||
|
for (let i = 0; i < ids.length; i++) {
|
||||||
|
contacts.push({
|
||||||
|
id: $(ids[i]).val() || null,
|
||||||
|
name: $(names[i]).val(),
|
||||||
|
mobile: $(mobiles[i]).val(),
|
||||||
|
email: $(emails[i]).val(),
|
||||||
|
designation: $(designations[i]).val()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return contacts;
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeLevelContacts(id){
|
||||||
|
|
||||||
|
let url = '<?= base_url('util/removeLevelContacts') ?>';
|
||||||
|
|
||||||
|
let requestData = {
|
||||||
|
id: id,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Send AJAX request
|
||||||
|
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
|
||||||
|
|
||||||
|
console.log('Data fetched successfully:', response);
|
||||||
|
if (response.status == true) {
|
||||||
|
toastr.success(response.message, 'SUCCESS');
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message, 'WARNING');
|
||||||
|
}
|
||||||
|
|
||||||
|
}, function(xhr, status, error) {
|
||||||
|
console.error('Error fetching data:', error);
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@ -1,48 +1,48 @@
|
|||||||
<style>
|
<style>
|
||||||
.table th,
|
.table th,
|
||||||
.table td {
|
.table td {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.dataTable tbody td {
|
table.dataTable tbody td {
|
||||||
padding: 4px 4px !important;
|
padding: 4px 4px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.dataTable thead th {
|
table.dataTable thead th {
|
||||||
padding: 4px 4px !important;
|
padding: 4px 4px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.col-12{
|
.col-12{
|
||||||
|
|
||||||
max-width: 98% !important;
|
max-width: 98% !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-dropdown-menu {
|
.custom-dropdown-menu {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-color: #ffffff !important;
|
background-color: #ffffff !important;
|
||||||
border: 1px solid rgba(0, 0, 0, 0.15);
|
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||||
border-radius: 0.25rem;
|
border-radius: 0.25rem;
|
||||||
padding: 0.5rem 0;
|
padding: 0.5rem 0;
|
||||||
min-width: 10rem;
|
min-width: 10rem;
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-dropdown-menu .dropdown-item {
|
.custom-dropdown-menu .dropdown-item {
|
||||||
display: block !important;
|
display: block !important;
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
padding: 0.5rem 1rem !important;
|
padding: 0.5rem 1rem !important;
|
||||||
color: #212529 !important;
|
color: #212529 !important;
|
||||||
text-decoration: none !important;
|
text-decoration: none !important;
|
||||||
background-color: transparent !important;
|
background-color: transparent !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-dropdown-menu .dropdown-item:hover {
|
.custom-dropdown-menu .dropdown-item:hover {
|
||||||
background-color: #f8f9fa !important;
|
background-color: #f8f9fa !important;
|
||||||
color: #16181b !important;
|
color: #16181b !important;
|
||||||
cursor: pointer !important;
|
cursor: pointer !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="row" id="client_list">
|
<div class="row" id="client_list">
|
||||||
@ -71,33 +71,31 @@ table.dataTable thead th {
|
|||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach($clientList as $row){ ?>
|
<?php foreach($clientList as $row){ ?>
|
||||||
<tr >
|
<tr >
|
||||||
<td class="client_info" data-id="<?php echo $row->id; ?>"><?php echo $row->client_name; ?> ( <?php echo $row->short_name; ?> ) </td>
|
<td class="client_info" data-id="<?php echo $row->id; ?>"><?php echo $row->client_name; ?> ( <?php echo $row->short_name; ?> ) </td>
|
||||||
<td>
|
<td>
|
||||||
<?php $account_managers = ''; ?>
|
<?php $account_managers = ''; ?>
|
||||||
<?php foreach ($client_rm as $client): ?>
|
<?php foreach ($client_rm as $client): ?>
|
||||||
<?php if ($client->client_id == $row->id): ?>
|
<?php if ($client->client_id == $row->id): ?>
|
||||||
<?php $account_managers .= $client->account_manager . ', '; ?>
|
<?php $account_managers .= $client->account_manager . ', '; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php echo rtrim($account_managers, ', '); ?>
|
<?php echo rtrim($account_managers, ', '); ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group dropdown">
|
<div class="btn-group dropdown">
|
||||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||||
<div class="dropdown-menu dropdown-menu-right">
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
<a class="dropdown-item" href="<?= base_url("client/list/"); ?><?= $row->id;?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
<a class="dropdown-item" href="<?= base_url("client/list/"); ?><?= $row->id;?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||||
<!-- <a class="dropdown-item" href="<?= base_url("client/deposit/{$row->id}"); ?>"><i class="mdi mdi-cash mr-2 text-muted font-18 vertical-middle"></i>CD Transactions</a> -->
|
<!-- <a class="dropdown-item" href="<?= base_url("client/deposit/{$row->id}"); ?>"><i class="mdi mdi-cash mr-2 text-muted font-18 vertical-middle"></i>CD Transactions</a> -->
|
||||||
<?php if(get_role_id() != 3 && get_role_id() != 4) { ?>
|
<?php if(in_array(get_role_id(), [1, 5])) { ?>
|
||||||
<a class="dropdown-item" data-id="<?= $row->id;?>" onclick="removeClient(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
<a class="dropdown-item" data-id="<?= $row->id;?>" onclick="removeClient(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</td>
|
||||||
</td>
|
</tr>
|
||||||
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -107,7 +105,6 @@ table.dataTable thead th {
|
|||||||
</div>
|
</div>
|
||||||
<!-- end row -->
|
<!-- end row -->
|
||||||
|
|
||||||
|
|
||||||
<div id="append_client_info"></div>
|
<div id="append_client_info"></div>
|
||||||
|
|
||||||
|
|
||||||
@ -142,111 +139,302 @@ table.dataTable thead th {
|
|||||||
</div><!-- /.modal -->
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
const table = document.getElementById("tickets-table");
|
const table = document.getElementById("tickets-table");
|
||||||
|
|
||||||
// Create custom dropdown
|
|
||||||
function createCustomDropdown(row) {
|
|
||||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
|
||||||
if (!originalDropdown) return null;
|
|
||||||
|
|
||||||
const customDropdown = document.createElement('div');
|
// Create custom dropdown
|
||||||
customDropdown.className = 'custom-dropdown-menu';
|
function createCustomDropdown(row) {
|
||||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||||
|
if (!originalDropdown) return null;
|
||||||
// Add 'Open Client Details' option in the dropdown
|
|
||||||
const clientId = row.querySelector('.client_info').dataset.id;
|
const customDropdown = document.createElement('div');
|
||||||
const openDetailsOption = document.createElement('a');
|
customDropdown.className = 'custom-dropdown-menu';
|
||||||
openDetailsOption.href = "javascript:void(0);";
|
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||||
openDetailsOption.className = 'dropdown-item';
|
|
||||||
openDetailsOption.innerHTML = `<i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>Open Client Details`;
|
// Add 'Open Client Details' option in the dropdown
|
||||||
|
const clientId = row.querySelector('.client_info').dataset.id;
|
||||||
openDetailsOption.addEventListener('click', function() {
|
const openDetailsOption = document.createElement('a');
|
||||||
openClientDetailsPage(clientId); // Open the client details page when clicked
|
openDetailsOption.href = "javascript:void(0);";
|
||||||
});
|
openDetailsOption.className = 'dropdown-item';
|
||||||
|
openDetailsOption.innerHTML = `<i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>Open Client Details`;
|
||||||
customDropdown.appendChild(openDetailsOption);
|
|
||||||
|
openDetailsOption.addEventListener('click', function() {
|
||||||
|
openClientDetailsPage(clientId); // Open the client details page when clicked
|
||||||
|
});
|
||||||
|
|
||||||
|
customDropdown.appendChild(openDetailsOption);
|
||||||
|
|
||||||
return customDropdown;
|
return customDropdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
let activeDropdown = null;
|
let activeDropdown = null;
|
||||||
|
|
||||||
// Add click event listener to rows
|
// Add click event listener to rows
|
||||||
table.querySelectorAll("tbody tr").forEach(row => {
|
table.querySelectorAll("tbody tr").forEach(row => {
|
||||||
const customDropdown = createCustomDropdown(row);
|
const customDropdown = createCustomDropdown(row);
|
||||||
if (!customDropdown) return;
|
if (!customDropdown) return;
|
||||||
|
|
||||||
document.body.appendChild(customDropdown);
|
document.body.appendChild(customDropdown);
|
||||||
|
|
||||||
row.addEventListener("click", function(event) {
|
row.addEventListener("click", function(event) {
|
||||||
// Ignore clicks on the action column
|
// Ignore clicks on the action column
|
||||||
if (event.target.closest('td:last-child')) {
|
if (event.target.closest('td:last-child')) {
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// Show the action dropdown
|
|
||||||
if (activeDropdown) {
|
|
||||||
activeDropdown.style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
const rect = event.target.getBoundingClientRect();
|
|
||||||
customDropdown.style.display = 'block';
|
|
||||||
customDropdown.style.position = 'fixed';
|
|
||||||
customDropdown.style.left = `${rect.left}px`;
|
|
||||||
customDropdown.style.top = `${rect.bottom + 5}px`; // 5px gap
|
|
||||||
|
|
||||||
activeDropdown = customDropdown;
|
|
||||||
event.stopPropagation();
|
|
||||||
});
|
|
||||||
|
|
||||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
|
||||||
item.addEventListener('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
const onclickAttr = this.getAttribute('onclick');
|
|
||||||
if (onclickAttr) {
|
|
||||||
eval(onclickAttr);
|
|
||||||
}
|
|
||||||
|
|
||||||
const href = this.getAttribute('href');
|
|
||||||
if (href && href !== '#') {
|
|
||||||
window.location.href = href;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show the action dropdown
|
||||||
if (activeDropdown) {
|
if (activeDropdown) {
|
||||||
activeDropdown.style.display = 'none';
|
activeDropdown.style.display = 'none';
|
||||||
activeDropdown = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
e.stopPropagation();
|
const rect = event.target.getBoundingClientRect();
|
||||||
|
customDropdown.style.display = 'block';
|
||||||
|
customDropdown.style.position = 'fixed';
|
||||||
|
customDropdown.style.left = `${rect.left}px`;
|
||||||
|
customDropdown.style.top = `${rect.bottom + 5}px`; // 5px gap
|
||||||
|
|
||||||
|
activeDropdown = customDropdown;
|
||||||
|
event.stopPropagation();
|
||||||
|
});
|
||||||
|
|
||||||
|
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||||
|
item.addEventListener('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
const onclickAttr = this.getAttribute('onclick');
|
||||||
|
if (onclickAttr) {
|
||||||
|
eval(onclickAttr);
|
||||||
|
}
|
||||||
|
|
||||||
|
const href = this.getAttribute('href');
|
||||||
|
if (href && href !== '#') {
|
||||||
|
window.location.href = href;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (activeDropdown) {
|
||||||
|
activeDropdown.style.display = 'none';
|
||||||
|
activeDropdown = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
// Close dropdown when clicking outside
|
// Close dropdown when clicking outside
|
||||||
document.addEventListener("click", function() {
|
document.addEventListener("click", function() {
|
||||||
if (activeDropdown) {
|
if (activeDropdown) {
|
||||||
activeDropdown.style.display = 'none';
|
activeDropdown.style.display = 'none';
|
||||||
activeDropdown = null;
|
activeDropdown = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Open client details page
|
||||||
|
function openClientDetailsPage(clientId) {
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "<?= base_url('util/get-client-details/') ?>" + clientId,
|
||||||
|
type: "GET",
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(res) {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
$('#append_client_info').empty().append(res.data);
|
||||||
|
$('#client_info').show();
|
||||||
|
$('#client_list').hide();
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
$('#lead_id').select2();
|
||||||
|
})
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
$('#tickets-table').DataTable({
|
||||||
|
dom: "<'row'<'col-sm-0'f><'col-sm-7 text-right'B>>" +
|
||||||
|
"<'row'<'col-sm-12'tr>>" +
|
||||||
|
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||||
|
buttons: [{
|
||||||
|
extend: 'csv',
|
||||||
|
text: 'CSV',
|
||||||
|
title: 'ClientList',
|
||||||
|
className: 'my_class',
|
||||||
|
exportOptions: {
|
||||||
|
columns: ':not(:last-child)'
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
language: {
|
||||||
|
search: "_INPUT_",
|
||||||
|
searchPlaceholder: "Search..."
|
||||||
|
},
|
||||||
|
paging: true ,
|
||||||
|
// pagingType: 'full_numbers'
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
//DO NOT REMOVE THIS FUNCTION >>> THI FUNCTION FOR CLIENT SOFT DELETE
|
||||||
|
// function removeClient(element)
|
||||||
|
// {
|
||||||
|
|
||||||
|
// Swal.fire({
|
||||||
|
// title: "Are you sure?",
|
||||||
|
// text: "You need to remove this client.",
|
||||||
|
// icon: "info",
|
||||||
|
// showCancelButton: true,
|
||||||
|
// confirmButtonColor: "#3085d6",
|
||||||
|
// confirmButtonText: "Yes",
|
||||||
|
// }).then((result) => {
|
||||||
|
|
||||||
|
// if (result.isConfirmed) {
|
||||||
|
|
||||||
|
// $('.loader').fadeIn();
|
||||||
|
// $('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
// var id = element.getAttribute('data-id');
|
||||||
|
// var form_action = '<?= base_url("client/remove/") ?>' + id;
|
||||||
|
// $.ajax({
|
||||||
|
// url: form_action,
|
||||||
|
// type: "GET",
|
||||||
|
// dataType: 'json',
|
||||||
|
// processData: false,
|
||||||
|
// contentType: false,
|
||||||
|
// success: function(res) {
|
||||||
|
|
||||||
|
// $('.loader').fadeOut();
|
||||||
|
// $('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
// if(res){
|
||||||
|
// if (res.status == true) {
|
||||||
|
// toastr.success('Client removed successfully.', 'success');
|
||||||
|
// location.reload();
|
||||||
|
// } else {
|
||||||
|
// Swal.fire({
|
||||||
|
// title: "warning!",
|
||||||
|
// text: res.message,
|
||||||
|
// icon: "warning"
|
||||||
|
// });
|
||||||
|
// // toastr.warning(res.message, 'warning');
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// error: function (xhr, status, error) {
|
||||||
|
// console.error(xhr.responseText);
|
||||||
|
// console.error(status, error);
|
||||||
|
// $('.loader').fadeOut();
|
||||||
|
// $('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
// console.log('Something Wrong!', 'warning');
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// });
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
function removeClient(element) {
|
||||||
|
console.log("Remove client function called")
|
||||||
|
console.log('element', element);
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Are you sure?",
|
||||||
|
html: `Is this a Demo Client?, Please reconfirm by clicking Yes to delete. <br> <span style = "color : red; font-size : 14px;">Note : This data will be deleted permanently and cannot be recovered.</span>`,
|
||||||
|
icon: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
confirmButtonText: "Yes",
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
console.log('Print the result : ', result)
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
|
||||||
|
console.log('Click Yes : ', result.isConfirmed);
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
var id = element.getAttribute('data-id');
|
||||||
|
console.log('client_id', id);
|
||||||
|
|
||||||
|
var form_action = '<?= base_url("/client/wipe") ?>';
|
||||||
|
console.log('URL : ', form_action);
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: form_action,
|
||||||
|
type: "POST",
|
||||||
|
data: {client_id : id},
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(res) {
|
||||||
|
|
||||||
|
console.log('Client remove function response : ', res);
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
if (res.status == true) {
|
||||||
|
toastr.success(res.message, 'success');
|
||||||
|
location.reload();
|
||||||
|
} else {
|
||||||
|
Swal.fire({
|
||||||
|
title: "warning!",
|
||||||
|
text: res.message,
|
||||||
|
icon: "warning"
|
||||||
|
});
|
||||||
|
// toastr.warning(res.message, 'warning');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
console.log('Something Wrong!', 'warning');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).on('click', '.client_info', function() {
|
||||||
|
|
||||||
// Open client details page
|
|
||||||
function openClientDetailsPage(clientId) {
|
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
$('.loader-mask').fadeIn();
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
var client_id = $(this).data('id')
|
||||||
|
$('#append_client_info').empty();
|
||||||
|
|
||||||
|
console.log(client_id);
|
||||||
|
console.log('client_info');
|
||||||
|
|
||||||
|
$('#client_info').show();
|
||||||
|
$('#client_list').hide();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "<?= base_url('util/get-client-details/') ?>" + clientId,
|
url: "<?= base_url('util/get-client-details/') ?>" + client_id,
|
||||||
type: "GET",
|
type: "GET",
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
$('#append_client_info').empty().append(res.data);
|
console.log(res);
|
||||||
$('#client_info').show();
|
console.log(res.data.length);
|
||||||
$('#client_list').hide();
|
$('#append_client_info').append(res.data);
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
@ -255,189 +443,59 @@ table.dataTable thead th {
|
|||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.client_info_close', function() {
|
||||||
|
|
||||||
|
console.log('client_info_close');
|
||||||
|
$('#client_info').hide();
|
||||||
|
$('#client_list').show();
|
||||||
|
});
|
||||||
|
|
||||||
|
function showModal(){
|
||||||
|
var myModal = new bootstrap.Modal(document.getElementById('lead_modal'));
|
||||||
|
myModal.show();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
function featchClient(){
|
||||||
|
|
||||||
<script>
|
let lead_id = $('#lead_id').val();
|
||||||
|
console.log('lead_id : ', lead_id)
|
||||||
|
let url = '<?= base_url('leads/featchLeadDataAndInsertClient/') ?>' + lead_id
|
||||||
|
|
||||||
$(document).ready(function(){
|
$('.loader').fadeIn();
|
||||||
$('#lead_id').select2();
|
$('.loader-mask').fadeIn();
|
||||||
})
|
|
||||||
|
|
||||||
$(document).ready(function()
|
$.ajax({
|
||||||
{
|
url: url,
|
||||||
$('#tickets-table').DataTable({
|
type: "GET",
|
||||||
dom: "<'row'<'col-sm-0'f><'col-sm-7 text-right'B>>" +
|
dataType: 'json',
|
||||||
"<'row'<'col-sm-12'tr>>" +
|
success: function (res) {
|
||||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
console.log(res);
|
||||||
buttons: [{
|
$('.loader').fadeOut();
|
||||||
extend: 'csv',
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
text: 'CSV',
|
|
||||||
title: 'ClientList',
|
|
||||||
className: 'my_class',
|
|
||||||
exportOptions: {
|
|
||||||
columns: ':not(:last-child)'
|
|
||||||
},
|
|
||||||
}],
|
|
||||||
language: {
|
|
||||||
search: "_INPUT_",
|
|
||||||
searchPlaceholder: "Search..."
|
|
||||||
},
|
|
||||||
paging: true ,
|
|
||||||
// pagingType: 'full_numbers'
|
|
||||||
});
|
|
||||||
})
|
|
||||||
|
|
||||||
function removeClient(element)
|
if(res.status == true){
|
||||||
{
|
let client_url = '<?= base_url('client/list/') ?>' + res.client_id + '?client_policy_id=' + res.client_policy_id+'#police-tab';
|
||||||
|
toastr.success(res.message, 'SUCCESS')
|
||||||
Swal.fire({
|
window.location.href = client_url
|
||||||
title: "Are you sure?",
|
}else{
|
||||||
text: "You need to remove this client.",
|
toastr.success(res.message, 'WARNING')
|
||||||
icon: "info",
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonColor: "#3085d6",
|
|
||||||
confirmButtonText: "Yes",
|
|
||||||
}).then((result) => {
|
|
||||||
|
|
||||||
if (result.isConfirmed) {
|
|
||||||
|
|
||||||
$('.loader').fadeIn();
|
|
||||||
$('.loader-mask').fadeIn();
|
|
||||||
|
|
||||||
var id = element.getAttribute('data-id');
|
|
||||||
var form_action = '<?= base_url("client/remove/") ?>' + id;
|
|
||||||
$.ajax({
|
|
||||||
url: form_action,
|
|
||||||
type: "GET",
|
|
||||||
dataType: 'json',
|
|
||||||
processData: false,
|
|
||||||
contentType: false,
|
|
||||||
success: function(res) {
|
|
||||||
|
|
||||||
$('.loader').fadeOut();
|
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
|
||||||
|
|
||||||
if(res){
|
|
||||||
if (res.status == true) {
|
|
||||||
toastr.success('Client removed successfully.', 'success');
|
|
||||||
location.reload();
|
|
||||||
} else {
|
|
||||||
Swal.fire({
|
|
||||||
title: "warning!",
|
|
||||||
text: res.message,
|
|
||||||
icon: "warning"
|
|
||||||
});
|
|
||||||
// toastr.warning(res.message, 'warning');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (xhr, status, error) {
|
|
||||||
console.error(xhr.responseText);
|
|
||||||
console.error(status, error);
|
|
||||||
$('.loader').fadeOut();
|
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
|
||||||
console.log('Something Wrong!', 'warning');
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
$('.close').click()
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
$('.close').click()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
$(document).on('click', '.client_info', function() {
|
}
|
||||||
|
|
||||||
$('.loader').fadeIn();
|
|
||||||
$('.loader-mask').fadeIn();
|
|
||||||
|
|
||||||
var client_id = $(this).data('id')
|
|
||||||
$('#append_client_info').empty();
|
|
||||||
|
|
||||||
console.log(client_id);
|
|
||||||
console.log('client_info');
|
|
||||||
|
|
||||||
$('#client_info').show();
|
|
||||||
$('#client_list').hide();
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: "<?= base_url('util/get-client-details/') ?>" + client_id,
|
|
||||||
type: "GET",
|
|
||||||
dataType: 'json',
|
|
||||||
processData: false,
|
|
||||||
contentType: false,
|
|
||||||
success: function(res) {
|
|
||||||
|
|
||||||
$('.loader').fadeOut();
|
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
|
||||||
|
|
||||||
console.log(res);
|
|
||||||
console.log(res.data.length);
|
|
||||||
$('#append_client_info').append(res.data);
|
|
||||||
|
|
||||||
},
|
|
||||||
error: function(xhr, status, error) {
|
|
||||||
console.error(xhr.responseText);
|
|
||||||
console.error(status, error);
|
|
||||||
$('.loader').fadeOut();
|
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).on('click', '.client_info_close', function() {
|
|
||||||
|
|
||||||
console.log('client_info_close');
|
|
||||||
$('#client_info').hide();
|
|
||||||
$('#client_list').show();
|
|
||||||
});
|
|
||||||
|
|
||||||
function showModal(){
|
|
||||||
var myModal = new bootstrap.Modal(document.getElementById('lead_modal'));
|
|
||||||
myModal.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
function featchClient(){
|
|
||||||
|
|
||||||
let lead_id = $('#lead_id').val();
|
|
||||||
console.log('lead_id : ', lead_id)
|
|
||||||
let url = '<?= base_url('leads/featchLeadDataAndInsertClient/') ?>' + lead_id
|
|
||||||
|
|
||||||
$('.loader').fadeIn();
|
|
||||||
$('.loader-mask').fadeIn();
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
type: "GET",
|
|
||||||
dataType: 'json',
|
|
||||||
success: function (res) {
|
|
||||||
console.log(res);
|
|
||||||
$('.loader').fadeOut();
|
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
|
||||||
|
|
||||||
if(res.status == true){
|
|
||||||
let client_url = '<?= base_url('client/list/') ?>' + res.client_id + '?client_policy_id=' + res.client_policy_id+'#police-tab';
|
|
||||||
toastr.success(res.message, 'SUCCESS')
|
|
||||||
window.location.href = client_url
|
|
||||||
}else{
|
|
||||||
toastr.success(res.message, 'WARNING')
|
|
||||||
}
|
|
||||||
|
|
||||||
$('.close').click()
|
|
||||||
},
|
|
||||||
error: function (xhr, status, error) {
|
|
||||||
console.error(xhr.responseText);
|
|
||||||
console.error(status, error);
|
|
||||||
$('.loader').fadeOut();
|
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
|
||||||
$('.close').click()
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -75,6 +75,19 @@
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
|
||||||
}
|
}
|
||||||
|
.btn-inception {
|
||||||
|
background-color: #02a8b5; /* Bootstrap primary blue */
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 6px 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-inception:hover {
|
||||||
|
background-color: #05676eff;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<?php $pro_rata_total = 0; $gst_total = 0 ?>
|
<?php $pro_rata_total = 0; $gst_total = 0 ?>
|
||||||
@ -88,6 +101,7 @@
|
|||||||
<h4 style="position: relative;">Employees</h4>
|
<h4 style="position: relative;">Employees</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
|
<table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
|
||||||
<thead class="bg-light">
|
<thead class="bg-light">
|
||||||
<tr>
|
<tr>
|
||||||
@ -105,6 +119,8 @@
|
|||||||
<th class="font-weight-medium">EMP Code</th>
|
<th class="font-weight-medium">EMP Code</th>
|
||||||
<th class="font-weight-medium">Relationship</th>
|
<th class="font-weight-medium">Relationship</th>
|
||||||
<th class="font-weight-medium">Gender</th>
|
<th class="font-weight-medium">Gender</th>
|
||||||
|
<th class="font-weight-medium">Email</th>
|
||||||
|
<th class="font-weight-medium">Mobile</th>
|
||||||
<th class="font-weight-medium">Date of Birth</th>
|
<th class="font-weight-medium">Date of Birth</th>
|
||||||
<th class="font-weight-medium">Policy name</th>
|
<th class="font-weight-medium">Policy name</th>
|
||||||
<th class="font-weight-medium">Insurer name</th>
|
<th class="font-weight-medium">Insurer name</th>
|
||||||
@ -144,6 +160,8 @@
|
|||||||
<td><?php echo $employee['emp_code']; ?></td>
|
<td><?php echo $employee['emp_code']; ?></td>
|
||||||
<td><?php echo $employee['relationship']; ?></td>
|
<td><?php echo $employee['relationship']; ?></td>
|
||||||
<td><?php echo $employee['gender']; ?></td>
|
<td><?php echo $employee['gender']; ?></td>
|
||||||
|
<td><?php echo $employee['email_corporate']; ?></td>
|
||||||
|
<td><?php echo $employee['mobile']; ?></td>
|
||||||
<td><?php echo date('d/m/Y', strtotime($employee['dob'])); ?></td>
|
<td><?php echo date('d/m/Y', strtotime($employee['dob'])); ?></td>
|
||||||
<td><?php echo isset($employee['policy_type']) ? $employee['policy_type'] : ''; ?> -
|
<td><?php echo isset($employee['policy_type']) ? $employee['policy_type'] : ''; ?> -
|
||||||
<?php echo isset($employee['policy_no']) ? $employee['policy_no'] : ''; ?></td>
|
<?php echo isset($employee['policy_no']) ? $employee['policy_no'] : ''; ?></td>
|
||||||
@ -394,7 +412,8 @@ $(document).ready(function() {
|
|||||||
extend: 'csv',
|
extend: 'csv',
|
||||||
text: 'CSV',
|
text: 'CSV',
|
||||||
title: 'Member-List',
|
title: 'Member-List',
|
||||||
},
|
}
|
||||||
|
,
|
||||||
{
|
{
|
||||||
extend: 'excelHtml5',
|
extend: 'excelHtml5',
|
||||||
text: 'Excel',
|
text: 'Excel',
|
||||||
@ -428,6 +447,15 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
|
||||||
|
text: 'Export As Inception',
|
||||||
|
className: 'btn-inception',
|
||||||
|
action: function (e, dt, node, config) {
|
||||||
|
downloadInception();
|
||||||
|
}
|
||||||
|
}
|
||||||
],
|
],
|
||||||
language: {
|
language: {
|
||||||
search: "_INPUT_",
|
search: "_INPUT_",
|
||||||
@ -779,4 +807,56 @@ function get_emp_history(input, emp_id) {
|
|||||||
// modalInstance.hide();
|
// modalInstance.hide();
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
function downloadInception(){
|
||||||
|
|
||||||
|
let client = $('#clients').val();
|
||||||
|
let branch = $('#branch_id').val();
|
||||||
|
let policies = $('#policies').val();
|
||||||
|
let status = $('#status2').val();
|
||||||
|
let empCode = $('#emp_code').val();
|
||||||
|
let empName = $('#emp_name').val();
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: "<?php echo base_url('employee/download_inception') ?>",
|
||||||
|
data: {
|
||||||
|
client: client,
|
||||||
|
branch: branch,
|
||||||
|
policies: policies,
|
||||||
|
status: status,
|
||||||
|
empCode: empCode,
|
||||||
|
empName: empName
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
if (response.status === 'success') {
|
||||||
|
$('<a>', {
|
||||||
|
href: response.downloadUrl,
|
||||||
|
download: '',
|
||||||
|
style: 'display:none'
|
||||||
|
}).appendTo('body')[0].click();
|
||||||
|
} else {
|
||||||
|
alert(response.message || 'Download failed');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error('Error:', error);
|
||||||
|
},
|
||||||
|
complete: function() {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
console.log('AJAX request finished.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -1,4 +1,4 @@
|
|||||||
<div class="tab-pane active show" id="pending-actions-dash-tab" style="/*padding-left: 35px;*/padding-right: 35px;">
|
<div class="tab-pane active show" id="pending-actions-dash-tab" >
|
||||||
<div class="row visa_status_count_view">
|
<div class="row visa_status_count_view">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card" style="border: 0px;height: 470px;">
|
<div class="card" style="border: 0px;height: 470px;">
|
||||||
@ -6,20 +6,20 @@
|
|||||||
style="padding: 0.5rem !important;background-color: white;">
|
style="padding: 0.5rem !important;background-color: white;">
|
||||||
<!-- Search Input Field -->
|
<!-- Search Input Field -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-3">
|
<div class="col-3" >
|
||||||
<select class="form-control" name="" id="enrollment_status_open_close">
|
<select class="form-control " name="" id="enrollment_status_open_close" style="width:200px">
|
||||||
<option value="open">Open Enrolment</option>
|
<option value="open">Open Enrolment</option>
|
||||||
<option value="close">Closed Enrolment</option>
|
<option value="close">Closed Enrolment</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-5"></div>
|
<div class="col-5"></div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<input type="text" id="searchInput" class="search-input"
|
<input type="text" id="searchInput" class="search-input" style="width:200px;margin-left:150px;"
|
||||||
placeholder="Search by client or branch">
|
placeholder="Search by client or branch">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Carousel Structure -->
|
<!-- Carousel Structure -->
|
||||||
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel" data-interval="false">
|
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel" data-interval="false" style="height:30vh; width:90vw;">
|
||||||
<div class="carousel-inner">
|
<div class="carousel-inner">
|
||||||
<?php
|
<?php
|
||||||
$itemsPerSlide = 3; // Number of items per slide
|
$itemsPerSlide = 3; // Number of items per slide
|
||||||
@ -88,14 +88,14 @@
|
|||||||
class="number_css"
|
class="number_css"
|
||||||
onclick="enrollment_list(this, 'emp_logged_in_view_click')"><?php echo isset($clients['logged_in_count']) ? $clients['logged_in_count'] : '0'; ?></span><br>
|
onclick="enrollment_list(this, 'emp_logged_in_view_click')"><?php echo isset($clients['logged_in_count']) ? $clients['logged_in_count'] : '0'; ?></span><br>
|
||||||
<span class="text-nowrap "
|
<span class="text-nowrap "
|
||||||
style="color: currentColor;font-size: 15px;">Logged-In</span>
|
style="color: black;font-size: 15px;">Logged-In</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 emp-count-view-click">
|
<div class="col-6 emp-count-view-click">
|
||||||
<span style="font-size: large;color: black !important;"
|
<span style="font-size: large;color: black !important;"
|
||||||
class="number_css"
|
class="number_css"
|
||||||
onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"><?php echo isset($clients['not_logged_in_count']) ? $clients['not_logged_in_count'] : '0'; ?></span><br>
|
onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"><?php echo isset($clients['not_logged_in_count']) ? $clients['not_logged_in_count'] : '0'; ?></span><br>
|
||||||
<span class="text-nowrap"
|
<span class="text-nowrap"
|
||||||
style="color: currentColor;font-size: 15px;margin-left: -13px;">Not
|
style="color: black;font-size: 15px;margin-left: -13px;">Not
|
||||||
Logged-In</span>
|
Logged-In</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -105,14 +105,14 @@
|
|||||||
class="number_css"
|
class="number_css"
|
||||||
onclick="enrollment_list(this, 'emp_not_enrolled_view_click')"><?php echo isset($clients['draft_count']) ? $clients['draft_count'] : '0'; ?></span><br>
|
onclick="enrollment_list(this, 'emp_not_enrolled_view_click')"><?php echo isset($clients['draft_count']) ? $clients['draft_count'] : '0'; ?></span><br>
|
||||||
<span class="text-nowrap"
|
<span class="text-nowrap"
|
||||||
style="color: currentColor;font-size: 15px;">Draft</span>
|
style="color: black;font-size: 15px;">Draft</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 emp-count-view-click">
|
<div class="col-6 emp-count-view-click">
|
||||||
<span style="font-size: large;color: black !important;"
|
<span style="font-size: large;color: black !important;"
|
||||||
class="number_css"
|
class="number_css"
|
||||||
onclick="enrollment_list(this, 'emp_enrolled_view_click')"><?php echo isset($clients['enrolled_count']) ? $clients['enrolled_count'] : '0'; ?></span><br>
|
onclick="enrollment_list(this, 'emp_enrolled_view_click')"><?php echo isset($clients['enrolled_count']) ? $clients['enrolled_count'] : '0'; ?></span><br>
|
||||||
<span class="text-nowrap"
|
<span class="text-nowrap"
|
||||||
style="color: currentColor;font-size: 15px;">Enrolled</span>
|
style="color: black;font-size: 15px;">Enrolled</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -91,6 +91,14 @@
|
|||||||
min-height: 0;
|
min-height: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body[data-sidebar-size=condensed] .navbar-custom {
|
||||||
|
left: 155px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
body[data-sidebar-size=condensed] .logo-box {
|
||||||
|
width: 155px !important;
|
||||||
|
}
|
||||||
|
|
||||||
.navbar-custom {
|
.navbar-custom {
|
||||||
top: -10px !important;
|
top: -10px !important;
|
||||||
height: 61px !important;
|
height: 61px !important;
|
||||||
@ -536,7 +544,7 @@
|
|||||||
|
|
||||||
<a href="<?= base_url('/dashboard/view') ?>" class="logo logo-light text-center">
|
<a href="<?= base_url('/dashboard/view') ?>" class="logo logo-light text-center">
|
||||||
<span class="logo-sm">
|
<span class="logo-sm">
|
||||||
<img src="<?= base_url() . "public"; ?>/assets/images/Nhance_Favi_white_2.png" alt="" width="30" height="30">
|
<img src="<?= base_url() . "public"; ?>/assets/images/nhance_white_logo.svg" alt="" width="130" height="30">
|
||||||
</span>
|
</span>
|
||||||
<!-- <span class="logo-lg">
|
<!-- <span class="logo-lg">
|
||||||
<img src="<?= base_url() . "public"; ?>./assets/images/logo-light.png" alt="" height="20">
|
<img src="<?= base_url() . "public"; ?>./assets/images/logo-light.png" alt="" height="20">
|
||||||
|
|||||||
@ -8,86 +8,157 @@
|
|||||||
<meta content="A fully featured CRM" name="description" />
|
<meta content="A fully featured CRM" name="description" />
|
||||||
<meta content="Venba info tech" name="author" />
|
<meta content="Venba info tech" name="author" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
|
||||||
<!-- App favicon -->
|
<!-- App favicon -->
|
||||||
<link rel="shortcut icon" href="<?= base_url()."public"; ?>/assets/images/Nhance_Favi.svg">
|
<link rel="shortcut icon" href="<?= base_url() . "public"; ?>/assets/images/Nhance_Favi.svg">
|
||||||
|
|
||||||
<!-- App css -->
|
<!-- App css -->
|
||||||
<link href="<?= base_url()."public"; ?>/assets/css/bootstrap-material.min.css" rel="stylesheet" type="text/css"
|
<link href="<?= base_url() . "public"; ?>/assets/css/bootstrap-material.min.css" rel="stylesheet" type="text/css"
|
||||||
id="bs-default-stylesheet" />
|
id="bs-default-stylesheet" />
|
||||||
<link href="<?= base_url()."public"; ?>/assets/css/app-material.min.css" rel="stylesheet" type="text/css"
|
<link href="<?= base_url() . "public"; ?>/assets/css/app-material.min.css" rel="stylesheet" type="text/css"
|
||||||
id="app-default-stylesheet" />
|
id="app-default-stylesheet" />
|
||||||
|
|
||||||
<link href="<?= base_url()."public"; ?>/assets/css/bootstrap-material-dark.min.css" rel="stylesheet" type="text/css"
|
<link href="<?= base_url() . "public"; ?>/assets/css/bootstrap-material-dark.min.css" rel="stylesheet" type="text/css"
|
||||||
id="bs-dark-stylesheet" />
|
id="bs-dark-stylesheet" />
|
||||||
<link href="<?= base_url()."public"; ?>/assets/css/app-material-dark.min.css" rel="stylesheet" type="text/css"
|
<link href="<?= base_url() . "public"; ?>/assets/css/app-material-dark.min.css" rel="stylesheet" type="text/css"
|
||||||
id="app-dark-stylesheet" />
|
id="app-dark-stylesheet" />
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700;800;900&display=swap" rel="stylesheet">
|
||||||
|
|
||||||
|
<!-- For background image -->
|
||||||
|
<link rel="preload" as="image" href="<?= base_url('public/assets/images/background_theme.jpg') ?>" />
|
||||||
|
|
||||||
|
<!-- For logo -->
|
||||||
|
<link rel="preload" as="image" href="<?= base_url('public/assets/images/Nhance-Logo-Final.png') ?>" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- icons -->
|
<!-- icons -->
|
||||||
<link href="<?= base_url()."public"; ?>/assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
<link href="<?= base_url() . "public"; ?>/assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
a:hover {
|
a:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.auth-fluid {
|
.background_theme {
|
||||||
position: relative;
|
background: url("<?= base_url('public/assets/images/background_theme.jpg') ?>");
|
||||||
display: flex;
|
background-size: contain;
|
||||||
min-height: 100vh;
|
background-repeat: no-repeat;
|
||||||
flex-direction: row;
|
background-size: 100% 100%;
|
||||||
background: url("<?= base_url('public/assets/images/login_bg.jpg') ?>") center center !important;
|
padding: 0;
|
||||||
background-size: cover !important;
|
margin: 0;
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg_image{
|
||||||
|
background : url("<?= base_url('public/assets/images/bg_image.png') ?>");
|
||||||
|
background-size : contain;
|
||||||
|
background-repeat : no-repeat;
|
||||||
|
background-size : 100% 100%;
|
||||||
|
padding : 0;
|
||||||
|
margin : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg_login{
|
||||||
|
background-color: #024C4F;
|
||||||
|
}
|
||||||
|
|
||||||
|
.outer_card{
|
||||||
|
margin-top:7%;
|
||||||
|
margin-bottom:5%;
|
||||||
|
margin-left:10%;
|
||||||
|
margin-right:10%;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.inner-card {
|
||||||
|
min-height: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-height: 780px) {
|
||||||
|
.outer_card{
|
||||||
|
margin-top:7%;
|
||||||
|
margin-bottom:0%;
|
||||||
|
margin-left:10%;
|
||||||
|
margin-right:10%;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="loading auth-fluid-pages pb-0">
|
<body class="background_theme ">
|
||||||
|
<div class="outer_card" >
|
||||||
|
<div class="inner_card" style="border-radius: 25px; overflow: hidden; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row " >
|
||||||
<div class="col-lg-8 auth-fluid">
|
<div class="col-lg-6 bg_image">
|
||||||
<!-- Auth fluid right content -->
|
<img
|
||||||
<div class="auth-fluid-right bg-transparent">
|
style="margin-top:40px;margin-left:40px;"
|
||||||
<img src="<?= base_url()."public"; ?>/assets/images/Nhance-Logo-Final.png" width="200">
|
src="<?= base_url() . "public"; ?>/assets/images/Nhance-Logo-Final.png" width="150" >
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 bg_login inner-card ">
|
||||||
|
<div class="content-box text-center">
|
||||||
|
|
||||||
|
<br><br><br><br>
|
||||||
|
<!-- nhance favicon -->
|
||||||
|
<img src="<?= base_url() . "public"; ?>/assets/images/Nhance_Favi.png" height="70" width="auto" >
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<!-- Text section -->
|
||||||
|
|
||||||
|
<h1 style="color:white; font-family: 'Poppins', sans-serif; font-weight: 600;">
|
||||||
|
Welcome To Nhance
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<h4 style="color:white; font-family: 'Poppins', sans-serif;">Sign in with your Google Account to continue</h4>
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
<!-- google button -->
|
||||||
|
<a href="<?= base_url('auth/google'); ?>" >
|
||||||
|
<img style="border-radius:50px;"
|
||||||
|
src="<?= base_url() . "public"; ?>/assets/images/googleButton.svg" width="200">
|
||||||
|
</a>
|
||||||
|
<?php if (session()->getFlashdata('error')) : ?>
|
||||||
|
<br>
|
||||||
|
<span class="widget-simple text-center">
|
||||||
|
<div class="media-body align-self-center font-24 avatar-title">
|
||||||
|
<p style="color:red; font-family: 'Poppins', sans-serif;" class="mt-0" style><?= session('error') ?></p>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<!-- space -->
|
||||||
|
<br><br><br><br><br><br>
|
||||||
|
|
||||||
|
<!-- data privacy indication -->
|
||||||
|
<h6 style="color:white; font-family: 'Poppins', sans-serif;">We respect your privacy and your data is safe with us</h6>
|
||||||
|
|
||||||
|
<!-- bottom line -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- end Auth fluid right content -->
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-4 align-items-center d-flex">
|
|
||||||
|
|
||||||
<!--Auth fluid left content -->
|
|
||||||
<div class="auth-fluid-form-box" style="margin-left: 10%;">
|
|
||||||
<div class="h-100">
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="form-group mb-0 text-center">
|
|
||||||
|
|
||||||
<a href="<?= base_url('auth/google'); ?>"><img
|
|
||||||
src="<?= base_url()."public"; ?>/assets/images/googleButton.svg" width="300"></a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if (session()->getFlashdata('error')) : ?>
|
|
||||||
<span class="widget-simple text-center">
|
|
||||||
<div class="media-body align-self-center font-24 avatar-title">
|
|
||||||
<p style="color: #f1556c!important;" class="mt-0" style><?= session('error') ?></p>
|
|
||||||
</div>
|
|
||||||
</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
</div> <!-- end .card-body -->
|
|
||||||
</div> <!-- end .align-items-center.d-flex.h-100-->
|
|
||||||
</div>
|
|
||||||
<!-- end auth-fluid-form-box-->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- end auth-fluid-->
|
<!-- end auth-fluid-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Vendor js -->
|
<!-- Vendor js -->
|
||||||
<script src="<?= base_url()."public"; ?>/assets/js/vendor.min.js"></script>
|
<script src="<?= base_url() . "public"; ?>/assets/js/vendor.min.js"></script>
|
||||||
<!-- App js -->
|
<!-- App js -->
|
||||||
<script src="<?= base_url()."public"; ?>/assets/js/app.min.js"></script>
|
<script src="<?= base_url() . "public"; ?>/assets/js/app.min.js"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
94
app/Views/login_old.php
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>NHANCE</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta content="A fully featured CRM" name="description" />
|
||||||
|
<meta content="Venba info tech" name="author" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
|
||||||
|
<!-- App favicon -->
|
||||||
|
<link rel="shortcut icon" href="<?= base_url()."public"; ?>/assets/images/Nhance_Favi.svg">
|
||||||
|
|
||||||
|
<!-- App css -->
|
||||||
|
<link href="<?= base_url()."public"; ?>/assets/css/bootstrap-material.min.css" rel="stylesheet" type="text/css"
|
||||||
|
id="bs-default-stylesheet" />
|
||||||
|
<link href="<?= base_url()."public"; ?>/assets/css/app-material.min.css" rel="stylesheet" type="text/css"
|
||||||
|
id="app-default-stylesheet" />
|
||||||
|
|
||||||
|
<link href="<?= base_url()."public"; ?>/assets/css/bootstrap-material-dark.min.css" rel="stylesheet" type="text/css"
|
||||||
|
id="bs-dark-stylesheet" />
|
||||||
|
<link href="<?= base_url()."public"; ?>/assets/css/app-material-dark.min.css" rel="stylesheet" type="text/css"
|
||||||
|
id="app-dark-stylesheet" />
|
||||||
|
|
||||||
|
<!-- icons -->
|
||||||
|
<link href="<?= base_url()."public"; ?>/assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
||||||
|
|
||||||
|
<style>
|
||||||
|
a:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.auth-fluid {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
min-height: 100vh;
|
||||||
|
flex-direction: row;
|
||||||
|
background: url("<?= base_url('public/assets/images/login_bg.jpg') ?>") center center !important;
|
||||||
|
background-size: cover !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="loading auth-fluid-pages pb-0">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-8 auth-fluid">
|
||||||
|
<!-- Auth fluid right content -->
|
||||||
|
<div class="auth-fluid-right bg-transparent">
|
||||||
|
<img src="<?= base_url()."public"; ?>/assets/images/Nhance-Logo-Final.png" width="200">
|
||||||
|
</div>
|
||||||
|
<!-- end Auth fluid right content -->
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 align-items-center d-flex">
|
||||||
|
|
||||||
|
<!--Auth fluid left content -->
|
||||||
|
<div class="auth-fluid-form-box" style="margin-left: 10%;">
|
||||||
|
<div class="h-100">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="form-group mb-0 text-center">
|
||||||
|
|
||||||
|
<a href="<?= base_url('auth/google'); ?>"><img
|
||||||
|
src="<?= base_url()."public"; ?>/assets/images/googleButton.svg" width="300"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if (session()->getFlashdata('error')) : ?>
|
||||||
|
<span class="widget-simple text-center">
|
||||||
|
<div class="media-body align-self-center font-24 avatar-title">
|
||||||
|
<p style="color: #f1556c!important;" class="mt-0" style><?= session('error') ?></p>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
</div> <!-- end .card-body -->
|
||||||
|
</div> <!-- end .align-items-center.d-flex.h-100-->
|
||||||
|
</div>
|
||||||
|
<!-- end auth-fluid-form-box-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- end auth-fluid-->
|
||||||
|
|
||||||
|
<!-- Vendor js -->
|
||||||
|
<script src="<?= base_url()."public"; ?>/assets/js/vendor.min.js"></script>
|
||||||
|
<!-- App js -->
|
||||||
|
<script src="<?= base_url()."public"; ?>/assets/js/app.min.js"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@ -1223,13 +1223,9 @@ $('body').on('click', '.btnPolicyMaster', function() {
|
|||||||
|
|
||||||
if (jsonObject[key]['either-parents-pil'] == 1) {
|
if (jsonObject[key]['either-parents-pil'] == 1) {
|
||||||
$('#family_floaters').val('EPORPIL');
|
$('#family_floaters').val('EPORPIL');
|
||||||
} else if (jsonObject[key].parents == 1 && jsonObject[key][
|
} else if (jsonObject[key].parents == 1 && jsonObject[key]['parents-in-law'] == 1) {
|
||||||
'parents-in-law'
|
|
||||||
] == 1) {
|
|
||||||
$('#family_floaters').val('2EPORPIL');
|
$('#family_floaters').val('2EPORPIL');
|
||||||
} else if (jsonObject[key].parents == 2 && jsonObject[key][
|
} else if (jsonObject[key].parents == 2 && jsonObject[key]['parents-in-law'] == 2) {
|
||||||
'parents-in-law'
|
|
||||||
] == 2) {
|
|
||||||
$('#family_floaters').val('4EPORPIL');
|
$('#family_floaters').val('4EPORPIL');
|
||||||
} else if (jsonObject[key].parents == 1) {
|
} else if (jsonObject[key].parents == 1) {
|
||||||
$('#family_floaters').val('1P');
|
$('#family_floaters').val('1P');
|
||||||
@ -1240,7 +1236,7 @@ $('body').on('click', '.btnPolicyMaster', function() {
|
|||||||
} else if (jsonObject[key]['parents-in-law'] == 2) {
|
} else if (jsonObject[key]['parents-in-law'] == 2) {
|
||||||
$('#family_floaters').val('2PIL');
|
$('#family_floaters').val('2PIL');
|
||||||
} else if (jsonObject[key]['either-parents-pil'] == 2) {
|
} else if (jsonObject[key]['either-parents-pil'] == 2) {
|
||||||
$('#family_floaters').val('4EPORPIL');
|
$('#family_floaters').val('2EPORPIL');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
public/assets/images/action_on_policies_sb.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
public/assets/images/app_content_mng_sb.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
public/assets/images/background_theme.jpg
Normal file
|
After Width: | Height: | Size: 665 KiB |
BIN
public/assets/images/bg_image.png
Normal file
|
After Width: | Height: | Size: 10 MiB |
BIN
public/assets/images/claims_sb.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
public/assets/images/clients_sb.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
public/assets/images/leads_sb.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
public/assets/images/masters_sb.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
public/assets/images/policy_transactions_sb.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
public/assets/images/user_manual_sb.png
Normal file
|
After Width: | Height: | Size: 15 KiB |