82 lines
3.1 KiB
TypeScript
82 lines
3.1 KiB
TypeScript
import { VSelect, VTextField } from "vuetify/components";
|
|
|
|
interface Schedule {
|
|
id?: number;
|
|
starts: string; // ISO datetime string
|
|
ends: string; // ISO datetime string
|
|
clipLength: number; // Length in seconds or appropriate unit
|
|
fadeIn: number; // Fade-in duration in seconds
|
|
fadeOut: number; // Fade-out duration in seconds
|
|
cueIn: string; // Cue-in point (HH:MM:SS or similar format)
|
|
cueOut: string; // Cue-out point (HH:MM:SS or similar format)
|
|
mediaItemPlayed: boolean; // Indicates if media item has been played
|
|
playoutStatus: string; // Status of the playout (e.g., 'pending', 'completed')
|
|
broadcasted: boolean; // Indicates if it has been broadcasted
|
|
position: number; // Position in the schedule
|
|
fileId: number; // Reference to File ID
|
|
instanceId: number; // Reference to ShowInstances ID
|
|
|
|
// Relationships
|
|
file?: File; // Reference to File interface
|
|
showInstance?: ShowInstances; // Reference to ShowInstances interface
|
|
}
|
|
|
|
export function scheduleForm(item: Schedule) {
|
|
const visibleFields = {
|
|
starts: 'Inizio',
|
|
ends: 'Fine',
|
|
clipLength: 'Lunghezza clip (s)',
|
|
fadeIn: 'Fade-in (s)',
|
|
fadeOut: 'Fade-out (s)',
|
|
cueIn: 'Cue in',
|
|
cueOut: 'Cue out',
|
|
mediaItemPlayed: 'Media riprodotto',
|
|
playoutStatus: 'Stato playout',
|
|
broadcasted: 'Trasmissione completata',
|
|
position: 'Posizione',
|
|
fileId: 'File',
|
|
instanceId: 'Istanza programma'
|
|
};
|
|
|
|
return () => {
|
|
const fields = {};
|
|
Object.keys(visibleFields).forEach((key) => {
|
|
fields[key] = {
|
|
label: visibleFields[key],
|
|
value: item[key as keyof Schedule],
|
|
component: VTextField,
|
|
disabled: false
|
|
};
|
|
|
|
switch (key) {
|
|
case 'starts':
|
|
case 'ends':
|
|
fields[key].props = {
|
|
type: 'datetime-local',
|
|
step: 300 // 5-minute increments for practical scheduling
|
|
};
|
|
break;
|
|
case 'mediaItemPlayed':
|
|
case 'broadcasted':
|
|
fields[key].component = VSelect;
|
|
fields[key].props = {
|
|
items: [
|
|
{ text: 'Sì', value: true },
|
|
{ text: 'No', value: false }
|
|
]
|
|
};
|
|
break;
|
|
case 'fileId':
|
|
fields[key].value = item.file?.name || '';
|
|
fields[key].disabled = true;
|
|
break;
|
|
case 'instanceId':
|
|
fields[key].value = item.showInstance?.id || ''; // Assuming you want to show instance ID or name
|
|
fields[key].disabled = true;
|
|
break;
|
|
}
|
|
});
|
|
|
|
return fields;
|
|
};
|
|
}
|