Execute PHP internal web-server on nix-shell
This commit is contained in:
parent
ac456c2328
commit
7106239d88
|
@ -16,5 +16,7 @@ mkShell {
|
||||||
mysql --socket="$(pwd)/.mysql/mysql.sock" -u root < $(pwd)/database/db.sql
|
mysql --socket="$(pwd)/.mysql/mysql.sock" -u root < $(pwd)/database/db.sql
|
||||||
|
|
||||||
alias mysql='mysql --socket="$(pwd)/.mysql/mysql.sock" -u root'
|
alias mysql='mysql --socket="$(pwd)/.mysql/mysql.sock" -u root'
|
||||||
|
|
||||||
|
php -S localhost:8000
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,10 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="stylesheet" href="../static/style.css" type="text/css" media="screen" />
|
<link rel="stylesheet" href="../static/style.css" type="text/css" media="screen" />
|
||||||
<link href='../lib/fullcalendar/core/main.css' rel='stylesheet' />
|
<link href='../lib/fullcalendar/core/main.css' rel='stylesheet' />
|
||||||
<link href='../lib/fullcalendar/daygrid/main.css' rel='stylesheet' />
|
|
||||||
<script src='../lib/fullcalendar/core/main.js'></script>
|
<script src='../lib/fullcalendar/core/main.js'></script>
|
||||||
<script src='../lib/fullcalendar/daygrid/main.js'></script>
|
<script src='../lib/fullcalendar/moment/main.min.js'></script>
|
||||||
|
<script src="../static/jquery-3.5.1.min.js"></script>
|
||||||
|
<script src="../static/moment.js"></script>
|
||||||
<script src="calendar.js"></script>
|
<script src="calendar.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -31,6 +32,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
<div class="response"></div>
|
||||||
<div id="calendar" style="max-width: 700px; margin: auto;"></div>
|
<div id="calendar" style="max-width: 700px; margin: auto;"></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
100
src/calendar.js
100
src/calendar.js
|
@ -1,27 +1,79 @@
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
$(document).ready(function () {
|
||||||
var calendarEl = document.getElementById('calendar');
|
var calendar = $('#calendar').fullCalendar({
|
||||||
|
|
||||||
var calendar = new FullCalendar.Calendar(calendarEl, {
|
|
||||||
plugins: [ 'dayGrid' ]
|
|
||||||
});
|
|
||||||
|
|
||||||
calendar.render();
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
$('#calendar').fullCalendar({
|
|
||||||
header: {
|
|
||||||
left: 'prev,next today',
|
|
||||||
center: 'title',
|
|
||||||
right: 'month,basicWeek,basicDay'
|
|
||||||
},
|
|
||||||
defaultDate: new Date(),
|
|
||||||
navLinks: true, // can click day/week names to navigate views
|
|
||||||
editable: true,
|
editable: true,
|
||||||
eventLimit: true, // allow "more" link when too many events
|
events: "fetch-event.php",
|
||||||
dayClick: function(date, jsEvent, view) {
|
displayEventTime: false,
|
||||||
$("#successModal").modal("show");
|
eventRender: function (event, element, view) {
|
||||||
$("#eventDate").val(date.format());
|
if (event.allDay === 'true') {
|
||||||
|
event.allDay = true;
|
||||||
|
} else {
|
||||||
|
event.allDay = false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
events: <?php echo json_encode($appointments); ?>
|
selectable: true,
|
||||||
|
selectHelper: true,
|
||||||
|
select: function (start, end, allDay) {
|
||||||
|
var title = prompt('Event Title:');
|
||||||
|
|
||||||
|
if (title) {
|
||||||
|
var start = $.fullCalendar.formatDate(start, "Y-MM-DD HH:mm:ss");
|
||||||
|
var end = $.fullCalendar.formatDate(end, "Y-MM-DD HH:mm:ss");
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: 'add-event.php',
|
||||||
|
data: 'title=' + title + '&start=' + start + '&end=' + end,
|
||||||
|
type: "POST",
|
||||||
|
success: function (data) {
|
||||||
|
displayMessage("Added Successfully");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
calendar.fullCalendar('renderEvent',
|
||||||
|
{
|
||||||
|
title: title,
|
||||||
|
start: start,
|
||||||
|
end: end,
|
||||||
|
allDay: allDay
|
||||||
|
},
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
calendar.fullCalendar('unselect');
|
||||||
|
},
|
||||||
|
|
||||||
|
editable: true,
|
||||||
|
eventDrop: function (event, delta) {
|
||||||
|
var start = $.fullCalendar.formatDate(event.start, "Y-MM-DD HH:mm:ss");
|
||||||
|
var end = $.fullCalendar.formatDate(event.end, "Y-MM-DD HH:mm:ss");
|
||||||
|
$.ajax({
|
||||||
|
url: 'edit-event.php',
|
||||||
|
data: 'title=' + event.title + '&start=' + start + '&end=' + end + '&id=' + event.id,
|
||||||
|
type: "POST",
|
||||||
|
success: function (response) {
|
||||||
|
displayMessage("Updated Successfully");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
eventClick: function (event) {
|
||||||
|
var deleteMsg = confirm("Do you really want to delete?");
|
||||||
|
if (deleteMsg) {
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "delete-event.php",
|
||||||
|
data: "&id=" + event.id,
|
||||||
|
success: function (response) {
|
||||||
|
if(parseInt(response) > 0) {
|
||||||
|
$('#calendar').fullCalendar('removeEvents', event.id);
|
||||||
|
displayMessage("Deleted Successfully");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function displayMessage(message) {
|
||||||
|
$(".response").html("<div class='success'>"+message+"</div>");
|
||||||
|
setInterval(function() { $(".success").fadeOut(); }, 1000);
|
||||||
|
}
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
<?php session_start(); ?>
|
|
||||||
<html class="no-js" lang="es">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
|
||||||
<title>Gestión de citas</title>
|
|
||||||
<meta name="description" content="">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<link rel="stylesheet" href="../static/style.css" type="text/css" media="screen" />
|
|
||||||
<link href='../lib/fullcalendar/core/main.css' rel='stylesheet' />
|
|
||||||
<link href='../lib/fullcalendar/daygrid/main.css' rel='stylesheet' />
|
|
||||||
<script src='../lib/fullcalendar/core/main.js'></script>
|
|
||||||
<script src='../lib/fullcalendar/daygrid/main.js'></script>
|
|
||||||
<script src="calendar.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<header>
|
|
||||||
<nav>
|
|
||||||
<ul class="navbar-left">
|
|
||||||
<li class="list"><a href="index.php">Página principal</a></li>
|
|
||||||
<?php if(isset($_SESSION["user"])) : ?>
|
|
||||||
<li class="list"><a href="user.php">Usuarios</a></li>
|
|
||||||
<li class="list"><a href="patient.php">Pacientes</a></li>
|
|
||||||
<li class="list"><a href="appointment.php">Citas</a></li>
|
|
||||||
<li class="list"><a href="holiday.php">Vacaciones</a></li>
|
|
||||||
<?php endif ?>
|
|
||||||
<?php if($_SESSION["user_type"] == 2) : ?>
|
|
||||||
<li class="list"><a href="report.php">Informes</a></li>
|
|
||||||
<?php endif ?>
|
|
||||||
<li class="list"><a href="login.php">Login</a></li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
</header>
|
|
||||||
<form action="../calendar_management.php" method="post">
|
|
||||||
<div class="input-group">
|
|
||||||
<label for="eventtitle">:</label>
|
|
||||||
<input type="eventTitle" name="eventTitle" class="form-control" id="eventTitle" required="">
|
|
||||||
<input type="hidden" name="eventDate" class="form-control" id="eventDate">
|
|
||||||
</div>
|
|
||||||
<button class="btn" type="submit" name="submit" >Guardar</button>
|
|
||||||
</form>
|
|
||||||
</body>
|
|
File diff suppressed because it is too large
Load Diff
|
@ -148,3 +148,9 @@ main {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
margin-bottom: 0.5em;
|
margin-bottom: 0.5em;
|
||||||
}
|
}
|
||||||
|
.success {
|
||||||
|
background: #cdf3cd;
|
||||||
|
padding: 10px 60px;
|
||||||
|
border: #c3e6c3 1px solid;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue