mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-28 01:25:00 +00:00
Misc: homepage widget with tickets, and improvements in ticket list
This commit is contained in:
@@ -1,26 +1,26 @@
|
||||
<template>
|
||||
<div class="alert alert-light">
|
||||
{{ $t("my_notifications.description") }}
|
||||
{{ trans(MY_NOTIFICATIONS_DESCRIPTION) }}
|
||||
</div>
|
||||
<span v-if="noResults" class="chill-no-data-statement">{{
|
||||
$t("no_data")
|
||||
}}</span>
|
||||
<span v-if="noResults" class="chill-no-data-statement">
|
||||
{{ trans(NO_DATA) }}
|
||||
</span>
|
||||
<tab-table v-else>
|
||||
<template #thead>
|
||||
<th scope="col">
|
||||
{{ $t("Date") }}
|
||||
{{ trans(DATE) }}
|
||||
</th>
|
||||
<th scope="col">
|
||||
{{ $t("Subject") }}
|
||||
{{ trans(SUBJECT) }}
|
||||
</th>
|
||||
<th scope="col">
|
||||
{{ $t("From") }}
|
||||
{{ trans(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>{{ $d(new Date(n.date.datetime), "long") }}</td>
|
||||
<td>
|
||||
<span class="unread">
|
||||
<i class="fa fa-envelope-o" />
|
||||
@@ -31,11 +31,11 @@
|
||||
{{ n.sender.text }}
|
||||
</td>
|
||||
<td v-else>
|
||||
{{ $t("automatic_notification") }}
|
||||
{{ trans(AUTOMATIC_NOTIFICATION) }}
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn-sm btn-show" :href="getEntityUrl(n)">
|
||||
{{ $t("show_entity", { entity: getEntityName(n) }) }}
|
||||
{{ trans(SHOW_ENTITY, { entity: getEntityName(n) }) }}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -43,65 +43,82 @@
|
||||
</tab-table>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState, mapGetters } from "vuex";
|
||||
import TabTable from "./TabTable";
|
||||
import { appMessages } from "ChillMainAssets/vuejs/HomepageWidget/js/i18n";
|
||||
<script lang="ts" setup>
|
||||
import { computed, ComputedRef } from "vue";
|
||||
import { useStore } from "vuex";
|
||||
import TabTable from "./TabTable.vue";
|
||||
import { Notification } from "ChillPersonAssets/types";
|
||||
|
||||
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";
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
import {
|
||||
MY_NOTIFICATIONS_DESCRIPTION,
|
||||
DATE,
|
||||
FROM,
|
||||
SUBJECT,
|
||||
SHOW_ENTITY,
|
||||
THE_ACTIVITY,
|
||||
THE_COURSE,
|
||||
THE_ACTION,
|
||||
THE_EVALUATION_DOCUMENT,
|
||||
THE_WORKFLOW,
|
||||
NO_DATA,
|
||||
AUTOMATIC_NOTIFICATION,
|
||||
trans,
|
||||
} from "translator";
|
||||
import { PaginationResponse } from "ChillMainAssets/lib/api/apiMethods";
|
||||
const store = useStore();
|
||||
|
||||
const notifications: ComputedRef<PaginationResponse<Notification>> = computed(
|
||||
() => store.state.homepage.notifications,
|
||||
);
|
||||
const isNotificationsLoaded = computed(
|
||||
() => store.getters.isNotificationsLoaded,
|
||||
);
|
||||
|
||||
const noResults = computed(() => {
|
||||
if (!isNotificationsLoaded.value) {
|
||||
return false;
|
||||
} else {
|
||||
return notifications.value.count === 0;
|
||||
}
|
||||
});
|
||||
|
||||
function getNotificationUrl(n: Notification): string {
|
||||
return `/fr/notification/${n.id}/show`;
|
||||
}
|
||||
|
||||
function getEntityName(n: Notification): string {
|
||||
switch (n.relatedEntityClass) {
|
||||
case "Chill\\ActivityBundle\\Entity\\Activity":
|
||||
return trans(THE_ACTIVITY);
|
||||
case "Chill\\PersonBundle\\Entity\\AccompanyingPeriod":
|
||||
return trans(THE_COURSE);
|
||||
case "Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork":
|
||||
return trans(THE_ACTION);
|
||||
case "Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument":
|
||||
return trans(THE_EVALUATION_DOCUMENT);
|
||||
case "Chill\\MainBundle\\Entity\\Workflow\\EntityWorkflow":
|
||||
return trans(THE_WORKFLOW);
|
||||
default:
|
||||
throw "notification type unknown";
|
||||
}
|
||||
}
|
||||
|
||||
function getEntityUrl(n: Notification): string {
|
||||
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>
|
||||
|
Reference in New Issue
Block a user