Commit af21bda5 authored by Richard Blechinger's avatar Richard Blechinger
Browse files

More translation adjustments, gray out past emissions, prevent deletion of old timeslots

parent c297d5c3
...@@ -152,24 +152,26 @@ ...@@ -152,24 +152,26 @@
class="tw-w-full tw-flex tw-justify-between tw-items-center" class="tw-w-full tw-flex tw-justify-between tw-items-center"
> >
<div class="tw-space-x-2"> <div class="tw-space-x-2">
<b-button <template v-if="isInTheFuture(timeslot)">
variant="danger" <b-button
size="sm" variant="danger"
@click="deleteFullSchedule(schedule.id)" size="sm"
> @click="deleteFullSchedule(schedule.id)"
<span v-if="scheduleTimeslots.length === 1">{{ $t('scheduleEditor.delete.delete') }}</span> >
<span v-else-if="schedule.rrule === 1">{{ $t('scheduleEditor.delete.both') }}</span> <span v-if="scheduleTimeslots.length === 1">{{ $t('scheduleEditor.delete.delete') }}</span>
<span v-else>{{ $t('scheduleEditor.delete.scheduleTimeslots') }}</span> <span v-else-if="schedule.rrule === 1">{{ $t('scheduleEditor.delete.both') }}</span>
</b-button> <span v-else>{{ $t('scheduleEditor.delete.scheduleTimeslots') }}</span>
</b-button>
<b-button
v-if="schedule.rrule > 1 && scheduleTimeslots.length > 1" <b-button
variant="danger" v-if="schedule.rrule > 1 && scheduleTimeslots.length > 1"
size="sm" variant="danger"
@click="deleteSingleTimeslot(schedule.id, timeslot.id)" size="sm"
> @click="deleteSingleTimeslot(schedule.id, timeslot.id)"
{{ $t('scheduleEditor.delete.timeslot') }} >
</b-button> {{ $t('scheduleEditor.delete.timeslot') }}
</b-button>
</template>
<b-button <b-button
v-if="schedule.rrule > 1 && scheduleTimeslots.length > 1" v-if="schedule.rrule > 1 && scheduleTimeslots.length > 1"
...@@ -269,11 +271,19 @@ ...@@ -269,11 +271,19 @@
return ''; return '';
} }
return item.id === this.timeslot.id return item.id === this.timeslot.id
? 'table-info' ? 'table-info'
: '' : ''
}, },
isInTheFuture(timeslot) {
const start = new Date(timeslot.start);
const now = new Date();
return start > now;
},
createRepetitionSchedule() { createRepetitionSchedule() {
const {onlyBusinessDays, addNoOfDays} = this.getRepetitionParameters(); const {onlyBusinessDays, addNoOfDays} = this.getRepetitionParameters();
const {dstart, tstart, tend, rrule, until, fallback_id, automation_id, byweekday} = this.schedule; const {dstart, tstart, tend, rrule, until, fallback_id, automation_id, byweekday} = this.schedule;
......
...@@ -73,13 +73,13 @@ ...@@ -73,13 +73,13 @@
variant="outline-danger" variant="outline-danger"
@click="resetFilter()" @click="resetFilter()"
> >
{{ $t('showTimeslots.applyFilters') }} {{ $t('showTimeslots.resetFilters') }}
</b-btn> &nbsp; </b-btn> &nbsp;
<b-btn <b-btn
variant="outline-success" variant="outline-success"
@click="applyFilter()" @click="applyFilter()"
> >
{{ $t('showTimeslots.resetFilters') }} {{ $t('showTimeslots.applyFilters') }}
</b-btn> </b-btn>
</b-container> </b-container>
</b-collapse> </b-collapse>
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
outlined outlined
:fields="notesTableArrayFields" :fields="notesTableArrayFields"
:items="notesTableArray" :items="notesTableArray"
:tbody-tr-class="notesTableRowClass"
> >
<template v-slot:cell(thumbnail)="data"> <template v-slot:cell(thumbnail)="data">
<div <div
...@@ -124,14 +125,14 @@ ...@@ -124,14 +125,14 @@
<!-- And here all the buttons for editing and doing other things <!-- And here all the buttons for editing and doing other things
with the displayed timeslot --> with the displayed timeslot -->
<template v-slot:cell(options)="data"> <template v-slot:cell(options)="data">
<span <span
class="timeslotEditLink" class="timeslotEditLink"
@click="editTimeslotNote(data.item.options.id, data.item.options.schedule)" @click="editTimeslotNote(data.item.options.id, data.item.options.schedule)"
><img ><img
src="/assets/16x16/emblem-system.png" src="/assets/16x16/emblem-system.png"
:alt="$t('showTimeslots.editDescription')" :alt="$t('showTimeslots.editDescription')"
:title="$t('showTimeslots.editDescription')" :title="$t('showTimeslots.editDescription')"
></span> ></span>
<span <span
class="timeslotEditLink" class="timeslotEditLink"
@click="editTimeslotPlaylist(selectedShow, data.item.options.schedule, data.item.options.id)" @click="editTimeslotPlaylist(selectedShow, data.item.options.schedule, data.item.options.id)"
...@@ -259,10 +260,14 @@ ...@@ -259,10 +260,14 @@
} }
} }
const { duration, minutes } = this.prettyDuration(timeslot.start, timeslot.end);
rows.push({ rows.push({
title: note ? note.title : null, title: note ? note.title : null,
startTimestamp: timeslot.start,
starts: this.prettyDateTime(timeslot.start), starts: this.prettyDateTime(timeslot.start),
duration: this.prettyDuration(timeslot.start, timeslot.end), duration,
durationInMinutes: minutes,
thumbnail: note ? process.env.VUE_APP_BASEURI_MEDIA + note.thumbnails[2] : null, thumbnail: note ? process.env.VUE_APP_BASEURI_MEDIA + note.thumbnails[2] : null,
options: { options: {
id: timeslot.id, id: timeslot.id,
...@@ -300,6 +305,19 @@ ...@@ -300,6 +305,19 @@
}, },
methods: { methods: {
notesTableRowClass(item) {
const minutesInMs = item.durationInMinutes * 60 * 1000;
const now = new Date()
const startDate = new Date(item.startTimestamp);
const endDate = new Date(startDate.getTime() + minutesInMs)
console.log(now, endDate, now > endDate);
if (now > endDate) {
return 'tw-opacity-50'
}
},
// Apply the newly set filter parameters for our timeslot table // Apply the newly set filter parameters for our timeslot table
applyFilter() { applyFilter() {
this.timeslotmeta.page = 1 this.timeslotmeta.page = 1
......
...@@ -193,7 +193,7 @@ export default { ...@@ -193,7 +193,7 @@ export default {
}, },
'showTimeslots': { 'showTimeslots': {
'toggleFilters': 'Sendeplatz-Filter ein-/ausblenden', 'toggleFilters': 'Ausstrahlungs-Filter ein-/ausblenden',
'applyFilters': 'Filter anwenden', 'applyFilters': 'Filter anwenden',
'resetFilters': 'Filter zurücksetzen', 'resetFilters': 'Filter zurücksetzen',
...@@ -204,7 +204,7 @@ export default { ...@@ -204,7 +204,7 @@ export default {
'uploadToCba': 'Aufnahme zum CBA hochladen', 'uploadToCba': 'Aufnahme zum CBA hochladen',
'switchToEmissions': 'Zur Austrahlungsverwaltung wechseln', 'switchToEmissions': 'Zur Austrahlungsverwaltung wechseln',
'numberOfSlots': 'Anzahl an Sendeplätzen', 'numberOfSlots': 'Anzahl an Ausstrahlungen',
'from': 'Von', 'from': 'Von',
'to': 'Bis (exklusive)', 'to': 'Bis (exklusive)',
}, },
...@@ -390,7 +390,7 @@ export default { ...@@ -390,7 +390,7 @@ export default {
'both': 'Beide löschen', 'both': 'Beide löschen',
'scheduleTimeslots': 'Programm und alle Sendeplätze löschen', 'scheduleTimeslots': 'Programm und alle Sendeplätze löschen',
'timeslot': 'Sendeplatz löschen', 'timeslot': 'Sendeplatz löschen',
'allTimeslots': 'Alle Sendeplätze löschen', 'allTimeslots': 'Alle zukünftigen Sendeplätze löschen',
}, },
'repetition': { 'repetition': {
......
...@@ -390,7 +390,7 @@ export default { ...@@ -390,7 +390,7 @@ export default {
'both': 'Delete both', 'both': 'Delete both',
'scheduleTimeslots': 'Delete schedule and all timeslots', 'scheduleTimeslots': 'Delete schedule and all timeslots',
'timeslot': 'Delete timeslot', 'timeslot': 'Delete timeslot',
'allTimeslots': 'Delete all timeslots', 'allTimeslots': 'Delete all future timeslots',
}, },
'repetition': { 'repetition': {
......
...@@ -85,7 +85,7 @@ export default { ...@@ -85,7 +85,7 @@ export default {
duration += seconds - 60 * minutes duration += seconds - 60 * minutes
duration += 'sec' duration += 'sec'
} }
return duration return { duration, minutes }
}, },
durationInSeconds: function (ns) { durationInSeconds: function (ns) {
const durationInMilliseconds = Math.floor(ns / 1000 / 1000); const durationInMilliseconds = Math.floor(ns / 1000 / 1000);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment