finalisation présentation

This commit is contained in:
Lucas Silva 2023-05-16 10:28:22 +02:00
parent b9e580af9a
commit c1c9562e67
3 changed files with 56 additions and 13 deletions

View File

@ -85,7 +85,7 @@ class DashboardHomepageController extends AbstractController{
if (!$this->security->getUser() instanceof User) { if (!$this->security->getUser() instanceof User) {
throw new AccessDeniedHttpException('You must be authenticated and a user to see the dashboard'); throw new AccessDeniedHttpException('You must be authenticated and a user to see the dashboard');
} }
// --------------Bar---------------------
$config = [ $config = [
'alias' => 'bar', 'alias' => 'bar',
]; ];
@ -96,6 +96,16 @@ class DashboardHomepageController extends AbstractController{
'user' => 19, 'user' => 19,
'what' => 'accompanying_period_by_month', 'what' => 'accompanying_period_by_month',
]; ];
// --------------Number------------------
/*$config = [
'alias' => 'number',
];
$context = [
'user' => $this->security->getUser(),
//'what' => 'notification_unread',
'what' => 'notification_sender',
];*/
$data = $this->widgetHandlerManager->getDataForWidget($config, $context); $data = $this->widgetHandlerManager->getDataForWidget($config, $context);
return new JsonResponse($data,Response::HTTP_OK,[]); return new JsonResponse($data,Response::HTTP_OK,[]);

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="container"> <div class="container">
<Bar v-if="loaded_bar" :data="chartData" :options="chartOptions"/> <Bar v-if="loaded_bar" :data="chartData" :options="chartOptions"/>
<span v-if="loaded_number">{{number}} Notification(s) non lue(s)</span> <span v-if="loaded_number">{{ number }}</span>
</div> </div>
</template> </template>
@ -45,14 +45,47 @@ export default defineComponent({
this.chartOptions = response.options; this.chartOptions = response.options;
if (response.type == 'bar') { if (response.type == 'bar') {
this.loaded_bar = true; this.loaded_bar = true;
} } else {
else {
this.loaded_number = true this.loaded_number = true
this.number = response.data.datasets[0].data[0]; this.number = response.data.datasets[0].data[0] + " "+ response.data.labels[0];
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
},
/*methods: {
async makeNumberWidget() {
let body = {
config: {
alias: 'number'
},
context: {
what: 'notification_unread',
user: 19 //Ne rien mettre ou via les refs
} }
};
try {
const response: {
data: any,
options: any,
type: any
} = await makeFetch('POST', '/{_locale}//{_locale}/dashboard/widget/number', body)
this.chartData = response.data;
this.chartOptions = response.options;
this.loaded_number = true;
this.number = response.data.datasets[0].data[0] + response.data.labels[0];
} catch (error) {
console.log(error)
}
},
}*/
}) })
</script> </script>
<style lang="scss" scoped>
span {
font-size: x-large;
color: #0a53be;
}
</style>

View File

@ -70,7 +70,7 @@ class WidgetNumber implements WidgetHandlerInterface
//Count the number of notification the sender send //Count the number of notification the sender send
$countSend = $this->notificationRepository->countAllForSender($user); $countSend = $this->notificationRepository->countAllForSender($user);
$dataForWidget = [ $dataForWidget = [
'labels' => ['Notification Send'], 'labels' => ['notification(s) envoyée(s)'],
'datasets' => [ 'datasets' => [
[ [
'backgroundColor' => ['#41B883'], 'backgroundColor' => ['#41B883'],
@ -84,7 +84,7 @@ class WidgetNumber implements WidgetHandlerInterface
//Count the number of unread notification by the current User //Count the number of unread notification by the current User
$countUnread = $this->notificationRepository->countUnreadByUser($user); $countUnread = $this->notificationRepository->countUnreadByUser($user);
$dataForWidget = [ $dataForWidget = [
'labels' => ['Notification Unread'], 'labels' => ['notification(s) non lue(s)'],
'datasets' => [ 'datasets' => [
[ [
'backgroundColor' => ['#41B883'], 'backgroundColor' => ['#41B883'],