|
@ -1,25 +1,38 @@ |
|
|
const ticket = document.getElementsByClassName('ticket'); |
|
|
var tr = ''; |
|
|
|
|
|
|
|
|
document.getElementById('form').addEventListener('submit', function(e) { |
|
|
document.getElementById('form').addEventListener('submit', function(e) { |
|
|
e.preventDefault(); |
|
|
e.preventDefault(); |
|
|
|
|
|
// try {
|
|
|
|
|
|
// while (document.getElementsByName('tr')) {
|
|
|
|
|
|
// document.getElementsByName('tr')[0].remove();
|
|
|
|
|
|
// }
|
|
|
|
|
|
// } catch (e) {
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
let data = new FormData(this); |
|
|
let data = new FormData(this); |
|
|
|
|
|
console.log(data); |
|
|
|
|
|
|
|
|
let xhr = new XMLHttpRequest(); |
|
|
let xhr = new XMLHttpRequest(); |
|
|
xhr.onreadystatechange = function() { |
|
|
xhr.onreadystatechange = function() { |
|
|
if (this.readyState == 4 && this.status == 200) { |
|
|
if (this.readyState == 4 && this.status == 200) { |
|
|
if (this.response != false) { |
|
|
if (this.response != false) { |
|
|
console.log(this.response); |
|
|
this.response.forEach((item, i) => { |
|
|
for (let i=0; i < 11; i++) { |
|
|
console.log(push_line(item[0])); |
|
|
ticket[i].textContent = this.response[i]; |
|
|
console.log('salut' + tr); |
|
|
} |
|
|
document.getElementsByTagName('tbody')[0].innerHTML = tr; |
|
|
if (this.response[11] == 1) { |
|
|
let ticket = document.getElementsByClassName("'" + item[0] + "'"); |
|
|
ticket[11].querySelector('img').src = "../img/check.png"; |
|
|
console.log(ticket); |
|
|
} |
|
|
for (let i=0; i < 11; i++) { |
|
|
else { |
|
|
ticket[i].textContent = item[i]; |
|
|
ticket[11].querySelector('img').src = "../img/excla.png"; |
|
|
} |
|
|
} |
|
|
if (item[11] == 1) { |
|
|
document.getElementsByTagName('table')[0].style.display = 'block'; |
|
|
ticket[11].querySelector('img').src = "../img/check.png"; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
ticket[11].querySelector('img').src = "../img/excla.png"; |
|
|
|
|
|
} |
|
|
|
|
|
document.getElementsByTagName('table')[0].style.display = 'block'; |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
alert("Ce ticket n'existe pas"); |
|
|
alert("Ce ticket n'existe pas"); |
|
@ -31,5 +44,19 @@ document.getElementById('form').addEventListener('submit', function(e) { |
|
|
xhr.open('POST', 'cible/search.php', true); |
|
|
xhr.open('POST', 'cible/search.php', true); |
|
|
xhr.responseType = 'json'; |
|
|
xhr.responseType = 'json'; |
|
|
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); |
|
|
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); |
|
|
xhr.send("id=" + encodeURI(data.get('id'))); |
|
|
xhr.send("champ=" + encodeURI(data.get('champ')) + "&" + "value=" + encodeURI(data.get('value'))); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
function push_line(clas) { |
|
|
|
|
|
let xhr = new XMLHttpRequest(); |
|
|
|
|
|
xhr.open('POST', 'include/line.php', true); |
|
|
|
|
|
xhr.onreadystatechange = function() { |
|
|
|
|
|
if (this.readyState == 4 && this.status == 200) { |
|
|
|
|
|
tr = this.response; |
|
|
|
|
|
console.log(tr); |
|
|
|
|
|
return tr; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); |
|
|
|
|
|
xhr.send("class=" + encodeURI(clas)); |
|
|
|
|
|
} |
|
|