Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
f6bed8485d
@ -412,6 +412,7 @@ $routes->get('cli/sendZeptoMail', 'MasterController::testZeptoSMTP');
|
||||
|
||||
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
||||
$routes->cli('cli/processjobs', 'JobWorker::processJobs');
|
||||
$routes->cli('cli/sendMailWithAutoQuery','TicketController::sendMailWithAutoQuery');
|
||||
|
||||
$routes->get("processjob", "JobWorker::processJob");
|
||||
$routes->cli('cli/new_gmail_token', 'MasterController::generateNewGmailAPIToken');
|
||||
|
||||
@ -51,7 +51,7 @@ class EcardDownloadConversation extends Conversation
|
||||
$link = base_url().'/download-e-card/' . explode('#',$answer->getValue())[1].'/1';
|
||||
$this->say('Click here to downlad: <a href="'.$link.'" target="_blank">Ecard</a>');
|
||||
|
||||
$this->bot->startConversation(new EcardDownloadConversation()); // ✅ Restart the
|
||||
$this->bot->startConversation(new doYouWantToContinueConversation()); // ✅ Restart the
|
||||
|
||||
break;
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use App\Helpers\ChatbotHelper;
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
@ -28,24 +29,30 @@ class MainMenuConversation extends Conversation
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "ecard_download":
|
||||
$this->say("📄 Ecard Download Menu:");
|
||||
$this->bot->startConversation(new EcardDownloadConversation());
|
||||
|
||||
$message = ChatbotHelper::get_payload_data();
|
||||
$this->say($message);
|
||||
// $this->say("📄 Ecard Download Menu:");
|
||||
// $this->bot->startConversation(new EcardDownloadConversation());
|
||||
break;
|
||||
case "network_hospital":
|
||||
$this->say("🏥 Network Hospital Menu:");
|
||||
$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->say("Reimbursement Claim Process selected. (Dummy Response)");
|
||||
$this->bot->startConversation(new ReimbursementClaimProcessConversation());
|
||||
break;
|
||||
case "reimbursement_status":
|
||||
$this->say("Reimbursement Claim Status selected. (Dummy Response)");
|
||||
$this->bot->startConversation(new ReimbursementClaimStatusConversation());
|
||||
|
||||
break;
|
||||
case "new_policy":
|
||||
$this->say("New Policy selected. (Dummy Response)");
|
||||
$this->bot->startConversation(new policyConversation());
|
||||
break;
|
||||
case "renew_policy":
|
||||
$this->say("Renew Policy selected. (Dummy Response)");
|
||||
$this->bot->startConversation(new policyConversation());
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
@ -54,4 +61,5 @@ class MainMenuConversation extends Conversation
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -7,8 +7,12 @@ use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
|
||||
use App\Helpers\ChatbotHelper;
|
||||
|
||||
class NetworkHospitalConversation extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->showHospitalMenu();
|
||||
@ -26,10 +30,20 @@ class NetworkHospitalConversation extends Conversation
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "search_city":
|
||||
$this->say("Searching by City... (Dummy Response)");
|
||||
$this->bot->ask("Enter the City Name",function ($response){
|
||||
// $cityName = $response->getText();
|
||||
$hospital_link = ChatbotHelper::getHospitalLink();
|
||||
$this->say("Searching for hospitals in .....");
|
||||
|
||||
$this->say('<a href="' . $hospital_link['network_hospitals'] . '" target="_blank">Click here for hospital details</a>');
|
||||
$this->bot->startConversation(new doYouWantToContinueConversation());
|
||||
});
|
||||
break;
|
||||
case "search_pincode":
|
||||
$this->say("Searching by Pincode... (Dummy Response)");
|
||||
$this->bot->ask("Enter the Pincode",function ($response){
|
||||
$pincode = $response->getText();
|
||||
$this->say("Searching for hospitals in ".$pincode.'.....');
|
||||
});
|
||||
break;
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
@ -41,4 +55,5 @@ class NetworkHospitalConversation extends Conversation
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
<?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;
|
||||
|
||||
|
||||
class ReimbursementClaimProcessConversation extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->claimProcess();
|
||||
}
|
||||
|
||||
protected function claimProcess()
|
||||
{
|
||||
$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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
<?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;
|
||||
|
||||
|
||||
class ReimbursementClaimStatusConversation extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->claimStatus();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
50
app/Controllers/Chatbot/commonPolicyOptionConversations.php
Normal file
50
app/Controllers/Chatbot/commonPolicyOptionConversations.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?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 commonPolicyOptionConversations extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->policyOptions();
|
||||
}
|
||||
|
||||
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"),
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "upload_vehicle_details":
|
||||
// $cityName = $response->getText();
|
||||
$this->bot->startConversation(new vehicleFormConversation());
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
48
app/Controllers/Chatbot/doYouWantToContinueConversation.php
Normal file
48
app/Controllers/Chatbot/doYouWantToContinueConversation.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?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 doYouWantToContinueConversation extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->askQuestion();
|
||||
}
|
||||
|
||||
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"),
|
||||
]);
|
||||
|
||||
$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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
50
app/Controllers/Chatbot/fourWheelerOptionsConversations.php
Normal file
50
app/Controllers/Chatbot/fourWheelerOptionsConversations.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?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 fourWheelerOptionsConversations extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->show4WOptions();
|
||||
}
|
||||
|
||||
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"),
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "3p":
|
||||
// $cityName = $response->getText();
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
break;
|
||||
case "comp":
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
break;
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->showHospitalMenu();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
49
app/Controllers/Chatbot/hospitalPolicyConversation.php
Normal file
49
app/Controllers/Chatbot/hospitalPolicyConversation.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?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 hospitalPolicyConversation extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->showMediclaimPolicyOptions();
|
||||
}
|
||||
|
||||
protected function showMediclaimPolicyOptions()
|
||||
{
|
||||
$question = Question::create("Choose Policy Type:")
|
||||
->addButtons([
|
||||
Button::create("🔹 Individual")->value("individual"),
|
||||
Button::create("🔹 Floater")->value("floater"),
|
||||
Button::create("◀️ Go Back")->value("go_back"),
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "individual":
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
break;
|
||||
case "floater":
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
break;
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->showHospitalMenu();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
50
app/Controllers/Chatbot/medicalClaimOptionConversations.php
Normal file
50
app/Controllers/Chatbot/medicalClaimOptionConversations.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?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 medicalClaimOptionConversations extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->showMediclaimOptions();
|
||||
}
|
||||
|
||||
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"),
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "individual":
|
||||
// $cityName = $response->getText();
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
break;
|
||||
case "floater":
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
break;
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->showHospitalMenu();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
55
app/Controllers/Chatbot/policyConversation.php
Normal file
55
app/Controllers/Chatbot/policyConversation.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?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 policyConversation extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->showNewPolicy();
|
||||
}
|
||||
|
||||
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"),
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "2_wheeler":
|
||||
// $cityName = $response->getText();
|
||||
$this->bot->startConversation(new twoWheelerOptionsConversations());
|
||||
break;
|
||||
case "4_wheeler":
|
||||
$this->bot->startConversation(new fourWheelerOptionsConversations());
|
||||
break;
|
||||
case "mediclaim":
|
||||
$this->bot->startConversation(new medicalClaimOptionConversations());
|
||||
|
||||
break;
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->showHospitalMenu();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
60
app/Controllers/Chatbot/serviceExecutiveConversation.php
Normal file
60
app/Controllers/Chatbot/serviceExecutiveConversation.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use App\Helpers\ChatbotHelper;
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
|
||||
class serviceExecutiveConversation extends Conversation
|
||||
{
|
||||
protected $mobile_number;
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->askServiceExecutive();
|
||||
}
|
||||
|
||||
protected function askServiceExecutive()
|
||||
{
|
||||
$mobile = ChatbotHelper::getPhoneNumber(); // Assuming this fetches the user's phone number
|
||||
$question = Question::create("Is this Your Mobile Number: $mobile")
|
||||
->addButtons([
|
||||
Button::create("✅ Yes")->value("yes"),
|
||||
Button::create("❌ No")->value("no"),
|
||||
Button::create("◀️ Go Back")->value("go_back"),
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "yes":
|
||||
$this->say("Our executive will call you at the earliest.");
|
||||
$this->bot->startConversation(new doYouWantToContinueConversation());
|
||||
break;
|
||||
|
||||
case "no":
|
||||
$this->ask('Enter Your Mobile Number?', function ($response) {
|
||||
$this->mobile_number = $response->getText();
|
||||
$this->bot->userStorage()->save([
|
||||
'mobile_number' => $this->mobile_number
|
||||
]);
|
||||
// Use 'use' to bring the class context into the closure
|
||||
$this->say("Our executive will call you at the earliest.");
|
||||
$this->bot->startConversation(new doYouWantToContinueConversation());
|
||||
});
|
||||
break;
|
||||
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->askServiceExecutive();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
50
app/Controllers/Chatbot/twoWheelerOptionsConversations.php
Normal file
50
app/Controllers/Chatbot/twoWheelerOptionsConversations.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?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 twoWheelerOptionsConversations extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->show2WOptions();
|
||||
}
|
||||
|
||||
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"),
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "3p":
|
||||
// $cityName = $response->getText();
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
break;
|
||||
case "comp":
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
break;
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->showHospitalMenu();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
83
app/Controllers/Chatbot/vehicleFormConversation.php
Normal file
83
app/Controllers/Chatbot/vehicleFormConversation.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
|
||||
class vehicleFormConversation extends Conversation
|
||||
{
|
||||
protected $vehicleName;
|
||||
protected $vehicleYOM;
|
||||
protected $vehicleEngineNo;
|
||||
protected $vehicleInvoiceNo;
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->askVehicleName();
|
||||
}
|
||||
|
||||
protected function askVehicleName()
|
||||
{
|
||||
$this->ask('Enter Vehicle Name ?', function ($response) {
|
||||
$this->vehicleName = $response->getText();
|
||||
if (empty($this->vehicleName)) {
|
||||
$this->say('Vehicle Name Cannot be Empty');
|
||||
return $this->askVehicleName(); // Re-ask if empty
|
||||
}
|
||||
$this->askVehicleYOM(); // Ask next question
|
||||
});
|
||||
}
|
||||
|
||||
protected function askVehicleYOM()
|
||||
{
|
||||
$this->ask('Enter Vehicle Year of Manufacture ?', function ($response) {
|
||||
$this->vehicleYOM = $response->getText();
|
||||
if (empty($this->vehicleYOM)) {
|
||||
$this->say('Vehicle Year of Manufacture Cannot be Empty');
|
||||
return $this->askVehicleYOM(); // Re-ask if empty
|
||||
}
|
||||
$this->askVehicleEngineNo(); // Ask next question
|
||||
});
|
||||
}
|
||||
|
||||
protected function askVehicleEngineNo()
|
||||
{
|
||||
$this->ask('Enter Vehicle Engine Number ?', function ($response) {
|
||||
$this->vehicleEngineNo = $response->getText();
|
||||
if (empty($this->vehicleEngineNo)) {
|
||||
$this->say('Vehicle Engine Number Cannot be Empty');
|
||||
return $this->askVehicleEngineNo(); // Re-ask if empty
|
||||
}
|
||||
$this->askVehicleInvoiceNo(); // Ask next question
|
||||
});
|
||||
}
|
||||
|
||||
protected function askVehicleInvoiceNo()
|
||||
{
|
||||
$this->ask('Enter Vehicle Invoice Number ?', function ($response) {
|
||||
$this->vehicleInvoiceNo = $response->getText();
|
||||
if (empty($this->vehicleInvoiceNo)) {
|
||||
$this->say('Vehicle Invoice Number Cannot be Empty');
|
||||
return $this->askVehicleInvoiceNo(); // Re-ask if empty
|
||||
}
|
||||
$this->storeVehicleData(); // Proceed to store the data
|
||||
});
|
||||
}
|
||||
|
||||
protected function storeVehicleData()
|
||||
{
|
||||
// Save all collected data to user storage
|
||||
$this->bot->userStorage()->save([
|
||||
'vehicle_name' => $this->vehicleName,
|
||||
'vehicle_yom' => $this->vehicleYOM,
|
||||
'vehicle_engine_no' => $this->vehicleEngineNo,
|
||||
'vehicle_invoice_no' => $this->vehicleInvoiceNo
|
||||
]);
|
||||
|
||||
$this->say('Vehicle Information Saved!');
|
||||
$this->bot->startConversation(new doYouWantToContinueConversation());
|
||||
|
||||
}
|
||||
}
|
||||
@ -54,10 +54,12 @@ class ChatbotControllerNew extends BaseController
|
||||
{
|
||||
// Start the Main Menu when user says "hi" or "start"
|
||||
$this->botman->hears('start|hi|hello', function (BotMan $bot) {
|
||||
$bot->reply('How how can i assit?');
|
||||
$bot->reply('Hi how can i assit?');
|
||||
$bot->startConversation(new MainMenuConversation());
|
||||
});
|
||||
|
||||
|
||||
|
||||
// $this->botman->hears('main_menu', function (BotMan $bot) {
|
||||
// BotService::sendMainOptions($bot);
|
||||
// });
|
||||
|
||||
@ -109,6 +109,7 @@ class TicketController extends BaseController
|
||||
'((CLAIM_NO))' => 'claim_number',
|
||||
'((RELATIONSHIP))' => 'relationship',
|
||||
'((POLICY_TYPE))' => 'policy_type',
|
||||
'((AUTO_QUERY_CONTENT))' => 'auto_query_content',
|
||||
];
|
||||
|
||||
$this->ticketMasterModel = new TicketMasterModel();
|
||||
@ -145,9 +146,9 @@ class TicketController extends BaseController
|
||||
if ($action == 1) {
|
||||
$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,
|
||||
DATE_FORMAT(ticket_master.created_at, "%d-%m-%Y") as tat')
|
||||
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 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')
|
||||
@ -169,9 +170,9 @@ 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,
|
||||
DATE_FORMAT(ticket_master.created_at, "%d-%m-%Y") as tat')
|
||||
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 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')
|
||||
@ -250,7 +251,7 @@ class TicketController extends BaseController
|
||||
$ticket_data = $this->formatDateForClaim($ticket_data, 'd/m/Y');
|
||||
// dd($ticket_data);
|
||||
$template_data = $this->ticketMasterModel->getTemplateDataByTicketID($ticket_id);
|
||||
if(!empty($template_data)){
|
||||
if (!empty($template_data)) {
|
||||
$template_data['mail_content'] = $this->replacePlaceholders($template_data['mail_content'], $ticket_data);
|
||||
$template_data['subject'] = $this->replacePlaceholders($template_data['subject'], $ticket_data);
|
||||
}
|
||||
@ -423,8 +424,10 @@ class TicketController extends BaseController
|
||||
// action = 1 is read, action 2 is insert/update
|
||||
if ($action == 1) {
|
||||
$ticket_master_id = $this->request->getPost('id');
|
||||
$is_auto_query = $this->request->getPost('is_auto_query');
|
||||
// print_rr($is_auto_query);
|
||||
if (isset($ticket_master_id) && $ticket_master_id != '') {
|
||||
$data = $this->ticketNoteModel->where('is_active', 1)->where('ticket_id', $ticket_master_id)->first();
|
||||
$data = $this->ticketNoteModel->where('is_active', 1)->where('ticket_id', $ticket_master_id)->where('is_auto_query', $is_auto_query)->first();
|
||||
if ($data) {
|
||||
return $this->respond(['status' => true, 'data' => $data], 200);
|
||||
} else {
|
||||
@ -434,10 +437,13 @@ class TicketController extends BaseController
|
||||
} elseif ($action == 2) {
|
||||
$data = $this->request->getPost();
|
||||
// if (isset($data['id']) && $data['id'] != ''){
|
||||
// print_rr($data);die();
|
||||
$status = $this->ticketNoteModel->save($data);
|
||||
$id = isset($data['id']) ? $data['id'] : $this->ticketNoteModel->insertID();
|
||||
|
||||
// }
|
||||
if ($status) {
|
||||
return $this->respond(['status' => true], 200);
|
||||
return $this->respond(['status' => true, 'id' => $id], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false], 200);
|
||||
}
|
||||
@ -532,12 +538,12 @@ class TicketController extends BaseController
|
||||
|
||||
// Validate Essential Fields
|
||||
if (empty($ticket_data['emp_mail'])) {
|
||||
$this->myLogger->logme('error', "Employee email is missing for Ticket ID : '".$ticket_id ."'");
|
||||
$this->myLogger->logme('error', "Employee email is missing for Ticket ID : '" . $ticket_id . "'");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (empty($subject) || empty($message)) {
|
||||
$this->myLogger->logme('error', "Generated email content is empty for Ticket ID: '".$ticket_id ."'");
|
||||
$this->myLogger->logme('error', "Generated email content is empty for Ticket ID: '" . $ticket_id . "'");
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -570,9 +576,9 @@ class TicketController extends BaseController
|
||||
|
||||
if ($value == "emp_code") {
|
||||
$replaceData = $ticket_data[$value] ?? '';
|
||||
}else if($value == "policy_type"){
|
||||
} else if ($value == "policy_type") {
|
||||
$replaceData = str_replace("Claim-", "", $this->ticketType[$ticket_data['ticket_type_id']] ?? "");
|
||||
}else{
|
||||
} else {
|
||||
$replaceData = strtoupper($ticket_data[$value]) ?? '';
|
||||
}
|
||||
|
||||
@ -589,9 +595,9 @@ class TicketController extends BaseController
|
||||
public function sendTrigger($mail_content)
|
||||
{
|
||||
$this->myLogger->logme('error', "Sending email with content");
|
||||
if(!empty($mail_content)){
|
||||
if (!empty($mail_content)) {
|
||||
$response = MailHelper::send_email($mail_content);
|
||||
}else{
|
||||
} else {
|
||||
$response = ['status' => false, 'code' => 404, 'message' => "Mail not sent, mail data empty"];
|
||||
$this->myLogger->logme('error', "Mail not sent, mail data empty");
|
||||
}
|
||||
@ -615,14 +621,14 @@ class TicketController extends BaseController
|
||||
}
|
||||
|
||||
$ticket_data = $this->ticketMasterModel->getTicketDataByTicketID($mail_data['ticket_id']);
|
||||
|
||||
// print_rr($ticket_data);die();
|
||||
if (!$ticket_data) {
|
||||
$this->myLogger->logme('error', "No ticket data found for Ticket ID : " .$mail_data['ticket_id']);
|
||||
$this->myLogger->logme('error', "No ticket data found for Ticket ID : " . $mail_data['ticket_id']);
|
||||
$this->myLogger->logme('error', "Reply mail not send");
|
||||
return null;
|
||||
}
|
||||
|
||||
if(!empty($mail_data)){
|
||||
if (!empty($mail_data)) {
|
||||
$mail_data['mail_content'] = $this->replacePlaceholders($mail_data['mail_content'], $ticket_data);
|
||||
$mail_data['mail_subject'] = $this->replacePlaceholders($mail_data['mail_subject'], $ticket_data);
|
||||
}
|
||||
@ -653,10 +659,10 @@ class TicketController extends BaseController
|
||||
$mail_content = $this->constructMailContent($ticket_id);
|
||||
// print_r($mail_content); die;
|
||||
$mail_responce = $this->sendTrigger($mail_content);
|
||||
}elseif (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 0 ){
|
||||
$this->myLogger->logme('error','Auto Mail Not Sent, Reason: Automail Not Enabled');
|
||||
}else{
|
||||
$this->myLogger->logme('error','Auto Mail Not Sent, Reason: Mail Template Not Created');
|
||||
} elseif (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 0) {
|
||||
$this->myLogger->logme('error', 'Auto Mail Not Sent, Reason: Automail Not Enabled');
|
||||
} else {
|
||||
$this->myLogger->logme('error', 'Auto Mail Not Sent, Reason: Mail Template Not Created');
|
||||
}
|
||||
|
||||
return $mail_responce;
|
||||
@ -733,61 +739,106 @@ class TicketController extends BaseController
|
||||
AND th.is_active = 1
|
||||
ORDER BY
|
||||
th.created_at DESC";
|
||||
$data = $this->ticketHistoryModel->query($sql)->getResultArray();
|
||||
$priorityType = $this->priorityType;
|
||||
$relationshipType = $this->relationshipType;
|
||||
$modeOFIntimate = $this->modeOFIntimate;
|
||||
$claim_type = $this->claimType;
|
||||
foreach ($data as &$row) {
|
||||
if ($row['field_name'] == 'claim_status_id') {
|
||||
$new_old_value = isset($row['old_status_value']) ? $row['old_status_value'] : '-';
|
||||
$new_new_value = $row['new_status_value'];
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'acm_id') {
|
||||
$new_old_value = isset($row['old_account_manager']) ? $row['old_account_manager'] : '-';
|
||||
$new_new_value = $row['new_account_manager'];
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'insured_emp_id') {
|
||||
$new_old_value = isset($row['old_insured_id_name']) ? $row['old_insured_id_name'] : '-';
|
||||
$new_new_value = $row['new_insured_id_name'];
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'priority') {
|
||||
$new_old_value = isset($priorityType[$row['old_value']]) ? $priorityType[$row['old_value']] : '-';
|
||||
$new_new_value = isset($priorityType[$row['new_value']]) ? $priorityType[$row['new_value']] : '-';
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'relationship') {
|
||||
$new_old_value = isset($relationshipType[$row['old_value']]) ? $relationshipType[$row['old_value']] : '-';
|
||||
$new_new_value = isset($relationshipType[$row['new_value']]) ? $relationshipType[$row['new_value']] : '-';
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'mode_of_intimation') {
|
||||
$new_old_value = isset($modeOFIntimate[$row['old_value']]) ? $modeOFIntimate[$row['old_value']] : "-";
|
||||
$new_new_value = isset($modeOFIntimate[$row['old_value']]) ? $modeOFIntimate[$row['old_value']] : "-";
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'claim_type') {
|
||||
$new_old_value = isset($claim_type[$row['ticket_type_id']][$row['old_value']]) ? $claim_type[$row['ticket_type_id']][$row['old_value']] : '-';
|
||||
$new_new_value = isset($claim_type[$row['ticket_type_id']][$row['new_value']])?$claim_type[$row['ticket_type_id']][$row['new_value']]:'-';
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'claim_type') {
|
||||
$new_old_value = isset($claim_type[$row['old_value']]) ? $claim_type[$row['old_value']] : '-';
|
||||
$new_new_value = isset($claim_type[$row['new_value']]) ? $claim_type[$row['new_value']] : '-';
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} else {
|
||||
$new_old_value = isset($row['old_value']) ? $row['old_value'] : '-';
|
||||
$new_new_value = isset($row['new_value']) ? $row['new_value'] : '-';
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
$data = $this->ticketHistoryModel->query($sql)->getResultArray();
|
||||
$priorityType = $this->priorityType;
|
||||
$relationshipType = $this->relationshipType;
|
||||
$modeOFIntimate = $this->modeOFIntimate;
|
||||
$claim_type = $this->claimType;
|
||||
foreach ($data as &$row) {
|
||||
if ($row['field_name'] == 'claim_status_id') {
|
||||
$new_old_value = isset($row['old_status_value']) ? $row['old_status_value'] : '-';
|
||||
$new_new_value = $row['new_status_value'];
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'acm_id') {
|
||||
$new_old_value = isset($row['old_account_manager']) ? $row['old_account_manager'] : '-';
|
||||
$new_new_value = $row['new_account_manager'];
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'insured_emp_id') {
|
||||
$new_old_value = isset($row['old_insured_id_name']) ? $row['old_insured_id_name'] : '-';
|
||||
$new_new_value = $row['new_insured_id_name'];
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'priority') {
|
||||
$new_old_value = isset($priorityType[$row['old_value']]) ? $priorityType[$row['old_value']] : '-';
|
||||
$new_new_value = isset($priorityType[$row['new_value']]) ? $priorityType[$row['new_value']] : '-';
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'relationship') {
|
||||
$new_old_value = isset($relationshipType[$row['old_value']]) ? $relationshipType[$row['old_value']] : '-';
|
||||
$new_new_value = isset($relationshipType[$row['new_value']]) ? $relationshipType[$row['new_value']] : '-';
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'mode_of_intimation') {
|
||||
$new_old_value = isset($modeOFIntimate[$row['old_value']]) ? $modeOFIntimate[$row['old_value']] : "-";
|
||||
$new_new_value = isset($modeOFIntimate[$row['old_value']]) ? $modeOFIntimate[$row['old_value']] : "-";
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'claim_type') {
|
||||
$new_old_value = isset($claim_type[$row['ticket_type_id']][$row['old_value']]) ? $claim_type[$row['ticket_type_id']][$row['old_value']] : '-';
|
||||
$new_new_value = isset($claim_type[$row['ticket_type_id']][$row['new_value']]) ? $claim_type[$row['ticket_type_id']][$row['new_value']] : '-';
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'claim_type') {
|
||||
$new_old_value = isset($claim_type[$row['old_value']]) ? $claim_type[$row['old_value']] : '-';
|
||||
$new_new_value = isset($claim_type[$row['new_value']]) ? $claim_type[$row['new_value']] : '-';
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} else {
|
||||
$new_old_value = isset($row['old_value']) ? $row['old_value'] : '-';
|
||||
$new_new_value = isset($row['new_value']) ? $row['new_value'] : '-';
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return ($data);
|
||||
}
|
||||
|
||||
return ($data);
|
||||
public function sendMailWithAutoQuery()
|
||||
{
|
||||
|
||||
$ticket_ids = $this->ticketMessageModel
|
||||
->select('ticket_master.id')
|
||||
->join('ticket_master', 'ticket_master.id = ticket_messages.ticket_id AND ticket_master.is_active = 1 and ticket_master.claim_status_id in (4,17,27,37)')
|
||||
->join('ticket_claim_status AS tcs', 'tcs.id = ticket_messages.claim_status AND (tcs.is_active = 1)')
|
||||
->join('ticket_notes', 'ticket_notes.ticket_id = ticket_messages.ticket_id AND ticket_notes.is_auto_query = 1 AND ticket_notes.is_active = 1')
|
||||
->where('ticket_messages.is_active', 1)
|
||||
->where('ticket_messages.claim_status in (4,17,27,37)')
|
||||
->groupBy('ticket_master.id')
|
||||
->having('DATEDIFF(CURDATE(), MAX(ticket_messages.created_at)) =', 7)
|
||||
->having('count(ticket_messages.id) < ', 6)
|
||||
->findAll();
|
||||
|
||||
|
||||
// var_dump($ticket_ids);die();
|
||||
foreach ($ticket_ids as $ticket) {
|
||||
|
||||
$ticket_id = $ticket['id'];
|
||||
$acm_mails = $this->ticketMasterModel->getTicketDataByTicketID($ticket_id);
|
||||
$ticket_data = $this->ticketMasterModel->getTicketDataByTicketID($ticket_id);
|
||||
|
||||
$template_data = $this->ticketMasterModel->getTemplateDataByTicketID($ticket_id);
|
||||
|
||||
if (!empty($template_data)) {
|
||||
$template_data['mail_content'] = $this->replacePlaceholders($template_data['mail_content'], $ticket_data);
|
||||
$template_data['subject'] = $this->replacePlaceholders($template_data['subject'], $ticket_data);
|
||||
}
|
||||
$emailData = [
|
||||
'mail' => $template_data['emp_mail'],
|
||||
'subject' => $template_data['subject'],
|
||||
'message' => $template_data['mail_content'],
|
||||
'common' => [],
|
||||
'cc' => $acm_mails['common_mails'],
|
||||
'attachments' => []
|
||||
];
|
||||
|
||||
$this->myLogger->logme('error', "Final Reply Email Data");
|
||||
// var_dump($emailData);
|
||||
$this->sendTrigger($emailData);
|
||||
}
|
||||
|
||||
return 'Ticket id\'s : '.json_encode($ticket_ids);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,8 @@ namespace App\Helpers;
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\CDMasterModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use App\Models\TPAModel;
|
||||
|
||||
class ChatbotHelper
|
||||
{
|
||||
@ -19,9 +21,44 @@ class ChatbotHelper
|
||||
$client_branch_id = 126;
|
||||
$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 = 336;
|
||||
$emp_id = 12288;
|
||||
$EmployeePolicyModel = new EmployeePolicyModel();
|
||||
return $EmployeePolicyModel->getHospitalLinkByPolicyandEmp(336,12288);
|
||||
}
|
||||
|
||||
public static function getPhoneNumber(){
|
||||
$emp_id = 12288;
|
||||
$EmployeeModel = new EmployeeModel();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1136,7 +1136,7 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
public function getEmployeePolicyForFileList($client_id, $policy_id)
|
||||
{
|
||||
$result = $this->select(['employee_polices.*','pt.policy_type','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active','emp.mobile as mobile'])
|
||||
$result = $this->select(['employee_polices.*','pt.policy_type','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active','emp.mobile as mobile','cp.policy_type_id'])
|
||||
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
|
||||
->join('policy_type pt', 'cp.policy_type_id = pt.id') //pm - policy master
|
||||
@ -1745,4 +1745,17 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
return $result[0];
|
||||
}
|
||||
|
||||
public function getHospitalLinkByPolicyandEmp($client_policy_id,$emp_id){
|
||||
$data = $this->db->table('employee_polices')
|
||||
->select('tpa.network_hospitals')
|
||||
->where('client_policy_id', $client_policy_id)
|
||||
->where('employee_polices.is_active', 1)
|
||||
->join('tpa', 'tpa.id = employee_polices.tpa_id AND tpa.is_active = 1')
|
||||
->join('employees', 'employees.id = employee_polices.employee_id AND employees.id = ' . (int) $emp_id)
|
||||
->get()->getResultArray()[0];
|
||||
|
||||
// var_dump($this->db->getLastQuery());
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@ -105,7 +105,7 @@ class TicketMasterModel extends Model
|
||||
public function getTemplateDataByTicketID($ticket_id)
|
||||
{
|
||||
$template_data = $this
|
||||
->select("ticket_mail_template.*, ticket_master.emp_mail")
|
||||
->select("ticket_mail_template.*, ticket_master.emp_mail,ticket_master.claim_status_id")
|
||||
->join('ticket_claim_status', 'ticket_master.claim_status_id = ticket_claim_status.id and ticket_claim_status.is_active = 1')
|
||||
->join('ticket_mail_template', '
|
||||
ticket_claim_status.trigger_type = ticket_mail_template.trigger_type
|
||||
@ -131,11 +131,13 @@ class TicketMasterModel extends Model
|
||||
clients.client_name,
|
||||
|
||||
insurers.name as insurer_name,
|
||||
tpa.name as tpa_name
|
||||
tpa.name as tpa_name,
|
||||
ticket_notes.note as auto_query_content
|
||||
")
|
||||
->join('clients', 'ticket_master.client_id = clients.id', 'left')
|
||||
->join('insurers', 'ticket_master.insurer_id = insurers.id', 'left')
|
||||
->join('tpa', 'ticket_master.tpa_id = tpa.id', 'left')
|
||||
->join('ticket_notes', 'ticket_master.id = ticket_notes.ticket_id and ticket_notes.is_active = 1 and ticket_notes.is_auto_query = 1','left')
|
||||
->join('user_profiles', 'ticket_master.acm_id = user_profiles.id', 'left')
|
||||
->where('ticket_master.id', $ticket_id)
|
||||
->where('ticket_master.is_active', 1)
|
||||
|
||||
@ -12,7 +12,7 @@ class TicketMessageModel extends Model
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = ['id','sender','ticket_id','mail_subject','emp_mail','mail_content','created_at'];
|
||||
protected $allowedFields = ['id','sender','ticket_id','claim_status','mail_subject','emp_mail','mail_content','created_at'];
|
||||
|
||||
|
||||
// Callbacks
|
||||
|
||||
@ -12,7 +12,7 @@ class TicketNoteModel extends Model
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = ['id','ticket_id','note','created_by','updated_by','is_active'];
|
||||
protected $allowedFields = ['id','ticket_id','note','is_auto_query','created_by','updated_by','is_active'];
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
|
||||
@ -24,8 +24,8 @@
|
||||
var uid = Math.floor(100000 + Math.random() * 900000);
|
||||
console.log('CURRENT_USER' + uid);
|
||||
var botmanWidget = {
|
||||
chatServer: "https://localhost/PHP828APPS/ruc/nhance/chat", // Make sure this URL is correct
|
||||
frameEndpoint: 'https://localhost/PHP828APPS/ruc/nhance/widget', // This should match your CI4
|
||||
chatServer: `<?=base_url('chat')?>`, // Make sure this URL is correct
|
||||
frameEndpoint: `<?=base_url('widget')?>`, // This should match your CI4
|
||||
title: "Ask ஆதிரை",
|
||||
introMessage: "",
|
||||
bubbleBackground: "#007bff",
|
||||
|
||||
98
app/Views/ticket_auto_query.php
Normal file
98
app/Views/ticket_auto_query.php
Normal file
@ -0,0 +1,98 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<form role="form" class="parsley-examples" method="post" id="ticket_auto_query"
|
||||
enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<!-- <label for="ticket_auto_query_note">Add Notes</label> -->
|
||||
<textarea class="form-control" id="ticket_auto_query_note" name="note" rows="3"
|
||||
placeholder="Enter Text"><?= isset($ticket_note['note']) ? $ticket_note['note'] : '' ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div><input type="hidden" id="query_note_id"><input type="hidden"
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary" id="ticket_auto_query_submit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
url = '<?= base_url('ticket/note/1')?>';
|
||||
data = { id : $('#ticket_master_id').val() , is_auto_query : 1};
|
||||
$.ajax({
|
||||
url:url,
|
||||
data:data,
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
if (res.status == true){
|
||||
$('#ticket_auto_query_note').val(res.data.note);
|
||||
$('#query_note_id').val(res.data.id);
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Went Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
})
|
||||
|
||||
$("#ticket_auto_query").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var url = '<?= base_url("/ticket/note/2"); ?>';
|
||||
var formData = $(this).serializeArray();
|
||||
var ticket_id = $('#ticket_master_id').val();
|
||||
if (ticket_id != null && ticket_id != ''){
|
||||
formData.push({ name: 'ticket_id', value: ticket_id});
|
||||
}
|
||||
var primary_key = $('#query_note_id').val();
|
||||
if (primary_key != null && primary_key != ''){
|
||||
formData.push({ name: 'id', value: primary_key});
|
||||
}
|
||||
formData.push({name: 'is_auto_query',value:1})
|
||||
console.log(formData);
|
||||
sendAjaxRequestForGlobal(url, 'POST', formData, function(response) {
|
||||
if (response.status == true) {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('Note Added Successfully','Success');
|
||||
// console.log("Respone id is ")
|
||||
// console.log(response.id);
|
||||
$('#query_note_id').val(response.id);
|
||||
|
||||
|
||||
} else {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
let message = response.message;
|
||||
toastr.error(message, 'ERROR');
|
||||
}
|
||||
|
||||
|
||||
}, function(xhr, status, error) {
|
||||
console.error('Error fetching data:', error);
|
||||
console.error(xhr.responseText);
|
||||
toastr.error('An error occurred while fetching the report page.', 'ERROR');
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -49,6 +49,13 @@
|
||||
<span class="d-none d-sm-inline-block">History</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#autoQuery-tab" data-toggle="tab" class="nav-link px-2 py-1" id="auto_query_tab"
|
||||
aria-expanded="false">
|
||||
<i class="mdi mdi-robot mr-1"></i>
|
||||
<span class="d-none d-sm-inline-block">Auto Query Content</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- Tab Content -->
|
||||
@ -72,6 +79,9 @@
|
||||
<div class="tab-pane fade" id="history-tab">
|
||||
<?php include('ticket_history.php'); ?>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="autoQuery-tab">
|
||||
<?php include('ticket_auto_query.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -25,6 +25,20 @@ table.dataTable tbody td {
|
||||
margin-left: 20px !important;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.table th:nth-child(1),
|
||||
.table td:nth-child(1) {
|
||||
max-width: 200px !important;
|
||||
min-width: 100px !important;
|
||||
overflow: hidden !important;
|
||||
text-overflow: ellipsis !important;
|
||||
white-space: nowrap !important;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
@ -52,12 +66,14 @@ table.dataTable tbody td {
|
||||
<?php if (isset($ticket_data)) { ?>
|
||||
<?php foreach($ticket_data as $index => $row){ ?>
|
||||
<tr onclick="viewTicket(<?php echo $row['id']; ?>)">
|
||||
<td><?php echo $row['status']; ?></td>
|
||||
<td data-toggle="tooltip" data-placement="top" title="<?php echo $row['status']; ?>">
|
||||
<span class="status-tooltip"><?php echo $row['status']; ?></span>
|
||||
</td>
|
||||
<td><?php echo $row['claim_no']; ?></td>
|
||||
<td><?php echo $row['tpa_id']; ?></td>
|
||||
<td><?php echo $row['emp_name']; ?></td>
|
||||
<td><?php echo $row['insurer_name']; ?></td>
|
||||
<td><?php echo $row['client_name']; ?></td>
|
||||
<td><?php echo $row['insured_name']; ?></td>
|
||||
<td><?php echo $row['short_name']; ?></td>
|
||||
<td><?php echo $row['tat']; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
@ -77,6 +93,10 @@ table.dataTable tbody td {
|
||||
<!-------------------------------------------------------------------------------------------------->
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
|
||||
// Datatable document ready
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
$(document).ready(function() {
|
||||
url = '<?= base_url('ticket/note/1')?>';
|
||||
data = { id : $('#ticket_master_id').val()};
|
||||
data = { id : $('#ticket_master_id').val(), is_auto_query : 0};
|
||||
$.ajax({
|
||||
url:url,
|
||||
data:data,
|
||||
@ -69,6 +69,10 @@ $(document).ready(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('Note Added Successfully','Success');
|
||||
// console.log("Respone id is ")
|
||||
// console.log(response.id);
|
||||
$('#note_id').val(response.id);
|
||||
// console.log($('#'))
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
</div>
|
||||
<div id="ticket_mail_editor" name="content" style="height: 300px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div><input type="hidden" id="claim_status" name="claim_status" value="<?= $reply_data['claim_status_id'] ?>">
|
||||
</div>
|
||||
|
||||
<!-- Submit Button -->
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
"psr/http-message": "^1.0",
|
||||
"psr/log": "^1.1",
|
||||
"slim/slim": "^4.13",
|
||||
"symfony/cache": "^7.2",
|
||||
"symfony/cache": "^6.0",
|
||||
"zircote/swagger-php": "^4.8"
|
||||
},
|
||||
"require-dev": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user