diff --git a/src/appointment.php b/src/appointment.php index ded066f..e1324de 100644 --- a/src/appointment.php +++ b/src/appointment.php @@ -19,8 +19,14 @@
diff --git a/src/database.php b/src/database.php index 9081e51..95e9b7a 100644 --- a/src/database.php +++ b/src/database.php @@ -308,3 +308,33 @@ function configureCalendar($pdo, $data) } return "Calendario configurado con éxito"; } + + +function fetchCalendarEvents($pdo) +{ + $query = "SELECT * from cita"; + $result = $pdo->prepare($query); + $result->execute(); + $data = $result->fetchAll(); + return $data; +} + + +function fetchCalendarSettings($pdo, $doctor) +{ + $query = "SELECT * from calendario WHERE medico=?"; + $result = $pdo->prepare($query); + $result->execute([$doctor]); + $data = $result->fetch(); + return $data; +} + + +function fetchDoctorHolidays($pdo, $doctor) +{ + $query = "SELECT * FROM festivo WHERE medico IS NULL OR medico=?"; + $result = $pdo->prepare($query); + $result->execute($doctor); + $data = $result->fetchAll(); + return $data; +}