{% extends "base.html" %}
{% block title %} Genre List {% endblock %}
{% block script %}
<script type="text/javascript" src="{{ url_for('static', filename='delete.js') }}"></script>
{% endblock %}
{% block content %} 

<h1> Genre Categories </h1>

{% if genres|length == 0 %}
	<div class="w3-panel w3-red">
		<h3>There are no Genre Categories in the database</h3>
		<p>You have to add a new Genre Category before you are able to Categorize any movies. </p>
	</div>  
{% else %}
	<h3> Below is a list of all the Genre Categories in the Database </h3>
	
	<ul class="w3-ul w3-pale-blue">
	
		{% set count = namespace(value=0) %}
		{% for genre in genres %}
		
			{% set count.value = count.value + 1 %}
			{% set Id = 'delete' + count.value|string %}
				<span id="{{ Id }}">
					<li> <p><a href="{{ url_for('movies.genres', category=genre.Category_Name, page=1) }}"> 
					{{ genre.Category_Name }} </a> </p>
			 
					<p><a class="alink" href="{{ url_for('genres.editGenre', Id=genre.Category_ID) }}">
					Edit Genre {{ genre.Category_Name }} </a></p>
			
					</p><a class="alink" 
					href="#"  onclick="deleteEntity('{{ Id }}','{{ url_for('genres.delete',Id=genre.Category_ID) }}','{{ genre.Category_ID }}')">
					Delete Genre {{ genre.Category_Name }} </a></p></li>
				</span>
		{% endfor %}
		
	</ul>
	
	<p><a class="alink" href="{{ url_for('genres.create') }}">Add New Genre Category </a></p>
{% endif %}



{% endblock %}