66 lines
2.7 KiB
PHP
66 lines
2.7 KiB
PHP
<?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 MainMenuConversation extends Conversation
|
|
{
|
|
public function run()
|
|
{
|
|
$this->showMainMenu();
|
|
}
|
|
|
|
protected function showMainMenu()
|
|
{
|
|
$question = Question::create("Please choose")
|
|
->addButtons([
|
|
Button::create("📄 Ecard Download")->value("ecard_download"),
|
|
Button::create("🏥 Network Hospital")->value("network_hospital"),
|
|
Button::create("💰 Reimbursement Claim Process")->value("reimbursement_claim"),
|
|
Button::create("📑 Reimbursement Claim Status")->value("reimbursement_status"),
|
|
Button::create("🆕 New Policy")->value("new_policy"),
|
|
Button::create("🔄 Renew Policy")->value("renew_policy"),
|
|
]);
|
|
|
|
$this->bot->ask($question, function ($answer) {
|
|
switch ($answer->getValue()) {
|
|
case "ecard_download":
|
|
|
|
$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:");log_message('error','Network Hospital clicked');
|
|
$this->bot->startConversation(new NetworkHospitalConversation());
|
|
break;
|
|
case "reimbursement_claim":
|
|
// $this->say("Reimbursement Claim Process selected. (Dummy Response)");
|
|
$this->bot->startConversation(new ReimbursementClaimProcessConversation());
|
|
break;
|
|
case "reimbursement_status":
|
|
$this->say("Reimbursement Claim Status selected. (Dummy Response)");
|
|
$this->bot->startConversation(new ReimbursementClaimStatusConversation());
|
|
|
|
break;
|
|
case "new_policy":
|
|
$this->bot->startConversation(new policyConversation());
|
|
break;
|
|
case "renew_policy":
|
|
$this->bot->startConversation(new policyConversation());
|
|
break;
|
|
default:
|
|
$this->say("Invalid selection. Please choose an option.");
|
|
$this->bot->startConversation(new MainMenuConversation());
|
|
break;
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|