rvr-nextgen/views/communities/community.php

64 lines
4.0 KiB
PHP
Raw Permalink Normal View History

2023-04-16 03:31:40 +02:00
@extends(templates/layout_normal)
@section(main)
2023-05-01 23:37:30 +02:00
<h2>
<?= $community->getName() ?>
<?php if ($editPermission): ?>
<span class="small">[<a href="<?= Container::$routeCollection->getRoute('community.edit')->generateLink(['communitySlug' => $community->getSlug()]) ?>">edit</a>]</span>
2023-05-01 23:37:30 +02:00
<?php endif; ?>
</h2>
<p class="marginTop"><a href="<?= Container::$routeCollection->getRoute('community.settings')->generateLink(['communitySlug' => $community->getSlug()]) ?>">Settings</a></p>
2023-04-16 03:31:40 +02:00
<div class="gridContainer marginTop">
<div>
<h3 class="marginBottom">Upcoming and recent events</h3>
<?php if (count($upcomingAndRecentEvents) > 0): ?>
<?php foreach ($upcomingAndRecentEvents as $event): ?>
<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>
2023-04-16 03:31:40 +02:00
<?php endforeach; ?>
<?php else: ?>
<p>There is no event to show.</p>
2023-04-16 03:31:40 +02:00
<?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>
2023-04-16 03:31:40 +02:00
</div>
<div>
<?php
$mainCurrencyCode = $community->getMainCurrency()->getCode();
$mainCurrencyRoundDigits = $community->getMainCurrency()->getRoundDigits();
?>
2023-04-16 03:31:40 +02:00
<h3 class="marginBottom">Finances</h3>
<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>
2023-05-01 19:32:35 +02:00
<table class="fullWidth marginTop">
2023-04-16 03:31:40 +02:00
<tr>
<td class="bold">You owe</td>
<td class="mono red" style="text-align: right;"><?= number_format($debtBalance, $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
2023-04-16 03:31:40 +02:00
</tr>
2023-05-01 23:02:57 +02:00
<?php foreach ($debtItems as $item): ?>
<tr>
2023-05-01 23:02:57 +02:00
<td class="small"><?= $item['payee']->getUser()->getDisplayName() ?></td>
<td class="small mono red" style="text-align: right;"><?= number_format($item['amount'], $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
</tr>
<?php endforeach; ?>
2023-04-16 03:31:40 +02:00
<tr>
<td class="bold">You're owed</td>
<td class="mono green" style="text-align: right;"><?= number_format($outstandingBalance, $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
2023-04-16 03:31:40 +02:00
</tr>
2023-05-01 23:02:57 +02:00
<?php foreach ($outstandingItems as $item): ?>
<tr>
2023-05-01 23:02:57 +02:00
<td class="small"><?= $item['payer']->getUser()->getDisplayName() ?></td>
<td class="small mono green" style="text-align: right;"><?= number_format($item['amount'], $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
</tr>
<?php endforeach; ?>
2023-04-16 03:31:40 +02:00
<tr>
<td class="bold">Your balance</td>
<td class="mono <?= $balance < 0 ? 'red' : ($balance > 0 ? 'green' : '') ?>" style="text-align: right;;"><?= number_format($balance, $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
2023-04-16 03:31:40 +02:00
</tr>
</table>
</div>
</div>
@endsection