Add files via upload

This commit is contained in:
Markines16 2021-06-07 23:15:57 +02:00 committed by GitHub
parent 0b6faa00eb
commit 3ee19f4c5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 47 deletions

View File

@ -7,25 +7,30 @@ $(document).ready(function(){
var span = document.getElementsByClassName("close")[0]; var span = document.getElementsByClassName("close")[0];
var calendar = $('#calendar').fullCalendar({ var calendar = $('#calendar').fullCalendar({
editable:true,
header:{ header:{
left:'prev,next today', left:'prev,next,today',
center:'title', center:'title',
right:'month,agendaWeek,agendaDay' right:'month,agendaWeek,agendaDay'
}, },
firstDay: 1, firstDay: 1,
editable:true,
fixedWeekCount: false, fixedWeekCount: false,
eventSources: [ selectedFeed ], eventSources: [ selectedFeed ],
selectable:true, selectable:true,
selectHelper:true, selectHelper:true,
timeFormat: 'H:mm', timeFormat: 'H:mm',
slotLabelFormat: 'H:mm',
nowIndicator: true,
allDaySlot: false,
eventDurationEditable: false,
eventOverlap: function(stillEvent, movingEvent) { eventOverlap: function(stillEvent, movingEvent) {
return (stillEvent.start_time > stillEvent.end && stillEvent.end < movingEvent.start_time) return (stillEvent.start_time > movingEvent.start_time && stillEvent.end < movingEvent.start_time)
}, },
//Add event/session function when u click in any non-event date. Prepares the form to be seen as such //Add event/session function when u click in any non-event date. Prepares the form to be seen as such
select: function(start, end, allDay) select: function(start, end, allDay)
{ {
$(modal).fadeIn(); $(modal).fadeIn();
var x = document.getElementById("film_group"); var x = document.getElementById("film_group");
@ -40,7 +45,6 @@ $(document).ready(function(){
document.getElementById("sumbit_new").style.display = "block"; document.getElementById("sumbit_new").style.display = "block";
document.getElementById("edit_inputs").style.display = "none"; document.getElementById("edit_inputs").style.display = "none";
}, },
editable:true,
//Edit only the date/hour start of an event/session when u click,drag and drop an event. //Edit only the date/hour start of an event/session when u click,drag and drop an event.
eventDrop:function(event) eventDrop:function(event)
{ {
@ -50,10 +54,9 @@ $(document).ready(function(){
"startHour":event.start_time, "startHour":event.start_time,
"startDate":event.date, "startDate":event.date,
"price": event.seat_price, "price": event.seat_price,
"idfilm": event.film.idfilm, "idfilm": event.film_id,
"format": event.format, "format": event.format,
}; };
console.log(e);
console.log(event); console.log(event);
$.ajax({ $.ajax({
url:"eventsProcess.php?drop=true", url:"eventsProcess.php?drop=true",
@ -74,7 +77,7 @@ $(document).ready(function(){
eventClick:function(event) eventClick:function(event)
{ {
$(modal).fadeIn(); $(modal).fadeIn();
console.log(event);
var x = document.getElementById("film_group"); var x = document.getElementById("film_group");
x.style.display = "block"; x.style.display = "block";
@ -92,12 +95,11 @@ $(document).ready(function(){
document.getElementById("original_start_time").value = event.start_time; document.getElementById("original_start_time").value = event.start_time;
document.getElementById("original_date").value = $.fullCalendar.formatDate( event.start, "Y-MM-DD" ); document.getElementById("original_date").value = $.fullCalendar.formatDate( event.start, "Y-MM-DD" );
document.getElementById("film_title").innerHTML = event.film.tittle; document.getElementById("film_title").innerHTML = event.title;
document.getElementById("film_lan").innerHTML = event.film.language; document.getElementById("film_lan").innerHTML = event.film_lan;
document.getElementById("film_dur").innerHTML = event.film.duration+" min"; document.getElementById("film_dur").innerHTML = event.film_dur+" min";
document.getElementById("film_img").src = "../img/films/"+event.film.img; document.getElementById("film_img").src = "../img/films/"+event.film_img;
document.getElementById("film_desc").innerHTML = event.film.description; document.getElementById("film_id").value = event.film_id;
document.getElementById("film_id").value = event.film.idfilm;
document.getElementById("sumbit_new").style.display = "none"; document.getElementById("sumbit_new").style.display = "none";
document.getElementById("edit_inputs").style.display = "grid"; document.getElementById("edit_inputs").style.display = "grid";
@ -136,4 +138,3 @@ $(document).ready(function(){
}); });
} }
}); });

View File

@ -14,7 +14,7 @@ $(document).ready(function () {
startHour: $("#startHour").val(), startHour: $("#startHour").val(),
idFilm: $("#film_id").val(), idFilm: $("#film_id").val(),
}; };
console.log(formData);
$.ajax({ $.ajax({
type: "POST", type: "POST",
url:"eventsProcess.php", url:"eventsProcess.php",
@ -23,7 +23,6 @@ $(document).ready(function () {
data:JSON.stringify(formData), data:JSON.stringify(formData),
encode: true, encode: true,
}).done(function (data) { }).done(function (data) {
console.log(data);
checkErrors(data,"session_form"); checkErrors(data,"session_form");
}) })
.fail(function (jqXHR, textStatus) { .fail(function (jqXHR, textStatus) {
@ -61,7 +60,6 @@ $(document).ready(function () {
data:JSON.stringify(formData), data:JSON.stringify(formData),
encode: true, encode: true,
}).done(function (data) { }).done(function (data) {
console.log(data);
checkErrors(data,"session_form"); checkErrors(data,"session_form");
}) })
.fail(function (jqXHR, textStatus) { .fail(function (jqXHR, textStatus) {
@ -76,30 +74,30 @@ $(document).ready(function () {
$(".form_group").removeClass("has_error"); $(".form_group").removeClass("has_error");
$(".help_block").remove(); $(".help_block").remove();
if(confirm("¿Seguro que quieres eliminar esta sesión?")){
var formData = {
og_hall: $("#original_hall").val(),
og_date: $("#original_date").val(),
og_start: $("#original_start_time").val(),
};
console.log(formData);
var formData = { $.ajax({
og_hall: $("#original_hall").val(), type: "DELETE",
og_date: $("#original_date").val(), url:"eventsProcess.php",
og_start: $("#original_start_time").val(), contentType: 'application/json; charset=utf-8',
}; dataType: "json",
console.log(formData); data:JSON.stringify(formData),
encode: true,
$.ajax({ }).done(function (data) {
type: "DELETE", checkErrors(data,"session_form")
url:"eventsProcess.php", })
contentType: 'application/json; charset=utf-8', .fail(function (jqXHR, textStatus) {
dataType: "json", $("form#session_form").html(
data:JSON.stringify(formData), '<div class="alert alert_danger">Could not reach server, please try again later. '+textStatus+'</div>'
encode: true, );
}).done(function (data) { });
console.log(data); }
checkErrors(data,"session_form")
})
.fail(function (jqXHR, textStatus) {
$("form#session_form").html(
'<div class="alert alert_danger">Could not reach server, please try again later. '+textStatus+'</div>'
);
});
e.preventDefault(); e.preventDefault();
}); });
@ -189,9 +187,6 @@ $(document).ready(function () {
var img = document.getElementById("img"+id); var img = document.getElementById("img"+id);
document.getElementById("film_img").src = "../img/films/"+img.value; document.getElementById("film_img").src = "../img/films/"+img.value;
var desc = document.getElementById("desc"+id);
document.getElementById("film_desc").innerHTML = desc.value;
var idf = document.getElementById("id"+id); var idf = document.getElementById("id"+id);
document.getElementById("film_id").value = idf.value; document.getElementById("film_id").value = idf.value;