8/7/405
This commit is contained in:
@@ -7,7 +7,7 @@ import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||
import BaseModal from '@/components/ui/BaseModal.vue'
|
||||
import { useSmsWalletSummary } from '@/composables/useSmsWalletSummary'
|
||||
import { useToast } from '@/composables/useToast'
|
||||
import { dashboardApi, notificationsApi } from '@/services/api'
|
||||
import { dashboardApi, internalMessagesApi, notificationsApi } from '@/services/api'
|
||||
import { formatDateTime, formatNumber, toPersianDigits } from '@/utils/format'
|
||||
import { resolveAdminInboxLink } from '@/utils/inboxLinks'
|
||||
import { formatCardNumber, formatSheba } from '@/utils/smsFormat'
|
||||
@@ -78,7 +78,11 @@ function closePanel() {
|
||||
}
|
||||
|
||||
function markMessageRead(message: InternalMessage) {
|
||||
if (message.isRead) return
|
||||
message.isRead = true
|
||||
void internalMessagesApi.markRead(message.id).catch(() => {
|
||||
message.isRead = false
|
||||
})
|
||||
}
|
||||
|
||||
function markNotificationRead(notification: AdminNotification) {
|
||||
@@ -90,9 +94,16 @@ function markNotificationRead(notification: AdminNotification) {
|
||||
}
|
||||
|
||||
function markAllMessagesRead() {
|
||||
messageList.value.forEach((m) => {
|
||||
const unread = messageList.value.filter((m) => !m.isRead)
|
||||
if (!unread.length) return
|
||||
unread.forEach((m) => {
|
||||
m.isRead = true
|
||||
})
|
||||
void internalMessagesApi.markAllRead().catch(() => {
|
||||
unread.forEach((m) => {
|
||||
m.isRead = false
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function markAllNotificationsRead() {
|
||||
@@ -118,7 +129,7 @@ function openMessage(message: InternalMessage) {
|
||||
markMessageRead(message)
|
||||
navigateInboxTarget(
|
||||
resolveAdminInboxLink({
|
||||
link: message.link,
|
||||
link: message.link || undefined,
|
||||
orderId: message.orderId,
|
||||
title: message.subject,
|
||||
body: message.preview,
|
||||
|
||||
Reference in New Issue
Block a user