Compare commits

..

No commits in common. "b93df4005bec1abce1b496dc97c5b88edf1f8259" and "f591cb5f2f54f54484783fee673c3ec3e8ea3a34" have entirely different histories.

7 changed files with 24 additions and 59 deletions

View File

@ -21,8 +21,13 @@
$pdo = connectDatabase(); $pdo = connectDatabase();
?> ?>
<?php if($_SESSION["user_type"] == 1): ?> <?php if($_SESSION["user_type"] == 2): ?>
<form name="select_doctor" method="post" action="appointment_management.php"> $user = finduser($pdo, $_SESSION["user"]);
$events = fetchCalendarEvents($pdo, $user[0][4]);
$holidays = fetchDoctorHolidays($pdo, $user[0][4]);
$calendar_settings = fetchCalendarSettings($pdo, $user[0][4]);
<?php else: ?>
<form name="select_doctor" method="get">
<?php $doctors = listDoctors($pdo); ?> <?php $doctors = listDoctors($pdo); ?>
<div class="input-group"> <div class="input-group">
<select id="medico" name="medico"> <select id="medico" name="medico">
@ -33,6 +38,11 @@
</select> </select>
<button class="create_btn" type="submit" name="select">Seleccionar</button> <button class="create_btn" type="submit" name="select">Seleccionar</button>
</div> </div>
<?php
$events = fetchCalendarEvents($pdo, $_GET["medico"]);
$holidays = fetchDoctorHolidays($pdo, $_GET["medico"]);
$calendar_settings = fetchCalendarSettings($pdo, $_GET["medico"]);
?>
<?php endif; ?> <?php endif; ?>
<?php closeDatabase($pdo); ?> <?php closeDatabase($pdo); ?>
<div class="response"></div> <div class="response"></div>

View File

@ -1,48 +0,0 @@
<?php
include'database.php';
session_start();
function fetchDoctor($pdo){
if($_SESSION["user_type"] == 2){
$user = finduser($pdo, $_SESSION["user"]);
return $user[0][4];
}
$data = $_POST;
return $_POST["medico"];
}
function listEvents(){
$pdo = connectDatabase();
$doctor = fetchDoctor($pdo);
$events = fetchCalendarEvents($pdo, $doctor);
closeDatabase($pdo);
return json_encode($events);
}
function listHolidays(){
$pdo = connectDatabase();
$doctor = fetchDoctor($pdo);
$holidays = fetchDoctorHolidays($pdo, $doctor);
closeDatabase($pdo);
return json_encode($holidays);
}
function listCalendarSettings(){
$pdo = connectDatabase();
$doctor = fetchDoctor($pdo);
$calendar_settings = fetchCalendarSettings($pdo, $doctor);
closeDatabase($pdo);
return json_encode($events);
}
if (isset($_GET["list"])) {
listEvents();
listHolidays();
listCalendarSettings();
header('location: appointment.php');
}

View File

@ -15,7 +15,7 @@
header: { header: {
left: 'prev,next,today', left: 'prev,next today',
center: 'title', center: 'title',
@ -24,7 +24,7 @@
}, },
events: "appointment_management.php?list=1", events: "events.php",
eventRender: function(event, element, view) { eventRender: function(event, element, view) {
@ -47,9 +47,10 @@
select: function(start, end, allDay) { select: function(start, end, allDay) {
var title = prompt('Título: '); var title = prompt('Event Title:');
var duration = prompt('Duración: ');
if (title) {
var start = $.fullCalendar.formatDate(start, "Y-MM-DD HH:mm:ss"); var start = $.fullCalendar.formatDate(start, "Y-MM-DD HH:mm:ss");
@ -57,7 +58,7 @@
$.ajax({ $.ajax({
url: 'appointment_management.php', url: 'add_events.php',
data: 'title='+ title+'&start='+ start +'&end='+ end, data: 'title='+ title+'&start='+ start +'&end='+ end,
@ -85,9 +86,11 @@
}, },
true
); );
}
calendar.fullCalendar('unselect'); calendar.fullCalendar('unselect');

View File

@ -32,7 +32,7 @@
$pdo = connectDatabase(); $pdo = connectDatabase();
$list = fetchHolidays($pdo); $list = listHolidays($pdo);
foreach ($list as $row) : foreach ($list as $row) :
?> ?>

View File

@ -187,7 +187,7 @@ function fetchRegions($pdo)
return $data; return $data;
} }
function fetchHolidays($pdo) function listHolidays($pdo)
{ {
$query = "SELECT * FROM festivo"; $query = "SELECT * FROM festivo";
$result = $pdo->prepare($query); $result = $pdo->prepare($query);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

View File

@ -134,7 +134,7 @@ main {
text-align: center; text-align: center;
color: white; color: white;
background-image: linear-gradient(rgba(0, 0, 0, 0.5),rgba(0, 0, 0, 0.5)), url('cover.jpg'); background-image: linear-gradient(rgba(0, 0, 0, 0.5),rgba(0, 0, 0, 0.5)), url('https://www.pepperconstruction.com/sites/default/files/images/pmc1.jpg');
background-size: cover; background-size: cover;
background-position: center center; background-position: center center;
background-repeat: no-repeat; background-repeat: no-repeat;
@ -155,7 +155,7 @@ main {
} }
#calendar { #calendar {
max-width: 600px; max-width: 700px;
margin: auto; margin: auto;
margin-top: 60px; margin-top: 60px;
} }