<!DOCTYPE html>
<html>
<head>
	<title>Meal List - KUKAPP</title>
	<meta name="viewport" content="width=device-width">
	<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}">
	<script src="{{ url_for('static', filename='script.js') }}"></script>
	<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
	<script src="https://use.fontawesome.com/2fef7be393.js"></script>
	<style type="text/css">
		html {
			background-image: url({{url_for('static', filename='burger.jpg')}});
			background-position: left top;
			background-repeat: no-repeat;
			background-size: 100% auto;
			background-color: #aeaeac;
			background-attachment: fixed;
		}
	</style>
</head>
<body>
	<div class="leaderboard">
		<h1 style="text-align: center">Leaderboard</h1>
		<div class="leaderboard-contiainer">
			{% for person in leaderboard %}
			<div class="lb-entry">
				<img src="{{url_for('static', filename=person.name + '.png')}}">
				<span class="name">{{ person.name }}</span>
				<span class="score">{{ person.score }}</span>
			</div>
			{% endfor %}
		</div>
	</div>
	<div class="right-pane">
		<div class="meal-list">
			<h2>{{meals[0].meal_friendly_date}}</h2>
			{% for meal in meals %}
				{% if loop.index != 1 and (meal.meal_friendly_date != meals[loop.index - 2].meal_friendly_date) %}
					<h2>{{meal.meal_friendly_date}}</h2>
				{% endif %}
				{% if meal.needs_confirmation %}
				<div class="flex-card" onclick="location.href='/verify?meal={{meal.id}}';" style="cursor: pointer; width: 60%; justify-content: space-between;">
				{% else %}
				<div class="flex-card" onclick="location.href='/view_meal?meal={{meal.id}}';" style="cursor: pointer; width: 60%; justify-content: space-between;">
				{% endif %}
					<span{% if meal.needs_confirmation%} style="color: #EE7500;"{% endif %}><b>{{meal.meal_time}}</b></span>
					<p style="text-align: left;">{% if meal.needs_confirmation %}Did &nbsp;{% endif %}{% if meal.kuk != "" %}<img class="flex-small-thumb" src="{{url_for('static', filename=meal.kuk + '.png')}}" title="{{meal.kuk}}" align="middle" style="margin: " /> &nbsp; {% if not meal.needs_confirmation %}<b>WILL</b>{% endif %}{% else %}<img class="flex-small-thumb" src="{{url_for('static', filename=meal.candidate + '.png')}}" title="{{meal.kuk}}" align="middle" style="margin: " /> &nbsp; {% if not meal.needs_confirmation %}<b>SHOULD</b>{% endif %}{% endif%} cook for <br>{% for e in meal.eaters %}<img class="flex-small-thumb" src="{{url_for('static', filename=e + '.png')}}" title="{{e}}" align="middle"/>&nbsp; {% endfor %}{% if meal.needs_confirmation %}<b>?</b>{% endif %}</p>
					{% if meal.needs_confirmation %}<span style="color: #EE7500;">Please verify.{% else %}<span>{% if meal.friendly_selection_deadline != '' %}Confirmed in {{meal.friendly_selection_deadline}}{% else %}Confirmed.{% endif %}{% endif %}</span>
				</div>
			{% endfor%}
			<h2> &nbsp; </h2>
			<div class="flex-card" style="background: none; box-shadow: none">
				<div class="round-button" onclick="location.href='/mealplanner';"><i class="fa fa-calendar" aria-hidden="true"></i></div>
				<span><b>Plan new meal</b></span>
			</div>
		</div>
		<div class="user-card">
			{% if current_user.is_authenticated %}
			<img src="{{url_for('static', filename=current_user.name + '.png')}}">
			{% endif %}
			<div class="user-info">
				{% if current_user.is_authenticated %}
				<span>{{current_user.name}}</span>
				<div class="rect-button" onclick="location.href='/logout';" style="background-color: #EE7500;">LOGOUT</div>
				{% else %}
				<div class="rect-button" onclick="location.href='/login';" style="background-color: #EE7500;">LOGIN</div>
				{% endif %}
			</div>
		</div>
	</div>
</body>
</html>