2022-09-03 01:53:24 +02:00
|
|
|
@page
|
2022-11-17 03:32:03 +01:00
|
|
|
@inject IAntiforgery _antiforgery
|
|
|
|
@using Microsoft.AspNetCore.Antiforgery
|
2022-09-03 01:53:24 +02:00
|
|
|
@using MediaManager.database
|
|
|
|
@using MediaManager.database.Tables
|
2022-11-17 03:32:03 +01:00
|
|
|
@model Shows
|
2022-09-03 01:53:24 +02:00
|
|
|
@{
|
|
|
|
ViewData["Title"] = "Shows";
|
2022-09-04 14:09:43 +02:00
|
|
|
Layout = "_LayoutNoContainer";
|
2022-11-17 03:32:03 +01:00
|
|
|
var tokenSet = _antiforgery.GetAndStoreTokens(HttpContext);
|
2022-09-03 01:53:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
<div class="text-center">
|
|
|
|
<h1 class="display-5">
|
|
|
|
Shows
|
|
|
|
<a class="btn btn-lg btn-primary" href="/AddShow">Add</a>
|
|
|
|
|
|
|
|
</h1>
|
|
|
|
<table class="table table-striped table-hover">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th scope="col">Title</th>
|
|
|
|
<th scope="col">Rating</th>
|
|
|
|
<th scope="col">Rewatchability</th>
|
|
|
|
<th scope="col">Watch count</th>
|
|
|
|
<th scope="col">Last Watch</th>
|
|
|
|
<th scope="col">Status</th>
|
|
|
|
<th scope="col">Progress</th>
|
|
|
|
<th scope="col">Comment</th>
|
|
|
|
<th scope="col">Actions</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2022-09-03 20:13:50 +02:00
|
|
|
@foreach (var show in new Database.DbConn().Shows.Where(p => p.UserId == Model.AuthorizedUser.UserId).OrderBy(p => p.Title.ToLower())) {
|
2022-11-17 03:32:03 +01:00
|
|
|
<tr id="show_@show.ShowId">
|
2022-09-03 01:53:24 +02:00
|
|
|
<td>
|
|
|
|
<b>@show.Title</b>
|
|
|
|
<br/>
|
|
|
|
<small>@show.Year</small>
|
|
|
|
</td>
|
|
|
|
<td class="td-progress">
|
|
|
|
@if (show.Rating > 0) {
|
|
|
|
<div class="progress">
|
|
|
|
<div class="progress-bar progress-@(show.Rating)0" role="progressbar" style="width: @(show.Rating * 10)%">@(show.Rating)</div>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
<div class="progress">
|
|
|
|
<div class="progress-bar progress-00" role="progressbar" style="width: 0"></div>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
</td>
|
|
|
|
<td class="td-progress">
|
|
|
|
@if (show.Rewatchability > 0) {
|
|
|
|
<div class="progress">
|
|
|
|
<div class="progress-bar progress-@(show.Rewatchability)0" role="progressbar" style="width: @(show.Rewatchability * 10)%">@(show.Rewatchability)</div>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
<div class="progress">
|
|
|
|
<div class="progress-bar progress-00" role="progressbar" style="width: 0"></div>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
</td>
|
|
|
|
<td class="td-progress">
|
|
|
|
<div class="progress">
|
|
|
|
<div class="progress-bar progress-@(Math.Min(show.WatchCount, 5) * 2)0" role="progressbar" style="width: @(Math.Min(show.WatchCount, 5) * 20)%">@(show.WatchCount)</div>
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
@if (show.LastSeen.Year > 2000) {
|
|
|
|
@show.LastSeen.ToString("yyyy-MM-dd")
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
@Html.Raw("-")
|
|
|
|
}
|
|
|
|
</td>
|
|
|
|
<td>
|
2022-09-04 13:03:46 +02:00
|
|
|
@switch (show.WatchStatus) {
|
|
|
|
case WatchStatus.Unwatched:
|
|
|
|
<span class="badge text-bg-danger">Unwatched</span>
|
|
|
|
break;
|
|
|
|
case WatchStatus.FirstWatch:
|
|
|
|
<span class="badge text-bg-warning">First Watch</span>
|
|
|
|
break;
|
|
|
|
case WatchStatus.Waiting:
|
|
|
|
<span class="badge text-bg-secondary">Waiting</span>
|
|
|
|
break;
|
|
|
|
case WatchStatus.Finished:
|
|
|
|
<span class="badge text-bg-success">Finished</span>
|
|
|
|
break;
|
|
|
|
case WatchStatus.Rewatch:
|
|
|
|
<span class="badge text-bg-primary">Rewatch</span>
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
throw new ArgumentOutOfRangeException();
|
|
|
|
}
|
2022-09-03 01:53:24 +02:00
|
|
|
</td>
|
|
|
|
<td class="td-progress">
|
|
|
|
<div class="progress position-relative">
|
|
|
|
@{
|
|
|
|
var progressf = 100d / show.TotalEpisodes * show.SeenEpisodes;
|
|
|
|
var progress = (int)progressf;
|
|
|
|
}
|
|
|
|
<div class="progress-bar progress-@(progress - progress % 10)" role="progressbar" style="width: @progress%"></div>
|
|
|
|
@if (progress >= 90) {
|
|
|
|
<small class="justify-content-center d-flex position-absolute w-100" style="color: #fff">@show.SeenEpisodes / @show.TotalEpisodes</small>
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
<small class="justify-content-center d-flex position-absolute w-100">@show.SeenEpisodes / @show.TotalEpisodes</small>
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
@show.Comment
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<div class="btn-group" role="group">
|
|
|
|
@if (show.SeenEpisodes == show.TotalEpisodes && show.WatchStatus == WatchStatus.FirstWatch) {
|
2022-11-17 03:32:03 +01:00
|
|
|
<button class="btn btn-sm btn-secondary" onclick="ajax_and_reload('/EditShow/@show.ShowId', 'waiting')">Waiting</button>
|
2022-09-03 01:53:24 +02:00
|
|
|
}
|
|
|
|
@if (show.SeenEpisodes == show.TotalEpisodes && (show.WatchStatus == WatchStatus.FirstWatch || show.WatchStatus == WatchStatus.Rewatch)) {
|
2022-11-17 03:32:03 +01:00
|
|
|
<button class="btn btn-sm btn-success" onclick="ajax_and_reload('/EditShow/@show.ShowId', 'finish')">Finish</button>
|
2022-09-03 01:53:24 +02:00
|
|
|
}
|
|
|
|
@if (show.SeenEpisodes < show.TotalEpisodes && (show.WatchStatus == WatchStatus.Unwatched || show.WatchStatus == WatchStatus.FirstWatch || show.WatchStatus == WatchStatus.Rewatch)) {
|
2022-11-17 03:32:03 +01:00
|
|
|
<button class="btn btn-sm btn-secondary" onclick="ajax_and_reload('/EditShow/@show.ShowId', 'autoinc')">W+1</button>
|
2022-09-03 01:53:24 +02:00
|
|
|
}
|
|
|
|
else if (show.WatchStatus == WatchStatus.Finished) {
|
2022-11-17 03:32:03 +01:00
|
|
|
<button class="btn btn-sm btn-success" onclick="ajax_and_reload('/EditShow/@show.ShowId', 'rewatch')">Start rewatch</button>
|
2022-09-03 01:53:24 +02:00
|
|
|
}
|
|
|
|
else if (show.WatchStatus == WatchStatus.Waiting) {
|
2022-11-17 03:32:03 +01:00
|
|
|
<button class="btn btn-sm btn-secondary" onclick="ajax_and_reload('/EditShow/@show.ShowId', 'autoinc')">New episode</button>
|
2022-09-03 01:53:24 +02:00
|
|
|
}
|
|
|
|
<a class="btn btn-sm btn-primary" href="/EditShow/@show.ShowId">Edit</a>
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2022-11-17 03:32:03 +01:00
|
|
|
|
|
|
|
<script>
|
|
|
|
function ajax_and_reload(url, action, target, value) {
|
|
|
|
if (window.location.hash.length > 0){
|
|
|
|
window.location.replace("#");
|
|
|
|
if (typeof window.history.replaceState == 'function') {
|
|
|
|
history.replaceState({}, '', window.location.href.slice(0, -1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$.ajax(url, {method: 'POST', data: {action: action, target: target, value: value, '__RequestVerificationToken' : '@tokenSet.RequestToken'}, success: function () { location.reload() }})
|
|
|
|
}
|
|
|
|
</script>
|