Minor UI tweaks

This commit is contained in:
2024-06-03 23:04:32 -04:00
parent c3098b073f
commit 947b463fe2
5 changed files with 59 additions and 29 deletions

View File

@@ -68,7 +68,7 @@ import NavigationBar from 'src/components/scheduling/NavigationBar.vue';
import { useQuasar } from 'quasar';
import { formatTime } from 'src/utils/schedule';
import { useIntervalStore } from 'src/stores/interval';
import { Interval } from 'src/stores/schedule.types';
import { Interval, Reservation } from 'src/stores/schedule.types';
import { useRouter } from 'vue-router';
import { storeToRefs } from 'pinia';
@@ -78,6 +78,7 @@ const $q = useQuasar();
const $router = useRouter();
const { getAvailableIntervals } = useIntervalStore();
const { selectedDate } = storeToRefs(useIntervalStore());
const currentUser = useAuthStore().currentUser;
// interface DayScope {
// timestamp: Timestamp;
@@ -115,11 +116,19 @@ const getSortedIntervals = (timestamp: Timestamp, boat?: Boat): Interval[] => {
// return s;
// }
const createReservationFromInterval = (interval: Interval) => {
$router.push({
name: 'reserve-boat',
query: { interval: interval.$id },
});
const createReservationFromInterval = (interval: Interval | Reservation) => {
if (interval.user) {
if (interval.user === currentUser?.$id) {
$router.push({ name: 'edit-reservation', params: { id: interval.$id } });
} else {
return false;
}
} else {
$router.push({
name: 'reserve-boat',
query: { interval: interval.$id },
});
}
};
function handleSwipe({ ...event }) {