From d8e08b7c3c83c55007b69212b0112129be72bc21 Mon Sep 17 00:00:00 2001 From: Markines16 <80280295+Markines16@users.noreply.github.com> Date: Sat, 5 Jun 2021 14:28:52 +0200 Subject: [PATCH] Full Calendar Add funcional Solo falta que el formulario se reinicie una vez se ha completado la operacion --- panel_manager/eventos.php | 13 +- panel_manager/includes/NewSessionForm.php | 51 ++++--- panel_manager/sessioncalendar.js | 24 +++- panel_manager/sessionforms.js | 163 ++++++++++++++-------- 4 files changed, 167 insertions(+), 84 deletions(-) diff --git a/panel_manager/eventos.php b/panel_manager/eventos.php index 0a72204..b7f7600 100644 --- a/panel_manager/eventos.php +++ b/panel_manager/eventos.php @@ -72,7 +72,6 @@ switch($_SERVER['REQUEST_METHOD']) { $data = []; //Testing hacks $correct_response = 'OperaciĆ³n completada'; - $film = "1"; $entityBody = file_get_contents('php://input'); $dictionary = json_decode($entityBody); @@ -86,6 +85,7 @@ switch($_SERVER['REQUEST_METHOD']) { $startDate = $dictionary->{"startDate"} ?? ""; $endDate = $dictionary->{"endDate"} ?? ""; $startHour = $dictionary->{"startHour"} ?? ""; + $idfilm = $dictionary->{"idFilm"} ?? ""; if (empty($price) || $price <= 0 ) $errors['price'] = 'El precio no puede ser 0.'; @@ -108,9 +108,14 @@ switch($_SERVER['REQUEST_METHOD']) { } if (empty($startHour)) $errors['startHour'] = 'Es necesario escoger el horario de la sesion.'; - + + error_log("El valor de idfilm: ".$idfilm); + + if (!is_numeric($idfilm) && $idfilm <= 0 ) + $errors['idfilm'] = 'No se ha seleccionado una pelicula.'; + while($startDate < $endDate && empty($errors)){ - $msg = Session::create_session($_SESSION["cinema"], $hall, $startHour, $startDate, $film, $price, $format); + $msg = Session::create_session($_SESSION["cinema"], $hall, $startHour, $startDate, $idfilm, $price, $format); if(strcmp($msg,$correct_response)!== 0) $errors['price'] = $msg; @@ -121,11 +126,9 @@ switch($_SERVER['REQUEST_METHOD']) { } if (!empty($errors)) { - error_log("no success"); $data['success'] = false; $data['errors'] = $errors; } else { - error_log("succes"); $data['success'] = true; } diff --git a/panel_manager/includes/NewSessionForm.php b/panel_manager/includes/NewSessionForm.php index f116797..3fc7f7c 100644 --- a/panel_manager/includes/NewSessionForm.php +++ b/panel_manager/includes/NewSessionForm.php @@ -19,17 +19,14 @@ class NewSessionForm {
"Un empresario millonario construye un traje blindado y lo usa para combatir el crimen y el terrorismo."
+