sintonia_webapp/resources/js/composables/content/models/show/showDays.ts
2025-03-19 10:57:20 +01:00

68 lines
2.2 KiB
TypeScript

import { VSelect, VTextField } from "vuetify/components";
import type {Show} from "@models/show/show";
export interface ShowDays {
id?: number;
firstShow: string; // Date string (ISO format)
lastShow: string; // Date string (ISO format)
startTime: string; // DateTime string (ISO format)
timezone: string;
duration: string; // Stored as string but could represent time
day: number; // Assuming 0-6 for days of week
repeatType: number; // Numerical representation of repeat type
nextPopDate: string; // Date string (ISO format)
showId: number;
record: number; // 0 or 1 for boolean-like values
// Relationships
show?: Show; // Reference to parent Show
}
export function showDaysForm(item: ShowDays) {
const visibleFields = {
firstShow: 'Prima data',
lastShow: 'Ultima data',
startTime: 'Ora inizio',
timezone: 'Fuso orario',
duration: 'Durata',
day: 'Giorno',
repeatType: 'Tipo ripetizione',
nextPopDate: 'Prossima data',
record: 'Registrazione'
};
return () => {
const fields = {};
Object.keys(visibleFields).forEach((key) => {
fields[key] = {
label: visibleFields[key],
value: item[key as keyof ShowDays],
component: VTextField,
disabled: false
};
switch (key) {
case 'day':
case 'repeatType':
case 'record':
fields[key].component = VSelect;
// Add options if you have predefined values
// fields[key].props = { items: daysOfWeekOptions };
break;
case 'startTime':
// Optional: Add time picker props
fields[key].props = { type: 'time' };
break;
case 'firstShow':
case 'lastShow':
case 'nextPopDate':
// Optional: Add date picker props
fields[key].props = { type: 'date' };
break;
}
});
return fields;
};
}