Hide appointment creation form on page load

This commit is contained in:
coolneng 2020-06-26 13:39:30 +02:00
parent 21213f993d
commit 1ee89ef1f5
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
4 changed files with 9 additions and 11 deletions

View File

@ -38,7 +38,7 @@
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php closeDatabase($pdo); ?> <?php closeDatabase($pdo); ?>
<div id="dialog-form" title="Añadir cita"> <div id="dialog-form" title="Añadir cita" style="display:none;">
<form> <form>
<div class="input-group"> <div class="input-group">
<label for="hora">Hora</label> <label for="hora">Hora</label>

View File

@ -18,7 +18,7 @@ function listEvents(){
$doctor = fetchDoctor($pdo); $doctor = fetchDoctor($pdo);
$events = fetchCalendarEvents($pdo, $doctor); $events = fetchCalendarEvents($pdo, $doctor);
closeDatabase($pdo); closeDatabase($pdo);
return json_encode($events); echo json_encode($events);
} }
@ -27,12 +27,9 @@ function listHolidays(){
$doctor = fetchDoctor($pdo); $doctor = fetchDoctor($pdo);
$holidays = fetchDoctorHolidays($pdo, $doctor); $holidays = fetchDoctorHolidays($pdo, $doctor);
closeDatabase($pdo); closeDatabase($pdo);
return json_encode($holidays); echo json_encode($holidays);
} }
if (isset($_GET["list"])) { listEvents();
listEvents(); listHolidays();
listHolidays();
header('location: appointment.php');
}

View File

@ -24,7 +24,7 @@
}, },
events: "appointment_management.php?list=1", events: "http://localhost:8000/appointment_management.php",
eventRender: function(event, element, view) { eventRender: function(event, element, view) {

View File

@ -60,7 +60,7 @@ function deletePatient($pdo, string $id)
function createHoliday($pdo, $data) function createHoliday($pdo, $data)
{ {
if (empty($data["medico"])) { if (!empty($data["medico"])) {
$query = "INSERT INTO festivo (fecha_festivo, tipo_festivo, medico) VALUES (?,?,?)"; $query = "INSERT INTO festivo (fecha_festivo, tipo_festivo, medico) VALUES (?,?,?)";
$pdo->prepare($query)->execute([$data["fecha_festivo"], $data["tipo_festivo"], $data["medico"]]); $pdo->prepare($query)->execute([$data["fecha_festivo"], $data["tipo_festivo"], $data["medico"]]);
} else { } else {
@ -189,7 +189,8 @@ function fetchRegions($pdo)
function fetchHolidays($pdo) function fetchHolidays($pdo)
{ {
$query = "SELECT * FROM festivo"; $query = "SELECT festivo.id, festivo.fecha_festivo, festivo.tipo_festivo, usuario.nombre
FROM festivo LEFT JOIN usuario ON festivo.medico = usuario.id";
$result = $pdo->prepare($query); $result = $pdo->prepare($query);
$result->execute(); $result->execute();
$data = $result->fetchAll(); $data = $result->fetchAll();