sintonia_webapp/resources/js/composables/content/models/show/showDays.ts
2025-03-30 23:38:11 +02:00

48 lines
No EOL
1.3 KiB
TypeScript

import { VSelect, VTextField } from "vuetify/components";
import type {Show} from "@models/show/show";
import axios, {type AxiosResponse} from "axios";
import {dateFormatter} from "@/helpers/DateFormatter.ts";
export interface ShowDays {
id?: number;
firstShow: Date;
lastShow: Date;
startTime: string;
timezone: string;
duration: string;
day: number[];
repeatType: number;
nextPopDate?: string;
showId?: number;
record?: number;
}
export const baseShowDays = ():ShowDays => {
return {
firstShow: new Date(),
lastShow: new Date(),
startTime: '08:00',
timezone: '',
duration: '01:00',
day: [0],
repeatType: 0,
nextPopDate: '',
showId: 0,
record: 0
};
}
export const getShowDays = async (options: {
showId?: number | null;
flattenShowDays?: boolean;
}): Promise<ShowDays> => {
const filteredParams = Object.fromEntries(
Object.entries(options).filter(([_, value]) => value !== undefined && value !== null)
);
return await axios.get(`/showDays`, {params: filteredParams})
.then((response: AxiosResponse) => {
return response.data
}).catch((error: Error) => {
console.log("Error: " + error);
})
}