<?php
	if ($this->session->userdata('permisson')==2) {
		$CI =& get_instance(); 
		$CI->load->library('libraryprofile');
		$CI->libraryprofile->showMenuBarLeadEmployee($this->session->userdata('meno'),$this->session->userdata('priezvisko'),$this->session->userdata('id_zamestnanca'));
		
		echo '<div id="default_container" style="height:525px">';
			echo '<div class="button-group" style="margin-left:50px;margin-top:10px;">';
				switch ($Active){
					case 1:
						echo '<a href="'. base_url() . 'lead_employee/getAllEmployees" class="button active">Všetci zamestnanci</a>';
						echo '<a href="'. base_url() . 'lead_employee/getLeadEmployees" class="button">Vedúci</a>';
						echo '<a href="'. base_url() . 'lead_employee/getDrivers" class="button">Vodiči</a>';
						echo '<a href="'. base_url() . 'lead_employee/getBasicEmployees" class="button">Zamestnanci</a>';
					echo "</div>";
					echo '<div class="button-group" style="margin-left:50px;margin-top:10px;">';
		 			echo form_open(base_url() . 'lead_employee/searchAllEmployees/1');	  			   			
						echo form_submit('submit_search', 'Hľadať', 'class="button"');
						echo form_input('lead_employee_search','','class="search_area" ');			
		 			echo form_close();
	    			echo '</div>';					
					echo "<div class='div_curve' style='height:350px; padding-bottom:30px' >";
						if (count($Employees)==0){
							echo "<br><h11>Zamestnanec s hľadaným parametrom neexistuje.</h11><br><br>";
							echo '<div class="button-group" style="margin-left:50px;margin-top:10px;">';
								echo '<a href="'. base_url() . 'lead_employee/getAllEmployees" class="button">Resetovať</a>';
						    echo "</div>";
						} else {
							echo "<table>";		
							echo "<thead style='text-align:left'>";
									echo "<th>";
									echo "</td>";
									echo "<th>";
										echo "ID zamest.";
									echo "</th>";
									echo "<th>";
										echo "Meno a priezvisko";
									echo "</th>";
									echo "<th>";
										echo "Mesto";
									echo "</th>";
									echo "<th>";
										echo "Kontakt";
									echo "</th>";
									echo "<th>";
										echo "E-mail";
									echo "</th>";
								echo "</thead>";
								echo "<tbody class='zoznamTable'>";						
									echo "<tr>";
										echo "<td colspan='8' class='nothing'>";
										echo "<div class='vehicle_div' style='align:center; margin-top:5px; margin-bottom:5px'></div>";
										echo "</td>";
									echo "</tr>";
								foreach($Employees as $Employee){
								echo "<tr>";
								echo "<td width='140px'>";
								echo "</td>";
								echo "<td width='100px'>";
								if (strlen($Employee->ID_ZAM)==1) {
											echo "0000";
											echo $Employee->ID_ZAM;
										} elseif (strlen($Employee->ID_ZAM)==2) {
											echo "000";
											echo $Employee->ID_ZAM;
										} elseif (strlen($Employee->ID_ZAM)==3) {
											echo "00";
											echo $Employee->ID_ZAM;
										} elseif (strlen($Employee->ID_ZAM)==4) {
											echo "0";
											echo $Employee->ID_ZAM;
										} else {
											echo $Employee->ID_ZAM;
										}
									
								echo "</td>";
								echo "<td width='160px'>";
									echo $Employee->Meno.' '.$Employee->Priezvisko;
								echo "</td>";
								echo "<td width='120px'>";
									if ($Employee->Mesto_zamestnanca==null){
										echo "<i>-nezadané-</i>";
									} else {
										echo $Employee->Mesto_zamestnanca;
									}					
								echo "</td>";
								echo "<td width='150px'>";
									if ($Employee->Tel_cislo_zamestnanca==null){
										echo "<i>-nezadané-</i>";
									} else {
										echo "0".$Employee->Tel_cislo_zamestnanca;
									}					
								echo "</td>";
								echo "<td class='email_td'>";
									echo $Employee->Email;
								echo "</td>";
								echo "<td>";
									echo '<div class="button-group">';
										echo '<a href="'. base_url('lead_employee/redirectDetailEmployee/1/1/'.$Employee->ID_ZAM) . '" class="button">Detail</a>';										
									echo '</div>';
								echo "</td>";
								echo "<td width='165px'>";
								echo "</td>";
							echo "</tr>";	
								}
							echo "</tbody>";		
						echo "</table>";
						echo '</div>';
					echo $this->pagination->create_links();		
						}		
					echo '</div>';
					break;
					case 2:
						echo '<a href="'. base_url() . 'lead_employee/getAllEmployees" class="button">Všetci zamestnanci</a>';
						echo '<a href="'. base_url() . 'lead_employee/getLeadEmployees" class="button  active">Vedúci</a>';
						echo '<a href="'. base_url() . 'lead_employee/getDrivers" class="button">Vodiči</a>';
						echo '<a href="'. base_url() . 'lead_employee/getBasicEmployees" class="button">Zamestnanci</a>';
					echo "</div>";
					echo '<div class="button-group" style="margin-left:50px;margin-top:10px;">';
		 			echo form_open(base_url() . 'lead_employee/searchAllEmployees/2');	  			   			
						echo form_submit('submit_search', 'Hľadať', 'class="button"');
						echo form_input('lead_employee_search','','class="search_area" ');			
		 			echo form_close();
	    			echo '</div>';
					echo "<div class='div_curve'>";
					if (count($Employees)==0){
							echo "<br><h11>Zamestnanec s hľadaným parametrom neexistuje.</h11><br><br>";
							echo '<div class="button-group" style="margin-left:50px;margin-top:10px;">';
								echo '<a href="'. base_url() . 'lead_employee/getLeadEmployees" class="button">Resetovať</a>';
						    echo "</div>";
						} else {
							echo "<table>";		
							echo "<thead style='text-align:left'>";
									echo "<th>";
									echo "</td>";
									echo "<th>";
										echo "ID zamest.";
									echo "</th>";
									echo "<th>";
										echo "Meno a priezvisko";
									echo "</th>";
									echo "<th>";
										echo "Mesto";
									echo "</th>";
									echo "<th>";
										echo "Kontakt";
									echo "</th>";
									echo "<th>";
										echo "E-mail";
									echo "</th>";
								echo "</thead>";
								echo "<tbody class='zoznamTable'>";						
									echo "<tr>";
										echo "<td colspan='8' class='nothing'>";
										echo "<div class='vehicle_div' style='align:center; margin-top:5px; margin-bottom:5px'></div>";
										echo "</td>";
									echo "</tr>";
								foreach($Employees as $Employee){
								echo "<tr>";
								echo "<td width='140px'>";
								echo "</td>";
								echo "<td width='100px'>";
								if (strlen($Employee->ID_ZAM)==1) {
											echo "0000";
											echo $Employee->ID_ZAM;
										} elseif (strlen($Employee->ID_ZAM)==2) {
											echo "000";
											echo $Employee->ID_ZAM;
										} elseif (strlen($Employee->ID_ZAM)==3) {
											echo "00";
											echo $Employee->ID_ZAM;
										} elseif (strlen($Employee->ID_ZAM)==4) {
											echo "0";
											echo $Employee->ID_ZAM;
										} else {
											echo $Employee->ID_ZAM;
										}
									
								echo "</td>";
								echo "<td width='160px'>";
									echo $Employee->Meno.' '.$Employee->Priezvisko;
								echo "</td>";
								echo "<td width='120px'>";
									if ($Employee->Mesto_zamestnanca==null){
										echo "<i>-nezadané-</i>";
									} else {
										echo $Employee->Mesto_zamestnanca;
									}					
								echo "</td>";
								echo "<td width='150px'>";
									if ($Employee->Tel_cislo_zamestnanca==null){
										echo "<i>-nezadané-</i>";
									} else {
										echo $Employee->Tel_cislo_zamestnanca;
									}					
								echo "</td>";
								echo "<td class='email_td'>";
									echo $Employee->Email;
								echo "</td>";
								echo "<td>";
									echo '<div class="button-group">';
										echo '<a href="'. base_url('lead_employee/redirectDetailEmployee/2/1/'.$Employee->ID_ZAM) . '" class="button">Detail</a>';										
									echo '</div>';
								echo "</td>";
								echo "<td width='165px'>";
								echo "</td>";
							echo "</tr>";	
								}
							echo "</tbody>";		
						echo "</table>";
						echo '</div>';
					echo $this->pagination->create_links();
						}
					echo '</div>';	
					break;
					case 3:
						echo '<a href="'. base_url() . 'lead_employee/getAllEmployees" class="button">Všetci zamestnanci</a>';
						echo '<a href="'. base_url() . 'lead_employee/getLeadEmployees" class="button">Vedúci</a>';
						echo '<a href="'. base_url() . 'lead_employee/getDrivers" class="button  active">Vodiči</a>';						
						echo '<a href="'. base_url() . 'lead_employee/getBasicEmployees" class="button">Zamestnanci</a>';
					echo "</div>";
					echo '<div class="button-group" style="margin-left:50px;margin-top:10px;">';
		 			echo form_open(base_url() . 'lead_employee/searchAllEmployees/3');	  			   			
						echo form_submit('submit_search', 'Hľadať', 'class="button"');
						echo form_input('lead_employee_search','','class="search_area" ');			
		 			echo form_close();
	    			echo '</div>';
					echo "<div class='div_curve'>";
						if (count($Employees)==0){
							echo "<br><h11>Zamestnanec s hľadaným parametrom neexistuje.</h11><br><br>";
							echo '<div class="button-group" style="margin-left:50px;margin-top:10px;">';
								echo '<a href="'. base_url() . 'lead_employee/getDrivers" class="button">Resetovať</a>';
						    echo "</div>";
						} else {
							echo "<table>";		
							echo "<thead style='text-align:left'>";
									echo "<th>";
									echo "</td>";
									echo "<th>";
										echo "ID zamest.";
									echo "</th>";
									echo "<th>";
										echo "Meno a priezvisko";
									echo "</th>";
									echo "<th>";
										echo "Mesto";
									echo "</th>";
									echo "<th>";
										echo "Kontakt";
									echo "</th>";
									echo "<th>";
										echo "E-mail";
									echo "</th>";
								echo "</thead>";
								echo "<tbody class='zoznamTable'>";						
									echo "<tr>";
										echo "<td colspan='8' class='nothing'>";
										echo "<div class='vehicle_div' style='align:center; margin-top:5px; margin-bottom:5px'></div>";
										echo "</td>";
									echo "</tr>";
								foreach($Employees as $Employee){
								echo "<tr>";
								echo "<td width='140px'>";
								echo "</td>";
								echo "<td width='100px'>";
								if (strlen($Employee->ID_ZAM)==1) {
											echo "0000";
											echo $Employee->ID_ZAM;
										} elseif (strlen($Employee->ID_ZAM)==2) {
											echo "000";
											echo $Employee->ID_ZAM;
										} elseif (strlen($Employee->ID_ZAM)==3) {
											echo "00";
											echo $Employee->ID_ZAM;
										} elseif (strlen($Employee->ID_ZAM)==4) {
											echo "0";
											echo $Employee->ID_ZAM;
										} else {
											echo $Employee->ID_ZAM;
										}
									
								echo "</td>";
								echo "<td width='160px'>";
									echo $Employee->Meno.' '.$Employee->Priezvisko;
								echo "</td>";
								echo "<td width='120px'>";
									if ($Employee->Mesto_zamestnanca==null){
										echo "<i>-nezadané-</i>";
									} else {
										echo $Employee->Mesto_zamestnanca;
									}					
								echo "</td>";
								echo "<td width='150px'>";
									if ($Employee->Tel_cislo_zamestnanca==null){
										echo "<i>-nezadané-</i>";
									} else {
										echo $Employee->Tel_cislo_zamestnanca;
									}					
								echo "</td>";
								echo "<td class='email_td'>";
									echo $Employee->Email;
								echo "</td>";
								echo "<td>";
									echo '<div class="button-group">';
										echo '<a href="'. base_url('lead_employee/redirectDetailEmployee/3/1/'.$Employee->ID_ZAM) . '" class="button">Detail</a>';										
									echo '</div>';
								echo "</td>";
								echo "<td width='165px'>";
								echo "</td>";
							echo "</tr>";	
								}
							echo "</tbody>";		
						echo "</table>";
						echo '</div>';
					echo $this->pagination->create_links();	
						}
					echo '</div>';	
					break;
					case 4:
						echo '<a href="'. base_url() . 'lead_employee/getAllEmployees" class="button">Všetci zamestnanci</a>';
						echo '<a href="'. base_url() . 'lead_employee/getLeadEmployees" class="button">Vedúci</a>';
						echo '<a href="'. base_url() . 'lead_employee/getDrivers" class="button">Vodiči</a>';
						echo '<a href="'. base_url() . 'lead_employee/getBasicEmployees" class="button active">Zamestnanci</a>';
					echo "</div>";
					echo '<div class="button-group" style="margin-left:50px;margin-top:10px;">';
		 			echo form_open(base_url() . 'lead_employee/searchAllEmployees/4');	  			   			
						echo form_submit('submit_search', 'Hľadať', 'class="button"');
						echo form_input('lead_employee_search','','class="search_area" ');			
		 			echo form_close();
	    			echo '</div>';	
					echo "<div class='div_curve'>";
					if (count($Employees)==0){
							echo "<br><h11>Zamestnanec s hľadaným parametrom neexistuje.</h11><br><br>";
							echo '<div class="button-group" style="margin-left:50px;margin-top:10px;">';
								echo '<a href="'. base_url() . 'lead_employee/getBasicEmployees" class="button">Resetovať</a>';
						    echo "</div>";
						} else {
							echo "<table>";		
							echo "<thead style='text-align:left'>";
									echo "<th>";
									echo "</td>";
									echo "<th>";
										echo "ID zamest.";
									echo "</th>";
									echo "<th>";
										echo "Meno a priezvisko";
									echo "</th>";
									echo "<th>";
										echo "Mesto";
									echo "</th>";
									echo "<th>";
										echo "Kontakt";
									echo "</th>";
									echo "<th>";
										echo "E-mail";
									echo "</th>";
								echo "</thead>";
								echo "<tbody class='zoznamTable'>";						
									echo "<tr>";
										echo "<td colspan='8' class='nothing'>";
										echo "<div class='vehicle_div' style='align:center; margin-top:5px; margin-bottom:5px'></div>";
										echo "</td>";
									echo "</tr>";
								foreach($Employees as $Employee){
								echo "<tr>";
								echo "<td width='140px'>";
								echo "</td>";
								echo "<td width='100px'>";
								if (strlen($Employee->ID_ZAM)==1) {
											echo "0000";
											echo $Employee->ID_ZAM;
										} elseif (strlen($Employee->ID_ZAM)==2) {
											echo "000";
											echo $Employee->ID_ZAM;
										} elseif (strlen($Employee->ID_ZAM)==3) {
											echo "00";
											echo $Employee->ID_ZAM;
										} elseif (strlen($Employee->ID_ZAM)==4) {
											echo "0";
											echo $Employee->ID_ZAM;
										} else {
											echo $Employee->ID_ZAM;
										}
									
								echo "</td>";
								echo "<td width='160px'>";
									echo $Employee->Meno.' '.$Employee->Priezvisko;
								echo "</td>";
								echo "<td width='120px'>";
									if ($Employee->Mesto_zamestnanca==null){
										echo "<i>-nezadané-</i>";
									} else {
										echo $Employee->Mesto_zamestnanca;
									}					
								echo "</td>";
								echo "<td width='150px'>";
									if ($Employee->Tel_cislo_zamestnanca==null){
										echo "<i>-nezadané-</i>";
									} else {
										echo $Employee->Tel_cislo_zamestnanca;
									}					
								echo "</td>";
								echo "<td class='email_td'>";
									echo $Employee->Email;
								echo "</td>";
								echo "<td>";
									echo '<div class="button-group">';
										echo '<a href="'. base_url('lead_employee/redirectDetailEmployee/4/1/'.$Employee->ID_ZAM) . '" class="button">Detail</a>';										
									echo '</div>';
								echo "</td>";
								echo "<td width='165px'>";
								echo "</td>";
							echo "</tr>";	
								}
							echo "</tbody>";		
						echo "</table>";
						echo '</div>';
					echo $this->pagination->create_links();	
						}
					echo '</div>';					
					break;
				}
				
		
	} else {
		redirect(base_url('main/restricted'));
	}	
?>

	
	
	


