<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>{{.Strings.Watchlist.title}}</title>
		<link rel="stylesheet" href="/static/style/style.css" />
		<link rel="icon" type="image/svg+xml" href="/static/img/logo.svg">
		<link rel="apple-touch-icon" type="image/svg+xml" href="/static/img/logo.svg">
	</head>
	<body>
		<header class="w12 padding-bottom-_25 flex flex-row flex-justify-space flex-align-centre">
			<a href="/" class="decoration-none">
				<h1 class="inline valign-mid text sans margin-lr-1">a·muse</h1>
			</a>
			<div class="margin-lr-1 text">
				<nav>
					<label for="hamburger" class="cursor-hand">
						<img src="/users/{{.State.User.Username}}/avatar?size=small" class="border-radius-25 width-1_5"/>
					</label>
					<input type="checkbox" id="hamburger" class="display-none" />
					<ul class="absolute right top-1 padding-lr-1 padding-tb-_5 bg align-right list-style-none sans">
						<!--<li><a href="/users/{{.State.User.Username}}" class="decoration-none text-accent">{{.Strings.Global.account}}</a><span class="material-icon padding-lr-_5">&#xe851;</span></li>-->
						<li><a href="/users/{{.State.User.Username}}/watchlist" class="decoration-none text-accent">{{.Strings.Global.watchlist}}</a><span class="material-icon padding-lr-_5">&#xe04a;</span></li>
						<li><a href="/users/{{.State.User.Username}}/tvqueue" class="decoration-none text-accent">{{.Strings.Global.tv_queue}}</a><span class="material-icon padding-lr-_5">&#xe1b2;</span></li>
						<li><a href="/users/{{.State.User.Username}}/readlist" class="decoration-none text-accent">{{.Strings.Global.readlist}}</a><span class="material-icon padding-lr-_5">&#xe431;</span></li>
						<li><a href="/users/{{.State.User.Username}}/experiences" class="decoration-none text-accent">{{.Strings.Global.experiences}}</a><span class="material-icon padding-lr-_5">&#xe042;</span></li>
						<li class="bg-error">
							<form action="/users/{{.State.User.Username}}/sessions/{{.State.User.Session}}" method="POST" class="inline">
								<input type="hidden" value="DELETE" name="method" />
								<input type="submit" value="{{.Strings.Global.log_out}}" class="border-none bg-none font-normal text-accent padding-lr-0 cursor-hand font-1" />
							</form><span class="material-icon padding-lr-_5">&#xe7ff;</span>
						</li>
					</ul>
				</nav>
			</div>
		</header>
		<main class="margin-lr-1">
			<!-- search, filter, order -->
			<div class="flex flex-row flex-wrap flex-centre flex-align-start margin-top-1">
				<form method="GET" class="flex inline margin-lr-1 border-bottom">
					<input type="search" name="filter" class="border-none bg-none sans text" placeholder="{{.Strings.Watchlist.filter}}" value="{{.Data.Query}}" />
				</form>
			</div>
			{{if .Data.List}}
			<div class="flex flex-row flex-wrap flex-justify-space flex-align-start margin-top-1">
				<div>
					{{if gt .Data.Page 1}}
					<a href="/users/{{.State.User.Username}}/watchlist?filter={{.Data.Query}}&page={{.Data.PrevPage}}" class="decoration-none" title="{{.Strings.Search.prev_link_title}}"><span class="material-icon font-2">&#xe408;</span></a>
					{{end}}
				</div>
				<div>Page {{.Data.Page}}/{{.Data.Pages}}</div>
				<div>
					{{if lt .Data.Page .Data.Pages}}
					<a href="/users/{{.State.User.Username}}/watchlist?filter={{.Data.Query}}&page={{.Data.NextPage}}" class="decoration-none" title="{{.Strings.Search.next_link_title}}"><span class="material-icon font-2">&#xe409;</span></a>
					{{end}}
				</div>
			</div>
			<div class="flex flex-row flex-wrap flex-justify-space flex-align-start">
				{{range .Data.List}}
				<a href="/films/{{.Id}}" class="decoration-none force-width-18 margin-tb-1 no-outline border-solid border-gradient border-tb-transparent border-_5 padding-tb-_25 padding-lr-_25">
					<div class="flex">
						<div>
							{{if .Cover}}
							<img src="https://image.tmdb.org/t/p/w154{{.Cover}}" class="min-height-231px width-154px{{if .IsUnreleased "film"}} bw{{end}}" />
							{{else}}
							<img src="/static/img/poster_empty.webp" class="min-height-231px width-154px" />
							{{end}}
						</div>
						<div class="margin-lr-1">
							<p class="sans">{{.Title}}</p>
							{{if eq .Status "Canceled"}}
							<p class="sans font-_875 text-error">Cancelled</p>
							{{else if gt .YearStart 1}}
							<p class="sans font-_875 text-grey">{{.YearStart}}</p>
							{{end}}
							<p class="sans font-_875">
								{{.GetGenres $.Data.Genres}}
							</p>
							{{if gt .Runtime 0}}
							<p class="sans font-_875 text-grey">{{.Runtime}} min</p>
							{{end}}
							<p class="font-_875 text-grey">
								{{if .HasPrevious}}<span class="material-icon" title="Watch previous part first">&#xe02c;</span>{{end}}
								<!-- todo based on -->
							</p>
						</div>
					</div>
				</a>
				{{end}}
			</div>
			<div class="flex flex-row flex-wrap flex-justify-space flex-align-start margin-top-1">
				<div>
					{{if gt .Data.Page 1}}
					<a href="/users/{{.State.User.Username}}/watchlist?filter={{.Data.Query}}&page={{.Data.PrevPage}}" class="decoration-none" title="{{.Strings.Search.prev_link_title}}"><span class="material-icon font-2">&#xe408;</span></a>
					{{end}}
				</div>
				<div>
					{{if lt .Data.Page .Data.Pages}}
					<a href="/users/{{.State.User.Username}}/watchlist?filter={{.Data.Query}}&page={{.Data.NextPage}}" class="decoration-none" title="{{.Strings.Search.next_link_title}}"><span class="material-icon font-2">&#xe409;</span></a>
					{{end}}
				</div>
			</div>
			{{else if and (gt .Data.Page .Data.Pages) (gt .Data.Pages 0)}}
			<div class="font-2 w12 flex flex-centre margin-top-10">
				<div>
					<p>{{.Strings.Global.too_far_quote}}</p>
					<p class="indent-2 sans">—{{.Strings.Global.too_far_character}} (<span class="italic sans">{{.Strings.Global.too_far_title}}</span>, {{.Strings.Global.too_far_code}} {{.Strings.Global.too_far_episode}})</p>
				</div>
			</div>
			{{else}}
			<div class="font-2 w12 flex flex-centre margin-top-10">
				<div>
					<p>{{.Strings.Global.empty_quote}}</p>
					<p class="indent-2 sans">—{{.Strings.Global.empty_character}} (<span class="italic sans">{{.Strings.Global.empty_title}}</span>)</p>
				</div>
			</div>
			{{end}}
		</main>
	</body>
</html>
