Add Activity Events
This commit is contained in:
parent
5aa3b2d723
commit
c4d110333b
1 changed files with 18 additions and 2 deletions
|
|
@ -1,8 +1,24 @@
|
|||
|
||||
import {getQualifyExams} from "$lib/data/info"
|
||||
import type { PageServerLoad } from './$types'
|
||||
import type {CalendarEvent} from '$lib/components/CalendarEvent'
|
||||
export const load: PageServerLoad = async () => {
|
||||
const exams = await getQualifyExams()
|
||||
return {exams}
|
||||
const exams = await getQualifyExams()
|
||||
const events:CalendarEvent[]=[]
|
||||
exams.forEach(({id,title,start,institute_id})=>{
|
||||
let backgroundColor ="#1111EE"
|
||||
switch (institute_id) {
|
||||
case 1:
|
||||
backgroundColor="#EE1111"
|
||||
break;
|
||||
case 2:
|
||||
backgroundColor="#11EE11"
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
events.push({id,title,start,backgroundColor})
|
||||
})
|
||||
return {exams,events}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue