| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <template>
- <div class="dashboard-page bg-page">
- <template v-if="loading">
- <div class="row items-center justify-center full-width bg-surface" style="height: 80vh">
- <q-spinner-dots color="primary" />
- </div>
- </template>
- <template v-else>
- <DashboardHeaderBar :data="headerBar" />
- <DashboardSummaryInfos :data="summaryInfos" />
- <DashboardPendingSchedules
- v-if="pendingSchedules.length > 0"
- :data="pendingSchedules"
- @view-details="openAcceptedDialog"
- />
- <DashboardScrollAreaSchedules />
- <DashboardClientProposals />
- <DashboardPendingCustomSchedules />
- <DashboardNextSchedules v-if="nextSchedules.length > 0" :data="nextSchedules" />
- <DashboardLastDoneSchedules v-if="lastDoneSchedules.length > 0" :data="lastDoneSchedules" />
- <DashboardFavoriteProviders v-if="favoriteProviders.length > 0" :data="favoriteProviders" />
- <DashboardProvidersClose v-if="providersClose.length > 0" :data="providersClose" />
- </template>
- </div>
- </template>
- <script setup>
- import DashboardHeaderBar from 'src/components/dashboard/DashboardHeaderBar.vue';
- import DashboardSummaryInfos from 'src/components/dashboard/DashboardSummaryInfos.vue';
- import DashboardPendingSchedules from 'src/components/dashboard/DashboardPendingSchedules.vue';
- import ScheduleAcceptedDialog from 'src/components/dashboard/ScheduleAcceptedDialog.vue';
- import DashboardScrollAreaSchedules from 'src/components/dashboard/DashboardScrollAreaSchedules.vue';
- import DashboardNextSchedules from 'src/components/dashboard/DashboardNextSchedules.vue';
- import DashboardLastDoneSchedules from 'src/components/dashboard/DashboardLastDoneSchedules.vue';
- import DashboardFavoriteProviders from 'src/components/dashboard/DashboardFavoriteProviders.vue';
- import DashboardProvidersClose from 'src/components/dashboard/DashboardProvidersClose.vue';
- import FinalSuccesModal from '../schedules/components/FinalSuccesModal.vue';
- import DashboardPendingCustomSchedules from 'src/pages/dashboard/components/DashboardPendingCustomSchedules.vue';
- import DashboardClientProposals from 'src/pages/dashboard/components/DashboardClientProposals.vue';
- import { useRouter } from 'vue-router'
- import { onMounted, ref } from 'vue';
- import { useQuasar } from 'quasar';
- import { dadosDashboard } from 'src/api/dashboard';
- const router = useRouter()
- const headerBar = ref({});
- const summaryInfos = ref({});
- const pendingSchedules = ref([]);
- const nextSchedules = ref([]);
- const lastDoneSchedules = ref([]);
- const favoriteProviders = ref([]);
- const providersClose = ref([]);
- const $q = useQuasar();
- const loading = ref(true);
- const showSuccessModal = ref(router.currentRoute.value.fullPath.includes('showSuccessModal') || false);
- const openAcceptedDialog = (schedule) => {
- $q.dialog({
- component: ScheduleAcceptedDialog,
- componentProps: { schedule }
- }).onOk(() => {
- reloadDashboard();
- });
- };
- const reloadDashboard = async () => {
- loading.value = true;
- const response = await dadosDashboard();
- if (response) {
- headerBar.value = response.headerBar;
- summaryInfos.value = response.summaryInfos;
- pendingSchedules.value = response.pendingSchedules ?? [];
- nextSchedules.value = response.nextSchedules ?? [];
- lastDoneSchedules.value = response.lastDoneSchedules ?? [];
- favoriteProviders.value = response.favoriteProviders ?? [];
- providersClose.value = response.providersClose ?? [];
- DashboardClientProposals.value = response.DashboardClientProposals ?? [];
- }
- if( showSuccessModal.value ) {
- $q.dialog({
- component: FinalSuccesModal
- })
- showSuccessModal.value = false;
- }
- loading.value = false;
- };
- onMounted(async () => {
- await reloadDashboard();
- });
- </script>
- <style scoped>
- .dashboard-page {
- width: 100%;
- min-height: 100%;
- box-sizing: border-box;
- }
- </style>
|