<?php 
/********************************************************************************* 
 *  This file is part of Sentrifugo.
 *  Copyright (C) 2014 Sapplica
 *   
 *  Sentrifugo is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Sentrifugo is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Sentrifugo.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  Sentrifugo Support <support@sentrifugo.com>
 ********************************************************************************/
?>
	<div class="popup_header">
		<h1 class="popups_child_headers">Add Project Employees </h1>

		<div class="search_emp_by_name_div">
			<input type="text" name="search_emp_by_name" id="search_emp_by_name" value="" placeholder="Search Employee"/>
			<input type="button" value="Go" name="search" id="search">&nbsp;
			<input type="button" id="idclear" name="tclear" value="Clear" class="btn_search_clear" onclick="javascript:clearSearchData();"/>
			
		</div>
			
	</div>
	
	<span id="success_users_message" style="display:none;  margin-left: 5px;" class="green_color_text"></span>

<div class="clear"></div>

<div class="users_list">

<div class="left-user">
<div class="users_list_left_title">Employees (Click on an employee to add to group)</div>

<div class="users_list_left" >

<?php
if(count($this->employeeList) > 0)
{
	$isUser = 0;
	
	foreach($this->employeeList as $emp)
	{
			?>
			<div class="users_left_list_div users_left_list user_div_<?php echo $emp['user_id'];?>" style="cursor:pointer;" onclick="javascript:fnAddRemoveProjectUser(1,'<?php echo $emp['user_id'];?>','<?php echo addslashes($emp['userfullname']);?>','<?php echo $emp['profileimg'];?>');" alt="Add" title="Add" name="<?php echo addslashes($emp['userfullname']);?>">
			<span class="values">
			<div class="profile_img">
			<img src="<?php echo $this->baseUrl("public/uploads/profile/").$emp['profileimg'];?>" width="28px"  height="28px" onerror="this.src='<?php echo MEDIA_PATH; ?>images/default-profile-pic.jpg'"/>
			</div> </span> <span class="member_name"><?php echo $emp['userfullname'];?>
			</span>
			</div>
			<?php
			$isUser++;
			
	}
	if($isUser < 1)
	{
		?>
		<div class="users_left_list_div no_left_data_found"><span class="values">Employees are not available.</span></div>
		<?php		
	}
}
else
{
?>
	<div class="users_left_list_div no_left_data_found" ><span class="values">Employees are not available.</span></div>
<?php
}
?>

<div class="users_left_list_div  no_search_results" style="display:none"><span class="values">No results were found.</span></div> 

</div>
</div>
<div class="left-user">
<div class="users_list_right_title"></div>

<div class="users_list_right">
<div class="users_right_list_div no_right_data_found"><span class="values">Add employees to group.</span></div>

<?php
$exist_member_ids = '';
if(count($this->groupedemployeeList) > 0)
{
	$isUser = 0;
	foreach($this->groupedemployeeList as $emp)
	{
			?>
			<div class="users_right_list_div users_right_list user_div_<?php echo $emp['user_id'];?>" style="cursor:pointer;" onclick="javascript:fnAddRemoveProjectUser(0,'<?php echo $emp['user_id'];?>','<?php echo addslashes($emp['userfullname']);?>','<?php echo $emp['profileimg'];?>');" alt="Add" title="Add" name="<?php echo addslashes($emp['userfullname']);?>">
			<span class="values">
			<div class="profile_img">
			<img src="<?php echo $this->baseUrl("public/uploads/profile/").$emp['profileimg'];?>" width="28px"  height="28px" onerror="this.src='<?php echo MEDIA_PATH; ?>images/default-profile-pic.jpg'"/>
			</div> </span> <span class="member_name"><?php echo $emp['userfullname'];?>
			</span>
			</div>
			<?php
			$isUser++;
			$exist_member_ids.= $emp['user_id'].',';
	}
	if($isUser < 1)
	{
		?>
		<div class="added_users_list_div no_added_user_found"><span class="values">Employees are not available.</span></div>
		<?php		
	}
	if($exist_member_ids !='')
	  $exist_member_ids = rtrim($exist_member_ids,',');
}
else
{
?>
	<div class="added_users_list_div no_added_user_found"><span class="values">Employees are not grouped yet.</span></div>
<?php
}
?>


</div>

</div>

<input type="hidden" name="mem_list_str" id="mem_list_str" value="" />

<input type="hidden" name="existetd_mem_str" id="existetd_mem_str" value="<?php echo $exist_member_ids;?>" />

</div>

<script type="text/javascript" language="javascript">
$(document).ready(function()
{
	$('#idclear').hide();
		
	if($.trim($('#search_emp_by_name').val()).length>0)
	{
		$('#idclear').show();
	}
	else
	{
		$('#idclear').hide();
	}
	
	$(document).keyup(function(e) {	 
	  if (e.keyCode == 27) { closeconfirmPopup(); }   // esc
	});

});

</script>
 