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

<?= $this->section('content') ?>
<?php
$emailid = 0;
$email = '';
if(isset($emails[0])) { $data = $emails[0]; }
if(isset($new_value)) { $data = $new_value; }
if(isset($data)) {
	if(isset($data['emailid'])) { $emailid= $data['emailid']; }
	$email = $data['email'];
}
?>
<div class="form-body">
	<h3 class="card-title">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'>
		<div class="form-group row">
			<input type='hidden' name='emailid' value='<?=$emailid;?>'/>
			<label class="col-2 col-form-label">Email</label>
			<div class="col-10"><input class="form-control" type="text" name='email' value="<?=$email;?>"></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> Submit</button>
	</form>
</div>
<?= $this->endSection() ?>