CHANGE_NORMAL_DROPDOWN_TO_SEARCHABLE_DROPDOWN : RV
This commit is contained in:
parent
a43394eb6e
commit
0cdd853d86
@ -196,7 +196,8 @@ class ClientController extends AdminController
|
||||
$subTypeOptions = [
|
||||
1 => 'Deposit',
|
||||
2 => 'Adjustment',
|
||||
3 => 'Deletion',
|
||||
3 => 'Refund',
|
||||
4 => 'Debit',
|
||||
// Add more options as needed
|
||||
];
|
||||
$data['subTypeOptions'] = $subTypeOptions;
|
||||
@ -970,7 +971,7 @@ class ClientController extends AdminController
|
||||
->where("employees.emp_status",'active')
|
||||
->countAllResults();
|
||||
|
||||
if($emp_count = 0){
|
||||
if($emp_count == 0){
|
||||
$emp_count = true;
|
||||
}else{
|
||||
$emp_count = false;
|
||||
@ -1252,7 +1253,7 @@ class ClientController extends AdminController
|
||||
->where("employees.emp_status",'active')
|
||||
->countAllResults();
|
||||
|
||||
if($emp_count = 0){
|
||||
if($emp_count == 0){
|
||||
$emp_count = true;
|
||||
}else{
|
||||
$emp_count = false;
|
||||
|
||||
@ -22,7 +22,8 @@ use App\Models\ClientDepositModel;
|
||||
|
||||
use App\Controllers\Jobs ;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
// use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
||||
|
||||
class EmpDataServiceController extends BaseController
|
||||
{
|
||||
@ -122,9 +123,27 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
// Define headers for the Excel file
|
||||
$headers = [
|
||||
'S.No', 'NAME OF EMP/DEP', 'EMP ID', 'EMP/DEP TYPE', 'RELATION', 'DOB', 'GENDER', 'PRE EXISTING AILMENTS',
|
||||
'BASIC COVER SI', 'DATE OF COVERAGE', 'AGE', 'RELATIONSHIP', 'REMARKS', 'POLICY END DATE', 'NO OF DAYS', 'TPA ID', 'UHID',
|
||||
'PREMIUM', 'PR0 RATA PREMIUM', 'GST', 'TOTAL'
|
||||
'S.No',
|
||||
'NAME OF EMP/DEP',
|
||||
'EMP ID',
|
||||
'EMP/DEP TYPE',
|
||||
'RELATION',
|
||||
'DOB',
|
||||
'GENDER',
|
||||
'PRE EXISTING AILMENTS',
|
||||
'BASIC COVER SI',
|
||||
'DATE OF COVERAGE',
|
||||
'AGE',
|
||||
'RELATIONSHIP',
|
||||
'REMARKS',
|
||||
'POLICY END DATE',
|
||||
'NO OF DAYS',
|
||||
'TPA ID',
|
||||
'UHID',
|
||||
'PREMIUM',
|
||||
'PR0 RATA PREMIUM',
|
||||
'GST',
|
||||
'TOTAL'
|
||||
];
|
||||
|
||||
// Generate Excel file
|
||||
@ -450,6 +469,12 @@ class EmpDataServiceController extends BaseController
|
||||
$client_policy_id = $import_data['client_policy_id'];
|
||||
$file = $import_data['file'];
|
||||
|
||||
// $data = $this->readExcelToArray($file);
|
||||
// unset($data[0]);
|
||||
// array_pop($data);
|
||||
// $count = count($data);cmd
|
||||
// dd($data);
|
||||
|
||||
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
|
||||
$filename = $file->getName();
|
||||
|
||||
@ -678,7 +703,7 @@ class EmpDataServiceController extends BaseController
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
$data = read_excel_file_to_array($file_name_with_path);
|
||||
unset($data[0]);
|
||||
$count = count($data);
|
||||
@ -947,7 +972,7 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
$data = [
|
||||
'amount' => $amount->total_sum,
|
||||
'sub_type_id' => 1,
|
||||
'sub_type_id' => 4,
|
||||
'client_id' => $arrayData['client_id'],
|
||||
'insurer_id' => $insurer_id['insurer_id'],
|
||||
'description' => $description,
|
||||
@ -986,7 +1011,7 @@ class EmpDataServiceController extends BaseController
|
||||
$data = [
|
||||
|
||||
'amount' => $amount->total_sum,
|
||||
'sub_type_id' => 1,
|
||||
'sub_type_id' => 4,
|
||||
'client_id' => $arrayData['client_id'],
|
||||
'insurer_id' => $insurer_id['insurer_id'],
|
||||
'description' => $description,
|
||||
@ -1027,7 +1052,7 @@ class EmpDataServiceController extends BaseController
|
||||
$data = [
|
||||
|
||||
'amount' => $amount->total_sum,
|
||||
'sub_type_id' => 1,
|
||||
'sub_type_id' => 3,
|
||||
'client_id' => $arrayData['client_id'],
|
||||
'insurer_id' => $insurer_id['insurer_id'],
|
||||
'description' => $description,
|
||||
@ -1219,4 +1244,36 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
public function readExcelToArray($file){
|
||||
|
||||
if ($file->isValid() && !$file->hasMoved()) {
|
||||
$file = $file;
|
||||
|
||||
$reader = new Xlsx();
|
||||
$spreadsheet = $reader->load($file->getPathname());
|
||||
|
||||
// Get the active sheet
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
// Iterate through rows to read data
|
||||
$data = [];
|
||||
foreach ($sheet->getRowIterator() as $row) {
|
||||
$rowData = [];
|
||||
foreach ($row->getCellIterator() as $cell) {
|
||||
$rowData[] = $cell->getValue();
|
||||
}
|
||||
$data[] = $rowData;
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
} else {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -268,39 +268,25 @@ if (! function_exists('transform_objects_to_array_for_deletion')) {
|
||||
|
||||
|
||||
if (!function_exists('add_totals_row')) {
|
||||
function add_totals_row(Spreadsheet $spreadsheet, array $data, array $headers)
|
||||
{
|
||||
|
||||
//find the index value
|
||||
$rata = array_search('PRO RATA PREMIUM', $headers);
|
||||
$gst = array_search('GST', $headers);
|
||||
$total = array_search('TOTAL', $headers);
|
||||
|
||||
|
||||
function add_totals_row(Spreadsheet $spreadsheet, array $data)
|
||||
{
|
||||
// Calculate GST, Pro Rata Premium, and Total sums
|
||||
$gstSum = 0;
|
||||
$proRataPremiumSum = 0;
|
||||
$totalSum = 0;
|
||||
|
||||
foreach ($data as $row) {
|
||||
$gstSum += $row[$gst];
|
||||
$proRataPremiumSum += $row[$rata];
|
||||
$totalSum += $row[$total];
|
||||
$gstSum += $row[18];
|
||||
$proRataPremiumSum += $row[19];
|
||||
$totalSum += $row[20];
|
||||
}
|
||||
|
||||
$cellValue = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
|
||||
$prev_index = $rata - 1;
|
||||
$cellValueTotal = $cellValue[$prev_index];
|
||||
$cellValueRata = $cellValue[$rata];
|
||||
$cellValueGST = $cellValue[$gst];
|
||||
$cellValueTotalSum = $cellValue[$total];
|
||||
|
||||
// Add a new row with sums
|
||||
$lastRow = count($data) + 1; // To get the last row number
|
||||
$spreadsheet->getActiveSheet()->setCellValue($cellValueTotal . ($lastRow + 1), 'TOTALS');
|
||||
$spreadsheet->getActiveSheet()->setCellValue($cellValueRata . ($lastRow + 1), $proRataPremiumSum);
|
||||
$spreadsheet->getActiveSheet()->setCellValue($cellValueGST . ($lastRow + 1), $gstSum);
|
||||
$spreadsheet->getActiveSheet()->setCellValue($cellValueTotalSum . ($lastRow + 1), $totalSum);
|
||||
$spreadsheet->getActiveSheet()->setCellValue('R' . ($lastRow + 1), 'TOTALS');
|
||||
$spreadsheet->getActiveSheet()->setCellValue('S' . ($lastRow + 1), $gstSum);
|
||||
$spreadsheet->getActiveSheet()->setCellValue('T' . ($lastRow + 1), $proRataPremiumSum);
|
||||
$spreadsheet->getActiveSheet()->setCellValue('U' . ($lastRow + 1), $totalSum);
|
||||
}
|
||||
}
|
||||
|
||||
@ -543,4 +529,4 @@ if (!function_exists('format_Excel_BasedOn_Client'))
|
||||
return $data;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,6 +80,7 @@ class ClientPolicyModel extends Model
|
||||
->join('policies', 'policies.id = client_policy.policy_id')
|
||||
->join('policy_type', 'policy_type.id = policies.policy_type_id')
|
||||
->where('client_policy.client_id', $client_id)
|
||||
->orderBy('client_policy.id', 'asc')
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
|
||||
@ -136,6 +136,14 @@
|
||||
var policy_PrimaryKey = $('#client_id_policy').val();
|
||||
var policy_client = $('#policy_PrimaryKey').val();
|
||||
|
||||
$(document).ready(function() {
|
||||
// Initialize select2
|
||||
$("#insurer").select2();
|
||||
$("#policy").select2();
|
||||
$("#tpa").select2();
|
||||
$("#base_policy").select2();
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#policy_status_field').hide()
|
||||
@ -398,53 +406,57 @@ $("#policy_form").submit(function(event) {
|
||||
});
|
||||
});
|
||||
|
||||
/********* To get th POLICY base on Insurer *******/
|
||||
$('#insurer').change(function() {
|
||||
var id = $(this).val();
|
||||
var parts = id.split('-');
|
||||
var secondPart = parts[1];
|
||||
var url = "<?= base_url("util/police-by-insurer/") ?>" + secondPart;
|
||||
$(document).ready(function() {
|
||||
/********* To get th POLICY base on Insurer *******/
|
||||
$('#insurer').change(function() {
|
||||
var id = $(this).val();
|
||||
var parts = id.split('-');
|
||||
var secondPart = parts[1];
|
||||
var url = "<?= base_url("util/police-by-insurer/") ?>" + secondPart;
|
||||
|
||||
$.get(url, function(res) {
|
||||
// res = JSON.parse(res)//
|
||||
// console.log(res)
|
||||
var OptionsHTML = '';
|
||||
OptionsHTML += '<option value="" selected>Select Policy</option>';
|
||||
$.each(res.data, function(index, item) {
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id +
|
||||
'">' + item.name + '</option>';
|
||||
$.get(url, function(res) {
|
||||
// res = JSON.parse(res)//
|
||||
// console.log(res)
|
||||
var OptionsHTML = '';
|
||||
OptionsHTML += '<option value="" selected>Select Policy</option>';
|
||||
$.each(res.data, function(index, item) {
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id +
|
||||
'">' + item.name + '</option>';
|
||||
});
|
||||
|
||||
$('#policy').html(OptionsHTML);
|
||||
}).fail(function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
});
|
||||
|
||||
$('#policy').html(OptionsHTML);
|
||||
}).fail(function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
});
|
||||
});
|
||||
|
||||
/********* set the Policy_Type_id for Form Submit *******/
|
||||
$('#policy').change(function() {
|
||||
$(document).ready(function() {
|
||||
/********* set the Policy_Type_id for Form Submit *******/
|
||||
$('#policy').change(function() {
|
||||
|
||||
var id = $(this).val();
|
||||
var dataId = $(this).children('option:selected').attr('data-id');
|
||||
console.log('id', id)
|
||||
$('#policy_type_id').val(dataId);
|
||||
var id = $(this).val();
|
||||
var dataId = $(this).children('option:selected').attr('data-id');
|
||||
console.log('id', id)
|
||||
$('#policy_type_id').val(dataId);
|
||||
|
||||
$('#base_policy option').each(function() {
|
||||
var val = $(this).val();
|
||||
if (val == id) {
|
||||
$(this).hide(); // Hide the option if its value matches the selected value of #policy
|
||||
} else {
|
||||
$(this).show(); // Show all other options
|
||||
}
|
||||
});
|
||||
|
||||
// if(dataId == 1){
|
||||
// appendPolicyFormFields(1);
|
||||
// }else if (dataId >= 1){
|
||||
// appendPolicyFormFields(2);
|
||||
// }
|
||||
|
||||
$('#base_policy option').each(function() {
|
||||
var val = $(this).val();
|
||||
if (val == id) {
|
||||
$(this).hide(); // Hide the option if its value matches the selected value of #policy
|
||||
} else {
|
||||
$(this).show(); // Show all other options
|
||||
}
|
||||
});
|
||||
|
||||
// if(dataId == 1){
|
||||
// appendPolicyFormFields(1);
|
||||
// }else if (dataId >= 1){
|
||||
// appendPolicyFormFields(2);
|
||||
// }
|
||||
|
||||
});
|
||||
|
||||
// get the client policy data for edit
|
||||
@ -482,9 +494,11 @@ $('body').on('click', '.btnPolicyEdit', function() {
|
||||
$('.btnBack').show();
|
||||
$('.btnAdd').hide();
|
||||
|
||||
$('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id);
|
||||
$('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id);
|
||||
$('#policy').val(res.data.policy_id);
|
||||
$('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id).change();
|
||||
$('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id).change();
|
||||
$('#policy').val(res.data.policy_id).change();
|
||||
|
||||
|
||||
$('#policy_type_id').val(res.data.policy_type_id);
|
||||
$('#policy_PrimaryKey').val(res.data.id);
|
||||
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date));
|
||||
@ -529,6 +543,11 @@ $('body').on('click', '.btnPolicyEdit', function() {
|
||||
}
|
||||
});
|
||||
$('#base_policy').html(OptionsHTML);
|
||||
setTimeout(function() {
|
||||
$('#policy').val(res.data.policy_id).change();
|
||||
$('#base_policy').change();
|
||||
}, 1000);
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
|
||||
@ -75,6 +75,17 @@ table.dataTable tbody td {
|
||||
<div id="loader" class="loader" style="display:none;">SPINNER</div>
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
// Initialize select2
|
||||
$("#clients").select2();
|
||||
$("#policies").select2();
|
||||
|
||||
// if ($('.select2-selection__arrow').length > 0) {
|
||||
// $('.select2-selection__arrow').removeClass('select2-selection__arrow').addClass('fa fa-chevron-down');
|
||||
// }
|
||||
});
|
||||
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
||||
@ -181,18 +192,19 @@ function appendPolicies(data) {
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#clients').on('change', function() {
|
||||
var selectedClient = $(this).val();
|
||||
console.log('selectedClient', selectedClient);
|
||||
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
||||
|
||||
$('#clients').on('change', function() {
|
||||
var selectedClient = $(this).val();
|
||||
console.log(selectedClient);
|
||||
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
||||
|
||||
// Check if the selected option exists in apiData
|
||||
var foundPolicies = clientPolicies.find(function(item) {
|
||||
return item.id === selectedClient;
|
||||
// Check if the selected option exists in apiData
|
||||
var foundPolicies = clientPolicies.find(function(item) {
|
||||
return item.id === selectedClient;
|
||||
});
|
||||
console.log(foundPolicies.policies);
|
||||
appendPolicies(foundPolicies.policies);
|
||||
});
|
||||
console.log(foundPolicies.policies);
|
||||
appendPolicies(foundPolicies.policies);
|
||||
});
|
||||
|
||||
|
||||
|
||||
@ -1,10 +1,3 @@
|
||||
<?php //echo fancy_date_time_format('2024-01-01 15:40:32');echo '<br>';?>
|
||||
<?php //echo fancy_date_time_format('2024-02-01 15:40:32');echo '<br>';?>
|
||||
<!-- <?php echo fancy_date_time_format('2024-02-10 15:40:32');echo '<br>';?> -->
|
||||
<!-- <?php echo fancy_date_time_format('2024-02-13 14:40:32');echo '<br>';?> -->
|
||||
<!-- <?php echo fancy_date_time_format('2024-02-13 14:58:00');echo '<br>';?> -->
|
||||
|
||||
|
||||
|
||||
<div class="tab-pane fade active show" id="general-q-tab">
|
||||
<div class="row">
|
||||
@ -20,7 +13,8 @@
|
||||
<div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion1">
|
||||
<div class="card-body">
|
||||
<!-- <div class="text-center"> -->
|
||||
<form class="parsley-examples" id="emp-upload-form" action="<?php echo base_url().'employee/upload'?>" method="post">
|
||||
<form class="parsley-examples" id="emp-upload-form"
|
||||
action="<?php echo base_url().'employee/upload'?>" method="post">
|
||||
<input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>"
|
||||
id="csrf_token">
|
||||
|
||||
@ -85,12 +79,14 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-2" style="margin-top: 26px;position: relative;left: 65px;"> OR </div>
|
||||
<div class="form-group col-md-2"
|
||||
style="margin-top: 26px;position: relative;left: 65px;"> OR </div>
|
||||
|
||||
<div class="form-group col-md-4" style="margin-top: 18px;">
|
||||
<a class="btn btn-primary waves-effect waves-light justify-content-end"
|
||||
id="fetch_enrolled_data" data-toggle="modal" data-target="#full-width-modal"
|
||||
title="Download Sample Excel">Featch Enrolled Data</a>
|
||||
id="fetch_enrolled_data" data-toggle="modal"
|
||||
data-target="#full-width-modal" title="Download Sample Excel">Featch
|
||||
Enrolled Data</a>
|
||||
</div>
|
||||
|
||||
|
||||
@ -125,7 +121,7 @@
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body" id="emp_data">
|
||||
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary">Save changes</button>
|
||||
@ -155,6 +151,12 @@
|
||||
<script>
|
||||
$('#file_upload').hide();
|
||||
|
||||
$(document).ready(function() {
|
||||
// Initialize select2
|
||||
$("#client_id").select2();
|
||||
$("#policy_id").select2();
|
||||
});
|
||||
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
|
||||
@ -472,17 +474,21 @@ function appendPolicies(data) {
|
||||
});
|
||||
}
|
||||
|
||||
$('#client_id').on('change', function() {
|
||||
var selectedClient = $(this).val();
|
||||
console.log(selectedClient);
|
||||
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
||||
$(document).ready(function() {
|
||||
|
||||
// Check if the selected option exists in apiData
|
||||
var foundPolicies = clientPolicies.find(function(item) {
|
||||
return item.id === selectedClient;
|
||||
$('#client_id').on('change', function() {
|
||||
var selectedClient = $(this).val();
|
||||
console.log(selectedClient);
|
||||
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
||||
|
||||
// Check if the selected option exists in apiData
|
||||
var foundPolicies = clientPolicies.find(function(item) {
|
||||
return item.id === selectedClient;
|
||||
});
|
||||
console.log(foundPolicies.policies);
|
||||
appendPolicies(foundPolicies.policies);
|
||||
});
|
||||
console.log(foundPolicies.policies);
|
||||
appendPolicies(foundPolicies.policies);
|
||||
|
||||
});
|
||||
|
||||
// Function to convert object to query parameters
|
||||
@ -567,7 +573,7 @@ document.getElementById('toggleIcon1').addEventListener('click', function() {
|
||||
icon.classList.toggle('mdi-chevron-up');
|
||||
});
|
||||
|
||||
$('#fetch_enrolled_data').click(function(){
|
||||
$('#fetch_enrolled_data').click(function() {
|
||||
|
||||
$('#emp_data').empty();
|
||||
var client_id = $('#client_id').val();
|
||||
@ -592,11 +598,11 @@ $('#fetch_enrolled_data').click(function(){
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var uri = '<?= base_url('util/featch-emp-list')?>?'+queryString
|
||||
var uri = '<?= base_url('util/featch-emp-list')?>?' + queryString
|
||||
console.log(uri)
|
||||
|
||||
$.ajax({
|
||||
url:uri,
|
||||
url: uri,
|
||||
data: {
|
||||
client_id: client_id,
|
||||
policy_id: policy_id
|
||||
@ -624,12 +630,12 @@ $('#fetch_enrolled_data').click(function(){
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something went wrong', 'Warning');
|
||||
toastr.warning('Something went wrong', 'Warning');
|
||||
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
})
|
||||
//--------------------------------------------------------------------------------------
|
||||
</script>
|
||||
@ -173,6 +173,13 @@ table.dataTable tbody td {
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
// Initialize select2
|
||||
$("#clients").select2();
|
||||
$("#policies").select2();
|
||||
});
|
||||
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
||||
@ -274,17 +281,21 @@ function appendPolicies(data) {
|
||||
});
|
||||
}
|
||||
|
||||
$('#clients').on('change', function() {
|
||||
var selectedClient = $(this).val();
|
||||
console.log(selectedClient);
|
||||
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
||||
$(document).ready(function() {
|
||||
|
||||
// Check if the selected option exists in apiData
|
||||
var foundPolicies = clientPolicies.find(function(item) {
|
||||
return item.id === selectedClient;
|
||||
$('#clients').on('change', function() {
|
||||
var selectedClient = $(this).val();
|
||||
console.log(selectedClient);
|
||||
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
||||
|
||||
// Check if the selected option exists in apiData
|
||||
var foundPolicies = clientPolicies.find(function(item) {
|
||||
return item.id === selectedClient;
|
||||
});
|
||||
console.log(foundPolicies.policies);
|
||||
appendPolicies(foundPolicies.policies);
|
||||
});
|
||||
console.log(foundPolicies.policies);
|
||||
appendPolicies(foundPolicies.policies);
|
||||
|
||||
});
|
||||
|
||||
// Function to convert object to query parameters
|
||||
|
||||
@ -134,6 +134,14 @@
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
// Initialize select2
|
||||
$("#client").select2();
|
||||
$("#policy").select2();
|
||||
});
|
||||
|
||||
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
|
||||
@ -288,6 +296,8 @@ function appendPolicies2(data) {
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#client').on('change', function() {
|
||||
var selectedClient = $(this).val();
|
||||
console.log(selectedClient);
|
||||
@ -301,6 +311,8 @@ $('#client').on('change', function() {
|
||||
appendPolicies2(foundPolicies.policies);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Function to convert object to query parameters
|
||||
function objectToQueryString2(obj) {
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
|
||||
@ -496,6 +496,8 @@
|
||||
<!-- Jodit Js -->
|
||||
<script src="<?= base_url()."public"; ?>/assets/js/jodit.min.js"></script>
|
||||
|
||||
<!-- select2 -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -50,6 +50,9 @@
|
||||
<!-- Sweet Alert CDN -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.10.4/dist/sweetalert2.all.min.js"></script>
|
||||
|
||||
<!-- select2 -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" type="text/css">
|
||||
|
||||
|
||||
<link rel="manifest" href="../manifest.json">
|
||||
|
||||
@ -215,6 +218,20 @@
|
||||
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.select2-container--default .select2-selection--single {
|
||||
height: 37px !important;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||
line-height: 35px !important;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
||||
top: 7px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
$(window).on('load', function() {
|
||||
setTimeout(function() {
|
||||
|
||||
@ -69,6 +69,11 @@
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#insurer_id").select2();
|
||||
});
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var policy_type_PrimaryKey = $('#policy_type_id').val();
|
||||
@ -288,7 +293,7 @@ $(document).ready(function () {
|
||||
$('#branch_table').hide();
|
||||
$('.btnBack').show();
|
||||
$('#btnBranchAdd').hide();
|
||||
$('#insurer_id').val(res.policies.insurer_id);
|
||||
$('#insurer_id').val(res.policies.insurer_id).change();
|
||||
$('#name').val(res.policies.name);
|
||||
$('#policy_type_PrimaryKey').val(res.policies.id);
|
||||
|
||||
|
||||
@ -495,19 +495,16 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <hr> -->
|
||||
|
||||
<!-- <div class="form-row" id="grid_content_input">
|
||||
</div> -->
|
||||
<br>
|
||||
|
||||
</div>
|
||||
<div class="form-group text-right m-b-0" style="margin-top: -49px;">
|
||||
<div class="form-group text-right m-b-0" style="margin-top: -49px;" id="group_btn_1">
|
||||
<a href="#" class="button-like" id="myButtonSpecialCondition" title="Special Condition">Special Condition</a>
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGridSubmit" style="margin-top: 100px;">Submit</button>
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGridSubmit1" style="margin-top: 100px;">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -660,7 +657,7 @@ var grid_html = '';
|
||||
data: {client_policy_id: client_policy_id},
|
||||
success: function(response) {
|
||||
console.log('response',response);
|
||||
|
||||
console.log('count', response.count);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
@ -668,16 +665,23 @@ var grid_html = '';
|
||||
$('#nameOfThePolicyInGMC').html(' - ' + response.policy_name.name);
|
||||
$('gmc_emp_count').val(response.count);
|
||||
|
||||
if(response.count){
|
||||
|
||||
console.log('count--1', response.count);
|
||||
$('emp_count').val(response.count)
|
||||
if(response.count === false){
|
||||
$("#btnGPATermsSubmit").prop("disabled", true);
|
||||
}else{
|
||||
$("#btnGPATermsSubmit").prop("disabled", false);
|
||||
}
|
||||
if (response && response.hasOwnProperty('count')) {
|
||||
if (response.count === false) {
|
||||
console.log('count -- 2', response.count);
|
||||
console.log(document.getElementById('btnGridSubmit1'))
|
||||
$("#btnGridSubmit1").hide();
|
||||
$("#myButtonSpecialCondition").hide();
|
||||
} else {
|
||||
$("#btnGridSubmit1").show();
|
||||
$("#myButtonSpecialCondition").show();
|
||||
console.log('count -- ', response.count);
|
||||
}
|
||||
} else {
|
||||
console.error('Response object does not have a "count" property or is invalid.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (response) {
|
||||
let jsonObject = JSON.parse(response.data);
|
||||
|
||||
@ -279,8 +279,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<div class="form-group text-right m-b-0" style="margin-top: -49px;">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGPATermsSubmit" style="margin-top: 100px;">Submit</button>
|
||||
</div>
|
||||
@ -464,22 +463,21 @@
|
||||
success: function(res) {
|
||||
|
||||
console.log(res);
|
||||
console.log('count', res.count);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
$('#nameOfThePolicyInGPA').html(' - ' + res.policy_name.name);
|
||||
|
||||
if(res.count){
|
||||
|
||||
$('#emp_count').val(res.count)
|
||||
if(res.count === false){
|
||||
$("#btnGPATermsSubmit").prop("disabled", true);
|
||||
$("#btnGPATermsSubmit").hide();
|
||||
}else{
|
||||
$("#btnGPATermsSubmit").prop("disabled", false);
|
||||
$("#btnGPATermsSubmit").show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (res) {
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGridSubmit">Submit</button>
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGridSubmit_2">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -598,6 +598,14 @@
|
||||
|
||||
$('#nameOfThePolicy').html(' - ' + res.policy_name);
|
||||
$('#grid_emp_count').val(res.count);
|
||||
|
||||
if(res.count == false){
|
||||
console.log('count -- 2', res.count);
|
||||
$("#btnGridSubmit_2").hide();
|
||||
}else{
|
||||
$("#btnGridSubmit_2").show();
|
||||
console.log('count -- ', res.count);
|
||||
}
|
||||
|
||||
if (res.status === false) {
|
||||
toastr.error(res.status);
|
||||
@ -714,6 +722,14 @@
|
||||
|
||||
$('#nameOfThePolicy').html(' - ' + res.policy_name);
|
||||
$('#grid_emp_count').val(res.count);
|
||||
|
||||
if(res.count == false){
|
||||
console.log('count -- 2', res.count);
|
||||
$("#btnGridSubmit_2").hide();
|
||||
}else{
|
||||
$("#btnGridSubmit_2").show();
|
||||
console.log('count -- ', res.count);
|
||||
}
|
||||
|
||||
if (res.status === false) {
|
||||
toastr.error(res.status);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user