<form id="domain_form" class="" method="post" action="/admin/domain_save" class="nvForm">
	<input type="hidden" name="domain_id" value="<?php echo($domain->domain_id); ?>" />
	<?php csrf(); ?>

	<div class="row">
		<div class="<?php echo(TOP_LEFT); ?>">
			<h2>Edit Domain Name</h2>
		</div>
		<div class="<?php echo(TOP_RIGHT); ?>">
			<button type="submit" name="submit_action" id="submit" value="close" class="btn btn-primary"><em class="fas fa-save" aria-hidden="true"></em> Save &amp; Close</button>
			<button type="submit" name="submit_action" id="submit2" value="continue" class="btn btn-primary"><em class="fas fa-save" aria-hidden="true"></em> Save &amp; Continue</button>
			<a href="/admin/domains" class="btn btn-secondary"><em class="fas fa-times" aria-hidden="true"></em> Cancel</a>
		</div>
	</div>

	<div class="<?php echo(FORM_ROW); ?>">
		<label for="domain" class="<?php echo(LABEL_COL); ?>">Domain Name</label>
		<div class="<?php echo(LABEL_COL); ?>"><input type="text" name="domain" id="domain" value="<?php echo($domain->domain); ?>" class="form-control" required /></div>
	</div>

	<div class="<?php echo(FORM_ROW); ?>">
		<label for="site_id" class="<?php echo(LABEL_COL); ?>">Site</label>
		<div class="<?php echo(LABEL_COL); ?>">
			<?php
			$wgt = new FeralBasicSelectWidget("site_id", ($domain->site_id ? $domain->site_id : Mainframe::active_site_id()), "form-control custom-select");

			foreach($sites as $site)
			{
				$wgt->AddOption($site->site_id, $site->name);
			}
			$wgt->Create();
			?>
		</div>
	</div>

	<div class="<?php echo(FORM_ROW); ?>">
		<label for="redirect_url" class="<?php echo(LABEL_COL); ?>">Redirect URL</label>
		<div class="<?php echo(LABEL_COL); ?>">
			<input type="text" name="redirect_url" id="redirect_url" value="<?php echo($domain->redirect_url); ?>" class="form-control" />
		</div>
	</div>
</form>