mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
homepage_widget: init counters on load, arrange MyCustoms tab
This commit is contained in:
parent
e95093f144
commit
00ac6aa1b9
@ -6,7 +6,7 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link"
|
<a class="nav-link"
|
||||||
:class="{'active': activeTab === 'MyCustoms'}"
|
:class="{'active': activeTab === 'MyCustoms'}"
|
||||||
@load="selectTab('MyCustoms')" @click="selectTab('MyCustoms')">
|
@click="selectTab('MyCustoms')">
|
||||||
<i class="fa fa-home"></i>
|
<i class="fa fa-home"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@ -115,9 +115,20 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
selectTab(tab) {
|
selectTab(tab) {
|
||||||
this.$store.dispatch('getByTab', tab);
|
this.$store.dispatch('getByTab', { tab: tab });
|
||||||
this.activeTab = tab;
|
this.activeTab = tab;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
for (const m of [
|
||||||
|
'MyNotifications',
|
||||||
|
'MyAccompanyingCourses',
|
||||||
|
'MyWorks',
|
||||||
|
'MyEvaluations',
|
||||||
|
'MyTasks',
|
||||||
|
]) {
|
||||||
|
this.$store.dispatch('getByTab', { tab: m, param: "countOnly=1" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,32 +1,76 @@
|
|||||||
<template>
|
<template>
|
||||||
<span v-if="noResults" class="chill-no-data-statement">{{ $t('no_dashboard') }}</span>
|
<span v-if="noResults" class="chill-no-data-statement">{{ $t('no_dashboard') }}</span>
|
||||||
<div v-else id="dashboards" class="row g-3">
|
<div v-else id="dashboards" class="row g-3" data-masonry='{"percentPosition": true }'>
|
||||||
|
|
||||||
<div class="mbloc col col-sm-6 col-lg-4">
|
<div class="mbloc col col-sm-6 col-lg-4">
|
||||||
<div class="custom1">
|
<div class="custom1">
|
||||||
Mon bloc personnalisé
|
<ul class="list-unstyled">
|
||||||
|
<li v-if="counter.notifications > 0">
|
||||||
x notifications non lues
|
<b>{{ counter.notifications }}</b> {{ $t('counter.unread_notifications') }}
|
||||||
x tâches en rappel
|
</li>
|
||||||
x ...
|
<li v-if="counter.accompanyingCourses > 0">
|
||||||
|
<b>{{ counter.accompanyingCourses }}</b> {{ $t('counter.assignated_courses') }}
|
||||||
|
</li>
|
||||||
|
<li v-if="counter.works > 0">
|
||||||
|
<b>{{ counter.works }}</b> {{ $t('counter.assignated_actions') }}
|
||||||
|
</li>
|
||||||
|
<li v-if="counter.evaluations > 0">
|
||||||
|
<b>{{ counter.evaluations }}</b> {{ $t('counter.assignated_evaluations') }}
|
||||||
|
</li>
|
||||||
|
<li v-if="counter.tasksAlert > 0">
|
||||||
|
<b>{{ counter.tasksAlert }}</b> {{ $t('counter.alert_tasks') }}
|
||||||
|
</li>
|
||||||
|
<li v-if="counter.tasksWarning > 0">
|
||||||
|
<b>{{ counter.tasksWarning }}</b> {{ $t('counter.warning_tasks') }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<div class="mbloc col col-sm-6 col-lg-4">
|
||||||
|
<div class="custom2">
|
||||||
|
Mon dashboard personnalisé
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mbloc col col-sm-6 col-lg-4">
|
||||||
|
<div class="custom3">
|
||||||
|
Mon dashboard personnalisé
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mbloc col col-sm-6 col-lg-4">
|
||||||
|
<div class="custom4">
|
||||||
|
Mon dashboard personnalisé
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
-->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mapGetters } from "vuex";
|
||||||
|
import Masonry from 'masonry-layout/masonry';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MyCustoms",
|
name: "MyCustoms",
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapGetters(['counter']),
|
||||||
noResults() {
|
noResults() {
|
||||||
return true
|
return false
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
const elem = document.querySelector('#dashboards');
|
||||||
|
const masonry = new Masonry(elem, {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
div.custom1 {
|
div.custom4,
|
||||||
|
div.custom3,
|
||||||
|
div.custom2 {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
color: var(--bs-chill-gray);
|
color: var(--bs-chill-gray);
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,15 @@ const appMessages = {
|
|||||||
StartDate: "Date d'ouverture",
|
StartDate: "Date d'ouverture",
|
||||||
SocialAction: "Action d'accompagnement",
|
SocialAction: "Action d'accompagnement",
|
||||||
no_data: "Aucun résultats",
|
no_data: "Aucun résultats",
|
||||||
no_dashboard: "Pas de tableaux de bord"
|
no_dashboard: "Pas de tableaux de bord",
|
||||||
|
counter: {
|
||||||
|
unread_notifications: "notifications non lues",
|
||||||
|
assignated_courses: "parcours assignés",
|
||||||
|
assignated_actions: "actions assignées",
|
||||||
|
assignated_evaluations: "évaluations assignées",
|
||||||
|
alert_tasks: "tâches en rappel",
|
||||||
|
warning_tasks: "tâches à échéances",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ const debug = process.env.NODE_ENV !== 'production';
|
|||||||
|
|
||||||
const isEmpty = (obj) => {
|
const isEmpty = (obj) => {
|
||||||
return obj
|
return obj
|
||||||
&& Object.keys(obj).length === 0
|
&& Object.keys(obj).length <= 1
|
||||||
&& Object.getPrototypeOf(obj) === Object.prototype;
|
&& Object.getPrototypeOf(obj) === Object.prototype;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -49,6 +49,16 @@ const store = createStore({
|
|||||||
isNotificationsLoaded(state) {
|
isNotificationsLoaded(state) {
|
||||||
return !isEmpty(state.notifications);
|
return !isEmpty(state.notifications);
|
||||||
},
|
},
|
||||||
|
counter(state) {
|
||||||
|
return {
|
||||||
|
works: state.works.count,
|
||||||
|
evaluations: state.evaluations.count,
|
||||||
|
tasksWarning: state.tasks.warning.count,
|
||||||
|
tasksAlert: state.tasks.alert.count,
|
||||||
|
accompanyingCourses: state.accompanyingCourses.count,
|
||||||
|
notifications: state.notifications.count,
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
addWorks(state, works) {
|
addWorks(state, works) {
|
||||||
@ -83,14 +93,14 @@ const store = createStore({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
getByTab({ commit, getters }, tab) {
|
getByTab({ commit, getters }, { tab, param }) {
|
||||||
switch (tab) {
|
switch (tab) {
|
||||||
case 'MyCustoms':
|
case 'MyCustoms':
|
||||||
break;
|
break;
|
||||||
case 'MyWorks':
|
case 'MyWorks':
|
||||||
if (!getters.isWorksLoaded) {
|
if (!getters.isWorksLoaded) {
|
||||||
commit('setLoading', true);
|
commit('setLoading', true);
|
||||||
const url = `/api/1.0/person/accompanying-period/work/my-near-end`;
|
const url = `/api/1.0/person/accompanying-period/work/my-near-end${'?'+ param}`;
|
||||||
makeFetch('GET', url)
|
makeFetch('GET', url)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
commit('addWorks', response);
|
commit('addWorks', response);
|
||||||
@ -106,7 +116,7 @@ const store = createStore({
|
|||||||
case 'MyEvaluations':
|
case 'MyEvaluations':
|
||||||
if (!getters.isEvaluationsLoaded) {
|
if (!getters.isEvaluationsLoaded) {
|
||||||
commit('setLoading', true);
|
commit('setLoading', true);
|
||||||
const url = `/api/1.0/person/accompanying-period/work/evaluation/my-near-end`;
|
const url = `/api/1.0/person/accompanying-period/work/evaluation/my-near-end${'?'+ param}`;
|
||||||
makeFetch('GET', url)
|
makeFetch('GET', url)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
commit('addEvaluations', response);
|
commit('addEvaluations', response);
|
||||||
@ -123,8 +133,8 @@ const store = createStore({
|
|||||||
if (!(getters.isTasksWarningLoaded && getters.isTasksAlertLoaded)) {
|
if (!(getters.isTasksWarningLoaded && getters.isTasksAlertLoaded)) {
|
||||||
commit('setLoading', true);
|
commit('setLoading', true);
|
||||||
const
|
const
|
||||||
urlWarning = `/api/1.0/task/single-task/list/my?f[q]=&f[checkboxes][status][]=warning&f[checkboxes][states][]=new&f[checkboxes][states][]=in_progress`,
|
urlWarning = `/api/1.0/task/single-task/list/my?f[q]=&f[checkboxes][status][]=warning&f[checkboxes][states][]=new&f[checkboxes][states][]=in_progress${'&'+ param}`,
|
||||||
urlAlert = `/api/1.0/task/single-task/list/my?f[q]=&f[checkboxes][status][]=alert&f[checkboxes][states][]=new&f[checkboxes][states][]=in_progress` //&f[f]=
|
urlAlert = `/api/1.0/task/single-task/list/my?f[q]=&f[checkboxes][status][]=alert&f[checkboxes][states][]=new&f[checkboxes][states][]=in_progress${'&'+ param}`
|
||||||
;
|
;
|
||||||
makeFetch('GET', urlWarning)
|
makeFetch('GET', urlWarning)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
@ -151,7 +161,7 @@ const store = createStore({
|
|||||||
case 'MyAccompanyingCourses':
|
case 'MyAccompanyingCourses':
|
||||||
if (!getters.isAccompanyingCoursesLoaded) {
|
if (!getters.isAccompanyingCoursesLoaded) {
|
||||||
commit('setLoading', true);
|
commit('setLoading', true);
|
||||||
const url = `/api/1.0/`;
|
const url = `/api/1.0/person/accompanying-course/list/by-recent-attributions${'?'+ param}`;
|
||||||
makeFetch('GET', url)
|
makeFetch('GET', url)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
commit('addCourses', response);
|
commit('addCourses', response);
|
||||||
@ -167,7 +177,7 @@ const store = createStore({
|
|||||||
case 'MyNotifications':
|
case 'MyNotifications':
|
||||||
if (!getters.isNotificationsLoaded) {
|
if (!getters.isNotificationsLoaded) {
|
||||||
commit('setLoading', true);
|
commit('setLoading', true);
|
||||||
const url = `/api/1.0/main/notification/my/unread`;
|
const url = `/api/1.0/main/notification/my/unread${'?'+ param}`;
|
||||||
makeFetch('GET', url)
|
makeFetch('GET', url)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
commit('addNotifications', response);
|
commit('addNotifications', response);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user