mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-28 01:25:00 +00:00
Apply prettier rules
This commit is contained in:
@@ -1,129 +1,117 @@
|
||||
<template>
|
||||
<div class="alert alert-light">
|
||||
{{ $t('my_notifications.description') }}
|
||||
</div>
|
||||
<span
|
||||
v-if="noResults"
|
||||
class="chill-no-data-statement"
|
||||
>{{ $t('no_data') }}</span>
|
||||
<tab-table v-else>
|
||||
<template #thead>
|
||||
<th scope="col">
|
||||
{{ $t('Date') }}
|
||||
</th>
|
||||
<th scope="col">
|
||||
{{ $t('Subject') }}
|
||||
</th>
|
||||
<th scope="col">
|
||||
{{ $t('From') }}
|
||||
</th>
|
||||
<th scope="col" />
|
||||
</template>
|
||||
<template #tbody>
|
||||
<tr
|
||||
v-for="(n, i) in notifications.results"
|
||||
:key="`notify-${i}`"
|
||||
>
|
||||
<td>{{ $d(n.date.datetime, 'long') }}</td>
|
||||
<td>
|
||||
<span class="unread">
|
||||
<i class="fa fa-envelope-o" />
|
||||
<a :href="getNotificationUrl(n)">{{ n.title }}</a>
|
||||
</span>
|
||||
</td>
|
||||
<td v-if="n.sender != null">
|
||||
{{ n.sender.text }}
|
||||
</td>
|
||||
<td v-else>
|
||||
{{ $t('automatic_notification') }}
|
||||
</td>
|
||||
<td>
|
||||
<a
|
||||
class="btn btn-sm btn-show"
|
||||
:href="getEntityUrl(n)"
|
||||
>
|
||||
{{ $t('show_entity', { entity: getEntityName(n) }) }}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tab-table>
|
||||
<div class="alert alert-light">
|
||||
{{ $t("my_notifications.description") }}
|
||||
</div>
|
||||
<span v-if="noResults" class="chill-no-data-statement">{{
|
||||
$t("no_data")
|
||||
}}</span>
|
||||
<tab-table v-else>
|
||||
<template #thead>
|
||||
<th scope="col">
|
||||
{{ $t("Date") }}
|
||||
</th>
|
||||
<th scope="col">
|
||||
{{ $t("Subject") }}
|
||||
</th>
|
||||
<th scope="col">
|
||||
{{ $t("From") }}
|
||||
</th>
|
||||
<th scope="col" />
|
||||
</template>
|
||||
<template #tbody>
|
||||
<tr v-for="(n, i) in notifications.results" :key="`notify-${i}`">
|
||||
<td>{{ $d(n.date.datetime, "long") }}</td>
|
||||
<td>
|
||||
<span class="unread">
|
||||
<i class="fa fa-envelope-o" />
|
||||
<a :href="getNotificationUrl(n)">{{ n.title }}</a>
|
||||
</span>
|
||||
</td>
|
||||
<td v-if="n.sender != null">
|
||||
{{ n.sender.text }}
|
||||
</td>
|
||||
<td v-else>
|
||||
{{ $t("automatic_notification") }}
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn-sm btn-show" :href="getEntityUrl(n)">
|
||||
{{ $t("show_entity", { entity: getEntityName(n) }) }}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tab-table>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState, mapGetters } from "vuex";
|
||||
import TabTable from "./TabTable";
|
||||
import { appMessages } from 'ChillMainAssets/vuejs/HomepageWidget/js/i18n';
|
||||
|
||||
import { appMessages } from "ChillMainAssets/vuejs/HomepageWidget/js/i18n";
|
||||
|
||||
export default {
|
||||
name: "MyNotifications",
|
||||
components: {
|
||||
TabTable
|
||||
},
|
||||
computed: {
|
||||
...mapState([
|
||||
'notifications',
|
||||
]),
|
||||
...mapGetters([
|
||||
'isNotificationsLoaded',
|
||||
]),
|
||||
noResults() {
|
||||
if (!this.isNotificationsLoaded) {
|
||||
return false;
|
||||
} else {
|
||||
return this.notifications.count === 0;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getNotificationUrl(n) {
|
||||
return `/fr/notification/${n.id}/show`
|
||||
},
|
||||
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;
|
||||
case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork':
|
||||
return appMessages.fr.the_action;
|
||||
case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument':
|
||||
return appMessages.fr.the_evaluation_document;
|
||||
case 'Chill\\MainBundle\\Entity\\Workflow\\EntityWorkflow':
|
||||
return appMessages.fr.the_workflow;
|
||||
default:
|
||||
throw 'notification type unknown';
|
||||
}
|
||||
},
|
||||
getEntityUrl(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}`
|
||||
case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork':
|
||||
return `/fr/person/accompanying-period/work/${n.relatedEntityId}/show`
|
||||
case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument':
|
||||
return `/fr/person/accompanying-period/work/evaluation/document/${n.relatedEntityId}/show`
|
||||
case 'Chill\\MainBundle\\Entity\\Workflow\\EntityWorkflow':
|
||||
return `/fr/main/workflow/${n.relatedEntityId}/show`
|
||||
default:
|
||||
throw 'notification type unknown';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
name: "MyNotifications",
|
||||
components: {
|
||||
TabTable,
|
||||
},
|
||||
computed: {
|
||||
...mapState(["notifications"]),
|
||||
...mapGetters(["isNotificationsLoaded"]),
|
||||
noResults() {
|
||||
if (!this.isNotificationsLoaded) {
|
||||
return false;
|
||||
} else {
|
||||
return this.notifications.count === 0;
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
getNotificationUrl(n) {
|
||||
return `/fr/notification/${n.id}/show`;
|
||||
},
|
||||
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;
|
||||
case "Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork":
|
||||
return appMessages.fr.the_action;
|
||||
case "Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument":
|
||||
return appMessages.fr.the_evaluation_document;
|
||||
case "Chill\\MainBundle\\Entity\\Workflow\\EntityWorkflow":
|
||||
return appMessages.fr.the_workflow;
|
||||
default:
|
||||
throw "notification type unknown";
|
||||
}
|
||||
},
|
||||
getEntityUrl(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}`;
|
||||
case "Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork":
|
||||
return `/fr/person/accompanying-period/work/${n.relatedEntityId}/show`;
|
||||
case "Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument":
|
||||
return `/fr/person/accompanying-period/work/evaluation/document/${n.relatedEntityId}/show`;
|
||||
case "Chill\\MainBundle\\Entity\\Workflow\\EntityWorkflow":
|
||||
return `/fr/main/workflow/${n.relatedEntityId}/show`;
|
||||
default:
|
||||
throw "notification type unknown";
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
span.unread {
|
||||
font-weight: bold;
|
||||
i {
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
a {
|
||||
text-decoration: unset;
|
||||
}
|
||||
font-weight: bold;
|
||||
i {
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
a {
|
||||
text-decoration: unset;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user