mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-08 06:00:50 -07:00
Added the issues to the requests page
This commit is contained in:
parent
759540c837
commit
0556e4d32b
7 changed files with 73 additions and 52 deletions
|
@ -41,10 +41,10 @@ $(document).on("click", ".dropdownIssue", function (e) {
|
||||||
}
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var $form = $('#form' + id);
|
var $form = $('#report' + id);
|
||||||
var data = $form.serialize();
|
var data = $form.serialize();
|
||||||
data = data + "&issue=" + issue;
|
data = data + "&issue=" + issue;
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: $form.prop('method'),
|
type: $form.prop('method'),
|
||||||
url: $form.prop('action'),
|
url: $form.prop('action'),
|
||||||
|
@ -63,13 +63,13 @@ $(document).on("click", ".dropdownIssue", function (e) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Modal click
|
// Modal click
|
||||||
$(".theSaveButton").click(function () {
|
$(".theSaveButton").click(function (e) {
|
||||||
var comment = $("#commentArea").val();
|
var comment = $("#commentArea").val();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
var id = e.target.value;
|
||||||
var $form = $("#form" + id);
|
var $form = $("#commentForm");
|
||||||
var data = $form.serialize();
|
var data = $form.serialize();
|
||||||
data = data + "&issue=" + 4 + "&comment="+comment;
|
data = data + "&issue=" + 4 + "&comment=" + comment;
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: $form.prop("method"),
|
type: $form.prop("method"),
|
||||||
|
@ -96,13 +96,14 @@ $('#myModal').on('show.bs.modal', function (event) {
|
||||||
|
|
||||||
var modal = $(this);
|
var modal = $(this);
|
||||||
modal.find('.theSaveButton').val(id); // Add ID to the button
|
modal.find('.theSaveButton').val(id); // Add ID to the button
|
||||||
modal.find('#requestId').val(id); // Add ID to the hidden field
|
var requestField = modal.find('input');
|
||||||
|
requestField.val(id); // Add ID to the hidden field
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("click", ".delete", function (e) {
|
$(document).on("click", ".delete", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var buttonId = e.target.id;
|
var buttonId = e.target.id;
|
||||||
var $form = $('#form' + buttonId);
|
var $form = $('#delete' + buttonId);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: $form.prop('method'),
|
type: $form.prop('method'),
|
||||||
|
@ -168,7 +169,8 @@ function buildRequestContext(result, type) {
|
||||||
available: result.available,
|
available: result.available,
|
||||||
admin: result.admin,
|
admin: result.admin,
|
||||||
issues: result.issues,
|
issues: result.issues,
|
||||||
otherMessage: result.otherMessage
|
otherMessage: result.otherMessage,
|
||||||
|
requestId: result.id
|
||||||
};
|
};
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace PlexRequests.UI.Models
|
||||||
public string ReleaseYear { get; set; }
|
public string ReleaseYear { get; set; }
|
||||||
public bool Available { get; set; }
|
public bool Available { get; set; }
|
||||||
public bool Admin { get; set; }
|
public bool Admin { get; set; }
|
||||||
public IssueState Issues { get; set; }
|
public string Issues { get; set; }
|
||||||
public string OtherMessage { get; set; }
|
public string OtherMessage { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,8 @@ namespace PlexRequests.UI.Modules
|
||||||
{
|
{
|
||||||
dynamic model = new ExpandoObject();
|
dynamic model = new ExpandoObject();
|
||||||
model.Errored = Request.Query.error.HasValue;
|
model.Errored = Request.Query.error.HasValue;
|
||||||
|
var adminCreated = UserMapper.DoUsersExist();
|
||||||
|
model.AdminExists = adminCreated;
|
||||||
return View["Login/Index", model];
|
return View["Login/Index", model];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,13 +55,9 @@ namespace PlexRequests.UI.Modules
|
||||||
Get["/"] = _ => LoadRequests();
|
Get["/"] = _ => LoadRequests();
|
||||||
Get["/movies"] = _ => GetMovies();
|
Get["/movies"] = _ => GetMovies();
|
||||||
Get["/tvshows"] = _ => GetTvShows();
|
Get["/tvshows"] = _ => GetTvShows();
|
||||||
Post["/delete"] = _ =>
|
Post["/delete"] = _ => DeleteRequest((int)Request.Form.id);
|
||||||
{
|
Post["/reportissue"] = _ => ReportIssue((int)Request.Form.requestId, (IssueState)(int)Request.Form.issue, null);
|
||||||
var convertedType = (string)Request.Form.type == "movie" ? RequestType.Movie : RequestType.TvShow;
|
Post["/reportissuecomment"] = _ => ReportIssue((int)Request.Form.requestId, IssueState.Other, (string)Request.Form.commentArea);
|
||||||
return DeleteRequest((int)Request.Form.id, convertedType);
|
|
||||||
};
|
|
||||||
Get["/reportissue"] = _ => ReportIssue((int)Request.Form.requestId, (IssueState)Request.Form.issue, null);
|
|
||||||
Get["/reportissuecomment"] = _ => ReportIssue((int)Request.Form.requestId, IssueState.Other, (string)Request.Form.commentArea);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
private IRepository<RequestedModel> Service { get; }
|
private IRepository<RequestedModel> Service { get; }
|
||||||
|
@ -96,7 +92,7 @@ namespace PlexRequests.UI.Modules
|
||||||
ReleaseYear = movie.ReleaseDate.Year.ToString(),
|
ReleaseYear = movie.ReleaseDate.Year.ToString(),
|
||||||
Available = movie.Available,
|
Available = movie.Available,
|
||||||
Admin = isAdmin,
|
Admin = isAdmin,
|
||||||
Issues = movie.Issues,
|
Issues = movie.Issues.Humanize(LetterCasing.Title),
|
||||||
OtherMessage = movie.OtherMessage
|
OtherMessage = movie.OtherMessage
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
|
@ -124,18 +120,18 @@ namespace PlexRequests.UI.Modules
|
||||||
ReleaseYear = tv.ReleaseDate.Year.ToString(),
|
ReleaseYear = tv.ReleaseDate.Year.ToString(),
|
||||||
Available = tv.Available,
|
Available = tv.Available,
|
||||||
Admin = isAdmin,
|
Admin = isAdmin,
|
||||||
Issues = tv.Issues,
|
Issues = tv.Issues.Humanize(LetterCasing.Title),
|
||||||
OtherMessage = tv.OtherMessage
|
OtherMessage = tv.OtherMessage
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
return Response.AsJson(viewModel);
|
return Response.AsJson(viewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response DeleteRequest(int providerId, RequestType type)
|
private Response DeleteRequest(int requestid)
|
||||||
{
|
{
|
||||||
if (Context.CurrentUser.IsAuthenticated())
|
if (Context.CurrentUser.IsAuthenticated())
|
||||||
{
|
{
|
||||||
var currentEntity = Service.GetAll().FirstOrDefault(x => x.ProviderId == providerId && x.Type == type);
|
var currentEntity = Service.Get(requestid);
|
||||||
Service.Delete(currentEntity);
|
Service.Delete(currentEntity);
|
||||||
return Response.AsJson(new JsonResponseModel { Result = true });
|
return Response.AsJson(new JsonResponseModel { Result = true });
|
||||||
}
|
}
|
||||||
|
@ -152,8 +148,20 @@ namespace PlexRequests.UI.Modules
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private Response ReportIssue(int requestId, IssueState issue, string comment)
|
private Response ReportIssue(int requestId, IssueState issue, string comment)
|
||||||
{
|
{
|
||||||
|
var originalRequest = Service.Get(requestId);
|
||||||
return Response.AsJson(new JsonResponseModel());
|
if (originalRequest == null)
|
||||||
|
{
|
||||||
|
return Response.AsJson(new JsonResponseModel { Result = false, Message = "Could not add issue, please try again or contact the administrator!" });
|
||||||
|
}
|
||||||
|
originalRequest.Issues = issue;
|
||||||
|
originalRequest.OtherMessage = comment;
|
||||||
|
|
||||||
|
var result = Service.Update(originalRequest);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
return Response.AsJson(new JsonResponseModel { Result = true });
|
||||||
|
}
|
||||||
|
return Response.AsJson(new JsonResponseModel { Result = false, Message = "Could not add issue, please try again or contact the administrator!" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,9 +7,10 @@
|
||||||
<br/>
|
<br/>
|
||||||
<input class="btn btn-success" type="submit" value="Login"/>
|
<input class="btn btn-success" type="submit" value="Login"/>
|
||||||
</form>
|
</form>
|
||||||
|
@if (!Model.AdminExists)
|
||||||
If you have not yet created an Admin account you can do here: <a href="/register">Register</a>
|
{
|
||||||
|
<div>If you have not yet created an Admin account you can do here: <a href="/register">Register</a></div>
|
||||||
|
}
|
||||||
@if (Model.Errored)
|
@if (Model.Errored)
|
||||||
{
|
{
|
||||||
<div class="alert alert-dismissible alert-danger">
|
<div class="alert alert-dismissible alert-danger">
|
||||||
|
|
|
@ -93,31 +93,36 @@
|
||||||
</p>
|
</p>
|
||||||
<p>Requested By: {{requestedBy}}</p>
|
<p>Requested By: {{requestedBy}}</p>
|
||||||
<p>Requested Date: {{requestedDate}}</p>
|
<p>Requested Date: {{requestedDate}}</p>
|
||||||
|
{{#if otherMessage}}
|
||||||
|
<p>Message: {{otherMessage}}</p>
|
||||||
|
{{else}}
|
||||||
|
<p>Issue: {{issues}}</p>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-2 col-sm-push-3">
|
<div class="col-sm-2 col-sm-push-3">
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
{{#if_eq admin true}}
|
{{#if_eq admin true}}
|
||||||
<form method="POST" action="/requests/delete" id="form{{id}}">
|
<form method="POST" action="/requests/delete" id="delete{{requestId}}">
|
||||||
<input name="Id" type="text" value="{{id}}" hidden="hidden" />
|
<input name="Id" type="text" value="{{requestId}}" hidden="hidden" />
|
||||||
<input name="Type" type="text" value="{{type}}" hidden="hidden" />
|
<button id="{{requestId}}" style="text-align: right" class="btn btn-danger delete" type="submit"><i class="fa fa-plus"></i> Remove</button>
|
||||||
<button id="{{id}}" style="text-align: right" class="btn btn-danger delete" type="submit"><i class="fa fa-plus"></i> Remove</button>
|
|
||||||
</form>
|
</form>
|
||||||
{{/if_eq}}
|
{{/if_eq}}
|
||||||
|
|
||||||
<form method="POST" action="/search/reportissue/" id="form{{id}}">
|
<form method="POST" action="/requests/reportissue/" id="report{{requestId}}">
|
||||||
<input name="requestId" type="text" value="{{id}}" hidden="hidden" />
|
<input name="requestId" type="text" value="{{requestId}}" hidden="hidden" />
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<button id="{{id}}" class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
<button id="{{requestId}}" class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||||
<i class="fa fa-plus"></i> Report Issue
|
<i class="fa fa-plus"></i> Report Issue
|
||||||
<span class="caret"></span>
|
<span class="caret"></span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
||||||
<li><a id="{{id}}" issue-select="0" class="dropdownIssue" href="#">Wrong Audio</a></li>
|
<li><a id="{{requestId}}" issue-select="0" class="dropdownIssue" href="#">Wrong Audio</a></li>
|
||||||
<li><a id="{{id}}" issue-select="1" class="dropdownIssue" href="#">No Subtitles</a></li>
|
<li><a id="{{requestId}}" issue-select="1" class="dropdownIssue" href="#">No Subtitles</a></li>
|
||||||
<li><a id="{{id}}" issue-select="2" class="dropdownIssue" href="#">Wrong Content</a></li>
|
<li><a id="{{requestId}}" issue-select="2" class="dropdownIssue" href="#">Wrong Content</a></li>
|
||||||
<li><a id="{{id}}" issue-select="3" class="dropdownIssue" href="#">Playback Issues</a></li>
|
<li><a id="{{requestId}}" issue-select="3" class="dropdownIssue" href="#">Playback Issues</a></li>
|
||||||
<li><a id="{{id}}" issue-select="4" class="dropdownIssue" data-identifier="{{id}}" href="#" data-toggle="modal" data-target="#myModal">Other</a></li>
|
<li><a id="{{requestId}}" issue-select="4" class="dropdownIssue" data-identifier="{{requestId}}" href="#" data-toggle="modal" data-target="#myModal">Other</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -135,9 +140,9 @@
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button>
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button>
|
||||||
<h4 class="modal-title">Add issue/comment</h4>
|
<h4 class="modal-title">Add issue/comment</h4>
|
||||||
</div>
|
</div>
|
||||||
<form method="POST" action="/search/reportissuecomment/" id="commentForm">
|
<form method="POST" action="/requests/reportissuecomment" id="commentForm">
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<input name="requestId" type="text" hidden="hidden" />
|
<input name="requestId" class="requestId" type="text" hidden="hidden" value="" />
|
||||||
<textarea class="form-control form-control-custom" rows="3" id="commentArea" name="commentArea"></textarea>
|
<textarea class="form-control form-control-custom" rows="3" id="commentArea" name="commentArea"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|
|
@ -6,24 +6,28 @@
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<form method="POST" id="loginForm">
|
<form method="POST" id="loginForm">
|
||||||
<div class="col-md-2">
|
<div class="row">
|
||||||
<label style="padding-top: 8px"> Username </label>
|
<div class="col-md-2">
|
||||||
|
<label style="padding-top: 8px"> Username </label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<input class="form-control form-control-custom col-md-5" type="text" name="Username" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-5">
|
<br />
|
||||||
<input class="form-control form-control-custom col-md-5" type="text" name="Username"/>
|
@if (Model.UsePassword)
|
||||||
</div>
|
{
|
||||||
<br />
|
<div class="row">
|
||||||
@if (Model.UsePassword)
|
|
||||||
{
|
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<label style="padding-top: 8px"> Password </label>
|
<label style="padding-top: 8px"> Password </label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
<input class="form-control form-control-custom col-md-5" name="Password" type="password" />
|
<input class="form-control form-control-custom col-md-5" name="Password" type="password" />
|
||||||
</div>
|
</div>
|
||||||
}
|
</div>
|
||||||
<br />
|
}
|
||||||
<input id="loginBtn" class="btn btn-success" type="submit" value="Login" />
|
<br />
|
||||||
|
<input id="loginBtn" class="btn btn-success" type="submit" value="Login" />
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue