diff --git a/referant/cible/edit.php b/referant/cible/edit.php
new file mode 100644
index 0000000..c0d3529
--- /dev/null
+++ b/referant/cible/edit.php
@@ -0,0 +1,21 @@
+query($request);
+
+$traitement = $bdd->query("SELECT * FROM pannes WHERE ID=" .$decode['id']);
+print_r(json_encode($traitement->fetch()));
+?>
\ No newline at end of file
diff --git a/referant/cible/index.php b/referant/cible/index.php
new file mode 100644
index 0000000..c4be944
--- /dev/null
+++ b/referant/cible/index.php
@@ -0,0 +1,9 @@
+query("UPDATE pannes SET traitement = " .$_POST['is_checked'] ." WHERE ID = " .$_POST['id']);
+
+$traitement = $bdd->query("SELECT traitement FROM pannes WHERE ID=" .$_POST['id']);
+$res = $traitement->fetch()['traitement'];
+echo $res;
+?>
\ No newline at end of file
diff --git a/referant/cible/script.js b/referant/cible/script.js
deleted file mode 100644
index 420442f..0000000
--- a/referant/cible/script.js
+++ /dev/null
@@ -1,19 +0,0 @@
-document.getElementById('form').addEventListener('submit', function(e) {
- e.preventDefault();
-
- let data = new FormData(this);
-
- let xhr = new XMLHttpRequest();
- xhr.onreadystatechange = function() {
- console.log(this.response);
- if (this.readyState == 4 && this.status == 200) {
- } else if (this.readyState == 4) {
- alert('uhe erreur est survenue...');
- }
- };
- xhr.open('POST', 'cible/search.php', true);
- xhr.send(data);
- let p = document.createElement('p');
- p.textContent = 'hzllo';
- document.getElementById('corps').appendChild(p);
-});
\ No newline at end of file
diff --git a/referant/cible/search.php b/referant/cible/search.php
index 7119bed..f3810af 100644
--- a/referant/cible/search.php
+++ b/referant/cible/search.php
@@ -1,7 +1,15 @@
query("SELECT * FROM pannes ORDER BY ID");
+try {
+ $reponse = $bdd->query("SELECT * FROM pannes WHERE ID=" .$_POST['id']);
+ $line = $reponse -> fetch();
-print_r($reponse -> fetch($_POST['id']));
+
+ $result = json_encode($line);
+
+ print_r($result);
+} catch (Exception) {
+ echo false;
+}
?>
diff --git a/referant/include/line.php b/referant/include/line.php
new file mode 100644
index 0000000..5fd759d
--- /dev/null
+++ b/referant/include/line.php
@@ -0,0 +1,23 @@
+
+
',$class,' |
+ ',$line[1],' |
+ ',$line[2],' |
+ ',$line[3],' |
+ ',$line[4],' |
+ ',$line[5],' |
+ ',$line[6],' |
+ ',$line[7],' |
+ ',$line[8],' |
+ ',$line[9],' |
+ ',$line[10],' |
+ ',$line[11],' |
+
+
+ |
+ |
+';
+?>
\ No newline at end of file
diff --git a/referant/include/menu.php b/referant/include/menu.php
index 3380e2f..3791fc2 100644
--- a/referant/include/menu.php
+++ b/referant/include/menu.php
@@ -1,6 +1,4 @@
-
-
- Admin ticket
-
-
-
+
+Admin ticket
+
+
diff --git a/referant/include/nav.php b/referant/include/nav.php
index 3047a49..353d90d 100644
--- a/referant/include/nav.php
+++ b/referant/include/nav.php
@@ -3,7 +3,7 @@
diff --git a/referant/index.php b/referant/index.php
index 9ca3073..a51b23e 100755
--- a/referant/index.php
+++ b/referant/index.php
@@ -1,8 +1,51 @@
-
+
+
+
+
- client
+ client
+
+
+
+
+ Ticket récents non traités |
+
+
+
+
+ ID |
+ date |
+ details |
+ lieu |
+ salle |
+ pos |
+ materiel |
+ marque |
+ model |
+ nserie |
+ demandeur |
+ traitement |
+ valider |
+
+
+ query("SELECT * FROM pannes ORDER BY ID DESC");
+
+ for ($j=0; $j < 3; $j++) {
+ $line = $reponse->fetch();
+ if ($line['traitement'] == 0) {
+ $class = $line[0];
+ include 'include/line.php';
+ }
+ }
+ $reponse->closeCursor();
+ ?>
+
+
diff --git a/referant/js/index.js b/referant/js/index.js
new file mode 100644
index 0000000..22da26f
--- /dev/null
+++ b/referant/js/index.js
@@ -0,0 +1,68 @@
+let checkbox = document.getElementsByClassName('checkbox');
+for (elem in checkbox) {
+ elem.checked = false;
+}
+
+function Slider(id) {
+ let td = document.getElementsByClassName(id);
+ let is_checked;
+ if (td[12].querySelector('input').checked == true) {
+ is_checked = 1;
+ }
+ else {
+ is_checked = 0;
+ }
+ let xhr = new XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (this.readyState == 4 && this.status == 200) {
+ td[11].textContent = this.response;
+ }
+ };
+ xhr.open('POST', 'cible/index.php', true);
+ xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+ xhr.send("is_checked=" + encodeURI(is_checked) + "&id=" + encodeURI(id));
+}
+
+function Edit(clas) {
+ let obj = document.getElementsByClassName(clas);
+ let data = new FormData();
+ if (obj[13].querySelector('input').value == 'edit') {
+ for (let i=1; i< 12; i++) {
+ obj[i].innerHTML = '';
+ }
+ obj[13].querySelector('input').value = 'ok';
+ }
+ else {
+ let value = new Value(obj);
+ let xhr = new XMLHttpRequest();
+ data.append('value', JSON.stringify(value));
+ console.log(data);
+ xhr.onreadystatechange = function() {
+ if (this.readyState == 4 && this.status == 200) {
+ console.log(this.response);
+ for (let i=1; i<12; i++) {
+ obj[i].innerHTML = this.response[i];
+ }
+ obj[13].querySelector('input').value = 'edit';
+ }
+ };
+ xhr.open('POST', 'cible/edit.php', true);
+ xhr.responseType = 'json';
+ xhr.send(data);
+ }
+}
+
+function Value(list) {
+ this.id = list[0].textContent;
+ this.dates = list[1].querySelector('input').value;
+ this.details = list[2].querySelector('input').value;
+ this.lieu = list[3].querySelector('input').value;
+ this.salle = list[4].querySelector('input').value;
+ this.pos = list[5].querySelector('input').value;
+ this.materiel = list[6].querySelector('input').value;
+ this.marque = list[7].querySelector('input').value;
+ this.model = list[8].querySelector('input').value;
+ this.nserie = list[9].querySelector('input').value;
+ this.demandeur = list[10].querySelector('input').value;
+ this.traitement = list[11].querySelector('input').value;
+}
\ No newline at end of file
diff --git a/referant/js/search.js b/referant/js/search.js
new file mode 100644
index 0000000..96c2071
--- /dev/null
+++ b/referant/js/search.js
@@ -0,0 +1,95 @@
+const table_ticket = document.getElementsByClassName('ticket');
+const table_title = document.getElementsByClassName('table-title');
+var id_displayed;
+
+document.getElementById('form').addEventListener('submit', function(e) {
+ e.preventDefault();
+
+ let data = new FormData(this);
+
+ let xhr = new XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (this.readyState == 4 && this.status == 200) {
+ if (this.response != false) {
+ id_displayed = data.get('id');
+ for (let i=0; i < 12; i++) {
+ table_ticket[i].textContent = this.response[i];
+ }
+ document.getElementById('table-search').style.display = 'block';
+ }
+ else {
+ alert("Ce ticket n'existe pas");
+ }
+ } else if (this.readyState == 4) {
+ alert('uhe erreur est survenue...');
+ }
+ };
+ xhr.open('POST', 'cible/search.php', true);
+ xhr.responseType = 'json';
+ xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+ xhr.send("id=" + encodeURI(data.get('id')));
+});
+
+function Slider(id) {
+ let td = document.getElementsByClassName(id);
+ let is_checked;
+ if (td[12].querySelector('input').checked == true) {
+ is_checked = 1;
+ }
+ else {
+ is_checked = 0;
+ }
+ let xhr = new XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (this.readyState == 4 && this.status == 200) {
+ td[11].textContent = this.response;
+ }
+ };
+ xhr.open('POST', 'cible/index.php', true);
+ xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+ xhr.send("is_checked=" + encodeURI(is_checked) + "&id=" + encodeURI(id_displayed));
+}
+
+function Edit(clas) {
+ let obj = document.getElementsByClassName(clas);
+ let data = new FormData();
+ if (obj[13].querySelector('input').value == 'edit') {
+ for (let i=1; i< 12; i++) {
+ obj[i].innerHTML = '';
+ }
+ obj[13].querySelector('input').value = 'ok';
+ }
+ else {
+ let value = new Value(obj);
+ let xhr = new XMLHttpRequest();
+ data.append('value', JSON.stringify(value));
+ console.log(data);
+ xhr.onreadystatechange = function() {
+ if (this.readyState == 4 && this.status == 200) {
+ console.log(this.response);
+ for (let i=1; i<12; i++) {
+ obj[i].innerHTML = this.response[i];
+ }
+ obj[13].querySelector('input').value = 'edit';
+ }
+ };
+ xhr.open('POST', 'cible/edit.php', true);
+ xhr.responseType = 'json';
+ xhr.send(data);
+ }
+}
+
+function Value(list) {
+ this.id = list[0].textContent;
+ this.dates = list[1].querySelector('input').value;
+ this.details = list[2].querySelector('input').value;
+ this.lieu = list[3].querySelector('input').value;
+ this.salle = list[4].querySelector('input').value;
+ this.pos = list[5].querySelector('input').value;
+ this.materiel = list[6].querySelector('input').value;
+ this.marque = list[7].querySelector('input').value;
+ this.model = list[8].querySelector('input').value;
+ this.nserie = list[9].querySelector('input').value;
+ this.demandeur = list[10].querySelector('input').value;
+ this.traitement = list[11].querySelector('input').value;
+}
\ No newline at end of file
diff --git a/referant/liste.php b/referant/liste.php
new file mode 100644
index 0000000..2098a95
--- /dev/null
+++ b/referant/liste.php
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+ Ticket |
+
+
+
+
+ ID |
+ date |
+ details |
+ lieu |
+ salle |
+ pos |
+ materiel |
+ marque |
+ model |
+ nserie |
+ demandeur |
+ traitement |
+ valider |
+
+ query("SELECT * FROM pannes ORDER BY ID");
+
+ while ($line = $reponse->fetch()) {
+ $class = $line[0];
+ include 'include/line.php';
+ }
+ $reponse->closeCursor();
+ ?>
+
+
+
+
\ No newline at end of file
diff --git a/referant/search.php b/referant/search.php
index a2896f2..e806e58 100755
--- a/referant/search.php
+++ b/referant/search.php
@@ -1,9 +1,13 @@
-
+
+
+
+
+
-
-
+
+
+
+ Ticket |
+
+
+
+
+ ID |
+ date |
+ details |
+ lieu |
+ salle |
+ pos |
+ materiel |
+ marque |
+ model |
+ nserie |
+ demandeur |
+ traitement |
+ valider |
+
+
+
+
diff --git a/referant/stylepage.css b/referant/stylepage.css
index 7b909cf..e0e7951 100755
--- a/referant/stylepage.css
+++ b/referant/stylepage.css
@@ -5,6 +5,24 @@ body{
text-align: center;
}
+#lien-client{
+ text-decoration: none;
+ display: block;
+ width: 10%;
+ color: #454444;
+ margin: 10px auto;
+ border: 4px solid #4e4d4d;
+ padding: 10px 10px;
+ border-radius: 30px;
+ transition: 0.25s;
+}
+
+#lien-client:hover{
+ width: 20%;
+ border-color: #ac2a8d;
+ background-color: #dddddd;
+}
+
nav{
width: 80%;
margin-left: 10%;
@@ -48,8 +66,41 @@ nav a{
text-decoration: none;
}
+#table-search{
+ display: none;
+}
+
+.table-title td{
+ color: #ac2a8d;
+ font-weight: bold;
+}
+
+table{
+ width: 80%;
+ border-radius: 5px;
+ margin-left: 10%;
+ background-color: #84878C;
+ color: #fff;
+ border: 1px solid #84878C;
+}
+
+td {
+ border: 1px solid #84878C;
+ background-color: #e5e5e5;
+ border-radius: 5px;
+
+ color: #84878C;
+ width: 7%;
+}
+
+th{
+ width: 100%;
+}
+
+
.menu:hover{
background-color: #59184E;
+ transition: .5s;
border-radius: 10px;
}
@@ -70,8 +121,8 @@ nav a{
display: block;
margin: 10px auto;
border: 4px solid #4e4d4d;
- padding: 40px 40px;
- width: 60%;
+ padding: 20px 40px;
+ width: 40%;
border-radius: 80px;
transition: 0.25s;
}
@@ -110,3 +161,58 @@ nav a{
background-color: #82E6AC;
border-color: #2ecc71;
}
+
+.switch {
+ position: relative;
+ display: inline-block;
+ width: 60px;
+ height: 34px;
+}
+
+/* Hide default HTML checkbox */
+.switch input {
+ opacity: 0;
+ width: 0;
+ height: 0;
+}
+
+/* The slider */
+.slider {
+ position: absolute;
+ cursor: pointer;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background-color: crimson;
+ border-radius: 34px;
+ -webkit-transition: .4s;
+ transition: .4s;
+}
+
+.slider:before {
+ position: absolute;
+ border-radius: 50%;
+ content: "";
+ height: 26px;
+ width: 26px;
+ left: 4px;
+ bottom: 4px;
+ background-color: white;
+ -webkit-transition: .4s;
+ transition: .4s;
+}
+
+input:checked + .slider {
+ background-color:#2ecc71;
+}
+
+input:focus + .slider {
+ box-shadow: 0 0 1px #2ecc71;
+}
+
+input:checked + .slider:before {
+ -webkit-transform: translateX(26px);
+ -ms-transform: translateX(26px);
+ transform: translateX(26px);
+}
\ No newline at end of file