mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
rdv: rdv -> activity: pass calendar data to new activity controller
This commit is contained in:
parent
3385cb2dda
commit
e8d8a57b4b
@ -139,6 +139,12 @@ class ActivityController extends AbstractController
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($request->query->has('activityData')) {
|
||||||
|
$activityData = $request->query->get('activityData');
|
||||||
|
} else {
|
||||||
|
$activityData = [];
|
||||||
|
}
|
||||||
|
|
||||||
if ($view === null) {
|
if ($view === null) {
|
||||||
throw $this->createNotFoundException('Template not found');
|
throw $this->createNotFoundException('Template not found');
|
||||||
}
|
}
|
||||||
@ -147,6 +153,7 @@ class ActivityController extends AbstractController
|
|||||||
'person' => $person,
|
'person' => $person,
|
||||||
'accompanyingCourse' => $accompanyingPeriod,
|
'accompanyingCourse' => $accompanyingPeriod,
|
||||||
'data' => $data,
|
'data' => $data,
|
||||||
|
'activityData' => $activityData
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,10 +173,21 @@ class ActivityController extends AbstractController
|
|||||||
$activityType = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityType::class)
|
$activityType = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityType::class)
|
||||||
->find($activityType_id);
|
->find($activityType_id);
|
||||||
|
|
||||||
|
|
||||||
|
if ($request->query->has('activityData')) {
|
||||||
|
$activityData = $request->query->get('activityData');
|
||||||
|
dump($activityData);
|
||||||
|
}
|
||||||
|
|
||||||
if (!$activityType instanceof \Chill\ActivityBundle\Entity\ActivityType ||
|
if (!$activityType instanceof \Chill\ActivityBundle\Entity\ActivityType ||
|
||||||
!$activityType->isActive()) {
|
!$activityType->isActive()) {
|
||||||
|
|
||||||
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
||||||
|
|
||||||
|
if (NULL !== $activityData) {
|
||||||
|
$params['activityData'] = $activityData;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->redirectToRoute('chill_activity_activity_select_type', $params);
|
return $this->redirectToRoute('chill_activity_activity_select_type', $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,12 @@
|
|||||||
{% set accompanying_course_id = accompanyingCourse.id %}
|
{% set accompanying_course_id = accompanyingCourse.id %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'activityType_id': activityType.id, 'accompanying_period_id': accompanying_course_id }) }}">
|
<a href="{{ path('chill_activity_activity_new', {
|
||||||
|
'person_id': person_id,
|
||||||
|
'activityType_id': activityType.id,
|
||||||
|
'accompanying_period_id': accompanying_course_id,
|
||||||
|
'activityData': activityData
|
||||||
|
}) }}">
|
||||||
|
|
||||||
<div class="bloc btn btn-primary btn-lg btn-block">
|
<div class="bloc btn btn-primary btn-lg btn-block">
|
||||||
{{ activityType.name|localize_translatable_string }}
|
{{ activityType.name|localize_translatable_string }}
|
||||||
|
@ -215,10 +215,28 @@ class CalendarController extends AbstractController
|
|||||||
throw $this->createNotFoundException('Template not found');
|
throw $this->createNotFoundException('Template not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$personsId = [];
|
||||||
|
foreach ($entity->getPersons() as $p) {
|
||||||
|
array_push($personsId, $p->getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
$professionalsId = [];
|
||||||
|
foreach ($entity->getProfessionals() as $p) {
|
||||||
|
array_push($professionalsId, $p->getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
$activityData = [
|
||||||
|
'personsId' => $personsId,
|
||||||
|
'professionalsId' => $professionalsId,
|
||||||
|
'date' => $entity->getStartDate()->format('Y-m-d'),
|
||||||
|
'durationTime' => $entity->getEndDate()->diff($entity->getStartDate())->format("%H:%M")
|
||||||
|
];
|
||||||
|
|
||||||
return $this->render($view, [
|
return $this->render($view, [
|
||||||
'accompanyingCourse' => $accompanyingPeriod,
|
'accompanyingCourse' => $accompanyingPeriod,
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
'user' => $user
|
'user' => $user,
|
||||||
|
'activityData' => $activityData
|
||||||
//'delete_form' => $deleteForm->createView(),
|
//'delete_form' => $deleteForm->createView(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -65,13 +65,21 @@
|
|||||||
|
|
||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
<a class="btn btn-cancel" href="{{ path('chill_calendar_calendar_list', { 'accompanying_period_id': accompanying_course_id, 'user_id': user_id } ) }}">
|
<a class="btn btn-cancel" href="{{ path('chill_calendar_calendar_list',
|
||||||
|
{ 'accompanying_period_id': accompanying_course_id, 'user_id': user_id }) }}">
|
||||||
{{ 'Back to the list'|trans }}
|
{{ 'Back to the list'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="btn btn-create" href="{{ chill_path_add_return_path('chill_activity_activity_new',
|
||||||
|
{ 'accompanying_period_id': accompanying_course_id, 'activityData': activityData }) }}">
|
||||||
|
{{ 'Transform to activity'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
{% if accompanyingCourse %}
|
{% if accompanyingCourse %}
|
||||||
<li>
|
<li>
|
||||||
<a class="btn btn-update" href="{{ path('chill_calendar_calendar_edit', { 'id': entity.id, 'accompanying_period_id': accompanying_course_id }) }}">
|
<a class="btn btn-update" href="{{ path('chill_calendar_calendar_edit',
|
||||||
|
{ 'id': entity.id, 'accompanying_period_id': accompanying_course_id }) }}">
|
||||||
{{ 'Edit'|trans }}
|
{{ 'Edit'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -24,3 +24,4 @@ Add a new calendar: Ajouter un nouveau rendez-vous
|
|||||||
The calendar item has been successfully removed.: Le rendez-vous a été supprimé
|
The calendar item has been successfully removed.: Le rendez-vous a été supprimé
|
||||||
From the day: Du
|
From the day: Du
|
||||||
to the day: au
|
to the day: au
|
||||||
|
Transform to activity: Transformer en échange
|
Loading…
x
Reference in New Issue
Block a user