FEAT_FORM_FIELD_AND_SWITCH_ADDED_IN_POLICY_TRANSACTION_SRINIVAS

This commit is contained in:
Srinivas-Saravanan 2025-01-21 15:38:42 +05:30
parent 7e7b8eb411
commit 55d4f56d26
6 changed files with 251 additions and 32 deletions

View File

@ -373,6 +373,7 @@ $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
$routes->get("getFileErr/(:any)", "PolicyTransactionController::getFileErr/$1");
$routes->get("getInsurerStatementMonth", "PolicyTransactionController::getInsurerStatementMonth");
$routes->get("deleteStatement/(:any)", "PolicyTransactionController::deleteStatement/$1");
//$routes->post('failedStatement',"PolicyTransactionController::failedStatementList");
});
});

View File

@ -1660,7 +1660,7 @@ class PolicyTransactionController extends BaseController
// dd($this->validateInsurerStatement(['file_id' => 30]));
// $data['insurers'] = $this->insurerModel->where('is_active',1)->findAll();
$today = date('Y-m-d');
$fromday = $from_date = date('Y-m-d', strtotime('-60 days', strtotime($today)));
$fromday = $from_date = date('Y-m-d', strtotime('-180 days', strtotime($today)));
// echo $fromday;die();
$data['invoice_status_array'] = $this->invoiceStatus;
$data['insurers'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
@ -1687,6 +1687,7 @@ class PolicyTransactionController extends BaseController
->join('insurer_branch', 'insurer_statements.branch_id = insurer_branch.id')
->join('user_profiles', 'insurer_statements.created_by = user_profiles.id')
->where('insurer_statements.is_active', 1)
// ->where('insurer_statements.file_status','success')
->where('date(insurer_statements.created_at) >= ', $from_date)
->where('date(insurer_statements.created_at) <= ', $today)
->orderBy('insurer_statements.id', 'DESC')
@ -1698,6 +1699,48 @@ class PolicyTransactionController extends BaseController
$this->loadLayout('insurer_statement_list', $data);
}
// public function failedStatementList(){
// $today = date('Y-m-d');
// $fromday = $from_date = date('Y-m-d', strtotime('-180 days', strtotime($today)));
// // echo $fromday;die();
// $data['invoice_status_array'] = $this->invoiceStatus;
// $data['insurers'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
// // dd( $data['insurers']);
// $data['insurer_statement_list'] = $this->insurerStatements
// ->select('insurer_statements.*,
// insurers.name AS insurer_name,
// insurers.short_name,
// user_profiles.first_name,
// insurer_branch.branch_code,
// (SELECT SUM(pt_co_share_details.exp_amt)
// FROM pt_co_share_details
// WHERE pt_co_share_details.is_active = 1
// AND pt_co_share_details.statement_id = insurer_statements.id
// ) AS exp_inv_amt,
// (SELECT SUM(inv_payment_details.inv_amt) + SUM(inv_payment_details.tds) + SUM(inv_payment_details.gst)
// FROM inv_payment_details
// WHERE inv_payment_details.is_active = 1
// AND inv_payment_details.statement_id = insurer_statements.id
// ) AS received_inv_amt'
// )
// ->join('insurers', 'insurer_statements.insurer_id = insurers.id')
// ->join('insurer_branch', 'insurer_statements.branch_id = insurer_branch.id')
// ->join('user_profiles', 'insurer_statements.created_by = user_profiles.id')
// ->where('insurer_statements.is_active', 1)
// ->where('insurer_statements.file_status','failed')
// ->where('date(insurer_statements.created_at) >= ', $from_date)
// ->where('date(insurer_statements.created_at) <= ', $today)
// ->orderBy('insurer_statements.id', 'DESC')
// ->findAll();
// if($data['insurer_statement_list']){
// return $this->respond(['status' => true, 'code' => 200,'data'=>$data ], 200);
// }else{
// return $this->respond(['status'=>false,'message'=>'Data Not Fount'],404);
// }
// }
public function uploadInsurerStatement()
{

View File

@ -22,6 +22,6 @@ class PolicyTypeModel extends Model
"etp",
"iep",
"itp",
"question_json",
"question_json",'itep','etep'
];
}

View File

@ -141,13 +141,38 @@ table.dataTable tbody td {
<div class="card">
<div class="card-body">
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<div class="col-9" style="align-self: center;">
<h4 style="position: relative;">Insurer Statement List</h4>
<!-- <div id="statusSwitchWrapper" class="dt-switch-wrapper">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="statusSwitch">
<label class="custom-control-label" for="statusSwitch">Failed Status</label>
</div>
</div> -->
</div>
<!-- <div class="col-4">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="failedSwitch">
<label class="custom-control-label" for="failedSwitch">Failed</label>
</div>
</div> -->
<div class="col-6" style="text-align: right;">
<button type="button" id="btnAdd" onclick="showFileUploadModal()" class="btn btn-primary waves-effect waves-light">Upload</button>
<div class="col-3" style="text-align: right;">
<div class="row align-items-center">
<div class="col-8">
<div id="statusSwitchWrapper" class="dt-switch-wrapper">
<div class="custom-control custom-switch" style="text-align: left;">
<input type="checkbox" class="custom-control-input" id="statusSwitch">
<label class="custom-control-label" for="statusSwitch">Failed Status</label>
</div>
</div>
</div>
<div class="col-4">
<button type="button" id="btnAdd" onclick="showFileUploadModal()" class="btn btn-primary waves-effect waves-light">Upload</button>
</div>
</div>
</div>
</div><div class="dataTables_length d-flex align-items-center">
</div>
<div>
<table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
@ -667,7 +692,7 @@ document.addEventListener("DOMContentLoaded", function () {
var jsonData = JSON.stringify(formDataJSON);
console.log(jsonData);
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
$('.loader-mask').fadeIn();
// Send the JSON data to the backend using AJAX
$.ajax({
url: 'saveInvoicePaymentDetails', // Replace with your backend URL
@ -1299,6 +1324,146 @@ function deleteStatement(id)
});
}
// $(document).ready(function() {
// $('#failedSwitch').change(function() {
// if ($(this).prop('checked')) {
// getFailedStatementList();
// } else {
// console.log("Inside Reload Function");
// fetch(window.location.href) // Fetch the current page's content
// .then(response => response.text())
// .then(html => {
// const parser = new DOMParser();
// const doc = parser.parseFromString(html, 'text/html');
// document.body.innerHTML = doc.body.innerHTML; // Replace the body content
// $('.loader').fadeOut();
// $('.loader-mask').delay(100).fadeOut('slow');
// })
// .catch(error => console.error('Error reloading body:', error));
// }
// });
// });
// function checkSwitchStatus(){
// $('#failedSwitch').change(function() {
// if ($(this).prop('checked')) {
// getFailedStatementList();
// } else {
// console.log("Inside Reload Function");
// fetch(window.location.href) // Fetch the current page's content
// .then(response => response.text())
// .then(html => {
// const parser = new DOMParser();
// const doc = parser.parseFromString(html, 'text/html');
// document.body.innerHTML = doc.body.innerHTML; // Replace the body content
// $('.loader').fadeOut();
// $('.loader-mask').delay(250).fadeOut('slow');
// })
// .catch(error => console.error('Error reloading body:', error));
// }
// });
// }
// function getFailedStatementList(){
// $('.loader').fadeIn();
// $('.loader-mask').fadeIn();
// $.ajax({
// url:'<?= base_url("policy_tranction/statement/failedStatement")?>',
// type:'POST',
// success:function(response){
// console.log(response);
// var table = $('#tickets-table').DataTable();
// table.clear();
// $('#tickets-table').addClass('table-fixed');
// var failedList = response.data.insurer_statement_list;
// console.log('failed list'+failedList);
// failedList.forEach(function(row) {
// var newRow = [
// '<input type="hidden" class="row-select" data-id="' + row.id + '">',
// row.short_name + '-' + row.branch_code,
// formatDate(row.month),
// row.stmt_sno,
// row.file_name,
// row.line_items,
// row.file_status +
// (row.file_status == 'failed' ? ' <span class="col-xl-3 col-lg-4 col-sm-6"><i class="fe-alert-circle" data-toggle="modal" data-target="#file-err-modal" data-err="' + row.id + '"></i></span>' : ''),
// (row.invoice_status ? row.invoice_status : ' - ') +
// (row.file_status == 'success' ? ' <span class="col-xl-3 col-lg-4 col-sm-6"><i class="fe-alert-circle" data-toggle="tooltip" title="Invoice Amt: ' + (row.invoice_amount || '0.00') + ' Received Amt: ' + (row.received_inv_amt || '0.00') + '"></i></span>' : ''),
// formatDate(row.created_at) + ' by <br>' + row.first_name,
// (row.file_status != 'failed' ?
// '<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>' +
// '<div class="dropdown-menu dropdown-menu-right">' +
// '<a class="dropdown-item btnEdit" data-id="' + row.id + '" data-exp-amt="' + row.exp_inv_amt + '" data-received-amt="' + row.received_inv_amt + '" onclick="showInvoiceStatusModal(event)">' +
// '<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Invoice status' +
// '</a>' +
// '<a class="dropdown-item btnEdit" data-id="' + row.id + '" onclick="deleteStatement(' + row.id + ')">' +
// '<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete' +
// '</a>' +
// '</div>' +
// '</div>' : '...')
// ];
// // Append the new row to the table body
// table.row.add(newRow);
// });
// table.draw();
// table.columns.adjust().draw(); // Ensures correct alignment
// $('.loader').fadeOut();
// $('.loader-mask').delay(250).fadeOut('slow');
// },
// error: function(xhr, status, error) {
// let message = 'Failed to load Data ';
// toastr.error(response.message, 'Failed');
// $('.loader').fadeOut();
// $('.loader-mask').delay(250).fadeOut('slow');
// }
// })
// }
// $(document).ready(function() {
// var table = $('#tickets-table').DataTable({
// // responsive: true, // Ensures table adjusts to smaller screens
// stateSave: true, // Saves the table's state
// });
// });
</script>
<script>
$(document).ready(function() {
// Add custom filter function to DataTables
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex) {
const showFailedStatus = $('#statusSwitch').is(':checked');
const status = data[6].toLowerCase().trim(); // Index 6 is the file_status column
if (showFailedStatus) {
return status.includes('failed');
} else {
return status.includes('success');
}
});
// Initialize DataTable
const table = $('#tickets-table').DataTable({
// Your existing DataTable options here
"order": [], // Disable initial sorting if needed
"pageLength": 10,
// "dom": '<"top"lf>rt<"bottom"ip><"clear">', // This places length and filter controls at top
"language": {
"lengthMenu": "Show _MENU_ entries",
"search": "Search:"
}
});
// Add event listener for switch changes
$('#statusSwitch').on('change', function() {
table.draw(); // Redraw the table to apply the filter
});
// Trigger initial filter to show only success status
table.draw();
});
</script>

View File

@ -1813,7 +1813,7 @@ function getMailTemplateData(element) {
bottom: '0', // Adjust based on branding position
left: '0',
width: iframe.width(),
height: '50px', // Adjust height to cover branding
height: '30px', // Adjust height to cover branding
backgroundColor: 'white',
zIndex: '9999',
pointerEvents: 'none',
@ -1828,13 +1828,7 @@ function getMailTemplateData(element) {
iframeParent.append(overlay);
console.log('Overlay added to hide branding.');
});
$(window).on('resize', function () {
overlay.css({
width: iframe.width(),
height: '50px', // Adjust height dynamically if necessary
});
});
@ -1931,20 +1925,6 @@ $('#account_maneger_summary_mail_form').submit(function (event) {
});
});
});
document.addEventListener("DOMContentLoaded", function () {
const observer = new MutationObserver(() => {
const brandingElement = document.querySelector('#editor-container .blockbuilder-branding');
if (brandingElement) {
brandingElement.remove(); // Remove the branding element
}
});
// Start observing the editor container for changes
const editorContainer = document.getElementById('editor-container');
if (editorContainer) {
observer.observe(editorContainer, { childList: true, subtree: true });
}
});

View File

@ -15,10 +15,9 @@
placeholder="Enter Policy Type Name" value="<?= isset($policytype['policy_type']) ? $policytype['policy_type'] : '' ?>" name="policy_type" required>
</div>
<div class="form-group col-md-4">
<label for="kyc_name">Policy Type Long Name<span
class="text-danger">*</span></label>
<label for="kyc_name">Policy Type Long Name</label>
<input type="text" class="form-control" id="long_name"
placeholder="Enter Policy Type Long Name" value="<?= isset($policytype['long_name']) ? $policytype['long_name'] : '' ?>" name="long_name" required>
placeholder="Enter Policy Type Long Name" value="<?= isset($policytype['long_name']) ? $policytype['long_name'] : '' ?>" name="long_name">
</div>
<div class="form-group col-md-4">
<label for="bap">BAP<span
@ -38,6 +37,37 @@
<input type="text" class="form-control" id="alloci"
placeholder="Enter Alloci" value="<?= isset($policytype['alloci']) ? $policytype['alloci'] : '' ?>" name="alloci" required>
</div>
<div class="form-group col-md-4">
<label for="ebp">Group Base Premium<span class="text-muted"> (STD %)</span></label>
<input type="number" class="form-control" id="ebp"
placeholder="Enter Group Base Premium" value="<?= isset($policytype['ebp']) ? $policytype['ebp'] : '' ?>" name="ebp">
</div>
<div class="form-group col-md-4">
<label for="etp">Group Third Party Premium<span
class="text-muted"> (STD %)</span></label> <input type="number" class="form-control" id="etp"
placeholder="Enter Group Base Premium" value="<?= isset($policytype['etp']) ? $policytype['etp'] : '' ?>" name="etp">
</div>
<div class="form-group col-md-4">
<label for="etep">Group Terrorism Premium<span
class="text-muted"> (STD %)</span></label> <input type="number" class="form-control" id="etep"
placeholder="Enter Group Base Premium" value="<?= isset($policytype['etep']) ? $policytype['etep'] : '' ?>" name="etep">
</div>
<div class="form-group col-md-4">
<label for="iep">Individual Base Premium<span
class="text-muted"> (STD %)</span></label> <input type="number" class="form-control" id="iep"
placeholder="Enter Group Base Premium" value="<?= isset($policytype['iep']) ? $policytype['iep'] : '' ?>" name="iep">
</div>
<div class="form-group col-md-4">
<label for="itp">Individual Third-Party Premium<span
class="text-muted"> (STD %)</span></label> <input type="number" class="form-control" id="itp"
placeholder="Enter Group Base Premium" value="<?= isset($policytype['itp']) ? $policytype['itp'] : '' ?>" name="itp">
</div>
<div class="form-group col-md-4">
<label for="itep">Individual Terrorism Premium<span
class="text-muted"> (STD %)</span></label> <input type="number" class="form-control" id="itep"
placeholder="Enter Group Base Premium" value="<?= isset($policytype['itep']) ? $policytype['itep'] : '' ?>" name="itep">
</div>
</div>
<hr>
@ -94,7 +124,7 @@ $(document).ready(function () {
}, 1000);
$('#policy_type_id').val(res.data.id);
$('#policytype_General_PrimaryKey').val(res.data.id);
$('#policytype_General_PrimaryKey').val(res.data.PrimaryKey);
$('#policy_id_type').click();
$('#btnBranchAdd').show();
var message = "Policy Type General Info";