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>
|
||||
|
@ -218,13 +218,15 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { DateTime, Duration } from 'luxon';
|
||||
import type { ChangeRecord, Schedule, Shift, Role, ShiftSlot as ShiftTimeSlot} from '~/shared/types/schedule';
|
||||
import type { ChangeRecord, Schedule, Shift, Role, ShiftSlot as ShiftTimeSlot, TimeSlot} from '~/shared/types/schedule';
|
||||
import { applyChangeArray } from '~/shared/utils/changes';
|
||||
import { enumerate, pairs, toId } from '~/shared/utils/functions';
|
||||
|
||||
const props = defineProps<{
|
||||
edit?: boolean,
|
||||
role?: string,
|
||||
eventSlotFilter?: (slot: TimeSlot) => boolean,
|
||||
shiftSlotFilter?: (slot: ShiftTimeSlot) => boolean,
|
||||
}>();
|
||||
|
||||
interface ShiftSlot {
|
||||
|
@ -608,6 +610,8 @@ const shiftSlots = computed(() => {
|
|||
if (props.role !== undefined && shift.role !== props.role)
|
||||
continue;
|
||||
for (const slot of shift.slots) {
|
||||
if (props.shiftSlotFilter && !props.shiftSlotFilter(slot))
|
||||
continue;
|
||||
data.push({
|
||||
type: "slot",
|
||||
id: slot.id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue