diff --git a/src/appointment.php b/src/appointment.php
index f691b4d..349ff1f 100644
--- a/src/appointment.php
+++ b/src/appointment.php
@@ -76,7 +76,7 @@
diff --git a/src/appointment_edit_form.php b/src/appointment_edit_form.php
new file mode 100644
index 0000000..ab1a560
--- /dev/null
+++ b/src/appointment_edit_form.php
@@ -0,0 +1,48 @@
+
+
+
+
+ Gestión de citas
+
+
+
+
+
+
+
+
+
+
diff --git a/src/appointment_management.php b/src/appointment_management.php
index 30965e2..f087865 100644
--- a/src/appointment_management.php
+++ b/src/appointment_management.php
@@ -57,8 +57,13 @@ if(isset($_POST["create"])){
appointmentCreation();
}
+if(isset($_POST["edit_form"])){
+ $event_id = $_POST["event_id"];
+ header("location: appointment_edit_form.php?event_id=$event_id");
+}
+
if(isset($_POST["edit"])){
- appointmentModification();
+ appointmentModification();
}
if(isset($_POST["delete"])){
diff --git a/src/calendar.js b/src/calendar.js
index 9b674c5..ab81a9a 100644
--- a/src/calendar.js
+++ b/src/calendar.js
@@ -2,10 +2,11 @@
var queryString = window.location.search;
var calendar = $('#calendar').fullCalendar({
- editable: true,
+ editable: false,
header: {
left: 'prev,next,today',
+ center: 'title',
right: 'month,agendaWeek,agendaDay'
},
diff --git a/src/database.php b/src/database.php
index 9757d23..f5c17b3 100644
--- a/src/database.php
+++ b/src/database.php
@@ -370,7 +370,7 @@ function configureCalendar($pdo, $data)
function fetchCalendarEvents($pdo, $doctor)
{
- $query = "SELECT cita.id, fecha, hora, duracion, medico, observaciones, nombre, apellido, documento_identificativo from cita
+ $query = "SELECT cita.id, fecha, hora, duracion, medico, observaciones, nombre, apellido, documento_identificativo FROM cita
INNER JOIN paciente ON cita.paciente = paciente.id
WHERE medico=?";
$result = $pdo->prepare($query);
@@ -412,9 +412,10 @@ function createAppointment($pdo, $data){
function editAppointment($pdo, $data){
- $query = "UPDATE cita SET (fecha, hora, duracion, medico, observaciones, paciente) VALUES (?,?,?,?,?,?)";
+ $query = "UPDATE cita SET fecha=?, hora=?, duracion=?, observaciones=?, paciente=?
+ WHERE id=?";
$pdo->prepare($query)->execute([$data["fecha"], $data["hora"], $data["duracion"],
- $data["doctor"], $data["observaciones"], $data["paciente"]]);
+ $data["observaciones"], $data["paciente"], $data["id"]]);
return "Cita modificada con éxito";
}
@@ -424,3 +425,12 @@ function deleteAppointment($pdo, $id){
$pdo->prepare($statement)->execute([$id]);
return "Cita borrada con éxito";
}
+
+
+function fetchAppointmentData($pdo, $id){
+ $query = "SELECT id, fecha, hora, duracion, observaciones FROM cita WHERE id=?";
+ $result = $pdo->prepare($query);
+ $result->execute([$id]);
+ $data = $result->fetch();
+ return $data;
+}