From 77426aaff6300e7091bbf1f76000e8d67f3abf1b Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 2 Apr 2025 11:35:23 +0530 Subject: [PATCH 1/7] FEAT_CLAIM_FEADBACK_FORM : RV --- app/Config/Routes.php | 2 ++ app/Controllers/TicketController.php | 18 ++++++++++++++++-- app/Views/ticket_feedback_form.php | 0 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 app/Views/ticket_feedback_form.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 0059a7a1..c9bedc6f 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -52,6 +52,8 @@ $routes->get('/update-emp-policy-status', 'ClientController::updateEmpAndPolicyS $routes->get('download-e-card/(:any)', 'EmployeeController::generateIDCardForEmployee/$1'); $routes->get('download-kyc-docs/(:segment)', 'ClientController::downloadKYCDocument/$1'); $routes->get('claim-form-download/(:any)', 'TicketController::downloadClaimForm/$1'); +$routes->get("claims-feedback-form/(:any)", "TicketController::viewClaimFeedbackForm/$1"); + $routes->group("/user", ["filter" => "authMVC"], function ($routes) { $routes->post("create", "UserController::create"); diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index a7392860..26ecbd5e 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -120,6 +120,7 @@ class TicketController extends BaseController '((POLICY_TYPE))' => 'policy_type', '((AUTO_QUERY_CONTENT))' => 'auto_query_content', '((CLAIM_FORM_LINK))' => 'claim_form_link', + '((CLAIM_FEEDBACK_FORM))' => 'claim_feedback_form', ]; $this->extraFields = [ 1 => ['non_id_reason'], @@ -869,6 +870,8 @@ class TicketController extends BaseController $replaceData = str_replace("Claim-", "", $this->ticketType[$ticket_data['ticket_type_id']] ?? ""); } else if ($value == "claim_form_link"){ $replaceData = 'Click here to download Claim Form'; + } else if ($value == "claim_feedback_form"){ + $replaceData = 'Click to open Claim Feedback Form'; }else { $replaceData = isset($ticket_data[$value]) ? $ticket_data[$value] : ''; } @@ -1371,7 +1374,8 @@ class TicketController extends BaseController } } - public function getPoliciesbyEmpID() { + public function getPoliciesbyEmpID() + { $received_data = $this->request->getPost(); $emp_id = $received_data['emp_id']; @@ -1443,5 +1447,15 @@ class TicketController extends BaseController return $this->response->setStatusCode(500)->setBody('An error occurred while downloading the file.'); } } - + + // ------------------------------------------------------------------------------------------------------------------------- + + + public function viewClaimFeedbackForm($md5_ticket_id) + { + $ticket_id = $this->ticketMasterModel->where('MD5(id)', $md5_ticket_id)->where('is_active', 1)->first(); + $data['ticket_id'] = $ticket_id['id']; + return view('ticket_feedback_form', $data); + } + } diff --git a/app/Views/ticket_feedback_form.php b/app/Views/ticket_feedback_form.php new file mode 100644 index 00000000..e69de29b From ad86f196cc0fb155c3983322fd809b7460e3526d Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 3 Apr 2025 10:58:11 +0530 Subject: [PATCH 2/7] CHANGE_CLAIMS_CR : RV --- app/Controllers/EmployeeRestController.php | 10 ++- app/Controllers/TicketController.php | 90 +++++++++++++++++++++- app/Models/TicketHistoryModel.php | 2 +- app/Views/ticket_list.php | 12 ++- 4 files changed, 106 insertions(+), 8 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 2d7bf436..b4d867a3 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -3112,6 +3112,8 @@ class EmployeeRestController extends AdminController } + // ---------------- TICKET API's --------------------------------------------------------------------------------------------------- + //Get Data from post for inserting ticket and message public function initiateClaim() { @@ -3171,9 +3173,11 @@ class EmployeeRestController extends AdminController ->first()['id']; $fetchData['priority'] = 1; - $fetchData['mode_of_intimation'] = 1; + $fetchData['mode_of_intimation'] = 3; + $fetchData['claim_type'] = 1; $fetchData = array_merge($fetchData, $received_data); + $fetchData['relationship'] = strtolower($fetchData['relationship']) ?? $fetchData['relationship']; // print_r($fetchData); die; $insert_status = $this->ticketMaster->insert($fetchData); $ticket_id = $this->ticketMaster->insertID(); @@ -3185,8 +3189,8 @@ class EmployeeRestController extends AdminController 'sender' => 'user', 'claim_status' => $fetchData['claim_status_id'] ?? null, 'emp_mail' => $fetchData['emp_mail'] ?? null, - 'mail_subject' => $fetchData['subject'] ?? null, - 'mail_content' => $fetchData['message'] ?? null, + 'mail_subject' => $fetchData['subject'] ?? "New Claim", + 'mail_content' => $fetchData['message'] ?? "New Claim", ]; if (!empty($messagesData['ticket_id'])) { diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 26ecbd5e..b8098149 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -234,6 +234,7 @@ class TicketController extends BaseController 'tm.claim_number AS claim_no', 'tm.tpa_id', 'tm.emp_name', + 'tm.emp_code', 'i.name AS insurer_name', 'c.client_name', 'tm.insured_name', @@ -274,6 +275,7 @@ class TicketController extends BaseController 'tm.is_head_approved', 'tm.tpa_id', 'tm.emp_name', + 'tm.emp_code', 'i.name AS insurer_name', 'c.client_name', 'tm.insured_name', @@ -457,7 +459,18 @@ class TicketController extends BaseController $data['placeHolders'] = $this->placeHolders; $data['message_data'] = $this->getTicketMessage($ticket_id); $data['view_ticket_page'] = []; - $data['member_data'] = $this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']); + + if($ticket_data['ticket_type_id'] == 1){ + $data['member_data'] = $this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']); + }else{ + $data['member_data'] = array_filter( + $this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']), + function ($member) { + return isset($member['emp_relationship']) && $member['emp_relationship'] == 'Self'; + } + ); + } + $data['ticket_history'] = $this->ticketHistory($ticket_id); $data['ticket_check_list'] = db_connect()->table('ticket_check_list')->where('is_active', 1)->where('ticket_type_id', $ticket_data['ticket_type_id'])->get()->getResultArray(); if (!empty($ticket_data['client_policy_id'])){ @@ -579,7 +592,9 @@ class TicketController extends BaseController $return_value = $this->ticketMasterModel->insert($ticket_data); if ($return_value) { //mail trigger part + $this->putHistoryAfterInsert($ticket_data, $return_value); $mail_responce = $this->sendAutoMailTrigger($return_value); + $this->autoMessageInsertBasedOnMailResponse($mail_responce, $return_value); return $this->respond(['status' => true, 'ticket_id' => $return_value, 'code' => 200, 'data' => $ticket_data, "message" => "Claim created successfully", 'mail_responce' => $mail_responce], 200); } else { return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to create claim'], 200); @@ -602,8 +617,12 @@ class TicketController extends BaseController $return_value = $this->ticketMasterModel->where('id', $ticket_id)->set($ticket_data)->update(); if ($return_value) { - //mail trigger part - $mail_responce = $this->sendAutoMailTrigger($ticket_id); + $mail_responce = null; + if($old_ticket_data['claim_status_id'] != $ticket_data['claim_status_id']){ + //mail trigger part + $mail_responce = $this->sendAutoMailTrigger($ticket_id); + $this->autoMessageInsertBasedOnMailResponse($mail_responce, $ticket_id); + } //send mail to the head for rejected ticket approvel if($ticket_data['claim_status_id'] == 8 && $ticket_data['is_head_approved'] == 0){ @@ -1450,6 +1469,71 @@ class TicketController extends BaseController // ------------------------------------------------------------------------------------------------------------------------- + public function autoMessageInsertBasedOnMailResponse($mail_sent_status, $ticket_id) + { + if (gettype($mail_sent_status) == 'array') { + $this->myLogger->logme('error', "auto Message Insert Based On Mail Response Failed because is array :$ticket_id "); + } else { + $mail_sent_status = json_decode($mail_sent_status); + $this->myLogger->logme('error', "mail_sent_status is object :$ticket_id "); + } + + if (!empty($mail_sent_status) && isset($mail_sent_status->status) && $mail_sent_status->status == 'success') { + + $sent_message_data['ticket_id'] = $ticket_id; + $sent_message_data['sender'] = 'staff'; + $sent_message_data['emp_mail'] = $mail_sent_status->data->params->mail; + $sent_message_data['mail_subject'] = $mail_sent_status->data->params->subject; + $sent_message_data['mail_content'] = $mail_sent_status->data->params->message; + + $message_insert_status = $this->ticketMessageModel->insert($sent_message_data); + + if ($message_insert_status) { + $this->myLogger->logme('error', "Claim initiated, Mail sent Successfully, successfully store message:$ticket_id "); + } else { + $this->myLogger->logme('error', "Claim initiated, Mail sent Successfully, Failed to store message:$ticket_id "); + } + + return true; + } else { + + $this->myLogger->logme('error', "Failed to send Mail :$ticket_id "); + return true; + } + } + + public function putHistoryAfterInsert($ticket_data, $ticket_id) + { + $this->myLogger->logme('error', "Put History After Insert function called : $ticket_id"); + + if(!empty($ticket_data)){ + + $history_data = [ + 'ticket_id' => $ticket_id, + 'field_name' => 'claim_status_id', + 'display_name' => 'Ticket Created', + 'old_value' => null, + 'new_value' => $ticket_data['claim_status_id'], + 'created_by' => get_session_userid(), + 'is_active' => 1 + ]; + + $this->myLogger->logme('error', "Put History After Insert function called : " . json_encode($history_data)); + + + $history_insert = $this->ticketHistoryModel->insert($history_data); + + if($history_insert){ + $this->myLogger->logme('error', "Put History After Insert Ticket Data Successfully"); + }else{ + $this->myLogger->logme('error', "Put History After Insert Ticket Data Failed"); + } + + }else{ + $this->myLogger->logme('error', "Put History After Insert Ticket Data is empty"); + } + + } public function viewClaimFeedbackForm($md5_ticket_id) { diff --git a/app/Models/TicketHistoryModel.php b/app/Models/TicketHistoryModel.php index 6d7eb0f5..92041c8c 100644 --- a/app/Models/TicketHistoryModel.php +++ b/app/Models/TicketHistoryModel.php @@ -12,7 +12,7 @@ class TicketHistoryModel extends Model protected $returnType = 'array'; protected $useSoftDeletes = false; protected $protectFields = true; - protected $allowedFields = ['id','field_name','display_name','old_value', + protected $allowedFields = ['id', "ticket_id", 'field_name','display_name','old_value', 'new_value','created_by','created_at','updated_by','updated_at','is_active']; // Callbacks diff --git a/app/Views/ticket_list.php b/app/Views/ticket_list.php index a51706fd..fa5c8fcc 100644 --- a/app/Views/ticket_list.php +++ b/app/Views/ticket_list.php @@ -35,6 +35,10 @@ table.dataTable tbody td { white-space: nowrap !important; } +#scroll-horizontal-datatable tbody tr:hover { + background-color: #e0e0e0; +} + @@ -57,6 +61,7 @@ table.dataTable tbody td { Policy Type Claim number TPA ID + Emp ID Emp name Insured Name Corporate name @@ -66,7 +71,7 @@ table.dataTable tbody td { $row){ ?> - + + @@ -184,8 +190,12 @@ $(document).ready(function() { function viewTicket(ticket_id){ + $('.loader').fadeIn(); + $('.loader-mask').fadeIn(); + let url = '' + ticket_id window.location.href = url + } \ No newline at end of file From 82f131f5115c1557284888e069bceff3076ddcf6 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 3 Apr 2025 11:14:47 +0530 Subject: [PATCH 3/7] CHNAGE_API_FOR_FIRST_HISTORY : RV --- app/Controllers/EmployeeRestController.php | 3 +++ app/Controllers/TicketController.php | 2 ++ app/Views/ticket_history.php | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index b4d867a3..e86f5de7 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -3184,6 +3184,9 @@ class EmployeeRestController extends AdminController if ($insert_status && !empty($ticket_id)) { + //insert first history + $this->ticketController->putHistoryAfterInsert($fetchData, $ticket_id); + $messagesData = [ 'ticket_id' => $ticket_id ?? null, 'sender' => 'user', diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index b8098149..a783fa2f 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -1533,6 +1533,8 @@ class TicketController extends BaseController $this->myLogger->logme('error', "Put History After Insert Ticket Data is empty"); } + return true; + } public function viewClaimFeedbackForm($md5_ticket_id) diff --git a/app/Views/ticket_history.php b/app/Views/ticket_history.php index 7ee087e1..0a783d26 100644 --- a/app/Views/ticket_history.php +++ b/app/Views/ticket_history.php @@ -20,7 +20,7 @@ '.$row['new_value']; ?> - + From 61732f1c2e28a06059372b8d3b45986376baada7 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Thu, 3 Apr 2025 16:49:06 +0530 Subject: [PATCH 4/7] FEAT_CLAIM_FEEDBACK_FORM_SRI --- app/Config/Routes.php | 5 +- app/Controllers/TicketController.php | 49 +- app/Models/TicketMasterModel.php | 1 + app/Views/layout/header.php | 10 + app/Views/ticket_feedback_form.php | 837 +++++++++++++++++++++++++++ app/Views/ticket_feedback_list.php | 148 +++++ 6 files changed, 1044 insertions(+), 6 deletions(-) create mode 100644 app/Views/ticket_feedback_list.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index c9bedc6f..0c5f0d0c 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -52,7 +52,9 @@ $routes->get('/update-emp-policy-status', 'ClientController::updateEmpAndPolicyS $routes->get('download-e-card/(:any)', 'EmployeeController::generateIDCardForEmployee/$1'); $routes->get('download-kyc-docs/(:segment)', 'ClientController::downloadKYCDocument/$1'); $routes->get('claim-form-download/(:any)', 'TicketController::downloadClaimForm/$1'); -$routes->get("claims-feedback-form/(:any)", "TicketController::viewClaimFeedbackForm/$1"); +$routes->match (['get','post'],"claims-feedback-form/(:any)/(:any)", "TicketController::viewClaimFeedbackForm/$1/$2"); +$routes->match (['get','post'],"claims-feedback-form/(:any)", "TicketController::viewClaimFeedbackForm/$1"); + $routes->group("/user", ["filter" => "authMVC"], function ($routes) { @@ -535,6 +537,7 @@ $routes->group("/bdsReport", ["filter" => "authMVC"], function ($routes) { //New Tickets $routes->group("/ticket", ["filter" => "authMVC"], function ($routes) { $routes->match( ['get', 'post'], 'list','TicketController::ticketList'); + $routes->get('feedback-list','TicketController::feedbackList'); $routes->get('new/(:any)','TicketController::ticket_form/$1'); $routes->post('create','TicketController::createTicket'); $routes->post('update','TicketController::updateTicket'); diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 26ecbd5e..d6e62594 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -870,7 +870,7 @@ class TicketController extends BaseController $replaceData = str_replace("Claim-", "", $this->ticketType[$ticket_data['ticket_type_id']] ?? ""); } else if ($value == "claim_form_link"){ $replaceData = 'Click here to download Claim Form'; - } else if ($value == "claim_feedback_form"){ + } else if ($value == "claim_feedback_form" && $ticket_data['ticket_type_id'] == 1){ $replaceData = 'Click to open Claim Feedback Form'; }else { $replaceData = isset($ticket_data[$value]) ? $ticket_data[$value] : ''; @@ -1451,11 +1451,50 @@ class TicketController extends BaseController // ------------------------------------------------------------------------------------------------------------------------- - public function viewClaimFeedbackForm($md5_ticket_id) + public function viewClaimFeedbackForm($md5_ticket_id,$empView = null) { - $ticket_id = $this->ticketMasterModel->where('MD5(id)', $md5_ticket_id)->where('is_active', 1)->first(); - $data['ticket_id'] = $ticket_id['id']; - return view('ticket_feedback_form', $data); + + if ($this->request->is("get")){ + + $data['ticket_id'] = $md5_ticket_id; + $data['ticket_data'] = $this->ticketMasterModel->select('ticket_master.*,clients.client_name')->join('clients','clients.id = ticket_master.client_id')->where('MD5(ticket_master.id)',$md5_ticket_id)->where('ticket_master.is_active',1)->first(); + $data['form_submitted'] = !empty($data['ticket_data']['feedback_json'])? 1 : 0; + + + $data['viewer'] = !empty($empView) ? $empView : 0; + // dd($data); + return view('ticket_feedback_form', $data); + }else{ + + $formDataJson = json_encode($this->request->getPost()); + // log_message("error","Form data : ".$formDataJson); + + + $data_to_store = [ + + 'feedback_json' => $formDataJson + ]; + + if (!empty($formDataJson)){ + // $this->ticketMasterModel->save($data_to_store); + $this->ticketMasterModel->where('MD5(id)', $md5_ticket_id)->set($data_to_store)->update(); + + return $this->respond(['status' => true,'id'=> $md5_ticket_id,'received_data' => $formDataJson], 200); + + }else{ + return $this->respond(['status' => false,'id'=> $md5_ticket_id,'received_data' => $formDataJson], 200); + } + + } + + } + + public function feedbackList(){ + + $data['feedback_data'] = $this->ticketMasterModel->select("ticket_master.*,clients.client_name")->join("clients","clients.id = ticket_master.client_id")->where("ticket_master.is_active",1)->where("ticket_master.feedback_json IS NOT NULL", null, false)->where("ticket_master.feedback_json !=", "")->findAll(); + + // dd($data); + $this->loadLayout("ticket_feedback_list",$data); } } diff --git a/app/Models/TicketMasterModel.php b/app/Models/TicketMasterModel.php index 7fc418cb..1612c08e 100644 --- a/app/Models/TicketMasterModel.php +++ b/app/Models/TicketMasterModel.php @@ -15,6 +15,7 @@ class TicketMasterModel extends Model protected $allowedFields = [ 'id', 'ticket_type_id', + 'feedback_json', 'claim_status_id', 'acm_id', 'insurer_id', diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index 0abdf8d5..f7ccabb4 100755 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -81,6 +81,13 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ +
+
+ " class="form-control-plaintext" id="email" readonly> +
+
+ +
+
+ +
+
+ " class="form-control-plaintext" id="name" readonly> +
+
+ +
+
+ +
+
+ " class="form-control-plaintext" id="client_name" readonly> +
+
+ +
+
+ +
+
+ " class="form-control-plaintext" id="emp_code" readonly> +
+
+ +
+
+ +
+
+ " class="form-control-plaintext" id="claim_number" readonly> +
+
+
+
+
+ +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ +
+ +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ +
+ +
+ +
+ + +
+ +
+ + +
+ +
+ +
+ +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ + +
+ +
+ +
+ + +
+
+ +
+ +
+
+ +
+ +
+ + +
+
+ /assets/images/nhance-loader-fast.gif" height="40" width="40" alt="Loading..."> +
+
+ + + +
+

© 2025 Nhance India Pvt Ltd. All Rights Reserved.

+
+ + + + + + \ No newline at end of file diff --git a/app/Views/ticket_feedback_list.php b/app/Views/ticket_feedback_list.php new file mode 100644 index 00000000..f4de0f73 --- /dev/null +++ b/app/Views/ticket_feedback_list.php @@ -0,0 +1,148 @@ + + + + + +
+
+
+
+
+

Claim Feedback List

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
Claim NumberEmp CodeEmp nameCorporate name
+ +
+
+
+
+
+
+ + + + + + \ No newline at end of file From 240c821f20e84b4e6735b413dfca76b6b552198b Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 3 Apr 2025 17:39:06 +0530 Subject: [PATCH 5/7] CHANGE_CLAIM_CR : RV --- app/Controllers/TicketController.php | 44 ++++++++++++++++++++++++++-- app/Views/ticket_history.php | 3 +- app/Views/ticket_list.php | 2 +- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index a783fa2f..6c2942c9 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -121,6 +121,7 @@ class TicketController extends BaseController '((AUTO_QUERY_CONTENT))' => 'auto_query_content', '((CLAIM_FORM_LINK))' => 'claim_form_link', '((CLAIM_FEEDBACK_FORM))' => 'claim_feedback_form', + '((SETTLED_LETTER))' => 'settle_letter', ]; $this->extraFields = [ 1 => ['non_id_reason'], @@ -233,6 +234,7 @@ class TicketController extends BaseController 'tcs.claim_status AS status', 'tm.claim_number AS claim_no', 'tm.tpa_id', + 'tm.tpa_no', 'tm.emp_name', 'tm.emp_code', 'i.name AS insurer_name', @@ -274,6 +276,7 @@ class TicketController extends BaseController 'tm.claim_status_id', 'tm.is_head_approved', 'tm.tpa_id', + 'tm.tpa_no', 'tm.emp_name', 'tm.emp_code', 'i.name AS insurer_name', @@ -857,7 +860,7 @@ class TicketController extends BaseController } // Construct Mail Data - $mailData = [ + $mailData[] = [ 'mail' => $ticket_data['emp_mail'], 'subject' => $subject, 'message' => $message, @@ -865,6 +868,17 @@ class TicketController extends BaseController 'attachments' => [] ]; + // if the employee personal mail is not empty then send the mail to the employee personal mail + if(!empty($ticket_data['emp_personal_mail'])){ + $mailData[] = [ + 'mail' => $ticket_data['emp_personal_mail'], + 'subject' => $subject, + 'message' => $message, + 'cc' => $ticket_data['common_mails'] ?? '', + 'attachments' => [] + ]; + } + // print_r($mailData); die; $this->myLogger->logme('error', "Final Email Data"); @@ -891,6 +905,8 @@ class TicketController extends BaseController $replaceData = 'Click here to download Claim Form'; } else if ($value == "claim_feedback_form"){ $replaceData = 'Click to open Claim Feedback Form'; + } else if ($value == "settle_letter"){ + $replaceData = ' View Settlement Letter '; }else { $replaceData = isset($ticket_data[$value]) ? $ticket_data[$value] : ''; } @@ -949,6 +965,27 @@ class TicketController extends BaseController $this->myLogger->logme('error', "Fetched ACM emails"); + + if(!empty($ticket_data['emp_personal_mail'])){ + + $this->myLogger->logme('error', "Send employee personal mail start"); + + $emailPersonalData = [ + 'mail' => $ticket_data['emp_personal_mail'], + 'subject' => $mail_data['mail_subject'], + 'message' => $mail_data['mail_content'], + 'common' => [], + 'cc' => $acm_mails['common_mails'], + 'attachments' => [] + ]; + + $this->sendTrigger($emailPersonalData); + + $this->myLogger->logme('error', "Send employee personal mail successfully"); + }else{ + $this->myLogger->logme('error', "Send employee personal mail is empty"); + } + $emailData = [ 'mail' => $mail_data['emp_mail'], 'subject' => $mail_data['mail_subject'], @@ -972,7 +1009,10 @@ class TicketController extends BaseController if (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 1) { $mail_content = $this->constructMailContent($ticket_id); // print_r($mail_content); die; - $mail_responce = $this->sendTrigger($mail_content); + foreach ($mail_content as $key => $value) { + $mail_responce = $this->sendTrigger($value); + $this->myLogger->logme('error', '{data} - Auto Mail Sent, Successfully', ['data' => $key + 1]); + } } 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 { diff --git a/app/Views/ticket_history.php b/app/Views/ticket_history.php index 0a783d26..c0e5bfea 100644 --- a/app/Views/ticket_history.php +++ b/app/Views/ticket_history.php @@ -21,7 +21,8 @@ '.$row['new_value']; ?> - + + diff --git a/app/Views/ticket_list.php b/app/Views/ticket_list.php index fa5c8fcc..f0410316 100644 --- a/app/Views/ticket_list.php +++ b/app/Views/ticket_list.php @@ -114,7 +114,7 @@ table.dataTable tbody td { - + From 27817789addc68b17d6aefc8669fc3c4200ea062 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Fri, 4 Apr 2025 14:25:21 +0530 Subject: [PATCH 6/7] DEBUG_CHATBOT --- .../Chatbot/EcardDownloadConversation.php | 2 ++ app/Controllers/Chatbot/MainMenuConversation.php | 8 ++++++++ .../Chatbot/NetworkHospitalConversation.php | 3 +++ app/Controllers/Chatbot/policyConversation.php | 3 +++ app/Controllers/ChatbotControllerNew.php | 14 +++++++------- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/app/Controllers/Chatbot/EcardDownloadConversation.php b/app/Controllers/Chatbot/EcardDownloadConversation.php index b0cb78ae..84617af1 100644 --- a/app/Controllers/Chatbot/EcardDownloadConversation.php +++ b/app/Controllers/Chatbot/EcardDownloadConversation.php @@ -17,6 +17,8 @@ class EcardDownloadConversation extends Conversation protected function showEcardMenu() { + log_message('error', ('showEcardMenu function called')); + $chat_session_info = get_chatbot_session_info(); $policy_list = ChatbotHelper::getListOfPolicies($chat_session_info); $buttons = []; diff --git a/app/Controllers/Chatbot/MainMenuConversation.php b/app/Controllers/Chatbot/MainMenuConversation.php index 87d9a4ef..875ecba4 100644 --- a/app/Controllers/Chatbot/MainMenuConversation.php +++ b/app/Controllers/Chatbot/MainMenuConversation.php @@ -46,9 +46,14 @@ class MainMenuConversation extends Conversation $this->bot->reply($message); } + log_message('error', ('user_reponse before: ' . $user_reponse)); + + if (!$answer->isInteractiveMessageReply()) { $user_reponse = null; } + + // Get just the existing path array $path = $this->bot->userStorage()->get('path') ?? []; @@ -60,6 +65,9 @@ class MainMenuConversation extends Conversation 'path' => $path ]); + log_message('error', ('user_reponse : ' . $user_reponse)); + + switch ($user_reponse) { case "ecard_download": diff --git a/app/Controllers/Chatbot/NetworkHospitalConversation.php b/app/Controllers/Chatbot/NetworkHospitalConversation.php index 2e59f896..4a1e991c 100644 --- a/app/Controllers/Chatbot/NetworkHospitalConversation.php +++ b/app/Controllers/Chatbot/NetworkHospitalConversation.php @@ -59,7 +59,10 @@ class NetworkHospitalConversation extends Conversation $this->bot->userStorage()->save([ 'path' => $path ]); + log_message('error', ('user_reponse : ' . $answer->getValue())); + switch ($answer->getValue()) { + case is_string($answer->getValue()) && is_array(explode('#',$answer->getValue())) && count((explode('#',$answer->getValue()))) == 2: $client_poilicy_id = explode('#',$answer->getValue())[1]; diff --git a/app/Controllers/Chatbot/policyConversation.php b/app/Controllers/Chatbot/policyConversation.php index 04c8d9a5..f2fe91c1 100644 --- a/app/Controllers/Chatbot/policyConversation.php +++ b/app/Controllers/Chatbot/policyConversation.php @@ -46,6 +46,9 @@ class policyConversation extends Conversation if (!$answer->isInteractiveMessageReply()) { $user_reponse = null; } + + log_message('error', ('user_reponse : ' . $answer->getValue())); + $path = $this->bot->userStorage()->get('path'); array_push($path, $answer->getValue() diff --git a/app/Controllers/ChatbotControllerNew.php b/app/Controllers/ChatbotControllerNew.php index 610f2bda..2f6ca404 100644 --- a/app/Controllers/ChatbotControllerNew.php +++ b/app/Controllers/ChatbotControllerNew.php @@ -89,7 +89,7 @@ class ChatbotControllerNew extends BaseController $user = $this->botman->getUser(); $id = $user->getId(); - // $this->myLogger->logme('error', ('TEST' . $id)); + $this->myLogger->logme('error', ('TEST' . $id)); $this->session->set('CHATBOT_RANDOM_USER_ID', $id); } @@ -128,14 +128,14 @@ class ChatbotControllerNew extends BaseController $this->botman->listen(); } - private function registerHandlers() - { - // Handling Policy and Claims - $this->botman->hears('group:policy:{option}', [\App\Controllers\Chatbot\PolicyHandler::class, 'handle']); - $this->botman->hears('group:claim:{option}', [\App\Libraries\Chatbot\ClaimHandler::class, 'handle']); + // private function registerHandlers() + // { + // // Handling Policy and Claims + // $this->botman->hears('group:policy:{option}', [\App\Controllers\Chatbot\PolicyHandler::class, 'handle']); + // $this->botman->hears('group:claim:{option}', [\App\Libraries\Chatbot\ClaimHandler::class, 'handle']); - } + // } public function chatbot() { From 1897b8760711415cb008d8da3120fd69b8695c7d Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Fri, 4 Apr 2025 17:59:03 +0530 Subject: [PATCH 7/7] FIX_EXCEL_MERGE_AND_FEAT_CAL_SRI --- app/Controllers/LeadsController.php | 2 +- app/Helpers/ExcelMergeHelper.php | 26 +++++++++--- app/Views/leads_form.php | 65 ++++++++++++++++++++++++++++- app/Views/rfq/gmc.php | 4 +- 4 files changed, 88 insertions(+), 9 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 1c5e9f80..bde79243 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -1801,7 +1801,7 @@ class LeadsController extends BaseController ['file_path' => $temp_file_path, 'sheets' => []], ['file_path' => $lead_file_path, 'sheets' => []] ]; - $outputPath = dirname($temp_file_path) . '/' . 'merged_' . $temp_file_name; + $outputPath = dirname($temp_file_path) . '/' . $temp_file_name; $result = ExcelMergeHelper::mergeExcelFiles($filePaths, $outputPath); // print_rr($result); } diff --git a/app/Helpers/ExcelMergeHelper.php b/app/Helpers/ExcelMergeHelper.php index 36306692..405c4762 100644 --- a/app/Helpers/ExcelMergeHelper.php +++ b/app/Helpers/ExcelMergeHelper.php @@ -17,10 +17,13 @@ class ExcelMergeHelper { { try { log_message('debug', 'Attempting merge with original file order'); + // echo "Attempting merge with original file order\n"; return self::processFiles($filePaths, $outputPath); } catch (Exception $e) { log_message('error', 'First attempt failed: ' . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine()); + // echo "First attempt failed: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() . "\n"; log_message('debug', 'Retrying with reversed file order'); + // echo "Retrying with reversed file order\n"; // Reverse the file order and try again $reversedFiles = array_reverse($filePaths); @@ -29,6 +32,7 @@ class ExcelMergeHelper { return self::processFiles($reversedFiles, $outputPath); } catch (Exception $e2) { log_message('error', 'Both attempts failed. Last error: ' . $e2->getMessage() . ' in ' . $e2->getFile() . ' on line ' . $e2->getLine()); + // echo "Both attempts failed. Last error: " . $e2->getMessage() . ' in ' . $e2->getFile() . ' on line ' . $e2->getLine() . "\n"; return null; } } @@ -45,7 +49,9 @@ class ExcelMergeHelper { private static function processFiles(array $filePaths, string $outputPath): string { log_message('debug', 'Starting Excel merge process'); + // echo "Starting Excel merge process\n"; log_message('debug', 'Files to process: ' . json_encode($filePaths)); + // echo "Files to process: " . json_encode($filePaths) . "\n"; if (empty($filePaths)) { throw new Exception("No files provided to merge"); @@ -66,6 +72,7 @@ class ExcelMergeHelper { // Save the merged file log_message('debug', "Saving merged file to: {$outputPath}"); + // echo "Saving merged file to: {$outputPath}\n"; $writer = IOFactory::createWriter($mergedSpreadsheet, 'Xlsx'); $writer->setPreCalculateFormulas(false); $writer->save($outputPath); @@ -76,6 +83,7 @@ class ExcelMergeHelper { gc_collect_cycles(); log_message('debug', 'Excel merge process completed successfully'); + // echo "Excel merge process completed successfully\n"; return $outputPath; } @@ -87,15 +95,17 @@ class ExcelMergeHelper { * @param int|null $index * @throws Exception */ - private static function processSingleFile(array $fileInfo, Spreadsheet $mergedSpreadsheet, int $index = null) + private static function processSingleFile(array $fileInfo, Spreadsheet $mergedSpreadsheet, ?int $index = null) { if (!isset($fileInfo['file_path']) || !file_exists($fileInfo['file_path'])) { $path = $fileInfo['file_path'] ?? 'undefined'; log_message('error', "File " . ($index ?? 'base') . ": Invalid or missing file path: {$path}"); + // echo "File " . ($index ?? 'base') . ": Invalid or missing file path: {$path}\n"; return; } log_message('debug', "Processing file " . ($index ?? 'base') . ": " . $fileInfo['file_path']); + // echo "Processing file " . ($index ?? 'base') . ": " . $fileInfo['file_path'] . "\n"; try { // Load the source spreadsheet @@ -105,6 +115,7 @@ class ExcelMergeHelper { $worksheets = $sourceSpreadsheet->getAllSheets(); $totalSheets = count($worksheets); log_message('debug', "Total sheets in file: " . $totalSheets); + // echo "Total sheets in file: " . $totalSheets . "\n"; $sheetsToMerge = $fileInfo['sheets'] ?? []; @@ -114,26 +125,30 @@ class ExcelMergeHelper { try { $sheetName = $worksheet->getTitle(); log_message('debug', "Processing sheet: {$sheetName}"); + // echo "Processing sheet: {$sheetName}\n"; // Generate unique sheet name before cloning $newName = $sheetName; $counter = 1; while (in_array($newName, $mergedSpreadsheet->getSheetNames())) { - $newName = $sheetName . "_" . $counter++; + // $newName = $sheetName . "_" . $counter++; log_message('debug', "Sheet name already exists. Trying new name: {$newName}"); + // echo "Sheet name already exists. Trying new name: {$newName}\n"; } // Clone the worksheet and set the new name - $clonedSheet = clone $worksheet; - $clonedSheet->setTitle($newName); + // $clonedSheet = clone $worksheet; + // $clonedSheet->setTitle($newName); // Add as external sheet - $mergedSpreadsheet->addExternalSheet($clonedSheet); + $mergedSpreadsheet->addExternalSheet($worksheet); log_message('debug', "Successfully added sheet: {$newName}"); + // echo "Successfully added sheet: {$newName}\n"; } catch (Exception $e) { log_message('error', "Error processing sheet {$sheetName} as new name {$newName}: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine()); + // echo "Error processing sheet {$sheetName} as new name {$newName}: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() . "\n"; } } } @@ -145,6 +160,7 @@ class ExcelMergeHelper { } catch (Exception $e) { log_message('error', "Error processing file {$fileInfo['file_path']}: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine()); + // echo "Error processing file {$fileInfo['file_path']}: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() . "\n"; } } } \ No newline at end of file diff --git a/app/Views/leads_form.php b/app/Views/leads_form.php index 003e8d96..e3be624c 100644 --- a/app/Views/leads_form.php +++ b/app/Views/leads_form.php @@ -1064,7 +1064,7 @@ console.log('incurredClaimDate', incurredClaimDate) if (policyStartDate && incurredClaimDate) { - var timeDiff = incurredClaimDate - policyStartDate; // Time difference in milliseconds + var timeDiff = (policyStartDate - incurredClaimDate) + 1; // Time difference in milliseconds console.log('timeDiff', timeDiff); var daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24)); // Convert to days and add 1 console.log('daysDiff', daysDiff); @@ -1145,6 +1145,69 @@ $('#earned_premium_' + increment).val(earned_premium_roundoff); } + $(document).on("input", "#incept_emp_count, #incept_dept_count, #renewal_emp_count, #renewal_dept_count, #exp_emp_count, #exp_dept_count", function() { + calculateTotalLives(this); + }); + + function calculateTotalLives(input) { + + var lead_type = $('#lead_type').val(); + + if (lead_type == 1) { + + let formRow = input.closest('.form-row'); + + if (formRow) { + // Get the employee count and dependent count within the same row + let empCountInput = formRow.querySelector('[name="incept_emp_count[]"]'); + let depCountInput = formRow.querySelector('[name="incept_dept_count[]"]'); + let totalLivesInput = formRow.querySelector('[name="incept_no_of_lives[]"]'); + + // Parse the input values as integers, defaulting to 0 if empty + let empCount = empCountInput ? parseInt(empCountInput.value) || 0 : 0; + let depCount = depCountInput ? parseInt(depCountInput.value) || 0 : 0; + + // Calculate total lives + let totalLives = empCount + depCount; + + // Set the total lives input value + if (totalLivesInput) { + totalLivesInput.value = totalLives; + } + } + + + } else { + console.log("Function Called"); + + if (input.id === "incept_emp_count" || input.id === "incept_dept_count") { + var incept_emp_count = parseInt($("#incept_emp_count").val()) || 0; + var incept_dept_count = parseInt($("#incept_dept_count").val()) || 0; + + var totalCount = incept_emp_count + incept_dept_count; + $("#incept_no_of_lives").val(totalCount); + + } else if (input.id === "renewal_emp_count" || input.id === "renewal_dept_count") { + var renewal_emp_count = parseInt($("#renewal_emp_count").val()) || 0; + var renewal_dept_count = parseInt($("#renewal_dept_count").val()) || 0; + + var totalCount = renewal_emp_count + renewal_dept_count; + $("#renewal_no_of_lives").val(totalCount); + + } else { + var exp_emp_count = parseInt($("#exp_emp_count").val()) || 0; + var exp_dept_count = parseInt($("#exp_dept_count").val()) || 0; + + var totalCount = exp_emp_count + exp_dept_count; + $("#exp_no_of_lives").val(totalCount); + } + } + + + } + + + //------------------------ FORM SUBMIT --------------------------------------------------------------------------------- $("#leads_form_id").submit(function(event) { diff --git a/app/Views/rfq/gmc.php b/app/Views/rfq/gmc.php index 09d28d3e..9c99df08 100644 --- a/app/Views/rfq/gmc.php +++ b/app/Views/rfq/gmc.php @@ -116,14 +116,14 @@ + placeholder="Enter Lives" required oninput="calculateTotalLives(this)">
+ placeholder="Enter Lives" required oninput="calculateTotalLives(this)">