mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
quick fixes to make calendar app work
This commit is contained in:
parent
0ec0708807
commit
f4b1a25a67
@ -131,6 +131,9 @@ class CalendarType extends AbstractType
|
||||
return implode(',', $personIds);
|
||||
},
|
||||
function (?string $personsAsString): array {
|
||||
if (null === $personsAsString) {
|
||||
return [];
|
||||
}
|
||||
return array_map(
|
||||
fn (string $id): ?Person => $this->om->getRepository(Person::class)->findOneBy(['id' => (int) $id]),
|
||||
explode(',', $personsAsString)
|
||||
@ -151,6 +154,9 @@ class CalendarType extends AbstractType
|
||||
return implode(',', $thirdpartyIds);
|
||||
},
|
||||
function (?string $thirdpartyAsString): array {
|
||||
if (null === $thirdpartyAsString) {
|
||||
return [];
|
||||
}
|
||||
return array_map(
|
||||
fn (string $id): ?ThirdParty => $this->om->getRepository(ThirdParty::class)->findOneBy(['id' => (int) $id]),
|
||||
explode(',', $thirdpartyAsString)
|
||||
@ -230,6 +236,7 @@ class CalendarType extends AbstractType
|
||||
|
||||
public function getBlockPrefix()
|
||||
{
|
||||
return 'chill_calendarbundle_calendar';
|
||||
// as the js share some hardcoded items from activity, we have to rewrite block prefix
|
||||
return 'chill_activitybundle_activity';
|
||||
}
|
||||
}
|
||||
|
@ -29,3 +29,8 @@ services:
|
||||
arguments:
|
||||
$azure: '@knpu.oauth2.provider.azure'
|
||||
tags: ['console.command']
|
||||
|
||||
Chill\CalendarBundle\Security\:
|
||||
autoconfigure: true
|
||||
autowire: true
|
||||
resource: '../../Security/'
|
||||
|
@ -34,7 +34,8 @@ const store = createStore({
|
||||
strict: debug,
|
||||
state: {
|
||||
activity: mapEntity(window.entity), // activity is the calendar entity actually
|
||||
currentEvent: null
|
||||
currentEvent: null,
|
||||
availableLocations: [],
|
||||
},
|
||||
getters: {
|
||||
suggestedEntities(state) {
|
||||
@ -58,6 +59,10 @@ const store = createStore({
|
||||
.filter(p => !existingPersonIds.includes(p.id))
|
||||
},
|
||||
suggestedRequestor(state) {
|
||||
if (state.activity.accompanyingPeriod.requestor === null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const existingPersonIds = state.activity.persons.map(p => p.id);
|
||||
const existingThirdPartyIds = state.activity.thirdParties.map(p => p.id);
|
||||
return [state.activity.accompanyingPeriod.requestor]
|
||||
@ -67,11 +72,14 @@ const store = createStore({
|
||||
);
|
||||
},
|
||||
suggestedUser(state) {
|
||||
const existingUserIds = state.activity.users.map(p => p.id);
|
||||
return [state.activity.accompanyingPeriod.user]
|
||||
.filter(
|
||||
u => !existingUserIds.includes(u.id)
|
||||
);
|
||||
if (null === state.activity.users) {
|
||||
return [];
|
||||
}
|
||||
const existingUserIds = state.activity.users.map(p => p.id);
|
||||
return [state.activity.accompanyingPeriod.user]
|
||||
.filter(
|
||||
u => u !== null && !existingUserIds.includes(u.id)
|
||||
);
|
||||
},
|
||||
suggestedResources(state) {
|
||||
const resources = state.activity.accompanyingPeriod.resources;
|
||||
@ -132,15 +140,15 @@ const store = createStore({
|
||||
console.log('### action addPersonsInvolved', payload.result.type);
|
||||
switch (payload.result.type) {
|
||||
case 'person':
|
||||
let aPersons = document.getElementById("chill_calendarbundle_calendar_persons");
|
||||
let aPersons = document.getElementById("chill_activitybundle_activity_persons");
|
||||
aPersons.value = addIdToValue(aPersons.value, payload.result.id);
|
||||
break;
|
||||
case 'thirdparty':
|
||||
let aThirdParties = document.getElementById("chill_calendarbundle_calendar_professionals");
|
||||
let aThirdParties = document.getElementById("chill_activitybundle_activity_professionals");
|
||||
aThirdParties.value = addIdToValue(aThirdParties.value, payload.result.id);
|
||||
break;
|
||||
case 'user':
|
||||
let aUsers = document.getElementById("chill_calendarbundle_calendar_invites");
|
||||
let aUsers = document.getElementById("chill_activitybundle_activity_invites");
|
||||
aUsers.value = addIdToValue(aUsers.value, payload.result.id);
|
||||
break;
|
||||
};
|
||||
@ -150,15 +158,15 @@ const store = createStore({
|
||||
//console.log('### action removePersonInvolved', payload);
|
||||
switch (payload.type) {
|
||||
case 'person':
|
||||
let aPersons = document.getElementById("chill_calendarbundle_calendar_persons");
|
||||
let aPersons = document.getElementById("chill_activitybundle_activity_persons");
|
||||
aPersons.value = removeIdFromValue(aPersons.value, payload.id);
|
||||
break;
|
||||
case 'thirdparty':
|
||||
let aThirdParties = document.getElementById("chill_calendarbundle_calendar_professionals");
|
||||
let aThirdParties = document.getElementById("chill_activitybundle_activity_professionals");
|
||||
aThirdParties.value = removeIdFromValue(aThirdParties.value, payload.id);
|
||||
break;
|
||||
case 'user':
|
||||
let aUsers = document.getElementById("chill_calendarbundle_calendar_invites");
|
||||
let aUsers = document.getElementById("chill_activitybundle_activity_invites");
|
||||
aUsers.value = removeIdFromValue(aUsers.value, payload.id);
|
||||
break;
|
||||
};
|
||||
@ -168,23 +176,23 @@ const store = createStore({
|
||||
// Calendar
|
||||
createEvent({ commit }, payload) {
|
||||
console.log('### action createEvent', payload);
|
||||
let startDateInput = document.getElementById("chill_calendarbundle_calendar_startDate");
|
||||
let startDateInput = document.getElementById("chill_activitybundle_activity_startDate");
|
||||
startDateInput.value = payload.startStr;
|
||||
let endDateInput = document.getElementById("chill_calendarbundle_calendar_endDate");
|
||||
let endDateInput = document.getElementById("chill_activitybundle_activity_endDate");
|
||||
endDateInput.value = payload.endStr;
|
||||
let mainUserInput = document.getElementById("chill_calendarbundle_calendar_mainUser");
|
||||
let mainUserInput = document.getElementById("chill_activitybundle_activity_mainUser");
|
||||
mainUserInput.value = payload.users.logged.id;
|
||||
commit('setEvents', payload);
|
||||
},
|
||||
updateEvent({ commit }, payload) {
|
||||
console.log('### action updateEvent', payload);
|
||||
let startDateInput = document.getElementById("chill_calendarbundle_calendar_startDate");
|
||||
let startDateInput = document.getElementById("chill_activitybundle_activity_startDate");
|
||||
startDateInput.value = payload.event.start.toISOString();
|
||||
let endDateInput = document.getElementById("chill_calendarbundle_calendar_endDate");
|
||||
let endDateInput = document.getElementById("chill_activitybundle_activity_endDate");
|
||||
endDateInput.value = payload.event.end.toISOString();
|
||||
let calendarRangeInput = document.getElementById("chill_calendarbundle_calendar_calendarRange");
|
||||
let calendarRangeInput = document.getElementById("chill_activitybundle_activity_calendarRange");
|
||||
calendarRangeInput.value = Number(payload.event.extendedProps.calendarRangeId);
|
||||
let mainUserInput = document.getElementById("chill_calendarbundle_calendar_mainUser");
|
||||
let mainUserInput = document.getElementById("chill_activitybundle_activity_mainUser");
|
||||
mainUserInput.value = Number(payload.event.source.id);
|
||||
commit('setEvents', payload);
|
||||
},
|
||||
@ -192,7 +200,7 @@ const store = createStore({
|
||||
// Location
|
||||
updateLocation({ commit }, value) {
|
||||
console.log('### action: updateLocation', value);
|
||||
let hiddenLocation = document.getElementById("chill_calendarbundle_calendar_location");
|
||||
let hiddenLocation = document.getElementById("chill_activitybundle_activity_location");
|
||||
if (value.onthefly) {
|
||||
const body = {
|
||||
"type": "location",
|
||||
|
Loading…
x
Reference in New Issue
Block a user