LocationsAdminPage data table

This commit is contained in:
2024-10-26 23:52:38 +02:00
parent 57819f5a2f
commit f8e1a191b3
5 changed files with 148 additions and 72 deletions

View File

@@ -14,7 +14,15 @@
"seatPlan": "Saalplan | Saalpläne", "seatPlan": "Saalplan | Saalpläne",
"seatSelection": "Sitzauswahl", "seatSelection": "Sitzauswahl",
"standingArea": "Stehbereich" "standingArea": "Stehbereich"
} },
"nrOfConcerts": "Konzerte",
"capacity": "Kapazität",
"layoutNr": "Layout Nr",
"name": "Location Name",
"address": "Adresse",
"imageIndoor": "Bild Innenraum",
"imageOutdoor": "Bild Außen",
"addLocation": "Neue Location hinzufügen"
}, },
"concert": { "concert": {
"concert": "Konzert | Konzerte", "concert": "Konzert | Konzerte",

View File

@@ -14,7 +14,15 @@
"seatPlan": "Seat plan | Seat plans", "seatPlan": "Seat plan | Seat plans",
"seatSelection": "Seat selection", "seatSelection": "Seat selection",
"standingArea": "Seat area" "standingArea": "Seat area"
} },
"nrOfConcerts": "Concerts",
"capacity": "Capacity",
"layoutNr": "Layout Nr",
"name": "Location Name",
"address": "Adress",
"imageIndoor": "Image Indoor",
"imageOutdoor": "Image Outdoor",
"addLocation": "Add new Location"
}, },
"concert": { "concert": {
"concert": "Concert | Concerts", "concert": "Concert | Concerts",

View File

@@ -2,6 +2,7 @@
import { useBandStore } from '@/stores/band.store'; import { useBandStore } from '@/stores/band.store';
import outlinedButton from '@/components/basics/outlinedButton.vue'; import outlinedButton from '@/components/basics/outlinedButton.vue';
import bandEditDialog from './bandEditDialog.vue'; import bandEditDialog from './bandEditDialog.vue';
import adminDataLayout from '@/layouts/adminDataLayout.vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useFeedbackStore } from '@/stores/feedback.store'; import { useFeedbackStore } from '@/stores/feedback.store';
@@ -24,79 +25,57 @@ bandStore.getBands()
</script> </script>
<template> <template>
<v-container> <admin-data-layout
<v-row> :add-button-string="$t('band.addNewBand')"
<v-col> :fetch-in-progress="bandStore.fetchInProgress"
<outlined-button :on-add-click="() => bandStore.newBand()"
prepend-icon="mdi-arrow-left" >
@click="router.go(-1)" <v-data-table
> :items="bandStore.bands"
{{ $t('misc.onePageBack') }} :headers="headers"
</outlined-button> :loading="bandStore.fetchInProgress"
</v-col> >
<template #item.genres="{ item }">
<v-chip v-for="genre of item.genres" class="mx-1">
{{ genre.name }}
</v-chip>
</template>
<v-col class="text-end"> <template #item.logo="{ item }">
<outlined-button <v-icon
prepend-icon="mdi-plus" :icon="item.logo != '' ? 'mdi-check' : 'mdi-close'"
color="green" :color="item.logo != '' ? 'green' : 'red'"
:disabled="bandStore.fetchInProgress" />
@click="bandStore.newBand" </template>
>
{{ $t('band.addNewBand') }}
</outlined-button>
</v-col>
</v-row>
<v-row> <template #item.imageMembers="{ item }">
<v-col> <v-icon
<v-data-table :icon="item.imageMembers != '' ? 'mdi-check' : 'mdi-close'"
:items="bandStore.bands" :color="item.imageMembers != '' ? 'green' : 'red'"
:headers="headers" />
:loading="bandStore.fetchInProgress" </template>
>
<template #item.genres="{ item }">
<v-chip v-for="genre of item.genres" class="mx-1">
{{ genre.name }}
</v-chip>
</template>
<template #item.logo="{ item }"> <template #item.images="{ item }">
<v-icon {{ item.images.length }} {{ $t('band.image', item.images.length) }}
:icon="item.logo != '' ? 'mdi-check' : 'mdi-close'" </template>
:color="item.logo != '' ? 'green' : 'red'"
/>
</template>
<template #item.imageMembers="{ item }"> <template #item.edit="{ item }">
<v-icon <v-btn
:icon="item.imageMembers != '' ? 'mdi-check' : 'mdi-close'" icon="mdi-pencil"
:color="item.imageMembers != '' ? 'green' : 'red'" variant="plain"
/> color="orange"
</template> @click="bandStore.editBand(item.name)"
/>
<template #item.images="{ item }"> <v-btn
{{ item.images.length }} {{ $t('band.image', item.images.length) }} icon="mdi-delete"
</template> variant="plain"
color="red"
<template #item.edit="{ item }"> @click="bandStore.deleteBand(item.id)"
<v-btn />
icon="mdi-pencil" </template>
variant="plain" </v-data-table>
color="orange" </admin-data-layout>
@click="bandStore.editBand(item.name)"
/>
<v-btn
icon="mdi-delete"
variant="plain"
color="red"
@click="bandStore.deleteBand(item.id)"
/>
</template>
</v-data-table>
</v-col>
</v-row>
</v-container>
<band-edit-dialog /> <band-edit-dialog />
</template> </template>

View File

@@ -1,6 +1,70 @@
<script setup lang="ts"> <script setup lang="ts">
import adminDataLayout from '@/layouts/adminDataLayout.vue';
import { useFeedbackStore } from '@/stores/feedback.store';
import { useLocationStore } from '@/stores/location.store';
const locationStore = useLocationStore()
const feedbackStore = useFeedbackStore()
const headers = [
{ title: feedbackStore.i18n.t('location.name'), value: "name" },
{ title: feedbackStore.i18n.t('location.address'), value: "address" },
{ title: feedbackStore.i18n.t('location.imageIndoor'), value: "imageIndoor" },
{ title: feedbackStore.i18n.t('location.imageOutdoor'), value: "imageOutdoor" },
{ title: feedbackStore.i18n.t('location.layoutNr'), value: "layout" },
{ title: feedbackStore.i18n.t('location.capacity'), value: "capacity" },
{ title: feedbackStore.i18n.t('location.city'), value: "city" },
{ title: feedbackStore.i18n.t('location.nrOfConcerts'), value: "nrOfConcerts" },
{ title: "", value: "edit", width: 130 }
]
locationStore.getLocations()
</script> </script>
<template> <template>
Locations Admin Page <admin-data-layout
:fetch-in-progress="locationStore.fetchInProgress"
:add-button-string="$t('location.addLocation')"
:on-add-click="() => { locationStore.newLocation() }"
>
<v-data-table
:items="locationStore.locations"
:headers="headers"
:loading="locationStore.fetchInProgress"
>
<template #item.imageIndoor="{ item }">
<v-icon
:icon="item.imageIndoor != '' ? 'mdi-check' : 'mdi-close'"
:color="item.imageIndoor != '' ? 'green' : 'red'"
/>
</template>
<template #item.imageOutdoor="{ item }">
<v-icon
:icon="item.imageOutdoor != '' ? 'mdi-check' : 'mdi-close'"
:color="item.imageOutdoor != '' ? 'green' : 'red'"
/>
</template>
<template #item.city="{ item }">
{{ item.city.name }}
</template>
<template #item.edit="{ item }">
<v-btn
icon="mdi-pencil"
variant="plain"
color="orange"
@click="locationStore.editLocation(item)"
/>
<v-btn
icon="mdi-delete"
variant="plain"
color="red"
@click="locationStore.deleteLocation(item)"
/>
</template>
</v-data-table>
</admin-data-layout>
</template> </template>

View File

@@ -21,7 +21,9 @@ export const useLocationStore = defineStore("locationStore", {
cities: ref<Array<CityModel>>([]), cities: ref<Array<CityModel>>([]),
/** Request to server sent, waiting for data response */ /** Request to server sent, waiting for data response */
fetchInProgress: ref(false) fetchInProgress: ref(false),
showEditLocation: ref(false)
}), }),
actions: { actions: {
@@ -75,6 +77,21 @@ export const useLocationStore = defineStore("locationStore", {
.then(result => { .then(result => {
this.topLocations = result.data this.topLocations = result.data
}) })
},
newLocation() {
this.location = new LocationDetailsApiModel()
this.showEditLocation = true
},
editLocation(item: LocationApiModel) {
this.location = item
this.showEditLocation = true
},
async deleteLocation(item: LocationApiModel) {
// todo
} }
}, },
}) })