<?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:480px">';
			echo '<div class="button-group" style="margin-left:50px;margin-top:10px;">'; 
				switch($modeDet){
					case 1: 
						echo '<a href="'. base_url('lead_employee/redirectDetailEmployee/'.$modeInv.'/1/'.$id_emp) . '" class="button active">Všeobecné informácie</a>'; 
						if($type_emp!=1 AND $type_emp!=2){
						echo '<a href="'. base_url('lead_employee/redirectDetailEmployee/'.$modeInv.'/2/'.$id_emp) . '" class="button">Inventúry za posledné obdobie</a>'; 							
						}
						echo "</div>";
						echo "<div class='vehicle_div' style='align:center; margin-top:15px; margin-bottom:10px'></div>";
						echo '<table id="newCustomerInfoTable" style="margin-left:50px; margin-top:10px">';
							echo "<tr>";
								echo "<td style='width:160px'>";
									echo "&nbsp";
								echo "</td>";													
							echo "</tr>";
							echo "<tr>";
								echo "<td  style='width:160px'>";
									echo "<b>Typ zamestnanca: </b>";
								echo "</td>";
								echo "<td>";										
									switch($employee->ID_TYP_Z){
										case 1:
											echo "Manažér";
										break;
										case 2:
											echo "Vedúci inventúr";
										break;
										case 3:
											echo "Vodič";
										break;
										case 4:
											echo "Zamestnanec";
										break;
									}
								echo "</td>";													
							echo "</tr>";
							
							echo "<tr>";
								echo "<td  style='width:160px'>";
									echo "<b>ID zamestnanca: </b>";
								echo "</td>";
								echo "<td>";										
									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 "</tr>";
							
							echo "<tr>";
								echo "<td style='width:160px'>";
									echo "&nbsp";
								echo "</td>";													
							echo "</tr>";
							
							echo "<tr>";
								echo "<td style='width:160px'>";
									echo "<b>Meno a priezvisko: </b>";
								echo "</td>";
								echo "<td>";										
									echo $employee->Meno." ".$employee->Priezvisko;
								echo "</td>";													
							echo "</tr>";
							
							echo "<tr>";
								echo "<td style='width:160px'>";
									echo "<b>Rodné číslo: </b>";
								echo "</td>";
								echo "<td>";										
									echo $employee->Rodne_cislo;
								echo "</td>";													
							echo "</tr>";
							
							echo "<tr>";
								echo "<td style='width:160px'>";
									echo "&nbsp";
								echo "</td>";													
							echo "</tr>";
							
							echo "<tr>";
								echo "<td style='width:160px'>";
									echo "<b>E-mail: </b>";
								echo "</td>";
								echo "<td>";										
									echo $employee->Email;
								echo "</td>";													
							echo "</tr>";
							
							echo "<tr>";
								echo "<td style='width:160px'>";
									echo "<b>Telefónne číslo: </b>";
								echo "</td>";
								echo "<td>";
									if($employee->Tel_cislo_zamestnanca==""){
										echo "-nevyplnené-";
									}else{
										echo "00421".$employee->Tel_cislo_zamestnanca;	
									}																	
								echo "</td>";													
							echo "</tr>";
							
							echo "<tr>";
								echo "<td style='width:160px'>";
									echo "&nbsp";
								echo "</td>";													
							echo "</tr>";
							
							echo "<tr>";
								echo "<td style='width:160px'>";
									echo "<b>Kontaktná adresa: </b>";
								echo "</td>";
								echo "<td>";
									if($employee->Mesto_zamestnanca=="" OR $employee->Ulica_zamestnanca=="" OR $employee->Cislo_domu_zamestnanca=="" OR $employee->PSC_zamestnanca==""){
										echo "-nevyplnené-";
										echo "</td>";
									echo "<tr>";
										echo "<td>";
											echo "&nbsp";
										echo "</td>";
									echo "</tr>";
									}else{
										echo $employee->Ulica_zamestnanca." ".$employee->Cislo_domu_zamestnanca;
										echo "</td>";
										echo "<tr>";
											echo "<td style='width:160px'>";
												echo "&nbsp";
											echo "</td>";
											echo "<td>";
												echo $employee->PSC_zamestnanca.", ".$employee->Mesto_zamestnanca;
											echo "</td>";
										echo "</tr>";		
									}																																				
							echo "</tr>";
							echo "<tr>";
								echo "<td style='width:160px'>";
									echo "&nbsp";
								echo "</td>";													
							echo "</tr>";
							
							echo "<tr>";
								echo "<td style='width:160px'>";
									echo "<b>Poistovňa: </b>";
								echo "</td>";
								echo "<td>";																	
									if($employee->Nazov_poistovne==""){
										echo "-nevyplnené-";
									}else{
										echo $employee->Nazov_poistovne." / ".$employee->Kod_poistovne;	
									}
								echo "</td>";													
							echo "</tr>";
							
							echo "<tr>";
								echo "<td style='width:160px'>";
									echo "<b>Číslo účtu: </b>";
								echo "</td>";
								echo "<td>";										
									if($employee->Cislo_uctu=="" OR $employee->Kod_banky==""){
										echo "-nevyplnené-";
									}else{
										echo $employee->Cislo_uctu." / ";
										if(strlen($employee->Kod_banky)==3){
											echo "0".$employee->Kod_banky;	
										}else{
											$employee->Kod_banky;
										}
									}
								echo "</td>";													
							echo "</tr>";
							echo "<tr>";
								echo "<td style='width:160px'>";
									echo "&nbsp";
								echo "</td>";													
							echo "</tr>";							
						echo '</table>';
					echo "<div class='vehicle_div' style='align:center; margin-top:15px; margin-bottom:-10px'></div>";
					break;
					case 2:
						echo '<a href="'. base_url('lead_employee/redirectDetailEmployee/'.$modeInv.'/1/'.$id_emp) . '" class="button">Všeobecné informácie</a>'; 
						echo '<a href="'. base_url('lead_employee/redirectDetailEmployee/'.$modeInv.'/2/'.$id_emp) . '" class="button active">Inventúry za posledné obdobie</a>';  
					echo '</div>';
					echo "<div class='vehicle_div' style='align:center; margin-top:15px; margin-bottom:0px'></div>";																
					if(count($inventories)==0 OR $inventories==Array()){
						echo "<h3>Zamestnanec poslednú dobu nebol na žiadnej inventúre.</h3>";	
					}else{
						foreach($inventories as $inventory){
							echo "<div class='vehicle_div' align='center'>";
								echo "<table class='vehicle_table' style='margin-left:0px; padding-top:15px;margin-top:0px; margin-bottom:10px;'>";
									echo "<tr>";
										echo "<td width='0px' style='text-align: center'>";
										echo "</td>";
										echo "<td width='100px' style='text-align: center; margin-left:0px'>";
											echo "<b>ID inventúry</b>";					
											echo "</br>";
											if (strlen($inventory->ID_INV)==1) {
													echo "0000".$inventory->ID_INV;
											} elseif (strlen($inventory->ID_INV)==2) {
													echo "000".$inventory->ID_INV;
											} elseif (strlen($inventory->ID_INV)==3) {
													echo "00".$inventory->ID_INV;
											} elseif (strlen($inventory->ID_INV)==4) {
													echo "0".$inventory->ID_INV;
											} else {
													echo $inventory->ID_INV;
											}
										echo "</td>";
											echo "<td width='200px' style='text-align: center'>";
											echo "<b>Zákazník</b>";
											echo "</br>";
											echo $inventory->Nazov_spolocnosti.", ".$inventory->Mesto;
										echo "</td>";
										
										echo "<td width='90px' style='text-align: center'>";
											echo "<b>Počet zam.</b>";
											echo "</br>";
											echo $inventory->Pocet_zamestnancov;
										echo "</td>";
										
										echo "<td width='120px' style='text-align: center'>";
											echo "<b>Vedúci inventúry</b>";
											echo "</br>";
											if ($inventory->Meno==""){
												echo "-neurčené-";
											} else {
												echo $inventory->Meno."&nbsp".$inventory->Priezvisko;	
											}
										echo "</td>";
										echo "<td width='160px' style='text-align: center'>";
						echo "<b>Dátum a čas začiatku</b>";
						echo "</br>";
						echo date('d.m.Y G:i',strtotime($inventory->Datum_zaciatku));
					echo "</td>";
					
					echo "<td width='160px' style='text-align: center'>";
						echo "<b>Dátum a čas konca</b>";
						echo "</br>";
						echo date('d.m.Y G:i',strtotime($inventory->Datum_konca));
					echo "</td>";
					echo "<td>"; 
						echo '<div class="button-group">';
							switch($modeInv){
								case 1:
									echo '<a href="'.base_url('lead_employee/redirectLeadEmployeeInventoryDetail/10/1/'.$inventory->ID_INV).'" class="button">Detail</a>';																
								break;
								case 2:
									echo '<a href="'.base_url('lead_employee/redirectLeadEmployeeInventoryDetail/11/1/'.$inventory->ID_INV).'" class="button">Detail</a>';																
								break;
								case 3:
									echo '<a href="'.base_url('lead_employee/redirectLeadEmployeeInventoryDetail/12/1/'.$inventory->ID_INV).'" class="button">Detail</a>';																
								break;
								case 4:
									echo '<a href="'.base_url('lead_employee/redirectLeadEmployeeInventoryDetail/13/1/'.$inventory->ID_INV).'" class="button">Detail</a>';																
								break;								
							}
						echo '</div>';
					echo "<td>"; 
				echo "</tr>";
				echo "</table>";				
			echo "</div>";						
						}
					}
					break;					
				}
			echo '<div class="button-group" style="margin-left:50px;margin-top:30px;">';	
				switch($modeInv){
					case 1: 
						echo '<a href="'. base_url('lead_employee/getAllEmployees') .'" class="button">Späť</a>'; 									
					break;
					case 2: 
						echo '<a href="'. base_url('lead_employee/getLeadEmployees') .'" class="button">Späť</a>'; 									
					break;
					case 3: 
						echo '<a href="'. base_url('lead_employee/getDrivers') .'" class="button">Späť</a>'; 									
					break;
					case 4: 
						echo '<a href="'. base_url('lead_employee/getBasicEmployees') .'" class="button">Späť</a>'; 									
					break;
				}

			echo '</div>';	
	

		
	} else {
		redirect(base_url('main/restricted'));
	}	
?>

	
	
	


