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

View File

@ -67,6 +67,14 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
'id' => $period->getId() 'id' => $period->getId()
]]) ]])
->setExtras(['order' => 40]); ->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') }} {{ $t('course.step.draft') }}
</span> </span>
</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="d-md-block mb-md-3">
<span class="badge bg-primary"> <span class="badge bg-primary">
{{ $t('course.step.active') }} {{ $t('course.step.active') }}
@ -26,6 +26,11 @@
</span> </span>
</span> </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>
<teleport to="#header-accompanying_course-details #banner-social-issues"> <teleport to="#header-accompanying_course-details #banner-social-issues">

View File

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

View File

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

View File

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

View File

@ -374,6 +374,7 @@ regular: régulier
Confidential: confidentiel Confidential: confidentiel
Draft: brouillon Draft: brouillon
Confirmed: en file active Confirmed: en file active
Closed: Cloturé
# Accompanying Course # Accompanying Course
Accompanying Course: Parcours d'accompagnement Accompanying Course: Parcours d'accompagnement
@ -381,6 +382,7 @@ Accompanying Course History: Historique du parcours
Resume Accompanying Course: Résumé du parcours Resume Accompanying Course: Résumé du parcours
Show Accompanying Course: Voir le parcours Show Accompanying Course: Voir le parcours
Edit Accompanying Course: Modifier le parcours Edit Accompanying Course: Modifier le parcours
Close Accompanying Course: Clôturer le parcours
Create Accompanying Course: Créer un nouveau parcours Create Accompanying Course: Créer un nouveau parcours
Drop Accompanying Course: Supprimer le 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. 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.