RVRNEXT-11 add views for events
This commit is contained in:
parent
2bcaf13ee3
commit
49f3a371e5
27
views/events/event.php
Normal file
27
views/events/event.php
Normal file
@ -0,0 +1,27 @@
|
||||
@extends(templates/layout_normal)
|
||||
|
||||
@section(main)
|
||||
<h2>
|
||||
<a href="<?= Container::$routeCollection->getRoute('community')->generateLink(['communitySlug' => $community->getSlug()]) ?>"><?= $community->getName() ?></a> »
|
||||
<a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug()]) ?>">Events</a> »
|
||||
<?= $event->getTitle() ?>
|
||||
<span class="small">[<a href="<?= Container::$routeCollection->getRoute('community.event.edit')->generateLink(['communitySlug' => $community->getSlug(), 'eventSlug' => $event->getSlug()]) ?>">edit</a>]</span>
|
||||
</h2>
|
||||
|
||||
<div class="gridContainer marginTop">
|
||||
<div>
|
||||
<?php
|
||||
$mainCurrencyCode = $community->getMainCurrency()->getCode();
|
||||
$mainCurrencyRoundDigits = $community->getMainCurrency()->getRoundDigits();
|
||||
?>
|
||||
<h3 class="marginBottom">Finances</h3>
|
||||
<p><a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communitySlug' => $community->getSlug(), 'event' => $event->getSlug()]) ?>">Transactions</a> | <a href="<?= Container::$routeCollection->getRoute('community.transactions.new')->generateLink(['communitySlug' => $community->getSlug(), 'event' => $event->getSlug()]) ?>">New transaction</a></p>
|
||||
<table class="fullWidth marginTop">
|
||||
<tr>
|
||||
<td class="bold">Total cost</td>
|
||||
<td class="mono" style="text-align: right;"><?= number_format($totalCost, $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
40
views/events/event_edit.php
Normal file
40
views/events/event_edit.php
Normal file
@ -0,0 +1,40 @@
|
||||
@extends(templates/layout_normal)
|
||||
|
||||
@section(main)
|
||||
<h2>
|
||||
<a href="<?= Container::$routeCollection->getRoute('community')->generateLink(['communitySlug' => $community->getSlug()]) ?>"><?= $community->getName() ?></a> »
|
||||
<a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug()]) ?>">Events</a> »
|
||||
<?php if (isset($event)): ?>
|
||||
<a href="<?= Container::$routeCollection->getRoute('community.event')->generateLink(['communitySlug' => $community->getSlug(), 'eventSlug' => $event->getSlug()]) ?>"><?= $event->getTitle() ?></a> » Edit event
|
||||
<?php else: ?>
|
||||
New event
|
||||
<?php endif; ?>
|
||||
</h2>
|
||||
<div class="box compactBox">
|
||||
<?php
|
||||
$formAction = isset($event) ?
|
||||
Container::$routeCollection->getRoute('community.event.edit-action')->generateLink(['communitySlug' => $community->getSlug(), 'eventSlug' => $event->getSlug()]) :
|
||||
Container::$routeCollection->getRoute('community.events.new-action')->generateLink(['communitySlug' => $community->getSlug()]);
|
||||
?>
|
||||
<form id="eventForm" action="<?= $formAction ?>" method="post" data-redirect-on-success="true">
|
||||
<p class="formLabel">Title</p>
|
||||
<input type="text" class="text big fullWidth" name="title" value="<?= isset($event) ? $event->getTitle() : '' ?>" required>
|
||||
<p class="formLabel marginTop">Description</p>
|
||||
<textarea class="text big fullWidth" name="description" rows="3"><?= isset($event) ? $event->getDescription() : '' ?></textarea>
|
||||
<p class="formLabel marginTop">Start</p>
|
||||
<input type="datetime-local" class="text big fullWidth" name="start" value="<?= isset($event) ? $event->getStartDate()->format('Y-m-d\TH:i') : '' ?>" required>
|
||||
<p class="formLabel marginTop">End</p>
|
||||
<input type="datetime-local" class="text big fullWidth" name="end" value="<?= isset($event) ? $event->getEndDate()->format('Y-m-d\TH:i') : '' ?>" required>
|
||||
<p class="formError justify marginTop"></p>
|
||||
<div class="right marginTop" style="font-size: 0;">
|
||||
<button type="submit" name="submit_button"><?= isset($event) ? '<i class="fa-regular fa-floppy-disk"></i> Save' : '<i class="fa-regular fa-plus"></i> Create' ?></button>
|
||||
<?php if (isset($event)): ?>
|
||||
<button type="submit" form="deleteEvent" name="submit_button" data-confirmation="Are you sure you want to delete this event? All linked transactions will be unlinked!" class="red marginLeft"><i class="fa-regular fa-trash-can"></i> Delete</button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</form>
|
||||
<?php if (isset($event)): ?>
|
||||
<form id="deleteEvent" action="<?= Container::$routeCollection->getRoute('community.event.delete-action')->generateLink(['communitySlug' => $community->getSlug(), 'eventSlug' => $event->getSlug()]) ?>" method="post" data-redirect-on-success="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug()]) ?>"></form>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@endsection
|
60
views/events/events.php
Normal file
60
views/events/events.php
Normal file
@ -0,0 +1,60 @@
|
||||
@extends(templates/layout_normal)
|
||||
|
||||
@section(main)
|
||||
<h2>
|
||||
<a href="<?= Container::$routeCollection->getRoute('community')->generateLink(['communitySlug' => $community->getSlug()]) ?>"><?= $community->getName() ?></a> »
|
||||
Events
|
||||
</h2>
|
||||
|
||||
<p class="marginTop"><a href="<?= Container::$routeCollection->getRoute('community.events.new')->generateLink(['communitySlug' => $community->getSlug()]) ?>">New event</a></p>
|
||||
|
||||
<?php if ($numberOfEvents > 0): ?>
|
||||
<?php if ($pages > 1): ?>
|
||||
<p class="paginateContainer marginTop">
|
||||
<a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug(), 'page' => 0]) ?>">«</a>
|
||||
<a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug(), 'page' => max(0, $currentPage - 1)]) ?>">‹</a>
|
||||
<?php for ($i = 0; $i < $pages; $i++): ?>
|
||||
<?php if ($currentPage == $i): ?>
|
||||
<span class="selected"><?= $i + 1 ?></span>
|
||||
<?php else: ?>
|
||||
<a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug(), 'page' => $i]) ?>"><?= $i + 1 ?></a>
|
||||
<?php endif; ?>
|
||||
<?php endfor; ?>
|
||||
<a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug(), 'page' => min($pages - 1, $currentPage + 1)]) ?>">›</a>
|
||||
<a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug(), 'page' => $pages - 1]) ?>">»</a>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ($events as $event): ?>
|
||||
<a class="block" href="<?= Container::$routeCollection->getRoute('community.event')->generateLink(['communitySlug' => $community->getSlug(), 'eventSlug' => $event->getSlug()]) ?>">
|
||||
<div class="box">
|
||||
<p style="font-weight: bold;"><?= $event->getTitle() ?></p>
|
||||
<p class="small"><?= $event->getStartDate()->format('Y-m-d') ?> – <?= $event->getEndDate()->format('Y-m-d') ?></p>
|
||||
<p class="small"><?= $event->getDescription() ?></p>
|
||||
</div>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if ($pages > 1): ?>
|
||||
<p class="paginateContainer marginTop">
|
||||
<a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug(), 'page' => 0]) ?>">«</a>
|
||||
<a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug(), 'page' => max(0, $currentPage - 1)]) ?>">‹</a>
|
||||
<?php for ($i = 0; $i < $pages; $i++): ?>
|
||||
<?php if ($currentPage == $i): ?>
|
||||
<span class="selected"><?= $i + 1 ?></span>
|
||||
<?php else: ?>
|
||||
<a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug(), 'page' => $i]) ?>"><?= $i + 1 ?></a>
|
||||
<?php endif; ?>
|
||||
<?php endfor; ?>
|
||||
<a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug(), 'page' => min($pages - 1, $currentPage + 1)]) ?>">›</a>
|
||||
<a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug(), 'page' => $pages - 1]) ?>">»</a>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<p class="marginTop"><a href="<?= Container::$routeCollection->getRoute('community.events.new')->generateLink(['communitySlug' => $community->getSlug()]) ?>">New event</a></p>
|
||||
<?php else: ?>
|
||||
<div class="box">
|
||||
<p>There are no events yet.</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@endsection
|
Loading…
Reference in New Issue
Block a user