Updates to booking
All checks were successful
Build BAB Application Deployment Artifact / build (push) Successful in 2m30s
All checks were successful
Build BAB Application Deployment Artifact / build (push) Successful in 2m30s
This commit is contained in:
@@ -3,11 +3,7 @@ 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';
|
||||
import { Timestamp } from '@quasar/quasar-ui-qcalendar';
|
||||
import { timeStamp } from 'console';
|
||||
|
||||
export type StatusTypes = 'tentative' | 'confirmed' | 'pending' | undefined;
|
||||
@@ -21,6 +17,10 @@ export type Reservation = {
|
||||
status?: StatusTypes;
|
||||
};
|
||||
|
||||
/* 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 = {
|
||||
start: Timestamp;
|
||||
end: Timestamp;
|
||||
@@ -52,7 +52,7 @@ function getSampleReservations(): Reservation[] {
|
||||
user: 'John Smith',
|
||||
start: '12:00',
|
||||
end: '15:00',
|
||||
boat: 1,
|
||||
boat: '1',
|
||||
status: 'confirmed',
|
||||
},
|
||||
{
|
||||
@@ -60,7 +60,7 @@ function getSampleReservations(): Reservation[] {
|
||||
user: 'Bob Barker',
|
||||
start: '18:00',
|
||||
end: '21:00',
|
||||
boat: 1,
|
||||
boat: '1',
|
||||
status: 'confirmed',
|
||||
},
|
||||
{
|
||||
@@ -68,7 +68,7 @@ function getSampleReservations(): Reservation[] {
|
||||
user: 'Peter Parker',
|
||||
start: '9:00',
|
||||
end: '12:00',
|
||||
boat: 2,
|
||||
boat: '2',
|
||||
status: 'tentative',
|
||||
},
|
||||
{
|
||||
@@ -76,7 +76,7 @@ function getSampleReservations(): Reservation[] {
|
||||
user: 'Vince McMahon',
|
||||
start: '15:00',
|
||||
end: '18:00',
|
||||
boat: 2,
|
||||
boat: '2',
|
||||
status: 'pending',
|
||||
},
|
||||
{
|
||||
@@ -84,7 +84,7 @@ function getSampleReservations(): Reservation[] {
|
||||
user: 'Heather Graham',
|
||||
start: '09:00',
|
||||
end: '12:00',
|
||||
boat: 3,
|
||||
boat: '3',
|
||||
status: 'confirmed',
|
||||
},
|
||||
{
|
||||
@@ -92,7 +92,7 @@ function getSampleReservations(): Reservation[] {
|
||||
user: 'Lawrence Fishburne',
|
||||
start: '18:00',
|
||||
end: '21:00',
|
||||
boat: 3,
|
||||
boat: '3',
|
||||
},
|
||||
];
|
||||
const boatStore = useBoatStore();
|
||||
@@ -110,7 +110,7 @@ function getSampleReservations(): Reservation[] {
|
||||
};
|
||||
|
||||
return sampleData.map((entry): Reservation => {
|
||||
const boat = <Boat>boatStore.boats.find((b) => b.id == entry.boat);
|
||||
const boat = <Boat>boatStore.boats.find((b) => b.$id == entry.boat);
|
||||
return {
|
||||
id: entry.id,
|
||||
user: entry.user,
|
||||
@@ -131,17 +131,16 @@ export const useScheduleStore = defineStore('schedule', () => {
|
||||
const getTimeblocksForDate = (date: Date): Timeblock[] => timeblocks;
|
||||
|
||||
const getBoatReservations = (
|
||||
boat: number | string,
|
||||
curDate: Date
|
||||
searchDate: Date,
|
||||
boat?: string
|
||||
): Reservation[] => {
|
||||
return reservations.value.filter((x) => {
|
||||
return (
|
||||
(x.start.getDate() == curDate.getDate() ||
|
||||
x.end.getDate() == curDate.getDate()) &&
|
||||
x.resource != undefined &&
|
||||
(typeof boat == 'number'
|
||||
? x.resource.id == boat
|
||||
: x.resource.name == boat)
|
||||
((x.start.getDate() == searchDate.getDate() ||
|
||||
x.end.getDate() == searchDate.getDate()) && // Part of reservation falls on day
|
||||
x.resource != undefined && // A boat is defined
|
||||
!boat) ||
|
||||
x.resource.$id == boat // A specific boat has been passed, and matches
|
||||
);
|
||||
});
|
||||
};
|
||||
@@ -153,7 +152,7 @@ export const useScheduleStore = defineStore('schedule', () => {
|
||||
): Reservation[] => {
|
||||
const overlapped = reservations.value.filter(
|
||||
(entry: Reservation) =>
|
||||
entry.resource.id == resource.id &&
|
||||
entry.resource.$id == resource.$id &&
|
||||
entry.start < end &&
|
||||
entry.end > start
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user