diff --git a/assets/css/highContrast.css b/assets/css/highContrast.css index c10d05c..f62f560 100644 --- a/assets/css/highContrast.css +++ b/assets/css/highContrast.css @@ -701,7 +701,7 @@ form select { font-weight: 400px; color: #1f2c3d; line-height: 1.3; - padding: .3em 1.4em .3em .4em; + padding: 0.2em 0.2em 0.2em 0.2em; width: 75px; max-width: 100%; box-sizing: border-box; diff --git a/assets/css/main.css b/assets/css/main.css index 4d7441d..bedd0c6 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -694,7 +694,7 @@ form select { font-weight: 400px; color: #1f2c3d; line-height: 1.3; - padding: .3em 1.4em .3em .4em; + padding: 0.2em 0.2em 0.2em 0.2em; width: 75px; max-width: 100%; box-sizing: border-box; diff --git a/assets/css/manager.css b/assets/css/manager.css index 783a20a..a41d7f7 100644 --- a/assets/css/manager.css +++ b/assets/css/manager.css @@ -101,7 +101,7 @@ table.seat td:first-child { pointer-events: none; } -.tablelist li:nth-child(3n+) +.tablelist li:nth-child(3n) { clear: both; } diff --git a/assets/js/selectTicket.js b/assets/js/selectTicket.js new file mode 100644 index 0000000..d649bca --- /dev/null +++ b/assets/js/selectTicket.js @@ -0,0 +1,47 @@ +// Método 1: recargar la página y enviar un GET. +window.onload = function(){ + var select = document.getElementById("select_cinema"); + select.onchange = function(){ + location.href += "&cinema=" + $('select[id=cinemas]').val(); + } +} + +// Método 2: enviar una petición AJAX con POST. (NO FUNCIONA) +/* +$(document).ready(function(){ + $("#select_cinema_session").change(function(){ + var cinema = $('select[id=cinemas]').val(); + //console.log($('select[id=cinemas]').val()); + $.ajax({ + url : 'index.php', + type : 'POST', + dataType : 'text', + data : 'cinema='+cinema, + cache : false, + async : false, + success: function(data){ + $("cinemas option").remove(); + $("cinemas").append(data); + console.log(cinema); + }, + error: function(response) + { + console.log(response + ' ==> Error al seleccionar el cine') + } + }); + }); +}); +*/ + +//Método 3: enviar una petición AJAX con GET. (NO FUNCIONA) +/* +$(document).ready(function(){ + $("#select_cinema_session").change(function(){ + var cinema = $('select[id=cinemas]').val(); + //console.log($('select[id=cinemas]').val()); + $.get(window.location + "?cinema=" + cinema, function(data,status){ + console.log(cinema); + }); + }); +}); +*/ \ No newline at end of file diff --git a/assets/php/template.php b/assets/php/template.php index 352c40a..1a23ba3 100644 --- a/assets/php/template.php +++ b/assets/php/template.php @@ -701,6 +701,7 @@ "; if($page === "FDI-Cines") echo"\n"; if($page === "Panel de Usuario") echo"\n"; + if($page === "Comprar Entrada") echo"\n"; } } diff --git a/purchase/_old.index.php b/purchase/_old.index.php new file mode 100644 index 0000000..4ff77de --- /dev/null +++ b/purchase/_old.index.php @@ -0,0 +1,153 @@ +FilmData($_GET["film"]); + if($film){ + $tittle = $film->getTittle(); + + $cinemas = $filmDAO->getCinemas($_GET["film"]); + if(!empty($cinemas)){ + $cinemasNames = new ArrayIterator(array()); + $cinemasIDs = new ArrayIterator(array()); + foreach($cinemas as $key=>$value){ + $cinemasIDs[$key] = $value->getId(); + $cinemasNames[$key] = $value->getName(); + } + $cinemasIT = new MultipleIterator(MultipleIterator::MIT_KEYS_ASSOC); + $cinemasIT->attachIterator($cinemasIDs, "cID"); + $cinemasIT->attachIterator($cinemasNames, "NAME"); + + $cinemasListHTML = '
+ '; + } else { + $cinemasListHTML = '
'; + } + + $fiml_id = $film->getId(); + $cinema_id = $value["cID"]; + + $sessionsDAO = new SessionDAO("complucine"); + $sessions = $sessionsDAO->getSessions_Film_Cinema($fiml_id, $cinema_id); + if(!empty($sessions)){ + $sessionsDates = new ArrayIterator(array()); + $sessionsStarts = new ArrayIterator(array()); + $sessionsHalls = new ArrayIterator(array()); + $sessionsIDs = new ArrayIterator(array()); + foreach($sessions as $key=>$value){ + $sessionsIDs[$key] = $value->getId(); + $sessionsDates[$key] = date_format(date_create($value->getDate()), 'j-n-Y'); + $sessionsHalls[$key] = $value->getIdhall(); + $sessionsStarts[$key] = $value->getStartTime(); + } + $sessionsIT = new MultipleIterator(MultipleIterator::MIT_KEYS_ASSOC); + $sessionsIT->attachIterator($sessionsIDs, "sID"); + $sessionsIT->attachIterator($sessionsDates, "DATE"); + $sessionsIT->attachIterator($sessionsHalls, "HALL"); + $sessionsIT->attachIterator($sessionsStarts, "HOUR"); + + $count = 0; + $sessionsListHTML = ''; + + if($count == 0) { + $sessionsListHTML = ''; + $pay = false; + } + } else { + $sessionsListHTML = ''; + $pay = false; + } + + //$session_id = $value["sID"]; + //$hall_id = $value["HALL"]; + //$date_ = $value["DATE"]; + //$hour_ = $value["HOUR"]; + + //Reply: Depends on whether the purchase is to be made from a selected movie or a cinema. + $reply = '
+

Película seleccionada: '.str_replace('_', ' ', $tittle).'


+
'.$tittle.'
+

Duración: '.$film->getDuration().' minutos

+

Idioma: '.$film->getLanguage().'

+
+
+

Seleccione un Cine y una Sesión


+

Cines

+ '.$cinemasListHTML.' +

Sesiones

+ '.$sessionsListHTML.' +
+ '; + } else { + $reply = '

No existe la película.

'; + $pay = false; + } + } else if(isset($_GET["cinema"])) { + $reply = '

ESTAMOS TRABAJANDO EN ELLO

'; + $pay = false; + } else { + $reply = '

No se ha encontrado película ni cine.

'; + $pay = false; + } + + + //Pay button: + if($pay){ + $pay = ' + '; + } else { + $pay = ''; + } + //Page-specific content: + $section = ' +
+
+
+ '.$reply.' +
+
+ '.$pay.' +
+
+
+ '; + + //General page content: + require RAIZ_APP.'/HTMLtemplate.php'; +?> diff --git a/purchase/includes/formSelectTicket.php b/purchase/includes/formSelectTicket.php new file mode 100644 index 0000000..61f357c --- /dev/null +++ b/purchase/includes/formSelectTicket.php @@ -0,0 +1,50 @@ + 'error')); + + $html = ""; + + return $html; + } + + protected function procesaFormulario($datos){ + $result = array(); + + //$nombre = $this->test_input($datos['name']) ?? null; + $nombre = $datos['name'] ?? null; + $nombre = strtolower($nombre); + if ( empty($nombre) || mb_strlen($nombre) < 3 || mb_strlen($nombre) > 15 ) { + $result['name'] = "El nombre tiene que tener\n una longitud de al menos\n 3 caracteres\n y menos de 15 caracteres."; + } + + //$password = $this->test_input($datos['pass']) ?? null; + $password = $datos['pass'] ?? null; + if ( empty($password) || mb_strlen($password) < 4 ) { + $result['pass'] = "El password tiene que tener\n una longitud de al menos\n 4 caracteres."; + } + + if (count($result) === 0) { + $result[] = "La compra aun está en desarrollo. Vuelva en unos días."; + } + + return $result; + } +} +?> \ No newline at end of file diff --git a/purchase/index.php b/purchase/index.php index 4ff77de..130002f 100644 --- a/purchase/index.php +++ b/purchase/index.php @@ -15,6 +15,7 @@ $pay = true; $film = null; + $cinema = null; $cinemas = []; $sessions = []; if(isset($_GET["film"])){ @@ -24,6 +25,7 @@ $tittle = $film->getTittle(); $cinemas = $filmDAO->getCinemas($_GET["film"]); + $cinema_id = $_GET["cinema"]; if(!empty($cinemas)){ $cinemasNames = new ArrayIterator(array()); $cinemasIDs = new ArrayIterator(array()); @@ -34,71 +36,79 @@ $cinemasIT = new MultipleIterator(MultipleIterator::MIT_KEYS_ASSOC); $cinemasIT->attachIterator($cinemasIDs, "cID"); $cinemasIT->attachIterator($cinemasNames, "NAME"); - - $cinemasListHTML = '
+ + $cinemasListHTML = ' '; + $cinemasListHTML .= ' +
'; } else { $cinemasListHTML = ''; } $fiml_id = $film->getId(); - $cinema_id = $value["cID"]; - $sessionsDAO = new SessionDAO("complucine"); - $sessions = $sessionsDAO->getSessions_Film_Cinema($fiml_id, $cinema_id); - if(!empty($sessions)){ - $sessionsDates = new ArrayIterator(array()); - $sessionsStarts = new ArrayIterator(array()); - $sessionsHalls = new ArrayIterator(array()); - $sessionsIDs = new ArrayIterator(array()); - foreach($sessions as $key=>$value){ - $sessionsIDs[$key] = $value->getId(); - $sessionsDates[$key] = date_format(date_create($value->getDate()), 'j-n-Y'); - $sessionsHalls[$key] = $value->getIdhall(); - $sessionsStarts[$key] = $value->getStartTime(); - } - $sessionsIT = new MultipleIterator(MultipleIterator::MIT_KEYS_ASSOC); - $sessionsIT->attachIterator($sessionsIDs, "sID"); - $sessionsIT->attachIterator($sessionsDates, "DATE"); - $sessionsIT->attachIterator($sessionsHalls, "HALL"); - $sessionsIT->attachIterator($sessionsStarts, "HOUR"); - - $count = 0; - $sessionsListHTML = ''; + $sessionsIT = new MultipleIterator(MultipleIterator::MIT_KEYS_ASSOC); + $sessionsIT->attachIterator($sessionsIDs, "sID"); + $sessionsIT->attachIterator($sessionsDates, "DATE"); + $sessionsIT->attachIterator($sessionsHalls, "HALL"); + $sessionsIT->attachIterator($sessionsStarts, "HOUR"); - if($count == 0) { - $sessionsListHTML = ''; + $count = 0; + $sessionsListHTML = '
+ '; + + if($count == 0) { + $sessionsListHTML = '
'; + $pay = false; + } + } else { + $sessionsListHTML = '
'; $pay = false; } } else { - $sessionsListHTML = ''; + $sessionsListHTML = '
'; $pay = false; } - //$session_id = $value["sID"]; - //$hall_id = $value["HALL"]; - //$date_ = $value["DATE"]; - //$hour_ = $value["HOUR"]; - //Reply: Depends on whether the purchase is to be made from a selected movie or a cinema. $reply = '

Película seleccionada: '.str_replace('_', ' ', $tittle).'


@@ -126,14 +136,12 @@ $pay = false; } - //Pay button: if($pay){ $pay = ' - '; - } else { - $pay = ''; + '; } + //Page-specific content: $section = '