fixed some bugs
This commit is contained in:
parent
b9ee06121a
commit
fa21ab59ea
@ -20,8 +20,8 @@ SET FOREIGN_KEY_CHECKS = 0;
|
||||
-- ----------------------------
|
||||
-- Table structure for auth_chart_order
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `auth_chart_order`;
|
||||
CREATE TABLE `auth_chart_order` (
|
||||
DROP TABLE IF EXISTS `chart_order`;
|
||||
CREATE TABLE `chart_order` (
|
||||
`id` int NOT NULL,
|
||||
`user_id` int NULL DEFAULT NULL,
|
||||
`order` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
|
||||
@ -14,18 +14,18 @@ if ($_POST['method'] == 'save') {
|
||||
$order = $_POST['order'];
|
||||
$user_id = $iduserlogin;
|
||||
// check if user already have order
|
||||
$sql = "SELECT * FROM auth_chart_order WHERE user_id = $user_id";
|
||||
$sql = "SELECT * FROM chart_order WHERE user_id = $user_id";
|
||||
$result = $conn->query($sql);
|
||||
$order = implode(',', $order);
|
||||
if ($result->num_rows > 0) {
|
||||
$sql = "UPDATE auth_chart_order SET `order` = '$order' WHERE user_id = $user_id";
|
||||
$sql = "UPDATE chart_order SET `order` = '$order' WHERE user_id = $user_id";
|
||||
} else {
|
||||
$sql = "INSERT INTO auth_chart_order (user_id, `order`) VALUES ($user_id, '$order')";
|
||||
$sql = "INSERT INTO chart_order (user_id, `order`) VALUES ($user_id, '$order')";
|
||||
}
|
||||
$conn->query($sql);
|
||||
echo 'Data saved';
|
||||
} else if($_POST['method'] == 'load') {
|
||||
$sql = "SELECT `order` FROM auth_chart_order WHERE user_id = $iduserlogin ORDER BY insert_date DESC LIMIT 1";
|
||||
$sql = "SELECT `order` FROM chart_order WHERE user_id = $iduserlogin ORDER BY insert_date DESC LIMIT 1";
|
||||
$result = $conn->query($sql);
|
||||
if($result->num_rows == 0) {
|
||||
echo json_encode([]);
|
||||
|
||||
@ -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(''));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user