2023-05-01 19:23:48 +02:00
|
|
|
|
@extends(templates/layout_normal)
|
|
|
|
|
|
|
|
|
|
@section(main)
|
|
|
|
|
<h2>
|
2023-05-07 01:50:57 +02:00
|
|
|
|
<a href="<?= Container::$routeCollection->getRoute('community')->generateLink(['communitySlug' => $community->getSlug()]) ?>"><?= $community->getName() ?></a> »
|
2023-05-01 19:23:48 +02:00
|
|
|
|
Transactions
|
|
|
|
|
</h2>
|
|
|
|
|
|
2023-05-07 01:50:57 +02:00
|
|
|
|
<p class="marginTop"><a href="<?= Container::$routeCollection->getRoute('community.transactions.new')->generateLink(['communitySlug' => $community->getSlug()]) ?>">New transaction</a></p>
|
2023-05-01 19:23:48 +02:00
|
|
|
|
|
2023-05-01 23:37:30 +02:00
|
|
|
|
<?php if ($numberOfTransactions > 0): ?>
|
|
|
|
|
<?php if ($pages > 1): ?>
|
|
|
|
|
<p class="paginateContainer marginTop">
|
2023-05-07 01:50:57 +02:00
|
|
|
|
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communitySlug' => $community->getSlug(), 'page' => 0]) ?>">«</a>
|
|
|
|
|
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communitySlug' => $community->getSlug(), 'page' => max(0, $currentPage - 1)]) ?>">‹</a>
|
2023-05-01 23:37:30 +02:00
|
|
|
|
<?php for ($i = 0; $i < $pages; $i++): ?>
|
|
|
|
|
<?php if ($currentPage == $i): ?>
|
|
|
|
|
<span class="selected"><?= $i + 1 ?></span>
|
|
|
|
|
<?php else: ?>
|
2023-05-07 01:50:57 +02:00
|
|
|
|
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communitySlug' => $community->getSlug(), 'page' => $i]) ?>"><?= $i + 1 ?></a>
|
2023-05-01 23:37:30 +02:00
|
|
|
|
<?php endif; ?>
|
|
|
|
|
<?php endfor; ?>
|
2023-05-07 01:50:57 +02:00
|
|
|
|
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communitySlug' => $community->getSlug(), 'page' => min($pages - 1, $currentPage + 1)]) ?>">›</a>
|
|
|
|
|
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communitySlug' => $community->getSlug(), 'page' => $pages - 1]) ?>">»</a>
|
2023-05-01 23:37:30 +02:00
|
|
|
|
</p>
|
|
|
|
|
<?php endif; ?>
|
2023-05-01 19:23:48 +02:00
|
|
|
|
|
2023-05-01 23:37:30 +02:00
|
|
|
|
<?php foreach ($transactions as $transaction): ?>
|
2023-05-07 01:50:57 +02:00
|
|
|
|
<a class="block" href="<?= Container::$routeCollection->getRoute('community.transactions.edit')->generateLink(['communitySlug' => $community->getSlug(), 'transactionId' => $transaction->getId()]) ?>">
|
2023-05-01 23:37:30 +02:00
|
|
|
|
<div class="box transaction">
|
|
|
|
|
<div>
|
|
|
|
|
<p style="font-weight: bold;"><?= $transaction->getDescription() ?></p>
|
2023-05-06 21:43:01 +02:00
|
|
|
|
<p class="small"><?= $transaction->getPayerUser()->getDisplayName() ?> <i class="fa-solid fa-caret-right"></i> <?= $transaction->getPayeeUser() ? $transaction->getPayeeUser()->getDisplayName() : '[common]' ?></p>
|
2023-05-01 23:37:30 +02:00
|
|
|
|
<p class="small"><?= $transaction->getTimeDate()->format('Y-m-d H:i') ?></p>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="text-align: right;">
|
|
|
|
|
<h3><?= number_format($exchangeRateCalculator->calculate($transaction->getSum(), $transaction->getCurrency(), $transaction->getTimeDate()), $community->getMainCurrency()->getRoundDigits()) ?> <?= $community->getMainCurrency()->getCode() ?></h3>
|
|
|
|
|
<?php if ($community->getMainCurrencyId() !== $transaction->getCurrencyId()): ?>
|
|
|
|
|
<p style="color: #8e8e8e; font-weight: bold;"><?= number_format($transaction->getSum(), $transaction->getCurrency()->getRoundDigits()) ?> <?= $transaction->getCurrency()->getCode() ?></p>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</div>
|
2023-05-01 19:23:48 +02:00
|
|
|
|
</div>
|
2023-05-01 23:37:30 +02:00
|
|
|
|
</a>
|
|
|
|
|
<?php endforeach; ?>
|
2023-05-01 19:23:48 +02:00
|
|
|
|
|
2023-05-01 23:37:30 +02:00
|
|
|
|
<?php if ($pages > 1): ?>
|
|
|
|
|
<p class="paginateContainer marginTop">
|
2023-05-07 01:50:57 +02:00
|
|
|
|
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communitySlug' => $community->getSlug(), 'page' => 0]) ?>">«</a>
|
|
|
|
|
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communitySlug' => $community->getSlug(), 'page' => max(0, $currentPage - 1)]) ?>">‹</a>
|
2023-05-01 23:37:30 +02:00
|
|
|
|
<?php for ($i = 0; $i < $pages; $i++): ?>
|
|
|
|
|
<?php if ($currentPage == $i): ?>
|
|
|
|
|
<span class="selected"><?= $i + 1 ?></span>
|
|
|
|
|
<?php else: ?>
|
2023-05-07 01:50:57 +02:00
|
|
|
|
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communitySlug' => $community->getSlug(), 'page' => $i]) ?>"><?= $i + 1 ?></a>
|
2023-05-01 23:37:30 +02:00
|
|
|
|
<?php endif; ?>
|
|
|
|
|
<?php endfor; ?>
|
2023-05-07 01:50:57 +02:00
|
|
|
|
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communitySlug' => $community->getSlug(), 'page' => min($pages - 1, $currentPage + 1)]) ?>">›</a>
|
|
|
|
|
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communitySlug' => $community->getSlug(), 'page' => $pages - 1]) ?>">»</a>
|
2023-05-01 23:37:30 +02:00
|
|
|
|
</p>
|
|
|
|
|
<?php endif; ?>
|
2023-05-01 19:23:48 +02:00
|
|
|
|
|
2023-05-07 01:50:57 +02:00
|
|
|
|
<p class="marginTop"><a href="<?= Container::$routeCollection->getRoute('community.transactions.new')->generateLink(['communitySlug' => $community->getSlug()]) ?>">New transaction</a></p>
|
2023-05-01 23:37:30 +02:00
|
|
|
|
<?php else: ?>
|
|
|
|
|
<div class="box">
|
|
|
|
|
<p>There are no transactions yet.</p>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
2023-05-01 19:23:48 +02:00
|
|
|
|
@endsection
|