-
Notifications
You must be signed in to change notification settings - Fork 0
/
createEvents.php
165 lines (151 loc) · 7.05 KB
/
createEvents.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
session_start();
require "conf.inc.php";
require "functions.php";
if (isConnected() && isActivated() && isFranchisee()) {
$pdo = connectDB();
$queryPrepared = $pdo->prepare("SELECT truckName, idUser FROM USER, TRUCK WHERE idUser = user AND emailAddress = :email");
$queryPrepared->execute([
":email" => $_SESSION["email"]
]);
$info = $queryPrepared->fetchAll(PDO::FETCH_ASSOC);
if (!empty($info)) {
$user = $info[0]["idUser"];
$truck = $info[0]["truckName"];
}
include "header.php";
?>
<?php include "navbar.php";
if (isset($_SESSION["errors"])) {
?>
<div class="col-md-11 mx-auto pb-2 pt-2 mt-5 alert-danger alert card">
<ul>
<?php
foreach ($_SESSION["errors"] as $error) {
echo "<li>" . $error . "</li>";
}
?>
</ul>
</div>
<?php
unset($_SESSION["errors"]);
}
?>
<?php if (!empty($info)) {
?>
<form class="col-md-11 mx-auto mt-5 card pb-2 pt-2" method="POST" action="functions/newEvent.php">
<div class="form-row">
<div class="input-group col-md-6">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">Nom du camion</span>
</div>
<input type="text" class="form-control" name="truckName" aria-label="truckName"
aria-describedby="basic-addon1" value="<?php echo $truck; ?>" readonly>
</div>
<div class="input-group col-md-6">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">Nom de l'évennement</span>
</div>
<input type="text" class="form-control" name="eventName" aria-label="truckName"
aria-describedby="basic-addon1" placeholder="ex: Soirée Disco chez Boris">
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="beginDate">Date de début</label>
<input type="date" class="form-control" id="beginDate" name="beginDate"
min="<?php echo date('Y-m-d'); ?>" required>
</div>
<div class="form-group col-md-6">
<label for="endDate">Date de fin</label>
<input type="date" class="form-control" id="endDate" name="endDate"
min="<?php echo date('Y-m-d'); ?>" required>
</div>
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" for="inputGroupSelect01">Options</label>
</div>
<select class="custom-select" id="inputGroupSelect01" name="type" required>
<option selected value="">Choisir un type d'évènement...</option>
<option value="0">Réservation</option>
<option value="1">Dégustation</option>
</select>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="startHour">Heure de début</label>
<input type="time" class="form-control" id="startHour" name="startHour" required>
</div>
<div class="form-group col-md-6">
<label for="endHour">Heure de fin</label>
<input type="time" class="form-control" id="endHour" name="endHour" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-8">
<label for="inputAddress">Adresse de l'évènement</label>
<input type="text" class="form-control" id="inputAddress" name="address"
placeholder="ex: 242 av. du Faubourg Saint-Antoine" required>
</div>
<div class="form-group col-md-2">
<label for="inputCity">Ville</label>
<input type="text" class="form-control" id="inputCity" name="city" placeholder="Bayonne" required>
</div>
<div class="form-group col-md-2">
<label for="inputZip">Code postal</label>
<input type="text" class="form-control" id="inputZip" name="zip" placeholder="64100" required>
</div>
</div>
<div class="form-group">
<label for="eventDesc">Description de l'évènement</label>
<textarea class="form-control" id="eventDesc" name="eventDesc" rows="3"></textarea>
</div>
<div class="form-group col-md-2" style="display: none">
<label></label>
<input type="text" class="form-control" id="inputImg" name="img">
</div>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#uploadImage"
onclick="chooseImage()">Continuer
</button>
<div class="modal fade" id="uploadImage" tabindex="-1" role="dialog" aria-labelledby="uploadImageLabel"
aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="uploadImageLabel">Ajouter une image</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="mt-1">
<div class="tab-content card mt-1" id="myTabContent">
<div class="tab-pane fade show active" id="useOne" role="tabpanel"
aria-labelledby="home-tab">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-secondary">Valider</button>
</div>
</div>
</div>
</div>
</form>
<?php } else { ?>
<div class="jumbotron jumbotron-fluid">
<div class="container">
<h1 class="display-4">Oups, vous n'avez pas de camion</h1>
<p class="lead">Il vous faut un camion pour pouvoir créer un évennement !</p>
</div>
</div>
<?php } ?>
<script src="scripts/scripts.js"></script>
<?php
include "footer.php";
} else {
header("Location: login.php");
}
?>