<?php $this->load->view('header'); ?>
<!-- sidebar menu -->
<?php $this->load->view('left_bar'); ?>
<!-- page content -->

<div class="right_col" role="main">
  <div class="">
    <div class="clearfix"></div>
    <div class="row">
      <div class="col-md-4 col-sm-4 col-xs-12"> <!-- IMO this shud be a separate file -->
        <div class="x_panel tile fixed_height_320 overflow_hidden" style="display:none;">
          <div class="x_title">
            <h2>N JOB N Activity Graph</h2>
            <ul class="nav navbar-right panel_toolbox">
              <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a> </li>
              <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                <ul class="dropdown-menu" role="menu">
                  <li><a href="#">Settings 1</a> </li>
                  <li><a href="#">Settings 2</a> </li>
                </ul>
              </li>
              <li><a class="close-link"><i class="fa fa-close"></i></a> </li>
            </ul>
            <div class="clearfix"></div>
          </div>
          <div class="x_content">
            <table class="" style="width:100%">
              <tr>
                <th style="width:37%;"> <p></p>
                </th>
                <th> <div class="col-lg-7 col-md-7 col-sm-7 col-xs-7">
                    <p class=""></p>
                  </div>
                  <div class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
                    <p class=""></p>
                  </div>
                </th>
              </tr>
              <tr>
                <td><canvas id="canvas1" height="140" width="140" style="margin: 15px 10px 10px 0"></canvas></td>
                <td><table class="tile_info">
                    <tr>
                      <td><p><i class="fa fa-square blue"></i>Total Jobs</p></td>
                      <td>30%</td>
                    </tr>
                    <tr>
                      <td><p><i class="fa fa-square green"></i>Active Jobs</p></td>
                      <td>10%</td>
                    </tr>
                    <tr>
                      <td><p><i class="fa fa-square purple"></i>Short Listed Jobs</p></td>
                      <td>20%</td>
                    </tr>
                    <tr>
                      <td><p><i class="fa fa-square aero"></i>Total Candidate's</p></td>
                      <td>15%</td>
                    </tr>
                    <tr>
                      <td><p><i class="fa fa-square red"></i>Total Recruiter's</p></td>
                      <td>30%</td>
                    </tr>
                  </table></td>
              </tr>
            </table>
          </div>
        </div>
      </div>
      <div class="col-md-12 col-sm-12 col-xs-12">
        <div class="x_panel">
          <div class="x_title">
            <h2>Search CV by Skill</h2>
            <div class="clearfix"></div>
          </div>
          <div class="x_content">
            <table id="datatable-responsive" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
              <thead>
                <tr>
                  <th>#</th>
                  <th>Name</th>
                  <th>Job Title</th>
                  <th>Skills</th>
                  <th>CV File</th>
                </tr>
              </thead>
              <tbody>
                <?php 
			  	$no = 1;
			  	foreach ($query as $row) 
				{?>
                <tr>
                  <td><?php echo $no;?></td>
                  <td><?php echo $row->fname." ".$row->lname;?></td>
                  <td><?php
                  $user_id = $row->user_id;
				  $query=mysql_query("SELECT * FROM work_history WHERE candidate_id='".$user_id."'");
				  while ($history_data = mysql_fetch_array($query))
				  {
					  $job_title = $history_data['job_title'];
				  }
				  echo $job_title;
				   ?></td>
                  <td><?php 
				  $user_id = $row->user_id;
				  /*$sel_skill = mysql_query("SELECT * FROM candidate_skills WHERE candidate_id='".$user_id."'");*/
				  $this->db->where('candidate_id', $user_id);
				  $query=$this->db->get('candidate_skills');
				  $skills_data = $query->result();
				  foreach($skills_data as $val)
				  {
					  $skill_name=mysql_query("select * from skills where skill_id='".$val->skill_id."'");
					  $fetch_skill_name=mysql_fetch_array($skill_name);
					  echo $fetch_skill_name['skill_name']." ";
				  } ?></td>
                  <td><div style="margin: auto; width: 65%;"><span>
                      <input type="submit" onClick="window.open('<?php echo base_url();?>manage/download_cv?document=<?php echo $row->cv_file;?>&cand_id=<?php echo $row->user_id;?>')" target="_blank" value="Download CV">
                      </span>&nbsp; <span>
                      <input type="submit" onClick="window.open('<?php echo base_url();?>manage/view_cv?document=<?php echo $row->cv_file;?>&cand_id=<?php echo $row->user_id;?>')" target="_blank" value="View CV">
                      </span></br>
                    </div></td>
                </tr>
                <?php $no++;}?>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<?php $this->load->view('footer'); ?>
