mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
calendar app: fix list for showing users and their colors (not in rgith place in page)
This commit is contained in:
parent
b89edc29af
commit
dba0e84781
@ -1,5 +1,10 @@
|
||||
<template>
|
||||
<concerned-groups></concerned-groups>
|
||||
<div>
|
||||
<template v-for="uid in this.$store.state.currentView.users.keys()" :key="uid">
|
||||
<calendar-active :user="this.$store.getters.getUserDataById(uid).user" ></calendar-active>
|
||||
</template>
|
||||
</div>
|
||||
<teleport to="#fullCalendar">
|
||||
<FullCalendar ref="fullCalendar" :options="calendarOptions">
|
||||
<template v-slot:eventContent='arg'>
|
||||
@ -22,6 +27,7 @@ import FullCalendar from '@fullcalendar/vue3';
|
||||
import dayGridPlugin from '@fullcalendar/daygrid';
|
||||
import interactionPlugin from '@fullcalendar/interaction';
|
||||
import timeGridPlugin from '@fullcalendar/timegrid';
|
||||
import CalendarActive from './Components/CalendarActive';
|
||||
// import listPlugin from '@fullcalendar/list';
|
||||
|
||||
export default {
|
||||
@ -29,8 +35,8 @@ export default {
|
||||
components: {
|
||||
ConcernedGroups,
|
||||
Location,
|
||||
CalendarUserSelector,
|
||||
FullCalendar
|
||||
FullCalendar,
|
||||
CalendarActive,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -89,6 +95,11 @@ export default {
|
||||
}
|
||||
};
|
||||
},
|
||||
getActiveUsers() {
|
||||
return this.$store.state.currentView.users.keys()
|
||||
.filter(id => this.$store.getters.hasUserDataById(id))
|
||||
.map(id => this.$store.getters.getUserDataById().user);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
|
@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<span class="badge" :style="style">{{ user.text }}</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters} from 'vuex';
|
||||
|
||||
export default {
|
||||
name: "CalendarActive",
|
||||
props: ['user'],
|
||||
computed: {
|
||||
style() {
|
||||
return {
|
||||
backgroundColor: this.$store.getters.getUserData(this.user).mainColor,
|
||||
};
|
||||
},
|
||||
mainColor() {
|
||||
return 'blue';
|
||||
console.log('mainColor userId', this.userId);
|
||||
console.log(this.$store.state.usersData);
|
||||
|
||||
if (!this.$store.getters.hasUserDataById(this.userId)) {
|
||||
return 'blue';
|
||||
}
|
||||
|
||||
return this.$store.getters.getUserDataById(this.userId).mainColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -18,10 +18,11 @@ export default {
|
||||
}
|
||||
|
||||
let promises = [];
|
||||
if (null !== getters.getMainUser) {
|
||||
for (const uid of state.currentView.users.keys()) {
|
||||
console.log('fetchCalendarEventsFor', uid);
|
||||
promises.push(
|
||||
dispatch('fetchCalendarRangeForUser',
|
||||
{user: getters.getMainUser, start: state.currentView.start, end: state.currentView.end})
|
||||
{user: state.usersData.get(uid).user, start: state.currentView.start, end: state.currentView.end})
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,9 @@ export default {
|
||||
getUserData: (state) => (user) => {
|
||||
return state.usersData.get(user.id);
|
||||
},
|
||||
getUserDataById: (state) => (userId) => {
|
||||
return state.usersData.get(userId);
|
||||
},
|
||||
/**
|
||||
* return true if the user has an entry in userData
|
||||
*
|
||||
@ -86,6 +89,9 @@ export default {
|
||||
hasUserData: (state) => (user) => {
|
||||
return state.usersData.has(user.id);
|
||||
},
|
||||
hasUserDataById: (state) => (userId) => {
|
||||
return state.usersData.has(userId);
|
||||
},
|
||||
/**
|
||||
* return true if there was a fetch query for event between this date (start and end),
|
||||
* those date are included.
|
||||
|
@ -10,7 +10,11 @@ export default {
|
||||
},
|
||||
showUserOnCalendar(state, {user, what}) {
|
||||
console.log('showUserOnCalendar', {user: user.id, what});
|
||||
if (!state.usersData.has(user.id)) {
|
||||
state.usersData.set(user.id, createUserData(user, state.usersData.size));
|
||||
}
|
||||
state.currentView.users.set(user.id, what);
|
||||
console.log('state at end', state);
|
||||
},
|
||||
|
||||
// ConcernedGroups
|
||||
|
Loading…
x
Reference in New Issue
Block a user