Skip to content

Commit

Permalink
feat: aggiunta descrizione, start/end date e più lecturers ai corsi d…
Browse files Browse the repository at this point in the history
…i dottorato
  • Loading branch information
aziis98 committed Oct 26, 2023
1 parent 57c52eb commit 1bee8bb
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 15 deletions.
3 changes: 2 additions & 1 deletion server/controllers/EventPhdCourseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ class EventPhdCourseController extends Controller {
this.supervisorRoles.push('event-phd-course-manager', 'event-phd-course-supervisor')

this.searchFields = [
'title', 'lecturer.firstName', 'lecturer.lastName'
'title',
'description',
]
}
}
Expand Down
9 changes: 7 additions & 2 deletions server/models/EventPhdCourse.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const {
ObjectId,
createdBy,
updatedBy,
startDate,
endDate,
} = require('./Model')

const lessonSchema = new Schema({
Expand All @@ -13,8 +15,11 @@ const lessonSchema = new Schema({
});

const eventPhdCourseSchema = new Schema({
title: {type: String, label: 'Titolo'},
lecturer: { type: ObjectId, label: 'Docente', ref: 'Person', required: true },
title: { type: String, label: 'Titolo'},
description: { type: String, label: 'Descrizione', widget: 'text', default: '' },
startDate,
endDate,
lecturers: [{ type: ObjectId, label: 'Docente/i', ref: 'Person', default: [], required: true }],
lessons: [lessonSchema],

createdBy,
Expand Down
6 changes: 4 additions & 2 deletions src/models/EventPhdCourse.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ export default class EventPhdCourse {
'gli oggetti': "i corsi di dottorato",
'un oggetto': "un corso di dottorato",
}
this.indexDefaultFilter = {'_sort': 'title', '_limit': 10}
this.indexDefaultFilter = {'_sort': '-startDate', '_limit': 10}
this.columns = {
'title': 'Titolo',
'lecturer': 'Docente',
'startDate': 'Data Inizio',
'endDate': 'Data Fine',
'lecturers': 'Docente/i',
}

this.schema = null
Expand Down
69 changes: 62 additions & 7 deletions src/pages/PhdCourseEditPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Button, ButtonGroup, Card, Container, Form } from 'react-bootstrap'
import Loading from '../components/Loading'
import { useEngine } from '../Engine'
import { ModelHeading } from '../components/ModelHeading'
import { ConferenceRoomInput, NumberInput, PersonInput, StringInput } from '../components/Input'
import { ConferenceRoomInput, DateInput, NumberInput, PersonInput, StringInput, TextInput } from '../components/Input'
import moment from 'moment'
import { LessonTable } from '../components/PhdCourseLessonList'
import { DatetimeInput } from '../components/DatetimeInput'
Expand Down Expand Up @@ -276,25 +276,80 @@ export default function PhdCourseEditPage({ Model }) {
<div className="col-sm-2"></div>
</Form.Group>
<Form.Group className="row my-2">
<Form.Label className="col-sm-2 col-form-label" htmlFor={"lecturer"} style={{textAlign: "right"}}>
Docente
<Form.Label className="col-sm-2 col-form-label" htmlFor={"description"} style={{textAlign: "right"}}>
Descrizione
</Form.Label>
<div className="col-sm-10">
<TextInput
id="description"
value={modifiedObj.description}
setValue={value => {
setModifiedObj(obj => ({
...obj,
description: value,
}))
}}
/>
</div>
<div className="col-sm-2"></div>
</Form.Group>
<Form.Group className="row my-2">
<Form.Label className="col-sm-2 col-form-label" htmlFor={"start-date"} style={{textAlign: "right"}}>
Data inizio
</Form.Label>
<div className="col-sm-10">
<DateInput
id="start-date"
value={modifiedObj.startDate}
setValue={value => {
setModifiedObj(obj => ({
...obj,
startDate: value,
}))
}}
/>
</div>
<div className="col-sm-2"></div>
</Form.Group>
<Form.Group className="row my-2">
<Form.Label className="col-sm-2 col-form-label" htmlFor={"end-date"} style={{textAlign: "right"}}>
Data fine
</Form.Label>
<div className="col-sm-10">
<DateInput
id="end-date"
value={modifiedObj.endDate}
setValue={value => {
setModifiedObj(obj => ({
...obj,
endDate: value,
}))
}}
/>
</div>
<div className="col-sm-2"></div>
</Form.Group>
<Form.Group className="row my-2">
<Form.Label className="col-sm-2 col-form-label" style={{textAlign: "right"}}>
Docente/i
</Form.Label>
<div className="col-sm-10">
<PersonInput
id="lecturer"
value={modifiedObj.lecturer}
id="lecturers"
multiple={true}
value={modifiedObj.lecturers}
setValue={value => {
setModifiedObj(obj => ({
...obj,
lecturer: value,
lecturers: value,
}))
}}
/>
</div>
<div className="col-sm-2"></div>
</Form.Group>
<Form.Group className="row my-2">
<Form.Label className="col-sm-2 col-form-label" htmlFor={"lecturer"} style={{textAlign: "right"}}>
<Form.Label className="col-sm-2 col-form-label" style={{textAlign: "right"}}>
Lezioni
</Form.Label>
<div className="col-sm-10">
Expand Down
14 changes: 11 additions & 3 deletions src/pages/PhdCourseViewPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,20 @@ const PhdCourseView = ({ Model }) => {
</Card.Header>
<Card.Body>
<p>
<strong className="align-top">titolo: </strong>
<strong className="align-top">Titolo: </strong>
<ModelFieldOutput key="title" field="title" schema={schema.title} value={obj.title} />
</p>
<p>
<strong className="align-top">docente: </strong>
<ModelFieldOutput key="lecturer" field="lecturer" schema={schema.lecturer} value={obj.lecturer} />
<strong className="align-top">Data Inizio: </strong>
<ModelFieldOutput key="startDate" field="startDate" schema={schema.startDate} value={obj.startDate} />
</p>
<p>
<strong className="align-top">Data Fine: </strong>
<ModelFieldOutput key="endDate" field="endDate" schema={schema.endDate} value={obj.endDate} />
</p>
<p>
<strong className="align-top">Docente/i: </strong>
<ModelFieldOutput key="lecturers" field="lecturers" schema={schema.lecturers} value={obj.lecturers} />
</p>
<h4>Lezioni</h4>
<Container>
Expand Down

0 comments on commit 1bee8bb

Please sign in to comment.