@extends("layout.main")
@section("content")

<ul class="nav nav-tabs mt-3 mb-2">
	<li class="nav-item">
		@if ($tab == "account")
			<a class="nav-link active" aria-current="page" href="#">Account</a>
		@else
			<a class="nav-link" aria-current="page" href="/account">Account</a>
		@endif
	</li>
	<li class="nav-item">
		@if ($tab == "data")
			<a class="nav-link active" aria-current="page" href="#">Data</a>
		@else
			<a class="nav-link" aria-current="page" href="/account/data">Data</a>
		@endif
	</li>
</ul>

@if ($tab == "account")
<div class="row">
	<div class="col-12 col-lg-3"></div>
	<div class="col-12 col-lg-6">
		<h5>Change Password</h5>
		<form action='/account/chpass' method="POST">
			<div class="input-group">
				<span class="input-group-text w-25">Current password</span>
				<input class="form-control" name="current" type="password">
			</div>
			<div class="input-group">
				<span class="input-group-text w-25">New password</span>
				<input class="form-control" name="pass1" type="password">
			</div>
			<div class="input-group">
				<span class="input-group-text w-25">Confirm password</span>
				<input class="form-control w-50" name="pass2" type="password">
				<input class="form-control w-25 btn btn-primary" type="submit" value="Change">
			</div>
		</form>
	</div>
	<div class="col-12 col-lg-3"></div>
</div>	
@endif



@if ($tab == "data")

<p>Here is a list of all the data associated with your current session.</p>

<table class="table">
	<thead>
		<tr>
			<th>Key</th>
			<th>Data</th>
		</tr>
	</thead>

	<tbody>
		@foreach ($session as $k=>$v)
			<tr>
				<td>{{ $k }}</td>
				<td>{{ json_encode($v) }}</td>
			</tr>
		@endforeach
	</tbody>
</table>

<p>And here is the contents of your user's database record.</p>

<table class="table">
	<thead>
		<tr>
			<th>Key</th>
			<th>Data</th>
		</tr>
	</thead>

	<tbody>
		@foreach ($user->_data as $k=>$v)
			<tr>
				<td>{{ $k }}</td>
				<td>{{ json_encode($v) }}</td>
			</tr>
		@endforeach
	</tbody>
</table>

<p>And that's it. That's the sum total of the data we currently store.</p>

@endif

@endsection
