From 4d9a4025c3de92fa91e5c63a11fc68bebe8b23db Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Mon, 17 Feb 2025 09:20:43 +0530 Subject: [PATCH 1/4] FIX_CHATBOT_MAIL_AND_CANCEL_IN_FORM --- .../Chatbot/medicalClaimFormConversations.php | 6 +++++- app/Controllers/Chatbot/vehicleFormConversation.php | 11 ++++++++--- app/Helpers/ChatbotHelper.php | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) 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/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); From 9568260f650c6b1054ad8734ee378f9fb98b6a98 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Mon, 17 Feb 2025 15:49:37 +0530 Subject: [PATCH 2/4] FIX_TICKET_MASTER_MAIL --- app/Controllers/EmployeeController.php | 31 ++++++++++++++++- app/Models/TicketMasterModel.php | 13 ++++++- app/Views/employee_data_list.php | 42 +++++++++++++++------- app/Views/notification.php | 48 ++++++++++++++++++++++++++ 4 files changed, 120 insertions(+), 14 deletions(-) diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index b27a0dae..f5289ae0 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() @@ -2732,8 +2735,20 @@ 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'] = '-'; + } + } + 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(); @@ -2742,4 +2757,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/Models/TicketMasterModel.php b/app/Models/TicketMasterModel.php index 5587f943..4ccaba9c 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 and employees.is_active = 1') ->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 and employees.is_active = 1') ->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/notification.php b/app/Views/notification.php index 051d2f98..6b1f8f63 100755 --- a/app/Views/notification.php +++ b/app/Views/notification.php @@ -1972,4 +1972,52 @@ }); } } +$(document).on('click', '#notification_enable_form_submit', function() { + var formData = []; + console.log($('#hr_mail_id').val()); + + formData.push({name:'client_id', value: $('#general_PrimaryKey').val()}) + formData.push({ name: 'nhance_team_mail_ids', value: $('#nhance_team_mail_ids').val() }); + formData.push({ name: 'hr_mail_id', value: $('#hr_mail_id').val() }); + formData.push({ name: 'mail_domain', value: $('#mail_domain').val() }); + formData.push({ name: 'reply_to', value: $('#reply_to').val() }); + formData.push({ name: 'member_welcome_mail_btn', value: $('#member_welcome_mail_btn').prop('checked') }); + formData.push({ name: 'member_reminder_mail_btn', value: $('#member_reminder_mail_btn').prop('checked') }); + formData.push({ name: 'member_ecard_mail_btn', value: $('#member_ecard_mail_btn').prop('checked') }); + formData.push({ name: 'member_review_and_summary_mail_btn', value: $('#member_review_and_summary_mail_btn').prop('checked') }); + formData.push({ name: 'account_maneger_summary_mail_btn', value: $('#account_maneger_summary_mail_btn').prop('checked') }); + formData.push({ name: 'client_hr_summary_mail_btn', value: $('#client_hr_summary_mail_btn').prop('checked') }); + + var form_action = ''; + $('.loader').fadeIn(); + $('.loader-mask').fadeIn(); + $.ajax({ + url: form_action, + type: "POST", + data: formData, + dataType: 'json', + success: function(res) + { + console.log(res); + if (res) + { + toastr.success('Update Successfully'); + } + $('.loader').fadeOut(); + $('.loader-mask').delay(350).fadeOut('slow'); + }, + 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 Wrong!', 'warning'); + }, 1000); + } + }); +}) + \ No newline at end of file From c2c013f4a16bb3a006c2ba8ba2120818e12b97b8 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Mon, 17 Feb 2025 15:50:34 +0530 Subject: [PATCH 3/4] FIX_TICKET_MASTER_MAIL --- app/Models/TicketMasterModel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Models/TicketMasterModel.php b/app/Models/TicketMasterModel.php index 4ccaba9c..4cb59773 100644 --- a/app/Models/TicketMasterModel.php +++ b/app/Models/TicketMasterModel.php @@ -133,7 +133,7 @@ class TicketMasterModel extends Model 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 and employees.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) @@ -168,7 +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 and employees.is_active = 1') + ->join('employees','employees.id = ticket_master.emp_id','left') ->where('ticket_master.id', $ticket_id) ->where('ticket_master.is_active', 1) ->first(); From 34ac39ca26958b65f7cad2f5be27fdf3d7e22018 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Tue, 18 Feb 2025 13:42:33 +0530 Subject: [PATCH 4/4] FIX_RFQ_SRI --- app/Controllers/EmployeeController.php | 2 ++ app/Controllers/LeadsController.php | 5 +++++ app/Views/leads_list.php | 7 ++++++- app/Views/notification.php | 2 +- app/Views/view_rfq.php | 6 +++--- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index f5289ae0..c14c9a77 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -2746,6 +2746,8 @@ class EmployeeController extends AdminController }else{ $emp_history['created_by'] = '-'; } + + $emp_history['created_at'] = date("d-m-Y H:i:s", strtotime($emp_history['created_at'])); } unset($emp_history); 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/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