<details id="room">
	<summary role="button"><img src="/res/icons/bedroom.svg" class="icon"/> Accomodation & Roommates <span class="status">{% if not order.room_confirmed %}⚠️{% endif %}</span></summary>
	<h2>Your room {% if room_members %}- {{room_members[0].ans('room_name')}}{% endif %}</h2>
	
	{# Show alert if room owner has wrong people inside #}
	{% if room_members and quota.get_left(len(room_members)) == 0 and (not order.room_confirmed) %}
		<p class="notice">⚠️ Your room contains {{len(room_members)}} people inside, but sadly there are no more {{[None,'single','double','triple','quadruple','quintuple'][len(room_members)]}} rooms. You need to add or remove people until you reach the size of an available room if you want to confirm it.</p>
	{% endif %}
	
	{# Show alert if room was not confirmed #}
	{% if order.room_id and not order.room_confirmed %}
		<p class="notice">⚠️ Your room hasn't been confirmed yet. Unconfirmed rooms are subject to changes by the staff as we optimize for hotel capacity.</p>
	{% endif %}
	
	{# Show notice if the room is confirmed #}
	{% if order.room_confirmed %}
		<p class="notice" style="background:#060">✅ Your <strong>{{[None,'single','double','triple','quadruple','quintuple'][len(room_members)]}}</strong> room has been confirmed</p>
	{% endif %}
	
	{# Show roommates if room is set #}
	{% set room = namespace(forbidden=false) %}
	{% if order.room_id %}
		<div class="grid people" style="padding-bottom:1em;">
			{% for person in room_members %}
				<div style="margin-bottom: 1em;">
					<div class="propic-container">
						<img class="propic propic-{{person.sponsorship}}" src="/res/propic/{{person.ans('propic') or 'default.png'}}" />
						<img class="propic-flag" src="/res/flags/{{person.country.lower()}}.svg" />
					</div>
					<h3>{{person.ans('fursona_name')}}</h3>
					{% if person.code == order.room_id %}<p><strong style="color:#c6f">ROOM OWNER</strong></p>{% endif %}
					<p>{{person.ans('staff_title') if person.ans('staff_title') else ''}} {{'Fursuiter' if person.ans('is_fursuiter') != 'No'}}</p>
					{% if person.status == 'pending' %}
						<p><strong style="color:red;">UNPAID</strong></p>
					{% endif %}
					{% if order.room_owner and person.code != order.code and (not order.room_confirmed) %}<a href="/manage/room/kick/{{person.code}}">KICK</a>{% endif %}
				</div>
				
				{% if person.status != 'paid' %}
					{% set room.forbidden = True %}
				{% endif %}
			{% endfor %}
			
			{% if order.room_id == order.code and not order.room_confirmed and len(room_members) < 5 %}
				<div>
					<a href="javascript:document.getElementById('modal-roominvite').setAttribute('open', 'true');">
						<div class="propic-container">
							<img class="propic" src="/res/new.png" />
							<h3>Invite</h3>
							<p>Get room code</p>
						</div>
					</a>
				</div>
			{% endif %}
		</div>
	{% elif order.pending_room %}
		<p>You have have asked to join the room of another member. Wait for them to confirm or reject your request.</p>
		<a role="button" href="/manage/room/cancel_request">Cancel pending join request</a>
	{% else %}
		<p class="notice">🎲 If you don't join a room or create your one within the room deadline, we will randomly put you into a room with free spots.</p>
		<p>To join a room, ask somebody to send you their room code.</p>
		<p class="grid">
			<a role="button" href="/manage/room/create">Create a room</a>
			<a role="button" href="javascript:document.getElementById('modal-joinroom').setAttribute('open', 'true');">Join a room</a>
		</p>
	{% endif %}
	
	{% if order.room_owner and not order.room_confirmed %}
		{% if room.forbidden %}
			<p class="notice">⚠️ There are roommates for which a payment was not received yet, you will be able to confirm this room only once all payments are completed.</p>
		{% endif %}
	{% endif %}
	
	<p class="grid">
		{% if order.room_owner %}
			{% if len(room_members) == 1 and not order.room_confirmed %}
				<a href="/manage/room/delete" role="button">Delete room</a>	
			{% endif %}	
			
			{% if not order.room_confirmed %}
				<a role="button" {% if not room.forbidden and quota.get_left(len(room_members)) > 0 %}href="javascript:document.getElementById('modal-roomconfirm').setAttribute('open', 'true');"{% endif %}>Confirm <strong>{{[None,'single','double','triple','quadruple','quintuple'][len(room_members)]}}</strong> room</a>
			{% endif %}
		{% else %}
			{% if order.room_id and not order.room_confirmed %}
				<a href="/manage/room/leave" role="button">Leave room</a>	
			{% endif %}
		{% endif %}	
	</p>
	
	{# Pending roommates #}
	{% if pending_roommates %}
		<h4>Pending roommates</h4>
		<p>These people have asked to join your room.</p>
		<table>
			{% for person in pending_roommates %}
				<tr>
					<td style="width:4em;"><img style="width:2em;height:2em;" class="propic" src="/res/propic/{{person.ans('propic') or 'default.png'}}" /></td>
					<td>{{person.name}}</td>
					{% if person.status == 'pending' %}
						<td><strong style="color:red;">UNPAID</strong></td>
					{% endif %}
					<td style="width:1%;white-space: nowrap;"><a role="button" href="/manage/room/approve/{{person.code}}">Approve</a></td>
					<td style="width:1%;white-space: nowrap;"><a role="button" href="/manage/room/reject/{{person.code}}">Reject</a></td>
				</tr>
			</div>
				
			{% if person.status != 'paid' %}
				{% set room.forbidden = True %}
			{% endif %}
		{% endfor %}
		</table>
	{% endif %}
	
	{# Room availability is always shown #}
	<h4>Room availability</h4>
	<table>
		{% for q in quota.data['results'] if 'Room' in q['name'] %}
			<tr {% if q['available_number'] == 0 %}style="text-decoration:line-through;"{% endif %}>
				<td>{{q['name']}}</td>
				<td>{{q['available_number']}} left</td>
			</tr>
		{% endfor %}
	</table>
</details>
