Quellcode durchsuchen

feat: redireciona e abre dealhes do agendamento no bloco servicos do dia

Gustavo Zanatta vor 1 Woche
Ursprung
Commit
39d77bd90e

+ 2 - 1
src/components/dashboard/DashboardTodaySchedules.vue

@@ -17,6 +17,7 @@
           :key="item.id"
           :flat="false"
           class="today-card card-border shadow-card bg-surface"
+          @click="emit('view-details', item)"
         >
           <q-card-section class="q-pa-md">
             <div class="row no-wrap items-start q-mb-xs">
@@ -255,7 +256,7 @@ const props = defineProps({
 
 
 
-const emit = defineEmits(["rate"]);
+const emit = defineEmits(["rate", "view-details"]);
 
 const $q = useQuasar();
 

+ 20 - 2
src/pages/agenda/CalendarPage.vue

@@ -313,11 +313,11 @@ import {
   getScheduleTotalWithPlatformFee,
 } from "src/helpers/paymentPlatformFees";
 
-import { onMounted, ref } from "vue";
+import { nextTick, onMounted, ref } from "vue";
 import { useI18n } from "vue-i18n";
 import { usePaymentPlatformFees } from "src/composables/usePaymentPlatformFees";
 import { useQuasar } from "quasar";
-import { useRouter } from "vue-router";
+import { useRoute, useRouter } from "vue-router";
 
 import NextSchedulesDetailsDialog from "src/pages/dashboard/components/schedule/NextSchedulesDetailsDialog.vue";
 import ScheduleRatingDialog from "src/pages/dashboard/components/schedule/ScheduleRatingDialog.vue";
@@ -325,6 +325,7 @@ import SchedulingDialog from "src/pages/search/components/SchedulingDialog.vue";
 
 const $q = useQuasar();
 const { platformFees, loadPlatformFees } = usePaymentPlatformFees();
+const route = useRoute();
 const router = useRouter();
 const { t } = useI18n();
 
@@ -432,9 +433,26 @@ const statusTextColor = (status) => {
   return map[status] ?? "text";
 };
 
+const openScheduleFromQuery = async () => {
+  const scheduleId = Number(route.query.scheduleId);
+
+  if (!scheduleId) return;
+
+  await router.replace({ path: route.path, query: {} });
+  await nextTick();
+
+  const schedule = [...upcomingSchedules.value, ...completedSchedules.value].find(
+    (item) => item.id === scheduleId,
+  );
+
+  if (schedule) openDetailsDialog(schedule);
+};
+
 onMounted(async () => {
   await Promise.all([loadCalendar(), loadPlatformFees().catch(() => {})]);
   loading.value = false;
+
+  await openScheduleFromQuery();
 });
 
 </script>

+ 13 - 1
src/pages/dashboard/DashboardPage.vue

@@ -41,7 +41,12 @@
           @view-details="openPackageDetailsDialog"
         />
 
-        <DashboardTodaySchedules v-if="todaySchedules.length > 0" :data="todaySchedules" @rate="openRatingDialog" />
+        <DashboardTodaySchedules
+          v-if="todaySchedules.length > 0"
+          :data="todaySchedules"
+          @rate="openRatingDialog"
+          @view-details="openScheduleOnCalendar"
+        />
 
         <DashboardScrollAreaSchedules />
 
@@ -267,6 +272,13 @@ const openNextScheduleDialog = (schedule) => {
   });
 };
 
+const openScheduleOnCalendar = (schedule) => {
+  router.push({
+    name: 'CalendarPage',
+    query: { scheduleId: schedule.id },
+  });
+};
+
 const openRatingDialog = (schedule) => {
   $q.dialog({
     component: ScheduleRatingDialog,