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

View File

@@ -8,7 +8,7 @@
>
<q-scroll-area class="fit">
<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-section avatar>
<q-icon :name="link.icon" />
@@ -28,7 +28,7 @@
<script lang="ts" setup>
import { defineComponent } from 'vue';
import { links } from 'src/router/navlinks.js';
import { enabledLinks } from 'src/router/navlinks.js';
import { logout } from 'boot/appwrite';
defineProps(['drawer']);

View File

@@ -12,12 +12,12 @@
<q-separator />
<q-card-actions align="evenly">
<!-- <q-card-actions align="evenly">
<q-btn flat>Info</q-btn>
<q-btn flat>Book</q-btn>
<q-btn flat>Check-Out</q-btn>
<q-btn flat>Check-In</q-btn>
</q-card-actions>
</q-card-actions> -->
</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[]> => {
return scheduleStore
.getIntervalsForDate(selectedDate.value)
.reduce((result, tb) => {
if (!result[tb.boatId]) result[tb.boatId] = [];
result[tb.boatId].push(tb);
.reduce((result, interval) => {
if (!result[interval.boatId]) result[interval.boatId] = [];
if (
!reservationStore.isResourceTimeOverlapped(
interval.boatId,
new Date(interval.start),
new Date(interval.end)
)
)
result[interval.boatId].push(interval);
return result;
}, <Record<string, Interval[]>>{});
});
@@ -203,34 +210,6 @@ function getBoatReservations(scope: DayBodyScope): Reservation[] {
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 todayTs = parseTimestamp(today()) as Timestamp;
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-list class="full-width mobile-only">
<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"
>
<q-btn
@@ -23,6 +23,6 @@
</template>
<script lang="ts" setup>
import { links } from 'src/router/navlinks.js';
import { enabledLinks } from 'src/router/navlinks.js';
import ToolbarComponent from 'components/ToolbarComponent.vue';
</script>

View File

@@ -4,47 +4,57 @@ export const links = [
to: '/',
icon: 'home',
front_links: false,
enabled: true,
},
{
name: 'Profile',
to: '/profile',
icon: 'account_circle',
front_links: false,
enabled: false,
},
{
name: 'Boats',
to: '/boat',
icon: 'sailing',
front_links: true,
enabled: true,
},
{
name: 'Schedule',
to: '/schedule',
icon: 'calendar_month',
front_links: true,
enabled: true,
},
{
name: 'Certifications',
to: '/certification',
icon: 'verified',
front_links: true,
enabled: false,
},
{
name: 'Checklists',
to: '/checklist',
icon: 'checklist',
front_links: true,
enabled: false,
},
{
name: 'Reference',
to: '/reference',
icon: 'info_outline',
front_links: true,
enabled: false,
},
{
name: 'Tasks',
to: '/task',
icon: 'build',
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(),
end: string = start
) => {
const startDate = new Date(start + 'T00:00');
const endDate = new Date(end + 'T23:59');
const startDate = new Date(start < end ? start : end + 'T00:00');
const endDate = new Date(start < end ? end : start + 'T23:59');
if (getUnloadedDates(startDate, endDate).length === 0) return;
setDateLoaded(startDate, endDate, 'pending');

View File

@@ -135,21 +135,6 @@ export const useScheduleStore = defineStore('schedule', () => {
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) => {
try {