<?php
	$_world = get_world_info();
	$_vars = get_world_variables();
?>

<div class="row">
	<div class="col-sm-6 col-xl-3">
		<div class="p-2 bg-primary-300 rounded overflow-hidden position-relative text-white mb-g">
			<div class="">
				<h3 class="display-4 d-block l-h-n m-0 fw-500">
					1
					<small class="m-0 l-h-n">GM Online</small>
				</h3>
			</div>
			<i class="fad fa-user-secret position-absolute pos-right pos-bottom opacity-15 mb-n1 mr-n1" style="font-size:6rem"></i>
		</div>
	</div>

	<div class="col-sm-6 col-xl-3">
		<div class="p-2 bg-warning-400 rounded overflow-hidden position-relative text-white mb-g">
			<div class="">
				<h3 class="display-4 d-block l-h-n m-0 fw-500">
					<?php echo get_character_count(); ?>
					<small class="m-0 l-h-n text-secondary">Player Characters</small>
				</h3>
			</div>
			<i class="fad fa-user-friends position-absolute pos-right pos-bottom opacity-15  mb-n1 mr-n4" style="font-size: 6rem;"></i>
		</div>
	</div>
	
	<div class="col-sm-6 col-xl-3">
		<div class="p-2 bg-success-200 rounded overflow-hidden position-relative text-white mb-g">
			<div class="">
				<h3 class="display-4 d-block l-h-n m-0 fw-500">
					0
					<small class="m-0 l-h-n">Players Banned</small>
				</h3>
			</div>
			<i class="fal fa-lightbulb position-absolute pos-right pos-bottom opacity-15 mb-n5 mr-n6" style="font-size: 8rem;"></i>
		</div>
	</div>
	
	<div class="col-sm-6 col-xl-3">
		<div class="p-2 bg-info-200 rounded overflow-hidden position-relative text-white mb-g">
			<div class="">
				<h3 class="display-4 d-block l-h-n m-0 fw-500">
					Online
					<small class="m-0 l-h-n">Server Status</small>
				</h3>
			</div>
			<i class="fad fa-lightbulb-on position-absolute pos-right pos-bottom opacity-15 mb-n1 mr-n4" style="font-size: 6rem;"></i>
		</div>
	</div>
	
</div>

<div class="row">
	<div class="col-xs-12 col-sm-7">
		<div id="panel-1" class="panel">
			<div class="panel-hdr">
				<h2>
					<i class="fad fa-cog text-success"></i>&nbsp;World <span class="fw-300"><i>Server</i></span>
				</h2>
				<div class="panel-toolbar">

				</div>
			</div>
			<div class="panel-container show">
				<div class="panel-content">
					<p class="text-right">
						<button class="btn btn-xs btn-default"><i class="fad fa-stop text-danger"></i> Stop LS</button>&nbsp;<small class="text-muted">|</small>&nbsp;
						<button class="btn btn-xs btn-default"><i class="fad fa-key-skeleton text-warning"></i> Restart LS</button>&nbsp;<small class="text-muted">|</small>&nbsp;
						<button class="btn btn-xs btn-default"><i class="fad fa-stop-circle text-danger"></i> Stop World</button>&nbsp;<small class="text-muted">|</small>&nbsp;
						<button class="btn btn-xs btn-default"><i class="fad fa-globe-asia text-success"></i> Restart World</button>
					</p>
					<table class="table table-bordered">
					<?php
						echo '
						<tr>
							<td> <strong>World Name</strong>: '.$_world['name'].' <small class="badge-pill badge-primary"><strong>id</strong> '.$_world['id'].'</small></td>
							<td>
								<div class="custom-control custom-switch">
									<input type="checkbox" class="custom-control-input" disabled="" id="customSwitchd">
									<label class="custom-control-label" for="customSwitchd">Disabled</label>
								</div>
							</td>
							<td><strong>IP Address</strong>: '.$_world['ip_address'].'</td>
							<td><strong>Login Version</strong>: '.$_world['login_version'].'</td>
						</tr>
						<tr>
							<td><strong>Account</strong>: '.$_world['account'].'</td>
							<td><strong>Password</strong>: <span class="text-secondary"> - <i>hidden</i> -</span></td>
							<td colspan="2"><strong>Last Seen</strong>: '.$_world['lastseen'].'</td>
						</tr>
						<tr>
							<td colspan="3"><strong>Description</strong>: '.$_world['description'].'</td>
							<td>
								<button class="btn btn-xs btn-warning"><i class="fas fa-edit"></i> Modify World</button>
							</td>
						</tr>
						';
					?>
					</table>
					<div class="col-xs-12">
						<p>World Server Console</p>
						<div class="console text-left text-monospace">
							[<strong class="text-danger">FATAL</strong>]: SERVER CRASHED!<br>
							[<strong class="text-warning">NOTICE</strong>]: UHH... TRUNCATING ALL TABLES TO CORRECT ISSUE!<br>
							[<strong class="text-info">SUCCESS</strong>]: ALL TABLES TRUNCATED!<br>
							[<strong class="text-warning">NOTICE</strong>]: RESTARTING WORLD SERVER!<br>
							[<strong class="text-danger">FATAL</strong>]: SERVER CRASHED!<br>
						</div>
						<table class="table">
							<tr>
								<th class="n-p-b va n-p-lr" valign="middle" style="width:70px;"><button class="btn btn-sm btn-default inline"><i class="fas fa-bolt text-warning"></i> Run</button></th>
								<td class="n-p-b"><input class="form-control" placeholder="Enter world server command to execute."/></td>
							</tr>
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>
	
	<div class="col-xs-12 col-sm-5">
		<div id="panel-1" class="panel">
			<div class="panel-hdr">
				<h2>
					<i class="fad fa-tag text-info"></i>&nbsp;Variable <span class="fw-300"><i>Configuration</i></span>
				</h2>
			</div>
			<div class="panel-container show">
				<div class="panel-content">
					<table class="table">
						<?php 
							foreach($_vars as $vk => $v) {
								echo '
								<tr>
									<th class="n-p-b va variable-title" data-name="'.$vk.'" valign="middle">'.$vk.'</th>
									<td class="n-p-b">
										<input class="form-control variable-input" type="text" data-name="'.$vk.'" value="'.$v['value'].'"/> 
									</td>
									<td class="n-p-b text-center">
										<button class="btn btn-sm btn-default edit-variable" data-name="'.$vk.'"><i class="fad fa-edit"></i></button>
									</td>
								</tr>';
								if(strlen($v['desc']) > 0) {
									echo '
									<tr>
										<td colspan="3" class="n-b-t n-p-b n-p-tb">
											<small class="text-muted">'.$v['desc'].'</small>
										</td>
									</tr>';
								}
							}
						?>
						</table>
				</div>
			</div>
		</div>
	</div>
	
</div>