9de9bb41
lwadbled
feat(html): Ajout...
|
1
2
3
4
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
|
c825216f
lwadbled
feat(main.php): R...
|
5
|
<title>Réserver un banc</title>
|
9de9bb41
lwadbled
feat(html): Ajout...
|
6
7
8
9
10
11
12
13
14
15
16
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x"
crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//E1J19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4"
crossorigin="anonymous">
</script>
</head>
<body>
<?php
|
87d5afd9
lwadbled
feat(*): verifica...
|
17
18
19
20
21
22
|
session_start();
if(isset($_SESSION['identifiant'])){
$identifiant = $_SESSION['identifiant'];
}else{
echo "<meta http-equiv=\"refresh\" content=\"0;url=index.html\">";
}
|
9de9bb41
lwadbled
feat(html): Ajout...
|
23
24
25
26
27
28
29
|
include("connexion.php");
$requete = "SELECT * FROM banc ORDER BY numero";
$exec_requete = mysqli_query($db,$requete);
$reponse = mysqli_fetch_all($exec_requete);
mysqli_close($db);
?>
<form method="POST" action="menu.php">
|
87d5afd9
lwadbled
feat(*): verifica...
|
30
|
<button class="btn-lg btn-secondary" type="submit">Retour au menu</button>
|
9de9bb41
lwadbled
feat(html): Ajout...
|
31
|
</form>
|
67147733
lwadbled
fix(reservation.p...
|
32
33
34
35
36
37
38
39
40
41
|
<?php
if(isset($_GET['erreur'])){
$erreur = $_GET['erreur'];
if($erreur==1){
echo "<div class='text-center' style='color:red'>";
echo "Un problème est apparu lors de la réservation. Veuillez réessayer. <br>";
echo "</div>";
}
}
?>
|
9de9bb41
lwadbled
feat(html): Ajout...
|
42
|
<form method="POST" action="ajoutReservation.php">
|
67147733
lwadbled
fix(reservation.p...
|
43
|
<div class="text-center">
|
87d5afd9
lwadbled
feat(*): verifica...
|
44
|
<input type="date" name="txtDate" id="txtDate" onclick="minimum();" onchange="dispo_creneau();" required>
|
9de9bb41
lwadbled
feat(html): Ajout...
|
45
46
|
</div>
|
67147733
lwadbled
fix(reservation.p...
|
47
|
<div class="text-center" style="padding-left: 40rem!important; padding-right: 40rem!important;">
|
9de9bb41
lwadbled
feat(html): Ajout...
|
48
|
Banc choisi :
|
87d5afd9
lwadbled
feat(*): verifica...
|
49
|
<select class="form-select" name="banc" id="banc" onchange="dispo_creneau();" required>
|
9de9bb41
lwadbled
feat(html): Ajout...
|
50
51
52
53
54
55
56
57
|
<?php
foreach($reponse as $value){
echo '<option value="'.$value[0].'">'.$value[0].'</option>';
}
?>
</select>
</div>
|
67147733
lwadbled
fix(reservation.p...
|
58
|
<div class="text-center" style="padding-left: 40rem!important; padding-right: 40rem!important;">
|
9de9bb41
lwadbled
feat(html): Ajout...
|
59
60
|
Heure de début du créneau :
<select class="form-select" name="heure" id="heure" onchange='calcul_fin();' required>
|
87d5afd9
lwadbled
feat(*): verifica...
|
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
<option value="0" id="0" selected> 00h00 </option>
<option value="1" id="1"> 01h00 </option>
<option value="2" id="2"> 02h00 </option>
<option value="3" id="3"> 03h00 </option>
<option value="4" id="4"> 04h00 </option>
<option value="5" id="5"> 05h00 </option>
<option value="6" id="6"> 06h00 </option>
<option value="7" id="7"> 07h00 </option>
<option value="8" id="8"> 08h00 </option>
<option value="9" id="9"> 09h00 </option>
<option value="10" id="10"> 10h00 </option>
<option value="11" id="11"> 11h00 </option>
<option value="12" id="12"> 12h00 </option>
<option value="13" id="13"> 13h00 </option>
<option value="14" id="14"> 14h00 </option>
<option value="15" id="15"> 15h00 </option>
<option value="16" id="16"> 16h00 </option>
<option value="17" id="17"> 17h00 </option>
<option value="18" id="18"> 18h00 </option>
<option value="19" id="19"> 19h00 </option>
<option value="20" id="20"> 20h00 </option>
<option value="21" id="21"> 21h00 </option>
<option value="22" id="22"> 22h00 </option>
<option value="23" id="23"> 23h00 </option>
|
9de9bb41
lwadbled
feat(html): Ajout...
|
85
86
87
|
</select>
</div>
|
67147733
lwadbled
fix(reservation.p...
|
88
|
<div class="text-center">
|
9de9bb41
lwadbled
feat(html): Ajout...
|
89
90
91
|
Heure de fin du créneau : <div id="fin">01h00</div>
</div>
|
67147733
lwadbled
fix(reservation.p...
|
92
|
<div class="text-center">
|
87d5afd9
lwadbled
feat(*): verifica...
|
93
|
<button class="btn-lg btn-success" type="submit">Reserver</button>
|
9de9bb41
lwadbled
feat(html): Ajout...
|
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
</div>
</form>
<script type="text/javascript">
function minimum(){
var dtToday=new Date();
var month=dtToday.getMonth()+1;
var day=dtToday.getDate();
var year=dtToday.getFullYear();
if(month<10)
month='0'+month.toString();
if(day<10)
day='0'+day.toString();
var minDate=year.toString()+'-'+month+'-'+day;
|
9de9bb41
lwadbled
feat(html): Ajout...
|
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
var txtdate=document.getElementById('txtDate');
txtdate.min=minDate;
}
function calcul_fin(){
var test = document.getElementById('heure');
var lafin = document.getElementById('fin');
var valeur=parseInt(test.value)+1;
if(valeur==24)
valeur=0;
if(valeur<10)
var h='0'+valeur.toString();
else
var h=valeur.toString();
lafin.textContent=h+"h00";
}
|
87d5afd9
lwadbled
feat(*): verifica...
|
124
125
126
127
128
129
130
131
132
133
134
135
|
function dispo_creneau(){
var txtDate = document.getElementById('txtDate');
var newBanc = document.getElementById('banc');
var realBanc = newBanc.value;
var valDate = txtDate.value.split("-");
var year = valDate[0];
var month = valDate[1];
var day = valDate[2];
var realDate = day+"/"+month+"/"+year;
var xhttp = new XMLHttpRequest();
var params = "date="+realDate+"&banc="+realBanc;
console.log(params);
|
cdb865f1
lwadbled
feat(Python): Ajo...
|
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
xhttp.onreadystatechange=function(){
if(xhttp.readyState==4){
// Si requete faite, on modifie les horaires non dispo
var elemId;
var texte=xhttp.responseText.split("-");
if(texte.length>1){
for(var i=0;i<texte.length-1;i++){
if(texte[i][0]==0){
elemId=texte[i][1];
}else{
elemId=texte[i][0]+texte[i][1];
}
var chgt = document.getElementById(elemId);
chgt.setAttribute('disabled','disabled');
chgt.style.color="red";
}
}else{
for(var i=0;i<24;i++){
var chgt = document.getElementById(i);
chgt.removeAttribute('disabled');
chgt.style.color="black";
}
}
}
}
xhttp.open('POST','dispoCreneau.php',true);
xhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xhttp.send(params);
|
a0f8f60e
lwadbled
fix(): ajustement...
|
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
/* Enleve les creneaux deja passes dans la journee pour ne plus pouvoir les reserver */
var horaire = new Date();
var mois = parseInt(horaire.getMonth())+1;
if(mois<10){
var nouvMois = "0"+mois;
}else{
var nouvMois = mois;
}
var jour = horaire.getDate();
if(jour<10){
var nouvJour = "0"+jour;
}else{
var nouvJour = jour;
}
var laDate = nouvJour+"/"+nouvMois+"/"+horaire.getFullYear();
console.log(laDate);
console.log(realDate);
if(laDate==realDate){
var heure = horaire.getHours();
|
cdb865f1
lwadbled
feat(Python): Ajo...
|
183
|
for(var i=0;i<parseInt(heure);i++){
|
a0f8f60e
lwadbled
fix(): ajustement...
|
184
|
var chgt = document.getElementById(i);
|
cdb865f1
lwadbled
feat(Python): Ajo...
|
185
|
chgt.setAttribute('disabled','disabled');
|
a0f8f60e
lwadbled
fix(): ajustement...
|
186
|
console.log(chgt.value);
|
cdb865f1
lwadbled
feat(Python): Ajo...
|
187
|
chgt.style.color="red";
|
a0f8f60e
lwadbled
fix(): ajustement...
|
188
189
190
191
192
193
|
}
var chgt = document.getElementById(heure);
chgt.selected=true;
calcul_fin();
}
/* */
|
87d5afd9
lwadbled
feat(*): verifica...
|
194
|
}
|
9de9bb41
lwadbled
feat(html): Ajout...
|
195
196
197
|
</script>
</body>
</html>
|