fixed some bugs
This commit is contained in:
@@ -301,8 +301,7 @@ include('parsedatachart.php');
|
||||
|
||||
?>
|
||||
<div class="form-group">
|
||||
<label for="productsRefnumber">Product Ref Number</label>
|
||||
<br>
|
||||
<label for="productsRefnumber">Product Ref Number</label>
|
||||
<select id="productsRefnumber" class="form-control select2" multiple>
|
||||
|
||||
<?php foreach ($refNumbers as $refNumber): ?>
|
||||
@@ -312,8 +311,7 @@ include('parsedatachart.php');
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="productsSeason">Product Season</label>
|
||||
<br>
|
||||
<label for="productsSeason">Product Season</label>
|
||||
<select id="productsSeason" class="form-control select2" multiple>
|
||||
<?php foreach ($productsSeasons as $productSeason): ?>
|
||||
<option value="<?php echo $productSeason['season']; ?>"><?php echo $productSeason['season']; ?></option>
|
||||
@@ -322,8 +320,7 @@ include('parsedatachart.php');
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="ageRange">Age Range</label>
|
||||
<br>
|
||||
<label for="ageRange">Age Range</label>
|
||||
<select id="ageRange" class="form-control select2" multiple>
|
||||
<?php foreach ($ageRange as $age): ?>
|
||||
<option value="<?php echo $age['ageRange']; ?>"><?php echo $age['ageRange']; ?></option>
|
||||
@@ -332,8 +329,7 @@ include('parsedatachart.php');
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="reportsLabName">Lab Name</label>
|
||||
<br>
|
||||
<label for="reportsLabName">Lab Name</label>
|
||||
<select id="reportsLabName" class="form-control select2" multiple>
|
||||
<?php foreach ($labName as $lab): ?>
|
||||
<option value="<?php echo $lab['labName']; ?>"><?php echo $lab['labName']; ?></option>
|
||||
@@ -342,8 +338,7 @@ include('parsedatachart.php');
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="reportsTestType">Tes Type</label>
|
||||
<br>
|
||||
<label for="reportsTestType">Tes Type</label>
|
||||
<select id="reportsTestType" class="form-control select2" multiple>
|
||||
<?php foreach ($tesType as $test): ?>
|
||||
<option value="<?php echo $test['tesType']; ?>"><?php echo $test['tesType']; ?></option>
|
||||
@@ -352,8 +347,7 @@ include('parsedatachart.php');
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="reportsNumberLab">Report Number</label>
|
||||
<br>
|
||||
<label for="reportsNumberLab">Report Number</label>
|
||||
<select id="reportsNumberLab" class="form-control select2" multiple>
|
||||
<?php foreach ($numberLabs as $number): ?>
|
||||
<option value="<?php echo $number['reportNumber']; ?>"><?php echo $number['reportNumber']; ?></option>
|
||||
@@ -378,15 +372,28 @@ include('parsedatachart.php');
|
||||
$('.select2').on('change', function() {
|
||||
updateActiveFilters();
|
||||
});
|
||||
|
||||
$('#startDate, #endDate').on('change', function() {
|
||||
updateActiveFilters();
|
||||
});
|
||||
|
||||
function updateActiveFilters() {
|
||||
let activeFilters = [];
|
||||
$('.select2').each(function() {
|
||||
const selectedValues = $(this).val();
|
||||
if (selectedValues) {
|
||||
activeFilters.push(`${$(this).prev('label').text()}: ${selectedValues.join(', ')}`);
|
||||
// activeFilters with values
|
||||
// activeFilters.push(`${$(this).prev('label').text()}: ${selectedValues.join(', ')}`);
|
||||
// activefilters without values
|
||||
activeFilters.push($(this).prev('label').text());
|
||||
}
|
||||
});
|
||||
$('#startDate, #endDate').each(function(){
|
||||
const selectedValue = $(this).val();
|
||||
if(selectedValue){
|
||||
activeFilters.push($(this).prev('label').text());
|
||||
}
|
||||
})
|
||||
|
||||
$('#activeFilters').html(activeFilters.map(f => `<span class="badge badge-info mr-1">${f} <button class="close" onclick="removeFilter('${f}')">×</button></span>`).join(''));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user