diff --git a/common/helpers/materialListsSorted.js b/common/helpers/materialListsSorted.js index c973baff69..865bb834ed 100644 --- a/common/helpers/materialListsSorted.js +++ b/common/helpers/materialListsSorted.js @@ -1,4 +1,4 @@ -import { sortBy } from 'lodash' +import sortBy from 'lodash/sortBy.js' export default function (materialLists) { return sortBy( diff --git a/common/locales/de.json b/common/locales/de.json index 2cbf5a65f2..ee02dee977 100644 --- a/common/locales/de.json +++ b/common/locales/de.json @@ -8,7 +8,7 @@ }, "contentNode": { "checklist": { - "icon": "mdi-clipboard-list-outline", + "info": "Wähle die relevanten Checklistenpunkte, welche durch diese Aktivität abgedeckt werden (Ausbildungsziele, J+S-Checklisten, etc.).", "name": "Checkliste" }, "columnLayout": { @@ -261,6 +261,9 @@ "shortScheduleEntryDescription": "Tag\u202f{dayNumber} {startTime}" }, "print": { + "activityList": { + "title": "Aktivitätsübersicht" + }, "config": { "periods": "Lagerabschnitt(e)" }, @@ -291,4 +294,4 @@ "title": "Inhaltsverzeichnis" } } -} +} \ No newline at end of file diff --git a/common/locales/en.json b/common/locales/en.json index 320ee684f7..fc6c679316 100644 --- a/common/locales/en.json +++ b/common/locales/en.json @@ -7,6 +7,11 @@ } }, "contentNode": { + "checklist": { + "icon": "mdi-clipboard-list-outline", + "info": "Select the relevant checklist items, which are covered by this activity (course objectives, etc.).", + "name": "Checklists" + }, "columnLayout": { "entity": { "column": { @@ -264,6 +269,9 @@ "shortScheduleEntryDescription": "day {dayNumber} {startTime}" }, "print": { + "activityList": { + "title": "Activity list" + }, "config": { "periods": "Period(s)" }, @@ -294,4 +302,4 @@ "title": "Table of contents" } } -} +} \ No newline at end of file diff --git a/frontend/src/components/print/PrintConfigurator.vue b/frontend/src/components/print/PrintConfigurator.vue index bc4091fc53..6340ba2f71 100644 --- a/frontend/src/components/print/PrintConfigurator.vue +++ b/frontend/src/components/print/PrintConfigurator.vue @@ -103,6 +103,7 @@ import PicassoConfig from './config/PicassoConfig.vue' import SummaryConfig from './config/SummaryConfig.vue' import ProgramConfig from './config/ProgramConfig.vue' import ActivityConfig from './config/ActivityConfig.vue' +import ActivityListConfig from './config/ActivityListConfig.vue' import TocConfig from './config/TocConfig.vue' import PagesOverview from './configurator/PagesOverview.vue' import PagesConfig from './configurator/PagesConfig.vue' @@ -132,6 +133,7 @@ export default { ProgramConfig, ActivityConfig, TocConfig, + ActivityListConfig, }, props: { camp: { @@ -149,6 +151,7 @@ export default { Program: ProgramConfig, Activity: ActivityConfig, Toc: TocConfig, + ActivityList: ActivityListConfig, }, previewTab: null, } diff --git a/frontend/src/components/print/__tests__/repairPrintConfig.spec.js b/frontend/src/components/print/__tests__/repairPrintConfig.spec.js index b1f6d7fa7d..fc05081dae 100644 --- a/frontend/src/components/print/__tests__/repairPrintConfig.spec.js +++ b/frontend/src/components/print/__tests__/repairPrintConfig.spec.js @@ -7,6 +7,7 @@ import ProgramConfig from '../config/ProgramConfig.vue' import StoryConfig from '../config/StoryConfig.vue' import SafetyConsiderationsConfig from '../config/SafetyConsiderationsConfig.vue' import TocConfig from '../config/TocConfig.vue' +import ActivityListConfig from '../config/ActivityListConfig.vue' describe('repairConfig', () => { const camp = { @@ -30,6 +31,7 @@ describe('repairConfig', () => { SafetyConsiderationsConfig, StoryConfig, TocConfig, + ActivityListConfig, ].map((component) => [component.name.replace(/Config$/, ''), component.repairConfig]) ) const defaultContents = [ @@ -1126,4 +1128,102 @@ describe('repairConfig', () => { }) }) }) + + describe('activityList', () => { + test('adds missing options', async () => { + // given + const config = { + camp: '/camps/1a2b3c4d', + contents: [ + { + type: 'ActivityList', + }, + ], + documentName: 'test camp', + language: 'en-GB', + } + + // when + const result = repairConfig(config, ...args) + + // then + expect(result).toEqual({ + camp: '/camps/1a2b3c4d', + contents: [ + { + type: 'ActivityList', + options: { periods: [] }, + }, + ], + documentName: 'test camp', + language: 'en-GB', + }) + }) + + test('allows empty periods', async () => { + // given + const config = { + camp: '/camps/1a2b3c4d', + contents: [ + { + type: 'ActivityList', + options: { periods: [] }, + }, + ], + documentName: 'test camp', + language: 'en-GB', + } + + // when + const result = repairConfig(config, ...args) + + // then + expect(result).toEqual({ + camp: '/camps/1a2b3c4d', + contents: [ + { + type: 'ActivityList', + options: { periods: [] }, + }, + ], + documentName: 'test camp', + language: 'en-GB', + }) + }) + + test('filters out unknown periods', async () => { + // given + const config = { + camp: '/camps/1a2b3c4d', + contents: [ + { + type: 'ActivityList', + options: { + periods: ['/periods/11112222', '/periods/1a2b3c4d'], + }, + }, + ], + documentName: 'test camp', + language: 'en-GB', + } + + // when + const result = repairConfig(config, ...args) + + // then + expect(result).toEqual({ + camp: '/camps/1a2b3c4d', + contents: [ + { + type: 'ActivityList', + options: { + periods: ['/periods/1a2b3c4d'], + }, + }, + ], + documentName: 'test camp', + language: 'en-GB', + }) + }) + }) }) diff --git a/frontend/src/components/print/config/ActivityListConfig.vue b/frontend/src/components/print/config/ActivityListConfig.vue new file mode 100644 index 0000000000..7201d4bbc9 --- /dev/null +++ b/frontend/src/components/print/config/ActivityListConfig.vue @@ -0,0 +1,55 @@ + + + diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index ceb229f1ec..f44cb6ed6e 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -370,7 +370,8 @@ "Program": "Detailprogramm", "SafetyConsiderations": "Sicherheits­überlegungen", "Story": "Roter Faden", - "Toc": "Inhaltsverzeichnis" + "Toc": "Inhaltsverzeichnis", + "ActivityList": "Aktivitätsübersicht (Kurse)" } }, "printNuxt": { diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index fc0b43ba26..553d819687 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -369,7 +369,8 @@ "Program": "Program", "SafetyConsiderations": "Safety considerations", "Story": "Story", - "Toc": "Table of contents" + "Toc": "Table of contents", + "ActivityList": "Activity list (courses)" } }, "printNuxt": { diff --git a/print/components/activityList/ActivityListPeriod.vue b/print/components/activityList/ActivityListPeriod.vue new file mode 100644 index 0000000000..06a5218373 --- /dev/null +++ b/print/components/activityList/ActivityListPeriod.vue @@ -0,0 +1,71 @@ + + + diff --git a/print/components/activityList/ActivityListScheduleEntry.vue b/print/components/activityList/ActivityListScheduleEntry.vue new file mode 100644 index 0000000000..6c723410ae --- /dev/null +++ b/print/components/activityList/ActivityListScheduleEntry.vue @@ -0,0 +1,58 @@ + + + + + + + diff --git a/print/components/config/Activity.vue b/print/components/config/Activity.vue index 438081f33a..bd43ca8cf1 100644 --- a/print/components/config/Activity.vue +++ b/print/components/config/Activity.vue @@ -30,6 +30,13 @@ const { data: scheduleEntryData, error } = await useAsyncData( // might not be needed for every activity, but safer to do eager loading instead of n+1 later on props.camp.materialLists().$loadItems(), props.camp.campCollaborations().$loadItems(), + props.camp.checklists().$loadItems(), + $api + .get() + .checklistItems({ + 'checklist.camp': props.camp._meta.self, + }) + .$loadItems(), ]) return markRaw(scheduleEntry) diff --git a/print/components/config/ActivityList.vue b/print/components/config/ActivityList.vue new file mode 100644 index 0000000000..91ce64d810 --- /dev/null +++ b/print/components/config/ActivityList.vue @@ -0,0 +1,47 @@ + + + diff --git a/print/components/config/Program.vue b/print/components/config/Program.vue index e2226d00f1..056873aa30 100644 --- a/print/components/config/Program.vue +++ b/print/components/config/Program.vue @@ -34,6 +34,13 @@ const { data: periods, error } = await useAsyncData( props.camp.categories().$loadItems(), props.camp.materialLists().$loadItems(), props.camp.campCollaborations().$loadItems(), + props.camp.checklists().$loadItems(), + $api + .get() + .checklistItems({ + 'checklist.camp': props.camp._meta.self, + }) + .$loadItems(), ]) return props.options.periods.map((periodUri) => { diff --git a/print/components/scheduleEntry/ScheduleEntry.vue b/print/components/scheduleEntry/ScheduleEntry.vue index 2b4e17b290..d0a1ff4468 100644 --- a/print/components/scheduleEntry/ScheduleEntry.vue +++ b/print/components/scheduleEntry/ScheduleEntry.vue @@ -1,27 +1,7 @@