-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
147 lines (129 loc) · 5.09 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
try {
$dbh = new PDO('mysql:host=localhost;dbname=affectation', 'root', '');
} catch (PDOException $e) {
print "Erreur !: " . $e->getMessage() . "<br/>";
die();
}
echo'dsklqd';
$stmt = $dbh->prepare("INSERT INTO affectation (Id_affect,Id_agent,Id_poste) VALUES (:aff, :ag , :p)");
$stmt->bindParam(':aff', NULL);
$stmt->bindParam(':ag',$_POST['p']);
$stmt->bindParam(':p',$_POST['q']);
$stmt->execute();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="index.css">
<title>Tp </title>
</head>
<body>
<section>
<header>
<h1>Affectation opération aux Postes</h1>
</header>
<div id="jj"></div>
<div class=" list-wrapper">
<div>
<h2>Liste Agents</h2>
<table style="width:100%" class="t-agentposte">
<tr>
<th>Id_Agent</th>
<th>Username</th>
<th>Nom</th>
<th>Prénom</th>
<th>mobile</th>
<th>Statut</th>
</tr>
<?php
foreach($dbh->query(' SELECT * from agent where agent.id_agent NOT IN (SELECT agent.id_agent from agent JOIN affectation ON agent.id_agent=affectation.Id_agent) ;') as $row) {
?>
<tr class="bodyt">
<td><?php echo $row['id_agent']; ?></td>
<td><?php echo $row['Username']; ?></td>
<td><?php echo $row['Nom']; ?></td>
<td><?php echo $row['Prenom']; ?></td>
<td><?php echo $row['Mobile']; ?></td>
<td><?php echo $row['Statut']; ?></td>
</tr>
<?php
}
?>
</table>
</div>
<div>
<h2>Liste des postes</h2>
<table style="width:100%" class="t-agentposte">
<tr>
<th>Id_poste</th>
<th>Designation</th>
<th>role</th>
</tr>
<?php
foreach($dbh->query('SELECT * from poste where poste.id_poste NOT IN (SELECT poste.id_poste from poste JOIN affectation ON poste.id_poste=affectation.Id_poste)') as $row) {
?>
<tr class="poste">
<td ><?php echo $row['id_poste']; ?></td>
<td><?php echo $row['Designation']; ?></td>
<td><?php echo $row['Role']; ?></td>
</tr>
<?php
}
?>
</table>
</div>
<div>
<button id="btaj" value="kara">Ajouter</button>
</div>
</div>
<div class='affectation'>
<div>
<h2>AFFECTATION</h2>
<table style="width:100%" class="t-affectation">
<tr>
<th>Id_Agent</th>
<th>Username</th>
<th>Nom</th>
<th>Prénom</th>
<th>mobile</th>
<th>Statut</th>
<th>Id_poste</th>
<th>Designation</th>
<th>role</th>
<th>Select</th>
</tr>
<tr>
<?php
foreach($dbh->query('SELECT * from agent JOIN affectation ON agent.id_agent=affectation.Id_agent JOIN poste ON affectation.Id_poste=poste.id_poste;') as $row) {
?>
<tr class="bodyt">
<td ><?php echo $row['id_agent']; ?></td>
<td><?php echo $row['Username']; ?></td>
<td><?php echo $row['Nom']; ?></td>
<td><?php echo $row['Prenom']; ?></td>
<td><?php echo $row['Mobile']; ?></td>
<td><?php echo $row['Statut']; ?></td>
<td ><?php echo $row['id_poste']; ?></td>
<td><?php echo $row['Designation']; ?></td>
<td><?php echo $row['Role']; ?></td>
<td><input type="checkbox"></td>
</tr>
<?php
}
?>
</tr>
</table>
</div>
<div>
<button>Supprimer</button>
</div>
</div>
</section>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="index.js"></script>
</body>
</html>