Merge remote-tracking branch 'origin/master' into issue469_budget

This commit is contained in:
2022-03-24 16:22:52 +01:00
151 changed files with 2587 additions and 636 deletions

View File

@@ -179,14 +179,15 @@ final class ActivityController extends AbstractController
{
$view = null;
[$person, $accompanyingPeriod] = $this->getEntity($request);
$entity = $this->activityRepository->find($id);
if (null === $entity) {
throw $this->createNotFoundException('Unable to find Activity entity.');
}
$accompanyingPeriod = $entity->getAccompanyingPeriod();
$person = $entity->getPerson();
if ($entity->getAccompanyingPeriod() instanceof AccompanyingPeriod) {
$view = 'ChillActivityBundle:Activity:editAccompanyingCourse.html.twig';
$accompanyingPeriod = $entity->getAccompanyingPeriod();
@@ -220,6 +221,9 @@ final class ActivityController extends AbstractController
$this->entityManager->persist($entity);
$this->entityManager->flush();
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
$params['id'] = $entity->getId();
if ($form->has('gendocTemplateId') && null !== $form['gendocTemplateId']->getData()) {
return $this->redirectToRoute(
'chill_docgenerator_generate_from_template',
@@ -227,15 +231,13 @@ final class ActivityController extends AbstractController
'template' => $form->get('gendocTemplateId')->getData(),
'entityClassName' => Activity::class,
'entityId' => $entity->getId(),
'returnPath' => $this->generateUrl('chill_activity_activity_edit', $params),
]
);
}
$this->addFlash('success', $this->get('translator')->trans('Success : activity updated!'));
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
$params['id'] = $entity->getId();
return $this->redirectToRoute('chill_activity_activity_show', $params);
}
@@ -444,6 +446,9 @@ final class ActivityController extends AbstractController
'template' => $form->get('gendocTemplateId')->getData(),
'entityClassName' => Activity::class,
'entityId' => $entity->getId(),
'returnPath' => $this->generateUrl('chill_activity_activity_edit', [
'id' => $entity->getId(),
]),
]
);
}

View File

@@ -305,6 +305,7 @@ class ActivityType extends AbstractType
'label' => $activityType->getLabel('documents'),
'required' => $activityType->isRequired('documents'),
'allow_add' => true,
'allow_delete' => true,
'button_add_label' => 'activity.Insert a document',
'button_remove_label' => 'activity.Remove a document',
'empty_collection_explain' => 'No documents',

View File

@@ -0,0 +1,16 @@
div.chill-dropzone__below-zone {
a.btn-delete {
display: none;
}
}
// do it in js does not work
// document.addEventListener('DOMContentLoaded', e => {
// const dropzoneBelow = document.querySelectorAll('div.chill-dropzone__below-zone');
// dropzoneBelow.forEach(
// d => {
// const a = d.querySelector('a.btn-delete');
// d.removeChild(a);
// }
// )
// });

View File

@@ -110,10 +110,8 @@ export default function prepareLocations(store) {
console.log('default loation id', window.default_location_id);
if (window.default_location_id) {
for (let group of store.state.availableLocations) {
console.log(group);
let location = group.locations.find((l) => l.id === window.default_location_id);
console.log(location);
if (location !== undefined) {
if (location !== undefined & store.state.activity.location === null) {
store.dispatch('updateLocation', location);
break;
}

View File

@@ -30,4 +30,5 @@
{{ parent() }}
{{ encore_entry_link_tags('mod_async_upload') }}
{{ encore_entry_link_tags('vue_activity') }}
{{ encore_entry_link_tags('page_edit_activity') }}
{% endblock %}

View File

@@ -46,7 +46,7 @@
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'person'} %}
{% if is_granted('CHILL_ACTIVITY_CREATE', person) %}
{% if is_granted('CHILL_ACTIVITY_CREATE_PERSON', person) %}
<ul class="record_actions sticky-form-buttons">
<li>
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}"

View File

@@ -7,5 +7,7 @@ module.exports = function(encore, entries)
ChillActivityAssets: __dirname + '/Resources/public'
});
encore.addEntry('page_edit_activity', __dirname + '/Resources/public/page/edit_activity/index.scss');
encore.addEntry('vue_activity', __dirname + '/Resources/public/vuejs/Activity/index.js');
};

View File

@@ -76,7 +76,7 @@ activity:
Insert a document: Insérer un document
Remove a document: Supprimer le document
comment: Commentaire
No documents: Pas de documents
No documents: Aucun document
#timeline
'%user% has done an %activity_type%': '%user% a effectué une activité de type "%activity_type%"'