Implement editing of slots in ClientSchedule

Implement tracking of time slots along with editing and restoration of
singularly edited time slots.  This provides a simpler interface to work
with when rendering tables of time slots that can be edited than
directly manipulating events and shifts containing an array of slots.
This commit is contained in:
Hornwitser 2025-06-14 19:12:31 +02:00
parent 73bb12c104
commit ce9f758f84
4 changed files with 432 additions and 44 deletions

View file

@ -1,4 +1,5 @@
import type { LocationQueryValue } from 'vue-router';
import type { Id } from '~/shared/types/common';
export function queryToString(item?: null | LocationQueryValue | LocationQueryValue[]) {
if (item === null)
@ -15,3 +16,7 @@ export function queryToNumber(item?: null | LocationQueryValue | LocationQueryVa
return queryToNumber(item[0])
return Number.parseInt(item, 10);
}
export function idMap<T extends { id: Id }>(entities: T[]) {
return new Map(entities.map(entity => [entity.id, entity]));
}