|
|
@@ -3,14 +3,7 @@
|
|
|
|
|
|
<!-- HEADER -->
|
|
|
<div class="page-header">
|
|
|
- <q-btn
|
|
|
- flat
|
|
|
- round
|
|
|
- dense
|
|
|
- icon="chevron_left"
|
|
|
- class="back-btn"
|
|
|
- @click="router.back()"
|
|
|
- />
|
|
|
+ <q-btn flat round dense icon="chevron_left" class="back-btn" @click="router.back()" />
|
|
|
<div class="page-title">
|
|
|
{{ $t('provider.dashboard.opportunity_details.title') }}
|
|
|
</div>
|
|
|
@@ -49,17 +42,12 @@
|
|
|
</span>
|
|
|
<br />
|
|
|
{{ $t('provider.dashboard.opportunity_details.para') }}
|
|
|
- <strong>{{ details.tags[0] }}</strong>
|
|
|
+ <!-- <strong>{{ details.tags[0] }}</strong> -->
|
|
|
</div>
|
|
|
|
|
|
<!-- TAGS -->
|
|
|
<div v-if="details.tags?.length" class="tags-row">
|
|
|
- <q-chip
|
|
|
- v-for="(tag, index) in details.tags"
|
|
|
- :key="index"
|
|
|
- outline
|
|
|
- class="chip"
|
|
|
- >
|
|
|
+ <q-chip v-for="(tag, index) in details.tags" :key="index" outline class="chip">
|
|
|
{{ tag }}
|
|
|
</q-chip>
|
|
|
</div>
|
|
|
@@ -75,14 +63,7 @@
|
|
|
</div>
|
|
|
|
|
|
<!-- BOTÃO -->
|
|
|
- <q-btn
|
|
|
- unelevated
|
|
|
- rounded
|
|
|
- no-caps
|
|
|
- class="accept-btn"
|
|
|
- :label="$t('provider.dashboard.opportunity_details.button_accept')"
|
|
|
- @click="goToProposalFlow"
|
|
|
- />
|
|
|
+ <q-btn unelevated rounded no-caps class="accept-btn" :label="$t('provider.dashboard.opportunity_details.button_accept')" @click="goToProposalFlow" />
|
|
|
|
|
|
<!-- ALERTA -->
|
|
|
<div class="alert-box">
|
|
|
@@ -98,51 +79,51 @@
|
|
|
<script setup>
|
|
|
import { ref, onMounted } from 'vue'
|
|
|
import { useRouter, useRoute } from 'vue-router'
|
|
|
-import { useI18n } from 'vue-i18n'
|
|
|
-import AvatarMock from 'src/assets/foto_diarista_login.svg'
|
|
|
-import { getOpportunityById } from 'src/api/opportunities'
|
|
|
+import { userStore } from 'src/stores/user'
|
|
|
+import { getOpportunityById, proposalOpportunity } from 'src/api/opportunities'
|
|
|
+
|
|
|
|
|
|
const router = useRouter()
|
|
|
const route = useRoute()
|
|
|
-const { t } = useI18n()
|
|
|
|
|
|
+const user = userStore()
|
|
|
const details = ref(null)
|
|
|
const loading = ref(true)
|
|
|
|
|
|
-const formatHour = (time) =>
|
|
|
- time ? time.slice(0, 5).replace(':', 'h') : ''
|
|
|
+// const formatHour = (time) =>
|
|
|
+// time ? time.slice(0, 5).replace(':', 'h') : ''
|
|
|
|
|
|
-const normalizeDetails = (item) => ({
|
|
|
- avatar: AvatarMock,
|
|
|
+// const normalizeDetails = (item) => ({
|
|
|
+// avatar: AvatarMock,
|
|
|
|
|
|
- clientName:
|
|
|
- item?.schedule?.client_name ||
|
|
|
- t('provider.dashboard.opportunity_details.client_default'),
|
|
|
+// clientName:
|
|
|
+// item?.schedule?.client_name ||
|
|
|
+// t('provider.dashboard.opportunity_details.client_default'),
|
|
|
|
|
|
- price: `R$ ${Number(item?.max_price || 0).toFixed(2)}`,
|
|
|
+// price: `R$ ${Number(item?.max_price || 0).toFixed(2)}`,
|
|
|
|
|
|
- date: item?.schedule?.date || '',
|
|
|
+// date: item?.schedule?.date || '',
|
|
|
|
|
|
- hour:
|
|
|
- item?.schedule?.start_time && item?.schedule?.end_time
|
|
|
- ? `Das ${formatHour(item.schedule.start_time)} às ${formatHour(item.schedule.end_time)}`
|
|
|
- : t('provider.dashboard.opportunity_details.hour_not_found'),
|
|
|
+// hour:
|
|
|
+// item?.schedule?.start_time && item?.schedule?.end_time
|
|
|
+// ? `Das ${formatHour(item.schedule.start_time)} às ${formatHour(item.schedule.end_time)}`
|
|
|
+// : t('provider.dashboard.opportunity_details.hour_not_found'),
|
|
|
|
|
|
- address:
|
|
|
- item?.schedule?.address?.address ||
|
|
|
- t('provider.dashboard.opportunity_details.address_not_found'),
|
|
|
+// address:
|
|
|
+// item?.schedule?.address?.address ||
|
|
|
+// t('provider.dashboard.opportunity_details.address_not_found'),
|
|
|
|
|
|
- distance:
|
|
|
- item?.distance
|
|
|
- ? `${item.distance} km`
|
|
|
- : t('provider.dashboard.opportunity_details.distance_default'),
|
|
|
+// distance:
|
|
|
+// item?.distance
|
|
|
+// ? `${item.distance} km`
|
|
|
+// : t('provider.dashboard.opportunity_details.distance_default'),
|
|
|
|
|
|
- tags: [item?.service_type_name].filter(Boolean),
|
|
|
+// tags: [item?.service_type_name].filter(Boolean),
|
|
|
|
|
|
- description:
|
|
|
- item?.description ||
|
|
|
- t('provider.dashboard.opportunity_details.description_not_found')
|
|
|
-})
|
|
|
+// description:
|
|
|
+// item?.description ||
|
|
|
+// t('provider.dashboard.opportunity_details.description_not_found')
|
|
|
+// })
|
|
|
|
|
|
onMounted(async () => {
|
|
|
try {
|
|
|
@@ -150,7 +131,7 @@ onMounted(async () => {
|
|
|
const response = await getOpportunityById(id)
|
|
|
|
|
|
if (response) {
|
|
|
- details.value = normalizeDetails(response)
|
|
|
+ details.value = response
|
|
|
} else {
|
|
|
console.warn('Nenhum dado retornado')
|
|
|
}
|
|
|
@@ -161,8 +142,10 @@ onMounted(async () => {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
-const goToProposalFlow = () => {
|
|
|
- console.log('Ir para proposta', details.value)
|
|
|
+const goToProposalFlow = async () => {
|
|
|
+
|
|
|
+ await proposalOpportunity(details.value.schedule_id, user.user.provider.id)
|
|
|
+ router.push({ name: 'DashboardPage' })
|
|
|
}
|
|
|
</script>
|
|
|
|