CHANGE_CLAIMS_MODULE : RV

This commit is contained in:
VENKATESHWARAN 2025-02-07 18:45:29 +05:30
parent c35eb8545a
commit 21999bc0ae
12 changed files with 529 additions and 107 deletions

View File

@ -173,17 +173,17 @@ class ClientController extends AdminController
{ {
$message = '<style>body{font-family:Arial,sans-serif;color:#333;line-height:1.6;margin:0;padding:0}.email-container{width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9}.header{background-color:#4a90e2;color:#fff;padding:15px;text-align:center}.header h1{margin:0;font-size:24px}.content{padding:20px;background-color:#fff}.content h2{color:#4a90e2;font-size:20px;margin-top:0}.content p{margin:10px 0}.details-table{width:100%;border-collapse:collapse;margin-top:20px}.details-table td,.details-table th{border:1px solid #ddd;padding:10px;text-align:left}.details-table th{background-color:#f2f2f2}.footer{margin-top:20px;font-size:12px;color:#777;text-align:center}.attachment-note{margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic}</style><div class=email-container><div class=header><h1>Request for Quotation (RFQ)</h1></div><div class=content><h2>Dear {{RECIPIENT_NAME}},</h2><p>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.<h2>RFQ Details</h2><table class=details-table><tr><th>Client name<td>{{CLIENT_NAME}}<tr><th>Coverage Type<td>{{POLICY_LONG_NAME}}<tr><th>Policy Start Date<td>{{POLICY_START_DATE}}<tr><th>Policy Duration<td>{{DURATION}}</table><div class=attachment-note>Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div class=footer><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>'; $message = '<style>body{font-family:Arial,sans-serif;color:#333;line-height:1.6;margin:0;padding:0}.email-container{width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9}.header{background-color:#4a90e2;color:#fff;padding:15px;text-align:center}.header h1{margin:0;font-size:24px}.content{padding:20px;background-color:#fff}.content h2{color:#4a90e2;font-size:20px;margin-top:0}.content p{margin:10px 0}.details-table{width:100%;border-collapse:collapse;margin-top:20px}.details-table td,.details-table th{border:1px solid #ddd;padding:10px;text-align:left}.details-table th{background-color:#f2f2f2}.footer{margin-top:20px;font-size:12px;color:#777;text-align:center}.attachment-note{margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic}</style><div class=email-container><div class=header><h1>Request for Quotation (RFQ)</h1></div><div class=content><h2>Dear {{RECIPIENT_NAME}},</h2><p>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.<h2>RFQ Details</h2><table class=details-table><tr><th>Client name<td>{{CLIENT_NAME}}<tr><th>Coverage Type<td>{{POLICY_LONG_NAME}}<tr><th>Policy Start Date<td>{{POLICY_START_DATE}}<tr><th>Policy Duration<td>{{DURATION}}</table><div class=attachment-note>Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div class=footer><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
$attachments = [ // $attachments = [
["filePath" => ROOTPATH."public/sample_excel/sample_addition.xls","fileName" => "sample_addition.xls"], // ["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/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"],
["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"] // ["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]); $res = MailHelper::send_email(['mail' => $email, 'subject' => 'Mail Via Attachment Testing URL', 'message' => $message,'attachments' => $attachments]);
print_rr($res); print_rr($res);
echo '------------------------------------------------------------------------------------------'; echo '------------------------------------------------------------------------------------------';
print_rr($attachments); // print_rr($attachments);
} }
//Function for Testing Member Review and Summery Confirmation Mail //Function for Testing Member Review and Summery Confirmation Mail

View File

@ -125,9 +125,9 @@ class TicketController extends BaseController
public function ticketList() public function ticketList()
{ {
$data['ticket_type'] = $this->ticketType;
if ($this->request->is('get')) { if ($this->request->is('get')) {
$data['page_name'] = "Claims"; $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['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['client_list'] = $this->clientModel->select('id,client_name')->where('is_active', 1)->findAll();
$data['ticket_data'] = $this->ticketSearch(1); $data['ticket_data'] = $this->ticketSearch(1);
@ -182,6 +182,9 @@ class TicketController extends BaseController
$query = $db->table('ticket_master tm') $query = $db->table('ticket_master tm')
->select([ ->select([
'tm.id', 'tm.id',
'tm.ticket_type_id',
'tm.claim_status_id',
'tm.is_head_approved',
'tcs.claim_status AS status', 'tcs.claim_status AS status',
'tm.claim_number AS claim_no', 'tm.claim_number AS claim_no',
'tm.tpa_id', 'tm.tpa_id',
@ -219,8 +222,11 @@ class TicketController extends BaseController
$query = $db->table('ticket_master tm') $query = $db->table('ticket_master tm')
->select([ ->select([
'tm.id', 'tm.id',
'tm.ticket_type_id',
'tcs.claim_status AS status', 'tcs.claim_status AS status',
'tm.claim_number AS claim_no', 'tm.claim_number AS claim_no',
'tm.claim_status_id',
'tm.is_head_approved',
'tm.tpa_id', 'tm.tpa_id',
'tm.emp_name', 'tm.emp_name',
'i.name AS insurer_name', 'i.name AS insurer_name',
@ -324,6 +330,7 @@ class TicketController extends BaseController
$data['view_ticket_page'] = []; $data['view_ticket_page'] = [];
$data['member_data'] = $this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']); $data['member_data'] = $this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']);
$data['ticket_history'] = $this->ticketHistory($ticket_id); $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); // dd($data);
return $this->loadLayout('ticket_edit_onbording', $data); return $this->loadLayout('ticket_edit_onbording', $data);
@ -418,6 +425,11 @@ class TicketController extends BaseController
//mail trigger part //mail trigger part
$mail_responce = $this->sendAutoMailTrigger($ticket_id); $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); return $this->respond(['status' => true, 'code' => 200, 'data' => $ticket_data, "message" => "Claim updated successfully", 'mail_responce' => $mail_responce], 200);
} else { } else {
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to update claim'], 200); 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") { } else if ($value == "policy_type") {
$replaceData = str_replace("Claim-", "", $this->ticketType[$ticket_data['ticket_type_id']] ?? ""); $replaceData = str_replace("Claim-", "", $this->ticketType[$ticket_data['ticket_type_id']] ?? "");
} else { } else {
$replaceData = strtoupper($ticket_data[$value]) ?? ''; $replaceData = isset($ticket_data[$value]) ? strtoupper($ticket_data[$value]) : '';
} }
$content = str_replace($key, $replaceData, $content); $content = str_replace($key, $replaceData, $content);
@ -657,6 +669,7 @@ class TicketController extends BaseController
{ {
$this->myLogger->logme('error', "Sending email with content"); $this->myLogger->logme('error', "Sending email with content");
if (!empty($mail_content)) { if (!empty($mail_content)) {
$mail_content['from_mail'] = "claims@nhanceindia.in";
$response = MailHelper::send_email($mail_content); $response = MailHelper::send_email($mail_content);
} else { } else {
$response = ['status' => false, 'code' => 404, 'message' => "Mail not sent, mail data empty"]; $response = ['status' => false, 'code' => 404, 'message' => "Mail not sent, mail data empty"];
@ -1135,4 +1148,58 @@ class TicketController extends BaseController
// return $result; // 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");
}
}
} }

View File

@ -304,7 +304,8 @@ class MailHelper
$bcc = isset($params['bcc']) ? $params['bcc'] : ''; $bcc = isset($params['bcc']) ? $params['bcc'] : '';
$cc = isset($params['cc']) ? $params['cc'] : ''; $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 { try {
$curl = curl_init(); $curl = curl_init();

View File

@ -51,6 +51,19 @@ class TicketMasterModel extends Model
'claim_number', 'claim_number',
'emp_id', 'emp_id',
'insured_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',
]; ];

View File

@ -436,7 +436,8 @@
$('#email_corporate').val(''); $('#email_corporate').val('');
$('#mobile').val(''); $('#mobile').val('');
window.location.reload(); // window.location.reload();
fetchEmpolyeeList();
}else{ }else{
toastr.error(response.message, 'ERROR'); 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;
}
</script> </script>

View File

@ -142,25 +142,98 @@ table.dataTable tbody td {
<!-- end row --> <!-- end row -->
<div id="loader" class="loader" style="display:none;">SPINNER</div> <div id="loader" class="loader" style="display:none;">SPINNER</div>
<script> <script>
document.addEventListener("DOMContentLoaded", function () { // document.addEventListener("DOMContentLoaded", function () {
// const table = document.getElementById("tickets-table");
// // Create custom dropdown
// function createCustomDropdown(row) {
// // Get the original dropdown items
// const originalDropdown = row.querySelector('.dropdown-menu');
// if (!originalDropdown) return null;
// // Create new dropdown with proper background and spacing
// const customDropdown = document.createElement('div');
// customDropdown.className = 'custom-dropdown-menu';
// // Copy inner content while maintaining icon alignment
// customDropdown.innerHTML = originalDropdown.innerHTML;
// return customDropdown;
// }
// let activeDropdown = null;
// // Add click event listener to rows
// table.querySelectorAll("tbody tr").forEach(row => {
// const customDropdown = createCustomDropdown(row);
// if (!customDropdown) return;
// document.body.appendChild(customDropdown);
// row.addEventListener("click", function(event) {
// // Ignore clicks on the action column
// if (event.target.closest('td:last-child')) {
// return;
// }
// // Hide any active dropdown
// if (activeDropdown) {
// activeDropdown.style.display = 'none';
// }
// // Get click position
// const rect = event.target.getBoundingClientRect();
// // Position the dropdown with some offset
// customDropdown.style.display = 'block';
// customDropdown.style.position = 'fixed';
// customDropdown.style.left = `${rect.left}px`;
// customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
// // Set as active dropdown
// activeDropdown = customDropdown;
// event.stopPropagation();
// });
// // Preserve click handlers and add auto-close
// customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
// item.addEventListener('click', function(e) {
// const onclickAttr = this.getAttribute('onclick');
// if (onclickAttr) {
// eval(onclickAttr);
// }
// const href = this.getAttribute('href');
// if (href && href !== '#') {
// window.location.href = href;
// }
// // Close the dropdown after handling the click
// if (activeDropdown) {
// activeDropdown.style.display = 'none';
// activeDropdown = null;
// }
// e.stopPropagation();
// });
// });
// });
// // Close dropdown when clicking outside
// document.addEventListener("click", function() {
// if (activeDropdown) {
// activeDropdown.style.display = 'none';
// activeDropdown = null;
// }
// });
// });
document.addEventListener("DOMContentLoaded", init);
function init() {
const table = document.getElementById("tickets-table"); const table = document.getElementById("tickets-table");
// Create custom dropdown
function createCustomDropdown(row) {
// Get the original dropdown items
const originalDropdown = row.querySelector('.dropdown-menu');
if (!originalDropdown) return null;
// Create new dropdown with proper background and spacing
const customDropdown = document.createElement('div');
customDropdown.className = 'custom-dropdown-menu';
// Copy inner content while maintaining icon alignment
customDropdown.innerHTML = originalDropdown.innerHTML;
return customDropdown;
}
let activeDropdown = null; let activeDropdown = null;
// Add click event listener to rows // Add click event listener to rows
@ -171,63 +244,75 @@ document.addEventListener("DOMContentLoaded", function () {
document.body.appendChild(customDropdown); document.body.appendChild(customDropdown);
row.addEventListener("click", function(event) { row.addEventListener("click", function(event) {
// Ignore clicks on the action column handleRowClick(event, customDropdown);
if (event.target.closest('td:last-child')) {
return;
}
// Hide any active dropdown
if (activeDropdown) {
activeDropdown.style.display = 'none';
}
// Get click position
const rect = event.target.getBoundingClientRect();
// Position the dropdown with some offset
customDropdown.style.display = 'block';
customDropdown.style.position = 'fixed';
customDropdown.style.left = `${rect.left}px`;
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
// Set as active dropdown
activeDropdown = customDropdown;
event.stopPropagation();
}); });
// Preserve click handlers and add auto-close // Preserve click handlers and add auto-close
customDropdown.querySelectorAll('.dropdown-item').forEach(item => { customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
item.addEventListener('click', function(e) { item.addEventListener('click', function(e) {
const onclickAttr = this.getAttribute('onclick'); handleItemClick(e, item);
});
});
});
// Close dropdown when clicking outside
document.addEventListener("click", handleDocumentClick);
function createCustomDropdown(row) {
const originalDropdown = row.querySelector('.dropdown-menu');
if (!originalDropdown) return null;
const customDropdown = document.createElement('div');
customDropdown.className = 'custom-dropdown-menu';
customDropdown.innerHTML = originalDropdown.innerHTML;
return customDropdown;
}
function handleRowClick(event, customDropdown) {
if (event.target.closest('td:last-child')) return;
if (activeDropdown) {
activeDropdown.style.display = 'none';
}
const rect = event.target.getBoundingClientRect();
customDropdown.style.display = 'block';
customDropdown.style.position = 'fixed';
customDropdown.style.left = `${rect.left}px`;
customDropdown.style.top = `${rect.bottom + 5}px`;
activeDropdown = customDropdown;
event.stopPropagation();
}
function handleItemClick(e, item) {
const onclickAttr = item.getAttribute('onclick');
if (onclickAttr) { if (onclickAttr) {
eval(onclickAttr); eval(onclickAttr);
} }
const href = this.getAttribute('href'); const href = item.getAttribute('href');
if (href && href !== '#') { if (href && href !== '#') {
window.location.href = href; window.location.href = href;
} }
// Close the dropdown after handling the click
if (activeDropdown) { if (activeDropdown) {
activeDropdown.style.display = 'none'; activeDropdown.style.display = 'none';
activeDropdown = null; activeDropdown = null;
} }
e.stopPropagation(); e.stopPropagation();
}); }
});
});
// Close dropdown when clicking outside function handleDocumentClick() {
document.addEventListener("click", function() {
if (activeDropdown) { if (activeDropdown) {
activeDropdown.style.display = 'none'; activeDropdown.style.display = 'none';
activeDropdown = null; activeDropdown = null;
} }
}); }
}); }
</script> </script>
<script> <script>
@ -469,8 +554,11 @@ function objectToQueryString(obj) {
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&'); return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
} }
function fetchEmpolyeeList(event) { function fetchEmpolyeeList(event = null) {
if(event){
event.preventDefault(); // Prevent default action event.preventDefault(); // Prevent default action
}
var client_id = $('#clients').val(); var client_id = $('#clients').val();
var policy_id = $('#policies').val(); var policy_id = $('#policies').val();
@ -505,6 +593,9 @@ function fetchEmpolyeeList(event) {
// console.log(apiURL); // console.log(apiURL);
// window.location.href = apiURL; // window.location.href = apiURL;
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
// var apiURL2 = $('#get-emp-list').attr('href'); // Get href attribute value // var apiURL2 = $('#get-emp-list').attr('href'); // Get href attribute value
console.log(apiURL); console.log(apiURL);
@ -514,16 +605,19 @@ function fetchEmpolyeeList(event) {
data: queryParams, data: queryParams,
success: function(response) { success: function(response) {
if(response.status == true){ if(response.status == true){
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
$('#employee_table_list').html(response.html); $('#employee_table_list').html(response.html);
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
setTimeout(function(){
init()
}, 1000)
} }
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error('Error:', error); console.error('Error:', error);
toastr.error('Failed to fetch Data','Error'); toastr.error('Failed to fetch Data','Error');
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
} }
}); });
} }

View File

@ -7,36 +7,49 @@
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<!-- <label for="ticket_auto_query_note">Add Notes</label> --> <!-- <label for="ticket_auto_query_note">Add Notes</label> -->
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<select id="ticket_mail_auto_query_customButton" class="form-control"
style="border:none;right: 13px;width: auto;position: absolute;z-index: 1;top: -19px;height: 32px;float: right;">
<option value="">Documents</option>
<?php foreach ($ticket_check_list as $value): ?>
<option value="<?= $value['document']; ?>"><?= $value['document']; ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<textarea class="form-control" id="ticket_auto_query_note" name="note" rows="3" <textarea class="form-control" id="ticket_auto_query_note" name="note" rows="3"
placeholder="Enter Text"><?= isset($ticket_note['note']) ? $ticket_note['note'] : '' ?></textarea> placeholder="Enter Text"><?= isset($ticket_note['note']) ? $ticket_note['note'] : '' ?></textarea>
</div> </div>
</div> </div>
</div><input type="hidden" id="query_note_id"><input type="hidden" </div><input type="hidden" id="query_note_id"><input type="hidden" <div
<div class="form-group text-right m-b-0"> class="form-group text-right m-b-0">
<button type="submit" class="btn btn-primary" id="ticket_auto_query_submit">Submit</button> <button type="submit" class="btn btn-primary" id="ticket_auto_query_submit">Submit</button>
</div> </div>
</form> </form>
</div> </div>
</div> <!-- end col--> </div> <!-- end col-->
</div> </div>
<!-- end --> <!-- end -->
<script> <script>
$(document).ready(function() { $(document).ready(function() {
url = '<?= base_url('ticket/note/1')?>'; url = '<?= base_url('ticket/note/1') ?>';
data = { id : $('#ticket_master_id').val() , is_auto_query : 1}; data = {
id: $('#ticket_master_id').val(),
is_auto_query: 1
};
$.ajax({ $.ajax({
url:url, url: url,
data:data, data: data,
type: 'POST', type: 'POST',
success: function(res) { success: function(res) {
if (res.status == true){ if (res.status == true) {
$('#ticket_auto_query_note').val(res.data.note); $('#ticket_auto_query_note').val(res.data.note);
$('#query_note_id').val(res.data.id); $('#query_note_id').val(res.data.id);
} }
}, },
error: function (xhr, status, error) { error: function(xhr, status, error) {
console.error(xhr.responseText); console.error(xhr.responseText);
console.error(status, error); console.error(status, error);
setTimeout(function() { setTimeout(function() {
@ -56,20 +69,29 @@ $(document).ready(function() {
var url = '<?= base_url("/ticket/note/2"); ?>'; var url = '<?= base_url("/ticket/note/2"); ?>';
var formData = $(this).serializeArray(); var formData = $(this).serializeArray();
var ticket_id = $('#ticket_master_id').val(); var ticket_id = $('#ticket_master_id').val();
if (ticket_id != null && ticket_id != ''){ if (ticket_id != null && ticket_id != '') {
formData.push({ name: 'ticket_id', value: ticket_id}); formData.push({
name: 'ticket_id',
value: ticket_id
});
} }
var primary_key = $('#query_note_id').val(); var primary_key = $('#query_note_id').val();
if (primary_key != null && primary_key != ''){ if (primary_key != null && primary_key != '') {
formData.push({ name: 'id', value: primary_key}); formData.push({
name: 'id',
value: primary_key
});
} }
formData.push({name: 'is_auto_query',value:1}) formData.push({
name: 'is_auto_query',
value: 1
})
console.log(formData); console.log(formData);
sendAjaxRequestForGlobal(url, 'POST', formData, function(response) { sendAjaxRequestForGlobal(url, 'POST', formData, function(response) {
if (response.status == true) { if (response.status == true) {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
toastr.success('Note Added Successfully','Success'); toastr.success('Note Added Successfully', 'Success');
// console.log("Respone id is ") // console.log("Respone id is ")
// console.log(response.id); // console.log(response.id);
$('#query_note_id').val(response.id); $('#query_note_id').val(response.id);
@ -95,4 +117,47 @@ $(document).ready(function() {
}); });
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;
}
}
</script> </script>

View File

@ -219,13 +219,79 @@
name="pod_no"> name="pod_no">
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3 up_cnu" style="display: none;">
<label for="claim_number">Claim Number<span class="text-danger"></span></label> <label for="claim_number">Claim Number<span class="text-danger"></span></label>
<input type="text" class="form-control" id="claim_number" placeholder="Enter Claim NO" <input type="text" class="form-control" id="claim_number" placeholder="Enter Claim NO"
value="<?= isset($ticket_data['claim_number']) ? $ticket_data['claim_number'] : '' ?>" value="<?= isset($ticket_data['claim_number']) ? $ticket_data['claim_number'] : '' ?>"
name="claim_number"> name="claim_number">
</div> </div>
<div class="form-group col-md-3 up_cnu" style="display: none;">
<label for="registration_date">Registration Date</label>
<input type="text" class="form-control datepicker" id="registration_date" placeholder="Select Registration Date"
value="<?= isset($ticket_data['registration_date']) ? $ticket_data['registration_date'] : '' ?>" name="registration_date">
</div>
<div class="form-group col-md-3 cda_ir" style="display: none;">
<label for="raised_date">Raised Date</label>
<input type="text" class="form-control datepicker" id="raised_date" placeholder="Select Raised Date"
value="<?= isset($ticket_data['raised_date']) ? $ticket_data['raised_date'] : '' ?>" name="raised_date">
</div>
<div class="form-group col-md-3 up_qdr" style="display: none;">
<label for="query_received_date">Query Received Date</label>
<input type="text" class="form-control datepicker" id="query_received_date" placeholder="Select Query Received Date"
value="<?= isset($ticket_data['query_received_date']) ? $ticket_data['query_received_date'] : '' ?>" name="query_received_date">
</div>
<div class="form-group col-md-3 rejected" style="display: none;">
<label for="denial_reason">Denial Reason</label>
<input type="text" class="form-control" id="denial_reason" placeholder="Enter Denial Reason"
value="<?= isset($ticket_data['denial_reason']) ? $ticket_data['denial_reason'] : '' ?>" name="denial_reason">
</div>
<div class="form-group col-md-3 rejected" style="display: none;">
<label for="denial_date">Denial Date</label>
<input type="text" class="form-control datepicker" id="denial_date" placeholder="Select Denial Date"
value="<?= isset($ticket_data['denial_date']) ? $ticket_data['denial_date'] : '' ?>" name="denial_date">
</div>
<div class="form-group col-md-3 approved" style="display: none;">
<label for="approved_amount">Approved Amount</label>
<input type="text" class="form-control" id="approved_amount" placeholder="Enter Approved Amount"
value="<?= isset($ticket_data['approved_amount']) ? $ticket_data['approved_amount'] : '' ?>" name="approved_amount">
</div>
<div class="form-group col-md-3 approved" style="display: none;">
<label for="approved_date">Approved Date</label>
<input type="text" class="form-control datepicker" id="approved_date" placeholder="Select Approved Date"
value="<?= isset($ticket_data['approved_date']) ? $ticket_data['approved_date'] : '' ?>" name="approved_date">
</div>
<div class="form-group col-md-3 approved" style="display: none;">
<label for="approved_letter">Approved Letter</label>
<input type="text" class="form-control" id="approved_letter" placeholder="Enter Approved Letter"
value="<?= isset($ticket_data['approved_letter']) ? $ticket_data['approved_letter'] : '' ?>" name="approved_letter">
</div>
<div class="form-group col-md-3 settled" style="display: none;">
<label for="utr_details">UTR Details</label>
<input type="text" class="form-control" id="utr_details" placeholder="Enter UTR Details"
value="<?= isset($ticket_data['utr_details']) ? $ticket_data['utr_details'] : '' ?>" name="utr_details">
</div>
<div class="form-group col-md-3 settled" style="display: none;">
<label for="settled_date">Settled Date</label>
<input type="text" class="form-control datepicker" id="settled_date" placeholder="Select Settled Date"
value="<?= isset($ticket_data['settled_date']) ? $ticket_data['settled_date'] : '' ?>" name="settled_date">
</div>
<div class="form-group col-md-3 settled" style="display: none;">
<label for="settle_letter">Settle Letter</label>
<input type="text" class="form-control" id="settle_letter" placeholder="Enter Settle Letter"
value="<?= isset($ticket_data['settle_letter']) ? $ticket_data['settle_letter'] : '' ?>" name="settle_letter">
</div>
</div> </div>
</div> </div>
<div class="form-group col-md-12 text-right m-b-0" style="margin-top: 29px;"> <div class="form-group col-md-12 text-right m-b-0" style="margin-top: 29px;">
@ -239,6 +305,7 @@
</div> </div>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
var doa = flatpickr("#doa", { var doa = flatpickr("#doa", {
@ -251,5 +318,39 @@ $(document).ready(function() {
allowInput: false allowInput: false
}); });
flatpickr("#raised_date", { dateFormat: "d/m/Y", allowInput: false });
flatpickr("#registration_date", { dateFormat: "d/m/Y", allowInput: false });
flatpickr("#query_received_date", { dateFormat: "d/m/Y", allowInput: false });
flatpickr("#denial_date", { dateFormat: "d/m/Y", allowInput: false });
flatpickr("#approved_date", { dateFormat: "d/m/Y", allowInput: false });
flatpickr("#settled_date", { dateFormat: "d/m/Y", allowInput: false });
updateClaimStatusDisplay("<?= isset($ticket_data['claim_status_id']) ? $ticket_data['claim_status_id'] : 0 ?>")
}) })
function updateClaimStatusDisplay(value) {
// Hide all sections first
$('.cda_ir, .settled, .approved, .rejected, .up_qdr, .up_cnu').hide();
// Show relevant section based on value
if (value == 3 || value == 4) { // CDA / INFORMATION REQUIRED
$('.cda_ir').show();
} else if (value == 5) { // UNDER PROCESS - CLAIM NO. UPDATION
$('.up_cnu').show();
} else if (value == 7) { // UNDER PROCESS - QUERY DOCUMENT RECEIVED
$('.up_qdr').show();
} else if (value == 8) { // REJECTED
$('.rejected').show();
} else if (value == 9) { // APPROVED
$('.approved').show();
} else if (value == 11) { // SETTLED
$('.settled').show();
}
}
$('#claim_status_id').on('change', function() {
updateClaimStatusDisplay($(this).val());
});
</script> </script>

View File

@ -195,11 +195,34 @@
name="si_amt"> name="si_amt">
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3 approved" style="display: none;">
<label for="claim_number">Claim Number<span class="text-danger"></span></label> <label for="approved_date">Approved Date</label>
<input type="text" class="form-control" id="claim_number" placeholder="Enter Claim NO" <input type="text" class="form-control datepicker" id="approved_date" placeholder="Select Approved Date"
value="<?= isset($ticket_data['claim_number']) ? $ticket_data['claim_number'] : '' ?>" value="<?= isset($ticket_data['approved_date']) ? $ticket_data['approved_date'] : '' ?>" name="approved_date">
name="claim_number"> </div>
<div class="form-group col-md-3 approved" style="display: none;">
<label for="approved_letter">Approved Letter</label>
<input type="text" class="form-control" id="approved_letter" placeholder="Enter Approved Letter"
value="<?= isset($ticket_data['approved_letter']) ? $ticket_data['approved_letter'] : '' ?>" name="approved_letter">
</div>
<div class="form-group col-md-3 settled" style="display: none;">
<label for="utr_details">UTR Details</label>
<input type="text" class="form-control" id="utr_details" placeholder="Enter UTR Details"
value="<?= isset($ticket_data['utr_details']) ? $ticket_data['utr_details'] : '' ?>" name="utr_details">
</div>
<div class="form-group col-md-3 settled" style="display: none;">
<label for="settled_date">Settled Date</label>
<input type="text" class="form-control datepicker" id="settled_date" placeholder="Select Settled Date"
value="<?= isset($ticket_data['settled_date']) ? $ticket_data['settled_date'] : '' ?>" name="settled_date">
</div>
<div class="form-group col-md-3 settled" style="display: none;">
<label for="settle_letter">Settle Letter</label>
<input type="text" class="form-control" id="settle_letter" placeholder="Enter Settle Letter"
value="<?= isset($ticket_data['settle_letter']) ? $ticket_data['settle_letter'] : '' ?>" name="settle_letter">
</div> </div>
</div> </div>
@ -215,6 +238,7 @@
</div> </div>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
var date_of_join = flatpickr("#date_of_join", { var date_of_join = flatpickr("#date_of_join", {
@ -246,5 +270,31 @@ $(document).ready(function() {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
allowInput: false allowInput: false
}); });
flatpickr("#approved_date", { dateFormat: "d/m/Y", allowInput: false });
flatpickr("#settled_date", { dateFormat: "d/m/Y", allowInput: false });
updateClaimStatusDisplay("<?= isset($ticket_data['claim_status_id']) ? $ticket_data['claim_status_id'] : 0 ?>")
}) })
function updateClaimStatusDisplay(value) {
console.log('value', value);
// Hide all sections first
$('.settled, .approved').hide();
// Show relevant section based on value
if (value == 20) { // APPROVED
$('.approved').show();
} else if (value == 24) { // SETTLED
$('.settled').show();
}
}
$('#claim_status_id').on('change', function() {
updateClaimStatusDisplay($(this).val());
});
</script> </script>

View File

@ -571,7 +571,7 @@ function appendEmployee(data, attrId) {
console.log(item) console.log(item)
var option = $('<option>', { var option = $('<option>', {
value: item.emp_code, value: item.emp_code,
text: item.emp_name, text: item.emp_name + ' - ' + item.emp_code,
}); });
$('#' + attrId).append(option).select2(); $('#' + attrId).append(option).select2();

View File

@ -54,6 +54,7 @@ table.dataTable tbody td {
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th>Status</th> <th>Status</th>
<th>Policy Type</th>
<th>Claim number</th> <th>Claim number</th>
<th>TPA ID</th> <th>TPA ID</th>
<th>Emp name</th> <th>Emp name</th>
@ -66,9 +67,28 @@ table.dataTable tbody td {
<?php if (isset($ticket_data)) { ?> <?php if (isset($ticket_data)) { ?>
<?php foreach($ticket_data as $index => $row){ ?> <?php foreach($ticket_data as $index => $row){ ?>
<tr onclick="viewTicket(<?php echo $row['id']; ?>)"> <tr onclick="viewTicket(<?php echo $row['id']; ?>)">
<td data-toggle="tooltip" data-placement="top" title="<?php echo $row['status']; ?>"> <td data-toggle="tooltip" data-placement="top" title="<?php echo $row['status']; ?>">
<span class="status-tooltip"><?php echo $row['status']; ?></span> <span class="status-tooltip">
<?php
if ($row['claim_status_id'] == 8) {
if ($row['is_head_approved'] == 0) {
echo $row['status'] . '&nbsp;<i class="fa fa-exclamation-triangle" style="color:red;" aria-hidden="true"></i>';
} elseif ($row['is_head_approved'] == 1) {
echo $row['status'] . '&nbsp;<i class="fa fa-check-circle" style="color:green;" aria-hidden="true"></i>';
} elseif ($row['is_head_approved'] == 2) {
echo $row['status'] . '&nbsp;<i class="fa fa-times-circle" style="color:red;" aria-hidden="true"></i>';
} else {
echo $row['status'];
}
} else {
echo $row['status'];
}
?>
</span>
</td> </td>
<td><?php echo str_replace("Claim-", "", $ticket_type[$row['ticket_type_id']] ?? ""); ?></td>
<td><?php echo $row['claim_no']; ?></td> <td><?php echo $row['claim_no']; ?></td>
<td><?php echo $row['tpa_id']; ?></td> <td><?php echo $row['tpa_id']; ?></td>
<td><?php echo $row['emp_name']; ?></td> <td><?php echo $row['emp_name']; ?></td>

View File

@ -77,9 +77,9 @@ table.dataTable tbody td {
<?php if (isset($ticket_data)) { ?> <?php if (isset($ticket_data)) { ?>
<?php foreach($ticket_data as $index => $row){ ?> <?php foreach($ticket_data as $index => $row){ ?>
<tr> <tr>
<td><?php echo $row['template_name']; ?></td> <td><?php echo $row['template_name'] ?? ""; ?></td>
<td><?php echo $ticket_type[$row['ticket_type']]; ?></td> <td><?php echo $ticket_type[$row['ticket_type']] ?? ""; ?></td>
<td><?php echo $trigger_type[$row['trigger_type']]; ?></td> <td><?php echo $trigger_type[$row['trigger_type']] ?? ""; ?></td>
<td><?=$row['is_auto_mail'] == 1?'Auto':"Manual" ?></td> <td><?=$row['is_auto_mail'] == 1?'Auto':"Manual" ?></td>
<td> <td>
<div class="btn-group dropdown"> <div class="btn-group dropdown">