From c7dbaae8d61feff50f1523d6503ecb899fb40553 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 24 Jan 2022 13:17:46 +0000 Subject: [PATCH] 105 worflow --- CHANGELOG.md | 7 + .../views/Activity/_list_item.html.twig | 14 +- .../Resources/views/Activity/list.html.twig | 4 - .../Resources/views/Activity/show.html.twig | 2 +- .../_workflow.html.twig | 52 +++ .../_workflow.title.html.twig | 19 + .../AccompanyingCourseDocument/show.html.twig | 100 ++-- ...ompanyingCourseDocumentWorkflowHandler.php | 74 +++ .../ChillDocStoreBundle/config/services.yaml | 5 + .../translations/messages.fr.yml | 1 + .../ChillMainBundle/ChillMainBundle.php | 3 + .../Controller/WorkflowApiController.php | 118 +++++ .../Controller/WorkflowController.php | 257 ++++++++++ .../Entity/Workflow/EntityWorkflow.php | 439 ++++++++++++++++++ .../Entity/Workflow/EntityWorkflowComment.php | 77 +++ .../Entity/Workflow/EntityWorkflowStep.php | 336 ++++++++++++++ .../Form/EntityWorkflowCommentType.php | 27 ++ .../DataTransformer/UserToJsonTransformer.php | 10 +- .../ChillMainBundle/Form/WorkflowStepType.php | 111 +++++ .../Form/WorkflowTransitionType.php | 36 ++ .../Workflow/EntityWorkflowRepository.php | 137 ++++++ .../Resources/public/chill/chillmain.scss | 68 ++- .../Resources/public/chill/scss/buttons.scss | 3 + .../public/chill/scss/flex_table.scss | 9 + .../public/chill/scss/notification.scss | 12 + .../public/chill/scss/render_box.scss | 3 + .../public/lib/entity-workflow/api.js | 12 + .../public/module/bootstrap/index.js | 14 +- .../module/entity-workflow-pick/index.js | 49 ++ .../module/entity-workflow-subscribe/index.js | 32 ++ .../public/module/pick-entity/index.js | 2 +- .../public/module/wopi-link/index.js | 29 ++ .../public/page/workflow-show/index.js | 30 ++ .../EntityWorkflowVueSubscriber.vue | 101 ++++ .../EntityWorkflow/ListWorkflow.vue | 36 ++ .../EntityWorkflow/PickWorkflow.vue | 50 ++ .../public/vuejs/_components/Modal.vue | 13 +- .../public/vuejs/_components/OpenWopiLink.vue | 243 ++++++++++ .../Resources/views/Admin/layout.html.twig | 2 +- .../views/Entity/CommentEmbeddable.html.twig | 24 +- .../views/Menu/verticalMenu.html.twig | 14 +- .../views/Notification/_list_item.html.twig | 8 +- ...ension_counter_notifications_for.html.twig | 14 +- .../views/Notification/list.html.twig | 2 +- .../views/Notification/show.html.twig | 4 +- .../views/Workflow/_attachment.html.twig | 120 +++++ .../views/Workflow/_comment.html.twig | 13 + .../views/Workflow/_decision.html.twig | 48 ++ .../_extension_list_workflow_for.html.twig | 13 + .../views/Workflow/_follow.html.twig | 8 + .../views/Workflow/_history.html.twig | 59 +++ .../Workflow/_notification_include.html.twig | 12 + .../Resources/views/Workflow/index.html.twig | 56 +++ .../Resources/views/Workflow/list.html.twig | 97 ++++ .../views/Workflow/macro_breadcrumb.html.twig | 45 ++ ...n_transition_completed_content.fr.txt.twig | 13 + ..._on_transition_completed_title.fr.txt.twig | 5 + .../Routing/MenuBuilder/UserMenuBuilder.php | 9 + .../Authorization/EntityWorkflowVoter.php | 70 +++ .../Entity/Workflow/EntityWorkflowTest.php | 81 ++++ .../EntityWorkflowHandlerInterface.php | 39 ++ .../Workflow/EntityWorkflowManager.php | 48 ++ ...ntityWorkflowTransitionEventSubscriber.php | 114 +++++ .../NotificationOnTransition.php | 103 ++++ .../Exception/HandlerNotFoundException.php | 18 + .../Workflow/Helper/MetadataExtractor.php | 74 +++ .../WorkflowNotificationHandler.php | 45 ++ .../RelatedEntityWorkflowSupportsStrategy.php | 35 ++ .../Templating/WorkflowTwigExtension.php | 29 ++ .../WorkflowTwigExtensionRuntime.php | 79 ++++ .../Validator/EntityWorkflowCreation.php | 35 ++ .../EntityWorkflowCreationValidator.php | 71 +++ .../ChillMainBundle/chill.webpack.config.js | 4 + .../ChillMainBundle/config/services.yaml | 14 + .../ChillMainBundle/config/services/form.yaml | 2 + .../config/services/security.yaml | 2 + .../migrations/Version20220112123436.php | 72 +++ .../migrations/Version20220114132105.php | 47 ++ .../migrations/Version20220114165950.php | 37 ++ .../translations/messages.fr.yml | 40 +- ...mpanyingPeriodWorkEvaluationRepository.php | 61 +++ .../vuejs/AccompanyingCourseWorkEdit/App.vue | 20 +- .../components/AddEvaluation.vue | 35 +- .../components/FormEvaluation.vue | 36 +- .../vuejs/AccompanyingCourseWorkEdit/store.js | 4 +- .../Comment/index.html.twig | 6 +- .../views/AccompanyingCourse/index.html.twig | 19 +- .../AccompanyingCourseWork/_item.html.twig | 127 +++++ .../AccompanyingCourseWork/edit.html.twig | 23 +- .../AccompanyingCourseWork/index.html.twig | 132 +----- ...st_recent_by_accompanying_period.html.twig | 9 +- .../views/AccompanyingPeriod/_list.html.twig | 4 - .../AccompanyingPeriod/_list_item.html.twig | 20 +- .../Resources/views/Macro/updatedBy.html.twig | 12 + .../views/Person/household_history.html.twig | 2 +- .../views/Person/list_with_period.html.twig | 247 +++++----- .../Resources/views/Person/view.html.twig | 6 +- .../_accompanying_period_work.html.twig | 17 + .../_accompanying_period_work.title.html.twig | 19 + .../views/Workflow/_evaluation.html.twig | 99 ++++ .../Workflow/_evaluation.title.html.twig | 19 + .../AccompanyingPeriodWorkEvaluationVoter.php | 51 ++ .../AccompanyingPeriodWorkVoter.php | 57 +++ ...mpanyingPeriodWorkEvaluationNormalizer.php | 74 +++ .../AccompanyingPeriodWorkNormalizer.php | 85 ++++ .../Normalizer/WorkflowNormalizer.php | 70 +++ ...ingPeriodWorkEvaluationWorkflowHandler.php | 71 +++ .../AccompanyingPeriodWorkWorkflowHandler.php | 70 +++ .../ChillPersonBundle/config/services.yaml | 5 + .../config/services/security.yaml | 8 + 110 files changed, 5176 insertions(+), 392 deletions(-) create mode 100644 src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/_workflow.html.twig create mode 100644 src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/_workflow.title.html.twig create mode 100644 src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php create mode 100644 src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php create mode 100644 src/Bundle/ChillMainBundle/Controller/WorkflowController.php create mode 100644 src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php create mode 100644 src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowComment.php create mode 100644 src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php create mode 100644 src/Bundle/ChillMainBundle/Form/EntityWorkflowCommentType.php create mode 100644 src/Bundle/ChillMainBundle/Form/WorkflowStepType.php create mode 100644 src/Bundle/ChillMainBundle/Form/WorkflowTransitionType.php create mode 100644 src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php create mode 100644 src/Bundle/ChillMainBundle/Resources/public/lib/entity-workflow/api.js create mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/entity-workflow-pick/index.js create mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/entity-workflow-subscribe/index.js create mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/wopi-link/index.js create mode 100644 src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js create mode 100644 src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/EntityWorkflowVueSubscriber.vue create mode 100644 src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/ListWorkflow.vue create mode 100644 src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/PickWorkflow.vue create mode 100644 src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/OpenWopiLink.vue create mode 100644 src/Bundle/ChillMainBundle/Resources/views/Workflow/_attachment.html.twig create mode 100644 src/Bundle/ChillMainBundle/Resources/views/Workflow/_comment.html.twig create mode 100644 src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig create mode 100644 src/Bundle/ChillMainBundle/Resources/views/Workflow/_extension_list_workflow_for.html.twig create mode 100644 src/Bundle/ChillMainBundle/Resources/views/Workflow/_follow.html.twig create mode 100644 src/Bundle/ChillMainBundle/Resources/views/Workflow/_history.html.twig create mode 100644 src/Bundle/ChillMainBundle/Resources/views/Workflow/_notification_include.html.twig create mode 100644 src/Bundle/ChillMainBundle/Resources/views/Workflow/index.html.twig create mode 100644 src/Bundle/ChillMainBundle/Resources/views/Workflow/list.html.twig create mode 100644 src/Bundle/ChillMainBundle/Resources/views/Workflow/macro_breadcrumb.html.twig create mode 100644 src/Bundle/ChillMainBundle/Resources/views/Workflow/workflow_notification_on_transition_completed_content.fr.txt.twig create mode 100644 src/Bundle/ChillMainBundle/Resources/views/Workflow/workflow_notification_on_transition_completed_title.fr.txt.twig create mode 100644 src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php create mode 100644 src/Bundle/ChillMainBundle/Tests/Entity/Workflow/EntityWorkflowTest.php create mode 100644 src/Bundle/ChillMainBundle/Workflow/EntityWorkflowHandlerInterface.php create mode 100644 src/Bundle/ChillMainBundle/Workflow/EntityWorkflowManager.php create mode 100644 src/Bundle/ChillMainBundle/Workflow/EventSubscriber/EntityWorkflowTransitionEventSubscriber.php create mode 100644 src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php create mode 100644 src/Bundle/ChillMainBundle/Workflow/Exception/HandlerNotFoundException.php create mode 100644 src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php create mode 100644 src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php create mode 100644 src/Bundle/ChillMainBundle/Workflow/RelatedEntityWorkflowSupportsStrategy.php create mode 100644 src/Bundle/ChillMainBundle/Workflow/Templating/WorkflowTwigExtension.php create mode 100644 src/Bundle/ChillMainBundle/Workflow/Templating/WorkflowTwigExtensionRuntime.php create mode 100644 src/Bundle/ChillMainBundle/Workflow/Validator/EntityWorkflowCreation.php create mode 100644 src/Bundle/ChillMainBundle/Workflow/Validator/EntityWorkflowCreationValidator.php create mode 100644 src/Bundle/ChillMainBundle/migrations/Version20220112123436.php create mode 100644 src/Bundle/ChillMainBundle/migrations/Version20220114132105.php create mode 100644 src/Bundle/ChillMainBundle/migrations/Version20220114165950.php create mode 100644 src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationRepository.php create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/_item.html.twig create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/Macro/updatedBy.html.twig create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/Workflow/_accompanying_period_work.html.twig create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/Workflow/_accompanying_period_work.title.html.twig create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/Workflow/_evaluation.html.twig create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/Workflow/_evaluation.title.html.twig create mode 100644 src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationVoter.php create mode 100644 src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkVoter.php create mode 100644 src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php create mode 100644 src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php create mode 100644 src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php create mode 100644 src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php create mode 100644 src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php diff --git a/CHANGELOG.md b/CHANGELOG.md index dc3a8da23..9fe5fc94b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,9 @@ and this project adheres to * [notification] add `[Chill]` in the subject of each notification, automatically * [notification] add a counter for notification in activity list and accompanying period list, and search results * [parcours] bugfix if deathdate is not defined (eg. for a thirdparty) parcours is still displayed. Gave error before. +* [workflow] add breadcrumb to show steps +* [popover] add popover html popup mechanism (used by workflow breadcrumb) +* [templates] improve updatedBy macro in item metadatas ## Test releases @@ -28,6 +31,10 @@ and this project adheres to * [main] location form type: fix unmapped address field (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/246) * [activity] fix wrong import of js assets for adding and viewing documents in activity (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/83 & https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/176) * [person]: space added between deathdate and age in twig renderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/380) +* [workflow] + * add My workflow section with my opened subscriptions + * apply workflow on documents, accompanyingCourseWork and Evaluations +* [wopi-link] a new vue component allow to open wopi link in a fullscreen chill-themed modal ### test release 2022-01-17 diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/_list_item.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/_list_item.html.twig index 09a7ab2a3..6b2e33dfb 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/_list_item.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/_list_item.html.twig @@ -143,9 +143,17 @@
- +
+ {% set notif_counter = chill_count_notifications('Chill\\ActivityBundle\\Entity\\Activity', activity.id) %} + {% if notif_counter.total > 0 %} + {{ chill_counter_notifications('Chill\\ActivityBundle\\Entity\\Activity', activity.id) }} + {% endif %} +
+
+
    + {{ recordAction }} +
+
diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig index 6b0639a27..7ae24fa4b 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig @@ -1,10 +1,6 @@ {% macro recordAction(activity, context = null, person_id = null, accompanying_course_id = null) %} {% if is_granted('CHILL_ACTIVITY_SEE_DETAILS', activity) %} {% if no_action is not defined or no_action == false %} - {% set notif_counter = chill_count_notifications('Chill\\ActivityBundle\\Entity\\Activity', activity.id) %} - {% if notif_counter.total > 0 %} -
  • {{ chill_counter_notifications('Chill\\ActivityBundle\\Entity\\Activity', activity.id) }}
  • - {% endif %}
  • {{ 'Activity data'|trans }} diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/_workflow.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/_workflow.html.twig new file mode 100644 index 000000000..4ec11a8e8 --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/_workflow.html.twig @@ -0,0 +1,52 @@ +{% import "@ChillDocStore/Macro/macro.html.twig" as m %} + +
    +
    +
    +
    + +
    +
    +

    {{ document.title }}

    + {{ document.object.type }} + + {% if document.description is not empty %} +
    + {{ document.description }} +
    + {% endif %} + +
    +
    +
    +
    + +{% if display_action is defined and display_action == true %} +
      +
    • + {{ m.download_button(document.object, document.title) }} +
    • +
    • + + {# + data-button is optional ! + OPTIONS: + 'changeIcon' string + 'changeClass' string + 'noText' boolean + + #}{% set button = { + 'changeIcon': 'fa-unlock', + } %} + + {# vue component #} + +
    • +
    +{% endif %} \ No newline at end of file diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/_workflow.title.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/_workflow.title.html.twig new file mode 100644 index 000000000..e3c1dc50a --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/_workflow.title.html.twig @@ -0,0 +1,19 @@ +{% 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/Resources/views/AccompanyingCourseDocument/show.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/show.html.twig index 97299675a..9d6175e12 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/show.html.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/show.html.twig @@ -6,61 +6,71 @@ {% block title %} {# {{ 'Detail of document of %name%'|trans({ '%name%': accompanyingCourse|chill_entity_render_string } ) }} #} -{% endblock %} - - -{% block js %} - {{ parent() }} - {{ encore_entry_script_tags('mod_async_upload') }} + {{ 'Document %title%' | trans({ '%title%': document.title }) }} {% endblock %} {% block css %} {{ parent() }} {{ encore_entry_link_tags('mod_async_upload') }} + {{ encore_entry_link_tags('mod_entity_workflow_pick') }} {% endblock %} {% block content %} - -

    {{ 'Document %title%' | trans({ '%title%': document.title }) }}

    - -
    -
    {{ 'Title'|trans }}
    -
    {{ document.title }}
    - +
    +{% endblock %} + +{% block block_post_menu %} +
    + {% set workflows_frame = chill_entity_workflow_list('Chill\\DocStoreBundle\\Entity\\AccompanyingCourseDocument', document.id) %} + {% if workflows_frame is not empty %} + {{ workflows_frame|raw }} + {% endif %} +
    +{% endblock %} -
    {{ 'Description' | trans }}
    -
    - {% if document.description is empty %} - {{ 'Any description'|trans }} - {% else %} -
    - {{ document.description|chill_markdown_to_html }} -
    - {% endif %} -
    - -
    - -