read notification working

This commit is contained in:
isUnknown 2025-01-15 14:56:17 +01:00
parent 0b472988a2
commit 2071d9bd6d
4 changed files with 57 additions and 48 deletions

View file

@ -45,6 +45,7 @@
:is="notificationComponents[notification.type]"
:notification="notification"
:data-status="notification.isRead ? 'read' : 'unread'"
@click="router.push(getHref(notification))"
/>
</template>
</section>
@ -62,10 +63,12 @@ import { useApiStore } from "../stores/api";
import Comment from "../components/notifications/Comment.vue";
import Reply from "../components/notifications/Reply.vue";
import Content from "../components/notifications/Content.vue";
import { useRouter } from "vue-router";
dayjs.locale("fr");
const userStore = useUserStore();
const router = useRouter();
const { notifications } = storeToRefs(useUserStore());
const api = useApiStore();
const currentTab = ref("all");
@ -119,6 +122,25 @@ function readAll() {
console.log("Could not read all notifications : ", error);
}
}
// Functions
function getHref(notification) {
const uri = notification.location.page.uri;
const isDocumentBrief =
notification.location.page.template === "client-brief" &&
notification.location?.file.type === "document";
if (isDocumentBrief) {
return notification.project.uri + "?dialog=client-brief&comments=true";
}
if (notification.location.page.template === "track") {
return notification.project.uri + "?dialog=virtual-sample&comments=true";
}
return uri;
}
</script>
<style scoped>