File tree Expand file tree Collapse file tree 3 files changed +36
-11
lines changed Expand file tree Collapse file tree 3 files changed +36
-11
lines changed Original file line number Diff line number Diff line change @@ -18,13 +18,21 @@ export default {
1818 name: ' ScheduleEntry' ,
1919 components: { ScheduleEntryTitle, ContentNode },
2020 extends: PdfComponent,
21+ provide () {
22+ return {
23+ camp: this .camp ,
24+ }
25+ },
2126 props: {
2227 scheduleEntry: { type: Object , required: true },
2328 },
2429 computed: {
2530 activity () {
2631 return this .scheduleEntry .activity ()
2732 },
33+ camp () {
34+ return this .activity .camp ()
35+ },
2836 },
2937}
3038 </script >
Original file line number Diff line number Diff line change 1919<script setup>
2020import uniqWith from ' lodash-es/uniqWith.js'
2121import sortBy from ' lodash-es/sortBy.js'
22+ import { inject } from ' vue'
2223
2324const props = defineProps ({
2425 contentNode: { type: Object , required: true },
@@ -31,18 +32,27 @@ function calculateItemNumber(item) {
3132
3233 return calculateItemNumber (item .parent ()) + ' .' + (item .position + 1 )
3334}
34- const items = props .contentNode .checklistItems ().items .map ((item ) => {
35- const number = calculateItemNumber (item)
36- return {
37- ... item,
38- number,
39- }
40- })
35+
36+ const camp = inject (' camp' )
37+ const allChecklists = camp .checklists ().items
38+ const allItems = allChecklists .flatMap ((checklist ) => checklist .checklistItems ().items )
39+ const items = allItems
40+ .filter ((item ) => {
41+ const connectedChecklistNodes = item
42+ .checklistNodes ()
43+ .items .map ((checklistNode ) => checklistNode ._meta .self )
44+ return connectedChecklistNodes .includes (props .contentNode ._meta .self )
45+ })
46+ .map ((item ) => {
47+ const number = calculateItemNumber (item)
48+ return {
49+ ... item,
50+ number,
51+ }
52+ })
4153
4254const checklists = uniqWith (
43- props .contentNode
44- .checklistItems ()
45- .items .map ((checklistItem ) => checklistItem .checklist ()),
55+ items .map ((checklistItem ) => checklistItem .checklist ()),
4656 function (checklist1 , checklist2 ) {
4757 return checklist1 ._meta .self === checklist2 ._meta .self
4858 }
Original file line number Diff line number Diff line change @@ -93,7 +93,14 @@ export async function prepareInMainThread(config) {
9393 } ) ,
9494 camp . materialLists ( ) . $loadItems ( ) ,
9595 config . apiGet ( ) . contentTypes ( ) . $loadItems ( ) ,
96- camp . checklists ( ) . $loadItems ( ) ,
96+ camp
97+ . checklists ( )
98+ . $loadItems ( )
99+ . then ( ( checklists ) => {
100+ return Promise . all (
101+ checklists . items . map ( ( checklist ) => checklist . checklistItems ( ) . _meta . load )
102+ )
103+ } ) ,
97104 config
98105 . apiGet ( )
99106 . checklistItems ( {
You can’t perform that action at this time.
0 commit comments