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-start"/></div>
<div id="event-end"/></div>
<button class="create_btn" type="submit" name="edit">Editar</button>
<button class="del_btn" type="submit" name="delete">Borrar</button>
<form method="post" action="appointment_management.php">
<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>
</body>
</html>

View File

@ -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');
}

View File

@ -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("<b>DNI/NIE: </b>" + event.patient);
$("#event-description").html("<b>Observaciones: </b>" + event.description);
$("#event-start").html("<b>Comienzo: </b>" + start);

View File

@ -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";
}