|
|
@@ -1,71 +1,74 @@
|
|
|
-<!-- eslint-disable @intlify/vue-i18n/no-raw-text -->
|
|
|
<template>
|
|
|
<div class="q-mx-md q-mb-md">
|
|
|
- <div class="dashboard-section-title gradient-diarista q-mb-sm">Próximos serviços</div>
|
|
|
+ <div class="dashboard-section-title gradient-diarista q-mb-sm">{{ $t('dashboard_client.next_schedules.title') }}</div>
|
|
|
|
|
|
<div class="scroll-wrapper">
|
|
|
<div class="scroll-track">
|
|
|
<q-card
|
|
|
- v-for="item in items"
|
|
|
+ v-for="item in data"
|
|
|
:key="item.id"
|
|
|
class="schedule-card card-border shadow-card bg-surface"
|
|
|
+ :flat="false"
|
|
|
>
|
|
|
<q-card-section class="q-pa-md row col-12 no-wrap">
|
|
|
- <div class="col-3 column text-center">
|
|
|
- <div class="col-7">
|
|
|
- <q-avatar :style="item.avatarStyle" class="text-weight-bold q-mx-auto">
|
|
|
- {{ item.initials }}
|
|
|
- </q-avatar>
|
|
|
- </div>
|
|
|
- <div class="col-5 column justify-end">
|
|
|
- <span class="text-pill text-primary q-pb-xs">{{ item.tag }}</span>
|
|
|
- <span class="text-pill text-secondary">{{ item.tag2 }}</span>
|
|
|
- </div>
|
|
|
+ <div class="col-3 column text-center">
|
|
|
+ <div class="col-7">
|
|
|
+ <q-avatar :style="avatarColors[item.id % avatarColors.length]" class="text-weight-bold q-mx-auto">
|
|
|
+ {{ item.provider_name?.slice(0,1) ?? '—' }}
|
|
|
+ </q-avatar>
|
|
|
</div>
|
|
|
+ <div class="col-5 column justify-end">
|
|
|
+ <span class="text-pill text-primary">
|
|
|
+ {{ item.schedule_type === 'custom' ? $t('dashboard_client.next_schedules.custom') : $t('dashboard_client.next_schedules.default') }}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
-
|
|
|
- <div class="col-5 column text-text q-px-sm">
|
|
|
- <div class="col-7 column">
|
|
|
- <div class="col-4">
|
|
|
- <span class="text-provider-name">{{ item.name }}</span>
|
|
|
- </div>
|
|
|
- <div class="col-4 column">
|
|
|
- <div class="col-6">
|
|
|
- <span class="text-schedule-date-bold">{{ item.dateBold }}</span>
|
|
|
- <span class="text-schedule-date-regular">{{ item.dateRegular }}</span>
|
|
|
- </div>
|
|
|
- <div class="col-6 q-pt-sm">
|
|
|
- <span class="text-schedule-date-regular">{{ item.hourRegular }}</span>
|
|
|
- <span class="text-schedule-date-bold">{{ item.hourBold }}</span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <div class="col-5 column text-text q-px-sm">
|
|
|
+ <div class="col-7 column">
|
|
|
+ <div class="col-4">
|
|
|
+ <span class="text-provider-name">{{ item.provider_name ?? $t('dashboard_client.next_schedules.no_provider') }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="col-4 column">
|
|
|
+ <div class="col-6">
|
|
|
+ <span class="text-schedule-date-bold">{{ formatWeekday(item.date) }}</span><span class="text-schedule-date-regular">{{ ', ' + formatDayMonth(item.date) }}</span>
|
|
|
</div>
|
|
|
- <div class="col-5">
|
|
|
- <div class="full-height column justify-end">
|
|
|
- <div class="row text-pill-place">
|
|
|
- <q-icon :name="item.placeIcon" size="15px" color="primary"/>
|
|
|
- <div class="row items-end">{{ item.place }}</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <div class="col-6 q-pt-sm">
|
|
|
+ <span class="text-schedule-date-regular">{{ $t('dashboard_client.next_schedules.from') }} </span>
|
|
|
+ <span class="text-schedule-date-bold">{{ item.start_time?.slice(0,5) }} {{ $t('dashboard_client.next_schedules.to') }} {{ item.end_time?.slice(0,5) }}</span>
|
|
|
</div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="col-4 column text-text">
|
|
|
- <div class="column col-5">
|
|
|
- <span class="text-price-main col-6 q-mx-auto">{{ item.priceMain }}</span>
|
|
|
- <span class="text-price-label col-6 q-mx-auto">{{ item.priceLabel }}</span>
|
|
|
</div>
|
|
|
- <div class="col-7 column justify-end items-end">
|
|
|
- <q-btn
|
|
|
- unelevated rounded no-caps
|
|
|
- color="primary"
|
|
|
- padding="1px 5px"
|
|
|
- size="sm"
|
|
|
- class="full-width"
|
|
|
- label="ver detalhes"
|
|
|
- />
|
|
|
+ </div>
|
|
|
+ <div class="col-5">
|
|
|
+ <div class="full-height column justify-end">
|
|
|
+ <div class="row text-pill-place">
|
|
|
+ <q-icon :name="addressIcon(item.address_type)" size="15px" color="primary" />
|
|
|
+ <span class="row items-end">{{ addressLabel(item.address_type) }}</span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="col-4 column text-text">
|
|
|
+ <div class="column col-5">
|
|
|
+ <span class="text-price-main col-6 q-mx-auto">
|
|
|
+ {{ item.total_amount && item.total_amount !== '0.00' ? formatCurrency(item.total_amount) : $t('dashboard_client.next_schedules.to_combine') }}
|
|
|
+ </span>
|
|
|
+ <span class="text-price-label col-6 q-mx-auto">
|
|
|
+ {{ item.schedule_type === 'custom' ? $t('dashboard_client.next_schedules.tag_custom') : $t('dashboard_client.next_schedules.tag_default') }}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div class="col-7 column justify-end items-end">
|
|
|
+ <q-btn
|
|
|
+ unelevated rounded no-caps
|
|
|
+ color="primary"
|
|
|
+ padding="1px 5px"
|
|
|
+ size="sm"
|
|
|
+ class="full-width"
|
|
|
+ :label="$t('dashboard_client.next_schedules.details')"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</q-card-section>
|
|
|
</q-card>
|
|
|
</div>
|
|
|
@@ -74,48 +77,43 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-const items = [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- initials: 'F',
|
|
|
- name: 'Fátima',
|
|
|
- dateBold: 'Segunda-feira',
|
|
|
- dateRegular: ', 04/10',
|
|
|
- hourBold: ' 09h30 às 17h30',
|
|
|
- hourRegular: 'Das',
|
|
|
- priceLabel: 'integral (até 8h)',
|
|
|
- priceMain: 'R$245,00',
|
|
|
- tag: 'solicitação',
|
|
|
- tag2: 'sob medida',
|
|
|
- place: 'apartamento',
|
|
|
- placeIcon: 'mdi-home-map-marker',
|
|
|
- avatarStyle: { background: '#ffd5df', color: '#932e57' },
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- initials: 'S',
|
|
|
- name: 'Sandra',
|
|
|
- dateBold: 'Quarta-feira',
|
|
|
- dateRegular: ', 06/10',
|
|
|
- hourBold: ' 08h às 16h',
|
|
|
- hourRegular: 'Das',
|
|
|
- priceLabel: 'integral (até 8h)',
|
|
|
- priceMain: 'R$198,00',
|
|
|
- tag: 'solicitação',
|
|
|
- tag2: 'sob medida',
|
|
|
- place: 'casa',
|
|
|
- placeIcon: 'mdi-home-map-marker',
|
|
|
- avatarStyle: { background: '#d7e8ff', color: '#2158a8' },
|
|
|
- },
|
|
|
+import { useI18n } from 'vue-i18n';
|
|
|
+import { formatCurrency } from 'src/helpers/utils';
|
|
|
+
|
|
|
+defineProps({ data: { type: Array, default: () => [] } });
|
|
|
+
|
|
|
+const { t } = useI18n();
|
|
|
+
|
|
|
+const avatarColors = [
|
|
|
+ { background: '#ffd5df', color: '#932e57' },
|
|
|
+ { background: '#d7e8ff', color: '#2158a8' },
|
|
|
+ { background: '#dfd', color: '#2a7a3b' },
|
|
|
+ { background: '#ffe5cc', color: '#8a4500' },
|
|
|
];
|
|
|
-</script>
|
|
|
|
|
|
-<style scoped lang="scss">
|
|
|
+const formatWeekday = (iso) => {
|
|
|
+ if (!iso) return '';
|
|
|
+ const d = new Date(iso);
|
|
|
+ const w = d.toLocaleDateString('pt-BR', { weekday: 'long' });
|
|
|
+ return w.charAt(0).toUpperCase() + w.slice(1);
|
|
|
+};
|
|
|
|
|
|
-.scroll-wrapper {
|
|
|
- overflow: hidden;
|
|
|
-}
|
|
|
+const formatDayMonth = (iso) => {
|
|
|
+ if (!iso) return '';
|
|
|
+ return new Date(iso).toLocaleDateString('pt-BR', { day: '2-digit', month: '2-digit' });
|
|
|
+};
|
|
|
+
|
|
|
+const addressIcon = (type) => type === 'home' ? 'mdi-home-outline' : 'mdi-office-building-outline';
|
|
|
|
|
|
+const addressLabel = (type) => {
|
|
|
+ if (type === 'home') return t('dashboard_client.next_schedules.place_home');
|
|
|
+ if (type === 'apartment') return t('dashboard_client.next_schedules.place_apartment');
|
|
|
+ return t('dashboard_client.next_schedules.place_unknown');
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+.scroll-wrapper { overflow: hidden; }
|
|
|
.scroll-track {
|
|
|
display: flex;
|
|
|
flex-direction: row;
|
|
|
@@ -124,19 +122,11 @@ const items = [
|
|
|
overscroll-behavior-x: contain;
|
|
|
scroll-snap-type: x proximity;
|
|
|
padding-bottom: 8px;
|
|
|
-
|
|
|
&::-webkit-scrollbar { display: none; }
|
|
|
-
|
|
|
- &::after {
|
|
|
- content: '';
|
|
|
- flex: 0 0 1px;
|
|
|
- }
|
|
|
+ &::after { content: ''; flex: 0 0 1px; }
|
|
|
}
|
|
|
-
|
|
|
.schedule-card {
|
|
|
- // border-radius: 18px;
|
|
|
min-width: 80%;
|
|
|
- min-height: 90px
|
|
|
+ min-height: 90px;
|
|
|
}
|
|
|
-
|
|
|
</style>
|