Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
bf3a19addf
2
.gitignore
vendored
2
.gitignore
vendored
@ -33,3 +33,5 @@ build/
|
||||
composer.lock
|
||||
.env
|
||||
.phpunit*
|
||||
phpqueue.sh
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ use CodeIgniter\Filters\SecureHeaders;
|
||||
use App\Filters\AuthMVC;
|
||||
use App\Filters\HttpRequestLog;
|
||||
use App\Filters\CloseDbConnection;
|
||||
use App\Filters\AuthClientApi;
|
||||
|
||||
use App\Filters\AuthJWT;
|
||||
|
||||
@ -34,6 +35,7 @@ class Filters extends BaseConfig
|
||||
'authMVC' => AuthMVC::class,
|
||||
'HttpRequestLog' => HttpRequestLog::class,
|
||||
'authJWT' => AuthJWT::class,
|
||||
'AuthClientApi' => AuthClientApi::class,
|
||||
'CloseDbConnection' => CloseDbConnection::class
|
||||
];
|
||||
|
||||
|
||||
@ -52,6 +52,10 @@ $routes->get('/update-emp-policy-status', 'ClientController::updateEmpAndPolicyS
|
||||
$routes->get('download-e-card/(:any)', 'EmployeeController::generateIDCardForEmployee/$1');
|
||||
$routes->get('download-kyc-docs/(:segment)', 'ClientController::downloadKYCDocument/$1');
|
||||
$routes->get('claim-form-download/(:any)', 'TicketController::downloadClaimForm/$1');
|
||||
$routes->match (['get','post'],"claims-feedback-form/(:any)/(:any)", "TicketController::viewClaimFeedbackForm/$1/$2");
|
||||
$routes->match (['get','post'],"claims-feedback-form/(:any)", "TicketController::viewClaimFeedbackForm/$1");
|
||||
|
||||
|
||||
|
||||
$routes->group("/user", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("create", "UserController::create");
|
||||
@ -68,6 +72,7 @@ $routes->group("/dashboard", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get('get-notification', 'DashboardController::getDashboardNotifications');
|
||||
$routes->get('acknowledge-notification/(:segment)', 'DashboardController::acknowledgeMessage/$1');
|
||||
$routes->get('get-pending-action', 'PendingActionsController::getPendingActions');
|
||||
$routes->post("prepareClaimSearchData","DashboardController::prepareClaimSearchData");
|
||||
});
|
||||
|
||||
$routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
||||
@ -83,6 +88,8 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get('view_deposit/(:num)', 'ClientController::view_Deposit/$1');
|
||||
$routes->get('createtransaction', 'ClientController::createtransaction');
|
||||
$routes->post('save_deposit', 'ClientController::saveDeposit');
|
||||
$routes->post("saveApiData", "ClientController::saveApiData");
|
||||
$routes->get("generateToken","ClientController::sendToken");
|
||||
// $routes->get('view_Deposit/(:num)/(:num)','ClientController/view_Deposit/$1/$2');
|
||||
|
||||
$routes->group("notification", ["filter" => "authMVC"], function ($routes) {
|
||||
@ -348,6 +355,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get('getTheEmpDataForClaimSearchByMobile/(:any)', 'ClientController::getTheEmpDataForClaimSearchByMobile/$1');
|
||||
$routes->get('getLeadNonEB/(:any)', 'LeadsController::getLeadNonEB/$1');
|
||||
$routes->get('getPolicyTypeFields', 'LeadsController::getPolicyTypeFields');
|
||||
$routes->get('removeMultiFile', 'LeadsController::removeMultiFile');
|
||||
});
|
||||
|
||||
$routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||
@ -533,6 +541,7 @@ $routes->group("/bdsReport", ["filter" => "authMVC"], function ($routes) {
|
||||
//New Tickets
|
||||
$routes->group("/ticket", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->match( ['get', 'post'], 'list','TicketController::ticketList');
|
||||
$routes->get('feedback-list','TicketController::feedbackList');
|
||||
$routes->get('new/(:any)','TicketController::ticket_form/$1');
|
||||
$routes->post('create','TicketController::createTicket');
|
||||
$routes->post('update','TicketController::updateTicket');
|
||||
@ -547,3 +556,16 @@ $routes->group("/ticket", ["filter" => "authMVC"], function ($routes) {
|
||||
// $routes->post('ticket_messages','TicketController::getTicketMessage');
|
||||
});
|
||||
|
||||
$routes->group("clientApi",["filter" => "AuthClientApi"], function ($routes){
|
||||
|
||||
$routes->post("getPolicyMaster","ClientAPIController::sendPolicyMaster");
|
||||
$routes->post("getEmployeeMaster","ClientAPIController::sendEmpMaster");
|
||||
$routes->post("getClaimMaster","ClientAPIController::sendClaimMaster");
|
||||
// $routes->post("pushData","ClientWebHooksController::sendSample");
|
||||
});
|
||||
|
||||
$routes->post("dispatchWebhookData/(:any)/(:any)",'ClientWebHooksController::pushData/$1/$2');
|
||||
|
||||
|
||||
$routes->post("retrieveWebhookDataEmp","ClientWebHooksController::pullData_emp");
|
||||
$routes->post("retrieveWebhookDataClaim","ClientWebHooksController::pullData_claim");
|
||||
|
||||
@ -17,10 +17,14 @@ class EcardDownloadConversation extends Conversation
|
||||
|
||||
protected function showEcardMenu()
|
||||
{
|
||||
log_message('error', ('showEcardMenu function called'));
|
||||
|
||||
$chat_session_info = get_chatbot_session_info();
|
||||
$policy_list = ChatbotHelper::getListOfPolicies($chat_session_info);
|
||||
$buttons = [];
|
||||
$question = 'Choose Policy to Download Ecard:';
|
||||
log_message('error', ('policy_list : ' . json_encode($policy_list)));
|
||||
|
||||
if(is_array($policy_list) && count($policy_list))
|
||||
{
|
||||
foreach($policy_list as $policy)
|
||||
|
||||
@ -46,9 +46,16 @@ class MainMenuConversation extends Conversation
|
||||
$this->bot->reply($message);
|
||||
}
|
||||
|
||||
log_message('error', ('user_reponse before: ' . $user_reponse));
|
||||
|
||||
|
||||
if (!$answer->isInteractiveMessageReply()) {
|
||||
$user_reponse = null;
|
||||
}
|
||||
|
||||
log_message('error', ('user_reponse is interactive: ' . $answer->isInteractiveMessageReply()));
|
||||
|
||||
|
||||
// Get just the existing path array
|
||||
$path = $this->bot->userStorage()->get('path') ?? [];
|
||||
|
||||
@ -60,25 +67,35 @@ class MainMenuConversation extends Conversation
|
||||
'path' => $path
|
||||
]);
|
||||
|
||||
log_message('error', ('user_reponse after: ' . $user_reponse));
|
||||
|
||||
|
||||
switch ($user_reponse) {
|
||||
|
||||
case "ecard_download":
|
||||
$this->bot->startConversation(new EcardDownloadConversation());
|
||||
log_message('error', 'ecard_download clicked ');
|
||||
|
||||
break;
|
||||
case "network_hospital":
|
||||
$this->bot->startConversation(new NetworkHospitalConversation());
|
||||
log_message('error', 'network_hospital clicked ');
|
||||
break;
|
||||
case "reimbursement_claim":
|
||||
$this->bot->startConversation(new ReimbursementClaimProcessConversation());
|
||||
log_message('error', 'reimbursement_claim clicked ');
|
||||
break;
|
||||
case "reimbursement_status":
|
||||
$this->bot->startConversation(new ReimbursementClaimStatusConversation());
|
||||
log_message('error', 'reimbursement_status clicked ');
|
||||
break;
|
||||
case "new_policy":
|
||||
case "renew_policy":
|
||||
$this->bot->startConversation(new policyConversation());
|
||||
log_message('error', 'renew_policy || new_policy clicked ');
|
||||
break;
|
||||
default:
|
||||
log_message('error', 'default shown ');
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
|
||||
@ -59,7 +59,10 @@ class NetworkHospitalConversation extends Conversation
|
||||
$this->bot->userStorage()->save([
|
||||
'path' => $path
|
||||
]);
|
||||
log_message('error', ('user_reponse : ' . $answer->getValue()));
|
||||
|
||||
switch ($answer->getValue()) {
|
||||
|
||||
case is_string($answer->getValue()) && is_array(explode('#',$answer->getValue())) && count((explode('#',$answer->getValue()))) == 2:
|
||||
|
||||
$client_poilicy_id = explode('#',$answer->getValue())[1];
|
||||
|
||||
@ -46,6 +46,9 @@ class policyConversation extends Conversation
|
||||
if (!$answer->isInteractiveMessageReply()) {
|
||||
$user_reponse = null;
|
||||
}
|
||||
|
||||
log_message('error', ('user_reponse : ' . $answer->getValue()));
|
||||
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
array_push($path,
|
||||
$answer->getValue()
|
||||
|
||||
@ -84,12 +84,13 @@ class ChatbotControllerNew extends BaseController
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
if($this->session->get('CHATBOT_RANDOM_USER_ID') == '-' || $this->session->get('CHATBOT_RANDOM_USER_ID') == '')
|
||||
{
|
||||
|
||||
$user = $this->botman->getUser();
|
||||
$id = $user->getId();
|
||||
// $this->myLogger->logme('error', ('TEST' . $id));
|
||||
$this->myLogger->logme('error', ('TEST' . $id));
|
||||
$this->session->set('CHATBOT_RANDOM_USER_ID', $id);
|
||||
}
|
||||
|
||||
@ -100,6 +101,7 @@ class ChatbotControllerNew extends BaseController
|
||||
}
|
||||
|
||||
$this->botman->hears('.*', function ($bot) {
|
||||
log_message("error","Inside Bot Type Function");
|
||||
|
||||
$bot->types(); // Typing indicator for the first message
|
||||
sleep(0.5); // Delay
|
||||
@ -128,14 +130,14 @@ class ChatbotControllerNew extends BaseController
|
||||
$this->botman->listen();
|
||||
}
|
||||
|
||||
private function registerHandlers()
|
||||
{
|
||||
// Handling Policy and Claims
|
||||
$this->botman->hears('group:policy:{option}', [\App\Controllers\Chatbot\PolicyHandler::class, 'handle']);
|
||||
$this->botman->hears('group:claim:{option}', [\App\Libraries\Chatbot\ClaimHandler::class, 'handle']);
|
||||
// private function registerHandlers()
|
||||
// {
|
||||
// // Handling Policy and Claims
|
||||
// $this->botman->hears('group:policy:{option}', [\App\Controllers\Chatbot\PolicyHandler::class, 'handle']);
|
||||
// $this->botman->hears('group:claim:{option}', [\App\Libraries\Chatbot\ClaimHandler::class, 'handle']);
|
||||
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
public function chatbot()
|
||||
{
|
||||
|
||||
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\MailHelper;
|
||||
use App\Helpers\ClientTokenHelper;
|
||||
use App\helpers\JWTToken;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
@ -39,6 +40,7 @@ use App\Models\PolicyTransactionModel;
|
||||
use App\Models\PolicyTransactionStatusModel;
|
||||
use App\Models\VehicleModel;
|
||||
use App\Models\LeadsModel;
|
||||
use App\Models\ClientApiModel;
|
||||
|
||||
use App\Controllers\EmpDataServiceController;
|
||||
use App\Controllers\GoogleDriveController;
|
||||
@ -83,7 +85,7 @@ class ClientController extends AdminController
|
||||
protected $policyTransactionStatusModel;
|
||||
protected $vehicleModel;
|
||||
protected $leadsModel;
|
||||
|
||||
protected $clientApi;
|
||||
|
||||
|
||||
public function __construct()
|
||||
@ -119,6 +121,7 @@ class ClientController extends AdminController
|
||||
$this->policyTransactionStatusModel = new PolicyTransactionStatusModel();
|
||||
$this->vehicleModel = new VehicleModel();
|
||||
$this->leadsModel = new LeadsModel();
|
||||
$this->clientApi = new ClientApiModel();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
@ -751,7 +754,7 @@ class ClientController extends AdminController
|
||||
$editData['client_policy']['role'] = get_role_id();
|
||||
$editData['notification'] = $this->notificationModel->select('template_name,enabled')->where('client_id', $id)->findAll();
|
||||
$editData['placeHolders'] = ['member_name', 'member_mobile', 'nhance_logo', 'tpa_id', 'ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name'];
|
||||
|
||||
$editData['api_data'] = $this->clientApi->where("client_id", $id)->where("is_active",1)->first();
|
||||
// dd($editData);
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('client_onboarding', $editData);
|
||||
@ -1994,9 +1997,22 @@ class ClientController extends AdminController
|
||||
|
||||
if ($id) {
|
||||
$client_policy_data = $this->clientPolicyModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
|
||||
$insurer_id = $client_policy_data['insurer_id'];
|
||||
$client_id = $client_policy_data['client_id'];
|
||||
|
||||
if (!empty($client_policy_data['policy_start_date'])) {
|
||||
$client_policy_data['source_policy_start_date'] = change_date_format($client_policy_data['policy_start_date'], 'Y-m-d', 'd/m/Y');
|
||||
} else {
|
||||
$client_policy_data['source_policy_start_date'] = null;
|
||||
}
|
||||
|
||||
if (!empty($client_policy_data['policy_end_date'])) {
|
||||
$client_policy_data['source_policy_end_date'] = change_date_format($client_policy_data['policy_end_date'], 'Y-m-d', 'd/m/Y');
|
||||
} else {
|
||||
$client_policy_data['source_policy_end_date'] = null;
|
||||
}
|
||||
|
||||
$polices = $this->policesModel
|
||||
->select('policies.*, policy_type.policy_type')
|
||||
->join('policy_type', 'policy_type.id = policies.policy_type_id')
|
||||
@ -2022,7 +2038,7 @@ class ClientController extends AdminController
|
||||
'policy' => $polices,
|
||||
'client_policy_list' => $client_policy_list,
|
||||
'end_date' => $newDate,
|
||||
'new_start_date' => date('d/m/Y', strtotime($client_policy_data['policy_end_date']))
|
||||
'new_start_date' => date('d/m/Y', strtotime($client_policy_data['policy_end_date'] . ' +1 day')),
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
||||
@ -4745,8 +4761,7 @@ class ClientController extends AdminController
|
||||
// }
|
||||
|
||||
// $data = $this->leadsModel->where('leads.id', 125)->where('leads.is_active', 1)->first();
|
||||
// $RFQdata = $RFQModel->getRFQTableDataWithLeadIDAndType(125, 2);
|
||||
// // Kint::dump($RFQdata);
|
||||
// $RFQdata = $RFQModel->getRFQTableDataWithLeadIDAndType(145, 2);
|
||||
// $returnData = $LeadsController->getPlacementJson($data);
|
||||
// Kint::dump($returnData);
|
||||
// $policy_terms = $LeadsController->convertNonEbQCRJsonToPolicyTerms(json_decode($returnData, true));
|
||||
@ -4756,6 +4771,29 @@ class ClientController extends AdminController
|
||||
// $this->clientPolicyModel->where('id', 6050)->set('policy_terms', $policy_terms)->update();
|
||||
// dd($returnData);
|
||||
|
||||
// Kint::dump($RFQdata['json']);
|
||||
// $inputJson = json_decode($RFQdata['json'], true);
|
||||
// Kint::dump($inputJson);
|
||||
// // print_rr($inputJson['table_data']);
|
||||
// $sortedJson = $this->reorderProposalsByInsurerTotal($inputJson);
|
||||
|
||||
// // If you want to convert back to JSON string
|
||||
// $finalJson = json_encode($sortedJson, JSON_PRETTY_PRINT);
|
||||
|
||||
// // $RFQModel->insert(['lead_id' => 145, 'json' => $finalJson, 'type' => 1]);
|
||||
|
||||
// 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);
|
||||
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
@ -5461,6 +5499,241 @@ class ClientController extends AdminController
|
||||
$id = $InsurerModel->insert($insurerData);
|
||||
return $id;
|
||||
}
|
||||
|
||||
private function reorderProposalsByInsurerTotal(array $data): array {
|
||||
|
||||
Kint::dump($data);
|
||||
if (!isset($data['premium_data']['data'])) return $data;
|
||||
|
||||
$original = $data['premium_data']['data'];
|
||||
$proposals = [];
|
||||
$others = [];
|
||||
$emptyKeyData = [];
|
||||
|
||||
foreach ($original as $key => $value) {
|
||||
// Match only keys that look like 'Proposal X'
|
||||
if (preg_match('/^Proposal\s+\d+$/', $key)) {
|
||||
// Get the insurer entry (not 'Quote Asked')
|
||||
foreach ($value as $subKey => $subVal) {
|
||||
if ($subKey !== 'Quote Asked' && isset($subVal['Total'])) {
|
||||
$proposals[$key] = $value;
|
||||
break;
|
||||
}else{
|
||||
$proposals[$key] = $value;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
if ($key === '' && isset($value['']) && is_array($value[''])) {
|
||||
// Capture empty key to push it later
|
||||
$emptyKeyData[$key] = $value;
|
||||
}else{
|
||||
$others[$key] = $value;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// dd($proposals, $others, $emptyKeyData);
|
||||
// Sort proposals by their insurer's total
|
||||
uasort($proposals, function($a, $b) {
|
||||
$totalA = 0;
|
||||
$totalB = 0;
|
||||
|
||||
foreach ($a as $key => $val) {
|
||||
if ($key !== 'Quote Asked' && isset($val['Total'])) {
|
||||
$totalA = floatval($val['Total']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($b as $key => $val) {
|
||||
if ($key !== 'Quote Asked' && isset($val['Total'])) {
|
||||
$totalB = floatval($val['Total']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $totalA <=> $totalB;
|
||||
});
|
||||
|
||||
// Merge back the sorted proposals into the full structure
|
||||
$data['premium_data']['data'] = array_merge($others, $proposals, $emptyKeyData);
|
||||
$data = $this->reorderProposalDataByPremiumOrder($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function reorderProposalDataByPremiumOrder(array $data): array {
|
||||
if (!isset($data['premium_data']['data'], $data['proposal_data']['over_all_column_data'])) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
$premiumProposals = array_keys($data['premium_data']['data']);
|
||||
$filteredProposals = [];
|
||||
|
||||
// Collect proposal keys that match the pattern "Proposal X"
|
||||
foreach ($premiumProposals as $key) {
|
||||
if (preg_match('/^Proposal\s+\d+$/', $key) && isset($data['proposal_data']['over_all_column_data'][$key])) {
|
||||
$filteredProposals[$key] = $data['proposal_data']['over_all_column_data'][$key];
|
||||
}
|
||||
}
|
||||
|
||||
// dd($premiumProposals, $filteredProposals);
|
||||
|
||||
$data['proposal_data']['over_all_column_data'] = $filteredProposals;
|
||||
$data = $this->reorderProposalInHeaderAndData($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function reorderProposalInHeaderAndData(array $data): array {
|
||||
|
||||
// Kint::dump($data);
|
||||
$tableData = $data['table_data'];
|
||||
$sortedProposalOrder = $data['proposal_data']['over_all_column_data'];
|
||||
$headers = $tableData['headers'] ?? [];
|
||||
$dataRows = $tableData['data'] ?? [];
|
||||
|
||||
// Step 1: Separate static and proposal headers
|
||||
$staticHeaders = [];
|
||||
$proposalHeaders = [];
|
||||
$actionHeader = [];
|
||||
foreach ($headers as $header) {
|
||||
if (in_array($header['parentHeader'], array_keys($sortedProposalOrder))) {
|
||||
$proposalHeaders[$header['parentHeader']] = $header;
|
||||
} else {
|
||||
if($header['parentHeader'] == "Action"){
|
||||
$actionHeader[] = $header;
|
||||
}else{
|
||||
$staticHeaders[] = $header;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// dd($staticHeaders, $proposalHeaders, $sortedProposalOrder);
|
||||
|
||||
// Step 2: Reorder headers
|
||||
$reorderedHeaders = [];
|
||||
foreach ($sortedProposalOrder as $proposalKey => $proposalValue) {
|
||||
if (isset($proposalHeaders[$proposalKey])) {
|
||||
$reorderedHeaders[] = $proposalHeaders[$proposalKey];
|
||||
}
|
||||
}
|
||||
|
||||
// print_rr($reorderedHeaders); die;
|
||||
foreach ($reorderedHeaders as $key => &$value) {
|
||||
$value['parentHeader'] = 'Proposal ' . ($key + 1);
|
||||
}
|
||||
unset($value);
|
||||
|
||||
|
||||
$reorderedHeaders = array_merge($staticHeaders, $reorderedHeaders, $actionHeader);
|
||||
|
||||
|
||||
// Step 3: Reorder each row's `data` by matching parentth
|
||||
foreach ($dataRows as $dataRowIndex => &$row) {
|
||||
$staticData = [];
|
||||
$proposalData = [];
|
||||
$actionData = [];
|
||||
|
||||
foreach ($row['data'] as $entry) {
|
||||
if (in_array($entry['parentth'], array_keys($sortedProposalOrder))) {
|
||||
$proposalData[$entry['parentth']][] = $entry;
|
||||
} else {
|
||||
if($entry['parentth'] == "Action"){
|
||||
$actionData[] = $entry;
|
||||
}else{
|
||||
$staticData[] = $entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$reorderedProposalData = [];
|
||||
foreach ($sortedProposalOrder as $proposalKey => $proposalValue) {
|
||||
if (isset($proposalData[$proposalKey])) {
|
||||
foreach ($proposalData[$proposalKey] as $entry) {
|
||||
$reorderedProposalData[] = $entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$dubParTh = "";
|
||||
$increament = 0;
|
||||
foreach ($reorderedProposalData as $key => &$value) {
|
||||
|
||||
if($dubParTh == $value['parentth']){
|
||||
$value['parentth'] = 'Proposal ' . ($increament);
|
||||
}else{
|
||||
$dubParTh = $value['parentth'];
|
||||
$increament = $increament + 1;
|
||||
$value['parentth'] = 'Proposal ' . ($increament);
|
||||
}
|
||||
}
|
||||
unset($value);
|
||||
|
||||
$row['data'] = array_merge($staticData, $reorderedProposalData, $actionData);
|
||||
}
|
||||
|
||||
$data['table_data']['headers'] = $reorderedHeaders;
|
||||
$data['table_data']['data'] = $dataRows;
|
||||
|
||||
// dd('-----', $data);
|
||||
$renumberedArray = $this->renumberProposalKeys($data['proposal_data']['over_all_column_data']);
|
||||
$updatedDataSet = $this->renumberProposalKeys($data['premium_data']['data']);
|
||||
$data['proposal_data']['over_all_column_data'] = !empty($renumberedArray) ? $renumberedArray : $data['proposal_data']['over_all_column_data'];
|
||||
$data['premium_data']['data'] = !empty($updatedDataSet) ? $updatedDataSet : $data['premium_data']['data'];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function renumberProposalKeys(array $input): array {
|
||||
$result = [];
|
||||
$counter = 1;
|
||||
|
||||
foreach ($input as $key => $value) {
|
||||
if (strpos($key, 'Proposal') === 0) {
|
||||
$newKey = 'Proposal ' . $counter++;
|
||||
$result[$newKey] = $value;
|
||||
} else {
|
||||
$result[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
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\Controllers\PendingActionsContrller;
|
||||
use App\Controllers\EmpDataServiceController;
|
||||
use App\Models\TicketMasterModel;
|
||||
use App\Models\LeadsModel;
|
||||
use App\Models\TicketClaimStatusModel;
|
||||
|
||||
|
||||
class DashboardController extends AdminController
|
||||
{
|
||||
@ -33,8 +37,12 @@ class DashboardController extends AdminController
|
||||
protected $notificationModel;
|
||||
protected $employeePolicyModel;
|
||||
protected $policyTransactionModel;
|
||||
protected $leadModel;
|
||||
protected $ticketModel;
|
||||
protected $ticketStatusModel;
|
||||
protected $policyStatus;
|
||||
protected $colorShades;
|
||||
protected $claimDashLimit;
|
||||
|
||||
protected $myLogger;
|
||||
|
||||
@ -48,9 +56,76 @@ class DashboardController extends AdminController
|
||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||
$this->clientModel = new ClientModel();
|
||||
$this->policyTransactionModel = new PolicyTransactionModel();
|
||||
$this->ticketModel = new TicketMasterModel();
|
||||
$this->leadModel = new LeadsModel();
|
||||
$this->ticketStatusModel = new TicketClaimStatusModel();
|
||||
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
|
||||
$this->claimDashLimit = [
|
||||
1 => [
|
||||
'non_id' => 3,
|
||||
'id_not_generated' => 3,
|
||||
'cda' => 3,
|
||||
'information_required' => 3,
|
||||
'under_process' => 3,
|
||||
'rejected' => 3,
|
||||
'approved' => 3,
|
||||
'payment_initiated' => 3,
|
||||
'settled' => 3,
|
||||
'closed' => 3,
|
||||
'cancelled' => 3,
|
||||
'returned' => 3
|
||||
],
|
||||
|
||||
2 => [
|
||||
'claim_intimation' => 3,
|
||||
'intimation_to_insurer' => 3,
|
||||
'client_pending' => 3,
|
||||
'insurer_pending' => 3,
|
||||
'investigation' => 3,
|
||||
'approved' => 3,
|
||||
'closed' => 3,
|
||||
'not_covered' => 3,
|
||||
'settled' => 3,
|
||||
'coverage_check' => 3,
|
||||
'cancelled' => 3,
|
||||
'returned' => 3,
|
||||
'rejected' => 3,
|
||||
'dv_sent_to_insured' => 3
|
||||
],
|
||||
3 => [
|
||||
'claim_intimation' => 3,
|
||||
'intimation_to_insurer' => 3,
|
||||
'client_pending' => 3,
|
||||
'insurer_pending' => 3,
|
||||
'investigation' => 3,
|
||||
'approved' => 3,
|
||||
'closed' => 3,
|
||||
'not_covered' => 3,
|
||||
'settled' => 3,
|
||||
'coverage_check' => 3,
|
||||
'cancelled' => 3,
|
||||
'returned' => 3,
|
||||
'rejected' => 3
|
||||
],
|
||||
4 => [
|
||||
'claim_intimation' => 3,
|
||||
'intimation_to_insurer' => 3,
|
||||
'client_pending' => 3,
|
||||
'insurer_pending' => 3,
|
||||
'investigation' => 3,
|
||||
'approved' => 3,
|
||||
'closed' => 3,
|
||||
'not_covered' => 3,
|
||||
'settled' => 3,
|
||||
'coverage_check' => 3,
|
||||
'cancelled' => 3,
|
||||
'returned' => 3,
|
||||
'rejected' => 3
|
||||
]
|
||||
];
|
||||
|
||||
$this->policyStatus = [
|
||||
'under_process' => 'Under Process',
|
||||
'client_pending' => 'Client Pending',
|
||||
@ -92,7 +167,6 @@ class DashboardController extends AdminController
|
||||
'linear-gradient(45deg, #494f4f, #353d3d)' // SilverChalice shade 6
|
||||
]
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
public function dashboard()
|
||||
@ -100,8 +174,8 @@ class DashboardController extends AdminController
|
||||
|
||||
$data = [];
|
||||
|
||||
if (in_array(get_role_id(), [1,2,3,5]) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) {
|
||||
|
||||
if (in_array(get_role_id(), [1, 2, 3, 5]) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) {
|
||||
|
||||
$db = db_connect();
|
||||
$sql = "SELECT
|
||||
clients.id AS client_id,
|
||||
@ -169,17 +243,65 @@ class DashboardController extends AdminController
|
||||
$data['financeTeamStatusData'] = $financeTeamStatusData;
|
||||
$data['policyStatus'] = $this->policyStatus;
|
||||
$data['colorShades'] = $this->colorShades;
|
||||
// print_r($data);die;
|
||||
|
||||
}
|
||||
|
||||
$data['claim_data'] = $this->getClaimData();
|
||||
$data['lead_data'] = $this->getLeadData();
|
||||
|
||||
$data['page_name'] = 'Dashboard';
|
||||
|
||||
echo view('layout/header', $data);
|
||||
echo view('DashBoard', $data);
|
||||
echo view('layout/footer');
|
||||
}
|
||||
|
||||
|
||||
public function getLeadData(){
|
||||
|
||||
}
|
||||
|
||||
public function getClaimData()
|
||||
{
|
||||
|
||||
$results = $this->ticketStatusModel
|
||||
->select("ticket_type as ticket_type_id, claim_status")
|
||||
->where("is_active", 1)
|
||||
->findAll();
|
||||
|
||||
$claim_status = [];
|
||||
|
||||
foreach ($results as $row) {
|
||||
if (empty($row['ticket_type_id']) || empty($row['claim_status'])) {
|
||||
continue; // Skip if either value is empty
|
||||
}
|
||||
$typeId = $row['ticket_type_id'];
|
||||
$status = $row['claim_status'];
|
||||
|
||||
// Initialize if not set
|
||||
if (!isset($claim_status[$typeId])) {
|
||||
$claim_status[$typeId] = [];
|
||||
}
|
||||
|
||||
// Use associative array keys to mimic a set
|
||||
$claim_status[$typeId][$status] = true;
|
||||
}
|
||||
|
||||
// Convert set-like structure to plain array
|
||||
foreach ($claim_status as $typeId => $statuses) {
|
||||
$claim_status[$typeId] = array_keys($statuses);
|
||||
}
|
||||
$data = $this->ticketModel->getDashData($claim_status, $this->claimDashLimit);
|
||||
|
||||
// dd($data);
|
||||
// foreach ($data as $dat){
|
||||
// foreach ($dat as $key => $value){
|
||||
// echo($key . " => ". $value);
|
||||
// }
|
||||
// }
|
||||
// die();
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getDashboardNotifications()
|
||||
{
|
||||
@ -212,29 +334,29 @@ class DashboardController extends AdminController
|
||||
{
|
||||
$clientPolicyModel = new ClientPolicyModel();
|
||||
$myLogger = \Config\Services::mylogger();
|
||||
|
||||
|
||||
$client_policy_data = $clientPolicyModel->getPolicyDetailsForEnrollment();
|
||||
$myLogger->logme('error', 'Fetched client policy data for Enrollment Status update');
|
||||
|
||||
|
||||
// dd($client_policy_data);
|
||||
|
||||
$currentDate = date('d-m-Y');
|
||||
$openEnrollment = [];
|
||||
$closeEnrollment = [];
|
||||
|
||||
|
||||
// Update policy status based on start and end dates
|
||||
foreach ($client_policy_data as $client_policy) {
|
||||
|
||||
$id = $client_policy['id'];
|
||||
$openDate = date('d-m-Y', strtotime($client_policy['open_date']));
|
||||
$closeDate = date('d-m-Y', strtotime($client_policy['close_date']));
|
||||
|
||||
|
||||
if ($currentDate == $openDate) {
|
||||
$clientPolicyModel->update($id, ['open_for_enrollment' => 1]);
|
||||
$openEnrollment[] = $id;
|
||||
$myLogger->logme('error', 'Updated policy ID ' . $id . ' to open for enrollment.');
|
||||
}
|
||||
|
||||
|
||||
if ($closeDate < $currentDate) {
|
||||
$clientPolicyModel->update($id, ['open_for_enrollment' => 0]);
|
||||
$closeEnrollment[] = $id;
|
||||
@ -243,37 +365,36 @@ class DashboardController extends AdminController
|
||||
}
|
||||
|
||||
$myLogger->logme('error', 'enrollment_status function completed');
|
||||
$myLogger->logme('error', 'updated Open Enrollment Policy count : "'.count($openEnrollment).'" and Close Enrollment Policy count : "'.count($closeEnrollment).'"');
|
||||
$myLogger->logme('error', 'updated Open Enrollment Policy count : "' . count($openEnrollment) . '" and Close Enrollment Policy count : "' . count($closeEnrollment) . '"');
|
||||
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'message' => 'updated Open and Close Enrollment successfully',
|
||||
'open_policy_count' => count($openEnrollment),
|
||||
'status' => true,
|
||||
'message' => 'updated Open and Close Enrollment successfully',
|
||||
'open_policy_count' => count($openEnrollment),
|
||||
'close_policy_count' => count($closeEnrollment),
|
||||
'open_policy_ids' => $openEnrollment,
|
||||
'open_policy_ids' => $openEnrollment,
|
||||
'close_policy_ids' => $closeEnrollment,
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function sendCroneRemainderMail()
|
||||
{
|
||||
$clientPolicyModel = new ClientPolicyModel();
|
||||
$myLogger = \Config\Services::mylogger();
|
||||
|
||||
|
||||
|
||||
|
||||
$client_policy_data = $clientPolicyModel->getPolicyDetailsForRemainder();
|
||||
$myLogger->logme('error', 'Fetched client policy data');
|
||||
// dd($client_policy_data);
|
||||
|
||||
|
||||
// Mail send function
|
||||
$result = $this->sendRemainderMail($client_policy_data, 'crone');
|
||||
|
||||
$myLogger->logme('error', 'sendCroneRemainderMail function completed');
|
||||
|
||||
if($result){
|
||||
|
||||
if ($result) {
|
||||
return json_encode(['status' => true, 'message' => 'Mail send successfully']);
|
||||
}else{
|
||||
} else {
|
||||
return json_encode(['status' => false, 'message' => 'There is no data to send']);
|
||||
}
|
||||
}
|
||||
@ -285,29 +406,22 @@ class DashboardController extends AdminController
|
||||
|
||||
$data = [];
|
||||
|
||||
if($type == 'insurer'){
|
||||
if ($type == 'insurer') {
|
||||
|
||||
$data = $pendingActionsData['uhid'];
|
||||
|
||||
}else if($type == 'TPA'){
|
||||
} else if ($type == 'TPA') {
|
||||
$data = $pendingActionsData['tpa'];
|
||||
|
||||
}else if($type == 'I'){
|
||||
} else if ($type == 'I') {
|
||||
$data = $pendingActionsData['inception'];
|
||||
|
||||
}else if($type == 'D'){
|
||||
} else if ($type == 'D') {
|
||||
$data = $pendingActionsData['deletion'];
|
||||
|
||||
}else if($type == 'C'){
|
||||
} else if ($type == 'C') {
|
||||
$data = $pendingActionsData['correction'];
|
||||
|
||||
}else if($type == 'SI'){
|
||||
} else if ($type == 'SI') {
|
||||
$data = $pendingActionsData['si_enhancement'];
|
||||
|
||||
}else if($type == 'policy'){
|
||||
} else if ($type == 'policy') {
|
||||
$data = $pendingActionsData['policy'];
|
||||
|
||||
}else if($type == 'ticket'){
|
||||
} else if ($type == 'ticket') {
|
||||
$data = $pendingActionsData['uhid'];
|
||||
}
|
||||
|
||||
@ -421,7 +535,6 @@ class DashboardController extends AdminController
|
||||
$reminder_whole_mail[] = $mail_result;
|
||||
}
|
||||
}
|
||||
|
||||
} else { // crone
|
||||
|
||||
if (!empty($client_policy['reminder_date'])) {
|
||||
@ -511,15 +624,12 @@ class DashboardController extends AdminController
|
||||
// $this->myLogger->logme('error', 'Mail sent result: ' . json_encode($mail_result));
|
||||
$reminder_whole_mail[] = $mail_result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->myLogger->logme('error', "SEND REMAINDER CRONE --- Remainder date is empty()");
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$this->myLogger->logme('error', 'Notification setup not found or not enabled');
|
||||
@ -549,29 +659,28 @@ class DashboardController extends AdminController
|
||||
|
||||
public function sendManualReminder($client_id, $client_branch_id, $client_policy_id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Log Works');
|
||||
$this->myLogger->logme('error', 'Log Works');
|
||||
|
||||
$this->myLogger->logme('error', "sendManualRemainder called with client_id: {$client_id}, client_branch_id: {$client_branch_id}");
|
||||
|
||||
|
||||
$client_policy_data = $this->clientPolicyModel->getPolicyDetailsForRemainder($client_id, $client_branch_id, $client_policy_id);
|
||||
// print_r($client_policy_data); die;
|
||||
// print_r($this->clientPolicyModel->getLastQuery()); die;
|
||||
// $this->myLogger->logme('error', "Policy details fetched: " . json_encode($client_policy_data));
|
||||
|
||||
|
||||
if ($client_policy_data) {
|
||||
$result = $this->sendRemainderMail($client_policy_data);
|
||||
log_message('error',json_encode($result));
|
||||
$this->myLogger->logme('error',$result);
|
||||
log_message('error', json_encode($result));
|
||||
$this->myLogger->logme('error', $result);
|
||||
$this->myLogger->logme('error', "Manual Remainder Mail sending result: " . ($result ? 'success' : 'failure'));
|
||||
|
||||
|
||||
if ($result) {
|
||||
$this->myLogger->logme('error', 'Manual Remainder Mail sent successfully');
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Mail sent successfully'], 200);
|
||||
} else {
|
||||
$this->myLogger->logme('error', 'Failed to send manual remainder mail, no data to send');
|
||||
return $this->respond(['status' => false, 'code' => 200, 'message' => 'There is no data to send','message2' => 'Failed' ], 200);
|
||||
return $this->respond(['status' => false, 'code' => 200, 'message' => 'There is no data to send', 'message2' => 'Failed'], 200);
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->myLogger->logme('error', 'No policy data found to send');
|
||||
return $this->respond(['status' => false, 'code' => 200, 'message' => 'There is no data to send', 'message2' => 'No policy data found to send'], 200);
|
||||
@ -581,19 +690,17 @@ class DashboardController extends AdminController
|
||||
public function sendManualEcard($client_id, $client_branch_id, $policy_id)
|
||||
{
|
||||
$this->myLogger->logme('error', "sendManualEcard called with client_id: {$client_id}, client_branch_id: {$client_branch_id}, policy id : {$policy_id}");
|
||||
|
||||
$notification = $this->notificationModel->where('client_id', $client_id)->where('template_name', 'member_ecard_mail')->first();
|
||||
// print_r(($notification)); die;
|
||||
if($notification && $notification['enabled'] == 0 && $notification['mail_content'] == '')
|
||||
{
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No template found','message2' => 'Failed' ], 200);
|
||||
}
|
||||
|
||||
|
||||
$notification = $this->notificationModel->where('client_id', $client_id)->where('template_name', 'member_ecard_mail')->first();
|
||||
// print_r(($notification)); die;
|
||||
if ($notification && $notification['enabled'] == 0 && $notification['mail_content'] == '') {
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No template found', 'message2' => 'Failed'], 200);
|
||||
}
|
||||
|
||||
|
||||
$emp_data = $this->employeePolicyModel->getEmployeePolicyForEcard($policy_id);
|
||||
if(count($emp_data) == 0)
|
||||
{
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No employees found','message2' => 'Failed' ], 200);
|
||||
if (count($emp_data) == 0) {
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No employees found', 'message2' => 'Failed'], 200);
|
||||
}
|
||||
$ids = array_column($emp_data, 'id');
|
||||
// print_r(($ids)); die;
|
||||
@ -603,9 +710,8 @@ class DashboardController extends AdminController
|
||||
// $empEmpDataServiceController = new EmpDataServiceController();
|
||||
// $empEmpDataServiceController->sendMailForDownloadingECard($ids);
|
||||
|
||||
|
||||
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Mail Queued'], 200);
|
||||
|
||||
}
|
||||
|
||||
public function data_construct_for_bds($data)
|
||||
@ -622,7 +728,7 @@ class DashboardController extends AdminController
|
||||
'instalment_pending' => [],
|
||||
'completed' => [],
|
||||
];
|
||||
|
||||
|
||||
// Loop through results and group them by their status
|
||||
foreach ($data as $row) {
|
||||
switch ($row['status']) {
|
||||
@ -655,8 +761,25 @@ class DashboardController extends AdminController
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $groupedData;
|
||||
}
|
||||
|
||||
public function prepareClaimSearchData(){
|
||||
|
||||
$received_data = $this->request->getPost();
|
||||
$ticketTypeId = $received_data['ticketTypeId'];
|
||||
$status = $received_data['status'];
|
||||
|
||||
$status = strtoupper($status);
|
||||
$status = str_replace('_', ' ', $status);
|
||||
|
||||
$data = $this->ticketModel
|
||||
->select("tcs.id as claim_status_id")
|
||||
->join("ticket_claim_status tcs", "tcs.ticket_type = " . (int)$ticketTypeId)
|
||||
->where("tcs.claim_status", $status)
|
||||
->first();
|
||||
$data['ticket_type_id'] = $ticketTypeId;
|
||||
return $this->respond(['status' => "success","data" => $data],200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4105,6 +4105,9 @@ class EmpDataServiceController extends BaseController
|
||||
AND emp_endorsement.pk IN (" . implode(',', $arrayData['employeeIds']) . ")
|
||||
AND employee_polices.claim_status = 0
|
||||
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();
|
||||
|
||||
// dd(db_connect()->getLastQuery(), $amount);
|
||||
|
||||
@ -3112,6 +3112,8 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
// ---------------- TICKET API's ---------------------------------------------------------------------------------------------------
|
||||
|
||||
//Get Data from post for inserting ticket and message
|
||||
public function initiateClaim()
|
||||
{
|
||||
@ -3122,6 +3124,18 @@ class EmployeeRestController extends AdminController
|
||||
$client_policy_id = $received_data['client_policy_id'];
|
||||
$insured_emp_id = $received_data['insured_emp_id'];
|
||||
|
||||
if (empty($received_data['doa'])) {
|
||||
$received_data['doa'] = null;
|
||||
} else{
|
||||
$ticket_data['doa'] = change_date_format($received_data['doa']);
|
||||
}
|
||||
|
||||
if (empty($received_data['dod'])) {
|
||||
$received_data['dod'] = null;
|
||||
} else{
|
||||
$ticket_data['dod'] = change_date_format($received_data['dod']);
|
||||
}
|
||||
|
||||
$sql = "
|
||||
select
|
||||
cp.policy_type_id,
|
||||
@ -3164,29 +3178,42 @@ class EmployeeRestController extends AdminController
|
||||
if(!empty($emp_ticket_data)){
|
||||
|
||||
$fetchData = $emp_ticket_data[0];
|
||||
$fetchData['claim_status_id'] = $this->claimStatusModel
|
||||
->select('id')
|
||||
->where('ticket_type', $fetchData['ticket_type_id'])
|
||||
->orderBy('id', 'asc')
|
||||
->first()['id'];
|
||||
|
||||
$claimStatusQuery = $this->claimStatusModel
|
||||
->select('id')
|
||||
->where('ticket_type', $fetchData['ticket_type_id'])
|
||||
->orderBy('id', 'asc');
|
||||
|
||||
if ($fetchData['ticket_type_id'] == 1 && !empty($fetchData['tpa_no'])) {
|
||||
$results = $claimStatusQuery->findAll(2);
|
||||
$fetchData['claim_status_id'] = $results[1]['id'] ?? $results[0]['id'];
|
||||
} else {
|
||||
$fetchData['claim_status_id'] = $claimStatusQuery->first()['id'];
|
||||
}
|
||||
|
||||
|
||||
$fetchData['priority'] = 1;
|
||||
$fetchData['mode_of_intimation'] = 1;
|
||||
$fetchData['mode_of_intimation'] = 3;
|
||||
$fetchData['claim_type'] = 1;
|
||||
$fetchData = array_merge($fetchData, $received_data);
|
||||
|
||||
$fetchData['relationship'] = strtolower($fetchData['relationship']) ?? $fetchData['relationship'];
|
||||
// print_r($fetchData); die;
|
||||
$insert_status = $this->ticketMaster->insert($fetchData);
|
||||
$ticket_id = $this->ticketMaster->insertID();
|
||||
|
||||
if ($insert_status && !empty($ticket_id)) {
|
||||
|
||||
//insert first history
|
||||
$this->ticketController->putHistoryAfterInsert($fetchData, $ticket_id);
|
||||
|
||||
$messagesData = [
|
||||
'ticket_id' => $ticket_id ?? null,
|
||||
'sender' => 'user',
|
||||
'claim_status' => $fetchData['claim_status_id'] ?? null,
|
||||
'emp_mail' => $fetchData['emp_mail'] ?? null,
|
||||
'mail_subject' => $fetchData['subject'] ?? null,
|
||||
'mail_content' => $fetchData['message'] ?? null,
|
||||
'mail_subject' => $fetchData['subject'] ?? "New Claim",
|
||||
'mail_content' => $fetchData['message'] ?? "New Claim",
|
||||
];
|
||||
|
||||
if (!empty($messagesData['ticket_id'])) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1422,11 +1422,12 @@ class MasterController extends AdminController
|
||||
if ($insert) {
|
||||
|
||||
//for CD Tranction Table
|
||||
$cd_tranction_data['cd_ac_pk'] = $this->CDMasterModel->insertID();
|
||||
$response = DepositHelper::saveDeposit($cd_tranction_data, $loggedInUserID);
|
||||
|
||||
$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{
|
||||
return $this->respond(['status' => false, 'message' => 'Failed to created CD Account number'], 200);
|
||||
}
|
||||
|
||||
@ -306,6 +306,12 @@ class PolicyTransactionController extends BaseController
|
||||
$data['policy_with_corr'] = 1;
|
||||
}
|
||||
|
||||
if (!isset($data['is_cd_reduce_from_bds'])) {
|
||||
$data['is_cd_reduce_from_bds'] = 0;
|
||||
} elseif ($data['is_cd_reduce_from_bds']) {
|
||||
$data['is_cd_reduce_from_bds'] = 1;
|
||||
}
|
||||
|
||||
if($data['ct_type'] == ""){
|
||||
$data['ct_type'] = 1;
|
||||
}
|
||||
@ -342,7 +348,7 @@ class PolicyTransactionController extends BaseController
|
||||
$this->policyTransactionModel->update($insert, ['client_policy_id' => $client_policy_id]);
|
||||
$emp_policy_insert = $this->InsertIndividualEmpPolicyTable($emp_data, $client_policy_id);
|
||||
|
||||
if ($data['client_type'] == 1 && $data['status'] == 'completed') {
|
||||
if ($data['client_type'] == 1 && $data['status'] == 'completed' && $data['is_cd_reduce_from_bds'] == 1) {
|
||||
$this->processCompletedStatus($data, $client_policy_id, $data['insurer_id']);
|
||||
}
|
||||
}
|
||||
@ -362,6 +368,7 @@ class PolicyTransactionController extends BaseController
|
||||
|
||||
private function updateInceptionPolicy($id, $data)
|
||||
{
|
||||
// print_r($data); die;
|
||||
if ($this->policyTransactionModel->update($id, $data)) {
|
||||
|
||||
$this->insertTransactionStatus($id, $data, 1);
|
||||
@ -391,7 +398,7 @@ class PolicyTransactionController extends BaseController
|
||||
}
|
||||
|
||||
if ($data['status'] == 'completed' && $data['ct_type'] == 2) {
|
||||
if($data['client_type'] == 1){
|
||||
if($data['client_type'] == 1 && $data['is_cd_reduce_from_bds'] == 1){
|
||||
$this->processCompletedStatus($data, $data['client_policy_id'], $data['insurer_id']);
|
||||
}
|
||||
}
|
||||
@ -426,7 +433,12 @@ class PolicyTransactionController extends BaseController
|
||||
foreach ($data['follow_insurer_id'] as $index => $insurer) {
|
||||
|
||||
// Separate the insurer and insurer branch
|
||||
list($insurer_branch_id, $insurer_id) = explode('-', $insurer);
|
||||
if(isset($insurer) && !empty($insurer)){
|
||||
list($insurer_branch_id, $insurer_id) = explode('-', $insurer);
|
||||
}else{
|
||||
$insurer_branch_id = null;
|
||||
$insurer_id = null;
|
||||
}
|
||||
|
||||
// Prepare each co-share detail entry
|
||||
$coShareDetails[] = [
|
||||
@ -547,7 +559,7 @@ class PolicyTransactionController extends BaseController
|
||||
private function processCompletedStatus($data, $client_policy_id, $insurer_id)
|
||||
{
|
||||
$totalAmount = (int)$data['total'][0] ?? 0;
|
||||
$description = 'The following amount of Rs. ' . $totalAmount . '/- has been debited for the ' . $data['emp_count'] . ' employees at Inception.';
|
||||
$description = 'The following amount of Rs. ' . $totalAmount . '/- has been debited for the ' . $data['emp_count'] . ' employees at Inception (BDS).';
|
||||
|
||||
$cdTransactionData = [
|
||||
'amount' => $totalAmount,
|
||||
@ -562,8 +574,9 @@ class PolicyTransactionController extends BaseController
|
||||
'updated_by' => get_session_userid(),
|
||||
'event_name' => 'inception',
|
||||
'is_active' => 1,
|
||||
'cd_ac_pk' => $data['cd_ac_pk']
|
||||
];
|
||||
|
||||
|
||||
DepositHelper::saveDeposit($cdTransactionData, get_session_userid());
|
||||
}
|
||||
|
||||
@ -987,7 +1000,6 @@ class PolicyTransactionController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
// Policy Transaction Endorsement
|
||||
@ -1102,6 +1114,12 @@ class PolicyTransactionController extends BaseController
|
||||
$data['policy_with_corr'] = 1;
|
||||
}
|
||||
|
||||
if (!isset($data['is_cd_reduce_from_bds'])) {
|
||||
$data['is_cd_reduce_from_bds'] = 0;
|
||||
} elseif ($data['is_cd_reduce_from_bds']) {
|
||||
$data['is_cd_reduce_from_bds'] = 1;
|
||||
}
|
||||
|
||||
if(empty($data['data_received_date'])){
|
||||
$data['data_received_date'] = null;
|
||||
}else{
|
||||
@ -1171,8 +1189,8 @@ class PolicyTransactionController extends BaseController
|
||||
'policy_type_id' => $issue_type['policy_type_id'] ?? null,
|
||||
'issue_type' => $issue_type['issue_type'] ?? null,
|
||||
'source_client_policy_id' => $issue_type['source_client_policy_id'] ?? null,
|
||||
'cd_ac_no' => $issue_type['cd_ac_no'] ?? null,
|
||||
'cd_ac_pk' => $issue_type['cd_ac_pk'] ?? null,
|
||||
'cd_ac_no' => isset( $data['cd_ac_no']) && !empty($data['cd_ac_no']) ? $data['cd_ac_no'] : $issue_type['cd_ac_no'] ?? null,
|
||||
'cd_ac_pk' => isset( $data['cd_ac_pk']) && !empty($data['cd_ac_pk']) ? $data['cd_ac_pk'] : $issue_type['cd_ac_pk'] ?? null,
|
||||
// 'policy_issue_date' => $issue_type['policy_issue_date'] ?? null,
|
||||
'policy_start_date' => $issue_type['policy_start_date'] ?? null,
|
||||
'policy_end_date' => $issue_type['policy_end_date'] ?? null,
|
||||
@ -1231,6 +1249,7 @@ class PolicyTransactionController extends BaseController
|
||||
$update = $this->policyTransactionModel->where('id', $id)->set($data)->update();
|
||||
|
||||
if ($update) {
|
||||
|
||||
$this->insertTransactionStatus($id, $data, 1);
|
||||
$this->handleCompletedStatus($data, $id);
|
||||
$this->insertOrUpdateCoShareDetails($data, $id);
|
||||
@ -1243,13 +1262,13 @@ class PolicyTransactionController extends BaseController
|
||||
}
|
||||
|
||||
private function handleCompletedStatus($data, $policy_tran_id)
|
||||
{
|
||||
if ($data['status'] == 'completed' && $data['ct_type'] == 2) {
|
||||
{
|
||||
if ($data['client_type'] == 1 && $data['status'] == 'completed' && $data['is_cd_reduce_from_bds'] == 1) {
|
||||
|
||||
$tolamt = $data['total'][0] ?? 0;
|
||||
|
||||
$description = 'The following amount of Rs. ' . round($tolamt, 2) . '/- has been' .
|
||||
($data['action_type'] == 'deletion' ? ' Credit ' : ' Debit ') . 'from the policy transaction';
|
||||
($data['action_type'] == 'deletion' ? ' Credit ' : ' Debit ') . 'from the policy transaction (BDS)';
|
||||
|
||||
$cd_tranction_data = [
|
||||
'amount' => $tolamt,
|
||||
@ -1264,6 +1283,7 @@ class PolicyTransactionController extends BaseController
|
||||
'updated_by' => get_session_userid(),
|
||||
'event_name' => $data['action_type'],
|
||||
'is_active' => 1,
|
||||
'cd_ac_pk' => $data['cd_ac_pk'] ?? null,
|
||||
];
|
||||
|
||||
DepositHelper::saveDeposit($cd_tranction_data, get_session_userid());
|
||||
@ -1589,6 +1609,7 @@ class PolicyTransactionController extends BaseController
|
||||
->select("
|
||||
pt_co_share_details.*,
|
||||
policy_transaction.bro_payable_by,
|
||||
policy_transaction.cd_ac_pk,
|
||||
(
|
||||
select cd_ac_no
|
||||
from cd_master
|
||||
@ -1616,9 +1637,12 @@ class PolicyTransactionController extends BaseController
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
$cd_ac_no = db_connect()->table('cd_master')->where('id', $is_copay_yes['cd_ac_pk'] ?? null)->get()->getRowArray();
|
||||
|
||||
if ($totalCount) {
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $totalCount, 'is_copay_yes' => $is_copay_yes], 200);
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $totalCount, 'is_copay_yes' => $is_copay_yes, "cd_master_data" => $cd_ac_no], 200);
|
||||
} else {
|
||||
$insurer_data = $this->clientPolicyModel->where('id', $client_policy_id)->where('is_active', 1)->first();
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to get data'], 200);
|
||||
}
|
||||
|
||||
|
||||
@ -120,6 +120,9 @@ class TicketController extends BaseController
|
||||
'((POLICY_TYPE))' => 'policy_type',
|
||||
'((AUTO_QUERY_CONTENT))' => 'auto_query_content',
|
||||
'((CLAIM_FORM_LINK))' => 'claim_form_link',
|
||||
'((CLAIM_FEEDBACK_FORM))' => 'claim_feedback_form',
|
||||
'((SETTLED_LETTER))' => 'settle_letter',
|
||||
'((APPROVED_LETTER))' => 'approved_letter',
|
||||
];
|
||||
$this->extraFields = [
|
||||
1 => ['non_id_reason'],
|
||||
@ -179,8 +182,18 @@ class TicketController extends BaseController
|
||||
} else {
|
||||
|
||||
$data['ticket_data'] = $this->ticketSearch();
|
||||
$html = view('ticket_list', $data);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
$isFromDashboard = $this->request->getPost("is_dashboard");
|
||||
|
||||
if (isset($isFromDashboard) && !empty($isFromDashboard) && $isFromDashboard == 1) {
|
||||
$data['page_name'] = "Claims";
|
||||
$data['claim_status'] = $this->claimStatus->select('id,ticket_type,claim_status')->where('is_active', 1)->findAll();
|
||||
$data['client_list'] = $this->clientModel->select('id,client_name')->where('is_active', 1)->findAll();
|
||||
return $this->loadLayout('ticket_search', $data);
|
||||
}else{
|
||||
$html = view('ticket_list', $data);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -232,7 +245,9 @@ class TicketController extends BaseController
|
||||
'tcs.claim_status AS status',
|
||||
'tm.claim_number AS claim_no',
|
||||
'tm.tpa_id',
|
||||
'tm.tpa_no',
|
||||
'tm.emp_name',
|
||||
'tm.emp_code',
|
||||
'i.name AS insurer_name',
|
||||
'c.client_name',
|
||||
'tm.insured_name',
|
||||
@ -255,10 +270,10 @@ class TicketController extends BaseController
|
||||
|
||||
} else {
|
||||
$search_data = $this->request->getPost();
|
||||
// print_r($search_data);
|
||||
// print_r($search_data); die()
|
||||
$where = [];
|
||||
foreach ($search_data as $search_objects => $key) {
|
||||
if ($key != null && $key != '' && $key != 0) {
|
||||
if ($key != null && $key != '' && $key != 0 && $search_objects != 'is_dashboard') {
|
||||
$where[$search_objects] = $key;
|
||||
}
|
||||
}
|
||||
@ -272,7 +287,9 @@ class TicketController extends BaseController
|
||||
'tm.claim_status_id',
|
||||
'tm.is_head_approved',
|
||||
'tm.tpa_id',
|
||||
'tm.tpa_no',
|
||||
'tm.emp_name',
|
||||
'tm.emp_code',
|
||||
'i.name AS insurer_name',
|
||||
'c.client_name',
|
||||
'tm.insured_name',
|
||||
@ -456,7 +473,18 @@ class TicketController extends BaseController
|
||||
$data['placeHolders'] = $this->placeHolders;
|
||||
$data['message_data'] = $this->getTicketMessage($ticket_id);
|
||||
$data['view_ticket_page'] = [];
|
||||
$data['member_data'] = $this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']);
|
||||
|
||||
if($ticket_data['ticket_type_id'] == 1){
|
||||
$data['member_data'] = $this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']);
|
||||
}else{
|
||||
$data['member_data'] = array_filter(
|
||||
$this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']),
|
||||
function ($member) {
|
||||
return isset($member['emp_relationship']) && $member['emp_relationship'] == 'Self';
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$data['ticket_history'] = $this->ticketHistory($ticket_id);
|
||||
$data['ticket_check_list'] = db_connect()->table('ticket_check_list')->where('is_active', 1)->where('ticket_type_id', $ticket_data['ticket_type_id'])->get()->getResultArray();
|
||||
if (!empty($ticket_data['client_policy_id'])){
|
||||
@ -578,7 +606,9 @@ class TicketController extends BaseController
|
||||
$return_value = $this->ticketMasterModel->insert($ticket_data);
|
||||
if ($return_value) {
|
||||
//mail trigger part
|
||||
$this->putHistoryAfterInsert($ticket_data, $return_value);
|
||||
$mail_responce = $this->sendAutoMailTrigger($return_value);
|
||||
$this->autoMessageInsertBasedOnMailResponse($mail_responce, $return_value);
|
||||
return $this->respond(['status' => true, 'ticket_id' => $return_value, 'code' => 200, 'data' => $ticket_data, "message" => "Claim created successfully", 'mail_responce' => $mail_responce], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to create claim'], 200);
|
||||
@ -601,8 +631,12 @@ class TicketController extends BaseController
|
||||
$return_value = $this->ticketMasterModel->where('id', $ticket_id)->set($ticket_data)->update();
|
||||
if ($return_value) {
|
||||
|
||||
//mail trigger part
|
||||
$mail_responce = $this->sendAutoMailTrigger($ticket_id);
|
||||
$mail_responce = null;
|
||||
if($old_ticket_data['claim_status_id'] != $ticket_data['claim_status_id']){
|
||||
//mail trigger part
|
||||
$mail_responce = $this->sendAutoMailTrigger($ticket_id);
|
||||
$this->autoMessageInsertBasedOnMailResponse($mail_responce, $ticket_id);
|
||||
}
|
||||
|
||||
//send mail to the head for rejected ticket approvel
|
||||
if($ticket_data['claim_status_id'] == 8 && $ticket_data['is_head_approved'] == 0){
|
||||
@ -751,13 +785,20 @@ class TicketController extends BaseController
|
||||
{
|
||||
// log_message('error','Function called');die();
|
||||
// $ticket_master_id = $this->request->getPost('id');
|
||||
$user_id = get_session_userid();
|
||||
$logged_user = $this->userModel->select('first_name,last_name,profile')->where('id', $user_id)->first();
|
||||
$dataToSend = [];
|
||||
$dataToSend['user_name'] = $logged_user['first_name'] . ' ' . $logged_user['last_name'];
|
||||
$dataToSend['messages'] = $this->ticketMessageModel->where('is_active', 1)
|
||||
->where('ticket_id', $ticket_master_id)->orderBy('created_at', 'DESC')
|
||||
|
||||
$user_id = get_session_userid();
|
||||
// $logged_user = $this->userModel->select('first_name,last_name,profile')->where('id', $user_id)->first();
|
||||
// $dataToSend['user_name'] = $logged_user['first_name'] . ' ' . $logged_user['last_name'];
|
||||
|
||||
$dataToSend['messages'] = $this->ticketMessageModel
|
||||
->select('ticket_messages.*,up.first_name as user_name')
|
||||
->join('user_profiles up', 'up.id = ticket_messages.created_by', 'left')
|
||||
->where('ticket_messages.is_active', 1)
|
||||
->where('ticket_messages.ticket_id', $ticket_master_id)
|
||||
->orderBy('ticket_messages.created_at', 'DESC')
|
||||
->findAll();
|
||||
|
||||
foreach ($dataToSend['messages'] as $message) {
|
||||
$mail_content_converted = $this->convertHtmlToText($message['mail_content']);
|
||||
$message['mail_content'] = $mail_content_converted;
|
||||
@ -837,7 +878,7 @@ class TicketController extends BaseController
|
||||
}
|
||||
|
||||
// Construct Mail Data
|
||||
$mailData = [
|
||||
$mailData[] = [
|
||||
'mail' => $ticket_data['emp_mail'],
|
||||
'subject' => $subject,
|
||||
'message' => $message,
|
||||
@ -845,6 +886,17 @@ class TicketController extends BaseController
|
||||
'attachments' => []
|
||||
];
|
||||
|
||||
// if the employee personal mail is not empty then send the mail to the employee personal mail
|
||||
if(!empty($ticket_data['emp_personal_mail'])){
|
||||
$mailData[] = [
|
||||
'mail' => $ticket_data['emp_personal_mail'],
|
||||
'subject' => $subject,
|
||||
'message' => $message,
|
||||
'cc' => $ticket_data['common_mails'] ?? '',
|
||||
'attachments' => []
|
||||
];
|
||||
}
|
||||
|
||||
// print_r($mailData); die;
|
||||
|
||||
$this->myLogger->logme('error', "Final Email Data");
|
||||
@ -869,6 +921,12 @@ class TicketController extends BaseController
|
||||
$replaceData = str_replace("Claim-", "", $this->ticketType[$ticket_data['ticket_type_id']] ?? "");
|
||||
} else if ($value == "claim_form_link"){
|
||||
$replaceData = '<a href="' . base_url('claim-form-download/' . md5($ticket_data['insurer_id'])) . '" target="_blank">Click here to download Claim Form</a>';
|
||||
} else if ($value == "claim_feedback_form" && $ticket_data['ticket_type_id'] == 1){
|
||||
$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"){
|
||||
$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 {
|
||||
$replaceData = isset($ticket_data[$value]) ? $ticket_data[$value] : '';
|
||||
}
|
||||
@ -927,6 +985,27 @@ class TicketController extends BaseController
|
||||
|
||||
$this->myLogger->logme('error', "Fetched ACM emails");
|
||||
|
||||
|
||||
if(!empty($ticket_data['emp_personal_mail'])){
|
||||
|
||||
$this->myLogger->logme('error', "Send employee personal mail start");
|
||||
|
||||
$emailPersonalData = [
|
||||
'mail' => $ticket_data['emp_personal_mail'],
|
||||
'subject' => $mail_data['mail_subject'],
|
||||
'message' => $mail_data['mail_content'],
|
||||
'common' => [],
|
||||
'cc' => $acm_mails['common_mails'],
|
||||
'attachments' => []
|
||||
];
|
||||
|
||||
$this->sendTrigger($emailPersonalData);
|
||||
|
||||
$this->myLogger->logme('error', "Send employee personal mail successfully");
|
||||
}else{
|
||||
$this->myLogger->logme('error', "Send employee personal mail is empty");
|
||||
}
|
||||
|
||||
$emailData = [
|
||||
'mail' => $mail_data['emp_mail'],
|
||||
'subject' => $mail_data['mail_subject'],
|
||||
@ -950,7 +1029,10 @@ class TicketController extends BaseController
|
||||
if (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 1) {
|
||||
$mail_content = $this->constructMailContent($ticket_id);
|
||||
// print_r($mail_content); die;
|
||||
$mail_responce = $this->sendTrigger($mail_content);
|
||||
foreach ($mail_content as $key => $value) {
|
||||
$mail_responce = $this->sendTrigger($value);
|
||||
$this->myLogger->logme('error', '{data} - Auto Mail Sent, Successfully', ['data' => $key + 1]);
|
||||
}
|
||||
} elseif (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 0) {
|
||||
$this->myLogger->logme('error', 'Auto Mail Not Sent, Reason: Automail Not Enabled');
|
||||
} else {
|
||||
@ -972,7 +1054,7 @@ class TicketController extends BaseController
|
||||
th.old_value,
|
||||
th.new_value,
|
||||
th.created_at,
|
||||
CONCAT(creator.first_name, ' ', creator.last_name) as modified_by,
|
||||
CONCAT_WS(' ', creator.first_name, creator.last_name) AS modified_by,
|
||||
-- Claim Status
|
||||
old_status.claim_status as old_status_value,
|
||||
new_status.claim_status as new_status_value,
|
||||
@ -1032,6 +1114,7 @@ class TicketController extends BaseController
|
||||
ORDER BY
|
||||
th.created_at DESC";
|
||||
$data = $this->ticketHistoryModel->query($sql)->getResultArray();
|
||||
// dd(db_connect()->getLastQuery());
|
||||
$priorityType = $this->priorityType;
|
||||
$relationshipType = $this->relationshipType;
|
||||
$modeOFIntimate = $this->modeOFIntimate;
|
||||
@ -1166,7 +1249,7 @@ class TicketController extends BaseController
|
||||
if ($policy_type == 1){
|
||||
$viewData['column_order'] = [
|
||||
'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',
|
||||
'TOTAL'
|
||||
];
|
||||
@ -1185,7 +1268,7 @@ class TicketController extends BaseController
|
||||
}else{
|
||||
$viewData['column_order'] = [
|
||||
'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'
|
||||
];
|
||||
$ordered_data = [];
|
||||
@ -1207,7 +1290,7 @@ class TicketController extends BaseController
|
||||
|
||||
$viewData['column_order'] = [
|
||||
'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',
|
||||
'TOTAL', 'SETTLED', 'CLOSED', 'CANCELLED', 'RETURNED', 'CLEARED_TOTAL'
|
||||
];
|
||||
@ -1371,7 +1454,8 @@ class TicketController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
public function getPoliciesbyEmpID() {
|
||||
public function getPoliciesbyEmpID()
|
||||
{
|
||||
$received_data = $this->request->getPost();
|
||||
$emp_id = $received_data['emp_id'];
|
||||
|
||||
@ -1443,5 +1527,121 @@ class TicketController extends BaseController
|
||||
return $this->response->setStatusCode(500)->setBody('An error occurred while downloading the file.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public function autoMessageInsertBasedOnMailResponse($mail_sent_status, $ticket_id)
|
||||
{
|
||||
if (gettype($mail_sent_status) == 'array') {
|
||||
$this->myLogger->logme('error', "auto Message Insert Based On Mail Response Failed because is array :$ticket_id ");
|
||||
} else {
|
||||
$mail_sent_status = json_decode($mail_sent_status);
|
||||
$this->myLogger->logme('error', "mail_sent_status is object :$ticket_id ");
|
||||
}
|
||||
|
||||
if (!empty($mail_sent_status) && isset($mail_sent_status->status) && $mail_sent_status->status == 'success') {
|
||||
|
||||
$sent_message_data['ticket_id'] = $ticket_id;
|
||||
$sent_message_data['sender'] = 'staff';
|
||||
$sent_message_data['emp_mail'] = $mail_sent_status->data->params->mail;
|
||||
$sent_message_data['mail_subject'] = $mail_sent_status->data->params->subject;
|
||||
$sent_message_data['mail_content'] = $mail_sent_status->data->params->message;
|
||||
|
||||
$message_insert_status = $this->ticketMessageModel->insert($sent_message_data);
|
||||
|
||||
if ($message_insert_status) {
|
||||
$this->myLogger->logme('error', "Claim initiated, Mail sent Successfully, successfully store message:$ticket_id ");
|
||||
} else {
|
||||
$this->myLogger->logme('error', "Claim initiated, Mail sent Successfully, Failed to store message:$ticket_id ");
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
|
||||
$this->myLogger->logme('error', "Failed to send Mail :$ticket_id ");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public function putHistoryAfterInsert($ticket_data, $ticket_id)
|
||||
{
|
||||
$this->myLogger->logme('error', "Put History After Insert function called : $ticket_id");
|
||||
|
||||
if(!empty($ticket_data)){
|
||||
|
||||
$history_data = [
|
||||
'ticket_id' => $ticket_id,
|
||||
'field_name' => 'claim_status_id',
|
||||
'display_name' => 'Ticket Created',
|
||||
'old_value' => null,
|
||||
'new_value' => $ticket_data['claim_status_id'],
|
||||
'created_by' => get_session_userid(),
|
||||
'is_active' => 1
|
||||
];
|
||||
|
||||
$this->myLogger->logme('error', "Put History After Insert function called : " . json_encode($history_data));
|
||||
|
||||
|
||||
$history_insert = $this->ticketHistoryModel->insert($history_data);
|
||||
|
||||
if($history_insert){
|
||||
$this->myLogger->logme('error', "Put History After Insert Ticket Data Successfully");
|
||||
}else{
|
||||
$this->myLogger->logme('error', "Put History After Insert Ticket Data Failed");
|
||||
}
|
||||
|
||||
}else{
|
||||
$this->myLogger->logme('error', "Put History After Insert Ticket Data is empty");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public function viewClaimFeedbackForm($md5_ticket_id,$empView = null)
|
||||
{
|
||||
|
||||
if ($this->request->is("get")){
|
||||
|
||||
$data['ticket_id'] = $md5_ticket_id;
|
||||
$data['ticket_data'] = $this->ticketMasterModel->select('ticket_master.*,clients.client_name')->join('clients','clients.id = ticket_master.client_id')->where('MD5(ticket_master.id)',$md5_ticket_id)->where('ticket_master.is_active',1)->first();
|
||||
$data['form_submitted'] = !empty($data['ticket_data']['feedback_json'])? 1 : 0;
|
||||
|
||||
|
||||
$data['viewer'] = !empty($empView) ? $empView : 0;
|
||||
// dd($data);
|
||||
return view('ticket_feedback_form', $data);
|
||||
}else{
|
||||
|
||||
$formDataJson = json_encode($this->request->getPost());
|
||||
// log_message("error","Form data : ".$formDataJson);
|
||||
|
||||
|
||||
$data_to_store = [
|
||||
|
||||
'feedback_json' => $formDataJson
|
||||
];
|
||||
|
||||
if (!empty($formDataJson)){
|
||||
// $this->ticketMasterModel->save($data_to_store);
|
||||
$this->ticketMasterModel->where('MD5(id)', $md5_ticket_id)->set($data_to_store)->update();
|
||||
|
||||
return $this->respond(['status' => true,'id'=> $md5_ticket_id,'received_data' => $formDataJson], 200);
|
||||
|
||||
}else{
|
||||
return $this->respond(['status' => false,'id'=> $md5_ticket_id,'received_data' => $formDataJson], 200);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function feedbackList(){
|
||||
|
||||
$data['feedback_data'] = $this->ticketMasterModel->select("ticket_master.*,clients.client_name")->join("clients","clients.id = ticket_master.client_id")->where("ticket_master.is_active",1)->where("ticket_master.feedback_json IS NOT NULL", null, false)->where("ticket_master.feedback_json !=", "")->findAll();
|
||||
|
||||
// dd($data);
|
||||
$this->loadLayout("ticket_feedback_list",$data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
log_message("error", 'saveDeposit function called '. json_encode($data));
|
||||
|
||||
// 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
|
||||
$newBalance = self::calculateBalance(
|
||||
@ -91,15 +94,21 @@ class DepositHelper
|
||||
*
|
||||
* @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();
|
||||
|
||||
// $getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE client_id = ? AND insurer_id = ? ORDER BY created_at DESC LIMIT 1";
|
||||
// $getLastBalanceParams = [$clientId, $insurerId];
|
||||
|
||||
$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];
|
||||
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";
|
||||
$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;
|
||||
|
||||
|
||||
@ -17,10 +17,13 @@ class ExcelMergeHelper {
|
||||
{
|
||||
try {
|
||||
log_message('debug', 'Attempting merge with original file order');
|
||||
// echo "Attempting merge with original file order\n";
|
||||
return self::processFiles($filePaths, $outputPath);
|
||||
} catch (Exception $e) {
|
||||
log_message('error', 'First attempt failed: ' . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine());
|
||||
// echo "First attempt failed: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() . "\n";
|
||||
log_message('debug', 'Retrying with reversed file order');
|
||||
// echo "Retrying with reversed file order\n";
|
||||
|
||||
// Reverse the file order and try again
|
||||
$reversedFiles = array_reverse($filePaths);
|
||||
@ -29,6 +32,7 @@ class ExcelMergeHelper {
|
||||
return self::processFiles($reversedFiles, $outputPath);
|
||||
} catch (Exception $e2) {
|
||||
log_message('error', 'Both attempts failed. Last error: ' . $e2->getMessage() . ' in ' . $e2->getFile() . ' on line ' . $e2->getLine());
|
||||
// echo "Both attempts failed. Last error: " . $e2->getMessage() . ' in ' . $e2->getFile() . ' on line ' . $e2->getLine() . "\n";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -45,7 +49,9 @@ class ExcelMergeHelper {
|
||||
private static function processFiles(array $filePaths, string $outputPath): string
|
||||
{
|
||||
log_message('debug', 'Starting Excel merge process');
|
||||
// echo "Starting Excel merge process\n";
|
||||
log_message('debug', 'Files to process: ' . json_encode($filePaths));
|
||||
// echo "Files to process: " . json_encode($filePaths) . "\n";
|
||||
|
||||
if (empty($filePaths)) {
|
||||
throw new Exception("No files provided to merge");
|
||||
@ -66,6 +72,7 @@ class ExcelMergeHelper {
|
||||
|
||||
// Save the merged file
|
||||
log_message('debug', "Saving merged file to: {$outputPath}");
|
||||
// echo "Saving merged file to: {$outputPath}\n";
|
||||
$writer = IOFactory::createWriter($mergedSpreadsheet, 'Xlsx');
|
||||
$writer->setPreCalculateFormulas(false);
|
||||
$writer->save($outputPath);
|
||||
@ -76,6 +83,7 @@ class ExcelMergeHelper {
|
||||
gc_collect_cycles();
|
||||
|
||||
log_message('debug', 'Excel merge process completed successfully');
|
||||
// echo "Excel merge process completed successfully\n";
|
||||
return $outputPath;
|
||||
}
|
||||
|
||||
@ -87,15 +95,17 @@ class ExcelMergeHelper {
|
||||
* @param int|null $index
|
||||
* @throws Exception
|
||||
*/
|
||||
private static function processSingleFile(array $fileInfo, Spreadsheet $mergedSpreadsheet, int $index = null)
|
||||
private static function processSingleFile(array $fileInfo, Spreadsheet $mergedSpreadsheet, ?int $index = null)
|
||||
{
|
||||
if (!isset($fileInfo['file_path']) || !file_exists($fileInfo['file_path'])) {
|
||||
$path = $fileInfo['file_path'] ?? 'undefined';
|
||||
log_message('error', "File " . ($index ?? 'base') . ": Invalid or missing file path: {$path}");
|
||||
// echo "File " . ($index ?? 'base') . ": Invalid or missing file path: {$path}\n";
|
||||
return;
|
||||
}
|
||||
|
||||
log_message('debug', "Processing file " . ($index ?? 'base') . ": " . $fileInfo['file_path']);
|
||||
// echo "Processing file " . ($index ?? 'base') . ": " . $fileInfo['file_path'] . "\n";
|
||||
|
||||
try {
|
||||
// Load the source spreadsheet
|
||||
@ -105,6 +115,7 @@ class ExcelMergeHelper {
|
||||
$worksheets = $sourceSpreadsheet->getAllSheets();
|
||||
$totalSheets = count($worksheets);
|
||||
log_message('debug', "Total sheets in file: " . $totalSheets);
|
||||
// echo "Total sheets in file: " . $totalSheets . "\n";
|
||||
|
||||
$sheetsToMerge = $fileInfo['sheets'] ?? [];
|
||||
|
||||
@ -114,26 +125,30 @@ class ExcelMergeHelper {
|
||||
try {
|
||||
$sheetName = $worksheet->getTitle();
|
||||
log_message('debug', "Processing sheet: {$sheetName}");
|
||||
// echo "Processing sheet: {$sheetName}\n";
|
||||
|
||||
// Generate unique sheet name before cloning
|
||||
$newName = $sheetName;
|
||||
$counter = 1;
|
||||
|
||||
while (in_array($newName, $mergedSpreadsheet->getSheetNames())) {
|
||||
$newName = $sheetName . "_" . $counter++;
|
||||
// $newName = $sheetName . "_" . $counter++;
|
||||
log_message('debug', "Sheet name already exists. Trying new name: {$newName}");
|
||||
// echo "Sheet name already exists. Trying new name: {$newName}\n";
|
||||
}
|
||||
|
||||
// Clone the worksheet and set the new name
|
||||
$clonedSheet = clone $worksheet;
|
||||
$clonedSheet->setTitle($newName);
|
||||
// $clonedSheet = clone $worksheet;
|
||||
// $clonedSheet->setTitle($newName);
|
||||
|
||||
// Add as external sheet
|
||||
$mergedSpreadsheet->addExternalSheet($clonedSheet);
|
||||
$mergedSpreadsheet->addExternalSheet($worksheet);
|
||||
|
||||
log_message('debug', "Successfully added sheet: {$newName}");
|
||||
// echo "Successfully added sheet: {$newName}\n";
|
||||
} catch (Exception $e) {
|
||||
log_message('error', "Error processing sheet {$sheetName} as new name {$newName}: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine());
|
||||
// echo "Error processing sheet {$sheetName} as new name {$newName}: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -145,6 +160,7 @@ class ExcelMergeHelper {
|
||||
|
||||
} catch (Exception $e) {
|
||||
log_message('error', "Error processing file {$fileInfo['file_path']}: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine());
|
||||
// echo "Error processing file {$fileInfo['file_path']}: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -1132,7 +1132,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
{
|
||||
$insurer = new InsurerModel();
|
||||
$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');
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
55
app/Models/LeadFilesModel.php
Normal file
55
app/Models/LeadFilesModel.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class LeadFilesModel extends Model
|
||||
{
|
||||
protected $table = 'lead_files';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
'id',
|
||||
'lead_id',
|
||||
'docs_name',
|
||||
'file_name',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'is_active'
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -87,6 +87,12 @@ class LeadsModel extends Model
|
||||
|
||||
'lead_form_type',
|
||||
'custom_fields',
|
||||
|
||||
'source_policy_start_date',
|
||||
'source_policy_end_date',
|
||||
|
||||
'payment_date',
|
||||
'is_cd'
|
||||
];
|
||||
|
||||
|
||||
|
||||
@ -79,6 +79,7 @@ class PolicyTransactionModel extends Model
|
||||
'cd_ac_pk',
|
||||
'install_due_date',
|
||||
'policy_with_corr',
|
||||
'is_cd_reduce_from_bds',
|
||||
];
|
||||
|
||||
|
||||
@ -783,6 +784,19 @@ class PolicyTransactionModel extends Model
|
||||
->join('user_profiles AS service_user', 'policy_transaction.serviced_by = service_user.id', 'left')
|
||||
->where('policy_transaction.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());
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the start date and end date are provided
|
||||
if ($start_date != 0 && $end_date != 0 && $date_type != 0 && $date_type != 'statement_month') {
|
||||
@ -1347,7 +1361,10 @@ class PolicyTransactionModel extends Model
|
||||
|
||||
$builder->orderBy('policy_transaction.id', 'desc');
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
$returnData = $builder->get()->getResultArray();
|
||||
|
||||
|
||||
return $returnData;
|
||||
}
|
||||
|
||||
public function getFinanceReportList($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0)
|
||||
|
||||
@ -12,7 +12,7 @@ class TicketHistoryModel extends Model
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = ['id','field_name','display_name','old_value',
|
||||
protected $allowedFields = ['id', "ticket_id", 'field_name','display_name','old_value',
|
||||
'new_value','created_by','created_at','updated_by','updated_at','is_active'];
|
||||
|
||||
// Callbacks
|
||||
|
||||
@ -15,6 +15,7 @@ class TicketMasterModel extends Model
|
||||
protected $allowedFields = [
|
||||
'id',
|
||||
'ticket_type_id',
|
||||
'feedback_json',
|
||||
'claim_status_id',
|
||||
'acm_id',
|
||||
'insurer_id',
|
||||
@ -74,10 +75,10 @@ class TicketMasterModel extends Model
|
||||
'pay_initiate_date',
|
||||
'emp_personal_mail',
|
||||
'client_policy_id'
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
];
|
||||
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||
@ -92,7 +93,7 @@ class TicketMasterModel extends Model
|
||||
protected function checkAndADDCreatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['created_by'])) {
|
||||
if (empty($data['data']['created_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['created_by'] = get_session_userid();
|
||||
}
|
||||
@ -103,7 +104,7 @@ class TicketMasterModel extends Model
|
||||
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['updated_by'])) {
|
||||
if (empty($data['data']['updated_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['updated_by'] = get_session_userid();
|
||||
}
|
||||
@ -129,21 +130,21 @@ class TicketMasterModel extends Model
|
||||
public function getTemplateDataByTicketID($ticket_id)
|
||||
{
|
||||
$template_data = $this
|
||||
->select("ticket_mail_template.*, CASE
|
||||
->select("ticket_mail_template.*, CASE
|
||||
WHEN employees.email_corporate IS NULL OR employees.email_corporate = ''
|
||||
THEN ticket_master.emp_mail
|
||||
ELSE employees.email_corporate
|
||||
END as emp_mail, ,ticket_master.claim_status_id")
|
||||
->join('ticket_claim_status', 'ticket_master.claim_status_id = ticket_claim_status.id and ticket_claim_status.is_active = 1')
|
||||
->join('ticket_mail_template', '
|
||||
->join('ticket_claim_status', 'ticket_master.claim_status_id = ticket_claim_status.id and ticket_claim_status.is_active = 1')
|
||||
->join('ticket_mail_template', '
|
||||
ticket_claim_status.trigger_type = ticket_mail_template.trigger_type
|
||||
and ticket_claim_status.ticket_type = ticket_mail_template.ticket_type
|
||||
and ticket_mail_template.is_active = 1')
|
||||
->join('employees','employees.id = ticket_master.emp_id','left')
|
||||
->where('ticket_master.id', $ticket_id)
|
||||
->where('ticket_master.is_active', 1)
|
||||
->where('ticket_claim_status.is_active', 1)
|
||||
->first();
|
||||
->join('employees', 'employees.id = ticket_master.emp_id', 'left')
|
||||
->where('ticket_master.id', $ticket_id)
|
||||
->where('ticket_master.is_active', 1)
|
||||
->where('ticket_claim_status.is_active', 1)
|
||||
->first();
|
||||
|
||||
return $template_data;
|
||||
}
|
||||
@ -172,16 +173,16 @@ class TicketMasterModel extends Model
|
||||
->join('clients', 'ticket_master.client_id = clients.id', 'left')
|
||||
->join('insurers', 'ticket_master.insurer_id = insurers.id', 'left')
|
||||
->join('tpa', 'ticket_master.tpa_id = tpa.id', 'left')
|
||||
->join('ticket_notes', 'ticket_master.id = ticket_notes.ticket_id and ticket_notes.is_active = 1 and ticket_notes.is_auto_query = 1','left')
|
||||
->join('ticket_notes', 'ticket_master.id = ticket_notes.ticket_id and ticket_notes.is_active = 1 and ticket_notes.is_auto_query = 1', 'left')
|
||||
->join('user_profiles', 'ticket_master.acm_id = user_profiles.id', 'left')
|
||||
->join('employees','employees.id = ticket_master.emp_id','left')
|
||||
->join('employees', 'employees.id = ticket_master.emp_id', 'left')
|
||||
->where('ticket_master.id', $ticket_id)
|
||||
->where('ticket_master.is_active', 1)
|
||||
->first();
|
||||
|
||||
return $ticket_data;
|
||||
}
|
||||
|
||||
|
||||
//get TAT report BAND wise Data
|
||||
// public function getTATReport($ticket_type = null, $start_date = null, $end_date = null)
|
||||
// {
|
||||
@ -209,7 +210,7 @@ class TicketMasterModel extends Model
|
||||
// ";
|
||||
// $statusResult = $this->db->query($statusQuery)->getResultArray();
|
||||
// // dd($statusResult);
|
||||
|
||||
|
||||
// // Initialize dynamic query parts
|
||||
// $dynamicSelect = '';
|
||||
|
||||
@ -247,12 +248,12 @@ class TicketMasterModel extends Model
|
||||
// 0
|
||||
// ) AS `$columnName`, ";
|
||||
// }
|
||||
|
||||
|
||||
// // Remove the trailing comma from the SELECT part
|
||||
// $dynamicSelect = rtrim($dynamicSelect, ', ');
|
||||
// // dd($dynamicSelect);
|
||||
|
||||
|
||||
|
||||
// // Construct the full SQL query
|
||||
// $sql = "
|
||||
// SELECT
|
||||
@ -316,7 +317,7 @@ class TicketMasterModel extends Model
|
||||
// ORDER BY
|
||||
// FIELD(tc.TAT_Category, 'Above 20 Days', '13-20 Days', '7-12 Days', '0-6 Days');
|
||||
// ";
|
||||
|
||||
|
||||
// // Execute the query and return the result
|
||||
// $data = $this->db->query($sql)->getResultArray();
|
||||
// // print_rr($this->db->getLastQuery(), $data); die;
|
||||
@ -328,12 +329,12 @@ class TicketMasterModel extends Model
|
||||
// // $tableData['headers'] = $headers;
|
||||
// // $tableData['body'] = $data;
|
||||
// // }
|
||||
|
||||
|
||||
// return $data;
|
||||
// }
|
||||
|
||||
public function getTATReport($ticket_type = null, $start_date = null, $end_date = null)
|
||||
{
|
||||
{
|
||||
//set default last 3 months data date
|
||||
$fromDate = date('Y-m-d', strtotime('-90 days'));
|
||||
$toDate = date('Y-m-d 23:59:59');
|
||||
@ -344,9 +345,9 @@ class TicketMasterModel extends Model
|
||||
}
|
||||
$ticket_type_data_1 = "";
|
||||
$ticket_type_data_2 = "";
|
||||
if(!empty($ticket_type)){
|
||||
$ticket_type_data_1 = "AND ticket_type = $ticket_type";
|
||||
$ticket_type_data_2 = "WHERE tm.ticket_type_id = $ticket_type";
|
||||
if (!empty($ticket_type)) {
|
||||
$ticket_type_data_1 = "AND ticket_type = $ticket_type";
|
||||
$ticket_type_data_2 = "WHERE tm.ticket_type_id = $ticket_type";
|
||||
}
|
||||
|
||||
// Fetch claim statuses from the `ticket_claim_status` table
|
||||
@ -358,7 +359,7 @@ class TicketMasterModel extends Model
|
||||
";
|
||||
$statusResult = $this->db->query($statusQuery)->getResultArray();
|
||||
// dd($statusResult);
|
||||
|
||||
|
||||
// Initialize dynamic query parts
|
||||
$dynamicSelect = '';
|
||||
|
||||
@ -396,12 +397,12 @@ class TicketMasterModel extends Model
|
||||
0
|
||||
) AS `$columnName`, ";
|
||||
}
|
||||
|
||||
|
||||
// Remove the trailing comma from the SELECT part
|
||||
$dynamicSelect = rtrim($dynamicSelect, ', ');
|
||||
// dd($dynamicSelect);
|
||||
|
||||
|
||||
|
||||
// Construct the full SQL query
|
||||
$sql = "
|
||||
SELECT
|
||||
@ -471,7 +472,7 @@ class TicketMasterModel extends Model
|
||||
'0-6 Days'
|
||||
);
|
||||
";
|
||||
|
||||
|
||||
// Execute the query and return the result
|
||||
$data = $this->db->query($sql)->getResultArray();
|
||||
// print_rr($this->db->getLastQuery(), $data); die;
|
||||
@ -483,12 +484,13 @@ class TicketMasterModel extends Model
|
||||
// $tableData['headers'] = $headers;
|
||||
// $tableData['body'] = $data;
|
||||
// }
|
||||
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function tpaWiseReport($policy_type = null ,$start_date = null, $end_date = null){
|
||||
$ticket_type_data_1 = "";
|
||||
public function tpaWiseReport($policy_type = null, $start_date = null, $end_date = null)
|
||||
{
|
||||
$ticket_type_data_1 = "";
|
||||
$ticket_type_data_2 = "";
|
||||
|
||||
if (!empty($policy_type)) {
|
||||
@ -510,8 +512,17 @@ class TicketMasterModel extends Model
|
||||
$dynamicSelect .= "
|
||||
COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) AS `{$status['claim_status']}`, ";
|
||||
|
||||
if (in_array($status['claim_status'], ['ID NOT GENERATED', 'NON ID', 'CDA', 'INFORMATION REQUIRED','UNDER PROCESS - CLAIM NO. UPDATION',
|
||||
'UNDER PROCESS - INVESTIGATION STATUS','UNDER PROCESS - QUERY DOCUMENT RECEIVED','APPROVED','PAYMENT INITIATED'])) {
|
||||
if (in_array($status['claim_status'], [
|
||||
'ID NOT GENERATED',
|
||||
'NON ID',
|
||||
'CDA',
|
||||
'INFORMATION REQUIRED',
|
||||
'UNDER PROCESS - CLAIM NO. UPDATION',
|
||||
'UNDER PROCESS - INVESTIGATION STATUS',
|
||||
'UNDER PROCESS - QUERY DOCUMENT RECEIVED',
|
||||
'APPROVED',
|
||||
'PAYMENT INITIATED'
|
||||
])) {
|
||||
$dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||
}
|
||||
// Include in total count
|
||||
@ -552,47 +563,47 @@ class TicketMasterModel extends Model
|
||||
|
||||
// print_rr($result);die();
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
public function accountManagerWiseReport($policy_type = null ,$start_date = null, $end_date = null){
|
||||
public function accountManagerWiseReport($policy_type = null, $start_date = null, $end_date = null)
|
||||
{
|
||||
|
||||
if ($policy_type == 1) {
|
||||
$ticket_type_data_1 = "";
|
||||
$ticket_type_data_2 = "";
|
||||
$ticket_type_data_2 = "";
|
||||
|
||||
if (!empty($policy_type)) {
|
||||
$ticket_type_data_1 = "AND ticket_type = $policy_type";
|
||||
$ticket_type_data_2 = "AND master.ticket_type_id = $policy_type";
|
||||
}
|
||||
if (!empty($policy_type)) {
|
||||
$ticket_type_data_1 = "AND ticket_type = $policy_type";
|
||||
$ticket_type_data_2 = "AND master.ticket_type_id = $policy_type";
|
||||
}
|
||||
|
||||
// Fetch claim statuses dynamically
|
||||
$statusQuery = "SELECT id, claim_status FROM ticket_claim_status WHERE is_active = 1 $ticket_type_data_1";
|
||||
$statusResult = $this->db->query($statusQuery)->getResultArray();
|
||||
// Fetch claim statuses dynamically
|
||||
$statusQuery = "SELECT id, claim_status FROM ticket_claim_status WHERE is_active = 1 $ticket_type_data_1";
|
||||
$statusResult = $this->db->query($statusQuery)->getResultArray();
|
||||
|
||||
// Initialize dynamic query parts
|
||||
$dynamicSelect = '';
|
||||
$dynamicTotal = '';
|
||||
// Initialize dynamic query parts
|
||||
$dynamicSelect = '';
|
||||
$dynamicTotal = '';
|
||||
|
||||
// Loop through each claim status and generate the CASE statements
|
||||
foreach ($statusResult as $status) {
|
||||
$dynamicSelect .= "
|
||||
// Loop through each claim status and generate the CASE statements
|
||||
foreach ($statusResult as $status) {
|
||||
$dynamicSelect .= "
|
||||
COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) AS `{$status['claim_status']}`, ";
|
||||
|
||||
|
||||
// Include in total count
|
||||
$dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||
// Include in total count
|
||||
$dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||
|
||||
// Include only closed-related statuses in total2 count
|
||||
// Include only closed-related statuses in total2 count
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the trailing commas and `+` signs
|
||||
$dynamicSelect = rtrim($dynamicSelect, ', ');
|
||||
$dynamicTotal = rtrim($dynamicTotal, ' +');
|
||||
// print_rr($dynamicSelect);
|
||||
// Construct the final SQL query
|
||||
$sql = "
|
||||
// Remove the trailing commas and `+` signs
|
||||
$dynamicSelect = rtrim($dynamicSelect, ', ');
|
||||
$dynamicTotal = rtrim($dynamicTotal, ' +');
|
||||
// print_rr($dynamicSelect);
|
||||
// Construct the final SQL query
|
||||
$sql = "
|
||||
SELECT
|
||||
user_profiles.first_name AS ACM_NAME,
|
||||
$dynamicSelect,
|
||||
@ -613,44 +624,49 @@ class TicketMasterModel extends Model
|
||||
// dd($result);
|
||||
|
||||
return $result;
|
||||
|
||||
|
||||
}else{
|
||||
} else {
|
||||
$ticket_type_data_1 = "";
|
||||
$ticket_type_data_2 = "";
|
||||
|
||||
|
||||
if (!empty($policy_type)) {
|
||||
$ticket_type_data_1 = "AND ticket_type = $policy_type";
|
||||
$ticket_type_data_2 = "AND master.ticket_type_id = $policy_type";
|
||||
}
|
||||
|
||||
|
||||
// Fetch claim statuses dynamically
|
||||
$statusQuery = "SELECT id, claim_status FROM ticket_claim_status WHERE is_active = 1 $ticket_type_data_1";
|
||||
$statusResult = $this->db->query($statusQuery)->getResultArray();
|
||||
|
||||
|
||||
// Initialize dynamic query parts
|
||||
$dynamicSelect = '';
|
||||
$dynamicTotal = '';
|
||||
$dynamicClosedTotal = '';
|
||||
|
||||
|
||||
// Loop through each claim status and generate the CASE statements
|
||||
foreach ($statusResult as $status) {
|
||||
$dynamicSelect .= "
|
||||
COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) AS `{$status['claim_status']}`, ";
|
||||
|
||||
if (in_array($status['claim_status'], ['CLAIM INTIMATION', 'INTIMATION TO INSURER', 'CLIENT PENDING', 'INSURER PENDING','INVESTIGATION',
|
||||
'APPROVED','ON HOLD'])) {
|
||||
|
||||
if (in_array($status['claim_status'], [
|
||||
'CLAIM INTIMATION',
|
||||
'INTIMATION TO INSURER',
|
||||
'CLIENT PENDING',
|
||||
'INSURER PENDING',
|
||||
'INVESTIGATION',
|
||||
'APPROVED',
|
||||
'ON HOLD'
|
||||
])) {
|
||||
$dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||
}
|
||||
// Include in total count
|
||||
// $dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||
|
||||
|
||||
// Include only closed-related statuses in total2 count
|
||||
if (in_array($status['claim_status'], ['CLOSED', 'SETTLED', 'NOT COVERED'])) {
|
||||
$dynamicClosedTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Remove the trailing commas and `+` signs
|
||||
$dynamicSelect = rtrim($dynamicSelect, ', ');
|
||||
$dynamicTotal = rtrim($dynamicTotal, ' +');
|
||||
@ -674,10 +690,10 @@ class TicketMasterModel extends Model
|
||||
GROUP BY
|
||||
user_profiles.id;
|
||||
";
|
||||
|
||||
|
||||
// Execute the query
|
||||
$result = $this->db->query($sql)->getResultArray();
|
||||
|
||||
|
||||
// print_rr($result);die();
|
||||
return $result;
|
||||
}
|
||||
@ -704,6 +720,82 @@ class TicketMasterModel extends Model
|
||||
// dd($data, db_connect()->getLastQuery());
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getDashData($claim_statuses, $limit)
|
||||
{
|
||||
$finalResults = [];
|
||||
|
||||
foreach ($claim_statuses as $typeId => $statuses) {
|
||||
$builder = $this->db->table('ticket_master tm');
|
||||
|
||||
// Start with ticket_type_id in SELECT
|
||||
$selects = ['tm.ticket_type_id'];
|
||||
|
||||
// Dynamically build status counts with COALESCE to handle missing values
|
||||
foreach ($statuses as $status) {
|
||||
$alias = strtolower($status);
|
||||
$alias = str_replace(' ', '_', $alias);
|
||||
$selects[] = "COALESCE(SUM(CASE WHEN tcs.claim_status = " . $this->db->escape($status) . " AND tm.ticket_type_id = {$typeId} THEN 1 ELSE 0 END), 0) AS `{$alias}`";
|
||||
}
|
||||
|
||||
$builder->select(implode(',', $selects));
|
||||
$builder->join('ticket_claim_status tcs', 'tm.claim_status_id = tcs.id', 'left');
|
||||
|
||||
// Subquery for latest status change, with LEFT JOIN to avoid missing ticket_type_id
|
||||
$builder->join(
|
||||
'(SELECT ticket_id, MAX(created_at) AS last_claim_status_change
|
||||
FROM ticket_history
|
||||
WHERE field_name = \'claim_status_id\'
|
||||
GROUP BY ticket_id) th',
|
||||
'tm.id = th.ticket_id',
|
||||
'left'
|
||||
);
|
||||
|
||||
// Set the date limit based on the status
|
||||
foreach ($statuses as $status) {
|
||||
$dateLimit = $limit[$typeId][$status] ?? 3;
|
||||
$dateThreshold = date('Y-m-d H:i:s', strtotime("-{$dateLimit} days"));
|
||||
|
||||
$builder->groupStart()
|
||||
->where('th.last_claim_status_change <=', $dateThreshold)
|
||||
->orWhere('th.last_claim_status_change IS NULL')
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
|
||||
$builder->where('tm.ticket_type_id', $typeId);
|
||||
$builder->where('tm.is_active', 1);
|
||||
$builder->where('tm.claim_status_id is not null');
|
||||
|
||||
$builder->groupBy('tm.ticket_type_id');
|
||||
|
||||
$query = $builder->get();
|
||||
$result = $query->getRowArray();
|
||||
|
||||
// Add Total count
|
||||
$total = 0;
|
||||
foreach ($result as $key => $res) {
|
||||
// Ensure that ticket_type_id is excluded from the sum
|
||||
if ($key !== 'ticket_type_id') {
|
||||
$total += $res;
|
||||
}
|
||||
}
|
||||
$result['total'] = $total;
|
||||
|
||||
// If no result, initialize an empty result for the ticket_type_id
|
||||
if (!$result) {
|
||||
$result = ['ticket_type_id' => $typeId, 'total' => 0];
|
||||
foreach ($statuses as $status) {
|
||||
$alias = strtolower($status);
|
||||
$alias = str_replace(' ', '_', $alias);
|
||||
$result[$alias] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Add the result to the final array
|
||||
$finalResults[$typeId] = $result;
|
||||
}
|
||||
|
||||
return $finalResults;
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,5 +134,20 @@ class UserModel extends Model
|
||||
->getResultArray();
|
||||
}
|
||||
|
||||
public function getexclusiveUserListForRFQ(){
|
||||
$data = $this->db->table('user_profiles')
|
||||
->select('user_profiles.*,user_teams.team_id')
|
||||
->select('roles.role as user_role')
|
||||
->join('roles', 'roles.id = user_profiles.role')
|
||||
->join('user_teams', 'user_teams.user_id = user_profiles.id')
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
|
||||
// dd($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -218,8 +218,27 @@
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<li class="nav-item">
|
||||
<a href="#claims-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" 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>
|
||||
|
||||
<li class="nav-item">
|
||||
<a href="#leads-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" 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 Renewals</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<?php include("claims_dash.php") ?>
|
||||
<?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 include("leads_dash.php") ?>
|
||||
|
||||
<?php if(in_array(get_role_id(), [1,2,3,5])) { ?>
|
||||
<?php include('endorsement_dash.php'); ?>
|
||||
@ -229,6 +248,7 @@
|
||||
<?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 } ?>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
origin: "mobile", // origin
|
||||
emp_code:"HTL-007",
|
||||
client_id:159,
|
||||
client_branch_id:125
|
||||
client_branch_id:126
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
304
app/Views/claims_dash.php
Normal file
304
app/Views/claims_dash.php
Normal file
@ -0,0 +1,304 @@
|
||||
<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>
|
||||
|
||||
<div class="tab-pane fade" 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="goBack">
|
||||
<a href="#" onclick="hideAndShowTile('2')">show all pending Tile<br></a>
|
||||
</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 === 'total') {
|
||||
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 ?>')">
|
||||
<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();
|
||||
}
|
||||
}
|
||||
|
||||
function linkRedirectForClaims(ticketTypeId, status) {
|
||||
$('.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.');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
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>
|
||||
452
app/Views/client_api.php
Normal file
452
app/Views/client_api.php
Normal file
@ -0,0 +1,452 @@
|
||||
<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>
|
||||
|
||||
</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>
|
||||
</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>
|
||||
</a>
|
||||
</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">
|
||||
<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>
|
||||
@ -96,6 +102,7 @@ body {
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<?php include("client_api.php"); ?>
|
||||
<?php include('client_others_tab.php'); ?>
|
||||
<?php include('notification.php'); ?>
|
||||
<?php include('client_basic_info.php'); ?>
|
||||
@ -246,7 +253,7 @@ body {
|
||||
event.preventDefault();
|
||||
client_notification();
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -80,7 +80,17 @@
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
|
||||
<!-- srinivas -->
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/css/bootstrap4-toggle.min.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/js/bootstrap4-toggle.min.js"></script>
|
||||
<script src="https://editor.unlayer.com/embed.js"></script>
|
||||
|
||||
<!-- MD5 Hash Start -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/blueimp-md5/2.19.0/js/md5.min.js"></script>
|
||||
|
||||
|
||||
<!-- MD5 Hash End -->
|
||||
|
||||
<!-- <script src="<?= base_url('public/unlayer/js/embed.js') . '' ?>"></script> -->
|
||||
<!-- srinivas -->
|
||||
<style>
|
||||
@ -668,6 +678,9 @@
|
||||
<li>
|
||||
<a href="<?= base_url('/ticket/ticket_reports') ?>">Claim Reports</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/ticket/feedback-list') ?>">Claim Feedback List</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
@ -719,9 +732,9 @@
|
||||
</div>
|
||||
</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>
|
||||
<a href="#policyReports" data-toggle="collapse" class="waves-effect">
|
||||
<i class="ri-file-chart-fill"></i>
|
||||
@ -732,68 +745,76 @@
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
|
||||
</li>
|
||||
<?php if (in_array(get_role_id(), [1,5]) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-outstanding-list') ?>">Outstanding</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/bdsReport/irba_report') ?>">IRDA Reports</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/bdsReport/renewal_report') ?>">Renewal Reports</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
</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>
|
||||
<a href="#policyPendingActions" data-toggle="collapse" class="waves-effect">
|
||||
<i class="mdi mdi-timer-sand"></i>
|
||||
<span> Policy Pending Actions </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyPendingActions">
|
||||
<ul class="nav-third-level">
|
||||
<?php if (in_array(get_role_id(), [1,5]) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (in_array(get_role_id(), [1,5]) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
</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>
|
||||
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
|
||||
<i class="ri-database-2-line"></i>
|
||||
<span> Masters </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyMasters">
|
||||
<ul class="nav-third-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-outstanding-list') ?>">Outstanding</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/bdsReport/irba_report') ?>">IRDA Reports</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/bdsReport/renewal_report') ?>">Renewal Reports</a>
|
||||
<a href="<?= base_url('/master/vehicle/list') ?>">Vehicle Master</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<li>
|
||||
<a href="#policyPendingActions" data-toggle="collapse" class="waves-effect">
|
||||
<i class="mdi mdi-timer-sand"></i>
|
||||
<span> Policy Pending Actions </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyPendingActions">
|
||||
<ul class="nav-third-level">
|
||||
<?php if (in_array(get_role_id(), [1,5]) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (in_array(get_role_id(), [1,5]) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
|
||||
<i class="ri-database-2-line"></i>
|
||||
<span> Masters </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyMasters">
|
||||
<ul class="nav-third-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/vehicle/list') ?>">Vehicle Master</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="<?= base_url('/dmsSearch') ?>">
|
||||
<i class="ri-book-open-line"></i>
|
||||
<span> Documents</span>
|
||||
</a>
|
||||
</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()))) { ?>
|
||||
<li>
|
||||
<a href="<?= base_url('/dmsSearch') ?>">
|
||||
<i class="ri-book-open-line"></i>
|
||||
<span> Documents</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<?php } ?>
|
||||
</ul>
|
||||
|
||||
173
app/Views/leads_dash.php
Normal file
173
app/Views/leads_dash.php
Normal file
@ -0,0 +1,173 @@
|
||||
<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>
|
||||
<div class="tab-pane fade" 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)">
|
||||
<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></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)">
|
||||
<div class="card-block">
|
||||
<h6 class="m-b-20 font-15">Renewals</h6>
|
||||
<h2 class="text-right"><i class="mdi mdi-playlist-check f-left"></i><span></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="status_tile" style="display: none; position: relative; bottom: 15px;">
|
||||
<a href="#" onclick="hide_and_show_tile(2)" >show all pending Tile</a>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function hide_and_show_tile(type) {
|
||||
|
||||
if (type == 1) {
|
||||
|
||||
$('.leadTypeTile').hide();
|
||||
$('.status_tile').show();
|
||||
} else {
|
||||
|
||||
$('.leadTypeTile').show();
|
||||
$('.status_tile').hide();
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -162,6 +162,16 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="source_policy_start_date">Source Policy Start Date<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control readonly-select" id="source_policy_start_date" name="source_policy_start_date" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="source_policy_end_date">Source Policy End Date<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="source_policy_end_date" name="source_policy_end_date" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="pan">PAN<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="pan" placeholder="Enter PAN Number"
|
||||
@ -228,9 +238,9 @@
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="salse_person_id">Sales Person<span class="text-danger">*</span></label>
|
||||
<label for="salse_person_id">Salse Person<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="salse_person_id" name="salse_person_id" multiple required>
|
||||
<option value="">Select Sales Person</option>
|
||||
<option value="">Select Salse Person</option>
|
||||
<?php if (isset($salse_team)) { ?>
|
||||
<?php foreach ($salse_team as $value) { ?>
|
||||
<option value="<?= $value['id']; ?>">
|
||||
@ -343,24 +353,24 @@
|
||||
1); // Set end date to last day of selected year
|
||||
policy_end_datePicker.setDate(policy_end_date);
|
||||
|
||||
console.log('this object', this);
|
||||
console.log('id of this element:', this.element);
|
||||
console.log('id of this element:', this.element.id);
|
||||
// console.log('this object', this);
|
||||
// console.log('id of this element:', this.element);
|
||||
// console.log('id of this element:', this.element.id);
|
||||
|
||||
let increment = this.element.id.split('_').pop();
|
||||
console.log(increment); // Outputs: 1
|
||||
// let increment = this.element.id.split('_').pop();
|
||||
// console.log(increment); // Outputs: 1
|
||||
|
||||
|
||||
console.log('increment', increment);
|
||||
console.log('policy_start_datePicker selectedDates', selectedDates);
|
||||
console.log('policy_start_datePicker incurred_claim_date_', $(
|
||||
"#incurred_claim_date_" + increment).val());
|
||||
// console.log('increment', increment);
|
||||
// console.log('policy_start_datePicker selectedDates', selectedDates);
|
||||
// console.log('policy_start_datePicker incurred_claim_date_', $(
|
||||
// "#incurred_claim_date_" + increment).val());
|
||||
|
||||
// Recalculate policy_run_days if incurred claim date is already selected
|
||||
if ($("#incurred_claim_date_" + increment).val()) {
|
||||
console.log('policy_start_datePicker selectedDates', selectedDates);
|
||||
calculatePolicyRunDays(increment);
|
||||
}
|
||||
// if ($("#incurred_claim_date_" + increment).val()) {
|
||||
// console.log('policy_start_datePicker selectedDates', selectedDates);
|
||||
// calculatePolicyRunDays(increment);
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -369,6 +379,11 @@
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
document.getElementById('source_policy_start_date').readOnly = true;
|
||||
document.getElementById('source_policy_end_date').readOnly = true;
|
||||
|
||||
$('#source_policy_start_date, #source_policy_end_date').addClass('readonly-select');
|
||||
});
|
||||
|
||||
console.log('increment count for insurer and tpa ', increment);
|
||||
@ -453,7 +468,7 @@
|
||||
|
||||
updateRenewalFields(dataIncrement);
|
||||
let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
|
||||
let premium_date_id = 'premium_date_' + dataIncrement;
|
||||
// let premium_date_id = 'premium_date_' + dataIncrement;
|
||||
|
||||
var incurred_claim_datepicker = flatpickr("#" + incurred_claim_date_id, {
|
||||
dateFormat: "d/m/Y",
|
||||
@ -466,11 +481,7 @@
|
||||
let increment = this.input.id.split('_').pop();
|
||||
console.log('Extracted increment:', increment);
|
||||
|
||||
var policyStartDate = $("#policy_start_date_" + increment)
|
||||
.length ?
|
||||
$("#policy_start_date_" + increment) :
|
||||
$("#policy_start_date");
|
||||
|
||||
var policyStartDate = $("#source_policy_start_date");
|
||||
console.log('Selected Dates:', selectedDates);
|
||||
console.log('policy start date instance', policyStartDate)
|
||||
console.log('Policy Start Date:', policyStartDate.val());
|
||||
@ -482,10 +493,10 @@
|
||||
}
|
||||
});
|
||||
|
||||
var premium_date_datepicker = flatpickr("#" + premium_date_id, {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
// var premium_date_datepicker = flatpickr("#" + premium_date_id, {
|
||||
// dateFormat: "d/m/Y",
|
||||
// allowInput: false
|
||||
// });
|
||||
|
||||
$('#proposed_insurer_' + dataIncrement).select2();
|
||||
$('#proposed_tpa_' + dataIncrement).select2();
|
||||
@ -651,6 +662,12 @@
|
||||
|
||||
if (res.status === true && res.data) {
|
||||
|
||||
console.log("res.data.source_policy_start_date", res.data.source_policy_start_date)
|
||||
console.log("res.data.source_policy_end_date", res.data.source_policy_end_date)
|
||||
|
||||
$('#source_policy_start_date').val(res.data.source_policy_start_date);
|
||||
$('#source_policy_end_date').val(res.data.source_policy_end_date);
|
||||
|
||||
for (let i = 1; i <= increment_count; i++) {
|
||||
|
||||
$(`#policy_type_id`).removeClass('readonly-select ').select2();
|
||||
@ -682,6 +699,7 @@
|
||||
$(`#proposed_tpa_${i}`).addClass('readonly-select ').select2('destroy');
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
console.warn('Invalid response:', res.message || 'Unknown error');
|
||||
// Reset fields if response is invalid
|
||||
@ -694,6 +712,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Hide loader
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
@ -787,7 +806,7 @@
|
||||
|
||||
updateRenewalFields(dataIncrement);
|
||||
let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
|
||||
let premium_date_id = 'premium_date_' + dataIncrement;
|
||||
// let premium_date_id = 'premium_date_' + dataIncrement;
|
||||
|
||||
var incurred_claim_datepicker = flatpickr("#" + incurred_claim_date_id, {
|
||||
dateFormat: "d/m/Y",
|
||||
@ -800,10 +819,7 @@
|
||||
let increment = this.input.id.split('_').pop();
|
||||
console.log('Extracted increment:', increment);
|
||||
|
||||
var policyStartDate = $("#policy_start_date_" + increment).length ?
|
||||
$("#policy_start_date_" + increment) :
|
||||
$("#policy_start_date");
|
||||
|
||||
var policyStartDate = $("#source_policy_start_date");
|
||||
console.log('Selected Dates:', selectedDates);
|
||||
console.log('policy start date instance', policyStartDate)
|
||||
console.log('Policy Start Date:', policyStartDate.val());
|
||||
@ -815,10 +831,10 @@
|
||||
}
|
||||
});
|
||||
|
||||
var premium_date_datepicker = flatpickr("#" + premium_date_id, {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
// var premium_date_datepicker = flatpickr("#" + premium_date_id, {
|
||||
// dateFormat: "d/m/Y",
|
||||
// allowInput: false
|
||||
// });
|
||||
|
||||
$('#proposed_insurer_' + dataIncrement).select2();
|
||||
$('#proposed_tpa_' + dataIncrement).select2();
|
||||
@ -917,12 +933,8 @@
|
||||
|
||||
<div id="appendArea_${increment}" class = "form-group col-md-12 appendArea"></div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="file_upload">File Upload<span class="text-danger"></span></label>
|
||||
<input type="file" class="form-control" id="file_name_${increment}" name="file_name[]" accept=".xls,.xlsx">
|
||||
<span class="text-danger" id="file_name_display"></span>
|
||||
</div>
|
||||
|
||||
<div id="multiFileAppendArea_${increment}"></div>
|
||||
|
||||
<div class="form-group col-md-12 btnDiv" style="position: relative;top: 28px;float: right;text-align: end;">
|
||||
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this)">x</a>
|
||||
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="addHTMLInput(1)">+</a>
|
||||
@ -931,6 +943,8 @@
|
||||
|
||||
container.appendChild(newRow);
|
||||
|
||||
//append mutli file html
|
||||
addFileField(increment);
|
||||
|
||||
var lead_type = $('#lead_type').val();
|
||||
leadTypeBsedHideAndShow(lead_type)
|
||||
@ -970,16 +984,16 @@
|
||||
console.log(increment); // Outputs: 1
|
||||
|
||||
|
||||
console.log('increment', increment);
|
||||
console.log('policy_start_datePicker selectedDates', selectedDates);
|
||||
console.log('policy_start_datePicker incurred_claim_date_', $("#incurred_claim_date_" +
|
||||
increment).val());
|
||||
// console.log('increment', increment);
|
||||
// console.log('policy_start_datePicker selectedDates', selectedDates);
|
||||
// console.log('policy_start_datePicker incurred_claim_date_', $("#incurred_claim_date_" +
|
||||
// increment).val());
|
||||
|
||||
// Recalculate policy_run_days if incurred claim date is already selected
|
||||
if ($("#incurred_claim_date_" + increment).val()) {
|
||||
console.log('policy_start_datePicker selectedDates', selectedDates);
|
||||
calculatePolicyRunDays(increment);
|
||||
}
|
||||
// if ($("#incurred_claim_date_" + increment).val()) {
|
||||
// console.log('policy_start_datePicker selectedDates', selectedDates);
|
||||
// calculatePolicyRunDays(increment);
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -1053,10 +1067,7 @@
|
||||
console.log('calculatePolicyRunDays function called');
|
||||
console.log('increment', increment);
|
||||
|
||||
var policyStartDate = $("#policy_start_date_" + increment).length ?
|
||||
$("#policy_start_date_" + increment) :
|
||||
$("#policy_start_date");
|
||||
|
||||
var policyStartDate = $("#source_policy_start_date");
|
||||
var policyStartDate = flatpickr.parseDate(policyStartDate.val(), "d/m/Y");
|
||||
var incurredClaimDate = flatpickr.parseDate($("#incurred_claim_date_" + increment).val(), "d/m/Y");
|
||||
|
||||
@ -1064,9 +1075,9 @@
|
||||
console.log('incurredClaimDate', incurredClaimDate)
|
||||
|
||||
if (policyStartDate && incurredClaimDate) {
|
||||
var timeDiff = incurredClaimDate - policyStartDate; // Time difference in milliseconds
|
||||
var timeDiff = Math.abs(policyStartDate - incurredClaimDate); // Time difference in milliseconds
|
||||
console.log('timeDiff', timeDiff);
|
||||
var daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24)); // Convert to days and add 1
|
||||
var daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24) + 1); // Convert to days and add 1
|
||||
console.log('daysDiff', daysDiff);
|
||||
$("#policy_run_days_" + increment).val(daysDiff); // Set value in the policy_run_days_ input
|
||||
}
|
||||
@ -1106,7 +1117,8 @@
|
||||
// ------------------------------------------------------------------------------------------
|
||||
|
||||
// Prevent division by zero in incurred claim ratio calculation
|
||||
let incurred_claim_ratio = annualised_claims > 0 ? incurred_claims / annualised_claims : 0;
|
||||
let premium_as_on_date = Number($('#premium_date_' + increment).val()) || 0;
|
||||
let incurred_claim_ratio = annualised_claims > 0 ? annualised_claims / premium_as_on_date : 0;
|
||||
let incurred_claim_ratio_roundoff = Math.round(incurred_claim_ratio);
|
||||
console.log('incurred_claim_ratio', incurred_claim_ratio_roundoff);
|
||||
|
||||
@ -1118,7 +1130,7 @@
|
||||
console.log('earned_premium', earned_premium);
|
||||
|
||||
// Prevent division by zero in earned claims ratio calculation
|
||||
let earned_claims_ratio = earned_premium > 0 ? incurred_claims / earned_premium : 0;
|
||||
let earned_claims_ratio = earned_premium > 0 ? annualised_claims / earned_premium : 0;
|
||||
let earned_claims_ration_roundoff = Math.round(earned_claims_ratio);
|
||||
console.log('earned_claims_ratio', earned_claims_ratio);
|
||||
|
||||
@ -1130,6 +1142,8 @@
|
||||
let increment = input.id.split('_').pop(); // Extract the increment part
|
||||
console.log('increment', increment);
|
||||
|
||||
let premium_as_on_date = Number($('#premium_date_' + increment).val()) || 0;
|
||||
|
||||
// Retrieve and convert the values to numbers, fallback to 0 if empty or invalid
|
||||
let premium_at_inception = Number($('#premium_at_inception_' + increment).val()) || 0;
|
||||
console.log('premium_at_inception', premium_at_inception);
|
||||
@ -1138,13 +1152,76 @@
|
||||
console.log('policy_run_days', policy_run_days);
|
||||
|
||||
// Prevent division by zero and calculate earned premium
|
||||
let earned_premium = policy_run_days > 0 ? premium_at_inception / policy_run_days : 0;
|
||||
let earned_premium = premium_as_on_date > 0 ? (premium_as_on_date / 365) * 364 : 0;
|
||||
console.log('earned_premium', earned_premium);
|
||||
let earned_premium_roundoff = Math.round(earned_premium);
|
||||
// Set the calculated value with two decimal places
|
||||
$('#earned_premium_' + increment).val(earned_premium_roundoff);
|
||||
}
|
||||
|
||||
$(document).on("input", "#incept_emp_count, #incept_dept_count, #renewal_emp_count, #renewal_dept_count, #exp_emp_count, #exp_dept_count", function() {
|
||||
calculateTotalLives(this);
|
||||
});
|
||||
|
||||
function calculateTotalLives(input) {
|
||||
|
||||
var lead_type = $('#lead_type').val();
|
||||
|
||||
if (lead_type == 1) {
|
||||
|
||||
let formRow = input.closest('.form-row');
|
||||
|
||||
if (formRow) {
|
||||
// Get the employee count and dependent count within the same row
|
||||
let empCountInput = formRow.querySelector('[name="incept_emp_count[]"]');
|
||||
let depCountInput = formRow.querySelector('[name="incept_dept_count[]"]');
|
||||
let totalLivesInput = formRow.querySelector('[name="incept_no_of_lives[]"]');
|
||||
|
||||
// Parse the input values as integers, defaulting to 0 if empty
|
||||
let empCount = empCountInput ? parseInt(empCountInput.value) || 0 : 0;
|
||||
let depCount = depCountInput ? parseInt(depCountInput.value) || 0 : 0;
|
||||
|
||||
// Calculate total lives
|
||||
let totalLives = empCount + depCount;
|
||||
|
||||
// Set the total lives input value
|
||||
if (totalLivesInput) {
|
||||
totalLivesInput.value = totalLives;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
console.log("Function Called");
|
||||
|
||||
if (input.id === "incept_emp_count" || input.id === "incept_dept_count") {
|
||||
var incept_emp_count = parseInt($("#incept_emp_count").val()) || 0;
|
||||
var incept_dept_count = parseInt($("#incept_dept_count").val()) || 0;
|
||||
|
||||
var totalCount = incept_emp_count + incept_dept_count;
|
||||
$("#incept_no_of_lives").val(totalCount);
|
||||
|
||||
} else if (input.id === "renewal_emp_count" || input.id === "renewal_dept_count") {
|
||||
var renewal_emp_count = parseInt($("#renewal_emp_count").val()) || 0;
|
||||
var renewal_dept_count = parseInt($("#renewal_dept_count").val()) || 0;
|
||||
|
||||
var totalCount = renewal_emp_count + renewal_dept_count;
|
||||
$("#renewal_no_of_lives").val(totalCount);
|
||||
|
||||
} else {
|
||||
var exp_emp_count = parseInt($("#exp_emp_count").val()) || 0;
|
||||
var exp_dept_count = parseInt($("#exp_dept_count").val()) || 0;
|
||||
|
||||
var totalCount = exp_emp_count + exp_dept_count;
|
||||
$("#exp_no_of_lives").val(totalCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------ FORM SUBMIT ---------------------------------------------------------------------------------
|
||||
|
||||
$("#leads_form_id").submit(function(event) {
|
||||
@ -1452,7 +1529,7 @@
|
||||
$('.freshFields').find('select, input').attr('required', 'required');
|
||||
$('.freshFields').show();
|
||||
|
||||
$('.proposed_div').hide().find('select, input').removeAttr('required');
|
||||
// $('.proposed_div').hide().find('select, input').removeAttr('required');
|
||||
|
||||
if (resetValues) {
|
||||
|
||||
@ -1486,11 +1563,15 @@
|
||||
$('.renewalFields').show();
|
||||
$('.renewalFields').find('select, input').attr('required', 'required');
|
||||
|
||||
$('.proposed_div').show().find('select, input').attr('required', 'required');
|
||||
// $('.proposed_div').show().find('select, input').attr('required', 'required');
|
||||
|
||||
$('#policy_end_date').removeAttr('required');
|
||||
$('#policy_start_date').removeAttr('required');
|
||||
$('#claims').removeAttr('required');
|
||||
$('#source_policy_start_date').attr('readonly', 'readonly');
|
||||
$('#source_policy_end_date').attr('readonly', 'readonly');
|
||||
|
||||
console.log('readonly set', $('#source_policy_start_date').prop('readonly')); // should print true
|
||||
|
||||
if (resetValues) {
|
||||
|
||||
@ -1540,4 +1621,8 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
</script>
|
||||
@ -86,6 +86,8 @@ if (isset($selected_lead_type)) {
|
||||
var temp_client_id = 0;
|
||||
var temp_branch_id = 0;
|
||||
var selected_lead_form_type = <?= isset($selected_lead_type) ? $selected_lead_type : 0 ?>;
|
||||
var fileIndex = 1; // Initialize index
|
||||
|
||||
|
||||
// select2 document ready
|
||||
$(document).ready(function() {
|
||||
@ -327,6 +329,127 @@ if (isset($selected_lead_type)) {
|
||||
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------
|
||||
|
||||
function addFileField(increment) {
|
||||
|
||||
console.log('addFileField function called');
|
||||
|
||||
const container = document.getElementById(`multiFileAppendArea_${increment}`);
|
||||
if (!container) return;
|
||||
|
||||
const div = document.createElement("div");
|
||||
div.className = "form-row d-flex align-items-end";
|
||||
div.setAttribute("id", `fileField_${fileIndex}`);
|
||||
|
||||
let isFirstField = container.childElementCount === 0; // Check if it's the first field
|
||||
let placeholder = isFirstField ? 'First file must be Demography.' : '';
|
||||
let accept = isFirstField ? '.xls,.xlsx' : '';
|
||||
|
||||
if(selected_lead_form_type != 1){
|
||||
placeholder = '';
|
||||
accept = '';
|
||||
}
|
||||
|
||||
div.innerHTML = `
|
||||
<div class="form-group col-md-5">
|
||||
<label>Document Name<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" name="docs_name_${increment}[]" placeholder="${placeholder}">
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<label>File Upload<span class="text-danger"></span></label>
|
||||
<input type="file" class="form-control" id="file_name_${fileIndex}" name="file_name_${increment}[]" accept="${accept}">
|
||||
</div>
|
||||
<div class="col-md-2" style="position: relative; bottom: 16px;">
|
||||
<button type="button" class="btn btn-danger" onclick="removeFileField(${fileIndex})">x</button>
|
||||
<button type="button" class="btn btn-primary" onclick="addFileField(${increment})">+</button>
|
||||
</div>
|
||||
`;
|
||||
container.appendChild(div);
|
||||
fileIndex++;
|
||||
}
|
||||
|
||||
function removeFileField(index, lead_file_id = null) {
|
||||
|
||||
if(index == 1){
|
||||
toastr.warning("You can't remove the first file field", 'WARNING');
|
||||
return false;
|
||||
}
|
||||
|
||||
if(lead_file_id != null) {
|
||||
|
||||
Swal.fire({
|
||||
title: "Do you want to remove this file?",
|
||||
// text: "Do you want Save this!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#d33",
|
||||
confirmButtonText: "Yes, Procced!"
|
||||
}).then((result) => {
|
||||
|
||||
if (result.isConfirmed) {
|
||||
|
||||
let url = '<?= base_url('util/removeMultiFile') ?>';
|
||||
|
||||
let requestData = {
|
||||
lead_file_id: lead_file_id
|
||||
};
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
// Send AJAX request
|
||||
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
|
||||
console.log('Data fetched successfully:', response);
|
||||
|
||||
if (response.status == true) {
|
||||
toastr.success(response.message, 'SUCCESS');
|
||||
|
||||
//remove the file field
|
||||
const field = document.getElementById(`fileField_${index}`);
|
||||
if(index != 1){
|
||||
if (field) field.remove();
|
||||
}
|
||||
|
||||
} else {
|
||||
toastr.error(response.message, 'WARNING');
|
||||
}
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
}, function(xhr, status, error) {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.error('Error fetching data:', error);
|
||||
console.error(xhr.responseText);
|
||||
toastr.error('An error occurred while checking the CD amount.', 'ERROR');
|
||||
});
|
||||
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}else{
|
||||
const field = document.getElementById(`fileField_${index}`);
|
||||
if(index != 1){
|
||||
if (field) field.remove();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function showFileName(input, index) {
|
||||
if (input.files.length > 0) {
|
||||
document.getElementById(`file_name_display_${index}`).textContent = input.files[0].name;
|
||||
} else {
|
||||
document.getElementById(`file_name_display_${index}`).textContent = "No file chosen";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@ -334,10 +457,11 @@ if (isset($selected_lead_type)) {
|
||||
<?php if (isset($lead_edit_data)) { ?>
|
||||
<script>
|
||||
|
||||
setTimeout(function(){
|
||||
$(document).ready(async function () {
|
||||
handleEbAndNonEbEdit(
|
||||
<?= json_encode($lead_edit_data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP) ?>);
|
||||
}, 1000)
|
||||
<?= json_encode($lead_edit_data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP) ?>
|
||||
);
|
||||
});
|
||||
|
||||
function handleEbAndNonEbEdit(data){
|
||||
if(data.lead_form_type == 1){
|
||||
@ -349,10 +473,15 @@ if (isset($selected_lead_type)) {
|
||||
|
||||
function dynamicLeadsDataForEdit(data) {
|
||||
try {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
console.log('########### THIS IS EB LEAD ###############')
|
||||
|
||||
console.log('Received data:', data);
|
||||
let dataIncrement = 1;
|
||||
fileIndex = data.lead_file_count + 1;
|
||||
|
||||
if (!data || typeof data !== 'object') {
|
||||
console.error('Invalid data received for editing.');
|
||||
@ -361,6 +490,7 @@ if (isset($selected_lead_type)) {
|
||||
|
||||
$('.btnDiv').hide();
|
||||
$('#appendArea_' + dataIncrement).empty();
|
||||
|
||||
|
||||
if (data.html) {
|
||||
$('#appendArea_' + dataIncrement).append(data.html);
|
||||
@ -368,6 +498,15 @@ if (isset($selected_lead_type)) {
|
||||
console.warn('HTML content missing in data.');
|
||||
}
|
||||
|
||||
if (data.multi_file_html && data.multi_file_html != '') {
|
||||
$('#multiFileAppendArea_' + dataIncrement).empty();
|
||||
setTimeout(function(){
|
||||
$('#multiFileAppendArea_' + dataIncrement).append(data.multi_file_html);
|
||||
}, 2000)
|
||||
} else {
|
||||
console.warn('MULTI FILE HTML content missing in data.');
|
||||
}
|
||||
|
||||
let policy_type_id = data.policy_type_id || null;
|
||||
let lead_type = data.lead_type || null;
|
||||
|
||||
@ -378,6 +517,10 @@ if (isset($selected_lead_type)) {
|
||||
|
||||
leadTypeBsedHideAndShow(lead_type);
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
|
||||
if (lead_type == 1) {
|
||||
$('.claim-row').hide();
|
||||
} else {
|
||||
@ -389,10 +532,10 @@ if (isset($selected_lead_type)) {
|
||||
$('.gpaClaimFileds').hide();
|
||||
$('.lifeClaimFields').show();
|
||||
} else {
|
||||
updateRenewalFields(dataIncrement);
|
||||
// updateRenewalFields(dataIncrement);
|
||||
|
||||
let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
|
||||
let premium_date_id = 'premium_date_' + dataIncrement;
|
||||
// let premium_date_id = 'premium_date_' + dataIncrement;
|
||||
|
||||
if ($('#' + incurred_claim_date_id).length) {
|
||||
flatpickr("#" + incurred_claim_date_id, {
|
||||
@ -401,10 +544,7 @@ if (isset($selected_lead_type)) {
|
||||
onChange: function (selectedDates) {
|
||||
try {
|
||||
let increment = this.input.id.split('_').pop();
|
||||
let policyStartDate = $("#policy_start_date_" + increment).length
|
||||
? $("#policy_start_date_" + increment)
|
||||
: $("#policy_start_date");
|
||||
|
||||
let policyStartDate = $("#source_policy_start_date");
|
||||
if (policyStartDate.val()) {
|
||||
calculatePolicyRunDays(increment);
|
||||
}
|
||||
@ -417,15 +557,16 @@ if (isset($selected_lead_type)) {
|
||||
console.warn(`Incurred claim date field #${incurred_claim_date_id} not found.`);
|
||||
}
|
||||
|
||||
if ($('#' + premium_date_id).length) {
|
||||
flatpickr("#" + premium_date_id, {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
} else {
|
||||
console.warn(`Premium date field #${premium_date_id} not found.`);
|
||||
}
|
||||
// if ($('#' + premium_date_id).length) {
|
||||
// flatpickr("#" + premium_date_id, {
|
||||
// dateFormat: "d/m/Y",
|
||||
// allowInput: false
|
||||
// });
|
||||
// } else {
|
||||
// console.warn(`Premium date field #${premium_date_id} not found.`);
|
||||
// }
|
||||
|
||||
// console.log($('#proposed_insurer_' + dataIncrement).length);
|
||||
$('#proposed_insurer_' + dataIncrement).select2();
|
||||
$('#proposed_tpa_' + dataIncrement).select2();
|
||||
}
|
||||
@ -451,6 +592,8 @@ if (isset($selected_lead_type)) {
|
||||
$('#client_branch_id').val(data.client_branch_id || '').change();
|
||||
setTimeout(() => {
|
||||
$('#source_policy_id').val(data.source_policy_id || '');
|
||||
$('#source_policy_end_date').val(data.source_policy_end_date || '');
|
||||
$('#source_policy_start_date').val(data.source_policy_start_date || '');
|
||||
$('#pan').val(data.pan || '');
|
||||
$('#gst').val(data.gst || '');
|
||||
$('#branch_name').val(data.branch_name || '');
|
||||
@ -463,7 +606,7 @@ if (isset($selected_lead_type)) {
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
}, 5000);
|
||||
|
||||
let insurer = (data.insurer_branch_id && data.insurer_id)
|
||||
? `${data.insurer_branch_id}-${data.insurer_id}`
|
||||
@ -490,6 +633,8 @@ if (isset($selected_lead_type)) {
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error in dynamicLeadsDataForEdit function:', error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
}
|
||||
|
||||
@ -498,6 +643,7 @@ if (isset($selected_lead_type)) {
|
||||
console.log('########### THIS IS NON EB LEAD ###############')
|
||||
console.log('Received data:', data);
|
||||
let dataIncrement = 1;
|
||||
fileIndex = data.lead_file_count + 1;
|
||||
|
||||
if (!data || typeof data !== 'object') {
|
||||
console.error('Invalid data received for editing.');
|
||||
@ -505,6 +651,8 @@ if (isset($selected_lead_type)) {
|
||||
}
|
||||
|
||||
$('#appendArea').empty();
|
||||
$('#multiFileAppendArea_' + dataIncrement).empty();
|
||||
|
||||
|
||||
if (data.html) {
|
||||
$('#appendArea').append(data.html);
|
||||
@ -512,6 +660,15 @@ if (isset($selected_lead_type)) {
|
||||
console.warn('HTML content missing in data.');
|
||||
}
|
||||
|
||||
if (data.multi_file_html) {
|
||||
console.log(data.multi_file_html);
|
||||
setTimeout(function(){
|
||||
$('#multiFileAppendArea_' + dataIncrement).append(data.multi_file_html);
|
||||
}, 2000)
|
||||
} else {
|
||||
console.warn('MULTI FILE HTML content missing in data.');
|
||||
}
|
||||
|
||||
let policy_type_id = data.policy_type_id || null;
|
||||
let lead_type = data.lead_type || null;
|
||||
|
||||
|
||||
@ -290,14 +290,18 @@ hr.solid {
|
||||
|
||||
<hr>
|
||||
|
||||
<div id="multiFileAppendArea_1"></div>
|
||||
|
||||
<hr>
|
||||
|
||||
<!-- other row -->
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label for="file_upload">File Upload<span class="text-danger"></span></label>
|
||||
<input type="file" class="form-control" id="file_name" name="file_name" accept=".xls,.xlsx">
|
||||
<span class="text-danger" id="file_name_display"></span>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="salse_person_id">Sales Person<span class="text-danger">*</span></label>
|
||||
@ -370,6 +374,8 @@ $(document).ready(function(){
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
addFileField(1);
|
||||
})
|
||||
|
||||
function getPolicyTypeFields(input) {
|
||||
|
||||
@ -10,9 +10,9 @@
|
||||
overflow-y: auto !important;
|
||||
}
|
||||
#editor-container {
|
||||
width: 100%;
|
||||
min-height: 600px;
|
||||
}
|
||||
width: 100%;
|
||||
min-height: 600px;
|
||||
}
|
||||
|
||||
.modal-dialog {
|
||||
max-width: 90% !important;
|
||||
@ -264,7 +264,7 @@
|
||||
<!-- Unlayer editor -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<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>
|
||||
|
||||
@ -360,7 +360,7 @@
|
||||
<!-- Unlayer editor -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<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>
|
||||
|
||||
@ -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)">
|
||||
<option value="">PlaceHolders</option>
|
||||
<?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);
|
||||
$valueChange = ucwords($valueChange); ?>
|
||||
<option value="{{<?php echo $value; ?>}}"><?php echo $valueChange; ?></option>
|
||||
@ -440,7 +440,7 @@
|
||||
<!-- Unlayer editor -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<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>
|
||||
|
||||
@ -542,7 +542,7 @@
|
||||
<!-- Unlayer editor -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<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>
|
||||
|
||||
@ -615,7 +615,7 @@
|
||||
<!-- Unlayer editor -->
|
||||
<!-- <div class="form-row" id="rac_rate_dropdown"> -->
|
||||
<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 class="form-group text-right m-b-0">
|
||||
@ -702,7 +702,7 @@
|
||||
<!-- Unlayer editor -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<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>
|
||||
|
||||
|
||||
@ -119,6 +119,7 @@
|
||||
<input type="hidden" name="client_id" id="client_id_for_edit">
|
||||
<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_pk" id="cd_ac_pk">
|
||||
<input type="hidden" name="ct_type" id="ct_type">
|
||||
<input type="hidden" name="" id="bro_payable_by">
|
||||
<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>
|
||||
</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>
|
||||
|
||||
<hr>
|
||||
@ -585,6 +595,14 @@ $(document).ready(function(){
|
||||
var cd_ac_no = $(this).find('option:selected').attr('data-cd');
|
||||
var start_date = $(this).find('option:selected').attr('data-sd');
|
||||
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_policy_id', client_policy_id);
|
||||
@ -596,7 +614,7 @@ $(document).ready(function(){
|
||||
$('#policy_no').val(policy_no);
|
||||
$('#insurer_id').val(insurer);
|
||||
$('#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_end_date').val(end_date);
|
||||
|
||||
@ -619,6 +637,9 @@ $(document).ready(function(){
|
||||
if(res.status == true){
|
||||
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)
|
||||
|
||||
if(res.is_copay_yes && res.is_copay_yes.co_share == 1){
|
||||
@ -633,9 +654,11 @@ $(document).ready(function(){
|
||||
|
||||
|
||||
}else{
|
||||
$('#ct_type').val(1)
|
||||
addInsurerColumn()
|
||||
}
|
||||
}else{
|
||||
$('#ct_type').val(1)
|
||||
addInsurerColumn()
|
||||
}
|
||||
},
|
||||
@ -914,6 +937,9 @@ function getPolicyTransactionDataForEndorsementEdit(input){
|
||||
$('#last_action_date').val(res.data.last_action_date);
|
||||
$('#install_due_date').val(res.data.install_due_date);
|
||||
$('#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) {
|
||||
$('#policy_with_corr').prop('checked', true);
|
||||
@ -921,6 +947,12 @@ function getPolicyTransactionDataForEndorsementEdit(input){
|
||||
$('#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') {
|
||||
$('.install_due_date_div').show()
|
||||
}else{
|
||||
@ -937,6 +969,13 @@ function getPolicyTransactionDataForEndorsementEdit(input){
|
||||
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{
|
||||
console.log('No data found');
|
||||
}
|
||||
@ -1769,7 +1808,7 @@ function addInsurerColumn() {
|
||||
break;
|
||||
}
|
||||
|
||||
}else if(team_id.includes('3')){
|
||||
}else if(team_id.includes('3') || team_id.includes('8')){
|
||||
|
||||
switch(index) {
|
||||
case 0: // Insurer selection
|
||||
@ -2155,7 +2194,7 @@ function populateTable(dataArray, status = false) {
|
||||
cell.find('input[type="hidden"]').val(status ? data.id : '');
|
||||
break;
|
||||
}
|
||||
}else if(team_id.includes('3')){
|
||||
}else if(team_id.includes('3') || team_id.includes('8')){
|
||||
switch (rowIndex) {
|
||||
case 0: // Insurer selection
|
||||
cell.find('select').val(insurer);
|
||||
|
||||
@ -698,6 +698,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
'data-itp' : item.itp,
|
||||
'data-bap' : item.bap,
|
||||
'data-tpa' : item.tpa_branch_id + '-' + item.tpa_id,
|
||||
'data-ptid' : item.policy_type_id,
|
||||
});
|
||||
$('#client_policy_id').append(option);
|
||||
});
|
||||
|
||||
@ -123,6 +123,12 @@
|
||||
color: white !important;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
:disabled {
|
||||
background-color: #e0e0e0;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<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>
|
||||
</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;">
|
||||
<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">
|
||||
@ -1352,6 +1368,11 @@ $(document).ready(function(){
|
||||
$('#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();
|
||||
}
|
||||
|
||||
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){
|
||||
$('#hide_file_upload').show();
|
||||
}else{
|
||||
@ -1744,6 +1771,12 @@ function getPolicyTransactionDataForEdit(input) {
|
||||
$('#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 {
|
||||
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) {
|
||||
case 0: // Insurer selection
|
||||
@ -4312,7 +4345,7 @@ function populateTable(dataArray, cd_ac_pk) {
|
||||
cell.find('input[type="hidden"]').val(data.id);
|
||||
break;
|
||||
}
|
||||
}else if(team_id.includes('3')){
|
||||
}else if(team_id.includes('3') || team_id.includes('8')){
|
||||
|
||||
switch (rowIndex) {
|
||||
case 0: // Insurer selection
|
||||
|
||||
14
app/Views/rfq/attachment_files.php
Normal file
14
app/Views/rfq/attachment_files.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php if (!empty($multi_file_data)) : ?>
|
||||
<div class="form-group col-md-12">
|
||||
<label>Select Files:</label>
|
||||
<?php foreach ($multi_file_data as $file) : ?>
|
||||
<div class="form-check">
|
||||
|
||||
<input type="checkbox" class="form-check-input multi_file_attachment" id="file_<?= $file['id'] ?>" name="selected_attachment_files[]" value="<?= $file['id'] ?>" checked>
|
||||
<label class="form-check-label" for="file_<?= $file['id'] ?>">
|
||||
<?= htmlspecialchars($file['docs_name']) ?> - <?= htmlspecialchars($file['file_name']) ?>
|
||||
</label>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@ -1,80 +1,80 @@
|
||||
|
||||
<?php $increment = isset($lead_edit_data) ? "_1" : ''; ?>
|
||||
<hr>
|
||||
|
||||
<div class="form-row renewalCalculation">
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="incurred_claim_date">Incurred Claim Date<span class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['incurred_claim_date']) ? $lead_edit_data['incurred_claim_date'] : '' ?>" type="text" class="form-control incurred_claim" id="incurred_claim_date"
|
||||
<input value="<?= isset($lead_edit_data['incurred_claims_date']) ? $lead_edit_data['incurred_claims_date'] : '' ?>" type="text" class="form-control incurred_claim" id="incurred_claim_date<?= $increment ?>"
|
||||
name="incurred_claim_date[]" placeholder="Enter DOE">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="paid_claims">Paid Claims<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['paid_claims']) ? $lead_edit_data['paid_claims'] : '' ?>" type="text" class="form-control" id="paid_claims" name="paid_claims[]"
|
||||
<input value="<?= isset($lead_edit_data['paid_claims']) ? $lead_edit_data['paid_claims'] : '' ?>" type="text" class="form-control" id="paid_claims<?= $increment ?>" name="paid_claims[]"
|
||||
placeholder="Enter Paid Claims" oninput="incurredClaimSum(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="outstanding_claims">Outstanding Claims<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['outstanding_claims']) ? $lead_edit_data['outstanding_claims'] : '' ?>" type="text" class="form-control" id="outstanding_claims" name="outstanding_claims[]"
|
||||
<input value="<?= isset($lead_edit_data['outstanding_claims']) ? $lead_edit_data['outstanding_claims'] : '' ?>" type="text" class="form-control" id="outstanding_claims<?= $increment ?>" name="outstanding_claims[]"
|
||||
placeholder="Enter Outstanding Claims" oninput="incurredClaimSum(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="incurred_claims">Incurred Claim<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['incurred_claims']) ? $lead_edit_data['incurred_claims'] : '' ?>" type="text" class="form-control" id="incurred_claims" name="incurred_claims[]"
|
||||
<input value="<?= isset($lead_edit_data['incurred_claims']) ? $lead_edit_data['incurred_claims'] : '' ?>" type="text" class="form-control" id="incurred_claims<?= $increment ?>" name="incurred_claims[]"
|
||||
placeholder="Enter Incurred Claim" oninput="incurredClaimSum(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="policy_run_days">Policy Run Days<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['policy_run_days']) ? $lead_edit_data['policy_run_days'] : '' ?>" type="text" class="form-control" id="policy_run_days" name="policy_run_days[]"
|
||||
<input value="<?= isset($lead_edit_data['policy_run_days']) ? $lead_edit_data['policy_run_days'] : '' ?>" type="text" class="form-control" id="policy_run_days<?= $increment ?>" name="policy_run_days[]"
|
||||
placeholder="Enter Policy Run Days" oninput="earnedPremiumCalc(this)" onkeyup="incurredClaimSum(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="premium_at_inception">Premium Paid at Inception<span
|
||||
class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['premium_at_inception']) ? $lead_edit_data['premium_at_inception'] : '' ?>" type="text" class="form-control" id="premium_at_inception" name="premium_at_inception[]"
|
||||
<input value="<?= isset($lead_edit_data['premium_at_inception']) ? $lead_edit_data['premium_at_inception'] : '' ?>" type="text" class="form-control" id="premium_at_inception<?= $increment ?>" name="premium_at_inception[]"
|
||||
placeholder="Enter Premium Paid" oninput="earnedPremiumCalc(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="premium_date">Premium Date<span class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['premium_date']) ? $lead_edit_data['premium_date'] : '' ?>" type="text" class="form-control" id="premium_date" name="premium_date[]"
|
||||
<label for="premium_date">Premium as on Date<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['premium_date']) ? $lead_edit_data['premium_date'] : '' ?>" type="text" class="form-control" id="premium_date<?= $increment ?>" name="premium_date[]"
|
||||
placeholder="Enter Premium Date">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="earned_premium">Earned Premium<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['earned_premium']) ? $lead_edit_data['earned_premium'] : '' ?>" type="text" class="form-control" id="earned_premium" name="earned_premium[]"
|
||||
<input value="<?= isset($lead_edit_data['earned_premium']) ? $lead_edit_data['earned_premium'] : '' ?>" type="text" class="form-control" id="earned_premium<?= $increment ?>" name="earned_premium[]"
|
||||
placeholder="Enter Earned Premium" oninput="incurredClaimSum(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="annualised_claims">Annualised Claims<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['annualised_claims']) ? $lead_edit_data['annualised_claims'] : '' ?>" type="text" class="form-control" id="annualised_claims" name="annualised_claims[]"
|
||||
<input value="<?= isset($lead_edit_data['annualised_claims']) ? $lead_edit_data['annualised_claims'] : '' ?>" type="text" class="form-control" id="annualised_claims<?= $increment ?>" name="annualised_claims[]"
|
||||
placeholder="Enter Annualised Claims">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="incurred_claims_ratio">Incurred Claims Ratio<span
|
||||
class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['incurred_claims_ratio']) ? $lead_edit_data['incurred_claims_ratio'] : '' ?>" type="text" class="form-control" id="incurred_claims_ratio"
|
||||
<input value="<?= isset($lead_edit_data['incurred_claims_ratio']) ? $lead_edit_data['incurred_claims_ratio'] : '' ?>" type="text" class="form-control" id="incurred_claims_ratio<?= $increment ?>"
|
||||
name="incurred_claims_ratio[]" placeholder="Enter Incurred Claims Ratio">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="earned_claims_ratio">Earned Claims Ratio<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['earned_claims_ratio']) ? $lead_edit_data['earned_claims_ratio'] : '' ?>" type="text" class="form-control" id="earned_claims_ratio" name="earned_claims_ratio[]"
|
||||
<input value="<?= isset($lead_edit_data['earned_claims_ratio']) ? $lead_edit_data['earned_claims_ratio'] : '' ?>" type="text" class="form-control" id="earned_claims_ratio<?= $increment ?>" name="earned_claims_ratio[]"
|
||||
placeholder="Enter Earned Claims Ratio">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<!-- <div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="location">Location <span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['location']) ? $lead_edit_data['location'] : '' ?>" type="text" class="form-control" id="location" name="location[]" placeholder="Enter Location">
|
||||
</div>
|
||||
<input value="<?php //echo isset($lead_edit_data['location']) ? $lead_edit_data['location'] : '' ?>" type="text" class="form-control" id="location" name="location[]" placeholder="Enter Location">
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-3 proposed_div" style="display: none;">
|
||||
<label for="proposed_insurer">Proposed Insurer <span class="text-danger"></span></label>
|
||||
@ -116,14 +116,14 @@
|
||||
<label for="incept_emp_count" class="emp_title"> No of Employees at Inception <span
|
||||
class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['incept_emp_count']) ? $lead_edit_data['incept_emp_count'] : '' ?>" type="text" class="form-control" id="incept_emp_count" name="incept_emp_count[]"
|
||||
placeholder="Enter Lives" required>
|
||||
placeholder="Enter Lives" required oninput="calculateTotalLives(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="incept_dept_count" class="depnd_title"> No of Dependents at Inception <span
|
||||
class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['incept_dept_count']) ? $lead_edit_data['incept_dept_count'] : '' ?>" type="text" class="form-control" id="incept_dept_count" name="incept_dept_count[]"
|
||||
placeholder="Enter Lives" required>
|
||||
placeholder="Enter Lives" required oninput="calculateTotalLives(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
|
||||
50
app/Views/rfq/multi_files.php
Normal file
50
app/Views/rfq/multi_files.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
$fileIndex = 1; // Initialize index
|
||||
$increment = 1; // Example increment value
|
||||
?>
|
||||
|
||||
<?php if (isset($lead_edit_data) && isset($lead_edit_data["multi_file_data"]) && !empty($lead_edit_data["multi_file_data"])) {
|
||||
foreach ($lead_edit_data["multi_file_data"] as $index => $value) {
|
||||
$isFirstField = ($index === 0); // First file must be Demography
|
||||
$placeholder = $isFirstField ? 'First file must be Demography.' : '';
|
||||
$accept = $isFirstField ? '.xls,.xlsx' : '';
|
||||
$index = $index + 1;
|
||||
?>
|
||||
|
||||
<div class="form-row d-flex align-items-end" id="fileField_<?= $index ?>">
|
||||
|
||||
<input type="hidden" name="leads_file_id[]"
|
||||
value="<?= htmlspecialchars($value['id']) ?>" id="file_id_<?= $index ?>">
|
||||
|
||||
<!-- Document Name Input -->
|
||||
<div class="form-group col-md-5">
|
||||
<label>Document Name<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" name="docs_name_<?= $increment ?>[]"
|
||||
placeholder="<?= $placeholder ?>"
|
||||
value="<?= htmlspecialchars($value['docs_name']) ?>" id="docs_name_<?= $index ?>">
|
||||
</div>
|
||||
|
||||
<!-- File Upload Input -->
|
||||
<div class="form-group col-md-5">
|
||||
<label>
|
||||
File Upload
|
||||
<span class="text-danger"></span><br>
|
||||
<small id="file_name_display_<?= $index ?>" class="text-muted">
|
||||
<?= !empty($value['file_name']) ? htmlspecialchars($value['file_name']) : 'No file chosen' ?>
|
||||
</small>
|
||||
</label>
|
||||
|
||||
<input type="file" class="form-control" id="file_name_<?= $index ?>"
|
||||
name="file_name_<?= $increment ?>[]" accept="<?= $accept ?>"
|
||||
onchange="showFileName(this, <?= $index ?>)">
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Add/Remove Buttons -->
|
||||
<div class="col-md-2" style="position: relative; bottom: 16px;">
|
||||
<button type="button" class="btn btn-danger" onclick="removeFileField(<?= $index ?>, <?= htmlspecialchars($value['id']) ?>)">x</button>
|
||||
<button type="button" class="btn btn-primary" onclick="addFileField(<?= $increment ?>)">+</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } } ?>
|
||||
1
app/Views/testWebhook.php
Normal file
1
app/Views/testWebhook.php
Normal file
@ -0,0 +1 @@
|
||||
Hello
|
||||
@ -49,7 +49,7 @@
|
||||
<div class="row">
|
||||
<img src="https://venbait.in/nhance/helpdesk/dev/assets/helpdeskz/images/agent.jpg"
|
||||
class="user-avatar rounded-circle img-fluid col-mb-6" style="max-width: 70px">
|
||||
<div style="padding-left: 10px;padding-top: 15px;" class="col-mb-6"><?= $message_data['user_name'] ?></div>
|
||||
<div style="padding-left: 10px;padding-top: 15px;" class="col-mb-6"><?= $message['user_name'] ?? "Auto Mail" ?></div>
|
||||
|
||||
</div>
|
||||
<span style="text-align: center; position: relative;text-align: center;bottom: 28px;left: 15px;" class="badge badge-primary">Staff</span>
|
||||
|
||||
837
app/Views/ticket_feedback_form.php
Normal file
837
app/Views/ticket_feedback_form.php
Normal file
@ -0,0 +1,837 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<!-- App favicon -->
|
||||
<link rel="shortcut icon" href="<?= base_url() . "public"; ?>/assets/images/Nhance_Favi.svg">
|
||||
|
||||
<title>Nhance Experience Form</title>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css">
|
||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/parsleyjs@2.9.2/dist/parsley.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.navbar-custom {
|
||||
top: -10px !important;
|
||||
height: 61px !important;
|
||||
/* background-color: #02a8b5;
|
||||
*/
|
||||
background-color: #02a8b5;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.logo-box {
|
||||
top: -10px !important;
|
||||
height: 50px !important;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: #f0f0f0;
|
||||
font-family: 'Roboto', sans-serif;
|
||||
}
|
||||
|
||||
.nhance-form-card {
|
||||
max-width: 740px;
|
||||
margin: 32px auto;
|
||||
background: #fff;
|
||||
border-radius: 30px;
|
||||
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.1);
|
||||
padding: 32px 24px;
|
||||
}
|
||||
|
||||
.nhance-form-card-details {
|
||||
max-width: 740px;
|
||||
margin: 20px auto;
|
||||
/* Reduced vertical margin */
|
||||
background: #fff;
|
||||
border-radius: 20px;
|
||||
/* Slightly smaller radius */
|
||||
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.1);
|
||||
padding: 20px 16px;
|
||||
/* Reduced padding */
|
||||
}
|
||||
|
||||
/* Adjust form group spacing */
|
||||
.nhance-form-card-details .form-group {
|
||||
margin-bottom: 12px;
|
||||
/* Reduced spacing between rows */
|
||||
}
|
||||
|
||||
/* Compact label styling */
|
||||
.nhance-form-card-details label {
|
||||
font-size: 14px;
|
||||
/* Smaller font size */
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* Compact input styling */
|
||||
.nhance-form-card-details .form-control-plaintext {
|
||||
font-size: 14px;
|
||||
/* Smaller font size */
|
||||
padding-top: 4px !important;
|
||||
padding-bottom: 4px !important;
|
||||
}
|
||||
|
||||
/* Adjust grid columns spacing */
|
||||
.nhance-form-card-details .col-md-4 {
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
.nhance-form-card-details .col-md-8 {
|
||||
padding-left: 8px;
|
||||
}
|
||||
|
||||
.nhance-form-header {
|
||||
font-size: 32px;
|
||||
font-weight: 400;
|
||||
color: #202124;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.nhance-form-subtitle {
|
||||
font-size: 14px;
|
||||
color: #5f6368;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.divider {
|
||||
border-top: 1px solid #dadce0;
|
||||
margin: 24px 0;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
label {
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
color: #202124;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.form-control {
|
||||
height: 48px;
|
||||
border: 1px solid #dadce0;
|
||||
border-radius: 4px;
|
||||
padding: 12px 14px;
|
||||
font-size: 14px;
|
||||
color: #202124;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
.form-control:focus {
|
||||
border-color: #1a73e8;
|
||||
box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
textarea.form-control {
|
||||
height: auto;
|
||||
min-height: 100px;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.required-asterisk {
|
||||
color: #d93025;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.btn-nhance {
|
||||
background-color: #1a73e8;
|
||||
color: white;
|
||||
border-radius: 4px;
|
||||
padding: 12px 24px;
|
||||
border: none;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.25px;
|
||||
text-transform: uppercase;
|
||||
transition: background-color 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.btn-nhance:hover {
|
||||
background-color: #1557b0;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.half-framed-textbox {
|
||||
position: relative;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
|
||||
.border-animation {
|
||||
position: absolute;
|
||||
bottom: -2px;
|
||||
/* Align with input bottom */
|
||||
height: 2px;
|
||||
background: #6200ea;
|
||||
width: 0;
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
|
||||
.col-md-9 {
|
||||
position: relative;
|
||||
/* Contain the animation within the input column */
|
||||
}
|
||||
|
||||
.half-framed-textbox input {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
font-size: 16px;
|
||||
outline: none;
|
||||
background: transparent;
|
||||
position: relative;
|
||||
text-align: left !important;
|
||||
height: auto !important;
|
||||
/* padding-left: 0 !important; */
|
||||
/* padding-bottom: 0 !important; */
|
||||
}
|
||||
|
||||
.half-framed-textbox .form-control {
|
||||
border: none !important;
|
||||
border-bottom: 2px solid #dadce0 !important;
|
||||
box-shadow: none !important;
|
||||
text-align: left !important;
|
||||
height: auto !important;
|
||||
height: auto !important;
|
||||
padding-top: 18px !important;
|
||||
padding-bottom: 0px !important;
|
||||
line-height: 1.5 !important;
|
||||
margin-bottom: 21px;
|
||||
/* padding-left: 0 !important; */
|
||||
/* padding-bottom: 0 !important; */
|
||||
}
|
||||
|
||||
.form-control {
|
||||
height: auto !important;
|
||||
min-height: 48px;
|
||||
}
|
||||
|
||||
.navbar-custom {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 61px;
|
||||
background-color: #02a8b5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
/* Center vertically */
|
||||
justify-content: space-between;
|
||||
/* Align logo and header properly */
|
||||
padding: 0 20px;
|
||||
/* Add some spacing */
|
||||
z-index: 1000;
|
||||
/* Ensure it stays above other content */
|
||||
}
|
||||
|
||||
.logo-box img {
|
||||
margin-top: auto;
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
main {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.feedback-header {
|
||||
flex-grow: 1;
|
||||
/* Allow it to take remaining space */
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
font-size: 32px;
|
||||
font-weight: 400;
|
||||
margin-top: auto;
|
||||
font-family: 'sans-serif', serif;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.swal-modal {
|
||||
background-color: white;
|
||||
width: 80%;
|
||||
max-width: 400px;
|
||||
padding: 30px;
|
||||
border-radius: 10px;
|
||||
text-align: center;
|
||||
box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.swal-title {
|
||||
color: #595959;
|
||||
font-size: 24px;
|
||||
margin: 0 0 10px 0;
|
||||
}
|
||||
|
||||
.swal-text {
|
||||
color: #545454;
|
||||
font-size: 16px;
|
||||
margin: 15px 0;
|
||||
}
|
||||
|
||||
.swal-icon {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
border-radius: 50%;
|
||||
margin: 0 auto 20px;
|
||||
background-color: #a5dc86;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
animation: scaleIn 0.4s ease-out;
|
||||
}
|
||||
|
||||
.swal-icon::after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 30px;
|
||||
height: 50px;
|
||||
border: solid white;
|
||||
border-width: 0 4px 4px 0;
|
||||
transform: rotate(45deg);
|
||||
margin-top: -8px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@keyframes scaleIn {
|
||||
from {
|
||||
transform: scale(0);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.swal-modal {
|
||||
width: 90%;
|
||||
padding: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Style for Loader -->
|
||||
<style>
|
||||
.loader-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #00000069;
|
||||
z-index: 99999;
|
||||
}
|
||||
|
||||
.loader {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
font-size: 0;
|
||||
color: #00c9d0;
|
||||
display: inline-block;
|
||||
margin: -25px 0 0 -25px;
|
||||
text-indent: -9999em;
|
||||
-webkit-transform: translateZ(0);
|
||||
-ms-transform: translateZ(0);
|
||||
transform: translateZ(0);
|
||||
}
|
||||
|
||||
.loader div {
|
||||
background-color: #6ad9cf;
|
||||
display: inline-block;
|
||||
float: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
opacity: .5;
|
||||
border-radius: 50%;
|
||||
-webkit-animation: ballPulseDouble 2s ease-in-out infinite;
|
||||
animation: ballPulseDouble 2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.loader div:last-child {
|
||||
-webkit-animation-delay: -1s;
|
||||
animation-delay: -1s;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
|
||||
.parsley-required{
|
||||
color: red !important;
|
||||
}
|
||||
|
||||
.swal-icon-error {
|
||||
background-color: #f27474;
|
||||
}
|
||||
|
||||
.swal-icon-error::before,
|
||||
.swal-icon-error::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 40px;
|
||||
height: 4px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.swal-icon-error::before {
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
.swal-icon-error::after {
|
||||
transform: rotate(-45deg);
|
||||
}
|
||||
|
||||
.swal-button-error {
|
||||
background-color: #dc3545;
|
||||
}
|
||||
|
||||
.swal-button-error:hover {
|
||||
background-color: #bb2d3b;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- Topbar Start -->
|
||||
<div class="navbar-custom">
|
||||
<div class="logo-box d-flex align-items-center">
|
||||
<img src="<?= base_url() . "public"; ?>/assets/images/Nhance_Favi_white_2.png" alt="Logo">
|
||||
</div>
|
||||
<div class="feedback-header">
|
||||
Nhance Experience Form
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- end Topbar -->
|
||||
|
||||
|
||||
|
||||
<input type="hidden" id="ticket_id" value="<?= $ticket_id ?>">
|
||||
<input type="hidden" id="login_type" value="<?= $viewer ?>">
|
||||
<input type="hidden" id="form_submission_state" value="<?= $form_submitted ?>">
|
||||
|
||||
|
||||
<!-- <div class="nhance-form-card">
|
||||
<div class="nhance-form-header">Nhance Experience Form</div>
|
||||
<div class="nhance-form-subtitle">Fill in the details to enhance your experience</div>
|
||||
</div> -->
|
||||
<form id="feedbackForm" data-parsley-validate>
|
||||
<div class="nhance-form-card-details" style="margin-top : 70px;">
|
||||
<div class="form-group d-flex align-items-center">
|
||||
<div class="col-md-4">
|
||||
<label for="email" class="mb-0 mr-2">Email </label>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" value="<?= isset($ticket_data['emp_mail']) ? $ticket_data['emp_mail'] : "" ?>" class="form-control-plaintext" id="email" readonly>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group d-flex align-items-center">
|
||||
<div class="col-md-4">
|
||||
<label for="name">Your name </label>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" value="<?= isset($ticket_data['emp_name']) ? $ticket_data['emp_name'] : "" ?>" class="form-control-plaintext" id="name" readonly>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group d-flex align-items-center">
|
||||
<div class="col-md-4">
|
||||
<label for="client_name">Your Employer </label>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" value="<?= isset($ticket_data['client_name']) ? $ticket_data['client_name'] : "" ?>" class="form-control-plaintext" id="client_name" readonly>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group d-flex align-items-center ">
|
||||
<div class="col-md-4">
|
||||
<label for="emp_code">Your Employer ID </label>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" value="<?= isset($ticket_data['emp_code']) ? $ticket_data['emp_code'] : "" ?>" class="form-control-plaintext" id="emp_code" readonly>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group d-flex align-items-center">
|
||||
<div class="col-md-4">
|
||||
<label for="claim_number">Your Claim ID</label>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" value="<?= isset($ticket_data['claim_number']) ? $ticket_data['claim_number'] : "" ?>" class="form-control-plaintext" id="claim_number" readonly>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="nhance-form-card">
|
||||
<div class="form-group">
|
||||
<label for="satisfaction_level">Your satisfaction level with Nhance in explanation of the claims settlement process<span class="text-danger"> *</span></label>
|
||||
<div class="error-container" id="responsiveness-error"></div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process" id="highly_satisfied" required data-parsley-errors-container="#responsiveness-error">
|
||||
<label class="form-check-label" for="highly_satisfied">
|
||||
Highly satisfied
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process" id="satisfied" required>
|
||||
<label class="form-check-label" for="satisfied">
|
||||
Satisfied
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process" id="neutral" required>
|
||||
<label class="form-check-label" for="neutral">
|
||||
Neutral
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process" id="dissatisfied" required>
|
||||
<label class="form-check-label" for="dissatisfied">
|
||||
Dissatisfied
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process" id="highly_dissatisfied" required>
|
||||
<label class="form-check-label" for="highly_dissatisfied">
|
||||
Highly dissatisfied
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="claim_number">Your satisfaction level with Nhance responsiveness & professionalism throughout the process<span class="text-danger"> *</span></label>
|
||||
<div class="error-container" id="responsiveness-error_1"></div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process" id="highly_satisfied_1" required data-parsley-errors-container="#responsiveness-error_1">
|
||||
<label class="form-check-label" for="highly_satisfied_1">
|
||||
Highly satisfied
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process" id="satisfied_1" required>
|
||||
<label class="form-check-label" for="satisfied_1">
|
||||
Satisfied
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process" id="neutral_1" required>
|
||||
<label class="form-check-label" for="neutral_1">
|
||||
Neutral
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process" id="dissatisfied_1" required>
|
||||
<label class="form-check-label" for="dissatisfied_1">
|
||||
Dissatisfied
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process" id="highly_dissatisfied_1" required>
|
||||
<label class="form-check-label" for="highly_dissatisfied_1">
|
||||
Highly dissatisfied
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="claim_number">How satisfied were you with the time taken for Claim settlement? <span class="text-danger"> *</span></label>
|
||||
<div class="error-container" id="responsiveness-error_2"></div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="how_satisfied_were_you_with_the_time_taken_for_claim_settlement" id="claim_was_settled_on_time" required data-parsley-errors-container="#responsiveness-error_2">
|
||||
<label class="form-check-label" for="claim_was_settled_on_time">
|
||||
Claim was settled on time
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="how_satisfied_were_you_with_the_time_taken_for_claim_settlement" id="claim_settlement_took_longer_than_expected">
|
||||
<label class="form-check-label required" for="claim_settlement_took_longer_than_expected">
|
||||
Claim settlement took longer than expected
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="claim_number">How satisfied are you with the Policy's terms and coverage<span class="text-danger"> *</span></label>
|
||||
<div class="error-container" id="responsiveness-error_3"></div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="how_satisfied_are_you_with_the_policys_terms_and_coverage" id="highly_satisfied_2" required data-parsley-errors-container="#responsiveness-error_3">
|
||||
<label class="form-check-label" for="highly_satisfied_2">
|
||||
Highly satisfied
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="how_satisfied_are_you_with_the_policys_terms_and_coverage" id="satisfied_2" required>
|
||||
<label class="form-check-label" for="satisfied_2">
|
||||
Satisfied
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="how_satisfied_are_you_with_the_policys_terms_and_coverage" id="neutral_2" required>
|
||||
<label class="form-check-label" for="neutral_2">
|
||||
Neutral
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="how_satisfied_are_you_with_the_policys_terms_and_coverage" id="dissatisfied_2" required>
|
||||
<label class="form-check-label" for="dissatisfied_2">
|
||||
Dissatisfied
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="how_satisfied_are_you_with_the_policys_terms_and_coverage" id="highly_dissatisfied_2" required>
|
||||
<label class="form-check-label" for="highly_dissatisfied_2">
|
||||
Highly dissatisfied
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="claim_number">Would you recommend us? <span class="text-danger">*</span></label>
|
||||
|
||||
<div class="error-container" id="responsiveness-error_4"></div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" id="absolutely" name="would_you_recommend_us" required data-parsley-errors-container="#responsiveness-error_4">
|
||||
<label class="form-check-label" for="absolutely">
|
||||
Absolutely!
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="would_you_recommend_us" id="maybe_depends_on_improvements" required>
|
||||
<label class="form-check-label" for="maybe_depends_on_improvements">
|
||||
May be, depends on improvements.
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="would_you_recommend_us" id="no" required>
|
||||
<label class="form-check-label" for="no">
|
||||
No
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group half-framed-textbox">
|
||||
<label for="feedback"> Tell us how we can do better!</label>
|
||||
<input type="text" class="form-control" id="feedback" name="feedback">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-center mt-3">
|
||||
<button type="submit" id="feedbackFormSubmitButton" class="btn-nhance">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div id="formSuccessPage">
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Loader start -->
|
||||
<div class="loader-mask">
|
||||
<div class="loader">
|
||||
<img src="<?= base_url() . "public" ?>/assets/images/nhance-loader-fast.gif" height="40" width="40" alt="Loading...">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Loader end -->
|
||||
|
||||
<footer class="text-center py-3 mt-auto" style="background-color: #f8f9fa; color: #5f6368;">
|
||||
<p class="mb-0">© 2025 Nhance India Pvt Ltd. All Rights Reserved.</p>
|
||||
</footer>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
var form_submitted_state = $("#form_submission_state").val();
|
||||
|
||||
var login_type = $("#login_type").val();
|
||||
|
||||
if (form_submitted_state == 1 && login_type != 1) {
|
||||
|
||||
$("#feedbackForm").hide();
|
||||
|
||||
const container = document.getElementById("formSuccessPage");
|
||||
container.innerHTML = `
|
||||
|
||||
<div class = "nhance-form-card" style="margin-top : 70px;">
|
||||
<div class="swal-icon"></div>
|
||||
<h2 class="swal-title d-flex justify-content-center">Success!</h2>
|
||||
<div class="swal-text d-flex justify-content-center">Your Feedback has been Received Successfully.</div>
|
||||
</div>
|
||||
|
||||
`;
|
||||
|
||||
|
||||
} else if (form_submitted_state == 1 && login_type == 1) {
|
||||
|
||||
$("#feedbackFormSubmitButton").hide();
|
||||
|
||||
var formData = <?= !empty($ticket_data['feedback_json']) ? $ticket_data['feedback_json'] : '{}' ?>;
|
||||
console.log("Form data received : ", formData);
|
||||
|
||||
var feedbackText = formData.feedback;
|
||||
$("#feedback").val(feedbackText).prop("readonly", true);
|
||||
delete formData.feedback;
|
||||
|
||||
Object.values(formData).forEach((data, key) => {
|
||||
console.log("key : ", data);
|
||||
|
||||
if (data.length > 1) {
|
||||
$(`#${data}`).prop("checked", true);
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
} else if (form_submitted_state == 0 && login_type == 1) {
|
||||
|
||||
$("#feedbackForm").hide();
|
||||
|
||||
const container = document.getElementById("formSuccessPage");
|
||||
container.innerHTML = `
|
||||
|
||||
<div class="nhance-form-card" style="margin-top: 70px;">
|
||||
<div class="swal-icon swal-icon-error"></div>
|
||||
<h2 class="swal-title d-flex justify-content-center">Error!</h2>
|
||||
<div class="swal-text d-flex justify-content-center" id="errorMessage">User has not Submitted the Feedback Yet</div>
|
||||
</div>
|
||||
|
||||
`;
|
||||
}
|
||||
})
|
||||
|
||||
$("#feedbackForm").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
if (!$(this).parsley().isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
formData = $("#feedbackForm").serializeArray();
|
||||
|
||||
|
||||
var would_you_recommend_us_id = $("[name='would_you_recommend_us']:checked").attr("id") || "";
|
||||
|
||||
var how_satisfied_are_you_with_the_policys_terms_and_coverage_id = $("[name='how_satisfied_are_you_with_the_policys_terms_and_coverage']:checked").attr("id") || "";
|
||||
|
||||
var how_satisfied_were_you_with_the_time_taken_for_claim_settlement_id = $("[name='how_satisfied_were_you_with_the_time_taken_for_claim_settlement']:checked").attr("id") || "";
|
||||
|
||||
var your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process_id = $("[name='your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process']:checked").attr("id") || "";
|
||||
|
||||
var your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process_id = $("[name='your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process']:checked").attr("id") || "";
|
||||
|
||||
|
||||
formData.push({
|
||||
name: "your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process",
|
||||
value: your_satisfaction_level_with_nhance_in_explanation_of_the_claims_settlement_process_id
|
||||
});
|
||||
|
||||
formData.push({
|
||||
name: "would_you_recommend_us",
|
||||
value: would_you_recommend_us_id
|
||||
});
|
||||
|
||||
formData.push({
|
||||
name: "your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process",
|
||||
value: your_satisfaction_level_with_nhance_responsiveness_and_professionalism_throughout_the_process_id
|
||||
});
|
||||
|
||||
formData.push({
|
||||
name: "how_satisfied_were_you_with_the_time_taken_for_claim_settlement",
|
||||
value: how_satisfied_were_you_with_the_time_taken_for_claim_settlement_id
|
||||
});
|
||||
|
||||
formData.push({
|
||||
name: "how_satisfied_are_you_with_the_policys_terms_and_coverage",
|
||||
value: how_satisfied_are_you_with_the_policys_terms_and_coverage_id
|
||||
});
|
||||
|
||||
var data = filterFormData(formData);
|
||||
|
||||
var ticket_id = $("#ticket_id").val();
|
||||
|
||||
console.log("Form Data : ", data);
|
||||
console.log("Form Dataticket_id : ", ticket_id);
|
||||
|
||||
|
||||
var url = "<?= base_url('claims-feedback-form') ?>" + `/${ticket_id}`;
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: data,
|
||||
type: 'POST',
|
||||
success: function(response) {
|
||||
|
||||
if (response.status) {
|
||||
console.log("Success:", response);
|
||||
|
||||
} else {
|
||||
console.log("Failure");
|
||||
}
|
||||
location.reload(true);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error("AJAX Error:", error);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
$("#feedbackForm")[0].reset();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
function filterFormData(data) {
|
||||
return data.filter(entry => entry.value !== "on");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
148
app/Views/ticket_feedback_list.php
Normal file
148
app/Views/ticket_feedback_list.php
Normal file
@ -0,0 +1,148 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
.col-12 {
|
||||
|
||||
max-width: 98% !important;
|
||||
}
|
||||
|
||||
.dataTables_filter {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.addbtnStyle {
|
||||
margin-left: 20px !important;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.table th:nth-child(1),
|
||||
.table td:nth-child(1) {
|
||||
max-width: 200px !important;
|
||||
min-width: 100px !important;
|
||||
overflow: hidden !important;
|
||||
text-overflow: ellipsis !important;
|
||||
white-space: nowrap !important;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Claim Feedback List </h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>Claim Number</th>
|
||||
<th>Emp Code</th>
|
||||
<th>Emp name</th>
|
||||
<th>Corporate name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (isset($feedback_data)) { ?>
|
||||
<?php foreach($feedback_data as $data){ ?>
|
||||
<tr onclick="viewFeedbackForm(<?php echo $data['id']; ?>)">
|
||||
<td><?php echo $data['claim_number']; ?></td>
|
||||
<td><?php echo $data['emp_code']; ?></td>
|
||||
<td><?php echo $data['emp_name']; ?></td>
|
||||
<td><?php echo $data['client_name']; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-------------------------------------------------------------------------------------------------->
|
||||
|
||||
<script>
|
||||
|
||||
// Datatable document ready
|
||||
$(document).ready(function() {
|
||||
|
||||
var ticketsTable = $('#scroll-horizontal-datatable');
|
||||
|
||||
if (ticketsTable.length) {
|
||||
|
||||
ticketsTable.DataTable({
|
||||
scrollX: true,
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Claim-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: 'Excel',
|
||||
title: 'claim-List',
|
||||
exportOptions: {
|
||||
orthogonal: 'sort'
|
||||
},
|
||||
},
|
||||
],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 25, // Set default number of rows per page (optional)
|
||||
ordering: false,
|
||||
});
|
||||
} else {
|
||||
console.error("Table atet found.");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function viewFeedbackForm(ticket_id){
|
||||
|
||||
console.log("Ticket ID : ",ticket_id);
|
||||
var md5Hash_ticket_id = md5(ticket_id);
|
||||
console.log("MD5 Ticket ID : ",md5Hash_ticket_id);
|
||||
|
||||
// alert(md5Hash);
|
||||
|
||||
feedbackPage = `<?= base_url("claims-feedback-form/") ?>${md5Hash_ticket_id}/1`
|
||||
|
||||
// window.location.href = feedbackPage;
|
||||
window.open(feedbackPage, "_blank");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
@ -20,8 +20,9 @@
|
||||
<td><?php echo $row['display_name']; ?></td>
|
||||
<td><?php echo $row['old_value'].' => '.$row['new_value']; ?></td>
|
||||
<!-- <td><?php //echo $row['new_value']; ?></td> -->
|
||||
<td><?php echo $row['modified_by']; ?></td>
|
||||
<td><?php echo $row['created_at']; ?></td>
|
||||
<td><?php echo !empty($row['modified_by'])? $row['modified_by'] : "Created by employee"; ?></td>
|
||||
<!-- <td><?php //echo $row['created_at']; ?></td> -->
|
||||
<td><?php echo date("d-m-Y H:i:s a", strtotime($row['created_at'])) ?? " - "; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
@ -35,6 +35,10 @@ table.dataTable tbody td {
|
||||
white-space: nowrap !important;
|
||||
}
|
||||
|
||||
#scroll-horizontal-datatable tbody tr:hover {
|
||||
background-color: #e0e0e0;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
@ -57,6 +61,7 @@ table.dataTable tbody td {
|
||||
<th>Policy Type</th>
|
||||
<th>Claim number</th>
|
||||
<th>TPA ID</th>
|
||||
<th>Emp ID</th>
|
||||
<th>Emp name</th>
|
||||
<th>Insured Name</th>
|
||||
<th>Corporate name</th>
|
||||
@ -66,7 +71,7 @@ table.dataTable tbody td {
|
||||
<tbody>
|
||||
<?php if (isset($ticket_data)) { ?>
|
||||
<?php foreach($ticket_data as $index => $row){ ?>
|
||||
<tr onclick="viewTicket(<?php echo $row['id']; ?>)">
|
||||
<tr onclick="viewTicket(<?php echo $row['id']; ?>)" style="cursor: pointer;">
|
||||
|
||||
<td data-toggle="tooltip" data-placement="top"
|
||||
|
||||
@ -109,7 +114,8 @@ table.dataTable tbody td {
|
||||
|
||||
<td><?php echo str_replace("Claim-", "", $ticket_type[$row['ticket_type_id']] ?? ""); ?></td>
|
||||
<td><?php echo $row['claim_no']; ?></td>
|
||||
<td><?php echo $row['tpa_id']; ?></td>
|
||||
<td><?php echo $row['tpa_no']; ?></td>
|
||||
<td><?php echo $row['emp_code']; ?></td>
|
||||
<td><?php echo $row['emp_name']; ?></td>
|
||||
<td><?php echo $row['insured_name']; ?></td>
|
||||
<td><?php echo $row['short_name']; ?></td>
|
||||
@ -184,8 +190,12 @@ $(document).ready(function() {
|
||||
|
||||
function viewTicket(ticket_id){
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
let url = '<?= base_url('ticket/view/'); ?>' + ticket_id
|
||||
window.location.href = url
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -225,14 +225,18 @@
|
||||
|
||||
<button id="addQuote" class="btn btn-custom">Add New Proposal</button>
|
||||
<button id="submitData" class="btn btn-primary">Save RFQ</button>
|
||||
<?php if (in_array(get_role_id(), [1,2,3,5]) || in_array(BUSINESS_SUPPORT_TEAM_ID, user_team())) { ?>
|
||||
<?php if (in_array(get_role_id(), [1,2,5]) || in_array(BUSINESS_SUPPORT_TEAM_ID, user_team())) { ?>
|
||||
<button id="submitQCRData" onclick="checkTheTableDataChanged(5)" class="btn btn-primary">Procced to QCR</button>
|
||||
<?php } ?>
|
||||
<a id="submitExcel" onclick="checkTheTableDataChanged(2)" class="btn btn-primary" id>Export Excel</a>
|
||||
<button id="submitInternalMail" class="btn btn-primary" onclick="checkTheTableDataChanged(4)">Send Internal Mail</button>
|
||||
<button id="submitMail" class="btn btn-primary" onclick="checkTheTableDataChanged(3)">Send Insurer Mail</button>
|
||||
<?php if (get_role_id() == 1 || in_array($user_team,[6,7])) { ?>
|
||||
<button id="submitMail" class="btn btn-primary"
|
||||
onclick="checkTheTableDataChanged(3)">Send Insurer Mail</button>
|
||||
<?php } ?>
|
||||
<button id="submitPlacement" class="btn btn-primary" onclick="checkTheTableDataChanged(6)">Placement</button>
|
||||
<input type="hidden" id="lead_id" name="lead_id" value="<?= isset($lead_id) ? $lead_id : '' ?>">
|
||||
<input type="hidden" id="rfq_primaryKey" name="rfq_primaryKey" value="<?= isset($rfq_data['id']) ? $rfq_data['id'] : '' ?>">
|
||||
<input type="hidden" id="qcr_count" value="<?= isset($qcr_count) ? $qcr_count : 0 ?>">
|
||||
<!-- <button id="openDialogBtn">Open Dialog</button> -->
|
||||
|
||||
@ -373,6 +377,16 @@
|
||||
<div class="form-row" id="input_for_row">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<h4>Attachments Files</h4>
|
||||
<hr>
|
||||
|
||||
<div class="form-group" id="insurer_or_clinet_mail_attachment">
|
||||
<div class="form-row" >
|
||||
<?php echo isset($attachment_html) && !empty($attachment_html) ? $attachment_html : ''; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<button type="submit" class="btn btn-primary" onclick="constructURL(1)">Send Mail</button>
|
||||
@ -394,47 +408,61 @@
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="to">To </label>
|
||||
<select class="form-control" id="to" name="to" required>
|
||||
<?php if (isset($userList)) { ?>
|
||||
<?php foreach ($userList as $user) { ?>
|
||||
<option value="<?= $user['email'];?>">
|
||||
<?= $user['first_name'].' - '.$user['email'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="to">To </label>
|
||||
<select class="form-control" id="to" name="to" required>
|
||||
<?php if (isset($userList)) { ?>
|
||||
<?php foreach ($userList as $user) { ?>
|
||||
<option value="<?= $user['email'];?>">
|
||||
<?= $user['first_name'].' - '.$user['email'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="cc">CC </label>
|
||||
<select class="form-control" id="cc" name="cc" required multiple>
|
||||
<?php if (isset($userList)) { ?>
|
||||
<?php foreach ($userList as $user) { ?>
|
||||
<option value="<?= $user['id'];?>">
|
||||
<?= $user['first_name'].' - '.$user['email'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="subject">Subject</label>
|
||||
<input id="subject" type="text" class="form-control" name="subject" value="<?= isset($subject) ? $subject : " " ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="internal_mail_content">Mail Content</label>
|
||||
<textarea id="internal_mail_content" class="form-control" name="internal_mail_content" rows="3"><?= isset($mail_content) ? $mail_content : " " ?></textarea>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="cc">CC </label>
|
||||
<select class="form-control" id="cc" name="cc" required multiple>
|
||||
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
|
||||
<?php if (isset($exclusiveUserList)) { ?>
|
||||
<?php foreach ($exclusiveUserList as $user) { ?>
|
||||
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
|
||||
<option value="<?= $user['id'];?>">
|
||||
<?= $user['first_name'].' - '.$user['email'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="subject">Subject</label>
|
||||
<input id="subject" type="text" class="form-control" name="subject" value="<?= isset($subject) ? $subject : " " ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="internal_mail_content">Mail Content</label>
|
||||
<textarea id="internal_mail_content" class="form-control" name="internal_mail_content" rows="3"><?= isset($mail_content) ? $mail_content : " " ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<br>
|
||||
<h4>Attachments Files</h4>
|
||||
<hr>
|
||||
|
||||
<div class="form-group" id="internal_mail_attachment">
|
||||
<div class="form-row" >
|
||||
<?php echo isset($attachment_html) && !empty($attachment_html) ? $attachment_html : ''; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<button type="submit" class="btn btn-primary" onclick="constructURL(2)">Send Mail</button>
|
||||
</div>
|
||||
@ -463,30 +491,45 @@
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="payment_date">Payment Date</label>
|
||||
<input type="text" class="form-control" id="payment_date" name="payment_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['payment_date']) ? date('d/m/Y', strtotime($lead_data['payment_date'])) : "" ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="utr_no">UTR No.</label>
|
||||
<input type="text" class="form-control" id="utr_no" name="utr_no" placeholder="Enter UTR No.">
|
||||
<input type="text" class="form-control" id="utr_no" name="utr_no" placeholder="Enter UTR No." value="<?= isset($lead_data['utr_no']) ? $lead_data['utr_no'] : "" ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="placement_date">Placement Date</label>
|
||||
<input type="text" class="form-control" id="placement_date" name="placement_date" placeholder="DD/MM/YYY">
|
||||
<input type="text" class="form-control" id="placement_date" name="placement_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['placement_date']) ? date('d/m/Y', strtotime($lead_data['placement_date'])) : "" ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label style = "padding-left: 15px;padding-top: 33px;" for="is_cd_switch">CD </label>
|
||||
<input id="is_cd_switch" type="checkbox" name = "is_cd" value = "1" data-toggle="toggle" data-on="With CD" data-off="Without CD" data-onstyle="info" data-offstyle="dark" data-style="border" data-width="150" <?= isset($lead_data['is_cd']) && $lead_data['is_cd'] != 1 ? '' : 'checked' ?>
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="premium_amount">Premium Amount</label>
|
||||
<input type="text" class="form-control" id="premium_amount" name="premium_amount" placeholder="Enter Premium Amount">
|
||||
<input type="text" class="form-control" id="premium_amount" name="premium_amount" placeholder="Enter Premium Amount" value="<?= isset($lead_data['premium_amount']) ? $lead_data['premium_amount'] : "" ?>">
|
||||
</div>
|
||||
|
||||
<?php if (isset($lead_data['is_cd']) && $lead_data['is_cd'] == 1 || !isset($lead_data['is_cd'])) { ?>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="cd_amount">CD Amount</label>
|
||||
<input type="text" class="form-control" id="cd_amount" name="cd_amount" placeholder="Enter CD Amount" value="<?= isset($lead_data['cd_amount']) ? $lead_data['cd_amount'] : "" ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="total_amount">Total Amount</label>
|
||||
<input type="text" class="form-control" id="total_amount" name="total_amount" placeholder="Enter Total Amount">
|
||||
<input type="text" class="form-control" id="total_amount" name="total_amount" placeholder="Enter Total Amount" value="<?= isset($lead_data['cd_amount']) ? $lead_data['cd_amount'] : "" ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="cd_amount">CD Amount</label>
|
||||
<input type="text" class="form-control" id="cd_amount" name="cd_amount" placeholder="Enter CD Amount">
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<hr>
|
||||
@ -509,12 +552,15 @@
|
||||
<div class="form-group col-md-6">
|
||||
<label for="placement_cc">CC </label>
|
||||
<select class="form-control" id="placement_cc" name="placement_cc" required multiple>
|
||||
<?php if (isset($userList)) { ?>
|
||||
<?php foreach ($userList as $user) { ?>
|
||||
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
|
||||
<?php if (isset($exclusiveUserList)) { ?>
|
||||
>
|
||||
<?php foreach ($exclusiveUserList as $user) { ?>
|
||||
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
|
||||
<option value="<?= $user['id'];?>">
|
||||
<?= $user['first_name'].' - '.$user['email'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } }?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
@ -535,6 +581,16 @@
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<h4>Attachments Files</h4>
|
||||
<hr>
|
||||
|
||||
<div class="form-group" id="placement_mail_attachment">
|
||||
<div class="form-row" >
|
||||
<?php echo isset($attachment_html) && !empty($attachment_html) ? $attachment_html : ''; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<button type="submit" class="btn btn-primary" onclick="constructURL(3)">Send Mail</button>
|
||||
</div>
|
||||
@ -557,6 +613,7 @@
|
||||
var premium_data_check = false;
|
||||
var user_role_id = <?= get_role_id(); ?>;
|
||||
var jsonDataForHide = null;
|
||||
var multi_file_data = [];
|
||||
|
||||
const editorConfig = {
|
||||
buttons: [
|
||||
@ -595,7 +652,8 @@
|
||||
console.log('Type:', type);
|
||||
|
||||
let titile_client_name = "<?= isset($lead_data) ? $lead_data['client_name'] : '' ?>";
|
||||
|
||||
multi_file_data = <?= isset($multi_file_data) ? json_encode($multi_file_data) : '[]' ?>;
|
||||
appendMultiFileData(multi_file_data)
|
||||
RFQ_or_QCR = type;
|
||||
|
||||
var type_for_url = 1;
|
||||
@ -764,6 +822,11 @@
|
||||
allowInput: false,
|
||||
});
|
||||
|
||||
var payment_date_datePicker = flatpickr("#payment_date", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false,
|
||||
});
|
||||
|
||||
|
||||
})
|
||||
|
||||
@ -771,6 +834,13 @@
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function () {
|
||||
setInterval(function () {
|
||||
submitData(1);
|
||||
}, 15000);
|
||||
});
|
||||
|
||||
|
||||
const openDialogBtn = document.getElementById('openDialogBtn');
|
||||
const closeDialogBtn = document.getElementById('closeDialogBtn');
|
||||
|
||||
@ -797,6 +867,24 @@ var over_all_column_data = {
|
||||
'insurers': []
|
||||
}
|
||||
};
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const textarea = document.getElementById('placement_mail_content');
|
||||
const textarea2 = document.getElementById("placement_subject");
|
||||
|
||||
if (textarea) {
|
||||
let content = textarea.value;
|
||||
if (content.includes('QCR')) {
|
||||
textarea.value = content.replace(/QCR/g, 'Placement');
|
||||
}
|
||||
}
|
||||
|
||||
if (textarea2){
|
||||
let content = textarea2.value;
|
||||
if (content.includes('QCR')) {
|
||||
textarea2.value = content.replace(/QCR/g, 'Placement');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// document.addEventListener("DOMContentLoaded", function () {
|
||||
const rfqTable = document.getElementById('rfqTable');
|
||||
@ -1250,19 +1338,34 @@ function moveAddRowButton() {
|
||||
rfqTable.addEventListener('click', function(e) {
|
||||
|
||||
if (e.target.classList.contains('removeRow')) {
|
||||
const row = e.target.closest('tr'); // Get the row to be removed
|
||||
const rowKey = row.getAttribute('id');
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Do you want to remove the row?",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Yes, remove it!',
|
||||
cancelButtonText: 'Cancel'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
const row = e.target.closest('tr'); // Get the row to be removed
|
||||
const rowKey = row.getAttribute('id');
|
||||
|
||||
console.log(suggestionKeys);
|
||||
// Remove the key from suggestionKeys
|
||||
suggestionKeys = suggestionKeys.filter(key => key !== rowKey);
|
||||
row.remove();
|
||||
console.log(suggestionKeys);
|
||||
updateRowNumbers(); // Update row numbers
|
||||
moveAddRowButton(); // Move the add row button to the last row
|
||||
realignSpecialConditions();
|
||||
console.log(suggestionKeys);
|
||||
// Remove the key from suggestionKeys
|
||||
suggestionKeys = suggestionKeys.filter(key => key !== rowKey);
|
||||
row.remove();
|
||||
console.log(suggestionKeys);
|
||||
updateRowNumbers(); // Update row numbers
|
||||
moveAddRowButton(); // Move the add row button to the last row
|
||||
realignSpecialConditions();
|
||||
|
||||
isFormDataModified = true; // if any value changeing in the table to set true
|
||||
isFormDataModified = true; // if any value changeing in the table to set true
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@ -1408,7 +1511,6 @@ function showSuggestions(input) {
|
||||
|
||||
// Function to handle answers suggestion box
|
||||
function showAnswersSuggestions(input) {
|
||||
|
||||
console.log(input.parentElement.id);
|
||||
console.log(input);
|
||||
//return;
|
||||
@ -2109,7 +2211,17 @@ function removeProposal(event) {
|
||||
let rfqTable = document.getElementById('rfqTable');
|
||||
console.log(rfqTable)
|
||||
|
||||
if (confirm("Are you sure you want to remove this column?")) {
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Do you want to remove the Proposal?",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Yes, remove it!',
|
||||
cancelButtonText: 'Cancel'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
|
||||
const headerRows = rfqTable.querySelectorAll('thead tr');
|
||||
const parentTh = headerRows[0].children[colIndex];
|
||||
@ -2154,69 +2266,83 @@ function removeProposal(event) {
|
||||
console.log(`${proposal_name} does not exist.`);
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
function removeInsurer(event) {
|
||||
|
||||
if (confirm("Are you sure you want to remove this column?")) {
|
||||
// function removeSubColumnByIndex(tableId, subThIndex) {
|
||||
const table = document.getElementById('rfqTable');
|
||||
const headerRows = table.querySelectorAll('thead tr');
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Do you want to remove the insurer?",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Yes, remove it!',
|
||||
cancelButtonText: 'Cancel'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// function removeSubColumnByIndex(tableId, subThIndex) {
|
||||
const table = document.getElementById('rfqTable');
|
||||
const headerRows = table.querySelectorAll('thead tr');
|
||||
|
||||
const closestTh = event.target.closest('th');
|
||||
let insurerName = closestTh.innerText.split('⋮')[0]
|
||||
// alert(insurerName);return;
|
||||
let subThIndex = closestTh.cellIndex;
|
||||
console.log('subThIndex', subThIndex);
|
||||
const closestTh = event.target.closest('th');
|
||||
let insurerName = closestTh.innerText.split('⋮')[0]
|
||||
// alert(insurerName);return;
|
||||
let subThIndex = closestTh.cellIndex;
|
||||
console.log('subThIndex', subThIndex);
|
||||
|
||||
// Get the sub TH from the second header row
|
||||
const subTh = headerRows[1].children[subThIndex];
|
||||
console.log('subTh', subTh);
|
||||
// Get the sub TH from the second header row
|
||||
const subTh = headerRows[1].children[subThIndex];
|
||||
console.log('subTh', subTh);
|
||||
|
||||
let accumulatedColspan = 0;
|
||||
let parentTh = null;
|
||||
const firstHeaderRow = headerRows[0];
|
||||
// Find the parent TH for the specified sub TH index
|
||||
for (let i = 0; i < firstHeaderRow.children.length; i++) {
|
||||
const currentParentTh = firstHeaderRow.children[i];
|
||||
const currentColspan = parseInt(currentParentTh.getAttribute('colspan')) || 1;
|
||||
let accumulatedColspan = 0;
|
||||
let parentTh = null;
|
||||
const firstHeaderRow = headerRows[0];
|
||||
// Find the parent TH for the specified sub TH index
|
||||
for (let i = 0; i < firstHeaderRow.children.length; i++) {
|
||||
const currentParentTh = firstHeaderRow.children[i];
|
||||
const currentColspan = parseInt(currentParentTh.getAttribute('colspan')) || 1;
|
||||
|
||||
accumulatedColspan += currentColspan;
|
||||
accumulatedColspan += currentColspan;
|
||||
|
||||
if (subThIndex < accumulatedColspan) {
|
||||
parentTh = currentParentTh;
|
||||
break;
|
||||
if (subThIndex < accumulatedColspan) {
|
||||
parentTh = currentParentTh;
|
||||
break;
|
||||
}
|
||||
}
|
||||
console.log('parentth' + parentTh);
|
||||
console.log('sub col indexOf' + subThIndex);
|
||||
|
||||
|
||||
// Get the starting position of the sub TH
|
||||
const startIndex = Array.from(headerRows[1].children).indexOf(subTh);
|
||||
|
||||
// Remove the sub TH
|
||||
headerRows[1].removeChild(subTh);
|
||||
|
||||
// Reduce colspan of parent TH
|
||||
const parentColspan = parseInt(parentTh.getAttribute('colspan')) || 1;
|
||||
console.log('existing colspan' + parentColspan);
|
||||
parentTh.setAttribute('colspan', parentColspan - 1);
|
||||
console.log('new colspan' + (parentColspan - 1));
|
||||
|
||||
// Remove the corresponding TDs from each row
|
||||
table.querySelectorAll('tbody tr').forEach(row => {
|
||||
row.removeChild(row.children[startIndex]);
|
||||
});
|
||||
|
||||
removeInsurerFromPremiumTable(event, subThIndex)
|
||||
|
||||
//remove the insurer from gobal array
|
||||
let proposal_name = parentTh.innerText.split('⋮')[0];
|
||||
popInsurerInArray(proposal_name, insurerName);
|
||||
|
||||
isFormDataModified = true; // if any value changeing in the table to set true
|
||||
}
|
||||
}
|
||||
console.log('parentth' + parentTh);
|
||||
console.log('sub col indexOf' + subThIndex);
|
||||
|
||||
|
||||
// Get the starting position of the sub TH
|
||||
const startIndex = Array.from(headerRows[1].children).indexOf(subTh);
|
||||
|
||||
// Remove the sub TH
|
||||
headerRows[1].removeChild(subTh);
|
||||
|
||||
// Reduce colspan of parent TH
|
||||
const parentColspan = parseInt(parentTh.getAttribute('colspan')) || 1;
|
||||
console.log('existing colspan' + parentColspan);
|
||||
parentTh.setAttribute('colspan', parentColspan - 1);
|
||||
console.log('new colspan' + (parentColspan - 1));
|
||||
|
||||
// Remove the corresponding TDs from each row
|
||||
table.querySelectorAll('tbody tr').forEach(row => {
|
||||
row.removeChild(row.children[startIndex]);
|
||||
});
|
||||
|
||||
removeInsurerFromPremiumTable(event, subThIndex)
|
||||
|
||||
//remove the insurer from gobal array
|
||||
let proposal_name = parentTh.innerText.split('⋮')[0];
|
||||
popInsurerInArray(proposal_name, insurerName);
|
||||
|
||||
isFormDataModified = true; // if any value changeing in the table to set true
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
function showThreeDottedMenu(event) {
|
||||
@ -2706,8 +2832,8 @@ function handleChildQuestions(target) {
|
||||
let childCell = childRow.cells[currentColumnIndex];
|
||||
|
||||
if (childCell) {
|
||||
console.log('found cell');
|
||||
|
||||
console.log('found cell',inputValue);
|
||||
|
||||
if (inputValue.key == disable_at.key) {
|
||||
childCell.innerHTML = '';
|
||||
childCell.innerText = '';
|
||||
@ -2726,6 +2852,21 @@ function handleChildQuestions(target) {
|
||||
console.log(child.default_answer.display_value)
|
||||
childCell.contentEditable = false;
|
||||
} else {
|
||||
childCell.innerHTML = '';
|
||||
childCell.innerText = '';
|
||||
//hidden text box for store choosed answers object
|
||||
const hiddenInputBox = document.createElement('input');
|
||||
hiddenInputBox.type = 'hidden';
|
||||
hiddenInputBox.value = JSON.stringify(inputValue.display_value);
|
||||
|
||||
childCell.appendChild(hiddenInputBox);
|
||||
// alert(input.innerText);
|
||||
childCell.appendChild(document.createTextNode(inputValue.display_value));
|
||||
|
||||
// Set the default answer in the child cell
|
||||
// childCell.innerHTML = child.default_answer.display_value;
|
||||
// console.log('setting default value');
|
||||
// console.log(child.default_answer.display_value)
|
||||
childCell.contentEditable = true;
|
||||
}
|
||||
}
|
||||
@ -3103,7 +3244,7 @@ function ajaxRequestForGetMailData(url) {
|
||||
|
||||
function appendInput(data) {
|
||||
|
||||
console.log(data);
|
||||
console.log("append data:",data);
|
||||
var lead_id = $('#lead_id').val();
|
||||
$('#input_for_row').empty();
|
||||
let html = '';
|
||||
@ -3113,9 +3254,9 @@ function appendInput(data) {
|
||||
const url = '<?= base_url('leads/list') ?>?lead_id=' + lead_id;
|
||||
|
||||
html += `
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="contact_mail">Client Contact Mail</label>
|
||||
<input value="${data.contact_person_email || ''}" type="text" id="contact_mail" class="form-control" placeholder="Contact Mail" readonly>
|
||||
<input value="${data.contact_person_email || ''}" type="text" id="contact_mail" class="form-control" placeholder="Contact Mail">
|
||||
</div>
|
||||
`;
|
||||
|
||||
@ -3131,29 +3272,33 @@ function appendInput(data) {
|
||||
|
||||
html += `
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="client_cc">CC </label>
|
||||
<select class="form-control" id="client_cc" name="client_cc" required multiple>
|
||||
<?php if (isset($userList)) { ?>
|
||||
<?php foreach ($userList as $user) { ?>
|
||||
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
|
||||
<?php if (isset($exclusiveUserList)) { ?>
|
||||
<?php foreach ($exclusiveUserList as $user) { ?>
|
||||
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
|
||||
<option value="<?= $user['id'];?>">
|
||||
<?= $user['first_name'].' - '.$user['email'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="client_bcc">BCC </label>
|
||||
<select class="form-control" id="client_bcc" name="client_bcc" required multiple>
|
||||
<?php if (isset($userList)) { ?>
|
||||
<?php foreach ($userList as $user) { ?>
|
||||
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
|
||||
<?php if (isset($exclusiveUserList)) { ?>
|
||||
<?php foreach ($exclusiveUserList as $user) { ?>
|
||||
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
|
||||
<option value="<?= $user['id'];?>">
|
||||
<?= $user['first_name'].' - '.$user['email'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php } } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
`;
|
||||
@ -3163,7 +3308,7 @@ function appendInput(data) {
|
||||
html += `
|
||||
<div class="form-group col-md-12">
|
||||
<label for="mail_subject">Subject</label>
|
||||
<input type="text" id="mail_subject" class="form-control" value="'<?= isset($subject) ? $subject : " " ?>'" placeholder="Subject">
|
||||
<input type="text" id="mail_subject" class="form-control" value="<?= isset($subject) ? $subject : " " ?>" placeholder="Subject">
|
||||
</div>
|
||||
`;
|
||||
|
||||
@ -3196,25 +3341,28 @@ function appendInput(data) {
|
||||
<div class="form-group col-md-4">
|
||||
<label for="client_cc">CC </label>
|
||||
<select class="form-control" id="client_cc" name="client_cc" required multiple>
|
||||
<?php if (isset($userList)) { ?>
|
||||
<?php foreach ($userList as $user) { ?>
|
||||
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
|
||||
<?php if (isset($exclusiveUserList)) { ?>
|
||||
<?php foreach ($exclusiveUserList as $user) { ?>
|
||||
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
|
||||
<option value="<?= $user['id'];?>">
|
||||
<?= $user['first_name'].' - '.$user['email'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php } }?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="client_bcc">BCC </label>
|
||||
<select class="form-control" id="client_bcc" name="client_bcc" required multiple>
|
||||
<?php if (isset($userList)) { ?>
|
||||
<?php foreach ($userList as $user) { ?>
|
||||
<option value="<?= $user['id'];?>">
|
||||
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
|
||||
<?php if (isset($exclusiveUserList)) { ?>
|
||||
<?php foreach ($exclusiveUserList as $user) { ?>
|
||||
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
|
||||
<?= $user['first_name'].' - '.$user['email'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
@ -3274,7 +3422,13 @@ function appendInput(data) {
|
||||
function constructURL(url_type) {
|
||||
|
||||
if(url_type == 1){
|
||||
constructURL_ForInsurerAndClientMailSend()
|
||||
var validationStatus = checkMailValidation();
|
||||
|
||||
if (validationStatus){
|
||||
constructURL_ForInsurerAndClientMailSend();
|
||||
}else{
|
||||
toastr.error("All Client Mail ID's Should Contain Same Domain","ERROR");
|
||||
}
|
||||
}else if(url_type == 2){
|
||||
constructURL_ForInternalMailSend()
|
||||
}else if(url_type == 3){
|
||||
@ -3437,6 +3591,7 @@ function constructURL_ForInsurerAndClientMailSend() {
|
||||
var subject = $('#mail_subject').val();
|
||||
var bcc = $('#client_bcc').val();
|
||||
var cc = $('#client_cc').val();
|
||||
var contact_mail = $("#contact_mail").val();
|
||||
|
||||
console.log('lead_id', lead_id)
|
||||
console.log('subject', subject)
|
||||
@ -3452,6 +3607,11 @@ function constructURL_ForInsurerAndClientMailSend() {
|
||||
bcc = bcc.map(Number);
|
||||
bcc = JSON.stringify(bcc);
|
||||
|
||||
var selectedFiles = [];
|
||||
$('#insurer_or_clinet_mail_attachment .multi_file_attachment:checked').each(function () {
|
||||
selectedFiles.push($(this).val());
|
||||
});
|
||||
|
||||
// Prepare FormData object
|
||||
var formData = new FormData();
|
||||
formData.append('lead_id', lead_id);
|
||||
@ -3459,8 +3619,11 @@ function constructURL_ForInsurerAndClientMailSend() {
|
||||
formData.append('subject', subject);
|
||||
formData.append('cc', cc);
|
||||
formData.append('bcc', bcc);
|
||||
formData.append('selected_attachment_files', JSON.stringify(selectedFiles));
|
||||
|
||||
|
||||
if (RFQ_or_QCR == 2) {
|
||||
formData.append('contact_mail',contact_mail);
|
||||
formData.append('file_type', 'qcr');
|
||||
formData.append('recipient_type', 'client');
|
||||
formData.append('recipient_mail', '');
|
||||
@ -3493,6 +3656,11 @@ function constructURL_ForInternalMailSend() {
|
||||
// Determine file type
|
||||
var file_type = RFQ_or_QCR == 2 ? 'qcr' : 'rfq';
|
||||
|
||||
var selectedFiles = [];
|
||||
$('#internal_mail_attachment .multi_file_attachment:checked').each(function () {
|
||||
selectedFiles.push($(this).val());
|
||||
});
|
||||
|
||||
// Create FormData
|
||||
var formData = new FormData();
|
||||
formData.append('lead_id', lead_id);
|
||||
@ -3503,6 +3671,7 @@ function constructURL_ForInternalMailSend() {
|
||||
formData.append('subject', subject);
|
||||
formData.append('mail_content', mail_content);
|
||||
formData.append('recipient_mail', ''); // Empty value as per logic
|
||||
formData.append('selected_attachment_files', JSON.stringify(selectedFiles));
|
||||
|
||||
ajaxRequest(formData)
|
||||
|
||||
@ -3514,6 +3683,8 @@ function constructURL_ForPlacementMailSend() {
|
||||
var lead_id = $('#lead_id').val();
|
||||
let to = $('#placement_to').val();
|
||||
let placement_date = $('#placement_date').val();
|
||||
let payment_date = $('#payment_date').val();
|
||||
let is_cd = $("#is_cd_switch").is(":checked") ? 1 : 0;
|
||||
let utr_no = $('#utr_no').val();
|
||||
let premium_amount = $('#premium_amount').val();
|
||||
let total_amount = $('#total_amount').val();
|
||||
@ -3528,6 +3699,11 @@ function constructURL_ForPlacementMailSend() {
|
||||
to = to.split(',').map(email => email.trim());
|
||||
cc = cc.map(Number); // or split if it's a string: `cc.split(',').map(email => email.trim())`
|
||||
|
||||
var selectedFiles = [];
|
||||
$('#placement_mail_attachment .multi_file_attachment:checked').each(function () {
|
||||
selectedFiles.push($(this).val());
|
||||
});
|
||||
|
||||
// Prepare FormData
|
||||
var formData = new FormData();
|
||||
formData.append('lead_id', lead_id);
|
||||
@ -3539,11 +3715,15 @@ function constructURL_ForPlacementMailSend() {
|
||||
formData.append('proposal_insurer', proposal_insurer);
|
||||
formData.append('insurer_and_branch', insurer_and_branch);
|
||||
formData.append('placement_date', placement_date);
|
||||
formData.append('payment_date', payment_date);
|
||||
formData.append("is_cd",is_cd);
|
||||
formData.append('utr_no', utr_no);
|
||||
formData.append('premium_amount', premium_amount);
|
||||
formData.append('total_amount', total_amount);
|
||||
formData.append('cd_amount', cd_amount);
|
||||
formData.append('mail_content', mail_content);
|
||||
formData.append('selected_attachment_files', JSON.stringify(selectedFiles));
|
||||
|
||||
|
||||
ajaxRequest(formData);
|
||||
|
||||
@ -3608,7 +3788,7 @@ function ajaxRequest(formData) {
|
||||
$('#placement_cc').val('').select2({
|
||||
placeholder : 'select CC Mail'
|
||||
});
|
||||
$('#placement_subject').val('');
|
||||
// $('#placement_subject').val('');
|
||||
|
||||
$("textarea.select2-search__field").attr('rows', '1');
|
||||
$("textarea.select2-search__field").css('resize', 'none');
|
||||
@ -3685,7 +3865,7 @@ $('.close').click(function(){
|
||||
$('#placement_cc').val('').select2({
|
||||
placeholder : 'select CC Mail'
|
||||
});
|
||||
$('#placement_subject').val('');
|
||||
// $('#placement_subject').val('');
|
||||
|
||||
$("textarea.select2-search__field").attr('rows', '1');
|
||||
$("textarea.select2-search__field").css('resize', 'none');
|
||||
@ -5157,12 +5337,18 @@ function autoCaluculationForPremiumChildTable(input) {
|
||||
}
|
||||
|
||||
|
||||
function appendMultiFileData(data) {
|
||||
|
||||
console.log('appendMultiFileData function called');
|
||||
console.log(data)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
async function submitData(json) {
|
||||
async function submitData(input) {
|
||||
|
||||
console.log(over_all_column_data);
|
||||
|
||||
try {
|
||||
@ -5177,6 +5363,7 @@ function autoCaluculationForPremiumChildTable(input) {
|
||||
// Create a FormData object
|
||||
const formData = new FormData();
|
||||
let lead_id = $('#lead_id').val();
|
||||
let rfq_primaryKey = $('#rfq_primaryKey').val();
|
||||
|
||||
let submit_type = "RFQ"
|
||||
if(RFQ_or_QCR == 2){submit_type = 'QCR'}
|
||||
@ -5185,6 +5372,10 @@ function autoCaluculationForPremiumChildTable(input) {
|
||||
formData.append('lead_id', lead_id);
|
||||
formData.append('submit_type', submit_type);
|
||||
|
||||
if(input == 1){
|
||||
formData.append('rfq_primaryKey', rfq_primaryKey);
|
||||
}
|
||||
|
||||
const postUrl = '<?= base_url('rfq/create')?>';
|
||||
console.log(postUrl);
|
||||
|
||||
@ -5200,11 +5391,14 @@ function autoCaluculationForPremiumChildTable(input) {
|
||||
|
||||
if (response.status == true) {
|
||||
toastr.success(response.message, 'SUCCESS');
|
||||
$('#rfq_primaryKey').val(response.id);
|
||||
} else {
|
||||
toastr.warning(response.message, 'WARNING');
|
||||
}
|
||||
|
||||
window.location.reload();
|
||||
if(input != 1){
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('An error occurred during the AJAX request:');
|
||||
@ -5675,4 +5869,65 @@ function autoCaluculationForPremiumChildTable(input) {
|
||||
|
||||
}
|
||||
|
||||
$("#is_cd_switch").change(function (){
|
||||
var switch_status = ($("#is_cd_switch").is(":checked")? "on" : "off");
|
||||
console.log("Switch status",switch_status);
|
||||
if (switch_status == "on"){
|
||||
|
||||
$("#cd_amount").show();
|
||||
$("#total_amount").show();
|
||||
$("#cd_amount").closest('.form-group').show();
|
||||
$("#total_amount").closest('.form-group').show();
|
||||
|
||||
}else{
|
||||
|
||||
$("#cd_amount").hide();
|
||||
$("#total_amount").hide();
|
||||
$("#cd_amount").closest('.form-group').hide();
|
||||
$("#total_amount").closest('.form-group').hide();
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
$(document).on("input", "#cd_amount, #premium_amount", function() {
|
||||
|
||||
// alert("Function called");
|
||||
|
||||
var cd_amount = parseInt($("#cd_amount").val()) || 0;
|
||||
var premium_amount = parseInt($("#premium_amount").val()) || 0;
|
||||
|
||||
var total_amount = (cd_amount + premium_amount);
|
||||
$("#total_amount").val(total_amount);
|
||||
|
||||
|
||||
});
|
||||
|
||||
function checkMailValidation(){
|
||||
|
||||
emailString = $("#contact_mail").val();
|
||||
|
||||
if (RFQ_or_QCR == 1){
|
||||
if (typeof emailString !== 'string' || !emailString.includes(',')) return true;
|
||||
}else{
|
||||
if (typeof emailString !== 'string') return false;
|
||||
}
|
||||
|
||||
const invalidChars = /[;|]/;
|
||||
if (invalidChars.test(emailString)) return false;
|
||||
|
||||
|
||||
const emails = emailString.split(',').map(email => email.trim());
|
||||
|
||||
if (emails.length === 0) return false;
|
||||
|
||||
const getDomain = email => email.split('@')[1]?.toLowerCase();
|
||||
const firstDomain = getDomain(emails[0]);
|
||||
|
||||
if (!firstDomain) return false;
|
||||
|
||||
return emails.every(email => getDomain(email) === firstDomain);
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@ -309,11 +309,22 @@
|
||||
<button type="button" id="close_btn" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-row" id="input_for_row">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<h4>Attachments Files</h4>
|
||||
<hr>
|
||||
|
||||
<div class="form-group" id="insurer_or_clinet_mail_attachment">
|
||||
<div class="form-row" >
|
||||
<?php echo isset($attachment_html) && !empty($attachment_html) ? $attachment_html : ''; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<button type="submit" class="btn btn-primary" onclick="constructURL(1)">Send Mail</button>
|
||||
</div>
|
||||
@ -374,7 +385,17 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<h4>Attachments Files</h4>
|
||||
<hr>
|
||||
|
||||
<div class="form-group" id="internal_mail_attachment">
|
||||
<div class="form-row" >
|
||||
<?php echo isset($attachment_html) && !empty($attachment_html) ? $attachment_html : ''; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<button type="submit" class="btn btn-primary" onclick="constructURL(2)">Send Mail</button>
|
||||
</div>
|
||||
@ -475,6 +496,16 @@
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<h4>Attachments Files</h4>
|
||||
<hr>
|
||||
|
||||
<div class="form-group" id="placement_mail_attachment">
|
||||
<div class="form-row" >
|
||||
<?php echo isset($attachment_html) && !empty($attachment_html) ? $attachment_html : ''; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<button type="submit" class="btn btn-primary" onclick="constructURL(3)">Send Mail</button>
|
||||
</div>
|
||||
@ -3789,7 +3820,12 @@
|
||||
|
||||
tables.forEach(table => {
|
||||
if (table.id.includes("summary")) {
|
||||
table.remove(); // reMove summary table from the top
|
||||
let tableContainer = table.closest(".table-container") || table.parentElement;
|
||||
if (tableContainer) {
|
||||
tableContainer.remove(); // Remove the container, including table and collapsible bar
|
||||
} else {
|
||||
table.remove(); // Fallback to removing just the table if no container is found
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -4550,6 +4586,11 @@
|
||||
bcc = bcc.map(Number);
|
||||
bcc = JSON.stringify(bcc);
|
||||
|
||||
var selectedFiles = [];
|
||||
$('#insurer_or_clinet_mail_attachment .multi_file_attachment:checked').each(function () {
|
||||
selectedFiles.push($(this).val());
|
||||
});
|
||||
|
||||
// Prepare FormData object
|
||||
var formData = new FormData();
|
||||
formData.append('lead_id', lead_id);
|
||||
@ -4557,6 +4598,8 @@
|
||||
formData.append('subject', subject);
|
||||
formData.append('cc', cc);
|
||||
formData.append('bcc', bcc);
|
||||
formData.append('selected_attachment_files', JSON.stringify(selectedFiles));
|
||||
|
||||
|
||||
if (rfq_or_qcr == 2) {
|
||||
formData.append('file_type', 'qcr');
|
||||
@ -4591,6 +4634,12 @@
|
||||
// Determine file type
|
||||
var file_type = rfq_or_qcr == 2 ? 'qcr' : 'rfq';
|
||||
|
||||
var selectedFiles = [];
|
||||
$('#internal_mail_attachment .multi_file_attachment:checked').each(function () {
|
||||
selectedFiles.push($(this).val());
|
||||
});
|
||||
|
||||
|
||||
// Create FormData
|
||||
var formData = new FormData();
|
||||
formData.append('lead_id', lead_id);
|
||||
@ -4601,6 +4650,8 @@
|
||||
formData.append('subject', subject);
|
||||
formData.append('mail_content', mail_content);
|
||||
formData.append('recipient_mail', ''); // Empty value as per logic
|
||||
formData.append('selected_attachment_files', JSON.stringify(selectedFiles));
|
||||
|
||||
|
||||
ajaxRequest(formData)
|
||||
|
||||
@ -4626,6 +4677,13 @@
|
||||
to = to.split(',').map(email => email.trim());
|
||||
cc = cc.map(Number); // or split if it's a string: `cc.split(',').map(email => email.trim())`
|
||||
|
||||
|
||||
var selectedFiles = [];
|
||||
$('#placement_mail_attachment .multi_file_attachment:checked').each(function () {
|
||||
selectedFiles.push($(this).val());
|
||||
});
|
||||
|
||||
|
||||
// Prepare FormData
|
||||
var formData = new FormData();
|
||||
formData.append('lead_id', lead_id);
|
||||
@ -4642,11 +4700,14 @@
|
||||
formData.append('total_amount', total_amount);
|
||||
formData.append('cd_amount', cd_amount);
|
||||
formData.append('mail_content', mail_content);
|
||||
formData.append('selected_attachment_files', JSON.stringify(selectedFiles));
|
||||
|
||||
|
||||
ajaxRequest(formData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function ajaxRequest(formData) {
|
||||
|
||||
var apiURL = '<?= base_url('leads/sendMail') ?>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user