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
|
-- Table structure for auth_chart_order
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `auth_chart_order`;
|
DROP TABLE IF EXISTS `chart_order`;
|
||||||
CREATE TABLE `auth_chart_order` (
|
CREATE TABLE `chart_order` (
|
||||||
`id` int NOT NULL,
|
`id` int NOT NULL,
|
||||||
`user_id` int NULL DEFAULT NULL,
|
`user_id` int NULL DEFAULT NULL,
|
||||||
`order` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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'];
|
$order = $_POST['order'];
|
||||||
$user_id = $iduserlogin;
|
$user_id = $iduserlogin;
|
||||||
// check if user already have order
|
// 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);
|
$result = $conn->query($sql);
|
||||||
$order = implode(',', $order);
|
$order = implode(',', $order);
|
||||||
if ($result->num_rows > 0) {
|
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 {
|
} 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);
|
$conn->query($sql);
|
||||||
echo 'Data saved';
|
echo 'Data saved';
|
||||||
} else if($_POST['method'] == 'load') {
|
} 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);
|
$result = $conn->query($sql);
|
||||||
if($result->num_rows == 0) {
|
if($result->num_rows == 0) {
|
||||||
echo json_encode([]);
|
echo json_encode([]);
|
||||||
|
|||||||
@ -302,7 +302,6 @@ include('parsedatachart.php');
|
|||||||
?>
|
?>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="productsRefnumber">Product Ref Number</label>
|
<label for="productsRefnumber">Product Ref Number</label>
|
||||||
<br>
|
|
||||||
<select id="productsRefnumber" class="form-control select2" multiple>
|
<select id="productsRefnumber" class="form-control select2" multiple>
|
||||||
|
|
||||||
<?php foreach ($refNumbers as $refNumber): ?>
|
<?php foreach ($refNumbers as $refNumber): ?>
|
||||||
@ -313,7 +312,6 @@ include('parsedatachart.php');
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="productsSeason">Product Season</label>
|
<label for="productsSeason">Product Season</label>
|
||||||
<br>
|
|
||||||
<select id="productsSeason" class="form-control select2" multiple>
|
<select id="productsSeason" class="form-control select2" multiple>
|
||||||
<?php foreach ($productsSeasons as $productSeason): ?>
|
<?php foreach ($productsSeasons as $productSeason): ?>
|
||||||
<option value="<?php echo $productSeason['season']; ?>"><?php echo $productSeason['season']; ?></option>
|
<option value="<?php echo $productSeason['season']; ?>"><?php echo $productSeason['season']; ?></option>
|
||||||
@ -323,7 +321,6 @@ include('parsedatachart.php');
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="ageRange">Age Range</label>
|
<label for="ageRange">Age Range</label>
|
||||||
<br>
|
|
||||||
<select id="ageRange" class="form-control select2" multiple>
|
<select id="ageRange" class="form-control select2" multiple>
|
||||||
<?php foreach ($ageRange as $age): ?>
|
<?php foreach ($ageRange as $age): ?>
|
||||||
<option value="<?php echo $age['ageRange']; ?>"><?php echo $age['ageRange']; ?></option>
|
<option value="<?php echo $age['ageRange']; ?>"><?php echo $age['ageRange']; ?></option>
|
||||||
@ -333,7 +330,6 @@ include('parsedatachart.php');
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="reportsLabName">Lab Name</label>
|
<label for="reportsLabName">Lab Name</label>
|
||||||
<br>
|
|
||||||
<select id="reportsLabName" class="form-control select2" multiple>
|
<select id="reportsLabName" class="form-control select2" multiple>
|
||||||
<?php foreach ($labName as $lab): ?>
|
<?php foreach ($labName as $lab): ?>
|
||||||
<option value="<?php echo $lab['labName']; ?>"><?php echo $lab['labName']; ?></option>
|
<option value="<?php echo $lab['labName']; ?>"><?php echo $lab['labName']; ?></option>
|
||||||
@ -343,7 +339,6 @@ include('parsedatachart.php');
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="reportsTestType">Tes Type</label>
|
<label for="reportsTestType">Tes Type</label>
|
||||||
<br>
|
|
||||||
<select id="reportsTestType" class="form-control select2" multiple>
|
<select id="reportsTestType" class="form-control select2" multiple>
|
||||||
<?php foreach ($tesType as $test): ?>
|
<?php foreach ($tesType as $test): ?>
|
||||||
<option value="<?php echo $test['tesType']; ?>"><?php echo $test['tesType']; ?></option>
|
<option value="<?php echo $test['tesType']; ?>"><?php echo $test['tesType']; ?></option>
|
||||||
@ -353,7 +348,6 @@ include('parsedatachart.php');
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="reportsNumberLab">Report Number</label>
|
<label for="reportsNumberLab">Report Number</label>
|
||||||
<br>
|
|
||||||
<select id="reportsNumberLab" class="form-control select2" multiple>
|
<select id="reportsNumberLab" class="form-control select2" multiple>
|
||||||
<?php foreach ($numberLabs as $number): ?>
|
<?php foreach ($numberLabs as $number): ?>
|
||||||
<option value="<?php echo $number['reportNumber']; ?>"><?php echo $number['reportNumber']; ?></option>
|
<option value="<?php echo $number['reportNumber']; ?>"><?php echo $number['reportNumber']; ?></option>
|
||||||
@ -379,14 +373,27 @@ include('parsedatachart.php');
|
|||||||
updateActiveFilters();
|
updateActiveFilters();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#startDate, #endDate').on('change', function() {
|
||||||
|
updateActiveFilters();
|
||||||
|
});
|
||||||
|
|
||||||
function updateActiveFilters() {
|
function updateActiveFilters() {
|
||||||
let activeFilters = [];
|
let activeFilters = [];
|
||||||
$('.select2').each(function() {
|
$('.select2').each(function() {
|
||||||
const selectedValues = $(this).val();
|
const selectedValues = $(this).val();
|
||||||
if (selectedValues) {
|
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(''));
|
$('#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