Finish search page
This commit is contained in:
@@ -118,8 +118,19 @@ band.get("/search", (req: Request, res: Response) => {
|
|||||||
where: {
|
where: {
|
||||||
name: {
|
name: {
|
||||||
[Op.substring]: req.query.value
|
[Op.substring]: req.query.value
|
||||||
|
},
|
||||||
|
},
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
model: Event,
|
||||||
|
include: [
|
||||||
|
Concert
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
model: Genre
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
})
|
})
|
||||||
.then(bands => {
|
.then(bands => {
|
||||||
res.status(200).json(bands)
|
res.status(200).json(bands)
|
||||||
|
|||||||
@@ -116,7 +116,8 @@ location.get("/search", (req: Request, res: Response) => {
|
|||||||
name: {
|
name: {
|
||||||
[Op.substring]: req.query.value
|
[Op.substring]: req.query.value
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
include: [ Concert ]
|
||||||
})
|
})
|
||||||
.then(locations => {
|
.then(locations => {
|
||||||
res.status(200).json(locations)
|
res.status(200).json(locations)
|
||||||
|
|||||||
68
software/src/components/pageParts/bandListItem.vue
Normal file
68
software/src/components/pageParts/bandListItem.vue
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { BandModel } from '@/data/models/acts/bandModel';
|
||||||
|
import { lowestTicketPrice, lowestTicketPriceEvents } from '@/scripts/concertScripts';
|
||||||
|
import cardViewHorizontal from '@/components/basics/cardViewHorizontal.vue';
|
||||||
|
import { EventModel } from '@/data/models/acts/eventModel';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import { GenreModel } from '@/data/models/acts/genreModel';
|
||||||
|
import { EventApiModel } from '@/data/models/acts/eventApiModel';
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
defineProps({
|
||||||
|
/** Band to display */
|
||||||
|
band: {
|
||||||
|
type: BandModel,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
|
||||||
|
/** Events where the band participate */
|
||||||
|
events: {
|
||||||
|
type: Array<EventApiModel>,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
|
||||||
|
genres: {
|
||||||
|
type: Array<GenreModel>,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
|
||||||
|
/** Display text parts as skeleton */
|
||||||
|
loading: Boolean
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<card-view-horizontal
|
||||||
|
v-if="!loading"
|
||||||
|
:title="band.name"
|
||||||
|
:image="'http://localhost:3000/static/' + band.logo"
|
||||||
|
@click="router.push('/bands/' + band.name.replaceAll(' ', '-').toLowerCase())"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
<div>
|
||||||
|
<v-chip
|
||||||
|
v-for="genre in genres"
|
||||||
|
class="mr-2 my-1"
|
||||||
|
variant="flat"
|
||||||
|
>
|
||||||
|
{{ genre.name }}
|
||||||
|
</v-chip>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #append>
|
||||||
|
<div>
|
||||||
|
<div class="text-secondary font-weight-medium text-h6 pb-1">
|
||||||
|
{{ $t('from') + ' ' + lowestTicketPriceEvents(events) + ' €' }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<v-btn variant="flat" color="secondary">
|
||||||
|
{{ events.length }} {{ $t('event', events.length) }}
|
||||||
|
</v-btn>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</card-view-horizontal>
|
||||||
|
</template>
|
||||||
@@ -171,5 +171,7 @@
|
|||||||
},
|
},
|
||||||
"goToTheConcert": "Zum Konzert",
|
"goToTheConcert": "Zum Konzert",
|
||||||
"selectedConcert": "Ausgewähltes Konzert",
|
"selectedConcert": "Ausgewähltes Konzert",
|
||||||
"enterSomeKeywords": "Füge Schlagworte ein um nach Bands, Events, Konzerten und Veranstaltungsorten zu suchen"
|
"enterSomeKeywords": "Füge Schlagworte ein um nach Bands, Events, Konzerten und Veranstaltungsorten zu suchen",
|
||||||
|
"noBandFound": "Keine Band gefunden",
|
||||||
|
"noLocationsFound": "Keine Veranstaltungsorte gefunden"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,5 +171,7 @@
|
|||||||
},
|
},
|
||||||
"goToTheConcert": "To the concert",
|
"goToTheConcert": "To the concert",
|
||||||
"selectedConcert": "Selected Concert",
|
"selectedConcert": "Selected Concert",
|
||||||
"enterSomeKeywords": "Enter keywords to search for bands, events, concerts and locations"
|
"enterSomeKeywords": "Enter keywords to search for bands, events, concerts and locations",
|
||||||
|
"noBandFound": "No band found",
|
||||||
|
"noLocationsFound": "No location found"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,10 @@
|
|||||||
import searchBar from './searchBar.vue';
|
import searchBar from './searchBar.vue';
|
||||||
import eventListItem from '@/components/pageParts/eventListItem.vue';
|
import eventListItem from '@/components/pageParts/eventListItem.vue';
|
||||||
import sectionDivider from '@/components/basics/sectionDivider.vue';
|
import sectionDivider from '@/components/basics/sectionDivider.vue';
|
||||||
|
import cardViewHorizontal from '@/components/basics/cardViewHorizontal.vue';
|
||||||
|
import locationListItem from '@/components/pageParts/locationListItem.vue';
|
||||||
|
import cardViewTopImage from '@/components/basics/cardViewTopImage.vue';
|
||||||
|
import bandListItem from '@/components/pageParts/bandListItem.vue';
|
||||||
import { useSearchStore } from '@/data/stores/searchStore';
|
import { useSearchStore } from '@/data/stores/searchStore';
|
||||||
|
|
||||||
const searchStore = useSearchStore()
|
const searchStore = useSearchStore()
|
||||||
@@ -19,62 +23,126 @@ const searchStore = useSearchStore()
|
|||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|
||||||
<v-row>
|
<div v-if="searchStore.alreadySearched">
|
||||||
<v-col>
|
<v-row>
|
||||||
{{ searchStore.bands }}
|
<v-col>
|
||||||
</v-col>
|
<section-divider :title="$t('band', 2)" />
|
||||||
</v-row>
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
<v-row>
|
<v-row
|
||||||
<v-col>
|
v-if="searchStore.searchInProgress"
|
||||||
{{ searchStore.locations }}
|
v-for="i in 2"
|
||||||
</v-col>
|
>
|
||||||
</v-row>
|
<v-col>
|
||||||
|
<card-view-horizontal :loading="true" />
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
<v-row
|
||||||
|
v-else-if="searchStore.bands.length > 0"
|
||||||
|
v-for="band in searchStore.bands">
|
||||||
|
<v-col>
|
||||||
|
<band-list-item
|
||||||
|
:band="band"
|
||||||
|
:events="band.events"
|
||||||
|
:genres="band.genres"
|
||||||
|
:loading="searchStore.searchInProgress"
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
<v-row v-else >
|
||||||
|
<v-col>
|
||||||
|
<v-empty-state
|
||||||
|
:title="$t('noBandFound')"
|
||||||
|
icon="mdi-guitar-electric"
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
|
||||||
<v-row>
|
|
||||||
<v-col>
|
|
||||||
<section-divider
|
|
||||||
v-if="searchStore.alreadySearched"
|
|
||||||
:title="$t('event', 2)"
|
|
||||||
/>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
|
|
||||||
<v-row
|
<!-- Section Location results -->
|
||||||
v-if="searchStore.alreadySearched && !searchStore.searchInProgress"
|
<v-row>
|
||||||
v-for="event in searchStore.events"
|
<v-col>
|
||||||
>
|
<section-divider :title="$t('location', 2)" />
|
||||||
<v-col>
|
</v-col>
|
||||||
<event-list-item
|
</v-row>
|
||||||
:event="event"
|
|
||||||
:band="event.band"
|
|
||||||
:concerts="event.concerts"
|
|
||||||
:loading="searchStore.searchInProgress"
|
|
||||||
/>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
|
|
||||||
<v-row
|
<v-row
|
||||||
v-else-if="searchStore.alreadySearched && searchStore.searchInProgress"
|
v-if="searchStore.searchInProgress"
|
||||||
v-for="i in 3"
|
>
|
||||||
>
|
<v-col v-for="i in 4">
|
||||||
<v-col>
|
<card-view-top-image :loading="true" />
|
||||||
Loading...
|
</v-col>
|
||||||
<!-- <event-list-item
|
</v-row>
|
||||||
:loading="searchStore.searchInProgress"
|
|
||||||
/> -->
|
<v-row
|
||||||
</v-col>
|
v-else-if="searchStore.locations.length > 0"
|
||||||
</v-row>
|
>
|
||||||
|
<v-col
|
||||||
|
cols="3"
|
||||||
|
v-for="locaiton in searchStore.locations"
|
||||||
|
>
|
||||||
|
<location-list-item
|
||||||
|
:location="locaiton"
|
||||||
|
:concerts="locaiton.concerts"
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
<v-row v-else >
|
||||||
|
<v-col>
|
||||||
|
<v-empty-state
|
||||||
|
:title="$t('noLocationsFound')"
|
||||||
|
icon="mdi-city"
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Section Event results -->
|
||||||
|
<v-row>
|
||||||
|
<v-col>
|
||||||
|
<section-divider :title="$t('event', 2)" />
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
<v-row
|
||||||
|
v-if="searchStore.searchInProgress"
|
||||||
|
v-for="i in 2"
|
||||||
|
>
|
||||||
|
<v-col>
|
||||||
|
<card-view-horizontal :loading="true" />
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
<v-row
|
||||||
|
v-else-if="searchStore.events.length > 0"
|
||||||
|
v-for="event in searchStore.events"
|
||||||
|
>
|
||||||
|
<v-col>
|
||||||
|
<event-list-item
|
||||||
|
:event="event"
|
||||||
|
:band="event.band"
|
||||||
|
:concerts="event.concerts"
|
||||||
|
:loading="searchStore.searchInProgress"
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
<v-row v-else >
|
||||||
|
<v-col>
|
||||||
|
<v-empty-state
|
||||||
|
:title="$t('noEventsFound')"
|
||||||
|
icon="mdi-party-popper"
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</div>
|
||||||
|
|
||||||
<v-row>
|
|
||||||
<v-col>
|
|
||||||
<v-empty-state
|
|
||||||
:title="$t('noEventsFound')"
|
|
||||||
icon="mdi-magnify"
|
|
||||||
/>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
</v-col>
|
</v-col>
|
||||||
|
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ const searchStore = useSearchStore()
|
|||||||
hide-details
|
hide-details
|
||||||
v-model="searchStore.searchTerm"
|
v-model="searchStore.searchTerm"
|
||||||
:placeholder="$t('enterSomeKeywords')"
|
:placeholder="$t('enterSomeKeywords')"
|
||||||
|
@keyup.enter="searchStore.startSearch"
|
||||||
>
|
>
|
||||||
<template #append-inner>
|
<template #append-inner>
|
||||||
<v-btn
|
<v-btn
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { RatingModel } from "@/data/models/acts/ratingModel"
|
import { RatingModel } from "@/data/models/acts/ratingModel"
|
||||||
import { dateToHumanReadableString } from "./dateTimeScripts"
|
import { dateToHumanReadableString } from "./dateTimeScripts"
|
||||||
import { ConcertModel } from "@/data/models/acts/concertModel"
|
import { ConcertModel } from "@/data/models/acts/concertModel"
|
||||||
|
import { EventModel } from "@/data/models/acts/eventModel"
|
||||||
|
import { EventApiModel } from "@/data/models/acts/eventApiModel"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate a price based on parameters
|
* Calculate a price based on parameters
|
||||||
@@ -102,6 +104,24 @@ export function lowestTicketPrice(concerts: Array<ConcertModel>): string {
|
|||||||
|
|
||||||
priceArray.sort()
|
priceArray.sort()
|
||||||
|
|
||||||
|
try {
|
||||||
|
return priceArray[0].toFixed(2)
|
||||||
|
} catch(e) {
|
||||||
|
return "0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function lowestTicketPriceEvents(events: Array<EventApiModel>) {
|
||||||
|
const priceArray : Array<number> = []
|
||||||
|
|
||||||
|
for (let event of events) {
|
||||||
|
for (let concert of event.concerts) {
|
||||||
|
priceArray.push(concert.price)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
priceArray.sort()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return priceArray[0].toFixed(2)
|
return priceArray[0].toFixed(2)
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user