Compare commits

3 Commits

Author SHA1 Message Date
97481a5d2e Disable not ready stuff
All checks were successful
Build BAB Application Deployment Artifact / build (push) Successful in 1m58s
2024-05-17 21:50:38 -04:00
369bbc4960 Remove conflicting blocks 2024-05-17 21:41:11 -04:00
c3ee739366 Small tweak to handle swapped dates 2024-05-17 20:56:18 -04:00
8 changed files with 31 additions and 56 deletions

View File

@@ -7,7 +7,7 @@
icon="calendar_month" icon="calendar_month"
to="/schedule" to="/schedule"
></q-route-tab> ></q-route-tab>
<q-route-tab <!-- <q-route-tab
name="Checklists" name="Checklists"
icon="checklist" icon="checklist"
to="/checklist" to="/checklist"
@@ -19,7 +19,7 @@
></q-route-tab> ></q-route-tab>
<q-route-tab name="Tasks" icon="build" to="/task"> <q-route-tab name="Tasks" icon="build" to="/task">
<q-badge color="red" floating> NEW </q-badge> <q-badge color="red" floating> NEW </q-badge>
</q-route-tab> </q-route-tab> -->
</q-tabs> </q-tabs>
</template> </template>

View File

@@ -8,7 +8,7 @@
> >
<q-scroll-area class="fit"> <q-scroll-area class="fit">
<q-list padding class="menu-list"> <q-list padding class="menu-list">
<template v-for="link in links" :key="link.name"> <template v-for="link in enabledLinks" :key="link.name">
<q-item clickable v-ripple :to="link.to"> <q-item clickable v-ripple :to="link.to">
<q-item-section avatar> <q-item-section avatar>
<q-icon :name="link.icon" /> <q-icon :name="link.icon" />
@@ -28,7 +28,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import { links } from 'src/router/navlinks.js'; import { enabledLinks } from 'src/router/navlinks.js';
import { logout } from 'boot/appwrite'; import { logout } from 'boot/appwrite';
defineProps(['drawer']); defineProps(['drawer']);

View File

@@ -12,12 +12,12 @@
<q-separator /> <q-separator />
<q-card-actions align="evenly"> <!-- <q-card-actions align="evenly">
<q-btn flat>Info</q-btn> <q-btn flat>Info</q-btn>
<q-btn flat>Book</q-btn> <q-btn flat>Book</q-btn>
<q-btn flat>Check-Out</q-btn> <q-btn flat>Check-Out</q-btn>
<q-btn flat>Check-In</q-btn> <q-btn flat>Check-In</q-btn>
</q-card-actions> </q-card-actions> -->
</q-card> </q-card>
</div> </div>
<div v-else><q-card>Sorry, no boats to show you!</q-card></div> <div v-else><q-card>Sorry, no boats to show you!</q-card></div>

View File

@@ -177,9 +177,16 @@ function selectBlock(event: MouseEvent, scope: DayBodyScope, block: Interval) {
const boatBlocks = computed((): Record<string, Interval[]> => { const boatBlocks = computed((): Record<string, Interval[]> => {
return scheduleStore return scheduleStore
.getIntervalsForDate(selectedDate.value) .getIntervalsForDate(selectedDate.value)
.reduce((result, tb) => { .reduce((result, interval) => {
if (!result[tb.boatId]) result[tb.boatId] = []; if (!result[interval.boatId]) result[interval.boatId] = [];
result[tb.boatId].push(tb); if (
!reservationStore.isResourceTimeOverlapped(
interval.boatId,
new Date(interval.start),
new Date(interval.end)
)
)
result[interval.boatId].push(interval);
return result; return result;
}, <Record<string, Interval[]>>{}); }, <Record<string, Interval[]>>{});
}); });
@@ -203,34 +210,6 @@ function getBoatReservations(scope: DayBodyScope): Reservation[] {
return boat ? boatReservations.value[boat.$id] : []; return boat ? boatReservations.value[boat.$id] : [];
} }
// function changeEvent({ start }: { start: string }) {
// const newBlocks = scheduleStore.getIntervalsForDate(start);
// const reservations = scheduleStore.getReservationsByDate(
// parsed(start) as Timestamp
// );
// boats.value.map((boat) => {
// boat.reservations = reservations.filter(
// (reservation) => reservation.resource === boat
// );
// boat.blocks = newBlocks.filter(
// (block) =>
// block.boatId === boat.$id &&
// boat.reservations?.filter(
// (r: Reservation) =>
// r.start <
// date.addToDate(makeDateTime(parsed(block.end) as Timestamp), {
// hours: 4,
// }) &&
// r.end >
// date.addToDate(makeDateTime(parsed(block.start) as Timestamp), {
// hours: 4,
// })
// ).length == 0
// );
// });
// setTimeout(() => calendar.value?.scrollToTime('09:00'), 100); // Should figure out why we need this setTimeout...
// }
const disabledBefore = computed(() => { const disabledBefore = computed(() => {
const todayTs = parseTimestamp(today()) as Timestamp; const todayTs = parseTimestamp(today()) as Timestamp;
return addToDate(todayTs, { day: -1 }).date; return addToDate(todayTs, { day: -1 }).date;

View File

@@ -4,7 +4,7 @@
<q-img alt="OYS Logo" src="~assets/oysqn_logo.png" fit="scale-down" /> <q-img alt="OYS Logo" src="~assets/oysqn_logo.png" fit="scale-down" />
<q-list class="full-width mobile-only"> <q-list class="full-width mobile-only">
<q-item <q-item
v-for="link in links.filter((x) => x.front_links)" v-for="link in enabledLinks.filter((x) => x.front_links)"
:key="link.name" :key="link.name"
> >
<q-btn <q-btn
@@ -23,6 +23,6 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { links } from 'src/router/navlinks.js'; import { enabledLinks } from 'src/router/navlinks.js';
import ToolbarComponent from 'components/ToolbarComponent.vue'; import ToolbarComponent from 'components/ToolbarComponent.vue';
</script> </script>

View File

@@ -4,47 +4,57 @@ export const links = [
to: '/', to: '/',
icon: 'home', icon: 'home',
front_links: false, front_links: false,
enabled: true,
}, },
{ {
name: 'Profile', name: 'Profile',
to: '/profile', to: '/profile',
icon: 'account_circle', icon: 'account_circle',
front_links: false, front_links: false,
enabled: false,
}, },
{ {
name: 'Boats', name: 'Boats',
to: '/boat', to: '/boat',
icon: 'sailing', icon: 'sailing',
front_links: true, front_links: true,
enabled: true,
}, },
{ {
name: 'Schedule', name: 'Schedule',
to: '/schedule', to: '/schedule',
icon: 'calendar_month', icon: 'calendar_month',
front_links: true, front_links: true,
enabled: true,
}, },
{ {
name: 'Certifications', name: 'Certifications',
to: '/certification', to: '/certification',
icon: 'verified', icon: 'verified',
front_links: true, front_links: true,
enabled: false,
}, },
{ {
name: 'Checklists', name: 'Checklists',
to: '/checklist', to: '/checklist',
icon: 'checklist', icon: 'checklist',
front_links: true, front_links: true,
enabled: false,
}, },
{ {
name: 'Reference', name: 'Reference',
to: '/reference', to: '/reference',
icon: 'info_outline', icon: 'info_outline',
front_links: true, front_links: true,
enabled: false,
}, },
{ {
name: 'Tasks', name: 'Tasks',
to: '/task', to: '/task',
icon: 'build', icon: 'build',
front_links: true, front_links: true,
enabled: false,
}, },
]; ];
export const enabledLinks = links.filter((link) => link.enabled);

View File

@@ -16,8 +16,9 @@ export const useReservationStore = defineStore('reservation', () => {
start: string = today(), start: string = today(),
end: string = start end: string = start
) => { ) => {
const startDate = new Date(start + 'T00:00'); const startDate = new Date(start < end ? start : end + 'T00:00');
const endDate = new Date(end + 'T23:59'); const endDate = new Date(start < end ? end : start + 'T23:59');
if (getUnloadedDates(startDate, endDate).length === 0) return; if (getUnloadedDates(startDate, endDate).length === 0) return;
setDateLoaded(startDate, endDate, 'pending'); setDateLoaded(startDate, endDate, 'pending');

View File

@@ -135,21 +135,6 @@ export const useScheduleStore = defineStore('schedule', () => {
console.error('Failed to fetch timeblock templates', error); console.error('Failed to fetch timeblock templates', error);
} }
} }
// const getConflicts = (timeblock: Interval, boat: Boat) => {
// const start = date.buildDate({
// hour: timeblock.start.hour,
// minute: timeblock.start.minute,
// second: 0,
// millisecond: 0,
// });
// const end = date.buildDate({
// hour: timeblock.end.hour,
// minute: timeblock.end.minute,
// second: 0,
// millisecond: 0,
// });
// return scheduleStore.getConflictingReservations(boat, start, end);
// };
const createInterval = async (interval: Interval) => { const createInterval = async (interval: Interval) => {
try { try {