BBnepal-Accounts/application/views/admin/scholarship_multiple_fee.php
Sampanna Rimal 9cd05ef3cb commitall
2024-07-10 18:28:19 +05:45

855 lines
50 KiB
PHP

<style>
table.dataTable tfoot th {
font-weight: 600 !important;
}
.form-group .bootstrap-select>.dropdown-toggle {
padding: 9px 9px !important;
font-size: 12px !important;
border: 1px solid #c8c8c8 !important;
background: #fff !important;
}
.error {
color: red;
font-size: 12px;
}
input[type="number"] {
font-size: 14px;
border: 1px solid #858585;
border-radius: 4px;
color: #6b6b6b;
padding: 5px;
width: 160px;
}
table.dataTable tfoot th {
font-weight: 600 !important;
}
.form-group .bootstrap-select>.dropdown-toggle {
padding: 9px 9px !important;
font-size: 12px !important;
border: 1px solid #c8c8c8 !important;
background: #fff !important;
}
.course_grade_details_table input[type="text"] {
font-size: 14px;
border: 1px solid #858585;
border-radius: 4px;
color: #6b6b6b;
padding: 5px;
}
.course_grade_details_table input[type="number"] {
font-size: 14px;
border: 1px solid #858585;
border-radius: 4px;
color: #6b6b6b;
padding: 5px;
width: 90px;
}
.course_grade_details_table td,
.course_grade_details_table th {
border: 0;
padding: 15px 10px;
}
.course_grade_details_table {
border: 0;
}
.course_grade_details_table td {
text-align: left;
padding: 8px 10px;
}
.course_grade_details_table th {
font-weight: 300;
font-size: 15px;
color: black;
border-bottom: 2px solid #032da1;
}
.scrollable_table thead {
display: table;
width: 100%;
}
.scrollable_table tbody {
display: block;
overflow-y: scroll;
max-height: 400px;
}
.scrollable_table th,
.scrollable_table td {
width: 130px;
font-size: 12px;
}
.scrollable_table tr {
display: table;
width: 100%;
box-sizing: border-box;
}
.scrollable_table th:nth-child(1),
.scrollable_table td:nth-child(1) {
width: 42px;
}
span.margin-t {
margin-top: 5px;
display: block;
}
</style>
<div class="wraper responsive-width">
<main class="long-tbl-main" id="main">
<!-- admin template section -->
<div class="admin_tempblock">
<div class="admin_tempsec">
<div class="admin_sec">
<div class="from-group adding-class form-group_lng">
<a href="<?= base_url(); ?>admin/scholarship-types" class="">
<button type="button" class="btn subject_addbtn btn-sm">Scholarship Types</button>
</a>
</div>
<?php
if (!empty($this->session->flashdata('success_msg'))) { ?>
<div class="alert alert-success">
<a href="#" class="close" data-dismiss="alert">&times;</a>
<strong>Success!</strong> <?php echo $this->session->flashdata('success_msg'); ?>
</div>
<?php
}
if (!empty($this->session->flashdata('error_msg'))) {
?>
<div class="alert alert-danger">
<a href="#" class="close" data-dismiss="alert">&times;</a>
<strong>Failed!</strong> <?php echo $this->session->flashdata('error_msg'); ?>
</div>
<?php } ?>
<div class="subsec_sec" style="display:block">
<form id="searchFilters" action="<?= base_url(); ?>admin/scholarship" method="POST" onkeydown=" return event.key != 'Enter'">
<div class="subject_lsec dashboard_graph report_sec_graph">
<div class="report_sec_cover">
<div class="report_sec_left">
<?php
$f_f_types = array();
$currency_symbol = $school_info['currency_symbol'];
$search_batch = (isset($_POST['f_batch']) && !empty($_POST['f_batch'])) ? $_POST['f_batch'] : '';
$search_course_id = (isset($_POST['f_course']) && !empty($_POST['f_course'])) ? $_POST['f_course'] : '';
$search_section = (isset($_POST['f_section']) && !empty($_POST['f_section'])) ? $_POST['f_section'] : '';
$search_fee_types = (isset($_POST['filter_fee_types']) && !empty($_POST['filter_fee_types'])) ? $_POST['filter_fee_types'] : '';
$theExportHeader = 'Scholarships';
if (isset($school_info) && !empty($school_info)) {
$theExportHeader = $school_info['school_name'] . '\n' . $school_info['address'] . '\n Scholarships';
}
if (count($_POST) > 0) {
if (isset($_POST['filter_fee_types']) && !empty($_POST['filter_fee_types'])) {
$f_f_types = $_POST['filter_fee_types'];
}
}
// print_r($_POST);
?>
</div>
<div class="subject_lhead">Scholarships</div>
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-2">
<div class="subject-filter">
<label>Select Batch <span style="font-weight:bold;color:red;"> * </span></label>
<select id="f_batch" name="f_batch" class=" form-control">
<option value="">Select Batch</option>
<?php if (isset($batches) || !empty($batches)) {
foreach ($batches as $row) {
if ($search_batch != '')
$b_selected = ($row['id'] == $search_batch) ? 'selected' : '';
else
$b_selected = ($row['id'] == $school_info['batch_id']) ? 'selected' : '';
?>
<option value="<?php echo $row['id'] ?>" <?= $b_selected; ?>>
<?php echo $row['b_name']; ?></option>
<?php }
} ?>
</select>
<div class="text-danger cierr"><?php echo form_error('f_batch'); ?></div>
</div>
</div>
<div class="col-md-3">
<div class="subject-filter">
<label>Select Course <span style="font-weight:bold;color:red;"> * </span></label>
<select id="f_course" name="f_course" class=" form-control">
<option value="">Select Course</option>
<?php foreach ($course as $c_value) {
$course_selected = ($c_value['id'] == $search_course_id) ? 'selected' : '';
?>
<option value="<?= $c_value['id']; ?>" <?= $course_selected; ?>><?php echo $c_value['course_name']; ?> </option>
<?php } ?>
</select>
</div>
</div>
<div class="col-md-3">
<div class=" form-group subject-filter">
<label>Select Section</label>
<?php if ($search_course_id != '' && $search_course_id > 0) {
$sql = "SELECT s.id as section_id,s.section_name FROM course_sections cs JOIN section s ON s.id=cs.section_id WHERE cs.course_id='$search_course_id' ORDER BY s.id DESC";
$section_list = $this->Admin_model->get_query_result($sql);
?>
<select id="f_section" id="f_section" name="f_section[]" class=" form-control selectpicker" multiple>
<option value="" disabled>Select Section</option>
<?php
if (isset($section_list) && !empty($section_list)) {
foreach ($section_list as $se_val) { ?>
<option value="<?php echo $se_val['section_id'] ?>" <?php if (isset($search_section) && !empty($search_section)) {
echo (in_array($se_val['section_id'], $search_section)) ? 'selected' : '';
} ?>><?php echo $se_val['section_name'] ?></option>
<?php }
} ?>
</select>
<?php } else { ?>
<select id="f_section" id="f_section" name="f_section[]" class=" form-control selectpicker" multiple>
<option value="" disabled>Select Section</option>
</select>
<?php } ?>
</div>
</div>
<div class="col-md-3">
<div class="form-group assign_fee_toall mb-0">
<label class="mb-0" style="font-size: 13px;">Fees Type</label>
<?php if (!empty($all_fee_types) && count($all_fee_types) > 0) {
// var_dump($selected_feetype);
?>
<select placeholder="Select Fees type" name="filter_fee_types[]" id="filter_fee_types" class="form-control selectpicker" multiple data-live-search="true">
<option value="" disabled> -- Select Fees type -- </option>
<?php
foreach ($all_fee_types as $ft_value) {
$disableStatus = '';
if (count($selected_feetype) != 0) {
// if (in_array(8, $selected_fee_types)) {
// $disableStatus = '';
// } else {
// $disableStatus = 'disabled';
// }
// if ($ft_value['id'] == 8) {
// $disableStatus = '';
// } else {
// $disableStatus = 'disabled';
// }
}
?>
<option value="<?= $ft_value['id'] ?>" <?php echo (in_array($ft_value['id'], $f_f_types)) ? "selected" : ""; ?> <?= $disableStatus ?>><?= $ft_value['feetype_name'] ?></option>
<?php
} ?>
</select>
<label id="filter_fee_types-error" class="error" for="filter_fee_types"></label>
<?php
} else { ?>
<select placeholder="Select Fees type" name="filter_fee_types[]" id="filter_fee_types" class="form-control fees_type_list selectpicker" multiple>
<option value="" disabled> -- Select Fees type -- </option>
<?php
foreach ($all_fee_types as $ft_value) {
?>
<option value="<?= $ft_value['id'] ?>"><?= $ft_value['feetype_name'] ?></option>
<?php } ?>
</select>
<label id="filter_fee_types-error" class="error" for="filter_fee_types"></label>
<?php } ?>
<div class="text-danger cierr"><?php echo form_error('filter_fee_types'); ?></div>
</div>
</div>
<div class="col-md-3">
<div class="date-filter">
<input type="submit" name="filtersubmit" id="filter_reset1" class="btn subject_addbtn btn-sm " style="width:250px;height:40px;" value="Filter">
<a href="<?php echo base_url() ?>admin/total-due-report">
<div class="date-filter"> <button type="button" name="reset_filter" id="reset_filter" value="reset_filter" class="subject_addbtn subject_addbtn_nobg"><i class="fas fa-redo"></i>Reset</button>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- new divs added -->
<div class="tab-content">
<!-- new divs added -->
<div class="applicnts-list-wrap ">
<div class=" table_div">
<!-- changed ID -->
<table id="tbl1" class="display table-responsive">
<thead>
<tr>
<!-- <th>Roll No</th> -->
<th>Student Id </th>
<th>Student Name</th>
<th>Section</th>
<th class="col-md-3">Scholarship Type</th>
<?php
echo '<pre>';
// var_dump($selected_fee_types);
if (isset($selected_fee_types) && !empty($selected_fee_types)) {
if (isset($selected_fee_types) && !empty($selected_fee_types)) {
// Check if the fee type is trapnsport or monthly
$fees = json_decode($selected_fee_types[0]['fees_name']);
if (in_array(8, $f_f_types) || in_array(4, $f_f_types) || in_array(5, $f_f_types)) {
?>
<th class="col-md-3">
<?= in_array(5, $f_f_types) ? 'Select Exam' : 'Select Months' ?>
</th>
<th>
Scholarship
<label class="text-muted"> <?= in_array(5, $f_f_types) ? 'Exam Fee' : 'Monthly Fee' ?> = Rs. <?= $fees[0]->amount; ?>/- </label>
</th>
<?php
} else {
foreach ($selected_fee_types as $sftypes) {
?>
<th>
<?= $sftypes['fee_values']; ?><br>
<span class="text-muted h6"><?= $sftypes['amount']; ?></span>
</th>
<?php
}
}
}
}
?>
</tr>
</thead>
<tbody>
<?php
// echo '<pre>';
// var_dump($students);
$sno = 1;
if (isset($students) && !empty($students)) {
// echo '<pre>';
// print_r($students);
foreach ($students as $svalue) {
if ($svalue['scholarship'] != null) {
$scholarshipFee = $svalue['scholarship'];
}
?>
<tr>
<!-- <td><?= $svalue['roll_no']; ?></td> -->
<td><?= $svalue['studentId']; ?></td>
<td><?= $svalue['student_name']; ?></td>
<td><?= $svalue['section_name']; ?></td>
<!-- <td><?= $svalue['total_assigned_amount']; ?></td>-->
<td class="text-center col-md-3">
<?php
// echo '<pre>';
$sTypes = [];
if ($svalue['scholarship'] != null) {
foreach ($svalue['scholarship'] as $ss_value) {
if (isset($ss_value['scholarship_type']) && ($ss_value['scholarship_type'] != null)) {
array_push($sTypes, $ss_value['scholarship_type']);
}
}
$sTypes = array_unique($sTypes);
}
// var_dump($sTypes);
?>
<select id="s_type_<?= $svalue['student_id']; ?>" name="s_type[<?= $svalue['student_id']; ?>]" class=" form-control">
<option value="">Scholarship Type</option>
<?php foreach ($all_scholarship_types as $s_value) {
?>
<option value="<?= $s_value['id']; ?>" <?php if (count($sTypes) != 0) {
if ($sTypes[0] == $s_value['id']) {
echo 'selected';
}
}
?>>
<?= $s_value['scholarshiptype_name']; ?>
</option>
<?php } ?>
</select>
</td>
<?php
if (isset($selected_fee_types) && !empty($selected_fee_types)) {
if (in_array(8, $f_f_types) || in_array(4, $f_f_types) || in_array(5, $f_f_types)) {
// foreach ($selected_fee_types as $sftypes) {
// print_r($sftypes);
// }
$scholarshipFee = [];
if ($svalue['scholarship'] != null) {
// echo '<pre>'; var_dump($svalue['scholarship']);
$scholarshipFee = $svalue['scholarship'];
}
// var_dump($scholarshipFee);
?>
<th class="text-center col-md-3">
<?php
// var_dump($sftypes);
?>
<select id="f_selected_course_fee" name="f_selected_course_fee[<?= $svalue['student_id']; ?>][]" class=" form-control selectpicker" multiple>
<option value="" disabled> <?= in_array(5, $f_f_types) ? 'Select Exam' : 'Select Month' ?> </option>
<?php
foreach ($selected_fee_types as $sftypes) {
$isSelected = '';
$isDisabled = '';
$ssId = 0;
if ($svalue['scholarship'] != null) {
foreach ($svalue['scholarship'] as $ss_value) {
if ($sftypes['course_fee_id'] == $ss_value['course_fee_id']) {
$ssId = $ss_value['id'];
if ($ss_value['isPaymentMade'] != 0) {
$isDisabled = 'disabled';
} else {
$isDisabled = '';
}
$isSelected = 'selected';
}
}
}
?>
<!-- <input type="hidden" value="<?= $ssId ?>" /> -->
<option value="<?php echo $sftypes['course_fee_id'] ?>" <?= $isSelected ?> <?= $isDisabled ?>>
<?php
echo $sftypes['fee_values'] . ' - ' . $sftypes['course_fee_id'];
?>
</option>
<?php
// }
} ?>
</select>
</th>
<?php
$scholarShipAmountArray = [];
$scholarShipPercentageArray = [];
if (count($scholarshipFee) > 0) {
foreach ($scholarshipFee as $sf_key => $sf_value) {
var_dump($sf_value['scholarship_amount']);
array_push($scholarShipAmountArray, $sf_value['scholarship_amount']);
array_push($scholarShipPercentageArray, $sf_value['scholarship_discount']);
}
} else {
echo 'Not';
}
$scholarShipAmountArray = array_unique($scholarShipAmountArray);
$scholarShipPercentageArray = array_unique($scholarShipPercentageArray);
$scholarShipAmount = count($scholarShipAmountArray) > 0 ? $scholarShipAmountArray[0] : '';
$scholarShipPercentage = count($scholarShipPercentageArray) > 0 ? $scholarShipPercentageArray[0] : '';
?>
<th>
<!-- <input type="hidden" name="assignedFeeId[<?= $sftypes['fees_type']; ?>][<?= $svalue['student_id']; ?>]" value="<?= count($scholarshipFee) > 0 ? $scholarshipFee['id'] : '' ?>"> -->
<!-- <?php var_dump($scholarshipFee); ?> -->
<!-- <input type="number" name="assignedFeeId[<?= $sftypes['fees_type']; ?>][<?= $svalue['student_id']; ?>]" value="<?= isset($scholarshipFee['id']) ? $scholarshipFee['id'] : '' ?>"> -->
<input type="hidden" name="studentBatchId[<?= $sftypes['fees_type']; ?>][<?= $svalue['student_id']; ?>]" value="<?= $svalue['student_batch_id'] ?>">
<input type="hidden" name="courseFeeId[<?= $sftypes['fees_type']; ?>][<?= $svalue['student_id']; ?>]" value="<?= $sftypes['course_fee_id'] ?>">
<input type="hidden" name="feeType" value="<?= $sftypes['fees_type'] ?>">
<input type="number" onchange="perToAmount(this.value, 'scholarshipAmount[<?= $sftypes['fees_type']; ?>][<?= $svalue['student_id']; ?>]', <?= $sftypes['amount'] ?>, 's_type[<?= $svalue['student_id']; ?>]')" class="mb-2 w-100" min="0" max="100" name="scholarshipPercentage[<?= $sftypes['fees_type']; ?>][<?= $svalue['student_id']; ?>]" id='row_th_percentage_<?= $svalue['student_id'] ?>_<?= $sftypes['fees_type']; ?>' placeholder="In Percentage (%)" value=<?= $scholarShipPercentage ?> /><br />
<input class="w-100" type="number" onchange="amountToPer(this.value, 'scholarshipPercentage[<?= $sftypes['fees_type']; ?>][<?= $svalue['student_id']; ?>]', <?= $sftypes['amount'] ?>, 's_type[<?= $svalue['student_id']; ?>]')" min="0" max="<?= $sftypes['amount']; ?>" name="scholarshipAmount[<?= $sftypes['fees_type']; ?>][<?= $svalue['student_id']; ?>]" id='row_th_amount_<?= $svalue['student_id'] ?>_<?= $sftypes['fees_type']; ?>' placeholder="In Rs." value=<?= $scholarShipAmount ?> /><br />
</th>
<?php ?>
<?php
} else {
foreach ($selected_fee_types as $sftypes) {
?>
<th class="text-center col-md-2">
<?php
if ($scholarshipFee != null) {
?>
<input type="hidden" name="assignedFeeId[<?= $sftypes['fees_type']; ?>][<?= $svalue['student_id']; ?>]" value="<?= $scholarshipFee['id'] ?>">
<input type="hidden" name="studentBatchId[<?= $sftypes['fees_type']; ?>][<?= $svalue['student_id']; ?>]" value="<?= $svalue['student_batch_id'] ?>">
<input type="hidden" name="courseFeeId[<?= $sftypes['fees_type']; ?>][<?= $svalue['student_id']; ?>]" value="<?= $sftypes['course_fee_id'] ?>">
<input type="hidden" name="feeType" value="<?= $sftypes['fees_type'] ?>">
<input type="number" onchange="perToAmount(this.value, 'scholarshipAmount[<?= $sftypes['fees_type']; ?>][<?= $svalue['student_id']; ?>]', <?= $sftypes['amount'] ?>, 's_type[<?= $svalue['student_id']; ?>]')" class="mb-2 w-100" min="0" max="100" name="scholarshipPercentage[<?= $sftypes['fees_type']; ?>][<?= $svalue['student_id']; ?>]" id='row_th_percentage_<?= $svalue['student_id'] ?>_<?= $sftypes['fees_type']; ?>' placeholder="In Percentage (%)" value='<?= $scholarshipFee['scholarship_discount'] ?>' /><br />
<input class="w-100" type="number" onchange="amountToPer(this.value, 'scholarshipPercentage[<?= $sftypes['fees_type']; ?>][<?= $svalue['student_id']; ?>]', <?= $sftypes['amount'] ?>, 's_type[<?= $svalue['student_id']; ?>]')" min="0" max="<?= $sftypes['amount']; ?>" name="scholarshipAmount[<?= $sftypes['fees_type']; ?>][<?= $svalue['student_id']; ?>]" id='row_th_amount_<?= $svalue['student_id'] ?>_<?= $sftypes['fees_type']; ?>' placeholder="In Rs." value='<?= $scholarshipFee['scholarship_amount'] ?>' /><br />
<?php foreach ($all_scholarship_types as $s_key => $s_value) {
if ($s_value['id'] == $scholarshipFee['scholarship_type']) {
echo '<p class="text-left"><span class="text-danger font-weight-bold" style="font-size:16px">* </span><label class="small text-muted mt-1 font-weight-normal">' . $s_value['scholarshiptype_name'] . '</label></p>';
}
?>
<?php } ?>
<?php
} else {
?>
<h6 class="small text-muted">Fee Not Assigned</h6>
<?php
// echo 'Null';
}
?>
</th>
<?php
}
}
}
?>
</tr>
<?php
$sno++;
}
} ?>
</tbody>
</table>
<input type="submit" name="save" id="save_scholarship" class="btn subject_addbtn btn-sm " style="width:250px;height:40px;" value="Save">
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- admin template section end -->
</main>
<!--End right-top side-->
</div>
<script defer src="<?php echo base_url(); ?>assets_admin/js/bootstrap-select.min.js"></script>
<script>
// function formOnEnter() {
// $(this).next('input').focus();
// }
$('input').on("keydown", function(e) {
/* ENTER PRESSED*/
console.log(e.keyCode);
if (e.keyCode == 13) {
/* FOCUS ELEMENT */
var inputs = $(this).parents("form").eq(0).find(":input[type='number']");
var idx = inputs.index(this);
if (idx == inputs.length - 1) {
inputs[0].select()
} else {
inputs[idx + 1].focus(); // handles submit buttons
inputs[idx + 1].select();
}
e.preventDefault();
return false;
} else {
return true;
// e.preventDefault();
}
});
$('#save_scholarship').click(function() {
$('#searchFilters').submit();
});
// Reusable helper functions
const calculateSale = (feePrice, discount) => {
feePrice = parseFloat(feePrice);
discount = parseFloat(discount);
return (feePrice * discount / 100).toFixed(2); // Final price
}
const calculateDiscount = (feePrice, finalPrice) => {
feePrice = parseFloat(feePrice);
finalPrice = parseFloat(finalPrice);
return (finalPrice * 100 / feePrice).toFixed(2); // Discount percentage
}
function perToAmount(discount, scholarshipAmountFieldName, feeAmount, selectId) {
console.log(discount + ' =============> ' + scholarshipAmountFieldName);
$('input[name="' + scholarshipAmountFieldName + '"]').val(calculateSale(feeAmount, discount));
$('#' + selectId).attr('required', 'required');
// console.log(calculateSale(feeAmount, discount));
}
function amountToPer(amount, scholarshipPercentageName, feeAmount) {
// console.log(discount + ' =============> ' + scholarshipAmountFieldName);
$('input[name="' + scholarshipPercentageName + '"]').val(calculateDiscount(feeAmount, amount));
$('#' + selectId).attr('required', true);
// console.log(calculateSale(feeAmount, discount));
}
// $('input[name^="scholarshipPercentage"]').change(function(event) {
// $('input').attr('name', $('input').attr('name'))
// console.log($('input').attr('name'));
// // console.log(event.target);
// // $('input[name^="scholarshipPercentage"]').val(1000);
// var index = $('input[name^="scholarshipPercentage"]').index(this);
// studentId = $('input[name^="studentId"]').val();
// var totalFeeAmount = $('input[name^="totalFee"]').val();
// $('input[name^="scholarshipPercentage"]').each(function(index, elem) {
// console.log('Index = ' + index + 'Eleam =======> ');
// $('input[name="scholarshipAmount[' + index + ']"]', index).val(1000);
// console.log($('input[name^="scholarshipPercentage"]').is(':focus'));
// // $(".val2", elem).val(parseInt($(".val1", elem).val()) * parseInt($("#value").val()));
// });
// alert('Index =======> ' + index + ' Student Id =======> ' + studentId + ' Total Fee Amount =======> ' + totalFeeAmount);
// });
// Init!
// $totalFee.trigger('input');
</script>
<script>
// checkFeeType();
// $("#filter_fee_types option[value='3']").prop('disabled', true);
// $("#filter_fee_types option[value='4']").prop('disabled', true);
// $("#filter_fee_types option[value='8']").prop('disabled', true);
// const intersection = TotalValues.filter(element => selectedValues.includes(element));
// const differValues = TotalValues.filter(element => !selectedValues.includes(element));
function checkFeeType() {
}
$('#filter_fee_types').change(function() {
$('#filter_fee_types').selectpicker('toggle');
$('#new-dropdown-section').addClass('d-none');
var TotalValues = [];
var selectedValues = [];
$('#filter_fee_types option').each(function() {
let item = $(this).val();
if (item != '') {
TotalValues.push(item);
}
});
$('#filter_fee_types option:selected').each(function() {
let selectItem = $(this).val();
if (selectItem != '')
selectedValues.push(selectItem);
});
const intersection = TotalValues.filter(element => selectedValues.includes(element));
const differValues = TotalValues.filter(element => !selectedValues.includes(element));
// console.log(intersection);
// console.log(differValues);
if (intersection.length > 0) {
var divData1 = '';
if (intersection.includes("3") || intersection.includes("4") || intersection.includes("8")) {
for (let i = 0; i < intersection.length; i++) {
if (intersection[i] == '4') {
$.ajax({
url: "<?php echo base_url(); ?>Admin/get_routes_by_batch_course",
method: "GET",
dataType: "json",
success: function(res) {
// console.log(res.routes);
// #new-dropdown-section
$('#new-dropdown-section').removeClass('d-none');
divData1 += "<label class='mb-0' style='font-size: 13px;margin-bottom: 4px !important;'> Routes <span class='text-danger'></span></label><select class='form-control' name='filter-route-id' id='filter-route-id' >";
divData1 += "<option value='' disabled> Select Routes </option>";
if (res.routes != '') {
$.each(res.routes, function(i, routedata) {
// console.log(routedata.id+"="+routedata.route_name);
divData1 += "<option value='" + routedata.id + "'>" + routedata.route_name + "</option>";
});
}
// $('#course_error_msg').text();
else {
divData1 += "<option value=''> -- No Route's Found --</option>";
}
divData1 += "</select>"
$('#new-dropdown-section').empty().append(divData1);
}
});
} else if (intersection[i] == '3') {
} else if (intersection[i] == '8') {
}
for (let j = 0; j < differValues.length; j++) {
$("#filter_fee_types option[value='" + differValues[j] + "']").prop('disabled', true);
}
$("#filter_fee_types option[value='" + intersection[i] + "']").prop('disabled', false);
}
} else {
$("#filter_fee_types option[value='3']").prop('disabled', true);
$("#filter_fee_types option[value='4']").prop('disabled', true);
$("#filter_fee_types option[value='8']").prop('disabled', true);
}
} else {
$("#filter_fee_types option").prop('disabled', false);
}
});
$(document).ready(function() {
$("#searchFilters").validate({
rules: {
f_batch: 'required',
f_course: 'required',
"filter_fee_types[]": {
required: true
},
},
submitHandler: function(form, e) {
e.preventDefault();
form.submit();
}
});
});
$('#f_course').change(function() {
var course = $('#f_course option:selected').val();
// alert(course);
var divData = '';
if (course != '' && course != 0) {
$.ajax({
url: "<?php echo base_url(); ?>Admin/get_section_by_course",
method: "POST",
data: {
course_id: course
},
dataType: "json",
success: function(response) {
// console.log(response);
// section options code and start from here
divData += "<option value='' disabled> Select Section </option>";
if (response.sections != '') {
$.each(response.sections, function(i, sectiondata) {
divData += "<option value='" + sectiondata.section_id + "'>" + sectiondata.section_name + "</option>";
});
}
// $('#course_error_msg').text();
else {
divData += "<option value=''> -- No Section's Found --</option>";
}
$('#f_section').empty().append(divData).selectpicker("refresh");
// section options code here End from here
}
});
} else {
divData = "<option value=''> -- Select Section -- </option>";
$('#f_section').empty().append(divData);
}
});
$(document).ready(function() {
$('.user-drpdown').click(function() {
$('.drpdown-items').toggle();
});
var currency_symbol = "<?php echo $currency_symbol; ?>";
var jsTheExportHeader = '<?php echo $theExportHeader; ?>';
//table js
$('#tbl1').DataTable({
"lengthMenu": [
[-1],
["All"]
],
"dom": 'lBfrtip',
"buttons": []
});
//table js end
//multiple select js start
$('#f_section').selectpicker();
$('#f_feetype').selectpicker();
//multiple select js end
});
</script>
</body>
</html>