Reports - Add Users activities

This commit is contained in:
Tavares André 2015-06-11 20:25:12 +02:00
parent b8f54a3174
commit 749188d6fe
2 changed files with 38 additions and 20 deletions

View File

@ -10,13 +10,14 @@
<div class="viewControls"> <div class="viewControls">
<span style="margin-right: 10px; vertical-align: middle;">${LabelReport}</span> <span style="margin-right: 10px; vertical-align: middle;">${LabelReport}</span>
<div style="display: inline-block;"> <div style="display: inline-block;">
<select data-mini="true" data-inline="true" id="selectReportType"> <select data-mini="true" data-inline="true" id="selectViewType">
<option value="ReportData">${OptionReportList}</option> <option value="ReportData">${OptionReportList}</option>
<option value="ReportStatistic">${OptionReportStatistics}</option> <option value="ReportStatistics">${OptionReportStatistics}</option>
<option value="ReportActivities">${OptionReportActivities}</option>
</select> </select>
</div> </div>
<div style="display: inline-block;"> <div style="display: inline-block;" id="selectIncludeItemTypesBox">
<select data-mini="true" data-inline="true" id="selectView" name="selectView"> <select data-mini="true" data-inline="true" id="selectIncludeItemTypes" name="selectIncludeItemTypes">
<option value="MusicAlbum">${OptionReportAlbums}</option> <option value="MusicAlbum">${OptionReportAlbums}</option>
<option value="MusicArtist">${OptionReportArtists}</option> <option value="MusicArtist">${OptionReportArtists}</option>
<option value="Book">${OptionReportBooks}</option> <option value="Book">${OptionReportBooks}</option>
@ -88,7 +89,7 @@
</div> </div>
</div> </div>
<div class="tabFilter viewTab"> <div class="tabFilter viewTab" id="tabFilterBox" style="display: none;">
<fieldset data-role="controlgroup"> <fieldset data-role="controlgroup">
<legend> <legend>
${HeaderFilters} ${HeaderFilters}

View File

@ -1,6 +1,5 @@
(function ($, document) { (function ($, document) {
var defaultSortBy = "SortName"; var defaultSortBy = "SortName";
var SelectedReportView = "ReportData";
var topItems = 5; var topItems = 5;
var query = { var query = {
@ -8,7 +7,8 @@
Limit: 100, Limit: 100,
IncludeItemTypes: "Movie", IncludeItemTypes: "Movie",
HasQueryLimit: true, HasQueryLimit: true,
GroupBy: "None" GroupBy: "None",
ReportView: "ReportData"
}; };
function getTable(result) { function getTable(result) {
@ -263,7 +263,18 @@
$(document).scrollTop(0); $(document).scrollTop(0);
var html = ''; var html = '';
if (SelectedReportView === "ReportData") { if (query.ReportView === "ReportData" || query.ReportView === "ReportStatistics") {
$('#selectIncludeItemTypesBox', page).show();
$('#tabFilterBox', page).show();
$('#tabFilter', page).show();
}
else {
$('#selectIncludeItemTypesBox', page).hide();
$('#tabFilterBox', page).hide();
$('#tabFilter', page).hide();
}
if (query.ReportView === "ReportData" || query.ReportView === "ReportActivities") {
var pagingHtml = LibraryBrowser.getQueryPagingHtml({ var pagingHtml = LibraryBrowser.getQueryPagingHtml({
startIndex: query.StartIndex, startIndex: query.StartIndex,
@ -368,16 +379,20 @@
query.UserId = Dashboard.getCurrentUserId(); query.UserId = Dashboard.getCurrentUserId();
var url = ""; var url = "";
switch (SelectedReportView) { switch (query.ReportView) {
case "ReportData": case "ReportData":
query.HasQueryLimit = true; query.HasQueryLimit = true;
url = ApiClient.getUrl("Reports/Items", query); url = ApiClient.getUrl("Reports/Items", query);
break; break;
case "ReportStatistic": case "ReportStatistics":
query.TopItems = topItems; query.TopItems = topItems;
query.HasQueryLimit = false; query.HasQueryLimit = false;
url = ApiClient.getUrl("Reports/Statistics", query); url = ApiClient.getUrl("Reports/Statistics", query);
break; break;
case "ReportActivities":
query.HasQueryLimit = true;
url = ApiClient.getUrl("Reports/Activities", query);
break;
} }
ApiClient.getJSON(url).done(function (result) { ApiClient.getJSON(url).done(function (result) {
@ -455,7 +470,7 @@
$('#chkMissingEpisode', page).checked(query.IsMissing == true).checkboxradio('refresh'); $('#chkMissingEpisode', page).checked(query.IsMissing == true).checkboxradio('refresh');
$('#chkFutureEpisode', page).checked(query.IsUnaired == true).checkboxradio('refresh'); $('#chkFutureEpisode', page).checked(query.IsUnaired == true).checkboxradio('refresh');
$('#selectView').val(query.IncludeItemTypes).selectmenu('refresh'); $('#selectIncludeItemTypes').val(query.IncludeItemTypes).selectmenu('refresh');
} }
var filtersLoaded; var filtersLoaded;
@ -482,10 +497,10 @@
var page = this; var page = this;
$('#selectView', page).on('change', function () { $('#selectIncludeItemTypes', page).on('change', function () {
query.StartIndex = 0; query.StartIndex = 0;
SelectedReportView = $('#selectReportType', page).val(); query.ReportView = $('#selectViewType', page).val();
query.IncludeItemTypes = this.value; query.IncludeItemTypes = this.value;
query.SortOrder = "Ascending"; query.SortOrder = "Ascending";
query.ReportColumns = null; query.ReportColumns = null;
@ -498,13 +513,14 @@
}); });
$('#selectReportType', page).on('change', function () { $('#selectViewType', page).on('change', function () {
query.StartIndex = 0; query.StartIndex = 0;
query.IncludeItemTypes = $('#selectView', page).val(); query.ReportView = this.value;
SelectedReportView = this.value; query.IncludeItemTypes = $('#selectIncludeItemTypes', page).val();
query.SortOrder = "Ascending"; query.SortOrder = "Ascending";
filtersLoaded = false; filtersLoaded = false;
query.ReportColumns = null;
loadGroupByFilters(page); loadGroupByFilters(page);
reloadFiltersIfNeeded(page); reloadFiltersIfNeeded(page);
reloadItems(page); reloadItems(page);
@ -540,7 +556,6 @@
}); });
$('.viewPanel', page).on('panelopen', function () { $('.viewPanel', page).on('panelopen', function () {
reloadFiltersIfNeeded(page); reloadFiltersIfNeeded(page);
}); });
@ -789,7 +804,7 @@
QueryReportFilters.onPageShow(page, query); QueryReportFilters.onPageShow(page, query);
QueryReportColumns.onPageShow(page, query); QueryReportColumns.onPageShow(page, query);
$('#selectView', page).val(query.IncludeItemTypes).selectmenu('refresh').trigger('change'); $('#selectIncludeItemTypes', page).val(query.IncludeItemTypes).selectmenu('refresh').trigger('change');
updateFilterControls(page); updateFilterControls(page);
@ -974,7 +989,8 @@
UserId: userId, UserId: userId,
ParentId: itemQuery.ParentId, ParentId: itemQuery.ParentId,
IncludeItemTypes: itemQuery.IncludeItemTypes IncludeItemTypes: itemQuery.IncludeItemTypes,
ReportView: itemQuery.ReportView
})).done(function (result) { })).done(function (result) {
@ -990,7 +1006,8 @@
return ApiClient.getJSON(ApiClient.getUrl('Reports/Headers', { return ApiClient.getJSON(ApiClient.getUrl('Reports/Headers', {
UserId: userId, UserId: userId,
IncludeItemTypes: itemQuery.IncludeItemTypes IncludeItemTypes: itemQuery.IncludeItemTypes,
ReportView: itemQuery.ReportView
})).done(function (result) { })).done(function (result) {