diff --git a/src/boot/appwrite.ts b/src/boot/appwrite.ts index e84a8b1..1233fa5 100644 --- a/src/boot/appwrite.ts +++ b/src/boot/appwrite.ts @@ -37,13 +37,13 @@ const AppwriteIds = process.env.DEV ? { databaseId: '65ee1cbf9c2493faf15f', collection: { - boat: '66341910003e287cd71c', - reservation: '663f8847000b8f5e29bb', - skillTags: '66072582a74d94a4bd01', - task: '65ee1cd5b550023fae4f', - taskTags: '65ee21d72d5c8007c34c', - interval: '66361869002883fb4c4b', - intervalTemplate: '66361f480007fdd639af', + boat: 'boat', + reservation: 'reservation', + skillTags: 'skillTags', + task: 'task', + taskTags: 'taskTags', + interval: 'interval', + intervalTemplate: 'intervalTemplate', }, function: { userinfo: 'userinfo', diff --git a/src/components/BoatReservationComponent.vue b/src/components/BoatReservationComponent.vue index db27e48..695586b 100644 --- a/src/components/BoatReservationComponent.vue +++ b/src/components/BoatReservationComponent.vue @@ -166,7 +166,7 @@ watch(reservation, (newReservation) => { interval: { start: newReservation.start, end: newReservation.end, - boatId: newReservation.resource, + resource: newReservation.resource, }, }; bookingForm.value = updatedReservation; @@ -190,7 +190,7 @@ const bookingName = computed(() => ); const boat = computed((): Boat | null => { - const boatId = bookingForm.value.interval?.boatId; + const boatId = bookingForm.value.interval?.resource; console.log('Boat Lookup:', boatId); return boatStore.getBoatById(boatId); }); @@ -203,18 +203,18 @@ const onReset = () => { interval: { start: reservation.value.start, end: reservation.value.end, - boatId: reservation.value.resource, + resource: reservation.value.resource, }, } : { ...newForm }; }; -const onSubmit = () => { +const onSubmit = async () => { const booking = bookingForm.value; if ( !( booking.interval && - booking.interval.boatId && + booking.interval.resource && booking.interval.start && booking.interval.end && auth.currentUser @@ -224,7 +224,7 @@ const onSubmit = () => { return; } const reservation = { - resource: booking.interval.boatId, + resource: booking.interval.resource, start: booking.interval.start, end: booking.interval.end, user: auth.currentUser.$id, @@ -232,15 +232,34 @@ const onSubmit = () => { reason: booking.reason, comment: booking.comment, }; - // TODO: Fix this. It will always look successful - reservationStore.createReservation(reservation); // Probably should pass the notify as a callback to the reservation creation. - $q.notify({ - color: 'green-4', + const status = $q.notify({ + color: 'secondary', textColor: 'white', - icon: 'cloud_done', - message: 'Submitted', - timeout: 3000, + message: 'Submitting Reservation', + spinner: true, + closeBtn: 'Dismiss', + position: 'top', + timeout: 0, + group: false, }); + try { + const r = await reservationStore.createReservation(reservation); + status({ + color: 'positive', + icon: 'cloud_done', + message: `Booking successful: ${ + boatStore.getBoatById(r.resource)?.name + } at ${formatDate(r.start)}`, + spinner: false, + }); + } catch (e) { + status({ + color: 'negative', + icon: 'error', + spinner: false, + message: 'Failed to book!' + e, + }); + } router.go(-1); }; diff --git a/src/components/LeftDrawer.vue b/src/components/LeftDrawer.vue index d4d8bcb..e8c28a0 100644 --- a/src/components/LeftDrawer.vue +++ b/src/components/LeftDrawer.vue @@ -21,7 +21,11 @@ - {{ link.name }} + + + {{ link.name }} + +
- {{ sublink.name }} + + + {{ sublink.name }} + +
diff --git a/src/components/scheduling/IntervalTemplateComponent.vue b/src/components/scheduling/IntervalTemplateComponent.vue index 4ceab50..5014832 100644 --- a/src/components/scheduling/IntervalTemplateComponent.vue +++ b/src/components/scheduling/IntervalTemplateComponent.vue @@ -3,8 +3,7 @@ expand-icon-toggle draggable="true" @dragstart="onDragStart($event, template)" - v-model="expanded" - > + v-model="expanded"> - + + :readonly="!edit"> + @click="template.timeTuples.splice(index, 1)" /> + + + + + @click="template.timeTuples.push(['00:00', '00:00'])" /> + + @click="toggleEdit" /> + @click="saveTemplate($event, template)" /> + @click="revert" /> + @click="deleteTemplate($event, template)" /> @@ -101,25 +101,29 @@ square icon="schedule" v-for="item in overlapped" - :key="item.start" - > - {{ item.start }}-{{ item.end }} + :key="item.start"> + {{ item.start }}-{{ item.end }} + - - + + + + - - diff --git a/src/pages/schedule/ListReservationsPage.vue b/src/pages/schedule/ListReservationsPage.vue index 353d077..27f99ab 100644 --- a/src/pages/schedule/ListReservationsPage.vue +++ b/src/pages/schedule/ListReservationsPage.vue @@ -22,7 +22,7 @@ class="q-pa-none"> + v-if="!futureUserReservations.length">
You don't have any upcoming bookings!
Why don't you go make one?
@@ -41,7 +41,7 @@
@@ -51,7 +51,7 @@ name="past" class="q-pa-none">
@@ -63,7 +63,9 @@ import { useReservationStore } from 'src/stores/reservation'; import ReservationCardComponent from 'src/components/scheduling/ReservationCardComponent.vue'; import { ref } from 'vue'; -const reservationStore = useReservationStore(); +const { sortedUserReservations, futureUserReservations, pastUserReservations } = + useReservationStore(); + const tab = ref('upcoming'); // const showMarker = ( diff --git a/src/pages/schedule/ManageCalendar.vue b/src/pages/schedule/ManageCalendar.vue index 4eddfd7..72e689f 100644 --- a/src/pages/schedule/ManageCalendar.vue +++ b/src/pages/schedule/ManageCalendar.vue @@ -1,8 +1,13 @@