OrderStore

This commit is contained in:
2024-11-07 17:18:49 +01:00
parent 844898bb3c
commit 47e045dde3
12 changed files with 196 additions and 174 deletions

View File

@@ -1,7 +1,4 @@
<script setup lang="ts">
import { useRouter } from 'vue-router';
import outlinedButton from '@/components/basics/outlinedButton.vue';
import cardView from '@/components/basics/cardView.vue';
import { useConcertStore } from '@/stores/concert.store';
import { useBandStore } from '@/stores/band.store';
import { useAccountStore } from '@/stores/account.store';
@@ -9,8 +6,9 @@ import { useLocationStore } from '@/stores/location.store';
import { useExerciseStore } from '@/stores/exercise.store';
import { useGenreStore } from '@/stores/genre.store';
import { usePreferencesStore } from '@/stores/preferences.store';
import dashboardCard from './dashboardCard.vue';
import { useOrderStore } from '@/stores/order.store';
const router = useRouter()
const concertStore = useConcertStore()
const bandStore = useBandStore()
const accountStore = useAccountStore()
@@ -18,6 +16,7 @@ const genreStore = useGenreStore()
const locationStore = useLocationStore()
const exerciseStore = useExerciseStore()
const preferencesStore = usePreferencesStore()
const orderStore = useOrderStore()
exerciseStore.solveExercise(2, 1)
@@ -27,171 +26,94 @@ locationStore.getLocations()
genreStore.getGenres()
accountStore.getAllAccounts()
concertStore.getConcerts()
orderStore.getAllOrders()
</script>
<template>
<v-container>
<v-row>
<v-col>
<card-view
:title="$t('band.band', 2)"
icon="mdi-guitar-electric"
>
<div class="text-h4 text-center">
{{ bandStore.bands.length }} {{ $t('band.band', 2) }}
</div>
<dashboard-card
:title="$t('band.band', 2)"
icon="mdi-guitar-electric"
:first-line="bandStore.bands.length + ' ' + $t('band.band', 2)"
:second-line="bandStore.bands.reduce((counter, band) => {
return band.concerts.length == 0 ? counter += 1 : counter
}, 0) + ' ' + $t('band.withoutConcert', 2)"
button-route="/admin/bands"
:loading="bandStore.fetchInProgress"
/>
<template #actions>
<outlined-button
@click="router.push('/admin/bands')"
:loading="bandStore.fetchInProgress"
>
{{ $t('misc.actions.more') }}
</outlined-button>
</template>
</card-view>
</v-col>
<dashboard-card
:title="$t('concert.concert', 2)"
icon="mdi-ticket"
:first-line="concertStore.concerts.length + ' ' + $t('concert.concert', 2)"
:second-line="concertStore.concerts.reduce((counter, obj) => {
if (obj.inStock == 0) {
counter += 1
}
<v-col>
<card-view
:title="$t('concert.concert', 2)"
icon="mdi-ticket"
>
<div class="text-h4 text-center">
{{ concertStore.concerts.length }} {{ $t('concert.concert', 2) }}
</div>
<div class="text-h6 text-disabled text-center">
{{ concertStore.concerts.reduce((counter, obj) => {
if (obj.inStock == 0) {
counter += 1
}
return counter
}, 0) }} {{ $t('concert.concertSoldOut') }}
</div>
<template #actions>
<outlined-button
@click="router.push('/admin/concerts')"
:loading="concertStore.fetchInProgress"
>
{{ $t('misc.actions.more') }}
</outlined-button>
</template>
</card-view>
</v-col>
return counter
}, 0) + ' ' + $t('concert.concertSoldOut')"
button-route="/admin/concerts"
:loading="concertStore.fetchInProgress"
/>
<v-col>
<card-view
:title="$t('location.location', 2)"
icon="mdi-city"
>
<div class="text-h4 text-center">
{{ locationStore.locations.length }} {{ $t('location.location', 2) }}
</div>
<dashboard-card
:title="$t('location.location', 2)"
icon="mdi-city"
:first-line="locationStore.locations.length + ' ' + $t('location.location', 2)"
:second-line="locationStore.locations.reduce((city, obj) => {
city[obj.city.name] =
city[obj.city.name] === undefined ? city.push(obj.city.name) : city[obj.city.name] += 1
<div class="text-h6 text-disabled text-center">
{{
locationStore.locations.reduce((city, obj) => {
city[obj.city.name] =
city[obj.city.name] === undefined ? city.push(obj.city.name) : city[obj.city.name] += 1
return city
}, []).length + ' ' + $t('location.city', 2)"
button-route="/admin/locations"
:loading="locationStore.fetchInProgress"
/>
return city
}, []).length
}}
{{ $t('location.city', 2) }}
</div>
<dashboard-card
:title="$t('account.account', 2)"
icon="mdi-account"
:first-line="accountStore.accounts.length + ' ' + $t('account.account', 2)"
:second-line="accountStore.accounts.reduce((counter, obj) => {
return obj.accountRole.privilegeAdminPanel ? counter += 1 : counter
}, 0) + ' ' + $t('account.administrator', 2)"
button-route="/admin/accounts"
:loading="accountStore.fetchInProgress"
/>
<template #actions>
<outlined-button
@click="router.push('/admin/locations')"
:loading="locationStore.fetchInProgress"
>
{{ $t('misc.actions.more') }}
</outlined-button>
</template>
</card-view>
</v-col>
<dashboard-card
:title="$t('band.genre', 2)"
icon="mdi-music-clef-treble"
:first-line="genreStore.genres.length + ' ' + $t('band.genre', 2)"
:second-line="genreStore.genres.reduce((counter, obj) => {
return obj.bands.length == 0 ? counter += 1 : counter
}, 0) + ' ' + $t('genre.withoutBand', 2)"
button-route="/admin/genres"
:loading="genreStore.fetchInProgress"
/>
<dashboard-card
:title="$t('misc.file', 2)"
icon="mdi-file"
:first-line="preferencesStore.staticFiles.reduce((counter, obj) => {
return counter += obj.files.length
}, 0) + ' ' + $t('misc.file', 2)"
:second-line="preferencesStore.staticFiles.length + ' ' + $t('misc.folder', 2)"
button-route="/admin/files"
:loading="preferencesStore.fetchInProgress"
/>
<dashboard-card
:title="$t('order.orders', 2)"
icon="mdi-basket"
:first-line="orderStore.orders.length + ' ' + $t('order.orders', 2)"
second-line="todo"
button-route="/admin/orders"
:loading="orderStore.fetchInProgress"
/>
</v-row>
<v-row>
<v-col>
<card-view
:title="$t('account.account', 2)"
icon="mdi-account"
>
<div class="text-h4 text-center">
{{ accountStore.accounts.length }} {{ $t('account.account', accountStore.accounts.length) }}
</div>
<template #actions>
<outlined-button
@click="router.push('/admin/accounts')"
:loading="accountStore.fetchInProgress"
>
{{ $t('misc.actions.more') }}
</outlined-button>
</template>
</card-view>
</v-col>
<v-col>
<card-view
:title="$t('band.genre', 2)"
icon="mdi-music-clef-treble"
>
<div class="text-h4 text-center">
{{ genreStore.genres.length }} {{ $t('band.genre', 2) }}
</div>
<div class="text-h6 text-center text-disabled">
{{ genreStore.genres.reduce((counter, obj) => {
return obj.bands.length == 0 ? counter += 1 : counter
}, 0) }} {{ $t('genre.withoutBand') }}
</div>
<template #actions>
<outlined-button
@click="router.push('/admin/genres')"
:loading="genreStore.fetchInProgress"
>
{{ $t('misc.actions.more') }}
</outlined-button>
</template>
</card-view>
</v-col>
<v-col>
<card-view
:title="$t('misc.file', 2)"
icon="mdi-file"
>
<div class="text-h4 text-center">
{{ preferencesStore.staticFiles.reduce((counter, obj) => {
return counter += obj.files.length
}, 0) }} {{ $t('misc.file', 2) }}
</div>
<div class="text-h6 text-center text-disabled">
{{ preferencesStore.staticFiles.length }} {{ $t('misc.folder', 2) }}
</div>
<template #actions>
<outlined-button
@click="router.push('/admin/files')"
:loading="preferencesStore.fetchInProgress"
>
{{ $t('misc.actions.more') }}
</outlined-button>
</template>
</card-view>
</v-col>
</v-row>
<!-- todo: Orders -->
</v-container>
</template>