MERGE_UAT_LIVE_ISSUES
This commit is contained in:
commit
229ba8e5a0
2
.gitignore
vendored
2
.gitignore
vendored
@ -33,3 +33,5 @@ build/
|
|||||||
composer.lock
|
composer.lock
|
||||||
.env
|
.env
|
||||||
.phpunit*
|
.phpunit*
|
||||||
|
phpqueue.sh
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,7 @@ use CodeIgniter\Filters\SecureHeaders;
|
|||||||
use App\Filters\AuthMVC;
|
use App\Filters\AuthMVC;
|
||||||
use App\Filters\HttpRequestLog;
|
use App\Filters\HttpRequestLog;
|
||||||
use App\Filters\CloseDbConnection;
|
use App\Filters\CloseDbConnection;
|
||||||
|
use App\Filters\AuthClientApi;
|
||||||
|
|
||||||
use App\Filters\AuthJWT;
|
use App\Filters\AuthJWT;
|
||||||
|
|
||||||
@ -34,6 +35,7 @@ class Filters extends BaseConfig
|
|||||||
'authMVC' => AuthMVC::class,
|
'authMVC' => AuthMVC::class,
|
||||||
'HttpRequestLog' => HttpRequestLog::class,
|
'HttpRequestLog' => HttpRequestLog::class,
|
||||||
'authJWT' => AuthJWT::class,
|
'authJWT' => AuthJWT::class,
|
||||||
|
'AuthClientApi' => AuthClientApi::class,
|
||||||
'CloseDbConnection' => CloseDbConnection::class
|
'CloseDbConnection' => CloseDbConnection::class
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,7 @@ $routes->get("sendextraparam", "ClientController::sendextraparam");
|
|||||||
$routes->get("updateRenewalData", "ClientController::updateRenewalData");
|
$routes->get("updateRenewalData", "ClientController::updateRenewalData");
|
||||||
$routes->get("updateRenewalDataNotExistingClient", "ClientController::updateRenewalDataNotExistingClient");
|
$routes->get("updateRenewalDataNotExistingClient", "ClientController::updateRenewalDataNotExistingClient");
|
||||||
$routes->get("updateRenewalInsurerData", "ClientController::updateRenewalInsurerData");
|
$routes->get("updateRenewalInsurerData", "ClientController::updateRenewalInsurerData");
|
||||||
|
$routes->get("sendMutipleToEmails", "MasterController::sendMutipleToEmails");
|
||||||
// $routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn");
|
// $routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn");
|
||||||
// $routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
|
// $routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
|
||||||
// $routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
|
// $routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
|
||||||
@ -72,6 +73,7 @@ $routes->group("/dashboard", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get('get-notification', 'DashboardController::getDashboardNotifications');
|
$routes->get('get-notification', 'DashboardController::getDashboardNotifications');
|
||||||
$routes->get('acknowledge-notification/(:segment)', 'DashboardController::acknowledgeMessage/$1');
|
$routes->get('acknowledge-notification/(:segment)', 'DashboardController::acknowledgeMessage/$1');
|
||||||
$routes->get('get-pending-action', 'PendingActionsController::getPendingActions');
|
$routes->get('get-pending-action', 'PendingActionsController::getPendingActions');
|
||||||
|
$routes->post("prepareClaimSearchData","DashboardController::prepareClaimSearchData");
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
$routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
||||||
@ -87,6 +89,8 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get('view_deposit/(:num)', 'ClientController::view_Deposit/$1');
|
$routes->get('view_deposit/(:num)', 'ClientController::view_Deposit/$1');
|
||||||
$routes->get('createtransaction', 'ClientController::createtransaction');
|
$routes->get('createtransaction', 'ClientController::createtransaction');
|
||||||
$routes->post('save_deposit', 'ClientController::saveDeposit');
|
$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->get('view_Deposit/(:num)/(:num)','ClientController/view_Deposit/$1/$2');
|
||||||
|
|
||||||
$routes->group("notification", ["filter" => "authMVC"], function ($routes) {
|
$routes->group("notification", ["filter" => "authMVC"], function ($routes) {
|
||||||
@ -373,7 +377,7 @@ $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$routes->group("report", ["filter" => "authMVC"], function ($routes) {
|
$routes->group("report", ["filter" => "authMVC"], function ($routes) {
|
||||||
$routes->get("list", "PolicyTransactionController::reportBDS");
|
$routes->match(['get', 'post'],"list", "PolicyTransactionController::reportBDS");
|
||||||
$routes->get("report-varience-list", "PolicyTransactionController::reportVarience");
|
$routes->get("report-varience-list", "PolicyTransactionController::reportVarience");
|
||||||
$routes->get("report-business-list", "PolicyTransactionController::reportBusinessList");
|
$routes->get("report-business-list", "PolicyTransactionController::reportBusinessList");
|
||||||
$routes->get("report-finance-list", "PolicyTransactionController::reportFinanceList");
|
$routes->get("report-finance-list", "PolicyTransactionController::reportFinanceList");
|
||||||
@ -553,3 +557,16 @@ $routes->group("/ticket", ["filter" => "authMVC"], function ($routes) {
|
|||||||
// $routes->post('ticket_messages','TicketController::getTicketMessage');
|
// $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");
|
||||||
|
|||||||
310
app/Controllers/ClientAPIController.php
Normal file
310
app/Controllers/ClientAPIController.php
Normal file
@ -0,0 +1,310 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Controllers\BaseController;
|
||||||
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
use CodeIgniter\API\ResponseTrait;
|
||||||
|
|
||||||
|
use App\Helpers\ClientTokenHelper;
|
||||||
|
use App\Helpers\ClientQueryHelper;
|
||||||
|
|
||||||
|
use App\Models\ClientApiModel;
|
||||||
|
use App\Models\ClientPolicyModel;
|
||||||
|
|
||||||
|
use App\Controllers\TicketController;
|
||||||
|
|
||||||
|
class ClientAPIController extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
use ResponseTrait;
|
||||||
|
|
||||||
|
protected $clientAPI;
|
||||||
|
protected $clientPolicy;
|
||||||
|
protected $myLogger;
|
||||||
|
protected $clientQueryHelper;
|
||||||
|
protected $clientTokenHelper;
|
||||||
|
protected $ticketController;
|
||||||
|
|
||||||
|
protected $operators;
|
||||||
|
protected $propertyNames;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
set_session_context('Client API Controller');
|
||||||
|
$this->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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -4,6 +4,7 @@ namespace App\Controllers;
|
|||||||
|
|
||||||
use App\Helpers\DepositHelper;
|
use App\Helpers\DepositHelper;
|
||||||
use App\Helpers\MailHelper;
|
use App\Helpers\MailHelper;
|
||||||
|
use App\Helpers\ClientTokenHelper;
|
||||||
use App\helpers\JWTToken;
|
use App\helpers\JWTToken;
|
||||||
use CodeIgniter\HTTP\IncomingRequest;
|
use CodeIgniter\HTTP\IncomingRequest;
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
@ -39,6 +40,7 @@ use App\Models\PolicyTransactionModel;
|
|||||||
use App\Models\PolicyTransactionStatusModel;
|
use App\Models\PolicyTransactionStatusModel;
|
||||||
use App\Models\VehicleModel;
|
use App\Models\VehicleModel;
|
||||||
use App\Models\LeadsModel;
|
use App\Models\LeadsModel;
|
||||||
|
use App\Models\ClientApiModel;
|
||||||
|
|
||||||
use App\Controllers\EmpDataServiceController;
|
use App\Controllers\EmpDataServiceController;
|
||||||
use App\Controllers\GoogleDriveController;
|
use App\Controllers\GoogleDriveController;
|
||||||
@ -83,7 +85,7 @@ class ClientController extends AdminController
|
|||||||
protected $policyTransactionStatusModel;
|
protected $policyTransactionStatusModel;
|
||||||
protected $vehicleModel;
|
protected $vehicleModel;
|
||||||
protected $leadsModel;
|
protected $leadsModel;
|
||||||
|
protected $clientApi;
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@ -119,6 +121,7 @@ class ClientController extends AdminController
|
|||||||
$this->policyTransactionStatusModel = new PolicyTransactionStatusModel();
|
$this->policyTransactionStatusModel = new PolicyTransactionStatusModel();
|
||||||
$this->vehicleModel = new VehicleModel();
|
$this->vehicleModel = new VehicleModel();
|
||||||
$this->leadsModel = new LeadsModel();
|
$this->leadsModel = new LeadsModel();
|
||||||
|
$this->clientApi = new ClientApiModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------
|
||||||
@ -751,7 +754,7 @@ class ClientController extends AdminController
|
|||||||
$editData['client_policy']['role'] = get_role_id();
|
$editData['client_policy']['role'] = get_role_id();
|
||||||
$editData['notification'] = $this->notificationModel->select('template_name,enabled')->where('client_id', $id)->findAll();
|
$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['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);
|
// dd($editData);
|
||||||
echo view('layout/header', $headerData);
|
echo view('layout/header', $headerData);
|
||||||
echo view('client_onboarding', $editData);
|
echo view('client_onboarding', $editData);
|
||||||
@ -4596,6 +4599,11 @@ class ClientController extends AdminController
|
|||||||
// $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]]);
|
||||||
|
$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--------------------------------------------------------------------------------
|
// ----------EMP DATA SERVICE CONTROLLER--------------------------------------------------------------------------------
|
||||||
@ -4776,6 +4784,15 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
// dd($finalJson);
|
// dd($finalJson);
|
||||||
|
|
||||||
|
// $baseWhere = [
|
||||||
|
// 'client_id' => 159,
|
||||||
|
// 'client_policy_id' => 336,
|
||||||
|
// 'insurer_id' => 1,
|
||||||
|
// 'cd_ac_pk' => 56,
|
||||||
|
// 'event_name' => "addition",
|
||||||
|
// ];
|
||||||
|
// $return_value = check_cd_entry_exist($baseWhere);
|
||||||
|
// dd($return_value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5683,6 +5700,40 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
return $result;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
319
app/Controllers/ClientWebHooksController.php
Normal file
319
app/Controllers/ClientWebHooksController.php
Normal file
@ -0,0 +1,319 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Controllers\BaseController;
|
||||||
|
use CodeIgniter\API\ResponseTrait;
|
||||||
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
|
||||||
|
use App\Models\ClientApiModel;
|
||||||
|
use App\Models\ClientPolicyModel;
|
||||||
|
|
||||||
|
use App\Helpers\clientWebHookHelper;
|
||||||
|
use App\Helpers\ClientTokenHelper;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
|
class ClientWebHooksController extends BaseController
|
||||||
|
{
|
||||||
|
use ResponseTrait;
|
||||||
|
protected $myLogger;
|
||||||
|
protected $clientAPI;
|
||||||
|
protected $clientPolicy;
|
||||||
|
|
||||||
|
protected $webHookHelper;
|
||||||
|
protected $clientTokenHelper;
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
set_session_context('Client Webhook Controller');
|
||||||
|
$this->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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -21,6 +21,10 @@ use App\Models\NotificationModel;
|
|||||||
use App\Models\EmployeePolicyModel;
|
use App\Models\EmployeePolicyModel;
|
||||||
use App\Controllers\PendingActionsContrller;
|
use App\Controllers\PendingActionsContrller;
|
||||||
use App\Controllers\EmpDataServiceController;
|
use App\Controllers\EmpDataServiceController;
|
||||||
|
use App\Models\TicketMasterModel;
|
||||||
|
use App\Models\LeadsModel;
|
||||||
|
use App\Models\TicketClaimStatusModel;
|
||||||
|
|
||||||
|
|
||||||
class DashboardController extends AdminController
|
class DashboardController extends AdminController
|
||||||
{
|
{
|
||||||
@ -33,8 +37,12 @@ class DashboardController extends AdminController
|
|||||||
protected $notificationModel;
|
protected $notificationModel;
|
||||||
protected $employeePolicyModel;
|
protected $employeePolicyModel;
|
||||||
protected $policyTransactionModel;
|
protected $policyTransactionModel;
|
||||||
|
protected $leadModel;
|
||||||
|
protected $ticketModel;
|
||||||
|
protected $ticketStatusModel;
|
||||||
protected $policyStatus;
|
protected $policyStatus;
|
||||||
protected $colorShades;
|
protected $colorShades;
|
||||||
|
protected $claimDashLimit;
|
||||||
|
|
||||||
protected $myLogger;
|
protected $myLogger;
|
||||||
|
|
||||||
@ -48,9 +56,76 @@ class DashboardController extends AdminController
|
|||||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||||
$this->clientModel = new ClientModel();
|
$this->clientModel = new ClientModel();
|
||||||
$this->policyTransactionModel = new PolicyTransactionModel();
|
$this->policyTransactionModel = new PolicyTransactionModel();
|
||||||
|
$this->ticketModel = new TicketMasterModel();
|
||||||
|
$this->leadModel = new LeadsModel();
|
||||||
|
$this->ticketStatusModel = new TicketClaimStatusModel();
|
||||||
|
|
||||||
$this->myLogger = \Config\Services::mylogger();
|
$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 = [
|
$this->policyStatus = [
|
||||||
'under_process' => 'Under Process',
|
'under_process' => 'Under Process',
|
||||||
'client_pending' => 'Client Pending',
|
'client_pending' => 'Client Pending',
|
||||||
@ -92,7 +167,6 @@ class DashboardController extends AdminController
|
|||||||
'linear-gradient(45deg, #494f4f, #353d3d)' // SilverChalice shade 6
|
'linear-gradient(45deg, #494f4f, #353d3d)' // SilverChalice shade 6
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dashboard()
|
public function dashboard()
|
||||||
@ -100,7 +174,7 @@ class DashboardController extends AdminController
|
|||||||
|
|
||||||
$data = [];
|
$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();
|
$db = db_connect();
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
@ -169,9 +243,20 @@ class DashboardController extends AdminController
|
|||||||
$data['financeTeamStatusData'] = $financeTeamStatusData;
|
$data['financeTeamStatusData'] = $financeTeamStatusData;
|
||||||
$data['policyStatus'] = $this->policyStatus;
|
$data['policyStatus'] = $this->policyStatus;
|
||||||
$data['colorShades'] = $this->colorShades;
|
$data['colorShades'] = $this->colorShades;
|
||||||
// print_r($data);die;
|
}
|
||||||
|
if ((get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team())) || in_array(get_role_id(),[1,5])){
|
||||||
|
$data['claim_data'] = $this->getClaimData();
|
||||||
|
$data['colorShades'] = $this->colorShades;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if ((get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_team())) || in_array(get_role_id(),[1,5])){
|
||||||
|
$data['lead_data'] = $this->leadModel->getDashData();
|
||||||
|
$data['bds_renewal'] = $this->policyTransactionModel->getBDSRenewalData();
|
||||||
|
$data['colorShades'] = $this->colorShades;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// dd(get_role_id(),user_team());
|
||||||
|
|
||||||
$data['page_name'] = 'Dashboard';
|
$data['page_name'] = 'Dashboard';
|
||||||
|
|
||||||
@ -181,6 +266,42 @@ class DashboardController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$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);
|
||||||
|
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getDashboardNotifications()
|
public function getDashboardNotifications()
|
||||||
{
|
{
|
||||||
// Pull notifications for the dashboard, especially for file upload cases.
|
// Pull notifications for the dashboard, especially for file upload cases.
|
||||||
@ -243,7 +364,7 @@ class DashboardController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$myLogger->logme('error', 'enrollment_status function completed');
|
$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([
|
return $this->respond([
|
||||||
'status' => true,
|
'status' => true,
|
||||||
@ -253,7 +374,6 @@ class DashboardController extends AdminController
|
|||||||
'open_policy_ids' => $openEnrollment,
|
'open_policy_ids' => $openEnrollment,
|
||||||
'close_policy_ids' => $closeEnrollment,
|
'close_policy_ids' => $closeEnrollment,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendCroneRemainderMail()
|
public function sendCroneRemainderMail()
|
||||||
@ -271,9 +391,9 @@ class DashboardController extends AdminController
|
|||||||
|
|
||||||
$myLogger->logme('error', 'sendCroneRemainderMail function completed');
|
$myLogger->logme('error', 'sendCroneRemainderMail function completed');
|
||||||
|
|
||||||
if($result){
|
if ($result) {
|
||||||
return json_encode(['status' => true, 'message' => 'Mail send successfully']);
|
return json_encode(['status' => true, 'message' => 'Mail send successfully']);
|
||||||
}else{
|
} else {
|
||||||
return json_encode(['status' => false, 'message' => 'There is no data to send']);
|
return json_encode(['status' => false, 'message' => 'There is no data to send']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -285,29 +405,22 @@ class DashboardController extends AdminController
|
|||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
if($type == 'insurer'){
|
if ($type == 'insurer') {
|
||||||
|
|
||||||
$data = $pendingActionsData['uhid'];
|
$data = $pendingActionsData['uhid'];
|
||||||
|
} else if ($type == 'TPA') {
|
||||||
}else if($type == 'TPA'){
|
|
||||||
$data = $pendingActionsData['tpa'];
|
$data = $pendingActionsData['tpa'];
|
||||||
|
} else if ($type == 'I') {
|
||||||
}else if($type == 'I'){
|
|
||||||
$data = $pendingActionsData['inception'];
|
$data = $pendingActionsData['inception'];
|
||||||
|
} else if ($type == 'D') {
|
||||||
}else if($type == 'D'){
|
|
||||||
$data = $pendingActionsData['deletion'];
|
$data = $pendingActionsData['deletion'];
|
||||||
|
} else if ($type == 'C') {
|
||||||
}else if($type == 'C'){
|
|
||||||
$data = $pendingActionsData['correction'];
|
$data = $pendingActionsData['correction'];
|
||||||
|
} else if ($type == 'SI') {
|
||||||
}else if($type == 'SI'){
|
|
||||||
$data = $pendingActionsData['si_enhancement'];
|
$data = $pendingActionsData['si_enhancement'];
|
||||||
|
} else if ($type == 'policy') {
|
||||||
}else if($type == 'policy'){
|
|
||||||
$data = $pendingActionsData['policy'];
|
$data = $pendingActionsData['policy'];
|
||||||
|
} else if ($type == 'ticket') {
|
||||||
}else if($type == 'ticket'){
|
|
||||||
$data = $pendingActionsData['uhid'];
|
$data = $pendingActionsData['uhid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,7 +534,6 @@ class DashboardController extends AdminController
|
|||||||
$reminder_whole_mail[] = $mail_result;
|
$reminder_whole_mail[] = $mail_result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else { // crone
|
} else { // crone
|
||||||
|
|
||||||
if (!empty($client_policy['reminder_date'])) {
|
if (!empty($client_policy['reminder_date'])) {
|
||||||
@ -511,15 +623,12 @@ class DashboardController extends AdminController
|
|||||||
// $this->myLogger->logme('error', 'Mail sent result: ' . json_encode($mail_result));
|
// $this->myLogger->logme('error', 'Mail sent result: ' . json_encode($mail_result));
|
||||||
$reminder_whole_mail[] = $mail_result;
|
$reminder_whole_mail[] = $mail_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->myLogger->logme('error', "SEND REMAINDER CRONE --- Remainder date is empty()");
|
$this->myLogger->logme('error', "SEND REMAINDER CRONE --- Remainder date is empty()");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'Notification setup not found or not enabled');
|
$this->myLogger->logme('error', 'Notification setup not found or not enabled');
|
||||||
@ -549,7 +658,7 @@ class DashboardController extends AdminController
|
|||||||
|
|
||||||
public function sendManualReminder($client_id, $client_branch_id, $client_policy_id = null)
|
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}");
|
$this->myLogger->logme('error', "sendManualRemainder called with client_id: {$client_id}, client_branch_id: {$client_branch_id}");
|
||||||
|
|
||||||
@ -560,8 +669,8 @@ class DashboardController extends AdminController
|
|||||||
|
|
||||||
if ($client_policy_data) {
|
if ($client_policy_data) {
|
||||||
$result = $this->sendRemainderMail($client_policy_data);
|
$result = $this->sendRemainderMail($client_policy_data);
|
||||||
log_message('error',json_encode($result));
|
log_message('error', json_encode($result));
|
||||||
$this->myLogger->logme('error',$result);
|
$this->myLogger->logme('error', $result);
|
||||||
$this->myLogger->logme('error', "Manual Remainder Mail sending result: " . ($result ? 'success' : 'failure'));
|
$this->myLogger->logme('error', "Manual Remainder Mail sending result: " . ($result ? 'success' : 'failure'));
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
@ -569,9 +678,8 @@ class DashboardController extends AdminController
|
|||||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Mail sent successfully'], 200);
|
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Mail sent successfully'], 200);
|
||||||
} else {
|
} else {
|
||||||
$this->myLogger->logme('error', 'Failed to send manual remainder mail, no data to send');
|
$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 {
|
} else {
|
||||||
$this->myLogger->logme('error', 'No policy data found to send');
|
$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);
|
return $this->respond(['status' => false, 'code' => 200, 'message' => 'There is no data to send', 'message2' => 'No policy data found to send'], 200);
|
||||||
@ -584,16 +692,14 @@ class DashboardController extends AdminController
|
|||||||
|
|
||||||
$notification = $this->notificationModel->where('client_id', $client_id)->where('template_name', 'member_ecard_mail')->first();
|
$notification = $this->notificationModel->where('client_id', $client_id)->where('template_name', 'member_ecard_mail')->first();
|
||||||
// print_r(($notification)); die;
|
// print_r(($notification)); die;
|
||||||
if($notification && $notification['enabled'] == 0 && $notification['mail_content'] == '')
|
if ($notification && $notification['enabled'] == 0 && $notification['mail_content'] == '') {
|
||||||
{
|
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No template found', 'message2' => 'Failed'], 200);
|
||||||
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No template found','message2' => 'Failed' ], 200);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$emp_data = $this->employeePolicyModel->getEmployeePolicyForEcard($policy_id);
|
$emp_data = $this->employeePolicyModel->getEmployeePolicyForEcard($policy_id);
|
||||||
if(count($emp_data) == 0)
|
if (count($emp_data) == 0) {
|
||||||
{
|
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No employees found', 'message2' => 'Failed'], 200);
|
||||||
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No employees found','message2' => 'Failed' ], 200);
|
|
||||||
}
|
}
|
||||||
$ids = array_column($emp_data, 'id');
|
$ids = array_column($emp_data, 'id');
|
||||||
// print_r(($ids)); die;
|
// print_r(($ids)); die;
|
||||||
@ -605,7 +711,6 @@ class DashboardController extends AdminController
|
|||||||
|
|
||||||
|
|
||||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Mail Queued'], 200);
|
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Mail Queued'], 200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function data_construct_for_bds($data)
|
public function data_construct_for_bds($data)
|
||||||
@ -659,4 +764,22 @@ class DashboardController extends AdminController
|
|||||||
return $groupedData;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -529,6 +529,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
// Close and remove temporary file
|
// Close and remove temporary file
|
||||||
fclose($tempFile);
|
fclose($tempFile);
|
||||||
|
exit();
|
||||||
|
|
||||||
return true; // Excel file successfully generated and exported
|
return true; // Excel file successfully generated and exported
|
||||||
|
|
||||||
@ -633,6 +634,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
// Close and remove the temporary file
|
// Close and remove the temporary file
|
||||||
fclose($tempFile);
|
fclose($tempFile);
|
||||||
|
exit();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -784,6 +786,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
// Close and remove the temporary file
|
// Close and remove the temporary file
|
||||||
fclose($tempFile);
|
fclose($tempFile);
|
||||||
|
exit();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -897,6 +900,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
// Close and remove the temporary file
|
// Close and remove the temporary file
|
||||||
fclose($tempFile);
|
fclose($tempFile);
|
||||||
|
exit();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -1196,6 +1200,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
// Close and remove temporary file
|
// Close and remove temporary file
|
||||||
fclose($tempFile);
|
fclose($tempFile);
|
||||||
|
exit();
|
||||||
|
|
||||||
return true; // Excel file successfully generated and exported
|
return true; // Excel file successfully generated and exported
|
||||||
|
|
||||||
@ -4105,6 +4110,9 @@ class EmpDataServiceController extends BaseController
|
|||||||
AND emp_endorsement.pk IN (" . implode(',', $arrayData['employeeIds']) . ")
|
AND emp_endorsement.pk IN (" . implode(',', $arrayData['employeeIds']) . ")
|
||||||
AND employee_polices.claim_status = 0
|
AND employee_polices.claim_status = 0
|
||||||
AND emp_endorsement.field_name = 'date_of_exit'
|
AND emp_endorsement.field_name = 'date_of_exit'
|
||||||
|
AND emp_endorsement.is_active = 1
|
||||||
|
AND emp_endorsement.actions = 'd'
|
||||||
|
AND emp_endorsement.status != 'truncated';
|
||||||
")->getRow();
|
")->getRow();
|
||||||
|
|
||||||
// dd(db_connect()->getLastQuery(), $amount);
|
// dd(db_connect()->getLastQuery(), $amount);
|
||||||
|
|||||||
@ -28,6 +28,9 @@ use App\Controllers\JobWorker ;
|
|||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
use Kint\Kint;
|
use Kint\Kint;
|
||||||
|
|
||||||
|
use App\Helpers\ExcelSanitizeHelper;
|
||||||
|
|
||||||
|
|
||||||
class EmployeeServiceController extends AdminController
|
class EmployeeServiceController extends AdminController
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -468,7 +471,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
'format' => null,
|
'format' => null,
|
||||||
'allowed_values' => null,
|
'allowed_values' => null,
|
||||||
'custom' => 'check_si',
|
'custom' => 'check_si',
|
||||||
'params' => ['row', 'policy_terms', 'slab_details']
|
'params' => ['row', 'policy_details', 'slab_details']
|
||||||
],
|
],
|
||||||
'date_of_enhancement' => [
|
'date_of_enhancement' => [
|
||||||
'col_idx' => 4,
|
'col_idx' => 4,
|
||||||
@ -1552,8 +1555,10 @@ class EmployeeServiceController extends AdminController
|
|||||||
if($pre_rack_rate_name != $slab_value['rack_rate_name'])
|
if($pre_rack_rate_name != $slab_value['rack_rate_name'])
|
||||||
{
|
{
|
||||||
$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']);
|
$rack_rate_json = json_decode($slab_value['additional_relationship'], true);
|
||||||
if(in_array(strtolower($employee['relationship']), $rack_rate_json) && $rack_rate_json[ strtolower($employee['relationship']) ] != 0 && $rack_rate_json[ strtolower($employee['relationship']) ] != 'NA')
|
$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_name = $slab_value['rack_rate_name'];
|
||||||
$applicable_rack_rate_master = $slab_value['grid_master'];
|
$applicable_rack_rate_master = $slab_value['grid_master'];
|
||||||
@ -1658,6 +1663,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
// $this->myLogger->logme('error',('Insert - ' . $value['emp_code'] .' - '. $value['name']));
|
// $this->myLogger->logme('error',('Insert - ' . $value['emp_code'] .' - '. $value['name']));
|
||||||
// echo 'update emp';
|
// echo 'update emp';
|
||||||
}
|
}
|
||||||
|
$value = ExcelSanitizeHelper::sanitizeArrayData($value);
|
||||||
$this->employeeModel->save($value);
|
$this->employeeModel->save($value);
|
||||||
if (isset($value['id'])) {
|
if (isset($value['id'])) {
|
||||||
$emp_id = $value['id'];
|
$emp_id = $value['id'];
|
||||||
@ -2082,6 +2088,7 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
|||||||
$log_message = 'Enrollment Insert Employee- '.$value['name'] .'('.$value['emp_code'] .') with PK ';
|
$log_message = 'Enrollment Insert Employee- '.$value['name'] .'('.$value['emp_code'] .') with PK ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$value = ExcelSanitizeHelper::sanitizeArrayData($value);
|
||||||
$this->employeeModel->save($value);
|
$this->employeeModel->save($value);
|
||||||
if (isset($value['id']))
|
if (isset($value['id']))
|
||||||
{ $emp_id = $value['id']; }
|
{ $emp_id = $value['id']; }
|
||||||
|
|||||||
@ -146,21 +146,38 @@ class LeadsController extends BaseController
|
|||||||
$this->loadLayout('lead_filter', $data);
|
$this->loadLayout('lead_filter', $data);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
$isFromDashboard = $this->request->getPost("is_dashboard");
|
||||||
|
|
||||||
|
if (isset($isFromDashboard) && !empty($isFromDashboard) && $isFromDashboard == 1) {
|
||||||
|
$ids = $this->request->getPost('ids');
|
||||||
|
$ids = array_filter(explode(',', $ids));
|
||||||
|
|
||||||
|
if (!empty($ids)) {
|
||||||
|
$idsStr = implode(',', array_map('intval', $ids)); // sanitize IDs to be integers
|
||||||
|
$where = "leads.id IN ($idsStr)";
|
||||||
|
} else {
|
||||||
|
$where = '1 = 0'; // No valid IDs, return empty result
|
||||||
|
}
|
||||||
|
// dd($where );
|
||||||
|
$data['lead_data_list'] = $this->leadsModel->getLeadDataForLising($where);
|
||||||
|
$this->loadLayout('lead_filter', $data);
|
||||||
|
} else {
|
||||||
$search_data = $this->request->getPost();
|
$search_data = $this->request->getPost();
|
||||||
// print_r($search_data);
|
|
||||||
|
|
||||||
$where = [];
|
$where = [];
|
||||||
foreach ($search_data as $search_objects => $key) {
|
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;
|
$where[$search_objects] = $key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['lead_data_list'] = $this->leadsModel->getLeadDataForLising($where);
|
$data['lead_data_list'] = $this->leadsModel->getLeadDataForLising($where);
|
||||||
|
|
||||||
$html = view('leads_list', $data);
|
$html = view('leads_list', $data);
|
||||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function createLead()
|
public function createLead()
|
||||||
{
|
{
|
||||||
@ -678,11 +695,10 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
";
|
";
|
||||||
|
|
||||||
if ($data['lead_data']['policy_end_date'] != null){
|
if ($data['lead_data']['policy_end_date'] != null) {
|
||||||
$subject = "{{CLIENT_NAME}} _ {{POLICY_TYPE}} _ {{RFQ_OR_QCR}} _ {{POLICY_YEAR}} {{POLICY_END_DATE}}";
|
$subject = "{{CLIENT_NAME}} _ {{POLICY_TYPE}} _ {{RFQ_OR_QCR}} _ {{POLICY_YEAR}} {{POLICY_END_DATE}}";
|
||||||
}else{
|
} else {
|
||||||
$subject = "{{CLIENT_NAME}} _ {{POLICY_TYPE}} _ {{RFQ_OR_QCR}} _ {{POLICY_YEAR}}";
|
$subject = "{{CLIENT_NAME}} _ {{POLICY_TYPE}} _ {{RFQ_OR_QCR}} _ {{POLICY_YEAR}}";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['mail_content'] = $this->transformMailContent($lead_data, $mail_content, $data['page_name']);
|
$data['mail_content'] = $this->transformMailContent($lead_data, $mail_content, $data['page_name']);
|
||||||
@ -690,7 +706,7 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
$data['multi_file_data'] = $this->leadFilesModel->where('lead_id', $id)->where('is_active', 1)->findAll() ?? null;
|
$data['multi_file_data'] = $this->leadFilesModel->where('lead_id', $id)->where('is_active', 1)->findAll() ?? null;
|
||||||
$data['attachment_html'] = view('rfq/attachment_files', $data) ?? "";
|
$data['attachment_html'] = view('rfq/attachment_files', $data) ?? "";
|
||||||
$data['user_team'] = $this->userModel->select("ut.team_id")->join("user_teams ut","ut.user_id = user_profiles.id and ut.is_active = 1")->where("user_profiles.is_active",1)->first()['team_id'];
|
$data['user_team'] = $this->userModel->select("ut.team_id")->join("user_teams ut", "ut.user_id = user_profiles.id and ut.is_active = 1")->where("user_profiles.is_active", 1)->first()['team_id'];
|
||||||
// dd($data);
|
// dd($data);
|
||||||
|
|
||||||
if ($data['lead_data']['lead_form_type'] == 1) {
|
if ($data['lead_data']['lead_form_type'] == 1) {
|
||||||
@ -866,7 +882,7 @@ class LeadsController extends BaseController
|
|||||||
if ($subKey !== 'Quote Asked' && isset($subVal['Total'])) {
|
if ($subKey !== 'Quote Asked' && isset($subVal['Total'])) {
|
||||||
$proposals[$key] = $value;
|
$proposals[$key] = $value;
|
||||||
break;
|
break;
|
||||||
}else{
|
} else {
|
||||||
$proposals[$key] = $value;
|
$proposals[$key] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1554,15 +1570,14 @@ class LeadsController extends BaseController
|
|||||||
$next_year = $current_year + 1;
|
$next_year = $current_year + 1;
|
||||||
$policy_year = "$current_year-$next_year";
|
$policy_year = "$current_year-$next_year";
|
||||||
|
|
||||||
if (!empty($rfq_data['policy_end_date'])){
|
if (!empty($rfq_data['policy_end_date'])) {
|
||||||
$policy_expiry = strtotime($lead_data['policy_end_date']);
|
$policy_expiry = strtotime($lead_data['policy_end_date']);
|
||||||
|
|
||||||
$formatted_policy = date("d-m-Y",$policy_expiry);
|
$formatted_policy = date("d-m-Y", $policy_expiry);
|
||||||
|
|
||||||
$filename = "{$rfq_data['client_name']}_{$rfq_data['policy_type']}_{$string}_" .$policy_year.'(Due On '.$formatted_policy . ')' .'.xlsx';
|
$filename = "{$rfq_data['client_name']}_{$rfq_data['policy_type']}_{$string}_" . $policy_year . '(Due On ' . $formatted_policy . ')' . '.xlsx';
|
||||||
|
} else {
|
||||||
}else{
|
$filename = "{$rfq_data['client_name']}_{$rfq_data['policy_type']}_{$string}_" . $policy_year . '_' . '.xlsx';
|
||||||
$filename = "{$rfq_data['client_name']}_{$rfq_data['policy_type']}_{$string}_".$policy_year.'_' . '.xlsx';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2190,12 +2205,11 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
} else if ($recipient_type == 'client') {
|
} else if ($recipient_type == 'client') {
|
||||||
|
|
||||||
$mailIDS = explode(',',$params['contact_mail']);
|
$mailIDS = explode(',', $params['contact_mail']);
|
||||||
$recipient_data = [];
|
$recipient_data = [];
|
||||||
foreach ($mailIDS as $mail){
|
foreach ($mailIDS as $mail) {
|
||||||
$recipient_data[] = ['name' => $lead_data['contact_person_name'], 'email' => $mail];
|
$recipient_data[] = ['name' => $lead_data['contact_person_name'], 'email' => $mail];
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$recipient_data = [['name' => "Team", 'email' => $params['to']]];
|
$recipient_data = [['name' => "Team", 'email' => $params['to']]];
|
||||||
}
|
}
|
||||||
@ -2902,10 +2916,10 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
$policy_expiry = strtotime($lead_data['policy_end_date']);
|
$policy_expiry = strtotime($lead_data['policy_end_date']);
|
||||||
|
|
||||||
$formatted_policy = date("d-m-Y",$policy_expiry);
|
$formatted_policy = date("d-m-Y", $policy_expiry);
|
||||||
$logged_user_id = get_session_userid();
|
$logged_user_id = get_session_userid();
|
||||||
|
|
||||||
$logged_user_data = $this->userModel->where("id",$logged_user_id)->where("is_active",1)->first();
|
$logged_user_data = $this->userModel->where("id", $logged_user_id)->where("is_active", 1)->first();
|
||||||
|
|
||||||
if ($lead_data) {
|
if ($lead_data) {
|
||||||
|
|
||||||
@ -2916,11 +2930,11 @@ class LeadsController extends BaseController
|
|||||||
$message = str_replace("{{POLICY_TYPE}}", $lead_data['policy_type'] ?? "Insurance Policy", $message);
|
$message = str_replace("{{POLICY_TYPE}}", $lead_data['policy_type'] ?? "Insurance Policy", $message);
|
||||||
$message = str_replace("{{RFQ_OR_QCR}}", $page_name, $message);
|
$message = str_replace("{{RFQ_OR_QCR}}", $page_name, $message);
|
||||||
$message = str_replace("{{POLICY_YEAR}}", $policy_year, $message);
|
$message = str_replace("{{POLICY_YEAR}}", $policy_year, $message);
|
||||||
$message = str_replace("{{POLICY_END_DATE}}"," (Due On ".$formatted_policy.")",$message);
|
$message = str_replace("{{POLICY_END_DATE}}", " (Due On " . $formatted_policy . ")", $message);
|
||||||
|
|
||||||
$message = str_replace("{{LOGGED_USER_NAME}}",ucfirst($logged_user_data['first_name'])." ".ucfirst($logged_user_data['last_name']),$message);
|
$message = str_replace("{{LOGGED_USER_NAME}}", ucfirst($logged_user_data['first_name']) . " " . ucfirst($logged_user_data['last_name']), $message);
|
||||||
$message = str_replace("{{LOGGED_USER_EMAIL}}",$logged_user_data['email'],$message);
|
$message = str_replace("{{LOGGED_USER_EMAIL}}", $logged_user_data['email'], $message);
|
||||||
$message = str_replace("{{LOGGED_USER_MOBILE}}",$logged_user_data['mobile'],$message);
|
$message = str_replace("{{LOGGED_USER_MOBILE}}", $logged_user_data['mobile'], $message);
|
||||||
|
|
||||||
return $message;
|
return $message;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -1422,11 +1422,12 @@ class MasterController extends AdminController
|
|||||||
if ($insert) {
|
if ($insert) {
|
||||||
|
|
||||||
//for CD Tranction Table
|
//for CD Tranction Table
|
||||||
|
$cd_tranction_data['cd_ac_pk'] = $this->CDMasterModel->insertID();
|
||||||
$response = DepositHelper::saveDeposit($cd_tranction_data, $loggedInUserID);
|
$response = DepositHelper::saveDeposit($cd_tranction_data, $loggedInUserID);
|
||||||
|
|
||||||
$cd_data = $this->CDMasterModel->where('client_id', $data['client_id'])->where('insurer_id', $data['insurer_id'])->findAll();
|
$cd_data = $this->CDMasterModel->where('client_id', $data['client_id'])->where('insurer_id', $data['insurer_id'])->findAll();
|
||||||
|
|
||||||
return $this->respond(['status' => true, 'data' => $cd_data, 'cd_ac_no'=>$data['cd_ac_no'], 'message' => 'CD Account number created successfully'], 200);
|
return $this->respond(['status' => true, 'data' => $cd_data, 'cd_ac_no'=>$data['cd_ac_no'], 'message' => 'CD Account number created successfully', "FOR BDS PURPOSE"], 200);
|
||||||
}else{
|
}else{
|
||||||
return $this->respond(['status' => false, 'message' => 'Failed to created CD Account number'], 200);
|
return $this->respond(['status' => false, 'message' => 'Failed to created CD Account number'], 200);
|
||||||
}
|
}
|
||||||
@ -1828,4 +1829,22 @@ class MasterController extends AdminController
|
|||||||
echo "################################################################\n\n";
|
echo "################################################################\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sendMutipleToEmails()
|
||||||
|
{
|
||||||
|
|
||||||
|
$message = '<style>body{font-family:Arial,sans-serif;color:#333;line-height:1.6;margin:0;padding:0}.email-container{width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9}.header{background-color:#4a90e2;color:#fff;padding:15px;text-align:center}.header h1{margin:0;font-size:24px}.content{padding:20px;background-color:#fff}.content h2{color:#4a90e2;font-size:20px;margin-top:0}.content p{margin:10px 0}.details-table{width:100%;border-collapse:collapse;margin-top:20px}.details-table td,.details-table th{border:1px solid #ddd;padding:10px;text-align:left}.details-table th{background-color:#f2f2f2}.footer{margin-top:20px;font-size:12px;color:#777;text-align:center}.attachment-note{margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic}</style><div class=email-container><div class=header><h1>Request for Quotation (RFQ)</h1></div><div class=content><h2>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2>RFQ Details</h2><table class=details-table><tr><th>Client name<td>{{CLIENT_NAME}}<tr><th>Coverage Type<td>{{POLICY_LONG_NAME}}<tr><th>Policy Start Date<td>{{POLICY_START_DATE}}<tr><th>Policy Duration<td>{{DURATION}}</table><div class=attachment-note>Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div class=footer><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
|
||||||
|
$attachments = [
|
||||||
|
["filePath" => ROOTPATH."public/sample_excel/sample_addition.xls","fileName" => "sample_addition.xls"],
|
||||||
|
["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"],
|
||||||
|
["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"]
|
||||||
|
];
|
||||||
|
$email_id = 'venkateshraman786@gmail.com';
|
||||||
|
$params = ['mail'=>$email_id];
|
||||||
|
$multi_mails = ['venkateshraman786@gmail.com', 'gowtham.manavalan.la@gmail.com', 'venkatesh.r@venbainfotech.com'];
|
||||||
|
$common = ['mail_type'=>'test_mail_cli'];
|
||||||
|
$bcc = "vitvelz@gmail.com,velmurugan.s@venbainfotech.com,srinivas.saravanan@venbainfotech.com";
|
||||||
|
$result = MailHelper::send_email(['mail' => $multi_mails, 'bcc'=>$bcc, 'params'=>$params,'subject' => 'Send Multiple " To " emails','message' => $message,'attachments' => $attachments,'common'=>$common]);
|
||||||
|
dd($result);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@ -122,6 +122,7 @@ class TicketController extends BaseController
|
|||||||
'((CLAIM_FORM_LINK))' => 'claim_form_link',
|
'((CLAIM_FORM_LINK))' => 'claim_form_link',
|
||||||
'((CLAIM_FEEDBACK_FORM))' => 'claim_feedback_form',
|
'((CLAIM_FEEDBACK_FORM))' => 'claim_feedback_form',
|
||||||
'((SETTLED_LETTER))' => 'settle_letter',
|
'((SETTLED_LETTER))' => 'settle_letter',
|
||||||
|
'((APPROVED_LETTER))' => 'approved_letter',
|
||||||
];
|
];
|
||||||
$this->extraFields = [
|
$this->extraFields = [
|
||||||
1 => ['non_id_reason'],
|
1 => ['non_id_reason'],
|
||||||
@ -180,49 +181,59 @@ class TicketController extends BaseController
|
|||||||
return $this->loadLayout('ticket_search', $data);
|
return $this->loadLayout('ticket_search', $data);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
$isFromDashboard = $this->request->getPost("is_dashboard");
|
||||||
|
|
||||||
|
if (isset($isFromDashboard) && !empty($isFromDashboard) && $isFromDashboard == 1) {
|
||||||
|
$data['page_name'] = "Claims";
|
||||||
|
$data['ticket_data'] = $this->ticketSearch(3);
|
||||||
|
$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{
|
||||||
$data['ticket_data'] = $this->ticketSearch();
|
$data['ticket_data'] = $this->ticketSearch();
|
||||||
$html = view('ticket_list', $data);
|
$html = view('ticket_list', $data);
|
||||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ticketSearch($action = null)
|
public function ticketSearch($action = null)
|
||||||
{
|
{
|
||||||
$db = db_connect();
|
$db = db_connect();
|
||||||
|
|
||||||
$subquery = $db->table('ticket_history th')
|
$subquery = $db->table('ticket_master tm')
|
||||||
->select([
|
->select([
|
||||||
'th.ticket_id',
|
'tm.id AS ticket_id',
|
||||||
"CASE
|
"CASE
|
||||||
WHEN DATEDIFF(
|
WHEN DATEDIFF(
|
||||||
th.created_at,
|
CURDATE(),
|
||||||
COALESCE(
|
COALESCE(latest_history.created_at, tm.created_at)
|
||||||
(SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = th.ticket_id),
|
|
||||||
tm.created_at
|
|
||||||
)
|
|
||||||
) BETWEEN 0 AND 6 THEN '0-6 Days'
|
) BETWEEN 0 AND 6 THEN '0-6 Days'
|
||||||
WHEN DATEDIFF(
|
WHEN DATEDIFF(
|
||||||
th.created_at,
|
CURDATE(),
|
||||||
COALESCE(
|
COALESCE(latest_history.created_at, tm.created_at)
|
||||||
(SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = th.ticket_id),
|
|
||||||
tm.created_at
|
|
||||||
)
|
|
||||||
) BETWEEN 7 AND 12 THEN '7-12 Days'
|
) BETWEEN 7 AND 12 THEN '7-12 Days'
|
||||||
WHEN DATEDIFF(
|
WHEN DATEDIFF(
|
||||||
th.created_at,
|
CURDATE(),
|
||||||
COALESCE(
|
COALESCE(latest_history.created_at, tm.created_at)
|
||||||
(SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = th.ticket_id),
|
|
||||||
tm.created_at
|
|
||||||
)
|
|
||||||
) BETWEEN 13 AND 20 THEN '13-20 Days'
|
) BETWEEN 13 AND 20 THEN '13-20 Days'
|
||||||
ELSE 'Above 20 Days'
|
ELSE 'Above 20 Days'
|
||||||
END AS tat"
|
END AS tat"
|
||||||
])
|
])
|
||||||
->join('ticket_master tm', 'tm.id = th.ticket_id', 'right')
|
->join(
|
||||||
|
'(SELECT th.ticket_id, MAX(th.created_at) AS created_at
|
||||||
|
FROM ticket_history th
|
||||||
|
WHERE th.field_name = "claim_status_id"
|
||||||
|
GROUP BY th.ticket_id) AS latest_history',
|
||||||
|
'latest_history.ticket_id = tm.id',
|
||||||
|
'left'
|
||||||
|
)
|
||||||
->where('tm.is_active', 1)
|
->where('tm.is_active', 1)
|
||||||
->groupBy('th.ticket_id, tm.created_at');
|
->groupBy('tm.id, tm.created_at, latest_history.created_at');
|
||||||
|
|
||||||
//action 1 get last 100 rows, action 2 filter and get all rows related to that
|
|
||||||
|
//action 1 get last 100 rows, action 2 filter and get all rows related to that and action 3 gets according to dashboard
|
||||||
if ($action == 1) {
|
if ($action == 1) {
|
||||||
|
|
||||||
$query = $db->table('ticket_master tm')
|
$query = $db->table('ticket_master tm')
|
||||||
@ -257,16 +268,30 @@ class TicketController extends BaseController
|
|||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
|
||||||
|
}else if ($action == 3) {
|
||||||
|
$ids = $this->request->getPost('ids');
|
||||||
|
$ids = array_filter(explode(',', $ids));
|
||||||
|
|
||||||
|
if (!empty($ids)) {
|
||||||
|
$idsStr = implode(',', array_map('intval', $ids)); // sanitize IDs to be integers
|
||||||
|
$where = "tm.id IN ($idsStr)";
|
||||||
|
} else {
|
||||||
|
$where = '1 = 0'; // No valid IDs, return empty result
|
||||||
|
}
|
||||||
|
// dd($where);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$search_data = $this->request->getPost();
|
$search_data = $this->request->getPost();
|
||||||
// print_r($search_data);
|
// print_r($search_data); die()
|
||||||
$where = [];
|
$where = [];
|
||||||
foreach ($search_data as $search_objects => $key) {
|
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;
|
$where[$search_objects] = $key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// print_rr($where);
|
// print_rr($where);
|
||||||
|
|
||||||
|
}
|
||||||
$query = $db->table('ticket_master tm')
|
$query = $db->table('ticket_master tm')
|
||||||
->select([
|
->select([
|
||||||
'tm.id',
|
'tm.id',
|
||||||
@ -301,7 +326,6 @@ class TicketController extends BaseController
|
|||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function ticket_form($ticket_type)
|
public function ticket_form($ticket_type)
|
||||||
{
|
{
|
||||||
@ -867,24 +891,24 @@ class TicketController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Construct Mail Data
|
// Construct Mail Data
|
||||||
$mailData[] = [
|
$mailData = [
|
||||||
'mail' => $ticket_data['emp_mail'],
|
'mail' => [$ticket_data['emp_mail'], $ticket_data['emp_personal_mail'] ?? ""],
|
||||||
'subject' => $subject,
|
'subject' => $subject,
|
||||||
'message' => $message,
|
'message' => $message,
|
||||||
'cc' => $ticket_data['common_mails'] ?? '',
|
'cc' => $ticket_data['common_mails'] ?? '',
|
||||||
'attachments' => []
|
'attachments' => []
|
||||||
];
|
];
|
||||||
|
|
||||||
// if the employee personal mail is not empty then send the mail to the employee personal mail
|
// // if the employee personal mail is not empty then send the mail to the employee personal mail
|
||||||
if(!empty($ticket_data['emp_personal_mail'])){
|
// if(!empty($ticket_data['emp_personal_mail'])){
|
||||||
$mailData[] = [
|
// $mailData[] = [
|
||||||
'mail' => $ticket_data['emp_personal_mail'],
|
// 'mail' => [$ticket_data['emp_mail'], $ticket_data['emp_personal_mail'] ?? ""],
|
||||||
'subject' => $subject,
|
// 'subject' => $subject,
|
||||||
'message' => $message,
|
// 'message' => $message,
|
||||||
'cc' => $ticket_data['common_mails'] ?? '',
|
// 'cc' => $ticket_data['common_mails'] ?? '',
|
||||||
'attachments' => []
|
// 'attachments' => []
|
||||||
];
|
// ];
|
||||||
}
|
// }
|
||||||
|
|
||||||
// print_r($mailData); die;
|
// print_r($mailData); die;
|
||||||
|
|
||||||
@ -914,6 +938,8 @@ class TicketController extends BaseController
|
|||||||
$replaceData = '<a href="' . base_url('claims-feedback-form/' . md5($ticket_data['id'])) . '" target="_blank">Click to open Claim Feedback Form</a>';
|
$replaceData = '<a href="' . base_url('claims-feedback-form/' . md5($ticket_data['id'])) . '" target="_blank">Click to open Claim Feedback Form</a>';
|
||||||
} else if ($value == "settle_letter"){
|
} else if ($value == "settle_letter"){
|
||||||
$replaceData = '<a href="' . $ticket_data['settle_letter'] . '" target="_blank"> View Settlement Letter </a>';
|
$replaceData = '<a href="' . $ticket_data['settle_letter'] . '" target="_blank"> View Settlement Letter </a>';
|
||||||
|
}else if ($value == "approved_letter"){
|
||||||
|
$replaceData = '<a href="' . $ticket_data['approved_letter'] . '" target="_blank"> View Approved Letter </a>';
|
||||||
}else {
|
}else {
|
||||||
$replaceData = isset($ticket_data[$value]) ? $ticket_data[$value] : '';
|
$replaceData = isset($ticket_data[$value]) ? $ticket_data[$value] : '';
|
||||||
}
|
}
|
||||||
@ -973,28 +999,28 @@ class TicketController extends BaseController
|
|||||||
$this->myLogger->logme('error', "Fetched ACM emails");
|
$this->myLogger->logme('error', "Fetched ACM emails");
|
||||||
|
|
||||||
|
|
||||||
if(!empty($ticket_data['emp_personal_mail'])){
|
// if(!empty($ticket_data['emp_personal_mail'])){
|
||||||
|
|
||||||
$this->myLogger->logme('error', "Send employee personal mail start");
|
// $this->myLogger->logme('error', "Send employee personal mail start");
|
||||||
|
|
||||||
$emailPersonalData = [
|
// $emailPersonalData = [
|
||||||
'mail' => $ticket_data['emp_personal_mail'],
|
// 'mail' => $ticket_data['emp_personal_mail'],
|
||||||
'subject' => $mail_data['mail_subject'],
|
// 'subject' => $mail_data['mail_subject'],
|
||||||
'message' => $mail_data['mail_content'],
|
// 'message' => $mail_data['mail_content'],
|
||||||
'common' => [],
|
// 'common' => [],
|
||||||
'cc' => $acm_mails['common_mails'],
|
// 'cc' => $acm_mails['common_mails'],
|
||||||
'attachments' => []
|
// 'attachments' => []
|
||||||
];
|
// ];
|
||||||
|
|
||||||
$this->sendTrigger($emailPersonalData);
|
// $this->sendTrigger($emailPersonalData);
|
||||||
|
|
||||||
$this->myLogger->logme('error', "Send employee personal mail successfully");
|
// $this->myLogger->logme('error', "Send employee personal mail successfully");
|
||||||
}else{
|
// }else{
|
||||||
$this->myLogger->logme('error', "Send employee personal mail is empty");
|
// $this->myLogger->logme('error', "Send employee personal mail is empty");
|
||||||
}
|
// }
|
||||||
|
|
||||||
$emailData = [
|
$emailData = [
|
||||||
'mail' => $mail_data['emp_mail'],
|
'mail' => [$mail_data['emp_mail'], $ticket_data['emp_personal_mail'] ?? ""],
|
||||||
'subject' => $mail_data['mail_subject'],
|
'subject' => $mail_data['mail_subject'],
|
||||||
'message' => $mail_data['mail_content'],
|
'message' => $mail_data['mail_content'],
|
||||||
'common' => [],
|
'common' => [],
|
||||||
@ -1016,10 +1042,11 @@ class TicketController extends BaseController
|
|||||||
if (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 1) {
|
if (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 1) {
|
||||||
$mail_content = $this->constructMailContent($ticket_id);
|
$mail_content = $this->constructMailContent($ticket_id);
|
||||||
// print_r($mail_content); die;
|
// print_r($mail_content); die;
|
||||||
foreach ($mail_content as $key => $value) {
|
// foreach ($mail_content as $key => $value) {
|
||||||
$mail_responce = $this->sendTrigger($value);
|
$mail_responce = $this->sendTrigger($mail_content);
|
||||||
$this->myLogger->logme('error', '{data} - Auto Mail Sent, Successfully', ['data' => $key + 1]);
|
// $this->myLogger->logme('error', '{data} - Auto Mail Sent, Successfully', ['data' => $key + 1]);
|
||||||
}
|
$this->myLogger->logme('error', 'Auto Mail Sent, Successfully');
|
||||||
|
// }
|
||||||
} elseif (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 0) {
|
} elseif (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 0) {
|
||||||
$this->myLogger->logme('error', 'Auto Mail Not Sent, Reason: Automail Not Enabled');
|
$this->myLogger->logme('error', 'Auto Mail Not Sent, Reason: Automail Not Enabled');
|
||||||
} else {
|
} else {
|
||||||
@ -1236,7 +1263,7 @@ class TicketController extends BaseController
|
|||||||
if ($policy_type == 1){
|
if ($policy_type == 1){
|
||||||
$viewData['column_order'] = [
|
$viewData['column_order'] = [
|
||||||
'ACM_NAME', 'ID NOT GENERATED', 'NON ID', 'CDA', 'INFORMATION REQUIRED',
|
'ACM_NAME', 'ID NOT GENERATED', 'NON ID', 'CDA', 'INFORMATION REQUIRED',
|
||||||
'UNDER PROCESS - CLAIM NO. UPDATION', 'UNDER PROCESS - INVESTIGATION STATUS',
|
'UNDER PROCESS - CLAIM NO. UPDATION',
|
||||||
'UNDER PROCESS - QUERY DOCUMENT RECEIVED', 'APPROVED', 'PAYMENT INITIATED',
|
'UNDER PROCESS - QUERY DOCUMENT RECEIVED', 'APPROVED', 'PAYMENT INITIATED',
|
||||||
'TOTAL'
|
'TOTAL'
|
||||||
];
|
];
|
||||||
@ -1255,7 +1282,7 @@ class TicketController extends BaseController
|
|||||||
}else{
|
}else{
|
||||||
$viewData['column_order'] = [
|
$viewData['column_order'] = [
|
||||||
'ACM_NAME', 'CLAIM INTIMATION', 'INTIMATION TO INSURER', 'CLIENT PENDING',
|
'ACM_NAME', 'CLAIM INTIMATION', 'INTIMATION TO INSURER', 'CLIENT PENDING',
|
||||||
'INSURER PENDING','INVESTIGATION','APPROVED','ON HOLD','TOTAL', 'NOT COVERED',
|
'INSURER PENDING','INVESTIGATION','APPROVED','TOTAL', 'NOT COVERED',
|
||||||
'CLOSED', 'SETTLED', 'CLEARED_TOTAL'
|
'CLOSED', 'SETTLED', 'CLEARED_TOTAL'
|
||||||
];
|
];
|
||||||
$ordered_data = [];
|
$ordered_data = [];
|
||||||
@ -1277,7 +1304,7 @@ class TicketController extends BaseController
|
|||||||
|
|
||||||
$viewData['column_order'] = [
|
$viewData['column_order'] = [
|
||||||
'TPA_NAME', 'NON ID', 'ID NOT GENERATED', 'CDA', 'INFORMATION REQUIRED',
|
'TPA_NAME', 'NON ID', 'ID NOT GENERATED', 'CDA', 'INFORMATION REQUIRED',
|
||||||
'UNDER PROCESS - CLAIM NO. UPDATION', 'UNDER PROCESS - INVESTIGATION STATUS',
|
'UNDER PROCESS - CLAIM NO. UPDATION',
|
||||||
'UNDER PROCESS - QUERY DOCUMENT RECEIVED', 'APPROVED', 'PAYMENT INITIATED',
|
'UNDER PROCESS - QUERY DOCUMENT RECEIVED', 'APPROVED', 'PAYMENT INITIATED',
|
||||||
'TOTAL', 'SETTLED', 'CLOSED', 'CANCELLED', 'RETURNED', 'CLEARED_TOTAL'
|
'TOTAL', 'SETTLED', 'CLOSED', 'CANCELLED', 'RETURNED', 'CLEARED_TOTAL'
|
||||||
];
|
];
|
||||||
@ -1530,7 +1557,7 @@ class TicketController extends BaseController
|
|||||||
|
|
||||||
$sent_message_data['ticket_id'] = $ticket_id;
|
$sent_message_data['ticket_id'] = $ticket_id;
|
||||||
$sent_message_data['sender'] = 'staff';
|
$sent_message_data['sender'] = 'staff';
|
||||||
$sent_message_data['emp_mail'] = $mail_sent_status->data->params->mail;
|
$sent_message_data['emp_mail'] = isset($mail_sent_status->data->params->mail[0]) ? $mail_sent_status->data->params->mail[0] ?? null : $mail_sent_status->data->params->mail ?? null;
|
||||||
$sent_message_data['mail_subject'] = $mail_sent_status->data->params->subject;
|
$sent_message_data['mail_subject'] = $mail_sent_status->data->params->subject;
|
||||||
$sent_message_data['mail_content'] = $mail_sent_status->data->params->message;
|
$sent_message_data['mail_content'] = $mail_sent_status->data->params->message;
|
||||||
|
|
||||||
|
|||||||
87
app/Filters/AuthClientApi.php
Normal file
87
app/Filters/AuthClientApi.php
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Filters;
|
||||||
|
|
||||||
|
use CodeIgniter\Filters\FilterInterface;
|
||||||
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
|
||||||
|
use App\Helpers\ClientTokenHelper;
|
||||||
|
use App\Models\ClientApiModel;
|
||||||
|
use CodeIgniter\API\ResponseTrait;
|
||||||
|
|
||||||
|
class AuthClientApi implements FilterInterface
|
||||||
|
{
|
||||||
|
use ResponseTrait;
|
||||||
|
protected $clientAPI;
|
||||||
|
protected $myLogger;
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
set_session_context('External API Filter');
|
||||||
|
$this->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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
100
app/Helpers/ClientQueryHelper.php
Normal file
100
app/Helpers/ClientQueryHelper.php
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Helpers;
|
||||||
|
|
||||||
|
use App\Models\ClientPolicyModel;
|
||||||
|
use App\Models\EmployeeModel;
|
||||||
|
use App\Models\EmployeePolicyModel;
|
||||||
|
use App\Models\TicketMasterModel;
|
||||||
|
|
||||||
|
|
||||||
|
class ClientQueryHelper{
|
||||||
|
|
||||||
|
protected $clientPolicy;
|
||||||
|
protected $empModel;
|
||||||
|
protected $empPolicyModel;
|
||||||
|
protected $claimModel;
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->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();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
54
app/Helpers/ClientTokenHelper.php
Normal file
54
app/Helpers/ClientTokenHelper.php
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Helpers;
|
||||||
|
|
||||||
|
|
||||||
|
class ClientTokenHelper{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function generateKey($clientId,$length = 32)
|
||||||
|
{
|
||||||
|
$clientIdPart = bin2hex($clientId); // Convert client ID to hex
|
||||||
|
$randomPart = bin2hex(random_bytes($length)); // Random part
|
||||||
|
return $clientIdPart . ':' . $randomPart; // Combine with a delimiter
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function extractClientId($token)
|
||||||
|
{
|
||||||
|
$parts = explode(':', $token);
|
||||||
|
return hex2bin($parts[0]); // Decode the hex client ID
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function encryptData($data, $key)
|
||||||
|
{
|
||||||
|
|
||||||
|
$cipher = "AES-256-CBC";
|
||||||
|
$ivlen = openssl_cipher_iv_length($cipher);
|
||||||
|
$iv = openssl_random_pseudo_bytes($ivlen);
|
||||||
|
|
||||||
|
// Convert array to JSON string before encrypting
|
||||||
|
$jsonData = json_encode($data, JSON_UNESCAPED_UNICODE);
|
||||||
|
|
||||||
|
$encrypted = openssl_encrypt($jsonData, $cipher, $key, OPENSSL_RAW_DATA, $iv);
|
||||||
|
|
||||||
|
// Combine IV + encrypted, then base64 encode it to make it JSON-safe
|
||||||
|
return base64_encode($iv . $encrypted);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function decryptData($encryptedData, $key)
|
||||||
|
{
|
||||||
|
$cipher = "AES-256-CBC";
|
||||||
|
$data = base64_decode($encryptedData);
|
||||||
|
|
||||||
|
$ivlen = openssl_cipher_iv_length($cipher);
|
||||||
|
$iv = substr($data, 0, $ivlen); // Extract IV
|
||||||
|
$ciphertext = substr($data, $ivlen); // Extract Encrypted Payload
|
||||||
|
|
||||||
|
$decryptedJson = openssl_decrypt($ciphertext, $cipher, $key, OPENSSL_RAW_DATA, $iv);
|
||||||
|
|
||||||
|
return json_decode($decryptedJson, true); // return as array
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -32,8 +32,11 @@ class DepositHelper
|
|||||||
*/
|
*/
|
||||||
public static function saveDeposit(array $data, int $loggedInUserID): array
|
public static function saveDeposit(array $data, int $loggedInUserID): array
|
||||||
{
|
{
|
||||||
|
|
||||||
|
log_message("error", 'saveDeposit function called '. json_encode($data));
|
||||||
|
|
||||||
// Retrieve the last known balance
|
// Retrieve the last known balance
|
||||||
$lastBalance = self::calculateLastBalance($data['client_id'], $data['insurer_id'], $data['cd_ac_no']);
|
$lastBalance = self::calculateLastBalance($data['client_id'], $data['insurer_id'], $data['cd_ac_no'], $data['cd_ac_pk'] ?? null);
|
||||||
|
|
||||||
// Calculate the new balance based on the transaction type
|
// Calculate the new balance based on the transaction type
|
||||||
$newBalance = self::calculateBalance(
|
$newBalance = self::calculateBalance(
|
||||||
@ -91,15 +94,21 @@ class DepositHelper
|
|||||||
*
|
*
|
||||||
* @return float The last known balance.
|
* @return float The last known balance.
|
||||||
*/
|
*/
|
||||||
public static function calculateLastBalance(int $clientId, int $insurerId, $cd_ac_no): float
|
public static function calculateLastBalance(int $clientId, int $insurerId, $cd_ac_no, $cd_ac_pk): float
|
||||||
{
|
{
|
||||||
$model = new ClientDepositModel();
|
$model = new ClientDepositModel();
|
||||||
|
|
||||||
// $getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE client_id = ? AND insurer_id = ? ORDER BY created_at DESC LIMIT 1";
|
// $getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE client_id = ? AND insurer_id = ? ORDER BY created_at DESC LIMIT 1";
|
||||||
// $getLastBalanceParams = [$clientId, $insurerId];
|
// $getLastBalanceParams = [$clientId, $insurerId];
|
||||||
|
|
||||||
|
if(empty($cd_ac_pk)){
|
||||||
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE cd_ac_no = ? AND is_active = 1 ORDER BY created_at DESC LIMIT 1";
|
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE cd_ac_no = ? AND is_active = 1 ORDER BY created_at DESC LIMIT 1";
|
||||||
$getLastBalanceParams = [$cd_ac_no];
|
$getLastBalanceParams = [$cd_ac_no];
|
||||||
|
}else{
|
||||||
|
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE cd_ac_pk = ? AND is_active = 1 ORDER BY created_at DESC LIMIT 1";
|
||||||
|
$getLastBalanceParams = [$cd_ac_pk];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$lastBalance = $model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->balance ?? 0;
|
$lastBalance = $model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->balance ?? 0;
|
||||||
|
|
||||||
|
|||||||
@ -73,11 +73,15 @@ class GmailResponseHandler{
|
|||||||
$arr = ['bcc','cc','attachments'];
|
$arr = ['bcc','cc','attachments'];
|
||||||
if(in_array($key,$arr)){
|
if(in_array($key,$arr)){
|
||||||
$data[$key] = isset($value)?json_encode($value):null;
|
$data[$key] = isset($value)?json_encode($value):null;
|
||||||
|
}else{
|
||||||
|
if($key == "mail" && is_array($value)){
|
||||||
|
$data[$key] = isset($value)?json_encode($value):null;
|
||||||
}else{
|
}else{
|
||||||
$data[$key] = isset($value)?$value:null;
|
$data[$key] = isset($value)?$value:null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(isset($params['zepto_api']['data']) && $params['zepto_api']['message'] == 'OK' ){
|
if(isset($params['zepto_api']['data']) && $params['zepto_api']['message'] == 'OK' ){
|
||||||
$data['gmail_api_status'] = isset($params['zepto_api']['data']) ? $params['zepto_api']['data'][0]['code'] : null;
|
$data['gmail_api_status'] = isset($params['zepto_api']['data']) ? $params['zepto_api']['data'][0]['code'] : null;
|
||||||
$data['gmail_api_id'] = isset($params['zepto_api']['request_id']) ? $params['zepto_api']['request_id'] : null;
|
$data['gmail_api_id'] = isset($params['zepto_api']['request_id']) ? $params['zepto_api']['request_id'] : null;
|
||||||
|
|||||||
@ -293,10 +293,26 @@ class MailHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function send_email($params)
|
public static function send_email($params)
|
||||||
{
|
{
|
||||||
$myLogger = \Config\Services::mylogger();
|
$myLogger = \Config\Services::mylogger();
|
||||||
|
if (is_array($params['mail'])) {
|
||||||
|
$emails = [];
|
||||||
|
|
||||||
|
foreach ($params['mail'] as $key => $emaill) {
|
||||||
|
$emails[] = [
|
||||||
|
'email_address' => [
|
||||||
|
'address' => $emaill
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$emails[] = [
|
||||||
|
'email_address' => [
|
||||||
|
'address' => $params['mail']
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
$emaill = $params['mail'];
|
|
||||||
$subject = $params['subject'];
|
$subject = $params['subject'];
|
||||||
$message = $params['message'];
|
$message = $params['message'];
|
||||||
$attachments = isset($params['attachments']) ? $params['attachments'] : [];
|
$attachments = isset($params['attachments']) ? $params['attachments'] : [];
|
||||||
@ -313,13 +329,7 @@ class MailHelper
|
|||||||
'from' => [
|
'from' => [
|
||||||
'address' => $from_address
|
'address' => $from_address
|
||||||
],
|
],
|
||||||
'to' => [
|
'to' => $emails,
|
||||||
[
|
|
||||||
'email_address' => [
|
|
||||||
'address' => $emaill
|
|
||||||
]
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'subject' => $subject,
|
'subject' => $subject,
|
||||||
'htmlbody' => $message
|
'htmlbody' => $message
|
||||||
];
|
];
|
||||||
@ -328,7 +338,7 @@ class MailHelper
|
|||||||
if (!empty($cc)) {
|
if (!empty($cc)) {
|
||||||
$ccList = explode(',', $cc);
|
$ccList = explode(',', $cc);
|
||||||
$ccList = array_map('trim', $ccList);
|
$ccList = array_map('trim', $ccList);
|
||||||
$postData['cc'] = array_map(function($email) {
|
$postData['cc'] = array_map(function ($email) {
|
||||||
return [
|
return [
|
||||||
'email_address' => [
|
'email_address' => [
|
||||||
'address' => $email
|
'address' => $email
|
||||||
@ -340,7 +350,7 @@ class MailHelper
|
|||||||
if (!empty($bcc)) {
|
if (!empty($bcc)) {
|
||||||
$bccList = explode(',', $bcc);
|
$bccList = explode(',', $bcc);
|
||||||
$bccList = array_map('trim', $bccList);
|
$bccList = array_map('trim', $bccList);
|
||||||
$postData['bcc'] = array_map(function($email) {
|
$postData['bcc'] = array_map(function ($email) {
|
||||||
return [
|
return [
|
||||||
'email_address' => [
|
'email_address' => [
|
||||||
'address' => $email
|
'address' => $email
|
||||||
@ -412,7 +422,7 @@ class MailHelper
|
|||||||
return json_encode([
|
return json_encode([
|
||||||
'status' => 'failed',
|
'status' => 'failed',
|
||||||
'code' => 404,
|
'code' => 404,
|
||||||
'message' => 'Email Sent Failed...' . $emaill,
|
'message' => 'Email Sent Failed...' . json_encode($params['mail']),
|
||||||
'data' => $res
|
'data' => $res
|
||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
@ -423,11 +433,10 @@ class MailHelper
|
|||||||
return json_encode([
|
return json_encode([
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
'message' => 'Email Sent Successfully...' . $emaill,
|
'message' => 'Email Sent Successfully...' . json_encode($params['mail']),
|
||||||
'data' => $res
|
'data' => $res
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$msg['error'] = $e->getMessage();
|
$msg['error'] = $e->getMessage();
|
||||||
$msg['params'] = $params;
|
$msg['params'] = $params;
|
||||||
@ -439,7 +448,8 @@ class MailHelper
|
|||||||
'data' => $msg
|
'data' => $msg
|
||||||
], 500);
|
], 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function bulk_mail(array $mails = [])
|
public static function bulk_mail(array $mails = [])
|
||||||
{
|
{
|
||||||
$model = new JobModel();
|
$model = new JobModel();
|
||||||
|
|||||||
39
app/Helpers/clientWebHookHelper.php
Normal file
39
app/Helpers/clientWebHookHelper.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Helpers;
|
||||||
|
|
||||||
|
use App\Models\EmployeeModel;
|
||||||
|
use App\Models\EmployeePolicyModel;
|
||||||
|
use App\Models\TicketMasterModel;
|
||||||
|
|
||||||
|
class clientWebHookHelper
|
||||||
|
{
|
||||||
|
protected $empModel;
|
||||||
|
protected $empPolicyModel;
|
||||||
|
protected $claimModel;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
// Models
|
||||||
|
$this->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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -407,7 +407,7 @@ if (!function_exists('data_group_by_family'))
|
|||||||
$row = transform_enrollment_row_to_inception_row($row);
|
$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);
|
array_unshift($result[$row[1]],$row);
|
||||||
}else
|
}else
|
||||||
@ -1132,7 +1132,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
{
|
{
|
||||||
$insurer = new InsurerModel();
|
$insurer = new InsurerModel();
|
||||||
$insurer = ($insurer->find($policy_terms['insurer_id']));
|
$insurer = ($insurer->find($policy_terms['insurer_id']));
|
||||||
if($insurer['addition_add_day'] == true)
|
if(isset($insurer['addition_add_day']) && $insurer['addition_add_day'] == true)
|
||||||
{
|
{
|
||||||
// $emp_data['policy_details']['date_coverage'] = (new DateTime($emp_data['policy_details']['date_coverage']))->modify('+1 day')->format('Y-m-d');
|
// $emp_data['policy_details']['date_coverage'] = (new DateTime($emp_data['policy_details']['date_coverage']))->modify('+1 day')->format('Y-m-d');
|
||||||
|
|
||||||
@ -2119,7 +2119,7 @@ if(!function_exists('check_unit'))
|
|||||||
|
|
||||||
if(!function_exists('transform_si_excel_row_to_calculatable_format'))
|
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'] = [];
|
||||||
$employee['temp']['max_age'] = $maxage_and_maxcount[0]['max_age'];
|
$employee['temp']['max_age'] = $maxage_and_maxcount[0]['max_age'];
|
||||||
@ -2127,7 +2127,7 @@ if(!function_exists('transform_si_excel_row_to_calculatable_format'))
|
|||||||
$employee['temp']['grid_name'] = $applicable_slab_name;
|
$employee['temp']['grid_name'] = $applicable_slab_name;
|
||||||
$employee['temp']['grid_master'] = $grid_master;
|
$employee['temp']['grid_master'] = $grid_master;
|
||||||
$employee['temp']['acting_self'] = true;
|
$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_type'] = $applicable_slab_name;
|
||||||
$employee['temp']['grid_id'] = $grid_master['ui_type'];
|
$employee['temp']['grid_id'] = $grid_master['ui_type'];
|
||||||
$employee['temp']['action'] = 'SI';
|
$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']['policy_status'] = null;
|
||||||
$employee['temp']['emp_status'] = null;
|
$employee['temp']['emp_status'] = null;
|
||||||
$employee['temp']['rata_premimum'] = null;
|
$employee['temp']['rata_premimum'] = null;
|
||||||
|
$employee['policy_details'] = $employee_policy;
|
||||||
return $employee;
|
return $employee;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -677,3 +677,69 @@ if (!function_exists('is_json_string')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!function_exists('check_cd_entry_exist')) {
|
||||||
|
function check_cd_entry_exist($params)
|
||||||
|
{
|
||||||
|
$db = db_connect();
|
||||||
|
|
||||||
|
$client_id = $params['client_id'];
|
||||||
|
$client_policy_id = $params['client_policy_id'];
|
||||||
|
$insurer_id = $params['insurer_id'];
|
||||||
|
$cd_ac_pk = $params['cd_ac_pk'];
|
||||||
|
$event_name = $params['event_name'];
|
||||||
|
|
||||||
|
// Check if truncated entry (sub_type = 8) exists
|
||||||
|
$has_truncated = $db->table('cash_deposit')
|
||||||
|
->where('client_id', $client_id)
|
||||||
|
->where('insurer_id', $insurer_id)
|
||||||
|
->where('cd_ac_pk', $cd_ac_pk)
|
||||||
|
->where('client_policy_id', $client_policy_id)
|
||||||
|
->where('event_name', $event_name)
|
||||||
|
->where('sub_type', 8)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->countAllResults();
|
||||||
|
|
||||||
|
if ($has_truncated) {
|
||||||
|
|
||||||
|
echo "has_truncated";
|
||||||
|
// Get all entries with same details (including truncated)
|
||||||
|
$entries = $db->table('cash_deposit')
|
||||||
|
->where('client_id', $client_id)
|
||||||
|
->where('insurer_id', $insurer_id)
|
||||||
|
->where('cd_ac_pk', $cd_ac_pk)
|
||||||
|
->where('client_policy_id', $client_policy_id)
|
||||||
|
->where('event_name', $event_name)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->where('sub_type !=', 8)
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
|
||||||
|
if (count($entries) > 1) {
|
||||||
|
// Only one entry found (truncated)
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Check if any other entry exists
|
||||||
|
$entry = $db->table('cash_deposit')
|
||||||
|
->where('client_id', $client_id)
|
||||||
|
->where('insurer_id', $insurer_id)
|
||||||
|
->where('cd_ac_pk', $cd_ac_pk)
|
||||||
|
->where('client_policy_id', $client_policy_id)
|
||||||
|
->where('event_name', $event_name)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->get()
|
||||||
|
->getRowArray();
|
||||||
|
|
||||||
|
if (!empty($entry)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
45
app/Models/ClientApiModel.php
Normal file
45
app/Models/ClientApiModel.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class ClientApiModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'client_api';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $returnType = 'array';
|
||||||
|
protected $protectFields = true;
|
||||||
|
protected $allowedFields = [
|
||||||
|
'id','client_id','api_access','created_by','updated_by','created_at','updated_at',
|
||||||
|
'emp_method',"emp_url","emp_tkn_type","emp_token","emp_obj","claim_method",
|
||||||
|
"claim_url","claim_tkn_type","claim_token","claim_obj",'is_active',"client_token",
|
||||||
|
"pull_emp_token","pull_emp_obj","pull_claim_token","pull_claim_obj"
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||||
|
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||||
|
|
||||||
|
protected function checkAndADDCreatedByValue(array $data)
|
||||||
|
{
|
||||||
|
// Check if 'updated_by' value is null or empty
|
||||||
|
if (empty($data['data']['created_by'])) {
|
||||||
|
// Set 'updated_by' value to the current session user ID
|
||||||
|
$data['data']['created_by'] = get_session_userid();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||||
|
{
|
||||||
|
// Check if 'updated_by' value is null or empty
|
||||||
|
if (empty($data['data']['updated_by'])) {
|
||||||
|
// Set 'updated_by' value to the current session user ID
|
||||||
|
$data['data']['updated_by'] = get_session_userid();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -90,7 +90,8 @@ class ClientPolicyModel extends Model
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getClientPolicyById($id){
|
public function getClientPolicyById($id)
|
||||||
|
{
|
||||||
|
|
||||||
return $this->db->table('client_policy')
|
return $this->db->table('client_policy')
|
||||||
->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
|
->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
|
||||||
@ -106,10 +107,10 @@ class ClientPolicyModel extends Model
|
|||||||
->where('client_policy.id', $id)
|
->where('client_policy.id', $id)
|
||||||
->get()
|
->get()
|
||||||
->getResult();
|
->getResult();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getClientPolicyByClientId($client_id){
|
public function getClientPolicyByClientId($client_id)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
return $this->db->table('client_policy')
|
return $this->db->table('client_policy')
|
||||||
@ -132,12 +133,10 @@ class ClientPolicyModel extends Model
|
|||||||
->where('client_policy.is_active', 1)
|
->where('client_policy.is_active', 1)
|
||||||
->get()
|
->get()
|
||||||
->getResult();
|
->getResult();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPolicyPremium($policy_id){
|
public function getPolicyPremium($policy_id)
|
||||||
|
{
|
||||||
|
|
||||||
return $this->db->table('policies')
|
return $this->db->table('policies')
|
||||||
->select('policy_type.*')
|
->select('policy_type.*')
|
||||||
@ -147,7 +146,8 @@ class ClientPolicyModel extends Model
|
|||||||
->getResult();
|
->getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPolicyPremiumPolicyTypeId($policy_type_id){
|
public function getPolicyPremiumPolicyTypeId($policy_type_id)
|
||||||
|
{
|
||||||
|
|
||||||
return $this->db->table('policies')
|
return $this->db->table('policies')
|
||||||
->select('policy_type.*')
|
->select('policy_type.*')
|
||||||
@ -158,24 +158,24 @@ class ClientPolicyModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getPolicyDetails($client_id,$policy_id)
|
public function getPolicyDetails($client_id, $policy_id)
|
||||||
{
|
{
|
||||||
return $this->select('*')
|
return $this->select('*')
|
||||||
->where('client_id',$client_id)
|
->where('client_id', $client_id)
|
||||||
->where('id',$policy_id)
|
->where('id', $policy_id)
|
||||||
->get()
|
->get()
|
||||||
->getResult();
|
->getResult();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getinsurerswithclientid($id){
|
public function getinsurerswithclientid($id)
|
||||||
|
{
|
||||||
|
|
||||||
return $this->db->table('client_policy')
|
return $this->db->table('client_policy')
|
||||||
->select('client_policy.*, cd_master.cd_ac_no as cd_master_account_no')
|
->select('client_policy.*, cd_master.cd_ac_no as cd_master_account_no')
|
||||||
->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
|
->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
|
||||||
->select('clients.client_name as client_name')
|
->select('clients.client_name as client_name')
|
||||||
->join('clients','clients.id=client_policy.client_id')
|
->join('clients', 'clients.id=client_policy.client_id')
|
||||||
->join('insurers', 'insurers.id = client_policy.insurer_id')
|
->join('insurers', 'insurers.id = client_policy.insurer_id')
|
||||||
->join('cd_master', 'cd_master.insurer_id = insurers.id AND cd_master.client_id = client_policy.client_id')
|
->join('cd_master', 'cd_master.insurer_id = insurers.id AND cd_master.client_id = client_policy.client_id')
|
||||||
->where('client_policy.client_id', $id)
|
->where('client_policy.client_id', $id)
|
||||||
@ -200,7 +200,8 @@ class ClientPolicyModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getinsurerswithinsurenceid($insurerId){
|
public function getinsurerswithinsurenceid($insurerId)
|
||||||
|
{
|
||||||
|
|
||||||
return $this->db->table('client_policy')
|
return $this->db->table('client_policy')
|
||||||
->select('client_policy.*')
|
->select('client_policy.*')
|
||||||
@ -215,7 +216,8 @@ class ClientPolicyModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getClientById($id) {
|
public function getClientById($id)
|
||||||
|
{
|
||||||
$query = $this->db->table('clients')->getWhere(['id' => $id]);
|
$query = $this->db->table('clients')->getWhere(['id' => $id]);
|
||||||
// Debug statement
|
// Debug statement
|
||||||
return $query->getRow();
|
return $query->getRow();
|
||||||
@ -251,7 +253,7 @@ class ClientPolicyModel extends Model
|
|||||||
|
|
||||||
|
|
||||||
public function getDepositSummary($clientId, $insurerId)
|
public function getDepositSummary($clientId, $insurerId)
|
||||||
{
|
{
|
||||||
// Fetch the sum of credit and debit transactions and calculate the balance
|
// Fetch the sum of credit and debit transactions and calculate the balance
|
||||||
return $this->db->table('cash_deposit')
|
return $this->db->table('cash_deposit')
|
||||||
->select('SUM(CASE WHEN transaction_type = "Credit" THEN amount ELSE 0 END) AS total_credit')
|
->select('SUM(CASE WHEN transaction_type = "Credit" THEN amount ELSE 0 END) AS total_credit')
|
||||||
@ -263,41 +265,41 @@ class ClientPolicyModel extends Model
|
|||||||
->where('cash_deposit.is_active', 1)
|
->where('cash_deposit.is_active', 1)
|
||||||
->get()
|
->get()
|
||||||
->getRow();
|
->getRow();
|
||||||
}
|
}
|
||||||
// Inside your clientPolicyModel
|
// Inside your clientPolicyModel
|
||||||
// Inside your clientPolicyModel
|
// Inside your clientPolicyModel
|
||||||
// public function getDepositDataWithBalance($clientId, $insurerId)
|
// public function getDepositDataWithBalance($clientId, $insurerId)
|
||||||
// {
|
// {
|
||||||
// // Fetch deposit data with balance information
|
// // Fetch deposit data with balance information
|
||||||
// $builder = $this->db->table('cash_deposit');
|
// $builder = $this->db->table('cash_deposit');
|
||||||
// $builder->select('id, created_at, description, sub_type, amount, transaction_type');
|
// $builder->select('id, created_at, description, sub_type, amount, transaction_type');
|
||||||
|
|
||||||
// $builder->where('client_id', $clientId);
|
// $builder->where('client_id', $clientId);
|
||||||
// $builder->where('insurer_id', $insurerId);
|
// $builder->where('insurer_id', $insurerId);
|
||||||
// $builder->orderBy('created_at', 'asc');
|
// $builder->orderBy('created_at', 'asc');
|
||||||
|
|
||||||
// $depositData = $builder->get()->getResult();
|
// $depositData = $builder->get()->getResult();
|
||||||
|
|
||||||
// $currentBalance = 0;
|
// $currentBalance = 0;
|
||||||
|
|
||||||
// foreach ($depositData as $transaction) {
|
// foreach ($depositData as $transaction) {
|
||||||
// if ($transaction->transaction_type == 'Credit') {
|
// if ($transaction->transaction_type == 'Credit') {
|
||||||
// $currentBalance += $transaction->amount;
|
// $currentBalance += $transaction->amount;
|
||||||
// } elseif ($transaction->transaction_type == 'Debit') {
|
// } elseif ($transaction->transaction_type == 'Debit') {
|
||||||
// $currentBalance -= $transaction->amount;
|
// $currentBalance -= $transaction->amount;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// $transaction->balance = $currentBalance;
|
// $transaction->balance = $currentBalance;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// return $depositData;
|
// return $depositData;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getBalances($clientId)
|
public function getBalances($clientId)
|
||||||
{
|
{
|
||||||
$depositsummary = $this->getDepositlistsummary($clientId);
|
$depositsummary = $this->getDepositlistsummary($clientId);
|
||||||
$balances = [];
|
$balances = [];
|
||||||
|
|
||||||
@ -307,10 +309,10 @@ public function getBalances($clientId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $balances;
|
return $balances;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDepositlistsummary($id)
|
public function getDepositlistsummary($id)
|
||||||
{
|
{
|
||||||
return $this->db->table('cash_deposit')
|
return $this->db->table('cash_deposit')
|
||||||
->select('insurer_id')
|
->select('insurer_id')
|
||||||
->select('SUM(CASE WHEN transaction_type = "Credit" THEN amount ELSE -amount END) AS balance')
|
->select('SUM(CASE WHEN transaction_type = "Credit" THEN amount ELSE -amount END) AS balance')
|
||||||
@ -318,10 +320,11 @@ public function getDepositlistsummary($id)
|
|||||||
->groupBy('insurer_id')
|
->groupBy('insurer_id')
|
||||||
->get()
|
->get()
|
||||||
->getResult();
|
->getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function updateStatus(){
|
public function updateStatus()
|
||||||
|
{
|
||||||
|
|
||||||
// Update client_policy table
|
// Update client_policy table
|
||||||
$client = $this->db->query("UPDATE client_policy SET policy_status = 0 WHERE policy_end_date < CURDATE()");
|
$client = $this->db->query("UPDATE client_policy SET policy_status = 0 WHERE policy_end_date < CURDATE()");
|
||||||
@ -330,12 +333,11 @@ public function updateStatus(){
|
|||||||
$employee = $this->db->query("UPDATE employee_polices SET status = 'expired' WHERE policy_end_date < CURDATE()");
|
$employee = $this->db->query("UPDATE employee_polices SET status = 'expired' WHERE policy_end_date < CURDATE()");
|
||||||
$emp_count = $this->db->affectedRows();
|
$emp_count = $this->db->affectedRows();
|
||||||
|
|
||||||
return ['client'=>$client_count, 'emp' => $emp_count];
|
return ['client' => $client_count, 'emp' => $emp_count];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getpolicyWithPattern($client_id)
|
||||||
}
|
{
|
||||||
|
|
||||||
public function getpolicyWithPattern($client_id){
|
|
||||||
|
|
||||||
$query = $this->db->table('client_policy')
|
$query = $this->db->table('client_policy')
|
||||||
->select('client_policy.*, policies.name, policies.policy_type_id, policy_type.policy_type')
|
->select('client_policy.*, policies.name, policies.policy_type_id, policy_type.policy_type')
|
||||||
@ -349,9 +351,10 @@ public function getpolicyWithPattern($client_id){
|
|||||||
|
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTopUpPolicy($client_id, $type){
|
public function getTopUpPolicy($client_id, $type)
|
||||||
|
{
|
||||||
|
|
||||||
$query = "
|
$query = "
|
||||||
SELECT client_policy.*, policies.name, policies.policy_type_id
|
SELECT client_policy.*, policies.name, policies.policy_type_id
|
||||||
@ -364,11 +367,11 @@ public function getTopUpPolicy($client_id, $type){
|
|||||||
$result = $this->db->query($query)->getResult();
|
$result = $this->db->query($query)->getResult();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function getClientPolicyByPolicyType($client_id, $type){
|
public function getClientPolicyByPolicyType($client_id, $type)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
$query = $this->db->table('client_policy')
|
$query = $this->db->table('client_policy')
|
||||||
@ -396,28 +399,26 @@ public function getClientPolicyByPolicyType($client_id, $type){
|
|||||||
$result = $query->get()->getResult();
|
$result = $query->get()->getResult();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
public function getPolicyTypeForPolicyBinding($client_id)
|
||||||
|
{
|
||||||
|
|
||||||
public function getPolicyTypeForPolicyBinding($client_id){
|
|
||||||
|
|
||||||
$result = $this->table('client_policy')
|
$result = $this->table('client_policy')
|
||||||
->select('policy_type.*, client_policy.id as client_policy_id, client_policy.policy_no')
|
->select('policy_type.*, client_policy.id as client_policy_id, client_policy.policy_no')
|
||||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||||
->where('client_policy.client_id', $client_id)
|
->where('client_policy.client_id', $client_id)
|
||||||
->where('client_policy.is_active', 1)
|
->where('client_policy.is_active', 1)
|
||||||
->whereIn('policy_type.id', [2,3])
|
->whereIn('policy_type.id', [2, 3])
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
public function getCliendDataForExcelFileName($client_policy_id)
|
||||||
|
{
|
||||||
|
|
||||||
public function getCliendDataForExcelFileName($client_policy_id){
|
|
||||||
|
|
||||||
return $this->table('client_policy')
|
return $this->table('client_policy')
|
||||||
->select('clients.short_name, policy_type.policy_type, client_branch.branch_code')
|
->select('clients.short_name, policy_type.policy_type, client_branch.branch_code')
|
||||||
@ -427,12 +428,11 @@ public function getCliendDataForExcelFileName($client_policy_id){
|
|||||||
->where('client_policy.id', $client_policy_id)
|
->where('client_policy.id', $client_policy_id)
|
||||||
->where('client_policy.is_active', 1)
|
->where('client_policy.is_active', 1)
|
||||||
->first();
|
->first();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
//for this using in CRONE JOB
|
||||||
|
public function getPolicyDetailsForRemainder($client_id = null, $branch_id = null, $policy_id = null)
|
||||||
//for this using in CRONE JOB
|
{
|
||||||
public function getPolicyDetailsForRemainder($client_id = null, $branch_id = null, $policy_id = null)
|
|
||||||
{
|
|
||||||
$builder = $this->table('client_policy')
|
$builder = $this->table('client_policy')
|
||||||
->where('client_policy.is_active', 1)
|
->where('client_policy.is_active', 1)
|
||||||
->where('client_policy.policy_status', 1)
|
->where('client_policy.policy_status', 1)
|
||||||
@ -445,18 +445,18 @@ public function getPolicyDetailsForRemainder($client_id = null, $branch_id = nul
|
|||||||
->where('client_policy.client_branch_id', $branch_id);
|
->where('client_policy.client_branch_id', $branch_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($policy_id)){
|
if (empty($policy_id)) {
|
||||||
$builder->whereIn('client_policy.policy_type_id', [2, 3, 4, 5]);
|
$builder->whereIn('client_policy.policy_type_id', [2, 3, 4, 5]);
|
||||||
}else{
|
} else {
|
||||||
$builder->where('client_policy.id', $policy_id);
|
$builder->where('client_policy.id', $policy_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $builder->get()->getResultArray();
|
return $builder->get()->getResultArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
//for this using in CRONE JOB
|
//for this using in CRONE JOB
|
||||||
public function getPolicyDetailsForEnrollment($client_id = null, $branch_id = null)
|
public function getPolicyDetailsForEnrollment($client_id = null, $branch_id = null)
|
||||||
{
|
{
|
||||||
$builder = $this->table('client_policy')
|
$builder = $this->table('client_policy')
|
||||||
->where('client_policy.is_active', 1)
|
->where('client_policy.is_active', 1)
|
||||||
->where('client_policy.policy_status', 1)
|
->where('client_policy.policy_status', 1)
|
||||||
@ -469,7 +469,7 @@ public function getPolicyDetailsForEnrollment($client_id = null, $branch_id = nu
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $builder->get()->getResultArray();
|
return $builder->get()->getResultArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -222,7 +222,7 @@ class EmployeeModel extends Model
|
|||||||
) AS family_stats
|
) AS family_stats
|
||||||
ORDER BY family_member_count DESC, max_age DESC
|
ORDER BY family_member_count DESC, max_age DESC
|
||||||
LIMIT 1;";
|
LIMIT 1;";
|
||||||
$results = $this->db->query($query)->getResult();
|
$results = $this->db->query($query)->getResultArray();
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -186,8 +186,80 @@ class LeadsModel extends Model
|
|||||||
|
|
||||||
$result = $query->get()->getResultArray();
|
$result = $query->get()->getResultArray();
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDashData()
|
||||||
|
{
|
||||||
|
$statuses = $this->db->table('leads')
|
||||||
|
->select('status')
|
||||||
|
->where("is_active", 1)
|
||||||
|
->groupBy('status')
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
|
||||||
|
$selectParts = [];
|
||||||
|
|
||||||
|
foreach ($statuses as $status) {
|
||||||
|
$s = $status['status'];
|
||||||
|
$alias = strtolower(str_replace(' ', '_', $s));
|
||||||
|
|
||||||
|
// Count alias
|
||||||
|
$selectParts[] = "SUM(CASE WHEN status = '{$s}' THEN 1 ELSE 0 END) AS `{$alias}`";
|
||||||
|
|
||||||
|
// IDs alias
|
||||||
|
$selectParts[] = "GROUP_CONCAT(CASE WHEN status = '{$s}' THEN leads.id ELSE NULL END) AS `{$alias}_ids`";
|
||||||
|
}
|
||||||
|
|
||||||
|
$select = implode(", ", $selectParts);
|
||||||
|
|
||||||
|
// Start query builder
|
||||||
|
$builder = $this->db->table('leads');
|
||||||
|
|
||||||
|
$builder->select($select);
|
||||||
|
|
||||||
|
// Auditing subquery
|
||||||
|
$subquery = "(SELECT pk, MAX(created_at) AS last_claim_status_change
|
||||||
|
FROM auditing_history
|
||||||
|
WHERE table_name = 'leads' AND field_name = 'status'
|
||||||
|
GROUP BY pk)";
|
||||||
|
|
||||||
|
$builder->join("{$subquery} AS th", 'leads.id = th.pk', 'left');
|
||||||
|
|
||||||
|
// Date filtering for last status change
|
||||||
|
$dateLimit = 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();
|
||||||
|
|
||||||
|
// Add only active
|
||||||
|
$builder->where("leads.is_active", 1);
|
||||||
|
|
||||||
|
$lead_data = $builder->get()->getResultArray();
|
||||||
|
|
||||||
|
// Fallback for empty results
|
||||||
|
if (empty($lead_data)) {
|
||||||
|
$lead_data[0] = ['total' => 0];
|
||||||
|
foreach ($statuses as $status) {
|
||||||
|
$alias = strtolower(str_replace(' ', '_', $status['status']));
|
||||||
|
$lead_data[0][$alias] = 0;
|
||||||
|
$lead_data[0]["{$alias}_ids"] = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate total
|
||||||
|
$total = 0;
|
||||||
|
foreach ($lead_data[0] as $key => $value) {
|
||||||
|
if (!str_ends_with($key, '_ids') && $key != "won") {
|
||||||
|
$total += (int) $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$lead_data[0]['total'] = $total;
|
||||||
|
|
||||||
|
// dd($lead_data[0]);
|
||||||
|
return $lead_data[0];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,6 +79,7 @@ class PolicyTransactionModel extends Model
|
|||||||
'cd_ac_pk',
|
'cd_ac_pk',
|
||||||
'install_due_date',
|
'install_due_date',
|
||||||
'policy_with_corr',
|
'policy_with_corr',
|
||||||
|
'is_cd_reduce_from_bds',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@ -274,9 +275,9 @@ class PolicyTransactionModel extends Model
|
|||||||
$startDate = date('Y-m-d 00:00:00', strtotime($start_date));
|
$startDate = date('Y-m-d 00:00:00', strtotime($start_date));
|
||||||
$endDate = date('Y-m-d 23:59:59', strtotime($end_date));
|
$endDate = date('Y-m-d 23:59:59', strtotime($end_date));
|
||||||
|
|
||||||
$builder->where('policy_transaction.'.$date_type.'>=', $startDate)
|
$builder->where('policy_transaction.' . $date_type . '>=', $startDate)
|
||||||
->where('policy_transaction.'.$date_type.'<=', $endDate);
|
->where('policy_transaction.' . $date_type . '<=', $endDate);
|
||||||
}else{
|
} else {
|
||||||
|
|
||||||
// $fromDate = date('Y-m-d', strtotime('-30 days'));
|
// $fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||||
// $toDate = date('Y-m-d 23:59:59');
|
// $toDate = date('Y-m-d 23:59:59');
|
||||||
@ -301,14 +302,13 @@ class PolicyTransactionModel extends Model
|
|||||||
$builder->where('policy_transaction.issuer', $issuer);
|
$builder->where('policy_transaction.issuer', $issuer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0){
|
if ($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0) {
|
||||||
|
|
||||||
$fromDate = date('Y-m-d', strtotime('-30 days'));
|
$fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||||
$toDate = date('Y-m-d 23:59:59');
|
$toDate = date('Y-m-d 23:59:59');
|
||||||
|
|
||||||
$builder->where('policy_transaction.created_at >=', $fromDate)
|
$builder->where('policy_transaction.created_at >=', $fromDate)
|
||||||
->where('policy_transaction.created_at <=', $toDate);
|
->where('policy_transaction.created_at <=', $toDate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$builder->orderBy('policy_transaction.id', 'desc');
|
$builder->orderBy('policy_transaction.id', 'desc');
|
||||||
@ -592,14 +592,14 @@ class PolicyTransactionModel extends Model
|
|||||||
// return $result;
|
// return $result;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public function getBDSReportList($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $client_branch_id = 0, $insurer_branch_id = 0, $client_policy_id = 0)
|
public function getBDSReportList($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $client_branch_id = 0, $insurer_branch_id = 0, $client_policy_id = 0, $where = [])
|
||||||
{
|
{
|
||||||
|
|
||||||
$date_condition = '';
|
$date_condition = '';
|
||||||
if($date_type == 'statement_month' && $start_date != 0 && $end_date != 0) {
|
if ($date_type == 'statement_month' && $start_date != 0 && $end_date != 0) {
|
||||||
$date_condition = "
|
$date_condition = "
|
||||||
AND insurer_statements.month >= '".$start_date ."'
|
AND insurer_statements.month >= '" . $start_date . "'
|
||||||
AND insurer_statements.month <= '".$end_date ."'
|
AND insurer_statements.month <= '" . $end_date . "'
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -784,15 +784,30 @@ class PolicyTransactionModel extends Model
|
|||||||
->where('policy_transaction.is_active', 1)
|
->where('policy_transaction.is_active', 1)
|
||||||
->where('pt_co_share_details.is_active', 1);
|
->where('pt_co_share_details.is_active', 1);
|
||||||
|
|
||||||
|
if (
|
||||||
|
(!in_array(get_role_id(), [1, 5])) &&
|
||||||
|
!(
|
||||||
|
in_array(MANAGEMENT_TEAM_ID, user_team()) ||
|
||||||
|
in_array(FINANCE_TEAM_ID, user_team()) ||
|
||||||
|
in_array(BUSINESS_TEAM_ID, user_team())
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
if (get_role_id() == 4 && in_array(POS_TEAM_ID, user_team())) {
|
||||||
|
$builder->where('policy_transaction.created_by', get_session_userid());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!empty($where)) {
|
||||||
|
log_message('info', 'Where condition: ' . json_encode($where));
|
||||||
|
$builder->where($where);
|
||||||
|
}
|
||||||
// Check if the start date and end date are provided
|
// Check if the start date and end date are provided
|
||||||
if ($start_date != 0 && $end_date != 0 && $date_type != 0 && $date_type != 'statement_month') {
|
if ($start_date != 0 && $end_date != 0 && $date_type != 0 && $date_type != 'statement_month') {
|
||||||
|
|
||||||
$startDate = date('Y-m-d 00:00:00', strtotime($start_date));
|
$startDate = date('Y-m-d 00:00:00', strtotime($start_date));
|
||||||
$endDate = date('Y-m-d 23:59:59', strtotime($end_date));
|
$endDate = date('Y-m-d 23:59:59', strtotime($end_date));
|
||||||
|
|
||||||
$builder->where('policy_transaction.'.$date_type.'>=', $startDate)
|
$builder->where('policy_transaction.' . $date_type . '>=', $startDate)
|
||||||
->where('policy_transaction.'.$date_type.'<=', $endDate);
|
->where('policy_transaction.' . $date_type . '<=', $endDate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if($date_type == 'statement_month' && $start_date != 0 && $end_date != 0){
|
// if($date_type == 'statement_month' && $start_date != 0 && $end_date != 0){
|
||||||
@ -809,7 +824,7 @@ class PolicyTransactionModel extends Model
|
|||||||
$endDate = date('Y-m-d', strtotime($end_date));
|
$endDate = date('Y-m-d', strtotime($end_date));
|
||||||
|
|
||||||
$builder->join('co_share_stmt_details', 'pt_co_share_details.id = co_share_stmt_details.co_share_id', 'left')
|
$builder->join('co_share_stmt_details', 'pt_co_share_details.id = co_share_stmt_details.co_share_id', 'left')
|
||||||
->join('insurer_statements', 'co_share_stmt_details.statement_id = insurer_statements.id','left')
|
->join('insurer_statements', 'co_share_stmt_details.statement_id = insurer_statements.id', 'left')
|
||||||
->where('insurer_statements.is_active', 1)
|
->where('insurer_statements.is_active', 1)
|
||||||
->where('insurer_statements.month >=', $startDate)
|
->where('insurer_statements.month >=', $startDate)
|
||||||
->where('insurer_statements.month <=', $endDate)
|
->where('insurer_statements.month <=', $endDate)
|
||||||
@ -846,14 +861,15 @@ class PolicyTransactionModel extends Model
|
|||||||
$builder->where('policy_transaction.issuer', $issuer);
|
$builder->where('policy_transaction.issuer', $issuer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0){
|
if ($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0) {
|
||||||
|
|
||||||
$fromDate = date('Y-m-d', strtotime('-30 days'));
|
$fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||||
$toDate = date('Y-m-d 23:59:59');
|
$toDate = date('Y-m-d 23:59:59');
|
||||||
|
|
||||||
|
if (empty($where)) {
|
||||||
$builder->where('policy_transaction.created_at >=', $fromDate)
|
$builder->where('policy_transaction.created_at >=', $fromDate)
|
||||||
->where('policy_transaction.created_at <=', $toDate);
|
->where('policy_transaction.created_at <=', $toDate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$builder->orderBy('policy_transaction.id', 'desc');
|
$builder->orderBy('policy_transaction.id', 'desc');
|
||||||
@ -1041,7 +1057,7 @@ class PolicyTransactionModel extends Model
|
|||||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||||
->join('clients', 'policy_transaction.client_id = clients.id', 'left')
|
->join('clients', 'policy_transaction.client_id = clients.id', 'left')
|
||||||
->join('client_branch', 'policy_transaction.client_branch_id = client_branch.id', 'left')
|
->join('client_branch', 'policy_transaction.client_branch_id = client_branch.id', 'left')
|
||||||
->join('insurers', 'pt_co_share_details.insurer_id = insurers.id','left')
|
->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
|
||||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||||
->where('policy_transaction.is_active', 1)
|
->where('policy_transaction.is_active', 1)
|
||||||
@ -1066,9 +1082,9 @@ class PolicyTransactionModel extends Model
|
|||||||
$startDate = date('Y-m-d 00:00:00', strtotime($start_date));
|
$startDate = date('Y-m-d 00:00:00', strtotime($start_date));
|
||||||
$endDate = date('Y-m-d 23:59:59', strtotime($end_date));
|
$endDate = date('Y-m-d 23:59:59', strtotime($end_date));
|
||||||
|
|
||||||
$builder->where('policy_transaction.'.$date_type.'>=', $startDate)
|
$builder->where('policy_transaction.' . $date_type . '>=', $startDate)
|
||||||
->where('policy_transaction.'.$date_type.'<=', $endDate);
|
->where('policy_transaction.' . $date_type . '<=', $endDate);
|
||||||
}else{
|
} else {
|
||||||
|
|
||||||
// $fromDate = date('Y-m-d', strtotime('-30 days'));
|
// $fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||||
// $toDate = date('Y-m-d 23:59:59');
|
// $toDate = date('Y-m-d 23:59:59');
|
||||||
@ -1096,14 +1112,13 @@ class PolicyTransactionModel extends Model
|
|||||||
$builder->where('policy_transaction.status', $status);
|
$builder->where('policy_transaction.status', $status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0){
|
if ($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0) {
|
||||||
|
|
||||||
$fromDate = date('Y-m-d', strtotime('-30 days'));
|
$fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||||
$toDate = date('Y-m-d 23:59:59');
|
$toDate = date('Y-m-d 23:59:59');
|
||||||
|
|
||||||
$builder->where('policy_transaction.created_at >=', $fromDate)
|
$builder->where('policy_transaction.created_at >=', $fromDate)
|
||||||
->where('policy_transaction.created_at <=', $toDate);
|
->where('policy_transaction.created_at <=', $toDate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$builder->orderBy('policy_transaction.id', 'desc');
|
$builder->orderBy('policy_transaction.id', 'desc');
|
||||||
@ -1282,6 +1297,7 @@ class PolicyTransactionModel extends Model
|
|||||||
|
|
||||||
public function getBusinessReportList($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0)
|
public function getBusinessReportList($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0)
|
||||||
{
|
{
|
||||||
|
$dateThreshold = date('Y-m-d H:i:s', strtotime("- 3 days"));
|
||||||
$builder = $this->db->table('policy_transaction')
|
$builder = $this->db->table('policy_transaction')
|
||||||
->select([
|
->select([
|
||||||
'policy_transaction.id AS policy_trns_id',
|
'policy_transaction.id AS policy_trns_id',
|
||||||
@ -1305,9 +1321,19 @@ class PolicyTransactionModel extends Model
|
|||||||
->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
|
->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
|
||||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||||
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
|
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
|
||||||
|
->join(
|
||||||
|
'(SELECT policy_tran_id, MAX(created_at) AS last_policy_status_change,is_active
|
||||||
|
FROM policy_transaction_status
|
||||||
|
WHERE is_active = 1
|
||||||
|
GROUP BY policy_tran_id) th',
|
||||||
|
'policy_transaction.id = th.policy_tran_id'
|
||||||
|
|
||||||
|
)
|
||||||
|
->where("th.last_policy_status_change <= '{$dateThreshold}'", null, false)
|
||||||
->where('policy_transaction.is_active', 1)
|
->where('policy_transaction.is_active', 1)
|
||||||
// ->where('policy_transaction.status', 'completed')
|
// ->where('policy_transaction.status', 'completed')
|
||||||
->where('pt_co_share_details.bp_amt IS NULL OR pt_co_share_details.bp_amt = 0');
|
->where('(pt_co_share_details.bp_amt IS NULL OR pt_co_share_details.bp_amt = 0)', null, false);
|
||||||
|
|
||||||
|
|
||||||
if ($start_date != 0 && $end_date != 0 && $date_type != 0) {
|
if ($start_date != 0 && $end_date != 0 && $date_type != 0) {
|
||||||
|
|
||||||
@ -1346,12 +1372,21 @@ class PolicyTransactionModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
$builder->orderBy('policy_transaction.id', 'desc');
|
$builder->orderBy('policy_transaction.id', 'desc');
|
||||||
|
// echo $builder->getCompiledSelect();
|
||||||
|
// exit;
|
||||||
|
|
||||||
return $builder->get()->getResultArray();
|
$returnData = $builder->get()->getResultArray();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// dd($returnData);
|
||||||
|
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)
|
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)
|
||||||
{
|
{
|
||||||
|
$dateThreshold = date('Y-m-d H:i:s', strtotime("- 3 days"));
|
||||||
|
|
||||||
$builder = $this->db->table('policy_transaction')
|
$builder = $this->db->table('policy_transaction')
|
||||||
->select("
|
->select("
|
||||||
policy_transaction.id,
|
policy_transaction.id,
|
||||||
@ -1374,6 +1409,15 @@ class PolicyTransactionModel extends Model
|
|||||||
->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
|
->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
|
||||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||||
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
|
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
|
||||||
|
->join(
|
||||||
|
'(SELECT policy_tran_id, MAX(created_at) AS last_policy_status_change,is_active
|
||||||
|
FROM policy_transaction_status
|
||||||
|
WHERE is_active = 1
|
||||||
|
GROUP BY policy_tran_id) th',
|
||||||
|
'policy_transaction.id = th.policy_tran_id'
|
||||||
|
|
||||||
|
)
|
||||||
|
->where("th.last_policy_status_change <= '{$dateThreshold}'", null, false)
|
||||||
->where('policy_transaction.is_active', 1)
|
->where('policy_transaction.is_active', 1)
|
||||||
// ->where('policy_transaction.status', 'completed')
|
// ->where('policy_transaction.status', 'completed')
|
||||||
->where('COALESCE(pt_co_share_details.agreed_bp_per, 0) + COALESCE(pt_co_share_details.agreed_tp_per, 0) + COALESCE(pt_co_share_details.agreed_tep_per, 0) = 0')
|
->where('COALESCE(pt_co_share_details.agreed_bp_per, 0) + COALESCE(pt_co_share_details.agreed_tp_per, 0) + COALESCE(pt_co_share_details.agreed_tep_per, 0) = 0')
|
||||||
@ -1520,7 +1564,7 @@ class PolicyTransactionModel extends Model
|
|||||||
return $builder->get()->getResultArray();
|
return $builder->get()->getResultArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOutstandingReportList($start_date = 0, $end_date = 0, $insurer_id = 0,$insurer_branch_id = 0)
|
public function getOutstandingReportList($start_date = 0, $end_date = 0, $insurer_id = 0, $insurer_branch_id = 0)
|
||||||
{
|
{
|
||||||
$builder = $this->db->table('insurer_statements s')
|
$builder = $this->db->table('insurer_statements s')
|
||||||
->select('
|
->select('
|
||||||
@ -1624,5 +1668,46 @@ class PolicyTransactionModel extends Model
|
|||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getBDSRenewalData()
|
||||||
|
{
|
||||||
|
// Increase GROUP_CONCAT limit
|
||||||
|
$this->db->query("SET SESSION group_concat_max_len = 1000000;");
|
||||||
|
|
||||||
|
$builder = $this->db->table('policy_transaction pt');
|
||||||
|
|
||||||
|
$builder->select([
|
||||||
|
'SUM(CASE WHEN pt.policy_end_date < CURDATE() THEN 1 ELSE 0 END) AS Expired',
|
||||||
|
'SUM(CASE WHEN pt.policy_end_date BETWEEN CURDATE() AND (CURDATE() + INTERVAL 1 MONTH) THEN 1 ELSE 0 END) AS `Renewal Pending`',
|
||||||
|
'GROUP_CONCAT(CASE WHEN pt.policy_end_date < CURDATE() THEN pt.id ELSE NULL END) AS Expired_ids',
|
||||||
|
'GROUP_CONCAT(CASE WHEN pt.policy_end_date BETWEEN CURDATE() AND (CURDATE() + INTERVAL 1 MONTH) THEN pt.id ELSE NULL END) AS Renewal_Pending_ids'
|
||||||
|
]);
|
||||||
|
$builder->where("pt.policy_end_date IS NOT NULL", null, false);
|
||||||
|
$builder->where('pt.is_active', 1);
|
||||||
|
|
||||||
|
// Self join to check if a policy has been renewed
|
||||||
|
$builder->join('policy_transaction renewed', 'renewed.source_client_policy_id = pt.client_policy_id and renewed.client_id = pt.client_id and renewed.client_branch_id = pt.client_branch_id', 'left');
|
||||||
|
|
||||||
|
// Filter for expired or expiring policies
|
||||||
|
$builder->where("(pt.policy_end_date < CURDATE() OR pt.policy_end_date BETWEEN CURDATE() AND (CURDATE() + INTERVAL 1 MONTH))", null, false);
|
||||||
|
|
||||||
|
$builder->where('renewed.id IS NULL', null, false);
|
||||||
|
$query = $builder->get();
|
||||||
|
$result = $query->getResultArray();
|
||||||
|
|
||||||
|
$total = 0;
|
||||||
|
foreach ($result[0] as $key => $value) {
|
||||||
|
if ($key !== 'Expired_ids' && $key !== 'Renewal_Pending_ids') {
|
||||||
|
$total += $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure ID fields are arrays (not null)
|
||||||
|
$result[0]['Expired_ids'] = $result[0]['Expired_ids'] ? $result[0]['Expired_ids'] : [];
|
||||||
|
$result[0]['Renewal Pending_ids'] = $result[0]['Renewal_Pending_ids'] ? $result[0]['Renewal_Pending_ids'] : [];
|
||||||
|
|
||||||
|
// Add total count
|
||||||
|
$result[0]['total'] = $total;
|
||||||
|
|
||||||
|
return $result[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -140,7 +140,7 @@ class TicketMasterModel extends Model
|
|||||||
ticket_claim_status.trigger_type = ticket_mail_template.trigger_type
|
ticket_claim_status.trigger_type = ticket_mail_template.trigger_type
|
||||||
and ticket_claim_status.ticket_type = ticket_mail_template.ticket_type
|
and ticket_claim_status.ticket_type = ticket_mail_template.ticket_type
|
||||||
and ticket_mail_template.is_active = 1')
|
and ticket_mail_template.is_active = 1')
|
||||||
->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.id', $ticket_id)
|
||||||
->where('ticket_master.is_active', 1)
|
->where('ticket_master.is_active', 1)
|
||||||
->where('ticket_claim_status.is_active', 1)
|
->where('ticket_claim_status.is_active', 1)
|
||||||
@ -173,9 +173,9 @@ class TicketMasterModel extends Model
|
|||||||
->join('clients', 'ticket_master.client_id = clients.id', 'left')
|
->join('clients', 'ticket_master.client_id = clients.id', 'left')
|
||||||
->join('insurers', 'ticket_master.insurer_id = insurers.id', 'left')
|
->join('insurers', 'ticket_master.insurer_id = insurers.id', 'left')
|
||||||
->join('tpa', 'ticket_master.tpa_id = tpa.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('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.id', $ticket_id)
|
||||||
->where('ticket_master.is_active', 1)
|
->where('ticket_master.is_active', 1)
|
||||||
->first();
|
->first();
|
||||||
@ -345,7 +345,7 @@ class TicketMasterModel extends Model
|
|||||||
}
|
}
|
||||||
$ticket_type_data_1 = "";
|
$ticket_type_data_1 = "";
|
||||||
$ticket_type_data_2 = "";
|
$ticket_type_data_2 = "";
|
||||||
if(!empty($ticket_type)){
|
if (!empty($ticket_type)) {
|
||||||
$ticket_type_data_1 = "AND ticket_type = $ticket_type";
|
$ticket_type_data_1 = "AND ticket_type = $ticket_type";
|
||||||
$ticket_type_data_2 = "WHERE tm.ticket_type_id = $ticket_type";
|
$ticket_type_data_2 = "WHERE tm.ticket_type_id = $ticket_type";
|
||||||
}
|
}
|
||||||
@ -488,7 +488,8 @@ class TicketMasterModel extends Model
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tpaWiseReport($policy_type = null ,$start_date = null, $end_date = null){
|
public function tpaWiseReport($policy_type = null, $start_date = null, $end_date = null)
|
||||||
|
{
|
||||||
$ticket_type_data_1 = "";
|
$ticket_type_data_1 = "";
|
||||||
$ticket_type_data_2 = "";
|
$ticket_type_data_2 = "";
|
||||||
|
|
||||||
@ -511,8 +512,17 @@ class TicketMasterModel extends Model
|
|||||||
$dynamicSelect .= "
|
$dynamicSelect .= "
|
||||||
COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) AS `{$status['claim_status']}`, ";
|
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',
|
if (in_array($status['claim_status'], [
|
||||||
'UNDER PROCESS - INVESTIGATION STATUS','UNDER PROCESS - QUERY DOCUMENT RECEIVED','APPROVED','PAYMENT INITIATED'])) {
|
'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) + ";
|
$dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||||
}
|
}
|
||||||
// Include in total count
|
// Include in total count
|
||||||
@ -553,10 +563,10 @@ class TicketMasterModel extends Model
|
|||||||
|
|
||||||
// print_rr($result);die();
|
// print_rr($result);die();
|
||||||
return $result;
|
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) {
|
if ($policy_type == 1) {
|
||||||
$ticket_type_data_1 = "";
|
$ticket_type_data_1 = "";
|
||||||
@ -614,9 +624,7 @@ class TicketMasterModel extends Model
|
|||||||
// dd($result);
|
// dd($result);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
} else {
|
||||||
|
|
||||||
}else{
|
|
||||||
$ticket_type_data_1 = "";
|
$ticket_type_data_1 = "";
|
||||||
$ticket_type_data_2 = "";
|
$ticket_type_data_2 = "";
|
||||||
|
|
||||||
@ -639,8 +647,15 @@ class TicketMasterModel extends Model
|
|||||||
$dynamicSelect .= "
|
$dynamicSelect .= "
|
||||||
COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) AS `{$status['claim_status']}`, ";
|
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',
|
if (in_array($status['claim_status'], [
|
||||||
'APPROVED','ON HOLD'])) {
|
'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) + ";
|
$dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||||
}
|
}
|
||||||
// Include in total count
|
// Include in total count
|
||||||
@ -706,5 +721,150 @@ class TicketMasterModel extends Model
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDashData($claim_statuses, $limit)
|
||||||
|
{
|
||||||
|
$finalResults = [];
|
||||||
|
|
||||||
|
foreach ($claim_statuses as $typeId => $statuses) {
|
||||||
|
// Get all active, non-null claim status tickets for this type
|
||||||
|
$builder = $this->db->table('ticket_master tm')
|
||||||
|
->select('tm.id, tm.ticket_type_id, tcs.claim_status, th.last_claim_status_change')
|
||||||
|
->join('ticket_claim_status tcs', 'tm.claim_status_id = tcs.id', 'left')
|
||||||
|
->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'
|
||||||
|
)
|
||||||
|
->where('tm.ticket_type_id', $typeId)
|
||||||
|
->where('tm.is_active', 1)
|
||||||
|
->where('tm.claim_status_id IS NOT NULL');
|
||||||
|
|
||||||
|
$results = $builder->get()->getResultArray();
|
||||||
|
|
||||||
|
$summary = [
|
||||||
|
'ticket_type_id' => $typeId,
|
||||||
|
];
|
||||||
|
|
||||||
|
$total = 0;
|
||||||
|
foreach ($statuses as $status) {
|
||||||
|
$alias = strtolower(str_replace(' ', '_', $status));
|
||||||
|
$summary[$alias] = 0;
|
||||||
|
$summary[$alias . '_ids'] = '';
|
||||||
|
|
||||||
|
$dateLimit = $limit[$typeId][$status] ?? 3;
|
||||||
|
$threshold = date('Y-m-d H:i:s', strtotime("-{$dateLimit} days"));
|
||||||
|
|
||||||
|
$ticketIds = [];
|
||||||
|
// dd($results);
|
||||||
|
foreach ($results as $row) {
|
||||||
|
if (
|
||||||
|
$row['claim_status'] === $status &&
|
||||||
|
(
|
||||||
|
!$row['last_claim_status_change'] ||
|
||||||
|
$row['last_claim_status_change'] <= $threshold
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
$summary[$alias]++;
|
||||||
|
$ticketIds[] = $row['id'];
|
||||||
|
if ($status == "APPROVED"|| $status == "SETTLED"|| $status == "CLOSED" ){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$total++;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert ticket IDs array to a comma-separated string
|
||||||
|
$summary[$alias . '_ids'] = implode(',', $ticketIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
$summary['total'] = $total;
|
||||||
|
|
||||||
|
// Add approved but not settled IDs and count
|
||||||
|
$approvedNotSettled = $this->getNotSettledbutApprovedCount($typeId);
|
||||||
|
$summary['approved_not_settled'] = $approvedNotSettled['count'];
|
||||||
|
$summary['approved_not_settled_ids'] = $approvedNotSettled['ticket_ids'];
|
||||||
|
|
||||||
|
$finalResults[$typeId] = $summary;
|
||||||
|
}
|
||||||
|
|
||||||
|
// dd($finalResults);
|
||||||
|
return $finalResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function getNotSettledbutApprovedCount($ticket_type)
|
||||||
|
{
|
||||||
|
// Fetch the approved and settled claim_status IDs
|
||||||
|
$builder = $this->db->table("ticket_claim_status approved")
|
||||||
|
->select("approved.id AS approved_id, settled.id AS settled_id")
|
||||||
|
->join("ticket_claim_status settled", "approved.ticket_type = settled.ticket_type")
|
||||||
|
->where("approved.claim_status", "APPROVED")
|
||||||
|
->where("settled.claim_status", "SETTLED")
|
||||||
|
->where("approved.ticket_type", $ticket_type)
|
||||||
|
->where("approved.is_active", 1)
|
||||||
|
->where("settled.is_active", 1);
|
||||||
|
|
||||||
|
$ids = $builder->get()->getRowArray();
|
||||||
|
|
||||||
|
// If no matching status IDs are found, return empty
|
||||||
|
if (!$ids) {
|
||||||
|
return ['count' => 0, 'ticket_ids' => ''];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract approved and settled status IDs
|
||||||
|
$approved_id = $ids['approved_id'];
|
||||||
|
$settled_id = $ids['settled_id'];
|
||||||
|
|
||||||
|
// Subquery to get the latest approval time for each ticket
|
||||||
|
$subquery = $this->db->table('ticket_history')
|
||||||
|
->select('ticket_id, MAX(created_at) AS approved_time')
|
||||||
|
->where('field_name', 'claim_status_id')
|
||||||
|
->where('new_value', $approved_id)
|
||||||
|
->groupBy('ticket_id');
|
||||||
|
|
||||||
|
// Main query to find tickets that are approved but not settled
|
||||||
|
$builder = $this->db->table('ticket_master tm');
|
||||||
|
|
||||||
|
$builder->join("({$subquery->getCompiledSelect()}) latest_approval", 'tm.id = latest_approval.ticket_id', 'inner');
|
||||||
|
|
||||||
|
// Left join to find if there is a settled status for each ticket after approval
|
||||||
|
$builder->join(
|
||||||
|
'ticket_history th_settled',
|
||||||
|
"th_settled.ticket_id = tm.id
|
||||||
|
AND th_settled.field_name = 'claim_status_id'
|
||||||
|
AND th_settled.new_value = {$settled_id}
|
||||||
|
AND th_settled.created_at > latest_approval.approved_time",
|
||||||
|
'left',
|
||||||
|
false // Important for raw ON condition
|
||||||
|
);
|
||||||
|
|
||||||
|
// Filtering conditions: not settled and approved time older than 12 days
|
||||||
|
$builder->where('tm.claim_status_id !=', $settled_id);
|
||||||
|
$builder->where('tm.is_active', 1);
|
||||||
|
$builder->where("latest_approval.approved_time <= DATE_SUB(NOW(), INTERVAL 12 DAY)", null, false);
|
||||||
|
$builder->where('th_settled.id IS NULL', null, false);
|
||||||
|
|
||||||
|
// Final select to get ticket IDs of approved but not settled tickets
|
||||||
|
$builder->select('tm.id');
|
||||||
|
|
||||||
|
// Execute the query
|
||||||
|
$query = $builder->get();
|
||||||
|
$ticketIds = array_column($query->getResultArray(), 'id'); // Extract the IDs
|
||||||
|
|
||||||
|
// Convert ticket IDs array to a comma-separated string
|
||||||
|
$ticketIdsString = implode(',', $ticketIds);
|
||||||
|
|
||||||
|
// Return the count and comma-separated ticket IDs
|
||||||
|
return [
|
||||||
|
'count' => count($ticketIds),
|
||||||
|
'ticket_ids' => $ticketIdsString
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -173,7 +173,7 @@
|
|||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<?php 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()))) { ?>
|
<?php if(in_array(get_role_id(), [1,2,3,4,5]) || (in_array(ENROLLMENT_TEAM_ID, user_team()) || in_array(CLAIMS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { ?>
|
||||||
|
|
||||||
<div class="row" id="client_add" style="margin-top: -32px;">
|
<div class="row" id="client_add" style="margin-top: -32px;">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
@ -217,9 +217,43 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
<?php if ((get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team())) || in_array(get_role_id(),[1,5])) :?>
|
||||||
|
<?php
|
||||||
|
$isActive = get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team()) ? 'active show' : '';
|
||||||
|
?>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="#claims-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2 <?= $isActive?>" id="claims_tab">
|
||||||
|
<span class="mr-1"><i class="fa fa-file-alt"></i> </span>
|
||||||
|
<span class="d-none d-sm-inline-block">Claims</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ((get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_team())) || in_array(get_role_id(),[1,5])) :?>
|
||||||
|
<?php
|
||||||
|
$isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_team()) ? 'active show' : '';
|
||||||
|
?>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="#leads-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2 <?= $isActive?>" id="leads_tab">
|
||||||
|
<span class="mr-1"><i class="fa fa-file-alt"></i> </span>
|
||||||
|
<span class="d-none d-sm-inline-block">Leads and BDS Renewals</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
|
<?php if ((get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team())) || in_array(get_role_id(),[1,5])) :?>
|
||||||
|
<?php include("claims_dash.php") ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if(in_array(get_role_id(), [1,2,3,5]) || (get_role_id() == 4 && in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { ?>
|
||||||
|
<?php include('bds_dash.php'); ?>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ((get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_team())) || in_array(get_role_id(),[1,5])) :?>
|
||||||
|
<?php include("leads_dash.php") ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if(in_array(get_role_id(), [1,2,3,5])) { ?>
|
<?php if(in_array(get_role_id(), [1,2,3,5])) { ?>
|
||||||
<?php include('endorsement_dash.php'); ?>
|
<?php include('endorsement_dash.php'); ?>
|
||||||
@ -230,6 +264,7 @@
|
|||||||
<?php include('bds_dash.php'); ?>
|
<?php include('bds_dash.php'); ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- </div> -->
|
<!-- </div> -->
|
||||||
|
|||||||
@ -131,11 +131,14 @@ body{
|
|||||||
|
|
||||||
|
|
||||||
<div class="tab-pane <?= isset($add_active_calss) ? $add_active_calss : 'fade' ?>" id="bds-dash-tab" style="padding-right: 35px;">
|
<div class="tab-pane <?= isset($add_active_calss) ? $add_active_calss : 'fade' ?>" id="bds-dash-tab" style="padding-right: 35px;">
|
||||||
|
<div class="row">
|
||||||
<div class="StatusTileHide" style="display: none; position: relative; bottom: 15px;">
|
<div class="StatusTileHide" style="display: none; padding-bottom: 10px;padding-left: 17px">
|
||||||
<a href="#" onclick="hide_status_show_pending_tile()" >show all pending Tile</a>
|
<a href="#" onclick="hide_status_show_pending_tile()" ><i class="fas fa-arrow-left"></i> Back to Overview</a>
|
||||||
|
</div>
|
||||||
|
<div class="StatusTileHide" style="display: none;padding-left: 30px;">
|
||||||
|
<a href="#" id="mainMenuTiles">Current Tile : </a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<?php if (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
<?php if (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||||
@ -224,6 +227,10 @@ body{
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
$(".StatusTileHide").hide();
|
||||||
|
})
|
||||||
|
|
||||||
function linkRedirectForBDS(input, team)
|
function linkRedirectForBDS(input, team)
|
||||||
{
|
{
|
||||||
var link = "";
|
var link = "";
|
||||||
@ -244,6 +251,7 @@ function show_business_status_tile(){
|
|||||||
|
|
||||||
$('.businessStatusTile').show()
|
$('.businessStatusTile').show()
|
||||||
$('.StatusTileHide').show()
|
$('.StatusTileHide').show()
|
||||||
|
$("#mainMenuTiles").text("Viewing Details of Business Team Pending");
|
||||||
|
|
||||||
$('.businessPendingTile').hide()
|
$('.businessPendingTile').hide()
|
||||||
$('.financePendingTile').hide()
|
$('.financePendingTile').hide()
|
||||||
@ -257,6 +265,8 @@ function show_finance_status_tile(){
|
|||||||
|
|
||||||
$('.financePendingTile').hide()
|
$('.financePendingTile').hide()
|
||||||
$('.businessPendingTile').hide()
|
$('.businessPendingTile').hide()
|
||||||
|
$("#mainMenuTiles").text("Viewing Details of Finance Team Pending");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,6 +277,6 @@ function hide_status_show_pending_tile(){
|
|||||||
$('.businessStatusTile').hide()
|
$('.businessStatusTile').hide()
|
||||||
$('.financePendingTile').show()
|
$('.financePendingTile').show()
|
||||||
$('.businessPendingTile').show()
|
$('.businessPendingTile').show()
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
329
app/Views/claims_dash.php
Normal file
329
app/Views/claims_dash.php
Normal file
@ -0,0 +1,329 @@
|
|||||||
|
<style>
|
||||||
|
body {
|
||||||
|
margin-top: 20px;
|
||||||
|
background: #FAFAFA;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-card {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-blue {
|
||||||
|
background: linear-gradient(45deg, #4099ff, #73b4ff);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-green {
|
||||||
|
background: linear-gradient(45deg, #2ed8b6, #59e0c5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-yellow {
|
||||||
|
background: linear-gradient(45deg, #FFB64D, #ffcb80);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-pink {
|
||||||
|
background: linear-gradient(45deg, #FF5370, #ff869a);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-red {
|
||||||
|
background: linear-gradient(45deg, #FF4E50, #F9D423);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-purple {
|
||||||
|
background: linear-gradient(45deg, #9D50BB, #6E48AA);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-orange {
|
||||||
|
background: linear-gradient(45deg, #F2994A, #F2C94C);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-teal {
|
||||||
|
background: linear-gradient(45deg, #1ABC9C, #16A085);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-cyan {
|
||||||
|
background: linear-gradient(45deg, #00C9FF, #92FE9D);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-lime {
|
||||||
|
background: linear-gradient(45deg, #A8E063, #56AB2F);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-indigo {
|
||||||
|
background: linear-gradient(45deg, #3F51B5, #5A55AE);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-Pelorous {
|
||||||
|
background: linear-gradient(45deg, #00d6db, #00a8b5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-Pelorous2 {
|
||||||
|
background: linear-gradient(45deg, #02a8b5, #017f8b);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-Pelorous3 {
|
||||||
|
background: linear-gradient(45deg, #098895, #046063);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-Grenadier {
|
||||||
|
background: linear-gradient(45deg, #ff9d37, #ff7a10);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-Grenadier2 {
|
||||||
|
background: linear-gradient(45deg, #ff8010, #ff4c00);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-Grenadier3 {
|
||||||
|
background: linear-gradient(45deg, #f06306, #cc4b05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-SilverChalice {
|
||||||
|
background: linear-gradient(45deg, #a3a8a8, #8f9494);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-SilverChalice2 {
|
||||||
|
background: linear-gradient(45deg, #7e8484, #686e6e);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-SilverChalice3 {
|
||||||
|
background: linear-gradient(45deg, #5c6363, #434949);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.card {
|
||||||
|
border-radius: 5px;
|
||||||
|
-webkit-box-shadow: 0 1px 2.94px 0.06px rgba(4, 26, 55, 0.16);
|
||||||
|
box-shadow: 0 1px 2.94px 0.06px rgba(4, 26, 55, 0.16);
|
||||||
|
border: none;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
-webkit-transition: all 0.3s ease-in-out;
|
||||||
|
transition: all 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card .card-block {
|
||||||
|
padding-top: 10px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
padding-left: 25px;
|
||||||
|
padding-right: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-card i {
|
||||||
|
font-size: 26px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.f-left {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.f-right {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.m-b-1 {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<?php
|
||||||
|
$isActive = get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team()) ? 'active show' : '';
|
||||||
|
?>
|
||||||
|
<div class="tab-pane fade <?= $isActive ?>" id="claims-dash-tab">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4 col-xl-3 claimTypeTile">
|
||||||
|
<div class="card bg-c-Pelorous order-card" onclick="hideAndShowTile(1,1)">
|
||||||
|
<div class="card-block">
|
||||||
|
<h6 class="m-b-20 font-15">GMC</h6>
|
||||||
|
<h2 class="text-right"><i class="mdi mdi-playlist-check f-left"></i><span><?= isset($claim_data[1]['total']) ? $claim_data[1]['total'] : '0' ?></span></h2>
|
||||||
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4 col-xl-3 claimTypeTile">
|
||||||
|
<div class="card bg-c-Pelorous order-card" onclick="hideAndShowTile(1,2)">
|
||||||
|
<div class="card-block">
|
||||||
|
<h6 class="m-b-20 font-15">GPA</h6>
|
||||||
|
<h2 class="text-right"><i class="mdi mdi-playlist-check f-left"></i><span><?= isset($claim_data[2]['total']) ? $claim_data[2]['total'] : '0' ?></span></h2>
|
||||||
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-4 col-xl-3 claimTypeTile">
|
||||||
|
<div class="card bg-c-Pelorous order-card" onclick="hideAndShowTile(1,3)">
|
||||||
|
<div class="card-block">
|
||||||
|
<h6 class="m-b-20 font-15">EDLI</h6>
|
||||||
|
<h2 class="text-right"><i class="mdi mdi-playlist-check f-left"></i><span><?= isset($claim_data[3]['total']) ? $claim_data[3]['total'] : '0' ?></span></h2>
|
||||||
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-4 col-xl-3 claimTypeTile">
|
||||||
|
<div class="card bg-c-Pelorous order-card" onclick="hideAndShowTile(1,4)">
|
||||||
|
<div class="card-block">
|
||||||
|
<h6 class="m-b-20 font-15">GTLI</h6>
|
||||||
|
<h2 class="text-right"><i class="mdi mdi-playlist-check f-left"></i><span><?= isset($claim_data[4]['total']) ? $claim_data[4]['total'] : '0' ?></span></h2>
|
||||||
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="goBack" style="padding-bottom: 10px;padding-left: 17px;">
|
||||||
|
<a href="#" onclick="hideAndShowTile('2')" ><i class="fas fa-arrow-left"></i> Back to Overview<br></a>
|
||||||
|
</div>
|
||||||
|
<div class="goBack" style="display: none;padding-left: 30px;">
|
||||||
|
<a href="#" id="current_tile">Current Tile : </a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<?php
|
||||||
|
$colorSetCount = count($colorShades); // Number of color sets
|
||||||
|
$shadeCount = count($colorShades[0]); // Number of shades per set
|
||||||
|
$index = 0;
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php foreach ($claim_data as $ticketTypeId => $statuses) : ?>
|
||||||
|
<?php
|
||||||
|
// Initialize color set and shade indexes
|
||||||
|
$colorSetIndex = floor($index / $shadeCount) % $colorSetCount; // Reset color set after each set
|
||||||
|
$shadeIndex = $index % $shadeCount; // Cycle through shades within the set
|
||||||
|
|
||||||
|
// Get the background color for the current tile
|
||||||
|
$bgColor = $colorShades[$colorSetIndex][$shadeIndex];
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php foreach ($statuses as $status => $count) : ?>
|
||||||
|
<?php
|
||||||
|
// Skip metadata fields
|
||||||
|
if ($status === 'ticket_type_id'|| $status == "approved"|| $status == "settled"|| $status == "closed" || $status === 'total' || substr($status, -4) === "_ids") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
$formattedStatus = strlen($status) < 5 ? strtoupper($status): ucwords(str_replace('_', ' ', $status));
|
||||||
|
$truncatedStatus = strlen($formattedStatus) > 20 ? substr($formattedStatus, 0, 15) . '...' : $formattedStatus;
|
||||||
|
$showTooltip = strlen($formattedStatus) > 20;
|
||||||
|
?>
|
||||||
|
<div class="col-md-2 col-xl-1 claimStatusTitle_<?= $ticketTypeId ?>" style="display: none;">
|
||||||
|
<div class="card order-card" style="background: <?= $bgColor ?>;" onclick="linkRedirectForClaims(<?= $ticketTypeId ?>, '<?= $status ?>','<?= $statuses[$status . '_ids'] ?? '' ?>')">
|
||||||
|
<h2 class="text-center"><span><?= $count ?></span></h2>
|
||||||
|
<h6 class="m-b-20 font-15 text-center"
|
||||||
|
<?= $showTooltip ? 'data-toggle="tooltip" title="' . htmlspecialchars($formattedStatus, ENT_QUOTES, 'UTF-8') . '"' : '' ?>>
|
||||||
|
<?= $truncatedStatus ?>
|
||||||
|
</h6>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('.goBack').hide();
|
||||||
|
$('[class*="claimStatusTitle_"]').hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
function hideAndShowTile(type, claimType = null) {
|
||||||
|
|
||||||
|
if (type == 1) {
|
||||||
|
|
||||||
|
$('.claimTypeTile').hide();
|
||||||
|
$(".goBack").show();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$('.claimTypeTile').show();
|
||||||
|
$('.goBack').hide();
|
||||||
|
$('[class*="claimStatusTitle_"]').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == 1 && claimType != null) {
|
||||||
|
|
||||||
|
$('.claimTypeTile').hide();
|
||||||
|
$('.claimStatusTitle_' + claimType).show();
|
||||||
|
|
||||||
|
if (claimType == 1) {
|
||||||
|
$('#current_tile').text("Viewing Details For : GMC");
|
||||||
|
} else if (claimType == 2) {
|
||||||
|
$('#current_tile').text("Viewing Details For : GPA");
|
||||||
|
} else if (claimType == 3) {
|
||||||
|
$('#current_tile').text("Viewing Details For : EDLI");
|
||||||
|
} else if (claimType == 4) {
|
||||||
|
$('#current_tile').text("Viewing Details For : GTLI");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function linkRedirectForClaims(ticketTypeId, status,ids) {
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
// $.ajax({
|
||||||
|
// url: "<?= base_url("/dashboard/prepareClaimSearchData") ?>",
|
||||||
|
// type: "POST",
|
||||||
|
// data: {
|
||||||
|
// ticketTypeId: ticketTypeId,
|
||||||
|
// status: status
|
||||||
|
// },
|
||||||
|
// success: function(response) {
|
||||||
|
// // Handle the response from the server
|
||||||
|
// if (response.status === 'success') {
|
||||||
|
// // Redirect to the claims list page with the selected filters
|
||||||
|
// console.log("response", response);
|
||||||
|
// // alert(JSON.stringify(response));
|
||||||
|
// data = response.data;
|
||||||
|
// data.is_dashboard = 1;
|
||||||
|
// redirectWithPost("<?= base_url("ticket/list") ?>", data);
|
||||||
|
// } else {
|
||||||
|
// // Handle error case
|
||||||
|
// console.log('Error: ' + response.message);
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// error: function(xhr, status, error) {
|
||||||
|
// // Handle AJAX error
|
||||||
|
// console.error('AJAX Error:', error);
|
||||||
|
// // alert('An error occurred while processing your request.');
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
|
data = {
|
||||||
|
is_dashboard: 1,
|
||||||
|
ids : ids
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
redirectWithPost("<?= base_url("ticket/list") ?>", data);
|
||||||
|
}
|
||||||
|
|
||||||
|
function redirectWithPost(url, data = {}) {
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.method = 'POST';
|
||||||
|
form.action = url;
|
||||||
|
|
||||||
|
for (const key in data) {
|
||||||
|
if (data.hasOwnProperty(key)) {
|
||||||
|
const input = document.createElement('input');
|
||||||
|
input.type = 'hidden';
|
||||||
|
input.name = key;
|
||||||
|
input.value = data[key];
|
||||||
|
form.appendChild(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
document.body.appendChild(form);
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
453
app/Views/client_api.php
Normal file
453
app/Views/client_api.php
Normal file
@ -0,0 +1,453 @@
|
|||||||
|
<style>
|
||||||
|
.card {
|
||||||
|
padding-top: 0px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="tab-pane fade" id="api-tab">
|
||||||
|
<div class="card">
|
||||||
|
<!-- <div class="card-header">
|
||||||
|
<h5>API Token Management</h5>
|
||||||
|
</div> -->
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label for="is_api">Enable API Access</label>
|
||||||
|
<label class="switch">
|
||||||
|
<input <?= isset($api_data) ? "Checked" : "" ?> id="is_api" type="checkbox" name="is_api">
|
||||||
|
<span class="slider round" style="height: 27px;"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div id="api-token-section">
|
||||||
|
<!-- Generate Token Section -->
|
||||||
|
<form id="api-form" data-parsley-validate>
|
||||||
|
<input type="hidden" id="apiPK" name="id" value="<?= isset($api_data) ? $api_data['id'] : "" ?>">
|
||||||
|
<div class="mb-4">
|
||||||
|
<h5 class="mb-3">Generate New Token</h5>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="client_token" value="<?= isset($api_data) ? $api_data['client_token'] : "" ?>" class="form-control" id="client_token" placeholder="Click generate to create token" readonly required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-6 d-flex">
|
||||||
|
<button class="btn btn-primary me-2" type="button" onclick="generateToken('client_token')">
|
||||||
|
<i class="mdi mdi-key-chain-variant me-1"></i> Generate Token
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-secondary" type="button" onclick="copyToken('client_token')">
|
||||||
|
<i class="mdi mdi-content-copy me-1"></i> Copy
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- <div class="row" style="padding-top:10px">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<label for="auth_type">Authorization Type</label>
|
||||||
|
<input type="text" class="form-control" id="auth_type" value="Authorization - Bearer" readonly>
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
|
</div>
|
||||||
|
<!-- <div class="table-responsive">
|
||||||
|
<table class="table table-bordered table-striped">
|
||||||
|
<tr>
|
||||||
|
<td>Get Individual Employee Data</td>
|
||||||
|
<td><?= base_url("getEmpData") ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Get All Employee Data</td>
|
||||||
|
<td><?= base_url("getAllEmpData") ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Get Branch Wise Employee Data</td>
|
||||||
|
<td><?= base_url("getClientBranchEmpData") ?></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Enter Token Section -->
|
||||||
|
<hr>
|
||||||
|
<div class="mt-5">
|
||||||
|
<h5 class="mb-3">Webhooks (PUSH)</h5>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="col-md-2">
|
||||||
|
<label>Webhook Action</label>
|
||||||
|
<input type="text" class="form-control" id="webhook_action" value="Employee" readonly>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<label>Webhook Method Type</label>
|
||||||
|
<select class="form-control" name="emp_method">
|
||||||
|
<option value="post" <?= isset($api_data['emp_method']) && $api_data['emp_method'] == "post" ? "selected" : "" ?>>POST</option>
|
||||||
|
<option value="get" <?= isset($api_data['emp_method']) && $api_data['emp_method'] == "get" ? "selected" : "" ?>>GET</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label>Webhook URL</label>
|
||||||
|
<input type="text" name="emp_url" value="<?= isset($api_data) ? $api_data['emp_url'] : "" ?>" class="form-control emp_webhook" onchange="validateWebhookUrlById(this.id)" id="webhook_url" placeholder="Enter Webhook URL">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<label>Token Type</label>
|
||||||
|
<select class="form-control" name="emp_tkn_type">
|
||||||
|
<option value="bearer" <?= (isset($api_data) && $api_data['emp_tkn_type'] == 'bearer') ? 'selected' : '' ?>>Bearer Token</option>
|
||||||
|
<option value="X-API-KEY" <?= (isset($api_data) && $api_data['emp_tkn_type'] == 'X-API-KEY') ? 'selected' : '' ?>>API Key</option>
|
||||||
|
<option value="token" <?= (isset($api_data) && $api_data['emp_tkn_type'] == 'token') ? 'selected' : '' ?>>Token</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<label>Authorization Token</label>
|
||||||
|
<input type="text" id="client_api_token" name="emp_token" value="<?= isset($api_data) ? $api_data['emp_token'] : "" ?>" class="form-control emp_webhook" placeholder="Enter Client API token" />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="client_object_type">Client Object Type</label>
|
||||||
|
<textarea class="form-control emp_webhook" name="emp_obj" onchange="checkValidJson(this)" id="client_object_type" rows="3" placeholder="Enter the object type"><?= isset($api_data) ? htmlspecialchars($api_data['emp_obj']) : "" ?></textarea>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="col-md-2">
|
||||||
|
<label>Webhook Action</label>
|
||||||
|
<input type="text" class="form-control" id="webhook_action" value="Claims" readonly>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<label>Webhook Method Type</label>
|
||||||
|
<select class="form-control" name="claim_method">
|
||||||
|
<option value="post" <?= isset($api_data['claim_method']) && $api_data['claim_method'] == "post" ? "selected" : "" ?>>POST</option>
|
||||||
|
<option value="get" <?= isset($api_data['claim_method']) && $api_data['claim_method'] == "get" ? "selected" : "" ?>>GET</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label>Webhook URL</label>
|
||||||
|
<input type="text" name="claim_url" value="<?= isset($api_data) ? $api_data['claim_url'] : "" ?>" class="form-control claim_webhook" onchange="validateWebhookUrlById(this.id)" id="webhook_url_claims" placeholder="Enter Webhook URL">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<label>Token Type</label>
|
||||||
|
<select class="form-control" name="claim_tkn_type">
|
||||||
|
<option value="bearer" <?= (isset($api_data) && $api_data['claim_tkn_type'] == 'bearer') ? 'selected' : '' ?>>Bearer Token</option>
|
||||||
|
<option value="X-API-KEY" <?= (isset($api_data) && $api_data['claim_tkn_type'] == 'X-API-KEY') ? 'selected' : '' ?>>API Key</option>
|
||||||
|
<option value="token" <?= (isset($api_data) && $api_data['claim_tkn_type'] == 'token') ? 'selected' : '' ?>>Token</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<label>Authorization Token</label>
|
||||||
|
<input type="text" id="client_api_token" name="claim_token" value="<?= isset($api_data) ? $api_data['claim_token'] : "" ?>" class="form-control claim_webhook" placeholder="Enter Client API token">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="client_object_type">Client Object Type</label>
|
||||||
|
<textarea class="form-control claim_webhook" name="claim_obj" onchange="checkValidJson(this)" id="client_object_type_claims" rows="3" placeholder="Enter the object type"><?= isset($api_data) ? htmlspecialchars($api_data['claim_obj']) : "" ?></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<h5 class="mt-5">Webhooks (PULL)</h5>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="col-md-2">
|
||||||
|
<label>Webhook Action</label>
|
||||||
|
<input type="text" class="form-control" id="webhook_action2" value="Employee" readonly>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<label>Webhook Method Type</label>
|
||||||
|
<select class="form-control" disabled>
|
||||||
|
<option value="post" selected>POST</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label>Webhook URL</label>
|
||||||
|
<input type="text" value="<?= base_url("retrieveWebhookDataEmp") ?>" class="form-control" onchange="validateWebhookUrlById(this.id)" id="webhook_url2" readonly placeholder="Enter Webhook URL">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<label>Token Type</label>
|
||||||
|
<select class="form-control" disabled>
|
||||||
|
<option value="bearer" selected>Bearer Token</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row mt-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label>Authorization Token</label>
|
||||||
|
<input type="text" name="pull_emp_token" value="<?= isset($api_data) ? $api_data['pull_emp_token'] : "" ?>" class="form-control" id="pull_emp_token" placeholder="Click generate to create token" readonly required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 d-flex align-items-end">
|
||||||
|
<button class="btn btn-primary me-2" type="button" onclick="generateToken('pull_emp_token')">
|
||||||
|
<i class="mdi mdi-key-chain-variant me-1"></i> Generate Token
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-secondary" type="button" onclick="copyToken('pull_emp_token')">
|
||||||
|
<i class="mdi mdi-content-copy me-1"></i> Copy
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group mt-3">
|
||||||
|
<label for="pull_emp_obj">Emp Object Type</label>
|
||||||
|
<textarea class="form-control" name="pull_emp_obj" onchange="checkValidJson(this)" id="pull_emp_obj" rows="3" placeholder="Enter the object type"><?= isset($api_data) ? htmlspecialchars($api_data['pull_emp_obj']) : "" ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-2">
|
||||||
|
<label>Webhook Action</label>
|
||||||
|
<input type="text" class="form-control" id="webhook_action2" value="Claim" readonly>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<label>Webhook Method Type</label>
|
||||||
|
<select class="form-control">
|
||||||
|
<option value="post" selected>POST</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label>Webhook URL</label>
|
||||||
|
<input type="text" value="<?= base_url("retrieveWebhookDataClaim") ?>" class="form-control" onchange="validateWebhookUrlById(this.id)" id="webhook_url2" readonly placeholder="Enter Webhook URL">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<label>Token Type</label>
|
||||||
|
<select class="form-control">
|
||||||
|
<option value="bearer" selected>Bearer Token</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label>Authorization Token</label>
|
||||||
|
<input type="text" name="pull_claim_token" value="<?= isset($api_data) ? $api_data['pull_claim_token'] : "" ?>" class="form-control" id="pull_claim_token" placeholder="Click generate to create token" readonly required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 d-flex align-items-end">
|
||||||
|
<button class="btn btn-primary me-2" type="button" onclick="generateToken('pull_claim_token')">
|
||||||
|
<i class="mdi mdi-key-chain-variant me-1"></i> Generate Token
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-secondary" type="button" onclick="copyToken('pull_claim_token')">
|
||||||
|
<i class="mdi mdi-content-copy me-1"></i> Copy
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<label for="pull_claim_obj">Claim Object Type</label>
|
||||||
|
<textarea class="form-control" name="pull_claim_obj" onchange="checkValidJson(this)" id="pull_claim_obj" rows="3" placeholder="Enter the object type"><?= isset($api_data) ? htmlspecialchars($api_data['pull_claim_obj']) : "" ?></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex justify-content-end">
|
||||||
|
<button class="btn btn-primary waves-effect waves-light mr-1" type="submit" id="formSubmit">Submit</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function generateToken(element_id) {
|
||||||
|
|
||||||
|
// alert($("#general_PrimaryKey").val());
|
||||||
|
// console.log('element_id:', element_id);
|
||||||
|
$.ajax({
|
||||||
|
url: "<?= base_url('client/generateToken') ?>",
|
||||||
|
type: "GET",
|
||||||
|
data: {
|
||||||
|
client_id: $("#general_PrimaryKey").val()
|
||||||
|
},
|
||||||
|
beforeSend: function() {
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
if (response.status) {
|
||||||
|
toastr.success(response.message);
|
||||||
|
$(`#${element_id}`).val(response.token);
|
||||||
|
} else {
|
||||||
|
toastr.error(response.message);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error("Error:", error);
|
||||||
|
toastr.error("An error occurred while processing your request.");
|
||||||
|
},
|
||||||
|
complete: function() {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').fadeOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyToken(element_id) {
|
||||||
|
const tokenField = document.getElementById(`${element_id}`);
|
||||||
|
if (tokenField.value) {
|
||||||
|
tokenField.select();
|
||||||
|
navigator.clipboard.writeText(tokenField.value);
|
||||||
|
toastr.success('Token copied to clipboard!');
|
||||||
|
} else {
|
||||||
|
toastr.warning('Generate a token first!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function pasteToken() {
|
||||||
|
try {
|
||||||
|
// Get the target input field
|
||||||
|
const tokenInput = document.getElementById('client_api_token');
|
||||||
|
|
||||||
|
// Request clipboard read permission
|
||||||
|
const permission = await navigator.permissions.query({
|
||||||
|
name: 'clipboard-read'
|
||||||
|
});
|
||||||
|
if (permission.state === 'denied') {
|
||||||
|
toastr.error('Clipboard access denied by user');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read clipboard contents
|
||||||
|
const text = await navigator.clipboard.readText();
|
||||||
|
|
||||||
|
// Security checks
|
||||||
|
if (text.length > 256) {
|
||||||
|
toastr.warning('Invalid token length');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!/^[a-zA-Z0-9\-_]+$/.test(text)) {
|
||||||
|
toastr.warning('Invalid token format');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert into input field
|
||||||
|
tokenInput.value = text;
|
||||||
|
|
||||||
|
// Visual feedback
|
||||||
|
tokenInput.focus();
|
||||||
|
toastr.success('Token pasted securely');
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Paste failed:', error);
|
||||||
|
toastr.error('Failed to read clipboard');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$("#is_api").change(function() {
|
||||||
|
checkAndShowApiElements();
|
||||||
|
});
|
||||||
|
$(document).ready(function() {
|
||||||
|
checkAndShowApiElements();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function checkAndShowApiElements() {
|
||||||
|
if ($("#is_api").is(":checked")) {
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
$("#api-token-section").show();
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').fadeOut();
|
||||||
|
} else {
|
||||||
|
$("#api-token-section").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkValidJson(el) {
|
||||||
|
|
||||||
|
const element = document.getElementById(el.id);
|
||||||
|
if (!element) {
|
||||||
|
console.error('Element with ID "${id}" not found.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
JSON.parse(element.value);
|
||||||
|
} catch (e) {
|
||||||
|
el.value = '';
|
||||||
|
toastr.error('Invalid JSON format');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateWebhookUrlById(id) {
|
||||||
|
console.log("function called");
|
||||||
|
const element = document.getElementById(id);
|
||||||
|
if (!element) {
|
||||||
|
console.error(`Element with ID "${id}" not found.`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const url = element.value.trim(); // Trim whitespace
|
||||||
|
try {
|
||||||
|
// Use the URL constructor to validate structure
|
||||||
|
const parsedUrl = new URL(url);
|
||||||
|
if (parsedUrl.pathname !== "/" && parsedUrl.pathname.endsWith("/")) {
|
||||||
|
element.value = "";
|
||||||
|
toastr.error("Webhook URL should not end with a trailing slash.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parsedUrl.pathname.endsWith(".")) {
|
||||||
|
element.value = "";
|
||||||
|
toastr.error("Webhook URL should not end with a trailing dot.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// const strictDomainRegex = /^[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/;
|
||||||
|
// if (!strictDomainRegex.test(parsedUrl.hostname)) {
|
||||||
|
// toastr.error("Invalid domain format in webhook URL.");
|
||||||
|
// element.value = "";
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// Check if protocol is HTTP/HTTPS
|
||||||
|
return parsedUrl.protocol === "http:" || parsedUrl.protocol === "https:";
|
||||||
|
} catch (e) {
|
||||||
|
toastr.error("Invalid Webhook URL format");
|
||||||
|
element.value = "";
|
||||||
|
return false; // Invalid URL structure
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#api-form").submit(function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
const form = $(this);
|
||||||
|
// form.parsley().validate(); // Activate Parsley validation
|
||||||
|
|
||||||
|
if (!$(this).parsley().isValid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const formData = $(this).serializeArray();
|
||||||
|
formData.push({
|
||||||
|
name: "client_id",
|
||||||
|
value: $("#general_PrimaryKey").val()
|
||||||
|
});
|
||||||
|
formData.push({
|
||||||
|
name: "api_access",
|
||||||
|
value: $("#is_api").is(":checked") ? 1 : 0
|
||||||
|
});
|
||||||
|
console.log(formData);
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "<?= base_url('client/saveApiData') ?>",
|
||||||
|
type: "POST",
|
||||||
|
data: formData,
|
||||||
|
beforeSend: function() {
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
if (response.status) {
|
||||||
|
toastr.success(response.message);
|
||||||
|
} else {
|
||||||
|
toastr.error(response.message);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error("Error:", error);
|
||||||
|
toastr.error("An error occurred while processing your request.");
|
||||||
|
},
|
||||||
|
complete: function() {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').fadeOut();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".claim_webhook").on("input", function() {
|
||||||
|
|
||||||
|
let anyNotEmpty = $(".claim_webhook").toArray().some(input => $(input).val() !== "");
|
||||||
|
|
||||||
|
$(".claim_webhook").prop("required", anyNotEmpty);
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".emp_webhook").on("input", function() {
|
||||||
|
let anyNotEmpty = $(".emp_webhook").toArray().some(input => $(input).val() !== "");
|
||||||
|
|
||||||
|
$(".emp_webhook").prop("required", anyNotEmpty);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@ -88,6 +88,12 @@ body {
|
|||||||
<span class="d-none d-sm-inline-block">Policies</span>
|
<span class="d-none d-sm-inline-block">Policies</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<!-- <li class="nav-item">
|
||||||
|
<a href="#api-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="api_tab">
|
||||||
|
<span class="mdi mdi-api"></span>
|
||||||
|
<span class="d-none d-sm-inline-block">API</span>
|
||||||
|
</a>
|
||||||
|
</li> -->
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="#others-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="others_tab">
|
<a href="#others-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="others_tab">
|
||||||
<span class="mr-1"><i class="mdi mdi-tag-text-outline"></i></span>
|
<span class="mr-1"><i class="mdi mdi-tag-text-outline"></i></span>
|
||||||
@ -96,6 +102,7 @@ body {
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
|
<?php include("client_api.php"); ?>
|
||||||
<?php include('client_others_tab.php'); ?>
|
<?php include('client_others_tab.php'); ?>
|
||||||
<?php include('notification.php'); ?>
|
<?php include('notification.php'); ?>
|
||||||
<?php include('client_basic_info.php'); ?>
|
<?php include('client_basic_info.php'); ?>
|
||||||
|
|||||||
@ -732,9 +732,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { ?>
|
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team()))) { ?>
|
||||||
|
|
||||||
<?php if (in_array(get_role_id(), [1,5]) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
<?php if (in_array(get_role_id(), [1,5]) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team()) ) { ?>
|
||||||
<li>
|
<li>
|
||||||
<a href="#policyReports" data-toggle="collapse" class="waves-effect">
|
<a href="#policyReports" data-toggle="collapse" class="waves-effect">
|
||||||
<i class="ri-file-chart-fill"></i>
|
<i class="ri-file-chart-fill"></i>
|
||||||
@ -745,6 +745,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
|
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
|
||||||
</li>
|
</li>
|
||||||
|
<?php if (in_array(get_role_id(), [1,5]) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||||
<li>
|
<li>
|
||||||
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a>
|
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a>
|
||||||
</li>
|
</li>
|
||||||
@ -757,11 +758,13 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="<?= base_url('/bdsReport/renewal_report') ?>">Renewal Reports</a>
|
<a href="<?= base_url('/bdsReport/renewal_report') ?>">Renewal Reports</a>
|
||||||
</li>
|
</li>
|
||||||
|
<?php } ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()) )) { ?>
|
||||||
<li>
|
<li>
|
||||||
<a href="#policyPendingActions" data-toggle="collapse" class="waves-effect">
|
<a href="#policyPendingActions" data-toggle="collapse" class="waves-effect">
|
||||||
<i class="mdi mdi-timer-sand"></i>
|
<i class="mdi mdi-timer-sand"></i>
|
||||||
@ -783,7 +786,9 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()) )) { ?>
|
||||||
<li>
|
<li>
|
||||||
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
|
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
|
||||||
<i class="ri-database-2-line"></i>
|
<i class="ri-database-2-line"></i>
|
||||||
@ -800,13 +805,16 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { ?>
|
||||||
<li>
|
<li>
|
||||||
<a href="<?= base_url('/dmsSearch') ?>">
|
<a href="<?= base_url('/dmsSearch') ?>">
|
||||||
<i class="ri-book-open-line"></i>
|
<i class="ri-book-open-line"></i>
|
||||||
<span> Documents</span>
|
<span> Documents</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
312
app/Views/leads_dash.php
Normal file
312
app/Views/leads_dash.php
Normal file
@ -0,0 +1,312 @@
|
|||||||
|
<style>
|
||||||
|
|
||||||
|
body{
|
||||||
|
margin-top:20px;
|
||||||
|
background:#FAFAFA;
|
||||||
|
}
|
||||||
|
.order-card {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-blue {
|
||||||
|
background: linear-gradient(45deg,#4099ff,#73b4ff);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-green {
|
||||||
|
background: linear-gradient(45deg,#2ed8b6,#59e0c5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-yellow {
|
||||||
|
background: linear-gradient(45deg,#FFB64D,#ffcb80);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-pink {
|
||||||
|
background: linear-gradient(45deg,#FF5370,#ff869a);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-red {
|
||||||
|
background: linear-gradient(45deg,#FF4E50,#F9D423);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-purple {
|
||||||
|
background: linear-gradient(45deg,#9D50BB,#6E48AA);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-orange {
|
||||||
|
background: linear-gradient(45deg,#F2994A,#F2C94C);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-teal {
|
||||||
|
background: linear-gradient(45deg,#1ABC9C,#16A085);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-cyan {
|
||||||
|
background: linear-gradient(45deg,#00C9FF,#92FE9D);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-lime {
|
||||||
|
background: linear-gradient(45deg,#A8E063,#56AB2F);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-indigo {
|
||||||
|
background: linear-gradient(45deg,#3F51B5,#5A55AE);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-Pelorous {
|
||||||
|
background: linear-gradient(45deg, #00d6db, #00a8b5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-Pelorous2 {
|
||||||
|
background: linear-gradient(45deg, #02a8b5, #017f8b);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-Pelorous3 {
|
||||||
|
background: linear-gradient(45deg, #098895, #046063);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-Grenadier {
|
||||||
|
background: linear-gradient(45deg, #ff9d37, #ff7a10);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-Grenadier2 {
|
||||||
|
background: linear-gradient(45deg, #ff8010, #ff4c00);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-Grenadier3 {
|
||||||
|
background: linear-gradient(45deg, #f06306, #cc4b05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-SilverChalice {
|
||||||
|
background: linear-gradient(45deg, #a3a8a8, #8f9494);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-SilverChalice2 {
|
||||||
|
background: linear-gradient(45deg, #7e8484, #686e6e);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-SilverChalice3 {
|
||||||
|
background: linear-gradient(45deg, #5c6363, #434949);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.card {
|
||||||
|
border-radius: 5px;
|
||||||
|
-webkit-box-shadow: 0 1px 2.94px 0.06px rgba(4,26,55,0.16);
|
||||||
|
box-shadow: 0 1px 2.94px 0.06px rgba(4,26,55,0.16);
|
||||||
|
border: none;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
-webkit-transition: all 0.3s ease-in-out;
|
||||||
|
transition: all 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card .card-block {
|
||||||
|
padding-top: 10px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
padding-left: 25px;
|
||||||
|
padding-right: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-card i {
|
||||||
|
font-size: 26px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.f-left {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.f-right {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.m-b-1{
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<?php
|
||||||
|
$isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_team()) ? 'show active' : '';
|
||||||
|
?>
|
||||||
|
<div class="tab-pane fade <?= $isActive ?>" id="leads-dash-tab">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4 col-xl-3 leadTypeTile">
|
||||||
|
<div class="card bg-c-Pelorous order-card" onclick="hide_and_show_tile(1,1)">
|
||||||
|
<div class="card-block">
|
||||||
|
<h6 class="m-b-20 font-15">Leads</h6>
|
||||||
|
<h2 class="text-right"><i class="mdi mdi-playlist-check f-left"></i><span><?= isset($lead_data)? $lead_data['total'] : 0 ?></span></h2>
|
||||||
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4 col-xl-3 leadTypeTile">
|
||||||
|
<div class="card bg-c-Pelorous order-card" onclick="hide_and_show_tile(1,2)">
|
||||||
|
<div class="card-block">
|
||||||
|
<h6 class="m-b-20 font-15">BDS Renewals</h6>
|
||||||
|
<h2 class="text-right"><i class="mdi mdi-playlist-check f-left"></i><span><?= isset($bds_renewal) ? $bds_renewal['total'] : 0?></span></h2>
|
||||||
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="status_tile" style="padding-bottom: 10px;padding-left: 17px; ">
|
||||||
|
<a href="#" onclick="hide_and_show_tile(2)" ><i class="fas fa-arrow-left"></i> Back to Overview</a>
|
||||||
|
</div>
|
||||||
|
<div class="status_tile" style="padding-left: 30px;">
|
||||||
|
<a href="#" id="main_tile" >Current Tile : </a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$colorSetCount = count($colorShades); // Number of color sets
|
||||||
|
$shadeCount = count($colorShades[0]); // Number of shades per set
|
||||||
|
$index = 0;
|
||||||
|
foreach ($lead_data as $key => $value) : ?>
|
||||||
|
<?php
|
||||||
|
if ($key == "total"|| $key == "won" || substr($key, -4) === "_ids") { continue; } // Skip the total key
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
// Initialize color set and shade indexes
|
||||||
|
$colorSetIndex = floor($index / $shadeCount) % $colorSetCount; // Reset color set after each set
|
||||||
|
$shadeIndex = $index % $shadeCount; // Cycle through shades within the set
|
||||||
|
|
||||||
|
// Get the background color for the current tile
|
||||||
|
$bgColor = $colorShades[$colorSetIndex][$shadeIndex];
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
$formattedStatus = strlen($key) < 5 ? strtoupper($key): ucwords(str_replace('_', ' ', $key));
|
||||||
|
$truncatedStatus = strlen($formattedStatus) > 20 ? substr($formattedStatus, 0, 15) . '...' : $formattedStatus;
|
||||||
|
$showTooltip = strlen($formattedStatus) > 20;
|
||||||
|
?>
|
||||||
|
<div class="col-md-2 col-xl-1 leadStatusTitle_1" style="display: none;">
|
||||||
|
<div class="card order-card" style="background: <?= $bgColor ?>;" onclick="linkRedirectForLeads('<?= esc(strtolower(str_replace(' ', '_', $key)), 'js') ?>','<?= $lead_data[$key . '_ids'] ?? '' ?>')">
|
||||||
|
<h2 class="text-center"><span><?= $value ?></span></h2>
|
||||||
|
<h6 class="m-b-20 font-15 text-center"
|
||||||
|
<?= $showTooltip ? 'data-toggle="tooltip" title="' . htmlspecialchars($formattedStatus, ENT_QUOTES, 'UTF-8') . '"' : '' ?>>
|
||||||
|
<?= $truncatedStatus ?>
|
||||||
|
</h6>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php endforeach ?>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$colorSetCount = count($colorShades); // Number of color sets
|
||||||
|
$shadeCount = count($colorShades[0]); // Number of shades per set
|
||||||
|
$index = 0;
|
||||||
|
|
||||||
|
foreach ($bds_renewal as $key => $value) : ?>
|
||||||
|
<?php
|
||||||
|
if ($key == "total" || substr($key, -4) === "_ids"){ continue; } // Skip the total key
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
// Initialize color set and shade indexes
|
||||||
|
$colorSetIndex = floor($index / $shadeCount) % $colorSetCount; // Reset color set after each set
|
||||||
|
$shadeIndex = $index % $shadeCount; // Cycle through shades within the set
|
||||||
|
|
||||||
|
// Get the background color for the current tile
|
||||||
|
$bgColor = $colorShades[$colorSetIndex][$shadeIndex];
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
$formattedStatus = strlen($key) < 5 ? strtoupper($key): ucwords(str_replace('_', ' ', $key));
|
||||||
|
$truncatedStatus = strlen($formattedStatus) > 20 ? substr($formattedStatus, 0, 15) . '...' : $formattedStatus;
|
||||||
|
$showTooltip = strlen($formattedStatus) > 20;
|
||||||
|
?>
|
||||||
|
<div class="col-md-2 col-xl-1 leadStatusTitle_2" style="display: none;">
|
||||||
|
<div class="card order-card" style="background: <?= $bgColor ?>;" onclick="linkRedirectForPolicy('<?= isset($bds_renewal[$key . '_ids']) ? str_replace(' ', '_', $bds_renewal[$key . '_ids']) : '' ?>')">
|
||||||
|
<h2 class="text-center"><span><?= $value ?></span></h2>
|
||||||
|
<h6 class="m-b-20 font-15 text-center"
|
||||||
|
<?= $showTooltip ? 'data-toggle="tooltip" title="' . htmlspecialchars($formattedStatus, ENT_QUOTES, 'UTF-8') . '"' : '' ?>>
|
||||||
|
<?= $truncatedStatus ?>
|
||||||
|
</h6>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php endforeach ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
$(".status_tile").hide();
|
||||||
|
});
|
||||||
|
function hide_and_show_tile(type,leadType = null) {
|
||||||
|
|
||||||
|
if (type == 1) {
|
||||||
|
|
||||||
|
$('.leadTypeTile').hide();
|
||||||
|
$('.status_tile').show();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$('.leadTypeTile').show();
|
||||||
|
$('.leadStatusTitle_1').hide();
|
||||||
|
$('.leadStatusTitle_2').hide();
|
||||||
|
$(".status_tile").hide();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == 1 && leadType != null && leadType == 1){
|
||||||
|
$('.leadStatusTitle_1').show();
|
||||||
|
$('#main_tile').text("Viewing Details For : Leads");
|
||||||
|
|
||||||
|
}
|
||||||
|
if (type == 1 && leadType != null && leadType == 2){
|
||||||
|
$('.leadStatusTitle_2').show();
|
||||||
|
$("#main_tile").text("Viewing Details For : BDS Renewals");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function linkRedirectForPolicy(ids){
|
||||||
|
var url = "<?= base_url("policy_tranction/report/list") ?>";
|
||||||
|
var data = {
|
||||||
|
ids : ids,
|
||||||
|
is_dashboard : 1
|
||||||
|
}
|
||||||
|
|
||||||
|
redirectWithPost(url,data);
|
||||||
|
}
|
||||||
|
|
||||||
|
function linkRedirectForLeads(status,ids){
|
||||||
|
|
||||||
|
var url = "<?= base_url("leads/list") ?>";
|
||||||
|
var data = {
|
||||||
|
ids : ids,
|
||||||
|
is_dashboard : 1
|
||||||
|
}
|
||||||
|
|
||||||
|
redirectWithPost(url,data);
|
||||||
|
}
|
||||||
|
|
||||||
|
function redirectWithPost(url, data = {}) {
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.method = 'POST';
|
||||||
|
form.action = url;
|
||||||
|
|
||||||
|
for (const key in data) {
|
||||||
|
if (data.hasOwnProperty(key)) {
|
||||||
|
const input = document.createElement('input');
|
||||||
|
input.type = 'hidden';
|
||||||
|
input.name = key;
|
||||||
|
input.value = data[key];
|
||||||
|
form.appendChild(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
document.body.appendChild(form);
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
#editor-container {
|
#editor-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 600px;
|
min-height: 600px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-dialog {
|
.modal-dialog {
|
||||||
max-width: 90% !important;
|
max-width: 90% !important;
|
||||||
@ -264,7 +264,7 @@
|
|||||||
<!-- Unlayer editor -->
|
<!-- Unlayer editor -->
|
||||||
<div class="form-row" id="rac_rate_dropdown">
|
<div class="form-row" id="rac_rate_dropdown">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<div id="member_welcome_mail_editor_container" style="height: 600px;width:max-content"></div>
|
<div id="member_welcome_mail_editor_container" style="height: 600px"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -360,7 +360,7 @@
|
|||||||
<!-- Unlayer editor -->
|
<!-- Unlayer editor -->
|
||||||
<div class="form-row" id="rac_rate_dropdown">
|
<div class="form-row" id="rac_rate_dropdown">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<div id="member_reminder_mail_editor_container" style="height: 600px;width:max-content"></div>
|
<div id="member_reminder_mail_editor_container" style="height: 600px"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -426,7 +426,7 @@
|
|||||||
<select id="member_ecard_mail_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;" onchange="copyToClipboard(this)">
|
<select id="member_ecard_mail_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;" onchange="copyToClipboard(this)">
|
||||||
<option value="">PlaceHolders</option>
|
<option value="">PlaceHolders</option>
|
||||||
<?php foreach ($placeHolders as $value): ?>
|
<?php foreach ($placeHolders as $value): ?>
|
||||||
<?php if ($value == 'member_name' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name' || $value == 'member_summary') { ?>
|
<?php if ($value) { ?>
|
||||||
<?php $valueChange = str_replace('_', ' ', $value);
|
<?php $valueChange = str_replace('_', ' ', $value);
|
||||||
$valueChange = ucwords($valueChange); ?>
|
$valueChange = ucwords($valueChange); ?>
|
||||||
<option value="{{<?php echo $value; ?>}}"><?php echo $valueChange; ?></option>
|
<option value="{{<?php echo $value; ?>}}"><?php echo $valueChange; ?></option>
|
||||||
@ -440,7 +440,7 @@
|
|||||||
<!-- Unlayer editor -->
|
<!-- Unlayer editor -->
|
||||||
<div class="form-row" id="rac_rate_dropdown">
|
<div class="form-row" id="rac_rate_dropdown">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<div id="member_ecard_mail_editor_container" style="height: 600px;width:max-content"></div>
|
<div id="member_ecard_mail_editor_container" style="height: 600px"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -542,7 +542,7 @@
|
|||||||
<!-- Unlayer editor -->
|
<!-- Unlayer editor -->
|
||||||
<div class="form-row" id="rac_rate_dropdown">
|
<div class="form-row" id="rac_rate_dropdown">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<div id="member_review_and_summary_mail_editor_container" style="height: 600px;width:max-content"></div>
|
<div id="member_review_and_summary_mail_editor_container" style="height: 600px;"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -615,7 +615,7 @@
|
|||||||
<!-- Unlayer editor -->
|
<!-- Unlayer editor -->
|
||||||
<!-- <div class="form-row" id="rac_rate_dropdown"> -->
|
<!-- <div class="form-row" id="rac_rate_dropdown"> -->
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<div id="account_maneger_summary_mail_editor_container" style="height: 600px;width:max-content"></div>
|
<div id="account_maneger_summary_mail_editor_container" style="height: 600px"></div>
|
||||||
</div>
|
</div>
|
||||||
<!-- </div> -->
|
<!-- </div> -->
|
||||||
<div class="form-group text-right m-b-0">
|
<div class="form-group text-right m-b-0">
|
||||||
@ -702,7 +702,7 @@
|
|||||||
<!-- Unlayer editor -->
|
<!-- Unlayer editor -->
|
||||||
<div class="form-row" id="rac_rate_dropdown">
|
<div class="form-row" id="rac_rate_dropdown">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<div id="client_hr_summary_mail_editor_container" style="height: 600px;width:max-content"></div>
|
<div id="client_hr_summary_mail_editor_container" style="height: 600px"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -119,6 +119,7 @@
|
|||||||
<input type="hidden" name="client_id" id="client_id_for_edit">
|
<input type="hidden" name="client_id" id="client_id_for_edit">
|
||||||
<input type="hidden" name="insurer_id" id="insurer_id">
|
<input type="hidden" name="insurer_id" id="insurer_id">
|
||||||
<input type="hidden" name="cd_ac_no" id="cd_ac_no">
|
<input type="hidden" name="cd_ac_no" id="cd_ac_no">
|
||||||
|
<input type="hidden" name="cd_ac_pk" id="cd_ac_pk">
|
||||||
<input type="hidden" name="ct_type" id="ct_type">
|
<input type="hidden" name="ct_type" id="ct_type">
|
||||||
<input type="hidden" name="" id="bro_payable_by">
|
<input type="hidden" name="" id="bro_payable_by">
|
||||||
<input type="hidden" name="" id="cop_yes">
|
<input type="hidden" name="" id="cop_yes">
|
||||||
@ -310,6 +311,15 @@
|
|||||||
<label for="policy_with_corr" style="position: relative;top: 33px;left: 25px;"> Policy with Correction</label>
|
<label for="policy_with_corr" style="position: relative;top: 33px;left: 25px;"> Policy with Correction</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label class="switch" style="position: relative;top: 32px;left: 20px;">
|
||||||
|
<input id="is_cd_reduce_from_bds" type="checkbox" name="is_cd_reduce_from_bds">
|
||||||
|
<span class="slider round" style="height: 27px;"></span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label for="is_cd_reduce_from_bds" style="position: relative;top: 33px;left: 25px;">Make Entry in CD <i class="fa fa-info-circle" data-toggle="tooltip" title="Enabling this will affect ( Credit/Debit ) the CD transaction. ( GMC, GPA, EDLI and GTLI, CD transaction from CRM )"></i></label>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
@ -585,6 +595,14 @@ $(document).ready(function(){
|
|||||||
var cd_ac_no = $(this).find('option:selected').attr('data-cd');
|
var cd_ac_no = $(this).find('option:selected').attr('data-cd');
|
||||||
var start_date = $(this).find('option:selected').attr('data-sd');
|
var start_date = $(this).find('option:selected').attr('data-sd');
|
||||||
var end_date = $(this).find('option:selected').attr('data-ed');
|
var end_date = $(this).find('option:selected').attr('data-ed');
|
||||||
|
var policy_type_id = $(this).find('option:selected').attr('data-ptid');
|
||||||
|
|
||||||
|
if(policy_type_id == 1 || policy_type_id == 2 || policy_type_id == 3 || policy_type_id == 4 || policy_type_id == 5 || policy_type_id == 6 || policy_type_id == 7){
|
||||||
|
$('#is_cd_reduce_from_bds').prop('disabled',true).prop('checked', false)
|
||||||
|
}else{
|
||||||
|
$('#is_cd_reduce_from_bds').prop('disabled',false)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// console.log('client_id', client_id);
|
// console.log('client_id', client_id);
|
||||||
// console.log('client_policy_id', client_policy_id);
|
// console.log('client_policy_id', client_policy_id);
|
||||||
@ -596,7 +614,7 @@ $(document).ready(function(){
|
|||||||
$('#policy_no').val(policy_no);
|
$('#policy_no').val(policy_no);
|
||||||
$('#insurer_id').val(insurer);
|
$('#insurer_id').val(insurer);
|
||||||
$('#tpa').val(tpa).change();
|
$('#tpa').val(tpa).change();
|
||||||
$('#cd_ac_no').val(cd_ac_no);
|
// $('#cd_ac_no').val(cd_ac_no);
|
||||||
$('#policy_start_date').val(start_date);
|
$('#policy_start_date').val(start_date);
|
||||||
$('#policy_end_date').val(end_date);
|
$('#policy_end_date').val(end_date);
|
||||||
|
|
||||||
@ -619,6 +637,9 @@ $(document).ready(function(){
|
|||||||
if(res.status == true){
|
if(res.status == true){
|
||||||
if(res.data.length > 0){
|
if(res.data.length > 0){
|
||||||
|
|
||||||
|
$('#ct_type').val(2)
|
||||||
|
$('#cd_ac_pk').val(res.is_copay_yes.cd_ac_pk);
|
||||||
|
$('#cd_ac_no').val(res.cd_master_data.cd_ac_no ?? "");
|
||||||
$('#bro_payable_by').val(res.data[0].bro_payable_by)
|
$('#bro_payable_by').val(res.data[0].bro_payable_by)
|
||||||
|
|
||||||
if(res.is_copay_yes && res.is_copay_yes.co_share == 1){
|
if(res.is_copay_yes && res.is_copay_yes.co_share == 1){
|
||||||
@ -633,9 +654,11 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
$('#ct_type').val(1)
|
||||||
addInsurerColumn()
|
addInsurerColumn()
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
$('#ct_type').val(1)
|
||||||
addInsurerColumn()
|
addInsurerColumn()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -914,6 +937,9 @@ function getPolicyTransactionDataForEndorsementEdit(input){
|
|||||||
$('#last_action_date').val(res.data.last_action_date);
|
$('#last_action_date').val(res.data.last_action_date);
|
||||||
$('#install_due_date').val(res.data.install_due_date);
|
$('#install_due_date').val(res.data.install_due_date);
|
||||||
$('#bro_payable_by').val(res.data.bro_payable_by);
|
$('#bro_payable_by').val(res.data.bro_payable_by);
|
||||||
|
$('#cd_ac_pk').val(res.data.cd_ac_pk);
|
||||||
|
$('#cd_ac_no').val(res.data.cd_ac_no);
|
||||||
|
$('#ct_type').val(res.data.ct_type);
|
||||||
|
|
||||||
if (res.data.policy_with_corr == 1) {
|
if (res.data.policy_with_corr == 1) {
|
||||||
$('#policy_with_corr').prop('checked', true);
|
$('#policy_with_corr').prop('checked', true);
|
||||||
@ -921,6 +947,12 @@ function getPolicyTransactionDataForEndorsementEdit(input){
|
|||||||
$('#policy_with_corr').prop('checked', false);
|
$('#policy_with_corr').prop('checked', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (res.data.is_cd_reduce_from_bds == 1) {
|
||||||
|
$('#is_cd_reduce_from_bds').prop('checked', true).prop('checked', false);
|
||||||
|
} else {
|
||||||
|
$('#is_cd_reduce_from_bds').prop('checked', false);
|
||||||
|
}
|
||||||
|
|
||||||
if (res.data.action_type == 'policy_instalment') {
|
if (res.data.action_type == 'policy_instalment') {
|
||||||
$('.install_due_date_div').show()
|
$('.install_due_date_div').show()
|
||||||
}else{
|
}else{
|
||||||
@ -937,6 +969,13 @@ function getPolicyTransactionDataForEndorsementEdit(input){
|
|||||||
addInsurerColumn();
|
addInsurerColumn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(res.data.policy_type_id == 1 || res.data.policy_type_id == 2 || res.data.policy_type_id == 3 || res.data.policy_type_id == 4 || res.data.policy_type_id == 5 || res.data.policy_type_id == 6 || res.data.policy_type_id == 7){
|
||||||
|
$('#is_cd_reduce_from_bds').prop('disabled',true).prop('checked', false);
|
||||||
|
}else{
|
||||||
|
$('#is_cd_reduce_from_bds').prop('disabled',false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
console.log('No data found');
|
console.log('No data found');
|
||||||
}
|
}
|
||||||
@ -1769,7 +1808,7 @@ function addInsurerColumn() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if(team_id.includes('3')){
|
}else if(team_id.includes('3') || team_id.includes('8')){
|
||||||
|
|
||||||
switch(index) {
|
switch(index) {
|
||||||
case 0: // Insurer selection
|
case 0: // Insurer selection
|
||||||
@ -2155,7 +2194,7 @@ function populateTable(dataArray, status = false) {
|
|||||||
cell.find('input[type="hidden"]').val(status ? data.id : '');
|
cell.find('input[type="hidden"]').val(status ? data.id : '');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}else if(team_id.includes('3')){
|
}else if(team_id.includes('3') || team_id.includes('8')){
|
||||||
switch (rowIndex) {
|
switch (rowIndex) {
|
||||||
case 0: // Insurer selection
|
case 0: // Insurer selection
|
||||||
cell.find('select').val(insurer);
|
cell.find('select').val(insurer);
|
||||||
|
|||||||
@ -698,6 +698,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
'data-itp' : item.itp,
|
'data-itp' : item.itp,
|
||||||
'data-bap' : item.bap,
|
'data-bap' : item.bap,
|
||||||
'data-tpa' : item.tpa_branch_id + '-' + item.tpa_id,
|
'data-tpa' : item.tpa_branch_id + '-' + item.tpa_id,
|
||||||
|
'data-ptid' : item.policy_type_id,
|
||||||
});
|
});
|
||||||
$('#client_policy_id').append(option);
|
$('#client_policy_id').append(option);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -123,6 +123,12 @@
|
|||||||
color: white !important;
|
color: white !important;
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:disabled {
|
||||||
|
background-color: #e0e0e0;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="tab-pane fade active show" id="form">
|
<div class="tab-pane fade active show" id="form">
|
||||||
@ -422,6 +428,16 @@
|
|||||||
<label for="policy_with_corr" style="position: relative;top: 33px;left: 25px;"> Policy with Correction</label>
|
<label for="policy_with_corr" style="position: relative;top: 33px;left: 25px;"> Policy with Correction</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label class="switch" style="position: relative;top: 32px;left: 20px;">
|
||||||
|
<input id="is_cd_reduce_from_bds" type="checkbox" name="is_cd_reduce_from_bds">
|
||||||
|
<span class="slider round" style="height: 27px;"></span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label for="is_cd_reduce_from_bds" style="position: relative;top: 33px;left: 25px;"> Make Entry in CD <i class="fa fa-info-circle" data-toggle="tooltip" title="Enabling this will affect ( Credit/Debit ) the CD transaction. ( GMC, GPA, EDLI and GTLI, CD transaction from CRM )"></i>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- <div class="form-group col-md-3 current_date" style="display: none;">
|
<!-- <div class="form-group col-md-3 current_date" style="display: none;">
|
||||||
<label for="bp_igst">Process Start Date</label>
|
<label for="bp_igst">Process Start Date</label>
|
||||||
<input id="process_start_date" type="text" class="form-control" name="process_start_date" placeholder="DD/MM/YYYY">
|
<input id="process_start_date" type="text" class="form-control" name="process_start_date" placeholder="DD/MM/YYYY">
|
||||||
@ -1352,6 +1368,11 @@ $(document).ready(function(){
|
|||||||
$('#tpa_div').show();
|
$('#tpa_div').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(value == 1 || value == 2 || value == 3 || value == 4 || value == 5 || value == 6 || value == 7){
|
||||||
|
$('#is_cd_reduce_from_bds').prop('disabled',true).prop('checked', false)
|
||||||
|
}else{
|
||||||
|
$('#is_cd_reduce_from_bds').prop('disabled',false)
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1527,6 +1548,12 @@ function getPolicyTransactionDataForEdit(input) {
|
|||||||
$('#tpa_div').show();
|
$('#tpa_div').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(policy_type_id_for_hide_tpa == 1 || policy_type_id_for_hide_tpa == 2 || policy_type_id_for_hide_tpa == 3 || policy_type_id_for_hide_tpa == 4 || policy_type_id_for_hide_tpa == 5 || policy_type_id_for_hide_tpa == 6 || policy_type_id_for_hide_tpa == 7){
|
||||||
|
$('#is_cd_reduce_from_bds').prop('disabled',true).prop('checked', false)
|
||||||
|
}else{
|
||||||
|
$('#is_cd_reduce_from_bds').prop('disabled',false)
|
||||||
|
}
|
||||||
|
|
||||||
if(res.data.client_policy_id != 0 && res.data.client_policy_id != null){
|
if(res.data.client_policy_id != 0 && res.data.client_policy_id != null){
|
||||||
$('#hide_file_upload').show();
|
$('#hide_file_upload').show();
|
||||||
}else{
|
}else{
|
||||||
@ -1744,6 +1771,12 @@ function getPolicyTransactionDataForEdit(input) {
|
|||||||
$('#policy_with_corr').prop('checked', false);
|
$('#policy_with_corr').prop('checked', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (res.data.is_cd_reduce_from_bds == 1) {
|
||||||
|
$('#is_cd_reduce_from_bds').prop('checked', true).prop('checked', false);
|
||||||
|
} else {
|
||||||
|
$('#is_cd_reduce_from_bds').prop('checked', false);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log('No data found');
|
console.log('No data found');
|
||||||
}
|
}
|
||||||
@ -3917,7 +3950,7 @@ function addInsurerColumn() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if(team_id.includes('3')){
|
}else if(team_id.includes('3') || team_id.includes('8')){
|
||||||
|
|
||||||
switch(index) {
|
switch(index) {
|
||||||
case 0: // Insurer selection
|
case 0: // Insurer selection
|
||||||
@ -4312,7 +4345,7 @@ function populateTable(dataArray, cd_ac_pk) {
|
|||||||
cell.find('input[type="hidden"]').val(data.id);
|
cell.find('input[type="hidden"]').val(data.id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}else if(team_id.includes('3')){
|
}else if(team_id.includes('3') || team_id.includes('8')){
|
||||||
|
|
||||||
switch (rowIndex) {
|
switch (rowIndex) {
|
||||||
case 0: // Insurer selection
|
case 0: // Insurer selection
|
||||||
|
|||||||
1
app/Views/testWebhook.php
Normal file
1
app/Views/testWebhook.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
Hello
|
||||||
@ -344,6 +344,7 @@
|
|||||||
$('#primaryKey').val('');
|
$('#primaryKey').val('');
|
||||||
$('#policy_type').val('').change();
|
$('#policy_type').val('').change();
|
||||||
$('#trigger_type').val('').change();
|
$('#trigger_type').val('').change();
|
||||||
|
$("#claim_status_for_template").val("").change;
|
||||||
editor.setEditorValue('');
|
editor.setEditorValue('');
|
||||||
$('#primaryKey').val(null);
|
$('#primaryKey').val(null);
|
||||||
$('#statusSwitch').prop('checked', false);
|
$('#statusSwitch').prop('checked', false);
|
||||||
|
|||||||
@ -255,7 +255,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('input[name="transactionMode"]').change(function() {
|
$('input[name="transactionMode"]').change(function() {
|
||||||
if ($(this).val() === 'adjustment') {
|
if ($(this).val() === 'adjustment') {
|
||||||
$('#transactionTypeRow').show();
|
$('#transactionTypeRow').show();
|
||||||
@ -263,13 +263,13 @@ $(document).ready(function() {
|
|||||||
$('#transactionTypeRow').hide();
|
$('#transactionTypeRow').hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
|
||||||
var record_date = flatpickr("#record_date",{
|
var record_date = flatpickr("#record_date", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
allowInput: false,
|
allowInput: false,
|
||||||
|
|
||||||
@ -291,26 +291,35 @@ var record_date = flatpickr("#record_date",{
|
|||||||
text: 'PDF',
|
text: 'PDF',
|
||||||
title: 'TransactionDetails',
|
title: 'TransactionDetails',
|
||||||
exportOptions: {
|
exportOptions: {
|
||||||
columns: ''
|
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||||
|
format: {
|
||||||
|
body: function(data, row, column, node) {
|
||||||
|
return data.replace(/<.*?>/g, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
customize: function(doc) {
|
||||||
|
doc.pageOrientation = 'landscape';
|
||||||
|
doc.styles.tableHeader.alignment = 'left';
|
||||||
|
doc.defaultStyle.alignment = 'left';
|
||||||
|
doc.content[1].table.widths = ['9%', '9%', '8%', '9%', '10%', '9%', '9%', '9%', '9%', '11%', '8%'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
language: {
|
language: {
|
||||||
search: "_INPUT_",
|
search: "_INPUT_",
|
||||||
searchPlaceholder: "Search..."
|
searchPlaceholder: "Search..."
|
||||||
},
|
},
|
||||||
ordering: false,
|
ordering: false,
|
||||||
paging: true ,
|
paging: true,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
$(document).ready(function() {
|
|
||||||
|
|
||||||
|
|
||||||
// // Event listener for radio buttons
|
// // Event listener for radio buttons
|
||||||
@ -334,34 +343,34 @@ $(document).ready(function() {
|
|||||||
var subType = "";
|
var subType = "";
|
||||||
var record_date = $('#record_date').val();
|
var record_date = $('#record_date').val();
|
||||||
|
|
||||||
if(amount == ""){
|
if (amount == "") {
|
||||||
toastr.warning('Amount field is required')
|
toastr.warning('Amount field is required')
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(description == ""){
|
if (description == "") {
|
||||||
toastr.warning('Description field is required')
|
toastr.warning('Description field is required')
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//tranction type
|
//tranction type
|
||||||
if(transactionTypeValue == 1){
|
if (transactionTypeValue == 1) {
|
||||||
transactionType = 'Credit';
|
transactionType = 'Credit';
|
||||||
subType = '1'; // Replenishment or Deposite
|
subType = '1'; // Replenishment or Deposite
|
||||||
}else if(transactionTypeValue == 2){
|
} else if (transactionTypeValue == 2) {
|
||||||
transactionType = 'Credit'
|
transactionType = 'Credit'
|
||||||
subType = '2'; // Adjustment add
|
subType = '2'; // Adjustment add
|
||||||
}else if(transactionTypeValue == 3){
|
} else if (transactionTypeValue == 3) {
|
||||||
transactionType = 'Debit'
|
transactionType = 'Debit'
|
||||||
subType = '2'; // Adjustment reduce
|
subType = '2'; // Adjustment reduce
|
||||||
}else if(transactionTypeValue == 4){
|
} else if (transactionTypeValue == 4) {
|
||||||
transactionType = 'Credit'
|
transactionType = 'Credit'
|
||||||
subType = '5'; // Asset Policy add
|
subType = '5'; // Asset Policy add
|
||||||
}else if(transactionTypeValue == 5){
|
} else if (transactionTypeValue == 5) {
|
||||||
transactionType = 'Debit'
|
transactionType = 'Debit'
|
||||||
subType = '5'; // Asset Policy reduce
|
subType = '5'; // Asset Policy reduce
|
||||||
}else if(transactionTypeValue == 6){
|
} else if (transactionTypeValue == 6) {
|
||||||
transactionType = 'Debit'
|
transactionType = 'Debit'
|
||||||
subType = '6'; // Refund by indurer
|
subType = '6'; // Refund by indurer
|
||||||
}
|
}
|
||||||
@ -378,7 +387,7 @@ $(document).ready(function() {
|
|||||||
// Send data to the server using Ajax
|
// Send data to the server using Ajax
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: '<?= base_url()."client/save_deposit" ?>',
|
url: '<?= base_url() . "client/save_deposit" ?>',
|
||||||
data: {
|
data: {
|
||||||
amount: amount,
|
amount: amount,
|
||||||
description: description,
|
description: description,
|
||||||
@ -386,7 +395,7 @@ $(document).ready(function() {
|
|||||||
sub_type_id: subType, // Include sub_type_id
|
sub_type_id: subType, // Include sub_type_id
|
||||||
client_id: clientId,
|
client_id: clientId,
|
||||||
insurer_id: insurerId,
|
insurer_id: insurerId,
|
||||||
record_date : record_date
|
record_date: record_date
|
||||||
},
|
},
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
// Handle success response
|
// Handle success response
|
||||||
@ -403,5 +412,5 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -3820,7 +3820,12 @@
|
|||||||
|
|
||||||
tables.forEach(table => {
|
tables.forEach(table => {
|
||||||
if (table.id.includes("summary")) {
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
while true; do
|
|
||||||
echo "Running job at $(date)"
|
|
||||||
/usr/bin/php /var/www/nhance/zenith/public/index.php cli/processjob
|
|
||||||
sleep 1 # Optional: Add a sleep to avoid CPU overload
|
|
||||||
done
|
|
||||||
Loading…
Reference in New Issue
Block a user