Delete appointment from calendar

This commit is contained in:
coolneng 2020-07-13 19:12:22 +02:00
parent a772b300df
commit 77a4a5987e
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
4 changed files with 9 additions and 5 deletions

View File

@ -74,8 +74,11 @@
<div id="event-description"/></div> <div id="event-description"/></div>
<div id="event-start"/></div> <div id="event-start"/></div>
<div id="event-end"/></div> <div id="event-end"/></div>
<button class="create_btn" type="submit" name="edit">Editar</button> <form method="post" action="appointment_management.php">
<button class="del_btn" type="submit" name="delete">Borrar</button> <input type="hidden" name="event_id" id="event_id">
<button class="create_btn" type="submit" name="edit">Editar</button>
<button class="del_btn" type="submit" name="delete">Borrar</button>
</form>
</div> </div>
</body> </body>
</html> </html>

View File

@ -45,9 +45,9 @@ function appointmentModification(){
function appointmentDeletion(){ function appointmentDeletion(){
$id = $_POST["id"]; $id = $_POST["event_id"];
$pdo = connectDatabase(); $pdo = connectDatabase();
editAppointment($pdo, $id); deleteAppointment($pdo, $id);
closeDatabase($pdo); closeDatabase($pdo);
header('location: appointment.php'); header('location: appointment.php');
} }

View File

@ -24,6 +24,7 @@
eventClick: function(event) { eventClick: function(event) {
var start = $.fullCalendar.formatDate(event.start, 'HH:mm'); var start = $.fullCalendar.formatDate(event.start, 'HH:mm');
var end = $.fullCalendar.formatDate(event.end, 'HH:mm'); var end = $.fullCalendar.formatDate(event.end, 'HH:mm');
$("#event_id").val(event.id);
$("#event-patient").html("<b>DNI/NIE: </b>" + event.patient); $("#event-patient").html("<b>DNI/NIE: </b>" + event.patient);
$("#event-description").html("<b>Observaciones: </b>" + event.description); $("#event-description").html("<b>Observaciones: </b>" + event.description);
$("#event-start").html("<b>Comienzo: </b>" + start); $("#event-start").html("<b>Comienzo: </b>" + start);

View File

@ -420,7 +420,7 @@ function editAppointment($pdo, $data){
function deleteAppointment($pdo, $id){ function deleteAppointment($pdo, $id){
$statement = "DELETE FROM cita where id=?"; $statement = "DELETE FROM cita WHERE id=?";
$pdo->prepare($statement)->execute([$id]); $pdo->prepare($statement)->execute([$id]);
return "Cita borrada con éxito"; return "Cita borrada con éxito";
} }