-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a privileges view for education events
- Loading branch information
1 parent
461f2e7
commit 02ba1af
Showing
4 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
app/AccountancyModule/EducationModule/presenters/PrivilegesPresenter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\AccountancyModule\EducationModule; | ||
|
||
use Model\Auth\Resources\Education; | ||
|
||
class PrivilegesPresenter extends BasePresenter | ||
{ | ||
public function renderDefault(int $aid): void | ||
{ | ||
$this->setLayout('layout.new'); | ||
$isDraft = $this->event->getState() === 'draft'; | ||
|
||
$privileges = [ | ||
'event' => [ | ||
'label' => 'Základní informace o akci', | ||
'items' => [ | ||
[ | ||
'label' => 'Zobrazovat detaily o akci', | ||
'value' => $this->authorizator->isAllowed(Education::ACCESS_DETAIL, $aid), | ||
'desc' => 'Lze zobrazovat další údaje o této akci.', | ||
], | ||
], | ||
], | ||
'participant' => [ | ||
'label' => 'Účastníci', | ||
'items' => [ | ||
[ | ||
'label' => 'Zobrazovat účastníky', | ||
'value' => $this->authorizator->isAllowed(Education::ACCESS_PARTICIPANTS, $aid), | ||
'desc' => 'Lze zobrazovat účastníky této akce.', | ||
], | ||
[ | ||
'label' => 'Upravovat účastníky', | ||
'value' => $this->authorizator->isAllowed(Education::UPDATE_PARTICIPANT, $aid), | ||
'desc' => 'Lze upravovat účastníky této akce.', | ||
], | ||
], | ||
], | ||
'budget' => [ | ||
'label' => 'Rozpočet', | ||
'items' => [ | ||
[ | ||
'label' => 'Upravovat závěrečný rozpočet', | ||
'value' => $isDraft && $this->authorizator->isAllowed(Education::UPDATE_REAL_BUDGET_SPENDING, $this->aid), | ||
'desc' => 'Lze upravovat závěrečný rozpočet této akce ve SkautISu.', | ||
], | ||
], | ||
], | ||
]; | ||
$this->template->setParameters(['privileges' => $privileges]); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
app/AccountancyModule/EducationModule/templates/@layout.new.latte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{extends '../../../templates/@layout.latte'} | ||
{block subMenu} | ||
{/block} |
38 changes: 38 additions & 0 deletions
38
app/AccountancyModule/EducationModule/templates/Privileges/default.latte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{block #title}{$event->getDisplayName()} - seznam oprávnění{/block} | ||
|
||
{block #content} | ||
|
||
{include ../header.latte} | ||
|
||
<h2>Přehled oprávnění přihlášené osoby</h2> | ||
|
||
<p class="alert alert-info">Oprávnění jsou zobrazena pro přihlášeného uživatele a právě aktivní roli, mohou být odvozena i podle funkce v jednotce či na dané akci.</p> | ||
<table class="table table-bordered table-sm"> | ||
<tr> | ||
<th>Sekce</th> | ||
<th>Událost</th> | ||
<th class="text-center">Máš oprávnění?</th> | ||
</tr> | ||
{foreach $privileges as $section} | ||
<tr> | ||
<th rowspan="{= count($section['items'])+1}">{$section['label']}</th> | ||
</tr> | ||
<tr n:foreach="$section['items'] as $p"> | ||
<td> | ||
{$p['label']} | ||
<div class="small text-muted">{$p['desc']}</div> | ||
</td> | ||
<td class="text-center align-middle"> | ||
{if $p['value']} | ||
<span class="text-success"><i class="far fa-check-circle"></i></span> | ||
Ano | ||
{else} | ||
<span class="text-muted"> | ||
<i class="far fa-times-circle"></i> | ||
Ne | ||
</span> | ||
{/if} | ||
</td> | ||
</tr> | ||
{/foreach} | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters