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

View File

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