<?php include_once('header.php'); ?>

<h2><?=$nadpis?></h2>

<?php
	if(!empty($akt) and !empty($firma))
	{
		?>
		<form method="POST" action="/admin/aktualizuj/<?php if(!empty($akt[0]['id']))echo $akt[0]['id'];?>/" onsubmit="return confirm(\'Vykonat zmeny?\')">
		<input type="submit" value="Vykonat akci">
		<input type="hidden" name="makechanges" value="1">
		<input type="hidden" name="id" value="<?php if(!empty($akt[0]['id']))echo $akt[0]['id'];?>">
		<input type="hidden" name="firma_id" value="<?php if(!empty($firma[0]['id']))echo $firma[0]['id'];?>">
		<input type="checkbox" name="deleteakt" id="deleteakt" value="1"><label for="deleteakt">Zmazat aktualizaciu?</label>
		<table width="100%" border="1" cellpadding="2" cellspacing="3"><tr><th>Aktualizace</th><th width="20">Potvrd</th><th>Firma</th></tr>
		<tr <?php if(!empty($firma[0]['nazev']) and !empty($akt[0]['nazev']) and $firma[0]['nazev'] == $akt[0]['nazev'])echo 'class="ok"'; ?>>
			<td width="20">nazev:<br><input type="text" name="nazev" size="60" value="<?php if(!empty($akt[0]['nazev']))echo $akt[0]['nazev'];?>"></td>
			<td class="centered"><input type="checkbox" name="nazev_ok"></td>
			<td class="centered"><?php if(!empty($firma[0]['nazev']))echo $firma[0]['nazev'];?></td>
		</tr>
		<tr <?php if(!empty($firma[0]['title']) and !empty($akt[0]['title']) and $firma[0]['title'] == $akt[0]['title'])echo 'class="ok"'; ?>>
			<td width="20">title:<br><input type="text" name="title" size="60" value="<?php if(!empty($akt[0]['title']))echo $akt[0]['title'];?>"></td>
			<td class="centered"><input type="checkbox" name="title_ok"></td>
			<td class="centered"><?php if(!empty($firma[0]['title']))echo $firma[0]['title'];?></td>
		</tr>
		<tr <?php if(!empty($firma[0]['ico']) and !empty($akt[0]['ico']) and $firma[0]['ico'] == $akt[0]['ico'])echo 'class="ok"'; ?>>
			<td width="20">ico:<br><input type="text" name="ico" size="60" value="<?php if(!empty($akt[0]['ico']))echo $akt[0]['ico'];?>"></td>
			<td class="centered"><input type="checkbox" name="ico_ok"></td>
			<td class="centered"><?php if(!empty($firma[0]['ico']))echo $firma[0]['ico'];?></td>
		</tr>
		<tr <?php if(!empty($firma[0]['dic']) and !empty($akt[0]['dic']) and $firma[0]['dic'] == $akt[0]['dic'])echo 'class="ok"'; ?>>
			<td width="20">dic:<br><input type="text" name="dic" size="60" value="<?php if(!empty($akt[0]['dic']))echo $akt[0]['dic'];?>"></td>
			<td class="centered"><input type="checkbox" name="dic_ok"></td>
			<td class="centered"><?php if(!empty($firma[0]['dic']))echo $firma[0]['dic'];?></td>
		</tr>
		<tr <?php if(!empty($firma[0]['obec']) and !empty($akt[0]['obec']) and $firma[0]['obec'] == $akt[0]['obec'])echo 'class="ok"'; ?>>
			<td width="20">obec:<br><input type="text" name="obec" size="60" value="<?php if(!empty($akt[0]['obec']))echo $akt[0]['obec'];?>"></td>
			<td class="centered"><input type="checkbox" name="obec_ok"></td>
			<td class="centered"><?php if(!empty($firma[0]['obec']))echo $firma[0]['obec'];?></td>
		</tr>
		<tr <?php if(!empty($firma[0]['ulice']) and !empty($akt[0]['ulice']) and $firma[0]['ulice'] == $akt[0]['ulice'])echo 'class="ok"'; ?>>
			<td width="20">ulice:<br><input type="text" name="ulice" size="60" value="<?php if(!empty($akt[0]['ulice']))echo $akt[0]['ulice'];?>"></td>
			<td class="centered"><input type="checkbox" name="ulice_ok"></td>
			<td class="centered"><?php if(!empty($firma[0]['ulice']))echo $firma[0]['ulice'];?></td>
		</tr>
		<tr <?php if(!empty($firma[0]['psc']) and !empty($akt[0]['psc']) and $firma[0]['psc'] == $akt[0]['psc'])echo 'class="ok"'; ?>>
			<td width="20">psc:<br><input type="text" name="psc" size="60" value="<?php if(!empty($akt[0]['psc']))echo $akt[0]['psc'];?>"></td>
			<td class="centered"><input type="checkbox" name="psc_ok"></td>
			<td class="centered"><?php if(!empty($firma[0]['psc']))echo $firma[0]['psc'];?></td>
		</tr>
		<tr <?php if(!empty($firma[0]['ulice_post']) and !empty($akt[0]['ulice_post']) and $firma[0]['ulice_post'] == $akt[0]['ulice_post'])echo 'class="ok"'; ?>>
			<td width="20">ulice_post:<br><input type="text" name="ulice_post" size="60" value="<?php if(!empty($akt[0]['ulice_post']))echo $akt[0]['ulice_post'];?>"></td>
			<td class="centered"><input type="checkbox" name="ulice_post_ok"></td>
			<td class="centered"><?php if(!empty($firma[0]['ulice_post']))echo $firma[0]['ulice_post'];?></td>
		</tr>
		<tr <?php if(!empty($firma[0]['posta']) and !empty($akt[0]['posta']) and $firma[0]['posta'] == $akt[0]['posta'])echo 'class="ok"'; ?>>
			<td width="20">posta:<br><input type="text" name="posta" size="60" value="<?php if(!empty($akt[0]['posta']))echo $akt[0]['posta'];?>"></td>
			<td class="centered"><input type="checkbox" name="posta_ok"></td>
			<td class="centered"><?php if(!empty($firma[0]['posta']))echo $firma[0]['posta'];?></td>
		</tr>
		<tr <?php if(!empty($firma[0]['tel']) and !empty($akt[0]['tel']) and $firma[0]['tel'] == $akt[0]['tel'])echo 'class="ok"'; ?>>
			<td width="20">tel:<br><input type="text" name="tel" size="60" value="<?php if(!empty($akt[0]['tel']))echo $akt[0]['tel'];?>"></td>
			<td class="centered"><input type="checkbox" name="tel_ok"></td>
			<td class="centered"><?php if(!empty($firma[0]['tel']))echo $firma[0]['tel'];?></td>
		</tr>
		<tr <?php if(!empty($firma[0]['fax']) and !empty($akt[0]['fax']) and $firma[0]['fax'] == $akt[0]['fax'])echo 'class="ok"'; ?>>
			<td width="20">fax:<br><input type="text" name="fax" size="60" value="<?php if(!empty($akt[0]['fax']))echo $akt[0]['fax'];?>"></td>
			<td class="centered"><input type="checkbox" name="fax_ok"></td>
			<td class="centered"><?php if(!empty($firma[0]['fax']))echo $firma[0]['fax'];?></td>
		</tr>
		<tr <?php if(!empty($firma[0]['email']) and !empty($akt[0]['email']) and $firma[0]['email'] == $akt[0]['email'])echo 'class="ok"'; ?>>
			<td width="20">email:<br><input type="text" name="email" size="60" value="<?php if(!empty($akt[0]['email']))echo $akt[0]['email'];?>"></td>
			<td class="centered"><input type="checkbox" name="email_ok"></td>
			<td class="centered"><?php if(!empty($firma[0]['email']))echo $firma[0]['email'];?></td>
		</tr>
		<tr <?php if(!empty($firma[0]['www']) and !empty($akt[0]['www']) and $firma[0]['www'] == $akt[0]['www'])echo 'class="ok"'; ?>>
			<td width="20">www:<br><input type="text" name="www" size="60" value="<?php if(!empty($akt[0]['www']))echo $akt[0]['www'];?>"></td>
			<td class="centered"><input type="checkbox" name="www_ok"></td>
			<td class="centered"><?php if(!empty($firma[0]['www']))echo $firma[0]['www'];?></td>
		</tr>
		<tr <?php if(!empty($firma[0]['popis']) and !empty($akt[0]['popis']) and $firma[0]['popis'] == $akt[0]['popis'])echo 'class="ok"'; ?>>
			<td width="20">popis:<br><textarea name="popis" rows="20" cols="70"><?php if(!empty($akt[0]['popis']))echo $akt[0]['popis'];?></textarea></td>
			<td class="centered"><input type="checkbox" name="popis_ok"></td>
			<td class="centered"><?php if(!empty($firma[0]['popis']))echo $firma[0]['popis'];?></td>
		</tr>
		<tr>
			<td width="20"><?=$words[109]?>:<br>
				1.<select name="lokality[]"><option value=""><?=$words[55]?></option><?= $akt['lokality1']?></select><br>
				2.<select name="lokality[]"><option value=""><?=$words[55]?></option><?= $akt['lokality2']?></select>
			</td>
			<td class="centered"><input type="checkbox" name="lokalita"></td>
			<td class="centered">
				<?php if(count($firma['lokality']) > 0)foreach($firma['lokality'] as $v){echo $v['lokalita'].'<br>';}?>			
			</td>
		</tr>
		<tr>
			<td width="20"><?=$words[2]?>:<br>
				1.<select name="kategorie[]"><option value=""><?=$words[55]?></option><?= $akt['kategorie1']?></select><br>
				2.<select name="kategorie[]"><option value=""><?=$words[55]?></option><?= $akt['kategorie2']?></select><br>
				3.<select name="kategorie[]"><option value=""><?=$words[55]?></option><?= $akt['kategorie3']?></select>
			</td>
			<td class="centered"><input type="checkbox" name="kategoria"></td>
			<td class="centered">
				<?php if(count($firma['kategorie'][0]) > 0)foreach($firma['kategorie'] as $v){echo $v['new_name'].'<br>';}?>			
			</td>
		</tr>
		<tr <?php if(!empty($firma[0]['kontaktemail']) and !empty($akt[0]['kontaktemail']) and $firma[0]['kontaktemail'] == $akt[0]['kontaktemail'])echo 'class="ok"'; ?>>
			<td width="20">kontaktemail:<br><input type="text" name="kontaktemail" size="60" value="<?php if(!empty($akt[0]['kontaktemail']))echo $akt[0]['kontaktemail'];?>"></td>
			<td class="centered"><input type="checkbox" name="kontaktemail_ok"></td>
			<td class="centered"><?php if(!empty($firma[0]['kontaktemail']))echo $firma[0]['kontaktemail'];?></td>
		</tr>
		<tr <?php if(!empty($firma[0]['kontaktosoba']) and !empty($akt[0]['kontaktosoba']) and $firma[0]['kontaktosoba'] == $akt[0]['kontaktosoba'])echo 'class="ok"'; ?>>
			<td width="20">kontaktosoba:<br><input type="text" name="kontaktosoba" size="60" value="<?php if(!empty($akt[0]['kontaktosoba']))echo $akt[0]['kontaktosoba'];?>"></td>
			<td class="centered"><input type="checkbox" name="kontaktosoba_ok"></td>
			<td class="centered"><?php if(!empty($firma[0]['kontaktosoba']))echo $firma[0]['kontaktosoba'];?></td>
		</tr>
		<tr>
			<td width="20">kontakt poznamka:<br><textarea name="kontaktpoznamka" rows="20" cols="70"><?php if(!empty($akt[0]['kontaktpoznamka']))echo $akt[0]['kontaktpoznamka'];?></textarea></td>
			<td class="centered"><input type="checkbox" name="kontaktpoznamka_ok"></td>
			<td class="centered"><?php if(!empty($firma[0]['kontaktpoznamka']))echo $firma[0]['kontaktpoznamka'];?></td>
		</tr>
		</table></form>
		<?php
	}else echo 'Zadne aktualizace!';
?>
<?php include_once('footer.php'); ?>
