Begin implementation of timeblocks. Update workflow to build on devel branch
All checks were successful
Build BAB Application Deployment Artifact / build (push) Successful in 2m21s

This commit is contained in:
2023-12-20 10:48:51 -05:00
parent ef569ac3b1
commit d18780bb21
3 changed files with 45 additions and 10 deletions

View File

@@ -3,9 +3,14 @@ import { ref } from 'vue';
import { Boat, useBoatStore } from './boat';
import { date } from 'quasar';
import { DateOptions } from 'quasar';
import {
Timestamp,
parseTimestamp,
TimestampArray,
} from '@quasar/quasar-ui-qcalendar';
export type StatusTypes = 'tentative' | 'confirmed' | 'pending' | undefined;
export interface Reservation {
export type Reservation = {
id: number;
user: string;
start: Date;
@@ -13,9 +18,21 @@ export interface Reservation {
resource: Boat;
reservationDate: Date;
status?: StatusTypes;
}
};
function getSampleData(): Reservation[] {
export type Timeblock = {
start: Timestamp;
end: Timestamp;
};
const sampleBlocks = [
{ start: { hour: 9, minute: 0 }, end: { hour: 12, minute: 0 } },
{ start: { hour: 12, minute: 0 }, end: { hour: 15, minute: 0 } },
{ start: { hour: 15, minute: 0 }, end: { hour: 18, minute: 0 } },
{ start: { hour: 18, minute: 0 }, end: { hour: 21, minute: 0 } },
] as Timeblock[];
function getSampleReservations(): Reservation[] {
const sampleData = [
{
id: 1,
@@ -83,13 +100,18 @@ function getSampleData(): Reservation[] {
end: date.adjustDate(now, makeOpts(splitTime(entry.end))),
resource: boat,
reservationDate: now,
status: entry.status,
status: entry.status as StatusTypes,
};
});
}
export const useScheduleStore = defineStore('schedule', () => {
const reservations = ref<Reservation[]>(getSampleData());
// TODO: Implement functions to dynamically pull this data.
const reservations = ref<Reservation[]>(getSampleReservations());
const timeblocks = sampleBlocks;
const getTimeblocksForDate = (date: Date): Timeblock[] => timeblocks;
const getBoatReservations = (
boat: number | string,
curDate: Date