|
|
@@ -110,8 +110,8 @@
|
|
|
justify-sm="start"
|
|
|
>
|
|
|
<v-col
|
|
|
- v-for="event in props.items"
|
|
|
- :key="event.uuid"
|
|
|
+ v-for="publicEvent in props.items"
|
|
|
+ :key="publicEvent.uuid"
|
|
|
:cols="12"
|
|
|
:sm="6"
|
|
|
:md="4"
|
|
|
@@ -124,7 +124,7 @@
|
|
|
>
|
|
|
<div class="d-flex justify-center max-w100">
|
|
|
<v-img
|
|
|
- :src="event.imageId ? 'https://api.opentalent.fr/app.php/_internal/secure/files/' + event.imageId : '/images/event-default.jpg'"
|
|
|
+ :src="publicEvent.imageId ? 'https://api.opentalent.fr/app.php/_internal/secure/files/' + publicEvent.imageId : '/images/event-default.jpg'"
|
|
|
alt="poster"
|
|
|
height="160"
|
|
|
width="100%"
|
|
|
@@ -136,32 +136,32 @@
|
|
|
|
|
|
<div class="d-flex flex-column flex-grow-1 px-3">
|
|
|
<v-card-title class="title">
|
|
|
- <nuxt-link :to="{path: '/events/' + event.uuid, query: { theme: theme }}">
|
|
|
- {{ event.name }}
|
|
|
+ <nuxt-link :to="{path: '/events/' + publicEvent.uuid, query: { theme: theme }}">
|
|
|
+ {{ publicEvent.name }}
|
|
|
</nuxt-link>
|
|
|
</v-card-title>
|
|
|
|
|
|
<v-card-text class="infos pb-0">
|
|
|
<table>
|
|
|
- <tr v-if="event.datetimeStart" class="pa-1">
|
|
|
+ <tr v-if="publicEvent.datetimeStart" class="pa-1">
|
|
|
<td class="pt-1">
|
|
|
<font-awesome-icon :icon="['fas', 'calendar']" class="icon mr-2" />
|
|
|
</td>
|
|
|
<td class="pa-1">
|
|
|
<span>
|
|
|
- {{ formatDateIntervalFor(new Date(event.datetimeStart), new Date(event.datetimeEnd)) }}
|
|
|
+ {{ dateUtils.formatDateIntervalFor(new Date(publicEvent.datetimeStart), new Date(publicEvent.datetimeEnd)) }}
|
|
|
</span>
|
|
|
</td>
|
|
|
</tr>
|
|
|
|
|
|
- <tr v-if="event.address.addressCity">
|
|
|
+ <tr v-if="publicEvent.address.addressCity">
|
|
|
<td class="pt-1">
|
|
|
<font-awesome-icon class="icon" :icon="['fas', 'map-marker-alt']" />
|
|
|
</td>
|
|
|
<td class="pa-1">
|
|
|
- <span v-if="event.roomName" style="white-space: pre-line;">{{ event.roomName }}<br></span>
|
|
|
- <span v-if="event.address.streetAddress" style="white-space: pre-line;">{{ event.address.streetAddress }}<br></span>
|
|
|
- <span>{{ event.address.addressCity }}</span>
|
|
|
+ <span v-if="publicEvent.roomName" style="white-space: pre-line;">{{ publicEvent.roomName }}<br></span>
|
|
|
+ <span v-if="publicEvent.address.streetAddress" style="white-space: pre-line;">{{ publicEvent.address.streetAddress }}<br></span>
|
|
|
+ <span>{{ publicEvent.address.addressCity }}</span>
|
|
|
</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
@@ -171,7 +171,7 @@
|
|
|
<v-card-actions class="align-self-end pa-3">
|
|
|
<v-btn
|
|
|
class="see"
|
|
|
- :to="{path: '/event/' + event.uuid, query: { theme: theme, hideTitle: hideTitle }}"
|
|
|
+ :to="{path: '/events/' + publicEvent.uuid, query: { theme: theme, hideTitle: hideTitle }}"
|
|
|
nuxt
|
|
|
>
|
|
|
<span style="margin-right: 6px;">{{ $t("more_to_know") }}</span>
|
|
|
@@ -201,8 +201,7 @@
|
|
|
<script lang="ts">
|
|
|
import Vue from 'vue'
|
|
|
import EventsProvider from "~/services/data/EventsProvider"
|
|
|
-import {today, todayIso, formatIso} from '@/services/utils/date'
|
|
|
-import locale from 'date-fns/locale/fr'
|
|
|
+import DatesUtils from "~/services/utils/dateUtils";
|
|
|
|
|
|
const defaultDateRange: DateRange = { start: '', end: '' }
|
|
|
|
|
|
@@ -219,6 +218,7 @@ export default Vue.extend({
|
|
|
dateRangeFilter: defaultDateRange,
|
|
|
totalRecords: 0 as number,
|
|
|
pagesCount: 1 as number | null,
|
|
|
+ dateUtils: new DatesUtils(this.$dateFns, this.$t, this.$i18n)
|
|
|
}
|
|
|
},
|
|
|
async fetch () {
|
|
|
@@ -236,38 +236,36 @@ export default Vue.extend({
|
|
|
this.totalRecords = collection.totalItems
|
|
|
this.page = collection.page ?? 1
|
|
|
this.pagesCount = collection.lastPage ?? 1
|
|
|
-
|
|
|
- console.log(this.events)
|
|
|
})
|
|
|
},
|
|
|
computed: {
|
|
|
dateRangeMin(): string {
|
|
|
- return todayIso()
|
|
|
+ return this.dateUtils.todayIso()
|
|
|
},
|
|
|
dateRangePresets(): Array<DateRangePreset> {
|
|
|
// Today
|
|
|
const today_preset: DateRangePreset = {
|
|
|
label: this.$t('today').toString(),
|
|
|
- range: {start: todayIso(), end: todayIso()}
|
|
|
+ range: {start: this.dateUtils.todayIso(), end: this.dateUtils.todayIso()}
|
|
|
}
|
|
|
|
|
|
// Cette semaine
|
|
|
const week_preset: DateRangePreset = {
|
|
|
label: this.$t('next_week').toString(),
|
|
|
- range: {start: todayIso(), end: formatIso(this.$dateFns.addDays(today(), 7))}
|
|
|
+ range: {start: this.dateUtils.todayIso(), end: this.dateUtils.formatIso(this.$dateFns.addDays(this.dateUtils.today(), 7))}
|
|
|
}
|
|
|
|
|
|
// Ce week-end
|
|
|
- const sunday: Date = this.$dateFns.nextSunday(today())
|
|
|
+ const sunday: Date = this.$dateFns.nextSunday(this.dateUtils.today())
|
|
|
const weekend_preset: DateRangePreset = {
|
|
|
label: this.$t('next_weekend').toString(),
|
|
|
- range: {start: formatIso(this.$dateFns.addDays(sunday, -2)), end: formatIso(sunday)}
|
|
|
+ range: {start: this.dateUtils.formatIso(this.$dateFns.addDays(sunday, -2)), end: this.dateUtils.formatIso(sunday)}
|
|
|
}
|
|
|
|
|
|
// Ce mois
|
|
|
const month_preset: DateRangePreset = {
|
|
|
label: this.$t('next_month').toString(),
|
|
|
- range: {start: todayIso(), end: formatIso(this.$dateFns.addMonths(today(), 1))}
|
|
|
+ range: {start: this.dateUtils.todayIso(), end: this.dateUtils.formatIso(this.$dateFns.addMonths(this.dateUtils.today(), 1))}
|
|
|
}
|
|
|
|
|
|
return [today_preset, week_preset, weekend_preset, month_preset]
|
|
|
@@ -312,37 +310,6 @@ export default Vue.extend({
|
|
|
*/
|
|
|
enhancedAutocompleteFilter (_: any, queryText: string, itemText: string): boolean {
|
|
|
return normalize(itemText).includes(normalize(queryText))
|
|
|
- },
|
|
|
- formatDate(date: Date, short = true): string {
|
|
|
- return short ? this.$dateFns.format(date, 'dd/MM/yyyy') : this.$dateFns.format(date, 'dd MMM yyyy', {locale: locale})
|
|
|
- },
|
|
|
- formatTime(date: Date): string {
|
|
|
- return this.$dateFns.format(date, 'HH:mm')
|
|
|
- },
|
|
|
- formatDateTime(date: Date): string {
|
|
|
- return this.formatDate(date) + ' ' + this.$t('on_hour') + ' ' + this.formatTime(date)
|
|
|
- },
|
|
|
- formatDateIntervalFor(dateStart: Date | null = null, dateEnd: Date | null = null): string {
|
|
|
- if (dateStart === null && dateEnd !== null)
|
|
|
- {
|
|
|
- return this.formatDateTime(dateEnd)
|
|
|
- }
|
|
|
- else if (dateEnd === null && dateStart !== null) {
|
|
|
- return this.formatDateTime(dateStart)
|
|
|
- }
|
|
|
- else if (dateStart !== null && dateEnd !== null) {
|
|
|
- if (dateStart === dateEnd) {
|
|
|
- return this.formatDateTime(dateStart)
|
|
|
- }
|
|
|
- else if (this.$dateFns.isSameDay(dateStart, dateEnd)) {
|
|
|
- return this.formatDate(dateStart, false) + ', ' +
|
|
|
- this.formatTime(dateStart) + ' - ' + this.formatTime(dateEnd)
|
|
|
- }
|
|
|
- else {
|
|
|
- return this.$t('from_day') + ' ' + this.formatDateTime(dateStart) + ' ' + this.$t('to_day') + ' ' + this.formatDateTime(dateEnd)
|
|
|
- }
|
|
|
- }
|
|
|
- return ""
|
|
|
}
|
|
|
}
|
|
|
})
|