From 21999bc0aefcc0a0e1512ce7c505038b3a5a9a5d Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 7 Feb 2025 18:45:29 +0530 Subject: [PATCH] CHANGE_CLAIMS_MODULE : RV --- app/Controllers/ClientController.php | 14 +- app/Controllers/TicketController.php | 73 ++++++++- app/Helpers/MailHelper.php | 3 +- app/Models/TicketMasterModel.php | 13 ++ app/Views/employee_data_list.php | 13 +- app/Views/employee_list.php | 216 +++++++++++++++++++-------- app/Views/ticket_auto_query.php | 105 ++++++++++--- app/Views/ticket_form_gmc.php | 103 ++++++++++++- app/Views/ticket_form_gpa.php | 60 +++++++- app/Views/ticket_form_handler.php | 2 +- app/Views/ticket_list.php | 28 +++- app/Views/ticket_mail_template.php | 6 +- 12 files changed, 529 insertions(+), 107 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 63f167df..d7a06cf5 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -173,17 +173,17 @@ class ClientController extends AdminController { $message = '

Request for Quotation (RFQ)

Dear {{RECIPIENT_NAME}},

We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.

RFQ Details

Client name{{CLIENT_NAME}}
Coverage Type{{POLICY_LONG_NAME}}
Policy Start Date{{POLICY_START_DATE}}
Policy Duration{{DURATION}}
Please note: Additional terms and details are included in the attachment for your reference.

Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.

Best regards,

Nhance India Pvt Ltd

'; - $attachments = [ - ["filePath" => ROOTPATH."public/sample_excel/sample_addition.xls","fileName" => "sample_addition.xls"], - ["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"], - ["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"] - ]; - + // $attachments = [ + // ["filePath" => ROOTPATH."public/sample_excel/sample_addition.xls","fileName" => "sample_addition.xls"], + // ["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"], + // ["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"] + // ]; + $attachments = []; $res = MailHelper::send_email(['mail' => $email, 'subject' => 'Mail Via Attachment Testing URL', 'message' => $message,'attachments' => $attachments]); print_rr($res); echo '------------------------------------------------------------------------------------------'; - print_rr($attachments); + // print_rr($attachments); } //Function for Testing Member Review and Summery Confirmation Mail diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index e2a9bb42..78023e93 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -124,10 +124,10 @@ class TicketController extends BaseController } public function ticketList() - { + { + $data['ticket_type'] = $this->ticketType; if ($this->request->is('get')) { $data['page_name'] = "Claims"; - $data['ticket_type'] = $this->ticketType; $data['claim_status'] = $this->claimStatus->select('id,ticket_type,claim_status')->where('is_active', 1)->findAll(); $data['client_list'] = $this->clientModel->select('id,client_name')->where('is_active', 1)->findAll(); $data['ticket_data'] = $this->ticketSearch(1); @@ -182,6 +182,9 @@ class TicketController extends BaseController $query = $db->table('ticket_master tm') ->select([ 'tm.id', + 'tm.ticket_type_id', + 'tm.claim_status_id', + 'tm.is_head_approved', 'tcs.claim_status AS status', 'tm.claim_number AS claim_no', 'tm.tpa_id', @@ -219,8 +222,11 @@ class TicketController extends BaseController $query = $db->table('ticket_master tm') ->select([ 'tm.id', + 'tm.ticket_type_id', 'tcs.claim_status AS status', 'tm.claim_number AS claim_no', + 'tm.claim_status_id', + 'tm.is_head_approved', 'tm.tpa_id', 'tm.emp_name', 'i.name AS insurer_name', @@ -324,6 +330,7 @@ class TicketController extends BaseController $data['view_ticket_page'] = []; $data['member_data'] = $this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']); $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(); // dd($data); return $this->loadLayout('ticket_edit_onbording', $data); @@ -418,6 +425,11 @@ class TicketController extends BaseController //mail trigger part $mail_responce = $this->sendAutoMailTrigger($ticket_id); + //send mail to the head for rejected ticket approvel + if($ticket_data['claim_status_id'] == 8){ + $this->sendMailToTheHead($ticket_data); + } + return $this->respond(['status' => true, 'code' => 200, 'data' => $ticket_data, "message" => "Claim updated successfully", 'mail_responce' => $mail_responce], 200); } else { return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to update claim'], 200); @@ -640,7 +652,7 @@ class TicketController extends BaseController } else if ($value == "policy_type") { $replaceData = str_replace("Claim-", "", $this->ticketType[$ticket_data['ticket_type_id']] ?? ""); } else { - $replaceData = strtoupper($ticket_data[$value]) ?? ''; + $replaceData = isset($ticket_data[$value]) ? strtoupper($ticket_data[$value]) : ''; } $content = str_replace($key, $replaceData, $content); @@ -657,6 +669,7 @@ class TicketController extends BaseController { $this->myLogger->logme('error', "Sending email with content"); if (!empty($mail_content)) { + $mail_content['from_mail'] = "claims@nhanceindia.in"; $response = MailHelper::send_email($mail_content); } else { $response = ['status' => false, 'code' => 404, 'message' => "Mail not sent, mail data empty"]; @@ -1135,4 +1148,58 @@ class TicketController extends BaseController // return $result; // } + + // function for Reject ticket Head Approvel mail sent function + public function sendMailToTheHead($ticket_data) + { + $this->myLogger->logme('error', "sendMailToTheHead Function Called"); + if(!empty($ticket_data)){ + + // print_r($ticket_data); die; + + $head_mail = $this->employeeModel + ->select('user_profiles.email') + ->join('clients', 'employees.client_id = clients.id') + ->join('client_rm', 'clients.id = client_rm.client_id') + ->join('user_profiles', 'client_rm.user_id = user_profiles.id') + ->where('employees.is_active', 1) + ->where('client_rm.is_active', 1) + ->where('client_rm.level', 1) + ->where('employees.id', $ticket_data['emp_id']) + ->first(); + + if(!empty($head_mail)){ + + $template_data = $this->ticketMailTemplateModel + ->where('ticket_mail_template.ticket_type', 0) + ->where('ticket_mail_template.trigger_type', 0) + ->first(); + + if(!empty($template_data)){ + + $subject = $this->replacePlaceholders($template_data['subject'], $ticket_data); + $message = $this->replacePlaceholders($template_data['mail_content'], $ticket_data); + + $emailData = [ + 'mail' => $head_mail['email'], + 'subject' => $subject, + 'message' => $message, + 'common' => [], + ]; + + $this->sendTrigger($emailData); + + }else{ + $this->myLogger->logme('error', "Head Mail can't be sent because Template data is empty"); + } + + + }else{ + $this->myLogger->logme('error', "Head Mail can't be sent because head mail is empty"); + } + + }else{ + $this->myLogger->logme('error', "Head Mail can't be sent because ticket data is empty"); + } + } } diff --git a/app/Helpers/MailHelper.php b/app/Helpers/MailHelper.php index 99490bde..8fc4884b 100755 --- a/app/Helpers/MailHelper.php +++ b/app/Helpers/MailHelper.php @@ -304,7 +304,8 @@ class MailHelper $bcc = isset($params['bcc']) ? $params['bcc'] : ''; $cc = isset($params['cc']) ? $params['cc'] : ''; - $from_address = getenv('email.fromEmail'); + $from_address = isset($params['from_mail']) && !empty($params['from_mail']) ? $params['from_mail'] : getenv('email.fromEmail'); + // $from_address = "claims@nhanceindia.in"; try { $curl = curl_init(); diff --git a/app/Models/TicketMasterModel.php b/app/Models/TicketMasterModel.php index c4fca96d..fbcf696c 100644 --- a/app/Models/TicketMasterModel.php +++ b/app/Models/TicketMasterModel.php @@ -51,6 +51,19 @@ class TicketMasterModel extends Model 'claim_number', 'emp_id', 'insured_emp_id', + + 'raised_date', + 'registration_date', + 'query_received_date', + 'denial_date', + 'approved_date', + 'settled_date', + 'denial_reason', + 'approved_letter', + 'approved_amount', + 'utr_details', + 'settle_letter', + 'is_head_approved', ]; diff --git a/app/Views/employee_data_list.php b/app/Views/employee_data_list.php index 9543fa85..918d73e3 100755 --- a/app/Views/employee_data_list.php +++ b/app/Views/employee_data_list.php @@ -436,7 +436,8 @@ $('#email_corporate').val(''); $('#mobile').val(''); - window.location.reload(); + // window.location.reload(); + fetchEmpolyeeList(); }else{ toastr.error(response.message, 'ERROR'); @@ -534,4 +535,14 @@ } + function onlyNumbers(event) { + var charcode; + charcode = event.which || event.keyCode; + if (charcode >= 48 && charcode <= 57 || charcode == 46) return true; + return false; + } + + + + diff --git a/app/Views/employee_list.php b/app/Views/employee_list.php index 7c35a42d..976e2f69 100755 --- a/app/Views/employee_list.php +++ b/app/Views/employee_list.php @@ -142,25 +142,98 @@ table.dataTable tbody td { \ No newline at end of file +let lastActiveField = null; + +$("#ticket_auto_query_note").on("focus", function() { + lastActiveField = this; +}); + +document.addEventListener('change', function(event) { + + var target = event.target; + + if (target.matches('#ticket_mail_auto_query_customButton')) { + + let placeholderValue = $(target).val(); + if (!placeholderValue) return; + + if (lastActiveField) { + if (lastActiveField.id === "ticket_auto_query_note") { + insertAtCursor(lastActiveField, placeholderValue); + } + } + + $(target).val(''); + } +}); + +function insertAtCursor(input, textToInsert) { + + textToInsert += '\n'; + + if (document.selection) { + input.focus(); + var sel = document.selection.createRange(); + sel.text = textToInsert; + } else if (input.selectionStart || input.selectionStart === 0) { + let startPos = input.selectionStart; + let endPos = input.selectionEnd; + input.value = input.value.substring(0, startPos) + textToInsert + input.value.substring(endPos, input.value + .length); + input.selectionStart = input.selectionEnd = startPos + textToInsert.length; + } else { + input.value += textToInsert; + } +} + \ No newline at end of file diff --git a/app/Views/ticket_form_gmc.php b/app/Views/ticket_form_gmc.php index 5e02f45c..e04f2a84 100644 --- a/app/Views/ticket_form_gmc.php +++ b/app/Views/ticket_form_gmc.php @@ -219,13 +219,79 @@ name="pod_no"> -
+ + + + + + + + + + + + + + + + + + + + + + +
@@ -239,6 +305,7 @@
\ No newline at end of file diff --git a/app/Views/ticket_form_gpa.php b/app/Views/ticket_form_gpa.php index a072d1dc..4a81584b 100644 --- a/app/Views/ticket_form_gpa.php +++ b/app/Views/ticket_form_gpa.php @@ -195,11 +195,34 @@ name="si_amt"> -
- - + + + + + + + + +
@@ -215,6 +238,7 @@ \ No newline at end of file diff --git a/app/Views/ticket_form_handler.php b/app/Views/ticket_form_handler.php index 9e9a6eb5..e668bde6 100644 --- a/app/Views/ticket_form_handler.php +++ b/app/Views/ticket_form_handler.php @@ -571,7 +571,7 @@ function appendEmployee(data, attrId) { console.log(item) var option = $('