display table with notifications datas, prepare others tabs to render datas

This commit is contained in:
Mathieu Jaumotte 2022-01-25 20:08:39 +01:00
parent 2144b247b3
commit fc1ed8b71e
8 changed files with 175 additions and 18 deletions

View File

@ -12,7 +12,7 @@
<a class="nav-link" <a class="nav-link"
:class="{'active': activeTab === 'MyWorks'}" :class="{'active': activeTab === 'MyWorks'}"
@click="selectTab('MyWorks')"> @click="selectTab('MyWorks')">
{{ $t('my_works') }} {{ $t('my_works.tab') }}
<!-- <span class="badge rounded-pill bg-danger counter">2</span> --> <!-- <span class="badge rounded-pill bg-danger counter">2</span> -->
</a> </a>
</li> </li>
@ -20,28 +20,28 @@
<a class="nav-link" <a class="nav-link"
:class="{'active': activeTab === 'MyEvaluations'}" :class="{'active': activeTab === 'MyEvaluations'}"
@click="selectTab('MyEvaluations')"> @click="selectTab('MyEvaluations')">
{{ $t('my_evaluations') }} {{ $t('my_evaluations.tab') }}
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" <a class="nav-link"
:class="{'active': activeTab === 'MyTasks'}" :class="{'active': activeTab === 'MyTasks'}"
@click="selectTab('MyTasks')"> @click="selectTab('MyTasks')">
{{ $t('my_task') }} {{ $t('my_tasks.tab') }}
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" <a class="nav-link"
:class="{'active': activeTab === 'MyAccompanyingCourses'}" :class="{'active': activeTab === 'MyAccompanyingCourses'}"
@click="selectTab('MyAccompanyingCourses')"> @click="selectTab('MyAccompanyingCourses')">
{{ $t('my_accompanying_courses') }} {{ $t('my_accompanying_courses.tab') }}
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" <a class="nav-link"
:class="{'active': activeTab === 'MyNotifications'}" :class="{'active': activeTab === 'MyNotifications'}"
@click="selectTab('MyNotifications')"> @click="selectTab('MyNotifications')">
{{ $t('my_notifications') }} {{ $t('my_notifications.tab') }}
</a> </a>
</li> </li>
<li class="nav-item loading ms-auto py-2" v-if="loading"> <li class="nav-item loading ms-auto py-2" v-if="loading">
@ -106,8 +106,8 @@ export default {
}, },
methods: { methods: {
selectTab(tab) { selectTab(tab) {
this.activeTab = tab;
this.$store.dispatch('getByTab', tab); this.$store.dispatch('getByTab', tab);
this.activeTab = tab;
} }
} }
} }

View File

@ -1,12 +1,23 @@
<template> <template>
MyAccompanyingCourses <h3>{{ $t('my_accompanying_courses.title') }}</h3>
<tab-table>
<template v-slot:thead>
</template>
<template v-slot:tbody>
<tr></tr>
</template>
</tab-table>
</template> </template>
<script> <script>
import { mapState, mapGetters } from "vuex"; import { mapState, mapGetters } from "vuex";
import TabTable from "./TabTable";
export default { export default {
name: "MyAccompanyingCourses", name: "MyAccompanyingCourses",
components: {
TabTable
},
computed: { computed: {
...mapState([ ...mapState([
'accompanyingCourses', 'accompanyingCourses',

View File

@ -1,12 +1,23 @@
<template> <template>
MyEvaluations <h3>{{ $t('my_evaluations.title') }}</h3>
<tab-table>
<template v-slot:thead>
</template>
<template v-slot:tbody>
<tr></tr>
</template>
</tab-table>
</template> </template>
<script> <script>
import { mapState, mapGetters } from "vuex"; import { mapState, mapGetters } from "vuex";
import TabTable from "./TabTable";
export default { export default {
name: "MyEvaluations", name: "MyEvaluations",
components: {
TabTable
},
computed: { computed: {
...mapState([ ...mapState([
'evaluations', 'evaluations',

View File

@ -1,12 +1,44 @@
<template> <template>
MyNotifications <h3>{{ $t('my_notifications.title') }}</h3>
<tab-table>
<template v-slot:thead>
<th scope="col">#</th>
<th scope="col">{{ $t('Date') }}</th>
<th scope="col">{{ $t('Subject') }}</th>
<th scope="col">{{ $t('Entity') }}</th>
</template>
<template v-slot:tbody>
<tr v-for="(n, i) in notifications.results" :key="`notify-${i}`">
<th scope="row">{{ i+1 }}</th>
<td>{{ $d(n.date.datetime, 'short') }}</td>
<td>
<span class="unread">
<i class="fa fa-envelope-o"></i>
{{ n.title }}
</span>
</td>
<td>
<a class="btn btn-sm btn-show"
:href="linkEntity(n)">
{{ $t('show_entity', { entity: getEntityName(n) }) }}
</a>
</td>
</tr>
</template>
</tab-table>
</template> </template>
<script> <script>
import { mapState, mapGetters } from "vuex"; import { mapState, mapGetters } from "vuex";
import TabTable from "./TabTable";
import { appMessages } from 'ChillMainAssets/vuejs/HomepageWidget/js/i18n';
export default { export default {
name: "MyNotifications", name: "MyNotifications",
components: {
TabTable
},
computed: { computed: {
...mapState([ ...mapState([
'notifications', 'notifications',
@ -15,9 +47,36 @@ export default {
'isNotificationsLoaded', 'isNotificationsLoaded',
]) ])
}, },
methods: {
getEntityName(n) {
switch (n.relatedEntityClass) {
case 'Chill\\ActivityBundle\\Entity\\Activity':
return appMessages.fr.the_activity;
case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod':
return appMessages.fr.the_course;
default:
throw 'notification type unknown';
}
},
linkEntity(n) {
switch (n.relatedEntityClass) {
case 'Chill\\ActivityBundle\\Entity\\Activity':
return `/fr/activity/${n.relatedEntityId}/show`
case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod':
return `/fr/parcours/${n.relatedEntityId}`
default:
throw 'notification type unknown';
}
}
}
} }
</script> </script>
<style scoped> <style lang="scss" scoped>
span.unread {
font-weight: bold;
i {
margin-right: 0.5em;
}
}
</style> </style>

View File

@ -1,12 +1,34 @@
<template> <template>
MyTasks <h3>{{ $t('my_tasks.title_warning') }}</h3>
<tab-table>
<template v-slot:thead>
</template>
<template v-slot:tbody>
<tr></tr>
</template>
</tab-table>
<h3>{{ $t('my_tasks.title_alert') }}</h3>
<tab-table>
<template v-slot:thead>
</template>
<template v-slot:tbody>
<tr></tr>
</template>
</tab-table>
</template> </template>
<script> <script>
import { mapState, mapGetters } from "vuex"; import { mapState, mapGetters } from "vuex";
import TabTable from "./TabTable";
export default { export default {
name: "MyTasks", name: "MyTasks",
components: {
TabTable
},
computed: { computed: {
...mapState([ ...mapState([
'tasks', 'tasks',

View File

@ -1,12 +1,23 @@
<template> <template>
MyWorks <h3>{{ $t('my_works.title') }}</h3>
<tab-table>
<template v-slot:thead>
</template>
<template v-slot:tbody>
<tr></tr>
</template>
</tab-table>
</template> </template>
<script> <script>
import { mapState, mapGetters } from "vuex"; import { mapState, mapGetters } from "vuex";
import TabTable from "./TabTable";
export default { export default {
name: "MyWorks", name: "MyWorks",
components: {
TabTable
},
computed: { computed: {
...mapState([ ...mapState([
'works', 'works',

View File

@ -0,0 +1,21 @@
<template>
<table class="table table-striped table-hover">
<thead>
<tr>
<slot name="thead"></slot>
</tr>
</thead>
<tbody>
<slot name="tbody"></slot>
</tbody>
</table>
</template>
<script>
export default {
name: "TabTable",
props: []
}
</script>
<style scoped></style>

View File

@ -1,10 +1,32 @@
const appMessages = { const appMessages = {
fr: { fr: {
my_works: "Actions d'accompagnement", my_works: {
my_evaluations: "Évaluations", tab: "Actions d'accompagnement",
my_task: "Tâches", title: "Mes actions d'accompagnement qui arrivent à échéance",
my_accompanying_courses: "Parcours", },
my_notifications: "Notifications", my_evaluations: {
tab: "Évaluations",
title: "Mes évaluations qui arrivent à échéance",
},
my_tasks: {
tab: "Tâches",
title_warning: "Mes tâches avec date d'échéance dépassée",
title_alert: "Mes tâches avec date de rappel dépassée",
},
my_accompanying_courses: {
tab: "Parcours",
title: "Les parcours que l'on vient de m'attribuer",
},
my_notifications: {
tab: "Notifications",
title: "Mes notifications reçues (et non lues)",
},
Date: "Date",
Subject: "Objet",
Entity: "Associé à",
show_entity: "Voir {entity}",
the_activity: "l'échange",
the_course: "le parcours"
} }
}; };