mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
homepage_widget: improve notifications rows
This commit is contained in:
parent
41a6366efe
commit
39a7cecd24
@ -5,22 +5,24 @@
|
|||||||
<template v-slot:thead>
|
<template v-slot:thead>
|
||||||
<th scope="col">#</th>
|
<th scope="col">#</th>
|
||||||
<th scope="col">{{ $t('Date') }}</th>
|
<th scope="col">{{ $t('Date') }}</th>
|
||||||
|
<th scope="col">{{ $t('From') }}</th>
|
||||||
<th scope="col">{{ $t('Subject') }}</th>
|
<th scope="col">{{ $t('Subject') }}</th>
|
||||||
<th scope="col">{{ $t('Entity') }}</th>
|
<th scope="col"></th>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:tbody>
|
<template v-slot:tbody>
|
||||||
<tr v-for="(n, i) in notifications.results" :key="`notify-${i}`">
|
<tr v-for="(n, i) in notifications.results" :key="`notify-${i}`">
|
||||||
<th scope="row">{{ i+1 }}</th>
|
<th scope="row">{{ i+1 }}</th>
|
||||||
<td>{{ $d(n.date.datetime, 'short') }}</td>
|
<td>{{ $d(n.date.datetime, 'long') }}</td>
|
||||||
|
<td>{{ n.sender.text }}</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="unread">
|
<span class="unread">
|
||||||
<i class="fa fa-envelope-o"></i>
|
<i class="fa fa-envelope-o"></i>
|
||||||
{{ n.title }}
|
<a :href="getNotificationUrl(n)">{{ n.title }}</a>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a class="btn btn-sm btn-show"
|
<a class="btn btn-sm btn-show"
|
||||||
:href="linkEntity(n)">
|
:href="getEntityUrl(n)">
|
||||||
{{ $t('show_entity', { entity: getEntityName(n) }) }}
|
{{ $t('show_entity', { entity: getEntityName(n) }) }}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
@ -56,6 +58,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getNotificationUrl(n) {
|
||||||
|
return `/fr/notification/${n.id}/show`
|
||||||
|
},
|
||||||
getEntityName(n) {
|
getEntityName(n) {
|
||||||
switch (n.relatedEntityClass) {
|
switch (n.relatedEntityClass) {
|
||||||
case 'Chill\\ActivityBundle\\Entity\\Activity':
|
case 'Chill\\ActivityBundle\\Entity\\Activity':
|
||||||
@ -66,7 +71,7 @@ export default {
|
|||||||
throw 'notification type unknown';
|
throw 'notification type unknown';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
linkEntity(n) {
|
getEntityUrl(n) {
|
||||||
switch (n.relatedEntityClass) {
|
switch (n.relatedEntityClass) {
|
||||||
case 'Chill\\ActivityBundle\\Entity\\Activity':
|
case 'Chill\\ActivityBundle\\Entity\\Activity':
|
||||||
return `/fr/activity/${n.relatedEntityId}/show`
|
return `/fr/activity/${n.relatedEntityId}/show`
|
||||||
@ -86,5 +91,8 @@ span.unread {
|
|||||||
i {
|
i {
|
||||||
margin-right: 0.5em;
|
margin-right: 0.5em;
|
||||||
}
|
}
|
||||||
|
a {
|
||||||
|
text-decoration: unset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -22,10 +22,14 @@
|
|||||||
</h4>
|
</h4>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a class="btn btn-sm btn-update"
|
<div class="btn-group" role="group" aria-label="Actions">
|
||||||
:href="linkEntity(w)">
|
<a class="btn btn-sm btn-update" :href="getUrl(w)">
|
||||||
{{ $t('show_entity', { entity: getEntityName(w) }) }}
|
{{ $t('show_entity', { entity: $t('the_action') }) }}
|
||||||
</a>
|
</a>
|
||||||
|
<a class="btn btn-sm btn-show" :href="getUrl(w.accompanyingPeriod)">
|
||||||
|
{{ $t('show_entity', { entity: $t('the_course') }) }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</template>
|
</template>
|
||||||
@ -36,7 +40,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapState, mapGetters } from "vuex";
|
import { mapState, mapGetters } from "vuex";
|
||||||
import TabTable from "./TabTable";
|
import TabTable from "./TabTable";
|
||||||
import { appMessages } from 'ChillMainAssets/vuejs/HomepageWidget/js/i18n';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MyWorks",
|
name: "MyWorks",
|
||||||
@ -59,20 +62,14 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getEntityName(w) {
|
getUrl(e) {
|
||||||
switch (w.type) {
|
switch (e.type) {
|
||||||
case 'accompanying_period_work':
|
case 'accompanying_period_work':
|
||||||
return appMessages.fr.the_action;
|
return `/fr/person/accompanying-period/work/${e.id}/edit`
|
||||||
|
case 'accompanying_period':
|
||||||
|
return `/fr/parcours/${e.id}`
|
||||||
default:
|
default:
|
||||||
throw 'work type unknown';
|
throw 'entity type unknown';
|
||||||
}
|
|
||||||
},
|
|
||||||
linkEntity(w) {
|
|
||||||
switch (w.type) {
|
|
||||||
case 'accompanying_period_work':
|
|
||||||
return `/fr/person/accompanying-period/work/${w.id}/edit`
|
|
||||||
default:
|
|
||||||
throw 'work type unknown';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -23,6 +23,7 @@ const appMessages = {
|
|||||||
description: "Liste des notifications reçues et non lues.",
|
description: "Liste des notifications reçues et non lues.",
|
||||||
},
|
},
|
||||||
Date: "Date",
|
Date: "Date",
|
||||||
|
From: "De",
|
||||||
Subject: "Objet",
|
Subject: "Objet",
|
||||||
Entity: "Associé à",
|
Entity: "Associé à",
|
||||||
show_entity: "Voir {entity}",
|
show_entity: "Voir {entity}",
|
||||||
|
@ -51,6 +51,7 @@ class NotificationNormalizer implements NormalizerAwareInterface, NormalizerInte
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'type' => 'notification',
|
'type' => 'notification',
|
||||||
|
'id' => $object->getId(),
|
||||||
'addressees' => $this->normalizer->normalize($object->getAddressees(), $format, $context),
|
'addressees' => $this->normalizer->normalize($object->getAddressees(), $format, $context),
|
||||||
'date' => $this->normalizer->normalize($object->getDate(), $format, $context),
|
'date' => $this->normalizer->normalize($object->getDate(), $format, $context),
|
||||||
'isRead' => $object->isReadBy($this->security->getUser()),
|
'isRead' => $object->isReadBy($this->security->getUser()),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user