|
|
@ -47,9 +47,6 @@
|
|
|
|
justify-content: space-between;
|
|
|
|
justify-content: space-between;
|
|
|
|
width: 100%;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#date{
|
|
|
|
|
|
|
|
margin-top: 15px;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#user{
|
|
|
|
#user{
|
|
|
|
position: relative;
|
|
|
|
position: relative;
|
|
|
|
margin-left: 50px;
|
|
|
|
margin-left: 50px;
|
|
|
@ -120,14 +117,15 @@
|
|
|
|
<select id="secondaryDropdown"></select>
|
|
|
|
<select id="secondaryDropdown"></select>
|
|
|
|
<input type="hidden" name="secondaryOption" id="hiddenSecondaryOption">
|
|
|
|
<input type="hidden" name="secondaryOption" id="hiddenSecondaryOption">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="date">
|
|
|
|
|
|
|
|
<input type="date" id="datePicker" name="query" style="display: none;">
|
|
|
|
<div id="yearDropdownContainer" style="display: none;">
|
|
|
|
|
|
|
|
<select id="yearDropdown"></select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</form>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
//MODAL
|
|
|
|
|
|
|
|
// Get the modal
|
|
|
|
// Get the modal
|
|
|
|
var modal = document.getElementById("userModal");
|
|
|
|
var modal = document.getElementById("userModal");
|
|
|
|
// Get the button that opens the modal
|
|
|
|
// Get the button that opens the modal
|
|
|
@ -225,80 +223,41 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
$(document).ready(function() {
|
|
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
|
|
const userDeleted = urlParams.get('userDeleted');
|
|
|
|
const userDeleted = urlParams.get('userDeleted');
|
|
|
|
|
|
|
|
|
|
|
|
if (userDeleted === 'true') {
|
|
|
|
if (userDeleted === 'true') {
|
|
|
|
alert('Usuario Borrado');
|
|
|
|
alert('Usuario Borrado');
|
|
|
|
userDeleted === 'false';
|
|
|
|
userDeleted === 'false';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// Get reference to the date picker
|
|
|
|
|
|
|
|
var datePicker = document.getElementById('datePicker');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add an event listener to the date picker
|
|
|
|
|
|
|
|
datePicker.addEventListener('change', function() {
|
|
|
|
|
|
|
|
var searchBar = document.querySelector('input[name="query"]');
|
|
|
|
|
|
|
|
var secondaryOption = document.getElementById('secondaryDropdown').value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// If the selected option is 'Fecha antes', 'Fecha despues', or 'Año', set the value of the search bar to the value of the date picker
|
|
|
|
|
|
|
|
if (['Fecha antes', 'Fecha despues', 'Año'].includes(secondaryOption)) {
|
|
|
|
|
|
|
|
searchBar.value = datePicker.value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Log the value of the search bar to the console
|
|
|
|
|
|
|
|
//console.log("Query: " + searchBar.value);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
document.getElementById('searchForm').addEventListener('submit', function() {
|
|
|
|
document.getElementById('searchForm').addEventListener('submit', function() {
|
|
|
|
var searchOption = document.getElementById('searchOption').value;
|
|
|
|
var searchOption = document.getElementById('searchOption'); // Removed .value
|
|
|
|
var secondaryOption = document.getElementById('secondaryDropdown').value;
|
|
|
|
var secondaryOption = document.getElementById('secondaryDropdown').value;
|
|
|
|
var datePicker = document.getElementById('datePicker');
|
|
|
|
|
|
|
|
var searchBar = document.querySelector('input[name="query"]');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// If the selected option is 'Fecha antes', 'Fecha despues', or 'Año', set the value of the search bar to the value of the date picker
|
|
|
|
|
|
|
|
if (['Fecha antes', 'Fecha despues', 'Año'].includes(secondaryOption)) {
|
|
|
|
|
|
|
|
searchBar.value = datePicker.value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Update the value of the hidden input field
|
|
|
|
|
|
|
|
document.getElementById('hiddenSecondaryOption').value = secondaryOption;
|
|
|
|
document.getElementById('hiddenSecondaryOption').value = secondaryOption;
|
|
|
|
this.action = "/buscador/" + searchOption + "/page/1";
|
|
|
|
// Update the searchBar value to the selected year
|
|
|
|
|
|
|
|
if (secondaryOption === 'Año') {
|
|
|
|
|
|
|
|
searchBar.value = document.getElementById('yearDropdown').value;
|
|
|
|
|
|
|
|
console.log('searchBar.value after assignment: ', searchBar.value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.action = "/buscador/" + searchOption.value + "/page/1";
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// Get references to the primary dropdown, the search bar, and the secondary dropdown
|
|
|
|
|
|
|
|
var primaryDropdown = document.getElementById('searchOption');
|
|
|
|
var primaryDropdown = document.getElementById('searchOption');
|
|
|
|
var searchBar = document.querySelector('input[name="query"]');
|
|
|
|
var searchBar = document.querySelector('input[name="query"]');
|
|
|
|
var secondaryDropdown = document.getElementById('secondaryDropdown');
|
|
|
|
var secondaryDropdown = document.getElementById('secondaryDropdown');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
primaryDropdown.addEventListener('change', function() {
|
|
|
|
|
|
|
|
if (primaryDropdown.value === 'YourCondition') { // replace 'YourCondition' with the actual condition
|
|
|
|
|
|
|
|
secondaryDropdown.style.display = 'none';
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
secondaryDropdown.style.display = 'block';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
secondaryDropdown.addEventListener('change', function() {
|
|
|
|
secondaryDropdown.addEventListener('change', function() {
|
|
|
|
var datePicker = document.getElementById('datePicker');
|
|
|
|
if (secondaryDropdown.value === 'Todo') {
|
|
|
|
if (['Fecha antes', 'Fecha despues', 'Año'].includes(secondaryDropdown.value)) {
|
|
|
|
|
|
|
|
searchBar.value = '';
|
|
|
|
|
|
|
|
searchBar.disabled = true;
|
|
|
|
|
|
|
|
datePicker.style.display = 'block';
|
|
|
|
|
|
|
|
} else if (secondaryDropdown.value === 'Todo') {
|
|
|
|
|
|
|
|
searchBar.value = 'Todo';
|
|
|
|
searchBar.value = 'Todo';
|
|
|
|
searchBar.disabled = true;
|
|
|
|
searchBar.disabled = true;
|
|
|
|
datePicker.style.display = 'none';
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
searchBar.value = '';
|
|
|
|
searchBar.value = '';
|
|
|
|
searchBar.disabled = false;
|
|
|
|
searchBar.disabled = false;
|
|
|
|
datePicker.style.display = 'none';
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
primaryDropdown.addEventListener('change', function() {
|
|
|
|
primaryDropdown.addEventListener('change', function() {
|
|
|
|
// Clear the secondary dropdown
|
|
|
|
|
|
|
|
secondaryDropdown.innerHTML = '';
|
|
|
|
secondaryDropdown.innerHTML = '';
|
|
|
|
|
|
|
|
|
|
|
|
// Determine what to add to the secondary dropdown based on the selected option of the primary dropdown
|
|
|
|
// Determine what to add to the secondary dropdown based on the selected option of the primary dropdown
|
|
|
@ -314,7 +273,7 @@
|
|
|
|
options = ['Todo', 'Nombre', 'Empresa'];
|
|
|
|
options = ['Todo', 'Nombre', 'Empresa'];
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case'ofertas':
|
|
|
|
case'ofertas':
|
|
|
|
options = ['Todo', 'Nombre', 'Empresa','Fecha'];
|
|
|
|
options = ['Todo', 'Nombre', 'Empresa','Año'];
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case'sucursales':
|
|
|
|
case'sucursales':
|
|
|
|
options = ['Todo', 'Nombre', 'Empresa','Localidad'];
|
|
|
|
options = ['Todo', 'Nombre', 'Empresa','Localidad'];
|
|
|
@ -338,50 +297,6 @@
|
|
|
|
//console.log("Primary dropdown value: " + primaryDropdown.value); // Add this line
|
|
|
|
//console.log("Primary dropdown value: " + primaryDropdown.value); // Add this line
|
|
|
|
//console.log("Options to add to secondary dropdown: " + options); // Add this line
|
|
|
|
//console.log("Options to add to secondary dropdown: " + options); // Add this line
|
|
|
|
|
|
|
|
|
|
|
|
// Add the new options to the secondary dropdown
|
|
|
|
|
|
|
|
for (var i = 0; i < options.length; i++) {
|
|
|
|
|
|
|
|
var option = document.createElement('option');
|
|
|
|
|
|
|
|
option.text = options[i];
|
|
|
|
|
|
|
|
secondaryDropdown.add(option);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});// Add an event listener to the primary dropdown
|
|
|
|
|
|
|
|
primaryDropdown.addEventListener('change', function() {
|
|
|
|
|
|
|
|
// Clear the secondary dropdown
|
|
|
|
|
|
|
|
secondaryDropdown.innerHTML = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Determine what to add to the secondary dropdown based on the selected option of the primary dropdown
|
|
|
|
|
|
|
|
var options;
|
|
|
|
|
|
|
|
switch (primaryDropdown.value) {
|
|
|
|
|
|
|
|
case 'empresas':
|
|
|
|
|
|
|
|
options = ['Todo', 'Nombre', 'Sector','Keywords'];
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'sectores':
|
|
|
|
|
|
|
|
options = ['Todo'];
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'contactos':
|
|
|
|
|
|
|
|
options = ['Todo', 'Nombre', 'Empresa'];
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case'ofertas':
|
|
|
|
|
|
|
|
options = ['Todo', 'Nombre', 'Empresa','Fecha antes','Fecha despues','Año','Skill'];
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case'sucursales':
|
|
|
|
|
|
|
|
options = ['Todo', 'Nombre', 'Empresa','Localidad'];
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case'skills':
|
|
|
|
|
|
|
|
options = ['Todo'];
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case'familias':
|
|
|
|
|
|
|
|
options = ['Todo'];
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case'ciclos':
|
|
|
|
|
|
|
|
options = ['Todo','Familia','Codigo'];
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case'alumnos':
|
|
|
|
|
|
|
|
options = ['Todo', 'Nombre', 'Apellido','Ciclo','Keywords','Nia' ,'Dni'];
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
options = [];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add the new options to the secondary dropdown
|
|
|
|
// Add the new options to the secondary dropdown
|
|
|
|
for (var i = 0; i < options.length; i++) {
|
|
|
|
for (var i = 0; i < options.length; i++) {
|
|
|
|
var option = document.createElement('option');
|
|
|
|
var option = document.createElement('option');
|
|
|
@ -389,40 +304,74 @@
|
|
|
|
secondaryDropdown.add(option);
|
|
|
|
secondaryDropdown.add(option);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Trigger the change event manually to populate the secondary dropdown when the page loads
|
|
|
|
|
|
|
|
primaryDropdown.dispatchEvent(new Event('change'));
|
|
|
|
primaryDropdown.dispatchEvent(new Event('change'));
|
|
|
|
|
|
|
|
|
|
|
|
// Reset the form
|
|
|
|
|
|
|
|
document.querySelector('form').reset();
|
|
|
|
document.querySelector('form').reset();
|
|
|
|
|
|
|
|
|
|
|
|
// Set the value of the search bar to "Todo" and disable it
|
|
|
|
|
|
|
|
searchBar.value = 'Todo';
|
|
|
|
searchBar.value = 'Todo';
|
|
|
|
searchBar.disabled = true;
|
|
|
|
searchBar.disabled = true;
|
|
|
|
|
|
|
|
|
|
|
|
function submitForm() {
|
|
|
|
function submitForm() {
|
|
|
|
var searchOption = document.getElementById('searchOption').value;
|
|
|
|
var searchOption = document.getElementById('searchOption');
|
|
|
|
var secondaryOption = document.getElementById('secondaryDropdown').value;
|
|
|
|
var secondaryOption = document.getElementById('secondaryDropdown').value;
|
|
|
|
var datePicker = document.getElementById('datePicker');
|
|
|
|
document.getElementById('hiddenSecondaryOption').value = secondaryOption;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Update the searchOption value to the selected year
|
|
|
|
|
|
|
|
// Update the searchBar value to the selected year
|
|
|
|
|
|
|
|
if (secondaryOption === 'Año') {
|
|
|
|
|
|
|
|
searchBar.value = document.getElementById('yearDropdown').value;
|
|
|
|
|
|
|
|
console.log('searchBar.value after assignment: ', searchBar.value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.action = "/buscador/" + searchOption.value + "/page/1";
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////DATE//////////////////////////////////////
|
|
|
|
|
|
|
|
// Fetch the distinct years from the server
|
|
|
|
|
|
|
|
// Fetch the distinct years from the server
|
|
|
|
|
|
|
|
fetch('/api/distinct-years')
|
|
|
|
|
|
|
|
.then(response => response.json()) // Convert the response to JSON
|
|
|
|
|
|
|
|
.then(years => {
|
|
|
|
|
|
|
|
// Get a reference to the yearDropdown select element
|
|
|
|
|
|
|
|
var yearDropdown = document.getElementById('yearDropdown');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remove any existing options in the dropdown
|
|
|
|
|
|
|
|
yearDropdown.innerHTML = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Iterate over each year
|
|
|
|
|
|
|
|
years.forEach(year => {
|
|
|
|
|
|
|
|
// Create a new option element
|
|
|
|
|
|
|
|
var option = document.createElement('option');
|
|
|
|
|
|
|
|
option.value = year;
|
|
|
|
|
|
|
|
option.text = year;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Append the option to the yearDropdown select element
|
|
|
|
|
|
|
|
yearDropdown.appendChild(option);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch(error => console.error('Error:', error));
|
|
|
|
|
|
|
|
|
|
|
|
// If the selected option is 'Fecha antes', 'Fecha despues', or 'Año', set the value of the search bar to the value of the date picker
|
|
|
|
// Get a reference to the yearDropdownContainer div
|
|
|
|
if (['Fecha antes', 'Fecha despues', 'Año'].includes(secondaryOption)) {
|
|
|
|
|
|
|
|
datePicker.name = "query";
|
|
|
|
// Add an event listener to the secondaryDropdown select element
|
|
|
|
|
|
|
|
secondaryDropdown.addEventListener('change', function() {
|
|
|
|
|
|
|
|
// Check if the selected value is "Año"
|
|
|
|
|
|
|
|
if (secondaryDropdown.value === 'Año') {
|
|
|
|
|
|
|
|
// If it is, make the yearDropdownContainer visible
|
|
|
|
|
|
|
|
yearDropdownContainer.style.display = 'block';
|
|
|
|
|
|
|
|
searchBar.disabled = true;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
datePicker.name = "";
|
|
|
|
// If it's not, hide the yearDropdownContainer
|
|
|
|
|
|
|
|
yearDropdownContainer.style.display = 'none';
|
|
|
|
|
|
|
|
searchBar.disabled = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Log the query to the console
|
|
|
|
var yearDropdown = document.getElementById('yearDropdown');
|
|
|
|
//console.log("Query SENT TEST: " + datePicker.value);
|
|
|
|
var searchOption = document.getElementById('searchOption');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
yearDropdown.addEventListener('change', function() {
|
|
|
|
|
|
|
|
searchBar.value = yearDropdown.value;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Update the value of the hidden input field
|
|
|
|
|
|
|
|
document.getElementById('hiddenSecondaryOption').value = secondaryOption;
|
|
|
|
|
|
|
|
this.action = "/buscador/" + searchOption + "/page/1";
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
window.onload = function() {
|
|
|
|
|
|
|
|
primaryDropdown.dispatchEvent(new Event('change'));
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
</html>
|