appointment request notification working

This commit is contained in:
isUnknown 2025-01-27 14:46:50 +01:00
parent 54af78e32c
commit 85e3e7b2d4
4 changed files with 68 additions and 4 deletions

View file

@ -31,7 +31,7 @@ return [
"page" => $newProject
],
"date" => (string) $formattedDate,
"text" => nl2br(esc($data->details)),
"text" => nl2br("Objet : " . $data->subject . "\n" . esc($data->details)),
"author" => $user,
"id" => Str::uuid(),
"type" => "appointment-request",

View file

@ -0,0 +1,59 @@
<template>
<article
@click="read()"
v-if="useUserStore.role !== 'client'"
class="notification | bg-white rounded-lg | p-16 | flow"
data-type="appointment-request"
>
<header>
<p class="flex">
<strong
class="notification__type | font-medium text-primary"
data-icon="comment"
>Demande de rendez-vous</strong
>
<span class="notification__client | text-grey-700"
>{{ notification.project.title }}
{{
notification.project.status === "draft" ? "(brouillon)" : ""
}}</span
>
<time
datetime=""
class="notification__date | text-grey-700 | ml-auto"
>{{ formatDate(notification) }}</time
>
</p>
</header>
<p
v-if="notification.type"
class="notification__body | text-md font-medium | line-clamp"
v-html="
'Auteur : ' +
(notification.author.name
? notification.author.name + ' (' + notification.author.email + ')'
: notification.author.email) +
' : <br>' +
notification.text
"
></p>
</article>
</template>
<script setup>
import { useNotificationsStore } from "../../stores/notifications";
import { useUserStore } from "../../stores/user";
import { useApiStore } from "../../stores/api";
const { notification } = defineProps({ notification: Object });
const { formatDate } = useNotificationsStore();
const { user } = useUserStore();
const api = useApiStore();
async function read() {
const response = await api.readNotification(
notification.id,
notification.project.uri
);
}
</script>

View file

@ -13,7 +13,10 @@
>Demande de création de projet</strong
>
<span class="notification__client | text-grey-700"
>{{ notification.project.title }} (brouillon)</span
>{{ notification.project.title }}
{{
notification.project.status === "draft" ? "(brouillon)" : ""
}}</span
>
<time
datetime=""
@ -26,11 +29,11 @@
v-if="notification.type"
class="notification__body | text-md font-medium | line-clamp"
v-html="
'Auteur de la demande : ' +
'De la part de ' +
(notification.author.name
? notification.author.name + ' (' + notification.author.email + ')'
: notification.author.email) +
'<br>Demande : ' +
' : <br>' +
notification.text
"
></p>

View file

@ -65,6 +65,7 @@ import Reply from "../components/notifications/Reply.vue";
import Content from "../components/notifications/Content.vue";
import { useRouter } from "vue-router";
import ProjectRequest from "../components/notifications/ProjectRequest.vue";
import AppointmentRequest from "../components/notifications/AppointmentRequest.vue";
dayjs.locale("fr");
@ -97,6 +98,7 @@ const notificationComponents = {
"comment-reply": Reply,
content: Content,
"project-request": ProjectRequest,
"appointment-request": AppointmentRequest,
};
const sortedNotifications = computed(() => {