<?php 
/********************************************************************************* 
 *  This file is part of Sentrifugo.
 *  Copyright (C) 2015 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>
 ********************************************************************************/
$groupname = isset($this->groupname)?$this->groupname:'';
$groupid = isset($this->groupid)?$this->groupid:'';

?>
<form name="assignemployees" id="formid" action= "" method="post" class="veiw_form_emp">
<input type="hidden" name="groupid" id="groupid" value="<?php echo $groupid;?>" />
<div id="actionButtonsDiv" class="new-form-ui-submit inner_action_div"  style="margin-top: 9px;">  
			<button onclick="slideupqsdiv()" type="button" id="Cancel" name="Cancel">Close</button>
			</div>
<div id="groupnamediv" class="grpnamecls_2">
<div class="up_arrow"></div>
	<label class="grou_name_lab">Group Name : </label> <span class="grou_name"> <?php echo $groupname;?></span>
</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_right_title">Selected Employees<span class="emp_count">(<?php echo $this->empcount;?>)</span></div>

		<div class="search_emp_by_name_div">
			<input type="text" name="search_emp_by_name" id="search_emp_by_name_right" value="" placeholder="Search Employee"/>
			<input type="button" value="Go" name="search" id="search_right">&nbsp;
			<input type="button" id="idclear_right" name="tclear" value="Clear" class="btn_search_clear" onclick="javascript:clearSearchData_right();"/>
			
		</div>
<div class="users_list_right">
<div class="users_right_list_div no_right_data_found" style="display: none;"><span class="values"></span></div>

<?php
$exist_member_ids = '';
if(count($this->groupedEmployeeDetails) > 0)
{
	$isUser = 0;
	foreach($this->groupedEmployeeDetails as $emp)
	{
		$jobtitle_length=strlen($emp['jobtitle_name']);
		$jobtitle =$emp['jobtitle_name'];
			?>
			<div class="users_right_list_div users_right_list user_div_<?php echo $emp['user_id'];?>" style="cursor:pointer;"  subject = "<?php echo $emp['user_id'];?>" alt="Add" title="<?php echo addslashes($emp['userfullname']);?>" 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" title="<?php echo $emp['userfullname'];?>"><?php echo $emp['userfullname'];?></span>
            <span class="member_id" title="<?php echo $emp['employeeId'];?>">(<?php echo $emp['employeeId'];?>)</span>
            <span class="member_jname" title="<?php echo $emp['jobtitle_name'];?>"><?php echo ($jobtitle_length<=17)?$jobtitle:substr($jobtitle,0,15) . '...';?></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 class="users_right_list_div  no_search_results_right" style="display:none"><span class="values">No results were found.</span></div>

</div>

</div>

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

<input type="hidden" name="edit_group_id" id="edit_group_id" value="<?php echo $this->groupid;?>" />

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

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

<?php 
			if(!empty($this->questionsArr))
				{
					sapp_PerformanceHelper::questions_privileges_view($this->questionsArr,$this->appraisalid,$this->checkArr,$this->initializationdata);
				}	
?>

		<div class="content_box add_new_fields checklist_new_fields action_buttons_div">
		
			<span id="no_members_error" style="display:none;color: red; position: absolute; font-size: 12px; margin-left: 4px;"></span>
			
		
		
		</div>

</div>
</form>

<script type="text/javascript" language="javascript">
$(document).ready(function()
{
	group_emp_ready_fn();
	$("#qssubmitdiv").remove();

});
</script>
 