Updates to selection component
Some checks failed
Build BAB Application Deployment Artifact / build (push) Failing after 2m27s

This commit is contained in:
2023-12-29 09:22:28 -05:00
parent 66e2169f45
commit cd6f2e3ba2

View File

@@ -1,8 +1,8 @@
<template> <template>
<q-card-section style="max-width: 320px"> <q-card-section style="max-width: 320px">
<div class="text-caption text-justify"> <div class="text-caption">
Use the calendar to pick a date. Tap a box in the grid for the boat and Use the calendar to pick a date. Select an available boat and timeslot
start time. Select the duration below. below.
</div> </div>
<div <div
style=" style="
@@ -48,6 +48,7 @@
ref="calendar" ref="calendar"
v-model="selectedDate" v-model="selectedDate"
:disabled-before="disabledBefore" :disabled-before="disabledBefore"
:disabled-days="disabledDays()"
animated animated
bordered bordered
mini-mode mini-mode
@@ -70,7 +71,9 @@
<template v-slot:label="opt"> <template v-slot:label="opt">
<div class="row items-center"> <div class="row items-center">
{{ opt.label }} &nbsp; {{ opt.label }} &nbsp;
<span v-if="opt.disable">Reserved by {{ opt.user }}</span> <span class="text-caption" v-if="opt.disable"
>Reserved by {{ opt.user }}</span
>
</div></template </div></template
> >
</q-option-group> </q-option-group>
@@ -84,7 +87,7 @@
import { ref } from 'vue'; import { ref } from 'vue';
import { import {
today, today,
parsed, parseTimestamp,
addToDate, addToDate,
Timestamp, Timestamp,
} from '@quasar/quasar-ui-qcalendar'; } from '@quasar/quasar-ui-qcalendar';
@@ -115,7 +118,7 @@ const formattedMonth = computed(() => {
}); });
const disabledBefore = computed(() => { const disabledBefore = computed(() => {
const todayTs = parsed(today()) as Timestamp; const todayTs = parseTimestamp(today()) as Timestamp;
return addToDate(todayTs, { day: -1 }).date; return addToDate(todayTs, { day: -1 }).date;
}); });
@@ -134,6 +137,14 @@ function monthFormatter() {
} }
} }
const disabledDays = () => {
// Placeholder. This should actually compute days when boats aren't available.
const days = [];
const todayTs = parseTimestamp(today()) as Timestamp;
days.push(addToDate(todayTs, { day: 2 }).date);
return days;
};
const boatoptions = (boat: Boat) => { const boatoptions = (boat: Boat) => {
const options = useScheduleStore() const options = useScheduleStore()
.getTimeblocksForDate(date.extractDate(selectedDate.value, 'YYYY-MM-DD')) .getTimeblocksForDate(date.extractDate(selectedDate.value, 'YYYY-MM-DD'))