appointment request notification working
This commit is contained in:
parent
54af78e32c
commit
85e3e7b2d4
4 changed files with 68 additions and 4 deletions
|
|
@ -31,7 +31,7 @@ return [
|
||||||
"page" => $newProject
|
"page" => $newProject
|
||||||
],
|
],
|
||||||
"date" => (string) $formattedDate,
|
"date" => (string) $formattedDate,
|
||||||
"text" => nl2br(esc($data->details)),
|
"text" => nl2br("Objet : " . $data->subject . "\n" . esc($data->details)),
|
||||||
"author" => $user,
|
"author" => $user,
|
||||||
"id" => Str::uuid(),
|
"id" => Str::uuid(),
|
||||||
"type" => "appointment-request",
|
"type" => "appointment-request",
|
||||||
|
|
|
||||||
59
src/components/notifications/AppointmentRequest.vue
Normal file
59
src/components/notifications/AppointmentRequest.vue
Normal 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>
|
||||||
|
|
@ -13,7 +13,10 @@
|
||||||
>Demande de création de projet</strong
|
>Demande de création de projet</strong
|
||||||
>
|
>
|
||||||
<span class="notification__client | text-grey-700"
|
<span class="notification__client | text-grey-700"
|
||||||
>{{ notification.project.title }} (brouillon)</span
|
>{{ notification.project.title }}
|
||||||
|
{{
|
||||||
|
notification.project.status === "draft" ? "(brouillon)" : ""
|
||||||
|
}}</span
|
||||||
>
|
>
|
||||||
<time
|
<time
|
||||||
datetime=""
|
datetime=""
|
||||||
|
|
@ -26,11 +29,11 @@
|
||||||
v-if="notification.type"
|
v-if="notification.type"
|
||||||
class="notification__body | text-md font-medium | line-clamp"
|
class="notification__body | text-md font-medium | line-clamp"
|
||||||
v-html="
|
v-html="
|
||||||
'Auteur de la demande : ' +
|
'De la part de ' +
|
||||||
(notification.author.name
|
(notification.author.name
|
||||||
? notification.author.name + ' (' + notification.author.email + ')'
|
? notification.author.name + ' (' + notification.author.email + ')'
|
||||||
: notification.author.email) +
|
: notification.author.email) +
|
||||||
'<br>Demande : ' +
|
' : <br>' +
|
||||||
notification.text
|
notification.text
|
||||||
"
|
"
|
||||||
></p>
|
></p>
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ import Reply from "../components/notifications/Reply.vue";
|
||||||
import Content from "../components/notifications/Content.vue";
|
import Content from "../components/notifications/Content.vue";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import ProjectRequest from "../components/notifications/ProjectRequest.vue";
|
import ProjectRequest from "../components/notifications/ProjectRequest.vue";
|
||||||
|
import AppointmentRequest from "../components/notifications/AppointmentRequest.vue";
|
||||||
|
|
||||||
dayjs.locale("fr");
|
dayjs.locale("fr");
|
||||||
|
|
||||||
|
|
@ -97,6 +98,7 @@ const notificationComponents = {
|
||||||
"comment-reply": Reply,
|
"comment-reply": Reply,
|
||||||
content: Content,
|
content: Content,
|
||||||
"project-request": ProjectRequest,
|
"project-request": ProjectRequest,
|
||||||
|
"appointment-request": AppointmentRequest,
|
||||||
};
|
};
|
||||||
|
|
||||||
const sortedNotifications = computed(() => {
|
const sortedNotifications = computed(() => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue