badge adapted+ menu entry + persistance of object fixed

This commit is contained in:
Julie Lenaerts 2021-11-19 09:46:24 +01:00
parent 57cf46a0af
commit fc8a766c25
7 changed files with 37 additions and 11 deletions

View File

@ -179,7 +179,9 @@ class AccompanyingCourseController extends Controller
if ($form->isSubmitted() && $form->isValid()) {
$this->getDoctrine()->getManager()->flush();
$em = $this->getDoctrine()->getManager();
$em->persist($accompanyingCourse);
$workflow = $this->registry->get($accompanyingCourse);
if ($workflow->can($accompanyingCourse, 'close')) {
@ -187,10 +189,16 @@ class AccompanyingCourseController extends Controller
if( count($errors) > 0 ){
return $this->json($errors, 422);
}
$workflow->apply($accompanyingCourse, 'close');
$em->persist($accompanyingCourse);
}
$em->flush();
return $this->redirectToRoute('chill_person_accompanying_course_index', [
'accompanying_period_id' => $accompanyingCourse->getId()
]);
}
return $this->render('@ChillPerson/AccompanyingCourse/close.html.twig', [

View File

@ -67,6 +67,14 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
'id' => $period->getId()
]])
->setExtras(['order' => 40]);
$menu->addChild($this->translator->trans('Close Accompanying Course'), [
'route' => 'chill_person_accompanying_course_close',
'routeParameters' => [
'accompanying_period_id' => $period->getId()
]])
->setExtras(['order' => 50]);
}

View File

@ -11,7 +11,7 @@
{{ $t('course.step.draft') }}
</span>
</span>
<span v-else class="text-md-end">
<span v-else-if="accompanyingCourse.step === 'CONFIRMED'" class="text-md-end">
<span class="d-md-block mb-md-3">
<span class="badge bg-primary">
{{ $t('course.step.active') }}
@ -26,6 +26,11 @@
</span>
</span>
</span>
<span v-else class="text-md-end d-md-block">
<span class="badge bg-primary">
{{ $t('course.step.closed') }}
</span>
</span>
</teleport>
<teleport to="#header-accompanying_course-details #banner-social-issues">

View File

@ -20,7 +20,8 @@ const appMessages = {
status: "État",
step: {
draft: "Brouillon",
active: "En file active"
active: "En file active",
closed: "Cloturé"
},
open_at: "ouvert le ",
by: "par ",

View File

@ -21,8 +21,10 @@
<div class="wh-col">
{% if accompanying_period.step == 'DRAFT' %}
<span class="badge bg-secondary">{{- 'Draft'|trans|upper -}}</span>
{% else %}
{% elseif accompanying_period.step == 'CONFIRMED' %}
<span class="badge bg-primary">{{- 'Confirmed'|trans|upper -}}</span>
{% else %}
<span class="badge bg-primary">{{- 'Closed'|trans|upper -}}</span>
{% endif %}
</div>
</div>

View File

@ -78,11 +78,11 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRole
return false;
}
if (AccompanyingPeriod::STEP_CLOSED === $subject->getStep()) {
if($this->security->isGranted(self::EDIT, $subject)) {
return false;
}
}
// if (AccompanyingPeriod::STEP_CLOSED === $subject->getStep()) {
// if($this->security->isGranted(self::EDIT, $subject)) {
// return false;
// }
// }
// if confidential, only the referent can see it
if ($subject->isConfidential()) {

View File

@ -374,6 +374,7 @@ regular: régulier
Confidential: confidentiel
Draft: brouillon
Confirmed: en file active
Closed: Cloturé
# Accompanying Course
Accompanying Course: Parcours d'accompagnement
@ -381,6 +382,7 @@ Accompanying Course History: Historique du parcours
Resume Accompanying Course: Résumé du parcours
Show Accompanying Course: Voir le parcours
Edit Accompanying Course: Modifier le parcours
Close Accompanying Course: Clôturer le parcours
Create Accompanying Course: Créer un nouveau parcours
Drop Accompanying Course: Supprimer le parcours
This course is located at a temporarily address. You should locate this course to an user: Le parcours est localisé à une adresse temporaire. Il devrait être localisé auprès d'une personne concernée.