diff --git a/panel_manager/includes/formHall.php b/panel_manager/includes/formHall.php
index 89e27c9..9733d13 100644
--- a/panel_manager/includes/formHall.php
+++ b/panel_manager/includes/formHall.php
@@ -7,23 +7,28 @@ class FormHall extends Form {
private $option;
private $cinema;
+ private $og_hall;
+ private $first;
//Constructor:
- public function __construct($option, $cinema) {
+ public function __construct($option, $cinema, $hall) {
+
$this->option = $option;
$this->cinema = $cinema;
- $options = array("action" => "./?state=".$option);
+ $this->og_hall = $hall;
+
+ if($option == "edit_hall")
+ $this->first = true;
+
+ $options = array("action" => "./?state=".$option."&number=".$hall->getNumber()."");
parent::__construct('formHall',$options);
}
protected function generaCamposFormulario($data, $errores = array()){
//Prepare the data
- $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;
+ $number = $data['number'] ?? $this->og_hall->getNumber() ?? "";
+ $rows = $data['rows'] ?? $this->og_hall->getNumRows() ?? "12";
+ $cols = $data['cols'] ?? $this->og_hall->getNumCol() ?? "8";
//Seats_map
$seats = 0;
@@ -35,10 +40,11 @@ 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(isset($data["restart"]) || $this->first){
+ $first = false;
+ $rows = $this->og_hall->getNumRows();
+ $cols = $this->og_hall->getNumCol();
+ $seat_list = Seat::getSeatsMap($this->og_hall->getNumber(), $this->cinema);
if($seat_list){
foreach($seat_list as $seat){
$seats_map[$seat->getNumRows()][$seat->getNumCol()] = $seat->getState();
@@ -76,21 +82,17 @@ class FormHall extends Form {
'.$errorSeats.' '.$errorRows.' '.$errorCols.'
-
-
- ';
+
+ ';
if($this->option == "edit_hall")
$html .= ' ';
$html .='
-
- '.$errorNumber.'
-
Numero | -Filas | -Columnas | -Asientos Disponibles | -
---|