list des upcoming appointments prettier
This commit is contained in:
parent
f46c3756f0
commit
35f314498f
@ -1,20 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="appointment-list">
|
<div class="appointment-list">
|
||||||
<h2>Liste des rendez-vous</h2>
|
<h2>Liste des rendez-vous</h2>
|
||||||
|
<h3>de {{ store.user.username }}</h3>
|
||||||
|
<ul v-if="appointments.length">
|
||||||
|
<li v-for="appt in appointments" :key="appt.idAppointment">
|
||||||
|
<strong>Sujet :</strong> {{ appt.appointmentSubject }}<br />
|
||||||
|
<strong>Date :</strong> {{ appt.appointmentDate }}<br />
|
||||||
|
<strong>Heure :</strong> {{ appt.appointmentTime }}<br />
|
||||||
|
<strong>Durée :</strong> {{ appt.appointmentDuration }}<br />
|
||||||
|
<strong>Lieu :</strong> {{ appt.appointmentPlace }}
|
||||||
|
<hr />
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<ul v-if="appointments.length">
|
<p v-else>Aucun rendez-vous trouvé.</p>
|
||||||
<li v-for="appt in appointments" :key="appt.idAppointment">
|
</div>
|
||||||
<strong>Sujet :</strong> {{ appt.appointmentSubject }}<br />
|
|
||||||
<strong>Date :</strong> {{ appt.appointmentDate }}<br />
|
|
||||||
<strong>Heure :</strong> {{ appt.appointmentTime }}<br />
|
|
||||||
<strong>Durée :</strong> {{ appt.appointmentDuration }}<br />
|
|
||||||
<strong>Lieu :</strong> {{ appt.appointmentPlace }}
|
|
||||||
<hr />
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<p v-else>Aucun rendez-vous trouvé.</p>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@ -23,53 +23,68 @@ import { callApi } from "@/services/api";
|
|||||||
import Appointment from "@/ApiClasses/Appointment";
|
import Appointment from "@/ApiClasses/Appointment";
|
||||||
import { store } from "@/main.ts";
|
import { store } from "@/main.ts";
|
||||||
|
|
||||||
|
// Define the interface for the API response
|
||||||
|
interface AppointmentResponse {
|
||||||
|
idAppointment: number;
|
||||||
|
appointmentSubject: string;
|
||||||
|
appointmentDate: string;
|
||||||
|
appointmentTime: string;
|
||||||
|
appointmentDuration: string;
|
||||||
|
appointmentPlace: string;
|
||||||
|
}
|
||||||
|
|
||||||
const appointments = ref<Appointment[]>([]);
|
const appointments = ref<Appointment[]>([]);
|
||||||
|
|
||||||
function loadAppointments() {
|
function loadAppointments() {
|
||||||
if (!store.user) {
|
if (!store.user) {
|
||||||
console.error("L'utilisateur n'est pas connecté ou les données utilisateur ne sont pas disponibles.");
|
console.error(
|
||||||
return;
|
"L'utilisateur n'est pas connecté ou les données utilisateur ne sont pas disponibles."
|
||||||
}
|
);
|
||||||
console.log("username :", store.user.username);
|
return;
|
||||||
console.log("token :", store.user.token);
|
|
||||||
callApi(
|
|
||||||
"/admin/appointments/upcoming",
|
|
||||||
(response) => {
|
|
||||||
appointments.value = response.data.map(
|
|
||||||
(item: any) => new Appointment(item)
|
|
||||||
);
|
|
||||||
},
|
|
||||||
(error) => {
|
|
||||||
console.error("Erreur lors de la récupération des rendez-vous :", error);
|
|
||||||
}
|
}
|
||||||
);
|
//console.log("username :", store.user.username);
|
||||||
|
//console.log("token :", store.user.token);
|
||||||
|
callApi(
|
||||||
|
"/admin/appointments/upcoming",
|
||||||
|
(response) => {
|
||||||
|
appointments.value = response.data.map(
|
||||||
|
(item: AppointmentResponse) => new Appointment(item)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
console.error(
|
||||||
|
"Erreur lors de la récupération des rendez-vous :",
|
||||||
|
error
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadAppointments();
|
loadAppointments();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.appointment-list {
|
.appointment-list {
|
||||||
max-width: 600px;
|
max-width: 600px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
background: #fdfdfd;
|
background: #fdfdfd;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
|
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
font-size: 1.8rem;
|
font-size: 1.8rem;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
color: #333;
|
color: #333;
|
||||||
border-bottom: 2px solid #ddd;
|
border-bottom: 2px solid #ddd;
|
||||||
padding-bottom: 10px;
|
padding-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
li {
|
li {
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user