From a2f7a7290d0b54650c249a0bf59e66d8d7691135 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 17 Jan 2018 16:09:31 +0100 Subject: [PATCH] Refine the fligth search: - Make a select for the cities; - Keep selected values between each call. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Permit to cancel a reservation. Signed-off-by: Jérôme Benoit --- includes/account.php | 2 +- includes/formbooking.php | 2 +- includes/formreservations.php | 25 +++++++++++++++ includes/formsearch.php | 54 +++++++++++++++++++++++++++++--- includes/reservations.php | 58 ++++++++++++++++++++++++++++++++++- includes/search.php | 38 ++++++++++++++++++++--- styles/airpolytech.css | 25 ++++++++++++++- 7 files changed, 191 insertions(+), 13 deletions(-) create mode 100644 includes/formreservations.php diff --git a/includes/account.php b/includes/account.php index c7099db..073d5ad 100644 --- a/includes/account.php +++ b/includes/account.php @@ -1,7 +1,7 @@ "; redirect("index.php?page=login", 2); include('footer.html'); exit(); diff --git a/includes/formbooking.php b/includes/formbooking.php index dd4189e..3d55c50 100644 --- a/includes/formbooking.php +++ b/includes/formbooking.php @@ -7,7 +7,7 @@ $form_return_flight = filter_input(INPUT_POST, "return_flight", FILTER_VALIDATE_ global $is_logged_in; if (!$is_logged_in) { - echo "Please login first."; + echo "Please login first.
"; redirect("index.php?page=login", 2); } diff --git a/includes/formreservations.php b/includes/formreservations.php new file mode 100644 index 0000000..479489b --- /dev/null +++ b/includes/formreservations.php @@ -0,0 +1,25 @@ +prepare_query($sql_pquery); + $connection->prepared_query_bind_param("iss", array($client_id, $form_flight_id, $form_class_name)); + $connection->run_prepared_query(); + $connection->close_prepared_query(); + echo "Votre réservation a été annulée.
"; + redirect("index.php?page=reservations", 3); +} else { + echo "Make an error message.
"; +} + +?> diff --git a/includes/formsearch.php b/includes/formsearch.php index 951bef1..7796f06 100644 --- a/includes/formsearch.php +++ b/includes/formsearch.php @@ -1,5 +1,4 @@ add(new DateInterval("P6M")); + $form_arrival_date = $oArrivalDate->format('Y-m-d\TH:i'); +} + ?>

Rechercher un vol

@@ -39,13 +45,51 @@ if ($oArrivalDate <= $oDepartureDate) { - + - + - + />
@@ -97,7 +141,7 @@ if (!$input_failure) { - + \n"; echo " \n"; diff --git a/includes/reservations.php b/includes/reservations.php index e986fb6..f560b9a 100644 --- a/includes/reservations.php +++ b/includes/reservations.php @@ -1,10 +1,66 @@ "; redirect("index.php?page=login", 2); include('footer.html'); exit(); } ?>

Mes réservations

+ ? + order by DateD, NumVol, Prix"; +$connection->prepare_query($sql_pquery); +$connection->prepared_query_bind_param("is", array($client_id, $date_now)); +$connection->run_prepared_query(); +$connection->get_pquery_result(); +$rows = $connection->get_result_array(); +$connection->close_prepared_query(); +//var_dump($rows); +if (empty($rows)) { + echo "Aucune(s) réservation(s) en cours pour le moment.
"; +} else { + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + foreach ($rows as $row) { + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + } + echo "
Numéro de volVille de départDate de départVille d'arrivéeDate d'arrivéeClasseNombre de place(s)PrixActions
" . $row['NumVol'] . "" . $row['VilleD'] . "" . $row['DateD'] . "" . $row['VilleA'] . "" . $row['DateA'] . "" . $row['Classe'] . "" . $row['NbPlaces'] . "" . $row['Prix'] . "€ +
+ + + + + +
+
"; +} +?> diff --git a/includes/search.php b/includes/search.php index 03a9560..3365090 100644 --- a/includes/search.php +++ b/includes/search.php @@ -4,15 +4,45 @@
diff --git a/styles/airpolytech.css b/styles/airpolytech.css index a5e5ebc..fbbb3cc 100644 --- a/styles/airpolytech.css +++ b/styles/airpolytech.css @@ -45,7 +45,11 @@ form#booking { width: 250px; } -label, input { +form#reservations { + width: 130px; +} + +label, input, select { /* in order to define widths */ display: inline-block; } @@ -63,6 +67,13 @@ label + input { margin: 0 30% 0 4%; } +label + select { + width: 30%; + /* large margin-right to force the next element to the new-line + and margin-left to create a gutter between the label and select */ + margin: 0 30% 0 4%; +} + /* only the submit button is matched by this selector, but to be sure you could use an id or class for that button */ input + input { @@ -91,6 +102,18 @@ table#search tr:nth-child(odd) { background-color: #474343; } +table#reservations { + border: none; +} + +table#reservations tr:nth-child(even) { + background-color: #675b5b; +} + +table#reservations tr:nth-child(odd) { + background-color: #474343; +} + #header { font-size: 4em; text-align: center; -- 2.34.1