Minor UI tweaks
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
class="col-lg-4 col-md-6 col-sm-8 col-xs-12">
|
class="col-lg-4 col-md-6 col-sm-8 col-xs-12">
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<div class="text-h5 q-mt-none q-mb-xs">
|
<div class="text-h5 q-mt-none q-mb-xs">
|
||||||
{{ reservation?.value ? 'Modify Booking' : 'New Booking' }}
|
{{ reservation ? 'Modify Booking' : 'New Booking' }}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-caption text-grey-8">for: {{ bookingName }}</div>
|
<div class="text-caption text-grey-8">for: {{ bookingName }}</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
@@ -98,11 +98,15 @@
|
|||||||
</q-item>
|
</q-item>
|
||||||
</q-list>
|
</q-list>
|
||||||
<q-card-actions align="right">
|
<q-card-actions align="right">
|
||||||
|
<q-btn
|
||||||
|
label="Delete"
|
||||||
|
color="negative"
|
||||||
|
v-if="reservation?.$id"
|
||||||
|
@click="onDelete" />
|
||||||
<q-btn
|
<q-btn
|
||||||
label="Reset"
|
label="Reset"
|
||||||
@click="onReset"
|
@click="onReset"
|
||||||
color="secondary"
|
color="secondary" />
|
||||||
size="md" />
|
|
||||||
<q-btn
|
<q-btn
|
||||||
label="Submit"
|
label="Submit"
|
||||||
@click="onSubmit"
|
@click="onSubmit"
|
||||||
@@ -112,7 +116,9 @@
|
|||||||
<q-dialog
|
<q-dialog
|
||||||
v-model="boatSelect"
|
v-model="boatSelect"
|
||||||
full-width>
|
full-width>
|
||||||
<BoatScheduleTableComponent v-model="bookingForm.interval" />
|
<BoatScheduleTableComponent
|
||||||
|
:model-value="bookingForm.interval"
|
||||||
|
@update:model-value="updateInterval" />
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -174,6 +180,11 @@ watch(reservation, (newReservation) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const updateInterval = (interval: Interval) => {
|
||||||
|
bookingForm.value.interval = interval;
|
||||||
|
boatSelect.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
const bookingDuration = computed((): { hours: number; minutes: number } => {
|
const bookingDuration = computed((): { hours: number; minutes: number } => {
|
||||||
if (bookingForm.value.interval?.start && bookingForm.value.interval?.end) {
|
if (bookingForm.value.interval?.start && bookingForm.value.interval?.end) {
|
||||||
const start = new Date(bookingForm.value.interval.start).getTime();
|
const start = new Date(bookingForm.value.interval.start).getTime();
|
||||||
@@ -195,6 +206,10 @@ const boat = computed((): Boat | null => {
|
|||||||
return boatStore.getBoatById(boatId);
|
return boatStore.getBoatById(boatId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const onDelete = () => {
|
||||||
|
reservationStore.deleteReservation(reservation.value?.id);
|
||||||
|
};
|
||||||
|
|
||||||
const onReset = () => {
|
const onReset = () => {
|
||||||
bookingForm.value.interval = null;
|
bookingForm.value.interval = null;
|
||||||
bookingForm.value = reservation.value
|
bookingForm.value = reservation.value
|
||||||
|
|||||||
@@ -7,16 +7,16 @@
|
|||||||
round
|
round
|
||||||
icon="menu"
|
icon="menu"
|
||||||
aria-label="Menu"
|
aria-label="Menu"
|
||||||
@click="toggleLeftDrawer"
|
@click="toggleLeftDrawer" />
|
||||||
/>
|
|
||||||
|
|
||||||
<q-toolbar-title> {{ pageTitle }} </q-toolbar-title>
|
<q-toolbar-title>{{ pageTitle }}</q-toolbar-title>
|
||||||
<q-tabs shrink>
|
<q-space />
|
||||||
<q-tab> </q-tab>
|
<div>v2024.6.3.2</div>
|
||||||
</q-tabs>
|
|
||||||
</q-toolbar>
|
</q-toolbar>
|
||||||
</q-header>
|
</q-header>
|
||||||
<LeftDrawer :drawer="leftDrawerOpen" @drawer-toggle="toggleLeftDrawer" />
|
<LeftDrawer
|
||||||
|
:drawer="leftDrawerOpen"
|
||||||
|
@drawer-toggle="toggleLeftDrawer" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
<q-btn
|
<q-btn
|
||||||
flat
|
flat
|
||||||
@click="cancelReservation()">
|
@click="cancelReservation()">
|
||||||
Cancel
|
Delete
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</q-card-actions>
|
</q-card-actions>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
:key="block.$id">
|
:key="block.$id">
|
||||||
<div
|
<div
|
||||||
class="timeblock"
|
class="timeblock"
|
||||||
|
:disabled="beforeNow(new Date(block.end))"
|
||||||
:class="selectedBlock?.$id === block.$id ? 'selected' : ''"
|
:class="selectedBlock?.$id === block.$id ? 'selected' : ''"
|
||||||
:style="
|
:style="
|
||||||
blockStyles(
|
blockStyles(
|
||||||
@@ -51,8 +52,7 @@
|
|||||||
)
|
)
|
||||||
"
|
"
|
||||||
:id="block.id"
|
:id="block.id"
|
||||||
@click="selectBlock($event, scope, block)"
|
@click="selectBlock($event, scope, block)">
|
||||||
v-close-popup>
|
|
||||||
{{ boats[scope.columnIndex].name }}
|
{{ boats[scope.columnIndex].name }}
|
||||||
<br />
|
<br />
|
||||||
{{
|
{{
|
||||||
@@ -96,7 +96,7 @@ import {
|
|||||||
} from '@quasar/quasar-ui-qcalendar';
|
} from '@quasar/quasar-ui-qcalendar';
|
||||||
import CalendarHeaderComponent from './CalendarHeaderComponent.vue';
|
import CalendarHeaderComponent from './CalendarHeaderComponent.vue';
|
||||||
|
|
||||||
import { ref, computed, onMounted } from 'vue';
|
import { ref, computed, onMounted, onUnmounted } from 'vue';
|
||||||
import { useBoatStore } from 'src/stores/boat';
|
import { useBoatStore } from 'src/stores/boat';
|
||||||
import { useAuthStore } from 'src/stores/auth';
|
import { useAuthStore } from 'src/stores/auth';
|
||||||
import { Interval, Reservation } from 'src/stores/schedule.types';
|
import { Interval, Reservation } from 'src/stores/schedule.types';
|
||||||
@@ -112,12 +112,19 @@ const selectedBlock = defineModel<Interval | null>();
|
|||||||
const selectedDate = ref(today());
|
const selectedDate = ref(today());
|
||||||
const { getAvailableIntervals } = useIntervalStore();
|
const { getAvailableIntervals } = useIntervalStore();
|
||||||
const calendar = ref<QCalendarDay | null>(null);
|
const calendar = ref<QCalendarDay | null>(null);
|
||||||
|
const now = ref(new Date());
|
||||||
|
let intervalId: string | number | NodeJS.Timeout | undefined;
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await useBoatStore().fetchBoats();
|
await useBoatStore().fetchBoats();
|
||||||
await intervalTemplateStore.fetchIntervalTemplates();
|
await intervalTemplateStore.fetchIntervalTemplates();
|
||||||
|
intervalId = setInterval(function () {
|
||||||
|
now.value = new Date();
|
||||||
|
}, 60000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => clearInterval(intervalId));
|
||||||
|
|
||||||
function handleSwipe({ ...event }) {
|
function handleSwipe({ ...event }) {
|
||||||
event.direction === 'right' ? calendar.value?.prev() : calendar.value?.next();
|
event.direction === 'right' ? calendar.value?.prev() : calendar.value?.next();
|
||||||
}
|
}
|
||||||
@@ -157,6 +164,10 @@ function getBoatDisplayName(scope: DayBodyScope) {
|
|||||||
: '';
|
: '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function beforeNow(time: Date) {
|
||||||
|
return time < now.value || null;
|
||||||
|
}
|
||||||
|
|
||||||
function genericBlockStyle(
|
function genericBlockStyle(
|
||||||
start: Timestamp,
|
start: Timestamp,
|
||||||
end: Timestamp,
|
end: Timestamp,
|
||||||
@@ -177,9 +188,6 @@ function genericBlockStyle(
|
|||||||
1 +
|
1 +
|
||||||
'px';
|
'px';
|
||||||
}
|
}
|
||||||
// if (selectedBlock.value?.id === block.id) {
|
|
||||||
// s.opacity = '1.0';
|
|
||||||
// }
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,11 +199,9 @@ interface DayBodyScope {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectBlock(event: MouseEvent, scope: DayBodyScope, block: Interval) {
|
function selectBlock(event: MouseEvent, scope: DayBodyScope, block: Interval) {
|
||||||
// TODO: Disable blocks before today with updateDisabled and/or comparison
|
if (scope.timestamp.disabled || new Date(block.end) < new Date())
|
||||||
if (scope.timestamp.disabled) return false;
|
return false;
|
||||||
selectedBlock.value === block
|
selectedBlock.value = block;
|
||||||
? (selectedBlock.value = null)
|
|
||||||
: (selectedBlock.value = block);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const boatReservations = computed((): Record<string, Reservation[]> => {
|
const boatReservations = computed((): Record<string, Reservation[]> => {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ import NavigationBar from 'src/components/scheduling/NavigationBar.vue';
|
|||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { formatTime } from 'src/utils/schedule';
|
import { formatTime } from 'src/utils/schedule';
|
||||||
import { useIntervalStore } from 'src/stores/interval';
|
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 { useRouter } from 'vue-router';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
@@ -78,6 +78,7 @@ const $q = useQuasar();
|
|||||||
const $router = useRouter();
|
const $router = useRouter();
|
||||||
const { getAvailableIntervals } = useIntervalStore();
|
const { getAvailableIntervals } = useIntervalStore();
|
||||||
const { selectedDate } = storeToRefs(useIntervalStore());
|
const { selectedDate } = storeToRefs(useIntervalStore());
|
||||||
|
const currentUser = useAuthStore().currentUser;
|
||||||
|
|
||||||
// interface DayScope {
|
// interface DayScope {
|
||||||
// timestamp: Timestamp;
|
// timestamp: Timestamp;
|
||||||
@@ -115,11 +116,19 @@ const getSortedIntervals = (timestamp: Timestamp, boat?: Boat): Interval[] => {
|
|||||||
// return s;
|
// return s;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
const createReservationFromInterval = (interval: Interval) => {
|
const createReservationFromInterval = (interval: Interval | Reservation) => {
|
||||||
$router.push({
|
if (interval.user) {
|
||||||
name: 'reserve-boat',
|
if (interval.user === currentUser?.$id) {
|
||||||
query: { interval: interval.$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 }) {
|
function handleSwipe({ ...event }) {
|
||||||
|
|||||||
Reference in New Issue
Block a user