diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index 5065832a..77b01b3d 100755
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -29,6 +29,7 @@ $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->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn");
// $routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
// $routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
diff --git a/app/Controllers/Chatbot/EcardDownloadConversation.php b/app/Controllers/Chatbot/EcardDownloadConversation.php
index 19fad42f..b0cb78ae 100644
--- a/app/Controllers/Chatbot/EcardDownloadConversation.php
+++ b/app/Controllers/Chatbot/EcardDownloadConversation.php
@@ -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());
diff --git a/app/Controllers/Chatbot/MainMenuConversation.php b/app/Controllers/Chatbot/MainMenuConversation.php
index c326e579..87d9a4ef 100644
--- a/app/Controllers/Chatbot/MainMenuConversation.php
+++ b/app/Controllers/Chatbot/MainMenuConversation.php
@@ -6,64 +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()
{
+ $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")
- ->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"),
- ]);
+ $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) {
- $path = $this->bot->userStorage()->get('path');
- array_push($path,
- $answer->getValue()
- );
+ 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
- ]);log_message("error","Path : ".json_encode($path));
- switch ($answer->getValue()) {
- case "ecard_download":
+ ]);
- // $message = ChatbotHelper::get_payload_data();
- // $this->say($message);
- // $this->say("📄 Ecard Download Menu:");
+ switch ($user_reponse) {
+
+ 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->bot->startConversation(new ReimbursementClaimStatusConversation());
-
break;
case "new_policy":
- $this->bot->startConversation(new policyConversation());
- break;
case "renew_policy":
$this->bot->startConversation(new policyConversation());
break;
@@ -73,6 +84,7 @@ class MainMenuConversation extends Conversation
break;
}
});
- }
+
+ }
}
diff --git a/app/Controllers/Chatbot/NetworkHospitalConversation.php b/app/Controllers/Chatbot/NetworkHospitalConversation.php
index 063a572b..2e59f896 100644
--- a/app/Controllers/Chatbot/NetworkHospitalConversation.php
+++ b/app/Controllers/Chatbot/NetworkHospitalConversation.php
@@ -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))
@@ -80,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;
}
});
diff --git a/app/Controllers/Chatbot/ReimbursementClaimProcessConversation.php b/app/Controllers/Chatbot/ReimbursementClaimProcessConversation.php
index ca3bf60a..14602974 100644
--- a/app/Controllers/Chatbot/ReimbursementClaimProcessConversation.php
+++ b/app/Controllers/Chatbot/ReimbursementClaimProcessConversation.php
@@ -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...!");
diff --git a/app/Controllers/Chatbot/ReimbursementClaimStatusConversation.php b/app/Controllers/Chatbot/ReimbursementClaimStatusConversation.php
index 96149cdf..db8831bc 100644
--- a/app/Controllers/Chatbot/ReimbursementClaimStatusConversation.php
+++ b/app/Controllers/Chatbot/ReimbursementClaimStatusConversation.php
@@ -21,9 +21,10 @@ class ReimbursementClaimStatusConversation extends Conversation
protected function claimStatus()
{
$this->say("Fetching Status please wait ...");
- if (sleep(1.5)){
- $data = ChatbotHelper::getReimbursementClaimStatus();
- }
+
+ $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 {$data['claim_status']} status.
More Detailed Information is sent to your mail");
diff --git a/app/Controllers/Chatbot/commonPolicyOptionConversations.php b/app/Controllers/Chatbot/commonPolicyOptionConversations.php
index f33b00d2..c6eb8eae 100644
--- a/app/Controllers/Chatbot/commonPolicyOptionConversations.php
+++ b/app/Controllers/Chatbot/commonPolicyOptionConversations.php
@@ -11,6 +11,12 @@ 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()
{
$this->policyOptions();
@@ -18,14 +24,26 @@ 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) {
+ if (!$answer->isInteractiveMessageReply()) {
+ $user_reponse = null;
+ }
$path = $this->bot->userStorage()->get('path');
array_push($path,
$answer->getValue()
@@ -33,7 +51,9 @@ class commonPolicyOptionConversations extends Conversation
$this->bot->userStorage()->save([
'path' => $path
]);
- switch ($answer->getValue()) {
+ $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());
diff --git a/app/Controllers/Chatbot/doYouWantToContinueConversation.php b/app/Controllers/Chatbot/doYouWantToContinueConversation.php
index ba5c1864..31bcf174 100644
--- a/app/Controllers/Chatbot/doYouWantToContinueConversation.php
+++ b/app/Controllers/Chatbot/doYouWantToContinueConversation.php
@@ -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:
diff --git a/app/Controllers/Chatbot/fourWheelerOptionsConversations.php b/app/Controllers/Chatbot/fourWheelerOptionsConversations.php
index bd5386a6..b2753566 100644
--- a/app/Controllers/Chatbot/fourWheelerOptionsConversations.php
+++ b/app/Controllers/Chatbot/fourWheelerOptionsConversations.php
@@ -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,14 +24,26 @@ 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) {
+ if (!$answer->isInteractiveMessageReply()) {
+ $user_reponse = null;
+ }
$path = $this->bot->userStorage()->get('path');
array_push($path,
$answer->getValue()
@@ -35,7 +51,9 @@ class fourWheelerOptionsConversations extends Conversation
$this->bot->userStorage()->save([
'path' => $path
]);
- switch ($answer->getValue()) {
+ $path = $this->bot->userStorage()->get('path');
+ // $this->say(json_encode($path));
+ switch ($user_reponse) {
case "3p":
// $cityName = $response->getText();
$this->bot->startConversation(new commonPolicyOptionConversations());
diff --git a/app/Controllers/Chatbot/hospitalPolicyConversation.php b/app/Controllers/Chatbot/hospitalPolicyConversation.php
index 32cce22b..a171c005 100644
--- a/app/Controllers/Chatbot/hospitalPolicyConversation.php
+++ b/app/Controllers/Chatbot/hospitalPolicyConversation.php
@@ -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()
{
@@ -23,20 +27,20 @@ class hospitalPolicyConversation extends Conversation
$path = $this->bot->userStorage()->get('path');
if (in_array('individual',$path)){
- $text1 = 'Upload Policy Copy and Individual Details';
+ $text = 'Upload Policy Copy and Individual Details';
$value = 'individual_upload';
}else{
- $text1 = 'Upload Policy Copy and Family Details';
+ $text = 'Upload Policy Copy and Family Details';
$value = 'family_upload';
}
$question = Question::create("Choose Policy Type:")
->addButtons([
- Button::create("🔹 ".$text1)->value($value),
+ 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) use ($value){
+ $this->bot->ask($question, function ($answer) use ($value, $text){
$path = $this->bot->userStorage()->get('path');
array_push($path,
$answer->getValue()
@@ -46,9 +50,12 @@ class hospitalPolicyConversation extends Conversation
]);
switch ($answer->getValue()) {
case $value:
+ $this->say("you have chosen ".$text);
+
$this->bot->startConversation(new medicalClaimFormConversations());
break;
case "service_executive":
+ $this->say('You have chosen to speak with our Service Executive');
$this->bot->startConversation(new serviceExecutiveConversation());
break;
case "go_back":
diff --git a/app/Controllers/Chatbot/medicalClaimOptionConversations.php b/app/Controllers/Chatbot/medicalClaimOptionConversations.php
index 37ed0354..db5312a7 100644
--- a/app/Controllers/Chatbot/medicalClaimOptionConversations.php
+++ b/app/Controllers/Chatbot/medicalClaimOptionConversations.php
@@ -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,14 +25,26 @@ 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);
+ }
- $this->bot->ask($question, function ($answer) {
+ if (!$answer->isInteractiveMessageReply()) {
+ $user_reponse = null;
+ }
$path = $this->bot->userStorage()->get('path');
array_push($path,
$answer->getValue()
@@ -35,7 +52,8 @@ class medicalClaimOptionConversations extends Conversation
$this->bot->userStorage()->save([
'path' => $path
]);
- switch ($answer->getValue()) {
+
+ switch ($user_reponse) {
case "individual":
// $cityName = $response->getText();
$this->bot->startConversation(new hospitalPolicyConversation());
diff --git a/app/Controllers/Chatbot/policyConversation.php b/app/Controllers/Chatbot/policyConversation.php
index bcc44070..04c8d9a5 100644
--- a/app/Controllers/Chatbot/policyConversation.php
+++ b/app/Controllers/Chatbot/policyConversation.php
@@ -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,23 +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) {
+ if (!$answer->isInteractiveMessageReply()) {
+ $user_reponse = null;
+ }
$path = $this->bot->userStorage()->get('path');
array_push($path,
$answer->getValue()
);
$this->bot->userStorage()->save([
'path' => $path
- ]);log_message("error","Path ".json_encode($path));
- switch ($answer->getValue()) {
+ ]);
+ switch ($user_reponse) {
case "2_wheeler":
// $cityName = $response->getText();
$this->bot->startConversation(new twoWheelerOptionsConversations());
diff --git a/app/Controllers/Chatbot/serviceExecutiveConversation.php b/app/Controllers/Chatbot/serviceExecutiveConversation.php
index 565da65f..72b678f8 100644
--- a/app/Controllers/Chatbot/serviceExecutiveConversation.php
+++ b/app/Controllers/Chatbot/serviceExecutiveConversation.php
@@ -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"),
diff --git a/app/Controllers/Chatbot/twoWheelerOptionsConversations.php b/app/Controllers/Chatbot/twoWheelerOptionsConversations.php
index 4b29005a..c4359041 100644
--- a/app/Controllers/Chatbot/twoWheelerOptionsConversations.php
+++ b/app/Controllers/Chatbot/twoWheelerOptionsConversations.php
@@ -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,14 +25,26 @@ 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);
+ }
- $this->bot->ask($question, function ($answer) {
+ if (!$answer->isInteractiveMessageReply()) {
+ $user_reponse = null;
+ }
$path = $this->bot->userStorage()->get('path');
array_push($path,
$answer->getValue()
@@ -35,7 +52,8 @@ class twoWheelerOptionsConversations extends Conversation
$this->bot->userStorage()->save([
'path' => $path
]);
- switch ($answer->getValue()) {
+
+ switch ($user_reponse) {
case "3p":
// $cityName = $response->getText();
$this->bot->startConversation(new commonPolicyOptionConversations());
diff --git a/app/Controllers/Chatbot/vehicleFormConversation.php b/app/Controllers/Chatbot/vehicleFormConversation.php
index 37baef1d..1595ae52 100644
--- a/app/Controllers/Chatbot/vehicleFormConversation.php
+++ b/app/Controllers/Chatbot/vehicleFormConversation.php
@@ -15,6 +15,9 @@ class vehicleFormConversation extends Conversation
protected $vehicleInvoiceNo;
protected $userId;
protected $complied_information;
+ protected $fuelType;
+ protected $seater;
+ protected $chassisNumber;
public function run()
{
@@ -33,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
});
}
@@ -61,17 +93,23 @@ class vehicleFormConversation extends Conversation
// Retrieve 'path' from storage
$path = $this->bot->userStorage()->get('path');
- // Append 'new_policy' to path if not already present
- // if (!in_array('new_policy', $path)) {
- // array_push($path, 'new_policy');
- // $this->bot->userStorage()->save(['path' => $path]);
- // }
- log_message('error','Path: ',$path);
- if (in_array('new_policy', $path)) {
- $this->storeVehicleData();
+ 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
});
}
@@ -91,17 +129,21 @@ class vehicleFormConversation extends Conversation
{
// 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,
+ $vehicleDetails['vehicle_invoice_no'] = $this->vehicleInvoiceNo
+
];
// Only store 'vehicle_invoice_no' if 'new_policy' is NOT in path
- if (!in_array('new_policy', $path)) {
- $vehicleDetails['vehicle_invoice_no'] = $this->vehicleInvoiceNo;
+ if (in_array('4_wheeler', $path)) {
+ $vehicleDetails['vehicle_fuelType'] = $this->fuelType;
+ $vehicleDetails['vehicle_seater'] = $this->seater;
+ $vehicleDetails['vehicle_chassisNo'] = $this->chassisNumber;
}
// Save vehicle details
@@ -109,9 +151,9 @@ class vehicleFormConversation extends Conversation
$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', 'All Details: ' . json_encode($alldata));
- log_message('error', 'Updated Vehicle Details: ' . json_encode($vehicle_details));
+ // log_message('error', 'Updated Vehicle Details: ' . json_encode($vehicle_details));
$this->say('Vehicle Information Saved!');
@@ -120,8 +162,10 @@ class vehicleFormConversation extends Conversation
$vehicleInfo .= "🔹 Year of Manufacture: " . $vehicle_details['vehicle_yom'] . "
";
$vehicleInfo .= "🔹 Engine No: " . $vehicle_details['vehicle_engine_no'] . "
";
- if (isset($vehicle_details['vehicle_invoice_no'])) {
- $vehicleInfo .= "🔹 Invoice No: " . $vehicle_details['vehicle_invoice_no'] . "
";
+ if (isset($vehicle_details['vehicle_fuelType'])) {
+ $vehicleInfo .= "🔹 Fuel Type: " . $vehicle_details['vehicle_fuelType'] . "
";
+ $vehicleInfo .= "🔹 Seater: " . $vehicle_details['vehicle_seater'] . "
";
+ $vehicleInfo .= "🔹 Chassis Number: " . $vehicle_details['vehicle_chassisNo'] . "
";
}
$this->complied_information = $vehicleInfo;
// Send the message with vehicle details
diff --git a/app/Controllers/ChatbotControllerNew.php b/app/Controllers/ChatbotControllerNew.php
index 4311a9bb..9fc9be36 100644
--- a/app/Controllers/ChatbotControllerNew.php
+++ b/app/Controllers/ChatbotControllerNew.php
@@ -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,22 +46,53 @@ 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
});
diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php
index 6714a44d..63f167df 100755
--- a/app/Controllers/ClientController.php
+++ b/app/Controllers/ClientController.php
@@ -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
{
@@ -4321,4 +4324,307 @@ class ClientController extends AdminController
}
+ // -----------------------------------------------------------------------------------------------------
+
+
+ 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();
+
+ $successData = [];
+ foreach ($renewalData as $key => $value) {
+ // Get branch_id properly
+ $branch = $this->clientBranchModel->where('client_id', $value['client_id'] ?? 0)->first();
+ $value['branch_id'] = $branch['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);
+ }
+
+ // 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);
+ // }
+
+ private function preparePolicyData($renewalData)
+ {
+ $data = [
+ 'issuer' => $renewalData['issuer_type_id'],
+ 'client_id' => $renewalData['client_id'],
+ 'client_branch_id' => $renewalData['branch_id'] ?? 0,
+ 'vehicle_id' => $renewalData['vehicel_id'],
+ 'insurer_id' => $renewalData['insurer_id'],
+ 'insurer_branch_id' => $renewalData['insurer_branch_id'],
+ 'tpa_id' => null,
+ 'tpa_branch_id' => null,
+ 'policy_type_id' => $renewalData['policy_type_id'],
+ 'client_policy_id' => $renewalData['client_policy_id'] ?? null,
+ 'issue_type' => 1,
+ 'source_client_policy_id' => null,
+ 'policy_no' => $renewalData['policy_no'],
+ '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);
+ $policyTransactionModel = new PolicyTransactionModel();
+ $id = $policyTransactionModel->insert($data);
+ return $id;
+ }
+
+ private function prepareVehicleData($renewalData)
+ {
+ $vehicleData = [
+ 'vehicle_no' => $renewalData['veh_no'],
+ 'type' => null,
+ 'description' => null,
+ 'owner' => $renewalData['client_id'], // client_id
+ 'branch_id' => $renewalData['client_type_id'] == 1 ? $renewalData['branch_id'] : null, // client_branch_id
+ 'old_owner' => null,
+ 'rc' => null,
+ ];
+
+ $VehicleModel = new VehicleModel();
+ $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'],
+ '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;
+ }
+
+
}
diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php
index 0cc8c4f4..856ef118 100755
--- a/app/Controllers/EmpDataServiceController.php
+++ b/app/Controllers/EmpDataServiceController.php
@@ -152,7 +152,7 @@ class EmpDataServiceController extends BaseController
$objects = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($export_data);
$policy_details = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first();
- if ($policy_details['cd_ac_no'] == null) {
+ if ($policy_details['cd_ac_pk'] == null) {
$this->myLogger->logme('error', 'The policy does not have a CD account number.');
return 5;
}
@@ -649,7 +649,7 @@ class EmpDataServiceController extends BaseController
$policy_details = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first();
- if ($policy_details['cd_ac_no'] == null) {
+ if ($policy_details['cd_ac_pk'] == null) {
$this->myLogger->logme('error', 'The policy does not have a CD account number.');
return 1;
}
@@ -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
@@ -959,7 +959,7 @@ class EmpDataServiceController extends BaseController
$policy_details = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first();
- if ($policy_details['cd_ac_no'] == null) {
+ if ($policy_details['cd_ac_pk'] == null) {
$this->myLogger->logme('error', 'The policy does not have a CD account number.');
return 5;
}
@@ -1829,7 +1829,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');
diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php
index 06bb8532..e81684f7 100755
--- a/app/Controllers/EmployeeController.php
+++ b/app/Controllers/EmployeeController.php
@@ -590,7 +590,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'));
@@ -2225,6 +2234,7 @@ class EmployeeController extends AdminController
}
}
+ //UPDATE EMPLOYEE
public function update_emp_data()
{
$data = $this->request->getPost();
diff --git a/app/Controllers/NotificationController.php b/app/Controllers/NotificationController.php
index 0dd29522..efdc2571 100755
--- a/app/Controllers/NotificationController.php
+++ b/app/Controllers/NotificationController.php
@@ -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)){
diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php
index 8100d40e..e2a9bb42 100644
--- a/app/Controllers/TicketController.php
+++ b/app/Controllers/TicketController.php
@@ -141,52 +141,68 @@ class TicketController extends BaseController
}
public function ticketSearch($action = null)
- {
+ {
+ $db = db_connect();
+
+ $subquery = $db->table('ticket_history th')
+ ->select([
+ 'th.ticket_id',
+ "CASE
+ WHEN DATEDIFF(
+ th.created_at,
+ COALESCE(
+ (SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = th.ticket_id),
+ tm.created_at
+ )
+ ) BETWEEN 0 AND 6 THEN '0-6 Days'
+ WHEN DATEDIFF(
+ th.created_at,
+ COALESCE(
+ (SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = th.ticket_id),
+ tm.created_at
+ )
+ ) BETWEEN 7 AND 12 THEN '7-12 Days'
+ WHEN DATEDIFF(
+ th.created_at,
+ COALESCE(
+ (SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = th.ticket_id),
+ tm.created_at
+ )
+ ) BETWEEN 13 AND 20 THEN '13-20 Days'
+ ELSE 'Above 20 Days'
+ END AS tat"
+ ])
+ ->join('ticket_master tm', 'tm.id = th.ticket_id', 'right')
+ ->where('tm.is_active', 1)
+ ->groupBy('th.ticket_id, tm.created_at');
+
//action 1 get last 100 rows, action 2 filter and get all rows related to that
if ($action == 1) {
- $data = $this->ticketMasterModel
- ->select("
+ $query = $db->table('ticket_master tm')
+ ->select([
+ 'tm.id',
+ 'tcs.claim_status AS status',
+ 'tm.claim_number AS claim_no',
+ 'tm.tpa_id',
+ 'tm.emp_name',
+ 'i.name AS insurer_name',
+ 'c.client_name',
+ 'tm.insured_name',
+ 'c.short_name',
+ 'DATE_FORMAT(tm.created_at, "%d-%m-%Y") AS ticket_created_date',
+ 'COALESCE(tat_category.tat, "0-6 Days") AS tat'
+ ])
+ ->join('insurers i', 'i.id = tm.insurer_id AND i.is_active = 1', 'left')
+ ->join('clients c', 'c.id = tm.client_id AND c.is_active = 1', 'left')
+ ->join('ticket_claim_status tcs', 'tcs.id = tm.claim_status_id AND tcs.is_active = 1', 'left')
+ ->join("({$subquery->getCompiledSelect()}) tat_category", 'tm.id = tat_category.ticket_id', 'left')
+ ->where('tm.is_active', 1)
+ ->orderBy('tm.id', 'DESC');
- ticket_master.id,
- ticket_claim_status.claim_status as status,
- ticket_master.claim_number as claim_no,
- ticket_master.tpa_id,
- ticket_master.emp_name,
- insurers.name as insurer_name,
- clients.client_name,
- ticket_master.insured_name,
- clients.short_name,
- DATE_FORMAT(ticket_master.created_at, '%d-%m-%Y') as ticket_created_date,
- CASE
- WHEN DATEDIFF(
- ticket_master.updated_at,
- COALESCE(ticket_master.updated_at, ticket_history.created_at)
- ) BETWEEN 0 AND 6 THEN '0-6 Days'
- WHEN DATEDIFF(
- ticket_master.updated_at,
- COALESCE(ticket_master.updated_at, ticket_history.created_at)
- ) BETWEEN 7 AND 12 THEN '7-12 Days'
- WHEN DATEDIFF(
- ticket_master.updated_at,
- COALESCE(ticket_master.updated_at, ticket_history.created_at)
- ) BETWEEN 13 AND 20 THEN '13-20 Days'
- ELSE 'Above 20 Days'
- END AS tat
+ $data = $query->get()->getResultArray();
- ")
- ->join('insurers', 'insurers.id = ticket_master.insurer_id and insurers.is_active = 1', 'left')
- ->join('clients', 'clients.id = ticket_master.client_id and clients.is_active = 1', 'left')
- ->join('ticket_claim_status', 'ticket_claim_status.id = ticket_master.claim_status_id and ticket_claim_status.is_active = 1', 'left')
- ->join('ticket_history', "ticket_master.id = ticket_history.ticket_id")
- ->where('ticket_master.is_active', 1)
- ->where('ticket_history.is_active', 1)
- ->groupBy('ticket_master.id')
- ->orderBy('ticket_master.id', 'DESC')
- ->limit(100)
- ->findAll();
-
- // dd($data);
+ // dd(db_connect()->getLastQuery());
return $data;
@@ -200,46 +216,33 @@ class TicketController extends BaseController
}
}
// print_rr($where);
- $data = $this->ticketMasterModel
- ->select("
- ticket_master.id,
- ticket_claim_status.claim_status as status,
- ticket_master.claim_number as claim_no,
- ticket_master.tpa_id,
- ticket_master.emp_name,
- insurers.name as insurer_name,
- clients.client_name,ticket_master.insured_name,
- clients.short_name,
- DATE_FORMAT(ticket_master.created_at, '%d-%m-%Y') as ticket_created_date,
- CASE
- WHEN DATEDIFF(
- ticket_master.updated_at,
- COALESCE(ticket_master.updated_at, ticket_history.created_at)
- ) BETWEEN 0 AND 6 THEN '0-6 Days'
- WHEN DATEDIFF(
- ticket_master.updated_at,
- COALESCE(ticket_master.updated_at, ticket_history.created_at)
- ) BETWEEN 7 AND 12 THEN '7-12 Days'
- WHEN DATEDIFF(
- ticket_master.updated_at,
- COALESCE(ticket_master.updated_at, ticket_history.created_at)
- ) BETWEEN 13 AND 20 THEN '13-20 Days'
- ELSE 'Above 20 Days'
- END AS tat
- ")
- ->join('insurers', 'insurers.id = ticket_master.insurer_id and insurers.is_active = 1', 'left')
- ->join('clients', 'clients.id = ticket_master.client_id and clients.is_active = 1', 'left')
- ->join('ticket_claim_status', 'ticket_claim_status.id = ticket_master.claim_status_id and ticket_claim_status.is_active = 1', 'left')
- ->join('ticket_history', "ticket_master.id = ticket_history.ticket_id")
- ->where('ticket_master.is_active', 1)
- ->where('ticket_history.is_active', 1)
+ $query = $db->table('ticket_master tm')
+ ->select([
+ 'tm.id',
+ 'tcs.claim_status AS status',
+ 'tm.claim_number AS claim_no',
+ 'tm.tpa_id',
+ 'tm.emp_name',
+ 'i.name AS insurer_name',
+ 'c.client_name',
+ 'tm.insured_name',
+ 'c.short_name',
+ 'DATE_FORMAT(tm.created_at, "%d-%m-%Y") AS ticket_created_date',
+ 'COALESCE(tat_category.tat, "0-6 Days") AS tat'
+ ])
+ ->join('insurers i', 'i.id = tm.insurer_id AND i.is_active = 1', 'left')
+ ->join('clients c', 'c.id = tm.client_id AND c.is_active = 1', 'left')
+ ->join('ticket_claim_status tcs', 'tcs.id = tm.claim_status_id AND tcs.is_active = 1', 'left')
+ ->join("({$subquery->getCompiledSelect()}) tat_category", 'tm.id = tat_category.ticket_id', 'left')
+ ->where('tm.is_active', 1)
->where($where)
- ->groupBy('ticket_master.id')
- ->orderBy('ticket_master.id', 'DESC')
- ->findAll();
- // print_rr($data);
- // log_message('error',' Claims Master Data '.json_encode($data));die();
+ ->orderBy('tm.id', 'DESC');
+
+ $data = $query->get()->getResultArray();
+ // print_rr($data);
+ // log_message('error',' Claims Master Data '.json_encode($data));die();
// print_rr($data);die();
+
return $data;
}
}
diff --git a/app/Helpers/ChatbotHelper.php b/app/Helpers/ChatbotHelper.php
index b78f936c..6dff5c6c 100644
--- a/app/Helpers/ChatbotHelper.php
+++ b/app/Helpers/ChatbotHelper.php
@@ -16,18 +16,23 @@ 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){
@@ -39,20 +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 sendReimbursementProcessOverMail()
+ public static function sendReimbursementProcessOverMail($chat_session_info)
{
- $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']))
@@ -196,7 +201,7 @@ class ChatbotHelper
$message = SELF::quotationRequestMailTemplate($data);
$common = ['mail_type'=>'request_quotation_bot'];
- $email_id = 'srinivas.saravanan@venbainfotech.com';
+ $email_id = 'no-reply-otp@nhanceindia.in';
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Quotation Request Received from bot.', 'message' => $message,'common'=>$common]);
$res = json_decode($res);
@@ -218,18 +223,16 @@ class ChatbotHelper
return $message;
}
- public static function getReimbursementClaimStatus(){
- $emp_id = 12052;
- $emp_code = 'EMP001-K4';
- $client_id = 12;
- $policy_id = 12;
- $client_branch_id = 1;
- $relationship ='Father';
+ public static function getReimbursementClaimStatus($chat_session_info){
+ $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'];
$ticketMaster = new TicketMasterModel();
$data = $ticketMaster->select('tcs.claim_status,ticket_master.claim_number,ticket_master.id')
- ->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.ticket_type = cp.policy_type_id and tcs.is_active = 1")
+ // ->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)
@@ -243,7 +246,7 @@ class ChatbotHelper
$mail_content = $ticket_controller->constructMailContent($ticket_id);
$mail_response = $ticket_controller->sendTrigger($mail_content);
return $data;
-
+
}else{
return false;
}
diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php
index 0b6a3a7b..31bb0f1b 100755
--- a/app/Helpers/excel_util_helper.php
+++ b/app/Helpers/excel_util_helper.php
@@ -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;
diff --git a/app/Helpers/sendMailNotification.php b/app/Helpers/sendMailNotification.php
index 98dfacab..44bea402 100755
--- a/app/Helpers/sendMailNotification.php
+++ b/app/Helpers/sendMailNotification.php
@@ -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}}", "", $mail_content);
- $mail_content = str_replace("{{nhance_logo}}", "
", $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}}"], "
", $mail_content);
+ $mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "
", $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}}", "Review Details", $mail_content);
+ $mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "Review Details", $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}}", "
", $mail_content);
- $mail_content = str_replace("{{client_logo}}", "
", $mail_content);
- $mail_content = str_replace("{{app_link}}", "Review Details", $mail_content);
+ $mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
+ $mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "
", $mail_content);
+ $mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "
", $mail_content);
+ $mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "Review Details", $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}}", "
", $mail_content);
- $mail_content = str_replace("{{client_logo}}", "
", $mail_content);
+ $mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "
", $mail_content);
+ $mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "
", $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}}", "Review Details", $mail_content);
- $mail_content = str_replace("{{post_enrollment_app_link}}", "Review Details", $mail_content);
- // $mail_content = str_replace("{{tpa_id}}", $tpa_id, $mail_content);
- $mail_content = str_replace("{{ecard_download_link}}", "Download Insurance Card", $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}}"], $employee_mobile_no, $mail_content);
+ $mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "Review Details", $mail_content);
+ $mail_content = str_replace(["[[post_enrollment_app_link]]", "{{post_enrollment_app_link}}"], "Review Details", $mail_content);
+ // $mail_content = str_replace("[[tpa_id]]", $tpa_id, $mail_content);
+ $mail_content = str_replace(["[[ecard_download_link]]", "{{ecard_download_link}}"], "Download Insurance Card", $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}}", "
", $mail_content);
- $mail_content = str_replace("{{client_logo}}", "
", $mail_content);
+ $mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
+ $mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "
", $mail_content);
+ $mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "
", $mail_content);
- $mail_content = str_replace("{{app_link}}", "Review Details", $mail_content);
+ $mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "Review Details", $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}}", "
", $mail_content);
- $mail_content = str_replace("{{client_logo}}", "
", $mail_content);
+ $mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
+ $mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "
", $mail_content);
+ $mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "
", $mail_content);
- $mail_content = str_replace("{{app_link}}", "Review Details", $mail_content);
+ $mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "Review Details", $mail_content);
// Step 1: Replace the placeholder with an HTML table structure
$mail = '';
@@ -816,13 +817,13 @@ 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'}};
@@ -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}}", "
", $mail_content);
- $mail_content = str_replace("{{client_logo}}", "
", $mail_content);
- $mail_content = str_replace("{{client_name}}", $client_data['client_name'], $mail_content);
+ $mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "
", $mail_content);
+ $mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "
", $mail_content);
+ $mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
- $mail_content = str_replace("{{app_link}}", "Review Details", $mail_content);
+ $mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "Review Details", $mail_content);
// Step 1: Replace the placeholder with an HTML table structure
$mail = '';
@@ -1115,7 +1116,7 @@ class sendMailNotification
// $table_content .= '