Esta comentado las opciones de sesion

Hay un fallo con film.php que esperamos arreglarlo mañana con el join en sesion y el template
This commit is contained in:
Markines16
2021-05-06 23:25:38 +02:00
committed by GitHub
parent 8bb34474d6
commit d00c212e07
6 changed files with 125 additions and 26 deletions

View File

@ -12,24 +12,66 @@ class FormHall extends Form {
public static function generaCampoFormulario($data, $errores = array()){
$number = $data['number'] ?? '';
$rows = $data['rows'] ?? '';
$cols = $data['cols'] ?? '';
$rows = $data['rows'] ?? '14';
$cols = $data['cols'] ?? '8';
$seats = $data['seats'] ?? '';
$htmlform .= '<form method="post" id="'.$data['option'].'" action="./includes/processForm.php"\>
$htmlform .= '<div class="column left">
<form method="post" id="seat_filter" action="./?state='.$data['option'].'"\>
<fieldset>
<legend> Configuracion </legend>
<input type="number" name="rows" value="'.$rows.'" min="1" placeholder="Numero de filas" required/> <br>
<input type="number" name="cols" value="'.$cols.'" min="1" placeholder="Numero de cols" required/> <br>
<button type="submit" name="seat_filter" class="button large">Actualizar</button><br>
</fieldset>
</form>
<br>
<br>
<form method="post" id="'.$data['option'].'" action="./includes/processForm.php"\>
<fieldset>
<input type="number" name="number" value="'.$number.'" min="1" placeholder="Numero de la sala" required/> <br>
<input type="number" name="rows" value= "'.$rows.'" min="1" placeholder="Filas" required/><br>
<input type="number" name="cols" value= "'.$cols.'" min="1" placeholder="Columnas" required/><br>
<input type="number" name="seats" value= "'.$seats.'" min="1" placeholder="Total de butacas?" /><br>
<input type="hidden" name="rows" value="'.$rows.'" min="1"/>
<input type="hidden" name="cols" value="'.$cols.'" min="1"/>
';
if($data['option'] == "new_hall")
$htmlform .= '<button type="submit" name="new_hall" class="button large">Crear</button></div><br>';
$htmlform .= '<button type="submit" name="new_hall" class="button large">Crear</button><br>';
$htmlform .= '
</fieldset>
</form>';
return $htmlform;
</div>
<div class="column right">
<h3 class="table_title"> Pantalla </h3>
<table class="seat">
<thead>
<tr>
<th></th>';
for($j = 1; $j<=$cols; $j++){
$htmlform .= '<th>'.$j.'</th>';
}
$htmlform .= '</tr>
</thead>
<tbody>';
for($i = 1;$i<=$rows;$i++){
$htmlform .= '
<tr>
<td>'.$i.'</td>
';
for($j=1; $j<=$cols; $j++){
$htmlform .= '<td> <input type="checkbox" class="check_box" name="checkbox'.$i.$j.'" id="checkbox'.$i.$j.'" value="1" checked> <label for="checkbox'.$i.$j.'"> </td>'
;
}
$htmlform .='
</tr>';
}
$htmlform .= '
</tbody>
</table>
</form>
</div>
';
return $htmlform;
}
//Methods:

View File

@ -101,5 +101,4 @@ class FormSession extends Form {
}
}
?>
?>

View File

@ -0,0 +1,50 @@
h3.table_title{
text-align: center;
margin-bottom: 1em;
}
table.seat {
border: solid 10px #1f2c3d;
text-align: center;
background-color: rgba(215, 215, 215, 1);
}
table.seat tbody tr:nth-child(2n + 1) {
background-color: rgba(204, 255, 204, 0);
}
table.seat th{
font-size: 0.9em;
padding: 0.30em 0.30em 0.30em 0.30em;
border-bottom: solid 2px #1f2c3d;
}
table.seat th:first-child {
border-right: solid 2px #1f2c3d;
}
table.seat td {
padding: 0.35em 0.35em;
}
table.seat td:first-child {
font-size: 0.9em;
padding: 0.30em 0.30em 0.30em 0.30em;
font-weight: 600;
border-right: solid 2px #1f2c3d;
}
.check_box {
display:none;
}
.check_box+label{
background:url('../../img/seat_red.png') no-repeat;
height: 16px;
width: 16px;
display:inline-block;
}
.check_box:checked+label{
background:url('../../img/seat_green.png') no-repeat;
}

View File

@ -7,7 +7,16 @@
include_once('formSession.php');
if(isset($_POST['new_hall'])){
$data = array("option" => "new_hall","number" => $_POST["number"],"cols" => $_POST["cols"],"rows" => $_POST["rows"], "cinema" => $_SESSION["cinema"]);
$data = array("option" => "new_hall","number" => $_POST["number"],"cols" => $_POST["cols"],"rows" => $_POST["rows"], "cinema" => $_SESSION["cinema"], "seats" => 0);
//Check what checkboxs are seats or not
for($i = 1;$i<=$data["rows"];$i++){
for($j=1; $j<=$data["cols"]; $j++){
if(!empty($_POST['checkbox'.$i.$j.''])){
$data[$i][$j] = $_POST['checkbox'.$i.$j.''];
$data["seats"]++;
} else $data[$i][$j] = "-1";
}
}
FormHall::processesForm($data);
}
@ -16,7 +25,7 @@
,"price" => $_POST["price"],"format" => $_POST["format"],"repeat" => $_POST["repeat"], "cinema" => $_SESSION["cinema"]);
FormSession::processesForm($data);
}
if(isset($_POST['edit_session'])){
$data = array("option" => "edit_session","film" => $_POST["film"],"hall" => $_POST["hall"],"date" => $_POST["date"],"start" => $_POST["start"]
,"price" => $_POST["price"],"format" => $_POST["format"],"repeat" => $_POST["repeat"], "cinema" => $_SESSION["cinema"]
@ -29,4 +38,5 @@
,"date"=> $_POST["origin_date"],"start"=> $_POST["origin_start"]);
FormSession::processesForm($data);
}
?>