{% extends "base.html" %}
{% block title %}Furizon 2024 Nosecount{% endblock %}
{% block main %}
	<main class="container">
		{% if order and order.isAdmin() %}
			<script src="/res/scripts/roomManager.js"></script>
		{% endif %}
		<header>
			<picture>
				<source srcset="/res/furizon.png" media="(prefers-color-scheme:dark)">
				<img src="/res/furizon-light.png" style="height:4rem;text-align:center;">
			</picture>
		</header>
		<p>Welcome to the nosecount page! Here you can see all of the available rooms at the convention, as well as the occupants currently staying in each room. Use this page to find your friends and plan your meet-ups.</p>
		{% for o in orders.values() %}
			{% if o.code == o.room_id and o.room_confirmed %}
				<h4 style="margin-top:1em;">
					<span>{{o.room_name}}</span>
					{% if order and order.isAdmin() %}
						<div class="room-actions">
							<a onclick="confirmAction('rename', this)" action="/manage/admin/room/rename/{{o.code}}"><img src="/res/icons/pencil.svg" class="icon" /><span>Rename</span></a>
							<a onclick="confirmAction('unconfirm', this)" action="/manage/admin/room/unconfirm/{{o.code}}"><img src="/res/icons/door_open.svg" class="icon" /><span>Unconfirm</span></a>
							<a class="act-del" onclick="confirmAction('delete', this)" action="/manage/admin/room/delete/{{o.code}}"><img src="/res/icons/delete.svg" class="icon" /><span>Delete</span></a>
						</div>
					{% endif %}
				</h4>
				<div class="grid people" style="padding-bottom:1em;">
					{% for m in o.room_members %}
						{% if m in orders %}
							{% with person = orders[m] %}
								<div style="margin-bottom: 1em;">
									{% with order=person, imgSrc='/res/propic/' + (person.ans('propic') or 'default.png'), effects = true, flag = true %}
										{% include 'blocks/propic.html' %}
									{% endwith %}
									<h5>{{person.ans('fursona_name')}}</h5>
								</div>
							{% endwith %}
						{% endif %}
					{% endfor %}
				</div>
			{% endif %}
		{% endfor %}
		{% for o in orders.values() if (o.code == o.room_id and not o.room_confirmed) %}
			{% if loop.first %}
				<hr />
				<h1>Unconfirmed rooms</h1>
				<p>These unconfirmed rooms are still being organized and may be subject to change. These rooms may also have openings for additional roommates. If you are interested in sharing a room, you can use this page to find potential roommates</p>
			{% endif %}
			<h3>
				<span>{{o.room_name}}</span>
				{% if o.room_person_no - len(o.room_members) > 0 %} <span class="nsc-room-counter"> - Remaining slots: {{o.room_person_no - len(o.room_members)}}</span> {% endif %}
				{% if order and order.isAdmin() %}
					<div class="room-actions">
						<a onclick="confirmAction('rename', this)" action="/manage/admin/room/rename/{{o.code}}"><img src="/res/icons/pencil.svg" class="icon" /><span>Rename</span></a>
						<a class="act-del" onclick="confirmAction('delete', this)" action="/manage/admin/room/delete/{{o.code}}"><img src="/res/icons/delete.svg" class="icon" /><span>Delete</span></a>
					</div>
				{% endif %}
			</h3>
			<div class="grid people" style="padding-bottom:1em;">
				{% for m in o.room_members %}
					{% if m in orders %}
						{% with person = orders[m] %}
							<div style="margin-bottom: 1em;">
								{% with order=person, imgSrc='/res/propic/' + (person.ans('propic') or 'default.png'), effects = true, flag = true %}
									{% include 'blocks/propic.html' %}
								{% endwith %}
								<h5>{{person.ans('fursona_name')}}</h5>
							</div>
						{% endwith %}
					{% endif %}
				{% endfor %}
			</div>
			{% if loop.last %}</div>{% endif %}
		{% endfor %}

		{% for person in orders.values() if not person.room_id and (not person.room_confirmed) and not person.daily %}
			{% if loop.first %}
				<hr />
				<h1>Roomless furs</h1>
				<p>These furs have not yet secured a room for the convention. If you see your name on this list, please make sure to secure a room before the deadline to avoid being placed in a random room. If you are looking for a roommate or have an open spot in your room, you can use this page to find and connect with other furries who are also looking for housing 🎲</p>
				<div class="grid people" style="padding-bottom:1em;">
			{% endif %}
				<div style="margin-bottom: 1em;">
					{% with order=person, imgSrc='/res/propic/' + (person.ans('propic') or 'default.png'), effects = true, flag = true %}
						{% include 'blocks/propic.html' %}
					{% endwith %}
					
					<h5>{{person.ans('fursona_name')}}</h5>
				</div>
			{% if loop.last %}</div>{% endif %}
		{% endfor %}

		{% for person in orders.values() if person.daily %}
			{% if loop.first %}
				<hr />
				<h1>Daily furs!</h1>
				<p>These furs will not stay in our hotels, but may be there with us just a few days!</p>
				<div class="grid people" style="padding-bottom:1em;">
			{% endif %}
				<div style="margin-bottom: 1em;">
					{% with order=person, imgSrc='/res/propic/' + (person.ans('propic') or 'default.png'), effects = true, flag = true %}
						{% include 'blocks/propic.html' %}
					{% endwith %}
					<h5>{{person.ans('fursona_name')}}</h5>
				</div>
			{% if loop.last %}</div>{% endif %}
		{% endfor %}

		<form id="intentFormAction" method="GET" action="">
			<dialog id="modalRoomconfirm">
				<article>
					<a href="#close" aria-label="Close" class="close" onClick="javascript:this.parentElement.parentElement.removeAttribute('open')"></a>
					<h3 id="intentText">Confirm room edit</h3>
					<p id="intentDescription"></p>
					<div id="intentEditPanel">
						<label for="name">Enter a new room name</label>
						<input id="intentRename" name="name" type="text" value="" minlength="4" maxlength="64"/>
					</div>
					<footer>
						<input id="intentSend" type="submit" value="Confirm" />
					</footer>
				</article>
			</dialog>
		</form>

	</main>
{% endblock %}
