CHANGE_NORMAL_DROPDOWN_TO_SEARCHABLE_DROPDOWN : RV

This commit is contained in:
VENKATESHWARAN 2024-04-12 09:44:37 +05:30
parent a43394eb6e
commit 0cdd853d86
15 changed files with 292 additions and 145 deletions

View File

@ -196,7 +196,8 @@ class ClientController extends AdminController
$subTypeOptions = [ $subTypeOptions = [
1 => 'Deposit', 1 => 'Deposit',
2 => 'Adjustment', 2 => 'Adjustment',
3 => 'Deletion', 3 => 'Refund',
4 => 'Debit',
// Add more options as needed // Add more options as needed
]; ];
$data['subTypeOptions'] = $subTypeOptions; $data['subTypeOptions'] = $subTypeOptions;
@ -970,7 +971,7 @@ class ClientController extends AdminController
->where("employees.emp_status",'active') ->where("employees.emp_status",'active')
->countAllResults(); ->countAllResults();
if($emp_count = 0){ if($emp_count == 0){
$emp_count = true; $emp_count = true;
}else{ }else{
$emp_count = false; $emp_count = false;
@ -1252,7 +1253,7 @@ class ClientController extends AdminController
->where("employees.emp_status",'active') ->where("employees.emp_status",'active')
->countAllResults(); ->countAllResults();
if($emp_count = 0){ if($emp_count == 0){
$emp_count = true; $emp_count = true;
}else{ }else{
$emp_count = false; $emp_count = false;

View File

@ -22,7 +22,8 @@ use App\Models\ClientDepositModel;
use App\Controllers\Jobs ; use App\Controllers\Jobs ;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx; // use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
class EmpDataServiceController extends BaseController class EmpDataServiceController extends BaseController
{ {
@ -122,9 +123,27 @@ class EmpDataServiceController extends BaseController
// Define headers for the Excel file // Define headers for the Excel file
$headers = [ $headers = [
'S.No', 'NAME OF EMP/DEP', 'EMP ID', 'EMP/DEP TYPE', 'RELATION', 'DOB', 'GENDER', 'PRE EXISTING AILMENTS', 'S.No',
'BASIC COVER SI', 'DATE OF COVERAGE', 'AGE', 'RELATIONSHIP', 'REMARKS', 'POLICY END DATE', 'NO OF DAYS', 'TPA ID', 'UHID', 'NAME OF EMP/DEP',
'PREMIUM', 'PR0 RATA PREMIUM', 'GST', 'TOTAL' '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 // Generate Excel file
@ -450,6 +469,12 @@ class EmpDataServiceController extends BaseController
$client_policy_id = $import_data['client_policy_id']; $client_policy_id = $import_data['client_policy_id'];
$file = $import_data['file']; $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'); $is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
$filename = $file->getName(); $filename = $file->getName();
@ -947,7 +972,7 @@ class EmpDataServiceController extends BaseController
$data = [ $data = [
'amount' => $amount->total_sum, 'amount' => $amount->total_sum,
'sub_type_id' => 1, 'sub_type_id' => 4,
'client_id' => $arrayData['client_id'], 'client_id' => $arrayData['client_id'],
'insurer_id' => $insurer_id['insurer_id'], 'insurer_id' => $insurer_id['insurer_id'],
'description' => $description, 'description' => $description,
@ -986,7 +1011,7 @@ class EmpDataServiceController extends BaseController
$data = [ $data = [
'amount' => $amount->total_sum, 'amount' => $amount->total_sum,
'sub_type_id' => 1, 'sub_type_id' => 4,
'client_id' => $arrayData['client_id'], 'client_id' => $arrayData['client_id'],
'insurer_id' => $insurer_id['insurer_id'], 'insurer_id' => $insurer_id['insurer_id'],
'description' => $description, 'description' => $description,
@ -1027,7 +1052,7 @@ class EmpDataServiceController extends BaseController
$data = [ $data = [
'amount' => $amount->total_sum, 'amount' => $amount->total_sum,
'sub_type_id' => 1, 'sub_type_id' => 3,
'client_id' => $arrayData['client_id'], 'client_id' => $arrayData['client_id'],
'insurer_id' => $insurer_id['insurer_id'], 'insurer_id' => $insurer_id['insurer_id'],
'description' => $description, '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;
}
}
} }

View File

@ -268,39 +268,25 @@ if (! function_exists('transform_objects_to_array_for_deletion')) {
if (!function_exists('add_totals_row')) { if (!function_exists('add_totals_row')) {
function add_totals_row(Spreadsheet $spreadsheet, array $data, array $headers) function add_totals_row(Spreadsheet $spreadsheet, array $data)
{ {
//find the index value
$rata = array_search('PRO RATA PREMIUM', $headers);
$gst = array_search('GST', $headers);
$total = array_search('TOTAL', $headers);
// Calculate GST, Pro Rata Premium, and Total sums // Calculate GST, Pro Rata Premium, and Total sums
$gstSum = 0; $gstSum = 0;
$proRataPremiumSum = 0; $proRataPremiumSum = 0;
$totalSum = 0; $totalSum = 0;
foreach ($data as $row) { foreach ($data as $row) {
$gstSum += $row[$gst]; $gstSum += $row[18];
$proRataPremiumSum += $row[$rata]; $proRataPremiumSum += $row[19];
$totalSum += $row[$total]; $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 // Add a new row with sums
$lastRow = count($data) + 1; // To get the last row number $lastRow = count($data) + 1; // To get the last row number
$spreadsheet->getActiveSheet()->setCellValue($cellValueTotal . ($lastRow + 1), 'TOTALS'); $spreadsheet->getActiveSheet()->setCellValue('R' . ($lastRow + 1), 'TOTALS');
$spreadsheet->getActiveSheet()->setCellValue($cellValueRata . ($lastRow + 1), $proRataPremiumSum); $spreadsheet->getActiveSheet()->setCellValue('S' . ($lastRow + 1), $gstSum);
$spreadsheet->getActiveSheet()->setCellValue($cellValueGST . ($lastRow + 1), $gstSum); $spreadsheet->getActiveSheet()->setCellValue('T' . ($lastRow + 1), $proRataPremiumSum);
$spreadsheet->getActiveSheet()->setCellValue($cellValueTotalSum . ($lastRow + 1), $totalSum); $spreadsheet->getActiveSheet()->setCellValue('U' . ($lastRow + 1), $totalSum);
} }
} }

View File

@ -80,6 +80,7 @@ class ClientPolicyModel extends Model
->join('policies', 'policies.id = client_policy.policy_id') ->join('policies', 'policies.id = client_policy.policy_id')
->join('policy_type', 'policy_type.id = policies.policy_type_id') ->join('policy_type', 'policy_type.id = policies.policy_type_id')
->where('client_policy.client_id', $client_id) ->where('client_policy.client_id', $client_id)
->orderBy('client_policy.id', 'asc')
->get() ->get()
->getResult(); ->getResult();

View File

@ -136,6 +136,14 @@
var policy_PrimaryKey = $('#client_id_policy').val(); var policy_PrimaryKey = $('#client_id_policy').val();
var policy_client = $('#policy_PrimaryKey').val(); var policy_client = $('#policy_PrimaryKey').val();
$(document).ready(function() {
// Initialize select2
$("#insurer").select2();
$("#policy").select2();
$("#tpa").select2();
$("#base_policy").select2();
});
$(document).ready(function() { $(document).ready(function() {
$('#policy_status_field').hide() $('#policy_status_field').hide()
@ -398,53 +406,57 @@ $("#policy_form").submit(function(event) {
}); });
}); });
/********* To get th POLICY base on Insurer *******/ $(document).ready(function() {
$('#insurer').change(function() { /********* To get th POLICY base on Insurer *******/
var id = $(this).val(); $('#insurer').change(function() {
var parts = id.split('-'); var id = $(this).val();
var secondPart = parts[1]; var parts = id.split('-');
var url = "<?= base_url("util/police-by-insurer/") ?>" + secondPart; var secondPart = parts[1];
var url = "<?= base_url("util/police-by-insurer/") ?>" + secondPart;
$.get(url, function(res) { $.get(url, function(res) {
// res = JSON.parse(res)// // res = JSON.parse(res)//
// console.log(res) // console.log(res)
var OptionsHTML = ''; var OptionsHTML = '';
OptionsHTML += '<option value="" selected>Select Policy</option>'; OptionsHTML += '<option value="" selected>Select Policy</option>';
$.each(res.data, function(index, item) { $.each(res.data, function(index, item) {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id + OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id +
'">' + item.name + '</option>'; '">' + 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 *******/ $(document).ready(function() {
$('#policy').change(function() { /********* set the Policy_Type_id for Form Submit *******/
$('#policy').change(function() {
var id = $(this).val(); var id = $(this).val();
var dataId = $(this).children('option:selected').attr('data-id'); var dataId = $(this).children('option:selected').attr('data-id');
console.log('id', id) console.log('id', id)
$('#policy_type_id').val(dataId); $('#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 // get the client policy data for edit
@ -482,9 +494,11 @@ $('body').on('click', '.btnPolicyEdit', function() {
$('.btnBack').show(); $('.btnBack').show();
$('.btnAdd').hide(); $('.btnAdd').hide();
$('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id); $('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id).change();
$('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id); $('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id).change();
$('#policy').val(res.data.policy_id); $('#policy').val(res.data.policy_id).change();
$('#policy_type_id').val(res.data.policy_type_id); $('#policy_type_id').val(res.data.policy_type_id);
$('#policy_PrimaryKey').val(res.data.id); $('#policy_PrimaryKey').val(res.data.id);
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date)); $('#start_date').val(rearrangeDateFormat(res.data.policy_start_date));
@ -529,6 +543,11 @@ $('body').on('click', '.btnPolicyEdit', function() {
} }
}); });
$('#base_policy').html(OptionsHTML); $('#base_policy').html(OptionsHTML);
setTimeout(function() {
$('#policy').val(res.data.policy_id).change();
$('#base_policy').change();
}, 1000);
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error(xhr.responseText); console.error(xhr.responseText);

View File

@ -75,6 +75,17 @@ table.dataTable tbody td {
<div id="loader" class="loader" style="display:none;">SPINNER</div> <div id="loader" class="loader" style="display:none;">SPINNER</div>
<script> <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 // Declare a global variable to store API response data
var clientPolicies = []; var clientPolicies = [];
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>'; 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() { // Check if the selected option exists in apiData
var selectedClient = $(this).val(); var foundPolicies = clientPolicies.find(function(item) {
console.log(selectedClient); return item.id === selectedClient;
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption); });
console.log(foundPolicies.policies);
// Check if the selected option exists in apiData appendPolicies(foundPolicies.policies);
var foundPolicies = clientPolicies.find(function(item) {
return item.id === selectedClient;
}); });
console.log(foundPolicies.policies);
appendPolicies(foundPolicies.policies);
}); });

View File

@ -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="tab-pane fade active show" id="general-q-tab">
<div class="row"> <div class="row">
@ -20,7 +13,8 @@
<div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion1"> <div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion1">
<div class="card-body"> <div class="card-body">
<!-- <div class="text-center"> --> <!-- <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() ?>" <input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>"
id="csrf_token"> id="csrf_token">
@ -85,12 +79,14 @@
</div> </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;"> <div class="form-group col-md-4" style="margin-top: 18px;">
<a class="btn btn-primary waves-effect waves-light justify-content-end" <a class="btn btn-primary waves-effect waves-light justify-content-end"
id="fetch_enrolled_data" data-toggle="modal" data-target="#full-width-modal" id="fetch_enrolled_data" data-toggle="modal"
title="Download Sample Excel">Featch Enrolled Data</a> data-target="#full-width-modal" title="Download Sample Excel">Featch
Enrolled Data</a>
</div> </div>
@ -155,6 +151,12 @@
<script> <script>
$('#file_upload').hide(); $('#file_upload').hide();
$(document).ready(function() {
// Initialize select2
$("#client_id").select2();
$("#policy_id").select2();
});
// Declare a global variable to store API response data // Declare a global variable to store API response data
var clientPolicies = []; var clientPolicies = [];
@ -472,17 +474,21 @@ function appendPolicies(data) {
}); });
} }
$('#client_id').on('change', function() { $(document).ready(function() {
var selectedClient = $(this).val();
console.log(selectedClient);
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
// Check if the selected option exists in apiData $('#client_id').on('change', function() {
var foundPolicies = clientPolicies.find(function(item) { var selectedClient = $(this).val();
return item.id === selectedClient; 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 // Function to convert object to query parameters
@ -567,7 +573,7 @@ document.getElementById('toggleIcon1').addEventListener('click', function() {
icon.classList.toggle('mdi-chevron-up'); icon.classList.toggle('mdi-chevron-up');
}); });
$('#fetch_enrolled_data').click(function(){ $('#fetch_enrolled_data').click(function() {
$('#emp_data').empty(); $('#emp_data').empty();
var client_id = $('#client_id').val(); var client_id = $('#client_id').val();
@ -592,11 +598,11 @@ $('#fetch_enrolled_data').click(function(){
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').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) console.log(uri)
$.ajax({ $.ajax({
url:uri, url: uri,
data: { data: {
client_id: client_id, client_id: client_id,
policy_id: policy_id policy_id: policy_id
@ -624,7 +630,7 @@ $('#fetch_enrolled_data').click(function(){
setTimeout(function() { setTimeout(function() {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something went wrong', 'Warning'); toastr.warning('Something went wrong', 'Warning');
}, 1000); }, 1000);
} }

View File

@ -173,6 +173,13 @@ table.dataTable tbody td {
<script> <script>
$(document).ready(function() {
// Initialize select2
$("#clients").select2();
$("#policies").select2();
});
// Declare a global variable to store API response data // Declare a global variable to store API response data
var clientPolicies = []; var clientPolicies = [];
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>'; var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
@ -274,17 +281,21 @@ function appendPolicies(data) {
}); });
} }
$('#clients').on('change', function() { $(document).ready(function() {
var selectedClient = $(this).val();
console.log(selectedClient);
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
// Check if the selected option exists in apiData $('#clients').on('change', function() {
var foundPolicies = clientPolicies.find(function(item) { var selectedClient = $(this).val();
return item.id === selectedClient; 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 // Function to convert object to query parameters

View File

@ -134,6 +134,14 @@
<script> <script>
$(document).ready(function() {
// Initialize select2
$("#client").select2();
$("#policy").select2();
});
// Declare a global variable to store API response data // Declare a global variable to store API response data
var clientPolicies = []; var clientPolicies = [];
@ -288,6 +296,8 @@ function appendPolicies2(data) {
}); });
} }
$(document).ready(function() {
$('#client').on('change', function() { $('#client').on('change', function() {
var selectedClient = $(this).val(); var selectedClient = $(this).val();
console.log(selectedClient); console.log(selectedClient);
@ -301,6 +311,8 @@ $('#client').on('change', function() {
appendPolicies2(foundPolicies.policies); appendPolicies2(foundPolicies.policies);
}); });
});
// Function to convert object to query parameters // Function to convert object to query parameters
function objectToQueryString2(obj) { function objectToQueryString2(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('&');

View File

@ -496,6 +496,8 @@
<!-- Jodit Js --> <!-- Jodit Js -->
<script src="<?= base_url()."public"; ?>/assets/js/jodit.min.js"></script> <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>

View File

@ -50,6 +50,9 @@
<!-- Sweet Alert CDN --> <!-- Sweet Alert CDN -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.10.4/dist/sweetalert2.all.min.js"></script> <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"> <link rel="manifest" href="../manifest.json">
@ -215,6 +218,20 @@
</style> </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> <script>
$(window).on('load', function() { $(window).on('load', function() {
setTimeout(function() { setTimeout(function() {

View File

@ -69,6 +69,11 @@
<script> <script>
$(document).ready(function() {
$("#insurer_id").select2();
});
$(document).ready(function () { $(document).ready(function () {
var policy_type_PrimaryKey = $('#policy_type_id').val(); var policy_type_PrimaryKey = $('#policy_type_id').val();
@ -288,7 +293,7 @@ $(document).ready(function () {
$('#branch_table').hide(); $('#branch_table').hide();
$('.btnBack').show(); $('.btnBack').show();
$('#btnBranchAdd').hide(); $('#btnBranchAdd').hide();
$('#insurer_id').val(res.policies.insurer_id); $('#insurer_id').val(res.policies.insurer_id).change();
$('#name').val(res.policies.name); $('#name').val(res.policies.name);
$('#policy_type_PrimaryKey').val(res.policies.id); $('#policy_type_PrimaryKey').val(res.policies.id);

View File

@ -495,19 +495,16 @@
</div> </div>
</div> </div>
<!-- <hr> --> <!-- <hr> -->
<!-- <div class="form-row" id="grid_content_input"> <!-- <div class="form-row" id="grid_content_input">
</div> --> </div> -->
<br>
</div> </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> <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> </div>
</form> </form>
</div> </div>
@ -660,7 +657,7 @@ var grid_html = '';
data: {client_policy_id: client_policy_id}, data: {client_policy_id: client_policy_id},
success: function(response) { success: function(response) {
console.log('response',response); console.log('response',response);
console.log('count', response.count);
setTimeout(function() { setTimeout(function() {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
@ -668,16 +665,23 @@ var grid_html = '';
$('#nameOfThePolicyInGMC').html(' - ' + response.policy_name.name); $('#nameOfThePolicyInGMC').html(' - ' + response.policy_name.name);
$('gmc_emp_count').val(response.count); $('gmc_emp_count').val(response.count);
if(response.count){ console.log('count--1', response.count);
$('emp_count').val(response.count) $('emp_count').val(response.count)
if(response.count === false){ if (response && response.hasOwnProperty('count')) {
$("#btnGPATermsSubmit").prop("disabled", true); if (response.count === false) {
}else{ console.log('count -- 2', response.count);
$("#btnGPATermsSubmit").prop("disabled", false); 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) { if (response) {
let jsonObject = JSON.parse(response.data); let jsonObject = JSON.parse(response.data);

View File

@ -279,8 +279,7 @@
</div> </div>
</div> </div>
<br>
<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;">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGPATermsSubmit" style="margin-top: 100px;">Submit</button> <button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGPATermsSubmit" style="margin-top: 100px;">Submit</button>
</div> </div>
@ -464,22 +463,21 @@
success: function(res) { success: function(res) {
console.log(res); console.log(res);
console.log('count', res.count);
setTimeout(function() { setTimeout(function() {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
}, 1000); }, 1000);
$('#nameOfThePolicyInGPA').html(' - ' + res.policy_name.name); $('#nameOfThePolicyInGPA').html(' - ' + res.policy_name.name);
if(res.count){
$('#emp_count').val(res.count) $('#emp_count').val(res.count)
if(res.count === false){ if(res.count === false){
$("#btnGPATermsSubmit").prop("disabled", true); $("#btnGPATermsSubmit").hide();
}else{ }else{
$("#btnGPATermsSubmit").prop("disabled", false); $("#btnGPATermsSubmit").show();
} }
}
if (res) { if (res) {

View File

@ -33,7 +33,7 @@
</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">Submit</button> <button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGridSubmit_2">Submit</button>
</div> </div>
</form> </form>
</div> </div>
@ -599,6 +599,14 @@
$('#nameOfThePolicy').html(' - ' + res.policy_name); $('#nameOfThePolicy').html(' - ' + res.policy_name);
$('#grid_emp_count').val(res.count); $('#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) { if (res.status === false) {
toastr.error(res.status); toastr.error(res.status);
return; return;
@ -715,6 +723,14 @@
$('#nameOfThePolicy').html(' - ' + res.policy_name); $('#nameOfThePolicy').html(' - ' + res.policy_name);
$('#grid_emp_count').val(res.count); $('#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) { if (res.status === false) {
toastr.error(res.status); toastr.error(res.status);
return; return;