mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-28 23:43:22 +00:00
feat: Ajout des évenements à venir
This commit is contained in:
@ -1,10 +1,11 @@
|
||||
from django.urls import path, re_path
|
||||
|
||||
from Planning.views import PlanningView,PlanningWithIdView,EventsView,EventsWithIdView
|
||||
from Planning.views import PlanningView,PlanningWithIdView,EventsView,EventsWithIdView,UpcomingEventsView
|
||||
|
||||
urlpatterns = [
|
||||
re_path(r'^plannings$', PlanningView.as_view(), name="planning"),
|
||||
re_path(r'^plannings/(?P<id>[0-9]+)$', PlanningWithIdView.as_view(), name="planning"),
|
||||
re_path(r'^events$', EventsView.as_view(), name="events"),
|
||||
re_path(r'^events/(?P<id>[0-9]+)$', EventsWithIdView.as_view(), name="events"),
|
||||
re_path(r'^events/upcoming', UpcomingEventsView.as_view(), name="events"),
|
||||
]
|
||||
@ -1,5 +1,6 @@
|
||||
from django.http.response import JsonResponse
|
||||
from rest_framework.views import APIView
|
||||
from django.utils import timezone
|
||||
|
||||
from .models import Planning, Events
|
||||
|
||||
@ -87,3 +88,10 @@ class EventsWithIdView(APIView):
|
||||
|
||||
event.delete()
|
||||
return JsonResponse({'message': 'Event deleted'}, status=204)
|
||||
|
||||
class UpcomingEventsView(APIView):
|
||||
def get(self, request):
|
||||
current_date = timezone.now()
|
||||
upcoming_events = Events.objects.filter(start__gte=current_date)
|
||||
events_serializer = EventsSerializer(upcoming_events, many=True)
|
||||
return JsonResponse(events_serializer.data, safe=False)
|
||||
@ -2,7 +2,7 @@
|
||||
"dashboard": "Dashboard",
|
||||
"subscriptions": "Subscriptions",
|
||||
"structure": "Structure",
|
||||
"planning": "Schedule",
|
||||
"events": "Events",
|
||||
"grades": "Grades",
|
||||
"settings": "Settings",
|
||||
"schoolAdmin": "School Administration"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"dashboard": "Tableau de bord",
|
||||
"subscriptions": "Inscriptions",
|
||||
"structure": "Structure",
|
||||
"planning": "Emploi du temps",
|
||||
"events": "Evenements",
|
||||
"grades": "Notes",
|
||||
"settings": "Paramètres",
|
||||
"schoolAdmin": "Administration Scolaire"
|
||||
|
||||
1
Front-End/project.inlang/.gitignore
vendored
1
Front-End/project.inlang/.gitignore
vendored
@ -1 +0,0 @@
|
||||
cache
|
||||
@ -1 +0,0 @@
|
||||
2ff5cbbb4bc1c6d178400871dfa342ac4f0b18e9b86cb64a1110be1ec54238c1
|
||||
@ -1,12 +0,0 @@
|
||||
{
|
||||
// official schema ensures that your project file is valid
|
||||
"$schema": "https://inlang.com/schema/project-settings",
|
||||
// the "source" language tag that is used in your project
|
||||
"sourceLanguageTag": "fr",
|
||||
// all the language tags you want to support in your project
|
||||
"languageTags": ["fr", "en"],
|
||||
"modules": [
|
||||
"https://cdn.jsdelivr.net/npm/@inlang/plugin-json@4/dist/index.js"
|
||||
], // or use another storage module: https://inlang.com/c/plugins (i18next, json, inlang message format)
|
||||
"settings": {}
|
||||
}
|
||||
@ -47,7 +47,7 @@ export default function Layout({
|
||||
"subscriptions": { "id": "subscriptions", "name": t('subscriptions'), "url": FE_ADMIN_SUBSCRIPTIONS_URL, "icon": Users },
|
||||
"structure": { "id": "structure", "name": t('structure'), "url": FE_ADMIN_STRUCTURE_URL, "icon": Building },
|
||||
"grades": { "id": "grades", "name": t('grades'), "url": FE_ADMIN_GRADES_URL, "icon": FileText },
|
||||
"planning": { "id": "planning", "name": t('planning'), "url": FE_ADMIN_PLANNING_URL, "icon": Calendar },
|
||||
"planning": { "id": "planning", "name": t('events'), "url": FE_ADMIN_PLANNING_URL, "icon": Calendar },
|
||||
"settings": { "id": "settings", "name": t('settings'), "url": FE_ADMIN_SETTINGS_URL, "icon": Settings }
|
||||
};
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
'use client'
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
@ -9,6 +8,7 @@ import { fetchClasses } from '@/app/actions/schoolAction';
|
||||
import StatCard from '@/components/StatCard';
|
||||
import logger from '@/utils/logger';
|
||||
import { fetchRegisterForms } from '@/app/actions/subscriptionAction';
|
||||
import { fetchUpcomingEvents } from '@/app/actions/planningAction';
|
||||
|
||||
|
||||
// Composant EventCard pour afficher les événements
|
||||
@ -64,22 +64,14 @@ export default function DashboardPage() {
|
||||
logger.error('Error fetching pending registrations:', error);
|
||||
});
|
||||
|
||||
fetchUpcomingEvents().then(data => {
|
||||
setUpcomingEvents(data);
|
||||
}).catch(error => {
|
||||
logger.error('Error fetching upcoming events:', error);
|
||||
});
|
||||
|
||||
// Simulation de chargement des données
|
||||
setTimeout(() => {
|
||||
setUpcomingEvents([
|
||||
{
|
||||
title: "Réunion de rentrée",
|
||||
date: "2024-09-01",
|
||||
description: "Présentation de l'année scolaire",
|
||||
type: "meeting"
|
||||
},
|
||||
{
|
||||
title: "Date limite inscriptions",
|
||||
date: "2024-08-15",
|
||||
description: "Clôture des inscriptions",
|
||||
type: "deadline"
|
||||
}
|
||||
]);
|
||||
setMonthlyStats({
|
||||
inscriptions: [150, 180, 210, 245],
|
||||
completionRate: 78
|
||||
|
||||
@ -104,5 +104,9 @@ export const deleteEvent = (id, csrfToken) => {
|
||||
return removeDatas(`${BE_PLANNING_EVENTS_URL}/${id}`, csrfToken)
|
||||
}
|
||||
|
||||
export const fetchUpcomingEvents = () => {
|
||||
return getData(`${BE_PLANNING_EVENTS_URL}/upcoming`);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user