Delete assets directory

This commit is contained in:
Fernando Méndez
2021-07-02 17:53:29 +02:00
committed by GitHub
parent 49ba6554f9
commit d9ca15a065
51 changed files with 0 additions and 7863 deletions

View File

@ -1,22 +0,0 @@
/**
* Práctica - Sistemas Web | Grupo D
* CompluCine - FDI-cines
*/
function cambiarCSS(nuevo){
if(nuevo.includes("main.css")){
var css = "main.css";
} else {
var css = "highContrast.css";
}
var url = "../assets/php/common/changeCSS.php?css=" + css;
$.get(url);
/* La idea era que cambiase todo dinámicamente sin refrescar la página */
document.getElementById('estilo').setAttribute('href', nuevo);
//document.getElementById('cssChange').innerHTML = oldName;
//document.getElementById('cssChange').setAttribute('onClick', 'cambiarCSS('+viejo+')');
location.reload();
}

View File

@ -1,153 +0,0 @@
/**
* Práctica - Sistemas Web | Grupo D
* CompluCine - FDI-cines
*/
//Expresión regular para comprobar que la contraseña tiene al menos 1 mayúscula y 1 número:
const regExprPass = /^(?=\w*\d)(?=\w*[A-Z])(?=\w*[a-z])\S{4,16}$/;
$(document).ready(function() {
//Iconos para validar el usuario:
$("#userValid").hide();
$("#userInvalid").hide();
$("#userWarning").hide();
//Iconos para validar el email:
$("#emailValid").hide();
$("#emailInvalid").hide();
//Iconos para validar el password:
$("#passValid").hide();
$("#passInvalid").hide();
$("#passWarning").hide();
//Iconos para validar que las contraseñas coindicen:
$("#repassValid").hide();
$("#repassInvalid").hide();
//Comprueba que el nombre de usuario introducido para el login, exista.
$("#name").change(function(){
var url = "../assets/php/common/checkUser.php?user=" + $("#name").val();
$.get(url, userLoginCheck);
});
//Comprueba que el nombre de usuario no esté registrado en la aplicación.
$("#new_name").change(function(){
var url = "../assets/php/common/checkUser.php?user=" + $("#new_name").val();
$.get(url, userCheck);
});
//Comprueba que el email introducido no esté registrado en la aplicación.
$("#new_email").change(function(){
var url = "../assets/php/common/checkEmail.php?email=" + $("#new_email").val();
$.get(url, emailCheck);
});
//Comprueba que la contraseña sea válida en base a los criterios de la aplicación.
$("#new_pass").change(function(){
const fieldPass = $("#new_pass");
fieldPass[0].setCustomValidity("");
const isPassValid = fieldPass[0].checkValidity();
if(fieldPass.val().length < 4){
$("#passValid").hide();
$("#passInvalid").hide();
$("#passWarning").show();
fieldPass[0].setCustomValidity("La contraseña debe contener almenos 4 caracteres.");
}
else if (isPassValid && passCheck(fieldPass.val())) {
$("#passValid").show();
$("#passInvalid").hide();
$("#passWarning").hide();
fieldPass[0].setCustomValidity("");
} else {
$("#passValid").hide();
$("#passInvalid").show();
$("#passWarning").hide();
fieldPass[0].setCustomValidity("La contraseña debe contener al menos 1 mayúscula y 1 número.");
}
});
//Comprueba que las contraseñas sean iguales.
$("#repass").change(function(){
const fieldPass = $("#new_pass");
const fieldRepass = $("#repass");
fieldRepass[0].setCustomValidity("");
if (Object.is(fieldPass.val(), fieldRepass.val())) {
$("#repassValid").show();
$("#repassInvalid").hide();
fieldRepass[0].setCustomValidity("");
} else {
$("#repassValid").hide();
$("#repassInvalid").show();
fieldRepass[0].setCustomValidity("Las contraseñas deben coincidir.");
}
});
//Muestra si el nombre de usuario introducido para el login existe o no.
function userLoginCheck(data, status) {
const fieldLogin = $("#name");
fieldLogin[0].setCustomValidity("");
if(data === "!avaliable") {
fieldLogin[0].setCustomValidity("");
} else {
fieldLogin[0].setCustomValidity("El nombre de usuario no está registrado.");
}
}
//Muestra si el nombre de usuario introducido es válido o no.
function userCheck(data, status) {
const fieldUser = $("#new_name");
fieldUser[0].setCustomValidity("");
if(fieldUser.val().length < 3){
$("#userValid").hide();
$("#userInvalid").hide();
$("#userWarning").show();
fieldUser[0].setCustomValidity("El nombre de usuario debe tener almenos 3 caracteres.");
}
else if(data === "avaliable") {
$("#userValid").show();
$("#userInvalid").hide();
$("#userWarning").hide();
fieldUser[0].setCustomValidity("");
} else {
$("#userValid").hide();
$("#userInvalid").show();
$("#userWarning").hide();
fieldUser[0].setCustomValidity("El nombre de usuario ya está registrado.");
}
}
//Muestra si el email introducido es válido o no.
function emailCheck(data, status) {
const fieldEmail = $("#new_email");
fieldEmail[0].setCustomValidity("");
const isEmailValid = fieldEmail[0].checkValidity();
if(!isEmailValid){
$("#emailValid").hide();
$("#emailInvalid").show();
}
else if (data === "avaliable") {
$("#emailValid").show();
$("#emailInvalid").hide();
fieldEmail[0].setCustomValidity("");
} else {
$("#emailValid").hide();
$("#emailInvalid").show();
fieldEmail[0].setCustomValidity("El email ya está registrado.");
}
}
//Devuelve true si la contraseña cumple los reuqisitos de seguridad, false en caso contrario.
function passCheck(pass) {
return regExprPass.test(pass) ? true : false;
}
})

View File

@ -1,196 +0,0 @@
/**
* Práctica - Sistemas Web | Grupo D
* CompluCine - FDI-cines
*/
//Expresión regular para validar nombre y apellidos:
const regExpr = /^([A-Za-zÁÉÍÓÚñáéíóúÑ]{0}?[A-Za-zÁÉÍÓÚñáéíóúÑ\']+[\s])+([A-Za-zÁÉÍÓÚñáéíóúÑ]{0}?[A-Za-zÁÉÍÓÚñáéíóúÑ\'])+[\s]?([A-Za-zÁÉÍÓÚñáéíóúÑ]{0}?[A-Za-zÁÉÍÓÚñáéíóúÑ\'])?$/g;
//Expresión regular para validar un código promocional:
const regExprCode = /^0?[xX]?[0-9a-fA-F]*$/;
//Fecha acutal:
const fecha = new Date();
$(document).ready(function() {
//Iconos para validar el titular de la tarjeta:
$("#cardNameValid").hide();
$("#cardNameInvalid").hide();
//Iconos para validar el número de tarjeta:
$("#carNumberValid").hide();
$("#cardNumerInvalid").hide();
//Iconos para validar el CVV:
$("#cvvValid").hide();
$("#cvvInvalid").hide();
//Iconos para validar el código promocional:
$("#codeValid").hide();
$("#codeInvalid").hide();
//Iconos para validar el mes y año de expiración de la tarjeta:
$("#dateValid").hide();
$("#dateInvalid").hide();
//Comprueba que el titular de la tarjeta es válido.
$("#card-holder").change(function(){
const cardHolder = $("#card-holder");
cardHolder[0].setCustomValidity("");
if(cardHolder.val().length > 5 && !holderCheck(cardHolder.val())){
$("#cardNameValid").show();
$("#cardNameInvalid").hide();
cardHolder[0].setCustomValidity("");
} else {
$("#cardNameValid").hide();
$("#cardNameInvalid").show();
cardHolder[0].setCustomValidity("El titular de la tarjeta no es válido.");
}
});
//Comprueba que el NÚMERO de la tarjeta es válido.
$("#card-number-0").change(function(){
const cardNumber0 = $("#card-number-0");
cardNumber0[0].setCustomValidity("");
if(cardNumber0.val().length === 4){
$("#carNumberValid").show();
$("#cardNumerInvalid").hide();
cardNumber0[0].setCustomValidity("");
} else {
$("#carNumberValid").hide();
$("#cardNumerInvalid").show();
cardNumber0[0].setCustomValidity("El número de tarjeta debe tener 16 dígitos.");
}
});
$("#card-number-1").change(function(){
const cardNumber1 = $("#card-number-1");
cardNumber1[0].setCustomValidity("");
if(cardNumber1.val().length === 4){
$("#carNumberValid").show();
$("#cardNumerInvalid").hide();
cardNumber1[0].setCustomValidity("");
} else {
$("#carNumberValid").hide();
$("#cardNumerInvalid").show();
cardNumber1[0].setCustomValidity("El número de tarjeta debe tener 16 dígitos.");
}
});
$("#card-number-2").change(function(){
const cardNumber2 = $("#card-number-2");
cardNumber2[0].setCustomValidity("");
if(cardNumber2.val().length === 4){
$("#carNumberValid").show();
$("#cardNumerInvalid").hide();
cardNumber2[0].setCustomValidity("");
} else {
$("#carNumberValid").hide();
$("#cardNumerInvalid").show();
cardNumber2[0].setCustomValidity("El número de tarjeta debe tener 16 dígitos.");
}
});
$("#card-number-3").change(function(){
const cardNumber3 = $("#card-number-3");
cardNumber3[0].setCustomValidity("");
if(cardNumber3.val().length === 4){
$("#carNumberValid").show();
$("#cardNumerInvalid").hide();
cardNumber3[0].setCustomValidity("");
} else {
$("#carNumberValid").hide();
$("#cardNumerInvalid").show();
cardNumber3[0].setCustomValidity("El número de tarjeta debe tener 16 dígitos.");
}
});
//Comprueba que el CVV de la tarjeta es válido.
$("#card-cvv").change(function(){
const cvv = $("#card-cvv");
cvv[0].setCustomValidity("");
if(cvv.val().length === 3){
$("#cvvValid").show();
$("#cvvInvalid").hide();
cvv[0].setCustomValidity("");
} else {
$("#cvvValid").hide();
$("#cvvInvalid").show();
cvv[0].setCustomValidity("El CVV debe tener 3 dígitos.");
}
});
//Comprueba que el mes de expiración de la tarjeta es válido.
$("#card-expiration-month").change(function(){
const month = $("#card-expiration-month");
month[0].setCustomValidity("");
if(parseInt(month.val()) > parseInt(fecha.getMonth())){
$("#dateValid").show();
$("#dateInvalid").hide();
month[0].setCustomValidity("");
} else {
$("#dateValid").hide();
$("#dateInvalid").show();
month[0].setCustomValidity("El mes de expiración no es válido.");
}
});
//Comprueba que el mes de expiración de la tarjeta es válido.
$("#card-expiration-year").change(function(){
const year = $("#card-expiration-year");
year[0].setCustomValidity("");
if(parseInt(year.val()) >= parseInt(fecha.getFullYear())){
$("#dateValid").show();
$("#dateInvalid").hide();
year[0].setCustomValidity("");
} else {
$("#dateValid").hide();
$("#dateInvalid").show();
year[0].setCustomValidity("El año de expiración no es válido.");
}
});
//Comprueba el código promocional introducido:
$("#code").change(function(){
var url = "../assets/php/common/checkPromo.php?code=" + $("#code").val();
$.get(url, codeCheck);
});
//Devuelve true si el nombre y apellidos del titular son válidos, false en caso contrario.
function holderCheck(name) {
return regExpr.test(name) ? true : false;
}
//Devuelve true si el código promocional es válido, false en caso contrario.
function holderCheck(code) {
return regExprCode.test(code) ? true : false;
}
//Muestra si el código promocional introducido existe o no.
function codeCheck(data, status) {
const code = $("#code");
code[0].setCustomValidity("");
if(code.val().length === 8 && data === "avaliable"){
$("#codeValid").show();
$("#codeInvalid").hide();
code[0].setCustomValidity("");
} else if(code.val().length > 0 && data === "!avaliable" ){
$("#codeValid").hide();
$("#codeInvalid").show();
code[0].setCustomValidity("El código promocional no es válido.");
} else if(code.val().length === 0 ){
$("#codeValid").hide();
$("#codeInvalid").hide();
code[0].setCustomValidity("");
}
}
});

View File

@ -1,13 +0,0 @@
/**
* Práctica - Sistemas Web | Grupo D
* CompluCine - FDI-cines
*/
function confirmDelete(e) {
if(confirm("¿Está seguro de que desea eliminar su cuenta de usuario?\nEsta acción no se puede deshacer.")){
document.getElementById("formDeleteAccount1").submit();
} else {
//location.href = "./";
e.preventDefault();
}
}

View File

@ -1,7 +0,0 @@
$(document).ready(function(){
document.getElementById('go-back').addEventListener('click', function(event){
event.preventDefault();
history.back();
//window.history.go(-1);
});
});

View File

@ -1,17 +0,0 @@
$(document).ready(function(){
$('.go-up').click(function(){
$('body, html').animate({
scrollTop: '0px'
}, 300);
});
$(window).scroll(function(){
if( $(this).scrollTop() > 0 ){
$('.go-up').slideDown(300);
} else {
$('.go-up').slideUp(300);
}
});
});

File diff suppressed because one or more lines are too long

View File

@ -1,87 +0,0 @@
/**
* Práctica - Sistemas Web | Grupo D
* CompluCine - FDI-cines
*/
window.onload = function () {
//Promociones:
var promos = document.getElementById("promotions").value;
const prefix = "../img/promos/";
const IMAGENES = JSON.parse(promos);
const TIEMPO_INTERVALO_MILESIMAS_SEG = 3500;
let posicionActual = 0;
let $botonRetroceder = document.querySelector('#retroceder');
let $botonAvanzar = document.querySelector('#avanzar');
let $imagen = document.querySelector('.imagen');
let $botonPlay = document.querySelector('#play');
let $botonStop = document.querySelector('#stop');
let intervalo;
// Funciones
/**
* Funcion que cambia la foto en la siguiente posicion
*/
function pasarFoto() {
if(posicionActual >= IMAGENES.length - 1) {
posicionActual = 0;
} else {
posicionActual++;
}
renderizarImagen();
}
/**
* Funcion que cambia la foto en la anterior posicion
*/
function retrocederFoto() {
if(posicionActual <= 0) {
posicionActual = IMAGENES.length - 1;
} else {
posicionActual--;
}
renderizarImagen();
}
/**
* Funcion que actualiza la imagen de imagen dependiendo de posicionActual
*/
function renderizarImagen () {
$imagen.style.backgroundImage = `url(${prefix+IMAGENES[posicionActual]})`;
}
/**
* Activa el autoplay de la imagen
*/
function playIntervalo() {
intervalo = setInterval(pasarFoto, TIEMPO_INTERVALO_MILESIMAS_SEG);
// Desactivamos los botones de control
//$botonAvanzar.setAttribute('disabled', true);
//$botonRetroceder.setAttribute('disabled', true);
$botonPlay.setAttribute('disabled', true);
$botonStop.removeAttribute('disabled');
}
/**
* Para el autoplay de la imagen
*/
function stopIntervalo() {
clearInterval(intervalo);
// Activamos los botones de control
$botonAvanzar.removeAttribute('disabled');
$botonRetroceder.removeAttribute('disabled');
$botonPlay.removeAttribute('disabled');
$botonStop.setAttribute('disabled', true);
}
// Eventos
$botonAvanzar.addEventListener('click', pasarFoto);
$botonRetroceder.addEventListener('click', retrocederFoto);
$botonPlay.addEventListener('click', playIntervalo);
$botonStop.addEventListener('click', stopIntervalo);
// Iniciar
renderizarImagen();
playIntervalo();
}

View File

@ -1,54 +0,0 @@
/**
* Práctica - Sistemas Web | Grupo D
* CompluCine - FDI-cines
*/
// Método 1: recargar la página y enviar un GET.
window.onload = function(){
if(!select_cinema()) select_film();
}
function select_cinema(){
var select = document.getElementById("select_cinema");
if(select != undefined){
select.onchange = function(){
location.href += "&cinema=" + $('select[id=cinemas]').val();
}
return true;
} else {
return false;
}
}
function select_film(){
var select_ = document.getElementById("select_film");
select_.onchange = function(){
location.href += "&film=" + $('select[id=films]').val();
}
}
// Método 2: enviar una petición AJAX con POST. ==> (NO FUNCIONA, PERO LA IDEA ERA HACERLO ASÍ PARA EVITAR REFRESCAR LA PÁGINA Y LLENAR LA URL)
/*
$(document).ready(function(){
$("#select_cinema").change(function(){
var cinema = $('select[id=cinemas]').val();
//console.log($('select[id=cinemas]').val());
$.ajax({
url : "index.php",
type : "post",
dataType : "html",
data : "",
success: function(response){
$("#cinemas > option[value="+ cinema +"]").attr("selected", true);
console.log(cinema);
},
error: function(response){
console.log(response + ' ==> Error al seleccionar el cine')
}
});
});
});
*/

View File

@ -1,140 +0,0 @@
$(document).ready(function(){
//Get the data that is going to be used as a filter for events
var selectedFeed = $('#hall_selector').find(':selected').data('feed');
var modal = document.getElementById("myModal");
var btn = document.getElementById("myBtn");
var span = document.getElementsByClassName("close")[0];
var calendar = $('#calendar').fullCalendar({
header:{
left:'prev,next,today',
center:'title',
right:'month,agendaWeek,agendaDay'
},
firstDay: 1,
editable:true,
fixedWeekCount: false,
eventSources: [ selectedFeed ],
selectable:true,
selectHelper:true,
timeFormat: 'H:mm',
slotLabelFormat: 'H:mm',
nowIndicator: true,
allDaySlot: false,
eventDurationEditable: false,
eventOverlap: function(stillEvent, movingEvent) {
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
select: function(start, end, allDay)
{
$(modal).fadeIn();
var x = document.getElementById("film_group");
x.style.display = "none";
x = document.getElementById("film_list");
x.style.display = "block";
document.getElementById("hall").value = document.getElementById("hall_selector").value;
document.getElementById("startDate").value = $.fullCalendar.formatDate( start, "Y-MM-DD" );
document.getElementById("endDate").value = $.fullCalendar.formatDate( end, "Y-MM-DD" );
document.getElementById("sumbit_new").style.display = "block";
document.getElementById("edit_inputs").style.display = "none";
},
//Edit only the date/hour start of an event/session when u click,drag and drop an event.
eventDrop:function(event)
{
var e = {
"newDate" : $.fullCalendar.formatDate(event.start, "Y-MM-DD HH:mm:ss"),
"idhall": document.getElementById("hall").value,
"startHour":event.start_time,
"startDate":event.date,
"price": event.seat_price,
"idfilm": event.film_id,
"format": event.format,
};
console.log(event);
$.ajax({
url:"eventsProcess.php?drop=true",
contentType: 'application/json; charset=utf-8',
dataType: "json",
type:"PUT",
data:JSON.stringify(e),
success: function(data) {
alert("El evento se ha desplazado correctamente");
calendar.fullCalendar('refetchEvents');
},
error: function(data) {
alert("Ha habido un error al desplazar el evento");
},
});
},
//Edit event/session function when u click an event. Prepares the form to be seen as such
eventClick:function(event)
{
$(modal).fadeIn();
console.log(event);
var x = document.getElementById("film_group");
x.style.display = "block";
x = document.getElementById("film_list");
x.style.display = "none";
document.getElementById("hall").value = document.getElementById("hall_selector").value;
document.getElementById("startDate").value = $.fullCalendar.formatDate( event.start, "Y-MM-DD" );
document.getElementById("endDate").value = $.fullCalendar.formatDate( event.end, "Y-MM-DD" );
document.getElementById("price").value = event.seat_price;
document.getElementById("format").value = event.format;
document.getElementById("startHour").value = event.start_time;
document.getElementById("original_hall").value = document.getElementById("hall_selector").value;
document.getElementById("original_start_time").value = event.start_time;
document.getElementById("original_date").value = $.fullCalendar.formatDate( event.start, "Y-MM-DD" );
document.getElementById("film_title").innerHTML = event.title;
document.getElementById("film_lan").innerHTML = event.film_lan;
document.getElementById("film_dur").innerHTML = event.film_dur+" min";
document.getElementById("film_img").src = "../img/films/"+event.film_img;
document.getElementById("film_id").value = event.film_id;
document.getElementById("sumbit_new").style.display = "none";
document.getElementById("edit_inputs").style.display = "grid";
},
});
//Once the filter changes, do the changes needed so full calendar research the events with the new hall
$('#hall_selector').change(onSelectChangeFeed);
function onSelectChangeFeed() {
var feed = $(this).find(':selected').data('feed');
$('#calendar').fullCalendar('removeEventSource', selectedFeed);
$('#calendar').fullCalendar('addEventSource', feed);
selectedFeed = feed;
};
//When u click on the X the form closes. If the user close it because the operation has been complete. Restart the form correctly
span.onclick = function() {
formout();
}
function formout(){
$(modal).fadeOut(100,function(){
var success = document.getElementById("success");
if(success){
calendar.fullCalendar('refetchEvents');
$(".alert").remove();
document.getElementById("session_form").style.display = "block";
document.getElementById("price").value = "";
document.getElementById("format").value = "";
document.getElementById("film_id").value = "";
document.getElementById("startHour").value ="";
}
$(".form_group").removeClass("has_error");
$(".help_block").remove();
});
}
});

View File

@ -1,207 +0,0 @@
$(document).ready(function () {
//New session
$('#sumbit_new').click( function(e) {
$(".form_group").removeClass("has_error");
$(".help_block").remove();
var formData = {
price: $("#price").val(),
format: $("#format").val(),
hall: $("#hall").val(),
startDate: $("#startDate").val(),
endDate: $("#endDate").val(),
startHour: $("#startHour").val(),
idFilm: $("#film_id").val(),
};
console.log(formData);
$.ajax({
type: "POST",
url:"eventsProcess.php",
contentType: 'application/json; charset=utf-8',
dataType: "json",
data:JSON.stringify(formData),
encode: true,
}).done(function (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();
});
//Edit session
$('#sumbit_edit').click( function(e) {
$(".form_group").removeClass("has_error");
$(".help_block").remove();
var formData = {
price: $("#price").val(),
format: $("#format").val(),
hall: $("#hall").val(),
startDate: $("#startDate").val(),
endDate: $("#endDate").val(),
startHour: $("#startHour").val(),
idFilm: $("#film_id").val(),
og_hall: $("#original_hall").val(),
og_date: $("#original_date").val(),
og_start: $("#original_start_time").val(),
};
console.log(formData);
$.ajax({
type: "PUT",
url:"eventsProcess.php",
contentType: 'application/json; charset=utf-8',
dataType: "json",
data:JSON.stringify(formData),
encode: true,
}).done(function (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();
});
//Delete Session
$('#submit_del').click( function(e) {
$(".form_group").removeClass("has_error");
$(".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);
$.ajax({
type: "DELETE",
url:"eventsProcess.php",
contentType: 'application/json; charset=utf-8',
dataType: "json",
data:JSON.stringify(formData),
encode: true,
}).done(function (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();
});
function checkErrors(data,formname) {
if (!data.success) {
if (data.errors.price) {
$("#price_group").addClass("has_error");
$("#price_group").append(
'<div class="help_block">' + data.errors.price + "</div>"
);
}
if (data.errors.format) {
$("#format_group").addClass("has_error");
$("#format_group").append(
'<div class="help_block">' + data.errors.format + "</div>"
);
}
if (data.errors.hall) {
$("#hall_group").addClass("has_error");
$("#hall_group").append(
'<div class="help_block">' + data.errors.hall + "</div>"
);
}
if (data.errors.startDate) {
$("#date_group").addClass("has_error");
$("#date_group").append(
'<div class="help_block">' + data.errors.startDate + "</div>"
);
}
if (data.errors.startDate) {
$("#date_group").addClass("has_error");
$("#date_group").append(
'<div class="help_block">' + data.errors.endDate + "</div>"
);
}
if (data.errors.date) {
$("#date_group").addClass("has_error");
$("#date_group").append(
'<div class="help_block">' + data.errors.date + "</div>"
);
}
if (data.errors.startHour) {
$("#hour_group").addClass("has_error");
$("#hour_group").append(
'<div class="help_block">' + data.errors.startHour + "</div>"
);
}
if (data.errors.idfilm) {
$("#film_msg_group").addClass("has_error");
$("#film_msg_group").append(
'<div class="help_block">' + data.errors.idfilm + "</div>"
);
}
if (data.errors.global) {
$("#global_group").addClass("has_error");
$("#global_group").append(
'<div class="help_block">' + data.errors.global + "</div>"
);
}
} else {
$("#operation_msg").addClass("has_no_error");
$("#operation_msg").append(
'<div class="alert alert_success" id="success">' + data.message + "</div>"
);
document.getElementById("session_form").style.display = "none";
}
}
//Change the view from the film list to a concrete film with some data about it
$('.film_button').bind('click', function(e) {
var id = $(this).attr('id');
var x = document.getElementById("film_group");
x.style.display = "block";
var tittle = document.getElementById("title"+id);
document.getElementById("film_title").innerHTML = tittle.innerHTML;
var lan = document.getElementById("lan"+id);
document.getElementById("film_lan").innerHTML = lan.value;
var dur = document.getElementById("dur"+id);
document.getElementById("film_dur").innerHTML = dur.innerHTML;
var img = document.getElementById("img"+id);
document.getElementById("film_img").src = "../img/films/"+img.value;
var idf = document.getElementById("id"+id);
document.getElementById("film_id").value = idf.value;
x = document.getElementById("film_list")
x.style.display = "none";
});
//Change the view from the concrete film data to a film list with all available films
$('#return').click( function() {
var x = document.getElementById("film_group");
x.style.display = "none";
x = document.getElementById("film_list");
x.style.display = "block";
});
});