CHANGE_ENABLE_POLICY_ISSUE_DATE_IN_THE_FILE_UPLOAD_AND_POLICY_NUMBER_VALIDATION

This commit is contained in:
VENKATESHWARAN 2025-12-02 12:54:01 +05:30
parent 1d836e34dc
commit 646abcc5aa
4 changed files with 66 additions and 28 deletions

View File

@ -5065,25 +5065,60 @@ class ClientController extends AdminController
public function get_client_policy_data_using_policy_no() public function get_client_policy_data_using_policy_no()
{ {
$received_data = $this->request->getGet(); $received_data = $this->request->getGet();
$policy_no = $this->request->getGet('policy_no'); $policy_no = trim($this->request->getGet('policy_no'));
$client_id = $this->request->getGet('client_id'); $client_id = $this->request->getGet('client_id') ?? null;
$client_branch_id = $this->request->getGet('client_branch_id'); $client_branch_id = $this->request->getGet('client_branch_id') ?? null;
$policy_type_id = $this->request->getGet('policy_type_id'); $policy_type_id = $this->request->getGet('policy_type_id') ?? null;
$client_type = $this->request->getGet('client_type'); $client_type = $this->request->getGet('client_type') ?? null;
$data = $this->policyTransactionModel // Check in Policy Transaction (BDS)
$bds_count = $this->policyTransactionModel
->where('is_active', 1) ->where('is_active', 1)
->where('action_type', 'inception') ->where('action_type', 'inception')
->where('policy_no', $policy_no) ->where('TRIM(policy_no)', $policy_no)
->where('policy_no IS NOT NULL AND policy_no <> ""')
->countAllResults(); ->countAllResults();
$client_policy_data = $this->clientPolicyModel->where('is_active', 1)->where('policy_status', 1)->where('policy_no', trim($policy_no))->first(); // Check in Enrollment (client_policy)
$client_policy_data = $this->clientPolicyModel
->where('is_active', 1)
->where('policy_status', 1)
->where('TRIM(policy_no)', $policy_no)
->first();
// Decide message + count
if ($bds_count > 0) {
return $this->respond([
'status' => true,
'message' => "This policy number is already linked to another policy in the BDS",
'code' => 409,
'data' => $bds_count,
'received_data' => $received_data,
'client_policy_id' => $client_policy_data['id'] ?? null
], 200);
} elseif (!empty($client_policy_data)) {
return $this->respond([
'status' => true,
'message' => "This policy number is already linked to another policy in the Enrollment",
'code' => 409,
'data' => 1,
'received_data' => $received_data,
'client_policy_id' => $client_policy_data['id']
], 200);
if ($data > 0) {
return $this->respond(['status' => true, 'message' => 'This policy number is already linked to another client', 'data' => $data, 'code' => 409, 'received_data' => $received_data, 'client_policy_id' => $client_policy_data['id'] ?? null], 200);
} else { } else {
return $this->respond(['status' => false, 'message' => 'No Data Found', 'code' => 404, 'received_data' => $received_data, 'client_policy_id' => $client_policy_data['id'] ?? null], 200);
return $this->respond([
'status' => false,
'message' => 'No Data Found',
'code' => 404,
'received_data' => $received_data,
'client_policy_id' => null
], 200);
} }
} }

View File

@ -5340,6 +5340,7 @@ class EmpDataServiceController extends BaseController
'co_share_type' => 1, 'co_share_type' => 1,
'co_share_per' => 100, 'co_share_per' => 100,
'standerd_bp_per' => $policy_type_data['ebp'], 'standerd_bp_per' => $policy_type_data['ebp'],
'pt_policy_issue_date' => $params['policy_issue_date'] ?? null,
'amount' => ($params['base_premium'] ?? 0) + ($params['gst'] ?? 0), 'amount' => ($params['base_premium'] ?? 0) + ($params['gst'] ?? 0),
]; ];

View File

@ -1988,8 +1988,10 @@ input:checked + .slider_blue::before {
console.log(policy_no + '-' + policy_no.length); console.log(policy_no + '-' + policy_no.length);
$.ajax({ $.ajax({
url: '<?php echo base_url('util/check_policy_no/');?>' + policy_no, // url: '<?php echo base_url('util/check_policy_no/');?>' + policy_no,
url: '<?php echo base_url('util/get_client_policy_data_using_policy_no');?>',
type: "GET", type: "GET",
data : {policy_no : policy_no},
dataType: 'json', dataType: 'json',
success: function (res) { success: function (res) {
console.log(res); console.log(res);

View File

@ -101,13 +101,13 @@
</div> </div>
</div> </div>
<!-- <div class="form-row policy_issue_date_row" style="display:none;"> <div class="form-row policy_issue_date_row" style="display:none;">
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label id="policy_issue_date_label">Policy Issue Date</label> <br /> <label id="policy_issue_date_label">Policy Issue Date</label> <br />
<input type="text" class="form-control" id="policy_issue_date" name="policy_issue_date" <input type="text" class="form-control" id="policy_issue_date" name="policy_issue_date"
placeholder="Enter Policy Issue Date"> placeholder="Enter Policy Issue Date">
</div> </div>
</div> --> </div>
<br> <br>
<div class="form-row" id="import_excel_btn"> <div class="form-row" id="import_excel_btn">
@ -171,10 +171,10 @@
$(document).ready(function() { $(document).ready(function() {
// var policy_issue_datePicker = flatpickr("#policy_issue_date", { var policy_issue_datePicker = flatpickr("#policy_issue_date", {
// dateFormat: "d/m/Y", dateFormat: "d/m/Y",
// allowInput: false, allowInput: false,
// }); });
$('#insurer_or_tpa, #action_type').on('change', togglePolicyIssueDate); $('#insurer_or_tpa, #action_type').on('change', togglePolicyIssueDate);
}); });
@ -796,15 +796,15 @@
function togglePolicyIssueDate() { function togglePolicyIssueDate() {
let insurer = $('#insurer_or_tpa').val(); let insurer = $('#insurer_or_tpa').val();
let action = $('#action_type').val(); let action = $('#action_type').val();
// if (insurer === 'insurer' && action === 'import') { if (insurer === 'insurer' && action === 'import') {
// $('.policy_issue_date_row').show(); $('.policy_issue_date_row').show();
// $('#policy_issue_date').attr('required', true); $('#policy_issue_date').attr('required', true);
// $('#policy_issue_date_label').html('Policy Issue Date <span class="text-danger">*</span>'); $('#policy_issue_date_label').html('Policy Issue Date <span class="text-danger">*</span>');
// } else { } else {
// $('.policy_issue_date_row').hide(); $('.policy_issue_date_row').hide();
// $('#policy_issue_date').removeAttr('required').val(''); $('#policy_issue_date').removeAttr('required').val('');
// $('#policy_issue_date_label').text('Policy Issue Date'); $('#policy_issue_date_label').text('Policy Issue Date');
// } }
} }
function fetchTpaIdFromTpa(){ function fetchTpaIdFromTpa(){