diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/_workflow.title.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/_workflow.title.html.twig deleted file mode 100644 index e3c1dc50a..000000000 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/_workflow.title.html.twig +++ /dev/null @@ -1,19 +0,0 @@ -{% import '@ChillMain/Workflow/macro_breadcrumb.html.twig' as m %} - -
-
- {% if concerne is defined and concerne == true %} - {{ 'Concerne'|trans }}: - {% endif %} - - {{ 'workflow.Document (n°%doc%)'|trans({'%doc%': document.id}) }} - - {% if description is defined and description == true %} - {{ ' — ' ~ document.title }} - {% endif %} -
- - {% if breadcrumb is defined and breadcrumb == true %} - {{ m.breadcrumb(_context) }} - {% endif %} -
\ No newline at end of file diff --git a/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php b/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php index b096e5f8d..e3cc9c408 100644 --- a/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php +++ b/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php @@ -84,16 +84,6 @@ class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandler ]; } - public function getTemplateTitle(EntityWorkflow $entityWorkflow, array $options = []): string - { - return '@ChillDocStore/AccompanyingCourseDocument/_workflow.title.html.twig'; - } - - public function getTemplateTitleData(EntityWorkflow $entityWorkflow, array $options = []): array - { - return $this->getTemplateData($entityWorkflow, $options); - } - public function supports(EntityWorkflow $entityWorkflow, array $options = []): bool { return $entityWorkflow->getRelatedEntityClass() === AccompanyingCourseDocument::class; diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/list.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/list.html.twig index 83d60ff4c..562413bc2 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/list.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/list.html.twig @@ -56,16 +56,14 @@

- {{ 'workflow_'|trans }} + {{ l.handler.entityTitle(l.entity_workflow) }}

- {% include l.handler.templateTitle(l.entity_workflow) with l.handler.templateTitleData(l.entity_workflow)|merge({ - 'description': true, - 'add_classes': 'ms-3 h3' - }) %}
- {{ macro.breadcrumb(l) }} +
+ {{ macro.breadcrumb(l) }} +
repository = $em->getRepository(AccompanyingPeriodWorkEvaluationDocument::class); + } + + public function find($id): ?AccompanyingPeriodWorkEvaluationDocument + { + return $this->repository->find($id); + } + + /** + * @return array|object[]|AccompanyingPeriodWorkEvaluationDocument[] + */ + public function findAll(): array + { + return $this->repository->findAll(); + } + + /** + * @param null|mixed $limit + * @param null|mixed $offset + * + * @return array|object[]|AccompanyingPeriodWorkEvaluationDocument[] + */ + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array + { + return $this->repository->findBy($criteria, $orderBy, $limit, $offset); + } + + public function findOneBy(array $criteria): ?AccompanyingPeriodWorkEvaluationDocument + { + return $this->repository->findOneBy($criteria); + } + + public function getClassName(): string + { + return AccompanyingPeriodWorkEvaluationDocument::class; + } +} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Workflow/_accompanying_period_work.title.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Workflow/_accompanying_period_work.title.html.twig deleted file mode 100644 index 2cc640c82..000000000 --- a/src/Bundle/ChillPersonBundle/Resources/views/Workflow/_accompanying_period_work.title.html.twig +++ /dev/null @@ -1,19 +0,0 @@ -{% import '@ChillMain/Workflow/macro_breadcrumb.html.twig' as m %} - -
-
- {% if concerne is defined and concerne == true %} - {{ 'Concerne'|trans }}: - {% endif %} - - {{ 'workflow.Work (n°%w%)'|trans({'%w%': work.id }) }} - - {% if description is defined and description == true %} - {{ ' — ' ~ work.socialAction|chill_entity_render_string }} - {% endif %} -
- - {% if breadcrumb is defined and breadcrumb == true %} - {{ m.breadcrumb(_context) }} - {% endif %} -
\ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Workflow/_evaluation.title.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Workflow/_evaluation.title.html.twig deleted file mode 100644 index 4b52acc24..000000000 --- a/src/Bundle/ChillPersonBundle/Resources/views/Workflow/_evaluation.title.html.twig +++ /dev/null @@ -1,19 +0,0 @@ -{% import '@ChillMain/Workflow/macro_breadcrumb.html.twig' as m %} - -
-
- {% if concerne is defined and concerne == true %} - {{ 'Concerne'|trans }}: - {% endif %} - - {{ 'workflow.Evaluation (n°%eval%)'|trans({'%eval%': evaluation.id}) }} - - {% if description is defined and description == true %} - {{ ' — ' ~ evaluation.evaluation.title|localize_translatable_string }} - {% endif %} -
- - {% if breadcrumb is defined and breadcrumb == true %} - {{ m.breadcrumb(_context) }} - {% endif %} -
diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Workflow/_evaluation_document.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Workflow/_evaluation_document.html.twig new file mode 100644 index 000000000..488f31661 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/Workflow/_evaluation_document.html.twig @@ -0,0 +1,103 @@ +
+
+
+

+ + + {{ evaluation.accompanyingPeriodWork.socialAction|chill_entity_render_string }} +
    +
  • + {{ 'accompanying_course_work.start_date'|trans ~ ' : ' }} + {{ evaluation.accompanyingPeriodWork.startDate|format_date('short') }} +
  • + {% if evaluation.accompanyingPeriodWork.endDate %} +
  • + {{ 'accompanying_course_work.end_date'|trans ~ ' : ' }} + {{ evaluation.accompanyingPeriodWork.endDate|format_date('short') }} +
  • + {% endif %} +
+
+

+
+
+ + + + + + + + + + + +
+

+ {{ 'Évaluation'|trans }} +

+
+
    +
  • + {{ evaluation.evaluation.title|localize_translatable_string }} +
      +
    • + {{ 'accompanying_course_work.start_date'|trans ~ ' : ' }} + {{ evaluation.startDate|format_date('short') }} +
    • + {% if evaluation.endDate %} +
    • + {{ 'accompanying_course_work.end_date'|trans ~ ' : ' }} + {{ evaluation.endDate|format_date('short') }} +
    • + {% endif %} + {% if evaluation.maxDate %} +
    • + {{ 'accompanying_course_work.max_date'|trans ~ ' : ' }} + {{ evaluation.maxDate|format_date('short') }} +
    • + {% endif %} + {% if evaluation.warningInterval and evaluation.warningInterval.d > 0 %} +
    • + {% set days = (evaluation.warningInterval.d + evaluation.warningInterval.m * 30) %} + {{ 'accompanying_course_work.warning_interval'|trans ~ ' : ' }} + {{ 'accompanying_course_work.%days% days before max_date'|trans({'%days%': days }) }} +
    • + {% endif %} +
    • + {% if evaluation.createdBy is not null %} + créé par + {{ evaluation.createdBy.username }} + {% endif %} + {% if evaluation.createdAt is not null %} + {{ 'le'|trans }} + {{ evaluation.createdAt|format_date('short') }} + {% endif %} +
    • +
    + {% if evaluation.comment %} +
    + {{ evaluation.comment }} +
    + {% endif %} +
  • +
+
+
+
+ {% import '@ChillPerson/Macro/updatedBy.html.twig' as macro %} + {{ macro.updatedBy(evaluation) }} +
+
+
+ +{% if display_action is defined and display_action == true %} + {# TODO add acl #} + +{% endif %} diff --git a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler.php b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler.php new file mode 100644 index 000000000..1465f345c --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler.php @@ -0,0 +1,95 @@ +repository = $repository; + $this->translatableStringHelper = $translatableStringHelper; + $this->translator = $translator; + } + + public function getEntityData(EntityWorkflow $entityWorkflow, array $options = []): array + { + $evaluation = $this->getRelatedEntity($entityWorkflow); + + return [ + 'persons' => $evaluation->getAccompanyingPeriodWork()->getPersons(), + ]; + } + + public function getEntityTitle(EntityWorkflow $entityWorkflow, array $options = []): string + { + $doc = $this->getRelatedEntity($entityWorkflow); + + return $this->translator->trans( + 'workflow.Evaluation (n°%eval%)', + ['%eval%' => $entityWorkflow->getRelatedEntityId()] + ) . ' - ' . $this->translatableStringHelper->localize($doc->getAccompanyingPeriodWorkEvaluation() + ->getEvaluation()->getTitle()); + } + + public function getRelatedEntity(EntityWorkflow $entityWorkflow): ?AccompanyingPeriodWorkEvaluationDocument + { + return $this->repository->find($entityWorkflow->getRelatedEntityId()); + } + + public function getRoleShow(EntityWorkflow $entityWorkflow): ?string + { + return AccompanyingPeriodWorkEvaluationVoter::SEE; + } + + public function getTemplate(EntityWorkflow $entityWorkflow, array $options = []): string + { + return '@ChillPerson/Workflow/_evaluation_document.html.twig'; + } + + public function getTemplateData(EntityWorkflow $entityWorkflow, array $options = []): array + { + $doc = $this->getRelatedEntity($entityWorkflow); + + return [ + 'entity_workflow' => $entityWorkflow, + 'evaluation' => $doc->getAccompanyingPeriodWorkEvaluation(), + 'doc' => $doc, + ]; + } + + public function supports(EntityWorkflow $entityWorkflow, array $options = []): bool + { + return $entityWorkflow->getRelatedEntityClass() === AccompanyingPeriodWorkEvaluationDocument::class; + } + + public function supportsFreeze(EntityWorkflow $entityWorkflow, array $options = []): bool + { + return false; + } +} diff --git a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php index a3a79da4b..5af305ac5 100644 --- a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php +++ b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php @@ -79,16 +79,6 @@ class AccompanyingPeriodWorkEvaluationWorkflowHandler implements EntityWorkflowH ]; } - public function getTemplateTitle(EntityWorkflow $entityWorkflow, array $options = []): string - { - return '@ChillPerson/Workflow/_evaluation.title.html.twig'; - } - - public function getTemplateTitleData(EntityWorkflow $entityWorkflow, array $options = []): array - { - return $this->getTemplateData($entityWorkflow, $options); - } - public function supports(EntityWorkflow $entityWorkflow, array $options = []): bool { return $entityWorkflow->getRelatedEntityClass() === AccompanyingPeriodWorkEvaluation::class; diff --git a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php index b9188d953..1385cb841 100644 --- a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php +++ b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php @@ -76,16 +76,6 @@ class AccompanyingPeriodWorkWorkflowHandler implements EntityWorkflowHandlerInte ]; } - public function getTemplateTitle(EntityWorkflow $entityWorkflow, array $options = []): string - { - return '@ChillPerson/Workflow/_accompanying_period_work.title.html.twig'; - } - - public function getTemplateTitleData(EntityWorkflow $entityWorkflow, array $options = []): array - { - return $this->getTemplateData($entityWorkflow, $options); - } - public function supports(EntityWorkflow $entityWorkflow, array $options = []): bool { return $entityWorkflow->getRelatedEntityClass() === AccompanyingPeriodWork::class;