<br /><br /><br />
<div class="content_title">Edytuj dane afilianta</div>

<?php if(!empty($afiliant)){ ?>

<form action="/superadmin/edit_afiliant" method="post">
	<table id="hor-minimalist-b" width="642">
		<tr>
			<td>Nazwa*</td>
			<td><input style="width:258px;" type="text" value="<?=$afiliant[0]['nazwa']; ?>" name="nazwa" /></td>
		</tr>	
		<tr>
			<td>Typ*</td>
			<td>
				<select style="width:258px;border:1px solid #E0E0E0;background-color:#F1F1F1;" name="typ">
					<?php 
						if($afiliant[0]['typ']=='Firma')
						{
							echo '<option value="Firma" selected="selected">Firma</option>';			
							echo '<option value="Osoba prywatna">Osoba prywatna</option>';
						}
						else
						{
							echo '<option value="Firma">Firma</option>';
							echo '<option value="Osoba prywatna"  selected="selected">Osoba prywatna</option>';
						}
					?>
				</select>
			</td>
		</tr>
		<tr>
			<td>Imię*</td>
			<td><input style="width:258px;" type="text" name="imie" value="<?=$afiliant[0]['imie']; ?>" />
			<input style="width:258px;" type="hidden" name="id" value="<?=$afiliant[0]['id']; ?>" /></td>
		</tr>
		<tr>
			<td>Nazwisko*</td>
			<td><input style="width:258px;" type="text" name="nazwisko" value="<?=$afiliant[0]['nazwisko']; ?>" /></td>
		</tr>
		<tr>
			<td>Pesel*</td>
			<td><input style="width:258px;" type="text" name="pesel" value="<?=$afiliant[0]['pesel']; ?>" /></td>
		</tr>
		<tr>
			<td>NIP</td>
			<td><input style="width:258px;" type="text" name="nip" value="<?=$afiliant[0]['nip']; ?>" /></td>
		</tr>
		<tr>
			<td>Regon</td>
			<td><input style="width:258px;" type="text" name="regon" value="<?=$afiliant[0]['regon']; ?>" /></td>
		</tr>
		<tr>
			<td>Miasto*</td>
			<td><input style="width:258px;" type="text" name="miasto" value="<?=$afiliant[0]['miasto']; ?>" /></td>
		</tr>
		<tr>
			<td>Ulica*</td>
			<td><input style="width:258px;" type="text" name="ulica" value="<?=$afiliant[0]['ulica']; ?>" /></td>
		</tr>
		<tr>
			<td>Kod pocztowy*</td>
			<td><input style="width:258px;" type="text" name="kod" value="<?=$afiliant[0]['kod_pocztowy']; ?>" /></td>
		</tr>
		<tr>
			<td>Numer domu*</td>
			<td><input style="width:258px;" type="text" name="nr_domu" value="<?=$afiliant[0]['numer_domu']; ?>" /></td>
		</tr>
		<tr>
			<td>Numer mieszkania</td>
			<td><input style="width:258px;" type="text" name="nr_mieszkania" value="<?=$afiliant[0]['nr_mieszkania']; ?>" /></td>
		</tr>
		<tr>
			<td>Telefon*</td>
			<td><input style="width:258px;" type="text" name="telefon" value="<?=$afiliant[0]['telefon']; ?>" /></td>
		</tr>
		<tr>
			<td>E-mail*</td>
			<td><input style="width:258px;" type="text" name="email" value="<?=$afiliant[0]['email']; ?>" /></td>
		</tr>
		<tr>
			<td>Uwagi</td>
			<td><textarea name="uwagi" cols="30" rows="4"  style="border:1px solid #E0E0E0;background-color:#F1F1F1;"><?=$afiliant[0]['uwagi']; ?></textarea></td>
		</tr>				
		<tr>
			<td>Aktywny(załączony)</td>
			<td>
				<select style="width:258px;border:1px solid #E0E0E0;background-color:#F1F1F1;" name="active">
					<?php 
						if($afiliant[0]['active']=='1')
						{
							echo '<option value="1" selected="selected">Tak</option>';			
							echo '<option value="0">Nie</option>';
						}
						else
						{
							echo '<option value="1">Tak</option>';
							echo '<option value="0" selected="selected">Nie</option>';
						}
					?>
				</select>
			</td>
		</tr>
		<tr>
			<td class="last"></td>
			<td class="last"><input style="width:140px;" type="submit" name="dodaj" value="zmień dane afilianta" /></td>
		</tr>
	</table>				
</form><br /><br />
* wymagane pola
<?php } ?>

<br /><br /><br />
<div class="content_title">Użytkownicy pod afiliantem</div>
<br />
<table id="hor-minimalist-b">
    	<tr>
        	<th scope="col">Nazwa użytkownika</th>
            <th scope="col">usuń</th>			
        </tr>

<?php

	foreach($users as $u)
	{
		echo '<tr>
				<td>'.$u['name'].'</td>
				<td><a href="#" onclick="return confirm_del(\''.$u['id'].'\',\''.$u['afiliant_id'].'\')">usuń</a></td>
			  </tr>';		
	}
?>
</table>