From 77a4a5987ee3fd9b8807c05377568546ecbd892b Mon Sep 17 00:00:00 2001 From: coolneng Date: Mon, 13 Jul 2020 19:12:22 +0200 Subject: [PATCH] Delete appointment from calendar --- src/appointment.php | 7 +++++-- src/appointment_management.php | 4 ++-- src/calendar.js | 1 + src/database.php | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/appointment.php b/src/appointment.php index 47dc623..f691b4d 100644 --- a/src/appointment.php +++ b/src/appointment.php @@ -74,8 +74,11 @@
- - +
+ + + +
diff --git a/src/appointment_management.php b/src/appointment_management.php index 141df14..30965e2 100644 --- a/src/appointment_management.php +++ b/src/appointment_management.php @@ -45,9 +45,9 @@ function appointmentModification(){ function appointmentDeletion(){ - $id = $_POST["id"]; + $id = $_POST["event_id"]; $pdo = connectDatabase(); - editAppointment($pdo, $id); + deleteAppointment($pdo, $id); closeDatabase($pdo); header('location: appointment.php'); } diff --git a/src/calendar.js b/src/calendar.js index 9c996ba..8e65f5f 100644 --- a/src/calendar.js +++ b/src/calendar.js @@ -24,6 +24,7 @@ eventClick: function(event) { var start = $.fullCalendar.formatDate(event.start, 'HH:mm'); var end = $.fullCalendar.formatDate(event.end, 'HH:mm'); + $("#event_id").val(event.id); $("#event-patient").html("DNI/NIE: " + event.patient); $("#event-description").html("Observaciones: " + event.description); $("#event-start").html("Comienzo: " + start); diff --git a/src/database.php b/src/database.php index 2cd40f0..9757d23 100644 --- a/src/database.php +++ b/src/database.php @@ -420,7 +420,7 @@ function editAppointment($pdo, $data){ function deleteAppointment($pdo, $id){ - $statement = "DELETE FROM cita where id=?"; + $statement = "DELETE FROM cita WHERE id=?"; $pdo->prepare($statement)->execute([$id]); return "Cita borrada con éxito"; }