FEAT_CHATBOT_NEW_AND_OLD_POLICY
This commit is contained in:
parent
2e6eef942e
commit
c48505b2d2
@ -19,6 +19,10 @@ class MainMenuConversation extends Conversation
|
||||
|
||||
protected function showMainMenu()
|
||||
{
|
||||
$this->bot->userStorage()->save([
|
||||
'path' => []
|
||||
]);
|
||||
|
||||
$question = Question::create("Please choose")
|
||||
->addButtons([
|
||||
Button::create("📄 Ecard Download")->value("ecard_download"),
|
||||
@ -30,6 +34,13 @@ class MainMenuConversation 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
|
||||
]);log_message("error","Path : ".json_encode($path));
|
||||
switch ($answer->getValue()) {
|
||||
case "ecard_download":
|
||||
|
||||
@ -47,7 +58,6 @@ class MainMenuConversation extends Conversation
|
||||
$this->bot->startConversation(new ReimbursementClaimProcessConversation());
|
||||
break;
|
||||
case "reimbursement_status":
|
||||
$this->say("Reimbursement Claim Status selected. (Dummy Response)");
|
||||
$this->bot->startConversation(new ReimbursementClaimStatusConversation());
|
||||
|
||||
break;
|
||||
|
||||
@ -51,6 +51,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:
|
||||
|
||||
|
||||
@ -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,18 @@ 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->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;
|
||||
}
|
||||
});
|
||||
$this->say("Fetching Status please wait ...");
|
||||
if (sleep(1.5)){
|
||||
$data = ChatbotHelper::getReimbursementClaimStatus();
|
||||
}
|
||||
$this->bot->types();
|
||||
if ($data){
|
||||
$this->say("The claim status for the claim Number {$data['claim_number']} is currently in {$data['claim_status']} 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,8 +11,6 @@ use App\Helpers\ChatbotHelper;
|
||||
|
||||
class commonPolicyOptionConversations extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->policyOptions();
|
||||
@ -20,14 +18,21 @@ class commonPolicyOptionConversations extends Conversation
|
||||
|
||||
protected function policyOptions()
|
||||
{
|
||||
$question = Question::create("Choose Policy Type:")
|
||||
$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"),
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
$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 "upload_vehicle_details":
|
||||
// $cityName = $response->getText();
|
||||
@ -48,3 +53,5 @@ class commonPolicyOptionConversations extends Conversation
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -28,6 +28,13 @@ class fourWheelerOptionsConversations 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 "3p":
|
||||
// $cityName = $response->getText();
|
||||
|
||||
@ -20,23 +20,39 @@ class hospitalPolicyConversation extends Conversation
|
||||
|
||||
protected function showMediclaimPolicyOptions()
|
||||
{
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
|
||||
if (in_array('individual',$path)){
|
||||
$text1 = 'Upload Policy Copy and Individual Details';
|
||||
$value = 'individual_upload';
|
||||
}else{
|
||||
$text1 = '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("🔹 ".$text1)->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){
|
||||
$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->bot->startConversation(new medicalClaimFormConversations());
|
||||
break;
|
||||
case "floater":
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
case "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.");
|
||||
|
||||
313
app/Controllers/Chatbot/medicalClaimFormConversations.php
Normal file
313
app/Controllers/Chatbot/medicalClaimFormConversations.php
Normal file
@ -0,0 +1,313 @@
|
||||
<?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"),
|
||||
]);
|
||||
|
||||
$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;
|
||||
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>';
|
||||
// }
|
||||
}
|
||||
@ -28,13 +28,20 @@ class medicalClaimOptionConversations 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 "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());
|
||||
|
||||
@ -29,6 +29,13 @@ class policyConversation 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
|
||||
]);log_message("error","Path ".json_encode($path));
|
||||
switch ($answer->getValue()) {
|
||||
case "2_wheeler":
|
||||
// $cityName = $response->getText();
|
||||
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -27,6 +27,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.");
|
||||
|
||||
@ -28,6 +28,13 @@ class twoWheelerOptionsConversations 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 "3p":
|
||||
// $cityName = $response->getText();
|
||||
|
||||
@ -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,16 @@ class vehicleFormConversation extends Conversation
|
||||
protected $vehicleYOM;
|
||||
protected $vehicleEngineNo;
|
||||
protected $vehicleInvoiceNo;
|
||||
protected $userId;
|
||||
protected $complied_information;
|
||||
|
||||
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()
|
||||
@ -50,7 +57,21 @@ class vehicleFormConversation extends Conversation
|
||||
$this->say('Vehicle Engine Number Cannot be Empty');
|
||||
return $this->askVehicleEngineNo(); // Re-ask if empty
|
||||
}
|
||||
$this->askVehicleInvoiceNo(); // Ask next question
|
||||
|
||||
// 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();
|
||||
} else {
|
||||
$this->askVehicleInvoiceNo(); // Ask next question
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -68,16 +89,82 @@ 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');
|
||||
|
||||
// Prepare vehicle details
|
||||
$vehicleDetails = [
|
||||
'vehicle_name' => $this->vehicleName,
|
||||
'vehicle_yom' => $this->vehicleYOM,
|
||||
'vehicle_engine_no' => $this->vehicleEngineNo,
|
||||
'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;
|
||||
}
|
||||
|
||||
// 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_invoice_no'])) {
|
||||
$vehicleInfo .= "🔹 Invoice No: " . $vehicle_details['vehicle_invoice_no'] . "<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("❌ No")->value("no"),
|
||||
]);
|
||||
$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 "no":
|
||||
$this->askVehicleName();
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->showHospitalMenu();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,10 @@ 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
|
||||
{
|
||||
@ -41,27 +45,6 @@ class ChatbotHelper
|
||||
return $EmployeeModel->select('mobile')->where('id',$emp_id)->first()['mobile'];
|
||||
}
|
||||
|
||||
public static function get_payload_data(string $key = null)
|
||||
{
|
||||
// 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;
|
||||
@ -202,6 +185,70 @@ 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 = 'srinivas.saravanan@venbainfotech.com';
|
||||
$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(){
|
||||
$emp_id = 12052;
|
||||
$emp_code = 'EMP001-K4';
|
||||
$client_id = 12;
|
||||
$policy_id = 12;
|
||||
$client_branch_id = 1;
|
||||
$relationship ='Father';
|
||||
|
||||
$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")
|
||||
->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();
|
||||
|
||||
$ticket_controller = new TicketController();
|
||||
|
||||
if (!empty($data)){
|
||||
$ticket_id = $data['id'];
|
||||
$mail_content = $ticket_controller->constructMailContent($ticket_id);
|
||||
$mail_response = $ticket_controller->sendTrigger($mail_content);
|
||||
return $data;
|
||||
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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}}", "<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("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace("{{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_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);
|
||||
|
||||
|
||||
$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}}", $employee_name, $mail_content);
|
||||
$mail_content = str_replace("{{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,16 @@ 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}}", "<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("[[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("[[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("{{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("{{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);
|
||||
$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 +172,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_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("{{app_link}}", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
|
||||
// Step 1: Replace the placeholder with an HTML table structure
|
||||
$mail = '';
|
||||
@ -518,9 +518,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}}", $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);
|
||||
|
||||
// print_r($mail_content); die;
|
||||
|
||||
@ -570,11 +570,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_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("{{app_link}}", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
|
||||
// Step 1: Replace the placeholder with an HTML table structure
|
||||
$mail = '';
|
||||
@ -816,16 +816,16 @@ class sendMailNotification
|
||||
}
|
||||
|
||||
|
||||
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
||||
$mail_content = str_replace("{{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}}", $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 +868,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}}", "<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("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace("{{app_link}}", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
|
||||
// Step 1: Replace the placeholder with an HTML table structure
|
||||
$mail = '';
|
||||
@ -1115,7 +1115,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}}", $table_content , $mail_content);
|
||||
|
||||
|
||||
$hr_mails = $client_data['hr_mails'];
|
||||
@ -1124,7 +1124,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 +1173,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}}", "<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("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace("{{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 +1204,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("[[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_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);
|
||||
|
||||
if ((isset($notification_data) && $notification_data['enabled'] == 1)) {
|
||||
|
||||
@ -1256,15 +1256,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}}", "<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("[[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}}", $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);
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'],'attachments' => $attachments, 'reply_to' => $client_data['reply_to']];
|
||||
|
||||
@ -1301,11 +1301,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_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("{{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 +1413,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}}", $name . ' (' . $emp_code . ')' , $mail_content);
|
||||
$mail_content = str_replace("{{member_mobile}}", $mobile, $mail_content);
|
||||
$mail_content = str_replace("{{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 +1453,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_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("{{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 +1563,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}}", $name . ' (' . $emp_code . ')' , $mail_content);
|
||||
$mail_content = str_replace("{{member_summary}}", $table_content , $mail_content);
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to']];
|
||||
|
||||
@ -1600,11 +1600,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}}", "<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("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace("{{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 +1712,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}}", $name . ' (' . $emp_code . ')' , $mail_content);
|
||||
$mail_content = str_replace("{{member_summary}}", $table_content , $mail_content);
|
||||
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to']];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user