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 <> - { + const year = parseInt(evt.target.value); + setYear(year); + if (year) { + setFilterFields(prev => ({ + ...prev, + startDate__lt_or_null: `${year + 1}-01-01`, + endDate__gte_or_null: `${year}-01-01`, + })); + } else { + setFilterFields(prev => { + const { startDate__lt_or_null, endDate__gte_or_null, ...rest } = prev; + return rest; + }); + } + }} + > + + {years.map(y => )} + + + + ); +} \ No newline at end of file diff --git a/src/models/Group.js b/src/models/Group.js index a7b1c069..ed65b386 100644 --- a/src/models/Group.js +++ b/src/models/Group.js @@ -1,4 +1,5 @@ import Model from './Model' +import { useState } from 'react' export default class Group extends Model { constructor() { @@ -21,8 +22,77 @@ export default class Group extends Model { 'members': "membri", 'updatedAt': "modificato", } + this.Filters = GroupsFilters } describe(obj) { return `${obj?.name}` } } +function GroupsFilters({ filter }) { + const setFilterFields = filter.setFilter + const [year, setYear] = useState(0) + const [status, setStatus] = useState('all') + const currentYear = new Date().getFullYear() + const startYear = 2007 + const years = Array.from({ length: currentYear - startYear + 1 }, (_, i) => currentYear - i) + + return ( + <> + + + + ); +} \ No newline at end of file diff --git a/src/models/RoomAssignment.js b/src/models/RoomAssignment.js index 69be1383..b62a1d51 100644 --- a/src/models/RoomAssignment.js +++ b/src/models/RoomAssignment.js @@ -1,4 +1,5 @@ import Model from './Model' +import { useState } from 'react' export default class RoomAssignment extends Model { constructor() { @@ -23,9 +24,45 @@ export default class RoomAssignment extends Model { 'room': "stanza", 'updatedAt': "modificato", } + this.Filters = RoomAssignmentsFilters } describe(obj) { return `${obj.person?.lastName} ${obj.room?.building}${obj.room?.floor} ${obj.room?.number}` } } + +function RoomAssignmentsFilters({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/Staff.js b/src/models/Staff.js index 9612f12a..ae61265b 100644 --- a/src/models/Staff.js +++ b/src/models/Staff.js @@ -1,5 +1,6 @@ import Model from './Model' import StaffViewPage from '../pages/StaffViewPage' +import { useState } from 'react' export default class Staff extends Model { constructor() { @@ -24,8 +25,102 @@ export default class Staff extends Model { 'updatedAt': "modificato", } this.ViewPage = StaffViewPage + this.Filters = StaffsFilters } describe(obj) { return `${obj?.person?.lastName} ${obj?.person?.firstName}` } } +function StaffsFilters({ filter }) { + const setFilterFields = filter.setFilter + const [year, setYear] = useState(0) + const [status, setStatus] = useState('all') + const [qualification, setQualification] = useState('') + const currentYear = new Date().getFullYear() + const startYear = 2007 + const years = Array.from({ length: currentYear - startYear + 1 }, (_, i) => currentYear - i) + const qualificationOptions = ['PO', 'PA', 'RTDb', 'RTDa', 'RIC', 'Assegnista', 'Dottorando', 'PTA', 'Professore Emerito', 'Collaboratore', 'Docente Esterno', 'Dottorando Esterno', 'Personale in quiescenza', 'ex Docente'] + + return ( + <> + + + + + ); +} \ No newline at end of file diff --git a/src/models/Thesis.js b/src/models/Thesis.js index 821f2047..2bc9759d 100644 --- a/src/models/Thesis.js +++ b/src/models/Thesis.js @@ -1,4 +1,5 @@ import Model from './Model' +import { useState } from 'react' export default class Thesis extends Model { constructor() { @@ -23,10 +24,69 @@ export default class Thesis extends Model { 'SSD': "SSD", 'updatedAt': "modificato", } + this.Filters = ThesesFilters } describe(thesis) { return thesis?.person.lastName } } +function ThesesFilters({filter}) { + const setFilterFields = filter.setFilter + const [year, setYear] = useState(0) + const [ssd, setSSD] = useState('') + const currentYear = new Date().getFullYear() + const startYear = 1987 + const years = Array.from({ length: currentYear - startYear + 1 }, (_, i) => currentYear - i) + const ssdOptions = ['MAT/01', 'MAT/02', 'MAT/03', 'MAT/04', 'MAT/05', 'MAT/06', 'MAT/07', 'MAT/08'] + return <> + + + +} \ No newline at end of file diff --git a/src/models/Visit.js b/src/models/Visit.js index 02ccf188..2110fd4c 100644 --- a/src/models/Visit.js +++ b/src/models/Visit.js @@ -1,5 +1,6 @@ import Model from './Model' import VisitViewPage from '../pages/VisitViewPage' +import { useState } from 'react' export default class Visit extends Model { constructor() { @@ -24,6 +25,7 @@ export default class Visit extends Model { 'updatedAt': "modificato", } this.ViewPage = VisitViewPage + this.Filters = VisitsFilters } describe(obj) { return `${obj?.person?.lastName}` } @@ -35,3 +37,37 @@ export default class Visit extends Model { }} } +function VisitsFilters({filter}) { + const setFilterFields = filter.setFilter + const [year, setYear] = useState(0) + const currentYear = new Date().getFullYear() + const startYear = 2013 + const years = Array.from({ length: currentYear - startYear + 1 }, (_, i) => currentYear - i) + + return <> + + +} \ No newline at end of file