FIX_BDS_TPA_AND_CLAIM_MAIL_SUBJECT : RV

This commit is contained in:
VENKATESHWARAN 2025-01-30 11:27:50 +05:30
parent 165011cf14
commit 6a0a73362e
3 changed files with 167 additions and 178 deletions

View File

@ -244,34 +244,6 @@ class PolicyTransactionController extends BaseController
// print_r($data); die; // print_r($data); die;
// var_dump($data); die; // var_dump($data); die;
// Format dates
// $data['policy_issue_date'] = change_date_format($this->request->getPost('policy_issue_date'), 'd/m/Y', 'Y-m-d') ?? null;
// $data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd/m/Y', 'Y-m-d') ?? null;
// $data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd/m/Y', 'Y-m-d') ?? null;
// $data['renewal_date'] = change_date_format($this->request->getPost('renewal_date'), 'd/m/Y', 'Y-m-d') ?? null;
// $data['rollover_date'] = change_date_format($this->request->getPost('rollover_date'), 'd/m/Y', 'Y-m-d') ?? null;
// $data['policy_issue_date'] = (isset($data['policy_issue_date']) && $data['policy_issue_date'] !== null && $data['policy_issue_date'] !== '')
// ? date('d/m/Y', strtotime($data['policy_issue_date']))
// : null;
// $data['policy_start_date'] = (isset($data['policy_start_date']) && $data['policy_start_date'] !== null && $data['policy_start_date'] !== '')
// ? date('d/m/Y', strtotime($data['policy_start_date']))
// : null;
// $data['policy_end_date'] = (isset($data['policy_end_date']) && $data['policy_end_date'] !== null && $data['policy_end_date'] !== '')
// ? date('d/m/Y', strtotime($data['policy_end_date']))
// : null;
// $data['renewal_date'] = (isset($data['renewal_date']) && $data['renewal_date'] !== null && $data['renewal_date'] !== '')
// ? date('d/m/Y', strtotime($data['renewal_date']))
// : null;
// $data['rollover_date'] = (isset($data['rollover_date']) && $data['rollover_date'] !== null && $data['rollover_date'] !== '')
// ? date('d/m/Y', strtotime($data['rollover_date']))
// : null;
if(empty($data['policy_issue_date'])){ if(empty($data['policy_issue_date'])){
$data['policy_issue_date'] = null; $data['policy_issue_date'] = null;
} }
@ -302,7 +274,7 @@ class PolicyTransactionController extends BaseController
// Separate Insurer and TPA Branch IDs and IDs // Separate Insurer and TPA Branch IDs and IDs
if(isset($data['insurer_id']) && !empty($data['insurer_id'])){ if(isset($data['insurer_id']) && !empty($data['insurer_id'])){
list($data['insurer_branch_id'], $data['insurer_id']) = explode('-', $data['insurer_id']); list($data['insurer_branch_id'], $data['insurer_id']) = explode('-', $data['insurer_id']);
if ($data['tpa']) { if (isset($data['tpa'])) {
list($data['tpa_branch_id'], $data['tpa_id']) = explode('-', $data['tpa']); list($data['tpa_branch_id'], $data['tpa_id']) = explode('-', $data['tpa']);
} }
} }

View File

@ -250,9 +250,10 @@ class TicketController extends BaseController
$ticket_data = $this->formatDateForClaim($ticket_data, 'd/m/Y'); $ticket_data = $this->formatDateForClaim($ticket_data, 'd/m/Y');
// dd($ticket_data); // dd($ticket_data);
$template_data = $this->ticketMasterModel->getTemplateDataByTicketID($ticket_id); $template_data = $this->ticketMasterModel->getTemplateDataByTicketID($ticket_id);
if(!empty($template_data)){
$template_data['mail_content'] = $this->replacePlaceholders($template_data['mail_content'], $ticket_data); $template_data['mail_content'] = $this->replacePlaceholders($template_data['mail_content'], $ticket_data);
$template_data['subject'] = $this->replacePlaceholders($template_data['subject'], $ticket_data); $template_data['subject'] = $this->replacePlaceholders($template_data['subject'], $ticket_data);
}
$data = $this->ticket_form_data($ticket_data['ticket_type_id']); $data = $this->ticket_form_data($ticket_data['ticket_type_id']);
$data['ticket_data'] = $ticket_data; $data['ticket_data'] = $ticket_data;
$data['reply_data'] = $template_data; $data['reply_data'] = $template_data;

View File

@ -83,10 +83,15 @@ table.dataTable tbody 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">
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a> <a href="javascript: void(0);"
class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"
aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right"> <div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="#" onclick="getMailTemplateData(<?=$row['id']?>)"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a> <a class="dropdown-item" href="#"
<a class="dropdown-item" onclick="deleteTemplate(<?=$row['id']?>)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a> onclick="getMailTemplateData(<?=$row['id']?>)"><i
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
<a class="dropdown-item" onclick="deleteTemplate(<?=$row['id']?>)"><i
class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
</div> </div>
</div> </div>
</td> </td>
@ -116,19 +121,14 @@ table.dataTable tbody td {
<form role="form" class="parsley-examples" method="post" id="ticket_mail_editor_modal" <form role="form" class="parsley-examples" method="post" id="ticket_mail_editor_modal"
enctype="multipart/form-data" novalidate> enctype="multipart/form-data" novalidate>
<div class="form-group"> <div class="form-group">
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-6"> <div class="form-group col-md-4">
<label for="emp_code">Template Name</label> <label for="emp_code">Template Name</label>
<input type="text" id="template_name" name="template_name" class="form-control" placeholder="Template Name" required> <input type="text" id="template_name" name="template_name" class="form-control"
placeholder="Template Name" required>
</div> </div>
<div class="form-group col-md-6">
<label for="template_subject">Subject</label>
<input type="text" id="template_subject" name="subject" class="form-control" placeholder="Subject" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="emp_code">Policy Type</label> <label for="emp_code">Policy Type</label>
@ -144,7 +144,7 @@ table.dataTable tbody td {
</select> </select>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-2">
<label for="trigger_type">Trigger Type</label> <label for="trigger_type">Trigger Type</label>
<select class="form-control" id="trigger_type" name="trigger_type" required> <select class="form-control" id="trigger_type" name="trigger_type" required>
<option value="">Select status</option> <option value="">Select status</option>
@ -157,9 +157,11 @@ table.dataTable tbody td {
?> ?>
</select> <input id="primaryKey" type="hidden"> </select> <input id="primaryKey" type="hidden">
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<div> <div>
<div id="statusSwitchWrapper" class="dt-switch-wrapper" style="padding-top: 40px;padding-left: 10px;"> <div id="statusSwitchWrapper" class="dt-switch-wrapper"
style="padding-top: 40px;padding-left: 10px;">
<div class="custom-control custom-switch" style="text-align: left;"> <div class="custom-control custom-switch" style="text-align: left;">
<input type="checkbox" class="custom-control-input" id="statusSwitch"> <input type="checkbox" class="custom-control-input" id="statusSwitch">
<label class="custom-control-label" for="statusSwitch">Auto Mail</label> <label class="custom-control-label" for="statusSwitch">Auto Mail</label>
@ -169,22 +171,31 @@ table.dataTable tbody td {
</div> </div>
</div> </div>
<div class="form-row">
<div class="form-group col-md-12">
<label for="template_subject">Subject</label>
<input type="text" id="template_subject" name="subject" class="form-control"
placeholder="Subject" required>
</div>
</div>
<hr> <hr>
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<!-- <textarea class="form-control" rows="5" placeholder="Enter Mail Content"></textarea> --> <!-- <textarea class="form-control" rows="5" placeholder="Enter Mail Content"></textarea> -->
<div class="form-row" id="rac_rate_dropdown"> <div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<select id="ticket_mail_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;"> <select id="ticket_mail_customButton" class="form-control"
style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
<option value="">PlaceHolders</option> <option value="">PlaceHolders</option>
<?php foreach ($placeHolders as $value): ?> <?php foreach ($placeHolders as $value): ?>
<?php // if($value == 'member_name' || $value == 'member_mobile' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name'){ ?>member_mobile <?php // if($value == 'member_name' || $value == 'member_mobile' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name'){ ?>member_mobile
<?php $valueChange = str_replace('_', ' ', $value); $valueChange = ucwords($valueChange); ?> <?php $valueChange = str_replace('_', ' ', $value); $valueChange = ucwords($valueChange); ?>
<option value="[[<?php echo $value; ?>]]"><?php echo $valueChange; ?></option> <option value="[[<?php echo $value; ?>]]"><?php echo $valueChange; ?>
</option>
<?php //} ?> <?php //} ?>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
@ -194,7 +205,8 @@ table.dataTable tbody td {
</div> </div>
</div> </div>
<div class="form-group text-right m-b-0"> <div class="form-group text-right m-b-0">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGridSubmit_2">Submit</button> <button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnGridSubmit_2">Submit</button>
</div> </div>
</div> </div>
</form> </form>
@ -245,16 +257,14 @@ $(document).ready(function() {
toolbarAdaptive: false, toolbarAdaptive: false,
saveHeightInStorage: true, saveHeightInStorage: true,
minHeight: 400, minHeight: 400,
extraButtons: [ extraButtons: [{
{
name: 'info', name: 'info',
iconURL: '<?= base_url()."public"; ?>/assets/images/image-solid.svg', // Replace with the actual icon URL iconURL: '<?= base_url()."public"; ?>/assets/images/image-solid.svg', // Replace with the actual icon URL
exec: function(editor) { exec: function(editor) {
const fileInput = document.getElementById("Question_title_fileInput"); const fileInput = document.getElementById("Question_title_fileInput");
fileInput.click(); fileInput.click();
}, },
}, }, ],
],
}; };
const editor = Jodit.make("#ticket_mail_editor", editorConfig); const editor = Jodit.make("#ticket_mail_editor", editorConfig);
@ -297,7 +307,8 @@ document.addEventListener('change', function(event) {
} else if (input.selectionStart || input.selectionStart === 0) { } else if (input.selectionStart || input.selectionStart === 0) {
let startPos = input.selectionStart; let startPos = input.selectionStart;
let endPos = input.selectionEnd; let endPos = input.selectionEnd;
input.value = input.value.substring(0, startPos) + textToInsert + input.value.substring(endPos, input.value.length); input.value = input.value.substring(0, startPos) + textToInsert + input.value.substring(endPos,
input.value.length);
input.selectionStart = input.selectionEnd = startPos + textToInsert.length; input.selectionStart = input.selectionEnd = startPos + textToInsert.length;
} else { } else {
input.value += textToInsert; input.value += textToInsert;
@ -334,17 +345,25 @@ $('#ticket_mail_editor_modal').submit(function (event) {
return; // Prevent submission return; // Prevent submission
} }
var joditEditor = editor; var joditEditor = editor;
if (joditEditor) if (joditEditor) {
{
var mailContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html(); var mailContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html();
var formData = $(this).serializeArray(); var formData = $(this).serializeArray();
formData.push({ name: 'mail_content', value: mailContent }); formData.push({
name: 'mail_content',
value: mailContent
});
// formData.push({ name: 'client_id', value: $('#general_PrimaryKey').val() }); // formData.push({ name: 'client_id', value: $('#general_PrimaryKey').val() });
var isAutoMailEnabled = $('#statusSwitch').is(':checked') ? 1 : 0; var isAutoMailEnabled = $('#statusSwitch').is(':checked') ? 1 : 0;
formData.push({ name: 'is_auto_mail', value: isAutoMailEnabled }); formData.push({
name: 'is_auto_mail',
value: isAutoMailEnabled
});
var primary_key = $('#primaryKey').val(); var primary_key = $('#primaryKey').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
});
} }
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
@ -354,8 +373,7 @@ $('#ticket_mail_editor_modal').submit(function (event) {
type: "POST", type: "POST",
data: formData, data: formData,
dataType: 'json', dataType: 'json',
success: function(res) success: function(res) {
{
if (res.status == true) { if (res.status == true) {
$('#new_mail_template').find('.close').click(); $('#new_mail_template').find('.close').click();
$('.loader').fadeOut(); $('.loader').fadeOut();
@ -367,21 +385,17 @@ $('#ticket_mail_editor_modal').submit(function (event) {
} }
}, },
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() {
{
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
toastr.error('Something Wrong!', 'warning'); toastr.error('Something Wrong!', 'warning');
}, 1000); }, 1000);
} }
}); });
} } else {
else
{
console.error("Jodit editor instance is not defined."); console.error("Jodit editor instance is not defined.");
} }
}) })
@ -395,7 +409,9 @@ function openModal() {
function deleteTemplate(id) { function deleteTemplate(id) {
const url = '<?= base_url("ticket/crud_mail_template/3") ?>'; const url = '<?= base_url("ticket/crud_mail_template/3") ?>';
const data = { id: id }; // Ensure data is passed as an object const data = {
id: id
}; // Ensure data is passed as an object
Swal.fire({ Swal.fire({
title: "Are you sure?", title: "Are you sure?",
@ -437,13 +453,16 @@ function deleteTemplate(id){
} }
}); });
} }
function getMailTemplateData(id) { function getMailTemplateData(id) {
const template_name = 'new_mail_template'; const template_name = 'new_mail_template';
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
var form_action = '<?= base_url("ticket/crud_mail_template/2") ?>'; var form_action = '<?= base_url("ticket/crud_mail_template/2") ?>';
var data = { id: id }; var data = {
id: id
};
$.ajax({ $.ajax({
url: form_action, url: form_action,
@ -497,11 +516,8 @@ function getMailTemplateData(id) {
} }
}); });
} }
</script> </script>
<script> <script>
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
const table = document.getElementById("scroll-horizontal-datatable"); const table = document.getElementById("scroll-horizontal-datatable");