Browse Source

posibilité de supprimé un ticket

master
BARRAUX Arthur 3 years ago
parent
commit
d151335931
  1. 65
      css/style.css
  2. 2
      css/style.css.map
  3. BIN
      database/ticket_panne.db
  4. BIN
      img/logo_PC.png
  5. 8
      referant/cible/delete.php
  6. 4
      referant/include/line.php
  7. 2
      referant/include/menu.html
  8. 8
      referant/include/popup.html
  9. 20
      referant/index.php
  10. 20
      referant/js/edit.js
  11. 20
      referant/liste.php
  12. 3
      referant/search.php
  13. 67
      sass/main.scss

65
css/style.css

@ -6,9 +6,15 @@ body {
z-index: 1; z-index: 1;
font-family: monofonto; font-family: monofonto;
background-color: #e5e5e5; background-color: #e5e5e5;
margin: 20px; margin: 143px 20px;
text-align: center; text-align: center;
} }
body > a {
position: absolute;
left: 20px;
top: 20px;
margin: auto;
}
body .logo { body .logo {
display: block; display: block;
} }
@ -166,6 +172,7 @@ form {
.table td { .table td {
background-color: #e5e5e5; background-color: #e5e5e5;
border: 1px solid #84878C; border: 1px solid #84878C;
width: 1%;
min-width: 20px; min-width: 20px;
border-radius: 5px; border-radius: 5px;
text-align: center; text-align: center;
@ -243,10 +250,61 @@ form {
transition: 0.4s; transition: 0.4s;
} }
.container-popup {
z-index: 1;
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.container-popup:target {
visibility: visible;
opacity: 1;
}
.container-popup__popup {
margin: auto;
padding: 20px;
background: #fff;
top: 0;
bottom: 0;
left: 0;
right: 0;
border-radius: 5px;
width: 30%;
height: 150px;
position: absolute;
transition: all 5s ease-in-out;
}
.container-popup__popup h2 {
margin-top: 0;
color: #333;
}
.container-popup__popup p {
max-height: 30%;
overflow: auto;
}
.container-popup__popup__close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.container-popup__popup__close:hover {
color: #06D85F;
}
.button { .button {
border: 3px solid #ac2a8d; border: 3px solid #ac2a8d;
background-color: #e5e5e5; background-color: #e5e5e5;
color: #ac2a8d;
font-weight: bold; font-weight: bold;
text-decoration: none; text-decoration: none;
transition: 0.5s; transition: 0.5s;
@ -259,10 +317,11 @@ form {
width: 3rem; width: 3rem;
border-radius: 5px; border-radius: 5px;
margin: 5px; margin: 5px;
color: #84878C;
} }
.button--large { .button--large {
color: #ac2a8d;
display: inline-block; display: inline-block;
width: 6%;
margin-bottom: 3%; margin-bottom: 3%;
padding: 10px 40px; padding: 10px 40px;
border-radius: 20px; border-radius: 20px;

2
css/style.css.map

@ -1 +1 @@
{"version":3,"sourceRoot":"","sources":["../sass/main.scss"],"names":[],"mappings":"AAMA;EACI;EACA;;AAGJ;EACI;EACA;EACA,kBAbS;EAcT;EACA;;AACA;EACI;;AAEJ;EACI;EACA;EACA;;AAEJ;EACI;EACA,OAxBE;EAyBF;EACA;;;AAOR;EACI;EACA;EACA;EACA,kBAxCQ;EAyCR;;AACA;EACI;EACA;EACA;;AACA;EACI;EACA;EACA;;AAGR;EACI;EACA;EACA;EACA;EACA;EACA;;AACA;EACI,kBA1DG;EA2DH;EACA;;AAEJ;EACI;EACA;EACA;EACA;EACA;EACA;;AACA;EACI;;;AAUhB;EACI;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;;;AAGJ;EACI;;AACA;EACI;EACA;;AAEJ;EACI;EACA;EACA;EACA;EACA;EACA;;AAEJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACI;EACA,cA7HF;EA8HE;;AAEJ;EACI;EACA;EACA;;;AASZ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,kBAzJS;EA0JT;;AACA;EACI;EACA;;AAEJ;EACI;EACA;;AAEJ;EACI;EACA;EACA;EACA;EACA;;;AAQR;EACI;EACA;EACA;EACA;EACA,kBAtLQ;EAuLR;EACA;;AACA;EACI;;AAEJ;EACI,kBA5LK;EA8LL;EACA;EACA;EAEA;EACA;EACA,OArMI;;AAsMJ;EACI;EACA;;AAEJ;EACI;EACA;EACA;EACA;EACA,OA/MA;EAgNA;;AACA;EACI;;AAEJ;EACI;EACA;;AAIZ;EACI,OAxNE;EAyNF;EACA;;AAEJ;EACI;EACA;EACA;EACA;;AACA;EACI;EACA;EACA;;AACA;EACI;;AAEJ;EACI;;AAEJ;EACI;EACA;EACA;;AAGR;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAOhB;EACI;EACA,kBAjRS;EAkRT,OAhRM;EAiRN;EACA;EACA;;AACA;EACI,OAvRK;EAwRL,kBAtRE;;AAwRN;EACI;EACA;EACA;;AAEJ;EACI;EACA;EACA;EACA;EACA","file":"style.css"} {"version":3,"sourceRoot":"","sources":["../sass/main.scss"],"names":[],"mappings":"AAMA;EACI;EACA;;AAGJ;EACI;EACA;EACA,kBAbS;EAcT;EACA;;AACA;EACI;EACA;EACA;EACA;;AAEJ;EACI;;AAEJ;EACI;EACA;EACA;;AAEJ;EACI;EACA,OA9BE;EA+BF;EACA;;;AAOR;EACI;EACA;EACA;EACA,kBA9CQ;EA+CR;;AACA;EACI;EACA;EACA;;AACA;EACI;EACA;EACA;;AAGR;EACI;EACA;EACA;EACA;EACA;EACA;;AACA;EACI,kBAhEG;EAiEH;EACA;;AAEJ;EACI;EACA;EACA;EACA;EACA;EACA;;AACA;EACI;;;AAUhB;EACI;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;;;AAGJ;EACI;;AACA;EACI;EACA;;AAEJ;EACI;EACA;EACA;EACA;EACA;EACA;;AAEJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACI;EACA,cAnIF;EAoIE;;AAEJ;EACI;EACA;EACA;;;AASZ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,kBA/JS;EAgKT;;AACA;EACI;EACA;;AAEJ;EACI;EACA;;AAEJ;EACI;EACA;EACA;EACA;EACA;;;AAQR;EACI;EACA;EACA;EACA;EACA,kBA5LQ;EA6LR;EACA;;AACA;EACI;;AAEJ;EACI,kBAlMK;EAoML;EACA;EACA;EACA;EAEA;EACA;EACA,OA5MI;;AA6MJ;EACI;EACA;;AAEJ;EACI;EACA;EACA;EACA;EACA,OAtNA;EAuNA;;AACA;EACI;;AAEJ;EACI;EACA;;AAIZ;EACI,OA/NE;EAgOF;EACA;;AAEJ;EACI;EACA;EACA;EACA;;AACA;EACI;EACA;EACA;;AACA;EACI;;AAEJ;EACI;;AAEJ;EACI;EACA;EACA;;AAGR;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAQhB;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACI;EACA;;AAEJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACI;EACA;;AAEJ;EACI;EACA;;AAEJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACI;;;AAOhB;EACI;EACA,kBA9US;EA+UT;EACA;EACA;;AACA;EACI,OAnVK;EAoVL,kBAlVE;;AAoVN;EACI;EACA;EACA;EACA,OA3VI;;AA6VR;EACI,OA3VE;EA4VF;EACA;EACA;EACA","file":"style.css"}

BIN
database/ticket_panne.db

Binary file not shown.

BIN
img/logo_PC.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 25 KiB

8
referant/cible/delete.php

@ -0,0 +1,8 @@
<?php
$bdd = new SQLite3('../../database/ticket_panne.db', SQLITE3_OPEN_READWRITE);
$request = $bdd->prepare('DELETE FROM pannes WHERE ID=:id');
$request->bindValue(':id', $_POST['id']);
$request->execute();
echo "Ticket supprimé veuillez actualiser la page";
?>

4
referant/include/line.php

@ -24,8 +24,6 @@ if (isset($line)) {
echo '<td class=', $class , '><img src="../img/excla.png" ></td>'; echo '<td class=', $class , '><img src="../img/excla.png" ></td>';
} }
echo ' <td class=', $class , '> echo ' <td class=', $class , '>
<label class="table__switch"> <label class="table__switch">
<input class="checkbox" type="checkbox" onchange="Slider(\'',$class,'\')"> <input class="checkbox" type="checkbox" onchange="Slider(\'',$class,'\')">
@ -33,6 +31,7 @@ if (isset($line)) {
</label> </label>
</td> </td>
<td class=',$class,'><input class="button button--small" type="button" value="edit" onclick="Edit(\'',$class,'\')"></td> <td class=',$class,'><input class="button button--small" type="button" value="edit" onclick="Edit(\'',$class,'\')"></td>
<td class=',$class,'><a href="#popup"><input class="button button--small" type="button" value="del" onclick="ModifPop(\'',$class,'\')"></a></td>
</tr>'; </tr>';
} }
else { else {
@ -56,6 +55,7 @@ else {
</label> </label>
</td> </td>
<td class=',$class,'><input class="button button--small" type="button" value="edit" onclick="Edit(\'',$class,'\')"></td> <td class=',$class,'><input class="button button--small" type="button" value="edit" onclick="Edit(\'',$class,'\')"></td>
<td class=',$class,'><a href="popup"><input class="button button--small" type="button" value="del" onclick="ModifPop(\'',$class,'\')"></a></td>
</tr>'; </tr>';
} }
?> ?>

2
referant/include/menu.html

@ -1,4 +1,4 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>Admin ticket</title> <title>Admin ticket</title>
<link href="../css/style.css" rel="stylesheet"> <link href="../css/style.css" rel="stylesheet">
<a href="index.php"><img class="logo" src="../img/logo_PC.png" alt="logo_PC" width="200px"></a> <a href="index.php"><img class="logo" src="../img/logo_PC.png" alt="logo_PC"></a>

8
referant/include/popup.html

@ -0,0 +1,8 @@
<div id="popup" class="container-popup">
<div class="container-popup__popup">
<h2>Attention!</h2>
<a class="container-popup__popup__close" href="#">X</a>
<p>Voulez-vous vraiment supprimer ce ticket?</p>
<a href="#"><input class="button button--large" type="button" value="supprimer"></a>
</div>
</div>

20
referant/index.php

@ -11,6 +11,7 @@ include '../sessions/session_restraintes.php';
<body> <body>
<div class="contaner-field"><a class="button button--large" href="../prof/index.php">client</a></div> <div class="contaner-field"><a class="button button--large" href="../prof/index.php">client</a></div>
<?php include 'include/nav.php'; ?> <?php include 'include/nav.php'; ?>
<?php include 'include/popup.html'; ?>
<script type="text/javascript" src="js/edit.js" defer></script> <script type="text/javascript" src="js/edit.js" defer></script>
<table class="table"> <table class="table">
<thead> <thead>
@ -39,17 +40,26 @@ include '../sessions/session_restraintes.php';
$bdd = new SQLite3('../database/ticket_panne.db', SQLITE3_OPEN_READWRITE); $bdd = new SQLite3('../database/ticket_panne.db', SQLITE3_OPEN_READWRITE);
$reponse = $bdd->query("SELECT * FROM pannes ORDER BY ID DESC"); $reponse = $bdd->query("SELECT * FROM pannes ORDER BY ID DESC");
$non_traite = 0;
for ($j=0; $j < 3; $j++) { for ($j=0; $j < 3; $j++) {
$line = $reponse->fetchArray(); $line = $reponse->fetchArray();
if ($line['traitement'] == 0) { if (isset($line['traitement'])) {
$class = $line[0]; if ($line['traitement'] == 0) {
include 'include/line.php'; $non_traite ++;
$class = $line[0];
include 'include/line.php';
}
else {
$j--;
}
} }
else { else {
$j--; break;
} }
} }
if ($non_traite == 0) {
echo "<h2>Aucun ticket non traité</h2>";
}
?> ?>
</tbody> </tbody>
</table> </table>

20
referant/js/edit.js

@ -38,7 +38,6 @@ function Edit(clas) {
data.append('value', JSON.stringify(value)); data.append('value', JSON.stringify(value));
xhr.onreadystatechange = function() { xhr.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) { if (this.readyState == 4 && this.status == 200) {
console.log(this.response);
for (let i=1; i<11; i++) { for (let i=1; i<11; i++) {
obj[i].innerHTML = this.response[i]; obj[i].innerHTML = this.response[i];
} }
@ -71,3 +70,22 @@ function Value(list) {
} }
} }
function ModifPop(clas) {
const popup = document.getElementsByClassName('container-popup__popup')[0];
popup.querySelector('p').textContent = 'Voulez-vous vraiment supprimer le ticket ' + clas + ' ?';
popup.querySelector('a > input').setAttribute('onclick', 'DelTicket('+clas+')');
}
function DelTicket(clas) {
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
alert(this.responseText);
}
};
xhr.open('POST', 'cible/delete.php', true);
xhr.responseType = 'text';
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.send("id=" + encodeURI(clas));
}

20
referant/liste.php

@ -10,10 +10,13 @@ include '../sessions/session_restraintes.php';
</head> </head>
<body id="corps"> <body id="corps">
<?php include 'include/nav.php';?> <?php include 'include/nav.php';?>
<?php include 'include/popup.html'; ?>
</div>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th colspan="14">Ticket</th> <th colspan="15">Ticket</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -36,10 +39,19 @@ include '../sessions/session_restraintes.php';
$bdd = new SQLite3('../database/ticket_panne.db', SQLITE3_OPEN_READWRITE); $bdd = new SQLite3('../database/ticket_panne.db', SQLITE3_OPEN_READWRITE);
$reponse = $bdd->query("SELECT * FROM pannes ORDER BY ID"); $reponse = $bdd->query("SELECT * FROM pannes ORDER BY ID");
$non_traite = 0;
while ($line = $reponse->fetchArray()) { while ($line = $reponse->fetchArray()) {
$class = $line[0]; if (isset($line['traitement'])) {
include 'include/line.php'; $non_traite ++;
$class = $line[0];
include 'include/line.php';
}
else {
break;
}
}
if ($non_traite == 0) {
echo "<h2>Aucun ticket dans la base</h2>";
} }
?> ?>
</tbody> </tbody>

3
referant/search.php

@ -12,6 +12,7 @@ include '../sessions/session_restraintes.php';
<body id='corps'> <body id='corps'>
<?php include 'include/nav.php'; ?> <?php include 'include/nav.php'; ?>
<?php include 'include/popup.html'; ?>
<form id="form" action="js/search.php" method="POST"> <form id="form" action="js/search.php" method="POST">
<div class="container-field"> <div class="container-field">
<p>Recherche :</p> <p>Recherche :</p>
@ -42,7 +43,7 @@ include '../sessions/session_restraintes.php';
<table class="table" style="display: none;"> <table class="table" style="display: none;">
<thead> <thead>
<tr> <tr>
<th colspan="14">Ticket</th> <th colspan="15">Ticket</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

67
sass/main.scss

@ -13,8 +13,14 @@ body {
z-index: 1; z-index: 1;
font-family: monofonto; font-family: monofonto;
background-color: $light-grey; background-color: $light-grey;
margin: 20px; margin: 143px 20px;
text-align: center; text-align: center;
&>a {
position: absolute;
left: 20px;
top: 20px;
margin: auto;
}
.logo { .logo {
display: block; display: block;
} }
@ -190,6 +196,7 @@ form {
background-color: $light-grey; background-color: $light-grey;
border: 1px solid $dark-grey; border: 1px solid $dark-grey;
width: 1%;
min-width: 20px; min-width: 20px;
border-radius: 5px; border-radius: 5px;
@ -270,10 +277,63 @@ form {
} }
.container-popup {
z-index: 1;
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
&:target {
visibility: visible;
opacity: 1;
}
&__popup {
margin: auto;
padding: 20px;
background: #fff;
top: 0;
bottom: 0;
left: 0;
right: 0;
border-radius: 5px;
width: 30%;
height: 150px;
position: absolute;
transition: all 5s ease-in-out;
h2 {
margin-top: 0;
color: #333;
}
p {
max-height: 30%;
overflow: auto;
}
&__close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
&:hover {
color: #06D85F;
}
}
}
}
.button { .button {
border: 3px solid $bordeau; border: 3px solid $bordeau;
background-color: $light-grey; background-color: $light-grey;
color: $bordeau;
font-weight: bold; font-weight: bold;
text-decoration: none; text-decoration: none;
transition: .5s; transition: .5s;
@ -285,10 +345,11 @@ form {
width: 3rem; width: 3rem;
border-radius: 5px; border-radius: 5px;
margin: 5px; margin: 5px;
color: $dark-grey;
} }
&--large { &--large {
color: $bordeau;
display: inline-block; display: inline-block;
width: 6%;
margin-bottom: 3%; margin-bottom: 3%;
padding: 10px 40px; padding: 10px 40px;
border-radius: 20px; border-radius: 20px;

Loading…
Cancel
Save