|
@@ -20,74 +20,7 @@
|
|
|
<div style="width: 36px"></div>
|
|
<div style="width: 36px"></div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <div
|
|
|
|
|
- v-if="servicePackage.items.length === 0"
|
|
|
|
|
- class="q-px-md q-pt-md"
|
|
|
|
|
- >
|
|
|
|
|
- <q-card
|
|
|
|
|
- :flat="false"
|
|
|
|
|
- class="empty-card bg-surface shadow-card card-border"
|
|
|
|
|
- >
|
|
|
|
|
- <q-card-section class="column items-center text-center q-pa-lg">
|
|
|
|
|
- <q-icon
|
|
|
|
|
- color="grey-5"
|
|
|
|
|
- name="mdi-shopping-outline"
|
|
|
|
|
- size="42px"
|
|
|
|
|
- />
|
|
|
|
|
-
|
|
|
|
|
- <span class="font14 fontbold text-text q-mt-sm">
|
|
|
|
|
- {{ $t("service_package.empty_title") }}
|
|
|
|
|
- </span>
|
|
|
|
|
-
|
|
|
|
|
- <span class="font12 text-grey-7 q-mt-xs">
|
|
|
|
|
- {{ $t("service_package.empty_message") }}
|
|
|
|
|
- </span>
|
|
|
|
|
-
|
|
|
|
|
- <q-btn
|
|
|
|
|
- class="q-mt-md"
|
|
|
|
|
- color="primary"
|
|
|
|
|
- no-caps
|
|
|
|
|
- padding="8px 18px"
|
|
|
|
|
- rounded
|
|
|
|
|
- unelevated
|
|
|
|
|
- :label="$t('service_package.view_favorites')"
|
|
|
|
|
- @click="router.push({ name: 'ProfilePage' })"
|
|
|
|
|
- />
|
|
|
|
|
- </q-card-section>
|
|
|
|
|
- </q-card>
|
|
|
|
|
-
|
|
|
|
|
- <q-card
|
|
|
|
|
- v-if="servicePackage.lastCreatedGroup"
|
|
|
|
|
- :flat="false"
|
|
|
|
|
- class="created-card bg-surface shadow-card card-border q-mt-md"
|
|
|
|
|
- >
|
|
|
|
|
- <q-card-section class="q-pa-md">
|
|
|
|
|
- <div class="row items-center no-wrap">
|
|
|
|
|
- <q-icon
|
|
|
|
|
- color="positive"
|
|
|
|
|
- name="mdi-check-circle-outline"
|
|
|
|
|
- size="24px"
|
|
|
|
|
- />
|
|
|
|
|
-
|
|
|
|
|
- <div class="column q-ml-sm">
|
|
|
|
|
- <span class="font14 fontbold text-text">
|
|
|
|
|
- {{ $t("service_package.last_request_title") }}
|
|
|
|
|
- </span>
|
|
|
|
|
-
|
|
|
|
|
- <span class="font12 text-grey-7">
|
|
|
|
|
- {{
|
|
|
|
|
- $t("service_package.created_count", {
|
|
|
|
|
- count: servicePackage.lastCreatedGroup.schedule_ids.length,
|
|
|
|
|
- })
|
|
|
|
|
- }}
|
|
|
|
|
- </span>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </q-card-section>
|
|
|
|
|
- </q-card>
|
|
|
|
|
- </div>
|
|
|
|
|
-
|
|
|
|
|
- <template v-else>
|
|
|
|
|
|
|
+ <template v-if="servicePackage.items.length > 0">
|
|
|
<div class="q-px-md q-pt-md column q-gutter-y-sm">
|
|
<div class="q-px-md q-pt-md column q-gutter-y-sm">
|
|
|
<div class="service-package-discount-banner row items-center no-wrap q-pa-sm">
|
|
<div class="service-package-discount-banner row items-center no-wrap q-pa-sm">
|
|
|
<span class="font12 fontbold text-positive q-ml-sm">
|
|
<span class="font12 fontbold text-positive q-ml-sm">
|
|
@@ -300,13 +233,106 @@
|
|
|
</q-card>
|
|
</q-card>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
+
|
|
|
|
|
+ <DashboardClientProposals
|
|
|
|
|
+ v-if="schedulesProposals.length > 0"
|
|
|
|
|
+ :data="schedulesProposals"
|
|
|
|
|
+ class="q-pt-md"
|
|
|
|
|
+ @refresh-data="loadCustomRequests"
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
|
|
+ <div
|
|
|
|
|
+ v-if="pendingCustomRequests.length > 0"
|
|
|
|
|
+ class="q-px-md q-pt-md column q-gutter-y-sm"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div class="section-title gradient-diarista q-mb-sm font16 fontbold">
|
|
|
|
|
+ {{ $t("service_package.pending_custom_title") }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <CustomScheduleRequestCard
|
|
|
|
|
+ v-for="entry in pendingCustomRequests"
|
|
|
|
|
+ :key="entry.schedule.id"
|
|
|
|
|
+ :proposals-count="entry.proposalsCount"
|
|
|
|
|
+ :schedule="entry.schedule"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div
|
|
|
|
|
+ v-if="servicePackage.items.length === 0 && !hasPendingCustomRequests"
|
|
|
|
|
+ class="q-px-md q-pt-md"
|
|
|
|
|
+ >
|
|
|
|
|
+ <q-card
|
|
|
|
|
+ :flat="false"
|
|
|
|
|
+ class="empty-card bg-surface shadow-card card-border"
|
|
|
|
|
+ >
|
|
|
|
|
+ <q-card-section class="column items-center text-center q-pa-lg">
|
|
|
|
|
+ <q-icon
|
|
|
|
|
+ color="grey-5"
|
|
|
|
|
+ name="mdi-shopping-outline"
|
|
|
|
|
+ size="42px"
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
|
|
+ <span class="font14 fontbold text-text q-mt-sm">
|
|
|
|
|
+ {{ $t("service_package.empty_title") }}
|
|
|
|
|
+ </span>
|
|
|
|
|
+
|
|
|
|
|
+ <span class="font12 text-grey-7 q-mt-xs">
|
|
|
|
|
+ {{ $t("service_package.empty_message") }}
|
|
|
|
|
+ </span>
|
|
|
|
|
+
|
|
|
|
|
+ <q-btn
|
|
|
|
|
+ class="q-mt-md"
|
|
|
|
|
+ color="primary"
|
|
|
|
|
+ no-caps
|
|
|
|
|
+ padding="8px 18px"
|
|
|
|
|
+ rounded
|
|
|
|
|
+ unelevated
|
|
|
|
|
+ :label="$t('service_package.view_favorites')"
|
|
|
|
|
+ @click="router.push({ name: 'ProfilePage' })"
|
|
|
|
|
+ />
|
|
|
|
|
+ </q-card-section>
|
|
|
|
|
+ </q-card>
|
|
|
|
|
+
|
|
|
|
|
+ <q-card
|
|
|
|
|
+ v-if="servicePackage.lastCreatedGroup"
|
|
|
|
|
+ :flat="false"
|
|
|
|
|
+ class="created-card bg-surface shadow-card card-border q-mt-md"
|
|
|
|
|
+ >
|
|
|
|
|
+ <q-card-section class="q-pa-md">
|
|
|
|
|
+ <div class="row items-center no-wrap">
|
|
|
|
|
+ <q-icon
|
|
|
|
|
+ color="positive"
|
|
|
|
|
+ name="mdi-check-circle-outline"
|
|
|
|
|
+ size="24px"
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
|
|
+ <div class="column q-ml-sm">
|
|
|
|
|
+ <span class="font14 fontbold text-text">
|
|
|
|
|
+ {{ $t("service_package.last_request_title") }}
|
|
|
|
|
+ </span>
|
|
|
|
|
+
|
|
|
|
|
+ <span class="font12 text-grey-7">
|
|
|
|
|
+ {{
|
|
|
|
|
+ $t("service_package.created_count", {
|
|
|
|
|
+ count: servicePackage.lastCreatedGroup.schedule_ids.length,
|
|
|
|
|
+ })
|
|
|
|
|
+ }}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </q-card-section>
|
|
|
|
|
+ </q-card>
|
|
|
|
|
+ </div>
|
|
|
</q-page>
|
|
</q-page>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import { computed, onMounted, ref } from "vue";
|
|
import { computed, onMounted, ref } from "vue";
|
|
|
import SchedulingDialog from "src/pages/search/components/SchedulingDialog.vue";
|
|
import SchedulingDialog from "src/pages/search/components/SchedulingDialog.vue";
|
|
|
|
|
+import DashboardClientProposals from "src/pages/dashboard/components/DashboardClientProposals.vue";
|
|
|
|
|
+import CustomScheduleRequestCard from "src/pages/orders/components/CustomScheduleRequestCard.vue";
|
|
|
import { createScheduleServicePackage } from "src/api/servicePackage";
|
|
import { createScheduleServicePackage } from "src/api/servicePackage";
|
|
|
|
|
+import { dadosPedidosCliente } from "src/api/dashboard";
|
|
|
import { getAddresses } from "src/api/address";
|
|
import { getAddresses } from "src/api/address";
|
|
|
import { getProfileMediaUrl } from "src/helpers/profileMedia";
|
|
import { getProfileMediaUrl } from "src/helpers/profileMedia";
|
|
|
import { useI18n } from "vue-i18n";
|
|
import { useI18n } from "vue-i18n";
|
|
@@ -327,6 +353,42 @@ const store = userStore();
|
|
|
const addressLoading = ref(false);
|
|
const addressLoading = ref(false);
|
|
|
const primaryAddress = ref(null);
|
|
const primaryAddress = ref(null);
|
|
|
const submitting = ref(false);
|
|
const submitting = ref(false);
|
|
|
|
|
+const customSchedulesNoProposals = ref([]);
|
|
|
|
|
+const schedulesProposals = ref([]);
|
|
|
|
|
+
|
|
|
|
|
+const pendingCustomRequests = computed(() => {
|
|
|
|
|
+ const groups = new Map();
|
|
|
|
|
+
|
|
|
|
|
+ for (const schedule of customSchedulesNoProposals.value) {
|
|
|
|
|
+ groups.set(schedule.id, { schedule, proposalsCount: 0 });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ for (const item of schedulesProposals.value) {
|
|
|
|
|
+ const existing = groups.get(item.schedule_id);
|
|
|
|
|
+
|
|
|
|
|
+ if (existing) {
|
|
|
|
|
+ existing.proposalsCount += 1;
|
|
|
|
|
+
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ groups.set(item.schedule_id, {
|
|
|
|
|
+ schedule: {
|
|
|
|
|
+ id: item.schedule_id,
|
|
|
|
|
+ date: item.date,
|
|
|
|
|
+ start_time: item.start_time,
|
|
|
|
|
+ end_time: item.end_time,
|
|
|
|
|
+ address: item.address,
|
|
|
|
|
+ schedule_type: "custom",
|
|
|
|
|
+ },
|
|
|
|
|
+ proposalsCount: 1,
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return [...groups.values()];
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+const hasPendingCustomRequests = computed(() => pendingCustomRequests.value.length > 0);
|
|
|
|
|
|
|
|
const isValidFee = (fee) =>
|
|
const isValidFee = (fee) =>
|
|
|
fee !== null && fee !== undefined && Number.isFinite(Number(fee));
|
|
fee !== null && fee !== undefined && Number.isFinite(Number(fee));
|
|
@@ -606,9 +668,19 @@ const submitServicePackage = async () => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+const loadCustomRequests = async () => {
|
|
|
|
|
+ const response = await dadosPedidosCliente();
|
|
|
|
|
+
|
|
|
|
|
+ if (response) {
|
|
|
|
|
+ customSchedulesNoProposals.value = response.customSchedulesNoProposals ?? [];
|
|
|
|
|
+ schedulesProposals.value = response.schedulesProposals ?? [];
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
loadPrimaryAddress();
|
|
loadPrimaryAddress();
|
|
|
loadPlatformFees().catch(() => {});
|
|
loadPlatformFees().catch(() => {});
|
|
|
|
|
+ loadCustomRequests();
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|