Show appointment information on click

This commit is contained in:
coolneng 2020-07-13 19:03:06 +02:00
parent 646f97fa79
commit a772b300df
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
4 changed files with 34 additions and 19 deletions

View File

@ -69,5 +69,13 @@
</div> </div>
<div class="response"></div> <div class="response"></div>
<div id="calendar"></div> <div id="calendar"></div>
<div id="event-info" style="display:none;">
<div id="event-patient"/></div>
<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>
</div>
</body> </body>
</html> </html>

View File

@ -17,8 +17,10 @@ function renameArray($data){
foreach($data as $row){ foreach($data as $row){
$events[] = array( $events[] = array(
"id" => $row["id"], "id" => $row["id"],
"title" => "Cita de " . $row["apellido"], "title" => $row["apellido"] . ", " . $row["nombre"],
"start" => $row["fecha"] . " " . $row["hora"], "start" => $row["fecha"] . " " . $row["hora"],
"description" => $row["observaciones"],
"patient" => $row["documento_identificativo"],
"end" => $row["fecha"] . " " . $row["end"], "end" => $row["fecha"] . " " . $row["end"],
); );
} }

View File

@ -1,5 +1,4 @@
$(document).ready(function() { $(document).ready(function() {
var queryString = window.location.search; var queryString = window.location.search;
var calendar = $('#calendar').fullCalendar({ var calendar = $('#calendar').fullCalendar({
@ -10,7 +9,6 @@
right: 'month,agendaWeek,agendaDay' right: 'month,agendaWeek,agendaDay'
}, },
events: "appointment_feed.php" + queryString, events: "appointment_feed.php" + queryString,
selectable: true, selectable: true,
@ -18,12 +16,19 @@
selectHelper: true, selectHelper: true,
select: function(start, end, allDay) { select: function(start, end, allDay) {
$("#dialog-form").dialog({ modal: true, width:450}); $("#dialog-form").dialog({ modal: true, width:450});
var date = $.fullCalendar.formatDate(start, 'YYYY-MM-DD'); var date = $.fullCalendar.formatDate(start, 'YYYY-MM-DD');
$("#fecha").val(date); $("#fecha").val(date);
},
eventClick: function(event) {
var start = $.fullCalendar.formatDate(event.start, 'HH:mm');
var end = $.fullCalendar.formatDate(event.end, 'HH:mm');
$("#event-patient").html("<b>DNI/NIE: </b>" + event.patient);
$("#event-description").html("<b>Observaciones: </b>" + event.description);
$("#event-start").html("<b>Comienzo: </b>" + start);
$("#event-end").html("<b>Fin: </b>" + end);
$("#event-info").dialog({title: event.title, width:450});
} }
}); });

View File

@ -370,7 +370,7 @@ function configureCalendar($pdo, $data)
function fetchCalendarEvents($pdo, $doctor) function fetchCalendarEvents($pdo, $doctor)
{ {
$query = "SELECT cita.id, fecha, hora, duracion, medico, observaciones, 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 INNER JOIN paciente ON cita.paciente = paciente.id
WHERE medico=?"; WHERE medico=?";
$result = $pdo->prepare($query); $result = $pdo->prepare($query);