<?php
$raspberrys = getRaspberrys();
?>
<div class="row">
	<div class="col-6 col-md-6 offset-md-3 offset-3">
	<br/>
		<h1 style="margin-bottom:20px; margin-top:60px; border-bottom:1px solid #CCC; padding-bottom:20px;"><i class="far fa-plus-square"></i> Ajout d'un capteur</h1>
		<form action="add.php" method="post">
			<table class="table table-striped table-bordered">
				<tbody>
					<tr>
						<td><label for="nom">Nom du capteur : </label></td>
						<td><input type="text" id="nom" name="nom" required/></td>
					</tr>

					<tr>
						<td><label for="type">Type de capteur : </label></td>
						<td><input type="text" id="type" name="type" required/></td>
					</tr>

					<tr>
						<td><label for="raspberry">Raspberry : </label></td>
						<td>
							<div class="form-group my-1 mr-sm-2">
                                                             <select class="custom-select my-1 mr-sm-2" id="raspberry" name="raspberry" required>
                                                                     <?php
                                                                     foreach($raspberrys as $raspberry)
                                                                     { ?>
                                                                       <option><?php echo $raspberry['ip'];?></option>
                                                                     <?php }?>
                                                             </select>
                                                    	</div>
						</td>
					</tr>

					<tr>
						<td><label for="unite">Unite de mesure : </label></td>
						<td><input type="text" id="unite" name="unite" required/></td>
					</tr>

					<tr>
						<td><label for="version">Version : </lavel></td>
						<td>
							<select id="version" name="version" required>
								<option value=0 selected>Arduino USB</option>
								<option value=1>Arduino SPI</option>
								<option value=2>Nucléo USB</option>
							</select>
						</td>
					</tr>
				</tbody>
			</table>
			<input type="submit" class="btn btn-dark btn-lg btn-block" style="margin-top:20px;" value="Ajouter le capteur"/>
			<br/>
		</form>
	</div>
</div>
