(function ($, document, window) {
function resetTuner(page, id) {
var message = Globalize.translate('MessageConfirmResetTuner');
Dashboard.confirm(message, Globalize.translate('HeaderResetTuner'), function (confirmResult) {
if (confirmResult) {
Dashboard.showLoadingMsg();
ApiClient.resetLiveTvTuner(id).done(function () {
Dashboard.hideLoadingMsg();
reload(page);
});
}
});
}
function renderTuners(page, tuners) {
var html = '';
for (var i = 0, length = tuners.length; i < length; i++) {
var tuner = tuners[i];
html += '
';
if (tuner.ProgramName) {
html += tuner.ProgramName;
}
html += '
';
html += '
';
html += tuner.Clients.join(' ');
html += '
';
html += '
';
html += '';
html += '
';
html += '
';
}
var elem = $('.tunersResultBody', page).html(html).parents('.tblTuners').table("refresh").trigger('create');
$('.btnResetTuner', elem).on('click', function () {
var id = this.getAttribute('data-tunerid');
resetTuner(page, id);
});
}
function getServiceHtml(service) {
var html = '';
html += '
';
var serviceUrl = service.HomePageUrl || '#';
html += '
';
var status = service.Status;
if (service.Status == 'Ok') {
status = '' + status + '';
} else {
if (service.StatusMessage) {
status += ' (' + service.StatusMessage + ')';
}
status = '' + status + '';
}
html += '