diff --git a/app/Controllers/Chatbot/medicalClaimFormConversations.php b/app/Controllers/Chatbot/medicalClaimFormConversations.php index d0d21e7e..da6bf3c5 100644 --- a/app/Controllers/Chatbot/medicalClaimFormConversations.php +++ b/app/Controllers/Chatbot/medicalClaimFormConversations.php @@ -246,7 +246,8 @@ class medicalClaimFormConversations extends Conversation $question = Question::create("Confirm all details:") ->addButtons([ Button::create("✅ Confirm")->value("confirm"), - Button::create("❌ Start Over")->value("restart"), + Button::create("🔁 Start Over")->value("restart"), + Button::create("❌ Cancel")->value('cancel') ]); $this->ask($question, function ($answer) use ($finalSummary) { @@ -271,6 +272,9 @@ class medicalClaimFormConversations extends Conversation ]); $this->run(); break; + case "cancel": + $this->bot->startConversation(new MainMenuConversation()); + break; default: $this->say("Invalid selection. Please choose an option."); $this->showSummary(); diff --git a/app/Controllers/Chatbot/vehicleFormConversation.php b/app/Controllers/Chatbot/vehicleFormConversation.php index 1595ae52..3bcf39fd 100644 --- a/app/Controllers/Chatbot/vehicleFormConversation.php +++ b/app/Controllers/Chatbot/vehicleFormConversation.php @@ -180,7 +180,8 @@ class vehicleFormConversation extends Conversation $question = Question::create("Confim your Details:") ->addButtons([ Button::create("✅ Confirm")->value("confirm"), - Button::create("❌ No")->value("no"), + Button::create("🔁 Start Over")->value("restart"), + Button::create("❌ Cancel")->value('cancel') ]); $this->bot->ask($question, function ($answer) use($vehicle_info) { $path = $this->bot->userStorage()->get('path'); @@ -201,8 +202,12 @@ class vehicleFormConversation extends Conversation $this->say("There was a problem while requesting for a quotation please try again later."); } break; - case "no": - $this->askVehicleName(); + case "restart": + $this->bot->startConversation(new vehicleFormConversation()); + break; + case "cancel": + $this->say("Redirecting you to main menu..."); + $this->bot->startConversation(new MainMenuConversation()); break; default: $this->say("Invalid selection. Please choose an option."); diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index 8262fcb7..6857487a 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -26,6 +26,7 @@ use App\Models\InsurerModel; use App\Models\ClientDepositModel; use App\Models\PolicyPremium2Model; use App\Models\AuditHistoryModel; +use App\Models\UserModel; use App\Controllers\Jobs; @@ -66,6 +67,7 @@ class EmployeeController extends AdminController protected $cashDepositModel; protected $PolicyPremium2Model; protected $auditHistory; + protected $userModel; public function __construct() { @@ -87,6 +89,7 @@ class EmployeeController extends AdminController $this->cashDepositModel = new ClientDepositModel(); $this->PolicyPremium2Model = new PolicyPremium2Model(); $this->auditHistory = new AuditHistoryModel(); + $this->userModel = new userModel(); } public function list() @@ -2734,8 +2737,22 @@ class EmployeeController extends AdminController $emp_id = $this->request->getPost('emp_id'); - $data['emp_history'] = $this->auditHistory->select('field_name,old_value,new_value,created_by,created_at')->where('pk',$emp_id)->where('table_name','employees')->findAll(); + $data['emp_history'] = $this->auditHistory->select('field_name,old_value,new_value,created_by,created_at')->where('pk',$emp_id)->where('table_name','employees')->orderBy('created_at', 'DESC')->findAll(); + foreach ($data['emp_history'] as &$emp_history) { + $emp_history['field_name'] = $this->formatFieldName($emp_history['field_name']); + $user = $emp_history['created_by']; + if ($user != null && $user != ''){ + $userData = $this->userModel->select('first_name, last_name')->where('id', $user)->where('is_active', 1)->first(); + $emp_history['created_by'] = ucwords($userData['first_name'] . ' ' . $userData['last_name']); + }else{ + $emp_history['created_by'] = '-'; + } + + $emp_history['created_at'] = date("d-m-Y H:i:s", strtotime($emp_history['created_at'])); + } + unset($emp_history); + $emp_pol_pk = $this->employeePolicyModel->select('id')->where('employee_id',$emp_id)->first()['id']; $data['emp_pol_history'] = $this->auditHistory->select('field_name,old_value,new_value,created_by,created_at')->where('pk',$emp_pol_pk)->where('table_name','employee_polices')->findAll(); @@ -2744,4 +2761,18 @@ class EmployeeController extends AdminController } + public function formatFieldName($unformattedString){ + + if (str_contains($unformattedString, '_')) { + $data = str_replace('_', ' ', $unformattedString); + }else{ + $data = $unformattedString; + } + + $format = ucwords($data); + + return $format; + + } + } diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index b5f31223..049c5f88 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -236,6 +236,8 @@ class LeadsController extends BaseController // Separate the insurer and insurer branch, handle missing or invalid data if (isset($data['insurer'][$index]) && strpos($data['insurer'][$index], '-') !== false) { list($insurer_branch_id, $insurer_id) = explode('-', $data['insurer'][$index]); + + }else{ $insurer_branch_id = 0; $insurer_id = 0; } @@ -1644,6 +1646,7 @@ class LeadsController extends BaseController //get file path to attach $file_info = $this->constructExcelToSaveTemp($lead_id, ($file_type == 'rfq' ? 1 : 2), $propsal_and_insurer); + log_message('error','File Info'.json_encode($file_info)); if ($lead_data['file_name'] != null && $lead_data['file_name'] != '') { $temp_file_path = $file_info['filePath']; $temp_file_name = $file_info['fileName']; @@ -1657,6 +1660,8 @@ class LeadsController extends BaseController $result = ExcelMergeHelper::mergeExcelFiles($filePaths, $outputPath); // print_rr($result); } + }else{ + return $this->respond(['status' => 'fail', 'code' => 200, 'messgae' => 'File Not Found'], 200); } // print_rr($lead_data); // print_rr($file_info); diff --git a/app/Helpers/ChatbotHelper.php b/app/Helpers/ChatbotHelper.php index 08fcbb83..e1f213d3 100644 --- a/app/Helpers/ChatbotHelper.php +++ b/app/Helpers/ChatbotHelper.php @@ -201,7 +201,7 @@ class ChatbotHelper $message = SELF::quotationRequestMailTemplate($data); $common = ['mail_type'=>'request_quotation_bot']; - $email_id = 'no-reply-otp@nhanceindia.in'; + $email_id = getenv('email.enquiryMail'); $res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Quotation Request Received from bot.', 'message' => $message,'common'=>$common]); $res = json_decode($res); diff --git a/app/Models/TicketMasterModel.php b/app/Models/TicketMasterModel.php index 5587f943..4cb59773 100644 --- a/app/Models/TicketMasterModel.php +++ b/app/Models/TicketMasterModel.php @@ -123,12 +123,17 @@ class TicketMasterModel extends Model public function getTemplateDataByTicketID($ticket_id) { $template_data = $this - ->select("ticket_mail_template.*, ticket_master.emp_mail,ticket_master.claim_status_id") + ->select("ticket_mail_template.*, CASE + WHEN employees.email_corporate IS NULL OR employees.email_corporate = '' + THEN ticket_master.emp_mail + ELSE employees.email_corporate + END as emp_mail, ,ticket_master.claim_status_id") ->join('ticket_claim_status', 'ticket_master.claim_status_id = ticket_claim_status.id and ticket_claim_status.is_active = 1') ->join('ticket_mail_template', ' ticket_claim_status.trigger_type = ticket_mail_template.trigger_type and ticket_claim_status.ticket_type = ticket_mail_template.ticket_type and ticket_mail_template.is_active = 1') + ->join('employees','employees.id = ticket_master.emp_id','left') ->where('ticket_master.id', $ticket_id) ->where('ticket_master.is_active', 1) ->where('ticket_claim_status.is_active', 1) @@ -141,6 +146,11 @@ class TicketMasterModel extends Model { $ticket_data = $this->select(" ticket_master.*, + CASE + WHEN employees.email_corporate IS NULL OR employees.email_corporate = '' + THEN ticket_master.emp_mail + ELSE employees.email_corporate + END as emp_mail, user_profiles.first_name as acm, user_profiles.mobile as acm_mobile, @@ -158,6 +168,7 @@ class TicketMasterModel extends Model ->join('tpa', 'ticket_master.tpa_id = tpa.id', 'left') ->join('ticket_notes', 'ticket_master.id = ticket_notes.ticket_id and ticket_notes.is_active = 1 and ticket_notes.is_auto_query = 1','left') ->join('user_profiles', 'ticket_master.acm_id = user_profiles.id', 'left') + ->join('employees','employees.id = ticket_master.emp_id','left') ->where('ticket_master.id', $ticket_id) ->where('ticket_master.is_active', 1) ->first(); diff --git a/app/Views/employee_data_list.php b/app/Views/employee_data_list.php index 1f26c391..9dd0956c 100755 --- a/app/Views/employee_data_list.php +++ b/app/Views/employee_data_list.php @@ -310,8 +310,8 @@
@@ -591,10 +591,28 @@ if (charcode >= 48 && charcode <= 57 || charcode == 46) return true; return false; } - function showModal() { - var myModal = new bootstrap.Modal(document.getElementById('emp_history_modal')); - myModal.show(); + var modalInstance; // Store the modal instance globally + +function showModal() { + var myModalEl = document.getElementById('emp_history_modal'); + modalInstance = new bootstrap.Modal(myModalEl, { + backdrop: true, // Ensures the backdrop is shown + keyboard: true // Allows closing with the Escape key + }); + modalInstance.show(); +} + +function closeModal() { + if (modalInstance) { + modalInstance.hide(); // Hide the modal and its backdrop + // Manually remove backdrop if it's still visible + setTimeout(function () { + document.querySelector('.modal-backdrop').classList.remove('show'); + }, 150); // Wait for animation to finish } +} + + function get_emp_history(input, emp_id) { $('.loader').fadeIn(); @@ -671,12 +689,12 @@ }); } -function closeModal(){ - var myModalEl = document.getElementById('emp_history_modal'); - var modalInstance = bootstrap.Modal.getInstance(myModalEl); - if (modalInstance) { - modalInstance.hide(); - } -} +// function closeModal(){ +// var myModalEl = document.getElementById('emp_history_modal'); +// var modalInstance = bootstrap.Modal.getInstance(myModalEl); +// if (modalInstance) { +// modalInstance.hide(); +// } +// } diff --git a/app/Views/leads_list.php b/app/Views/leads_list.php index 261083b4..0f6c0199 100644 --- a/app/Views/leads_list.php +++ b/app/Views/leads_list.php @@ -127,7 +127,7 @@ table.dataTable tbody td { Edit - + RFQ