tablas a listas

This commit is contained in:
marian1010 2021-06-01 11:24:37 +02:00
parent 2a5a9a9d12
commit c849f31681
3 changed files with 202 additions and 113 deletions

96
assets/css/admin.css Normal file
View File

@ -0,0 +1,96 @@
.tablelist{
display: grid;
list-style-type: none;
}
.tablelist li {
border-bottom: 1px solid black;
padding: 10px;
font-size: 20px;
text-align: center;
}
.tablelist a {
color: #000000;
}
.tablelist a:hover li{
color: rgb(211, 235, 255);
background: rgba(31, 44, 61, 1);
}
.tablelist li.title{
font-weight: bold;
}
.col7{
grid-template-columns: repeat(7,1fr);
}
.col7 .odd{
background: green;
display: grid;
grid-column-start: 1;
grid-column-end: 8;
grid-template-columns: repeat(5,auto);
}
.col7 .even{
background: pink;
display: grid;
grid-column-start: 1;
grid-column-end: 8;
grid-template-columns: repeat(5,auto);
}
.tablelist.col7 a.h4long
{
display: grid;
grid-column-start: 1;
grid-column-end: 7;
grid-template-columns: repeat(4,auto);
}
.tablelist.col7 a
{
display: grid;
grid-column-start: 5;
grid-column-end: 8;
grid-template-columns: auto;
}
.col6{
grid-template-columns: repeat(6,1fr);
}
.col6 .odd{
background: green;
display: grid;
grid-column-start: 1;
grid-column-end: 7;
grid-template-columns: repeat(5,auto);
}
.col6 .even{
background: pink;
display: grid;
grid-column-start: 1;
grid-column-end: 7;
grid-template-columns: repeat(5,auto);
}
.tablelist.col6 a.h4long
{
display: grid;
grid-column-start: 1;
grid-column-end: 6;
grid-template-columns: repeat(4,auto);
}
.tablelist.col6 a
{
display: grid;
grid-column-start: 5;
grid-column-end: 7;
grid-template-columns: auto;
}

View File

@ -484,18 +484,20 @@
$directions = array();
$phones = array();
if(is_array($cinemas)){
if(!is_array($cinemas)){
$reply = "<h2>No hay cines actualmentes</h2>";
}
else{
foreach($cinemas as $key => $value){
$ids[$key] = $value->getId();
$names[$key] = $value->getName();
$directions[$key] = $value->getDirection();
$phones[$key] = $value->getPhone();
}
}
switch($this->page){
case "Nuestros Cines":
if(is_array($cinemas)){
for($i = 0; $i < count($cinemas); $i++){
if($i%2 === 0){
if($i != 0) $reply .= "</div>
@ -524,31 +526,27 @@
";
}
$reply .= "</div>\n";
}
break;
case "Panel de Administrador":
$reply .= "<div class='row'>
<div class='column side'></div>
<div class='column middle'>
<table class='alt'>
<thead>
<tr>
<th>Id</th>
<th>Nombre</th>
<th>Direccion</th>
<th>Telefono</th>
</tr>
</thead>
<tbody>
<ul class='tablelist col6'>
<li>Id</li>
<li>Nombre</li>
<li>Dirección</li>
<li>Teléfono</li>
<li>Editar</li>
<li>Eliminar</li>
";
if(is_array($cinemas)){
for($i = 0; $i < count($cinemas); $i++){
$reply .= '<tr>
<td>'. $ids[$i] .'</td>
<td>'. $names[$i] .'</td>
<td>'. $directions[$i] .'</td>
<td>'. $phones[$i] .'</td>
<td>
$reply .= '
<li>'. $ids[$i] .'</li>
<li>'. $names[$i] .'</li>
<li>'. $directions[$i] .'</li>
<li>'. $phones[$i] .'</li>
<li>
<form method="post" action="index.php?state=mc">
<input name="id" type="hidden" value="'.$ids[$i].'">
<input name="name" type="hidden" value="'.$names[$i].'">
@ -556,8 +554,8 @@
<input name="phone" type="hidden" value="'.$phones[$i].'">
<input type="submit" id="submit" value="Editar" name="edit_cinema" class="primary" />
</form>
</td>
<td>
</li>
<li>
<form method="post" action="index.php?state=mc">
<input name="id" type="hidden" value="'.$ids[$i].'">
<input name="name" type="hidden" value="'.$names[$i].'">
@ -565,13 +563,11 @@
<input name="phone" type="hidden" value="'.$phones[$i].'">
<input type="submit" id="submit" value="Eliminar" name="delete_cinema" class="primary" />
</form>
</td>
</tr>
</li>
';
}
}
$reply .='</tbody>
</table>
$reply .='</ul>
</div>
<div class="column side"></div>
';
@ -579,9 +575,8 @@
default:
break;
}
}
return $reply;
}

View File

@ -98,7 +98,10 @@
$usernames = array();
$email = array();
$rol = array();
if(is_array($managers)){
if(!is_array($managers)){
$reply = "<h2> No hay ningun manager</h2>";
}
else{
foreach($managers as $key => $value){
$ids[$key] = $value->getId();
$idscinemas[$key] = $value->getIdcinema();
@ -106,38 +109,35 @@
$email[$key] = $value->getEmail();
$rol[$key] = $value->getRoll();
}
}
$reply= "<div class='row'>
<div class='column side'></div>
<div class='column middle'>
<table class='alt'>
<thead>
<tr>
<th>Id</th>
<th>IdCinema</th>
<th>Nombre</th>
<th>Email</th>
<th>Rol</th>
</tr>
</thead>
<tbody>
<ul class ='tablelist col7'>
<li class='title'>Id</li>
<li class='title'>IdCinema</li>
<li class='title'>Nombre</li>
<li class='title'>Email</li>
<li class='title'>Rol</li>
<li class='title'>Editar</li>
<li class='title'>Eliminar</li>
";
if(is_array($managers)){
for($i = 0; $i < count($managers); $i++){
$reply.= '<tr>
<td>'. $ids[$i] .'</td>
<td>'. $idscinemas[$i] .'</td>
<td>'. $usernames[$i] .'</td>
<td>'. $email[$i] .'</td>
<td>'. $rol[$i] .'</td>
<td>
$reply.= '
<li>'. $ids[$i] .'</li>
<li>'. $idscinemas[$i] .'</li>
<li>'. $usernames[$i] .'</li>
<li>'. $email[$i] .'</li>
<li>'. $rol[$i] .'</li>
<li>
<form method="post" action="index.php?state=mg">
<input name="id" type="hidden" value="'.$ids[$i].'">
<input name="idcinema" type="hidden" value="'.$idscinemas[$i].'">
<input type="submit" id="submit" value="Editar" name="edit_manager" class="primary" />
</form>
</td>
<td>
</li>
<li>
<form method="post" action="index.php?state=mg">
<input name="id" type="hidden" value="'.$ids[$i].'">
<input name="idcinema" type="hidden" value="'.$idscinemas[$i].'">
@ -146,17 +146,16 @@
<input name="rol" type="hidden" value="'.$rol[$i].'">
<input type="submit" id="submit" value="Eliminar" name="delete_manager" class="primary" />
</form>
</td>
</tr>
</li>
';
}
}
$reply.='</tbody>
</table>
$reply.='</ul>
</div>
<div class="column side"></div>
</div>
';
}
return $reply;
}
static function showAddBotton() {
@ -260,7 +259,10 @@
$codes = array();
$actives = array();
if(is_array($promos)){
if(!is_array($promos)){
$reply = "<h2> No hay promociones </h2>";
}
else{
foreach($promos as $key => $value){
$ids[$key] = $value->getId();
$tittles[$key] = $value->getTittle();
@ -268,32 +270,27 @@
$codes[$key] = $value->getCode();
$actives[$key] = $value->getActive();
}
}
$reply= "<div class='row'>
<div class='column middle'>
<table class='alt'>
<thead>
<tr>
<th>Id</th>
<th>Título</th>
<th>Descripcion</th>
<th>Código</th>
<th>Activo</th>
</tr>
</thead>
<tbody>
<ul class='tablelist col7'>
<li class='title'>Id</li>
<li class='title'>Título</li>
<li class='title'>Descripcion</li>
<li class='title'>Código</li>
<li class='title'>Activo</li>
<li class='title'>Editar</li>
<li class='title'>Eliminar</li>
";
if(is_array($promos)){
for($i = 0; $i < count($promos); $i++){
$reply.= '<tr>
<td>'. $ids[$i] .'</td>
<td>'. $tittles[$i] .'</td>
<td>'. $descriptions[$i] .'</td>
<td>'. $codes[$i] .'</td>
<td>'. $actives[$i] .'</td>
<td>
$reply.= '
<li>'. $ids[$i] .'</li>
<li>'. $tittles[$i] .'</li>
<li>'. $descriptions[$i] .'</li>
<li>'. $codes[$i] .'</li>
<li>'. $actives[$i] .'</li>
<li>
<form method="post" action="index.php?state=mp">
<input name="id" type="hidden" value="'.$ids[$i].'">
<input name="tittle" type="hidden" value="'.$tittles[$i].'">
@ -302,8 +299,8 @@
<input name="active" type="hidden" value="'.$actives[$i].'">
<input type="submit" id="submit" value="Editar" name="edit_promotion" class="primary" />
</form>
</td>
<td>
<li>
<form method="post" action="index.php?state=mp">
<input name="id" type="hidden" value="'.$ids[$i].'">
<input name="tittle" type="hidden" value="'.$tittles[$i].'">
@ -312,17 +309,18 @@
<input name="active" type="hidden" value="'.$actives[$i].'">
<input type="submit" id="submit" value="Eliminar" name="delete_promotion" class="primary" />
</form>
</td>
</tr>
</li>
</li>
';
}
}
$reply.='</tbody>
</table>
$reply.='</ul>
</div>
<div class="column side"></div>
</div>
';
}
return $reply ;
}