mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-20 01:04:23 +00:00
finalisation présentation
This commit is contained in:
parent
b9e580af9a
commit
c1c9562e67
@ -85,7 +85,7 @@ class DashboardHomepageController extends AbstractController{
|
||||
if (!$this->security->getUser() instanceof User) {
|
||||
throw new AccessDeniedHttpException('You must be authenticated and a user to see the dashboard');
|
||||
}
|
||||
|
||||
// --------------Bar---------------------
|
||||
$config = [
|
||||
'alias' => 'bar',
|
||||
];
|
||||
@ -96,6 +96,16 @@ class DashboardHomepageController extends AbstractController{
|
||||
'user' => 19,
|
||||
'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);
|
||||
|
||||
return new JsonResponse($data,Response::HTTP_OK,[]);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<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>
|
||||
</template>
|
||||
|
||||
@ -15,7 +15,7 @@ import {
|
||||
CategoryScale,
|
||||
LinearScale
|
||||
} from 'chart.js'
|
||||
import { Bar } from 'vue-chartjs'
|
||||
import {Bar} from 'vue-chartjs'
|
||||
import {defineComponent} from 'vue'
|
||||
import {makeFetch} from "../../lib/api/apiMethods";
|
||||
|
||||
@ -36,23 +36,56 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
this.loaded_bar=false;
|
||||
this.loaded_number=false;
|
||||
this.loaded_bar = false;
|
||||
this.loaded_number = false;
|
||||
const url = '/fr/dashboard/raw_data';
|
||||
try {
|
||||
const response: { data: any, options: any, type: any} = await makeFetch("GET", url);
|
||||
const response: { data: any, options: any, type: any } = await makeFetch("GET", url);
|
||||
this.chartData = response.data;
|
||||
this.chartOptions = response.options;
|
||||
if(response.type == 'bar'){
|
||||
if (response.type == 'bar') {
|
||||
this.loaded_bar = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
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) {
|
||||
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>
|
||||
<style lang="scss" scoped>
|
||||
span {
|
||||
font-size: x-large;
|
||||
color: #0a53be;
|
||||
}
|
||||
</style>
|
||||
|
@ -70,7 +70,7 @@ class WidgetNumber implements WidgetHandlerInterface
|
||||
//Count the number of notification the sender send
|
||||
$countSend = $this->notificationRepository->countAllForSender($user);
|
||||
$dataForWidget = [
|
||||
'labels' => ['Notification Send'],
|
||||
'labels' => ['notification(s) envoyée(s)'],
|
||||
'datasets' => [
|
||||
[
|
||||
'backgroundColor' => ['#41B883'],
|
||||
@ -84,7 +84,7 @@ class WidgetNumber implements WidgetHandlerInterface
|
||||
//Count the number of unread notification by the current User
|
||||
$countUnread = $this->notificationRepository->countUnreadByUser($user);
|
||||
$dataForWidget = [
|
||||
'labels' => ['Notification Unread'],
|
||||
'labels' => ['notification(s) non lue(s)'],
|
||||
'datasets' => [
|
||||
[
|
||||
'backgroundColor' => ['#41B883'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user