{% include '@dashnex/header.twig' %}
<header class="dashnex-frame-header">
	<h3 class="pull-left">Account</h3>
	<div class="dashnex-frame-primary-actions">
		{% if debug %}
		<form action="" method="post" class="form-inline inline-action-button">
			<input type="hidden" name="action" value="reset">
			<input type="submit" class="btn btn-danger" value="Reset">
		</form>
		{% endif %}

		<form action="" method="post" class="form-inline inline-action-button">
			<input type="hidden" name="action" value="disconnect">
			<input type="submit" class="btn btn-primary" value="Disconnect">
		</form>

		{% if debug %}
		<form action="" method="post" class="form-inline inline-action-button">
			<input type="hidden" name="action" value="clear">
			<input type="submit" class="btn btn-default" value="Clear Licenses">
		</form>
		{% endif %}
	</div>

	<div class="clearfix"></div>
</header>

<div class="dashnex-frame-container no-margin">
	<table class="table">
	{% if debug %}
		<tr>
			<td>Env</td>
			<td>{{ env }}</td>
		</tr>
	{% endif %}

	{% if client %}
		<tr>
			<td>Server</td>
			<td>{{ client.server }}</td>
		</tr>
		{% if debug %}
		<tr>
			<td>Client ID</td>
			<td>{{ client.id }}</td>
		</tr>
		<tr>
			<td>Client Secret</td>
			<td>{{ client.secret }}</td>
		</tr>
		{% endif %}
	{% else %}
		<tr>
			<td>Client</td>
			<td>None</td>
		</tr>
	{% endif %}

	{% if debug %}
		{% if token %}
			<tr>
				<td>Access Token</td>
				<td>{{ token.access }}</td>
			</tr>
			<tr>
				<td>Expires</td>
				<td>{{ token.expires|date }}</td>
			</tr>
		{% else %}
			<tr>
				<td>Token</td>
				<td>None</td>
			</tr>
		{% endif %}
	{% endif %}

	{% if user %}
		{% if debug %}
			<tr>
				<td>User ID</td>
				<td>{{ user.id }}</td>
			</tr>
			<tr>
				<td>Name</td>
				<td>{{ user.name }}</td>
			</tr>
		{% endif %}
		<tr>
			<td>Email</td>
			<td>{{ user.email }}</td>
		</tr>
	{% else %}
		<tr>
			<td>User</td>
			<td>None</td>
		</tr>
	{% endif %}
	</table>
</div>

<div class="dashnex-frame-popover">
	<div class="dashnex-frame-popover-arrow"></div>
	<h3 class="dashnex-frame-popover-title">Help!</h3>
	<div class="dashnex-frame-popover-content">
		<p><a id="show-support-modal-btn" href="#">I need to email support.</a></p>
	</div>
</div>

{% include '@dashnex/modal/support.twig' %}
