Add account based filtering of the schedule
Some checks failed
/ build (push) Has been cancelled
/ deploy (push) Has been cancelled

Implement personal filtering of the schedule based on events marked as
being interested in and filtering based on assigned crew for events.
This commit is contained in:
Hornwitser 2025-03-15 22:47:32 +01:00
parent 89b1d2a547
commit 399a4d2ca5
6 changed files with 197 additions and 46 deletions

View file

@ -1,6 +1,6 @@
<template>
<div>
<Timetable :schedule="schedulePreview" />
<Timetable :schedule="schedulePreview" :eventSlotFilter :shiftSlotFilter />
<table>
<thead>
<tr>
@ -220,13 +220,15 @@
<script lang="ts" setup>
import { DateTime, Duration } from 'luxon';
import type { ChangeRecord, Schedule, ScheduleEvent, ScheduleLocation, TimeSlot } from '~/shared/types/schedule';
import type { ChangeRecord, Schedule, ScheduleEvent, ScheduleLocation, ShiftSlot, TimeSlot } from '~/shared/types/schedule';
import { applyChangeArray } from '~/shared/utils/changes';
import { enumerate, pairs, toId } from '~/shared/utils/functions';
const props = defineProps<{
edit?: boolean,
location?: string,
eventSlotFilter?: (slot: TimeSlot) => boolean,
shiftSlotFilter?: (slot: ShiftSlot) => boolean,
}>();
interface EventSlot {
@ -625,6 +627,8 @@ const eventSlots = computed(() => {
const data: (EventSlot | Gap)[] = [];
for (const event of schedule.value.events) {
for (const slot of event.slots) {
if (props.eventSlotFilter && !props.eventSlotFilter(slot))
continue;
for (const location of slot.locations) {
if (props.location !== undefined && location !== props.location)
continue;