Skip to content

Commit

Permalink
handle assistant step saved but none selected
Browse files Browse the repository at this point in the history
  • Loading branch information
KaydenLiss committed Jul 31, 2023
1 parent 259edcb commit 8c725a7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Controller/AssistantController.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,16 @@ public function select(Request $request,

$step = $assistantService->getStep();
$selected = $request->get('assistant_select');
$assistantService->saveToSession(step: $step, data: $selected);

if ($selected) {
$assistantService->saveToSession(step: $step, data: $selected);
} elseif (!$assistantService->getPropertyForStep($step, AssistantService::PROPERTY_SKIP)) {
$this->addFlash(
'danger',
'assistant.noneSelected'
);
return $this->redirectToRoute('assistant_step', ['step' => $step]);
}
return $this->redirectToRoute('assistant_step', ['step' => $step + 1]);
}
}
9 changes: 9 additions & 0 deletions templates/assistant/step.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
<div class="alert alert-info" role="alert">
<p>{{ info }}</p>
</div>
{% if app.request.hasPreviousSession %}
{% for type, messages in app.session.flashbag.all() %}
{% for message in messages %}
<div class="alert alert-{{ type }}" role="alert">
{{ message | trans }}
</div>
{% endfor %}
{% endfor %}
{% endif %}
{% if select %}
<form name="select" method="post" action="{{ path('assistant_select') }}" class="select-container row mb-2">
<div class="col-md-4 pt-3 mb-3">
Expand Down
1 change: 1 addition & 0 deletions translations/assistant/assistant.de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ assistant:
start: Assistent Starten
finished: Der Assistent ist fertig und alle Elemente wurden erfolgreich angelegt. Du kannst ihn neu starten, um weitere Verarbeitungstätigkeiten zu dokumentieren.
aborted: Der Assistent wurde abgebrochen. Bereits angelegte Elemente wurden gespeichert.
noneSelected: Es wurde kein Element ausgewählt
category:
processing:
title: Datenkategorie für Auftragsverarbeitung
Expand Down

0 comments on commit 8c725a7

Please sign in to comment.