mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-01 14:36:13 +00:00
rdv: pages by User
This commit is contained in:
parent
406426111a
commit
74957154b1
@ -80,11 +80,10 @@ class CalendarController extends AbstractController
|
|||||||
|
|
||||||
if ($user instanceof User) {
|
if ($user instanceof User) {
|
||||||
|
|
||||||
// $calendar = $em->getRepository(Calendar::class)
|
$calendarItems = $em->getRepository(Calendar::class)
|
||||||
// ->findByUser($user)
|
->findByUser($user)
|
||||||
// ;
|
;
|
||||||
|
$view = 'ChillCalendarBundle:Calendar:listByUser.html.twig';
|
||||||
// $view = 'ChillCalendarBundle:Calendar:listByUser.html.twig';
|
|
||||||
} elseif ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
} elseif ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
$calendarItems = $em->getRepository(Calendar::class)->findBy(
|
$calendarItems = $em->getRepository(Calendar::class)->findBy(
|
||||||
['accompanyingPeriod' => $accompanyingPeriod],
|
['accompanyingPeriod' => $accompanyingPeriod],
|
||||||
@ -174,11 +173,11 @@ class CalendarController extends AbstractController
|
|||||||
[$user, $accompanyingPeriod] = $this->getEntity($request);
|
[$user, $accompanyingPeriod] = $this->getEntity($request);
|
||||||
|
|
||||||
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
$view = 'ChillCalendarBundle:Calendar:showAccompanyingCourse.html.twig';
|
$view = 'ChillCalendarBundle:Calendar:showByAccompanyingCourse.html.twig';
|
||||||
}
|
}
|
||||||
// elseif ($person instanceof Person) {
|
elseif ($user instanceof User) {
|
||||||
// $view = 'ChillCalendarBundle:Calendar:showPerson.html.twig';
|
$view = 'ChillCalendarBundle:Calendar:showByUser.html.twig';
|
||||||
// }
|
}
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillCalendarBundle:Calendar')->find($id);
|
$entity = $em->getRepository('ChillCalendarBundle:Calendar')->find($id);
|
||||||
|
|
||||||
@ -198,9 +197,9 @@ class CalendarController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->render($view, [
|
return $this->render($view, [
|
||||||
//'person' => $person,
|
|
||||||
'accompanyingCourse' => $accompanyingPeriod,
|
'accompanyingCourse' => $accompanyingPeriod,
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
|
'user' => $user
|
||||||
//'delete_form' => $deleteForm->createView(),
|
//'delete_form' => $deleteForm->createView(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -218,11 +217,11 @@ class CalendarController extends AbstractController
|
|||||||
[$user, $accompanyingPeriod] = $this->getEntity($request);
|
[$user, $accompanyingPeriod] = $this->getEntity($request);
|
||||||
|
|
||||||
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
$view = 'ChillCalendarBundle:Calendar:editAccompanyingCourse.html.twig';
|
$view = 'ChillCalendarBundle:Calendar:editByAccompanyingCourse.html.twig';
|
||||||
|
}
|
||||||
|
elseif ($user instanceof User) {
|
||||||
|
$view = 'ChillCalendarBundle:Calendar:editByUser.html.twig';
|
||||||
}
|
}
|
||||||
// elseif ($person instanceof Person) {
|
|
||||||
// $view = 'ChillCalendarBundle:Calendar:editPerson.html.twig';
|
|
||||||
// }
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillCalendarBundle:Calendar')->find($id);
|
$entity = $em->getRepository('ChillCalendarBundle:Calendar')->find($id);
|
||||||
|
|
||||||
@ -259,6 +258,7 @@ class CalendarController extends AbstractController
|
|||||||
'form' => $form->createView(),
|
'form' => $form->createView(),
|
||||||
'delete_form' => $deleteForm->createView(),
|
'delete_form' => $deleteForm->createView(),
|
||||||
'accompanyingCourse' => $accompanyingPeriod,
|
'accompanyingCourse' => $accompanyingPeriod,
|
||||||
|
'user' => $user,
|
||||||
'entity_json' => $entity_array
|
'entity_json' => $entity_array
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -274,11 +274,11 @@ class CalendarController extends AbstractController
|
|||||||
[$user, $accompanyingPeriod] = $this->getEntity($request);
|
[$user, $accompanyingPeriod] = $this->getEntity($request);
|
||||||
|
|
||||||
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
$view = 'ChillCalendarBundle:Calendar:confirm_deleteAccompanyingCourse.html.twig';
|
$view = 'ChillCalendarBundle:Calendar:confirm_deleteByAccompanyingCourse.html.twig';
|
||||||
}
|
}
|
||||||
// elseif ($person instanceof Person) {
|
elseif ($user instanceof User) {
|
||||||
// $view = 'ChillCalendarBundle:Calendar:confirm_deletePerson.html.twig';
|
$view = 'ChillCalendarBundle:Calendar:confirm_deleteByUser.html.twig';
|
||||||
// }
|
}
|
||||||
|
|
||||||
/* @var $entity Calendar */
|
/* @var $entity Calendar */
|
||||||
$entity = $em->getRepository('ChillCalendarBundle:Calendar')->find($id);
|
$entity = $em->getRepository('ChillCalendarBundle:Calendar')->find($id);
|
||||||
@ -324,9 +324,9 @@ class CalendarController extends AbstractController
|
|||||||
/**
|
/**
|
||||||
* Creates a form to delete a Calendar entity by id.
|
* Creates a form to delete a Calendar entity by id.
|
||||||
*/
|
*/
|
||||||
private function createDeleteForm(int $id, ?Person $person, ?AccompanyingPeriod $accompanyingPeriod): Form
|
private function createDeleteForm(int $id, ?User $user, ?AccompanyingPeriod $accompanyingPeriod): Form
|
||||||
{
|
{
|
||||||
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
$params = $this->buildParamsToUrl($user, $accompanyingPeriod);
|
||||||
$params['id'] = $id;
|
$params['id'] = $id;
|
||||||
|
|
||||||
return $this->createFormBuilder()
|
return $this->createFormBuilder()
|
||||||
@ -350,7 +350,8 @@ class CalendarController extends AbstractController
|
|||||||
throw $this->createNotFoundException('User not found');
|
throw $this->createNotFoundException('User not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $user);
|
// TODO Add permission
|
||||||
|
// $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $user);
|
||||||
} elseif ($request->query->has('accompanying_period_id')) {
|
} elseif ($request->query->has('accompanying_period_id')) {
|
||||||
$accompanying_period_id = $request->get('accompanying_period_id');
|
$accompanying_period_id = $request->get('accompanying_period_id');
|
||||||
$accompanyingPeriod = $em->getRepository(AccompanyingPeriod::class)->find($accompanying_period_id);
|
$accompanyingPeriod = $em->getRepository(AccompanyingPeriod::class)->find($accompanying_period_id);
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
{% extends "@ChillMain/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set user = calendar.user %}
|
||||||
|
|
||||||
|
{% set activeRouteKey = 'chill_calendar_calendar' %}
|
||||||
|
|
||||||
|
{% block title 'Remove activity'|trans %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{{ include('@ChillMain/Util/confirmation_template.html.twig',
|
||||||
|
{
|
||||||
|
'title' : 'Remove calendar item'|trans,
|
||||||
|
'confirm_question' : 'Are you sure you want to remove the calendar item?'|trans,
|
||||||
|
'cancel_route' : 'chill_calendar_calendar',
|
||||||
|
'cancel_parameters' : { 'user_id' : calendar.user.id, 'id' : calendar.id },
|
||||||
|
'form' : delete_form
|
||||||
|
} ) }}
|
||||||
|
{% endblock %}
|
@ -1,17 +0,0 @@
|
|||||||
{% extends "@ChillPerson/Person/layout.html.twig" %}
|
|
||||||
|
|
||||||
{% set activeRouteKey = 'chill_activity_activity_list' %}
|
|
||||||
{% set person = activity.person %}
|
|
||||||
|
|
||||||
{% block title 'Remove activity'|trans %}
|
|
||||||
|
|
||||||
{% block personcontent %}
|
|
||||||
{{ include('@ChillMain/Util/confirmation_template.html.twig',
|
|
||||||
{
|
|
||||||
'title' : 'Remove activity'|trans,
|
|
||||||
'confirm_question' : 'Are you sure you want to remove the activity about "%name%" ?'|trans({ '%name%' : person.firstname ~ ' ' ~ person.lastname } ),
|
|
||||||
'cancel_route' : 'chill_activity_activity_list',
|
|
||||||
'cancel_parameters' : { 'person_id' : activity.person.id, 'id' : activity.id },
|
|
||||||
'form' : delete_form
|
|
||||||
} ) }}
|
|
||||||
{% endblock %}
|
|
@ -48,15 +48,17 @@
|
|||||||
{{ form_row(form.sendSMS) }}
|
{{ form_row(form.sendSMS) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<div id="calendarControls"></div>
|
||||||
|
|
||||||
<div id="fullCalendar"></div>
|
<div id="fullCalendar"></div>
|
||||||
|
|
||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
<a
|
<a
|
||||||
class="btn btn-cancel"
|
class="btn btn-cancel"
|
||||||
{%- if context == 'person' -%}
|
{%- if context == 'user' -%}
|
||||||
href="{{ chill_return_path_or('chill_calendar_calendar', { 'person_id': person.id } )}}"
|
href="{{ chill_return_path_or('chill_calendar_calendar', { 'user_id': user.id } )}}"
|
||||||
{%- else -%}
|
{%- elseif context == 'accompanyingCourse' -%}
|
||||||
href="{{ chill_return_path_or('chill_calendar_calendar', { 'accompanying_period_id': accompanyingCourse.id } )}}"
|
href="{{ chill_return_path_or('chill_calendar_calendar', { 'accompanying_period_id': accompanyingCourse.id } )}}"
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
>
|
>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
{% set activeRouteKey = 'chill_calendar_calendar_list' %}
|
{% set activeRouteKey = 'chill_calendar_calendar_list' %}
|
||||||
|
|
||||||
{% block title 'Update calendar'|trans %}
|
{% block title 'Update calendar'|trans %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="calendar-edit">
|
<div class="calendar-edit">
|
@ -0,0 +1,36 @@
|
|||||||
|
{% extends "@ChillMain/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% block title 'Update calendar'|trans %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="calendar-edit">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-10 col-xxl">
|
||||||
|
|
||||||
|
<div id="calendar"></div> {# <=== vue component #}
|
||||||
|
{% include 'ChillCalendarBundle:Calendar:edit.html.twig' with {'context': 'user'} %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
{{ parent() }}
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.addEventListener('DOMContentLoaded', function (e) {
|
||||||
|
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ form.vars.form.vars.name }}"]',
|
||||||
|
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
||||||
|
});
|
||||||
|
window.entity = {{ entity_json|json_encode|raw }};
|
||||||
|
window.startDate = {{ entity.startDate|date('Y-m-d H:i:s')|json_encode|raw }};
|
||||||
|
window.endDate = {{ entity.endDate|date('Y-m-d H:i:s')|json_encode|raw }};
|
||||||
|
window.mainUser = {{ entity.mainUser.id }};
|
||||||
|
</script>
|
||||||
|
{{ encore_entry_script_tags('vue_calendar') }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block css %}
|
||||||
|
{{ parent() }}
|
||||||
|
{{ encore_entry_link_tags('vue_calendar') }}
|
||||||
|
{% endblock %}
|
@ -8,7 +8,11 @@
|
|||||||
{% set accompanying_course_id = accompanyingCourse.id %}
|
{% set accompanying_course_id = accompanyingCourse.id %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<h2>{{ 'Calendar list' |trans }}</h2>
|
{% if user %}
|
||||||
|
<h2>{{ 'My calendar list' |trans }}</h2>
|
||||||
|
{% else %}
|
||||||
|
<h2>{{ 'Calendar list' |trans }}</h2>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if calendarItems|length == 0 %}
|
{% if calendarItems|length == 0 %}
|
||||||
<p class="chill-no-data-statement">
|
<p class="chill-no-data-statement">
|
||||||
@ -54,6 +58,7 @@
|
|||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="item-col">
|
<div class="item-col">
|
||||||
<ul class="list-content">
|
<ul class="list-content">
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
{% extends "@ChillMain/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set activeRouteKey = 'chill_calendar_calendar_list' %}
|
||||||
|
|
||||||
|
{% block title %}{{ 'My calendar list' |trans }}{% endblock title %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% include 'ChillCalendarBundle:Calendar:list.html.twig' with {'context': 'user'} %}
|
||||||
|
{% endblock %}
|
@ -58,24 +58,37 @@
|
|||||||
{% set accompanying_course_id = accompanyingCourse.id %}
|
{% set accompanying_course_id = accompanyingCourse.id %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% set user_id = null %}
|
||||||
|
{% if user %}
|
||||||
|
{% set user_id = user.id %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<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', { 'accompanying_period_id': accompanying_course_id } ) }}">
|
<a class="btn btn-cancel" href="{{ path('chill_calendar_calendar', { 'accompanying_period_id': accompanying_course_id, 'user_id': user_id } ) }}">
|
||||||
{{ 'Back to the list'|trans }}
|
{{ 'Back to the list'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
{% 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>
|
||||||
|
{% endif %}
|
||||||
|
{% if user %}
|
||||||
|
<li>
|
||||||
|
<a class="btn btn-update" href="{{ path('chill_calendar_calendar_edit', { 'id': entity.id, 'user_id': user_id }) }}">
|
||||||
|
{{ 'Edit'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
{# TODO
|
{# TODO
|
||||||
{% if is_granted('CHILL_ACTIVITY_DELETE', entity) %}
|
{% if is_granted('CHILL_ACTIVITY_DELETE', entity) %}
|
||||||
#}
|
#}
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_calendar_calendar_delete', { 'id': entity.id, 'accompanying_period_id': accompanying_course_id } ) }}" class="btn btn-delete">
|
<a href="{{ path('chill_calendar_calendar_delete', { 'id': entity.id, 'accompanying_period_id': accompanying_course_id, 'user_id': user_id } ) }}" class="btn btn-delete">
|
||||||
{{ 'Delete'|trans }}
|
{{ 'Delete'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
{% extends "@ChillMain/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% block title 'Calendar'|trans %}
|
||||||
|
|
||||||
|
{% block content -%}
|
||||||
|
<div class="calendar-show">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-10 col-xxl">
|
||||||
|
{% include 'ChillCalendarBundle:Calendar:show.html.twig' with {'context': 'user'} %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock content %}
|
@ -1,5 +1,6 @@
|
|||||||
Calendar: Rendez-vous
|
Calendar: Rendez-vous
|
||||||
Calendar list: Liste des rendez-vous
|
Calendar list: Liste des rendez-vous
|
||||||
|
My calendar list: Mes rendez-vous
|
||||||
There is no calendar items.: Il n'y a pas de rendez-vous
|
There is no calendar items.: Il n'y a pas de rendez-vous
|
||||||
Remove calendar item: Supprimer le rendez-vous
|
Remove calendar item: Supprimer le rendez-vous
|
||||||
Are you sure you want to remove the calendar item?: Êtes-vous sûr de vouloir supprimer le rendez-vous?
|
Are you sure you want to remove the calendar item?: Êtes-vous sûr de vouloir supprimer le rendez-vous?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user