mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Create new route to redirect from document to work that contains evaluation that contains document
This commit is contained in:
parent
51e382760d
commit
22ded77bde
@ -85,7 +85,7 @@ export default {
|
||||
case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork':
|
||||
return `/fr/person/accompanying-period/work/${n.relatedEntityId}/show`
|
||||
case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument':
|
||||
return `/fr/notification/${n.id}/show` // to the notification
|
||||
return `/fr/person/accompanying-period/work/evaluation/document/${n.relatedEntityId}/show` // to the notification
|
||||
case 'Chill\\MainBundle\\Entity\\Workflow\\EntityWorkflow':
|
||||
return `/fr/main/workflow/${n.relatedEntityId}/show`
|
||||
default:
|
||||
|
@ -46,7 +46,7 @@ const appMessages = {
|
||||
the_course: "le parcours",
|
||||
the_action: "l'action",
|
||||
the_evaluation: "l'évaluation",
|
||||
the_evaluation_document: "le document de l'évaluation",
|
||||
the_evaluation_document: "le document",
|
||||
the_task: "la tâche",
|
||||
the_workflow: "le workflow",
|
||||
StartDate: "Date d'ouverture",
|
||||
|
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocument;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodWorkVoter;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
class AccompanyingCourseWorkEvaluationDocumentController extends AbstractController
|
||||
{
|
||||
private Security $security;
|
||||
|
||||
public function __construct(Security $security)
|
||||
{
|
||||
$this->security = $security;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "{_locale}/person/accompanying-period/work/evaluation/document/{id}/show",
|
||||
* name="chill_person_accompanying_period_work_evaluation_document_show",
|
||||
* methods={"GET"}
|
||||
* )
|
||||
*/
|
||||
public function showAccompanyingCourseWork(AccompanyingPeriodWorkEvaluationDocument $document): Response
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
/** @var AccompanyingPeriodWorkEvaluation $evaluation */
|
||||
$evaluation = $em->getRepository(AccompanyingPeriodWorkEvaluation::class)->find($document->getAccompanyingPeriodWorkEvaluation());
|
||||
|
||||
/** @var AccompanyingPeriodWork $work */
|
||||
$work = $em->getRepository(AccompanyingPeriodWork::class)->find($evaluation->getAccompanyingPeriodWork());
|
||||
|
||||
return $this->redirectToRoute(
|
||||
$this->security->isGranted(AccompanyingPeriodWorkVoter::UPDATE)?
|
||||
'chill_person_accompanying_period_work_edit' : 'chill_person_accompanying_period_work_show', [
|
||||
'id' => $work->getId()
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user