@extends('main')

@section('css')
<link href="{{ asset('/css/bootstrapValidator.min.css')}}" rel="stylesheet">
@endsection
<!-- hai hello -->
@section('content')
<section class="main_content">
    <div class="container">
    <ol class="breadcrumb cust-breadcrumb">
              <li><a href="{{url('/')}}">Home</a></li>
              <li class="active">History</li>
            </ol>
                 <div class="row">
          <div class="col-md-12">
          @if (Session::get('error_msg'))
              <div class="alert alert-danger clearfix">
                 <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                   <span aria-hidden="true">&times;</span>
                 </button>
                  {{Session::get('error_msg')}}
              </div>
          @endif
          @if (Session::get('succ_msg'))
              <div class="alert alert-success clearfix">
                 <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                   <span aria-hidden="true">&times;</span>
                 </button>
                  {{Session::get('succ_msg')}}
              </div>
          @endif
          </div>
        </div>
      <div class="row talent_home">
        @include("left_menu")
        <div class="col-md-9 col-sm-9 recently-view-history"> 
          
             <h1 class="heading mtop-0">Recently Viewed</h1>
            @if (Session::get('error_msg') || Session::get('succ_msg'))
   
        @endif
            <div class="row" id="mylikes_div">
            
               
             <div class="col-sm-12 findsiz">
              <div class="row rt-panel-block pad20">    
                  <h3 class="history-head">
                      Profiles            
                  </h3>
                  <table id="profile" class="table table-striped table-bordered th-display-none" cellspacing="0" width="100%">
                    <thead>
                      <tr>
                        <th></th>
                        <th></th>
                      
                      </tr>
                   </thead>
 
                 <tbody>
                  @if($profiles->count() > 0)
                   @foreach($profiles as $views)
                  <tr>
                   <td class="his-width-200">
                  
                     <div class="profile-image history-profile">
                      @if($views->profile_image && is_file('uploads/profile_images/'.$views->profile_image))<a href="{{url('profiles/'.$views->profile_id)}}"><img class="img-responsive img-circle" src="{{url('uploads/profile_images/'.$views->profile_image)}}" alt=""/> </a>@else
                      <a href="{{url('profiles/'.$views->profile_id)}}"> <img src="{{url('uploads/profile_images/default-profile.png')}}"  class="img-responsive img-circle"></a>@endif
                    </div> 
                    
                  </td>
                  <td><h6>{{$views->profile_name}}</h6>
                  <br /><a href="{{url('profiles/'.$views->profile_id)}}" class="btn btn-history">View Profile</a>&nbsp;<a href="javascript:void(0)" title="Delete" class="btn btn-danger delete_video" data-id="{{$views->id}}">Remove History</a></td>
               
                 </tr>
                  @endforeach
                   @endif
                </tbody>
               </table>
             
              </div>
            </div>  
             <!-- profile end-->   
                
              <!-- video start-->   
             <div class="col-sm-12  findsiz">
              <div class="row rt-panel-block pad20">    
               <h3 class="history-head">              
                    Videos                 
               </h3>
              <table id="video" class="table table-striped table-bordered th-display-none" cellspacing="0" width="100%">
                <thead>
                    <tr>
                        <th></th>
                        <th></th>
                       
                    </tr>
                </thead>
 
               <tbody>
                  @if($videos->count() > 0)
                  @foreach($videos as $views)
                  <tr>
                   <td class="his-width-200">
                  
                     <div class="profile-image history-pic173">
                    <img src="{{$views->thumb_img}}" iframe-src ="https://player.vimeo.com/video/{{$views->path}}" view-id="{{$views->view_id}}" class="img-responsive popup">
                    </div> 
                    
                  </td>
                  <td><h6>{{$views->assets_name}}</h6><br />
                  <a href="javascript:;" class="btn btn-history popup" iframe-src ="https://player.vimeo.com/video/{{$views->path}}" view-id="{{$views->view_id}}">View Video</a>&nbsp;<a href="javascript:void(0)" title="Delete" class="btn btn-danger delete_video" data-id="{{$views->id}}">Remove History</a></td>
               
                 </tr>
                  @endforeach
                   @endif
              </tbody>
             </table>
              </div>
            </div>
          <!-- video end-->   
          
            
           <!-- picture start-->
           
           <div class="col-sm-12  findsiz">
              <div class="row rt-panel-block pad20">    
               <h3 class="history-head">              
                    Pictures                 
               </h3>
              <table id="picture" class="table table-striped table-bordered th-display-none" cellspacing="0" width="100%">
                <thead>
                    <tr>
                         <th></th>
                        <th></th>
                     
                    </tr>
                </thead>
 
               <tbody>
                  @if($pictures->count() > 0)
                  @foreach($pictures as $views)
                  <tr>
                   <td class="his-width-200">
                  
                     <div class="profile-image history-pic173">
                    <a href="javascript:;" class="view_btn" data-id="{{$views->view_id}}" data-title="{{$views->assets_name}}" data-url="images/{{$views->path}}"><img class="img-responsive" src="images/{{$views->path}}"/></a>
                    </div> 
                    
                  </td>
                  <td><h6>{{$views->assets_name}}</h6><br /><a href="javascript:;" class="btn btn-history view_btn" data-id="{{$views->view_id}}" data-url="images/{{$views->path}}" title="View">View Picture</a>&nbsp;<a href="javascript:void(0)" title="Delete" class="btn btn-danger delete_video" data-id="{{$views->id}}">Remove History</a></td>
               
                 </tr>
                  @endforeach
                   @endif
              </tbody>
             </table>
              </div>
            </div>
         
            <!-- picture end-->
            
            
           <!--resume start-->
                
            <div class="col-sm-12  findsiz">
              <div class=" row rt-panel-block pad20">    
                  <h3 class="history-head">              
                    Resumes                 
                  </h3>
                  <table id="resume" class="table table-striped table-bordered th-display-none" cellspacing="0" width="100%">
                    <thead>
                        <tr>
                            <th></th>
                            <th></th>
                           
                        </tr>
                    </thead>
 
                    <tbody>
                          @if($resumes->count() > 0)
                              @foreach($resumes as $views)
                        <tr>
                            <td class="his-width-200">

                              <div class="profile-image history-profile">
                             {{--*/ $addfile='images/text.png' /*--}}

                                  {{--*/ $viewName = @end( @explode( '.', $views->path ) ) /*--}}
                                  @if($viewName=='txt')
                                  {{--*/ $addfile='images/text.png' /*--}}
                                  @endif
                                  @if($viewName=='doc')
                                  {{--*/ $addfile='images/doc.png' /*--}}
                                  @endif
                                  @if($viewName=='docx')
                                  {{--*/ $addfile='images/docxs.png' /*--}}
                                  @endif
                                  @if($viewName=='pdf')
                                  {{--*/ $addfile='images/pdfs.png' /*--}}
                                  @endif
                                   @if($viewName=='xls')
                                  {{--*/ $addfile='images/xlss.png' /*--}}
                                  @endif
                                   @if($viewName=='xlsx')
                                  {{--*/ $addfile='images/xlsxs.png' /*--}}
                                  @endif
                                   @if($viewName=='rtf')
                                  {{--*/ $addfile='images/rtfs.png' /*--}}
                                  @endif
                                 @if($views->path)
                               <a href="{{URL::to('res_download', array($views->view_id))}}">  <img class="img-responsive" src="{{$addfile}}"  alt=""/></a>
                              @endif
                              </div> 

                            </td>
                            <td><h6>{{$views->assets_name}}</h6><br /><a href="{{URL::to('res_download', array($views->view_id))}}" class="btn btn-history">View Resume</a>&nbsp;<a href="javascript:void(0)" title="Delete" class="btn btn-danger delete_video" data-id="{{$views->id}}">Remove History</a></td>

                        </tr>
                         @endforeach
                          @endif
                    </tbody>
                  </table>       
              </div>
            </div>
            <!--resume end-->
                
                
          </div>
            
        </div>
      </div>
    </div>
    <div id="view_modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
        <div class="modal-dialog">
            <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title img-name"></h4>
                    </div>
                    <div class="modal-body">
                      <div class="form-horizontal">
                          <div class="form-group">
                               <div class="col-sm-12 text-center"><img src="" class="img-elem img-responsive"></div>
                          </div>
                          <div class="form-group">
                              <div class="col-md-12">
                                  <button data-dismiss="modal" class="btn-close btn delete-btn clear_form pull-right" type="button">Close</button>
                              </div>
                          </div>
                      </div>          
                   </div><!-- End of Modal body -->
            </div><!-- End of Modal content -->
        </div><!-- End of Modal dialog -->
    </div><!-- End of Profile Image Modal --> 
    
    <!--video model-->
    <!-- Modal -->
<div class="modal fade" id="popup" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
  <div class="modal-dialog">
    <div class="modal-content">
         <iframe src="" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen width="600" height="400" id="modal-iframe"></iframe>
      <div class="modal-footer video-model-foot">
        <button type="button" class="btn-close btn delete-btn clear_form pull-right" id="modal-close" >Close</button>
      </div>
    </div>
  </div>
</div>
    
  </section>
@endsection

@section('js')
<script src="{{ asset('js/bootstrapValidator.min.js')}}"></script>
<script src="{{ asset('js/maskedinput/jquery.maskedinput.min.js')}}"></script>
<script src="{{ asset('js/bootbox.js')}}"></script>
<script src="{{ asset('js/jquery.dataTables.min.js')}}"></script>
<script src="{{ asset('js/dataTables.bootstrap.js')}}"></script>
<script type="text/javascript">
    //for video popup
     $(document).on('click','.popup',function(){
      var atr_val=$(this).attr('view-id');
      var dataString = 'atr_val='+ atr_val +  '&_token=' + $("input[name=_token]").val();
       // alert(dataString);
                       $.ajax({
                              type: "POST",
                              url : "video_view",
                              data : dataString,
                              success : function(data){ }
                          },"json");
                          
                          $('#modal-iframe').attr('src',$(this).attr('iframe-src'));
                          $('#popup').modal('show'); 
                          
       
 });
 //video popup close
 $("#modal-close").click(function(){
        $('#modal-iframe').attr('src',"");
        $('#popup').modal('hide');
    })
    
 //picture popup   
   if($('.view_btn').length)
  {
    $(document).on('click','.view_btn',function(){
         var atr_val=$(this).attr('data-id');
          var atr_name=$(this).attr('data-title');
      $('#view_modal').modal('show');
        $('#view_modal .img-name').html(atr_name);
      $('#view_modal .img-elem').attr('src', $(this).attr('data-url'));
      $('#view_modal .assets_id_elem').val($(this).attr('data-id'));
        
         var dataString = 'atr_val='+ atr_val +  '&_token=' + $("input[name=_token]").val();
        
            $.ajax({
                              type: "POST",
                              url : "picture_view",
                              data : dataString,
                              success : function(data){//alert(data);
                              }
                          },"json");
                          
     
    });
  }
  
  //history delete functionality
   $(document).on('click','.delete_video',function(){
    var history_id = $(this).attr("data-id");
    bootbox.confirm("Are you sure, you want to delete this?", function(result) {
      if(result)
      location.href = '{{url("history_delete/")}}/'+history_id;
    });  
  });
  
  //jquery data table
  $(document).ready(function() {
    $('#profile').DataTable( {
		"language": {
        "emptyTable":     "No profiles found"
    },
        responsive: true,
        "aLengthMenu": [[3, 6, 9, 12, 15, 25, 50, 75,-1], [3, 6, 9, 12, 15, 25, 50, 75, "All"]],
        "iDisplayLength": 3
    } );
    $('#video').DataTable( {
		"language": {
        "emptyTable":     "No videos found"
    },
        responsive: true,
         "aLengthMenu": [[3, 6, 9, 12, 15, 25, 50, 75,-1], [3, 6, 9, 12, 15, 25, 50, 75, "All"]],
        "iDisplayLength": 3
    } );
    $('#picture').DataTable( {
		"language": {
        "emptyTable":     "No pictures found"
    },
        responsive: true,
         "aLengthMenu": [[3, 6, 9, 12, 15, 25, 50, 75,-1], [3, 6, 9, 12, 15, 25, 50, 75, "All"]],
        "iDisplayLength": 3
    } );
    $('#resume').DataTable( {
		"language": {
        "emptyTable":     "No resumes found"
    },
        responsive: true,
         "aLengthMenu": [[3, 6, 9, 12, 15, 25, 50, 75,-1], [3, 6, 9, 12, 15, 25, 50, 75, "All"]],
        "iDisplayLength": 3
    } );
} );

</script>
@endsection
