added field for td and hide show identification parts
This commit is contained in:
@@ -11,7 +11,6 @@ function fill(
|
||||
reportof,
|
||||
kindtest
|
||||
) {
|
||||
//Assigning values to corresponding input fields in "search.php" file.
|
||||
$('#articlepartvalue').val(article)
|
||||
$('#materialpartvalue').val(material)
|
||||
$('#colorvalue').val(color)
|
||||
@@ -22,29 +21,56 @@ function fill(
|
||||
$('#cmcdatereport').val(cmcreportdate)
|
||||
$('#reportof').val(reportof)
|
||||
$('#combo').val(kindtest).change()
|
||||
|
||||
//Hiding "display" div in "search.php" file.
|
||||
$('#display').hide()
|
||||
}
|
||||
|
||||
function toggleHide(id, newHide, button) {
|
||||
// Cambia l'icona e il colore immediatamente
|
||||
const $button = $(button)
|
||||
const $icon = $button.find('i')
|
||||
$icon
|
||||
.removeClass('fa-eye fa-eye-slash')
|
||||
.addClass(newHide === 'Y' ? 'fa-eye-slash' : 'fa-eye')
|
||||
.css('color', newHide === 'Y' ? 'red' : 'green') // Cambia il colore
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'searchengine/togglehide.php',
|
||||
data: {
|
||||
ididentificationparts: id,
|
||||
hide: newHide,
|
||||
},
|
||||
success: function (response) {
|
||||
// Aggiorna la ricerca per riflettere il cambiamento
|
||||
performSearch()
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.log('Errore AJAX: ' + status + ' - ' + error)
|
||||
// Ripristina l'icona e il colore originale in caso di errore
|
||||
$icon
|
||||
.removeClass('fa-eye fa-eye-slash')
|
||||
.addClass(newHide === 'Y' ? 'fa-eye' : 'fa-eye-slash')
|
||||
.css('color', newHide === 'Y' ? 'green' : 'red')
|
||||
$('#display').html("Errore durante l'aggiornamento. Riprova.")
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
//On pressing a key on "Search box" in "search.php" file. This function will be called.
|
||||
$('#articlepartvalue').keyup(function () {
|
||||
//Assigning search box value to javascript variable named as "name".
|
||||
// Funzione per eseguire la ricerca
|
||||
function performSearch() {
|
||||
var name = $('#articlepartvalue').val()
|
||||
//Validating, if "name" is empty.
|
||||
var showHidden = $('#showHiddenParts').is(':checked')
|
||||
|
||||
if (name == '') {
|
||||
//Assigning empty value to "display" div in "search.php" file.
|
||||
$('#display').html('')
|
||||
}
|
||||
//If name is not empty.
|
||||
else {
|
||||
//AJAX is called.
|
||||
} else {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'searchengine/ajaxsearch.php',
|
||||
data: {
|
||||
articlepartvalue: encodeURIComponent(name), // Codifica il valore
|
||||
articlepartvalue: encodeURIComponent(name),
|
||||
showHidden: showHidden,
|
||||
},
|
||||
success: function (html) {
|
||||
$('#display').html(html).show()
|
||||
@@ -55,5 +81,15 @@ $(document).ready(function () {
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Esegui la ricerca quando l'utente digita nel campo
|
||||
$('#articlepartvalue').keyup(function () {
|
||||
performSearch()
|
||||
})
|
||||
|
||||
// Esegui la ricerca quando l'utente cambia il checkbox
|
||||
$('#showHiddenParts').change(function () {
|
||||
performSearch()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user