MERGE_UAT_RFQ/CLAIMS/BDS_LIVE_RELEASE
This commit is contained in:
commit
20f41478eb
@ -29,6 +29,8 @@ $routes->get("updatePolicyTermsKey", "ClientController::updatePolicyTermsKey");
|
||||
$routes->get("updateRemainderDate", "ClientController::updateRemainderDate");
|
||||
$routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
|
||||
$routes->get("sendextraparam", "ClientController::sendextraparam");
|
||||
$routes->get("updateRenewalData", "ClientController::updateRenewalData");
|
||||
$routes->get("updateRenewalDataNotExistingClient", "ClientController::updateRenewalDataNotExistingClient");
|
||||
// $routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn");
|
||||
// $routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
|
||||
// $routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
|
||||
@ -160,6 +162,7 @@ $routes->group("/employee", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("test-rack-rate", "EmployeeController::testRackRate");
|
||||
$routes->post("test-rack-rate", "EmployeeController::testRackRate");
|
||||
$routes->get('test_members_list', 'EmployeeController::test_members_list');
|
||||
$routes->post('get_emp_history','EmployeeController::getEmpHistory');
|
||||
});
|
||||
|
||||
$routes->group("/master", ["filter" => "authMVC"], function ($routes) {
|
||||
@ -386,15 +389,14 @@ $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
$routes->group("leads", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
$routes->get("list", "LeadsController::viewLeadsList");
|
||||
$routes->match(['get', 'post'],"list", "LeadsController::viewLeadsList");
|
||||
$routes->post("create", "LeadsController::createLead");
|
||||
$routes->get("list/(:any)", "LeadsController::getLeadDataForEdit/$1");
|
||||
$routes->get("sendMail", "LeadsController::sendMailWithAttachement");
|
||||
$routes->post("sendMail", "LeadsController::sendMailWithAttachement");
|
||||
$routes->get("exportQCRandRFQ/(:any)", "LeadsController::exportQCRandRFQ/$1");
|
||||
$routes->get("featchLeadDataAndInsertClient/(:any)", "LeadsController::featchLeadDataAndInsertClient/$1");
|
||||
$routes->get("featchClientPolicyFromLead/(:any)", "LeadsController::featchClientPolicyFromLead/$1");
|
||||
|
||||
$routes->get("featchClientPolicyFromLead/(:any)", "LeadsController::featchClientPolicyFromLead/$1");
|
||||
});
|
||||
|
||||
$routes->group("rfq", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
@ -17,7 +17,8 @@ class EcardDownloadConversation extends Conversation
|
||||
|
||||
protected function showEcardMenu()
|
||||
{
|
||||
$policy_list = ChatbotHelper::getListOfPolicies();
|
||||
$chat_session_info = get_chatbot_session_info();
|
||||
$policy_list = ChatbotHelper::getListOfPolicies($chat_session_info);
|
||||
$buttons = [];
|
||||
$question = 'Choose Policy to Download Ecard:';
|
||||
if(is_array($policy_list) && count($policy_list))
|
||||
@ -41,7 +42,8 @@ class EcardDownloadConversation extends Conversation
|
||||
->addButtons($buttons);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
// print_r($answer->getValue());die();
|
||||
$selectedOption = $answer->getText();
|
||||
$this->say("You have selected {$selectedOption}");
|
||||
switch ($answer->getValue()) {
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
|
||||
@ -6,54 +6,75 @@ use App\Helpers\ChatbotHelper;
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
use BotMan\Drivers\Web\WebDriver;
|
||||
|
||||
class MainMenuConversation extends Conversation
|
||||
{
|
||||
protected $buttonsData = [
|
||||
"ecard_download" => ["response_text" => "📄 Ecard Download"],
|
||||
"network_hospital" => ["response_text" => "🏥 Network Hospital"],
|
||||
"reimbursement_claim" => ["response_text" => "💰 Reimbursement Claim Process"],
|
||||
"reimbursement_status" => ["response_text" => "📑 Reimbursement Claim Status"],
|
||||
"new_policy" => ["response_text" => "🆕 New Policy"],
|
||||
"renew_policy" => ["response_text" => "🔄 Renew Policy"],
|
||||
];
|
||||
|
||||
public function run()
|
||||
{
|
||||
|
||||
$this->bot->userStorage()->delete();
|
||||
$this->bot->types(); // Typing indicator for the first message
|
||||
sleep(0.5); // Delay
|
||||
sleep(0.5); // Delay
|
||||
$this->showMainMenu();
|
||||
}
|
||||
|
||||
protected function showMainMenu()
|
||||
{
|
||||
$question = Question::create("Please choose")
|
||||
->addButtons([
|
||||
Button::create("📄 Ecard Download")->value("ecard_download"),
|
||||
Button::create("🏥 Network Hospital")->value("network_hospital"),
|
||||
Button::create("💰 Reimbursement Claim Process")->value("reimbursement_claim"),
|
||||
Button::create("📑 Reimbursement Claim Status")->value("reimbursement_status"),
|
||||
Button::create("🆕 New Policy")->value("new_policy"),
|
||||
Button::create("🔄 Renew Policy")->value("renew_policy"),
|
||||
$buttons = [];
|
||||
foreach ($this->buttonsData as $key => $data) {
|
||||
$buttons[] = Button::create($data['response_text'])->value($key);
|
||||
}
|
||||
$this->bot->userStorage()->save([
|
||||
'path' => []
|
||||
]);
|
||||
$question = Question::create("Please choose an option:")->addButtons($buttons);
|
||||
$temp = $this->buttonsData;
|
||||
$this->bot->ask($question, function ($answer) use( $temp ){
|
||||
$user_reponse = $answer->getValue();
|
||||
if (isset($temp[$user_reponse])) {
|
||||
$message = "You've chosen " . $temp[$user_reponse]['response_text'];
|
||||
// $this->bot->say($message,,WebDriver::class);
|
||||
$this->bot->reply($message);
|
||||
}
|
||||
|
||||
if (!$answer->isInteractiveMessageReply()) {
|
||||
$user_reponse = null;
|
||||
}
|
||||
// Get just the existing path array
|
||||
$path = $this->bot->userStorage()->get('path') ?? [];
|
||||
|
||||
// Add new value
|
||||
array_push($path, $answer->getValue());
|
||||
|
||||
// Save ONLY the path back
|
||||
$this->bot->userStorage()->save([
|
||||
'path' => $path
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "ecard_download":
|
||||
switch ($user_reponse) {
|
||||
|
||||
// $message = ChatbotHelper::get_payload_data();
|
||||
// $this->say($message);
|
||||
// $this->say("📄 Ecard Download Menu:");
|
||||
case "ecard_download":
|
||||
$this->bot->startConversation(new EcardDownloadConversation());
|
||||
break;
|
||||
case "network_hospital":
|
||||
$this->say("🏥 Network Hospital Menu:");log_message('error','Network Hospital clicked');
|
||||
$this->bot->startConversation(new NetworkHospitalConversation());
|
||||
break;
|
||||
case "reimbursement_claim":
|
||||
// $this->say("Reimbursement Claim Process selected. (Dummy Response)");
|
||||
$this->bot->startConversation(new ReimbursementClaimProcessConversation());
|
||||
break;
|
||||
case "reimbursement_status":
|
||||
$this->say("Reimbursement Claim Status selected. (Dummy Response)");
|
||||
$this->bot->startConversation(new ReimbursementClaimStatusConversation());
|
||||
|
||||
break;
|
||||
case "new_policy":
|
||||
$this->bot->startConversation(new policyConversation());
|
||||
break;
|
||||
case "renew_policy":
|
||||
$this->bot->startConversation(new policyConversation());
|
||||
break;
|
||||
@ -63,6 +84,7 @@ class MainMenuConversation extends Conversation
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,7 +22,8 @@ class NetworkHospitalConversation extends Conversation
|
||||
|
||||
protected function showHospitalMenu()
|
||||
{
|
||||
$policy_list = ChatbotHelper::getListOfPolicies();
|
||||
$chat_session_info = get_chatbot_session_info();
|
||||
$policy_list = ChatbotHelper::getListOfPolicies($chat_session_info);
|
||||
$buttons = [];
|
||||
$question = 'Choose Policy:';
|
||||
if(is_array($policy_list) && count($policy_list))
|
||||
@ -51,6 +52,13 @@ class NetworkHospitalConversation extends Conversation
|
||||
// });
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
array_push($path,
|
||||
$answer->getValue()
|
||||
);
|
||||
$this->bot->userStorage()->save([
|
||||
'path' => $path
|
||||
]);
|
||||
switch ($answer->getValue()) {
|
||||
case is_string($answer->getValue()) && is_array(explode('#',$answer->getValue())) && count((explode('#',$answer->getValue()))) == 2:
|
||||
|
||||
@ -73,7 +81,7 @@ class NetworkHospitalConversation extends Conversation
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->bot->startConversation(new EcardDownloadConversation());
|
||||
$this->bot->startConversation(new NetworkHospitalConversation());
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
@ -20,7 +20,8 @@ class ReimbursementClaimProcessConversation extends Conversation
|
||||
|
||||
protected function claimProcess()
|
||||
{
|
||||
$res = ChatbotHelper::sendReimbursementProcessOverMail();
|
||||
$chat_session_info = get_chatbot_session_info();
|
||||
$res = ChatbotHelper::sendReimbursementProcessOverMail($chat_session_info);
|
||||
if($res == true)
|
||||
{
|
||||
$this->say("Reimbursement process shared over your registered mail...!");
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
// namespace App\Conversations;
|
||||
namespace App\Controllers\Chatbot;
|
||||
use App\Helpers\ChatbotHelper;
|
||||
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
@ -19,29 +20,19 @@ class ReimbursementClaimStatusConversation extends Conversation
|
||||
|
||||
protected function claimStatus()
|
||||
{
|
||||
$question = Question::create("Do you Need Anything Else ?")
|
||||
->addButtons([
|
||||
Button::create("🔹 Yes I need some more Help")->value("yes"),
|
||||
Button::create("🔹 No, Thank You")->value("no"),
|
||||
// Button::create("◀️ Go Back")->value("go_back"),
|
||||
]);
|
||||
$this->say("Fetching Status please wait ...");
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "yes":
|
||||
|
||||
$this->say("Sure, How can I help you ");
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
case "no":
|
||||
$this->say("Thank you for your time! If you need anything else, feel free to reach out. Goodbye!");
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->askQuestion();
|
||||
break;
|
||||
}
|
||||
});
|
||||
$chat_session_info = get_chatbot_session_info();
|
||||
$data = ChatbotHelper::getReimbursementClaimStatus($chat_session_info);
|
||||
|
||||
$this->bot->types();
|
||||
if ($data){
|
||||
$this->say("The claim status for the claim Number {$data['claim_number']} is currently in <strong>{$data['client_status']}</strong> status. <br> More Detailed Information is sent to your mail");
|
||||
$this->bot->startConversation(new doYouWantToContinueConversation());
|
||||
}else{
|
||||
$this->say("No Claim Raised against the user.");
|
||||
$this->bot->startConversation(new doYouWantToContinueConversation());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -11,7 +11,11 @@ use App\Helpers\ChatbotHelper;
|
||||
|
||||
class commonPolicyOptionConversations extends Conversation
|
||||
{
|
||||
|
||||
protected $buttonsData = [
|
||||
"upload_vehicle_details" => ["response_text" => "🔹 Upload Vehicle Details"],
|
||||
"service_executive" => ["response_text" => "🔹 Talk to our Service Executive"],
|
||||
"go_back" => ["response_text" => "◀️ Go Back"],
|
||||
];
|
||||
|
||||
public function run()
|
||||
{
|
||||
@ -20,15 +24,36 @@ class commonPolicyOptionConversations extends Conversation
|
||||
|
||||
protected function policyOptions()
|
||||
{
|
||||
$question = Question::create("Choose Policy Type:")
|
||||
->addButtons([
|
||||
Button::create("🔹 Upload Vehicle Details")->value("upload_vehicle_details"),
|
||||
Button::create("🔹 Talk to our Service Executive")->value("service_executive"),
|
||||
Button::create("◀️ Go Back")->value("go_back"),
|
||||
]);
|
||||
$buttons = [];
|
||||
foreach ($this->buttonsData as $key => $data) {
|
||||
$buttons[] = Button::create($data['response_text'])->value($key);
|
||||
}
|
||||
// $this->bot->userStorage()->save([
|
||||
// 'path' => []
|
||||
// ]);
|
||||
$question = Question::create("Please choose an option:")->addButtons($buttons);
|
||||
$temp = $this->buttonsData;
|
||||
$this->bot->ask($question, function ($answer) use( $temp ){
|
||||
$user_reponse = $answer->getValue();
|
||||
if (isset($temp[$user_reponse])) {
|
||||
$message = "You've chosen " . $temp[$user_reponse]['response_text'];
|
||||
// $this->bot->say($message,,WebDriver::class);
|
||||
$this->bot->reply($message);
|
||||
}
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
if (!$answer->isInteractiveMessageReply()) {
|
||||
$user_reponse = null;
|
||||
}
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
array_push($path,
|
||||
$answer->getValue()
|
||||
);
|
||||
$this->bot->userStorage()->save([
|
||||
'path' => $path
|
||||
]);
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
// $this->say(json_encode($path));
|
||||
switch ($user_reponse) {
|
||||
case "upload_vehicle_details":
|
||||
// $cityName = $response->getText();
|
||||
$this->bot->startConversation(new vehicleFormConversation());
|
||||
@ -48,3 +73,5 @@ class commonPolicyOptionConversations extends Conversation
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -11,6 +11,10 @@ use App\Helpers\ChatbotHelper;
|
||||
|
||||
class doYouWantToContinueConversation extends Conversation
|
||||
{
|
||||
protected $buttonsData = [
|
||||
"yes" => ["response_text" => "🔹 Yes I need some more Help"],
|
||||
"no" => ["response_text" => "🔹 No, Thank You"]
|
||||
];
|
||||
|
||||
|
||||
public function run()
|
||||
@ -22,21 +26,56 @@ class doYouWantToContinueConversation extends Conversation
|
||||
|
||||
protected function askQuestion()
|
||||
{
|
||||
$question = Question::create("Do you Need Anything Else ?")
|
||||
->addButtons([
|
||||
Button::create("🔹 Yes I need some more Help")->value("yes"),
|
||||
Button::create("🔹 No, Thank You")->value("no"),
|
||||
// Button::create("◀️ Go Back")->value("go_back"),
|
||||
$buttons = [];
|
||||
foreach ($this->buttonsData as $key => $data) {
|
||||
$buttons[] = Button::create($data['response_text'])->value($key);
|
||||
}
|
||||
// $this->bot->userStorage()->save([
|
||||
// 'path' => []
|
||||
// ]);
|
||||
$question = Question::create("Please choose an option:")->addButtons($buttons);
|
||||
$temp = $this->buttonsData;
|
||||
$this->bot->ask($question, function ($answer) use( $temp ){
|
||||
$user_reponse = $answer->getValue();
|
||||
if (isset($temp[$user_reponse])) {
|
||||
$message = "You've chosen " . $temp[$user_reponse]['response_text'];
|
||||
// $this->bot->say($message,,WebDriver::class);
|
||||
$this->bot->reply($message);
|
||||
}
|
||||
|
||||
if (!$answer->isInteractiveMessageReply()) {
|
||||
$user_reponse = null;
|
||||
}
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
array_push($path,
|
||||
$answer->getValue()
|
||||
);
|
||||
$this->bot->userStorage()->save([
|
||||
'path' => $path
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
switch ($user_reponse) {
|
||||
case "yes":
|
||||
|
||||
// $this->say("Sure, How can I help you ");
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
case "no":
|
||||
// $user = $this->bot->getUser();
|
||||
// $userID = $user->getId();
|
||||
$dataBefore = $this->bot->userStorage()->all();
|
||||
// log_message('info','Before Deletion: ' . json_encode($dataBefore));
|
||||
|
||||
$this->bot->userStorage()->delete();
|
||||
$this->bot->userStorage()->save([]);
|
||||
|
||||
|
||||
// Cache::flush();
|
||||
|
||||
$dataAfter = $this->bot->userStorage()->all();
|
||||
// log_message('info','After Deletion: ' . json_encode($dataAfter));
|
||||
|
||||
|
||||
$this->say("Thank you for your time! If you need anything else, feel free to reach out. Goodbye!");
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -11,7 +11,11 @@ use App\Helpers\ChatbotHelper;
|
||||
|
||||
class fourWheelerOptionsConversations extends Conversation
|
||||
{
|
||||
|
||||
protected $buttonsData = [
|
||||
"comp" => ["response_text" => "🔹 Comprehensive"],
|
||||
"3p" => ["response_text" => "🔹 Third-Party Only"],
|
||||
"go_back" => ["response_text" => "◀️ Go Back"],
|
||||
];
|
||||
|
||||
public function run()
|
||||
{
|
||||
@ -20,15 +24,36 @@ class fourWheelerOptionsConversations extends Conversation
|
||||
|
||||
protected function show4WOptions()
|
||||
{
|
||||
$question = Question::create("Choose Policy Type:")
|
||||
->addButtons([
|
||||
Button::create("🔹 Comprehensive")->value("comp"),
|
||||
Button::create("🔹 Third-Party Only")->value("3p"),
|
||||
Button::create("◀️ Go Back")->value("go_back"),
|
||||
]);
|
||||
$buttons = [];
|
||||
foreach ($this->buttonsData as $key => $data) {
|
||||
$buttons[] = Button::create($data['response_text'])->value($key);
|
||||
}
|
||||
// $this->bot->userStorage()->save([
|
||||
// 'path' => []
|
||||
// ]);
|
||||
$question = Question::create("Please choose an option:")->addButtons($buttons);
|
||||
$temp = $this->buttonsData;
|
||||
$this->bot->ask($question, function ($answer) use( $temp ){
|
||||
$user_reponse = $answer->getValue();
|
||||
if (isset($temp[$user_reponse])) {
|
||||
$message = "You've chosen " . $temp[$user_reponse]['response_text'];
|
||||
// $this->bot->say($message,,WebDriver::class);
|
||||
$this->bot->reply($message);
|
||||
}
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
if (!$answer->isInteractiveMessageReply()) {
|
||||
$user_reponse = null;
|
||||
}
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
array_push($path,
|
||||
$answer->getValue()
|
||||
);
|
||||
$this->bot->userStorage()->save([
|
||||
'path' => $path
|
||||
]);
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
// $this->say(json_encode($path));
|
||||
switch ($user_reponse) {
|
||||
case "3p":
|
||||
// $cityName = $response->getText();
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
|
||||
@ -11,7 +11,11 @@ use App\Helpers\ChatbotHelper;
|
||||
|
||||
class hospitalPolicyConversation extends Conversation
|
||||
{
|
||||
|
||||
protected $buttonsData = [
|
||||
"individual" => ["response_text" => "🔹 Individual"],
|
||||
"floater" => ["response_text" => "🔹 Floater"],
|
||||
"go_back" => ["response_text" => "◀️ Go Back"],
|
||||
];
|
||||
|
||||
public function run()
|
||||
{
|
||||
@ -20,23 +24,42 @@ class hospitalPolicyConversation extends Conversation
|
||||
|
||||
protected function showMediclaimPolicyOptions()
|
||||
{
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
|
||||
if (in_array('individual',$path)){
|
||||
$text = 'Upload Policy Copy and Individual Details';
|
||||
$value = 'individual_upload';
|
||||
}else{
|
||||
$text = 'Upload Policy Copy and Family Details';
|
||||
$value = 'family_upload';
|
||||
}
|
||||
$question = Question::create("Choose Policy Type:")
|
||||
->addButtons([
|
||||
Button::create("🔹 Individual")->value("individual"),
|
||||
Button::create("🔹 Floater")->value("floater"),
|
||||
Button::create("🔹 ".$text)->value($value),
|
||||
Button::create("🔹 Talk to our Service Executive")->value("service_executive"),
|
||||
Button::create("◀️ Go Back")->value("go_back"),
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
$this->bot->ask($question, function ($answer) use ($value, $text){
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
array_push($path,
|
||||
$answer->getValue()
|
||||
);
|
||||
$this->bot->userStorage()->save([
|
||||
'path' => $path
|
||||
]);
|
||||
switch ($answer->getValue()) {
|
||||
case "individual":
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
case $value:
|
||||
$this->say("you have chosen ".$text);
|
||||
|
||||
$this->bot->startConversation(new medicalClaimFormConversations());
|
||||
break;
|
||||
case "floater":
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
case "service_executive":
|
||||
$this->say('You have chosen to speak with our Service Executive');
|
||||
$this->bot->startConversation(new serviceExecutiveConversation());
|
||||
break;
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
$this->bot->startConversation(new medicalClaimOptionConversations());
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
|
||||
317
app/Controllers/Chatbot/medicalClaimFormConversations.php
Normal file
317
app/Controllers/Chatbot/medicalClaimFormConversations.php
Normal file
@ -0,0 +1,317 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use App\Helpers\ChatbotHelper;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
|
||||
class medicalClaimFormConversations extends Conversation
|
||||
{
|
||||
private $currentMemberData = [
|
||||
'name' => null,
|
||||
'dob' => null,
|
||||
'si' => null,
|
||||
'pre_existing_disease' => null
|
||||
];
|
||||
|
||||
public function run()
|
||||
{
|
||||
// Initialize state if not exists
|
||||
if (!$this->bot->userStorage()->get('claim_form_state')) {
|
||||
$this->bot->userStorage()->save([
|
||||
'claim_form_state' => [
|
||||
'dependency_count' => 0,
|
||||
'current_member' => 'primary',
|
||||
'dependencies' => [],
|
||||
'primary_insurer' => null
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
$state = $this->bot->userStorage()->get('claim_form_state');
|
||||
$memberType = ($state['current_member'] === 'primary') ? 'primary insured person' : 'dependency';
|
||||
|
||||
$this->askName($memberType);
|
||||
}
|
||||
|
||||
private function askName($memberType)
|
||||
{
|
||||
$this->ask("Enter the Name of the $memberType?", function($answer) {
|
||||
$name = $answer->getText();
|
||||
|
||||
if (empty($name)) {
|
||||
$this->say('Name Cannot be Empty');
|
||||
return $this->run();
|
||||
}
|
||||
|
||||
// Get existing state and update only the name
|
||||
$state = $this->bot->userStorage()->get('claim_form_state');
|
||||
if ($state['current_member'] === 'primary') {
|
||||
if (!isset($state['primary_insurer'])) {
|
||||
$state['primary_insurer'] = [];
|
||||
}
|
||||
$state['primary_insurer']['name'] = $name;
|
||||
} else {
|
||||
if (!isset($state['temp_dependency'])) {
|
||||
$state['temp_dependency'] = [];
|
||||
}
|
||||
$state['temp_dependency']['name'] = $name;
|
||||
}
|
||||
|
||||
$this->bot->userStorage()->save(['claim_form_state' => $state]);
|
||||
$this->askDOB();
|
||||
});
|
||||
}
|
||||
|
||||
private function askDOB()
|
||||
{
|
||||
$this->ask('Enter Date of Birth (DD/MM/YYYY)?', function($answer) {
|
||||
$dob = $answer->getText();
|
||||
|
||||
if (empty($dob)) {
|
||||
$this->say('Date of Birth Cannot be Empty');
|
||||
return $this->askDOB();
|
||||
}
|
||||
|
||||
// Get existing state and update only the DOB
|
||||
$state = $this->bot->userStorage()->get('claim_form_state');
|
||||
if ($state['current_member'] === 'primary') {
|
||||
$state['primary_insurer']['dob'] = $dob;
|
||||
} else {
|
||||
$state['temp_dependency']['dob'] = $dob;
|
||||
}
|
||||
|
||||
$this->bot->userStorage()->save(['claim_form_state' => $state]);
|
||||
$this->askSumInsured();
|
||||
});
|
||||
}
|
||||
|
||||
private function askSumInsured()
|
||||
{
|
||||
$this->ask('Enter Sum Insured Amount?', function($answer) {
|
||||
$sum_insured = $answer->getText();
|
||||
|
||||
if (empty($sum_insured)) {
|
||||
$this->say('Sum Insured Cannot be Empty');
|
||||
return $this->askSumInsured();
|
||||
}
|
||||
|
||||
// Get existing state and update only the sum insured
|
||||
$state = $this->bot->userStorage()->get('claim_form_state');
|
||||
if ($state['current_member'] === 'primary') {
|
||||
$state['primary_insurer']['si'] = $sum_insured;
|
||||
} else {
|
||||
$state['temp_dependency']['si'] = $sum_insured;
|
||||
}
|
||||
|
||||
$this->bot->userStorage()->save(['claim_form_state' => $state]);
|
||||
$this->askPreExistingDisease();
|
||||
});
|
||||
}
|
||||
|
||||
private function askPreExistingDisease()
|
||||
{
|
||||
$this->ask('Enter Pre-Existing Disease if any (type "none" if none)?', function($answer) {
|
||||
$pre_existing_disease = $answer->getText();
|
||||
|
||||
if (empty($pre_existing_disease)) {
|
||||
$this->say('Please enter none if no pre-existing conditions');
|
||||
return $this->askPreExistingDisease();
|
||||
}
|
||||
|
||||
// Get existing state and update the disease info
|
||||
$state = $this->bot->userStorage()->get('claim_form_state');
|
||||
if ($state['current_member'] === 'primary') {
|
||||
$state['primary_insurer']['pre_existing_disease'] = $pre_existing_disease;
|
||||
$state['primary_insurer']['type'] = 'primary';
|
||||
} else {
|
||||
$state['temp_dependency']['pre_existing_disease'] = $pre_existing_disease;
|
||||
$state['temp_dependency']['type'] = 'dependency';
|
||||
|
||||
// Move completed dependency to dependencies array
|
||||
if (!isset($state['dependencies'])) {
|
||||
$state['dependencies'] = [];
|
||||
}
|
||||
$state['dependencies'][] = $state['temp_dependency'];
|
||||
$state['temp_dependency'] = null; // Clear temporary dependency
|
||||
}
|
||||
|
||||
$this->bot->userStorage()->save(['claim_form_state' => $state]);
|
||||
|
||||
// For debugging
|
||||
log_message('debug', 'Final state after all data collection: ' . json_encode($state));
|
||||
|
||||
$this->saveMemberAndContinue();
|
||||
});
|
||||
}
|
||||
|
||||
private function saveMemberAndContinue()
|
||||
{
|
||||
$state = $this->bot->userStorage()->get('claim_form_state');
|
||||
$memberData = $state['current_member'] === 'primary'
|
||||
? $state['primary_insurer']
|
||||
: end($state['dependencies']);
|
||||
|
||||
// Show current member info
|
||||
$memberInfo = "👤 **" . ucfirst($memberData['type']) . " Member Details:**\n";
|
||||
$memberInfo .= "🔹 Name: " . $memberData['name'] . "\n";
|
||||
$memberInfo .= "🔹 Date of Birth: " . $memberData['dob'] . "\n";
|
||||
$memberInfo .= "🔹 Sum Insured: " . $memberData['si'] . "\n";
|
||||
$memberInfo .= "🔹 Pre Existing Disease: " . $memberData['pre_existing_disease'] . "\n";
|
||||
|
||||
$this->say($memberInfo);
|
||||
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
|
||||
if (in_array('floater', $path)) {
|
||||
$this->askAboutDependencies();
|
||||
} else {
|
||||
$this->showSummary();
|
||||
}
|
||||
}
|
||||
|
||||
private function askAboutDependencies()
|
||||
{
|
||||
$question = Question::create("Do you want to add a dependency? ")
|
||||
->addButtons([
|
||||
Button::create("✅ Yes")->value("yes"),
|
||||
Button::create("❌ No")->value("no"),
|
||||
Button::create("◀️ Go Back")->value("go_back"),
|
||||
]);
|
||||
|
||||
$this->ask($question, function($answer) {
|
||||
$state = $this->bot->userStorage()->get('claim_form_state');
|
||||
|
||||
switch ($answer->getValue()) {
|
||||
case "yes":
|
||||
$state['dependency_count']++;
|
||||
$state['current_member'] = 'dependency';
|
||||
$this->bot->userStorage()->save(['claim_form_state' => $state]);
|
||||
|
||||
// Reset currentMemberData for new dependency
|
||||
$this->currentMemberData = [
|
||||
'name' => null,
|
||||
'dob' => null,
|
||||
'si' => null,
|
||||
'pre_existing_disease' => null
|
||||
];
|
||||
|
||||
$this->run();
|
||||
break;
|
||||
|
||||
case "no":
|
||||
$this->showSummary();
|
||||
break;
|
||||
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new hospitalPolicyConversation());
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->askAboutDependencies();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private function showSummary()
|
||||
{
|
||||
$state = $this->bot->userStorage()->get('claim_form_state');
|
||||
|
||||
$finalSummary = '<div style="font-family: Arial, sans-serif; font-size: 15px; margin: 0; padding: 2px;">';
|
||||
|
||||
// Primary Insurer
|
||||
if ($state['primary_insurer']) {
|
||||
$finalSummary .= '<div style="margin: 2px 0; padding-left: 5px;">Primary:<br>' .
|
||||
$this->formatSingleLineMemberInfo($state['primary_insurer']) .
|
||||
'</div>';
|
||||
}
|
||||
|
||||
// Dependencies
|
||||
if (!empty($state['dependencies'])) {
|
||||
foreach ($state['dependencies'] as $index => $dependency) {
|
||||
$finalSummary .= '<div style="margin: 2px 0; padding-left: 5px;">Dep ' . ($index + 1) . ':<br>' .
|
||||
$this->formatSingleLineMemberInfo($dependency) .
|
||||
'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
$finalSummary .= '</div>';
|
||||
|
||||
$this->say($finalSummary);
|
||||
|
||||
$question = Question::create("Confirm all details:")
|
||||
->addButtons([
|
||||
Button::create("✅ Confirm")->value("confirm"),
|
||||
Button::create("🔁 Start Over")->value("restart"),
|
||||
Button::create("❌ Cancel")->value('cancel')
|
||||
]);
|
||||
|
||||
$this->ask($question, function ($answer) use ($finalSummary) {
|
||||
switch ($answer->getValue()) {
|
||||
case "confirm":
|
||||
$sent_status = ChatbotHelper::sendQuotationRequestMail($finalSummary);
|
||||
if ($sent_status) {
|
||||
$this->say('Our Executive will contact you with the quotation soon.');
|
||||
$this->bot->startConversation(new doYouWantToContinueConversation());
|
||||
} else {
|
||||
$this->say("There was a problem while requesting for a quotation. Please try again later.");
|
||||
}
|
||||
break;
|
||||
case "restart":
|
||||
$this->bot->userStorage()->save([
|
||||
'claim_form_state' => [
|
||||
'dependency_count' => 0,
|
||||
'current_member' => 'primary',
|
||||
'dependencies' => [],
|
||||
'primary_insurer' => null
|
||||
]
|
||||
]);
|
||||
$this->run();
|
||||
break;
|
||||
case "cancel":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->showSummary();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private function formatSingleLineMemberInfo($member)
|
||||
{
|
||||
return '🔹 Name: ' . htmlspecialchars($member['name']) . '<br>' .
|
||||
'🔹 DOB: ' . htmlspecialchars($member['dob']) . '<br>' .
|
||||
'🔹 SI: ' . htmlspecialchars($member['si']) . '<br>' .
|
||||
'🔹 PED: ' . htmlspecialchars($member['pre_existing_disease']);
|
||||
}
|
||||
|
||||
|
||||
// private function formatMemberInfo($member)
|
||||
// {
|
||||
// // Format each piece of information with proper HTML
|
||||
// return '<div style="line-height: 1.6;">
|
||||
// <div style="margin-bottom: 5px;">
|
||||
// <span style="color: #2c3e50;">🔹 Name:</span>
|
||||
// <span style="color: #34495e; font-weight: 500;">' . htmlspecialchars($member['name']) . '</span>
|
||||
// </div>
|
||||
// <div style="margin-bottom: 5px;">
|
||||
// <span style="color: #2c3e50;">🔹 DOB:</span>
|
||||
// <span style="color: #34495e; font-weight: 500;">' . htmlspecialchars($member['dob']) . '</span>
|
||||
// </div>
|
||||
// <div style="margin-bottom: 5px;">
|
||||
// <span style="color: #2c3e50;">🔹 Sum Insured:</span>
|
||||
// <span style="color: #34495e; font-weight: 500;">' . htmlspecialchars($member['si']) . '</span>
|
||||
// </div>
|
||||
// <div style="margin-bottom: 5px;">
|
||||
// <span style="color: #2c3e50;">🔹 Pre-Existing Conditions:</span>
|
||||
// <span style="color: #34495e; font-weight: 500;">' . htmlspecialchars($member['pre_existing_disease']) . '</span>
|
||||
// </div>
|
||||
// </div>';
|
||||
// }
|
||||
}
|
||||
@ -12,6 +12,11 @@ use App\Helpers\ChatbotHelper;
|
||||
class medicalClaimOptionConversations extends Conversation
|
||||
{
|
||||
|
||||
protected $buttonsData = [
|
||||
"individual" => ["response_text" => "🔹 Individual"],
|
||||
"floater" => ["response_text" => "🔹 Floater"],
|
||||
"go_back" => ["response_text" => "◀️ Go Back"],
|
||||
];
|
||||
|
||||
public function run()
|
||||
{
|
||||
@ -20,21 +25,41 @@ class medicalClaimOptionConversations extends Conversation
|
||||
|
||||
protected function showMediclaimOptions()
|
||||
{
|
||||
$question = Question::create("Choose Policy Type:")
|
||||
->addButtons([
|
||||
Button::create("🔹 Individual")->value("individual"),
|
||||
Button::create("🔹 Floater")->value("floater"),
|
||||
Button::create("◀️ Go Back")->value("go_back"),
|
||||
$buttons = [];
|
||||
foreach ($this->buttonsData as $key => $data) {
|
||||
$buttons[] = Button::create($data['response_text'])->value($key);
|
||||
}
|
||||
// $this->bot->userStorage()->save([
|
||||
// 'path' => []
|
||||
// ]);
|
||||
$question = Question::create("Please choose an option:")->addButtons($buttons);
|
||||
$temp = $this->buttonsData;
|
||||
$this->bot->ask($question, function ($answer) use( $temp ){
|
||||
$user_reponse = $answer->getValue();
|
||||
if (isset($temp[$user_reponse])) {
|
||||
$message = "You've chosen " . $temp[$user_reponse]['response_text'];
|
||||
// $this->bot->say($message,,WebDriver::class);
|
||||
$this->bot->reply($message);
|
||||
}
|
||||
|
||||
if (!$answer->isInteractiveMessageReply()) {
|
||||
$user_reponse = null;
|
||||
}
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
array_push($path,
|
||||
$answer->getValue()
|
||||
);
|
||||
$this->bot->userStorage()->save([
|
||||
'path' => $path
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
switch ($user_reponse) {
|
||||
case "individual":
|
||||
// $cityName = $response->getText();
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
$this->bot->startConversation(new hospitalPolicyConversation());
|
||||
break;
|
||||
case "floater":
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
$this->bot->startConversation(new hospitalPolicyConversation());
|
||||
break;
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
|
||||
@ -11,6 +11,12 @@ use App\Helpers\ChatbotHelper;
|
||||
|
||||
class policyConversation extends Conversation
|
||||
{
|
||||
protected $buttonsData = [
|
||||
"2_wheeler" => ["response_text" => "🏍️ 2 Wheeler"],
|
||||
"4_wheeler" => ["response_text" => "🚗 4 Wheeler"],
|
||||
"mediclaim" => ["response_text" => "🩺 Medical Claim"],
|
||||
"go_back" => ["response_text" => "◀️ Go Back"],
|
||||
];
|
||||
|
||||
|
||||
public function run()
|
||||
@ -20,16 +26,34 @@ class policyConversation extends Conversation
|
||||
|
||||
protected function showNewPolicy()
|
||||
{
|
||||
$question = Question::create("Choose Policy Type:")
|
||||
->addButtons([
|
||||
Button::create("🏍️ 2 Wheeler")->value("2_wheeler"),
|
||||
Button::create("🚗 4 Wheeler")->value("4_wheeler"),
|
||||
Button::create("🩺 Medical Claim")->value("mediclaim"),
|
||||
Button::create("◀️ Go Back")->value("go_back"),
|
||||
]);
|
||||
$buttons = [];
|
||||
foreach ($this->buttonsData as $key => $data) {
|
||||
$buttons[] = Button::create($data['response_text'])->value($key);
|
||||
}
|
||||
// $this->bot->userStorage()->save([
|
||||
// 'path' => []
|
||||
// ]);
|
||||
$question = Question::create("Please choose an option:")->addButtons($buttons);
|
||||
$temp = $this->buttonsData;
|
||||
$this->bot->ask($question, function ($answer) use( $temp ){
|
||||
$user_reponse = $answer->getValue();
|
||||
if (isset($temp[$user_reponse])) {
|
||||
$message = "You've chosen " . $temp[$user_reponse]['response_text'];
|
||||
// $this->bot->say($message,,WebDriver::class);
|
||||
$this->bot->reply($message);
|
||||
}
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
if (!$answer->isInteractiveMessageReply()) {
|
||||
$user_reponse = null;
|
||||
}
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
array_push($path,
|
||||
$answer->getValue()
|
||||
);
|
||||
$this->bot->userStorage()->save([
|
||||
'path' => $path
|
||||
]);
|
||||
switch ($user_reponse) {
|
||||
case "2_wheeler":
|
||||
// $cityName = $response->getText();
|
||||
$this->bot->startConversation(new twoWheelerOptionsConversations());
|
||||
|
||||
93
app/Controllers/Chatbot/selectInsurerConversations.php
Normal file
93
app/Controllers/Chatbot/selectInsurerConversations.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
// namespace App\Conversations;
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
|
||||
use App\Helpers\ChatbotHelper;
|
||||
|
||||
class selectInsurerConversations extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->insurerOptions();
|
||||
}
|
||||
|
||||
protected function insurerOptions()
|
||||
{
|
||||
$question = Question::create("Choose Your Options:")
|
||||
->addButtons([
|
||||
Button::create("🔹 Select Insurers")->value("insurers"),
|
||||
Button::create("🔹 Talk to our Service Executive")->value("service_executive"),
|
||||
Button::create("◀️ Go Back")->value("go_back"),
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
array_push($path,
|
||||
$answer->getValue()
|
||||
);
|
||||
$this->bot->userStorage()->save([
|
||||
'path' => $path
|
||||
]);
|
||||
switch ($answer->getValue()) {
|
||||
case "insurers":
|
||||
$data = ChatbotHelper::getInsurersList();
|
||||
log_message("error",'data: '.json_encode($data));
|
||||
$question = Question::create("Select an Insurer:");
|
||||
$page = $this->bot->userStorage()->get('insurer_page') ?? 0;
|
||||
$perPage = 5;
|
||||
$totalPages = ceil(count($data) / $perPage);
|
||||
$insurersToShow = array_slice($data, $page * $perPage, $perPage);
|
||||
|
||||
$buttons = [];
|
||||
foreach ($insurersToShow as $insurer) {
|
||||
$buttons[] = Button::create("🔹 " . $insurer['short_name'])->value($insurer['short_name']);
|
||||
}
|
||||
|
||||
// Add pagination buttons
|
||||
if ($page > 0) {
|
||||
$buttons[] = Button::create("⬅️ Previous")->value("previous_page");
|
||||
}
|
||||
if (($page + 1) < $totalPages) {
|
||||
$buttons[] = Button::create("➡️ Next")->value("next_page");
|
||||
}
|
||||
|
||||
$question = Question::create("Choose an Insurer:")
|
||||
->addButtons($buttons);
|
||||
|
||||
$this->bot->ask($question, function ($response) {
|
||||
$selected = $response->getValue();
|
||||
|
||||
if ($selected == "previous_page") {
|
||||
$this->bot->userStorage()->save(["insurer_page" => max(0, $this->bot->userStorage()->get('insurer_page') - 1)]);
|
||||
$this->insurerOptions();
|
||||
} elseif ($selected == "next_page") {
|
||||
$this->bot->userStorage()->save(["insurer_page" => $this->bot->userStorage()->get('insurer_page') + 1]);
|
||||
$this->insurerOptions();
|
||||
} else {
|
||||
$this->say("You selected: " . $selected);
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
case "service_executive":
|
||||
$this->bot->startConversation(new serviceExecutiveConversation());
|
||||
break;
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->policyOptions();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -18,7 +18,8 @@ class serviceExecutiveConversation extends Conversation
|
||||
|
||||
protected function askServiceExecutive()
|
||||
{
|
||||
$mobile = ChatbotHelper::getPhoneNumber(); // Assuming this fetches the user's phone number
|
||||
$chat_session_info = get_chatbot_session_info();
|
||||
$mobile = ChatbotHelper::getPhoneNumber($chat_session_info); // Assuming this fetches the user's phone number
|
||||
$question = Question::create("Is this Your Mobile Number: $mobile")
|
||||
->addButtons([
|
||||
Button::create("✅ Yes")->value("yes"),
|
||||
@ -27,6 +28,13 @@ class serviceExecutiveConversation extends Conversation
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
array_push($path,
|
||||
$answer->getValue()
|
||||
);
|
||||
$this->bot->userStorage()->save([
|
||||
'path' => $path
|
||||
]);
|
||||
switch ($answer->getValue()) {
|
||||
case "yes":
|
||||
$this->say("Our executive will call you at the earliest.");
|
||||
|
||||
@ -11,6 +11,11 @@ use App\Helpers\ChatbotHelper;
|
||||
|
||||
class twoWheelerOptionsConversations extends Conversation
|
||||
{
|
||||
protected $buttonsData = [
|
||||
"3p" => ["response_text" => "🔹 Third-Party"],
|
||||
"comp" => ["response_text" => "🔹 Comprehensive"],
|
||||
"go_back" => ["response_text" => "◀️ Go Back"]
|
||||
];
|
||||
|
||||
|
||||
public function run()
|
||||
@ -20,15 +25,35 @@ class twoWheelerOptionsConversations extends Conversation
|
||||
|
||||
protected function show2WOptions()
|
||||
{
|
||||
$question = Question::create("Choose Policy Type:")
|
||||
->addButtons([
|
||||
Button::create("🔹 Third-Party")->value("3p"),
|
||||
Button::create("🔹 Comprehensive")->value("comp"),
|
||||
Button::create("◀️ Go Back")->value("go_back"),
|
||||
$buttons = [];
|
||||
foreach ($this->buttonsData as $key => $data) {
|
||||
$buttons[] = Button::create($data['response_text'])->value($key);
|
||||
}
|
||||
// $this->bot->userStorage()->save([
|
||||
// 'path' => []
|
||||
// ]);
|
||||
$question = Question::create("Please choose an option:")->addButtons($buttons);
|
||||
$temp = $this->buttonsData;
|
||||
$this->bot->ask($question, function ($answer) use( $temp ){
|
||||
$user_reponse = $answer->getValue();
|
||||
if (isset($temp[$user_reponse])) {
|
||||
$message = "You've chosen " . $temp[$user_reponse]['response_text'];
|
||||
// $this->bot->say($message,,WebDriver::class);
|
||||
$this->bot->reply($message);
|
||||
}
|
||||
|
||||
if (!$answer->isInteractiveMessageReply()) {
|
||||
$user_reponse = null;
|
||||
}
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
array_push($path,
|
||||
$answer->getValue()
|
||||
);
|
||||
$this->bot->userStorage()->save([
|
||||
'path' => $path
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
switch ($user_reponse) {
|
||||
case "3p":
|
||||
// $cityName = $response->getText();
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
|
||||
@ -2,9 +2,10 @@
|
||||
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use App\Helpers\ChatbotHelper;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
|
||||
class vehicleFormConversation extends Conversation
|
||||
{
|
||||
@ -12,10 +13,19 @@ class vehicleFormConversation extends Conversation
|
||||
protected $vehicleYOM;
|
||||
protected $vehicleEngineNo;
|
||||
protected $vehicleInvoiceNo;
|
||||
protected $userId;
|
||||
protected $complied_information;
|
||||
protected $fuelType;
|
||||
protected $seater;
|
||||
protected $chassisNumber;
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->askVehicleName();
|
||||
// Ensure $this->bot is properly initialized
|
||||
// $user = $this->bot->getUser();
|
||||
// $this->userId = $user->getId(); // Correctly store user ID
|
||||
|
||||
$this->askVehicleName(); // Start asking vehicle questions
|
||||
}
|
||||
|
||||
protected function askVehicleName()
|
||||
@ -26,6 +36,35 @@ class vehicleFormConversation extends Conversation
|
||||
$this->say('Vehicle Name Cannot be Empty');
|
||||
return $this->askVehicleName(); // Re-ask if empty
|
||||
}
|
||||
// $this->askVehicleYOM(); // Ask next question
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
|
||||
if (in_array('4_wheeler', $path)) {
|
||||
$this->askFuelType();
|
||||
} else {
|
||||
$this->askVehicleYOM(); // Ask next question
|
||||
}
|
||||
});
|
||||
}
|
||||
protected function askFuelType()
|
||||
{
|
||||
$this->ask('Enter Fuel Type of the Vehicle ?', function ($response) {
|
||||
$this->fuelType = $response->getText();
|
||||
if (empty($this->fuelType)) {
|
||||
$this->say('Vehicle Fuel Type Cannot be Empty');
|
||||
return $this->askFuelType(); // Re-ask if empty
|
||||
}
|
||||
$this->askSeating(); // Ask next question
|
||||
});
|
||||
}
|
||||
protected function askSeating()
|
||||
{
|
||||
$this->ask('Enter the seat count of the Vehicle ?', function ($response) {
|
||||
$this->seater = $response->getText();
|
||||
if (empty($this->seater)) {
|
||||
$this->say('Vehicle seat Cannot be Empty');
|
||||
return $this->askSeating(); // Re-ask if empty
|
||||
}
|
||||
$this->askVehicleYOM(); // Ask next question
|
||||
});
|
||||
}
|
||||
@ -50,6 +89,26 @@ class vehicleFormConversation extends Conversation
|
||||
$this->say('Vehicle Engine Number Cannot be Empty');
|
||||
return $this->askVehicleEngineNo(); // Re-ask if empty
|
||||
}
|
||||
|
||||
// Retrieve 'path' from storage
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
|
||||
if (in_array('4_wheeler', $path)) {
|
||||
$this->askChassisNumber();
|
||||
} else {
|
||||
$this->askVehicleInvoiceNo(); // Ask next question
|
||||
}
|
||||
// $this->askVehicleInvoiceNo();
|
||||
});
|
||||
}
|
||||
protected function askChassisNumber()
|
||||
{
|
||||
$this->ask('Enter Chassis Number of the Vehicle ?', function ($response) {
|
||||
$this->chassisNumber = $response->getText();
|
||||
if (empty($this->chassisNumber)) {
|
||||
$this->say('Vehicle Chassis Number Cannot be Empty');
|
||||
return $this->askChassisNumber(); // Re-ask if empty
|
||||
}
|
||||
$this->askVehicleInvoiceNo(); // Ask next question
|
||||
});
|
||||
}
|
||||
@ -68,16 +127,93 @@ class vehicleFormConversation extends Conversation
|
||||
|
||||
protected function storeVehicleData()
|
||||
{
|
||||
// Save all collected data to user storage
|
||||
$this->bot->userStorage()->save([
|
||||
// Retrieve 'path' from storage
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
// $this->say(json_encode($path));
|
||||
// Prepare vehicle details
|
||||
$vehicleDetails = [
|
||||
'vehicle_name' => $this->vehicleName,
|
||||
'vehicle_yom' => $this->vehicleYOM,
|
||||
'vehicle_engine_no' => $this->vehicleEngineNo,
|
||||
'vehicle_invoice_no' => $this->vehicleInvoiceNo
|
||||
]);
|
||||
$vehicleDetails['vehicle_invoice_no'] = $this->vehicleInvoiceNo
|
||||
|
||||
];
|
||||
|
||||
// Only store 'vehicle_invoice_no' if 'new_policy' is NOT in path
|
||||
if (in_array('4_wheeler', $path)) {
|
||||
$vehicleDetails['vehicle_fuelType'] = $this->fuelType;
|
||||
$vehicleDetails['vehicle_seater'] = $this->seater;
|
||||
$vehicleDetails['vehicle_chassisNo'] = $this->chassisNumber;
|
||||
}
|
||||
|
||||
// Save vehicle details
|
||||
$this->bot->userStorage()->save(['vehicle_details' => $vehicleDetails]);
|
||||
$alldata = $this->bot->userStorage()->all();
|
||||
$vehicle_details = $this->bot->userStorage()->get('vehicle_details');
|
||||
// Log stored data for debugging
|
||||
// log_message('error', 'All Details: ' . json_encode($alldata));
|
||||
|
||||
// log_message('error', 'Updated Vehicle Details: ' . json_encode($vehicle_details));
|
||||
|
||||
$this->say('Vehicle Information Saved!');
|
||||
$this->bot->startConversation(new doYouWantToContinueConversation());
|
||||
|
||||
$vehicleInfo = "🚗 **Vehicle Details:**<br>";
|
||||
$vehicleInfo .= "🔹 Name: " . $vehicle_details['vehicle_name'] . "<br>";
|
||||
$vehicleInfo .= "🔹 Year of Manufacture: " . $vehicle_details['vehicle_yom'] . "<br>";
|
||||
$vehicleInfo .= "🔹 Engine No: " . $vehicle_details['vehicle_engine_no'] . "<br>";
|
||||
|
||||
if (isset($vehicle_details['vehicle_fuelType'])) {
|
||||
$vehicleInfo .= "🔹 Fuel Type: " . $vehicle_details['vehicle_fuelType'] . "<br>";
|
||||
$vehicleInfo .= "🔹 Seater: " . $vehicle_details['vehicle_seater'] . "<br>";
|
||||
$vehicleInfo .= "🔹 Chassis Number: " . $vehicle_details['vehicle_chassisNo'] . "<br>";
|
||||
}
|
||||
$this->complied_information = $vehicleInfo;
|
||||
// Send the message with vehicle details
|
||||
$this->say($vehicleInfo);
|
||||
$this->confirmVehicleDate($vehicleInfo);
|
||||
|
||||
|
||||
// $this->bot->startConversation(new selectInsurerConversations());
|
||||
}
|
||||
|
||||
protected function confirmVehicleDate($vehicle_info){
|
||||
$question = Question::create("Confim your Details:")
|
||||
->addButtons([
|
||||
Button::create("✅ Confirm")->value("confirm"),
|
||||
Button::create("🔁 Start Over")->value("restart"),
|
||||
Button::create("❌ Cancel")->value('cancel')
|
||||
]);
|
||||
$this->bot->ask($question, function ($answer) use($vehicle_info) {
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
array_push($path,
|
||||
$answer->getValue()
|
||||
);
|
||||
$this->bot->userStorage()->save([
|
||||
'path' => $path
|
||||
]);
|
||||
switch ($answer->getValue()) {
|
||||
case "confirm":
|
||||
// $cityName = $response->getText();
|
||||
$sent_staus = ChatbotHelper::sendQuotationRequestMail($vehicle_info);
|
||||
if ($sent_staus){
|
||||
$this->say('Our Executive will contact you with the quotation soon.');
|
||||
$this->bot->startConversation(new doYouWantToContinueConversation());
|
||||
}else{
|
||||
$this->say("There was a problem while requesting for a quotation please try again later.");
|
||||
}
|
||||
break;
|
||||
case "restart":
|
||||
$this->bot->startConversation(new vehicleFormConversation());
|
||||
break;
|
||||
case "cancel":
|
||||
$this->say("Redirecting you to main menu...");
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->showHospitalMenu();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ class ChatbotControllerNew extends BaseController
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
$this->session = \Config\Services::session();
|
||||
|
||||
$this->myLogger->logme('error', 'CALLED');
|
||||
// $this->myLogger->logme('error', 'CALLED');
|
||||
|
||||
// Load BotMan driver
|
||||
DriverManager::loadDriver(WebDriver::class);
|
||||
@ -46,28 +46,59 @@ class ChatbotControllerNew extends BaseController
|
||||
$extras = json_decode($extras);
|
||||
$router = service('router');
|
||||
$method = $router->methodName();
|
||||
$this->myLogger->logme('error', $method);
|
||||
// $this->myLogger->logme('error', $method);
|
||||
|
||||
if (isset($extras) && $method == 'widget') {
|
||||
$extras = $extras->parameters;
|
||||
$this->session->set('CHATBOT_USER_ID', $extras->employee_id);
|
||||
$this->session->set('CHATBOT_EMP_ID', $extras->employee_id);
|
||||
$this->session->set('CHATBOT_ORIGIN', $extras->origin);
|
||||
$this->session->set('CHATBOT_EMP_CODE', $extras->emp_code);
|
||||
$this->session->set('CHATBOT_CLIENT_ID', $extras->client_id);
|
||||
$this->session->set('CHATBOT_CLIENT_BRANCH_ID', $extras->client_branch_id);
|
||||
if($this->session->get('CHATBOT_RANDOM_USER_ID') == '')
|
||||
{
|
||||
$this->session->set('CHATBOT_RANDOM_USER_ID', '-');
|
||||
}
|
||||
}
|
||||
$log_message = [
|
||||
'CHATBOT_EMP_ID' => $this->session->get('CHATBOT_EMP_ID'),
|
||||
'CHATBOT_ORIGIN' => $this->session->get('CHATBOT_ORIGIN'),
|
||||
'CHATBOT_EMP_CODE' => $this->session->get('CHATBOT_EMP_CODE'),
|
||||
'CHATBOT_CLIENT_ID' => $this->session->get('CHATBOT_CLIENT_ID'),
|
||||
'CHATBOT_CLIENT_BRANCH_ID' => $this->session->get('CHATBOT_CLIENT_BRANCH_ID'),
|
||||
'CHATBOT_RANDOM_USER_ID' => $this->session->get('CHATBOT_RANDOM_USER_ID')
|
||||
];
|
||||
|
||||
$this->myLogger->logme('error', $this->session->get('CHATBOT_USER_ID'));
|
||||
$log_message = implode(' | ', array_map(
|
||||
fn($key, $value) => "{$key}: {$value}",
|
||||
array_keys($log_message),
|
||||
$log_message
|
||||
));
|
||||
|
||||
$this->myLogger->logme('error', $log_message);
|
||||
|
||||
// print_rr(ChatbotHelper::getListOfPolicies());die();
|
||||
}
|
||||
|
||||
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->session->set('CHATBOT_RANDOM_USER_ID', $id);
|
||||
}
|
||||
|
||||
$this->botman->hears('.*', function ($bot) {
|
||||
|
||||
$bot->types(); // Typing indicator for the first message
|
||||
sleep(0.5); // Delay
|
||||
});
|
||||
// Start the Main Menu when user says "hi" or "start"
|
||||
$this->botman->hears('start|hi|hello', function (BotMan $bot) {
|
||||
$bot->reply('Hi how can i assit?');
|
||||
$bot->reply('Hi how can i assist?');
|
||||
$bot->startConversation(new MainMenuConversation());
|
||||
});
|
||||
|
||||
|
||||
@ -44,8 +44,11 @@ use App\Controllers\EmpDataServiceController;
|
||||
use App\Controllers\GoogleDriveController;
|
||||
|
||||
use App\Helpers\sendMailNotification;
|
||||
use App\Models\PTCOShareDetailsModel;
|
||||
use App\Models\RFQModel;
|
||||
use App\Models\TicketMasterModel;
|
||||
use SebastianBergmann\Type\NullType;
|
||||
use Kint\Kint;
|
||||
|
||||
class ClientController extends AdminController
|
||||
{
|
||||
@ -170,37 +173,42 @@ class ClientController extends AdminController
|
||||
{
|
||||
$message = '<style>body{font-family:Arial,sans-serif;color:#333;line-height:1.6;margin:0;padding:0}.email-container{width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9}.header{background-color:#4a90e2;color:#fff;padding:15px;text-align:center}.header h1{margin:0;font-size:24px}.content{padding:20px;background-color:#fff}.content h2{color:#4a90e2;font-size:20px;margin-top:0}.content p{margin:10px 0}.details-table{width:100%;border-collapse:collapse;margin-top:20px}.details-table td,.details-table th{border:1px solid #ddd;padding:10px;text-align:left}.details-table th{background-color:#f2f2f2}.footer{margin-top:20px;font-size:12px;color:#777;text-align:center}.attachment-note{margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic}</style><div class=email-container><div class=header><h1>Request for Quotation (RFQ)</h1></div><div class=content><h2>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2>RFQ Details</h2><table class=details-table><tr><th>Client name<td>{{CLIENT_NAME}}<tr><th>Coverage Type<td>{{POLICY_LONG_NAME}}<tr><th>Policy Start Date<td>{{POLICY_START_DATE}}<tr><th>Policy Duration<td>{{DURATION}}</table><div class=attachment-note>Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div class=footer><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
|
||||
|
||||
$attachments = [
|
||||
["filePath" => ROOTPATH."public/sample_excel/sample_addition.xls","fileName" => "sample_addition.xls"],
|
||||
["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"],
|
||||
["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"]
|
||||
];
|
||||
|
||||
// $attachments = [
|
||||
// ["filePath" => ROOTPATH."public/sample_excel/sample_addition.xls","fileName" => "sample_addition.xls"],
|
||||
// ["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"],
|
||||
// ["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"]
|
||||
// ];
|
||||
$attachments = [];
|
||||
$res = MailHelper::send_email(['mail' => $email, 'subject' => 'Mail Via Attachment Testing URL', 'message' => $message,'attachments' => $attachments]);
|
||||
|
||||
print_rr($res);
|
||||
echo '------------------------------------------------------------------------------------------';
|
||||
print_rr($attachments);
|
||||
// print_rr($attachments);
|
||||
}
|
||||
|
||||
//Function for Testing Member Review and Summery Confirmation Mail
|
||||
public function testingForReviewMail($client_id = 77, $emp_code = 'EMP001-K1', $mail_active = 0) //this function for only tsesting some logics not use for business logic
|
||||
public function testingForReviewMail($client_id = 77, $emp_code = 'EMP001-K1', $policy_id = "", $mail_active = 0) //this function for only tsesting some logics not use for business logic
|
||||
{
|
||||
|
||||
// dd($client_id, $emp_code, $mail_active);
|
||||
// dd($client_id, $emp_code, $policy_id, $mail_active);
|
||||
|
||||
$client_policy_ids = $this->employeeModel
|
||||
->select('employee_polices.client_policy_id')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.client_id', $client_id )
|
||||
->where('employees.emp_code', $emp_code )
|
||||
->where('employee_polices.is_active', 1 )
|
||||
->where('employees.is_active', 1 )
|
||||
->findAll();
|
||||
if(empty($policy_id)){
|
||||
|
||||
$client_policy_ids2 = array_column($client_policy_ids, 'client_policy_id');
|
||||
$client_policy_ids = $this->employeeModel
|
||||
->select('employee_polices.client_policy_id')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.client_id', $client_id )
|
||||
->where('employees.emp_code', $emp_code )
|
||||
->where('employee_polices.is_active', 1 )
|
||||
->where('employees.is_active', 1 )
|
||||
->findAll();
|
||||
|
||||
$client_policy_id = array_unique($client_policy_ids2);
|
||||
$client_policy_ids2 = array_column($client_policy_ids, 'client_policy_id');
|
||||
$client_policy_id = array_unique($client_policy_ids2);
|
||||
|
||||
}else{
|
||||
$client_policy_id = json_decode($policy_id, true);
|
||||
}
|
||||
|
||||
// echo '<pre>';
|
||||
// dd($client_policy_id);
|
||||
@ -256,7 +264,7 @@ class ClientController extends AdminController
|
||||
$wholeData =sendMailNotification::sendMailNotification('member_review_and_summary_mail', $params);
|
||||
// print_r($wholeData); die;
|
||||
|
||||
if($mail_active > 0){
|
||||
if($mail_active == 1){
|
||||
$mail_send_return = MailHelper::send_email($wholeData[0]);
|
||||
$this->myLogger->logme("info", $mail_send_return);
|
||||
}
|
||||
@ -321,19 +329,29 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
//Function for Send Member Review and Summery Confirmation Mail
|
||||
public function sendMemberReviewConfirmationMail($client_id = 77, $emp_code = 'EMP001-K1', $mail_active = 0)
|
||||
public function sendMemberReviewConfirmationMail($client_id = 77, $emp_code = 'EMP001-K1', $policy_id = "", $mail_active = 0)
|
||||
{
|
||||
$client_policy_ids = $this->employeeModel
|
||||
->select('employee_polices.client_policy_id')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.client_id', $client_id)
|
||||
->where('employees.emp_code', $emp_code)
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('employees.is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$client_policy_ids2 = array_column($client_policy_ids, 'client_policy_id');
|
||||
$client_policy_id = array_unique($client_policy_ids2);
|
||||
// dd($client_id, $emp_code, $policy_id, $mail_active);
|
||||
|
||||
if(empty($policy_id)){
|
||||
|
||||
$client_policy_ids = $this->employeeModel
|
||||
->select('employee_polices.client_policy_id')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.client_id', $client_id )
|
||||
->where('employees.emp_code', $emp_code )
|
||||
->where('employee_polices.is_active', 1 )
|
||||
->where('employees.is_active', 1 )
|
||||
->findAll();
|
||||
|
||||
$client_policy_ids2 = array_column($client_policy_ids, 'client_policy_id');
|
||||
$client_policy_id = array_unique($client_policy_ids2);
|
||||
|
||||
}else{
|
||||
$client_policy_id = json_decode($policy_id, true);
|
||||
}
|
||||
|
||||
// dd($client_policy_id);
|
||||
|
||||
if (!is_null($client_policy_id) && is_array($client_policy_id)) {
|
||||
|
||||
@ -393,8 +411,9 @@ class ClientController extends AdminController
|
||||
|
||||
$wholeData = sendMailNotification::sendMailNotification('member_review_and_summary_mail', $params);
|
||||
|
||||
if ($mail_active > 0) {
|
||||
if ($mail_active == 0) {
|
||||
|
||||
// $mail_send_result = [];
|
||||
$mail_send_result = MailHelper::send_email($wholeData[0]);
|
||||
|
||||
if ($mail_send_result['status'] === 'success') {
|
||||
@ -641,7 +660,7 @@ class ClientController extends AdminController
|
||||
$data['clientData'] = $this->clientPolicyModel->getClientById($clientId);
|
||||
$data['deposiamount'] = $this->clientPolicyModel->getDepositSummary($clientId, $insurerId);
|
||||
|
||||
// dd($data['insurerName']);
|
||||
// dd($data);
|
||||
|
||||
// print_r($data['depositdata'] );die;
|
||||
// Load the view for the new list page;
|
||||
@ -657,25 +676,31 @@ class ClientController extends AdminController
|
||||
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$insurer_id = $this->request->getPost('insurer_id');
|
||||
$record_date = $this->request->getPost('record_date');
|
||||
|
||||
$CD_Account_Number = $this->CDMasterModel
|
||||
->where('client_id', $client_id)
|
||||
->where('insurer_id', $insurer_id)
|
||||
->first();
|
||||
|
||||
// Prepare the array with data
|
||||
$date = \DateTime::createFromFormat('d/m/Y', $record_date);
|
||||
$record_date = $date->format('Y-m-d');
|
||||
$data = [
|
||||
'amount' => $this->request->getPost('amount'),
|
||||
'sub_type_id' => $this->request->getPost('sub_type_id'),
|
||||
'client_id' => $this->request->getPost('client_id'),
|
||||
'client_policy_id' => null,
|
||||
'cd_ac_no' => $CD_Account_Number['cd_ac_no'] ?? null,
|
||||
'cd_ac_pk' => $CD_Account_Number['id'] ?? null,
|
||||
'endorsement_no' => null,
|
||||
'insurer_id' => $this->request->getPost('insurer_id'),
|
||||
'description' => $this->request->getPost('description'),
|
||||
'transaction_type' => $this->request->getPost('transaction_type') ?: 'Credit',
|
||||
'updated_by' => 1,
|
||||
'record_date' => $record_date
|
||||
];
|
||||
// log_message('error','data for insert'.json_encode($data));die();
|
||||
// print_rr($data);die();
|
||||
|
||||
|
||||
// Call the saveDeposit function from DepositHelper
|
||||
@ -1979,6 +2004,13 @@ class ClientController extends AdminController
|
||||
->findAll();
|
||||
$client_policy_list = $this->clientPolicyModel->getPolicyTypeForPolicyBinding($client_id);
|
||||
$cd_data = $this->CDMasterModel->where('client_id', $client_id)->where('insurer_id', $insurer_id)->findAll();
|
||||
$client_policy_data['policy_end_date'] = date('d/m/Y', strtotime($client_policy_data['policy_end_date']));
|
||||
$fromDate = $client_policy_data['policy_end_date'];
|
||||
$date = \DateTime::createFromFormat('d/m/Y', $fromDate);
|
||||
$date->modify('+1 year');
|
||||
$newDate = $date->format('d/m/Y');
|
||||
|
||||
// print_rr($client_policy_data['policy_end_date']);die();
|
||||
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
@ -1987,7 +2019,8 @@ class ClientController extends AdminController
|
||||
'cd_data' => $cd_data,
|
||||
"insurer_id" => $client_policy_data['insurer_id'],
|
||||
'policy' => $polices,
|
||||
'client_policy_list' => $client_policy_list
|
||||
'client_policy_list' => $client_policy_list,
|
||||
'end_date' => $newDate
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
||||
@ -3806,6 +3839,8 @@ class ClientController extends AdminController
|
||||
continue;
|
||||
}
|
||||
|
||||
// dd($policyTerms);
|
||||
|
||||
$is_addon = $data[$i]['is_addon'];
|
||||
|
||||
$payable_arr = [];
|
||||
@ -3828,7 +3863,7 @@ class ClientController extends AdminController
|
||||
if(in_array($data[$i]['policy_type_id'], [2,3,4,5])){
|
||||
|
||||
// Set default value of copayzonewisecopay to "empty"
|
||||
$ans = isset($policyTerms['copayzonewisecopay']) ? $policyTerms['copayzonewisecopay'] : 'empty';
|
||||
// $ans = isset($policyTerms['copayzonewisecopay']) ? $policyTerms['copayzonewisecopay'] : 'empty';
|
||||
|
||||
// add is_payable_employee for the GMC Policy
|
||||
if (isset($policyTerms['age_ratio'])) {
|
||||
@ -3842,31 +3877,31 @@ class ClientController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
// Add copayzonewisecopay and copayzonewisecopaydata if they exist_
|
||||
if (isset($policyTerms['copayzonewisecopay'])) {
|
||||
// // Add copayzonewisecopay and copayzonewisecopaydata if they exist_
|
||||
// if (isset($policyTerms['copayzonewisecopay'])) {
|
||||
|
||||
if(!isset($policyTerms['co_pay_details'])){
|
||||
// if(!isset($policyTerms['co_pay_details'])){
|
||||
|
||||
$co_pay_details_value = "";
|
||||
if (strtolower($ans) == "nil" || $ans == 0) {
|
||||
$policyTerms['copayzonewisecopay'] = 0;
|
||||
$co_pay_details_value = "";
|
||||
} elseif ($ans != 'empty' && $ans !== 'Nil' && $ans !== null && $ans != '' && $ans != 0) {
|
||||
$policyTerms['copayzonewisecopay'] = 1;
|
||||
$co_pay_details_value = $ans;
|
||||
}
|
||||
// $co_pay_details_value = "";
|
||||
// if (strtolower($ans) == "nil" || $ans == 0) {
|
||||
// $policyTerms['copayzonewisecopay'] = 0;
|
||||
// $co_pay_details_value = "";
|
||||
// } elseif ($ans != 'empty' && $ans !== 'Nil' && $ans !== null && $ans != '' && $ans != 0) {
|
||||
// $policyTerms['copayzonewisecopay'] = 1;
|
||||
// $co_pay_details_value = $ans;
|
||||
// }
|
||||
|
||||
$co_pay_index = array_search('copayzonewisecopay', array_keys($policyTerms));
|
||||
$orderedPolicyTerms[] = [
|
||||
"key" => "co_pay_details",
|
||||
"value" => $co_pay_details_value,
|
||||
"position" => $co_pay_index + 2,
|
||||
];
|
||||
// $co_pay_index = array_search('copayzonewisecopay', array_keys($policyTerms));
|
||||
// $orderedPolicyTerms[] = [
|
||||
// "key" => "co_pay_details",
|
||||
// "value" => $co_pay_details_value,
|
||||
// "position" => $co_pay_index + 2,
|
||||
// ];
|
||||
|
||||
unset($policyTerms['optionalparentalcopay']);
|
||||
// unset($policyTerms['optionalparentalcopay']);
|
||||
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
|
||||
// Add ailmentcapping and ailmentcappingdata if they exist
|
||||
if (isset($policyTerms['ailmentcapping'])) {
|
||||
@ -3875,7 +3910,7 @@ class ClientController extends AdminController
|
||||
$orderedPolicyTerms[] = [
|
||||
"key" => "ailment_capping_details",
|
||||
"value" => "",
|
||||
"position" => $aliment_index + 3,
|
||||
"position" => $aliment_index + 2,
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -3909,8 +3944,6 @@ class ClientController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach ($orderedPolicyTerms as $term) {
|
||||
$position = $term['position'];
|
||||
$key = $term['key'];
|
||||
@ -3922,8 +3955,117 @@ class ClientController extends AdminController
|
||||
);
|
||||
}
|
||||
|
||||
if(in_array($data[$i]['policy_type_id'], [2,3,4,5])){
|
||||
|
||||
if (!isset($policyTerms['waiver_of_90_days_waiting_period'])) {
|
||||
$policyTerms['waiver_of_90_days_waiting_period'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['waiver_of_other_waiting_periods'])) {
|
||||
$policyTerms['waiver_of_other_waiting_periods'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['maternity_benefit'])) {
|
||||
$policyTerms['maternity_benefit'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['well_baby_well_mother_expenses'])) {
|
||||
$policyTerms['well_baby_well_mother_expenses'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['icu_limit'])) {
|
||||
$policyTerms['icu_limit'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['infertility_treatment_coverage'])) {
|
||||
$policyTerms['infertility_treatment_coverage'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['mid_term_addition_of_new_born_newly_wedded_spouse'])) {
|
||||
$policyTerms['mid_term_addition_of_new_born_newly_wedded_spouse'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['non_admissible_contingency_corporate_buffer'])) {
|
||||
$policyTerms['non_admissible_contingency_corporate_buffer'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['terrorism'])) {
|
||||
$policyTerms['terrorism'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['widower_cover'])) {
|
||||
$policyTerms['widower_cover'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['breavement_cover'])) {
|
||||
$policyTerms['breavement_cover'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['enrollment_display_key'])) {
|
||||
$policyTerms['enrollment_display_key'] = [];
|
||||
}
|
||||
|
||||
} else if($data[$i]['policy_type_id'] == 1){
|
||||
|
||||
if (!isset($policyTerms['medical_expenses_medical_extension'])) {
|
||||
$policyTerms['medical_expenses_medical_extension'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['opd_treatment_cover'])) {
|
||||
$policyTerms['opd_treatment_cover'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['repatriation_of_mortal_remains'])) {
|
||||
$policyTerms['repatriation_of_mortal_remains'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['family_transportation_benefits'])) {
|
||||
$policyTerms['family_transportation_benefits'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['fractures_dislocation_burns'])) {
|
||||
$policyTerms['fractures_dislocation_burns'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['coma'])) {
|
||||
$policyTerms['coma'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['travel_expenses_for_medical_treatment'])) {
|
||||
$policyTerms['travel_expenses_for_medical_treatment'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['daily_cash_allowance'])) {
|
||||
$policyTerms['daily_cash_allowance'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['artifical_limb_and_prosthesis'])) {
|
||||
$policyTerms['artifical_limb_and_prosthesis'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['air_ambulance'])) {
|
||||
$policyTerms['air_ambulance'] = "";
|
||||
}
|
||||
|
||||
if (!isset($policyTerms['enrollment_display_key'])) {
|
||||
$policyTerms['enrollment_display_key'] = [];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach ($policyTerms as $key => $term) {
|
||||
if ($term == "0") {
|
||||
$policyTerms[$key] = "No"; // Use = for assignment
|
||||
} elseif ($term == "1") {
|
||||
$policyTerms[$key] = "Yes"; // Use = for assignment
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// dd($policyTerms);
|
||||
// Re-encode the ordered policy terms
|
||||
$updatedPolicyTerms = json_encode($policyTerms);
|
||||
// dd($updatedPolicyTerms);
|
||||
|
||||
// dd($orderedPolicyTerms, $updatedPolicyTerms);
|
||||
$this->clientPolicyModel->update($data[$i]['id'], ['policy_terms' => $updatedPolicyTerms]);
|
||||
@ -3956,12 +4098,17 @@ class ClientController extends AdminController
|
||||
|
||||
public function sendextraparam()
|
||||
{
|
||||
|
||||
// $employeeController = new EmployeeController();
|
||||
// $employeeController->truncateFileData('633');
|
||||
|
||||
// ---------- EMP SERVICE CONTROLLER --------------------------------------------------------------------------------
|
||||
|
||||
$employeeRestController = new EmployeeServiceController();
|
||||
// $employeeRestController->excelFileDataValidation(['file_id' => 823]);
|
||||
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 823]);
|
||||
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 644]);
|
||||
// $employeeRestController->employeesOnboardProcess(['file_id' => 835]);
|
||||
// $employeeRestController->employeesEnrollmentInsert(['file_id' => 836]);
|
||||
// $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]);
|
||||
|
||||
|
||||
@ -4321,4 +4468,458 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// private function preparePolicyData($renewalData)
|
||||
// {
|
||||
// $data = [
|
||||
// 'issuer' => $renewalData['issuer_type_id'],
|
||||
// 'client_id' => $renewalData['client_id'],
|
||||
// 'client_branch_id' => $renewalData['branch_id'] ?? null,
|
||||
// 'vehicle_id' => $renewalData['vehicle_id'],
|
||||
// 'insurer_id' => $renewalData['insurer_id'],
|
||||
// 'insurer_branch_id' => $renewalData['insurer_branch_id'],
|
||||
// 'policy_type_id' => $renewalData['policy_type_id'],
|
||||
// 'client_policy_id' => $renewalData['client_policy_id'] ?? null,
|
||||
// 'policy_no' => $renewalData['policy_no'],
|
||||
// 'policy_issue_date' => $renewalData['date_date_of_issue'],
|
||||
// 'policy_start_date' => $renewalData['date_policy_start_date'],
|
||||
// 'policy_end_date' => $renewalData['date_policy_end_date'],
|
||||
// 'policy_holder_name' => $renewalData['insured'],
|
||||
// 'status' => 'completed',
|
||||
// 'is_active' => 1,
|
||||
// 'tsi' => '500000',
|
||||
// 'month' => '2025-02-01',
|
||||
// 'ct_type' => 1,
|
||||
// 'cd_ac_pk' => $renewalData['cd_ac_pk'] ?? null,
|
||||
// ];
|
||||
|
||||
// $policyTransactionModel = new PolicyTransactionModel();
|
||||
// return $policyTransactionModel->insert($data);
|
||||
// }
|
||||
|
||||
// private function prepareVehicleData($renewalData)
|
||||
// {
|
||||
// $vehicleData = [
|
||||
// 'vehicle_no' => $renewalData['veh_no'],
|
||||
// 'owner' => $renewalData['client_id'],
|
||||
// 'branch_id' => ($renewalData['client_type_id'] == 1) ? $renewalData['branch_id'] : null,
|
||||
// ];
|
||||
|
||||
// $vehicleModel = new VehicleModel();
|
||||
// return $vehicleModel->insert($vehicleData);
|
||||
// }
|
||||
|
||||
// private function preparePtCoShareDetails($renewalData)
|
||||
// {
|
||||
// $ptCoShareDetails = [
|
||||
// 'pt_id' => $renewalData['pt_id'],
|
||||
// 'insurer_id' => $renewalData['insurer_id'],
|
||||
// 'insurer_branch_id' => $renewalData['insurer_branch_id'],
|
||||
// 'co_share_type' => 0,
|
||||
// 'co_share_per' => 0.00,
|
||||
// 'bp_amt' => 0.00,
|
||||
// 'tp_amt' => 0.00,
|
||||
// 'tep_amt' => 0.00,
|
||||
// 'follower_policy_no' => $renewalData['policy_no'],
|
||||
// ];
|
||||
|
||||
// $ptCoShareDetailsModel = new PTCOShareDetailsModel();
|
||||
// return $ptCoShareDetailsModel->insert($ptCoShareDetails);
|
||||
// }
|
||||
|
||||
// private function prepareClientPolicy($renewalData)
|
||||
// {
|
||||
// $clientPolicy = [
|
||||
// 'client_id' => $renewalData['client_id'],
|
||||
// 'client_branch_id' => $renewalData['branch_id'],
|
||||
// 'policy_type_id' => $renewalData['policy_type_id'],
|
||||
// 'insurer_id' => $renewalData['insurer_id'],
|
||||
// 'insurer_branch_id' => $renewalData['insurer_branch_id'],
|
||||
// 'policy_no' => $renewalData['policy_no'],
|
||||
// 'policy_start_date' => $renewalData['date_policy_start_date'],
|
||||
// 'policy_end_date' => $renewalData['date_policy_end_date'],
|
||||
// 'policy_status' => 1,
|
||||
// 'gst' => 18.00,
|
||||
// 'cd_ac_pk' => $renewalData['cd_ac_pk'],
|
||||
// ];
|
||||
|
||||
// $clientPolicyModel = new ClientPolicyModel();
|
||||
// return $clientPolicyModel->insert($clientPolicy);
|
||||
// }
|
||||
|
||||
public function updateRenewalData()
|
||||
{
|
||||
$db = db_connect();
|
||||
$renewalData = $db->table('old_renewal_data_copy')
|
||||
->where('client_id IS NOT NULL')
|
||||
->where('is_inserted != 1')
|
||||
->get()
|
||||
->getResultArray();
|
||||
// dd($renewalData);
|
||||
|
||||
$successData = [];
|
||||
foreach ($renewalData as $key => $value) {
|
||||
// Get branch_id properly
|
||||
$branch = $this->clientBranchModel->where('client_id', $value['client_id'] ?? 0)->first();
|
||||
// kint::dump($branch);
|
||||
$value['branch_id'] = $branch['id'] ?? null;
|
||||
|
||||
// Fix vehicle_id key (previously "vehicel_id")
|
||||
$value['vehicle_id'] = null;
|
||||
if ($value['policy_type_id'] == 8 && !empty($value['policy_type_id'])) {
|
||||
$value['vehicle_id'] = $this->prepareVehicleData($value);
|
||||
}
|
||||
|
||||
// Process client policy, policy transaction, and co-share details
|
||||
$value['client_policy_id'] = $this->prepareClientPolicy($value);
|
||||
$value['pt_id'] = $this->preparePolicyData($value);
|
||||
$value['pt_co_id'] = $this->preparePtCoShareDetails($value);
|
||||
|
||||
// Update is_inserted field in DB
|
||||
$db->table('old_renewal_data_copy')
|
||||
->where('id', $value['id'])
|
||||
->set(['is_inserted' => 1])
|
||||
->update();
|
||||
|
||||
$successData[] = ['id' => $value['id'], 'client' => $value['insured']];
|
||||
}
|
||||
|
||||
kint::dump($successData);
|
||||
}
|
||||
|
||||
public function updateRenewalDataNotExistingClient()
|
||||
{
|
||||
$limit = $this->request->getGet('limit') ?? 10;
|
||||
$group = $this->request->getGet('group') ?? 2;
|
||||
$db = db_connect();
|
||||
$renewalData = $db->table('old_renewal_data_copy')
|
||||
->where('client_id IS NULL')
|
||||
->where('is_inserted = 0')
|
||||
->where('client_type_id', $group)
|
||||
// ->limit($limit)
|
||||
->get()
|
||||
->getResultArray();
|
||||
// dd($renewalData);
|
||||
|
||||
$successData = [];
|
||||
foreach ($renewalData as $key => $value) {
|
||||
|
||||
$client_data = $this->clientModel->where('client_name', $value['insured'])->where('is_active', 1)->first();
|
||||
if(!empty($client_data)){
|
||||
$branch = $this->clientBranchModel->where('client_id', $client_data['id'] ?? 0)->first();
|
||||
$value['branch_id'] = $branch['id'] ?? null;
|
||||
$value['client_id'] = $client_data['id'] ?? null;
|
||||
}else{
|
||||
$value['client_id'] = $this->prepareClient($value);
|
||||
if($value['client_type_id'] == 1){
|
||||
$value['branch_id'] = $this->prepareClientBranch($value);
|
||||
}
|
||||
}
|
||||
|
||||
// Fix vehicle_id key (previously "vehicel_id")
|
||||
if ($value['policy_type_id'] == 8 && !empty($value['policy_type_id'])) {
|
||||
$value['vehicle_id'] = $this->prepareVehicleData($value);
|
||||
}else{
|
||||
$value['vehicle_id'] = 0;
|
||||
}
|
||||
|
||||
// Process client policy, policy transaction, and co-share details
|
||||
$value['client_policy_id'] = $this->prepareClientPolicy($value);
|
||||
$value['pt_id'] = $this->preparePolicyData($value);
|
||||
$value['pt_co_id'] = $this->preparePtCoShareDetails($value);
|
||||
|
||||
// Update is_inserted field in DB
|
||||
$db->table('old_renewal_data_copy')
|
||||
->where('id', $value['id'])
|
||||
->set(['is_inserted' => 1])
|
||||
->update();
|
||||
|
||||
$successData[] = ['id' => $value['id'], 'client' => $value['insured'], 'vehicle_id' => $value['vehicle_id']];
|
||||
}
|
||||
|
||||
kint::dump($successData);
|
||||
}
|
||||
|
||||
private function preparePolicyData($renewalData)
|
||||
{
|
||||
$data = [
|
||||
'issuer' => $renewalData['issuer_type_id'] ?? null,
|
||||
'client_id' => $renewalData['client_id'] ?? null,
|
||||
'client_branch_id' => $renewalData['branch_id'] ?? 0,
|
||||
'vehicle_id' => $renewalData['vehicle_id'] ?? null,
|
||||
'insurer_id' => $renewalData['insurer_id'] ?? null,
|
||||
'insurer_branch_id' => $renewalData['insurer_branch_id'],
|
||||
'tpa_id' => null,
|
||||
'tpa_branch_id' => null,
|
||||
'policy_type_id' => $renewalData['policy_type_id'] ?? null,
|
||||
'client_policy_id' => $renewalData['client_policy_id'] ?? null,
|
||||
'issue_type' => 1,
|
||||
'source_client_policy_id' => null,
|
||||
'policy_no' => $renewalData['policy_no'] ?? null,
|
||||
'cd_ac_no' => null,
|
||||
'policy_issue_date' => $renewalData['date_date_of_issue'],
|
||||
'policy_start_date' => $renewalData['date_policy_start_date'],
|
||||
'policy_end_date' => $renewalData['date_policy_end_date'],
|
||||
'action_type' => 'inception',
|
||||
'endorsement_no' => null,
|
||||
'data_received_date' => null,
|
||||
'closure_date' => null,
|
||||
'emp_count' => null,
|
||||
'dependent_count' => null,
|
||||
'revenue_type' => $renewalData['revenue_type'] ?? null,
|
||||
'co_share' => 0,
|
||||
'pre_payable_by' => 1,
|
||||
'bro_payable_by' => 1,
|
||||
'tsi' => '500000',
|
||||
'status' => 'completed',
|
||||
'ct_status' => 0,
|
||||
'is_active' => 1,
|
||||
'co_broking_status' => null,
|
||||
'installment' => 0,
|
||||
'installment_data' => null,
|
||||
'location' => null,
|
||||
'links' => null,
|
||||
'stage' => null,
|
||||
'etat' => null,
|
||||
'etat_band' => null,
|
||||
'edate' => null,
|
||||
'renewal_date' => null,
|
||||
'rollover_date' => null,
|
||||
'policy_holder_name' => $renewalData['insured'],
|
||||
'same_as_proposer' => 1, // 1 - Yes, 0 - No
|
||||
'ref' => $renewalData['ref'],
|
||||
'spl' => null,
|
||||
'fund_received' => null,
|
||||
'listed_insurers' => null,
|
||||
'ppteam' => null,
|
||||
'endorse_eff_date' => null,
|
||||
'month' => '2025-02-01',
|
||||
'sales_generated_by' => null,
|
||||
'serviced_by' => null,
|
||||
'ct_type' => 1,
|
||||
'ct_tran_id' => null,
|
||||
'remarks' => null,
|
||||
'cd_ac_pk' => $renewalData['cd_ac_pk'] ?? null,
|
||||
'install_due_date' => null,
|
||||
'policy_with_corr' => 0
|
||||
];
|
||||
|
||||
// kint::dump($data);
|
||||
// dd($data);
|
||||
$policyTransactionModel = new PolicyTransactionModel();
|
||||
$id = $policyTransactionModel->insert($data);
|
||||
return $id;
|
||||
}
|
||||
|
||||
private function prepareVehicleData($renewalData)
|
||||
{
|
||||
$VehicleModel = new VehicleModel();
|
||||
|
||||
if ($renewalData['client_type_id'] == 1) {
|
||||
$veh_no = explode(" ", $renewalData['insured'])[0] . "_veh_no";
|
||||
} else {
|
||||
$veh_no = $renewalData['insured'] . "_veh_no";
|
||||
}
|
||||
|
||||
$vehicleData = $VehicleModel->where('owner', $renewalData['client_id'])
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
if (!empty($vehicleData)) {
|
||||
$increment = count($vehicleData);
|
||||
$veh_no = $increment . "_" . $veh_no;
|
||||
}
|
||||
|
||||
|
||||
$vehicleData = [
|
||||
'vehicle_no' => $veh_no,
|
||||
'type' => null,
|
||||
'description' => null,
|
||||
'owner' => $renewalData['client_id'], // client_id
|
||||
'branch_id' => $renewalData['client_type_id'] == 1 ? $renewalData['branch_id'] : 0, // client_branch_id
|
||||
'old_owner' => null,
|
||||
'rc' => null,
|
||||
];
|
||||
|
||||
// dd($vehicleData);
|
||||
$id = $VehicleModel->insert($vehicleData);
|
||||
return $id;
|
||||
}
|
||||
|
||||
private function preparePtCoShareDetails($renewalData)
|
||||
{
|
||||
$pt_co_share_details = [
|
||||
|
||||
'pt_id' => $renewalData['pt_id'],
|
||||
'insurer_id' => $renewalData['insurer_id'],
|
||||
'insurer_branch_id' => $renewalData['insurer_branch_id'],
|
||||
'co_share_type' => 0,
|
||||
'co_share_per' => 0.00,
|
||||
'bp_amt' => 0.00,
|
||||
'bp_gst_amt' => 0.00,
|
||||
'bp_igst' => 0,
|
||||
'bp_sgst' => 0,
|
||||
'bp_cgst' => 0,
|
||||
'tp_amt' => 0.00,
|
||||
'tp_gst_amt' => 0.00,
|
||||
'tp_igst' => 0.00,
|
||||
'tp_sgst' => 0.00,
|
||||
'tp_cgst' => 0.00,
|
||||
'tep_amt' => 0.00,
|
||||
'tep_gst_amt' => 0.00,
|
||||
'tep_igst' => 0.00,
|
||||
'tep_sgst' => 0.00,
|
||||
'tep_cgst' => 0.00,
|
||||
'agreed_amt' => 0.00,
|
||||
'agreed_bp_per' => 0.00,
|
||||
'agreed_tp_per' => 0.00,
|
||||
'agreed_tep_per' => 0.00,
|
||||
'standerd_bp_per' => 0.00,
|
||||
'standerd_tp_per' => 0.00,
|
||||
'standerd_tep_per' => 0.00,
|
||||
'actual_bp_amt' => 0.00,
|
||||
'actual_tp_amt' => 0.00,
|
||||
'actual_tep_amt' => 0.00,
|
||||
'actual_bp_per' => 0.00,
|
||||
'actual_tp_per' => 0.00,
|
||||
'actual_tep_per' => 0.00,
|
||||
'actual_bp_brokerage_amt' => 0.00,
|
||||
'actual_tp_brokerage_amt' => 0.00,
|
||||
'actual_tep_brokerage_amt' => 0.00,
|
||||
'reward' => 0.00,
|
||||
'exp_amt' => 0.00,
|
||||
'variance' => 0.00,
|
||||
'remark' => null,
|
||||
'cd_ac_no' => null,
|
||||
'amount' => 0.00,
|
||||
'stamp_duty' => 0.00,
|
||||
'gst_type' => 0,
|
||||
'cop_amt' => 0.00,
|
||||
'statement_id' => 0,
|
||||
'follower_policy_no' => $renewalData['policy_no'],
|
||||
'non_comm_per_amt' => 0.00
|
||||
];
|
||||
|
||||
$PTCOShareDetailsModel = new PTCOShareDetailsModel();
|
||||
$id = $PTCOShareDetailsModel->insert($pt_co_share_details);
|
||||
return $id;
|
||||
}
|
||||
|
||||
private function prepareClientPolicy($renewalData)
|
||||
{
|
||||
$client_policy = [
|
||||
'client_id' => $renewalData['client_id'],
|
||||
'client_branch_id' => $renewalData['branch_id'] ?? 0,
|
||||
'policy_type_id' => $renewalData['policy_type_id'],
|
||||
'insurer_id' => $renewalData['insurer_id'],
|
||||
'insurer_branch_id' => $renewalData['insurer_branch_id'],
|
||||
'tpa_id' => null,
|
||||
'tpa_branch_id' => null,
|
||||
'policy_start_date' => $renewalData['date_policy_start_date'],
|
||||
'policy_end_date' => $renewalData['date_policy_end_date'],
|
||||
'policy_no' => $renewalData['policy_no'],
|
||||
'cd_ac_no' => null,
|
||||
'policy_status' => 1,
|
||||
'policy_terms' => null,
|
||||
'is_addon' => 1,
|
||||
'base_policy' => null,
|
||||
'inception_type' => 1,
|
||||
'open_for_enrollment' => 0,
|
||||
'gst' => 18.00,
|
||||
'enrolment_visibility' => 1,
|
||||
'open_date' => null,
|
||||
'close_date' => null,
|
||||
'reminder_date' => null,
|
||||
'disclaimer' => null,
|
||||
'is_member_modify_allowed' => 0,
|
||||
'cd_ac_pk' => $renewalData['cd_ac_pk'],
|
||||
'is_lgbtq' => 0
|
||||
];
|
||||
|
||||
$ClientPolicyModel = new ClientPolicyModel();
|
||||
$id = $ClientPolicyModel->insert($client_policy);
|
||||
return $id;
|
||||
}
|
||||
|
||||
private function prepareClientBranch($renewalData)
|
||||
{
|
||||
$branch_code = "BRANCH001";
|
||||
$short_name = explode(" ", $renewalData['insured'])[0];
|
||||
$unit = $short_name . " - " . $branch_code;
|
||||
|
||||
$clientBranchData = [
|
||||
'client_id' => $renewalData['client_id'],
|
||||
'branch_name' => "Branch 1",
|
||||
'branch_code' => $branch_code,
|
||||
'city' => null,
|
||||
'district' => null,
|
||||
'state' => null,
|
||||
'pincode' => null,
|
||||
'address1' => null,
|
||||
'address2' => null,
|
||||
'gst' => null,
|
||||
'sez' => 0,
|
||||
'is_active' => 1,
|
||||
'units' => $unit
|
||||
];
|
||||
|
||||
|
||||
$ClientBranchModel = new ClientBranchModel();
|
||||
$id = $ClientBranchModel->insert($clientBranchData);
|
||||
return $id;
|
||||
}
|
||||
|
||||
private function prepareClient($renewalData)
|
||||
{
|
||||
|
||||
if($renewalData['client_type_id'] == 1){
|
||||
$short_name = explode(" ", $renewalData['insured'])[0];
|
||||
}else{
|
||||
$short_name = $renewalData['insured'];
|
||||
}
|
||||
|
||||
$clientData = [
|
||||
'client_type' => $renewalData['client_type_id'],
|
||||
'entity_type_id' => null,
|
||||
'client_name' => $renewalData['insured'],
|
||||
'short_name' => $short_name,
|
||||
'cost_center' => null,
|
||||
'client_code' => null, // Auto-generated
|
||||
'pan' => null,
|
||||
'gst' => null,
|
||||
'address1' => null,
|
||||
'address2' => null,
|
||||
'city' => null,
|
||||
'state' => null,
|
||||
'pincode' => null,
|
||||
'is_download_btn' => 0, // Assuming a default value if not specified
|
||||
'client_logo' => null,
|
||||
'created_by' => null,
|
||||
'created_at' => null, // Will be set automatically by MySQL
|
||||
'updated_by' => null,
|
||||
'updated_at' => null, // Will be set automatically by MySQL
|
||||
'is_active' => 1, // Default value is 1
|
||||
'common_mails' => null,
|
||||
'hr_mails' => null,
|
||||
'mail_domain' => null,
|
||||
'reply_to' => null,
|
||||
'dob' => null,
|
||||
'aadhar' => null,
|
||||
'reference' => null,
|
||||
'phone' => null,
|
||||
'email' => null,
|
||||
'addon_subheading' => null
|
||||
];
|
||||
|
||||
|
||||
|
||||
$ClientModel = new ClientModel();
|
||||
$id = $ClientModel->insert($clientData);
|
||||
return $id;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -951,7 +951,7 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
if(empty($additionData) && empty($deletionData) && empty($inceptionData) && empty($correctionData) && empty($enhancementData) && empty($dependentAdditionData)){
|
||||
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
//for cd tranction and cd master data is empty check
|
||||
@ -975,7 +975,7 @@ class EmpDataServiceController extends BaseController
|
||||
$balance = $this->CDMasterModel
|
||||
->where('client_id', $export_data['client_id'])
|
||||
->where('insurer_id', $policy_details['insurer_id'])
|
||||
->where('cd_ac_no', $policy_details['cd_ac_no'])
|
||||
->where('id', $policy_details['cd_ac_pk'])
|
||||
->first();
|
||||
|
||||
$cash_balance['balance'] = $balance['opening_bal'];
|
||||
@ -1011,14 +1011,33 @@ class EmpDataServiceController extends BaseController
|
||||
// dd($inceptionData, $additionData, $dependentAdditionData, $correctionData, $enhancementData, $deletionData, $mergedData);
|
||||
|
||||
|
||||
$template_json = $this->clientPolicyModel
|
||||
->select('insurer_excel_export_template.jsoncolumns')
|
||||
->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = client_policy.insurer_id and insurer_excel_export_template.policy_type_id = client_policy.policy_type_id')
|
||||
->where('client_policy.id', $export_data['client_policy_id'])
|
||||
->where('insurer_excel_export_template.event_name', 'all')
|
||||
->where('insurer_excel_export_template.is_active', 1) //Live issue changes 17-10-2024
|
||||
->where('insurer_excel_export_template.type_name', $export_data['actions'])
|
||||
->first();
|
||||
// $template_json = $this->clientPolicyModel
|
||||
// ->select('insurer_excel_export_template.jsoncolumns')
|
||||
// ->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = client_policy.insurer_id and insurer_excel_export_template.policy_type_id = client_policy.policy_type_id')
|
||||
// ->where('client_policy.id', $export_data['client_policy_id'])
|
||||
// ->where('insurer_excel_export_template.event_name', 'all')
|
||||
// ->where('insurer_excel_export_template.is_active', 1) //Live issue changes 17-10-2024
|
||||
// ->where('insurer_excel_export_template.type_name', $export_data['actions'])
|
||||
// ->first();
|
||||
|
||||
$sql = "
|
||||
SELECT `insurer_excel_export_template`.`jsoncolumns`
|
||||
FROM `client_policy`
|
||||
JOIN `insurer_excel_export_template`
|
||||
ON `insurer_excel_export_template`.`insurer_id` = `client_policy`.`insurer_id`
|
||||
AND `insurer_excel_export_template`.`policy_type_id` =
|
||||
CASE
|
||||
WHEN `client_policy`.`policy_type_id` IN (2, 3, 4, 5) THEN 2
|
||||
ELSE `client_policy`.`policy_type_id`
|
||||
END
|
||||
WHERE `client_policy`.`id` = '".$export_data['client_policy_id']."'
|
||||
AND `insurer_excel_export_template`.`event_name` = 'all'
|
||||
AND `insurer_excel_export_template`.`is_active` = 1
|
||||
AND `insurer_excel_export_template`.`type_name` = '".$export_data['actions']."'
|
||||
LIMIT 1";
|
||||
|
||||
$query = db_connect()->query($sql);
|
||||
$template_json = $query->getRowArray();
|
||||
|
||||
|
||||
if(!empty($template_json) && $template_json != null){
|
||||
@ -1829,7 +1848,7 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
if(!empty($name) && !empty($emp_code)){
|
||||
|
||||
$totals = $totals + $amount;
|
||||
$totals = $totals + floatval($amount);
|
||||
|
||||
$query = $db->table('employee_polices');
|
||||
$query->select('employee_polices.id');
|
||||
|
||||
@ -25,6 +25,8 @@ use App\Models\InsurerExcelExportTemplateModel;
|
||||
use App\Models\InsurerModel;
|
||||
use App\Models\ClientDepositModel;
|
||||
use App\Models\PolicyPremium2Model;
|
||||
use App\Models\AuditHistoryModel;
|
||||
use App\Models\UserModel;
|
||||
|
||||
|
||||
use App\Controllers\Jobs;
|
||||
@ -64,6 +66,8 @@ class EmployeeController extends AdminController
|
||||
protected $insurerModel;
|
||||
protected $cashDepositModel;
|
||||
protected $PolicyPremium2Model;
|
||||
protected $auditHistory;
|
||||
protected $userModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -84,6 +88,8 @@ class EmployeeController extends AdminController
|
||||
$this->insurerModel = new InsurerModel();
|
||||
$this->cashDepositModel = new ClientDepositModel();
|
||||
$this->PolicyPremium2Model = new PolicyPremium2Model();
|
||||
$this->auditHistory = new AuditHistoryModel();
|
||||
$this->userModel = new userModel();
|
||||
}
|
||||
|
||||
public function list()
|
||||
@ -372,7 +378,7 @@ class EmployeeController extends AdminController
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||
->join('clients', 'clients.id = client_policy.client_id')
|
||||
->orderBy('batch_files.id', 'desc')
|
||||
->limit(100)
|
||||
->limit(1000)
|
||||
->find();
|
||||
|
||||
|
||||
@ -590,7 +596,16 @@ class EmployeeController extends AdminController
|
||||
$batch_data['event_type'] = $array;
|
||||
$return = $empDataServiceController->generateExcelForAllEventType($batch_data);
|
||||
|
||||
if($return === 6){
|
||||
if ($return === 0) {
|
||||
session()->setFlashdata('error', "Insufficient deposit amount.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
|
||||
}else if($return === 5){
|
||||
|
||||
session()->setFlashdata('error', "The policy does not have a CD account number.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
else if($return === 6){
|
||||
|
||||
session()->setFlashdata('error', "The Insurer does not have an Excel export template format.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
@ -1286,7 +1301,7 @@ class EmployeeController extends AdminController
|
||||
->orderBy('id', 'desc')
|
||||
->first();
|
||||
|
||||
// print_r($file); die;
|
||||
// dd($cd_tranction, db_connect()->getLastQuery());
|
||||
if ($file['action'] == 'inception' || $file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'enrollment' || $file['action'] == 'missed_inception') {
|
||||
|
||||
|
||||
@ -1443,6 +1458,7 @@ class EmployeeController extends AdminController
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
// dd($res);
|
||||
// print_r($this->empEndorsementModel->getLastQuery());
|
||||
// echo $res[0]->count;die();
|
||||
|
||||
@ -1452,14 +1468,15 @@ class EmployeeController extends AdminController
|
||||
$this->myLogger->logme('error', 'Event Type : -- {data} --', ['data' => $file['action']]);
|
||||
|
||||
$transaction_type = 'Credit';
|
||||
$cd_amount = $cd_tranction['amount'];
|
||||
$cd_amount = 0;
|
||||
|
||||
if($file['action'] == 'deletion'){
|
||||
if($file['action'] == 'deletion' && $res[0]->count > 0){
|
||||
|
||||
$transaction_type = 'Debit';
|
||||
//get cd amount for the particular file id to reverse entry to the cash deposite for only deletion
|
||||
$cd_amount_total = $this->employeePolicyModel->getDeletionDataForTruncated($file['id']);
|
||||
$totalSum = array_sum(array_column($cd_amount_total, 'total'));
|
||||
$cd_amount = $totalSum;
|
||||
$cd_amount = $totalSum ?? 0;
|
||||
|
||||
$this->myLogger->logme('error', 'Deletion CD Amount : {data}', ['data' => $cd_amount]);
|
||||
}
|
||||
@ -1476,7 +1493,7 @@ class EmployeeController extends AdminController
|
||||
$this->myLogger->logme('error', 'emp_endorsement table updated');
|
||||
|
||||
//STEP 2:
|
||||
if($file['action'] == 'deletion') {
|
||||
if($file['action'] == 'deletion' && $res[0]->count > 0) {
|
||||
//update the employee policy table reverse the data
|
||||
$this->employeePolicyModel->updateEmployeePolicyTruncateReverse($file_id);
|
||||
$this->myLogger->logme('error', 'employee_polices table updated for deletion');
|
||||
@ -1492,7 +1509,7 @@ class EmployeeController extends AdminController
|
||||
$this->myLogger->logme('error', 'files table updated');
|
||||
|
||||
|
||||
if($cd_tranction && $file['action'] != 'correction'){
|
||||
if(!empty($cd_amount) && $file['action'] != 'correction'){
|
||||
|
||||
$cd_data = [
|
||||
'amount' => $cd_amount,
|
||||
@ -1596,9 +1613,8 @@ class EmployeeController extends AdminController
|
||||
$db = db_connect();
|
||||
$query = "
|
||||
UPDATE employee_polices
|
||||
JOIN employees ON employees.id = employee_polices.employee_id
|
||||
SET employee_polices.status = 'truncated', employee_polices.is_active = 0
|
||||
WHERE employees.file_id = $file_id
|
||||
WHERE employee_polices.file_id = $file_id
|
||||
";
|
||||
|
||||
$db->query($query);
|
||||
@ -2717,4 +2733,46 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function getEmpHistory(){
|
||||
|
||||
$emp_id = $this->request->getPost('emp_id');
|
||||
|
||||
$data['emp_history'] = $this->auditHistory->select('field_name,old_value,new_value,created_by,created_at')->where('pk',$emp_id)->where('table_name','employees')->orderBy('created_at', 'DESC')->findAll();
|
||||
|
||||
foreach ($data['emp_history'] as &$emp_history) {
|
||||
$emp_history['field_name'] = $this->formatFieldName($emp_history['field_name']);
|
||||
$user = $emp_history['created_by'];
|
||||
if ($user != null && $user != ''){
|
||||
$userData = $this->userModel->select('first_name, last_name')->where('id', $user)->where('is_active', 1)->first();
|
||||
$emp_history['created_by'] = ucwords($userData['first_name'] . ' ' . $userData['last_name']);
|
||||
}else{
|
||||
$emp_history['created_by'] = '-';
|
||||
}
|
||||
|
||||
$emp_history['created_at'] = date("d-m-Y H:i:s", strtotime($emp_history['created_at']));
|
||||
}
|
||||
unset($emp_history);
|
||||
|
||||
$emp_pol_pk = $this->employeePolicyModel->select('id')->where('employee_id',$emp_id)->first()['id'];
|
||||
$data['emp_pol_history'] = $this->auditHistory->select('field_name,old_value,new_value,created_by,created_at')->where('pk',$emp_pol_pk)->where('table_name','employee_polices')->findAll();
|
||||
|
||||
return $this->respond(['status' => true, 'data' => $data],200);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function formatFieldName($unformattedString){
|
||||
|
||||
if (str_contains($unformattedString, '_')) {
|
||||
$data = str_replace('_', ' ', $unformattedString);
|
||||
}else{
|
||||
$data = $unformattedString;
|
||||
}
|
||||
|
||||
$format = ucwords($data);
|
||||
|
||||
return $format;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2502,7 +2502,7 @@ class EmployeeRestController extends AdminController
|
||||
function getEmployeeActiveOrInactivePolicy()
|
||||
{
|
||||
if($this->request->getGet('type') == 'Active'){ $policy_status = 1; }else{ $policy_status = 0; }
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policy_type.policy_type as policy_type,insurers.name as insurer_name,tpa.name as tpa_name,tpa.network_hospitals as network_hospitals_url')
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policy_type.policy_type as policy_type,insurers.name as insurer_name,tpa.name as tpa_name,tpa.network_hospitals as network_hospitals_url, policy_type.long_name as policy_long_name')
|
||||
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
||||
->join('tpa', 'client_policy.tpa_id = tpa.id', 'left')
|
||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||
@ -2555,13 +2555,15 @@ class EmployeeRestController extends AdminController
|
||||
$data['network_hospitals_url'] = $ClientPolicyValue['network_hospitals_url'];
|
||||
$data['policy_start_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_start_date']);
|
||||
$data['policy_end_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_end_date']);
|
||||
$data['heading'] = $ClientPolicyValue['policy_long_name'];
|
||||
// $data['policy_terms'] = $terms;
|
||||
|
||||
if($ClientPolicyValue['policy_type_id'] == 1){ $data['heading'] = 'Group Personal Accident Coverage'; }else
|
||||
if($ClientPolicyValue['policy_type_id'] == 2){ $data['heading'] = 'Group Medical Coverage'; }else
|
||||
if($ClientPolicyValue['policy_type_id'] == 3){ $data['heading'] = 'Group Medical Coverage - Parents'; }else
|
||||
if($ClientPolicyValue['policy_type_id'] == 4){ $data['heading'] = 'Group Medical Coverage - Top Up'; }else
|
||||
if($ClientPolicyValue['policy_type_id'] == 5){ $data['heading'] = 'Group Medical Coverage - Parents (Top Up)'; }
|
||||
// if($ClientPolicyValue['policy_type_id'] == 1){ $data['heading'] = 'Group Personal Accident Coverage'; }else
|
||||
// if($ClientPolicyValue['policy_type_id'] == 2){ $data['heading'] = 'Group Medical Coverage'; }else
|
||||
// if($ClientPolicyValue['policy_type_id'] == 3){ $data['heading'] = 'Group Medical Coverage - Parents'; }else
|
||||
// if($ClientPolicyValue['policy_type_id'] == 4){ $data['heading'] = 'Group Medical Coverage - Top Up'; }else
|
||||
// if($ClientPolicyValue['policy_type_id'] == 5){ $data['heading'] = 'Group Medical Coverage - Parents (Top Up)'; }else
|
||||
// if($ClientPolicyValue['policy_type_id'] == 7){ $data['heading'] = 'Group Term Life Insurance'; }
|
||||
|
||||
if($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 6 || $ClientPolicyValue['policy_type_id'] == 7)
|
||||
{
|
||||
|
||||
@ -1647,7 +1647,7 @@ class EmployeeServiceController extends AdminController
|
||||
// echo 'insert emp';
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$value['emp_status'] = 'active';
|
||||
$value['created_by'] = $file['created_by'];
|
||||
$value['client_branch_id'] = $file['client_branch_id'];
|
||||
@ -2056,6 +2056,8 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
||||
}
|
||||
$value['family_floater_key'] = $relation;
|
||||
|
||||
// dd($value['family_floater_key']);
|
||||
|
||||
$policy_data['basic_cover_si'] = $row[9];
|
||||
$policy_data['date_coverage'] = $row[13] != "" && $row[13] != null ? change_date_format($row[13],'d-M-Y','Y-m-d') : null;
|
||||
$policy_data['client_policy_id'] = $file['policy_id'];
|
||||
|
||||
@ -12,6 +12,8 @@ use PhpOffice\PhpSpreadsheet\Style\Border;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Alignment;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Fill;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||
|
||||
use App\Models\UserModel;
|
||||
use App\Models\ClientModel;
|
||||
@ -31,7 +33,7 @@ use App\Helpers\MailHelper;
|
||||
use App\Helpers\ExcelMergeHelper;
|
||||
use App\Helpers\ExcelSanitizeHelper;
|
||||
use Google\Service\CloudSearch\PushItem;
|
||||
use Kint;
|
||||
use Kint\Kint;
|
||||
|
||||
use App\Controllers\Jobs;
|
||||
use App\Controllers\JobWorker;
|
||||
@ -64,6 +66,9 @@ class LeadsController extends BaseController
|
||||
protected $clientType;
|
||||
protected $leadType;
|
||||
protected $leadsStatus;
|
||||
protected $claim_type_for_gpa;
|
||||
protected $cause_of_death;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -96,6 +101,19 @@ class LeadsController extends BaseController
|
||||
'completed_with_corrections' => 'Completed with Corrections',
|
||||
'completed_without_corrections' => 'Completed w/o Corrections',
|
||||
];
|
||||
$this->claim_type_for_gpa = [
|
||||
'accident_death' => 'Accident Death',
|
||||
'permanent_total_disablement' => 'Permanent Total Disablement',
|
||||
'permanent_partial_disablement' => 'Permanent Partial Disablement',
|
||||
'temporary_total_disablement_benefit' => 'Temporary Total Disablement benefit'
|
||||
];
|
||||
|
||||
$this->cause_of_death = [
|
||||
'natural_death' => 'Natural Death',
|
||||
'suicide' => 'Suicide',
|
||||
'accident' => 'Accident'
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
public function viewLeadsList()
|
||||
@ -107,6 +125,7 @@ class LeadsController extends BaseController
|
||||
// $d = $this->calculateMembersDemography(['lead_id' => 24]);
|
||||
//$this->mergeQuoteExcelFileWithMembersListExcelFile(24, 1, $propsal_and_insurer = null);
|
||||
// dd($d);
|
||||
|
||||
$data['page_name'] = 'Leads';
|
||||
|
||||
// Set basic data
|
||||
@ -122,7 +141,7 @@ class LeadsController extends BaseController
|
||||
// Fetch insurer and TPA branch data
|
||||
$data['insurer'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
|
||||
$data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
|
||||
|
||||
// print_r($data['tpa']);die();
|
||||
// Fetch sales team members who are active in team 5
|
||||
$data['salse_team'] = $this->userModel
|
||||
->select('user_profiles.*')
|
||||
@ -133,12 +152,31 @@ class LeadsController extends BaseController
|
||||
->findAll();
|
||||
|
||||
// dd($data);
|
||||
$data['lastFiveYears'] = $this->getLastFiveFinancialYears();
|
||||
$data['gpaClaimType'] = $this->claim_type_for_gpa;
|
||||
$data['causeOfDeath'] = $this->cause_of_death;
|
||||
// dd($lastFiveYears);
|
||||
if ($this->request->is('get')) {
|
||||
// Fetch leads data
|
||||
$data ['lead_data_list'] = $this->leadsModel->getLeadDataForLising();
|
||||
// Load layout and pass data
|
||||
$this->loadLayout('lead_filter', $data);
|
||||
}else{
|
||||
|
||||
// Fetch leads data
|
||||
$data ['lead_data_list'] = $this->leadsModel->getLeadDataForLising();
|
||||
|
||||
// Load layout and pass data
|
||||
$this->loadLayout('leads_list', $data);
|
||||
$search_data = $this->request->getPost();
|
||||
// print_r($search_data);
|
||||
|
||||
$where = [];
|
||||
foreach ($search_data as $search_objects => $key) {
|
||||
if ($key != null && $key != '' && $key != 0) {
|
||||
$where[$search_objects] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
$data['lead_data_list'] = $this->leadsModel->getLeadDataForLising($where);
|
||||
$html = view('leads_list', $data);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
}
|
||||
}
|
||||
|
||||
public function createLead()
|
||||
@ -198,6 +236,8 @@ class LeadsController extends BaseController
|
||||
// Separate the insurer and insurer branch, handle missing or invalid data
|
||||
if (isset($data['insurer'][$index]) && strpos($data['insurer'][$index], '-') !== false) {
|
||||
list($insurer_branch_id, $insurer_id) = explode('-', $data['insurer'][$index]);
|
||||
|
||||
}else{
|
||||
$insurer_branch_id = 0;
|
||||
$insurer_id = 0;
|
||||
}
|
||||
@ -253,7 +293,18 @@ class LeadsController extends BaseController
|
||||
|
||||
$last_3_years_claims = null;
|
||||
if($value != 2){
|
||||
$last_3_years_claims = $data['finyear'];
|
||||
$last_3_years_claims = [];
|
||||
$finyear = json_decode($data['finyear']);
|
||||
|
||||
foreach ($finyear as $year){
|
||||
$received_policy_type = ($year->finyear[0]->policy_type);
|
||||
if ($value == $received_policy_type){
|
||||
array_push($last_3_years_claims,$year);
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$last_3_years_claims = json_encode($last_3_years_claims);
|
||||
}
|
||||
|
||||
$processedData[] = [
|
||||
@ -321,7 +372,7 @@ class LeadsController extends BaseController
|
||||
'notes' => $data['notes'] ?? null,
|
||||
];
|
||||
}
|
||||
|
||||
// print_r($processedData);die();
|
||||
return $processedData;
|
||||
}
|
||||
|
||||
@ -418,7 +469,9 @@ class LeadsController extends BaseController
|
||||
->where('lead_id', $id)
|
||||
// ->where('type', $type)
|
||||
->where('is_active', 1)
|
||||
->orderBy('id', 'desc')
|
||||
->first();
|
||||
// dd($data);
|
||||
|
||||
$data['rfq_count'] = $this->RFQModel
|
||||
->where('lead_id', $id)
|
||||
@ -436,8 +489,15 @@ class LeadsController extends BaseController
|
||||
|
||||
$data['lead_id'] = $id;
|
||||
$lead_data = $this->leadsModel
|
||||
->select('leads.*, policy_type.question_json, policy_type.policy_type')
|
||||
->select('
|
||||
leads.*,
|
||||
policy_type.question_json,
|
||||
policy_type.policy_type,
|
||||
policy_type.long_name,
|
||||
user_profiles.email as created_person_email
|
||||
')
|
||||
->join('policy_type', 'leads.policy_type_id = policy_type.id')
|
||||
->join('user_profiles', 'leads.created_by = user_profiles.id', 'left')
|
||||
->where('leads.id', $id)
|
||||
->where('leads.is_active', 1)
|
||||
->first();
|
||||
@ -455,7 +515,21 @@ class LeadsController extends BaseController
|
||||
$data['userList'] = $this->userModel->getUserListForRFQ();
|
||||
$data['lead_data'] = $lead_data;
|
||||
|
||||
$data['mail_content'] = $this->transformMailContent($id);
|
||||
$mail_content = "
|
||||
<p>Dear Sir,</p>
|
||||
<p>Greetings From Nhance India!</p>
|
||||
<p>Please find attached the {{RFQ_OR_QCR}} for <strong>{{POLICY_TYPE}}</strong> policy pertaining to <strong>{{CLIENT_NAME}}</strong>.</p>
|
||||
<p>Kindly request you to share the competitive quotes at the earliest.</p>
|
||||
<p>In case of any query, please feel free to contact us.</p>
|
||||
<p>Thank You!</p>
|
||||
";
|
||||
|
||||
|
||||
$subject = "{{CLIENT_NAME}} _ {{POLICY_TYPE}} _ {{RFQ_OR_QCR}} _ {{POLICY_YEAR}}";
|
||||
|
||||
$data['mail_content'] = $this->transformMailContent($lead_data, $mail_content, $data['page_name']);
|
||||
$data['subject'] = $this->transformMailContent($lead_data, $subject, $data['page_name']);
|
||||
|
||||
|
||||
// dd($data);
|
||||
$this->loadLayout('view_rfq.php', $data);
|
||||
@ -574,13 +648,13 @@ class LeadsController extends BaseController
|
||||
public function constructExcelToSaveTemp($lead_id, $type, $propsal_and_insurer = null)
|
||||
{
|
||||
$rfq_data = $this->RFQModel->getRFQTableDataWithLeadIDAndType($lead_id, $type);
|
||||
|
||||
|
||||
// dd($rfq_data, $lead_id, $type, $propsal_and_insurer);
|
||||
// print_r($propsal_and_insurer); die;
|
||||
|
||||
if($rfq_data['lead_type'] == 1){
|
||||
if ($rfq_data['lead_type'] == 1) {
|
||||
|
||||
if($rfq_data['policy_type_id'] == 2){
|
||||
if ($rfq_data['policy_type_id'] == 2) {
|
||||
$lead_data = [
|
||||
|
||||
'Insured' => $rfq_data['client_name'],
|
||||
@ -590,23 +664,22 @@ class LeadsController extends BaseController
|
||||
'No of Dependents' => $rfq_data['incept_dept_count'],
|
||||
'Total Lives' => $rfq_data['incept_no_of_lives'],
|
||||
|
||||
'Period of Insurance ' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])).' to '. date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
||||
'Period of Insurance ' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
||||
'Policy Run Days' => $rfq_data['policy_run_days'],
|
||||
];
|
||||
}else if($rfq_data['policy_type_id'] == 1){
|
||||
} else if ($rfq_data['policy_type_id'] == 1) {
|
||||
$lead_data = [
|
||||
'Insured' => $rfq_data['client_name'],
|
||||
'No of Employees at Inception' => $rfq_data['incept_emp_count'],
|
||||
'Total Sum Insured at Inception ' => $rfq_data['total_si_at_incept'],
|
||||
'Policy Period' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])).' to '. date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
||||
'Policy Period' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
||||
'Policy Status' => $rfq_data['status'],
|
||||
'Existing Insurer' => $rfq_data['insurer_name'],
|
||||
'TPA ' => $rfq_data['tpa_name'],
|
||||
];
|
||||
}
|
||||
|
||||
}else{
|
||||
if($rfq_data['policy_type_id'] == 2){
|
||||
} else {
|
||||
if ($rfq_data['policy_type_id'] == 2) {
|
||||
$lead_data = [
|
||||
|
||||
'Insured' => $rfq_data['client_name'],
|
||||
@ -624,7 +697,7 @@ class LeadsController extends BaseController
|
||||
'No of Dependents at Renewal' => $rfq_data['renewal_dept_count'],
|
||||
'Total Lives at Renewal ' => $rfq_data['renewal_no_of_lives'],
|
||||
|
||||
'Period of Insurance ' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])).' to '. date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
||||
'Period of Insurance ' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
||||
'Policy Run Days' => $rfq_data['policy_run_days'],
|
||||
'Inception Premium' => $rfq_data['premium_at_inception'],
|
||||
'Premium as on (Date - DD MM YYYY should be entered based on the claims dump report)' => $rfq_data['premium_date'],
|
||||
@ -634,12 +707,12 @@ class LeadsController extends BaseController
|
||||
'Incurred Claims Ratio' => $rfq_data['incurred_claims_ratio'],
|
||||
'Earned Claims Ratio' => $rfq_data['earned_claims_ratio'],
|
||||
];
|
||||
}else if($rfq_data['policy_type_id'] == 1){
|
||||
} else if ($rfq_data['policy_type_id'] == 1) {
|
||||
$lead_data = [
|
||||
'Insured' => $rfq_data['client_name'],
|
||||
'No of Employees at Renewal' => $rfq_data['renewal_emp_count'],
|
||||
'Total Sum Insured at Renewal ' => $rfq_data['total_si_at_renewal'],
|
||||
'Policy Period' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])).' to '. date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
||||
'Policy Period' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
||||
'Policy Status' => $rfq_data['status'],
|
||||
'Existing Insurer' => $rfq_data['insurer_name'],
|
||||
'TPA ' => $rfq_data['tpa_name'],
|
||||
@ -648,14 +721,15 @@ class LeadsController extends BaseController
|
||||
}
|
||||
|
||||
$data = json_decode($rfq_data['json'], true);
|
||||
// dd($data);
|
||||
|
||||
if($type == 2){
|
||||
if ($type == 2) {
|
||||
$data = $this->convertJsonForQCR($data, $type);
|
||||
if($propsal_and_insurer !== null){
|
||||
if ($propsal_and_insurer !== null) {
|
||||
list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2);
|
||||
$data = $this->transformProposelData($data, $proposal_key, $insurer_key);
|
||||
}
|
||||
}else if($type == 1){
|
||||
} else if ($type == 1) {
|
||||
$data = $this->convertJsonForQCR($data, $type);
|
||||
// dd($data);
|
||||
}
|
||||
@ -663,17 +737,123 @@ class LeadsController extends BaseController
|
||||
$spreadsheet = new Spreadsheet();
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
|
||||
// Start with lead_data at the top
|
||||
$rowNumber = 1;
|
||||
|
||||
$mergeRange1 = "A{$rowNumber}:C{$rowNumber}";
|
||||
$sheet->mergeCells($mergeRange1);
|
||||
$sheet->setCellValue("A{$rowNumber}", "Nhance India Insurance Broking Pvt Ltd");
|
||||
$sheet->getStyle("A{$rowNumber}")->applyFromArray([
|
||||
'font' => [
|
||||
'bold' => true,
|
||||
'size' => 20
|
||||
],
|
||||
'alignment' => [
|
||||
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
|
||||
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
|
||||
],
|
||||
]);
|
||||
|
||||
// Set column width to fit the image properly
|
||||
$sheet->getColumnDimension('D')->setWidth(20); // Adjust as needed
|
||||
$sheet->getRowDimension($rowNumber)->setRowHeight(40); // Adjust as needed
|
||||
|
||||
$drawing = new Drawing();
|
||||
$path = ROOTPATH . "public/assets/images/Nhance-Logo-Final.png"; // Use FCPATH for server path
|
||||
$drawing->setPath($path);
|
||||
$drawing->setCoordinates("D{$rowNumber}"); // Set position in column B
|
||||
$drawing->setHeight(35); // Adjust image height
|
||||
|
||||
// Center align the image in the cell
|
||||
$drawing->setOffsetX(30); // Adjust horizontal offset
|
||||
$drawing->setOffsetY(5); // Adjust vertical offset
|
||||
|
||||
$drawing->setWorksheet($sheet);
|
||||
|
||||
// Apply center alignment to the cell
|
||||
$sheet->getStyle("D{$rowNumber}")->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
||||
$sheet->getStyle("D{$rowNumber}")->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
|
||||
|
||||
|
||||
$rowNumber = $rowNumber + 1;
|
||||
|
||||
// Initialize max width tracking variables
|
||||
$maxWidthA = 0;
|
||||
$maxWidthB = 0;
|
||||
|
||||
foreach ($lead_data as $key => $value) {
|
||||
|
||||
// Merge A:B for key and C:D for value
|
||||
$mergeRangeKey = "A{$rowNumber}:B{$rowNumber}";
|
||||
$mergeRangeValue = "C{$rowNumber}:D{$rowNumber}";
|
||||
$sheet->mergeCells($mergeRangeKey);
|
||||
$sheet->mergeCells($mergeRangeValue);
|
||||
|
||||
// Set values in merged cells
|
||||
$sheet->setCellValue("A{$rowNumber}", $key);
|
||||
$sheet->setCellValue("B{$rowNumber}", $value);
|
||||
$sheet->getStyle("A{$rowNumber}")->applyFromArray(['font' => ['bold' => true]]);
|
||||
$sheet->setCellValue("C{$rowNumber}", $value);
|
||||
|
||||
// Apply styles for alignment and bold text in A:B
|
||||
$sheet->getStyle($mergeRangeKey)->applyFromArray([
|
||||
'font' => ['bold' => true],
|
||||
'alignment' => [
|
||||
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
|
||||
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
|
||||
],
|
||||
]);
|
||||
|
||||
// Apply bold style to B column if the key is "Insured"
|
||||
if ($key == "Insured") {
|
||||
$sheet->getStyle("C{$rowNumber}")->applyFromArray([
|
||||
'font' => ['bold' => true],
|
||||
]);
|
||||
}
|
||||
|
||||
// Track max width needed for columns
|
||||
$maxWidthA = max($maxWidthA, mb_strlen($key));
|
||||
$maxWidthB = max($maxWidthB, mb_strlen($value));
|
||||
|
||||
$rowNumber++;
|
||||
}
|
||||
|
||||
$leadRange = "A1:B" . (count($lead_data));
|
||||
$sheet->getStyle($leadRange)->applyFromArray([
|
||||
// Set column width based on max content length (adjusted for padding)
|
||||
$sheet->getColumnDimension('A')->setWidth($maxWidthA * 1.2);
|
||||
$sheet->getColumnDimension('B')->setWidth($maxWidthA * 1.2);
|
||||
$sheet->getColumnDimension('C')->setWidth($maxWidthB * 1.2);
|
||||
$sheet->getColumnDimension('D')->setWidth($maxWidthB * 1.2);
|
||||
|
||||
// $rowNumber += 2;
|
||||
|
||||
// Add headers and subheaders
|
||||
$headers = $data['table_data']['headers'];
|
||||
|
||||
$sheet->setCellValue("A{$rowNumber}", "Details of Coverage");
|
||||
$sheet->getStyle("A{$rowNumber}")->applyFromArray([
|
||||
'font' => [
|
||||
'bold' => true,
|
||||
],
|
||||
'fill' => [
|
||||
'fillType' => Fill::FILL_SOLID,
|
||||
'startColor' => ['rgb' => 'ADD8E6'],
|
||||
],
|
||||
'borders' => [
|
||||
'allBorders' => [
|
||||
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
|
||||
'color' => ['argb' => 'FF000000'], // Black color
|
||||
],
|
||||
],
|
||||
]);
|
||||
$subheader_count = array_sum(array_map(fn($header) => count($header['subHeaders']), $data['table_data']['headers']));
|
||||
$subheader_count = $subheader_count - 2;
|
||||
$headerCount = count($data['table_data']['headers']);
|
||||
$lastColumn = Coordinate::stringFromColumnIndex($subheader_count);
|
||||
// dd( $headerCount, $lastColumn);
|
||||
|
||||
// Merge cells from A to the last column
|
||||
$mergeRange = "A{$rowNumber}:{$lastColumn}{$rowNumber}";
|
||||
|
||||
$sheet->getStyle($mergeRange)->applyFromArray([
|
||||
'borders' => [
|
||||
'allBorders' => [
|
||||
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
|
||||
@ -682,21 +862,25 @@ class LeadsController extends BaseController
|
||||
],
|
||||
]);
|
||||
|
||||
$sheet->mergeCells($mergeRange);
|
||||
$rowNumber = $rowNumber + 1;
|
||||
|
||||
$rowNumber += 2;
|
||||
|
||||
// Add headers and subheaders
|
||||
$headers = $data['table_data']['headers'];
|
||||
$subHeaderRow = $rowNumber + 1;
|
||||
$columnLetter = 'A';
|
||||
|
||||
foreach ($headers as $header) {
|
||||
|
||||
if (in_array($header['parentHeader'], ['Item Key', 'Action'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($header['parentHeader'] === 'Sno') {
|
||||
$header['parentHeader'] = 'S.No.';
|
||||
$sheet->getColumnDimension('A')->setWidth(10);
|
||||
}
|
||||
|
||||
if ($header['parentHeader'] === 'Particulars') {
|
||||
$sheet->getColumnDimension('B')->setWidth(40);
|
||||
}
|
||||
|
||||
$startColumn = $columnLetter; // Start of the current header range
|
||||
@ -723,6 +907,13 @@ class LeadsController extends BaseController
|
||||
// Add subheaders
|
||||
foreach ($header['subHeaders'] as $subHeader) {
|
||||
$sheet->setCellValue("{$columnLetter}{$subHeaderRow}", $subHeader);
|
||||
|
||||
if ($columnLetter != "A" && $columnLetter != "B" && $columnLetter != "C" && $columnLetter != "D") {
|
||||
$sheet->getColumnDimension($columnLetter)->setWidth(35);
|
||||
} else {
|
||||
$sheet->getColumnDimension('A')->setWidth(10);
|
||||
}
|
||||
|
||||
$sheet->getStyle("{$columnLetter}{$subHeaderRow}")->applyFromArray([
|
||||
'font' => ['bold' => true],
|
||||
'alignment' => [
|
||||
@ -746,12 +937,13 @@ class LeadsController extends BaseController
|
||||
]);
|
||||
|
||||
// Increase row height for headers and subheaders
|
||||
$sheet->getRowDimension($rowNumber)->setRowHeight(30); // Header row height
|
||||
$sheet->getRowDimension($subHeaderRow)->setRowHeight(25); // Subheader row height
|
||||
$sheet->getRowDimension($rowNumber)->setRowHeight(25); // Header row height
|
||||
$sheet->getRowDimension($subHeaderRow)->setRowHeight(20); // Subheader row height
|
||||
|
||||
$rowNumber = $subHeaderRow + 2;
|
||||
$column_data = $data['table_data']['data'];
|
||||
$serial_no = 1;
|
||||
$maxColumnWidths = [];
|
||||
|
||||
// Add table data rows
|
||||
foreach ($column_data as $dataRow) {
|
||||
@ -789,6 +981,7 @@ class LeadsController extends BaseController
|
||||
$rowNumber += 2;
|
||||
|
||||
// Add premium data
|
||||
// dd($data);
|
||||
$labelArray = ["Premium", "GST (%)", "GST Amount (₹)", "Total"];
|
||||
$premiumData = $data['premium_data']['data'];
|
||||
$premium = [$labelArray[0]];
|
||||
@ -797,7 +990,7 @@ class LeadsController extends BaseController
|
||||
$total = [$labelArray[3]];
|
||||
|
||||
foreach ($premiumData as $proposal => $insurers) {
|
||||
if($proposal != 'Particulars'){
|
||||
if ($proposal != 'Particulars') {
|
||||
foreach ($insurers as $insurer => $values) {
|
||||
$premium[] = $values[$labelArray[0]];
|
||||
$gst[] = $values[$labelArray[1]];
|
||||
@ -819,7 +1012,8 @@ class LeadsController extends BaseController
|
||||
$rowNumber++;
|
||||
}
|
||||
|
||||
$premiumRange = "B" . ($rowNumber - 3) . ":" . chr(ord($columnLetter) - 1) . ($rowNumber - 1);
|
||||
$premiumRange = "B" . ($rowNumber - 4) . ":" . chr(ord($columnLetter) - 2) . ($rowNumber - 1);
|
||||
// dd($premiumRange);
|
||||
$sheet->getStyle($premiumRange)->applyFromArray([
|
||||
'borders' => [
|
||||
'allBorders' => [
|
||||
@ -831,10 +1025,53 @@ class LeadsController extends BaseController
|
||||
}
|
||||
|
||||
// Auto-size columns
|
||||
foreach ($sheet->getColumnIterator() as $column) {
|
||||
$sheet->getColumnDimension($column->getColumnIndex())->setAutoSize(true);
|
||||
// foreach ($sheet->getColumnIterator() as $column) {
|
||||
// $sheet->getColumnDimension($column->getColumnIndex())->setAutoSize(true);
|
||||
// }
|
||||
|
||||
$dataRange = $sheet->calculateWorksheetDimension();
|
||||
|
||||
$sheet->getStyle($dataRange)->getAlignment()
|
||||
->setHorizontal(Alignment::HORIZONTAL_CENTER)
|
||||
->setVertical(Alignment::VERTICAL_CENTER)
|
||||
->setWrapText(true);
|
||||
|
||||
$sheet->getStyle('A1')->applyFromArray([
|
||||
'alignment' => [
|
||||
'wrapText' => false, // Disables text wrapping for A1
|
||||
],
|
||||
]);
|
||||
|
||||
// Apply border to the entire sheet
|
||||
preg_match('/([A-Z]+)(\d+):([A-Z]+)(\d+)/', $dataRange, $matches);
|
||||
|
||||
if ($matches) {
|
||||
$startColumn = $matches[1]; // A
|
||||
$startRow = $matches[2]; // 1
|
||||
$endColumn = $matches[3]; // G
|
||||
$endRow = $matches[4]; // 75
|
||||
|
||||
// Convert column letter to index, reduce by 1, and convert back
|
||||
$endColumnIndex = Coordinate::columnIndexFromString($endColumn) - 1;
|
||||
$newEndColumn = Coordinate::stringFromColumnIndex($endColumnIndex);
|
||||
|
||||
// Generate the new range (e.g., "A1:F75" instead of "A1:G75")
|
||||
$newDataRange = "{$startColumn}{$startRow}:{$newEndColumn}{$endRow}";
|
||||
// $sheet->getStyle($newDataRange)->getBorders()->getAllBorders()->setBorderStyle(Border::BORDER_THIN);
|
||||
}
|
||||
|
||||
$lastRow = count($lead_data) + 1;
|
||||
$leadRange = "A1:D{$lastRow}";
|
||||
|
||||
$sheet->getStyle($leadRange)->applyFromArray([
|
||||
'borders' => [
|
||||
'allBorders' => [
|
||||
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
|
||||
'color' => ['argb' => 'FF000000'], // Black color
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
// Set filename
|
||||
$string = ($type == 2) ? 'QCR' : 'RFQ';
|
||||
$filename = "{$string}_{$rfq_data['client_short_name']}_{$rfq_data['policy_type']}_" . date('YmdHis') . '.xlsx';
|
||||
@ -1405,10 +1642,11 @@ class LeadsController extends BaseController
|
||||
}
|
||||
|
||||
// dd($lead_data);
|
||||
$reply_to = $lead_data['created_person_email'];
|
||||
$reply_to = $lead_data['created_person_email'] ?? "";
|
||||
|
||||
//get file path to attach
|
||||
$file_info = $this->constructExcelToSaveTemp($lead_id, ($file_type == 'rfq' ? 1 : 2), $propsal_and_insurer);
|
||||
log_message('error','File Info'.json_encode($file_info));
|
||||
if ($lead_data['file_name'] != null && $lead_data['file_name'] != '') {
|
||||
$temp_file_path = $file_info['filePath'];
|
||||
$temp_file_name = $file_info['fileName'];
|
||||
@ -1422,8 +1660,11 @@ class LeadsController extends BaseController
|
||||
$result = ExcelMergeHelper::mergeExcelFiles($filePaths, $outputPath);
|
||||
// print_rr($result);
|
||||
}
|
||||
}else{
|
||||
$result = $file_info['filePath'];
|
||||
// return $this->respond(['status' => 'fail', 'code' => 200, 'messgae' => 'File Not Found'], 200);
|
||||
}
|
||||
// print_rr($lead_data);
|
||||
// print_rr($result); die;
|
||||
// print_rr($file_info);
|
||||
// $file_path = WRITEPATH."uploads/excel/sample/correction.xls";
|
||||
// $file_name = $file_type.'.xlsx';
|
||||
@ -1478,8 +1719,10 @@ class LeadsController extends BaseController
|
||||
$message = str_replace("{{DURATION}}", calculate_days_bw_dates($lead_data['policy_end_date'] ?? "", $lead_data['policy_start_date'] ?? "")->days, $message) ?? '--';
|
||||
|
||||
// print_rr($message);calculate_days_bw_dates
|
||||
$string = implode(", ", $cc_mails);
|
||||
$bcc_string = implode(", ", $bcc_mails);
|
||||
|
||||
$res = MailHelper::send_email(['mail' => $recipient['email'], 'cc' => $cc_mails, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_mails]);
|
||||
$res = MailHelper::send_email(['mail' => $recipient['email'], 'cc' => $string, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_string]);
|
||||
// !dd($res);
|
||||
$result_data[] = ['mail' => $recipient['email'], 'status' => $res];
|
||||
}
|
||||
@ -2036,54 +2279,112 @@ class LeadsController extends BaseController
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
public function transformMailContent($lead_id)
|
||||
// public function transformMailContent($lead_id, $page_name)
|
||||
// {
|
||||
// helper('excel_util_helper');
|
||||
// // $params = $this->request->getGet();
|
||||
|
||||
// // print_r($params); die;
|
||||
// // $lead_id = $params['lead_id'];
|
||||
// // $file_type = $params['file_type']; //rfq or qcr
|
||||
// // $recipient_type = $params['recipient_type']; //insurer or client or internal or placement
|
||||
// // $recipient_mail = $params['recipient_mail']; // - only primary key of contacts
|
||||
// // $propsal_and_insurer = isset($params['proposal_insurer']) ? $params['proposal_insurer'] : null;
|
||||
|
||||
// // if ($recipient_type == 'insurer' && empty($recipient_mail)) {
|
||||
// // return $this->respond(['status' => 'failed', 'code' => 400, 'data' => '', 'messgae' => 'Recipient mail not found ! '], 200);
|
||||
// // }
|
||||
|
||||
// //gather lead info
|
||||
// $lead_data = $this->leadsModel
|
||||
// ->select('leads.*,policy_type.long_name,policy_type.policy_type,user_profiles.email as created_person_email')
|
||||
// ->join('policy_type', 'leads.policy_type_id = policy_type.id', 'left')
|
||||
// ->join('user_profiles', 'leads.created_by = user_profiles.id', 'left')
|
||||
// ->where('leads.id', $lead_id)
|
||||
// ->first();
|
||||
|
||||
// // dd($lead_data);
|
||||
|
||||
// if($lead_data){
|
||||
|
||||
// $recipient_data = ['name' => "Team"];
|
||||
// // $original_message = '<div style="width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9;font-family:Arial,sans-serif;color:#333;line-height:1.6"><div style=background-color:#4a90e2;color:#fff;padding:15px;text-align:center><h1 style=margin:0;font-size:24px>Request for Quotation (RFQ)</h1></div><div style=padding:20px;background-color:#fff><h2 style=color:#4a90e2;font-size:20px;margin-top:0>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2 style=color:#4a90e2;font-size:20px;margin-top:20px>RFQ Details</h2><table style=width:100%;border-collapse:collapse;margin-top:20px><tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Client name<td style="border:1px solid #ddd;padding:10px;text-align:left">{{CLIENT_NAME}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Coverage Type<td style="border:1px solid #ddd;padding:10px;text-align:left">{{POLICY_LONG_NAME}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Policy Start Date<td style="border:1px solid #ddd;padding:10px;text-align:left">{{POLICY_START_DATE}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Policy Duration<td style="border:1px solid #ddd;padding:10px;text-align:left">{{DURATION}}</table><div style="margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic">Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div style=margin-top:20px;font-size:12px;color:#777;text-align:center><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
|
||||
// $original_message = `Dear Sir,
|
||||
|
||||
// Greetings From Nhance India!
|
||||
|
||||
// Please find attached the RFQ for {{POLICY_TYPE}} policy pertaining to {{RECIPIENT_NAME}}
|
||||
// Kindly request you to share the competitive quotes at the earliest
|
||||
// In case of any query, Please feel free to contact us.
|
||||
// Thank You !`;
|
||||
|
||||
// $message = $original_message;
|
||||
// $message = str_replace("{{RECIPIENT_NAME}}", $lead_data['client_name'], $message);
|
||||
// $message = str_replace("{{POLICY_LONG_NAME}}", $lead_data['long_name'] ?? $lead_data['policy_type'], $message);
|
||||
// $message = str_replace("{{POLICY_TYPE}}", $lead_data['policy_type'], $message);
|
||||
// $message = str_replace("{{RFQ_OR_QCR}}", $page_name, $message);
|
||||
|
||||
// $message = str_replace("{{CLIENT_NAME}}", $lead_data['client_name'], $message);
|
||||
// $message = str_replace("{{POLICY_START_DATE}}", change_date_format($lead_data['policy_start_date'], 'Y-m-d', 'd-m-Y'), $message);
|
||||
// $message = str_replace("{{DURATION}}", calculate_days_bw_dates($lead_data['policy_end_date'] ?? "", $lead_data['policy_start_date'] ?? "")->days, $message) ?? '--';
|
||||
|
||||
// dd($message);
|
||||
// // return $this->respond(['status' => true, 'code' => 200, 'data' => $message], 200);
|
||||
// return $message;
|
||||
|
||||
// }else{
|
||||
|
||||
// // return $this->respond(['status' => false, 'code' => 404, 'message' => "This lead has not data"], 200);
|
||||
// return '';
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// }
|
||||
|
||||
public function transformMailContent($lead_data, $mail_content, $page_name)
|
||||
{
|
||||
helper('excel_util_helper');
|
||||
// $params = $this->request->getGet();
|
||||
$current_year = date('Y');
|
||||
$next_year = $current_year + 1;
|
||||
$policy_year = "$current_year-$next_year";
|
||||
|
||||
// print_r($params); die;
|
||||
// $lead_id = $params['lead_id'];
|
||||
// $file_type = $params['file_type']; //rfq or qcr
|
||||
// $recipient_type = $params['recipient_type']; //insurer or client or internal or placement
|
||||
// $recipient_mail = $params['recipient_mail']; // - only primary key of contacts
|
||||
// $propsal_and_insurer = isset($params['proposal_insurer']) ? $params['proposal_insurer'] : null;
|
||||
if ($lead_data) {
|
||||
|
||||
// Replacing placeholders with actual values
|
||||
$message = $mail_content;
|
||||
$message = str_replace("{{CLIENT_NAME}}", $lead_data['client_name'] ?? "Valued Client", $message);
|
||||
$message = str_replace("{{POLICY_LONG_NAME}}", $lead_data['long_name'] ?? $lead_data['policy_type'] ?? "Insurance Policy", $message);
|
||||
$message = str_replace("{{POLICY_TYPE}}", $lead_data['policy_type'] ?? "Insurance Policy", $message);
|
||||
$message = str_replace("{{RFQ_OR_QCR}}", $page_name, $message);
|
||||
$message = str_replace("{{POLICY_YEAR}}", $policy_year, $message);
|
||||
|
||||
// if ($recipient_type == 'insurer' && empty($recipient_mail)) {
|
||||
// return $this->respond(['status' => 'failed', 'code' => 400, 'data' => '', 'messgae' => 'Recipient mail not found ! '], 200);
|
||||
// }
|
||||
|
||||
//gather lead info
|
||||
$lead_data = $this->leadsModel
|
||||
->select('leads.*,policy_type.long_name,policy_type.policy_type,user_profiles.email as created_person_email')
|
||||
->join('policy_type', 'leads.policy_type_id = policy_type.id', 'left')
|
||||
->join('user_profiles', 'leads.created_by = user_profiles.id', 'left')
|
||||
->where('leads.id', $lead_id)
|
||||
->first();
|
||||
|
||||
// dd($lead_data);
|
||||
|
||||
if($lead_data){
|
||||
|
||||
$recipient_data = ['name' => "Team"];
|
||||
$original_message = '<div style="width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9;font-family:Arial,sans-serif;color:#333;line-height:1.6"><div style=background-color:#4a90e2;color:#fff;padding:15px;text-align:center><h1 style=margin:0;font-size:24px>Request for Quotation (RFQ)</h1></div><div style=padding:20px;background-color:#fff><h2 style=color:#4a90e2;font-size:20px;margin-top:0>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2 style=color:#4a90e2;font-size:20px;margin-top:20px>RFQ Details</h2><table style=width:100%;border-collapse:collapse;margin-top:20px><tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Client name<td style="border:1px solid #ddd;padding:10px;text-align:left">{{CLIENT_NAME}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Coverage Type<td style="border:1px solid #ddd;padding:10px;text-align:left">{{POLICY_LONG_NAME}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Policy Start Date<td style="border:1px solid #ddd;padding:10px;text-align:left">{{POLICY_START_DATE}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Policy Duration<td style="border:1px solid #ddd;padding:10px;text-align:left">{{DURATION}}</table><div style="margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic">Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div style=margin-top:20px;font-size:12px;color:#777;text-align:center><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
|
||||
|
||||
$message = $original_message;
|
||||
$message = str_replace("{{RECIPIENT_NAME}}", $recipient_data['name'], $message);
|
||||
$message = str_replace("{{CLIENT_NAME}}", $lead_data['client_name'], $message);
|
||||
$message = str_replace("{{POLICY_LONG_NAME}}", $lead_data['long_name'], $message);
|
||||
$message = str_replace("{{POLICY_START_DATE}}", change_date_format($lead_data['policy_start_date'], 'Y-m-d', 'd-m-Y'), $message);
|
||||
$message = str_replace("{{DURATION}}", calculate_days_bw_dates($lead_data['policy_end_date'] ?? "", $lead_data['policy_start_date'] ?? "")->days, $message) ?? '--';
|
||||
|
||||
// return $this->respond(['status' => true, 'code' => 200, 'data' => $message], 200);
|
||||
return $message;
|
||||
|
||||
}else{
|
||||
|
||||
// return $this->respond(['status' => false, 'code' => 404, 'message' => "This lead has not data"], 200);
|
||||
return '';
|
||||
} else {
|
||||
return ''; // Return empty if no lead data found
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function getLastFiveFinancialYears() {
|
||||
$currentYear = date('Y');
|
||||
$currentMonth = date('m');
|
||||
|
||||
// In India, the financial year starts from April (04)
|
||||
if ($currentMonth < 4) {
|
||||
$currentYear--; // Adjust year if it's Jan-Mar
|
||||
}
|
||||
|
||||
$financialYears = [];
|
||||
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$startYear = $currentYear - $i - 1;
|
||||
$endYear = $currentYear - $i;
|
||||
$financialYears[] = "$startYear-$endYear";
|
||||
}
|
||||
|
||||
return $financialYears;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ class NotificationController extends AdminController
|
||||
// This function for sent a mail for testing
|
||||
public function sentTestMail($template_id, $test_mail)
|
||||
{
|
||||
$notification_data = $this->notificationModel->where('id', $template_id)->where('enabled', 1)->first();
|
||||
$notification_data = $this->notificationModel->where('id', $template_id)->first();
|
||||
$client_data = $this->clientModel->where('id', $notification_data['client_id'])->where('is_active', 1)->first();
|
||||
|
||||
if(!empty($notification_data)){
|
||||
|
||||
@ -33,6 +33,7 @@ class TicketController extends BaseController
|
||||
protected $claimType;
|
||||
protected $claimStatus;
|
||||
protected $placeHolders;
|
||||
protected $extraFields;
|
||||
|
||||
protected $clientModel;
|
||||
protected $ticketMasterModel;
|
||||
@ -73,7 +74,8 @@ class TicketController extends BaseController
|
||||
1 => "In Person",
|
||||
2 => "Courier",
|
||||
3 => "Online Mode - Email",
|
||||
4 => "Online Mode - To TPA"
|
||||
4 => "Smart Service Desk",
|
||||
5 => "Direct to TPA"
|
||||
];
|
||||
$this->claimType = [
|
||||
1 => [
|
||||
@ -111,6 +113,30 @@ class TicketController extends BaseController
|
||||
'((POLICY_TYPE))' => 'policy_type',
|
||||
'((AUTO_QUERY_CONTENT))' => 'auto_query_content',
|
||||
];
|
||||
$this->extraFields = [
|
||||
|
||||
3 => ['raised_date'],
|
||||
4 => ['raised_date'],
|
||||
5 => ['claim_number', 'registration_date'],
|
||||
7 => ['query_received_date'],
|
||||
8 => ['denial_reason','denial_date'],
|
||||
9 => ['approved_amount','approved_date', 'approved_letter'],
|
||||
11 => ['utr_details', 'settled_date', 'settle_letter'],
|
||||
40 => ['approved_amount','approved_date', 'approved_letter'],
|
||||
44 => ['utr_details', 'settled_date', 'settle_letter'],
|
||||
30 => ['approved_amount','approved_date', 'approved_letter'],
|
||||
34 => ['utr_details', 'settled_date', 'settle_letter'],
|
||||
20 => ['approved_amount','approved_date', 'approved_letter'],
|
||||
24 => ['utr_details', 'settled_date', 'settle_letter'],
|
||||
14 => ['return_remark', 'awb_no_courier_name'],
|
||||
48 => ['return_remark', 'awb_no_courier_name'],
|
||||
59 => ['return_remark', 'awb_no_courier_name'],
|
||||
54 => ['return_remark', 'awb_no_courier_name'],
|
||||
13 => ['cancel_remark'],
|
||||
47 => ['cancel_remark'],
|
||||
53 => ['cancel_remark'],
|
||||
58 => ['cancel_remark'],
|
||||
];
|
||||
|
||||
$this->ticketMasterModel = new TicketMasterModel();
|
||||
$this->claimStatus = new TicketClaimStatusModel();
|
||||
@ -124,10 +150,10 @@ class TicketController extends BaseController
|
||||
}
|
||||
|
||||
public function ticketList()
|
||||
{
|
||||
{
|
||||
$data['ticket_type'] = $this->ticketType;
|
||||
if ($this->request->is('get')) {
|
||||
$data['page_name'] = "Claims";
|
||||
$data['ticket_type'] = $this->ticketType;
|
||||
$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();
|
||||
$data['ticket_data'] = $this->ticketSearch(1);
|
||||
@ -182,6 +208,9 @@ class TicketController extends BaseController
|
||||
$query = $db->table('ticket_master tm')
|
||||
->select([
|
||||
'tm.id',
|
||||
'tm.ticket_type_id',
|
||||
'tm.claim_status_id',
|
||||
'tm.is_head_approved',
|
||||
'tcs.claim_status AS status',
|
||||
'tm.claim_number AS claim_no',
|
||||
'tm.tpa_id',
|
||||
@ -219,8 +248,11 @@ class TicketController extends BaseController
|
||||
$query = $db->table('ticket_master tm')
|
||||
->select([
|
||||
'tm.id',
|
||||
'tm.ticket_type_id',
|
||||
'tcs.claim_status AS status',
|
||||
'tm.claim_number AS claim_no',
|
||||
'tm.claim_status_id',
|
||||
'tm.is_head_approved',
|
||||
'tm.tpa_id',
|
||||
'tm.emp_name',
|
||||
'i.name AS insurer_name',
|
||||
@ -254,7 +286,7 @@ class TicketController extends BaseController
|
||||
return $this->loadLayout('ticket_form_handler', $data);
|
||||
}
|
||||
|
||||
public function ticket_form_data($ticket_type)
|
||||
public function ticket_form_data($ticket_type, $claim_status_id = null)
|
||||
{
|
||||
$this->myLogger->logme('error', "Fetching ticket form data for Ticket Type: $ticket_type");
|
||||
|
||||
@ -288,11 +320,23 @@ class TicketController extends BaseController
|
||||
->getResultArray();
|
||||
|
||||
// Fetch Claim Status
|
||||
$data['claim_status'] = $this->claimStatus
|
||||
->select('*')
|
||||
->where(['is_active' => 1, 'ticket_type' => $ticket_type])
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
if(empty($claim_status_id)){
|
||||
|
||||
if($ticket_type == 2){
|
||||
$claim_status_id = 15;
|
||||
}else if($ticket_type == 3){
|
||||
$claim_status_id = 25;
|
||||
}else if($ticket_type == 4){
|
||||
$claim_status_id = 35;
|
||||
}else{
|
||||
$claim_status_id = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$data['claim_status'] = $this->transFormClaimStatus($claim_status_id, $ticket_type);
|
||||
$data['extra_fields'] = $this->getExtraFields($data['claim_status']);
|
||||
$data['extra_fields_array_for_validate'] = $this->getExtraFields($data['claim_status'], 1);
|
||||
|
||||
if ($ticket_type == 1) {
|
||||
$data['claim_type'] = $this->claimType[1];
|
||||
@ -305,6 +349,73 @@ class TicketController extends BaseController
|
||||
return $data;
|
||||
}
|
||||
|
||||
//transform the claim status
|
||||
public function transFormClaimStatus($claimStatusId, $ticket_type)
|
||||
{
|
||||
// Fetch the main claim status by ID
|
||||
$claimStatusData = $this->claimStatus
|
||||
->select('*')
|
||||
->where(['is_active' => 1, 'ticket_type' => $ticket_type])
|
||||
->where('id', $claimStatusId)
|
||||
->first();
|
||||
// dd($claimStatusData);
|
||||
|
||||
// Initialize the filtered claim status array
|
||||
$filteredClaimStatus = [];
|
||||
|
||||
if (!empty($claimStatusData)) {
|
||||
// Add the main claim status to the result
|
||||
$filteredClaimStatus[] = $claimStatusData;
|
||||
|
||||
// Decode the allowed_status JSON field
|
||||
$filterClaimStatusIds = json_decode($claimStatusData['allowed_status'], true);
|
||||
|
||||
// Fetch additional claim statuses if IDs exist
|
||||
if (!empty($filterClaimStatusIds) && is_array($filterClaimStatusIds)) {
|
||||
$additionalClaimStatuses = $this->claimStatus
|
||||
->select('*')
|
||||
->where(['is_active' => 1, 'ticket_type' => $ticket_type])
|
||||
->whereIn('id', $filterClaimStatusIds)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
// Merge additional claim statuses into the result
|
||||
$filteredClaimStatus = array_merge($filteredClaimStatus, $additionalClaimStatuses);
|
||||
}
|
||||
}
|
||||
|
||||
return $filteredClaimStatus;
|
||||
}
|
||||
|
||||
public function getExtraFields(array $claimStatus, $nonFilterArray = 0): array
|
||||
{
|
||||
$extra_fields = [];
|
||||
|
||||
if($nonFilterArray == 1){
|
||||
|
||||
foreach ($claimStatus as $value) {
|
||||
if (isset($this->extraFields[$value['id']])) {
|
||||
if (!isset($extra_fields[$value['id']])) {
|
||||
$extra_fields[$value['id']] = [];
|
||||
}
|
||||
$extra_fields[$value['id']] = array_merge($extra_fields[$value['id']], $this->extraFields[$value['id']]);
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
foreach ($claimStatus as $value) {
|
||||
if (isset($this->extraFields[$value['id']])) {
|
||||
$extra_fields[] = $this->extraFields[$value['id']];
|
||||
}
|
||||
}
|
||||
|
||||
$extra_fields = array_values(array_unique(array_merge(...$extra_fields)));
|
||||
}
|
||||
|
||||
return $extra_fields;
|
||||
}
|
||||
|
||||
public function view_ticket($ticket_id)
|
||||
{
|
||||
// $ticket_data = $this->ticketMasterModel->where('id', $ticket_id)->where('is_active', 1)->first();
|
||||
@ -316,7 +427,7 @@ class TicketController extends BaseController
|
||||
$template_data['mail_content'] = $this->replacePlaceholders($template_data['mail_content'], $ticket_data);
|
||||
$template_data['subject'] = $this->replacePlaceholders($template_data['subject'], $ticket_data);
|
||||
}
|
||||
$data = $this->ticket_form_data($ticket_data['ticket_type_id']);
|
||||
$data = $this->ticket_form_data($ticket_data['ticket_type_id'], $ticket_data['claim_status_id']);
|
||||
$data['ticket_data'] = $ticket_data;
|
||||
$data['reply_data'] = $template_data;
|
||||
$data['placeHolders'] = $this->placeHolders;
|
||||
@ -324,6 +435,7 @@ class TicketController extends BaseController
|
||||
$data['view_ticket_page'] = [];
|
||||
$data['member_data'] = $this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']);
|
||||
$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();
|
||||
// dd($data);
|
||||
|
||||
return $this->loadLayout('ticket_edit_onbording', $data);
|
||||
@ -380,6 +492,42 @@ class TicketController extends BaseController
|
||||
$ticket_data['date_of_intimat'] = change_date_format($ticket_data['date_of_intimat'], null, $out_put_format);
|
||||
}
|
||||
|
||||
if (empty($ticket_data['raised_date'])) {
|
||||
$ticket_data['raised_date'] = null;
|
||||
} else {
|
||||
$ticket_data['raised_date'] = change_date_format($ticket_data['raised_date'], null, $out_put_format);
|
||||
}
|
||||
|
||||
if (empty($ticket_data['registration_date'])) {
|
||||
$ticket_data['registration_date'] = null;
|
||||
} else {
|
||||
$ticket_data['registration_date'] = change_date_format($ticket_data['registration_date'], null, $out_put_format);
|
||||
}
|
||||
|
||||
if (empty($ticket_data['query_received_date'])) {
|
||||
$ticket_data['query_received_date'] = null;
|
||||
} else {
|
||||
$ticket_data['query_received_date'] = change_date_format($ticket_data['query_received_date'], null, $out_put_format);
|
||||
}
|
||||
|
||||
if (empty($ticket_data['denial_date'])) {
|
||||
$ticket_data['denial_date'] = null;
|
||||
} else {
|
||||
$ticket_data['denial_date'] = change_date_format($ticket_data['denial_date'], null, $out_put_format);
|
||||
}
|
||||
|
||||
if (empty($ticket_data['approved_date'])) {
|
||||
$ticket_data['approved_date'] = null;
|
||||
} else {
|
||||
$ticket_data['approved_date'] = change_date_format($ticket_data['approved_date'], null, $out_put_format);
|
||||
}
|
||||
|
||||
if (empty($ticket_data['settled_date'])) {
|
||||
$ticket_data['settled_date'] = null;
|
||||
} else {
|
||||
$ticket_data['settled_date'] = change_date_format($ticket_data['settled_date'], null, $out_put_format);
|
||||
}
|
||||
|
||||
return $ticket_data;
|
||||
}
|
||||
|
||||
@ -387,6 +535,7 @@ class TicketController extends BaseController
|
||||
{
|
||||
$ticket_data = $this->request->getPost();
|
||||
$ticket_data = $this->formatDateForClaim($ticket_data);
|
||||
// $ticket_data = $this->getLastMatchedStatus($ticket_data, );
|
||||
// print_rr($ticket_data); die;
|
||||
|
||||
if ($ticket_data) {
|
||||
@ -408,6 +557,7 @@ class TicketController extends BaseController
|
||||
$ticket_id = $this->request->getPost('ticket_master_id');
|
||||
$ticket_data = $this->request->getPost();
|
||||
$ticket_data = $this->formatDateForClaim($ticket_data);
|
||||
$ticket_data['claim_status_id'] = $this->getLastMatchedStatus($ticket_data);
|
||||
// print_rr($ticket_data); die;
|
||||
$old_ticket_data = $this->ticketMasterModel->where('id', $ticket_id)->where('is_active', 1)->first();
|
||||
|
||||
@ -418,6 +568,15 @@ class TicketController extends BaseController
|
||||
//mail trigger part
|
||||
$mail_responce = $this->sendAutoMailTrigger($ticket_id);
|
||||
|
||||
//send mail to the head for rejected ticket approvel
|
||||
if($ticket_data['claim_status_id'] == 8 && $ticket_data['is_head_approved'] == 0){
|
||||
$this->sendMailToTheHead($ticket_data);
|
||||
}else{
|
||||
$this->myLogger->logme('error', "Head Mail can't be sent");
|
||||
$this->myLogger->logme('error', "CLAIM STATUS ID : {data}", ['data' => $ticket_data['claim_status_id']]);
|
||||
$this->myLogger->logme('error', "IS HEAD APPROVED : {data}", ['data' => $ticket_data['is_head_approved']]);
|
||||
}
|
||||
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $ticket_data, "message" => "Claim updated successfully", 'mail_responce' => $mail_responce], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to update claim'], 200);
|
||||
@ -640,7 +799,7 @@ class TicketController extends BaseController
|
||||
} else if ($value == "policy_type") {
|
||||
$replaceData = str_replace("Claim-", "", $this->ticketType[$ticket_data['ticket_type_id']] ?? "");
|
||||
} else {
|
||||
$replaceData = strtoupper($ticket_data[$value]) ?? '';
|
||||
$replaceData = isset($ticket_data[$value]) ? strtoupper($ticket_data[$value]) : '';
|
||||
}
|
||||
|
||||
$content = str_replace($key, $replaceData, $content);
|
||||
@ -657,6 +816,7 @@ class TicketController extends BaseController
|
||||
{
|
||||
$this->myLogger->logme('error', "Sending email with content");
|
||||
if (!empty($mail_content)) {
|
||||
$mail_content['from_mail'] = "claims@nhanceindia.in";
|
||||
$response = MailHelper::send_email($mail_content);
|
||||
} else {
|
||||
$response = ['status' => false, 'code' => 404, 'message' => "Mail not sent, mail data empty"];
|
||||
@ -1135,4 +1295,94 @@ class TicketController extends BaseController
|
||||
// return $result;
|
||||
// }
|
||||
|
||||
|
||||
// function for Reject ticket Head Approvel mail sent function
|
||||
public function sendMailToTheHead($ticket_data)
|
||||
{
|
||||
$this->myLogger->logme('error', "sendMailToTheHead Function Called");
|
||||
if(!empty($ticket_data)){
|
||||
|
||||
// print_r($ticket_data); die;
|
||||
|
||||
$head_mail = $this->employeeModel
|
||||
->select('user_profiles.email')
|
||||
->join('clients', 'employees.client_id = clients.id')
|
||||
->join('client_rm', 'clients.id = client_rm.client_id')
|
||||
->join('user_profiles', 'client_rm.user_id = user_profiles.id')
|
||||
->where('employees.is_active', 1)
|
||||
->where('client_rm.is_active', 1)
|
||||
->where('client_rm.level', 1)
|
||||
->where('employees.id', $ticket_data['emp_id'])
|
||||
->first();
|
||||
|
||||
if(!empty($head_mail)){
|
||||
|
||||
$template_data = $this->ticketMailTemplateModel
|
||||
->where('ticket_mail_template.ticket_type', 0)
|
||||
->where('ticket_mail_template.trigger_type', 0)
|
||||
->first();
|
||||
|
||||
if(!empty($template_data)){
|
||||
|
||||
$subject = $this->replacePlaceholders($template_data['subject'], $ticket_data);
|
||||
$message = $this->replacePlaceholders($template_data['mail_content'], $ticket_data);
|
||||
|
||||
$emailData = [
|
||||
'mail' => $head_mail['email'],
|
||||
'subject' => $subject,
|
||||
'message' => $message,
|
||||
'common' => [],
|
||||
];
|
||||
|
||||
$this->sendTrigger($emailData);
|
||||
|
||||
}else{
|
||||
$this->myLogger->logme('error', "Head Mail can't be sent because Template data is empty");
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
$this->myLogger->logme('error', "Head Mail can't be sent because head mail is empty");
|
||||
}
|
||||
|
||||
}else{
|
||||
$this->myLogger->logme('error', "Head Mail can't be sent because ticket data is empty");
|
||||
}
|
||||
}
|
||||
|
||||
public function getLastMatchedStatus($incoming_form_values)
|
||||
{
|
||||
if (empty($incoming_form_values) || !isset($incoming_form_values['claim_status_id']) || !isset($incoming_form_values['extra_fields_array_for_validate'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$lastMatchedStatus = $incoming_form_values['claim_status_id'];
|
||||
|
||||
// Use the provided `extra_fields_array_for_validate` from the incoming data
|
||||
$statusMapping = json_decode($incoming_form_values['extra_fields_array_for_validate']);
|
||||
|
||||
foreach ($statusMapping as $status => $requiredFields) {
|
||||
// Ensure requiredFields is an array
|
||||
if (!is_array($requiredFields)) {
|
||||
$requiredFields = [$requiredFields];
|
||||
}
|
||||
|
||||
// Check if all required fields exist and are not empty in the incoming form values
|
||||
$allFieldsMatched = true;
|
||||
foreach ($requiredFields as $field) {
|
||||
if (!isset($incoming_form_values[$field]) || empty($incoming_form_values[$field])) {
|
||||
$allFieldsMatched = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Update the last matched status if all fields are validated
|
||||
if ($allFieldsMatched) {
|
||||
$lastMatchedStatus = $status;
|
||||
}
|
||||
}
|
||||
|
||||
return $lastMatchedStatus;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -9,21 +9,30 @@ use App\Models\EmployeePolicyModel;
|
||||
use App\Models\TPAModel;
|
||||
|
||||
use App\Helpers\MailHelper;
|
||||
use App\Models\InsurerModel;
|
||||
use App\Models\TicketMasterModel;
|
||||
|
||||
use App\Controllers\TicketController;
|
||||
|
||||
class ChatbotHelper
|
||||
{
|
||||
|
||||
//get list of policies againest an employee_id
|
||||
public static function getListOfPolicies()
|
||||
public static function getListOfPolicies($chat_session_info)
|
||||
{
|
||||
|
||||
$emp_id = 12288;
|
||||
$emp_code = 'HTL-007';
|
||||
$client_id = 159;
|
||||
$policy_id = 0;
|
||||
$client_branch_id = 126;
|
||||
$relationship ='Father';
|
||||
// $emp_id = 12288;
|
||||
// $emp_code = 'HTL-007';
|
||||
// $client_id = 159;
|
||||
// $policy_id = 0;
|
||||
// $client_branch_id = 126;
|
||||
$emp_id = $chat_session_info['emp_id'];
|
||||
$emp_code = $chat_session_info['emp_code'];
|
||||
$client_id = $chat_session_info['client_id'];
|
||||
$client_branch_id = $chat_session_info['client_branch_id'];
|
||||
// $relationship ='Father';
|
||||
$EmployeeModel = new EmployeeModel();
|
||||
return $EmployeeModel->getEmpFamilybyEmpCode(emp_code: $emp_code,client_id: $client_id,emp_status: ['draft'],policy_status:['draft'],client_branch_id:[ $client_branch_id ],relationship:[$relationship]);
|
||||
return $EmployeeModel->getEmpFamilybyEmpCode(emp_code: $emp_code,client_id: $client_id,emp_status: ['draft'],policy_status:['draft'],client_branch_id:[ $client_branch_id ]);//,relationship:[$relationship];
|
||||
}
|
||||
|
||||
public static function getHospitalLink($client_policy_id){
|
||||
@ -35,41 +44,20 @@ class ChatbotHelper
|
||||
return is_array($res) && count($res) ? $res[0]['network_hospitals'] : null;
|
||||
}
|
||||
|
||||
public static function getPhoneNumber(){
|
||||
$emp_id = 12288;
|
||||
public static function getPhoneNumber($chat_session_info){
|
||||
$emp_id = $chat_session_info['emp_id'];
|
||||
$EmployeeModel = new EmployeeModel();
|
||||
return $EmployeeModel->select('mobile')->where('id',$emp_id)->first()['mobile'];
|
||||
}
|
||||
|
||||
public static function get_payload_data(string $key = null)
|
||||
public static function sendReimbursementProcessOverMail($chat_session_info)
|
||||
{
|
||||
// Get the request object using the service helper
|
||||
$request = service('request');
|
||||
|
||||
// Get the raw input (JSON or other data)
|
||||
$rawInput = $request->getBody();
|
||||
|
||||
// Check if the raw input is valid JSON
|
||||
$payload = json_decode($rawInput, true);
|
||||
|
||||
if (json_last_error() === JSON_ERROR_NONE) {
|
||||
// JSON is valid, return the requested key or the entire payload
|
||||
return $key ? ($payload[$key] ?? null) : $payload;
|
||||
} else {
|
||||
// JSON is invalid, fallback to raw input or POST data
|
||||
$payload = $request->getRawInput() ?: $request->getPost();
|
||||
return $key ? ($payload[$key] ?? null) : $payload;
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendReimbursementProcessOverMail()
|
||||
{
|
||||
$emp_id = 12288;
|
||||
$emp_code = 'HTL-007';
|
||||
$client_id = 159;
|
||||
$policy_id = 0;
|
||||
$client_branch_id = 126;
|
||||
$relationship ='Father';
|
||||
$emp_id = $chat_session_info['emp_id'];
|
||||
$emp_code = $chat_session_info['emp_code'];
|
||||
$client_id = $chat_session_info['client_id'];
|
||||
$client_branch_id = $chat_session_info['client_branch_id'];
|
||||
// $policy_id = 0;
|
||||
// $relationship ='Father';
|
||||
$EmployeeModel = new EmployeeModel();
|
||||
$data = $EmployeeModel->find($emp_id);
|
||||
if(isset($data) && isset($data['email_corporate']))
|
||||
@ -202,6 +190,378 @@ class ChatbotHelper
|
||||
return $template;
|
||||
}
|
||||
|
||||
public static function getInsurersList(){
|
||||
$insurer = new InsurerModel();
|
||||
$data = $insurer->select('short_name,name')->where('category','general')->where('is_active',1)->findAll();
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function sendQuotationRequestMail($data){
|
||||
|
||||
$message = SELF::quotationRequestMailTemplate($data);
|
||||
|
||||
$common = ['mail_type'=>'request_quotation_bot'];
|
||||
$email_id = getenv('email.enquiryMail');
|
||||
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Quotation Request Received from bot.', 'message' => $message,'common'=>$common]);
|
||||
|
||||
$res = json_decode($res);
|
||||
log_message('error','res: '.json_encode($res));
|
||||
if($res->status == 'success')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function quotationRequestMailTemplate($data){
|
||||
$message = 'A customer has requested for a quotation using bot,Here are all the details for it:
|
||||
'.$data;
|
||||
return $message;
|
||||
}
|
||||
|
||||
public static function getReimbursementClaimStatus($chat_session_info){
|
||||
|
||||
$client_claim_status = [
|
||||
'Received' => [1,2,3,4],
|
||||
'Under Process' => [5,6,7,10],
|
||||
'Finished' => [9,11,12],
|
||||
'Rejected' => [8],
|
||||
'Cancelled' => [13,14]
|
||||
];
|
||||
$emp_id = $chat_session_info['emp_id'];
|
||||
log_message('error','emp_id'.$emp_id);
|
||||
$emp_code = $chat_session_info['emp_code'];
|
||||
$client_id = $chat_session_info['client_id'];
|
||||
$client_branch_id = $chat_session_info['client_branch_id'];
|
||||
|
||||
$ticketMaster = new TicketMasterModel();
|
||||
$data = $ticketMaster->select('tcs.id as tcs_id,tcs.claim_status,ticket_master.claim_number,ticket_master.id,ticket_master.emp_name,ticket_master.emp_mail')
|
||||
// ->join('client_policy cp',"cp.client_id = {$client_id} and cp.client_branch_id = {$client_branch_id} and cp.policy_id = {$policy_id} and cp.is_active = 1")
|
||||
->join('ticket_claim_status tcs',"ticket_master.claim_status_id = tcs.id and tcs.is_active = 1")
|
||||
->where('ticket_master.emp_id',$emp_id)
|
||||
->where('ticket_master.emp_code',$emp_code)
|
||||
->where('ticket_master.is_active',1)
|
||||
->orderBy('ticket_master.created_at', 'DESC')
|
||||
->first();
|
||||
$server_claim_status = $data['tcs_id'];
|
||||
$matched_key = null;
|
||||
foreach ($client_claim_status as $key => $statuses) {
|
||||
if (in_array($server_claim_status, $statuses)) {
|
||||
$matched_key = $key;
|
||||
break; // Stop loop once found
|
||||
}
|
||||
}
|
||||
|
||||
log_message('error','Data from ticket master'.json_encode($data));
|
||||
// print_r($data);
|
||||
// die();
|
||||
$ticket_controller = new TicketController();
|
||||
|
||||
if (!empty($data) && !empty($matched_key)){
|
||||
$ticket_id = $data['id'];
|
||||
$mail_content = Self::ReimbursementStatusMailTemplate($data['emp_name'],$data['claim_number'],$matched_key);
|
||||
$common = ['mail_type'=>'Claim Status'];
|
||||
$email_id = $data['emp_mail'];
|
||||
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Here is your claim status you requested in bot.', 'message' => $mail_content,'common'=>$common]);
|
||||
|
||||
$res = json_decode($res);
|
||||
log_message('error','res: '.json_encode($res));
|
||||
if($res->status == 'success')
|
||||
{
|
||||
$data['client_status'] = $matched_key;
|
||||
return $data;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function ReimbursementStatusMailTemplate($emp_name, $claim_number, $client_status) {
|
||||
$template = '
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
|
||||
|
||||
<head>
|
||||
<!--[if gte mso 9]>
|
||||
<xml>
|
||||
<o:OfficeDocumentSettings>
|
||||
<o:AllowPNG/>
|
||||
<o:PixelsPerInch>96</o:PixelsPerInch>
|
||||
</o:OfficeDocumentSettings>
|
||||
</xml>
|
||||
<![endif]-->
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="x-apple-disable-message-reformatting">
|
||||
<!--[if !mso]><!-->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"><!--<![endif]-->
|
||||
<title></title>
|
||||
|
||||
<style type="text/css">
|
||||
@media only screen and (min-width: 640px) {
|
||||
.u-row {
|
||||
width: 620px !important;
|
||||
}
|
||||
|
||||
.u-row .u-col {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
|
||||
.u-row .u-col-100 {
|
||||
width: 620px !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 640px) {
|
||||
.u-row-container {
|
||||
max-width: 100% !important;
|
||||
padding-left: 0px !important;
|
||||
padding-right: 0px !important;
|
||||
}
|
||||
|
||||
.u-row {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.u-row .u-col {
|
||||
display: block !important;
|
||||
width: 100% !important;
|
||||
min-width: 320px !important;
|
||||
max-width: 100% !important;
|
||||
}
|
||||
|
||||
.u-row .u-col>div {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
|
||||
.u-row .u-col img {
|
||||
max-width: 100% !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0
|
||||
}
|
||||
|
||||
table,
|
||||
td,
|
||||
tr {
|
||||
border-collapse: collapse;
|
||||
vertical-align: top
|
||||
}
|
||||
|
||||
.ie-container table,
|
||||
.mso-container table {
|
||||
table-layout: fixed
|
||||
}
|
||||
|
||||
* {
|
||||
line-height: inherit
|
||||
}
|
||||
|
||||
a[x-apple-data-detectors=true] {
|
||||
color: inherit !important;
|
||||
text-decoration: none !important
|
||||
}
|
||||
|
||||
|
||||
table,
|
||||
td {
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body class="clean-body u_body" style="margin: 0;padding: 0;-webkit-text-size-adjust: 100%;background-color: #F9F9F9;color: #000000">
|
||||
<!--[if IE]><div class="ie-container"><![endif]-->
|
||||
<!--[if mso]><div class="mso-container"><![endif]-->
|
||||
<table style="border-collapse: collapse;table-layout: fixed;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;vertical-align: top;min-width: 320px;Margin: 0 auto;background-color: #F9F9F9;width:100%" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr style="vertical-align: top">
|
||||
<td style="word-break: break-word;border-collapse: collapse !important;vertical-align: top">
|
||||
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" style="background-color: #F9F9F9;"><![endif]-->
|
||||
|
||||
|
||||
|
||||
<div class="u-row-container" style="padding: 0px;background-color: transparent">
|
||||
<div class="u-row" style="margin: 0 auto;min-width: 320px;max-width: 620px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: transparent;">
|
||||
<div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;">
|
||||
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: transparent;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:620px;"><tr style="background-color: transparent;"><![endif]-->
|
||||
|
||||
<!--[if (mso)|(IE)]><td align="center" width="620" style="width: 620px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;border-radius: 0px;-webkit-border-radius: 0px; -moz-border-radius: 0px;" valign="top"><![endif]-->
|
||||
<div class="u-col u-col-100" style="max-width: 320px;min-width: 620px;display: table-cell;vertical-align: top;">
|
||||
<div style="height: 100%;width: 100% !important;border-radius: 0px;-webkit-border-radius: 0px; -moz-border-radius: 0px;">
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
<div style="box-sizing: border-box; height: 100%; padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;border-radius: 0px;-webkit-border-radius: 0px; -moz-border-radius: 0px;"><!--<![endif]-->
|
||||
|
||||
<table style="font-family:times new roman,times;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="overflow-wrap:break-word;word-break:break-word;padding:10px;font-family:times new roman,times;" align="left">
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td style="padding-right: 0px;padding-left: 0px;" align="center">
|
||||
|
||||
<img align="center" border="0" src="https://assets.unlayer.com/projects/263979/1739609649412-nhance_logo.png?w=372px" alt="" title="" style="outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;clear: both;display: inline-block !important;border: none;height: auto;float: none;width: 31%;max-width: 186px;" width="186" />
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
</div><!--<![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
<!--[if (mso)|(IE)]></td><![endif]-->
|
||||
<!--[if (mso)|(IE)]></tr></table></td></tr></table><![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="u-row-container" style="padding: 0px;background-color: transparent">
|
||||
<div class="u-row" style="margin: 0 auto;min-width: 320px;max-width: 620px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: transparent;">
|
||||
<div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;">
|
||||
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: transparent;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:620px;"><tr style="background-color: transparent;"><![endif]-->
|
||||
|
||||
<!--[if (mso)|(IE)]><td align="center" width="620" style="width: 620px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;" valign="top"><![endif]-->
|
||||
<div class="u-col u-col-100" style="max-width: 320px;min-width: 620px;display: table-cell;vertical-align: top;">
|
||||
<div style="height: 100%;width: 100% !important;">
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
<div style="box-sizing: border-box; height: 100%; padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;"><!--<![endif]-->
|
||||
|
||||
<table style="font-family:times new roman,times;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="overflow-wrap:break-word;word-break:break-word;padding:10px;font-family:times new roman,times;" align="left">
|
||||
|
||||
<div style="font-size: 14px; line-height: 140%; text-align: left; word-wrap: break-word;">
|
||||
<p style="line-height: 140%; margin: 0px;"> </p>
|
||||
<p style="line-height: 140%; margin: 0px;">Dear [[member_name]],</p>
|
||||
<p style="line-height: 140%; margin: 0px;">Your Claim Number [[claim_number]] is currently in the <strong>[[status]]</strong> status with us.</p>
|
||||
<p style="line-height: 140%; margin: 0px;"> </p>
|
||||
<p style="line-height: 140%; margin: 0px;"> </p>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
</div><!--<![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
<!--[if (mso)|(IE)]></td><![endif]-->
|
||||
<!--[if (mso)|(IE)]></tr></table></td></tr></table><![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="u-row-container" style="padding: 0px;background-color: transparent">
|
||||
<div class="u-row" style="margin: 0 auto;min-width: 320px;max-width: 620px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: transparent;">
|
||||
<div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;">
|
||||
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: transparent;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:620px;"><tr style="background-color: transparent;"><![endif]-->
|
||||
|
||||
<!--[if (mso)|(IE)]><td align="center" width="620" style="width: 620px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;border-radius: 0px;-webkit-border-radius: 0px; -moz-border-radius: 0px;" valign="top"><![endif]-->
|
||||
<div class="u-col u-col-100" style="max-width: 320px;min-width: 620px;display: table-cell;vertical-align: top;">
|
||||
<div style="height: 100%;width: 100% !important;border-radius: 0px;-webkit-border-radius: 0px; -moz-border-radius: 0px;">
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
<div style="box-sizing: border-box; height: 100%; padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;border-radius: 0px;-webkit-border-radius: 0px; -moz-border-radius: 0px;"><!--<![endif]-->
|
||||
|
||||
<table style="font-family:times new roman,times;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="overflow-wrap:break-word;word-break:break-word;padding:10px;font-family:times new roman,times;" align="left">
|
||||
|
||||
<div>
|
||||
<img alt="Alternate image text" src="https://ci3.googleusercontent.com/meips/ADKq_NZ1tC_lDp1mJDJ6iwpQvycq0vGPIeb0bF_z4SVXl6h2csrbTBpjuVtXZuXhPHAIRyGfRvc30Y83qZtaXRsM4_p2B9-yGkYAS56f6UraLELku6bQTXbhUaAyXGeq8TndT-y0vuvSLRhMi8iS9xL62fcwJ8r-MqMCdiwLcvuYRFZHcWeuPmkC_ByeA0H0v3lVozfDHgTThXzpuzsfkMMhg4wcUoxWxVNg4GNkS9dv=s0-d-e1-ft#https://res.cloudinary.com/mailmodo/image/upload/v1731739899/editor/p/86755bd3-1482-4348-86df-ac4c01829407/93af6a8f9f9d7c81c28b1b51d9127cea_fv4fpe.gif" width="22" height="auto" class="CToWUd __web-inspector-hide-shortcut__" data-bit="iit" style="border: 0px solid transparent; height: auto; line-height: 13px; outline: 0px; text-decoration: none; object-fit: cover; border-radius: 0px; display: block; width: 21.9907px; font-size: 13px; margin-left: auto; margin-right: auto;">
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table style="font-family:times new roman,times;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="overflow-wrap:break-word;word-break:break-word;padding:10px;font-family:times new roman,times;" align="left">
|
||||
|
||||
<div style="font-size: 14px; line-height: 140%; text-align: center; word-wrap: break-word;">
|
||||
<p style="line-height: 140%; margin: 0px;">ⓒ2024 Nhance India Insurance Broking Pvt Ltd</p>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
</div><!--<![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
<!--[if (mso)|(IE)]></td><![endif]-->
|
||||
<!--[if (mso)|(IE)]></tr></table></td></tr></table><![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<!--[if mso]></div><![endif]-->
|
||||
<!--[if IE]></div><![endif]-->
|
||||
</body>
|
||||
|
||||
</html>
|
||||
';
|
||||
|
||||
// Replace placeholders with actual values
|
||||
$replacedTemplate = str_replace(
|
||||
['[[member_name]]', '[[claim_number]]', '[[status]]'],
|
||||
[$emp_name, $claim_number, $client_status],
|
||||
$template
|
||||
);
|
||||
|
||||
return $replacedTemplate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -63,6 +63,7 @@ class DepositHelper
|
||||
'updated_by' => $data['updated_by'],
|
||||
'balance' => $newBalance, // Include the new balance in the data array
|
||||
'cd_ac_pk'=> isset($data['cd_ac_pk'])?$data['cd_ac_pk']:null,
|
||||
'record_date' => $data['record_date'] ?? null
|
||||
];
|
||||
|
||||
// Insert data and get the insert ID
|
||||
|
||||
@ -304,7 +304,8 @@ class MailHelper
|
||||
$bcc = isset($params['bcc']) ? $params['bcc'] : '';
|
||||
$cc = isset($params['cc']) ? $params['cc'] : '';
|
||||
|
||||
$from_address = getenv('email.fromEmail');
|
||||
$from_address = isset($params['from_mail']) && !empty($params['from_mail']) ? $params['from_mail'] : getenv('email.fromEmail');
|
||||
// $from_address = "claims@nhanceindia.in";
|
||||
try {
|
||||
$curl = curl_init();
|
||||
|
||||
|
||||
@ -234,7 +234,7 @@ if(!function_exists('check_si'))
|
||||
$is_si_found = false;
|
||||
$is_age_slab_found = false;
|
||||
|
||||
if($policy_details['policy_type_id'] == 1 && $slab_details['slab_rates'][0]['policy_grid_id'] == 1 && $slab_details['slab_rates'][0]['si_or_bp'] == 2) // GPA && grid type 1 for GPA && sub type is basic pay
|
||||
if(($policy_details['policy_type_id'] == 1 || $policy_details['policy_type_id'] == 6 || $policy_details['policy_type_id'] == 7) && $slab_details['slab_rates'][0]['policy_grid_id'] == 1 && $slab_details['slab_rates'][0]['si_or_bp'] == 2) // GPA && grid type 1 for GPA && sub type is basic pay
|
||||
{
|
||||
$is_si_found = true;
|
||||
$is_age_slab_found = true;
|
||||
@ -2173,20 +2173,21 @@ if(!function_exists('group_slab_rates_basedon_name'))
|
||||
|
||||
|
||||
//this key generating mandantory for display employee info in enrolment app w/o error
|
||||
if(!function_exists('generate_family_floater_key'))
|
||||
{
|
||||
if (!function_exists('generate_family_floater_key')) {
|
||||
function generate_family_floater_key($relationship)
|
||||
{
|
||||
if (strtolower(trim($relationship)) === 'mother' || strtolower(trim($relationship)) === 'father') {
|
||||
$relation = 'parent';
|
||||
} else if(strtolower(trim($relationship)) === 'son' || strtolower(trim($relationship)) === 'daughter'){
|
||||
$relation = 'child';
|
||||
}else if(strtolower(trim($relationship)) === 'father in Law' || strtolower(trim($relationship)) === 'mother in Law'){
|
||||
$relation = 'parent_in_law';
|
||||
}else if(strtolower(trim($relationship)) === 'spouse'){
|
||||
$relation = 'spouse';
|
||||
}else{
|
||||
$relation = 'self';
|
||||
}
|
||||
$relation = 'parent';
|
||||
} else if (strtolower(trim($relationship)) === 'son' || strtolower(trim($relationship)) === 'daughter') {
|
||||
$relation = 'child';
|
||||
} else if (strtolower(trim($relationship)) === 'father in Law' || strtolower(trim($relationship)) === 'mother in Law') {
|
||||
$relation = 'parent_in_law';
|
||||
} else if (strtolower(trim($relationship)) === 'spouse') {
|
||||
$relation = 'spouse';
|
||||
} else {
|
||||
$relation = 'self';
|
||||
}
|
||||
|
||||
return $relation;
|
||||
}
|
||||
}
|
||||
@ -49,13 +49,13 @@ class sendMailNotification
|
||||
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
|
||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
||||
$mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content);
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $employee_name, $mail_content);
|
||||
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $employee_mobile_no, $mail_content);
|
||||
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
if ($dataToInsert['relationship'] == 'Self' && $mail != null || $mail != '') {
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'attachments' => $attachments, 'common' => $common];
|
||||
}
|
||||
@ -77,16 +77,16 @@ class sendMailNotification
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
|
||||
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
|
||||
|
||||
$employee_name =$emp_data['name'];
|
||||
$employee_mobile_no =$emp_data['mobile'];
|
||||
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
||||
$mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content);
|
||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $employee_name, $mail_content);
|
||||
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $employee_mobile_no, $mail_content);
|
||||
$mail = $emp_data['email_corporate'];
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common];
|
||||
@ -128,16 +128,17 @@ class sendMailNotification
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
// $client_logo = $nhance_logo;
|
||||
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
|
||||
$mail_content = str_replace("[[member_name]]", $name, $mail_content);
|
||||
$mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content);
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace("[[post_enrollment_app_link]]", "<a href='$post_enrollment_app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name, $mail_content);
|
||||
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $employee_mobile_no, $mail_content);
|
||||
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[post_enrollment_app_link]]", "{{post_enrollment_app_link}}"], "<a href='$post_enrollment_app_link'>Review Details</a>", $mail_content);
|
||||
// $mail_content = str_replace("[[tpa_id]]", $tpa_id, $mail_content);
|
||||
$mail_content = str_replace("[[ecard_download_link]]", "<a href='$link/1'>Download Insurance Card</a>", $mail_content);
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace(["[[ecard_download_link]]", "{{ecard_download_link}}"], "<a href='$link/1'>Download Insurance Card</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common];
|
||||
|
||||
return $wholeData;
|
||||
@ -172,11 +173,11 @@ class sendMailNotification
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
// $client_logo = $nhance_logo;
|
||||
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
|
||||
// Step 1: Replace the placeholder with an HTML table structure
|
||||
$mail = '';
|
||||
@ -518,9 +519,9 @@ class sendMailNotification
|
||||
// dd($payable_employee_array, $Addon_list);
|
||||
// print_r($table_content); die;
|
||||
|
||||
$mail_content = str_replace("[[member_name]]", $name . ' (' . $emp_code . ')' , $mail_content);
|
||||
$mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content);
|
||||
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name . ' (' . $emp_code . ')' , $mail_content);
|
||||
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $employee_mobile_no, $mail_content);
|
||||
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content , $mail_content);
|
||||
|
||||
// print_r($mail_content); die;
|
||||
|
||||
@ -570,11 +571,11 @@ class sendMailNotification
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
// $client_logo = $nhance_logo;
|
||||
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
|
||||
// Step 1: Replace the placeholder with an HTML table structure
|
||||
$mail = '';
|
||||
@ -816,16 +817,16 @@ class sendMailNotification
|
||||
}
|
||||
|
||||
|
||||
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
||||
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content , $mail_content);
|
||||
|
||||
$account_manager_mail_list = [];
|
||||
if(isset($user_list)){
|
||||
foreach ($user_list as $key => $value) {
|
||||
$full_name = $value['first_name'] .' ' .$value['last_name'];
|
||||
$mail_content = str_replace("[[member_name]]", $full_name , $mail_content);
|
||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $full_name , $mail_content);
|
||||
|
||||
$wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to'], 'common' => $common];
|
||||
// $wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
||||
// $wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'}};
|
||||
}
|
||||
return $wholeData;
|
||||
}
|
||||
@ -868,11 +869,11 @@ class sendMailNotification
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
// $client_logo = $nhance_logo;
|
||||
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
|
||||
// Step 1: Replace the placeholder with an HTML table structure
|
||||
$mail = '';
|
||||
@ -1115,7 +1116,7 @@ class sendMailNotification
|
||||
// $table_content .= '<div style="width:100%; text-align:right; font-size: 12px;">' . $sum_total_words . '</div>';
|
||||
}
|
||||
|
||||
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
||||
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content , $mail_content);
|
||||
|
||||
|
||||
$hr_mails = $client_data['hr_mails'];
|
||||
@ -1124,7 +1125,7 @@ class sendMailNotification
|
||||
$wholeData = [];
|
||||
foreach ($mail_array as $key => $value) {
|
||||
$wholeData[] = ['mail' => $value, 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to'], 'common' => $common];
|
||||
// $wholeData[] = ['mail' => $value, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
||||
// $wholeData[] = ['mail' => $value, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'}};
|
||||
}
|
||||
|
||||
return $wholeData;
|
||||
@ -1173,13 +1174,13 @@ class sendMailNotification
|
||||
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
|
||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
||||
$mail_content = str_replace("[[member_mobile]]", $mobile, $mail_content);
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $employee_name, $mail_content);
|
||||
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $mobile, $mail_content);
|
||||
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
|
||||
if ($mail != null || $mail != '') {
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'attachments' => $attachments];
|
||||
@ -1204,11 +1205,12 @@ class sendMailNotification
|
||||
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace("[[member_mobile]]", $mobile, $mail_content);
|
||||
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $employee_name, $mail_content);
|
||||
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $mobile, $mail_content);
|
||||
|
||||
if ((isset($notification_data) && $notification_data['enabled'] == 1)) {
|
||||
|
||||
@ -1256,15 +1258,15 @@ class sendMailNotification
|
||||
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
|
||||
$mail_content = str_replace("[[member_name]]", $name, $mail_content);
|
||||
$mail_content = str_replace("[[member_mobile]]", $mobile, $mail_content);
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace("[[post_enrollment_app_link]]", "<a href='$post_enrollment_app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace("[[ecard_download_link]]", "<a href='$link/1'>Download Insurance Card</a>", $mail_content);
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name, $mail_content);
|
||||
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $mobile, $mail_content);
|
||||
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[post_enrollment_app_link]]", "{{post_enrollment_app_link}}"], "<a href='$post_enrollment_app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[ecard_download_link]]", "{{ecard_download_link}}"], "<a href='$link/1'>Download Insurance Card</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'],'attachments' => $attachments, 'reply_to' => $client_data['reply_to']];
|
||||
|
||||
@ -1301,11 +1303,11 @@ class sendMailNotification
|
||||
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
|
||||
// Step 1: Replace the placeholder with an HTML table structure
|
||||
$table_content = '';
|
||||
@ -1413,9 +1415,9 @@ class sendMailNotification
|
||||
}
|
||||
}
|
||||
|
||||
$mail_content = str_replace("[[member_name]]", $name . ' (' . $emp_code . ')' , $mail_content);
|
||||
$mail_content = str_replace("[[member_mobile]]", $mobile, $mail_content);
|
||||
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name . ' (' . $emp_code . ')' , $mail_content);
|
||||
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $mobile, $mail_content);
|
||||
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content , $mail_content);
|
||||
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']];
|
||||
@ -1453,11 +1455,11 @@ class sendMailNotification
|
||||
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
|
||||
// Step 1: Replace the placeholder with an HTML table structure
|
||||
$table_content = '';
|
||||
@ -1563,8 +1565,8 @@ class sendMailNotification
|
||||
}
|
||||
}
|
||||
|
||||
$mail_content = str_replace("[[member_name]]", $name . ' (' . $emp_code . ')' , $mail_content);
|
||||
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name . ' (' . $emp_code . ')' , $mail_content);
|
||||
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content , $mail_content);
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to']];
|
||||
|
||||
@ -1600,11 +1602,11 @@ class sendMailNotification
|
||||
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
|
||||
// Step 1: Replace the placeholder with an HTML table structure
|
||||
$table_content = '';
|
||||
@ -1712,8 +1714,8 @@ class sendMailNotification
|
||||
}
|
||||
}
|
||||
|
||||
$mail_content = str_replace("[[member_name]]", $name . ' (' . $emp_code . ')' , $mail_content);
|
||||
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name . ' (' . $emp_code . ')' , $mail_content);
|
||||
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content , $mail_content);
|
||||
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to']];
|
||||
|
||||
@ -183,6 +183,23 @@ if (!function_exists('user_team')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_chatbot_session_info')) {
|
||||
function get_chatbot_session_info()
|
||||
{
|
||||
// $CI =& get_instance();
|
||||
$session = \Config\Services::session();
|
||||
return [
|
||||
'emp_id' => $session->get('CHATBOT_EMP_ID'),
|
||||
'origin' => $session->get('CHATBOT_ORIGIN'),
|
||||
'emp_code' => $session->get('CHATBOT_EMP_CODE'),
|
||||
'client_id' => $session->get('CHATBOT_CLIENT_ID'),
|
||||
'chatbot_random_user_id' => $session->get('CHATBOT_RANDOM_USER_ID'),
|
||||
'client_branch_id' => $session->get('CHATBOT_CLIENT_BRANCH_ID'),
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,8 @@ class ClientDepositModel extends Model
|
||||
"endorsement_no",
|
||||
"event_name",
|
||||
"unit",
|
||||
"cd_ac_pk"
|
||||
"cd_ac_pk",
|
||||
"record_date"
|
||||
];
|
||||
|
||||
|
||||
|
||||
@ -886,7 +886,6 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
emp_code,
|
||||
group_key,
|
||||
MAX(CASE WHEN field_name = 'emp_status' THEN new_value END) AS empstatus,
|
||||
MAX(CASE WHEN field_name = 'change_event' THEN new_value END) AS changeevent,
|
||||
@ -902,7 +901,7 @@ class EmployeePolicyModel extends Model
|
||||
group_key
|
||||
|
||||
) AS deletiondata
|
||||
ON a.emp_code = deletiondata.emp_code AND a.status != 'truncated'
|
||||
ON a.group_key = deletiondata.group_key AND a.status != 'truncated'
|
||||
|
||||
LEFT JOIN
|
||||
(
|
||||
@ -1682,7 +1681,10 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
// reverse the employee policy table data for the truncated the deletion file
|
||||
public function updateEmployeePolicyTruncateReverse($file_id)
|
||||
{
|
||||
{
|
||||
log_message('error', 'updateEmployeePolicyTruncateReverse model function called');
|
||||
log_message('error', 'FILE ID : {data}', ['data' => $file_id]);
|
||||
|
||||
$this->db->query("
|
||||
UPDATE employee_polices
|
||||
SET
|
||||
@ -1690,7 +1692,7 @@ class EmployeePolicyModel extends Model
|
||||
status = 'active',
|
||||
date_of_exit = NULL,
|
||||
reason_for_exit = NULL,
|
||||
claim_status = 0,
|
||||
claim_status = 0
|
||||
WHERE
|
||||
id IN (
|
||||
SELECT pk
|
||||
@ -1747,11 +1749,11 @@ class EmployeePolicyModel extends Model
|
||||
}
|
||||
|
||||
public function getHospitalLinkByPolicyandEmp($client_policy_id){
|
||||
$data = $this->db->table('employee_polices')
|
||||
$data = $this->db->table('client_policy')
|
||||
->select('tpa.network_hospitals')
|
||||
->where('client_policy_id', $client_policy_id)
|
||||
->where('employee_polices.is_active', 1)
|
||||
->join('tpa', 'tpa.id = employee_polices.tpa_id AND tpa.is_active = 1')
|
||||
->where('client_policy.id', $client_policy_id)
|
||||
// ->where('employee_polices.is_active', 1)
|
||||
->join('tpa', 'tpa.id = client_policy.tpa_id AND tpa.is_active = 1')
|
||||
// ->join('employees', 'employees.id = employee_polices.employee_id AND employees.id = ' . (int) $emp_id)
|
||||
->get()->getResultArray();
|
||||
|
||||
|
||||
@ -120,10 +120,10 @@ class LeadsModel extends Model
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getLeadDataForLising()
|
||||
public function getLeadDataForLising($where = null)
|
||||
{
|
||||
|
||||
return $this->select('
|
||||
$data = $this->select('
|
||||
leads.*,
|
||||
kyc_entity_type.name as entity_type,
|
||||
policy_type.policy_type,
|
||||
@ -144,13 +144,16 @@ class LeadsModel extends Model
|
||||
|
||||
) AS rfq_count
|
||||
')
|
||||
->join('kyc_entity_type', 'leads.entity_type_id = kyc_entity_type.id', 'left')
|
||||
->join('user_profiles', 'leads.salse_person_id = user_profiles.id', 'left')
|
||||
->join('policy_type', 'leads.policy_type_id = policy_type.id', 'left')
|
||||
->where('leads.is_active', 1)
|
||||
->orderBy('id', 'desc')
|
||||
->findAll();
|
||||
->join('kyc_entity_type', 'leads.entity_type_id = kyc_entity_type.id', 'left')
|
||||
->join('user_profiles', 'leads.salse_person_id = user_profiles.id', 'left')
|
||||
->join('policy_type', 'leads.policy_type_id = policy_type.id', 'left')
|
||||
->where('leads.is_active', 1);
|
||||
|
||||
if (!empty($where)) {
|
||||
$data->where($where);
|
||||
}
|
||||
|
||||
return $data->orderBy('leads.id', 'desc')->findAll();
|
||||
}
|
||||
|
||||
public function getLeadForInsertClientList($type = null, $client_id = null)
|
||||
|
||||
@ -77,6 +77,7 @@ class RFQModel extends Model
|
||||
->where('rfq.lead_id', $lead_id)
|
||||
// ->where('rfq.type', $type)
|
||||
->where('rfq.is_active', 1)
|
||||
->orderBy('rfq.id', 'desc')
|
||||
->first();
|
||||
|
||||
}
|
||||
|
||||
@ -51,7 +51,25 @@ class TicketMasterModel extends Model
|
||||
'claim_number',
|
||||
'emp_id',
|
||||
'insured_emp_id',
|
||||
];
|
||||
|
||||
'raised_date',
|
||||
'registration_date',
|
||||
'query_received_date',
|
||||
'denial_date',
|
||||
'approved_date',
|
||||
'settled_date',
|
||||
'denial_reason',
|
||||
'approved_letter',
|
||||
'approved_amount',
|
||||
'utr_details',
|
||||
'settle_letter',
|
||||
'is_head_approved',
|
||||
|
||||
'return_remark',
|
||||
'cancel_remark',
|
||||
'awb_no_courier_name',
|
||||
|
||||
];
|
||||
|
||||
|
||||
// Callbacks
|
||||
@ -105,14 +123,20 @@ class TicketMasterModel extends Model
|
||||
public function getTemplateDataByTicketID($ticket_id)
|
||||
{
|
||||
$template_data = $this
|
||||
->select("ticket_mail_template.*, ticket_master.emp_mail,ticket_master.claim_status_id")
|
||||
->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', '
|
||||
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();
|
||||
|
||||
return $template_data;
|
||||
@ -122,6 +146,11 @@ class TicketMasterModel extends Model
|
||||
{
|
||||
$ticket_data = $this->select("
|
||||
ticket_master.*,
|
||||
CASE
|
||||
WHEN employees.email_corporate IS NULL OR employees.email_corporate = ''
|
||||
THEN ticket_master.emp_mail
|
||||
ELSE employees.email_corporate
|
||||
END as emp_mail,
|
||||
|
||||
user_profiles.first_name as acm,
|
||||
user_profiles.mobile as acm_mobile,
|
||||
@ -139,6 +168,7 @@ class TicketMasterModel extends Model
|
||||
->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('user_profiles', 'ticket_master.acm_id = user_profiles.id', 'left')
|
||||
->join('employees','employees.id = ticket_master.emp_id','left')
|
||||
->where('ticket_master.id', $ticket_id)
|
||||
->where('ticket_master.is_active', 1)
|
||||
->first();
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
// mainColor: "#5C6BC0",
|
||||
// bubbleBackground: "#673AB7"
|
||||
// };
|
||||
var emp_name = 'Kumar';
|
||||
var uid = Math.floor(100000 + Math.random() * 900000);
|
||||
console.log('CURRENT_USER' + uid);
|
||||
var botmanWidget = {
|
||||
@ -35,12 +36,12 @@
|
||||
enableAttachments: false,
|
||||
// Add extra parameters
|
||||
parameters: {
|
||||
employee_id: '1234655', //PK of emp
|
||||
employee_id: '12288', //PK of emp
|
||||
session_id: "XYZ789", // token
|
||||
origin: "mobile", // origin
|
||||
emp_code:"EMP001",
|
||||
client_id:10,
|
||||
client_branch_id:12
|
||||
emp_code:"HTL-007",
|
||||
client_id:159,
|
||||
client_branch_id:125
|
||||
}
|
||||
};
|
||||
|
||||
@ -62,12 +63,12 @@
|
||||
if (window.botmanWidget) {
|
||||
botmanChatWidget.open();
|
||||
setTimeout(function(){
|
||||
botmanChatWidget.sayAsBot('Hi user '+ uid +' ,This is ILA your Insurance AI Assistant, plz choose the following options')
|
||||
botmanChatWidget.whisper('hi');
|
||||
},2000);
|
||||
botmanChatWidget.sayAsBot('Hi '+ emp_name +',This is ILA your Insurance Assistant, plz choose the following options')
|
||||
botmanChatWidget.whisper('Hi');
|
||||
},3000);
|
||||
|
||||
}
|
||||
}, 3000); // Delay to ensure widget is initialized
|
||||
}, 2000); // Delay to ensure widget is initialized
|
||||
});
|
||||
|
||||
|
||||
|
||||
@ -46,6 +46,38 @@
|
||||
|
||||
</style>
|
||||
|
||||
<style>
|
||||
/* Timeline Design */
|
||||
.timeline {
|
||||
position: relative;
|
||||
padding-left: 30px;
|
||||
border-left: 3px solid #007bff;
|
||||
}
|
||||
|
||||
.timeline-item {
|
||||
position: relative;
|
||||
margin-bottom: 20px;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.timeline-dot {
|
||||
position: absolute;
|
||||
left: -10px;
|
||||
top: 5px;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background: #007bff;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.timeline-content {
|
||||
background: #f8f9fa;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php $pro_rata_total = 0; $gst_total = 0 ?>
|
||||
|
||||
<div class="row" id="client_list">
|
||||
@ -154,6 +186,8 @@
|
||||
) {
|
||||
?>
|
||||
<a class="dropdown-item" onclick="get_emp_master_data_for_update(this, '<?= $employee['employee_id'];?>', '<?= $employee['status'];?>')" ><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a class="dropdown-item" onclick="get_emp_history(this, '<?= $employee['employee_id'];?>')" > <i class="mdi mdi-history mr-2 text-muted font-18 vertical-middle"></i>Employee History</a>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php if(in_array($employee['policy_type_id'], [2,3,4,5]) && $employee['emp_status'] == 'active' && $employee['status'] == 'active' && !empty($employee['tpa_id'])) { ?>
|
||||
@ -270,14 +304,30 @@
|
||||
</div>
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<!-- Modal content for Emp History -->
|
||||
<div class="modal fade" id="emp_history_modal" tabindex="-1" aria-labelledby="emp_history_modal_label" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="emp_history_modal_label">Employee History</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div id = "emp_history_content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
var dob = flatpickr("#dob", {
|
||||
dateFormat: "d/M/Y",
|
||||
allowInput: false
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false, // Allows manual input
|
||||
yearSelector: true, // Ensures year can be selected manually
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
$(document).ready(function() {
|
||||
@ -436,7 +486,8 @@
|
||||
$('#email_corporate').val('');
|
||||
$('#mobile').val('');
|
||||
|
||||
window.location.reload();
|
||||
// window.location.reload();
|
||||
fetchEmpolyeeList();
|
||||
|
||||
}else{
|
||||
toastr.error(response.message, 'ERROR');
|
||||
@ -534,4 +585,116 @@
|
||||
|
||||
}
|
||||
|
||||
function onlyNumbers(event) {
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
if (charcode >= 48 && charcode <= 57 || charcode == 46) return true;
|
||||
return false;
|
||||
}
|
||||
var modalInstance; // Store the modal instance globally
|
||||
|
||||
function showModal() {
|
||||
var myModalEl = document.getElementById('emp_history_modal');
|
||||
modalInstance = new bootstrap.Modal(myModalEl, {
|
||||
backdrop: true, // Ensures the backdrop is shown
|
||||
keyboard: true // Allows closing with the Escape key
|
||||
});
|
||||
modalInstance.show();
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
if (modalInstance) {
|
||||
modalInstance.hide(); // Hide the modal and its backdrop
|
||||
// Manually remove backdrop if it's still visible
|
||||
setTimeout(function () {
|
||||
document.querySelector('.modal-backdrop').classList.remove('show');
|
||||
}, 150); // Wait for animation to finish
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function get_emp_history(input, emp_id) {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
let url = '<?= base_url("employee/get_emp_history")?>';
|
||||
let requestData = { emp_id: emp_id };
|
||||
|
||||
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
if (response.status === true) {
|
||||
console.log('response data length', response.data.emp_history.length);
|
||||
|
||||
// **Clear old data**
|
||||
$('#emp_history_content').html('');
|
||||
|
||||
// **Check if data exists**
|
||||
if (response.data.emp_history.length > 0) {
|
||||
let historyTable = `
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table w-100">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<th>Change</th>
|
||||
<th>User</th>
|
||||
<th>Date/Time</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
`;
|
||||
|
||||
// **Loop through the data dynamically**
|
||||
response.data.emp_history.forEach(row => {
|
||||
historyTable += `
|
||||
<tr>
|
||||
<td>${row.field_name}</td>
|
||||
<td>${row.old_value} => ${row.new_value}</td>
|
||||
<td>${row.created_by}</td>
|
||||
<td>${row.created_at}</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
|
||||
historyTable += `
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
// **Append to modal**
|
||||
$('#emp_history_content').append(historyTable);
|
||||
} else {
|
||||
$('#emp_history_content').html('<p class="text-center text-muted">No history available.</p>');
|
||||
}
|
||||
|
||||
// **Show the modal**
|
||||
showModal();
|
||||
} else {
|
||||
let message = response.message;
|
||||
toastr.error(message, 'ERROR');
|
||||
}
|
||||
}, function(xhr, status, error) {
|
||||
console.error('Error fetching data:', error);
|
||||
console.error(xhr.responseText);
|
||||
toastr.error('An error occurred while fetching the report page.', 'ERROR');
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
});
|
||||
}
|
||||
|
||||
// function closeModal(){
|
||||
// var myModalEl = document.getElementById('emp_history_modal');
|
||||
// var modalInstance = bootstrap.Modal.getInstance(myModalEl);
|
||||
// if (modalInstance) {
|
||||
// modalInstance.hide();
|
||||
// }
|
||||
// }
|
||||
|
||||
</script>
|
||||
|
||||
@ -142,25 +142,98 @@ table.dataTable tbody td {
|
||||
<!-- end row -->
|
||||
<div id="loader" class="loader" style="display:none;">SPINNER</div>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const table = document.getElementById("tickets-table");
|
||||
// document.addEventListener("DOMContentLoaded", function () {
|
||||
// const table = document.getElementById("tickets-table");
|
||||
|
||||
// Create custom dropdown
|
||||
function createCustomDropdown(row) {
|
||||
// Get the original dropdown items
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
// // Create custom dropdown
|
||||
// function createCustomDropdown(row) {
|
||||
// // Get the original dropdown items
|
||||
// const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
// if (!originalDropdown) return null;
|
||||
|
||||
// Create new dropdown with proper background and spacing
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
// // Create new dropdown with proper background and spacing
|
||||
// const customDropdown = document.createElement('div');
|
||||
// customDropdown.className = 'custom-dropdown-menu';
|
||||
|
||||
// Copy inner content while maintaining icon alignment
|
||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
// // Copy inner content while maintaining icon alignment
|
||||
// customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
|
||||
return customDropdown;
|
||||
}
|
||||
// return customDropdown;
|
||||
// }
|
||||
|
||||
// let activeDropdown = null;
|
||||
|
||||
// // Add click event listener to rows
|
||||
// table.querySelectorAll("tbody tr").forEach(row => {
|
||||
// const customDropdown = createCustomDropdown(row);
|
||||
// if (!customDropdown) return;
|
||||
|
||||
// document.body.appendChild(customDropdown);
|
||||
|
||||
// row.addEventListener("click", function(event) {
|
||||
// // Ignore clicks on the action column
|
||||
// if (event.target.closest('td:last-child')) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // Hide any active dropdown
|
||||
// if (activeDropdown) {
|
||||
// activeDropdown.style.display = 'none';
|
||||
// }
|
||||
|
||||
// // Get click position
|
||||
// const rect = event.target.getBoundingClientRect();
|
||||
|
||||
// // Position the dropdown with some offset
|
||||
// customDropdown.style.display = 'block';
|
||||
// customDropdown.style.position = 'fixed';
|
||||
// customDropdown.style.left = `${rect.left}px`;
|
||||
// customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||
|
||||
// // Set as active dropdown
|
||||
// activeDropdown = customDropdown;
|
||||
|
||||
// event.stopPropagation();
|
||||
// });
|
||||
|
||||
// // Preserve click handlers and add auto-close
|
||||
// customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
// item.addEventListener('click', function(e) {
|
||||
// const onclickAttr = this.getAttribute('onclick');
|
||||
// if (onclickAttr) {
|
||||
// eval(onclickAttr);
|
||||
// }
|
||||
|
||||
// const href = this.getAttribute('href');
|
||||
// if (href && href !== '#') {
|
||||
// window.location.href = href;
|
||||
// }
|
||||
|
||||
// // Close the dropdown after handling the click
|
||||
// if (activeDropdown) {
|
||||
// activeDropdown.style.display = 'none';
|
||||
// activeDropdown = null;
|
||||
// }
|
||||
|
||||
// e.stopPropagation();
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
|
||||
// // Close dropdown when clicking outside
|
||||
// document.addEventListener("click", function() {
|
||||
// if (activeDropdown) {
|
||||
// activeDropdown.style.display = 'none';
|
||||
// activeDropdown = null;
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
document.addEventListener("DOMContentLoaded", init);
|
||||
|
||||
function init() {
|
||||
|
||||
const table = document.getElementById("tickets-table");
|
||||
let activeDropdown = null;
|
||||
|
||||
// Add click event listener to rows
|
||||
@ -171,63 +244,75 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
document.body.appendChild(customDropdown);
|
||||
|
||||
row.addEventListener("click", function(event) {
|
||||
// Ignore clicks on the action column
|
||||
if (event.target.closest('td:last-child')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Hide any active dropdown
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
}
|
||||
|
||||
// Get click position
|
||||
const rect = event.target.getBoundingClientRect();
|
||||
|
||||
// Position the dropdown with some offset
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||
|
||||
// Set as active dropdown
|
||||
activeDropdown = customDropdown;
|
||||
|
||||
event.stopPropagation();
|
||||
handleRowClick(event, customDropdown);
|
||||
});
|
||||
|
||||
// Preserve click handlers and add auto-close
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
}
|
||||
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#') {
|
||||
window.location.href = href;
|
||||
}
|
||||
|
||||
// Close the dropdown after handling the click
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
handleItemClick(e, item);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Close dropdown when clicking outside
|
||||
document.addEventListener("click", function() {
|
||||
document.addEventListener("click", handleDocumentClick);
|
||||
|
||||
function createCustomDropdown(row) {
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
|
||||
return customDropdown;
|
||||
}
|
||||
|
||||
function handleRowClick(event, customDropdown) {
|
||||
if (event.target.closest('td:last-child')) return;
|
||||
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
}
|
||||
|
||||
const rect = event.target.getBoundingClientRect();
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`;
|
||||
|
||||
activeDropdown = customDropdown;
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
function handleItemClick(e, item) {
|
||||
const onclickAttr = item.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
}
|
||||
|
||||
const href = item.getAttribute('href');
|
||||
if (href && href !== '#') {
|
||||
window.location.href = href;
|
||||
}
|
||||
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
function handleDocumentClick() {
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<script>
|
||||
|
||||
@ -469,8 +554,11 @@ function objectToQueryString(obj) {
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
}
|
||||
|
||||
function fetchEmpolyeeList(event) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
function fetchEmpolyeeList(event = null) {
|
||||
|
||||
if(event){
|
||||
event.preventDefault(); // Prevent default action
|
||||
}
|
||||
|
||||
var client_id = $('#clients').val();
|
||||
var policy_id = $('#policies').val();
|
||||
@ -505,6 +593,9 @@ function fetchEmpolyeeList(event) {
|
||||
// console.log(apiURL);
|
||||
// window.location.href = apiURL;
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
|
||||
// var apiURL2 = $('#get-emp-list').attr('href'); // Get href attribute value
|
||||
console.log(apiURL);
|
||||
@ -514,16 +605,19 @@ function fetchEmpolyeeList(event) {
|
||||
data: queryParams,
|
||||
success: function(response) {
|
||||
if(response.status == true){
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$('#employee_table_list').html(response.html);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
setTimeout(function(){
|
||||
init()
|
||||
}, 1000)
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error:', error);
|
||||
toastr.error('Failed to fetch Data','Error');
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
369
app/Views/lead_filter.php
Normal file
369
app/Views/lead_filter.php
Normal file
@ -0,0 +1,369 @@
|
||||
<style>
|
||||
.col-12 {
|
||||
max-width: 98% !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row" id="lead_filter_div">
|
||||
<div class="col-12" style="margin-top: -12px;">
|
||||
<div id="accordion" class="mb-3">
|
||||
<div class="card mb-1">
|
||||
<h5 class="m-1">
|
||||
<div class="row">
|
||||
<div class="col-md-6" style="position: relative;left: 17px;">
|
||||
<h4 style="text-align: left;">Lead Filter</h4>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<a style="text-align: right;" id="toggleIcon" class="text-dark float-right"
|
||||
data-toggle="collapse" href="#collapseOne" aria-expanded="true">
|
||||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary"
|
||||
style="font-size: 28px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</h5>
|
||||
<div id="collapseOne" class="collapse hide" aria-labelledby="headingOne" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="filter_issuer_type"> Issuer Type <span
|
||||
class="text-danger"></span></label>
|
||||
<select class="form-control" id="filter_issuer_type" name="filter_issuer_type">
|
||||
<option value="0">Select</option>
|
||||
<?php
|
||||
if (isset($issuer) && count($issuer)) {
|
||||
foreach ($issuer as $key => $value) {
|
||||
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="filter_lead_type"> Lead Type <span class="text-danger"></span></label>
|
||||
<select class="form-control" id="filter_lead_type" name="filter_lead_type">
|
||||
<option value="0">Select</option>
|
||||
<?php
|
||||
if (isset($lead_type) && count($lead_type)) {
|
||||
foreach ($lead_type as $key => $value) {
|
||||
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="filter_client_type"> Client Type <span
|
||||
class="text-danger"></span></label>
|
||||
<select class="form-control" id="filter_client_type" name="filter_client_type">
|
||||
<option value="0">Select</option>
|
||||
<?php
|
||||
if (isset($client_type) && count($client_type)) {
|
||||
foreach ($client_type as $key => $value) {
|
||||
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="filter_policy_type"> Policy Type <span
|
||||
class="text-danger"></span></label>
|
||||
<select class="form-control" id="filter_policy_type" name="filter_policy_type">
|
||||
<option value="0">Select</option>
|
||||
<?php
|
||||
if (isset($policy_type) && count($policy_type)) {
|
||||
foreach ($policy_type as $key => $value) {
|
||||
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="filter_client_id">Client<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="filter_client_id" name="filter_client_id">
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="filter_client_branch_id">Client Branch<span
|
||||
class="text-danger"></span></label>
|
||||
<select class="form-control" id="filter_client_branch_id"
|
||||
name="filter_client_branch_id">
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="filter_lead_status">Status<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="filter_lead_status" name="filter_lead_status">
|
||||
<option value="0">Select</option>
|
||||
<?php
|
||||
if (isset($lead_status) && count($lead_status)) {
|
||||
foreach ($lead_status as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12 text-right m-b-0" style="margin-bottom: -15px;">
|
||||
<a href="<?= base_url("/leads/list"); ?>" class="btn btn-secondary"
|
||||
id="clear-filters">Clear</a>
|
||||
<a class="btn btn-primary" id="get-emp-list"
|
||||
onclick="fetchTicketListData();">Submit</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- end page title -->
|
||||
<div id="lead_list_div">
|
||||
<?php include('leads_list.php'); ?>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
var filter_client_list = [];
|
||||
var filter_branch_list = [];
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#filter_client_id').select2();
|
||||
$('#filter_client_branch_id').select2();
|
||||
$('#filter_policy_type').select2();
|
||||
|
||||
getfilterClientAndBranch()
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#filter_client_id').change(function() {
|
||||
|
||||
let client_id = $(this).val();
|
||||
if (filter_branch_list != '') {
|
||||
// console.log(branch_list[client_id]);
|
||||
let data = filter_branch_list[client_id];
|
||||
appendfilterBranch(data);
|
||||
}
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
//----- AJAX FUNCTIONS --------------------------------------------------------------------------------
|
||||
|
||||
function fetchTicketListData() {
|
||||
|
||||
var issuer_type = $('#filter_issuer_type').val();
|
||||
var lead_type = $('#filter_lead_type').val();
|
||||
var policy_type = $('#filter_policy_type').val();
|
||||
var client_type = $('#filter_client_type').val();
|
||||
var status = $('#filter_lead_status').val();
|
||||
var client_id = $('#filter_client_id').val();
|
||||
var client_branch_id = $('#filter_client_branch_id').val();
|
||||
|
||||
var requestData = {
|
||||
issuer: issuer_type,
|
||||
lead_type: lead_type,
|
||||
policy_type_id: policy_type,
|
||||
client_type: client_type,
|
||||
status: status,
|
||||
client_id: client_id,
|
||||
client_branch_id: client_branch_id,
|
||||
};
|
||||
|
||||
console.log("requestData", requestData);
|
||||
|
||||
var url = '<?= base_url('/leads/list') ?>';
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
|
||||
|
||||
console.log('Filter Responce', response);
|
||||
|
||||
if (response.status == true) {
|
||||
|
||||
$('#lead_list_div').empty();
|
||||
$('#lead_list_div').html(response.html);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
setTimeout(function(){
|
||||
additionalDropdown();
|
||||
}, 1000);
|
||||
|
||||
} else {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
let message = response.message;
|
||||
toastr.error(message, 'ERROR');
|
||||
}
|
||||
|
||||
}, function(xhr, status, error) {
|
||||
console.error('Error fetching data:', error);
|
||||
console.error(xhr.responseText);
|
||||
toastr.error('An error occurred while fetching the data.', 'ERROR');
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
});
|
||||
}
|
||||
|
||||
//function for fetch client, branch
|
||||
function getfilterClientAndBranch() {
|
||||
$.ajax({
|
||||
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('getClientAndBranchAndPolicy', res);
|
||||
if (res.status == true) {
|
||||
filter_client_list = res.client_data;
|
||||
filter_branch_list = res.branch_data;
|
||||
appendfilterClients(res.client_data);
|
||||
} else {
|
||||
console.log('No data found');
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//----- END AJAX FUNCTIONS --------------------------------------------------------------------------------
|
||||
|
||||
|
||||
function appendfilterClients(data) {
|
||||
|
||||
$('#filter_client_id').empty();
|
||||
|
||||
$('#filter_client_id').append($('<option>', {
|
||||
value: 0,
|
||||
text: 'Select'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name,
|
||||
});
|
||||
|
||||
$('#filter_client_id').append(option);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function appendfilterBranch(data) {
|
||||
|
||||
$('#filter_client_branch_id').empty();
|
||||
|
||||
$('#filter_client_branch_id').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.branch_name
|
||||
});
|
||||
$('#filter_client_branch_id').append(option);
|
||||
});
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------
|
||||
|
||||
function additionalDropdown() {
|
||||
const table = document.getElementById("tickets-table");
|
||||
if (!table) return; // Prevent errors if the table is not found
|
||||
let activeDropdown = null;
|
||||
|
||||
function handleDropdownClick(row, event) {
|
||||
// Hide any active dropdown
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
}
|
||||
|
||||
let customDropdown = row.customDropdown;
|
||||
if (!customDropdown) {
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return;
|
||||
|
||||
customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
|
||||
document.body.appendChild(customDropdown);
|
||||
row.customDropdown = customDropdown;
|
||||
|
||||
// Preserve click handlers and add auto-close
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function (e) {
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) eval(onclickAttr);
|
||||
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#') window.location.href = href;
|
||||
|
||||
customDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
|
||||
e.stopPropagation();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Get click position
|
||||
const rect = event.target.getBoundingClientRect();
|
||||
|
||||
// Position the dropdown
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||
|
||||
activeDropdown = customDropdown;
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
// Add click event listener to rows
|
||||
table.querySelectorAll("tbody tr").forEach(row => {
|
||||
row.addEventListener("click", function (event) {
|
||||
if (!event.target.closest('td:last-child')) {
|
||||
handleDropdownClick(row, event);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Close dropdown when clicking outside
|
||||
document.addEventListener("click", function () {
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
File diff suppressed because it is too large
Load Diff
@ -127,7 +127,7 @@ table.dataTable tbody td {
|
||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>" onclick="getLeadsDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
</a>
|
||||
<a href="<?= base_url('/rfq/list/').$row['id'] . '/' . 1; ?>" class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>">
|
||||
<a href="<?= base_url('/rfq/list/').$row['id'] . '/' . 1; ?>" class="dropdown-item btnEdit2" data-id="<?= $row['id']; ?>">
|
||||
<i class="mdi mdi-note-text mr-2 text-muted font-18 vertical-middle"></i>RFQ
|
||||
</a>
|
||||
<!-- <?php if($row['qcr_count'] > 0) { ?>
|
||||
@ -163,25 +163,27 @@ table.dataTable tbody td {
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const table = document.getElementById("tickets-table");
|
||||
|
||||
// Create custom dropdown
|
||||
function createCustomDropdown(row) {
|
||||
// Get the original dropdown items
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
|
||||
// Create new dropdown with proper background and spacing
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
|
||||
// Copy inner content while maintaining icon alignment
|
||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
// Clone the items but remove their original click handlers
|
||||
const items = originalDropdown.querySelectorAll('.dropdown-item');
|
||||
items.forEach(item => {
|
||||
const newItem = item.cloneNode(true);
|
||||
// Preserve the attributes but remove the onclick
|
||||
newItem.removeAttribute('onclick');
|
||||
customDropdown.appendChild(newItem);
|
||||
});
|
||||
|
||||
return customDropdown;
|
||||
}
|
||||
|
||||
let activeDropdown = null;
|
||||
|
||||
// Add click event listener to rows
|
||||
table.querySelectorAll("tbody tr").forEach(row => {
|
||||
const customDropdown = createCustomDropdown(row);
|
||||
if (!customDropdown) return;
|
||||
@ -194,46 +196,54 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
return;
|
||||
}
|
||||
|
||||
// Hide any active dropdown
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
}
|
||||
|
||||
// Get click position
|
||||
const rect = event.target.getBoundingClientRect();
|
||||
|
||||
// Position the dropdown with some offset
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`;
|
||||
|
||||
// Set as active dropdown
|
||||
activeDropdown = customDropdown;
|
||||
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
// Preserve click handlers and add auto-close
|
||||
// Handle clicks on dropdown items
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
// Get the data-id and other attributes from the original button
|
||||
const originalItem = row.querySelector(`.dropdown-item[data-id="${this.getAttribute('data-id')}"]`);
|
||||
|
||||
// For edit functionality
|
||||
if (this.classList.contains('btnEdit')) {
|
||||
const id = this.getAttribute('data-id');
|
||||
if (id) {
|
||||
getLeadsDataForEdit(id);
|
||||
}
|
||||
}else{
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
}
|
||||
}
|
||||
|
||||
// For RFQ links
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#') {
|
||||
if (href && href !== '#' && !this.classList.contains('btnEdit')) {
|
||||
window.location.href = href;
|
||||
}
|
||||
|
||||
// Close the dropdown after handling the click
|
||||
// Close the dropdown
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -280,7 +290,7 @@ $(document).ready(function(){
|
||||
|
||||
$('#client_id').select2();
|
||||
$('#client_branch_id').select2();
|
||||
$('#source_policy_id').select2();
|
||||
// $('#source_policy_id').select2();
|
||||
$('#salse_person_id').select2({
|
||||
placeholder: "Select Salse Person",
|
||||
});
|
||||
@ -326,12 +336,14 @@ $(document).ready(function() {
|
||||
function hide_list_show_add()
|
||||
{
|
||||
$('#leads_list').hide()
|
||||
$('#lead_filter_div').hide()
|
||||
$('#leads_form').show()
|
||||
}
|
||||
|
||||
function show_list_hide_add()
|
||||
{
|
||||
$('#leads_list').show()
|
||||
$('#lead_filter_div').show()
|
||||
$('#leads_form').hide()
|
||||
}
|
||||
|
||||
@ -435,10 +447,12 @@ $(document).ready(function(){
|
||||
let client_id = $(this).val();
|
||||
let client_type = $('#client_id option:selected').data('ct');
|
||||
|
||||
if(branch_list != '' && client_id != '') {
|
||||
if(branch_list[client_id] != '' && branch_list[client_id] != null && client_id != '') {
|
||||
console.log('branch_list', branch_list[client_id]);
|
||||
let data = branch_list[client_id];
|
||||
appendBranch(data);
|
||||
}else{
|
||||
toastr.warning("No Branch Found for the selected Client",'Warning');
|
||||
}
|
||||
|
||||
})
|
||||
@ -447,10 +461,12 @@ $(document).ready(function(){
|
||||
|
||||
let client_branch_id = $(this).val();
|
||||
|
||||
if(policy_list != '' && client_branch_id != '') {
|
||||
if(policy_list[client_branch_id] != '' && policy_list[client_branch_id] != null && client_branch_id != ''&& client_branch_id != null) {
|
||||
console.log('policy_list', policy_list[client_branch_id]);
|
||||
let data = policy_list[client_branch_id];
|
||||
appendRenewalPolicies(data);
|
||||
}else{
|
||||
toastr.warning("No Policies Found for the selected Branch",'Warning');
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
@ -1395,7 +1395,7 @@
|
||||
console.log("Creating new editor instance...");
|
||||
editor = unlayer.createEditor({
|
||||
id: `${template_name}_editor_container`,
|
||||
projectId: 263979,
|
||||
projectId: <?=getenv('unlayer.projectID') ?>,
|
||||
displayMode: "email",
|
||||
features: {
|
||||
textEditor: {
|
||||
@ -1972,4 +1972,52 @@
|
||||
});
|
||||
}
|
||||
}
|
||||
$(document).on('click', '#notification_enable_form_submit', function() {
|
||||
var formData = [];
|
||||
console.log($('#hr_mail_id').val());
|
||||
|
||||
formData.push({name:'client_id', value: $('#general_PrimaryKey').val()})
|
||||
formData.push({ name: 'nhance_team_mail_ids', value: $('#nhance_team_mail_ids').val() });
|
||||
formData.push({ name: 'hr_mail_id', value: $('#hr_mail_id').val() });
|
||||
formData.push({ name: 'mail_domain', value: $('#mail_domain').val() });
|
||||
formData.push({ name: 'reply_to', value: $('#reply_to').val() });
|
||||
formData.push({ name: 'member_welcome_mail_btn', value: $('#member_welcome_mail_btn').prop('checked') });
|
||||
formData.push({ name: 'member_reminder_mail_btn', value: $('#member_reminder_mail_btn').prop('checked') });
|
||||
formData.push({ name: 'member_ecard_mail_btn', value: $('#member_ecard_mail_btn').prop('checked') });
|
||||
formData.push({ name: 'member_review_and_summary_mail_btn', value: $('#member_review_and_summary_mail_btn').prop('checked') });
|
||||
formData.push({ name: 'account_maneger_summary_mail_btn', value: $('#account_maneger_summary_mail_btn').prop('checked') });
|
||||
formData.push({ name: 'client_hr_summary_mail_btn', value: $('#client_hr_summary_mail_btn').prop('checked') });
|
||||
|
||||
var form_action = '<?= base_url("client/notification/update_enable") ?>';
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(res)
|
||||
{
|
||||
console.log(res);
|
||||
if (res)
|
||||
{
|
||||
toastr.success('Update Successfully');
|
||||
}
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
},
|
||||
error: function (xhr, status, error)
|
||||
{
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function()
|
||||
{
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
</script>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -7,36 +7,49 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<!-- <label for="ticket_auto_query_note">Add Notes</label> -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-12">
|
||||
<select id="ticket_mail_auto_query_customButton" class="form-control"
|
||||
style="border:none;right: 13px;width: auto;position: absolute;z-index: 1;top: -19px;height: 32px;float: right;">
|
||||
<option value="">Documents</option>
|
||||
<?php foreach ($ticket_check_list as $value): ?>
|
||||
<option value="<?= $value['document']; ?>"><?= $value['document']; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<textarea class="form-control" id="ticket_auto_query_note" name="note" rows="3"
|
||||
placeholder="Enter Text"><?= isset($ticket_note['note']) ? $ticket_note['note'] : '' ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div><input type="hidden" id="query_note_id"><input type="hidden"
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary" id="ticket_auto_query_submit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div><input type="hidden" id="query_note_id"><input type="hidden" <div
|
||||
class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary" id="ticket_auto_query_submit">Submit</button>
|
||||
</div>
|
||||
</div> <!-- end col-->
|
||||
</form>
|
||||
</div>
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
url = '<?= base_url('ticket/note/1')?>';
|
||||
data = { id : $('#ticket_master_id').val() , is_auto_query : 1};
|
||||
url = '<?= base_url('ticket/note/1') ?>';
|
||||
data = {
|
||||
id: $('#ticket_master_id').val(),
|
||||
is_auto_query: 1
|
||||
};
|
||||
$.ajax({
|
||||
url:url,
|
||||
data:data,
|
||||
url: url,
|
||||
data: data,
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
if (res.status == true){
|
||||
if (res.status == true) {
|
||||
$('#ticket_auto_query_note').val(res.data.note);
|
||||
$('#query_note_id').val(res.data.id);
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
@ -56,20 +69,29 @@ $(document).ready(function() {
|
||||
var url = '<?= base_url("/ticket/note/2"); ?>';
|
||||
var formData = $(this).serializeArray();
|
||||
var ticket_id = $('#ticket_master_id').val();
|
||||
if (ticket_id != null && ticket_id != ''){
|
||||
formData.push({ name: 'ticket_id', value: ticket_id});
|
||||
if (ticket_id != null && ticket_id != '') {
|
||||
formData.push({
|
||||
name: 'ticket_id',
|
||||
value: ticket_id
|
||||
});
|
||||
}
|
||||
var primary_key = $('#query_note_id').val();
|
||||
if (primary_key != null && primary_key != ''){
|
||||
formData.push({ name: 'id', value: primary_key});
|
||||
if (primary_key != null && primary_key != '') {
|
||||
formData.push({
|
||||
name: 'id',
|
||||
value: primary_key
|
||||
});
|
||||
}
|
||||
formData.push({name: 'is_auto_query',value:1})
|
||||
formData.push({
|
||||
name: 'is_auto_query',
|
||||
value: 1
|
||||
})
|
||||
console.log(formData);
|
||||
sendAjaxRequestForGlobal(url, 'POST', formData, function(response) {
|
||||
if (response.status == true) {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('Note Added Successfully','Success');
|
||||
toastr.success('Note Added Successfully', 'Success');
|
||||
// console.log("Respone id is ")
|
||||
// console.log(response.id);
|
||||
$('#query_note_id').val(response.id);
|
||||
@ -95,4 +117,47 @@ $(document).ready(function() {
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
let lastActiveField = null;
|
||||
|
||||
$("#ticket_auto_query_note").on("focus", function() {
|
||||
lastActiveField = this;
|
||||
});
|
||||
|
||||
document.addEventListener('change', function(event) {
|
||||
|
||||
var target = event.target;
|
||||
|
||||
if (target.matches('#ticket_mail_auto_query_customButton')) {
|
||||
|
||||
let placeholderValue = $(target).val();
|
||||
if (!placeholderValue) return;
|
||||
|
||||
if (lastActiveField) {
|
||||
if (lastActiveField.id === "ticket_auto_query_note") {
|
||||
insertAtCursor(lastActiveField, placeholderValue);
|
||||
}
|
||||
}
|
||||
|
||||
$(target).val('');
|
||||
}
|
||||
});
|
||||
|
||||
function insertAtCursor(input, textToInsert) {
|
||||
|
||||
textToInsert += '\n';
|
||||
|
||||
if (document.selection) {
|
||||
input.focus();
|
||||
var sel = document.selection.createRange();
|
||||
sel.text = textToInsert;
|
||||
} else if (input.selectionStart || input.selectionStart === 0) {
|
||||
let startPos = input.selectionStart;
|
||||
let endPos = input.selectionEnd;
|
||||
input.value = input.value.substring(0, startPos) + textToInsert + input.value.substring(endPos, input.value
|
||||
.length);
|
||||
input.selectionStart = input.selectionEnd = startPos + textToInsert.length;
|
||||
} else {
|
||||
input.value += textToInsert;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -139,6 +139,13 @@ function submitClaimForm(event, form) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var isValid = $('#ticket_form_data').parsley().validate();
|
||||
|
||||
if (!isValid) {
|
||||
toastr.warning('Form validation failed. Please check the required fields.', 'WARNING');
|
||||
return false;
|
||||
}
|
||||
|
||||
const formAction = '<?= base_url("ticket/update"); ?>';
|
||||
|
||||
// Show loader
|
||||
@ -186,7 +193,7 @@ function openFetchEmpDataodal() {
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
function setMemberData(input) {
|
||||
function setMemberData(input) {is_head_approved
|
||||
|
||||
var selectedOption = $(input).find(':selected');
|
||||
|
||||
@ -209,4 +216,33 @@ function setMemberData(input) {
|
||||
});
|
||||
}
|
||||
|
||||
function showConfirmationModal(event) {
|
||||
Swal.fire({
|
||||
title: "Approve Claim Rejection",
|
||||
// text: "Do you want to save this?",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
showDenyButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#6c757d",
|
||||
denyButtonColor: "#d33",
|
||||
confirmButtonText: "Approve",
|
||||
denyButtonText: "Reject",
|
||||
cancelButtonText: "Cancel"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$('#is_head_approved').val(1);
|
||||
console.log($('#ticket_form_data')[0])
|
||||
submitClaimForm(event, $('#ticket_form_data')[0]); // Fixed selector
|
||||
} else if (result.isDenied) {
|
||||
$('#is_head_approved').val(2);
|
||||
console.log($('#ticket_form_data')[0])
|
||||
submitClaimForm(event, $('#ticket_form_data')[0]); // Fixed selector
|
||||
} else {
|
||||
$('#is_head_approved').val(0);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -15,10 +15,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<form role="form" class="parsley-examples" method="post" id="ticket_form_gmc" onsubmit="submitClaimForm(event, this)" enctype="multipart/form-data">
|
||||
<form role="form" class="parsley-examples" method="post" id="ticket_form_data" onsubmit="submitClaimForm(event, this)" enctype="multipart/form-data">
|
||||
|
||||
<input type="hidden" id="ticket_type_id" name="ticket_type_id" value="1">
|
||||
<input type="hidden" id="ticket_master_id" name="ticket_master_id" value="<?= isset($ticket_data['id']) ? $ticket_data['id'] : '' ?>">
|
||||
<input type="hidden" id="is_head_approved" name="is_head_approved" value="<?= isset($ticket_data['is_head_approved']) ? $ticket_data['is_head_approved'] : '' ?>">
|
||||
<input type="hidden" id="extra_fields_array_for_validate" name="extra_fields_array_for_validate" value='<?= isset($extra_fields_array_for_validate) && !empty($extra_fields_array_for_validate) ? json_encode($extra_fields_array_for_validate) : "[]" ?>'>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
@ -219,10 +221,104 @@
|
||||
name="pod_no">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 up_cnu" style="display: none;">
|
||||
<label for="claim_number">Claim Number<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="claim_number" placeholder="Enter Claim NO"
|
||||
value="<?= isset($ticket_data['claim_number']) ? $ticket_data['claim_number'] : '' ?>"
|
||||
name="claim_number">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 up_cnu" style="display: none;">
|
||||
<label for="registration_date">Registration Date</label>
|
||||
<input type="text" class="form-control datepicker" id="registration_date" placeholder="Select Registration Date"
|
||||
value="<?= isset($ticket_data['registration_date']) ? $ticket_data['registration_date'] : '' ?>" name="registration_date">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 cda_ir" style="display: none;">
|
||||
<label for="raised_date">Raised Date</label>
|
||||
<input type="text" class="form-control datepicker" id="raised_date" placeholder="Select Raised Date"
|
||||
value="<?= isset($ticket_data['raised_date']) ? $ticket_data['raised_date'] : '' ?>" name="raised_date">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 up_qdr" style="display: none;">
|
||||
<label for="query_received_date">Query Received Date</label>
|
||||
<input type="text" class="form-control datepicker" id="query_received_date" placeholder="Select Query Received Date"
|
||||
value="<?= isset($ticket_data['query_received_date']) ? $ticket_data['query_received_date'] : '' ?>" name="query_received_date">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 rejected" style="display: none;">
|
||||
<label for="denial_reason">Denial Reason</label>
|
||||
<input type="text" class="form-control" id="denial_reason" placeholder="Enter Denial Reason"
|
||||
value="<?= isset($ticket_data['denial_reason']) ? $ticket_data['denial_reason'] : '' ?>" name="denial_reason">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 rejected" style="display: none;">
|
||||
<label for="denial_date">Denial Date</label>
|
||||
<input type="text" class="form-control datepicker" id="denial_date" placeholder="Select Denial Date"
|
||||
value="<?= isset($ticket_data['denial_date']) ? $ticket_data['denial_date'] : '' ?>" name="denial_date">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 approved" style="display: none;">
|
||||
<label for="approved_amount">Approved Amount</label>
|
||||
<input type="text" class="form-control" id="approved_amount" placeholder="Enter Approved Amount"
|
||||
value="<?= isset($ticket_data['approved_amount']) ? $ticket_data['approved_amount'] : '' ?>" name="approved_amount">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 approved" style="display: none;">
|
||||
<label for="approved_date">Approved Date</label>
|
||||
<input type="text" class="form-control datepicker" id="approved_date" placeholder="Select Approved Date"
|
||||
value="<?= isset($ticket_data['approved_date']) ? $ticket_data['approved_date'] : '' ?>" name="approved_date">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6 approved" style="display: none;">
|
||||
<label for="approved_letter">Approved Letter</label>
|
||||
<input type="text" class="form-control" id="approved_letter" placeholder="Enter Approved Letter"
|
||||
value="<?= isset($ticket_data['approved_letter']) ? $ticket_data['approved_letter'] : '' ?>" name="approved_letter">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 settled" style="display: none;">
|
||||
<label for="utr_details">UTR Details</label>
|
||||
<input type="text" class="form-control" id="utr_details" placeholder="Enter UTR Details"
|
||||
value="<?= isset($ticket_data['utr_details']) ? $ticket_data['utr_details'] : '' ?>" name="utr_details">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 settled" style="display: none;">
|
||||
<label for="settled_date">Settled Date</label>
|
||||
<input type="text" class="form-control datepicker" id="settled_date" placeholder="Select Settled Date"
|
||||
value="<?= isset($ticket_data['settled_date']) ? $ticket_data['settled_date'] : '' ?>" name="settled_date">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6 settled" style="display: none;">
|
||||
<label for="settle_letter">Settle Letter</label>
|
||||
<input type="text" class="form-control" id="settle_letter" placeholder="Enter Settle Letter"
|
||||
value="<?= isset($ticket_data['settle_letter']) ? $ticket_data['settle_letter'] : '' ?>" name="settle_letter">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 returned" style="display: none;">
|
||||
<label for="return_remark">Return Remark</label>
|
||||
<textarea class="form-control" id="return_remark" placeholder="Enter Return Remark" name="return_remark"><?= isset($ticket_data['return_remark']) ? $ticket_data['return_remark'] : '' ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 canceled" style="display: none;">
|
||||
<label for="cancel_remark">Cancel Remark</label>
|
||||
<textarea class="form-control" id="cancel_remark" placeholder="Enter Cancel Remark" name="cancel_remark"><?= isset($ticket_data['cancel_remark']) ? $ticket_data['cancel_remark'] : '' ?></textarea>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6 returned" style="display: none;">
|
||||
<label for="awb_no_courier_name">AWB No with Courier Name</label>
|
||||
<input type="text" class="form-control" id="awb_no_courier_name" placeholder="eg : 0001/ST Courier"
|
||||
value="<?= isset($ticket_data['awb_no_courier_name']) ? $ticket_data['awb_no_courier_name'] : '' ?>" name="awb_no_courier_name">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12 text-right m-b-0" style="margin-top: 29px;">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit" >Submit</button>
|
||||
<?php if(get_role_id() == 5 && isset($ticket_data) && $ticket_data['claim_status_id'] == 8) { ?>
|
||||
<a class="btn btn-secondary waves-effect waves-light mr-1" onclick="showConfirmationModal(event)">Approve Claim Rejection</a>
|
||||
<?php } ?>
|
||||
<!-- <button type="button" class="btn btn-primary waves-effect waves-light mr-1" id="btnApprove" >Approve</button> -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -232,6 +328,23 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// $(document).ready(function() {
|
||||
// var calim_status = $('#claim_status_id').val();
|
||||
// if (calim_status == 8){
|
||||
// $('#btnApprove').show();
|
||||
// }else{
|
||||
// $('#btnApprove').hide();
|
||||
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
let GlobelExtraFields = [];
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var doa = flatpickr("#doa", {
|
||||
@ -244,5 +357,170 @@ $(document).ready(function() {
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
flatpickr("#raised_date", { dateFormat: "d/m/Y", allowInput: false });
|
||||
flatpickr("#registration_date", { dateFormat: "d/m/Y", allowInput: false });
|
||||
flatpickr("#query_received_date", { dateFormat: "d/m/Y", allowInput: false });
|
||||
flatpickr("#denial_date", { dateFormat: "d/m/Y", allowInput: false });
|
||||
flatpickr("#approved_date", { dateFormat: "d/m/Y", allowInput: false });
|
||||
flatpickr("#settled_date", { dateFormat: "d/m/Y", allowInput: false });
|
||||
|
||||
// updateClaimStatusDisplay("<?= isset($ticket_data['claim_status_id']) ? $ticket_data['claim_status_id'] : 0 ?>")
|
||||
var extraFields = <?= json_encode(isset($extra_fields) ? $extra_fields : []); ?>;
|
||||
GlobelExtraFields = extraFields;
|
||||
console.log("extraFields", extraFields);
|
||||
claimStatusFieldChanges(extraFields);
|
||||
|
||||
})
|
||||
|
||||
// function updateClaimStatusDisplay(value) {
|
||||
// // Hide all sections first
|
||||
// $('.cda_ir, .settled, .approved, .rejected, .up_qdr, .up_cnu, .canceled, .returned').hide();
|
||||
// $('.cda_ir, .settled, .approved, .rejected, .up_qdr, .up_cnu, .canceled, .returned').hide().find('input, textarea').removeAttr('required');
|
||||
|
||||
// // Show relevant section based on value
|
||||
// if (value == 3 || value == 4) { // CDA & INFORMATION REQUIRED
|
||||
// $('.cda_ir').show();
|
||||
// $('.settled, .approved, .rejected, .up_qdr, .up_cnu, .canceled, .returned').find('input, textarea').removeAttr('required');
|
||||
// } else if (value == 5) { // UNDER PROCESS - CLAIM NO. UPDATION
|
||||
// $('.up_cnu').show();
|
||||
// $('.cda_ir, .settled, .approved, .rejected, .up_qdr, .canceled, .returned').find('input, textarea').removeAttr('required');
|
||||
// } else if (value == 7) { // UNDER PROCESS - QUERY DOCUMENT RECEIVED
|
||||
// $('.up_qdr').show();
|
||||
// $('.cda_ir, .settled, .approved, .rejected, .up_cnu, .canceled, .returned').find('input, textarea').removeAttr('required');
|
||||
// } else if (value == 8) { // REJECTED
|
||||
// $('.rejected').show();
|
||||
// $('.cda_ir, .settled, .approved, .up_qdr, .up_cnu, .canceled, .returned').find('input, textarea').removeAttr('required');
|
||||
// } else if (value == 9) { // APPROVED
|
||||
// $('.approved').show();
|
||||
// $('.cda_ir, .settled, .rejected, .up_qdr, .up_cnu, .canceled, .returned').find('input, textarea').removeAttr('required');
|
||||
// } else if (value == 11) { // SETTLED
|
||||
// $('.settled').show();
|
||||
// $('.cda_ir, .approved, .rejected, .up_qdr, .up_cnu, .canceled, .returned').find('input, textarea').removeAttr('required');
|
||||
// }else if (value == 13) { // CANCELLED
|
||||
// $('.canceled').show();
|
||||
// $('.cda_ir, .settled, .approved, .rejected, .up_qdr, .up_cnu, .returned').find('input, textarea').removeAttr('required');
|
||||
// }else if (value == 14) { // RETURNED
|
||||
// $('.returned').show();
|
||||
// $('.cda_ir, .settled, .approved, .rejected, .up_qdr, .up_cnu, .canceled').find('input, textarea').removeAttr('required');
|
||||
// }
|
||||
// }
|
||||
|
||||
function updateClaimStatusDisplay(value) {
|
||||
|
||||
// Hide all sections and remove required attribute from their inputs and textareas
|
||||
let sections = $('.cda_ir, .settled, .approved, .rejected, .up_qdr, .up_cnu, .canceled, .returned');
|
||||
sections.hide().find('input, textarea').removeAttr('required');
|
||||
|
||||
// Determine which section to show
|
||||
let showClass = '';
|
||||
if (value == 3 || value == 4) { // CDA & INFORMATION REQUIRED
|
||||
showClass = '.cda_ir';
|
||||
} else if (value == 5) { // UNDER PROCESS - CLAIM NO. UPDATION
|
||||
showClass = '.up_cnu';
|
||||
} else if (value == 7) { // UNDER PROCESS - QUERY DOCUMENT RECEIVED
|
||||
showClass = '.up_qdr';
|
||||
} else if (value == 8) { // REJECTED
|
||||
showClass = '.rejected';
|
||||
} else if (value == 9) { // APPROVED
|
||||
showClass = '.approved';
|
||||
} else if (value == 11) { // SETTLED
|
||||
showClass = '.settled';
|
||||
} else if (value == 13) { // CANCELLED
|
||||
showClass = '.canceled';
|
||||
} else if (value == 14) { // RETURNED
|
||||
showClass = '.returned';
|
||||
}
|
||||
|
||||
// Show the relevant section and enable required attributes
|
||||
if (showClass) {
|
||||
$(showClass).show().find('input, textarea').attr('required', true);
|
||||
}
|
||||
}
|
||||
|
||||
$('#claim_status_id').on('change', function() {
|
||||
updateClaimStatusDisplay($(this).val());
|
||||
// claimStatusFieldChanges()
|
||||
});
|
||||
|
||||
function claimStatusFieldChanges(fields) {
|
||||
|
||||
fields.forEach(function(fieldId) {
|
||||
var $field = $("#" + fieldId);
|
||||
|
||||
if ($field.length) {
|
||||
$field.prop('required', true);
|
||||
|
||||
var $parentDiv = $field.closest("div");
|
||||
$parentDiv.show();
|
||||
|
||||
var $label = $parentDiv.find("label[for='" + fieldId + "']");
|
||||
if ($label.length && !$label.find(".text-danger").length) {
|
||||
$label.append(' <span class="text-danger">*</span>');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function claimStatusFieldRemoveREquired(fields, remove_or_add, thirdClass) {
|
||||
|
||||
console.log('--------------------------- claimStatusFieldRemoveREquired ---------------------------');
|
||||
console.log('fields', fields);
|
||||
console.log('remove_or_add', remove_or_add);
|
||||
|
||||
fields.forEach(function(fieldId) {
|
||||
var $field = $("#" + fieldId);
|
||||
|
||||
if ($field.length) {
|
||||
$field.prop('required', remove_or_add);
|
||||
var $parentDiv = $field.closest("div");
|
||||
console.log('parentDiv', $parentDiv);
|
||||
var $label = $parentDiv.find("label[for='" + fieldId + "']");
|
||||
// if(remove_or_add == false){
|
||||
// $parentDiv.find("label[for='" + fieldId + "'] .text-danger").remove();
|
||||
// console.log('one', remove_or_add);
|
||||
// }else{
|
||||
// if ($label.length && !$label.find(".text-danger").length) {
|
||||
// $label.append(' <span class="text-danger">*</span>');
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('.'+thirdClass).find('input, textarea').attr('required', true);
|
||||
|
||||
}
|
||||
|
||||
$(document).on("input", function (event) {
|
||||
|
||||
let fields = GlobelExtraFields;
|
||||
console.log('fields', fields);
|
||||
let targetId = event.target.id;
|
||||
console.log('targetId', targetId);
|
||||
console.log('fields.includes(targetId)', fields.includes(targetId));
|
||||
|
||||
if (fields.includes(targetId)) {
|
||||
|
||||
let $field = $("#" + targetId);
|
||||
console.log('$field id', $field);
|
||||
let $parentDiv = $field.closest("div");
|
||||
console.log('$parentDiv', $parentDiv);
|
||||
|
||||
if ($parentDiv.length) {
|
||||
let thirdClass = $parentDiv.attr("class").split(" ")[2] || "";
|
||||
console.log('thirdClass', thirdClass);
|
||||
|
||||
if (thirdClass) {
|
||||
claimStatusFieldRemoveREquired(fields, false, thirdClass);
|
||||
let $label = $(thirdClass).find("label");
|
||||
if ($label.length && !$label.find(".text-danger").length) {
|
||||
$label.append(' <span class="text-danger">*</span>');
|
||||
}
|
||||
} else {
|
||||
claimStatusFieldRemoveREquired($field, false, '');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -23,12 +23,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<form role="form" class="parsley-examples" method="post" id="ticket_form_gmc" onsubmit="submitClaimForm(event, this)"
|
||||
<form role="form" class="parsley-examples" method="post" id="ticket_form_data" onsubmit="submitClaimForm(event, this)"
|
||||
enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
|
||||
<input type="hidden" id="ticket_master_id" name="ticket_master_id" value="<?= isset($ticket_data['id']) ? $ticket_data['id'] : '' ?>">
|
||||
<input type="hidden" id="is_head_approved" name="is_head_approved" value="<?= isset($ticket_data['is_head_approved']) ? $ticket_data['is_head_approved'] : '' ?>">
|
||||
<input type="hidden" id="extra_fields_array_for_validate" name="extra_fields_array_for_validate" value='<?= isset($extra_fields_array_for_validate) && !empty($extra_fields_array_for_validate) ? json_encode($extra_fields_array_for_validate) : "[]" ?>'>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="claim_status">Status<span class="text-danger"></span></label>
|
||||
@ -195,11 +197,67 @@
|
||||
name="si_amt">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 approved" style="display: none;">
|
||||
<label for="approved_amount">Approved Amount</label>
|
||||
<input type="text" class="form-control" id="approved_amount" placeholder="Enter Approved Amount"
|
||||
value="<?= isset($ticket_data['approved_amount']) ? $ticket_data['approved_amount'] : '' ?>" name="approved_amount">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 approved" style="display: none;">
|
||||
<label for="approved_date">Approved Date</label>
|
||||
<input type="text" class="form-control datepicker" id="approved_date" placeholder="Select Approved Date"
|
||||
value="<?= isset($ticket_data['approved_date']) ? $ticket_data['approved_date'] : '' ?>" name="approved_date">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6 approved" style="display: none;">
|
||||
<label for="approved_letter">Approved Letter</label>
|
||||
<input type="text" class="form-control" id="approved_letter" placeholder="Enter Approved Letter"
|
||||
value="<?= isset($ticket_data['approved_letter']) ? $ticket_data['approved_letter'] : '' ?>" name="approved_letter">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 settled" style="display: none;">
|
||||
<label for="utr_details">UTR Details</label>
|
||||
<input type="text" class="form-control" id="utr_details" placeholder="Enter UTR Details"
|
||||
value="<?= isset($ticket_data['utr_details']) ? $ticket_data['utr_details'] : '' ?>" name="utr_details">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 settled" style="display: none;">
|
||||
<label for="settled_date">Settled Date</label>
|
||||
<input type="text" class="form-control datepicker" id="settled_date" placeholder="Select Settled Date"
|
||||
value="<?= isset($ticket_data['settled_date']) ? $ticket_data['settled_date'] : '' ?>" name="settled_date">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6 settled" style="display: none;">
|
||||
<label for="settle_letter">Settle Letter</label>
|
||||
<input type="text" class="form-control" id="settle_letter" placeholder="Enter Settle Letter"
|
||||
value="<?= isset($ticket_data['settle_letter']) ? $ticket_data['settle_letter'] : '' ?>" name="settle_letter">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 returned" style="display: none;">
|
||||
<label for="return_remark">Return Remark</label>
|
||||
<textarea class="form-control" id="return_remark" placeholder="Enter Return Remark" name="return_remark"><?= isset($ticket_data['return_remark']) ? $ticket_data['return_remark'] : '' ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 canceled" style="display: none;">
|
||||
<label for="cancel_remark">Cancel Remark</label>
|
||||
<textarea class="form-control" id="cancel_remark" placeholder="Enter Cancel Remark" name="cancel_remark"><?= isset($ticket_data['cancel_remark']) ? $ticket_data['cancel_remark'] : '' ?></textarea>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6 returned" style="display: none;">
|
||||
<label for="awb_no_courier_name">AWB No with Courier Name</label>
|
||||
<input type="text" class="form-control" id="awb_no_courier_name" placeholder="eg : 0001/ST Courier"
|
||||
value="<?= isset($ticket_data['awb_no_courier_name']) ? $ticket_data['awb_no_courier_name'] : '' ?>" name="awb_no_courier_name">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12 text-right m-b-0" style="margin-top: 29px;">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnSubmit">Submit</button>
|
||||
<?php if(get_role_id() == 5 && isset($ticket_data) && in_array($ticket_data['claim_status_id'],[23,33,43])) { ?>
|
||||
<a class="btn btn-secondary waves-effect waves-light mr-1" onclick="showConfirmationModal(event)">Rejected Approve</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@ -208,6 +266,9 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
let GlobelExtraFields = [];
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var date_of_join = flatpickr("#date_of_join", {
|
||||
@ -239,5 +300,121 @@ $(document).ready(function() {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
flatpickr("#approved_date", { dateFormat: "d/m/Y", allowInput: false });
|
||||
flatpickr("#settled_date", { dateFormat: "d/m/Y", allowInput: false });
|
||||
|
||||
// updateClaimStatusDisplay("<?= isset($ticket_data['claim_status_id']) ? $ticket_data['claim_status_id'] : 0 ?>")
|
||||
var extraFields = <?= json_encode(isset($extra_fields) ? $extra_fields : []); ?>;
|
||||
GlobelExtraFields = extraFields;
|
||||
console.log("extraFields", extraFields);
|
||||
claimStatusFieldChanges(extraFields);
|
||||
|
||||
|
||||
})
|
||||
|
||||
function updateClaimStatusDisplay(value) {
|
||||
|
||||
console.log('value', value);
|
||||
|
||||
// Hide all sections first
|
||||
$('.settled, .approved, .canceled, .returned').hide();
|
||||
|
||||
// Show relevant section based on value
|
||||
if (value == 20 || value == 30 || value == 40) { // APPROVED
|
||||
$('.approved').show();
|
||||
} else if (value == 24 || value == 34 || value == 44) { // SETTLED
|
||||
$('.settled').show();
|
||||
}else if (value == 47 || value == 53 || value == 58) { // CANCELLED
|
||||
$('.canceled').show();
|
||||
}else if (value == 48 || value == 54 || value == 59) { // RETURNED
|
||||
$('.returned').show();
|
||||
}
|
||||
}
|
||||
|
||||
$('#claim_status_id').on('change', function() {
|
||||
updateClaimStatusDisplay($(this).val());
|
||||
});
|
||||
|
||||
function claimStatusFieldChanges(fields) {
|
||||
console.log('fields', fields);
|
||||
fields.forEach(function(fieldId) {
|
||||
var $field = $("#" + fieldId);
|
||||
|
||||
if ($field.length) {
|
||||
$field.prop('required', true);
|
||||
|
||||
var $parentDiv = $field.closest("div");
|
||||
$parentDiv.show();
|
||||
|
||||
var $label = $parentDiv.find("label[for='" + fieldId + "']");
|
||||
if ($label.length && !$label.find(".text-danger").length) {
|
||||
$label.append(' <span class="text-danger">*</span>');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function claimStatusFieldRemoveREquired(fields, remove_or_add, thirdClass) {
|
||||
|
||||
console.log('--------------------------- claimStatusFieldRemoveREquired ---------------------------');
|
||||
console.log('fields', fields);
|
||||
console.log('remove_or_add', remove_or_add);
|
||||
|
||||
fields.forEach(function(fieldId) {
|
||||
var $field = $("#" + fieldId);
|
||||
|
||||
if ($field.length) {
|
||||
$field.prop('required', remove_or_add);
|
||||
var $parentDiv = $field.closest("div");
|
||||
console.log('parentDiv', $parentDiv);
|
||||
var $label = $parentDiv.find("label[for='" + fieldId + "']");
|
||||
// if(remove_or_add == false){
|
||||
// $parentDiv.find("label[for='" + fieldId + "'] .text-danger").remove();
|
||||
// console.log('one', remove_or_add);
|
||||
// }else{
|
||||
// if ($label.length && !$label.find(".text-danger").length) {
|
||||
// $label.append(' <span class="text-danger">*</span>');
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('.'+thirdClass).find('input, textarea').attr('required', true);
|
||||
|
||||
}
|
||||
|
||||
$(document).on("input", function (event) {
|
||||
|
||||
let fields = GlobelExtraFields;
|
||||
console.log('fields', fields);
|
||||
let targetId = event.target.id;
|
||||
console.log('targetId', targetId);
|
||||
console.log('fields.includes(targetId)', fields.includes(targetId));
|
||||
|
||||
if (fields.includes(targetId)) {
|
||||
|
||||
let $field = $("#" + targetId);
|
||||
console.log('$field id', $field);
|
||||
let $parentDiv = $field.closest("div");
|
||||
console.log('$parentDiv', $parentDiv);
|
||||
|
||||
if ($parentDiv.length) {
|
||||
let thirdClass = $parentDiv.attr("class").split(" ")[2] || "";
|
||||
console.log('thirdClass', thirdClass);
|
||||
|
||||
if (thirdClass) {
|
||||
claimStatusFieldRemoveREquired(fields, false, thirdClass);
|
||||
let $label = $(thirdClass).find("label");
|
||||
if ($label.length && !$label.find(".text-danger").length) {
|
||||
$label.append(' <span class="text-danger">*</span>');
|
||||
}
|
||||
} else {
|
||||
claimStatusFieldRemoveREquired($field, false, '');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -417,6 +417,13 @@ function submitClaimForm(event, form) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var isValid = $('#ticket_form_data').parsley().validate();
|
||||
|
||||
if (!isValid) {
|
||||
toastr.warning('Form validation failed. Please check the required fields.', 'WARNING');
|
||||
return false;
|
||||
}
|
||||
|
||||
const formAction = '<?= isset($view_ticket_page) ? base_url("ticket/update") : base_url("ticket/create"); ?>';
|
||||
|
||||
// Show loader
|
||||
@ -571,7 +578,7 @@ function appendEmployee(data, attrId) {
|
||||
console.log(item)
|
||||
var option = $('<option>', {
|
||||
value: item.emp_code,
|
||||
text: item.emp_name,
|
||||
text: item.emp_name + ' - ' + item.emp_code,
|
||||
});
|
||||
|
||||
$('#' + attrId).append(option).select2();
|
||||
@ -704,6 +711,12 @@ function setMemberData(input) {
|
||||
$(this).prop('selected', true);
|
||||
}
|
||||
});
|
||||
|
||||
if(tpaNo == ""){
|
||||
$('#claim_status_id').val(1)
|
||||
}else{
|
||||
$('#claim_status_id').val(2)
|
||||
}
|
||||
}
|
||||
|
||||
$('#employee_data_points').on('change', function() {
|
||||
|
||||
@ -54,6 +54,7 @@ table.dataTable tbody td {
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
<th>Policy Type</th>
|
||||
<th>Claim number</th>
|
||||
<th>TPA ID</th>
|
||||
<th>Emp name</th>
|
||||
@ -65,10 +66,48 @@ table.dataTable tbody td {
|
||||
<tbody>
|
||||
<?php if (isset($ticket_data)) { ?>
|
||||
<?php foreach($ticket_data as $index => $row){ ?>
|
||||
<tr onclick="viewTicket(<?php echo $row['id']; ?>)">
|
||||
<td data-toggle="tooltip" data-placement="top" title="<?php echo $row['status']; ?>">
|
||||
<span class="status-tooltip"><?php echo $row['status']; ?></span>
|
||||
</td>
|
||||
<tr onclick="viewTicket(<?php echo $row['id']; ?>)">
|
||||
|
||||
<td data-toggle="tooltip" data-placement="top"
|
||||
|
||||
|
||||
title=" <?php
|
||||
if ($row['claim_status_id'] == 8) {
|
||||
if ($row['is_head_approved'] == 0) {
|
||||
echo 'Waiting For Head Approvel';
|
||||
} elseif ($row['is_head_approved'] == 1) {
|
||||
echo 'Head Approved';
|
||||
} elseif ($row['is_head_approved'] == 2) {
|
||||
echo 'Head Rejected';
|
||||
} else {
|
||||
echo $row['status'];
|
||||
}
|
||||
} else {
|
||||
echo $row['status'];
|
||||
}
|
||||
?>">
|
||||
|
||||
|
||||
<span class="status-tooltip">
|
||||
<?php
|
||||
if (in_array($row['claim_status_id'],[8,23,33,43])) {
|
||||
if ($row['is_head_approved'] == 0) {
|
||||
echo $row['status'] . ' <i class="fa fa-exclamation-triangle" style="color:#cece00;" aria-hidden="true"></i>';
|
||||
} elseif ($row['is_head_approved'] == 1) {
|
||||
echo $row['status'] . ' <i class="fa fa-check-circle" style="color:green;" aria-hidden="true"></i>';
|
||||
} elseif ($row['is_head_approved'] == 2) {
|
||||
echo $row['status'] . ' <i class="fa fa-times-circle" style="color:red;" aria-hidden="true"></i>';
|
||||
} else {
|
||||
echo $row['status'];
|
||||
}
|
||||
} else {
|
||||
echo $row['status'];
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
</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['emp_name']; ?></td>
|
||||
|
||||
@ -77,9 +77,9 @@ table.dataTable tbody td {
|
||||
<?php if (isset($ticket_data)) { ?>
|
||||
<?php foreach($ticket_data as $index => $row){ ?>
|
||||
<tr>
|
||||
<td><?php echo $row['template_name']; ?></td>
|
||||
<td><?php echo $ticket_type[$row['ticket_type']]; ?></td>
|
||||
<td><?php echo $trigger_type[$row['trigger_type']]; ?></td>
|
||||
<td><?php echo $row['template_name'] ?? ""; ?></td>
|
||||
<td><?php echo $ticket_type[$row['ticket_type']] ?? ""; ?></td>
|
||||
<td><?php echo $trigger_type[$row['trigger_type']] ?? ""; ?></td>
|
||||
<td><?=$row['is_auto_mail'] == 1?'Auto':"Manual" ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
|
||||
@ -85,8 +85,8 @@ table.dataTable tbody td {
|
||||
<td><?php echo $row['owner_name']; ?></td>
|
||||
<td><?php echo $row['rc']; ?></td>
|
||||
<td><?php echo $row['vehicle_no']; ?></td>
|
||||
<td><?php echo $vehicle_type[$row['type']]; ?></td>
|
||||
<td><?php echo $vehicle_des[$row['description']]; ?></td>
|
||||
<td><?php echo $vehicle_type[$row['type']] ?? ""; ?></td>
|
||||
<td><?php echo $vehicle_des[$row['description']] ?? ""; ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);"
|
||||
|
||||
@ -107,6 +107,7 @@
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">Date</th>
|
||||
<th class="font-weight-medium">Record Date</th>
|
||||
<th class="font-weight-medium">Unit</th>
|
||||
<th class="font-weight-medium">Policy</th>
|
||||
<th class="font-weight-medium">Endorsement No</th>
|
||||
@ -122,6 +123,7 @@
|
||||
<?php foreach($depositdata as $row) { ?>
|
||||
<tr id="<?php echo $row->id;?>">
|
||||
<td><?php echo date('d-M-Y h:i A', strtotime($row->created_at)); ?></td>
|
||||
<td><?php echo isset($row->record_date)? date('d-M-Y', strtotime($row->record_date)):'-' ?></td>
|
||||
<td><?php echo $row->unit ?? ' - '; ?></td>
|
||||
<!-- <td><?php echo $row->policy_name ?? '<center> - </center>'; ?></td> -->
|
||||
<td>
|
||||
@ -139,8 +141,8 @@
|
||||
<td><?php echo $row->endorsement_no ?? '<center> - </center>'; ?></td>
|
||||
<td><?php echo isset($subTypeOptions[$row->sub_type]) ? $subTypeOptions[$row->sub_type] : ''; ?>
|
||||
</td>
|
||||
<td><?php echo ($row->transaction_type == 'Credit') ? $row->amount : ''; ?></td>
|
||||
<td><?php echo ($row->transaction_type == 'Debit') ? $row->amount : ''; ?></td>
|
||||
<td><?php echo ($row->transaction_type == 'Credit') ? $row->amount : '-'; ?></td>
|
||||
<td><?php echo ($row->transaction_type == 'Debit') ? $row->amount : '-'; ?></td>
|
||||
<td><?php echo $row->balance; ?></td>
|
||||
<td><?php echo $row->description; ?></td>
|
||||
<td><?php echo $row->username; ?></td>
|
||||
@ -205,6 +207,8 @@
|
||||
<div class="form-group">
|
||||
<label for="field-1" class="control-label">Amount<span class="text-danger">*</span></label>
|
||||
<input type="number" class="form-control" id="amount" placeholder="Amount" required>
|
||||
<br><label for="record_date">Record Date <span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control policy_start_date" id="record_date" name="record_date" placeholder="Record Date">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -264,6 +268,12 @@ $(document).ready(function() {
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
var record_date = flatpickr("#record_date",{
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false,
|
||||
|
||||
});
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-7 text-right'B>>" +
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
@ -293,6 +303,8 @@ $(document).ready(function() {
|
||||
paging: true ,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@ -320,6 +332,7 @@ $(document).ready(function() {
|
||||
var insurerId = '<?php echo $insurerName->id; ?>';
|
||||
var transactionTypeValue = $('input[name="transactionMode"]:checked').val();
|
||||
var subType = "";
|
||||
var record_date = $('#record_date').val();
|
||||
|
||||
if(amount == ""){
|
||||
toastr.warning('Amount field is required')
|
||||
@ -372,7 +385,8 @@ $(document).ready(function() {
|
||||
transaction_type: transactionType,
|
||||
sub_type_id: subType, // Include sub_type_id
|
||||
client_id: clientId,
|
||||
insurer_id: insurerId
|
||||
insurer_id: insurerId,
|
||||
record_date : record_date
|
||||
},
|
||||
success: function(response) {
|
||||
// Handle success response
|
||||
|
||||
@ -58,6 +58,7 @@
|
||||
left: 0;
|
||||
background-color: #bfe0e2;
|
||||
z-index: 2;
|
||||
width: 10px;
|
||||
}
|
||||
|
||||
.suggestion-box {
|
||||
@ -194,6 +195,14 @@
|
||||
background-color: #f0f0f0;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
table th.action,
|
||||
table th.disableborder,
|
||||
table td.action,
|
||||
table td.disableborder {
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
@ -362,7 +371,7 @@
|
||||
<div class="form-row" id="input_for_row">
|
||||
</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>
|
||||
@ -411,9 +420,9 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="subject">Subject</label>
|
||||
<input id="subject" type="text" class="form-control" name="subject" value="Internal Mail - ">
|
||||
<input id="subject" type="text" class="form-control" name="subject" value="<?= isset($subject) ? $subject : " " ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
@ -423,9 +432,9 @@
|
||||
</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>
|
||||
<button type="submit" class="btn btn-primary" onclick="constructURL(2)">Send Mail</button>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
@ -508,9 +517,9 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="subject">Subject</label>
|
||||
<input type="text" class="form-control" id="placement_subject" name="placement_subject" value="Proposel Mail for - " placeholder="Enter Subject">
|
||||
<input type="text" class="form-control" id="placement_subject" name="placement_subject" value="<?= isset($subject) ? $subject : " " ?>" placeholder="Enter Subject">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -641,7 +650,7 @@
|
||||
|
||||
// Check if data is valid (not null or undefined) and is an object
|
||||
if (data && typeof data === 'object') {
|
||||
insurer_count = data.proposal_data.over_all_column_data['Proposal 1']['insurers'].length;
|
||||
let insurer_count = data.proposal_data.over_all_column_data['Proposal 1']?.insurers?.length || 0;
|
||||
jsonToTable(data);
|
||||
} else {
|
||||
addSuggestionsToTable();
|
||||
@ -1030,16 +1039,29 @@ function addSuggestionsToTable() {
|
||||
|
||||
console.log(' addSuggestionsToTable suggestions ', suggestions);
|
||||
console.log(' addSuggestionsToTable suggestions type', typeof suggestions);
|
||||
console.log(' over_all_column_data', over_all_column_data);
|
||||
let leadType = <?= isset($lead_data) && isset($lead_data['lead_type']) ? $lead_data['lead_type'] : 1; ?>;
|
||||
console.log('leadType', leadType);
|
||||
|
||||
let renewal_or_rollover = "Proposal 1";
|
||||
if(leadType == 2){
|
||||
renewal_or_rollover = "Existing Renewal"
|
||||
}else if(leadType == 3){
|
||||
renewal_or_rollover = "Existing Rollover"
|
||||
if (leadType == 2) {
|
||||
renewal_or_rollover = "Existing Renewal";
|
||||
} else if (leadType == 3) {
|
||||
renewal_or_rollover = "Existing Rollover";
|
||||
}
|
||||
|
||||
over_all_column_data = {
|
||||
[renewal_or_rollover]: {
|
||||
"qcr": 1,
|
||||
"stc": 1,
|
||||
"insurers": []
|
||||
}
|
||||
};
|
||||
|
||||
console.log('renewal_or_rollover', renewal_or_rollover);
|
||||
console.log(' over_all_column_data', over_all_column_data);
|
||||
|
||||
|
||||
$('#first_proposel_title').html(`
|
||||
${renewal_or_rollover}
|
||||
<span class="dropdown" onclick="showThreeDottedMenu(event)">
|
||||
@ -3137,9 +3159,9 @@ function appendInput(data) {
|
||||
}
|
||||
|
||||
html += `
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="mail_subject">Subject</label>
|
||||
<input value="Client Mail - " type="text" id="mail_subject" class="form-control" placeholder="Subject">
|
||||
<input type="text" id="mail_subject" class="form-control" value="'<?= isset($subject) ? $subject : " " ?>'" placeholder="Subject">
|
||||
</div>
|
||||
`;
|
||||
|
||||
@ -3197,9 +3219,9 @@ function appendInput(data) {
|
||||
`;
|
||||
|
||||
html += `
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="mail_subject">Subject</label>
|
||||
<input value="Insurer Mail - " type="text" id="mail_subject" class="form-control" placeholder="Subject">
|
||||
<input value="<?= isset($subject) ? $subject : " " ?>" type="text" id="mail_subject" class="form-control" placeholder="Subject">
|
||||
</div>
|
||||
`;
|
||||
|
||||
@ -3576,7 +3598,7 @@ function ajaxRequest(formData) {
|
||||
$('#cc').val('').select2({
|
||||
placeholder : 'select CC Mail'
|
||||
});
|
||||
$('#subject').val('');
|
||||
// $('#subject').val('');
|
||||
$('#proposals').val('');
|
||||
$('#placement_to').val('').select2({
|
||||
placeholder : 'select To Mail'
|
||||
@ -3653,7 +3675,7 @@ $('.close').click(function(){
|
||||
$('#cc').val('').select2({
|
||||
placeholder : 'select CC Mail'
|
||||
});
|
||||
$('#subject').val('');
|
||||
// $('#subject').val('');
|
||||
$('#proposals').val('');
|
||||
$('#placement_to').val('').select2({
|
||||
placeholder : 'select To Mail'
|
||||
@ -3806,7 +3828,7 @@ function constructInsurerNameWithVersion(proposal_name, insurerName) {
|
||||
let newDisplayName = `${insurerName}-V${maxVersion + 1}`;
|
||||
return newDisplayName;
|
||||
}
|
||||
return false;
|
||||
return insurerName;
|
||||
}
|
||||
|
||||
function checkTheTableDataChanged(redirect_type, url){
|
||||
@ -4441,7 +4463,7 @@ function jsonToTable(json) {
|
||||
//Premium Calculation child table
|
||||
function populateTable(json) {
|
||||
|
||||
console.log(json);
|
||||
console.log('populateTable json data', json);
|
||||
|
||||
const table = document.getElementById("rfqTable_for_calc");
|
||||
const thead = document.createElement("thead");
|
||||
@ -4458,7 +4480,7 @@ function populateTable(json) {
|
||||
let randomColor = 'hsl(' + Math.random() * 360 + ', 100%, 93%)';
|
||||
|
||||
// Skip unwanted parent headers
|
||||
if (!["Item Key", "Action"].includes(header.parentHeader)) {
|
||||
if (!["Item Key"].includes(header.parentHeader)) {
|
||||
// console.log(header.parentHeader);
|
||||
|
||||
// Create the parent header
|
||||
@ -4473,7 +4495,12 @@ function populateTable(json) {
|
||||
th.classList.add('sticky');
|
||||
}
|
||||
|
||||
if(header.parentHeader !== 'Particulars' && header.parentHeader !== 'Sno'){
|
||||
if (header.parentHeader === "Action") {
|
||||
th.classList.add('readonly-select');
|
||||
th.textContent = " ";
|
||||
}
|
||||
|
||||
if(header.parentHeader !== 'Particulars' && header.parentHeader !== 'Sno' && header.parentHeader !== "Action"){
|
||||
th.style.backgroundColor = randomColor;
|
||||
}
|
||||
// Calculate colspan based on the number of subheaders
|
||||
@ -4507,7 +4534,12 @@ function populateTable(json) {
|
||||
subTh.classList.add('sticky');
|
||||
}
|
||||
|
||||
if(header.parentHeader != "Particulars" && header.parentHeader !== 'Sno'){
|
||||
if (header.parentHeader === "Action") {
|
||||
subTh.classList.add('readonly-select');
|
||||
subTh.textContent = " ";
|
||||
}
|
||||
|
||||
if(header.parentHeader != "Particulars" && header.parentHeader !== 'Sno' && header.parentHeader !== "Action"){
|
||||
subTh.style.backgroundColor = randomColor;
|
||||
}
|
||||
|
||||
@ -4554,7 +4586,7 @@ function populateTable(json) {
|
||||
|
||||
// Create a td for each subheader
|
||||
json.table_data.headers.forEach((header, headerIndexForCalc) => {
|
||||
if (!["Item Key", "Sno", "Particulars", "Action"].includes(header.parentHeader)) {
|
||||
if (!["Item Key", "Sno", "Particulars"].includes(header.parentHeader)) {
|
||||
header.subHeaders.forEach((value, index) => {
|
||||
|
||||
// if(value != '-'){
|
||||
@ -4568,6 +4600,13 @@ function populateTable(json) {
|
||||
td.setAttribute("contenteditable", "true");
|
||||
}
|
||||
|
||||
if(header.parentHeader == "Action"){
|
||||
td.setAttribute("contenteditable", false);
|
||||
td.classList.add('action');
|
||||
td.classList.add('disableborder');
|
||||
td.classList.add('readonly-select');
|
||||
}
|
||||
|
||||
td.classList.add(
|
||||
'editablecolumnsforcalc',
|
||||
label.toLowerCase().replace(/\s+/g, '').replace(/[%₹()]/g, '')
|
||||
@ -4582,6 +4621,7 @@ function populateTable(json) {
|
||||
}
|
||||
|
||||
// td.id = `${label.toLowerCase()}`;
|
||||
console.log('child table', header.parentHeader);
|
||||
td.textContent = json.premium_data?.data?.[header.parentHeader]?.[value]?.[label] || "";
|
||||
tr.appendChild(td);
|
||||
// }
|
||||
|
||||
59
phpqueue.sh
59
phpqueue.sh
@ -1,56 +1,7 @@
|
||||
!/bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
while true; do
|
||||
echo "Running job at $(date)"
|
||||
/usr/bin/php /opt/lampp/htdocs/nhance/public/index.php cli/processjob
|
||||
!/bin/bash
|
||||
!/bin/bash
|
||||
|
||||
# Read the Job_Queue variable from the temporary file
|
||||
#!/bin/bash
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
# Define the root directory for the project and PID file path
|
||||
#!/bin/bash
|
||||
|
||||
# Define paths
|
||||
# ROOT_DIR=$(dirname "$(realpath "$0")")
|
||||
# JOB_QUEUE_FILE="$ROOT_DIR/job_queue"
|
||||
# PID_FILE="$ROOT_DIR/phpqueue.pid"
|
||||
|
||||
|
||||
# # Check if the script is already running
|
||||
# if [[ -f "$PID_FILE" ]] && kill -0 "$(cat $PID_FILE)" 2>/dev/null; then
|
||||
# echo "phpqueue.sh is already running. Exiting."
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
# # Write the current process ID (PID) to the PID file
|
||||
# echo $$ > "$PID_FILE"
|
||||
|
||||
# # Ensure the PID file is removed on script exit
|
||||
# trap "rm -f $PID_FILE" EXIT
|
||||
|
||||
# # Main loop
|
||||
# while true; do
|
||||
# # Check if the Job_Queue file exists
|
||||
# if [[ ! -f "$JOB_QUEUE_FILE" ]]; then
|
||||
# echo "Job Queue file not found."
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
# # Read the value of Job_Queue from the file
|
||||
# Job_Queue=$(cat "$JOB_QUEUE_FILE")
|
||||
|
||||
# if [[ "$Job_Queue" -eq 1 ]]; then
|
||||
# /usr/bin/php /opt/lampp/htdocs/nhance/public/index.php cli/processjob
|
||||
# else
|
||||
# echo "No job to process."
|
||||
# fi
|
||||
|
||||
# # Sleep for 1 second before the next iteration
|
||||
# sleep 1
|
||||
# done
|
||||
|
||||
/usr/bin/php /var/www/nhance/zenith/public/index.php cli/processjob
|
||||
sleep 1 # Optional: Add a sleep to avoid CPU overload
|
||||
done
|
||||
|
||||
11
writable/cache/.gitkeep
vendored
11
writable/cache/.gitkeep
vendored
@ -1,11 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue
Block a user