<?php require_once('../Connections/oprmConn.php'); ?>

<?php $msg = ""; if(isset($_REQUEST['msg'])) $msg = $_REQUEST['msg']; ?>

<?php include('check-admin-session.php'); ?>

<?php
mysql_select_db($database_oprmConn, $oprmConn);
$query_getProf = "SELECT weby_profiles.*,weby_users.email_address, weby_users.employee_id, weby_users.status, weby_users.updated_date, weby_users.caeated_date as jdate FROM weby_profiles, weby_users WHERE weby_users.user_id = weby_profiles.user_id AND weby_profiles.user_id = '$_REQUEST[user_id]' AND weby_profiles.status = 'P'";
$getProf = mysql_query($query_getProf, $oprmConn) or die(mysql_error());
$row_getProf = mysql_fetch_assoc($getProf);
$totalRows_getProf = mysql_num_rows($getProf);
//active record
$query_getactivepro = "SELECT weby_profiles.*,weby_users.email_address, weby_users.employee_id, weby_users.status, weby_users.updated_date, weby_users.caeated_date as jdate FROM weby_profiles, weby_users WHERE weby_users.user_id = weby_profiles.user_id AND weby_profiles.user_id = '$_REQUEST[user_id]' AND weby_profiles.status = 'A'";
$getactivepro = mysql_query($query_getactivepro, $oprmConn) or die(mysql_error());
$row_getactivepro = mysql_fetch_assoc($getactivepro);
$totalRows_getactivepro = mysql_num_rows($getactivepro);


mysql_select_db($database_oprmConn, $oprmConn);
$query_getProf1 = "SELECT * FROM weby_projects WHERE status='A' and projetc_id NOT IN ('10', '11')";
$getProf1 = mysql_query($query_getProf1, $oprmConn) or die(mysql_error());
$row_getProf1 = mysql_fetch_assoc($getProf1);
$totalRows_getProf1 = mysql_num_rows($getProf1);

mysql_select_db($database_oprmConn, $oprmConn);
$query_getCuPro = "SELECT weby_users_projects.project_id, weby_users_projects.status, weby_users_projects.created_by, weby_users_projects.created_date, weby_projects.project_name, weby_projects.project_description, weby_users_projects.user_id FROM weby_users_projects, weby_projects WHERE weby_projects.projetc_id = weby_users_projects.project_id AND weby_users_projects.user_id = '$_REQUEST[user_id]' AND weby_users_projects.status = 'A' AND weby_users_projects.project_id NOT IN ('10', '11')";
$getCuPro = mysql_query($query_getCuPro, $oprmConn) or die(mysql_error());
$row_getCuPro = mysql_fetch_assoc($getCuPro);
$totalRows_getCuPro = mysql_num_rows($getCuPro);

mysql_select_db($database_oprmConn, $oprmConn);
$query_getDoclist = "SELECT distinct d.doc_id, d.profile_id, d.other_docs, weby_profiles.profile_id, weby_profiles.user_id, weby_users.user_id FROM weby_otherdoc d, weby_profiles, weby_users WHERE weby_profiles.user_id = $_REQUEST[user_id] AND (d.profile_id = weby_profiles.profile_id AND d.status = 'A') group by d.doc_id";
$getDoclist = mysql_query($query_getDoclist, $oprmConn) or die(mysql_error());
$row_getDoclist = mysql_fetch_assoc($getDoclist);
$totalRows_getDoclist = mysql_num_rows($getDoclist);


if(isset($_POST['approve'])){
$query_updatepro = "update weby_profiles set status = 'D', updated_by = '$_SESSION[user_id]' WHERE user_id = '$_REQUEST[user_id]' AND status = 'A'";
$updatepro = mysql_query($query_updatepro, $oprmConn) or die(mysql_error());
$query_updateactpro = "update weby_profiles set status = 'A', updated_by = '$_SESSION[user_id]' WHERE user_id = '$_REQUEST[user_id]' AND status = 'P'";
$updateactpro = mysql_query($query_updateactpro, $oprmConn) or die(mysql_error()); ?>
<script> window.location = "resources-list.php?msg=Pending Profile Approved Successfull."; </script>
<?php //header("Location: resources-list.php?msg=Pending Profile Approved Successfull.");
}
if(isset($_POST['reject'])){
$query_updateactpro = "update weby_profiles set status = 'D', updated_by = '$_SESSION[user_id]' WHERE user_id = '$_REQUEST[user_id]' AND status = 'P'";
$updateactpro = mysql_query($query_updateactpro, $oprmConn) or die(mysql_error()); ?>
<script> window.location = "pending-resources-list.php?msg=Pending Profile Rejected Successfull."; </script>
<?php //header("Location: resources-list.php?msg=Pending Profile Rejected Successfull.");
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SS WEB TECHNOLOGIES- Tool-Admin- Resource View</title>
<link rel="stylesheet" href="../css/style.css" type="text/css">
<!-- IE Fix for HTML5 Tags -->
<!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> 
	<![endif]-->
<style>
.act_resource { background: #373938;
  color: #fff;}
.admin_container select{
	  width:245px;
}
.redlabel{
	color: #ff0000;
}
</style>
</head>
<body>
<!-- Wrapper Starts -->
<div class="wrapper">
    <?php  require_once('../includes/header.php'); ?>
<?php  require_once('../includes/tools-menu.php'); ?>
  <!-- Content Goes here -->
  <!-- Content Goes here -->
  <article class="inside_wrapper">
  <!-- Main Content Goes here -->

  <section class="main_content" style="width:100%;">

  <h1>Pending Resource view</h1>

  <?php if(isset($_REQUEST['msg']) ){ ?>
<div class="msg_cancel">
  <font color="#FF0000"> <?php echo $msg; ?> <a href="resources-view.php?user_id=<?php echo $row_getProf['user_id']; ?>"><img src="/RM/images/cross.png" width="12" height="12" alt="delete"></a> </font></div>
  <?php } ?>

  <!-- Timesheets Goes here -->
  <div class="admin_container clear_fix blue" style="width:96%;">
    <div class="profile_img"><img src="/RM/images/<?php if(!empty($row_getProf['profile_pic']))echo $row_getProf['profile_pic']; else echo "black-img.jpg"; ?>" width="68" /></div>
    <div style="width:100%;">
    <form method="post">
      <div class="resource_desc" style="width:65%; float:left;">
        <h3><?php echo $row_getProf['full_name']; ?><span class="desig"><br />
          <?php echo $row_getProf['job_title']; ?> </span></h3>
<h3><?php if ($row_getProf['cv_file'] !="") { ?><a href="../documents/<?php echo $row_getProf['cv_file']; ?>">Download CV</a><?php } else echo "CV Not Uploaded"; ?>
&nbsp; <!--| &nbsp; Rate: £ &nbsp; <span class="rate"><input type="text"  name="hr_rate" id="hr_rate" value="<?php echo $row_getProf['hr_rate']; ?>" class="hr_rate" style="width: 50px;"/>-->
<input type="hidden" name="user" id="user" value="<?php echo $_REQUEST['user_id'];?>" />
<input type="hidden" name="from" id="from" value="1" />
<!--<input type="submit" value="Save" />--></span></h3>
<span class="desigr"><br />
<span class="resource"><strong>Account #: </strong></span><span class="resourc <?php if($row_getactivepro['bank_account']!=$row_getProf['bank_account']){ ?>redlabel<?php } ?>"><?php if($row_getProf['bank_account'] != NULL) { echo $row_getProf['bank_account'];} else{ echo "Not Entered";} ?></span> <br />
<span class="resource"><strong>Sort Code: </strong></span><span class="resourc <?php if($row_getactivepro['bank_sortcode']!=$row_getProf['bank_sortcode']){ ?>redlabel<?php } ?>">
<?php if($row_getProf['bank_sortcode'] != NULL){ echo $row_getProf['bank_sortcode'];} else{ echo "Not Entered";} ?>
</span><br />
<span class="resource"><strong>Bank: </strong></span><span class="resourc <?php if($row_getactivepro['bank_address']!=$row_getProf['bank_address']){ ?>redlabel<?php } ?>"><?php if($row_getProf['bank_address'] != NULL) { echo $row_getProf['bank_address'];} else{ echo "Not Entered";} ?></span><br>
<span class="resource"><strong>Date Of Birth: </strong></span><span class="resourc <?php if($row_getactivepro['date_of_birth']!=$row_getProf['date_of_birth']){ ?>redlabel<?php } ?>">
<?php if($row_getProf['date_of_birth'] != 0) { echo ''.date('d/m/Y', strtotime($row_getProf['date_of_birth']));}  else{ echo "Not Entered";} ?> </span><br>
<span class="resource"><strong>Passport Number: </strong></span><span class="resourc <?php if($row_getactivepro['passport_number']!=$row_getProf['passport_number']){ ?>redlabel<?php } ?>">
<?php if($row_getProf['passport_number'] != NULL) { echo $row_getProf['passport_number'];} else{ echo "Not Entered";} ?>
<br />

        <b><?php if($row_getProf['passport_edate'] != 0) { echo 'Exp. '.date('d/m/Y', strtotime($row_getProf['passport_edate']));} ?>

        </b></span><br />

        <span class="resource"><strong>Visa Number: </strong></span><span class="resourc <?php if($row_getactivepro['visa_number']!=$row_getProf['visa_number']){ ?>redlabel<?php } ?>">

        <?php if($row_getProf['visa_number'] != NULL) { echo $row_getProf['visa_number'];} else{ echo "Not Entered";} ?>

        <br />

        <b><?php if($row_getProf['visa_edate'] != 0) { echo 'Exp. '.date('d/m/Y', strtotime($row_getProf['visa_edate']));} ?>

        </b></span><br />

        <span class="resource"><strong>NI Number: </strong></span><span class="resourc <?php if($row_getactivepro['ni_number']!=$row_getProf['ni_number']){ ?>redlabel<?php } ?>">

        <?php if($row_getProf['ni_number'] != NULL) { echo $row_getProf['ni_number'];} else{ echo "Not Entered";} ?>

        </span><br />

        <span class="resource"><strong>Nationality: </strong></span><span class="resourc <?php if($row_getactivepro['citizen_of']!=$row_getProf['citizen_of']){ ?>redlabel<?php } ?>">

        <?php if($row_getProf['citizen_of'] != NULL) { echo $row_getProf['citizen_of'];} else{ echo "Not Entered";} ?>

        </span><br>

<span class="resource"><strong>Contact Phone: </strong></span><span class="resourc <?php if($row_getactivepro['contact_phone']!=$row_getProf['contact_phone']){ ?>redlabel<?php } ?>">
<?php if($row_getProf['contact_phone'] != NULL) { echo $row_getProf['contact_phone']; } else{ echo "Not Entered";} ?></span> <br />

<span class="resource"><strong>Contact Address: </strong></span><span class="resourc">
<?php if($row_getProf['contact_address'] != NULL) { echo $row_getProf['contact_address']; } else{ echo "Not Entered";} ?></span> <br />

<span class="resource"><strong>Email Address: </strong></span><span class="resourc <?php if($row_getactivepro['email_address']!=$row_getProf['email_address']){ ?>redlabel<?php } ?>">
<?php if($row_getProf['email_address'] != NULL) { ?>
<a href="mailto:<?php echo $row_getProf['email_address']; ?>"> <?php echo $row_getProf['email_address']; ?></a>
<?php } else{ echo "Not Entered"; } ?></span><br />

        <h3>Emergency Contact Details:</h3>
<span class="resource"><strong>Name: </strong></span>
<span class="resourc <?php if($row_getactivepro['kin_name']!=$row_getProf['kin_name']){ ?>redlabel<?php } ?>">
<?php if($row_getProf['kin_name'] != '') { echo $row_getProf['kin_name'];} else{ echo "Not Entered";} ?></span><br />

<span class="resource"><strong>Phone: </strong></span><span class="resourc <?php if($row_getactivepro['kin_phone']!=$row_getProf['kin_phone']){ ?>redlabel<?php } ?>">
<?php if($row_getProf['kin_phone'] != '') { echo $row_getProf['kin_phone'];} else{ echo "Not Entered";} ?></span><br />

<span class="resource"><strong>Mail Address: </strong></span><span class="resourc <?php if($row_getactivepro['kin_email']!=$row_getProf['kin_email']){ ?>redlabel<?php } ?>"><?php if($row_getProf['kin_phone'] != '') { ?>
<a href="mailto:<?php echo $row_getProf['kin_email']; ?>"> <?php echo $row_getProf['kin_email']; ?></a>
<?php } else{ echo "Not Entered"; } ?></span><br />

<span class="resource"><strong>Address: </strong></span><span class="resourc <?php if($row_getactivepro['kin_address']!=$row_getProf['kin_address']){ ?>redlabel<?php } ?>">
<?php if($row_getProf['kin_address'] != '') { echo $row_getProf['kin_address'];} else{ echo "Not Entered"; } ?></span>
</span> </div>

    </form>

    <div class="resource_info" style="width:20%; float:right;">

      <p><b>Employee ID:</b> <?php echo 'SDS0'.$row_getProf['employee_id']; ?>	  <br/><b>Joining Date:</b> <?php echo date('d/m/Y', strtotime($row_getProf['jdate'])); ?>

        <!--<input type="button" name="edit_jdate" id="edit_jdate" value="Edit" onclick="window.location.href='join-date-edit.php?user_id=<?php echo $row_getProf['user_id']; ?>'" />-->

        <br/>

        <b>Status:</b>

        <?php  if($row_getProf['status']=="A")

	   $s = "Active";

	   if($row_getProf['status']=="P")

	   $s = "Pending";

	   if($row_getProf['status']=="D")

	   $s = "<font color='#FF0000'>Deleted</font>";

	   echo $s; ?>

        <br/>

        <!--<b>Last Update:</b> <?php echo date('d/m/Y', strtotime($row_getProf['updated_date'])); ?></p>--><br/><br/>

        <a href="timesheet-all.php?created_by=<?php echo $row_getProf['user_id']; ?>" style="font-size:18px;">Timesheet Management</a><br/><br/>

        <a href="leave-list.php?uid=<?php echo $row_getProf['user_id']; ?>" style="font-size:18px;">Leave management</a>

    </div>

    

    <div class="clear-fix">&nbsp;</div>

    </div>

    <div class="aside clear_fix">

      <h4><strong>Store assigned</strong></h4>

      <ul class="resource_box">
<?php if($totalRows_getCuPro >0){ do { ?>
<li><?php echo $row_getCuPro['project_name']; ?></li>
<?php } while ($row_getCuPro = mysql_fetch_assoc($getCuPro)); } ?></ul>

<h5><strong>Passport Copy:</strong></h5>

<p><?php if($row_getProf['passport_file'] != NULL) {?>

<a href="../documents/<?php echo $row_getProf['passport_file']; ?>" target="_blank"><?php echo $row_getProf['passport_file']; ?></a><?php } else { echo "Not Uploaded"; }?></p>

      <h5><strong>Visa Copy:</strong></h5>

<p><?php if($row_getProf['visa_file'] != NULL) { ?>
<a href="../documents/<?php echo $row_getProf['visa_file']; ?>" target="_blank"><?php echo $row_getProf['visa_file']; ?></a>
<?php } else { echo "Not Uploaded"; } ?></p>


      <h5><strong>Other Documents:</strong></h5>

      <ol>

        <?php if($row_getDoclist['other_docs'] != NULL) { ?>

        <?php do {?>

        <li> <a href="../documents/<?php echo $row_getDoclist['other_docs']; ?>" target="_blank"><?php echo $row_getDoclist['other_docs']; ?></a></li>

        <?php } while ($row_getDoclist = mysql_fetch_assoc($getDoclist)); } else {echo "Not uploaded";} ?>

      </ol>

      </p>

    </div>

    <form method="post">

    <div class="left_side" style="padding-left:90px; width:450px;">

    <label for="status" style="width:165px">

    <p><strong>Skillset:</strong></p>

    </label>

    <input type="hidden" name="hiddenField" id="hiddenField" />

    <p class="<?php if($row_getactivepro['skill_set']!=$row_getProf['skill_set']){ ?>redlabel<?php } ?>">

      <?php if($row_getProf['skill_set'] != NULL) { echo $row_getProf['skill_set'];} else{ echo "Not Given"; } ?>

    </p>

    <form name="resource_view" method="POST" id="resource_view">

<div class="action_items" style="margin-left:165px;">
<input type="submit" value="Approve" name="approve" class="save_btn">
<input type="button" class="del-btn btn action-three" value="Reject" data-toggle="modal" data-target="#Confirpopup" />
<input type="reset" value="Cancel" class="reset_btn" onclick="window.location.href='/RM/admin/pending-resources-list.php'">
      </div>
      <div class="clear-fix">&nbsp;</div>
    </form>
  </div>

  </form>
<div class="modal fade formpopup in" id="Confirpopup" role="dialog" data-keyboard="false" data-backdrop="static">
<div class="modal-dialog modal-sm">
<div class="modal-content col-md-12">
<div class="modal-header">
<button type="button" class="close closepopup" data-dismiss="modal">×</button>
<h4>Confirmation</h4></div>
<p>Are You Sure, Do you want to reject this profile?</p>
<div class="field_item clear_fix">
<div class="col-md-12 text-center"><form method="post">
<input type="submit" value="Reject" name="reject" class="save_btn">
<input type="reset" value="Cancel" class="reset_btn" onclick="window.location.href='pending-resources-view.php?user_id=<?php echo $_REQUEST['user_id']; ?>'"></form>
</div>
</div></div></div></div> 
  <div class="clear-fix">&nbsp;</div>
<link href="../css/bootstrap.min.css" rel="stylesheet">
<script src="../js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
</div>

</section>



<!-- Sidebar Goes here -->

<aside class="sidebar">

  <?php #include("timesheet.php"); ?>

</aside>

<div class="clear-fix">&nbsp;</div>

</article>

<div class="clear-fix">&nbsp;</div>

   <!-- Footer Goes here -->
     <?php  require_once('../includes/footer.php'); ?>
    

</div>

</body>

</html>

<?php

mysql_free_result($getProf);



mysql_free_result($getProf1);



mysql_free_result($getCuPro);

?>