<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Edit property &bull; YOPA</title>
	<script src="../static/bundle.js"></script>
	<link rel="stylesheet" href="../static/style.css">
</head>
<body>
<header class="navbar mb-2 mt-2">
	<section class="navbar-section">
		<a href="/" class="navbar-brand text-bold mr-2">
			Yopa
		</a><a href="/" class="btn btn-link"><i class="icon icon-home"></i>Home</a></section>
	<section class="navbar-section">
		YOPA is the best
	</section>
</header>

<div class="content"><h1>Edit property Name</h1>

<form action="/model/property/update/2" method="POST">

	<table>
		<tr>
			<th><label for="name">Name:</label></th>
			<td><input type="text" id="name" name="name" value="Name" autocomplete="off"></td>
		</tr>
		<tr>
			<th><label for="unique">Unique:</label></th>
			<td>
				<input type="checkbox" name="unique" id="unique" value="true" checked autocomplete="off">
			</td>
		</tr>
		<tr>
			<th><label for="optional">Optional:</label></th>
			<td>
				<input type="checkbox" name="optional" id="optional" value="true"  autocomplete="off">
			</td>
		</tr>
		<tr>
			<th><label for="multiple">Multiple:</label></th>
			<td>
				<input type="checkbox" name="multiple" id="multiple" value="true"  autocomplete="off">
			</td>
		</tr>
		<tr>
			<th><label for="data_type">Type:</label></th>
			<td>
				<select name="data_type" id="data_type" autocomplete="off">
					<option value="String" selected>String</option>
					<option value="Integer" >Integer</option>
					<option value="Decimal" >Decimal</option>
					<option value="Boolean" >Boolean</option>
				</select>
			</td>
		</tr>
		<tr>
			<th><label for="default">Default:</label></th>
			<td>
				<input type="text" id="default" name="default" value="" autocomplete="off">
			</td>
		</tr>
	</table>

	<input type="submit" value="Save">
</form>

<script>
  (function () {
    // multiple and unique are XORed. This is also enforced server-side
  	let multiple = document.getElementById('multiple');
  	let unique = document.getElementById('unique');
    unique.addEventListener('input', function () {
      multiple.checked &= !unique.checked;
	})
    multiple.addEventListener('input', function () {
      unique.checked &= !multiple.checked;
    })
  })();
</script></div>
</body>
</html>