Display concerts with card views on "All concerts" page, adding image property for tours
This commit is contained in:
@@ -5,7 +5,7 @@ import { useFeedbackStore } from "./feedbackStore";
|
||||
import { BannerStateEnum } from "../enums/bannerStateEnum";
|
||||
import { addOrder } from "../api/orderApi";
|
||||
import { useAccountStore } from "./accountStore";
|
||||
import { ShowModel } from "../models/showModel";
|
||||
import { ConcertModel } from "../models/concertModel";
|
||||
import { AddressModel } from "../models/addressModel";
|
||||
import { PaymentModel } from "../models/paymentModel";
|
||||
|
||||
@@ -44,28 +44,28 @@ export const useBasketStore = defineStore('basketStore', {
|
||||
feedbackStore.changeBanner(BannerStateEnum.BASKETPRODUCTREMOVED)
|
||||
|
||||
this.itemsInBasket = this.itemsInBasket.filter((basketItemModel: BasketItemModel) =>
|
||||
basketItemModel.product.id != item.product.id
|
||||
basketItemModel.concert.id != item.concert.id
|
||||
)
|
||||
},
|
||||
|
||||
/**
|
||||
* Add an item to the basket. If the product is already in the basket, the quantity will increase
|
||||
*
|
||||
* @param show Show to add
|
||||
* @param concert Concert to add
|
||||
* @param quantity Quantity of the product
|
||||
*/
|
||||
addItemToBasket(show: ShowModel, quantity: number) {
|
||||
addItemToBasket(concert: ConcertModel, quantity: number) {
|
||||
const feedbackStore = useFeedbackStore()
|
||||
feedbackStore.changeBanner(BannerStateEnum.BASKETPRODUCTADDED)
|
||||
|
||||
// Product is already in the basket, increase number of items
|
||||
if (this.itemsInBasket.find((basketItem: BasketItemModel) =>
|
||||
basketItem.product.id == show.id))
|
||||
basketItem.concert.id == concert.id))
|
||||
{
|
||||
this.itemsInBasket.find((basketItem: BasketItemModel) =>
|
||||
basketItem.product.id == show.id).quantity += quantity
|
||||
basketItem.concert.id == concert.id).quantity += quantity
|
||||
} else {
|
||||
this.itemsInBasket.push(new BasketItemModel(quantity, show))
|
||||
this.itemsInBasket.push(new BasketItemModel(quantity, concert))
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -11,13 +11,13 @@ import { getAllGenres } from "../api/genreApi";
|
||||
import { CityModel } from "../models/cityModel";
|
||||
import { getAllCities } from "../api/cityApi";
|
||||
|
||||
export const useShowStore = defineStore("showStore", {
|
||||
export const useConcertStore = defineStore("concertStore", {
|
||||
state: () => ({
|
||||
tours: useLocalStorage<Array<TourModel>>("hackmycart/showStore/tours", []),
|
||||
bands: useLocalStorage<Array<BandModel>>("hackmycart/showStore/bands", []),
|
||||
locations: useLocalStorage<Array<LocationModel>>("hackmycart/showStore/locations", []),
|
||||
cities: useLocalStorage<Array<CityModel>>("hackmycart/showStore/cities", []),
|
||||
genres: useLocalStorage<Array<GenreModel>>("hackmycart/showStore/genres", [])
|
||||
tours: useLocalStorage<Array<TourModel>>("hackmycart/concertStore/tours", []),
|
||||
bands: useLocalStorage<Array<BandModel>>("hackmycart/concertStore/bands", []),
|
||||
locations: useLocalStorage<Array<LocationModel>>("hackmycart/concertStore/locations", []),
|
||||
cities: useLocalStorage<Array<CityModel>>("hackmycart/concertStore/cities", []),
|
||||
genres: useLocalStorage<Array<GenreModel>>("hackmycart/concertStore/genres", [])
|
||||
}),
|
||||
|
||||
actions: {
|
||||
@@ -25,6 +25,10 @@ export const useShowStore = defineStore("showStore", {
|
||||
await getAllTours()
|
||||
.then(result => {
|
||||
this.tours = result.data
|
||||
|
||||
this.tours.sort((a, b) => {
|
||||
return new Date(a.shows[0].date) < new Date(b.shows[0].date) ? -1 : 1
|
||||
})
|
||||
})
|
||||
|
||||
await getAllBands()
|
||||
@@ -5,7 +5,7 @@ import { LanguageEnum } from "../enums/languageEnum";
|
||||
|
||||
export const usePreferencesStore = defineStore('preferencesStore', {
|
||||
state: () => ({
|
||||
theme: useLocalStorage<ThemeEnum>("hackmycart/preferencesStore/theme", ThemeEnum.DARKRED),
|
||||
theme: useLocalStorage<ThemeEnum>("hackmycart/preferencesStore/theme", ThemeEnum.DARKBLUE),
|
||||
language: useLocalStorage<LanguageEnum>("hackmycart/preferencesStore/language", LanguageEnum.GERMAN)
|
||||
}),
|
||||
})
|
||||
Reference in New Issue
Block a user