diff --git a/src/Controller/CommunityController.php b/src/Controller/CommunityController.php index 30b90be..77b1aa3 100644 --- a/src/Controller/CommunityController.php +++ b/src/Controller/CommunityController.php @@ -53,36 +53,48 @@ class CommunityController implements IAuthenticationRequired $balanceCalculator = new BalanceCalculator($community); $debts = $balanceCalculator->calculate(); - $debtUsers = []; + $debtItems = []; $debtBalance = 0.0; - $outstandingUsers = []; + $outstandingItems = []; $outstandingBalance = 0.0; foreach ($debts as $debt) { if ($debt['payer']->getId() === \Container::$request->user()->getUniqueId()) { $debtBalance += $debt['amount']; - $debtUsers[] = $debt; + $debtItems[] = $debt; } if ($debt['payee']->getId() === \Container::$request->user()->getUniqueId()) { $outstandingBalance += $debt['amount']; - $outstandingUsers[] = $debt; + $outstandingItems[] = $debt; } } $balance = $outstandingBalance - $debtBalance; return new HtmlContent('communities/community', [ 'community' => $community, - 'members' => $this->getMembers($community), - 'currencies' => $this->getCurrencies($community), 'upcomingEvents' => [], - 'debtUsers' => $debtUsers, + 'debtItems' => $debtItems, 'debtBalance' => $debtBalance, - 'outstandingUsers' => $outstandingUsers, + 'outstandingItems' => $outstandingItems, 'outstandingBalance' => $outstandingBalance, 'balance' => $balance, 'editPermission' => $ownCommunityMember->getOwner() ]); } + public function getCommunitySettings(): ?IContent + { + if (!$this->checkPermission(\Container::$request->query('communityId'), false, $community, $ownCommunityMember)) { + return null; + } + + return new HtmlContent('communities/community_settings', [ + 'community' => $community, + 'members' => $this->getMembers($community), + 'currencies' => $this->getCurrencies($community), + 'editPermission' => $ownCommunityMember->getOwner() + ]); + } + public function getCommunityNew(): IContent { return new HtmlContent('communities/community_edit'); diff --git a/src/Controller/TransactionController.php b/src/Controller/TransactionController.php index c6b484d..3f075c9 100644 --- a/src/Controller/TransactionController.php +++ b/src/Controller/TransactionController.php @@ -86,6 +86,7 @@ class TransactionController implements IAuthenticationRequired, ISecured 'exchangeRateCalculator' => $exchangeRateCalculator, 'pages' => $pages, 'currentPage' => $currentPage, + 'numberOfTransactions' => $numberOfTransactions, 'transactions' => $transactions ]); } diff --git a/views/communities/community.php b/views/communities/community.php index fe8bc40..13ce2dc 100644 --- a/views/communities/community.php +++ b/views/communities/community.php @@ -1,35 +1,16 @@ @extends(templates/layout_normal) @section(main) -
- getId() === $community->getMainCurrencyId()): ?> - = $currency->getCode() ?> - - = $currency->getCode() ?> - -
- - -= $member->getUser()->getDisplayName() ?>
+ ++ getId() === $community->getMainCurrencyId()): ?> + = $currency->getCode() ?> + + = $currency->getCode() ?> + +
+ +- « - ‹ - - - = $i + 1 ?> - - = $i + 1 ?> - - - › - » -
- + 0): ?> + 1): ?> ++ « + ‹ + + + = $i + 1 ?> + + = $i + 1 ?> + + + › + » +
+ - - -= $transaction->getDescription() ?>
-= $transaction->getPayerUser()->getDisplayName() ?> ► = $transaction->getPayeeUser() ? $transaction->getPayeeUser()->getDisplayName() : '[common]' ?>
-= $transaction->getTimeDate()->format('Y-m-d H:i') ?>
-= number_format($transaction->getSum(), $transaction->getCurrency()->getRoundDigits()) ?> = $transaction->getCurrency()->getCode() ?>
- + + += $transaction->getDescription() ?>
+= $transaction->getPayerUser()->getDisplayName() ?> ► = $transaction->getPayeeUser() ? $transaction->getPayeeUser()->getDisplayName() : '[common]' ?>
+= $transaction->getTimeDate()->format('Y-m-d H:i') ?>
+= number_format($transaction->getSum(), $transaction->getCurrency()->getRoundDigits()) ?> = $transaction->getCurrency()->getCode() ?>
+ ++ « + ‹ + + + = $i + 1 ?> + + = $i + 1 ?> + + + › + » +
+ + + + +There are no transactions yet.
- « - ‹ - - - = $i + 1 ?> - - = $i + 1 ?> - - - › - » -
- - @endsection diff --git a/views/home.php b/views/home.php index cc3a6a6..f88aa66 100644 --- a/views/home.php +++ b/views/home.php @@ -3,7 +3,10 @@ @section(main)