diff --git a/PlexRequests.Core/SettingModels/PlexRequestSettings.cs b/PlexRequests.Core/SettingModels/PlexRequestSettings.cs index dc27da865..20bf58acd 100644 --- a/PlexRequests.Core/SettingModels/PlexRequestSettings.cs +++ b/PlexRequests.Core/SettingModels/PlexRequestSettings.cs @@ -41,6 +41,7 @@ namespace PlexRequests.Core.SettingModels public bool RequireTvShowApproval { get; set; } public bool RequireMusicApproval { get; set; } public bool UsersCanViewOnlyOwnRequests { get; set; } + public bool UsersCanViewOnlyOwnIssues { get; set; } public int WeeklyRequestLimit { get; set; } public string NoApprovalUsers { get; set; } diff --git a/PlexRequests.UI/Content/Themes/plex.css b/PlexRequests.UI/Content/Themes/plex.css index c0a7597af..7444041c8 100644 --- a/PlexRequests.UI/Content/Themes/plex.css +++ b/PlexRequests.UI/Content/Themes/plex.css @@ -156,3 +156,17 @@ button.list-group-item:focus { background-clip: padding-box; outline: 0; } +.badge { + display: inline-block; + min-width: 10px; + padding: 3px 7px; + font-size: 12px; + font-weight: 300; + color: #ebebeb; + line-height: 1; + vertical-align: middle; + white-space: nowrap; + text-align: center; + background-color: #333333; + border-radius: 10px; } + diff --git a/PlexRequests.UI/Content/Themes/plex.min.css b/PlexRequests.UI/Content/Themes/plex.min.css index 2fa5bbcc9..20a9bff7b 100644 --- a/PlexRequests.UI/Content/Themes/plex.min.css +++ b/PlexRequests.UI/Content/Themes/plex.min.css @@ -1 +1 @@ -.form-control-custom{background-color:#333 !important;}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{background:#df691a;}scroll-top-wrapper{background-color:#333;}.scroll-top-wrapper:hover{background-color:#df691a;}body{font-family:Open Sans Regular,Helvetica Neue,Helvetica,Arial,sans-serif;color:#eee;background-color:#1f1f1f;}.table-striped>tbody>tr:nth-of-type(odd){background-color:#333;}.table-hover>tbody>tr:hover{background-color:#282828;}fieldset{padding:15px;}legend{border-bottom:1px solid #333;}.form-control{color:#fefefe;background-color:#333;}.radio input[type="radio"],.radio-inline input[type="radio"],.checkbox input[type="checkbox"],.checkbox-inline input[type="checkbox"]{margin-left:-0;}.form-horizontal .radio,.form-horizontal .checkbox,.form-horizontal .radio-inline,.form-horizontal .checkbox-inline{margin-top:-15px;}.dropdown-menu{background-color:#282828;}.dropdown-menu .divider{background-color:#333;}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{background-color:#333;}.input-group-addon{background-color:#333;}.nav>li>a:hover,.nav>li>a:focus{background-color:#df691a;}.nav-tabs>li>a:hover{border-color:#df691a #df691a transparent;}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{background-color:#df691a;border:1px solid #df691a;}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border:1px solid #df691a;}.navbar-default{background-color:#0a0a0a;}.navbar-default .navbar-brand{color:#df691a;}.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus{color:#f0ad4e;background-color:#282828;}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{background-color:#282828;}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:hover,.navbar-default .navbar-nav>.open>a:focus{background-color:#df691a;color:#fff;}.pagination>li>a,.pagination>li>span{background-color:#282828;}.pagination>li>a:hover,.pagination>li>span:hover,.pagination>li>a:focus,.pagination>li>span:focus{background-color:#333;}.pagination>.disabled>span,.pagination>.disabled>span:hover,.pagination>.disabled>span:focus,.pagination>.disabled>a,.pagination>.disabled>a:hover,.pagination>.disabled>a:focus{color:#fefefe;background-color:#333;}.list-group-item{background-color:#282828;}a.list-group-item:hover,button.list-group-item:hover,a.list-group-item:focus,button.list-group-item:focus{background-color:#333;}.input-addon,.input-group-addon{color:#df691a;}.modal-header,.modal-footer{background-color:#282828;}.modal-content{position:relative;background-color:#282828;border:1px solid transparent;border-radius:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box;outline:0;} \ No newline at end of file +.form-control-custom{background-color:#333 !important;}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{background:#df691a;}scroll-top-wrapper{background-color:#333;}.scroll-top-wrapper:hover{background-color:#df691a;}body{font-family:Open Sans Regular,Helvetica Neue,Helvetica,Arial,sans-serif;color:#eee;background-color:#1f1f1f;}.table-striped>tbody>tr:nth-of-type(odd){background-color:#333;}.table-hover>tbody>tr:hover{background-color:#282828;}fieldset{padding:15px;}legend{border-bottom:1px solid #333;}.form-control{color:#fefefe;background-color:#333;}.radio input[type="radio"],.radio-inline input[type="radio"],.checkbox input[type="checkbox"],.checkbox-inline input[type="checkbox"]{margin-left:-0;}.form-horizontal .radio,.form-horizontal .checkbox,.form-horizontal .radio-inline,.form-horizontal .checkbox-inline{margin-top:-15px;}.dropdown-menu{background-color:#282828;}.dropdown-menu .divider{background-color:#333;}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{background-color:#333;}.input-group-addon{background-color:#333;}.nav>li>a:hover,.nav>li>a:focus{background-color:#df691a;}.nav-tabs>li>a:hover{border-color:#df691a #df691a transparent;}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{background-color:#df691a;border:1px solid #df691a;}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border:1px solid #df691a;}.navbar-default{background-color:#0a0a0a;}.navbar-default .navbar-brand{color:#df691a;}.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus{color:#f0ad4e;background-color:#282828;}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{background-color:#282828;}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:hover,.navbar-default .navbar-nav>.open>a:focus{background-color:#df691a;color:#fff;}.pagination>li>a,.pagination>li>span{background-color:#282828;}.pagination>li>a:hover,.pagination>li>span:hover,.pagination>li>a:focus,.pagination>li>span:focus{background-color:#333;}.pagination>.disabled>span,.pagination>.disabled>span:hover,.pagination>.disabled>span:focus,.pagination>.disabled>a,.pagination>.disabled>a:hover,.pagination>.disabled>a:focus{color:#fefefe;background-color:#333;}.list-group-item{background-color:#282828;}a.list-group-item:hover,button.list-group-item:hover,a.list-group-item:focus,button.list-group-item:focus{background-color:#333;}.input-addon,.input-group-addon{color:#df691a;}.modal-header,.modal-footer{background-color:#282828;}.modal-content{position:relative;background-color:#282828;border:1px solid transparent;border-radius:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box;outline:0;}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:300;color:#ebebeb;line-height:1;vertical-align:middle;white-space:nowrap;text-align:center;background-color:#333;border-radius:10px;} \ No newline at end of file diff --git a/PlexRequests.UI/Content/Themes/plex.scss b/PlexRequests.UI/Content/Themes/plex.scss index 1de0e2092..ba48f2d20 100644 --- a/PlexRequests.UI/Content/Themes/plex.scss +++ b/PlexRequests.UI/Content/Themes/plex.scss @@ -194,3 +194,18 @@ button.list-group-item:focus { background-clip: padding-box; outline: 0; } + +.badge { + display: inline-block; + min-width: 10px; + padding: 3px 7px; + font-size: 12px; + font-weight: 300; + color: #ebebeb; + line-height: 1; + vertical-align: middle; + white-space: nowrap; + text-align: center; + background-color: $bg-colour; + border-radius: 10px; +} \ No newline at end of file diff --git a/PlexRequests.UI/Content/issue-details.js b/PlexRequests.UI/Content/issue-details.js new file mode 100644 index 000000000..28b10c997 --- /dev/null +++ b/PlexRequests.UI/Content/issue-details.js @@ -0,0 +1,46 @@ +var base = $('#baseUrl').text(); + + +// Note Modal click +$(".theNoteSaveButton").click(function (e) { + var comment = $("#noteArea").val(); + e.preventDefault(); + + var $form = $("#noteForm"); + var data = $form.serialize(); + + + $.ajax({ + type: $form.prop("method"), + url: $form.prop("action"), + data: data, + dataType: "json", + success: function (response) { + if (checkJsonResponse(response)) { + location.reload(); + } + }, + error: function (e) { + console.log(e); + generateNotify("Something went wrong!", "danger"); + } + }); +}); +// Update the note modal +$('#noteModal').on('show.bs.modal', function (event) { + var button = $(event.relatedTarget); // Button that triggered the modal + var id = button.data('identifier'); // Extract info from data-* attributes + var issue = button.data('issue'); + var modal = $(this); + modal.find('.theNoteSaveButton').val(id); // Add ID to the button + var requestField = modal.find('.noteId'); + requestField.val(id); // Add ID to the hidden field + var noteType = modal.find('.issue'); + noteType.val(issue); + + }); + + + + + diff --git a/PlexRequests.UI/Content/issues.js b/PlexRequests.UI/Content/issues.js index 74d0afda3..70a081a65 100644 --- a/PlexRequests.UI/Content/issues.js +++ b/PlexRequests.UI/Content/issues.js @@ -14,6 +14,16 @@ var base = $('#baseUrl').text(); initLoad(); +$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { + var target = $(e.target).attr('href'); + + if (target === "#inProgressTab") { + loadInProgressIssues(); + } + if (target === "#resolvedTab") { + loadResolvedIssues(); + } +}); // Report Issue @@ -179,14 +189,58 @@ $(document).on("click", ".clear", function (e) { function initLoad() { + loadCounts(); loadPendingIssues(); - } +function loadCounts() { + var url = createBaseUrl(base, "issues/tabCount"); + $.ajax({ + type: "get", + url: url, + dataType: "json", + success: function (response) { + if (response.length > 0) { + response.forEach(function (result) { + if (result.count > 0) { + + if (result.name == 0) { + $('#pendingCount').addClass("badge"); + $('#pendingCount').html(result.count); + } else if (result.name == 1) { + $('#inProgressCount').addClass("badge"); + $('#inProgressCount').html(result.count); + } else if (result.name == 2) { + $('#resolvedCount').addClass("badge"); + $('#resolvedCount').html(result.count); + } + + } + }); + }; + } + }); +} function loadPendingIssues() { - $issues = $('#pendingIssues'); - var url = createBaseUrl(base, "issues/pending"); + loadIssues("pending", $('#pendingIssues')); +} + + +function loadInProgressIssues() { + var $element = $('#inprogressIssues'); + $element.html(""); + loadIssues("inprogress", $element); +} + +function loadResolvedIssues() { + var $element = $('#resolvedIssues'); + $element.html(""); + loadIssues("resolved", $element); +} + +function loadIssues(type, element) { + var url = createBaseUrl(base, "issues/" + type); var linkUrl = createBaseUrl(base, "issues/"); $.ajax({ type: "get", @@ -194,12 +248,12 @@ function loadPendingIssues() { dataType: "json", success: function (response) { if (response.length > 0) { - response.forEach(function(result) { + response.forEach(function (result) { var context = buildIssueContext(result); var html = issueTemplate(context); - $issues.append(html); + element.append(html); - $("#" +result.id + "link").attr("href", linkUrl + result.id); + $("#" + result.id + "link").attr("href", linkUrl + result.id); }); }; }, @@ -208,7 +262,6 @@ function loadPendingIssues() { generateNotify("Could not load Pending issues", "danger"); } }); - } diff --git a/PlexRequests.UI/Content/requests-1.7.js b/PlexRequests.UI/Content/requests-1.7.js index f7c7aff42..041b67bcc 100644 --- a/PlexRequests.UI/Content/requests-1.7.js +++ b/PlexRequests.UI/Content/requests-1.7.js @@ -445,31 +445,6 @@ $(document).on("click", ".approve-with-quality", function (e) { }); -// Clear issues -$(document).on("click", ".clear", function (e) { - e.preventDefault(); - var buttonId = e.target.id; - var $form = $('#clear' + buttonId); - - $.ajax({ - type: $form.prop('method'), - url: $form.prop('action'), - data: $form.serialize(), - dataType: "json", - success: function (response) { - - if (checkJsonResponse(response)) { - generateNotify("Success! Issues Cleared.", "info"); - $('#issueArea' + buttonId).html("