<?php

if($auth->validateSession(false, true) == \CodePunch\Config\Auth::VALID) {
	if($auth->isAdmin()) {
include('header.php');
?>
<div class="wrapper">
	
	<div id="dtablewrapper"></div>
	<div id="cardview">
		<h1 id="currentdomain">&nbsp;</h1>
		<div class="cards">
			<div class="card">
				<h3>Renew Domain</h3>
				<p><input class="form-control" type="text" id="domain_to_renew" name="domain_to_renew" placeholder="Enter domain name"></p>
				<div class="break">
					<select class="form-control" id="renew-years" style="inline-block; margin-right:8px;">
						<option value="1">1 Year</option>
						<option value="2">2 Years</option>
						<option value="3">3 Years</option>
						<option value="4">4 Years</option>
						<option value="5">5 Years</option>
						<option value="6">6 Years</option>
						<option value="7">7 Years</option>
						<option value="8">8 Years</option>
						<option value="9">9 Years</option>
					</select>
					<a style="inline-block;" id="renew-domain" class="btn btn-primary">Renew</a>
					<a style="inline-block;" id="calculate-renewcosts" class="btn btn-primary">Costs</a>
				</div>
				<h3 style="margin-top: 10px;"><span id="domain-renew-costdata">&nbsp;</span></h3>
				<div class="break" style="margin-top: 10px;">
					<!-- <div>Registration Costs: <span id="register-costdata"></span></div> -->
					<div>Renewal Costs: <span id="renew-costdata"></span></div>
				</div>
			</div>
			<div class="card">
				<h3>Change Name Servers</h3>
				<div class="break">
					<textarea id="nsdata" class="form-control" placeholder="Enter name servers"></textarea>
					<a id="setns" class="btn btn-success">Set Name Servers</a>
				</div>
			</div>
			
			<div class="card">
				<h3>Register</h3>
				<p><input class="form-control" type="text" id="register_new" name="register_new" placeholder="Enter domain name"></p>
				
				<div class="break" style="margin-bottom: 8px;">
					<select class="form-control" id="register-years" style="inline-block; margin-right:8px;">
						<option value="1">1 Year</option>
						<option value="2">2 Years</option>
						<option value="3">3 Years</option>
						<option value="4">4 Years</option>
						<option value="5">5 Years</option>
						<option value="6">6 Years</option>
						<option value="7">7 Years</option>
						<option value="8">8 Years</option>
						<option value="9">9 Years</option>
						<option value="10">10 Years</option>
					</select>
					<a style="inline-block;" id="register-domain" class="btn btn-primary">Register</a>
					<a style="inline-block;" id="calculate-regcosts" class="btn btn-primary">Costs</a>
				</div>
				
				<select class="form-control" id="new_domain_category" style="block; width:100%;">
					<option value="0">Category To Add New Domain To</option>
					<option value="0">Don't Add to Any Category</option>
				</select>
				
				<h3 style="margin-top: 10px;"><span id="domain-register-costdata">&nbsp;</span></h3>

				<div class="break" style="margin-top: 10px;">
					<div>Registration Costs: <span id="register-costdata"></span></div>
					<!-- <div>Renewal Costs: <span id="renew-costdata"></span></div> -->
				</div>
			</div>
		</div>
		<div id="statuscard" class="cards">
		
			<div id="newreg" class="card">
				<h3>Check Domains</h3>
				
				<div class="break">
				<textarea id="domains-to-check" class="form-control" placeholder="Enter domain names to check"></textarea>
				<a id="check-domain" class="btn btn-success">Check</a>
				</div>
			</div>
			
			<div class="card">
				<h3>Domain Status</h3>
				<div class="break">
					<ul id="domainstatus"></ul>
				</div>
			</div>
		</div>
		<div class="cards">
			<div class="card">
				<h3>Registration Records</h3>
				<div class="break">
					<!-- <p class="small">These will be used for any new registrations. You may edit the information or load the data from the currently selected domain</p> -->
					<div id="regdata" style="max-height: 240px;"></div>
					<a id="load-createdata" class="btn btn-success">Load</a>
				</div>
			</div>
			
			<div class="card">
				<h3>Domain Pricing</h3>
				<div id="pricing"></div>
			</div>
		</div>	
	</div>
</div>


<?php
	}
	else {
		showError();
	}
}
else {
	showError();
}

function showError() {
include('header.php');
?>
<div class="wrapper" style="text-align:center">
		<h3>Requires Administrator Login</h3>
		<p><a class="btn btn-success" href="../?logout&return=toolbox">Login Again</a></p>
</div>
<?php
}
