feat(FE): get show spot
This commit is contained in:
parent
df5bc78f2e
commit
2cac6b6a90
3 changed files with 11 additions and 7 deletions
|
@ -6,15 +6,16 @@ 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";
|
||||
|
||||
const {items, listData, headers, selected, loading, search, getItems, editItem, deleteItem} = show_page()
|
||||
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'>,
|
||||
type: String as PropType<'show' | 'spot' | null>,
|
||||
required: true,
|
||||
validator: (value: string) => ['show', 'spot'].includes(value),
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -95,7 +96,7 @@ const goBack = () => {
|
|||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
listData.show_type = props.showType
|
||||
showType.value = props.showType
|
||||
})
|
||||
|
||||
watch(search, (newValue, oldValue) => {
|
||||
|
|
|
@ -2,7 +2,7 @@ import type {ShowInstance} from "@models/show/showInstance.ts";
|
|||
import type {ShowDays} from "@models/show/showDays";
|
||||
import type {ShowDJs} from "@models/show/showDJs.ts";
|
||||
import axios, {type AxiosResponse} from "axios";
|
||||
import {cleanOptions} from "@/helpers/AxiosHelper.ts";
|
||||
import {camelToSnake, cleanOptions} from "@/helpers/AxiosHelper.ts";
|
||||
|
||||
export interface Show {
|
||||
id?: number;
|
||||
|
@ -29,7 +29,7 @@ export interface Show {
|
|||
playlist?: any;
|
||||
|
||||
// Extra
|
||||
showType: 'show' | "spot" // Either show or spot
|
||||
showType: 'show' | "spot" | null // Either show or spot
|
||||
}
|
||||
|
||||
export const baseShow = (): Show => {
|
||||
|
@ -49,7 +49,7 @@ export const baseShow = (): Show => {
|
|||
autoplaylistRepeat: false,
|
||||
showDjs: null,
|
||||
showDays: null,
|
||||
showType: "show"
|
||||
showType: null
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,7 @@ export const getShows = async (options: {
|
|||
page?: Number | null;
|
||||
per_page?: Number | null;
|
||||
all?: string | null;
|
||||
showType?: 'show' | 'spot' | null;
|
||||
}): Promise<Show[]> => {
|
||||
const filteredParams = cleanOptions(options);
|
||||
return await axios.get(`/show`, {params: filteredParams})
|
||||
|
|
|
@ -14,6 +14,7 @@ export function show_page() {
|
|||
'total_items': 0,
|
||||
'page': 1,
|
||||
})
|
||||
const showType = ref(null);
|
||||
|
||||
const headers = showTableHeader
|
||||
|
||||
|
@ -22,6 +23,7 @@ export function show_page() {
|
|||
page: options.page,
|
||||
per_page: options.itemsPerPage,
|
||||
all: search.value,
|
||||
showType: showType.value,
|
||||
}
|
||||
return getShows(showSearchOptions).then(showList => {
|
||||
listData.itemsPerPage = showList.per_page;
|
||||
|
@ -53,5 +55,5 @@ export function show_page() {
|
|||
})
|
||||
};
|
||||
|
||||
return {items, listData, headers, selected, loading, search, getItems, editItem, deleteItem}
|
||||
return {items, listData, headers, selected, loading, search, showType, getItems, editItem, deleteItem}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue