feat: spots
This commit is contained in:
parent
08010fbb61
commit
a4e1a3328f
20 changed files with 172 additions and 97 deletions
|
@ -5,20 +5,11 @@ import ConfirmDelete from "@partials/dialogs/ConfirmDelete.vue";
|
|||
import {show_page} from "@/composables/content/show/show_page.ts";
|
||||
import ShowForm from "@partials/show/ShowForm.vue";
|
||||
import {baseShow, type Show} from "@models/show/show";
|
||||
import {useShowTypeStore} from "@stores/showType.store.ts";
|
||||
|
||||
const {items, listData, headers, selected, loading, search, showType, getItems, editItem, deleteItem} = show_page()
|
||||
|
||||
// Props and data
|
||||
|
||||
const props = defineProps({
|
||||
showType: {
|
||||
type: String as PropType<'show' | 'spot' | null>,
|
||||
required: true,
|
||||
validator: (value: string) => ['show', 'spot'].includes(value),
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
const {items, listData, headers, selected, loading, search, getItems, editItem, deleteItem} = show_page()
|
||||
|
||||
const showTypeStore = useShowTypeStore();
|
||||
const showCreateEditMode = ref(false);
|
||||
let showSelected = ref<Number | null>(null);
|
||||
|
||||
|
@ -58,8 +49,8 @@ const saveItem = (item) => {
|
|||
}
|
||||
|
||||
const cancel = (item) => {
|
||||
let deleteMessage = `Vuoi cancellare lo ${props.showType} selezionato?`
|
||||
if (bulk.value.state) deleteMessage = `Vuoi cancellare gli ${props.showType} selezionati?`
|
||||
let deleteMessage = `Vuoi cancellare lo ${showTypeStore.currentType} selezionato?`
|
||||
if (bulk.value.state) deleteMessage = `Vuoi cancellare gli ${showTypeStore.currentType} selezionati?`
|
||||
bulk.value.items = item
|
||||
showSelected.value = item?.id
|
||||
openDialog(
|
||||
|
@ -95,10 +86,6 @@ const goBack = () => {
|
|||
showSelected.value = null
|
||||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
showType.value = props.showType
|
||||
})
|
||||
|
||||
watch(search, (newValue, oldValue) => {
|
||||
const options = {...listData};
|
||||
getItems(options)
|
||||
|
@ -106,7 +93,7 @@ watch(search, (newValue, oldValue) => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<ShowForm v-if="showCreateEditMode" :showId="showSelected" :showType="props.showType" @go-back="goBack"/>
|
||||
<ShowForm v-if="showCreateEditMode" :showId="showSelected" :showType="showTypeStore.currentType" @go-back="goBack"/>
|
||||
<Table
|
||||
v-else
|
||||
:headers="headers"
|
||||
|
@ -125,7 +112,7 @@ watch(search, (newValue, oldValue) => {
|
|||
>
|
||||
<template v-slot:header-buttons>
|
||||
<v-btn color="primary" @click="create">
|
||||
<span>Crea un nuovo {{ props.showType }} </span>
|
||||
<span>Crea un nuovo {{ showTypeStore.currentType }} </span>
|
||||
</v-btn>
|
||||
</template>
|
||||
<template v-slot:dialog>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue