diff --git a/CHANGELOG.md b/CHANGELOG.md index a8aa604b7..9b00be8bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,13 +16,24 @@ and this project adheres to * [homepage widget] improve content tables, improve counter pluralization with style on number * [notification lists] add comments counter information * [workflows] fix popover header with previous transition +* [parcours]: validation + message for closing parcours adjusted. +* [household]: household composition double edit button replaced by a delete action (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/426) +[fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413 +[homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc. +* [person]: Comment on marital status is possible even if marital status is not defined (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/421) +* [parcours]: In the list of person results the requestor is not displayed if defined as anonymous (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/424) +* [bugfix]: modal closes and newly created person/thirdparty is selected when multiple persons/thirdparties are created through the modal (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/429) +* [person_resource]: Onthefly button added to view person/thirdparty and badge differentiation for a contact-thirdparty (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/428) +* [workflow][notification] improve how notifications and workflows are 'attached' to entities: contextual list, counter, buttons and vue modal +* [AddAddress] disable multiselect search, and rely only on most pertinent Cities and Street computed backend +* [fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413 +* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc. + ## Test releases ### test release 2021-01-31 -* [fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413 -* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc. * [person] accompanying course: optimisation: do not fetch some resources for the banner (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/409) * [person] accompanying course: close modal when edit participation (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/420) * [person] accompanying course: treat validation error when editing on-the-fly entities (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/420) @@ -33,7 +44,6 @@ and this project adheres to * [user]: page with accompanying periods to which is user is referent (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/408) * [person] age added to renderstring + renderbox/ vue component created to display person text (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/389) * [household member editor] allow to push to existing household -* [workflow][notification] improve how notifications and workflows are 'attached' to entities: contextual list, counter, buttons and vue modal ### test release 2021-01-28 diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 3e32edfce..d46136173 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -34,6 +34,7 @@ use Psr\Log\LoggerInterface; use RuntimeException; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; @@ -200,12 +201,36 @@ final class ActivityController extends AbstractController 'role' => new Role('CHILL_ACTIVITY_UPDATE'), 'activityType' => $entity->getActivityType(), 'accompanyingPeriod' => $accompanyingPeriod, - ])->handleRequest($request); + ]); + + if ($form->has('documents')) { + $form->add('gendocTemplateId', HiddenType::class, [ + 'mapped' => false, + 'data' => null, + 'attr' => [ + // required for js + 'data-template-id' => 'data-template-id', + ], + ]); + } + + $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $this->entityManager->persist($entity); $this->entityManager->flush(); + if ($form->has('gendocTemplateId') && '' !== $form['gendocTemplateId']) { + return $this->redirectToRoute( + 'chill_docgenerator_generate_from_template', + [ + 'template' => $form->get('gendocTemplateId')->getData(), + 'entityClassName' => Activity::class, + 'entityId' => $entity->getId(), + ] + ); + } + $this->addFlash('success', $this->get('translator')->trans('Success : activity updated!')); $params = $this->buildParamsToUrl($person, $accompanyingPeriod); @@ -393,12 +418,36 @@ final class ActivityController extends AbstractController 'role' => new Role('CHILL_ACTIVITY_CREATE'), 'activityType' => $entity->getActivityType(), 'accompanyingPeriod' => $accompanyingPeriod, - ])->handleRequest($request); + ]); + + if ($form->has('documents')) { + $form->add('gendocTemplateId', HiddenType::class, [ + 'mapped' => false, + 'data' => null, + 'attr' => [ + // required for js + 'data-template-id' => 'data-template-id', + ], + ]); + } + + $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $this->entityManager->persist($entity); $this->entityManager->flush(); + if ($form->has('gendocTemplateId') && '' !== $form['gendocTemplateId']) { + return $this->redirectToRoute( + 'chill_docgenerator_generate_from_template', + [ + 'template' => $form->get('gendocTemplateId')->getData(), + 'entityClassName' => Activity::class, + 'entityId' => $entity->getId(), + ] + ); + } + $this->addFlash('success', $this->get('translator')->trans('Success : activity created!')); $params = $this->buildParamsToUrl($person, $accompanyingPeriod); diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js index b7a5c791b..c812a27a4 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js @@ -2,11 +2,15 @@ import { createApp } from 'vue'; import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n' import { activityMessages } from './i18n' import store from './store' +import PickTemplate from 'ChillDocGeneratorAssets/vuejs/_components/PickTemplate.vue'; +import {fetchTemplates} from 'ChillDocGeneratorAssets/api/pickTemplate.js'; import App from './App.vue'; const i18n = _createI18n(activityMessages); +// app for activity + const hasSocialIssues = document.querySelector('#social-issues-acc') !== null; const hasLocation = document.querySelector('#location') !== null; const hasPerson = document.querySelector('#add-persons') !== null; @@ -29,3 +33,54 @@ const app = createApp({ .use(i18n) .component('app', App) .mount('#activity'); + + +// app for picking template + +const i18nGendoc = _createI18n({}); + +document.querySelectorAll('div[data-docgen-template-picker]').forEach(el => { + fetchTemplates(el.dataset.entityClass).then(templates => { + const picker = { + template: + '', + components: { + PickTemplate, + }, + data() { + return { + templates: templates, + entityId: el.dataset.entityId, + } + }, + methods: { + generateDoc({event, link, template}) { + console.log('generateDoc'); + console.log('link', link); + console.log('template', template); + + let hiddenInput = document.querySelector("input[data-template-id]"); + + if (hiddenInput === null) { + console.error('hidden input not found'); + return; + } + + hiddenInput.value = template; + + let form = document.querySelector('form[name="chill_activitybundle_activity"'); + + if (form === null) { + console.error('form not found'); + return; + } + + form.submit(); + } + } + }; + createApp(picker).use(i18nGendoc).mount(el); + }) + +}); diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig index a59c596c3..3da97efd6 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig @@ -89,9 +89,9 @@ {%- if edit_form.documents is defined -%} {{ form_row(edit_form.documents) }} +
{% endif %} -
{% set person_id = null %} {% if entity.person %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/editAccompanyingCourse.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/editAccompanyingCourse.html.twig index 09ff16fec..b278c0300 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/editAccompanyingCourse.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/editAccompanyingCourse.html.twig @@ -24,12 +24,10 @@ window.activity = {{ activity_json|json_encode|raw }}; {{ encore_entry_script_tags('vue_activity') }} - {{ encore_entry_script_tags('mod_docgen_picktemplate') }} {% endblock %} {% block css %} {{ parent() }} {{ encore_entry_link_tags('mod_async_upload') }} {{ encore_entry_link_tags('vue_activity') }} - {{ encore_entry_link_tags('mod_docgen_picktemplate') }} {% endblock %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/editPerson.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/editPerson.html.twig index 72c74c68e..82c7403c6 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/editPerson.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/editPerson.html.twig @@ -39,11 +39,9 @@ window.activity = {{ activity_json|json_encode|raw }}; {{ encore_entry_script_tags('vue_activity') }} - {{ encore_entry_script_tags('mod_docgen_picktemplate') }} {% endblock %} {% block css %} {{ encore_entry_link_tags('mod_async_upload') }} {{ encore_entry_link_tags('vue_activity') }} - {{ encore_entry_link_tags('mod_docgen_picktemplate') }} {% endblock %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig index a0668119c..755e2e151 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig @@ -87,6 +87,7 @@ {%- if form.documents is defined -%} {{ form_row(form.documents) }} +
{% endif %} {%- if form.attendee is defined -%} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig index 505d8c6cb..47a61bd86 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig @@ -17,10 +17,6 @@ {{ parent() }} {{ encore_entry_script_tags('mod_async_upload') }} diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php index 9a8e6b3b8..7ee09690a 100644 --- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php +++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php @@ -17,7 +17,6 @@ use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithPublicFormInterface; use Chill\DocGeneratorBundle\Context\Exception\UnexpectedTypeException; use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate; use Chill\DocGeneratorBundle\Service\Context\BaseContextData; -use Chill\DocStoreBundle\Entity\Document; use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Repository\DocumentCategoryRepository; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; @@ -210,11 +209,8 @@ class ActivityContext implements */ public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void { - $doc = new StoredObject(); - // TODO push document to remote + $entity->addDocument($storedObject); - $this->em->persist($doc); - - $entity->addDocument($doc); + $this->em->persist($storedObject); } } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php index 6418a7990..73ab536d6 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php @@ -167,7 +167,6 @@ class AsideActivityCategory } $this->parent = $parent; - dump($this); return $this; } diff --git a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php index acaeccf34..8966ecca8 100644 --- a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php +++ b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php @@ -97,7 +97,6 @@ class CalendarType extends AbstractType return $res; }, static function (?string $dateAsString): DateTimeImmutable { - dump($dateAsString); return new DateTimeImmutable($dateAsString); } diff --git a/src/Bundle/ChillDocGeneratorBundle/Resources/public/lib/document-generator.js b/src/Bundle/ChillDocGeneratorBundle/Resources/public/lib/document-generator.js new file mode 100644 index 000000000..beea190a3 --- /dev/null +++ b/src/Bundle/ChillDocGeneratorBundle/Resources/public/lib/document-generator.js @@ -0,0 +1,13 @@ + +const buildLink = function(templateId, entityId, entityClass) { + const + entityIdEncoded = encodeURI(entityId), + returnPath = encodeURIComponent(window.location.pathname + window.location.search + window.location.hash), + entityClassEncoded = encodeURI(entityClass), + url = `/fr/doc/gen/generate/from/${templateId}/for/${entityClassEncoded}/${entityIdEncoded}?returnPath=${returnPath}` + ; + console.log('computed Url'); + return url; +}; + +export {buildLink}; diff --git a/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue b/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue index 04d563782..cd5121fc9 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue +++ b/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue @@ -20,8 +20,8 @@ - - + + @@ -39,24 +39,27 @@