diff --git a/panel_manager/includes/formHall.php b/panel_manager/includes/formHall.php index 9b9f591..9ef6675 100644 --- a/panel_manager/includes/formHall.php +++ b/panel_manager/includes/formHall.php @@ -18,18 +18,13 @@ class FormHall extends Form { protected function generaCamposFormulario($data, $errores = array()){ //Prepare the data - if($this->option == "new_hall"){ - $number = $data['number'] ?? ""; - $rows = $data['rows'] ?? '12'; - $cols = $data['cols'] ?? '8'; - }else { - $number = $data['number'] ?? $_POST["number"]; - $rows = $data['rows'] ?? $_POST["rows"]; - $cols = $data['cols'] ?? $_POST["cols"]; - } - + $number = $data['number'] ?? $_POST["number"] ?? ""; + $rows = $data['rows'] ?? $_POST["rows"] ?? "12"; + $cols = $data['cols'] ?? $_POST["cols"] ?? "8"; $og_number = $data['og_number'] ?? $number; - + $og_rows = $data['og_rows'] ?? $rows; + $og_cols = $data['og_cols'] ?? $cols; + //Seats_map $seats = 0; $seats_map = array(); @@ -41,6 +36,8 @@ class FormHall extends Form { //Show the original seats_map once u click restart or the first time u enter this form from manage_halls's form if(isset($data["restart"]) || isset($_POST["edit_hall"]) ){ + $rows = $og_rows; + $cols = $og_cols; $seat_list = Seat::getSeatsMap($og_number, $this->cinema); if($seat_list){ foreach($seat_list as $seat){ @@ -70,13 +67,18 @@ class FormHall extends Form { $htmlErroresGlobales = self::generaListaErroresGlobales($errores); $errorNumber = self::createMensajeError($errores, 'number', 'span', array('class' => 'error')); $errorSeats = self::createMensajeError($errores, 'seats', 'span', array('class' => 'error')); - + $errorRows = self::createMensajeError($errores, 'rows', 'span', array('class' => 'error')); + $errorCols = self::createMensajeError($errores, 'cols', 'span', array('class' => 'error')); + $html = ' -
'.$htmlErroresGlobales.' '.$errorSeats.' +
'.$htmlErroresGlobales.'
Mapa de Asientos + '.$errorSeats.' '.$errorRows.' '.$errorCols.'
+

+

'; if($this->option == "edit_hall") @@ -98,6 +100,7 @@ class FormHall extends Form { '; } + if(!$errorCols && !$errorRows){ $html .='

Pantalla

@@ -133,7 +136,9 @@ class FormHall extends Form {
'; - + } else + $html .='
'; + return $html; } @@ -168,6 +173,14 @@ class FormHall extends Form { $result['seats'] = "
  • No puede haber 0 asientos disponibles.

  • "; } + if ($rows <= 0) { + $result['rows'] = "
  • No puede haber 0 o menos filas.

  • "; + } + + if ($cols <= 0) { + $result['cols'] = "
  • No puede haber 0 o menos columnas.

  • "; + } + $number = $datos['number'] ?? null; if (empty($number) && isset($datos["sumbit"])) { diff --git a/panel_manager/panel_manager.php b/panel_manager/panel_manager.php index 3624b35..ec8d1be 100644 --- a/panel_manager/panel_manager.php +++ b/panel_manager/panel_manager.php @@ -56,7 +56,6 @@ "; } } - $panel .= '
    @@ -108,7 +107,7 @@ - + '; }