Pőcze Bence
65424c2944
All checks were successful
rvr-nextgen/pipeline/pr-master This commit looks good
54 lines
4.2 KiB
PHP
54 lines
4.2 KiB
PHP
@extends(templates/layout_normal)
|
|
|
|
@section(main)
|
|
<h2>
|
|
<a href="<?= Container::$routeCollection->getRoute('community')->generateLink(['communityId' => $community->getId()]) ?>"><?= $community->getName() ?></a> »
|
|
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId()]) ?>">Transactions</a> »
|
|
<?php if (isset($transaction)): ?>
|
|
Edit transaction
|
|
<?php else: ?>
|
|
New transaction
|
|
<?php endif; ?>
|
|
</h2>
|
|
<div class="box compactBox">
|
|
<?php
|
|
$formAction = isset($transaction) ?
|
|
Container::$routeCollection->getRoute('community.transactions.edit-action')->generateLink(['communityId' => $community->getId(), 'transactionId' => $transaction->getId()]) :
|
|
Container::$routeCollection->getRoute('community.transactions.new-action')->generateLink(['communityId' => $community->getId()]);
|
|
?>
|
|
<form id="transactionForm" action="<?= $formAction ?>" method="post" data-redirect-on-success="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId()]) ?>">
|
|
<select class="big fullWidth" name="payer_user_id" required>
|
|
<option value="" hidden>[Payer]</option>
|
|
<?php foreach ($members as $member): ?>
|
|
<option value="<?= $member->getUser()->getId() ?>" <?= isset($transaction) && $transaction->getPayerUserId() === $member->getUser()->getId() ? 'selected' : '' ?>><?= $member->getUser()->getDisplayName() ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
<select class="big fullWidth marginTop" name="payee_user_id">
|
|
<option value="">[Payee]</option>
|
|
<?php foreach ($members as $member): ?>
|
|
<option value="<?= $member->getUser()->getId() ?>" <?= isset($transaction) && $transaction->getPayeeUserId() === $member->getUser()->getId() ? 'selected' : '' ?>><?= $member->getUser()->getDisplayName() ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
<input type="text" class="text big fullWidth marginTop" name="description" placeholder="Description" value="<?= isset($transaction) ? $transaction->getDescription() : '' ?>" required>
|
|
<input type="number" class="text big fullWidth marginTop" name="sum" placeholder="Sum" value="<?= isset($transaction) ? $transaction->getSum() : '' ?>" min="0" step="0.000000001" required>
|
|
<select class="big fullWidth marginTop" name="currency_id" required>
|
|
<option value="" hidden>[Currency]</option>
|
|
<?php foreach ($currencies as $currency): ?>
|
|
<option value="<?= $currency->getId() ?>" <?= isset($transaction) && $transaction->getCurrencyId() === $currency->getId() ? 'selected' : '' ?>><?= $currency->getCode() ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
<input type="datetime-local" class="text big fullWidth marginTop" name="time" placeholder="Time" value="<?= isset($transaction) ? $transaction->getTimeDate()->format('Y-m-d\TH:i') : (new DateTime())->format('Y-m-d\TH:i') ?>" required>
|
|
<p class="formError justify marginTop"></p>
|
|
<div class="right marginTop" style="font-size: 0;">
|
|
<?php if (isset($transaction)): ?>
|
|
<button type="submit" form="deleteTransaction" name="submit_button" data-confirmation="Are you sure you want to delete this transaction?" class="red marginRight">Delete</button>
|
|
<?php endif; ?>
|
|
<button type="submit" name="submit_button"><?= isset($transaction) ? 'Save' : 'Create' ?></button>
|
|
</div>
|
|
</form>
|
|
<?php if (isset($transaction)): ?>
|
|
<form id="deleteTransaction" action="<?= Container::$routeCollection->getRoute('community.transactions.delete-action')->generateLink(['communityId' => $community->getId(), 'transactionId' => $transaction->getId()]) ?>" method="post" data-redirect-on-success="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId()]) ?>"></form>
|
|
<?php endif; ?>
|
|
</div>
|
|
@endsection
|