feature/RVRNEXT-11-events #54

Merged
bence merged 13 commits from feature/RVRNEXT-11-events into master 2023-05-28 16:52:49 +02:00
2 changed files with 11 additions and 3 deletions
Showing only changes of commit c97d80a724 - Show all commits

View File

@ -11,6 +11,7 @@ use RVR\Repository\CommunityRepository;
use RVR\Repository\CommunityMemberRepository; use RVR\Repository\CommunityMemberRepository;
use RVR\Repository\CurrencyExchangeRateRepository; use RVR\Repository\CurrencyExchangeRateRepository;
use RVR\Repository\CurrencyRepository; use RVR\Repository\CurrencyRepository;
use RVR\Repository\EventRepository;
use RVR\Repository\TransactionRepository; use RVR\Repository\TransactionRepository;
use RVR\Repository\UserRepository; use RVR\Repository\UserRepository;
use SokoWeb\Interfaces\Authentication\IAuthenticationRequired; use SokoWeb\Interfaces\Authentication\IAuthenticationRequired;
@ -32,6 +33,8 @@ class CommunityController implements IAuthenticationRequired
private TransactionRepository $transactionRepository; private TransactionRepository $transactionRepository;
private EventRepository $eventRepository;
public function __construct() public function __construct()
{ {
$this->userRepository = new UserRepository(); $this->userRepository = new UserRepository();
@ -40,6 +43,7 @@ class CommunityController implements IAuthenticationRequired
$this->currencyRepository = new CurrencyRepository(); $this->currencyRepository = new CurrencyRepository();
$this->currencyExchangeRatesRepository = new CurrencyExchangeRateRepository(); $this->currencyExchangeRatesRepository = new CurrencyExchangeRateRepository();
$this->transactionRepository = new TransactionRepository(); $this->transactionRepository = new TransactionRepository();
$this->eventRepository = new EventRepository();
} }
public function isAuthenticationRequired(): bool public function isAuthenticationRequired(): bool
@ -75,7 +79,7 @@ class CommunityController implements IAuthenticationRequired
return new HtmlContent('communities/community', [ return new HtmlContent('communities/community', [
'community' => $community, 'community' => $community,
'upcomingEvents' => [], 'upcomingEvents' => iterator_to_array($this->eventRepository->getUpcomingByCommunity($community, new DateTime(), 3)),
'debtItems' => $debtItems, 'debtItems' => $debtItems,
'debtBalance' => $debtBalance, 'debtBalance' => $debtBalance,
'outstandingItems' => $outstandingItems, 'outstandingItems' => $outstandingItems,

View File

@ -15,11 +15,15 @@
<h3 class="marginBottom">Upcoming events</h3> <h3 class="marginBottom">Upcoming events</h3>
<?php if (count($upcomingEvents) > 0): ?> <?php if (count($upcomingEvents) > 0): ?>
<?php foreach ($upcomingEvents as $event): ?> <?php foreach ($upcomingEvents as $event): ?>
<!-- todo --> <p>
<a href="<?= Container::$routeCollection->getRoute('community.event')->generateLink(['communitySlug' => $community->getSlug(), 'eventSlug' => $event->getSlug()]) ?>"><?= $event->getTitle() ?></a>
<span class="small"><?= $event->getStartDate()->format('Y-m-d') ?> <?= $event->getEndDate()->format('Y-m-d') ?></span>
</p>
<?php endforeach; ?> <?php endforeach; ?>
<?php else: ?> <?php else: ?>
<p>There is no upcoming event.</p> <p>There is no upcoming event.</p>
<?php endif; ?> <?php endif; ?>
<p class="marginTop"><a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug()]) ?>">All events</a> | <a href="<?= Container::$routeCollection->getRoute('community.events.new')->generateLink(['communitySlug' => $community->getSlug()]) ?>">New event</a></p>
</div> </div>
<div> <div>
<?php <?php
@ -27,7 +31,7 @@
$mainCurrencyRoundDigits = $community->getMainCurrency()->getRoundDigits(); $mainCurrencyRoundDigits = $community->getMainCurrency()->getRoundDigits();
?> ?>
<h3 class="marginBottom">Finances</h3> <h3 class="marginBottom">Finances</h3>
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communitySlug' => $community->getSlug()]) ?>">Transactions</a> <p><a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communitySlug' => $community->getSlug()]) ?>">Transactions</a> | <a href="<?= Container::$routeCollection->getRoute('community.transactions.new')->generateLink(['communitySlug' => $community->getSlug()]) ?>">New transaction</a></p>
<table class="fullWidth marginTop"> <table class="fullWidth marginTop">
<tr> <tr>
<td class="bold">You owe</td> <td class="bold">You owe</td>