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 ShowForm from "@partials/show/ShowForm.vue";
|
||||||
import {baseShow, type Show} from "@models/show/show";
|
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
|
// Props and data
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
showType: {
|
showType: {
|
||||||
type: String as PropType<'show' | 'spot'>,
|
type: String as PropType<'show' | 'spot' | null>,
|
||||||
required: true,
|
required: true,
|
||||||
validator: (value: string) => ['show', 'spot'].includes(value),
|
validator: (value: string) => ['show', 'spot'].includes(value),
|
||||||
|
default: null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -95,7 +96,7 @@ const goBack = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
listData.show_type = props.showType
|
showType.value = props.showType
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(search, (newValue, oldValue) => {
|
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 {ShowDays} from "@models/show/showDays";
|
||||||
import type {ShowDJs} from "@models/show/showDJs.ts";
|
import type {ShowDJs} from "@models/show/showDJs.ts";
|
||||||
import axios, {type AxiosResponse} from "axios";
|
import axios, {type AxiosResponse} from "axios";
|
||||||
import {cleanOptions} from "@/helpers/AxiosHelper.ts";
|
import {camelToSnake, cleanOptions} from "@/helpers/AxiosHelper.ts";
|
||||||
|
|
||||||
export interface Show {
|
export interface Show {
|
||||||
id?: number;
|
id?: number;
|
||||||
|
@ -29,7 +29,7 @@ export interface Show {
|
||||||
playlist?: any;
|
playlist?: any;
|
||||||
|
|
||||||
// Extra
|
// Extra
|
||||||
showType: 'show' | "spot" // Either show or spot
|
showType: 'show' | "spot" | null // Either show or spot
|
||||||
}
|
}
|
||||||
|
|
||||||
export const baseShow = (): Show => {
|
export const baseShow = (): Show => {
|
||||||
|
@ -49,7 +49,7 @@ export const baseShow = (): Show => {
|
||||||
autoplaylistRepeat: false,
|
autoplaylistRepeat: false,
|
||||||
showDjs: null,
|
showDjs: null,
|
||||||
showDays: null,
|
showDays: null,
|
||||||
showType: "show"
|
showType: null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +70,7 @@ export const getShows = async (options: {
|
||||||
page?: Number | null;
|
page?: Number | null;
|
||||||
per_page?: Number | null;
|
per_page?: Number | null;
|
||||||
all?: string | null;
|
all?: string | null;
|
||||||
|
showType?: 'show' | 'spot' | null;
|
||||||
}): Promise<Show[]> => {
|
}): Promise<Show[]> => {
|
||||||
const filteredParams = cleanOptions(options);
|
const filteredParams = cleanOptions(options);
|
||||||
return await axios.get(`/show`, {params: filteredParams})
|
return await axios.get(`/show`, {params: filteredParams})
|
||||||
|
|
|
@ -14,6 +14,7 @@ export function show_page() {
|
||||||
'total_items': 0,
|
'total_items': 0,
|
||||||
'page': 1,
|
'page': 1,
|
||||||
})
|
})
|
||||||
|
const showType = ref(null);
|
||||||
|
|
||||||
const headers = showTableHeader
|
const headers = showTableHeader
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@ export function show_page() {
|
||||||
page: options.page,
|
page: options.page,
|
||||||
per_page: options.itemsPerPage,
|
per_page: options.itemsPerPage,
|
||||||
all: search.value,
|
all: search.value,
|
||||||
|
showType: showType.value,
|
||||||
}
|
}
|
||||||
return getShows(showSearchOptions).then(showList => {
|
return getShows(showSearchOptions).then(showList => {
|
||||||
listData.itemsPerPage = showList.per_page;
|
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