Merge remote-tracking branch 'origin/master' into fix-phpstan-issues-202303

This commit is contained in:
2023-04-11 11:36:11 +02:00
54 changed files with 572 additions and 465 deletions

View File

@@ -207,6 +207,7 @@ class CalendarController extends AbstractController
'entityClassName' => Calendar::class,
'entityId' => $entity->getId(),
'template' => $template->getId(),
'returnPath' => $request->getRequestUri(),
]);
}
}
@@ -377,7 +378,9 @@ class CalendarController extends AbstractController
$this->addFlash('success', $this->translator->trans('Success : calendar item created!'));
if ($form->get('save_and_upload_doc')->isClicked()) {
return $this->redirectToRoute('chill_calendar_calendardoc_new', ['id' => $entity->getId()]);
return $this->redirectToRoute('chill_calendar_calendardoc_new', [
'id' => $entity->getId()
]);
}
foreach ($templates as $template) {
@@ -386,6 +389,7 @@ class CalendarController extends AbstractController
'entityClassName' => Calendar::class,
'entityId' => $entity->getId(),
'template' => $template->getId(),
'returnPath' => $this->generateUrl('chill_calendar_calendar_edit', ['id' => $entity->getId()]),
]);
}
}
@@ -526,14 +530,20 @@ class CalendarController extends AbstractController
'comment' => $calendar->getComment()->getComment(),
];
return $this->redirectToRoute(
'chill_activity_activity_new',
[
'accompanying_period_id' => $calendar->getAccompanyingPeriod()->getId(),
'activityData' => $activityData,
'returnPath' => $request->query->get('returnPath', null),
]
);
$routeParams = [
'activityData' => $activityData,
'returnPath' => $request->query->get('returnPath', null),
];
if ($calendar->getContext() === 'accompanying_period') {
$routeParams['accompanying_period_id'] = $calendar->getAccompanyingPeriod()->getId();
} elseif ($calendar->getContext() === 'person') {
$routeParams['person_id'] = $calendar->getPerson()->getId();
} else {
throw new RuntimeException('context not found for this calendar');
}
return $this->redirectToRoute('chill_activity_activity_new', $routeParams);
}
private function buildListFilterOrder(): FilterOrderHelper

View File

@@ -93,6 +93,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
/**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod", inversedBy="calendars")
* @Serializer\Groups({"calendar:read", "read"})
*/
private ?AccompanyingPeriod $accompanyingPeriod = null;

View File

@@ -26,9 +26,6 @@ class CalendarDocEditType extends AbstractType
->add('title', TextType::class, [
'label' => 'chill_calendar.Document title',
'required' => true,
])
->add('doc', StoredObjectType::class, [
'label' => 'chill_calendar.Document object',
]);
}

View File

@@ -15,6 +15,7 @@
:picked="null !== this.$store.getters.getMainUser ? [this.$store.getters.getMainUser] : []"
:removableIfSet="false"
:displayPicked="false"
:suggested="this.suggestedUsers"
@addNewEntity="setMainUser"
></pick-entity>
</div>
@@ -143,6 +144,7 @@ export default {
slotMinTime: '09:00:00',
slotMaxTime: '18:00:00',
hideWeekEnds: true,
previousUser: [],
}
},
computed: {
@@ -188,11 +190,23 @@ export default {
users.push(this.$store.getters.getUserDataById(id).user);
}
return users;
}
},
suggestedUsers() {
const suggested = [];
this.$data.previousUser.forEach(u => {
if (u.id !== this.$store.getters.getMainUser.id) {
suggested.push(u)
}
});
return suggested;
},
},
methods: {
setMainUser(user) {
console.log('setMainUser APP', user);
setMainUser({entity}) {
const user = entity;
console.log('setMainUser APP', entity);
if (user.id !== this.$store.getters.getMainUser && (
this.$store.state.activity.calendarRange !== null
@@ -205,6 +219,14 @@ export default {
}
}
// add the previous user, if any, in the previous user list (in use for suggestion)
if (null !== this.$store.getters.getMainUser) {
const suggestedUids = new Set(this.$data.previousUser.map(u => u.id));
if (!suggestedUids.has(this.$store.getters.getMainUser.id)){
this.$data.previousUser.push(this.$store.getters.getMainUser);
}
}
this.$store.dispatch('setMainUser', user);
this.$store.commit('showUserOnCalendar', {user, ranges: true, remotes: true});
},

View File

@@ -202,6 +202,8 @@ export default {
return dispatch('associateCalendarToRange', { range: null }).then(() => {
commit('setMainUser', mainUser);
return dispatch('fetchCalendarEvents');
});
},

View File

@@ -54,7 +54,7 @@ export const mapEntity = (entity: EventInput): EventInput => {
export const createUserData = (user: User, colorIndex: number): UserData => {
const colorId = colorIndex % COLORS.length;
console.log('colorId', colorId);
return {
user: user,
calendarRanges: [],

View File

@@ -1,7 +1,7 @@
<template>
<div class="row">
<div class="col-sm">
<label class="form-label">Lieu des plages de disponibilités créées</label>
<label class="form-label">{{ $t('created_availabilities') }}</label>
<vue-multiselect
v-model="pickedLocation"
:options="locations"

View File

@@ -1,5 +1,6 @@
const appMessages = {
fr: {
created_availabilities: "Lieu des plages de disponibilités créées",
edit_your_calendar_range: "Planifiez vos plages de disponibilités",
show_my_calendar: "Afficher mon calendrier",
show_weekends: "Afficher les week-ends",

View File

@@ -20,15 +20,24 @@
<div class="row">
<div class="col text-start">
{{ d.storedObject.title }}
{% if d.dateTimeVersion < d.calendar.dateTimeVersion %}
</div>
{% if d.dateTimeVersion < d.calendar.dateTimeVersion %}
<div class="col text-start">
<span class="badge bg-danger">{{ 'chill_calendar.Document outdated'|trans }}</span>
{% endif %}
</div>
<div class="col-md-auto text-center">
{{ mm.mimeIcon(d.storedObject.type) }}
</div>
{% endif %}
<div class="col col-lg-4 text-end">
{{ d.storedObject|chill_document_button_group(d.storedObject.title, is_granted('CHILL_CALENDAR_DOC_EDIT', d), {'small': true}) }}
<ul class="record_actions">
<li>
{{ d.storedObject|chill_document_button_group(d.storedObject.title, is_granted('CHILL_CALENDAR_DOC_EDIT', d), {'small': true}) }}
</li>
<li>
<a href="{{ chill_path_add_return_path('chill_calendar_calendardoc_edit', {id: d.id}) }}" class="btn btn-sm btn-edit"></a>
</li>
<li>
<a href="{{ chill_path_add_return_path('chill_calendar_calendardoc_delete', {id: d.id}) }}" class="btn btn-sm btn-delete"></a>
</li>
</ul>
</div>
</div>
</li>

View File

@@ -110,7 +110,46 @@
</div>
</div>
<div class="item-row">
{% if calendar.activity is not null %}
<div class="item-row separator">
<div class="item-col">
<div class="wrap-list">
<div class="wl-row">
<div class="wl-col title"><h3>{{ 'Activity'|trans }}</h3></div>
<div class="wl-col list activity-linked">
<h2 class="badge-title">
<span class="title_label"></span>
<span class="title_action">
{{ calendar.activity.type.name | localize_translatable_string }}
{% if calendar.activity.emergency %}
<span class="badge bg-danger rounded-pill fs-6 float-end">{{ 'Emergency'|trans|upper }}</span>
{% endif %}
</span>
</h2>
<ul class="record_actions">
<li class="cancel">
<span class="createdBy">
{{ 'Created by'|trans }}
<b>{{ calendar.activity.createdBy|chill_entity_render_string }}</b>, {{ 'on'|trans }} {{ calendar.activity.createdAt|format_datetime('short', 'short') }}
</span>
</li>
{% if is_granted('CHILL_ACTIVITY_SEE', calendar.activity) %}
<li>
<a href="{{ chill_path_add_return_path('chill_activity_activity_show', {'id': calendar.activity.id}) }}" class="btn btn-sm btn-show" ></a>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
</div>
</div>
{% endif %}
<div class="item-row separator">
<ul class="record_actions">
{% if is_granted('CHILL_CALENDAR_CALENDAR_SEE', calendar) %}
{% if templates|length == 0 %}
@@ -147,7 +186,12 @@
</li>
{% endif %}
{% endif %}
{% if accompanyingCourse is defined and is_granted('CHILL_ACTIVITY_CREATE', accompanyingCourse) and calendar.activity is null %}
{% if calendar.activity is null and (
(calendar.context == 'accompanying_period' and is_granted('CHILL_ACTIVITY_CREATE', calendar.accompanyingPeriod))
or
(calendar.context == 'person' and is_granted('CHILL_ACTIVITY_CREATE', calendar.person))
)
%}
<li>
<a class="btn btn-create"
href="{{ chill_path_add_return_path('chill_calendar_calendar_to_activity', { 'id': calendar.id }) }}">

View File

@@ -9,13 +9,13 @@
{% block js %}
{{ parent() }}
{{ encore_entry_script_tags('mod_answer') }}
{{ encore_entry_script_tags('mod_async_upload') }}
{{ encore_entry_script_tags('mod_document_action_buttons_group') }}
{% endblock %}
{% block css %}
{{ parent() }}
{{ encore_entry_link_tags('mod_answer') }}
{{ encore_entry_link_tags('mod_async_upload') }}
{{ encore_entry_link_tags('mod_document_action_buttons_group') }}
{% endblock %}
{% block content %}

View File

@@ -24,7 +24,6 @@
{{ form_start(form) }}
{{ form_row(form.title) }}
{{ form_row(form.doc) }}
<ul class="record_actions sticky-form-buttons">
<li class="cancel">

View File

@@ -23,7 +23,6 @@
{{ form_start(form) }}
{{ form_row(form.title) }}
{{ form_row(form.doc) }}
<ul class="record_actions sticky-form-buttons">
<li class="cancel">

View File

@@ -28,7 +28,7 @@
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_calendar_calendar_list_by_accompanying_period', {'id': accompanyingCourse.id }) }}">{{ 'Cancel'|trans|chill_return_path_label }}</a>
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_calendar_calendar_edit', {'id': calendar_doc.calendar.id }) }}">{{ 'Cancel'|trans|chill_return_path_label }}</a>
</li>
<li>

View File

@@ -132,8 +132,8 @@ docgen:
Base context for calendar: 'Rendez-vous: contexte de base'
A base context for generating document on calendar: Contexte pour générer des documents à partir des rendez-vous
Track changes on datetime and warn user if date time is updated after the doc generation: Suivre les changements sur le document et prévenir les utilisateurs que la date et l'heure ont été modifiée après la génération du document
Ask main person: Demander de choisir une personne parmi les participants aux rendez-vous
Main person label: Label pour choisir la personne
Ask main person: Demander de choisir un usager parmi les participants aux rendez-vous
Main person label: Label pour choisir l'usager
Ask third party: Demander de choisir un tiers parmi les participants aux rendez-vous
Third party label: Label pour choisir le tiers
Destinee: Destinataire

View File

@@ -1,5 +1,5 @@
calendar:
At least {{ limit }} person is required.: Au moins {{ limit }} personne doit être associée à ce rendez-vous
At least {{ limit }} person is required.: Au moins {{ limit }} usager doit être associée à ce rendez-vous
An end date is required: Indiquez une date et heure de fin
A start date is required: Indiquez une date et heure de début
A location is required: Indiquez un lieu