Skip to content

Commit

Permalink
Improve visual stuffs
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusKoppe committed Oct 7, 2019
1 parent 829c06d commit d32bb29
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 5 deletions.
11 changes: 11 additions & 0 deletions App/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,15 @@ public function home ($request, $response, $args) {
View::render('layout/website/footer', $data);
return $response;
}

public function dashboard ($request, $response, $args) {
AuthHelper::restrictToPermission(User::USER_LEVEL_ADMIN);
$user = AuthHelper::getAuthenticatedUser();

$data = compact(['user']);
View::render('layout/admin/header', $data);
View::render('dashboard', $data);
View::render('layout/admin/footer', $data);
return $response;
}
}
6 changes: 4 additions & 2 deletions App/Views/auth/profile.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php
use App\Helpers\UtilsHelper;
use App\Models\Event;
use App\Models\Payment;
use App\Models\User;
?>

<div class="profile">
Expand All @@ -11,6 +10,9 @@
<h1 class="profile__title title">Perfil</h1>
</div>
<div class="col text-right">
<?php if ($user->isLevel(User::USER_LEVEL_ADMIN)): ?>
<a href="<?= UtilsHelper::base_url("/admin") ?>" class="btn btn--medium btn--secondary">Dashboard</a>
<?php endif; ?>
<a href="<?= UtilsHelper::base_url("/logout") ?>" class="btn btn--medium btn--primary">Sair</a>
</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions App/Views/dashboard.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="jumbotron">
<div class="container">
<h1>Painel Administrativo</h1>
<p>Gerencie os dados da SACC</p>
</div>
</div>
2 changes: 1 addition & 1 deletion App/Views/event/create.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<select name="fk_competition" class="form-control">
<option value=""></option>
<?php foreach($competitions as $id => $competition): ?>
<option value="<?= $id ?>"> <?= $competition['title'] ?></option>
<option value="<?= $id ?>"> <?= $competition->title ?></option>
<?php endforeach; ?>
</select>
</div>
Expand Down
2 changes: 1 addition & 1 deletion App/Views/event/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<select name="fk_competition" class="form-control">
<option value=""></option>
<?php foreach($competitions as $id => $competition): ?>
<option value="<?= $id ?>" <?= (@$event->fk_competition == $id ? 'selected="selected"' : '') ?>> <?= $competition['title'] ?></option>
<option value="<?= $id ?>" <?= (@$event->fk_competition == $id ? 'selected="selected"' : '') ?>> <?= $competition->title ?></option>
<?php endforeach; ?>
</select>
</div>
Expand Down
4 changes: 3 additions & 1 deletion App/Views/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@
</span><br>
<span> <?= $event->description?> </span> <br>

<?php if (isset($event->speaker)): ?>
<span class="event__strong"> Palestrante: </span>
<span> <?= isset($event->speaker) ? $event->speaker : 'Fausto Silva' ?> </span><br>
<span> <?= $event->speaker ?> </span><br>
<?php endif; ?>

<span class="event__strong"> Início: </span>
<span> <?= $event->time . ' hrs'?> </span><br>
Expand Down
1 change: 1 addition & 0 deletions App/router.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
$app->get('/perfil', 'App\Controllers\AuthController:profile');
$app->post('/perfil/atualizar', 'App\Controllers\AuthController:profileUpdate');

$app->get('/admin', 'App\Controllers\HomeController:dashboard');
$app->get('/admin/permissoes', 'App\Controllers\UserController:index');
$app->post('/admin/permissoes/{id}', 'App\Controllers\UserController:update');

Expand Down

0 comments on commit d32bb29

Please sign in to comment.