|
@@ -17,8 +17,8 @@
|
|
|
|
|
|
|
|
<v-menu
|
|
<v-menu
|
|
|
v-if="btn !== null"
|
|
v-if="btn !== null"
|
|
|
- :activator="btn"
|
|
|
|
|
v-model="isOpen"
|
|
v-model="isOpen"
|
|
|
|
|
+ :activator="btn"
|
|
|
location="bottom left"
|
|
location="bottom left"
|
|
|
>
|
|
>
|
|
|
<v-card max-width="400">
|
|
<v-card max-width="400">
|
|
@@ -42,8 +42,8 @@
|
|
|
<v-icon
|
|
<v-icon
|
|
|
v-if="notification.link"
|
|
v-if="notification.link"
|
|
|
icon="mdi:mdi-download"
|
|
icon="mdi:mdi-download"
|
|
|
- @click="download(notification.link)"
|
|
|
|
|
class="pt-4"
|
|
class="pt-4"
|
|
|
|
|
+ @click="download(notification.link)"
|
|
|
/>
|
|
/>
|
|
|
</template>
|
|
</template>
|
|
|
</v-list-item>
|
|
</v-list-item>
|
|
@@ -72,10 +72,9 @@
|
|
|
class="theme-primary"
|
|
class="theme-primary"
|
|
|
style="width: 100%; height: 52px"
|
|
style="width: 100%; height: 52px"
|
|
|
>
|
|
>
|
|
|
- <v-list-item-title
|
|
|
|
|
- class="text-body-2"
|
|
|
|
|
- v-text="$t('all_notification')"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <v-list-item-title class="text-body-2">
|
|
|
|
|
+ <span v-text="$t('all_notification')" />
|
|
|
|
|
+ </v-list-item-title>
|
|
|
</v-list-item>
|
|
</v-list-item>
|
|
|
</v-card-actions>
|
|
</v-card-actions>
|
|
|
</v-card>
|
|
</v-card>
|
|
@@ -83,23 +82,22 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
|
|
+import { computed, ref } from 'vue'
|
|
|
|
|
+import type { ComputedRef, Ref } from 'vue'
|
|
|
|
|
+import { useRepo } from 'pinia-orm'
|
|
|
import { NOTIFICATION_TYPE } from '~/types/enum/enums'
|
|
import { NOTIFICATION_TYPE } from '~/types/enum/enums'
|
|
|
import Notification from '~/models/Core/Notification'
|
|
import Notification from '~/models/Core/Notification'
|
|
|
import NotificationUsers from '~/models/Core/NotificationUsers'
|
|
import NotificationUsers from '~/models/Core/NotificationUsers'
|
|
|
import { useAccessProfileStore } from '~/stores/accessProfile'
|
|
import { useAccessProfileStore } from '~/stores/accessProfile'
|
|
|
-import { computed, ref } from '@vue/reactivity'
|
|
|
|
|
-import type { ComputedRef, Ref } from '@vue/reactivity'
|
|
|
|
|
import { useEntityFetch } from '~/composables/data/useEntityFetch'
|
|
import { useEntityFetch } from '~/composables/data/useEntityFetch'
|
|
|
import type { AnyJson, Pagination } from '~/types/data'
|
|
import type { AnyJson, Pagination } from '~/types/data'
|
|
|
import { useEntityManager } from '~/composables/data/useEntityManager'
|
|
import { useEntityManager } from '~/composables/data/useEntityManager'
|
|
|
import UrlUtils from '~/services/utils/urlUtils'
|
|
import UrlUtils from '~/services/utils/urlUtils'
|
|
|
-import { useRepo } from 'pinia-orm'
|
|
|
|
|
import NotificationRepository from '~/stores/repositories/NotificationRepository'
|
|
import NotificationRepository from '~/stores/repositories/NotificationRepository'
|
|
|
|
|
|
|
|
const accessProfileStore = useAccessProfileStore()
|
|
const accessProfileStore = useAccessProfileStore()
|
|
|
|
|
|
|
|
-const loading: Ref<Boolean> = ref(true)
|
|
|
|
|
-const isOpen: Ref<Boolean> = ref(false)
|
|
|
|
|
|
|
+const isOpen: Ref<boolean> = ref(false)
|
|
|
const page: Ref<number> = ref(1)
|
|
const page: Ref<number> = ref(1)
|
|
|
|
|
|
|
|
const i18n = useI18n()
|
|
const i18n = useI18n()
|
|
@@ -115,7 +113,7 @@ const query: ComputedRef<AnyJson> = computed(() => {
|
|
|
return { page: page.value }
|
|
return { page: page.value }
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-let {
|
|
|
|
|
|
|
+const {
|
|
|
data: collection,
|
|
data: collection,
|
|
|
pending,
|
|
pending,
|
|
|
refresh,
|
|
refresh,
|
|
@@ -146,7 +144,7 @@ const pagination: ComputedRef<Pagination> = computed(() => {
|
|
|
|
|
|
|
|
const notificationUrl = UrlUtils.join(
|
|
const notificationUrl = UrlUtils.join(
|
|
|
runtimeConfig.baseUrlAdminLegacy,
|
|
runtimeConfig.baseUrlAdminLegacy,
|
|
|
- '#/notifications/list/',
|
|
|
|
|
|
|
+ '#/notifications/list/'
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -188,15 +186,14 @@ const getMessage = (notification: Notification) => {
|
|
|
switch (notification.type) {
|
|
switch (notification.type) {
|
|
|
case NOTIFICATION_TYPE.FILE:
|
|
case NOTIFICATION_TYPE.FILE:
|
|
|
return `${i18n.t('your_file')} ${notification.message?.fileName} ${i18n.t(
|
|
return `${i18n.t('your_file')} ${notification.message?.fileName} ${i18n.t(
|
|
|
- 'is_ready_to_be_downloaded',
|
|
|
|
|
|
|
+ 'is_ready_to_be_downloaded'
|
|
|
)}`
|
|
)}`
|
|
|
|
|
|
|
|
case NOTIFICATION_TYPE.MESSAGE:
|
|
case NOTIFICATION_TYPE.MESSAGE:
|
|
|
if (notification.message?.action)
|
|
if (notification.message?.action)
|
|
|
- return `${i18n.t('your_message')} ${notification.message
|
|
|
|
|
- ?.fileName} ${i18n.t('is_ready_to_be')} ${
|
|
|
|
|
- notification.message.action
|
|
|
|
|
- }`
|
|
|
|
|
|
|
+ return `${i18n.t('your_message')} ${
|
|
|
|
|
+ notification.message?.fileName
|
|
|
|
|
+ } ${i18n.t('is_ready_to_be')} ${notification.message.action}`
|
|
|
|
|
|
|
|
return `${i18n.t('your_message')} ${
|
|
return `${i18n.t('your_message')} ${
|
|
|
notification.message?.about ?? ''
|
|
notification.message?.about ?? ''
|
|
@@ -215,7 +212,7 @@ const getMessage = (notification: Notification) => {
|
|
|
/**
|
|
/**
|
|
|
* Dès la fermeture du menu, on indique que les notifications non lues, le sont.
|
|
* Dès la fermeture du menu, on indique que les notifications non lues, le sont.
|
|
|
*/
|
|
*/
|
|
|
-const unwatch = watch(isOpen, (newValue, oldValue) => {
|
|
|
|
|
|
|
+const unwatch = watch(isOpen, (newValue, _) => {
|
|
|
if (!newValue) {
|
|
if (!newValue) {
|
|
|
markNotificationsAsRead()
|
|
markNotificationsAsRead()
|
|
|
}
|
|
}
|
|
@@ -247,7 +244,7 @@ const markNotificationAsRead = (notification: Notification) => {
|
|
|
*/
|
|
*/
|
|
|
const markNotificationsAsRead = () => {
|
|
const markNotificationsAsRead = () => {
|
|
|
unreadNotification.value.map((notification: Notification) => {
|
|
unreadNotification.value.map((notification: Notification) => {
|
|
|
- markNotificationAsRead(notification)
|
|
|
|
|
|
|
+ return markNotificationAsRead(notification)
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -270,7 +267,7 @@ const download = (link: string) => {
|
|
|
'api',
|
|
'api',
|
|
|
String(accessProfileStore.id),
|
|
String(accessProfileStore.id),
|
|
|
String(accessProfileStore.switchId || ''),
|
|
String(accessProfileStore.switchId || ''),
|
|
|
- path,
|
|
|
|
|
|
|
+ path
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
window.open(url)
|
|
window.open(url)
|