Remove redundant fullcalendar cruft
This commit is contained in:
@@ -6,10 +6,12 @@
|
||||
<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' />
|
||||
<script src='../lib/fullcalendar/core/main.js'></script>
|
||||
<link rel="stylesheet" href="static/style.css" type="text/css" media="screen"/>
|
||||
<link rel="stylesheet" href="static/fullcalendar.css" type="text/css" media="screen"/>
|
||||
<script src="static/jquery-3.5.1.min.js"></script>
|
||||
<script src="static/jquery-ui.min.js"></script>
|
||||
<script src="static/moment.min.js"></script>
|
||||
<script src="static/fullcalendar.min.js"></script>
|
||||
<script src="calendar.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
@@ -17,10 +19,10 @@
|
||||
<?php
|
||||
include 'database.php';
|
||||
|
||||
$pdo = connectDatabase();
|
||||
$data = fetchCalendarEvents($pdo);
|
||||
#$pdo = connectDatabase();
|
||||
#$data = fetchCalendarEvents($pdo);
|
||||
?>
|
||||
<div class="response"></div>
|
||||
<div id="calendar" style="max-width: 700px; margin: auto;"></div>
|
||||
<div id="calendar"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
253
src/calendar.js
253
src/calendar.js
@@ -1,79 +1,182 @@
|
||||
$(document).ready(function () {
|
||||
var calendar = $('#calendar').fullCalendar({
|
||||
editable: true,
|
||||
events: "fetch-event.php",
|
||||
displayEventTime: false,
|
||||
eventRender: function (event, element, view) {
|
||||
if (event.allDay === 'true') {
|
||||
event.allDay = true;
|
||||
} else {
|
||||
event.allDay = false;
|
||||
}
|
||||
},
|
||||
selectable: true,
|
||||
selectHelper: true,
|
||||
select: function (start, end, allDay) {
|
||||
var title = prompt('Event Title:');
|
||||
$(document).ready(function() {
|
||||
|
||||
if (title) {
|
||||
var start = $.fullCalendar.formatDate(start, "Y-MM-DD HH:mm:ss");
|
||||
var end = $.fullCalendar.formatDate(end, "Y-MM-DD HH:mm:ss");
|
||||
var date = new Date();
|
||||
|
||||
$.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");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
var d = date.getDate();
|
||||
|
||||
});
|
||||
});
|
||||
var m = date.getMonth();
|
||||
|
||||
function displayMessage(message) {
|
||||
$(".response").html("<div class='success'>"+message+"</div>");
|
||||
setInterval(function() { $(".success").fadeOut(); }, 1000);
|
||||
}
|
||||
var y = date.getFullYear();
|
||||
|
||||
|
||||
var calendar = $('#calendar').fullCalendar({
|
||||
|
||||
editable: true,
|
||||
|
||||
header: {
|
||||
|
||||
left: 'prev,next today',
|
||||
|
||||
center: 'title',
|
||||
|
||||
right: 'month,agendaWeek,agendaDay'
|
||||
|
||||
},
|
||||
|
||||
|
||||
events: "events.php",
|
||||
|
||||
|
||||
eventRender: function(event, element, view) {
|
||||
|
||||
if (event.allDay === 'true') {
|
||||
|
||||
event.allDay = true;
|
||||
|
||||
} else {
|
||||
|
||||
event.allDay = false;
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
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_events.php',
|
||||
|
||||
data: 'title='+ title+'&start='+ start +'&end='+ end,
|
||||
|
||||
type: "POST",
|
||||
|
||||
success: function(json) {
|
||||
|
||||
alert('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: 'update_events.php',
|
||||
|
||||
data: 'title='+ event.title+'&start='+ start +'&end='+ end +'&id='+ event.id ,
|
||||
|
||||
type: "POST",
|
||||
|
||||
success: function(json) {
|
||||
|
||||
alert("Updated Successfully");
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
eventClick: function(event) {
|
||||
|
||||
var decision = confirm("Do you really want to do that?");
|
||||
|
||||
if (decision) {
|
||||
|
||||
$.ajax({
|
||||
|
||||
type: "POST",
|
||||
|
||||
url: "delete_event.php",
|
||||
|
||||
data: "&id=" + event.id,
|
||||
|
||||
success: function(json) {
|
||||
|
||||
$('#calendar').fullCalendar('removeEvents', event.id);
|
||||
|
||||
alert("Updated Successfully");}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
eventResize: function(event) {
|
||||
|
||||
var start = $.fullCalendar.formatDate(event.start, "yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
var end = $.fullCalendar.formatDate(event.end, "yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
$.ajax({
|
||||
|
||||
url: 'update_events.php',
|
||||
|
||||
data: 'title='+ event.title+'&start='+ start +'&end='+ end +'&id='+ event.id ,
|
||||
|
||||
type: "POST",
|
||||
|
||||
success: function(json) {
|
||||
|
||||
alert("Updated Successfully");
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
1413
src/static/fullcalendar.css
Normal file
1413
src/static/fullcalendar.css
Normal file
File diff suppressed because it is too large
Load Diff
10
src/static/fullcalendar.min.js
vendored
Normal file
10
src/static/fullcalendar.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
13
src/static/jquery-ui.min.js
vendored
Normal file
13
src/static/jquery-ui.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
src/static/moment.min.js
vendored
Normal file
7
src/static/moment.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -153,3 +153,9 @@ main {
|
||||
border: #c3e6c3 1px solid;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#calendar {
|
||||
max-width: 700px;
|
||||
margin: auto;
|
||||
margin-top: 60px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user