Skip to content

Commit

Permalink
Added a form to the dashboard to easily jump to a payment order
Browse files Browse the repository at this point in the history
  • Loading branch information
jbtronics committed Dec 1, 2024
1 parent aadda51 commit d687900
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Controller/Admin/PaymentOrderHelperController.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,26 @@ public function doCheck(
'form' => $form->createView(),
]);
}

#[Route(path: '/payment_order/goto', name: "admin_payment_order_goto")]
public function goToPaymentOrder(
Request $request,
): Response
{
//Check if the user is allowed to access this route
$this->denyAccessUnlessGranted('ROLE_SHOW_PAYMENT_ORDERS');

//Extract the payment order id from the request
$paymentOrderId = $request->query->getInt('id', 0);

//Check if the payment order exists
$paymentOrder = $this->entityManager->getRepository(PaymentOrder::class)->find($paymentOrderId);

if ($paymentOrder === null) {
$this->addFlash('danger', 'Es konnte kein Zahlungsauftrag mit der ID ' . $paymentOrderId . ' gefunden werden.');
return $this->redirectToRoute('admin');
}

return $this->redirectToRoute('admin_payment_order_detail', ['entityId' => $paymentOrder->getId()]);
}
}
15 changes: 15 additions & 0 deletions templates/admin/dashboard.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@
</div>
{% endif %}

{% if is_granted("ROLE_SHOW_PAYMENT_ORDERS") %}
<form method="get" action="{{ url("admin_payment_order_goto") }}">
<div class="card mb-3">
<div class="card-body">
<h5>Zahlungsauftrag aufrufen:</h5>
<div class="input-group">
<span class="input-group-text" id="basic-addon1" style="height: 38px;"><b>ZA</b></span>
<input type="number" name="id" min="1" required class="form-control" placeholder="Auftragsnummer" aria-label="ZA-Nummer" aria-describedby="basic-addon1">
<button class="btn btn-outline-secondary" type="submit" style="height: 36px;">Go</button>
</div>
</div>
</div>
</form>
{% endif %}

<div class="alert alert-info rounded">
<h1>{% trans %}dashboard.welcome{% endtrans %}</h1>
<h4>{% trans %}dashboard.explanation{% endtrans %}</h4>
Expand Down

0 comments on commit d687900

Please sign in to comment.