2016-10-03 02:28:45 -04:00
|
|
|
|
define(['datetime', 'cardBuilder', 'paper-icon-button-light', 'emby-button'], function (datetime, cardBuilder) {
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
|
|
|
|
var query = {
|
|
|
|
|
|
|
|
|
|
SortBy: "SortName",
|
|
|
|
|
SortOrder: "Ascending"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function deleteSeriesTimer(context, id) {
|
|
|
|
|
|
|
|
|
|
require(['confirm'], function (confirm) {
|
|
|
|
|
|
|
|
|
|
confirm(Globalize.translate('MessageConfirmSeriesCancellation'), Globalize.translate('HeaderConfirmSeriesCancellation')).then(function () {
|
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
ApiClient.cancelLiveTvSeriesTimer(id).then(function () {
|
|
|
|
|
|
|
|
|
|
require(['toast'], function (toast) {
|
|
|
|
|
toast(Globalize.translate('MessageSeriesCancelled'));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
reload(context);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function renderTimers(context, timers) {
|
|
|
|
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
2016-10-03 02:28:45 -04:00
|
|
|
|
html += cardBuilder.getCardsHtml({
|
|
|
|
|
items: timers,
|
|
|
|
|
shape: 'backdrop',
|
|
|
|
|
showTitle: true,
|
|
|
|
|
cardLayout: true,
|
2016-10-05 03:15:29 -04:00
|
|
|
|
vibrant: true,
|
2016-10-03 02:28:45 -04:00
|
|
|
|
preferThumb: true,
|
|
|
|
|
coverImage: true,
|
|
|
|
|
overlayText: false,
|
|
|
|
|
showSeriesTimerTime: true,
|
|
|
|
|
showSeriesTimerChannel: true
|
|
|
|
|
});
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
2016-10-03 02:28:45 -04:00
|
|
|
|
//if (timers.length) {
|
|
|
|
|
// html += '<div class="paperList">';
|
|
|
|
|
//}
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
2016-10-03 02:28:45 -04:00
|
|
|
|
//for (var i = 0, length = timers.length; i < length; i++) {
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
2016-10-03 02:28:45 -04:00
|
|
|
|
// var timer = timers[i];
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
2016-10-03 02:28:45 -04:00
|
|
|
|
// html += '<div class="listItem">';
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
2016-10-03 02:28:45 -04:00
|
|
|
|
// html += '<i class="md-icon listItemIcon">live_tv</i>';
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
2016-10-03 02:28:45 -04:00
|
|
|
|
// html += '<div class="listItemBody three-line">';
|
|
|
|
|
// html += '<a class="clearLink" href="livetvseriestimer.html?id=' + timer.Id + '">';
|
|
|
|
|
// html += '<h3 class="listItemBodyText">';
|
|
|
|
|
// html += timer.Name;
|
|
|
|
|
// html += '</h3>';
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
2016-10-03 02:28:45 -04:00
|
|
|
|
// html += '<div class="secondary">';
|
|
|
|
|
// if (timer.DayPattern) {
|
|
|
|
|
// html += timer.DayPattern;
|
|
|
|
|
// }
|
|
|
|
|
// else {
|
|
|
|
|
// var days = timer.Days || [];
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
2016-10-03 02:28:45 -04:00
|
|
|
|
// html += days.join(', ');
|
|
|
|
|
// }
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
2016-10-03 02:28:45 -04:00
|
|
|
|
// if (timer.RecordAnyTime) {
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
2016-10-03 02:28:45 -04:00
|
|
|
|
// html += ' - ' + Globalize.translate('LabelAnytime');
|
|
|
|
|
// } else {
|
|
|
|
|
// html += ' - ' + datetime.getDisplayTime(timer.StartDate);
|
|
|
|
|
// }
|
|
|
|
|
// html += '</div>';
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
2016-10-03 02:28:45 -04:00
|
|
|
|
// html += '<div class="secondary">';
|
|
|
|
|
// if (timer.RecordAnyChannel) {
|
|
|
|
|
// html += Globalize.translate('LabelAllChannels');
|
|
|
|
|
// }
|
|
|
|
|
// else if (timer.ChannelId) {
|
|
|
|
|
// html += timer.ChannelName;
|
|
|
|
|
// }
|
|
|
|
|
// html += '</div>';
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
2016-10-03 02:28:45 -04:00
|
|
|
|
// html += '</a>';
|
|
|
|
|
// html += '</div>';
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
2016-10-03 02:28:45 -04:00
|
|
|
|
// html += '<button type="button" is="paper-icon-button-light" data-seriestimerid="' + timer.Id + '" title="' + Globalize.translate('ButtonCancelSeries') + '" class="btnCancelSeries autoSize"><i class="md-icon">cancel</i></button>';
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
2016-10-03 02:28:45 -04:00
|
|
|
|
// html += '</div>';
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//if (timers.length) {
|
|
|
|
|
// html += '</div>';
|
|
|
|
|
//}
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
2016-06-06 21:55:16 -04:00
|
|
|
|
var elem = context.querySelector('#items');
|
|
|
|
|
elem.innerHTML = html;
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
2016-10-03 02:28:45 -04:00
|
|
|
|
//if (timers.length) {
|
|
|
|
|
// elem.querySelector('.paperList').addEventListener('click', function (e) {
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
2016-10-03 02:28:45 -04:00
|
|
|
|
// var btnCancelSeries = parentWithClass(e.target, 'btnCancelSeries');
|
|
|
|
|
// if (btnCancelSeries) {
|
|
|
|
|
// deleteSeriesTimer(context, btnCancelSeries.getAttribute('data-seriestimerid'));
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
//}
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-06 21:55:16 -04:00
|
|
|
|
function parentWithClass(elem, className) {
|
|
|
|
|
|
|
|
|
|
while (!elem.classList || !elem.classList.contains(className)) {
|
|
|
|
|
elem = elem.parentNode;
|
|
|
|
|
|
|
|
|
|
if (!elem) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return elem;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-03 02:28:45 -04:00
|
|
|
|
function reload(context, promise) {
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
2016-10-03 02:28:45 -04:00
|
|
|
|
promise.then(function (result) {
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
2016-06-22 00:39:47 -04:00
|
|
|
|
renderTimers(context, result.Items);
|
2016-05-15 13:11:26 -04:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return function (view, params, tabContent) {
|
|
|
|
|
|
|
|
|
|
var self = this;
|
2016-10-03 02:28:45 -04:00
|
|
|
|
var timersPromise;
self.preRender = function () {
|
|
|
|
|
timersPromise = ApiClient.getLiveTvSeriesTimers(query);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
self.renderTab = function () {
|
2016-05-15 13:11:26 -04:00
|
|
|
|
|
2016-10-03 02:28:45 -04:00
|
|
|
|
reload(tabContent, timersPromise);
|
2016-05-15 13:11:26 -04:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2016-03-19 05:26:17 +01:00
|
|
|
|
});
|