diff --git a/app/Config/Filters.php b/app/Config/Filters.php index 0855ec3e..2cf9a260 100755 --- a/app/Config/Filters.php +++ b/app/Config/Filters.php @@ -12,6 +12,7 @@ use CodeIgniter\Filters\SecureHeaders; use App\Filters\AuthMVC; use App\Filters\HttpRequestLog; use App\Filters\CloseDbConnection; +use App\Filters\AuthClientApi; use App\Filters\AuthJWT; @@ -34,6 +35,7 @@ class Filters extends BaseConfig 'authMVC' => AuthMVC::class, 'HttpRequestLog' => HttpRequestLog::class, 'authJWT' => AuthJWT::class, + 'AuthClientApi' => AuthClientApi::class, 'CloseDbConnection' => CloseDbConnection::class ]; diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 45619181..a6e3eb12 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -72,6 +72,7 @@ $routes->group("/dashboard", ["filter" => "authMVC"], function ($routes) { $routes->get('get-notification', 'DashboardController::getDashboardNotifications'); $routes->get('acknowledge-notification/(:segment)', 'DashboardController::acknowledgeMessage/$1'); $routes->get('get-pending-action', 'PendingActionsController::getPendingActions'); + $routes->post("prepareClaimSearchData","DashboardController::prepareClaimSearchData"); }); $routes->group("/client", ["filter" => "authMVC"], function ($routes) { @@ -87,6 +88,8 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) { $routes->get('view_deposit/(:num)', 'ClientController::view_Deposit/$1'); $routes->get('createtransaction', 'ClientController::createtransaction'); $routes->post('save_deposit', 'ClientController::saveDeposit'); + $routes->post("saveApiData", "ClientController::saveApiData"); + $routes->get("generateToken","ClientController::sendToken"); // $routes->get('view_Deposit/(:num)/(:num)','ClientController/view_Deposit/$1/$2'); $routes->group("notification", ["filter" => "authMVC"], function ($routes) { @@ -553,3 +556,16 @@ $routes->group("/ticket", ["filter" => "authMVC"], function ($routes) { // $routes->post('ticket_messages','TicketController::getTicketMessage'); }); +$routes->group("clientApi",["filter" => "AuthClientApi"], function ($routes){ + + $routes->post("getPolicyMaster","ClientAPIController::sendPolicyMaster"); + $routes->post("getEmployeeMaster","ClientAPIController::sendEmpMaster"); + $routes->post("getClaimMaster","ClientAPIController::sendClaimMaster"); + // $routes->post("pushData","ClientWebHooksController::sendSample"); +}); + +$routes->post("dispatchWebhookData/(:any)/(:any)",'ClientWebHooksController::pushData/$1/$2'); + + +$routes->post("retrieveWebhookDataEmp","ClientWebHooksController::pullData_emp"); +$routes->post("retrieveWebhookDataClaim","ClientWebHooksController::pullData_claim"); diff --git a/app/Controllers/ClientAPIController.php b/app/Controllers/ClientAPIController.php new file mode 100644 index 00000000..4a6bff4f --- /dev/null +++ b/app/Controllers/ClientAPIController.php @@ -0,0 +1,310 @@ +myLogger = \Config\Services::mylogger(); + + //models + $this->clientAPI = new ClientApiModel(); + $this->clientPolicy = new ClientPolicyModel(); + + //helper + $this->clientQueryHelper = new ClientQueryHelper(); + + //controller + $this->ticketController = new TicketController(); + + //variables + $this->operators = [ + + "GT" => ">", + "LT" => "<", + "GTE" => ">=", + "LTE" => "<=", + "ET" => "=", + "NE" => "!=", + "LIKE" => "LIKE", + "NL" => "NOT LIKE", + "BTW" => "BETWEEN", + "NB" => "NOT BETWEEN", + "IS" => "IS NULL", + "ISN" => "IS NOT NULL", + + ]; + $this->propertyNames = [ + 'empMaster' => ['name','emp_code','relationship','client_branch_id','emp_status','mobile','email_corporate','change_event','dob','doj','band','gender'], + 'claimMaster' => ['emp_name','insured_name',"emp_code",'policy_no','emp_mobile','emp_mail','hospital_name','claim_type','claim_status','claim_no','claim_amount','claim_date','si_amt','raised_date','registration_date','denial_date','denial_reason','approved_amount','utr_details','return_remark','cancel_remark','non_id_reason','head_rejection_reason'], + ]; + + } + + public function validateToken() + { + + try { + + $authHeader = $this->request->getHeaderLine('Authorization'); + + // Check if header exists + if (empty($authHeader)) { + $this->myLogger->log('error', 'Authorization header missing'); + return $this->respond(['status' => "Failure", 'error' => ['message' => 'Authorization header missing', 'code' => 401]], 401); + } + + // Check if Bearer is present + if (!str_contains($authHeader, 'Bearer ')) { + $this->myLogger->log('error', 'Authorization Bearer missing'); + return $this->respond(['status' => "Failure", 'error' => ['message' => 'Invalid Authorization header', 'code' => 401]], 401); + } + + // Extract the token + $token = str_replace('Bearer ', '', $authHeader); + if (empty($token)) { + + $this->myLogger->log('error', 'Empty Token'); + return $this->respond(['status' => "Failure", 'error' => ['message' => 'Invalid Token Format', 'code' => 401]], 401); + } + + try { + + // Extract client_id from the token + $client_id = ClientTokenHelper::extractClientId($token); + } catch (\Exception $e) { + $this->myLogger->log('error', 'Invalid Client Token Format'); + + return $this->respond(['status' => "Failure", 'error' => 'Invalid Token Format'], 401); + } + + // Fetch client details from the database + $client = $this->clientAPI->where('client_id', $client_id)->where("is_active", 1)->where("api_access", 1)->first(); + + // Client validation + if (!$client) { + $this->myLogger->log('error', 'Client Not Found or Unauthorized'); + return $this->respond(['status' => "Failure", 'error' => ['message' => 'Client not found or unauthorized', 'code' => '403']], 403); + } + + // Validate the token + if (hash_equals($client['client_token'], $token)) { + $this->myLogger->log('error', 'Access Granted For Client : ' . $client_id); + return true; + } else { + $this->myLogger->log('error', 'Invalid Token given for client : ' . $client_id); + return $this->respond([ + 'status' => "Failure", + 'error' => ['message' => 'Invalid token', 'code' => 401] + ], 401); + } + } catch (\Exception $e) { + log_message('error', 'Error in ClientAPIController:validateToken - ' . $e->getMessage()); + return $this->respond(['status' => "Failure", 'error' => ['message' => 'Internal Server Error', 'code' => 500]], 500); + } + } + + public function getClientIdfromToken() + { + $authHeader = $this->request->getHeaderLine('Authorization'); + $token = str_replace('Bearer ', '', $authHeader); + $client_id = ClientTokenHelper::extractClientId($token); + + $this->myLogger->log('error', 'Client ID: ' . $client_id); + return [$client_id, $token]; + } + + public function sendPolicyMaster() + { + + $data = $this->getClientIdfromToken(); + $client_id = $data[0]; + $keyString = $data[1]; + + // Extract only the actual key (after colon) + // list($prefix, $hexKey) = explode(':', $keyString, 2); + + // // Convert hex to binary (32 bytes) + // $key = hex2bin($hexKey); + + + $clientPolicy = $this->clientQueryHelper->clientPolicyMaster($client_id); + + $this->myLogger->log('error', 'Client Policy Master: ' . json_encode($clientPolicy)); + + + // $encode_data = ClientTokenHelper::encryptData($clientPolicy, $key); + // return $this->respond(['status' => "Success", 'data' => $encode_data], 200); + + return $this->respond(['status' => "Success", 'data' => $clientPolicy], 200); + } + + + public function sendEmpMaster() + { + $data = $this->getClientIdfromToken(); + $client_id = $data[0]; + $keyString = $data[1]; + + $received_data = $this->request->getJSON(); + $filters = $received_data->filters ?? null; + $limit = $received_data->limit ?? null; + $after = $received_data->after ?? 0; + + if ($limit > getenv('MAX_LIMIT')) { + + $this->myLogger->log('error', "Limit exceeds maximum allowed limit"); + return $this->respond(['status' => "Failure", 'error' => ['message' => 'Limit exceeds maximum allowed limit', 'code' => 400]], 400); + } + + try{ + if (!empty($filters)) { + $whereConditions = $this->prepareWhereConditions($filters,"",'empMaster'); + $employees = $this->clientQueryHelper->sendEmpMaster($client_id, $whereConditions,!empty($limit) ? $limit : 10,$after); + }else{ + $employees = $this->clientQueryHelper->sendEmpMaster($client_id, [],!empty($limit) ? $limit : 10,$after); + } + }catch (\InvalidArgumentException $e) { + return $this->respond(['status' => "Failure",'error' => ['message' => $e->getMessage(), 'code' => 400]], 400); + } + + foreach ($employees as &$employee){ + + $employee['policy_details'] = $this->clientQueryHelper->sendEmpPolicies($employee['ref_no']); + } + + $next_after = (count($employees) < $limit) ? null : ($after + $limit); + + if (!empty($employees)){ + return $this->respond(['Status' => "Success","data" => $employees,'next_after'=>$next_after], 200); + }else{ + return $this->respond(['Status' => "Failure","error" => ['message' => 'No Employees Found', 'code' => 404]], 404); + } + } + + public function sendClaimMaster() + { + $policy_type = $this->ticketController->ticketType; + + $data = $this->getClientIdfromToken(); + $client_id = $data[0]; + $keyString = $data[1]; + + $received_data = $this->request->getJSON(); + $filters = $received_data->filters ?? null; + $limit = $received_data->limit ?? null; + $after = $received_data->after ?? 0; + + if ($limit > getenv('MAX_LIMIT')) { + $this->myLogger->log('error', "Limit exceeds maximum allowed limit"); + return $this->respond(['status' => "Failure", 'error' => ['message' => 'Limit exceeds maximum allowed limit', 'code' => 400]], 400); + } + + try{ + if (!empty($filters)) { + $whereConditions = $this->prepareWhereConditions($filters,"ticket_master",'claimMaster'); + $claimDetails = $this->clientQueryHelper->sendClaimMaster($client_id,$whereConditions,!empty($limit) ? $limit : 10); + }else{ + $claimDetails = $this->clientQueryHelper->sendClaimMaster($client_id, [],!empty($limit) ? $limit : 10); + } + + } catch (\InvalidArgumentException $e) { + return $this->respond(['status' => "Failure",'error' => ['message' => $e->getMessage(), 'code' => 400]], 400); + } + + foreach ($claimDetails as &$claim){ + + $claim['policy_type'] = $policy_type[$claim['policy_type']]; + } + // dd($claimDetails); + + $next_after = (count($claimDetails) < $limit) ? null : ($after + $limit); + + + if (!empty($claimDetails)){ + return $this->respond(['Status' => "Success","data" => $claimDetails,'next_after'=>$next_after], 200); + }else{ + return $this->respond(['Status' => "Failure","error" => ['message' => 'No Claims Found', 'code' => 404]], 404); + } + } + + public function prepareWhereConditions($filters,$tableName = null,$model) + { + $whereConditions = []; + + foreach ($filters as $filter) { + + $propertyName = $filter->propertyName; + $operator = $filter->operator; + $this->myLogger->log('error', 'Property Name: ' . $propertyName); + if (!in_array($operator, array_keys($this->operators))) { + $this->myLogger->log('error', 'Invalid operator: ' . $operator); + throw new \InvalidArgumentException('Invalid operator'); + } + if (!in_array($propertyName, $this->propertyNames[$model])) { + $this->myLogger->log('error', 'Invalid property name: ' . $propertyName); + throw new \InvalidArgumentException('Invalid property name '.$propertyName); + } + $value = isset($filter->value) ? $filter->value : null; + $sqlOperator = $this->operators[$operator]; + + $column = !empty($tableName) ? "{$tableName}.{$propertyName}" : $propertyName; + + if ($sqlOperator === '=') { + $whereConditions[$column] = $value; + } else if($sqlOperator == "LIKE" || $sqlOperator == "NOT LIKE") { + $whereConditions["{$column} {$sqlOperator}"] = "%{$value}%"; + + } else if ($sqlOperator == 'BETWEEN') { + if (is_array($value) && count($value) === 2) { + // $whereConditions[] = [$column, $sqlOperator, $value[0]]; + $whereConditions["{$column} >="] = $value[0]; + $whereConditions["{$column} <="] = $value[1]; + + } else { + return $this->respond(['status' => "Failure", 'error' => ['message' => 'Invalid value for BETWEEN operator', 'code' => 400]], 400); + } + }else if ($sqlOperator == 'NOT BETWEEN') { + if (is_array($value) && count($value) === 2) { + $whereConditions["{$column} <="] = $value[0]; + $whereConditions["{$column} >="] = $value[1]; + } else { + return $this->respond(['status' => "Failure", 'error' => ['message' => 'Invalid value for NOT BETWEEN operator', 'code' => 400]], 400); + } + }else { + $whereConditions["{$column} {$sqlOperator}"] = $value; + } + + } + + return $whereConditions; + } + +} diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 71bf3c98..ff19c48c 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -4,6 +4,7 @@ namespace App\Controllers; use App\Helpers\DepositHelper; use App\Helpers\MailHelper; +use App\Helpers\ClientTokenHelper; use App\helpers\JWTToken; use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\RequestInterface; @@ -39,6 +40,7 @@ use App\Models\PolicyTransactionModel; use App\Models\PolicyTransactionStatusModel; use App\Models\VehicleModel; use App\Models\LeadsModel; +use App\Models\ClientApiModel; use App\Controllers\EmpDataServiceController; use App\Controllers\GoogleDriveController; @@ -83,7 +85,7 @@ class ClientController extends AdminController protected $policyTransactionStatusModel; protected $vehicleModel; protected $leadsModel; - + protected $clientApi; public function __construct() @@ -119,6 +121,7 @@ class ClientController extends AdminController $this->policyTransactionStatusModel = new PolicyTransactionStatusModel(); $this->vehicleModel = new VehicleModel(); $this->leadsModel = new LeadsModel(); + $this->clientApi = new ClientApiModel(); } //-------------------------------------------------------------------------------------------------------- @@ -751,7 +754,7 @@ class ClientController extends AdminController $editData['client_policy']['role'] = get_role_id(); $editData['notification'] = $this->notificationModel->select('template_name,enabled')->where('client_id', $id)->findAll(); $editData['placeHolders'] = ['member_name', 'member_mobile', 'nhance_logo', 'tpa_id', 'ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name']; - + $editData['api_data'] = $this->clientApi->where("client_id", $id)->where("is_active",1)->first(); // dd($editData); echo view('layout/header', $headerData); echo view('client_onboarding', $editData); @@ -4596,6 +4599,11 @@ class ClientController extends AdminController // $employeeRestController->employeesOnboardProcess(['file_id' => 835]); // $employeeRestController->employeesEnrollmentInsert(['file_id' => 836]); // $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]); + $empServiceController = new EmployeeServiceController(); + // $res = $empServiceController->excelFileFormatValidation(['file_id' => '873']); + // $res = $empServiceController->excelFileDataValidation(['file_id' => '874']); + // $res = $empServiceController->employeesSIEnhanceProcess(['file_id' => '874']); + // dd('-----', $res); // ----------EMP DATA SERVICE CONTROLLER-------------------------------------------------------------------------------- @@ -5692,6 +5700,40 @@ class ClientController extends AdminController return $result; } + public function saveApiData(){ + + $receivedData = $this->request->getPost(); + + if (!empty($receivedData['id'])){ + $status = $this->clientApi->save($receivedData); + + }else{ + $status = $this->clientApi->insert($receivedData); + } + + + if ($status){ + return $this->respond(['status'=>"Sucesss",'message'=>"Submitted Successfully"],200); + }else{ + return $this->respond(['status'=>"Failed",'message'=>"Submission Faild"],500); + } + + } + + public function sendToken(){ + + $client_id = $this->request->getGet('client_id'); + + $token = ClientTokenHelper::generateKey($client_id); + + if ($token){ + return $this->respond(['status' => 'success', 'token' => $token,'message' => "Token Generated Successfully"],200); + }else{ + return $this->respond(['status' => "Failed","message"=>"Token Generation Failed, Try Again After some time"],500); + } + } } + + diff --git a/app/Controllers/ClientWebHooksController.php b/app/Controllers/ClientWebHooksController.php new file mode 100644 index 00000000..a54deaf2 --- /dev/null +++ b/app/Controllers/ClientWebHooksController.php @@ -0,0 +1,319 @@ +myLogger = \Config\Services::mylogger(); + + //models + $this->clientAPI = new ClientApiModel(); + $this->clientPolicy = new ClientPolicyModel(); + + // Helpers + $this->webHookHelper = new clientWebHookHelper(); + $this->clientTokenHelper = new ClientTokenHelper(); + } + + public function pushData($clientID, $type) + { + if ($type == 1) { + + $webHookType = "emp"; + } else if ($type == 2) { + + $webHookType = "claim"; + } + log_message('error', 'Client ID: ' . $clientID); + log_message('error', 'Webhook Type: ' . $webHookType); + // Validate client ID + if (empty($clientID)) { + return $this->respond(["status" => "Failure", "error" => ["message" => 'Client ID is required.', "code" => 400]], 400); + } + $webhookData = $this->clientAPI->where('client_id', $clientID)->where('is_active', 1)->first(); + if (empty($webhookData)) { + log_message('error', 'Client Not Found or Unauthorized'); + return $this->respond(["status" => "Failure", "error" => ["message" => 'Client Not Found or Client Does not have any Active Hooks.', "code" => 404]], 404); + } + $url = $webhookData[$webHookType . '_url']; + if (empty($url)) { + log_message('error', 'No active webhook found for the client.'); + return $this->respond(["status" => "Failure", "error" => ["message" => 'No active webhook found for the client.', "code" => 404]], 404); + } + + + $method = $webhookData[$webHookType . '_method']; + $auth_method = $webhookData[$webHookType . '_tkn_type']; + $token = $webhookData[$webHookType . '_token']; + $objectType = json_decode($webhookData[$webHookType . '_obj']); + + try { + $client = \Config\Services::curlrequest(); + $data = [ + "name" => "Kavitha", + "emp_code" => "EMP001-K4", + "emp_status" => "active", + "mobile" => "2233448965" + ]; + + try { + $mapped_data = $this->webHookHelper->mapObjectType($data, $objectType); + } catch (Exception $e) { + $errorMessage = "Object Mapping Failed: " . $e->getMessage(); + log_message('error', $errorMessage); + + return $this->respond(['status' => 'Failure', 'error' => ['code' => 500, 'message' => "Object Mapping Failed"]], 500); + } + + // Create payload + $payload = [ + 'event_type' => 'insert', + 'timestamp' => date('c'), + 'data' => $mapped_data + ]; + + log_message("error", "Payload: " . json_encode($payload)); + + // Configure request headers + $headers = ['Content-Type' => 'application/json']; + if ($auth_method && $token) { + if (strtolower($auth_method) === 'bearer') { + $headers['Authorization'] = 'Bearer ' . $token; + } else { + $headers[$auth_method] = $token; + } + } + + // Configure request based on method + $options = [ + 'headers' => $headers, + 'timeout' => 10, + 'http_errors' => false // Don't throw exceptions for 4xx/5xx responses + ]; + + if ($method === 'GET') { + $options['query'] = $payload; + } else { + $options['json'] = $payload; + } + + // Execute webhook request + $response = $client->request($method, $url, $options); + $statusCode = $response->getStatusCode(); + $responseBody = $response->getBody(); + + // Log and format response + $logMessage = "Webhook to {$url} returned status: {$statusCode}"; + log_message('error', $logMessage); + + return $this->respond(['status' => 'Success', "response" => $responseBody], $statusCode); + } catch (\Throwable $e) { + $errorMessage = "Webhook failed: " . $e->getMessage(); + log_message('error', $errorMessage); + + return $this->respond(['status' => 'Failure', 'error' => ['code' => 500, 'message' => $errorMessage, 'exception' => get_class($e)]], 500); + } + } + + public function validateToken($type) + { + $type = $type == 1 ? "pull_emp_token" : "pull_claim_token"; + try { + + $authHeader = $this->request->getHeaderLine('Authorization'); + + // Check if header exists + if (empty($authHeader)) { + log_message('error', 'Authorization header missing'); + return $this->respond(['status' => "Failure", 'error' => ['message' => 'Authorization header missing', 'code' => 401]], 401); + } + + // Check if Bearer is present + if (!str_contains($authHeader, 'Bearer ')) { + log_message('error', 'Authorization Bearer missing'); + return $this->respond(['status' => "Failure", 'error' => ['message' => 'Invalid Authorization header', 'code' => 401]], 401); + } + + // Extract the token + $token = str_replace('Bearer ', '', $authHeader); + if (empty($token)) { + + log_message('error', 'Empty Token'); + return $this->respond(['status' => "Failure", 'error' => ['message' => 'Invalid Token Format', 'code' => 401]], 401); + } + + try { + + // Extract client_id from the token + $client_id = ClientTokenHelper::extractClientId($token); + } catch (\Exception $e) { + log_message('error', 'Invalid Client Token Format'); + + return $this->respond(['status' => "Failure", 'error' => 'Invalid Token Format'], 401); + } + + // Fetch client details from the database + $client = $this->clientAPI->where('client_id', $client_id)->where("is_active", 1)->where("api_access", 1)->first(); + + // Client validation + if (!$client) { + log_message('error', 'Client Not Found or Unauthorized'); + return $this->respond(['status' => "Failure", 'error' => ['message' => 'Client not found or unauthorized', 'code' => '403']], 403); + } + + // Validate the token + if (hash_equals($client[$type], $token)) { + log_message('error', 'Access Granted For Client : ' . $client_id); + return true; + } else { + log_message('error', 'Invalid Token given for client : ' . $client_id); + return $this->respond([ + 'status' => "Failure", + 'error' => ['message' => 'Invalid token', 'code' => 401] + ], 401); + } + } catch (\Exception $e) { + log_message('error', 'Error in ClientAPIController:validateToken - ' . $e->getMessage()); + return $this->respond(['status' => "Failure", 'error' => ['message' => 'Internal Server Error', 'code' => 500]], 500); + } + } + + public function getClientIdfromToken() + { + $authHeader = $this->request->getHeaderLine('Authorization'); + $token = str_replace('Bearer ', '', $authHeader); + $client_id = ClientTokenHelper::extractClientId($token); + + log_message('error', 'Client ID: ' . $client_id); + return [$client_id, $token]; + } + + public function pullData_emp() + { + $validationStatus = $this->validateToken(1); + + $data = $this->getClientIdfromToken(); + $client_id = $data[0]; + + log_message('error', "Pull data emp from Client ID: ". $client_id); + $client = $this->clientAPI->where('client_id', $client_id)->where("is_active", 1)->where("api_access", 1)->first(); + if (empty($client)) { + log_message('error', 'Client Not Found or Unauthorized'); + return $this->respond(['status' => 'Failure', 'error' => ['code' => 404, 'message' => 'Client Not Found or Unauthorized']], 404); + } + + $objectType = $client['pull_emp_obj']; + + if ($validationStatus) { + $responseBody = $this->request->getBody(); + $data_to_map = json_decode($responseBody, true); + $objectType = json_decode($objectType, true); + if (!isset($data_to_map['data']) || !is_array($data_to_map['data'])) { + + log_message('error', "Invalid Response from Endpoint 'data' Key Missing"); + return $this->respond(['status' => 'Failure', 'error' => ['code' => 500, 'message' => "Invalid Response from Endpoint 'data' Key Missing"]], 500); + } + + foreach ($data_to_map['data'] as $index => $item) { + + try { + $mapped_data = $this->webHookHelper->mapObjectType($item, $objectType); + } catch (Exception $e) { + $errorMessage = "Object Mapping Failed: " . $e->getMessage(); + log_message('error', $errorMessage); + + return $this->respond(['status' => 'Failure', 'error' => ['code' => 500, 'message' => "Object Mapping Failed"]], 500); + } + + try { + $mapped_data['client_id'] = $client_id; + $this->webHookHelper->insertData($mapped_data, 1); + } catch (Exception $e) { + $errorMessage = "Data Insertion Failed: " . $e->getMessage(); + log_message('error', $errorMessage); + + return $this->respond(['status' => 'Failure', 'error' => ['code' => 500, 'message' => "Data Insertion Failed"]], 500); + } + } + + log_message('error', "Data Inserted Successfully for Client ID: " . $client_id); + // Return success response + return $this->respond(['status' => 'Success', 'message' => "Data Inserted Successfully"], 200); + } + } + + public function pullData_claim() + { + $validationStatus = $this->validateToken(2); + + $data = $this->getClientIdfromToken(); + $client_id = $data[0]; + log_message('error', "Pull data claim from Client ID: ". $client_id); + $client = $this->clientAPI->where('client_id', $client_id)->where("is_active", 1)->where("api_access", 1)->first(); + if (empty($client)) { + log_message('error', 'Client Not Found or Unauthorized'); + return $this->respond(['status' => 'Failure', 'error' => ['code' => 404, 'message' => 'Client Not Found or Unauthorized']], 404); + } + + $objectType = $client['pull_claim_obj']; + + if ($validationStatus) { + $responseBody = $this->request->getBody(); + $data_to_map = json_decode($responseBody, true); + $objectType = json_decode($objectType, true); + if (!isset($data_to_map['data']) || !is_array($data_to_map['data'])) { + + log_message('error', "Invalid Response from Endpoint 'data' Key Missing"); + return $this->respond(['status' => 'Failure', 'error' => ['code' => 500, 'message' => "Invalid Response from Endpoint 'data' Key Missing"]], 500); + } + foreach ($data_to_map['data'] as $index => $item) { + try { + $mapped_data = $this->webHookHelper->mapObjectType($item, $objectType); + } catch (Exception $e) { + $errorMessage = "Object Mapping Failed: " . $e->getMessage(); + log_message('error', $errorMessage); + + return $this->respond(['status' => 'Failure', 'error' => ['code' => 500, 'message' => "Object Mapping Failed"]], 500); + } + + try { + $mapped_data['client_id'] = $client_id; + $this->webHookHelper->insertData($mapped_data, 2); + } catch (Exception $e) { + $errorMessage = "Data Insertion Failed: " . $e->getMessage(); + log_message('error', $errorMessage); + + return $this->respond(['status' => 'Failure', 'error' => ['code' => 500, 'message' => "Data Insertion Failed"]], 500); + } + } + + + log_message('error', "Data Inserted Successfully for Client ID: " . $client_id); + // Return success response + return $this->respond(['status' => 'Success', 'message' => "Data Inserted Successfully"], 200); + } + } +} diff --git a/app/Controllers/DashboardController.php b/app/Controllers/DashboardController.php index f4eb8d34..78d1b86e 100755 --- a/app/Controllers/DashboardController.php +++ b/app/Controllers/DashboardController.php @@ -21,6 +21,10 @@ use App\Models\NotificationModel; use App\Models\EmployeePolicyModel; use App\Controllers\PendingActionsContrller; use App\Controllers\EmpDataServiceController; +use App\Models\TicketMasterModel; +use App\Models\LeadsModel; +use App\Models\TicketClaimStatusModel; + class DashboardController extends AdminController { @@ -33,8 +37,12 @@ class DashboardController extends AdminController protected $notificationModel; protected $employeePolicyModel; protected $policyTransactionModel; + protected $leadModel; + protected $ticketModel; + protected $ticketStatusModel; protected $policyStatus; protected $colorShades; + protected $claimDashLimit; protected $myLogger; @@ -48,9 +56,76 @@ class DashboardController extends AdminController $this->employeePolicyModel = new EmployeePolicyModel(); $this->clientModel = new ClientModel(); $this->policyTransactionModel = new PolicyTransactionModel(); + $this->ticketModel = new TicketMasterModel(); + $this->leadModel = new LeadsModel(); + $this->ticketStatusModel = new TicketClaimStatusModel(); $this->myLogger = \Config\Services::mylogger(); + $this->claimDashLimit = [ + 1 => [ + 'non_id' => 3, + 'id_not_generated' => 3, + 'cda' => 3, + 'information_required' => 3, + 'under_process' => 3, + 'rejected' => 3, + 'approved' => 3, + 'payment_initiated' => 3, + 'settled' => 3, + 'closed' => 3, + 'cancelled' => 3, + 'returned' => 3 + ], + + 2 => [ + 'claim_intimation' => 3, + 'intimation_to_insurer' => 3, + 'client_pending' => 3, + 'insurer_pending' => 3, + 'investigation' => 3, + 'approved' => 3, + 'closed' => 3, + 'not_covered' => 3, + 'settled' => 3, + 'coverage_check' => 3, + 'cancelled' => 3, + 'returned' => 3, + 'rejected' => 3, + 'dv_sent_to_insured' => 3 + ], + 3 => [ + 'claim_intimation' => 3, + 'intimation_to_insurer' => 3, + 'client_pending' => 3, + 'insurer_pending' => 3, + 'investigation' => 3, + 'approved' => 3, + 'closed' => 3, + 'not_covered' => 3, + 'settled' => 3, + 'coverage_check' => 3, + 'cancelled' => 3, + 'returned' => 3, + 'rejected' => 3 + ], + 4 => [ + 'claim_intimation' => 3, + 'intimation_to_insurer' => 3, + 'client_pending' => 3, + 'insurer_pending' => 3, + 'investigation' => 3, + 'approved' => 3, + 'closed' => 3, + 'not_covered' => 3, + 'settled' => 3, + 'coverage_check' => 3, + 'cancelled' => 3, + 'returned' => 3, + 'rejected' => 3 + ] + ]; + $this->policyStatus = [ 'under_process' => 'Under Process', 'client_pending' => 'Client Pending', @@ -92,7 +167,6 @@ class DashboardController extends AdminController 'linear-gradient(45deg, #494f4f, #353d3d)' // SilverChalice shade 6 ] ]; - } public function dashboard() @@ -100,8 +174,8 @@ class DashboardController extends AdminController $data = []; - if (in_array(get_role_id(), [1,2,3,5]) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { - + if (in_array(get_role_id(), [1, 2, 3, 5]) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { + $db = db_connect(); $sql = "SELECT clients.id AS client_id, @@ -169,17 +243,65 @@ class DashboardController extends AdminController $data['financeTeamStatusData'] = $financeTeamStatusData; $data['policyStatus'] = $this->policyStatus; $data['colorShades'] = $this->colorShades; - // print_r($data);die; - } + $data['claim_data'] = $this->getClaimData(); + $data['lead_data'] = $this->getLeadData(); + $data['page_name'] = 'Dashboard'; echo view('layout/header', $data); echo view('DashBoard', $data); echo view('layout/footer'); } - + + public function getLeadData(){ + + } + + public function getClaimData() + { + + $results = $this->ticketStatusModel + ->select("ticket_type as ticket_type_id, claim_status") + ->where("is_active", 1) + ->findAll(); + + $claim_status = []; + + foreach ($results as $row) { + if (empty($row['ticket_type_id']) || empty($row['claim_status'])) { + continue; // Skip if either value is empty + } + $typeId = $row['ticket_type_id']; + $status = $row['claim_status']; + + // Initialize if not set + if (!isset($claim_status[$typeId])) { + $claim_status[$typeId] = []; + } + + // Use associative array keys to mimic a set + $claim_status[$typeId][$status] = true; + } + + // Convert set-like structure to plain array + foreach ($claim_status as $typeId => $statuses) { + $claim_status[$typeId] = array_keys($statuses); + } + $data = $this->ticketModel->getDashData($claim_status, $this->claimDashLimit); + + // dd($data); + // foreach ($data as $dat){ + // foreach ($dat as $key => $value){ + // echo($key . " => ". $value); + // } + // } + // die(); + return $data; + + } + public function getDashboardNotifications() { @@ -212,29 +334,29 @@ class DashboardController extends AdminController { $clientPolicyModel = new ClientPolicyModel(); $myLogger = \Config\Services::mylogger(); - + $client_policy_data = $clientPolicyModel->getPolicyDetailsForEnrollment(); $myLogger->logme('error', 'Fetched client policy data for Enrollment Status update'); - + // dd($client_policy_data); $currentDate = date('d-m-Y'); $openEnrollment = []; $closeEnrollment = []; - + // Update policy status based on start and end dates foreach ($client_policy_data as $client_policy) { $id = $client_policy['id']; $openDate = date('d-m-Y', strtotime($client_policy['open_date'])); $closeDate = date('d-m-Y', strtotime($client_policy['close_date'])); - + if ($currentDate == $openDate) { $clientPolicyModel->update($id, ['open_for_enrollment' => 1]); $openEnrollment[] = $id; $myLogger->logme('error', 'Updated policy ID ' . $id . ' to open for enrollment.'); } - + if ($closeDate < $currentDate) { $clientPolicyModel->update($id, ['open_for_enrollment' => 0]); $closeEnrollment[] = $id; @@ -243,37 +365,36 @@ class DashboardController extends AdminController } $myLogger->logme('error', 'enrollment_status function completed'); - $myLogger->logme('error', 'updated Open Enrollment Policy count : "'.count($openEnrollment).'" and Close Enrollment Policy count : "'.count($closeEnrollment).'"'); + $myLogger->logme('error', 'updated Open Enrollment Policy count : "' . count($openEnrollment) . '" and Close Enrollment Policy count : "' . count($closeEnrollment) . '"'); return $this->respond([ - 'status' => true, - 'message' => 'updated Open and Close Enrollment successfully', - 'open_policy_count' => count($openEnrollment), + 'status' => true, + 'message' => 'updated Open and Close Enrollment successfully', + 'open_policy_count' => count($openEnrollment), 'close_policy_count' => count($closeEnrollment), - 'open_policy_ids' => $openEnrollment, + 'open_policy_ids' => $openEnrollment, 'close_policy_ids' => $closeEnrollment, ]); - } - + public function sendCroneRemainderMail() { $clientPolicyModel = new ClientPolicyModel(); $myLogger = \Config\Services::mylogger(); - - + + $client_policy_data = $clientPolicyModel->getPolicyDetailsForRemainder(); $myLogger->logme('error', 'Fetched client policy data'); // dd($client_policy_data); - + // Mail send function $result = $this->sendRemainderMail($client_policy_data, 'crone'); $myLogger->logme('error', 'sendCroneRemainderMail function completed'); - - if($result){ + + if ($result) { return json_encode(['status' => true, 'message' => 'Mail send successfully']); - }else{ + } else { return json_encode(['status' => false, 'message' => 'There is no data to send']); } } @@ -285,29 +406,22 @@ class DashboardController extends AdminController $data = []; - if($type == 'insurer'){ + if ($type == 'insurer') { $data = $pendingActionsData['uhid']; - - }else if($type == 'TPA'){ + } else if ($type == 'TPA') { $data = $pendingActionsData['tpa']; - - }else if($type == 'I'){ + } else if ($type == 'I') { $data = $pendingActionsData['inception']; - - }else if($type == 'D'){ + } else if ($type == 'D') { $data = $pendingActionsData['deletion']; - - }else if($type == 'C'){ + } else if ($type == 'C') { $data = $pendingActionsData['correction']; - - }else if($type == 'SI'){ + } else if ($type == 'SI') { $data = $pendingActionsData['si_enhancement']; - - }else if($type == 'policy'){ + } else if ($type == 'policy') { $data = $pendingActionsData['policy']; - - }else if($type == 'ticket'){ + } else if ($type == 'ticket') { $data = $pendingActionsData['uhid']; } @@ -421,7 +535,6 @@ class DashboardController extends AdminController $reminder_whole_mail[] = $mail_result; } } - } else { // crone if (!empty($client_policy['reminder_date'])) { @@ -511,15 +624,12 @@ class DashboardController extends AdminController // $this->myLogger->logme('error', 'Mail sent result: ' . json_encode($mail_result)); $reminder_whole_mail[] = $mail_result; } - } } - } else { $this->myLogger->logme('error', "SEND REMAINDER CRONE --- Remainder date is empty()"); } } - } else { $this->myLogger->logme('error', 'Notification setup not found or not enabled'); @@ -549,29 +659,28 @@ class DashboardController extends AdminController public function sendManualReminder($client_id, $client_branch_id, $client_policy_id = null) { - $this->myLogger->logme('error','Log Works'); + $this->myLogger->logme('error', 'Log Works'); $this->myLogger->logme('error', "sendManualRemainder called with client_id: {$client_id}, client_branch_id: {$client_branch_id}"); - + $client_policy_data = $this->clientPolicyModel->getPolicyDetailsForRemainder($client_id, $client_branch_id, $client_policy_id); // print_r($client_policy_data); die; // print_r($this->clientPolicyModel->getLastQuery()); die; // $this->myLogger->logme('error', "Policy details fetched: " . json_encode($client_policy_data)); - + if ($client_policy_data) { $result = $this->sendRemainderMail($client_policy_data); - log_message('error',json_encode($result)); - $this->myLogger->logme('error',$result); + log_message('error', json_encode($result)); + $this->myLogger->logme('error', $result); $this->myLogger->logme('error', "Manual Remainder Mail sending result: " . ($result ? 'success' : 'failure')); - + if ($result) { $this->myLogger->logme('error', 'Manual Remainder Mail sent successfully'); return $this->respond(['status' => true, 'code' => 200, 'message' => 'Mail sent successfully'], 200); } else { $this->myLogger->logme('error', 'Failed to send manual remainder mail, no data to send'); - return $this->respond(['status' => false, 'code' => 200, 'message' => 'There is no data to send','message2' => 'Failed' ], 200); + return $this->respond(['status' => false, 'code' => 200, 'message' => 'There is no data to send', 'message2' => 'Failed'], 200); } - } else { $this->myLogger->logme('error', 'No policy data found to send'); return $this->respond(['status' => false, 'code' => 200, 'message' => 'There is no data to send', 'message2' => 'No policy data found to send'], 200); @@ -581,19 +690,17 @@ class DashboardController extends AdminController public function sendManualEcard($client_id, $client_branch_id, $policy_id) { $this->myLogger->logme('error', "sendManualEcard called with client_id: {$client_id}, client_branch_id: {$client_branch_id}, policy id : {$policy_id}"); - - $notification = $this->notificationModel->where('client_id', $client_id)->where('template_name', 'member_ecard_mail')->first(); - // print_r(($notification)); die; - if($notification && $notification['enabled'] == 0 && $notification['mail_content'] == '') - { - return $this->respond(['status' => false, 'code' => 400, 'message' => 'No template found','message2' => 'Failed' ], 200); - } - + + $notification = $this->notificationModel->where('client_id', $client_id)->where('template_name', 'member_ecard_mail')->first(); + // print_r(($notification)); die; + if ($notification && $notification['enabled'] == 0 && $notification['mail_content'] == '') { + return $this->respond(['status' => false, 'code' => 400, 'message' => 'No template found', 'message2' => 'Failed'], 200); + } + $emp_data = $this->employeePolicyModel->getEmployeePolicyForEcard($policy_id); - if(count($emp_data) == 0) - { - return $this->respond(['status' => false, 'code' => 400, 'message' => 'No employees found','message2' => 'Failed' ], 200); + if (count($emp_data) == 0) { + return $this->respond(['status' => false, 'code' => 400, 'message' => 'No employees found', 'message2' => 'Failed'], 200); } $ids = array_column($emp_data, 'id'); // print_r(($ids)); die; @@ -603,9 +710,8 @@ class DashboardController extends AdminController // $empEmpDataServiceController = new EmpDataServiceController(); // $empEmpDataServiceController->sendMailForDownloadingECard($ids); - + return $this->respond(['status' => true, 'code' => 200, 'message' => 'Mail Queued'], 200); - } public function data_construct_for_bds($data) @@ -622,7 +728,7 @@ class DashboardController extends AdminController 'instalment_pending' => [], 'completed' => [], ]; - + // Loop through results and group them by their status foreach ($data as $row) { switch ($row['status']) { @@ -655,8 +761,25 @@ class DashboardController extends AdminController break; } } - + return $groupedData; } + public function prepareClaimSearchData(){ + + $received_data = $this->request->getPost(); + $ticketTypeId = $received_data['ticketTypeId']; + $status = $received_data['status']; + + $status = strtoupper($status); + $status = str_replace('_', ' ', $status); + + $data = $this->ticketModel + ->select("tcs.id as claim_status_id") + ->join("ticket_claim_status tcs", "tcs.ticket_type = " . (int)$ticketTypeId) + ->where("tcs.claim_status", $status) + ->first(); + $data['ticket_type_id'] = $ticketTypeId; + return $this->respond(['status' => "success","data" => $data],200); + } } diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index 61e0af4a..993194a0 100755 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -468,7 +468,7 @@ class EmployeeServiceController extends AdminController 'format' => null, 'allowed_values' => null, 'custom' => 'check_si', - 'params' => ['row', 'policy_terms', 'slab_details'] + 'params' => ['row', 'policy_details', 'slab_details'] ], 'date_of_enhancement' => [ 'col_idx' => 4, @@ -1552,9 +1552,11 @@ class EmployeeServiceController extends AdminController if($pre_rack_rate_name != $slab_value['rack_rate_name']) { $pre_rack_rate_name = $slab_value['rack_rate_name']; - $rack_rate_json = json_decode($slab_value['additional_relationship']); - if(in_array(strtolower($employee['relationship']), $rack_rate_json) && $rack_rate_json[ strtolower($employee['relationship']) ] != 0 && $rack_rate_json[ strtolower($employee['relationship']) ] != 'NA') - { + $rack_rate_json = json_decode($slab_value['additional_relationship'], true); + $relationship_array_key = strtolower($employee['relationship']); + + if(array_key_exists($relationship_array_key, $rack_rate_json) && $rack_rate_json[ strtolower($employee['relationship']) ] != 0 && $rack_rate_json[ strtolower($employee['relationship']) ] != 'NA') + { $applicable_rack_rate_name = $slab_value['rack_rate_name']; $applicable_rack_rate_master = $slab_value['grid_master']; break; @@ -1563,7 +1565,7 @@ class EmployeeServiceController extends AdminController } //get max age,max count of the familiy - $max_age_and_max_count_of_current_member = $this->employeeModel->getFamiliyCountAndMaxage($employee['emp_code']); + $max_age_and_max_count_of_current_member = $this->employeeModel->getFamiliyCountAndMaxage($employee['emp_code']); //transform SI excel row data as inception excel OR premium calculateable fomart $data = transform_si_excel_row_to_calculatable_format(employee: $employee,employee_policy: $employee_policy,maxage_and_maxcount: $max_age_and_max_count_of_current_member,slab_details: $slab_details,applicable_slab_name: $applicable_rack_rate_name,augmented_si: $row[3],grid_master: $applicable_rack_rate_master); diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 4b42394a..b9d62ff5 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -182,8 +182,18 @@ class TicketController extends BaseController } else { $data['ticket_data'] = $this->ticketSearch(); - $html = view('ticket_list', $data); - return $this->respond(['status' => true, 'html' => $html], 200); + $isFromDashboard = $this->request->getPost("is_dashboard"); + + if (isset($isFromDashboard) && !empty($isFromDashboard) && $isFromDashboard == 1) { + $data['page_name'] = "Claims"; + $data['claim_status'] = $this->claimStatus->select('id,ticket_type,claim_status')->where('is_active', 1)->findAll(); + $data['client_list'] = $this->clientModel->select('id,client_name')->where('is_active', 1)->findAll(); + return $this->loadLayout('ticket_search', $data); + }else{ + $html = view('ticket_list', $data); + return $this->respond(['status' => true, 'html' => $html], 200); + } + } } @@ -260,10 +270,10 @@ class TicketController extends BaseController } else { $search_data = $this->request->getPost(); - // print_r($search_data); + // print_r($search_data); die() $where = []; foreach ($search_data as $search_objects => $key) { - if ($key != null && $key != '' && $key != 0) { + if ($key != null && $key != '' && $key != 0 && $search_objects != 'is_dashboard') { $where[$search_objects] = $key; } } diff --git a/app/Filters/AuthClientApi.php b/app/Filters/AuthClientApi.php new file mode 100644 index 00000000..2b3eb46e --- /dev/null +++ b/app/Filters/AuthClientApi.php @@ -0,0 +1,87 @@ +clientAPI = new ClientApiModel(); + $this->myLogger = \Config\Services::mylogger(); + + } + public function before(RequestInterface $request, $arguments = null) + { + $response = service('response'); + try { + + $authHeader = $request->getHeaderLine('Authorization'); + + // Check if header exists + if (empty($authHeader)) { + $this->myLogger->log('error', 'Authorization header missing'); + return $response->setJson(['status' => "Failure", 'error' => ['message'=>'Authorization header missing','code'=> 401]], 401); + } + + if(!str_contains($authHeader, 'Bearer ')){ + $this->myLogger->log('error', 'Authorization Bearer missing'); + return $response->setJson(['status' => "Failure", 'error' => ['message'=>'Invalid Authorization header','code'=>401]], 401); + } + + $token = str_replace('Bearer ', '', $authHeader); + if (empty($token)) { + + $this->myLogger->log('error', 'Empty Token'); + return $response->setJson(['status' => "Failure", 'error' => ['message'=>'Invalid Token Format','code'=> 401]], 401); + } + + try{ + + $client_id = ClientTokenHelper::extractClientId($token); + + }catch(\Exception $e){ + + $this->myLogger->log('error', 'Invalid Client Token Format'); + + return $response->setJson(['status' => "Failure", 'error' => 'Invalid Token Format'], 401); + } + $client = $this->clientAPI->where('client_id', $client_id)->where("is_active", 1)->where("api_access", 1)->first(); + + // Client validation + if (!$client) { + $this->myLogger->log('error', 'Client Not Found or Unauthorized'); + return $response->setJson(['status' => "Failure", 'error' => ['message' => 'Client not found or unauthorized','code'=>'403']], 403); + } + + if (hash_equals($client['client_token'], $token)) { + $this->myLogger->log('error', 'Access Granted For Client : '.$client_id); + return true; + } else { + $this->myLogger->log('error', 'Invalid Token given for client : '.$client_id); + return $response->setJson(['status' => "Failure", 'error' => ['message' => 'Invalid token','code'=>401] + ], 401); + } + } catch (\Exception $e) { + log_message('error', 'Error in ClientAPIController:validateToken - ' . $e->getMessage()); + return $response->setJson(['status' => "Failure", 'error' => ['message'=>'Internal Server Error','code'=> 500]], 500); + } + + } + + public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) + { + // Do something here + } +} + diff --git a/app/Helpers/ClientQueryHelper.php b/app/Helpers/ClientQueryHelper.php new file mode 100644 index 00000000..6d58de19 --- /dev/null +++ b/app/Helpers/ClientQueryHelper.php @@ -0,0 +1,100 @@ +clientPolicy = new ClientPolicyModel(); + $this->empModel = new EmployeeModel(); + $this->empPolicyModel = new EmployeePolicyModel(); + $this->claimModel = new TicketMasterModel(); + } + + public function clientPolicyMaster($client_id){ + + return $this->clientPolicy->select("client_policy.id as policy_ref_no,client_policy.client_branch_id as branch_ref_no,client_branch.branch_code, + client_policy.insurer_id as insurer_ref_no,insurers.name as insurer,client_policy.policy_type_id,policy_type.policy_type, + client_policy.tpa_id as tpa_ref_no,client_policy.policy_start_date,client_policy.policy_end_date,client_policy.policy_no,client_policy.policy_status") + ->join('insurers', 'client_policy.insurer_id = insurers.id and insurers.is_active = 1') + ->join('policy_type', 'client_policy.policy_type_id = policy_type.id and policy_type.is_active = 1') + ->join('client_branch', 'client_policy.client_branch_id = client_branch.id and client_branch.is_active = 1') + ->where('client_policy.is_active', 1) + ->where('client_policy.client_id', $client_id) + ->get() + ->getResultArray(); + } + + public function sendEmpMaster($client_id,$where,$limit,$offset = 0) + { + + return $this->empModel->select("id as ref_no,name,emp_code, + relationship,emp_status,mobile,email_corporate, + change_event,dob,doj,band,gender") + ->where("is_active",1) + ->where("client_id", $client_id) + ->where($where) + ->whereNotIn('emp_status', ['truncated'],) + ->orderBy("id") + ->limit($limit,$offset) + ->get() + ->getResultArray(); + + } + + public function sendEmpPolicies($emp_id) + { + return $this->empPolicyModel->select("id as ref_no,client_policy_id as policy_ref_no, + tpa_id as tpa_ref_no,uhid as policy_no,pre_existing_alignments,age_band,basic_cover_si,date_coverage, + policy_end_date,days,premium,rata_premimum,date_of_exit,reason_for_exit,payable_employee") + ->where("employee_id", $emp_id) + ->where("is_active", 1) + ->whereNotIn("status", ['truncated']) + ->orderBy("id") + ->get() + ->getResultArray(); + } + + public function sendClaimMaster($client_id,$where,$limit,$offset = 0) + { + + return $this->claimModel->select("i.name as insurer,tpa.name as tpa,concat(up.first_name,' ',up.last_name) as acm_name, + cs.claim_status,ticket_master.emp_name,ticket_master.insured_name, + ticket_master.emp_code,ticket_master.policy_no,ticket_master.ticket_type_id as policy_type, + ticket_master.emp_mobile,ticket_master.emp_mail,ticket_master.hospital_name,ticket_master.doa, + ticket_master.dod,ticket_master.claim_amount,ticket_master.date_of_join,ticket_master.date_of_incep, + ticket_master.date_of_accident,ticket_master.date_of_death, + ticket_master.date_of_intimat,ticket_master.claim_number,ticket_master.si_amt, + ticket_master.raised_date,ticket_master.registration_date,ticket_master.denial_date, + ticket_master.settled_date,ticket_master.denial_reason,ticket_master.approved_amount, + ticket_master.utr_details,ticket_master.return_remark,ticket_master.cancel_remark, + ticket_master.non_id_reason,ticket_master.head_rejection_reason") + ->join("tpa","tpa.id = ticket_master.tpa_id and tpa.is_active = 1") + ->join("user_profiles up", "ticket_master.acm_id = up.id and up.is_active = 1") + ->join('insurers i', 'ticket_master.insurer_id = i.id and i.is_active = 1') + ->join('ticket_claim_status cs', 'ticket_master.claim_status_id = cs.id and cs.is_active = 1') + ->where("ticket_master.client_id", $client_id) + ->where("ticket_master.is_active", 1) + ->where($where) + ->orderBy("ticket_master.id") + ->limit($limit,$offset) + ->get() + ->getResultArray(); + + } + + +} \ No newline at end of file diff --git a/app/Helpers/ClientTokenHelper.php b/app/Helpers/ClientTokenHelper.php new file mode 100644 index 00000000..50c73f23 --- /dev/null +++ b/app/Helpers/ClientTokenHelper.php @@ -0,0 +1,54 @@ +empModel = new EmployeeModel(); + $this->empPolicyModel = new EmployeePolicyModel(); + $this->claimModel = new TicketMasterModel(); + + } + + public function mapObjectType($data_to_map, $objectType) + { + $mapped_data = []; + foreach ($objectType as $key => $value){ + $mapped_data[$key] = $data_to_map[$value]; + } + + return $mapped_data; + } + + public function insertData($mapped_data, $type){ + + $model = $type == 1 ? "empModel" : "claimModel"; + $this->$model->insert($mapped_data); + } +} diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php index e13d9793..593b2d05 100755 --- a/app/Helpers/excel_util_helper.php +++ b/app/Helpers/excel_util_helper.php @@ -407,7 +407,7 @@ if (!function_exists('data_group_by_family')) $row = transform_enrollment_row_to_inception_row($row); } - if(strtolower($row[5]) == 'self' && isset($result[$row[1]])) + if(isset($row[5]) && strtolower($row[5]) == 'self' && isset($result[$row[1]])) { array_unshift($result[$row[1]],$row); }else @@ -2119,15 +2119,15 @@ if(!function_exists('check_unit')) if(!function_exists('transform_si_excel_row_to_calculatable_format')) { - function transform_si_excel_row_to_calculatable_format(array $employee,array$employee_policy,array $maxage_and_maxcount,array $slab_details,string $applicable_slab_name,string $augmented_si,array $grid_master) - { + function transform_si_excel_row_to_calculatable_format(array $employee, array $employee_policy,array $maxage_and_maxcount,array $slab_details,string $applicable_slab_name,string $augmented_si,array $grid_master) + { $employee['temp'] = []; $employee['temp']['max_age'] = $maxage_and_maxcount[0]['max_age']; $employee['temp']['max_count'] = $maxage_and_maxcount[0]['family_member_count']; $employee['temp']['grid_name'] = $applicable_slab_name; $employee['temp']['grid_master'] = $grid_master; $employee['temp']['acting_self'] = true; - $employee['temp']['premium_type'] = $grid_master['premium_type']; + $employee['temp']['premium_type'] = $slab_details['slab_rates'][0]['premium_type']; $employee['temp']['grid_type'] = $applicable_slab_name; $employee['temp']['grid_id'] = $grid_master['ui_type']; $employee['temp']['action'] = 'SI'; @@ -2137,7 +2137,7 @@ if(!function_exists('transform_si_excel_row_to_calculatable_format')) $employee['temp']['policy_status'] = null; $employee['temp']['emp_status'] = null; $employee['temp']['rata_premimum'] = null; - + $employee['policy_details'] = $employee_policy; return $employee; diff --git a/app/Models/ClientApiModel.php b/app/Models/ClientApiModel.php new file mode 100644 index 00000000..59830aa0 --- /dev/null +++ b/app/Models/ClientApiModel.php @@ -0,0 +1,45 @@ +db->query($query)->getResult(); + $results = $this->db->query($query)->getResultArray(); return $results; } diff --git a/app/Models/PolicyTransactionModel.php b/app/Models/PolicyTransactionModel.php index b43669b2..b5d42e54 100644 --- a/app/Models/PolicyTransactionModel.php +++ b/app/Models/PolicyTransactionModel.php @@ -1361,7 +1361,10 @@ class PolicyTransactionModel extends Model $builder->orderBy('policy_transaction.id', 'desc'); - return $builder->get()->getResultArray(); + $returnData = $builder->get()->getResultArray(); + + + return $returnData; } public function getFinanceReportList($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0) diff --git a/app/Models/TicketMasterModel.php b/app/Models/TicketMasterModel.php index 1612c08e..4bd247dc 100644 --- a/app/Models/TicketMasterModel.php +++ b/app/Models/TicketMasterModel.php @@ -75,10 +75,10 @@ class TicketMasterModel extends Model 'pay_initiate_date', 'emp_personal_mail', 'client_policy_id' - - ]; - - + + ]; + + // Callbacks protected $allowCallbacks = true; protected $beforeInsert = ["checkAndADDCreatedByValue"]; @@ -93,7 +93,7 @@ class TicketMasterModel extends Model protected function checkAndADDCreatedByValue(array $data) { // Check if 'updated_by' value is null or empty - if (empty($data['data']['created_by'])) { + if (empty($data['data']['created_by'])) { // Set 'updated_by' value to the current session user ID $data['data']['created_by'] = get_session_userid(); } @@ -104,7 +104,7 @@ class TicketMasterModel extends Model protected function checkAndUpdateUpdatedByValue(array $data) { // Check if 'updated_by' value is null or empty - if (empty($data['data']['updated_by'])) { + if (empty($data['data']['updated_by'])) { // Set 'updated_by' value to the current session user ID $data['data']['updated_by'] = get_session_userid(); } @@ -130,21 +130,21 @@ class TicketMasterModel extends Model public function getTemplateDataByTicketID($ticket_id) { $template_data = $this - ->select("ticket_mail_template.*, CASE + ->select("ticket_mail_template.*, CASE WHEN employees.email_corporate IS NULL OR employees.email_corporate = '' THEN ticket_master.emp_mail ELSE employees.email_corporate END as emp_mail, ,ticket_master.claim_status_id") - ->join('ticket_claim_status', 'ticket_master.claim_status_id = ticket_claim_status.id and ticket_claim_status.is_active = 1') - ->join('ticket_mail_template', ' + ->join('ticket_claim_status', 'ticket_master.claim_status_id = ticket_claim_status.id and ticket_claim_status.is_active = 1') + ->join('ticket_mail_template', ' ticket_claim_status.trigger_type = ticket_mail_template.trigger_type and ticket_claim_status.ticket_type = ticket_mail_template.ticket_type and ticket_mail_template.is_active = 1') - ->join('employees','employees.id = ticket_master.emp_id','left') - ->where('ticket_master.id', $ticket_id) - ->where('ticket_master.is_active', 1) - ->where('ticket_claim_status.is_active', 1) - ->first(); + ->join('employees', 'employees.id = ticket_master.emp_id', 'left') + ->where('ticket_master.id', $ticket_id) + ->where('ticket_master.is_active', 1) + ->where('ticket_claim_status.is_active', 1) + ->first(); return $template_data; } @@ -173,16 +173,16 @@ class TicketMasterModel extends Model ->join('clients', 'ticket_master.client_id = clients.id', 'left') ->join('insurers', 'ticket_master.insurer_id = insurers.id', 'left') ->join('tpa', 'ticket_master.tpa_id = tpa.id', 'left') - ->join('ticket_notes', 'ticket_master.id = ticket_notes.ticket_id and ticket_notes.is_active = 1 and ticket_notes.is_auto_query = 1','left') + ->join('ticket_notes', 'ticket_master.id = ticket_notes.ticket_id and ticket_notes.is_active = 1 and ticket_notes.is_auto_query = 1', 'left') ->join('user_profiles', 'ticket_master.acm_id = user_profiles.id', 'left') - ->join('employees','employees.id = ticket_master.emp_id','left') + ->join('employees', 'employees.id = ticket_master.emp_id', 'left') ->where('ticket_master.id', $ticket_id) ->where('ticket_master.is_active', 1) ->first(); return $ticket_data; } - + //get TAT report BAND wise Data // public function getTATReport($ticket_type = null, $start_date = null, $end_date = null) // { @@ -210,7 +210,7 @@ class TicketMasterModel extends Model // "; // $statusResult = $this->db->query($statusQuery)->getResultArray(); // // dd($statusResult); - + // // Initialize dynamic query parts // $dynamicSelect = ''; @@ -248,12 +248,12 @@ class TicketMasterModel extends Model // 0 // ) AS `$columnName`, "; // } - + // // Remove the trailing comma from the SELECT part // $dynamicSelect = rtrim($dynamicSelect, ', '); // // dd($dynamicSelect); - + // // Construct the full SQL query // $sql = " // SELECT @@ -317,7 +317,7 @@ class TicketMasterModel extends Model // ORDER BY // FIELD(tc.TAT_Category, 'Above 20 Days', '13-20 Days', '7-12 Days', '0-6 Days'); // "; - + // // Execute the query and return the result // $data = $this->db->query($sql)->getResultArray(); // // print_rr($this->db->getLastQuery(), $data); die; @@ -329,12 +329,12 @@ class TicketMasterModel extends Model // // $tableData['headers'] = $headers; // // $tableData['body'] = $data; // // } - + // return $data; // } public function getTATReport($ticket_type = null, $start_date = null, $end_date = null) - { + { //set default last 3 months data date $fromDate = date('Y-m-d', strtotime('-90 days')); $toDate = date('Y-m-d 23:59:59'); @@ -345,9 +345,9 @@ class TicketMasterModel extends Model } $ticket_type_data_1 = ""; $ticket_type_data_2 = ""; - if(!empty($ticket_type)){ - $ticket_type_data_1 = "AND ticket_type = $ticket_type"; - $ticket_type_data_2 = "WHERE tm.ticket_type_id = $ticket_type"; + if (!empty($ticket_type)) { + $ticket_type_data_1 = "AND ticket_type = $ticket_type"; + $ticket_type_data_2 = "WHERE tm.ticket_type_id = $ticket_type"; } // Fetch claim statuses from the `ticket_claim_status` table @@ -359,7 +359,7 @@ class TicketMasterModel extends Model "; $statusResult = $this->db->query($statusQuery)->getResultArray(); // dd($statusResult); - + // Initialize dynamic query parts $dynamicSelect = ''; @@ -397,12 +397,12 @@ class TicketMasterModel extends Model 0 ) AS `$columnName`, "; } - + // Remove the trailing comma from the SELECT part $dynamicSelect = rtrim($dynamicSelect, ', '); // dd($dynamicSelect); - + // Construct the full SQL query $sql = " SELECT @@ -472,7 +472,7 @@ class TicketMasterModel extends Model '0-6 Days' ); "; - + // Execute the query and return the result $data = $this->db->query($sql)->getResultArray(); // print_rr($this->db->getLastQuery(), $data); die; @@ -484,12 +484,13 @@ class TicketMasterModel extends Model // $tableData['headers'] = $headers; // $tableData['body'] = $data; // } - + return $data; } - public function tpaWiseReport($policy_type = null ,$start_date = null, $end_date = null){ - $ticket_type_data_1 = ""; + public function tpaWiseReport($policy_type = null, $start_date = null, $end_date = null) + { + $ticket_type_data_1 = ""; $ticket_type_data_2 = ""; if (!empty($policy_type)) { @@ -511,8 +512,17 @@ class TicketMasterModel extends Model $dynamicSelect .= " COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) AS `{$status['claim_status']}`, "; - if (in_array($status['claim_status'], ['ID NOT GENERATED', 'NON ID', 'CDA', 'INFORMATION REQUIRED','UNDER PROCESS - CLAIM NO. UPDATION', - 'UNDER PROCESS - INVESTIGATION STATUS','UNDER PROCESS - QUERY DOCUMENT RECEIVED','APPROVED','PAYMENT INITIATED'])) { + if (in_array($status['claim_status'], [ + 'ID NOT GENERATED', + 'NON ID', + 'CDA', + 'INFORMATION REQUIRED', + 'UNDER PROCESS - CLAIM NO. UPDATION', + 'UNDER PROCESS - INVESTIGATION STATUS', + 'UNDER PROCESS - QUERY DOCUMENT RECEIVED', + 'APPROVED', + 'PAYMENT INITIATED' + ])) { $dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + "; } // Include in total count @@ -553,47 +563,47 @@ class TicketMasterModel extends Model // print_rr($result);die(); return $result; - } - public function accountManagerWiseReport($policy_type = null ,$start_date = null, $end_date = null){ + public function accountManagerWiseReport($policy_type = null, $start_date = null, $end_date = null) + { if ($policy_type == 1) { $ticket_type_data_1 = ""; - $ticket_type_data_2 = ""; + $ticket_type_data_2 = ""; - if (!empty($policy_type)) { - $ticket_type_data_1 = "AND ticket_type = $policy_type"; - $ticket_type_data_2 = "AND master.ticket_type_id = $policy_type"; - } + if (!empty($policy_type)) { + $ticket_type_data_1 = "AND ticket_type = $policy_type"; + $ticket_type_data_2 = "AND master.ticket_type_id = $policy_type"; + } - // Fetch claim statuses dynamically - $statusQuery = "SELECT id, claim_status FROM ticket_claim_status WHERE is_active = 1 $ticket_type_data_1"; - $statusResult = $this->db->query($statusQuery)->getResultArray(); + // Fetch claim statuses dynamically + $statusQuery = "SELECT id, claim_status FROM ticket_claim_status WHERE is_active = 1 $ticket_type_data_1"; + $statusResult = $this->db->query($statusQuery)->getResultArray(); - // Initialize dynamic query parts - $dynamicSelect = ''; - $dynamicTotal = ''; + // Initialize dynamic query parts + $dynamicSelect = ''; + $dynamicTotal = ''; - // Loop through each claim status and generate the CASE statements - foreach ($statusResult as $status) { - $dynamicSelect .= " + // Loop through each claim status and generate the CASE statements + foreach ($statusResult as $status) { + $dynamicSelect .= " COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) AS `{$status['claim_status']}`, "; - // Include in total count - $dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + "; + // Include in total count + $dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + "; - // Include only closed-related statuses in total2 count + // Include only closed-related statuses in total2 count - } + } - // Remove the trailing commas and `+` signs - $dynamicSelect = rtrim($dynamicSelect, ', '); - $dynamicTotal = rtrim($dynamicTotal, ' +'); - // print_rr($dynamicSelect); - // Construct the final SQL query - $sql = " + // Remove the trailing commas and `+` signs + $dynamicSelect = rtrim($dynamicSelect, ', '); + $dynamicTotal = rtrim($dynamicTotal, ' +'); + // print_rr($dynamicSelect); + // Construct the final SQL query + $sql = " SELECT user_profiles.first_name AS ACM_NAME, $dynamicSelect, @@ -614,44 +624,49 @@ class TicketMasterModel extends Model // dd($result); return $result; - - - }else{ + } else { $ticket_type_data_1 = ""; $ticket_type_data_2 = ""; - + if (!empty($policy_type)) { $ticket_type_data_1 = "AND ticket_type = $policy_type"; $ticket_type_data_2 = "AND master.ticket_type_id = $policy_type"; } - + // Fetch claim statuses dynamically $statusQuery = "SELECT id, claim_status FROM ticket_claim_status WHERE is_active = 1 $ticket_type_data_1"; $statusResult = $this->db->query($statusQuery)->getResultArray(); - + // Initialize dynamic query parts $dynamicSelect = ''; $dynamicTotal = ''; $dynamicClosedTotal = ''; - + // Loop through each claim status and generate the CASE statements foreach ($statusResult as $status) { $dynamicSelect .= " COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) AS `{$status['claim_status']}`, "; - - if (in_array($status['claim_status'], ['CLAIM INTIMATION', 'INTIMATION TO INSURER', 'CLIENT PENDING', 'INSURER PENDING','INVESTIGATION', - 'APPROVED','ON HOLD'])) { + + if (in_array($status['claim_status'], [ + 'CLAIM INTIMATION', + 'INTIMATION TO INSURER', + 'CLIENT PENDING', + 'INSURER PENDING', + 'INVESTIGATION', + 'APPROVED', + 'ON HOLD' + ])) { $dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + "; } // Include in total count // $dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + "; - + // Include only closed-related statuses in total2 count if (in_array($status['claim_status'], ['CLOSED', 'SETTLED', 'NOT COVERED'])) { $dynamicClosedTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + "; } } - + // Remove the trailing commas and `+` signs $dynamicSelect = rtrim($dynamicSelect, ', '); $dynamicTotal = rtrim($dynamicTotal, ' +'); @@ -675,10 +690,10 @@ class TicketMasterModel extends Model GROUP BY user_profiles.id; "; - + // Execute the query $result = $this->db->query($sql)->getResultArray(); - + // print_rr($result);die(); return $result; } @@ -705,6 +720,82 @@ class TicketMasterModel extends Model // dd($data, db_connect()->getLastQuery()); return $data; } - - + + public function getDashData($claim_statuses, $limit) + { + $finalResults = []; + + foreach ($claim_statuses as $typeId => $statuses) { + $builder = $this->db->table('ticket_master tm'); + + // Start with ticket_type_id in SELECT + $selects = ['tm.ticket_type_id']; + + // Dynamically build status counts with COALESCE to handle missing values + foreach ($statuses as $status) { + $alias = strtolower($status); + $alias = str_replace(' ', '_', $alias); + $selects[] = "COALESCE(SUM(CASE WHEN tcs.claim_status = " . $this->db->escape($status) . " AND tm.ticket_type_id = {$typeId} THEN 1 ELSE 0 END), 0) AS `{$alias}`"; + } + + $builder->select(implode(',', $selects)); + $builder->join('ticket_claim_status tcs', 'tm.claim_status_id = tcs.id', 'left'); + + // Subquery for latest status change, with LEFT JOIN to avoid missing ticket_type_id + $builder->join( + '(SELECT ticket_id, MAX(created_at) AS last_claim_status_change + FROM ticket_history + WHERE field_name = \'claim_status_id\' + GROUP BY ticket_id) th', + 'tm.id = th.ticket_id', + 'left' + ); + + // Set the date limit based on the status + foreach ($statuses as $status) { + $dateLimit = $limit[$typeId][$status] ?? 3; + $dateThreshold = date('Y-m-d H:i:s', strtotime("-{$dateLimit} days")); + + $builder->groupStart() + ->where('th.last_claim_status_change <=', $dateThreshold) + ->orWhere('th.last_claim_status_change IS NULL') + ->groupEnd(); + } + + + $builder->where('tm.ticket_type_id', $typeId); + $builder->where('tm.is_active', 1); + $builder->where('tm.claim_status_id is not null'); + + $builder->groupBy('tm.ticket_type_id'); + + $query = $builder->get(); + $result = $query->getRowArray(); + + // Add Total count + $total = 0; + foreach ($result as $key => $res) { + // Ensure that ticket_type_id is excluded from the sum + if ($key !== 'ticket_type_id') { + $total += $res; + } + } + $result['total'] = $total; + + // If no result, initialize an empty result for the ticket_type_id + if (!$result) { + $result = ['ticket_type_id' => $typeId, 'total' => 0]; + foreach ($statuses as $status) { + $alias = strtolower($status); + $alias = str_replace(' ', '_', $alias); + $result[$alias] = 0; + } + } + + // Add the result to the final array + $finalResults[$typeId] = $result; + } + + return $finalResults; + } } diff --git a/app/Views/DashBoard.php b/app/Views/DashBoard.php index 3102ab15..55b75fc5 100755 --- a/app/Views/DashBoard.php +++ b/app/Views/DashBoard.php @@ -218,8 +218,27 @@ + + + +
+ + + + + @@ -229,6 +248,7 @@ +
diff --git a/app/Views/claims_dash.php b/app/Views/claims_dash.php new file mode 100644 index 00000000..44538323 --- /dev/null +++ b/app/Views/claims_dash.php @@ -0,0 +1,304 @@ + + +
+
+
+
+
+
GMC
+

+

 

+

 

+
+
+ +
+
+
+
+
GPA
+

+

 

+

 

+
+
+
+ +
+
+
+
EDLI
+

+

 

+

 

+
+
+
+ +
+
+
+
GTLI
+

+

 

+

 

+
+
+
+ +
+ +
+ show all pending Tile
+
+
+ + + $statuses) : ?> + + + $count) : ?> + + 20 ? substr($formattedStatus, 0, 15) . '...' : $formattedStatus; + $showTooltip = strlen($formattedStatus) > 20; + ?> + + + + + +
+ + +
+ + \ No newline at end of file diff --git a/app/Views/client_api.php b/app/Views/client_api.php new file mode 100644 index 00000000..67f93316 --- /dev/null +++ b/app/Views/client_api.php @@ -0,0 +1,452 @@ + +
+
+ +
+
+ + +
+
+ +
+ "> +
+
Generate New Token
+
+
+ " class="form-control" id="client_token" placeholder="Click generate to create token" readonly required> +
+
+ + +
+ +
+ +
+ +
+
+
Webhooks (PUSH)
+
+
+ + +
+
+ + +
+
+ + " class="form-control emp_webhook" onchange="validateWebhookUrlById(this.id)" id="webhook_url" placeholder="Enter Webhook URL"> +
+
+ + +
+
+ + " class="form-control emp_webhook" placeholder="Enter Client API token" /> + +
+ +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + " class="form-control claim_webhook" onchange="validateWebhookUrlById(this.id)" id="webhook_url_claims" placeholder="Enter Webhook URL"> +
+
+ + +
+
+ + " class="form-control claim_webhook" placeholder="Enter Client API token"> +
+
+
+ + +
+
+
+
Webhooks (PULL)
+
+
+ + +
+
+ + +
+
+ + " class="form-control" onchange="validateWebhookUrlById(this.id)" id="webhook_url2" readonly placeholder="Enter Webhook URL"> +
+
+ + +
+
+ +
+
+ + " class="form-control" id="pull_emp_token" placeholder="Click generate to create token" readonly required> +
+
+ + +
+
+ +
+ + +
+ +

+
+
+ + +
+
+ + +
+
+ + " class="form-control" onchange="validateWebhookUrlById(this.id)" id="webhook_url2" readonly placeholder="Enter Webhook URL"> +
+
+ + +
+
+
+ + " class="form-control" id="pull_claim_token" placeholder="Click generate to create token" readonly required> +
+
+ + +
+
+ + +
+
+
+ +
+ +
+
+
+ + \ No newline at end of file diff --git a/app/Views/client_onboarding.php b/app/Views/client_onboarding.php index 814a97cd..fd334113 100755 --- a/app/Views/client_onboarding.php +++ b/app/Views/client_onboarding.php @@ -88,6 +88,12 @@ body { Policies +
+
+ +
+
+ \ No newline at end of file diff --git a/app/Views/testWebhook.php b/app/Views/testWebhook.php new file mode 100644 index 00000000..54bf7eda --- /dev/null +++ b/app/Views/testWebhook.php @@ -0,0 +1 @@ +Hello \ No newline at end of file diff --git a/app/Views/view_rfq_non_eb.php b/app/Views/view_rfq_non_eb.php index 5f9aba17..364f2d34 100644 --- a/app/Views/view_rfq_non_eb.php +++ b/app/Views/view_rfq_non_eb.php @@ -3820,7 +3820,12 @@ tables.forEach(table => { if (table.id.includes("summary")) { - table.remove(); // reMove summary table from the top + let tableContainer = table.closest(".table-container") || table.parentElement; + if (tableContainer) { + tableContainer.remove(); // Remove the container, including table and collapsible bar + } else { + table.remove(); // Fallback to removing just the table if no container is found + } } });