Streamlined stores

This commit is contained in:
2024-10-22 18:47:27 +02:00
parent 780ab85a9e
commit 9140765772
45 changed files with 384 additions and 387 deletions

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import cardView from '@/components/basics/cardView.vue';
import { useAccountStore } from '@/stores/account.store';
import { useFeedbackStore } from '@/stores/feedbackStore';
import { useFeedbackStore } from '@/stores/feedback.store';
const accountStore = useAccountStore()
const feedbackStore = useFeedbackStore()

View File

@@ -6,20 +6,7 @@ import { useAccountStore } from '@/stores/account.store';
import { ref } from 'vue';
const showConfirmDialog = ref(false)
const updateInProgress = ref(false)
const accountStore = useAccountStore()
function deleteAccount() {
// todo
}
async function updateAccount() {
updateInProgress.value = true
await accountStore.updateAccount()
updateInProgress.value = false
}
</script>
<template>
@@ -32,6 +19,7 @@ async function updateAccount() {
<outlined-button
prepend-icon="mdi-delete"
color="red"
:loading="accountStore.fetchInProgress"
@click="showConfirmDialog = true"
>
{{ $t("account.delete") }}
@@ -42,7 +30,8 @@ async function updateAccount() {
<outlined-button
prepend-icon="mdi-content-save"
color="green"
@click="updateAccount"
:loading="accountStore.fetchInProgress"
@click="accountStore.updateAccount()"
>
{{ $t("save") }}
</outlined-button>
@@ -54,6 +43,6 @@ async function updateAccount() {
v-model="showConfirmDialog"
:title="$t('dialog.deleteAccount.title')"
:description="$t('dialog.deleteAccount.description')"
:onConfirm="deleteAccount"
/>
<!-- todo :onConfirm="deleteAccount" -->
</template>

View File

@@ -1,5 +1,4 @@
<script setup lang="ts">
import { ref } from 'vue';
import cardView from '@/components/basics/cardView.vue';
import outlinedButton from '@/components/basics/outlinedButton.vue';
import { useAccountStore } from '@/stores/account.store';
@@ -7,37 +6,15 @@ import { useRouter } from 'vue-router';
const accountStore = useAccountStore()
const showRegisterCard = defineModel("showRegisterCard", { type: Boolean, default: false })
const loginInProgress = ref(false)
const username = ref("duranduran")
const password = ref("H4nn0ver")
const usernameWrong = ref(false)
const passwordWrong = ref(false)
const router = useRouter()
async function startLogin() {
loginInProgress.value = true
usernameWrong.value = false
passwordWrong.value = false
if (username.value == null || username.value.length == 0) {
usernameWrong.value = true
}
if (password.value == null || password.value.length == 0) {
passwordWrong.value = true
}
if (username.value != null && username.value.length > 0 &&
password.value != null && password.value.length > 0)
{
await accountStore.login(username.value, password.value)
if (accountStore.userAccount.id != undefined) {
router.push("/account/home")
}
}
loginInProgress.value = false
accountStore.login()
.then(result => {
if (accountStore.userAccount.id != undefined) {
router.push("/account/home")
}
})
}
</script>
@@ -52,8 +29,7 @@ async function startLogin() {
<v-text-field
:label="$t('account.username')"
prepend-icon="mdi-account"
v-model="username"
:error="usernameWrong"
v-model="accountStore.loginData.username"
clearable
/>
</v-col>
@@ -65,8 +41,7 @@ async function startLogin() {
:label="$t('account.password')"
prepend-icon="mdi-key"
type="password"
v-model="password"
:error="passwordWrong"
v-model="accountStore.loginData.password"
clearable
/>
</v-col>
@@ -76,7 +51,7 @@ async function startLogin() {
<outlined-button
@click="showRegisterCard = true"
prepend-icon="mdi-plus"
:disabled="loginInProgress"
:loading="accountStore.fetchInProgress"
>
{{ $t('account.noAccountRegister') }}
</outlined-button>
@@ -84,7 +59,7 @@ async function startLogin() {
<outlined-button
append-icon="mdi-arrow-right"
@click="startLogin"
:loading="loginInProgress"
:loading="accountStore.fetchInProgress"
>
{{ $t('login') }}
</outlined-button>

View File

@@ -1,21 +1,21 @@
<script setup lang="ts">
import { AccountModel } from '@/data/models/user/accountModel';
import { ref } from 'vue';
import cardView from '@/components/basics/cardView.vue';
import outlinedButton from '@/components/basics/outlinedButton.vue';
import { useAccountStore } from '@/stores/account.store';
import { getEmailRules, getPasswordRules, getStringRules } from '@/scripts/validationRules';
import { useRouter } from 'vue-router';
const newUser = ref(new AccountModel())
const showRegisterCard = defineModel("showRegisterCard", { type: Boolean, default: false })
const accountStore = useAccountStore()
const registerInProgress = ref(false)
const router = useRouter()
async function registerAccount() {
registerInProgress.value = true
await accountStore.registerAccount(newUser.value)
registerInProgress.value = false
accountStore.registerAccount()
.then(result => {
if (result) {
router.push("/account/home")
}
})
}
</script>
@@ -29,7 +29,7 @@ async function registerAccount() {
<v-text-field
:label="$t('account.username')"
prepend-icon="mdi-account"
v-model="newUser.username"
v-model="accountStore.registerData.username"
clearable
:rules="getStringRules()"
/>
@@ -42,7 +42,7 @@ async function registerAccount() {
:label="$t('account.password')"
prepend-icon="mdi-key"
type="password"
v-model="newUser.password"
v-model="accountStore.registerData.password"
clearable
:rules="getPasswordRules()"
/>
@@ -54,7 +54,7 @@ async function registerAccount() {
<v-text-field
:label="$t('account.email')"
prepend-icon="mdi-mail"
v-model="newUser.email"
v-model="accountStore.registerData.email"
:rules="getEmailRules()"
clearable
/>
@@ -65,7 +65,7 @@ async function registerAccount() {
<outlined-button
prepend-icon="mdi-arrow-left"
@click="showRegisterCard = false"
:disabled="registerInProgress"
:disabled="accountStore.fetchInProgress"
>
{{ $t('account.backToLogin') }}
</outlined-button>
@@ -73,7 +73,7 @@ async function registerAccount() {
<outlined-button
prepend-icon="mdi-account-plus"
@click="registerAccount"
:loading="registerInProgress"
:loading="accountStore.fetchInProgress"
>
{{ $t('account.register') }}
</outlined-button>

View File

@@ -1,9 +1,9 @@
<script setup lang="ts">
import cardWithTopImage from '@/components/basics/cardViewTopImage.vue';
import { useFeedbackStore } from '@/stores/feedbackStore';
import { BandApiModel } from '@/data/models/acts/bandApiModel';
import { useBandStore } from '@/stores/band.store';
const feedbackStore = useFeedbackStore()
const bandStore = useBandStore()
defineProps({
band: {
@@ -14,7 +14,7 @@ defineProps({
</script>
<template>
<v-row v-if="feedbackStore.fetchDataFromServerInProgress" >
<v-row v-if="bandStore.fetchInProgress" >
<v-col cols="3" v-for="i in 4">
<card-with-top-image :loading="true" />
</v-col>

View File

@@ -3,7 +3,7 @@ import concertListItem from '@/components/pageParts/concertListItem.vue';
import { BandApiModel } from '@/data/models/acts/bandApiModel';
import { ConcertApiModel } from '@/data/models/acts/concertApiModel';
import CardViewHorizontal from '@/components/basics/cardViewHorizontal.vue';
import { useConcertStore } from '@/stores/concertStore';
import { useConcertStore } from '@/stores/concert.store';
const concertStore = useConcertStore()

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import { BandModel } from '@/data/models/acts/bandModel';
import { useBandStore } from '@/stores/bandStore';
import { useBandStore } from '@/stores/band.store';
const bandStore = useBandStore()

View File

@@ -6,7 +6,7 @@ import gallerySection from './gallerySection.vue';
import concertSection from './concertSection.vue';
import heroImage from '@/components/pageParts/heroImage.vue';
import sectionDivider from '@/components/basics/sectionDivider.vue';
import { useBandStore } from '@/stores/bandStore';
import { useBandStore } from '@/stores/band.store';
const router = useRouter()
const bandStore = useBandStore()

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { useBandStore } from '@/stores/bandStore';
import { useBandStore } from '@/stores/band.store';
import cardViewHorizontal from '@/components/basics/cardViewHorizontal.vue';
import bandListItem from '@/components/pageParts/bandListItem.vue';

View File

@@ -5,7 +5,7 @@ import sectionDivider from '@/components/basics/sectionDivider.vue';
import { useBasketStore } from '@/stores/basket.store';
import concertListItem from '@/components/pageParts/concertListItem.vue';
import outlinedButton from '@/components/basics/outlinedButton.vue';
import { useConcertStore } from '@/stores/concertStore';
import { useConcertStore } from '@/stores/concert.store';
const router = useRouter()
const basketStore = useBasketStore()
@@ -93,7 +93,7 @@ concertStore.getConcert(Number(router.currentRoute.value.params.id))
<v-row class="pb-5">
<outlined-button todo
prepend-icon="mdi-basket-plus"
@click="basketStore.moveSeatSelectionsToBasket(concertStore.concert, concertStore.concert.band);
@click="basketStore.moveSeatSelectionsToBasket(concertStore.concert.band);
router.push('/basket')"
:disabled="basketStore.selectedSeats.length == 0"
block

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { useConcertStore } from '@/stores/concertStore';
import { useConcertStore } from '@/stores/concert.store';
import concertListItem from '@/components/pageParts/concertListItem.vue';
import cardViewHorizontal from '@/components/basics/cardViewHorizontal.vue';
import sectionDivider from '@/components/basics/sectionDivider.vue';

View File

@@ -1,12 +1,9 @@
<script setup lang="ts">
import OutlinedButton from '@/components/basics/outlinedButton.vue';
import { useShoppingStore } from '@/stores/shoppingStore';
import { useRouter } from 'vue-router';
const shoppingStore = useShoppingStore()
const router = useRouter()
shoppingStore.getEvents()
</script>
<template>

View File

@@ -2,12 +2,11 @@
import highlightCarousel from './highlightCarousel.vue';
import sectionDivider from '@/components/basics/sectionDivider.vue';
import cardWithTopImage from '@/components/basics/cardViewTopImage.vue';
import { lowestTicketPrice } from '@/scripts/concertScripts';
import OutlinedButton from '@/components/basics/outlinedButton.vue';
import { useRouter } from 'vue-router';
import { useConcertStore } from '@/stores/concertStore';
import { useLocationStore } from '@/stores/locationStore';
import { useBandStore } from '@/stores/bandStore';
import { useConcertStore } from '@/stores/concert.store';
import { useLocationStore } from '@/stores/location.store';
import { useBandStore } from '@/stores/band.store';
const router = useRouter()
const concertStore = useConcertStore()

View File

@@ -2,38 +2,30 @@
import { useRouter } from 'vue-router';
import sectionDivider from '@/components/basics/sectionDivider.vue';
import seatPlanMap from '@/components/seatPlanMap/seatPlanMap.vue';
import { getLocation } from '@/data/api/locationApi';
import { ref } from 'vue';
import { useFeedbackStore } from '@/stores/feedbackStore';
import heroImage from '@/components/pageParts/heroImage.vue';
import concertListItem from '@/components/pageParts/concertListItem.vue';
import { LocationDetailsApiModel } from '@/data/models/locations/locationDetailsApiModel';
import cardViewHorizontal from '@/components/basics/cardViewHorizontal.vue';
import { useLocationStore } from '@/stores/location.store';
const router = useRouter()
const feedbackStore = useFeedbackStore()
const location = ref<LocationDetailsApiModel>(new LocationDetailsApiModel())
const locationStore = useLocationStore()
feedbackStore.fetchDataFromServerInProgress = true
getLocation(String(router.currentRoute.value.params.name))
.then(result => {
location.value = result.data
feedbackStore.fetchDataFromServerInProgress = false
})
locationStore.getLocationByName(String(router.currentRoute.value.params.name))
</script>
<template>
<hero-image
:title="location.name"
:image="location.imageIndoor"
:description="location.address + location.city.name"
:loading="feedbackStore.fetchDataFromServerInProgress"
:logo="location.imageOutdoor"
:title="locationStore.location.name"
:image="locationStore.location.imageIndoor"
:description="locationStore.location.address + locationStore.location.city.name"
:loading="locationStore.fetchInProgress"
:logo="locationStore.location.imageOutdoor"
>
<template #description>
<p class="text-h6">{{ location.address }}</p>
<p class="text-h6">{{ location.city.name }}</p>
<p class="text-h6">{{ locationStore.location.address }}</p>
<p class="text-h6">{{ locationStore.location.city.name }}</p>
</template>
</hero-image>
@@ -48,21 +40,21 @@ getLocation(String(router.currentRoute.value.params.name))
</v-col>
</v-row>
<v-row v-if="feedbackStore.fetchDataFromServerInProgress" v-for="i in 3">
<v-row v-if="locationStore.fetchInProgress" v-for="i in 3">
<v-col class="text-center">
<card-view-horizontal :loading="true" />
</v-col>
</v-row>
<v-row
v-else-if="location.concerts.length > 0"
v-for="concert of location.concerts"
v-else-if="locationStore.location.concerts.length > 0"
v-for="concert of locationStore.location.concerts"
>
<v-col>
<concert-list-item
:concert="concert"
:band="concert.band"
:location="location"
:location="locationStore.location"
:title="concert.name"
>
<template #description>
@@ -88,7 +80,7 @@ getLocation(String(router.currentRoute.value.params.name))
</v-col>
</v-row>
<div v-if="feedbackStore.fetchDataFromServerInProgress">
<div v-if="locationStore.fetchInProgress">
<v-col class="text-center">
<v-progress-circular indeterminate :size="128" :width="12" color="primary" />
</v-col>
@@ -97,8 +89,8 @@ getLocation(String(router.currentRoute.value.params.name))
<v-row v-else>
<v-col>
<seat-plan-map
:location="location"
:seat-groups="location.seatGroups"
:location="locationStore.location"
:seat-groups="locationStore.location.seatGroups"
/>
</v-col>
</v-row>

View File

@@ -1,12 +1,10 @@
<script setup lang="ts">
import sectionDivider from '@/components/basics/sectionDivider.vue';
import cardWithTopImage from '@/components/basics/cardViewTopImage.vue';
import { useFeedbackStore } from '@/stores/feedbackStore';
import locationListItem from '@/components/pageParts/locationListItem.vue';
import { useLocationStore } from '@/stores/locationStore';
import { useLocationStore } from '@/stores/location.store';
const locationStore = useLocationStore()
const feedbackStore = useFeedbackStore()
locationStore.getLocations()
</script>
@@ -21,7 +19,7 @@ locationStore.getLocations()
<v-col cols="10">
<!-- During fetching -->
<div v-if="feedbackStore.fetchDataFromServerInProgress" v-for="i in 2">
<div v-if="locationStore.fetchInProgress" v-for="i in 2">
<v-row>
<v-col>
<section-divider :loading="true" />

View File

@@ -26,7 +26,6 @@ async function doOrder() {
}
if (basketStore.usedAddress != null && basketStore.usedPayment != null) {
await basketStore.takeOrder()
showDialog.value = false
}

View File

@@ -2,24 +2,21 @@
import { getAllExerciseGroups } from '@/data/api/exerciseApi';
import scoreCard from './scoreCard.vue';
import { ref } from 'vue';
import { useFeedbackStore } from '@/stores/feedbackStore';
import { ExerciseGroupApiModel } from '@/data/models/exercises/exerciseGroupApiModel';
import { usePreferencesStore } from '@/stores/preferences.store';
const exerciseGroups = ref<Array<ExerciseGroupApiModel>>([])
const feedbackStore = useFeedbackStore()
feedbackStore.fetchDataFromServerInProgress = true
const preferencesStore = usePreferencesStore()
getAllExerciseGroups()
.then(result => {
exerciseGroups.value = result.data
feedbackStore.fetchDataFromServerInProgress = false
})
</script>
<template>
<v-container max-width="1000">
<v-row v-if="feedbackStore.fetchDataFromServerInProgress" v-for="i in 3">
<v-row v-if="preferencesStore.fetchInProgress" v-for="i in 3">
<v-col>
<score-card :loading="true"
/>

View File

@@ -3,7 +3,7 @@ import { ThemeEnum } from '@/data/enums/themeEnums';
import { useTheme } from 'vuetify/lib/framework.mjs';
import { i18n } from '@/plugins/i18n';
import cardView from '@/components/basics/cardView.vue';
import { usePreferencesStore } from '@/stores/preferencesStore';
import { usePreferencesStore } from '@/stores/preferences.store';
const preferencesStore = usePreferencesStore()
const theme = useTheme()

View File

@@ -1,11 +1,11 @@
<script setup lang="ts">
import { BannerStateEnum } from '@/data/enums/bannerStateEnum';
import { useFeedbackStore } from '@/stores/feedbackStore';
import { useFeedbackStore } from '@/stores/feedback.store';
import cardView from '@/components/basics/cardView.vue';
import outlinedButton from '@/components/basics/outlinedButton.vue';
import { ref } from 'vue';
import confirmDialog from '@/components/basics/confirmDialog.vue';
import { getServerState, resetDatabase, resetExerciseProgress } from '@/data/api/mainApi';
import { fetchServerState, resetDatabase, resetExerciseProgress } from '@/data/api/mainApi';
import { ServerStateEnum } from '@/data/enums/serverStateEnum';
import packageJson from './../../../../package.json'
@@ -14,7 +14,7 @@ const showConfirmDeleteDbDialog = ref(false)
const showConfirmDeleteExerciseProgressDialog = ref(false)
const serverOnline = ref(ServerStateEnum.PENDING)
getServerState()
fetchServerState()
.then(result => {
if (result.status == 200) {
serverOnline.value = ServerStateEnum.ONLINE

View File

@@ -5,7 +5,8 @@ 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 '@/stores/searchStore';
import { useSearchStore } from '@/stores/search.store';
import ConcertListItem from '@/components/pageParts/concertListItem.vue';
const searchStore = useSearchStore()
</script>
@@ -30,7 +31,7 @@ const searchStore = useSearchStore()
</v-row>
<v-row
v-if="searchStore.searchInProgress"
v-if="searchStore.fetchInProgress"
v-for="i in 2"
>
<v-col>
@@ -46,7 +47,7 @@ const searchStore = useSearchStore()
:band="band"
:concerts="band.concerts"
:genres="band.genres"
:loading="searchStore.searchInProgress"
:loading="searchStore.fetchInProgress"
/>
</v-col>
</v-row>
@@ -62,6 +63,46 @@ const searchStore = useSearchStore()
<!-- Section Concert results -->
<v-row>
<v-col>
<section-divider :title="$t('event', 2)" />
</v-col>
</v-row>
<v-row
v-if="searchStore.fetchInProgress"
v-for="i in 2"
>
<v-col>
<card-view-horizontal :loading="true" />
</v-col>
</v-row>
<v-row
v-else-if="searchStore.concerts.length > 0"
v-for="concert in searchStore.concerts"
>
<v-col>
<concert-list-item
:concert="concert"
:band="concert.band"
:location="concert.location"
/>
</v-col>
</v-row>
<v-row v-else >
<v-col>
<v-empty-state
:title="$t('noEventsFound')"
icon="mdi-party-popper"
/>
</v-col>
</v-row>
<!-- Section Location results -->
<v-row>
<v-col>
@@ -70,7 +111,7 @@ const searchStore = useSearchStore()
</v-row>
<v-row
v-if="searchStore.searchInProgress"
v-if="searchStore.fetchInProgress"
>
<v-col v-for="i in 4">
<card-view-top-image :loading="true" />
@@ -82,11 +123,11 @@ const searchStore = useSearchStore()
>
<v-col
cols="3"
v-for="locaiton in searchStore.locations"
v-for="location in searchStore.locations"
>
<location-list-item
:location="locaiton"
:concerts="locaiton.concerts"
:location="location"
:nr-of-concerts="location.concerts.length"
/>
</v-col>
</v-row>
@@ -99,49 +140,7 @@ const searchStore = useSearchStore()
/>
</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-col>
<v-spacer />

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import cardView from '@/components/basics/cardView.vue';
import { useSearchStore } from '@/stores/searchStore';
import { useSearchStore } from '@/stores/search.store';
const searchStore = useSearchStore()
</script>