
<?php $__env->startSection('css'); ?>
<link href="<?php echo e(asset('/css/bootstrapValidator.min.css')); ?>" rel="stylesheet">
<link href="<?php echo e(asset('plugins/datatables/css/jquery.dataTables.css')); ?>" rel="stylesheet">
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<section class="main_content">
    <div class="container">
     <ol class="breadcrumb cust-breadcrumb">
              <li><a href="<?php echo e(url('/')); ?>">Home</a></li>
              <li class="active">Mentor/Mentee</li>
            </ol>  
              <div class="row">

  <div class="clearfix"></div>
             <?php if(Session::get('error_msg')): ?>
              <div class="col-md-12">
                <div class="alert alert-danger">
                   <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                     <span aria-hidden="true">&times;</span>
                   </button>
                    <?php echo Session::get('error_msg') ?>
                </div>
              </div>
            <?php endif; ?>
            <?php if(Session::get('succ_msg')): ?>
              <div class="col-md-12">
                <div class="alert alert-success">
                   <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                     <span aria-hidden="true">&times;</span>
                   </button>
                    <?php echo Session::get('succ_msg')?>
                </div>
              </div>  
            <?php endif; ?>
          </div>
      <div class="row talent_home">
        <?php echo $__env->make("left_menu", array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
        <div class="col-md-9 col-sm-8">
            <div class="rt-panel-block">  
           <div class="my-profiles-block"> 
            <div id="render-this">
            <h1 class="heading pull-left">Mentor/Mentee</h1> 
           
            <div class="row">
         
              <div class="col-md-12">
                  <div id="connectionmsg" >
                      <?php if(isset($_GET['data'])): ?>
                      <p class='alert alert-success clearfix'>                
                          <?php echo e($_GET['data']); ?>                
                      </p>
                      <?php endif; ?>
                  </div>
                  <div class="clearfix"><br></div>
                  
                  <ul id="myTab" class="nav nav-tabs mentor-tabs">
                  <li class="active"><a href="#Mentor" data-toggle="tab">My Mentors</a></li>
                  <li class=""><a href="#Mentee" data-toggle="tab">My Mentees</a></li>
                  </ul>
                   <div id="myTabContent" class="tab-content">
                  <div class="tab-pane fade active in" id="Mentor">
                    <table id="userstable" class="display responsive nowrap table table-bordered">
                  <thead>
                    <tr>
                      <th style="display:none">Name</th>
                      <th style="display:none">Subject</th>
                      <th style="display:none">Date</th>
                    </tr>
                    <?php if(count($res_act)==0): ?>
                    <tr>
                        <td colspan="3" align="center">No New Message</td>                      
                    </tr>
                    <?php endif; ?>                    
                    <?php foreach($res_act as $rows): ?>                  
                    <tr>
                       <?php if($rows['status']=="1"): ?>
                        <td class="menter-pic-block"><?php if($rows['profile_type']=='O'): ?><a href="<?php echo e(url('profiles/'.$rows['receiver_profile_id'])); ?>"><?php else: ?><a href="<?php echo e(url('profiles/'.$rows['receiver_profile_id'])); ?>"><?php endif; ?><img src="<?php if($rows['profile_image'] && is_file('uploads/profile_images/'.$rows['profile_image'])) {echo 'uploads/profile_images/'.$rows['profile_image']; }else  {echo 'uploads/profile_images/default-profile.png';} ?>" class="img-circle menter-profil-pic"> <p class="menter-name-p"><?php if($rows['is_readed']=='N') echo "<strong> ". ucfirst($rows['name']). "</strong>"; else echo ucfirst($rows['name']); ?></p></a></td>
                        <?php endif; ?>
                         <?php if($rows['status']=="1"): ?>
                        <td><a href="<?php echo e(url('mentor/details/'.$rows['id'])); ?>" class="mentor-msg-txt"><?php if($rows['is_readed']=='N') echo "<strong title='New Message'> ".ucfirst($rows['subject'])." </strong>"; else echo ucfirst($rows['subject']); ?></strong></a><p class="mentor-msg-date"><?php echo e(date('d-m-Y',strtotime($rows['created_at']))); ?></p></td>
                         <?php endif; ?>
                    </tr>                  
                    <?php endforeach; ?>
                  </thead>
              </table>
                  </div>
                  <div class="tab-pane fade" id="Mentee">
                      <table id="userstable" class="display responsive nowrap table table-bordered">
                  <thead>
                    <tr>
                      <th style="display:none">Name</th>
                      <th style="display:none">Subject</th>
                      <?php $i=0;?>
                      <?php if(count($res_inact)>0): ?>
                      <?php foreach($res_inact as $rows): ?>
                      <?php if($rows['status']=="0"): ?>
                     <?php  $i++;?>
                      <?php endif; ?>
                      <?php endforeach; ?>
                      <?php endif; ?>  
                      
                    </tr>
                    <?php if(count($res_inact)==0): ?>
                    <tr>
                        <td colspan="3" align="center">No New Message</td>                      
                    </tr>
                    <?php endif; ?>
                    <?php foreach($res_inact as $rows): ?>                  
                    <tr>
                        <?php if($rows['status']=="0"){ ?> 
                            <td class="menter-pic-block"><?php if($rows['profile_type']=='O'): ?><a href="<?php echo e(url('profiles/'.$rows['sender_profile_id'])); ?>"><?php else: ?><a href="<?php echo e(url('profiles/'.$rows['sender_profile_id'])); ?>"><?php endif; ?><img src="<?php if($rows['profile_image'] && is_file('uploads/profile_images/'.$rows['profile_image'])) {echo 'uploads/profile_images/'.$rows['profile_image']; }else  {echo 'uploads/profile_images/default-profile.png';} ?>" class="img-circle menter-profil-pic" > &nbsp;<?php if($rows['is_readed']=='N') echo "<p class='menter-name-p'><strong> ". ucfirst($rows['name']). "</strong></p>"; else echo ucfirst($rows['name']); ?></a></td>
                        <?php } else if($rows['status']=="1") { ?>
                            <td class="menter-pic-block"><?php if($rows['profile_type']=='O'): ?><a href="<?php echo e(url('profiles/'.$rows['sender_profile_id'])); ?>"><?php else: ?><a href="<?php echo e(url('profiles/'.$rows['sender_profile_id'])); ?>"><?php endif; ?><img src="<?php if($rows['profile_image'] && is_file('uploads/profile_images/'.$rows['profile_image'])) {echo 'uploads/profile_images/'.$rows['profile_image']; }else  {echo 'uploads/profile_images/default-profile.png';} ?>" class="img-circle menter-profil-pic"><p class="menter-name-p"><?php if($rows['is_readed']=='N') echo "<strong> ". ucfirst($rows['name']). "</strong>"; else echo ucfirst($rows['name']); ?></p></a></td>
                        <?php } ?>
                         <?php if($rows['status']=="0"){ ?> 
                            <td><a href="<?php echo e(url('mentor/details/'.$rows['id'])); ?>" class="mentor-msg-txt"><?php if($rows['is_readed']=='N') echo "<strong title='New Message'> ".ucfirst($rows['subject'])." </strong>"; else echo ucfirst($rows['subject']); ?></strong></a></td>
                           <td> <a class="btn btn-success ment-acc-btn"  href="<?php echo e(url('mentorstatus/yes/'.$rows['sender_profile_id'])); ?>">Accept</a>&nbsp;<a class="btn btn-success ment-decl-btn" href="<?php echo e(url('mentorstatus/no/'.$rows['sender_profile_id'])); ?>" >Decline</a>&nbsp;<a class="btn btn-success ment-decl-btn" id="mentor_request" data-id="<?php echo e($rows['sender_profile_id']); ?>" href="javascript:void(0)" >Delete</a><p class="mentor-msg-date"><?php echo e(date('d-m-Y',strtotime($rows['created_at']))); ?></p></td>
                         <?php } else if($rows['status']=="1") { ?>
                        <td><a href="<?php echo e(url('mentor/details/'.$rows['id'])); ?>"><?php if($rows['is_readed']=='N') echo "<strong title='New Message'> ".ucfirst($rows['subject'])." </strong>"; else echo ucfirst($rows['subject']); ?></a></td><td><p class="mentor-msg-date"><?php echo e(date('d-m-Y',strtotime($rows['created_at']))); ?></p></td>
                       
                         <?php } ?>  
                       
                       
                    </tr>                  
                    <?php endforeach; ?>
                  </thead>
              </table>
                      
                   
                  </div>
                  </div>
              </div>
            </div> 
          </div>  
          </div>
          </div>       
        </div>  
       </div>
       </div>  
  </section>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('js'); ?>
<script src="<?php echo e(asset('js/bootstrapValidator.min.js')); ?>"></script>
<script src="<?php echo e(asset('plugins/datatables/js/jquery.dataTables.js')); ?>"></script>
<script src="<?php echo e(asset('js/typeahead_0.11.js')); ?>"></script>
<script src="<?php echo e(asset('js/handlebars.js')); ?>"></script>
<script src="<?php echo e(asset('js/validation.js')); ?>"></script>
<script src="<?php echo e(asset('js/bootbox.js')); ?>"></script>
<script>
$(document).on('click','#mentor_request',function(){
    var msg = 'Are you sure want to Delete ';
    var pic_id = $(this).attr("data-id");
    bootbox.confirm("Are you sure, you want to Decline Connection", function(result){   
     if(result)

   location.href = '<?php echo e(url("mentorstatus/delete")); ?>/'+pic_id;
         return true;
//       $.ajax({
//              url: "<?php echo e(url('statusdelete')); ?>",
//              type: 'get',
//              data: { 'pid':$pid,'_token': $('input[name=_token]').val() },
//              success:function(data){
//                         //$("#connectionmsg").append(data);
//                        window.location='connectionview?data='+data;
//                        }
//              });
    });
  });
        
 if($('#send_invitation').length)
{
  $(document).on('click','#send_invitation',function(){
    $('#send_invitation_modal').modal('show');
  });
}
if($('#sendInvitationForm').length)
{
  /*Compose To Address Profile Typeahead*/
  var bestPictures = new Bloodhound({
      datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
      queryTokenizer: Bloodhound.tokenizers.whitespace,
      //prefetch: '../data/films/post_1960.json',
      remote: {
        url: '<?php echo e(url("profile_typeahead")); ?>?profile_name=%QUERY',
        wildcard: '%QUERY'
      }
    });

  $('#to').typeahead(null, {
      name: 'best-pictures',
      display: 'value',
      source: bestPictures,
      templates: {
        empty: [
          '<div class="empty-message">',
            'unable to find any prfofile name that match the current query',
          '</div>'
        ].join('\n'),
        suggestion: Handlebars.compile('<p><img src="<?php echo e(url("uploads/profile_images/")); ?>/{{#if profile_image}}{{profile_image}}{{else}}default-profile.png{{/if}}" class="img-circle" width="50px" height="50px">&nbsp;<strong>{{value}}</strong>  {{username}}</p>')
      }

    }).on('typeahead:selected', function($e, datum){
        $("#sel_to_prof_id").val(datum['id']);
    });
  /* End To Address Profile Typeahead*/
  $(document).on('click','.clear_form',function(){
    window.location=window.location;
  });

  $("#composeMessageForm").bootstrapValidator({        
      message: 'This value is not valid',
      feedbackIcons: {
          valid: 'glyphicon glyphicon-ok',
          invalid: 'glyphicon glyphicon-remove',
          validating: 'glyphicon glyphicon-refresh'
      },
      fields: {
        'to': {
              validators: {
                  notEmpty: {
                      message: 'The To should not be empty'
                  },
                  remote: {
                      message : 'invalid to address',
                      url: "/invitation/check_username",
                      type: "get",
                      data: {
                      username: function() {
                                      return $("#username").val();
                                  }
                      }
                  }
              },
          },
        'subject': {
              validators: {
                  notEmpty: {
                      message: 'The Subject should not be empty'
                  },
              }
          },
        'message': {
              validators: {
                  notEmpty: {
                      message: 'The Message should not be empty'
                  },
              }
          },
      }
  });
}
/*if($('#users-table').length)
{
  $('#users-table').DataTable({
    //processing: true,
    serverSide: true,
    ajax: 'connectedlist?msg_type=I',
    columns: [
      {data: 'profile_image', name: 'profile_image', width:'25%', orderable: false, searchable: false},
      {data: 'name', name: 'name', width:'60%', orderable: false, searchable: false},
      {data: 'created_at', name: 'created_at', width:'15%'},
      {data: 'status', name: 'status', width:'60%', orderable: false, searchable: false},
      {data: 'sender_profile_id', name: 'sender_profile_id', width:'15%'}
    ],
  });
}*/
function statuschange($pid)
{
    $.ajax({
          url: "<?php echo e(url('statuschange')); ?>",
          type: 'get',
          data: { 'pid':$pid,'_token': $('input[name=_token]').val() },
          success:function(data){
                //alert(data);
               window.location='connectionview?data='+data;
                    }
                });
}
function statusdelete($pid)
{  var msg = 'Are you sure want to Delete ';
    bootbox.confirm("Are you sure, you want to Decline Connection", function(result){   
     if(result)
       $.ajax({
              url: "<?php echo e(url('statusdelete')); ?>",
              type: 'get',
              data: { 'pid':$pid,'_token': $('input[name=_token]').val() },
              success:function(data){
                         //$("#connectionmsg").append(data);
                        window.location='connectionview?data='+data;
                        }
              });
    });
}
$(document).ready(function(){
    
    $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  var target = $(e.target).attr("href") // activated tab
  //alert(target);
});
});
</script>
<?php $__env->stopSection(); ?>

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