<?php $__env->startSection('content'); ?>

<?php
$searchValue = isset($_GET['searchValue'])?$_GET['searchValue']:'';
$searchBy = isset($_GET['searchBy'])?$_GET['searchBy']:'';
$order_by = isset($_GET['order_by'])?$_GET['order_by']:'';
$order = isset($_GET['order'])?$_GET['order']:'';
$redirect = url('/').'/admin/consultants?'.urlencode($_SERVER["QUERY_STRING"]);


?>


<style type="text/css">
  .clip_css{position: relative;
    background: #ccc;
    padding: 10px 12px;
    left: -57px;}
</style>
<!-- page content -->

<div class="right_col" role="main">
  <div class="row x_panel">
      <?php if(Session::has('message')): ?>
          <div class="alert alert-success">
              <button type="button" class="close" data-close="alert"></button>
               <?php echo e(Session::get('message')); ?>

          </div>
    <?php endif; ?>
    <div class="pull-right">
      <a href="<?php echo $links['csvlink']; ?>" class="btn btn-success">CSV</a>
      <a href="<?php echo $links['pdflink']; ?>" class="btn btn-success">PDF</a>
    </div>
    <div class="pull-left">
      <a href="<?php echo url('/'); ?>/admin/consultants/add" class="btn btn-success">Add Consultants</a>
    </div>
    <br>
    <hr>

    <form method="GET" action="" class="form-inline ibox-content">
        <div class="form-group">
          <select name="searchBy" class="form-control">
           <option value="consultants.con_name" <?php echo $searchBy=="consultants.con_name"?'selected="selected"':""; ?>>Consultant</option>
           <option value="consultants.con_email" <?php echo $searchBy=="consultants.con_email"?'selected="selected"':""; ?>>Email</option>
           <option value="consultants.con_phone" <?php echo $searchBy=="consultants.con_phone"?'selected="selected"':""; ?>>Phone</option>           
           <option value="consultants.con_profile_headline" <?php echo $searchBy=="consultants.con_profile_headline"?'selected="selected"':""; ?>>Profile Headline</option>
           <option value="industries.indu_title" <?php echo $searchBy=="industries.indu_title"?'selected="selected"':""; ?>>Industries</option>
           <option value="consultants.con_status" <?php echo $searchBy=="consultants.con_status"?'selected="selected"':""; ?>>Status</option>
          </select>
        </div>
        <div class="form-group">
          <input type="text" name="searchValue" id="searchValue" class="form-control" value="<?php echo $searchValue; ?>">
        </div>
        <input type="submit" name="search" value="Search" class="btn btn-info">
        <div class="form-group pull-right">
          <select name="per_page" class="form-control" onchange="this.form.submit()">
            <option value="5" <?php echo $per_page=="5"?'selected="selected"':""; ?>>5</option>
            <option value="10" <?php echo $per_page=="10"?'selected="selected"':""; ?>>10</option>
            <option value="20" <?php echo $per_page=="20"?'selected="selected"':""; ?>>20</option>
            <option value="50" <?php echo $per_page=="50"?'selected="selected"':""; ?>>50</option>
            <option value="100" <?php echo $per_page=="100"?'selected="selected"':""; ?>>100</option>
          </select>
        </div>
      </form>

              <hr>

    <div class="col-md-12 col-sm-12 col-xs-12">
    <h1>Consultants</h1>
    <br>
    <div class="table-responsive">
      <table class="table table-striped table-bordered table-hover Tax" >
      <thead>
      <th><input onclick="toggle(this,'cbgroup1')" id="foo[]" name="foo[]" type="checkbox" value="" /></th>
       <th> Sr No. </th>
          <?php $sortSym=isset($_GET["order"]) && $_GET["order"]=="asc" ? "up" : "down"; ?>
            <?php $symbol = isset($_GET["sortBy"]) && $_GET["sortBy"]=="consultants.con_name"?"<i class='fa fa-sort-$sortSym' aria-hidden='true'></i>": "<i class='fa fa-sort' aria-hidden='true'></i>"; ?>
            <th>
            <a href="<?php echo $links["consultants.con_name_link"]; ?>" class="link_css"> Consultant <?php echo $symbol ?></a>
            </th>
			
            <?php $symbol = isset($_GET["sortBy"]) && $_GET["sortBy"]=="consultants.con_email"?"<i class='fa fa-sort-$sortSym' aria-hidden='true'></i>": "<i class='fa fa-sort' aria-hidden='true'></i>"; ?>
            <th>
            <a href="<?php echo $links["consultants.con_email_link"]; ?>" class="link_css"> Email <?php echo $symbol ?></a>
            </th>
			
            <?php $symbol = isset($_GET["sortBy"]) && $_GET["sortBy"]=="consultants.con_phone"?"<i class='fa fa-sort-$sortSym' aria-hidden='true'></i>": "<i class='fa fa-sort' aria-hidden='true'></i>"; ?>
            <th>
            <a href="<?php echo $links["consultants.con_phone_link"]; ?>" class="link_css"> Phone <?php echo $symbol ?></a>
            </th>
			
            <?php $symbol = isset($_GET["sortBy"]) && $_GET["sortBy"]=="consultants.con_profile_headline"?"<i class='fa fa-sort-$sortSym' aria-hidden='true'></i>": "<i class='fa fa-sort' aria-hidden='true'></i>"; ?>
            <th>
            <a href="<?php echo $links["consultants.con_profile_headline_link"]; ?>" class="link_css"> Profile Headline <?php echo $symbol ?></a>
            </th><!-- 
			
            <?php
             $symbol = isset($_GET["sortBy"]) && $_GET["sortBy"]=="industries.indu_title"?"<i class='fa fa-sort-$sortSym' aria-hidden='true'></i>": "<i class='fa fa-sort' aria-hidden='true'></i>"; ?>

            <th> 
            <a href="<?php echo $links["industries.indu_title_link"]; ?>" class="link_css"> Industries <?php echo $symbol ?></a>
            </th> -->
				
            <?php $symbol = isset($_GET["sortBy"]) && $_GET["sortBy"]=="consultants.con_status"?"<i class='fa fa-sort-$sortSym' aria-hidden='true'></i>": "<i class='fa fa-sort' aria-hidden='true'></i>"; ?>
            <th>
            <a href="<?php echo $links["consultants.con_status_link"]; ?>" class="link_css"> Status <?php echo $symbol ?></a>
            </th>
            <th class="action-width">Generate ID</th>
            <th class="action-width">Jobs</th>
            <th class="action-width">Assign Jobs</th>
            <th class="action-width">Walk In Interview</th>
            <th>Action</th>
      </thead>
      <tbody>
      <?php $count=1;
            $img_path=url('/').'/uploads/';
          foreach($data as $value){
           ?>
          <tr id="hide<?php $value->con_id; ?>" >
            
            <th>
            <input name='input' id='del' onclick="callme('show')"  type='checkbox' class='del' value='<?php echo $value->con_id; ?>'/>
            </th>
            <th>
            <?php echo $count; $count++; ?>
            </th>
            <th>
            <?php echo e($value->con_name); ?>

            </th>
                
            <th>
            <?php echo e($value->con_email); ?>

            </th>
                
            <th>
            <?php echo e($value->con_phone); ?>

            </th>
                
            <th>
            <?php echo e($value->con_profile_headline); ?>

            </th><!-- 
                
            <th>
            <?php if(!empty($value->indu_title)){ echo $value->indu_title; }?>
            </th> -->
                        
            <th>
            <a href="<?php echo url("/")?>/admin/consultants/status/con_status/<?php echo $value->con_id; ?>">
            <?php if(!empty($value->con_status) and $value->con_status==1 )
            { echo "Active"; }else{ echo "Inactive";}?>
            </a>
            </th>
            <th class="action-width">
               <a href="javascript:;" title="Generate Id"  onclick="generateId('<?php echo e($value->con_id); ?>');">
                <span class="btn btn-info " >
                  Generate Id
                </span>
               </a>
            </th>
            <th class="action-width">
               <a href="<?php echo url('/')?>/admin/jobs/job_consultancy/<?php echo $value->con_id; ?>" title="Add Jobs">
                <span class="btn btn-info " >
                  Add Jobs
                </span>
               </a>
            </th>
            <th class="action-width">
               <a href="<?php echo url('/')?>/admin/job_assign/<?php echo $value->con_id; ?>" title="Assign Jobs">
                <span class="btn btn-info " >
                  Assign Jobs
                </span>
               </a>
            </th>
            <th class="action-width">
               <a href="<?php echo url('/')?>/admin/walk_in_interview/wi_cons_id/<?php echo $value->con_id; ?>" title="Add Walk In Interview">
                <span class="btn btn-info " >
                   Add Walk In Interview
                </span>
               </a>
            </th>
		        <th>
               <!-- <a href="<?php echo url("/"); ?>/admin/consultants/view/<?php echo $value->con_id?>" title="View">
                <span class="btn btn-info " ><i class="fa fa-eye"></i></span>
               </a> -->
               <a href="<?php echo url("/"); ?>/admin/consultants/edit/<?php echo $value->con_id; ?>" title="Edit">
                <span class="btn btn-info " ><i class="fa fa-edit"></i></span>
               </a>
               <a  title="Delete" data-toggle="modal" data-target="#commonDelete" onclick="$('#set_commondel_id').val('<?php echo $value->con_id; ?>');">
               <span class="btn btn-info " ><i class="fa fa-trash-o "></i></span>
               </a>
            </th>
          </tr>
          <?php
              }
              if($count<=1){
                echo '<tr><td colspan="100"><h3 align="center" class="text-danger">No Record found!</center</td></tr>';
              } ?>
            </tbody>
            </table>
            <?php echo e($data->links('vendor.pagination.default')); ?>

            </div>

    </div>
  </div>
</div>
<img onclick="callme('','item','')" src="<?php echo url('/')?>/accets/img/mac-trashcan_full-new.png" id="recycle" style="width:90px;  display:none; position:fixed; bottom: 50px; right: 50px;"/>
<!-- /page content -->

<!-- Common Delete Popup  -->
<div class="modal fade" id="commonDelete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
 <form action="<?php echo url('/'); ?>/admin/consultants/delete" method="post">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title" id="frm_title">Delete</h4>
      </div>
      <div class="modal-body" id="frm_body">
   Do you really want to delete?
    <input type="hidden" id="set_commondel_id" name="con_id">
    <input type="hidden" name="redirect" value="<?php echo $redirect; ?>">
    <?php echo e(csrf_field()); ?>

    </div>
      <div class="modal-footer">
        <button style='margin-left:10px;' type="submit" class="btn btn-primary col-sm-2 pull-right" id="frm_submit">Yes</button>
        <button type="button" class="btn btn-danger col-sm-2 pull-right" data-dismiss="modal" id="frm_cancel">No</button>
      </div>
    </div>
  </div>
</form>
</div>
<!-- ./ Common Delete Popup /. -->
<!-- Generate ID -->
<div id="generateID" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Generate Login Password</h4>
      </div>
      <div class="modal-body">
        <form class="form-horizontal" id="passForm">
          <?php echo e(csrf_field()); ?>

        <div class="form-group">
          <label for="loginId" class="col-sm-3 control-label"> Login ID </label>
          <div class="col-sm-9">
            <input type="hidden" name="con_id" id="hidden_con_id">
            <input type="hidden" value="consultants" name="table">
            <input type="text" class="form-control" id="loginId" name="loginId" disabled="disabled" readonly>
          <!-- </div>
          <div class="col-sm-5"> -->
            <div class="label label-danger"><?php echo e($errors->first("loginId")); ?></div>
            </div>
        </div>
        <div class="clear"></div>
         <div class="form-group ">
          <label for="logPass" class="col-sm-3 control-label">Password </label>
          <div class="col-sm-5">
           <!--  <input type="text" class="form-control" id="logPass" name="logPass"  value="<?php echo e(old('logPass')); ?>">  -->
           <div class = "input-group">
             <input type="text" class="form-control" id="logPass" name="logPass"  value="<?php echo e(old('logPass')); ?>"> 
             <span class = "input-group-addon">
                <a href="#" title="Copy To Clipboard" id='copyTOClipoard'><i class="fa fa-clipboard "></i></a>
              </span>
          </div>
           <span class="hidden text-success " id="textCopiedText">Text Copied To Clipboard</span>

          </div>
          <div class="col-sm-4">
              
             <button class='btn btn-secondary' type='button' onclick="createStriing()">Generate</button>
            
            </div>
            
        </div>
        <div class="clear"></div>
        <div class="form-group">
          
          <div class="col-sm-3 ">
            <input type="checkbox" name="" id='passCopyCheckbox' class="pull-right onoffswitch-checkbox" value="0">
          </div>
          <div class="col-sm-9">
            <span>
              Password Copied and saved in safe place. 
            </span><br>
            <span id='passCopyCheckboxErr' class=" hidden text-danger">Please select checkbox</span>
           
            </div>
        </div>
        <div class="clear"></div>
         <div class="form-group">
          <div class="col-sm-3 ">
            <input type="checkbox" name='sendMail' id='sendMail' class="pull-right onoffswitch-checkbox" value="0">
          </div>
          <div class="col-sm-9">
            <span>
              Send On Mail.
            </span><br>
            <span id=''  class="hidden text-danger">Please select checkbox</span>           
            </div>
        </div>
        <div class="clear"></div>
        <div class="form-group">
          <label for="logPass" class="col-sm-3 control-label"> </label>
          <div class="col-sm-4">
           
            <button class="btn btn-success" type="button" id="loginInfoSubmitBtn">Submit</button>
          </div>
          
        </div> 
        </form>
      </div>
     
    </div>

  </div>
</div>

<!-- Generate ID -->
<script type="text/javascript">
  $('#loginInfoSubmitBtn').click(function(){
    if($('#logPass').val()==''){
      $('#textCopiedText').text("Password Shouldn't be blank").removeClass('hidden text-success').addClass('text-danger').show();
      setTimeout(function(){
       $('#textCopiedText').addClass('hidden');
      },3000);
      return false;
    }
    // console.log($('#passCopyCheckbox').val());
    if($('#passCopyCheckbox').val()!=1){
      $('#passCopyCheckboxErr').removeClass('hidden').show();
      setTimeout(function(){
       $('#passCopyCheckboxErr').addClass('hidden');
      },3000);
      return false;
    }
      $.ajax({
        url:'<?php echo e(url("/")); ?>/admin/saveLoginInfo',
        data:$('#passForm').serialize(),
        type:'post',
        success:function(res)
        {
          if(res=='true'){
            $('#generateID').modal('hide');
            alert('Password generated Successfully');
            return false;
          }else{
            alert('Something Went Wrong. Please try after some time');
            return false;
          }
        }
      });
  });

  $('#copyTOClipoard').click(function(){
    var copyText = document.getElementById("logPass");
    if(copyText.value!=''){
      copyText.select();
      copyText.setSelectionRange(0, 99999);
      document.execCommand("copy");
      $('#textCopiedText').text('Text Copied To Clipboard').removeClass('hidden text-danger').addClass('text-success').show();
      setTimeout(function(){
       $('#textCopiedText').addClass('hidden');
      },1000);
    }else{
      $('#textCopiedText').text('Nothing To copy').removeClass('hidden text-success').addClass('text-danger').show();
      setTimeout(function(){
       $('#textCopiedText').addClass('hidden');
      },1000);
    }
  });

  function generateId(conID)
  {
    // console.log(conID);
    if(conID!='')
    {
      $.ajax({
        url:"<?php echo e(url('/')); ?>/admin/getLoginInfo/consultants/"+conID,
        type:'get',
        success:function(res)
        {
          // console.log(res);
          if(res!=null)
          {
            $('#loginId').val(res.con_email);
            $('#hidden_con_id').val(conID);
          }
          $('#generateID').modal('show');
        }
      });
    }

  }

  function randStr(len) 
  {
    let s = '';
    while (len--) s += String.fromCodePoint(Math.floor(Math.random() * (126 - 33) + 33));
    return s;
  }

  function createStriing()
  {
    $('#logPass').val(randStr(12));
  }
// console.log(randStr(10));
</script>
<script type="text/javascript">
   function delRow()
   {var confrm = confirm("Are you sure you want to delete?");
     if(confrm)
     {
       ids = values();
       $.ajax({
         type:"POST",
         url:'<?php echo url("/")."/admin/consultants/deleteAll"; ?>',
         data:{
          allIds:ids,
          _token:"<?php echo e(csrf_token()); ?>",
         },
         success:function(res){
           location.reload();
           },
       });
     }
   }
</script>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>