Browse Source

ajout de la partie référent

master
BARRAUX Arthur 3 years ago
parent
commit
3c828cce03
  1. 0
      img/check.png
  2. 0
      img/excla.png
  3. 0
      img/int.png
  4. 0
      img/int_hov.png
  5. 0
      img/logo_PC.png
  6. 22
      prof/cible.php
  7. 13
      prof/include/champ.php
  8. 150
      prof/index.php
  9. 62
      prof/script.js
  10. 145
      prof/stylepage.css
  11. 19
      referant/cible/script.js
  12. 7
      referant/cible/search.php
  13. 6
      referant/include/menu.php
  14. 10
      referant/include/nav.php
  15. 8
      referant/index.php
  16. 16
      referant/search.php
  17. 112
      referant/stylepage.css

0
img/check.png

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

0
img/excla.png

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

0
img/int.png

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

0
img/int_hov.png

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

0
img/logo_PC.png

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

22
prof/cible.php

@ -0,0 +1,22 @@
<?php
$bdd = new PDO('mysql:host=localhost;dbname=ticket;charset:utf8', 'root', '');
$req = $bdd->prepare('INSERT INTO pannes(dates, details, lieu, salle, pos, materiel, marque, model, nserie, demandeur, traitement) VALUES(:dates, :details, :lieu, :salle, :pos, :materiel, :marque, :model, :nserie, :demandeur, :traitement)');
$req->execute(array(
'dates' => $_POST['dates'],
'details' => $_POST['details'],
'lieu' => $_POST['lieu'],
'salle' => $_POST['salle'],
'pos' => $_POST['pos'],
'materiel' => $_POST['materiel'],
'marque' => $_POST['marque'],
'model' => $_POST['model'],
'nserie' => $_POST['nserie'],
'demandeur' => $_POST['demandeur'],
'traitement' => 0
));
echo 'Votre ticket à bien été pris en compte';
?>

13
prof/include/champ.php

@ -0,0 +1,13 @@
<?php
echo '<p> ',$titre,' : ';
if ($help) {
echo '<a class="int" href="#" onmouseover=displayHelp(',$sql_name,') onmouseout=hideHelp(',$sql_name,') ><img src="../img/int.png" alt="point_int" width=20px ></a>';
}
echo '</p>
<div class="champ">
<input class="entry" type=',$type,' name=',$sql_name,'><br>
<img class="check" src="../img/check.png" alt="check">
<img class="excla" src="../img/excla.png" alt="exclamation">
</div>
<small>Error: ',$error,'</small>';
?>

150
prof/index.php

@ -0,0 +1,150 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Tickets de panne</title>
<link href="stylepage.css" rel="stylesheet">
<script type="text/javascript" src="script.js" defer></script>
<img class="logo" src="../img/logo_PC.png" alt="logo_PC" width="200px">
</head>
<body id="page">
<a class="champ" href="../referant/index.php">site référant</a>
<h1 id="titre">
Formulaire de panne informatique
</h1>
<form id='form' method="POST" action="cible.php">
<div class="container-champ">
<?php
$titre = 'Date';
$sql_name = 'dates';
$type = 'date';
$error = 'Veuillez saisir une date';
$help = false;
include("include/champ.php");
?>
</div>
<div class="container-champ">
<p>Détails :</p>
<div class="champ">
<textarea class="entry" rows="10" cols="30" name='details'></textarea><br>
<img class="check" src="../img/check.png" alt="check">
<img class="excla" src="../img/excla.png" alt="exclamation">
</div>
<small>Error: Veuillez remplir ce champ</small>
</div>
<div class="container-champ">
<?php
$titre = 'Lieu';
$sql_name = 'lieu';
$type = 'text';
$error = "Vous n'avez saisie de lieu";
$help = true;
include("include/champ.php");
?>
<div class="help" id="lieu">
<p>Entrez le nom du bâtiment dans lequel se trouve le matériel</p><br>
<code>Ex: bâtiment A</code>
</div>
</div>
<div class="container-champ">
<?php
$titre = 'Salle';
$sql_name = 'salle';
$type = 'text';
$error = "Vous n'avez pas saisie de salle";
$help = true;
include("include/champ.php");
?>
<div class="help" id="salle">
<p>Entrez le nom de la salle dans lequel se trouve le matériel</p><br>
<code>Ex: A 11 codage</code>
</div>
</div>
<div class="container-champ">
<?php
$titre = 'Position dans la salle';
$sql_name = 'pos';
$type = 'text';
$error = 'Veuillez remplir ce champ';
$help = true;
include("include/champ.php");
?>
<div class="help" id="pos">
<p>Veillez fournir des présision sur la position du matériel</p><br>
<code>Ex: PC-42 au fond à droite</code>
</div>
</div>
<div class="container-champ">
<p>Matériel :</p>
<div class="champ">
<select class="entry" name='materiel'>
<option value="UC">Unité Centrale</option>
<option value="IMP">Imprimante</option>
<option value="ECR">Ecran</option>
<option value="VID">Vidéo Projecteur</option>
<option value="TBI">Tableau Blanc Interactif</option>
</select>
<img class="check" src="../img/check.png" alt="check">
<img class="excla" src="../img/excla.png" alt="exclamation">
</div>
<small></small>
</div>
<div class="container-champ">
<?php
$titre = 'Marque';
$sql_name = 'marque';
$type = 'text';
$error = "Vous n'avez pas saisie la marque";
$help = true;
include("include/champ.php");
?>
<div class="help" id="marque">
<p>Veillez renseigner la marque du matériel</p><br>
<code>Ex: Asus</code>
</div>
</div>
<div class="container-champ">
<?php
$titre = 'Model';
$sql_name = 'model';
$type = 'text';
$error = "Veuillez saisir le model";
$help = true;
include("include/champ.php");
?>
<div class="help" id="model">
<p>Veillez renseigner le modèle du matériel</p><br>
<code>Ex: Lattitude E6410</code>
</div>
</div>
<div class="container-champ">
<?php
$titre = 'N° de série';
$sql_name = 'nserie';
$type = 'text';
$error = "Vous n'avez saisie le n° de série";
$help = false;
include("include/champ.php");
?>
</div>
<div class="container-champ">
<?php
$titre = 'Nom';
$sql_name = 'demandeur';
$type = 'text';
$error = 'Veulliez entrer votre nom';
$help = false;
include("include/champ.php");
?>
</div>
<div class="container-champ">
<br>
<div class="submit">
<input id="submit" class="entry" type="submit" value="Valider">
</div>
</div>
</form>
</body>
</html>

62
prof/script.js

@ -0,0 +1,62 @@
const button = document.getElementById('submit');
const page = document.getElementById('page');
const check = document.getElementsByClassName('check');
const excla = document.getElementsByClassName('excla');
const entry = document.getElementsByClassName('entry');
const help = document.getElementsByClassName('help');
document.getElementById("form").addEventListener('submit', function(e) {
e.preventDefault();
if (checkInputs() == true) {
console.log('check');
var data = new FormData(this);
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
console.log(this.response);
} else if (this.readyState == 4) {
alert('uhe erreur est survenue...');
}
};
xhr.open('POST', 'cible.php', true);
xhr.send(data);
}
});
function displayHelp(id) {
id.style.display = 'block';
}
function hideHelp(id) {
id.style.display = 'none';
}
function checkInputs() {
let success = true;
for (let i=0; i < (entry.length - 1) ; i++) {
if (entry[i].value == '') {
setError(i);
success = false;
}
else {
setSuccess(i);
}
}
return success;
}
function setError(indice) {
check[indice].style.display = 'none';
excla[indice].style.display = 'block';
document.getElementsByTagName('small')[indice].style.display = 'block';
}
function setSuccess(indice) {
check[indice].style.display = 'block';
excla[indice].style.display = 'none';
document.getElementsByTagName('small')[indice].style.display = 'none';
}

145
prof/stylepage.css

@ -0,0 +1,145 @@
head{
display: inline-table;
}
a{
color: #2ecc71;
}
body{
z-index: 1;
background-color: #e5e5e5;
margin: 20px;
text-align: center;
}
.logo{
display: block;
}
h1{
margin: 40px;
font-weight: bold;
color: #454545;
}
p{
font-weight: bold;
color: #454444;
font-size: 20px;
height: 20px;
}
form{
width: 400px;
position: relative;
background-color: #ffffff;
display: block;
margin: auto;
border-radius: 30px;
padding: 20px;
}
.container-champ{
position: relative;
}
.container-champ small{
display: none;
color: red;
}
.champ{
background-color: inherit;
display: flex;
position: relative;
text-decoration-line: none;
flex-direction: row-reverse;
text-align: center;
color: #454444;
display: block;
margin: 10px auto;
border: 4px solid #4e4d4d;
padding: 10px 10px;
width: 200px;
border-radius: 30px;
transition: 0.25s;
}
.entry{
border: none;
resize: none;
outline: none;
width: 100%;
text-align: inherit;
background-color: inherit;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.champ:focus, .champ:hover{
width: 300px;
border-color: #ac2a8d;
background-color: #dddddd;
}
.champ img{
display: none;
position: relative;
float: right;
width: 20px;
bottom: 20px;
right: 20px;
}
.submit{
background-color: inherit;
display: flex;
position: relative;
flex-direction: row-reverse;
text-align: center;
color: #454444;
display: block;
margin: 10px auto;
border: 4px solid #4e4d4d;
padding: 10px 10px;
width: 200px;
border-radius: 30px;
transition: 0.25s;
}
.submit:hover{
width: 250px;
background-color: #82E6AC;
border-color: #2ecc71;
}
.help{
display: none;
z-index: 2;
position: absolute;
width: 170px;
right: 0;
top: 30%;
border-radius: 30px;
padding: 15px;
margin: 0;
background-color: #dddddd;
}
.help * {
font-size: 14px;
width: 100%;
}
.help p{
position: relative;
}
code {
background-color: #aaa;
border-radius: 5px;
font-family: courier, monospace;
padding: 3px 5px;
}

19
referant/cible/script.js

@ -0,0 +1,19 @@
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);
});

7
referant/cible/search.php

@ -0,0 +1,7 @@
<?php
$bdd = new PDO('mysql:host=localhost;dbname=ticket;charset:utf8', 'root', '');
$reponse = $bdd->query("SELECT * FROM pannes ORDER BY ID");
print_r($reponse -> fetch($_POST['id']));
?>

6
referant/include/menu.php

@ -0,0 +1,6 @@
<head>
<meta charset="utf-8">
<title>Admin ticket</title>
<link href="stylepage.css" rel="stylesheet">
<img class="logo" src="../img/logo_PC.png" alt="logo_PC" width="200px">
</head>

10
referant/include/nav.php

@ -0,0 +1,10 @@
<header>
<nav>
<ul>
<li class="menu"><a href="index.php">Accueil</a></li>
<li class="menu"><a href="search.php">Recherche</a></li>
<li class="menu"><a href="actus.html">Actus</a></li>
<li class="menu"><a href="liens.html">Liens</a></li>
</ul>
</nav>
</header>

8
referant/index.php

@ -0,0 +1,8 @@
<!DOCTYPE html>
<html lang="fr">
<?php include 'include/menu.php'; ?>
<body>
<a href="../prof/index.php">client</a>
<?php include 'include/nav.php'; ?>
</body>
</html>

16
referant/search.php

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="fr">
<?php include 'include/menu.php'; ?>
<body id='corps'>
<?php include 'include/nav.php'; ?>
<form id="form" action="cible/search.php" method="POST">
<div class="champ">
<input type="input" name="id">
</div>
<div class="submit">
<input id="submit" class="entry" type="submit">
</div>
</form>
<script type="text/javascript" src="cible/script.js" defer></script>
</body>
</html>

112
referant/stylepage.css

@ -0,0 +1,112 @@
body{
z-index: 1;
background-color: #e5e5e5;
margin: 20px;
text-align: center;
}
nav{
width: 80%;
margin-left: 10%;
background-color: #84878C; /*couleur nav entière*/
border-radius: 20px;
}
nav > ul{
margin-left: auto;
margin-right: auto;
padding: 0px;
width: 60%;
}
nav > ul::after{
content: "";
display: block;
clear: both;
}
nav > ul > li{
width: 25%;
float: left;
position: relative;
text-align: center;
}
nav> ul > li > a{
font-size: 100%;
padding-top: 10px;
padding-bottom: 10px;
color: #eee;
}
nav li{
list-style-type: none;
}
nav a{
display: inline-block;
text-decoration: none;
}
.menu:hover{
background-color: #59184E;
border-radius: 10px;
}
.menu:hover > a{
color: #fff; /*texte quand on passe la souris un bouton du menu*/
font-weight: bold;
}
.logo{
display: block;
}
.champ{
background-color: inherit;
position: relative;
text-align: center;
color: #454444;
display: block;
margin: 10px auto;
border: 4px solid #4e4d4d;
padding: 40px 40px;
width: 60%;
border-radius: 80px;
transition: 0.25s;
}
.champ:focus, .champ:hover{
border-color: #ac2a8d;
background-color: #dddddd;
}
.champ input{
border: none;
outline: none;
font-size: 3em;
color: #aaa;
width: 100%;
text-align: inherit;
background-color: inherit;
}
.submit{
background-color: inherit;
position: relative;
text-align: center;
color: #454444;
display: block;
margin: 10px auto;
border: 4px solid #4e4d4d;
padding: 10px 10px;
width: 200px;
border-radius: 30px;
transition: 0.25s;
}
.submit:hover{
width: 250px;
background-color: #82E6AC;
border-color: #2ecc71;
}
Loading…
Cancel
Save