<?= $this->extend('layouts/form.php') ?>

<?= $this->section('content') ?>
<?php
$usernumber = '';
if(isset($users)) { $data = $users[0]; }
if(isset($data)) {
	if(isset($data['userid'])) { $userid= $data['userid']; }
	$firstname = $data['firstname'];
	$lastname = $data['lastname'];
}
?>
<div class="form-body">
	<h3 class="card-title">User Password Editor</h3>
	<hr>
	<?php 
	if(isset($validation)) {
	?>
		<div class='alert alert-danger alert-dismissible'>
			<?= $validation->listErrors(); ?>
			<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <span aria-hidden="true"></span> </button>
		</div>
	<?php
	}
	?>
	<form method='post'>
		<input type='hidden' name='userid' value='<?=$userid;?>'/>
		<div class='form-group row'>
			<div class='col-3'>Username</div>
			<div class='col-9'><?=$firstname." ".$lastname;?></div>
		</div>
		<div class="form-group row">
			<label class="col-3 col-form-label">Password</label>
			<div class="col-9"><input class="form-control" type="password" name='password'></div>
		</div>
		<div class="form-group row">
			<label class="col-3 col-form-label">Confirm Password</label>
			<div class="col-9"><input class="form-control" type="password" name='password_confirm'></div>
		</div>
		<button type="button" class="btn btn-dark float-start" onclick="window.close()">Cancel</button>
		<button type="submit" class="btn btn-success text-white float-end"> <i class="fa fa-check"></i> Update</button>
	</form>
</div>
<?= $this->endSection() ?>