Convert type to interface
All checks were successful
Build BAB Application Deployment Artifact / build (push) Successful in 2m1s
All checks were successful
Build BAB Application Deployment Artifact / build (push) Successful in 2m1s
This commit is contained in:
@@ -3,16 +3,10 @@ import { ref } from 'vue';
|
||||
import { Boat, useBoatStore } from './boat';
|
||||
import { date } from 'quasar';
|
||||
import { DateOptions } from 'quasar';
|
||||
import {
|
||||
Timestamp,
|
||||
parseDate,
|
||||
updateRelative,
|
||||
today,
|
||||
parsed,
|
||||
} from '@quasar/quasar-ui-qcalendar';
|
||||
import { Timestamp, parseDate } from '@quasar/quasar-ui-qcalendar';
|
||||
|
||||
export type StatusTypes = 'tentative' | 'confirmed' | 'pending' | undefined;
|
||||
export type Reservation = {
|
||||
export interface Reservation {
|
||||
id: number;
|
||||
user: string;
|
||||
start: Date;
|
||||
@@ -20,42 +14,53 @@ export type Reservation = {
|
||||
resource: Boat;
|
||||
reservationDate: Date;
|
||||
status?: StatusTypes;
|
||||
};
|
||||
}
|
||||
// 24 hrs in advance only 2 weekday, and 1 weekend slot
|
||||
// Within 24 hrs, any available slot
|
||||
/* TODO: Figure out how best to separate out where qcalendar bits should be.
|
||||
e.g.: Should there be any qcalendar stuff in this store? Or should we have just JS Date
|
||||
objects in here? */
|
||||
|
||||
export type Timeblock = {
|
||||
id: number;
|
||||
export interface Timeblock {
|
||||
start: Timestamp;
|
||||
end: Timestamp;
|
||||
};
|
||||
selected?: false;
|
||||
}
|
||||
|
||||
const sampleBlocks = [
|
||||
const weekdayBlocks = [
|
||||
{
|
||||
id: 1,
|
||||
start: { time: '09:00', hour: 9, minute: 0, hasTime: true },
|
||||
end: { time: '11:30', hour: 12, minute: 0, hasTime: true },
|
||||
start: { time: '08:00', hour: 8, minute: 0 },
|
||||
end: { time: '12:00', hour: 12, minute: 0 },
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
start: { time: '12:00', hour: 12, minute: 0, hasTime: true },
|
||||
end: { time: '15:00', hour: 15, minute: 0, hasTime: true },
|
||||
start: { time: '12:00', hour: 12, minute: 0 },
|
||||
end: { time: '16:00', hour: 16, minute: 0 },
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
start: { time: '15:00', hour: 15, minute: 0, hasTime: true },
|
||||
end: { time: '18:00', hour: 18, minute: 0, hasTime: true },
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
start: { time: '18:00', hour: 18, minute: 0, hasTime: true },
|
||||
end: { time: '21:00', hour: 21, minute: 0, hasTime: true },
|
||||
start: { time: '17:00', hour: 17, minute: 0 },
|
||||
end: { time: '21:00', hour: 21, minute: 0 },
|
||||
},
|
||||
] as Timeblock[];
|
||||
|
||||
const weekendBlocks = [
|
||||
{
|
||||
start: { time: '07:00', hour: 7, minute: 0 },
|
||||
end: { time: '10:00', hour: 10, minute: 0 },
|
||||
},
|
||||
{
|
||||
start: { time: '10:00', hour: 10, minute: 0 },
|
||||
end: { time: '13:00', hour: 13, minute: 0 },
|
||||
},
|
||||
{
|
||||
start: { time: '13:00', hour: 13, minute: 0 },
|
||||
end: { time: '16:00', hour: 16, minute: 0 },
|
||||
},
|
||||
{
|
||||
start: { time: '16:00', hour: 16, minute: 0 },
|
||||
end: { time: '19:00', hour: 19, minute: 0 },
|
||||
},
|
||||
];
|
||||
|
||||
function getSampleReservations(): Reservation[] {
|
||||
const sampleData = [
|
||||
{
|
||||
@@ -137,7 +142,7 @@ function getSampleReservations(): Reservation[] {
|
||||
export const useScheduleStore = defineStore('schedule', () => {
|
||||
// TODO: Implement functions to dynamically pull this data.
|
||||
const reservations = ref<Reservation[]>(getSampleReservations());
|
||||
const timeblocks = sampleBlocks;
|
||||
const timeblocks = weekdayBlocks;
|
||||
|
||||
const getTimeblocksForDate = (date: Timestamp): Timeblock[] => {
|
||||
return timeblocks.map((t) => {
|
||||
|
||||
Reference in New Issue
Block a user