Add account based filtering of the schedule
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:
parent
89b1d2a547
commit
399a4d2ca5
6 changed files with 197 additions and 46 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue