From 86e06cb019302df8480609214557e4cfea2d10e1 Mon Sep 17 00:00:00 2001
From: CDP21 <132059856+c2d13p@users.noreply.github.com>
Date: Fri, 19 Jul 2024 08:40:26 +0000
Subject: [PATCH] Adding filters to a lot of models
---
src/models/EventConference.js | 39 +++++++++++++-
src/models/EventPhdCourse.js | 39 +++++++++++++-
src/models/EventSeminar.js | 16 +++---
src/models/Grant.js | 70 +++++++++++++++++++++++++-
src/models/Group.js | 70 ++++++++++++++++++++++++++
src/models/RoomAssignment.js | 37 ++++++++++++++
src/models/Staff.js | 95 +++++++++++++++++++++++++++++++++++
src/models/Thesis.js | 60 ++++++++++++++++++++++
src/models/Visit.js | 36 +++++++++++++
9 files changed, 450 insertions(+), 12 deletions(-)
diff --git a/src/models/EventConference.js b/src/models/EventConference.js
index ab170e4b..a49bdb89 100644
--- a/src/models/EventConference.js
+++ b/src/models/EventConference.js
@@ -1,4 +1,5 @@
import { Route } from 'react-router-dom'
+import { useState } from 'react'
import ModelEditPage from '../pages/ModelEditPage'
import ModelsPage from '../pages/ModelsPage'
@@ -26,12 +27,11 @@ export default class EventConference {
'SSD': 'SSD',
'conferenceRoom': 'Aula',
}
-
this.schema = null
-
this.IndexPage = ModelsPage
this.ViewPage = ModelViewPage
this.EditPage = ModelEditPage
+ this.Filters = ConferencesFilters
}
// absolute url of objects index
@@ -73,3 +73,38 @@ export default class EventConference {
return [indexRouter, viewRouter, editRouter].filter(Boolean)
}
}
+
+function ConferencesFilters({filter}) {
+ const setFilterFields = filter.setFilter
+ const [year, setYear] = useState(0)
+ const currentYear = new Date().getFullYear()
+ const startYear = 2016
+ const years = Array.from({ length: currentYear - startYear + 1 }, (_, i) => currentYear - i)
+
+ return <>
+
+ >
+}
\ No newline at end of file
diff --git a/src/models/EventPhdCourse.js b/src/models/EventPhdCourse.js
index 79969144..3eb638ba 100644
--- a/src/models/EventPhdCourse.js
+++ b/src/models/EventPhdCourse.js
@@ -1,5 +1,6 @@
import { Route } from 'react-router-dom'
import { Link } from 'react-router-dom'
+import { useState } from 'react'
import ModelsPage from '../pages/ModelsPage'
import PhdCourseEditPage from '../pages/PhdCourseEditPage'
@@ -34,12 +35,11 @@ export default class EventPhdCourse {
'endDate': 'Data Fine',
'lecturers': 'Docente/i',
}
-
this.schema = null
-
this.IndexPage = ModelsPage
this.ViewPage = PhdCourseViewPage
this.EditPage = PhdCourseEditPage
+ this.Filters = PhdCoursesFilters
}
// absolute url of objects index
@@ -91,3 +91,38 @@ export default class EventPhdCourse {
return [indexRouter, viewRouter, editRouter].filter(Boolean)
}
}
+
+function PhdCoursesFilters({filter}) {
+ const setFilterFields = filter.setFilter
+ const [year, setYear] = useState(0)
+ const currentYear = new Date().getFullYear()
+ const startYear = 2023
+ const years = Array.from({ length: currentYear - startYear + 1 }, (_, i) => currentYear - i)
+
+ return <>
+
+ >
+}
\ No newline at end of file
diff --git a/src/models/EventSeminar.js b/src/models/EventSeminar.js
index 4739fde0..26c02fa3 100644
--- a/src/models/EventSeminar.js
+++ b/src/models/EventSeminar.js
@@ -27,9 +27,7 @@ export default class EventSeminar {
'category': 'Categoria',
'startDatetime': 'Inizio',
}
-
this.schema = null
-
this.IndexPage = ModelsPage
this.ViewPage = ModelViewPage
this.EditPage = ModelEditPage
@@ -80,9 +78,13 @@ function SeminarsFilters({filter}) {
const setFilterFields = filter.setFilter
const [year, setYear] = useState(0)
const currentYear = new Date().getFullYear()
- const years = Array.from({length: 10} , (_, i) => currentYear + 1 - i)
+ const startYear = 2013
+ const years = Array.from({ length: currentYear - startYear + 1 }, (_, i) => currentYear - i)
+
return <>
-