@extends('layouts.app')

@section('content')
<?php
$email = Auth::user()->email;
$Nombre = Auth::user()->first_name;
$Apellido = Auth::user()->last_name;
$Chat = Auth::user()->Chat;
$Mobile ='Si';
$DB = Auth::user()->dbname;
date_default_timezone_set('America/Caracas');
?>

<div class="page-header" style="background-color: #6382a6;">
  <div class="modulo"><img class="imagenmodulo1" src="dashboardimage/support.png">
  <img class="imagenmodulo2" src="dashboardimage/linea.png">&nbsp   GESTIÓN DE COMUNICACIÓN  </div>
</div>
<div class="toolbar-nav" >   
	<div class="row">
		<div class="col-md-8"> 	
			@if($access['is_add'] ==1)
			<a href="{{ url('gestioncomunicacion/create?return='.$return) }}" class="btn  btn-sm"  
				title="{{ __('core.btn_create') }}"style="border-color:#f29f41;" ><i class=" fa fa-plus "></i> NUEVO </a>
			@endif

			<div class="btn-group">
					<button type="button" class="btn btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="border-color:#f29f41;"><i class="fa fa-bars"></i> Acciones</button>
		        <ul class="dropdown-menu">
		        @if($access['is_remove'] ==1)
					 <li class="nav-item"><a href="javascript://ajax"  onclick="SximoDelete();" class="nav-link tips" title="{{ __('core.btn_remove') }}">
					Remover</a></li>
				@endif 
				@if($access['is_add'] ==1)
					<!--<li class="nav-item"><a href="javascript://ajax" class=" copy nav-link " title="Copy" > Copy selected</a></li>
					<div class="dropdown-divider"></div>
					<li class="nav-item"><a href="{{ url($pageModule .'/import?return='.$return) }}" onclick="SximoModal(this.href, 'Import CSV'); return false;" class="nav-link "> Import CSV</a></li>

					
				@endif
				<div class="dropdown-divider"></div>
		        @if($access['is_excel'] ==1)
					<li class="nav-item"><a href="{{ url( $pageModule .'/export?do=excel&return='.$return) }}" class="nav-link "> Export Excel </a></li>	
				@endif
				@if($access['is_csv'] ==1)
					<li class="nav-item"><a href="{{ url( $pageModule .'/export?do=csv&return='.$return) }}" class="nav-link "> Export CSV </a></li>	
				@endif
				@if($access['is_pdf'] ==1)
					<li class="nav-item"><a href="{{ url( $pageModule .'/export?do=pdf&return='.$return) }}" class="nav-link "> Export PDF </a></li>	
				@endif
				@if($access['is_print'] ==1)
					<li class="nav-item"><a href="{{ url( $pageModule .'/export?do=print&return='.$return) }}" class="nav-link "> Print Document </a></li>	
				@endif
				<div class="dropdown-divider"></div>-->
				<li class="nav-item"><a href="{{ url($pageModule) }}"  class="nav-link "> Limpiar Busqueda </a></li>
				<li class="nav-item"><a href="{{ url('dashboard') }}"  class="nav-link "> Salir </a></li>
		          	
		        
		          
		        </ul>
		    </div> <button type="button" class="btn btn-default btn-sm " 
			        onclick="SximoModal('{{ url($pageModule."/search") }}','Busqueda'); " style="border-color:#7fb3e3;" ><i class="fa fa-filter"></i> Filtro </button>   
		</div>
		<div class="col-md-4 text-right">
			<!--<div class="input-group ">
			      <div class="input-group-prepend">
			        <button type="button" class="btn btn-default btn-sm " 
			        onclick="SximoModal('{{ url($pageModule."/search") }}','Advance Search'); " ><i class="fa fa-filter"></i> Filter </button>
			      </div><!-- /btn-group
			      <input type="text" class="form-control form-control-sm onsearch" data-target="{{ url($pageModule) }}" aria-label="..." placeholder=" Type And Hit Enter ">
			    </div>-->
		</div>    
	</div>	

</div>	
<div class="card">
	<div class="card-body">

			<!-- Table Grid -->
			
 			{!! Form::open(array('url'=>'gestioncomunicacion?'.$return, 'class'=>'form-horizontal m-t' ,'id' =>'SximoTable' )) !!}
			<div class="table-responsive">
			@if(count($rowData)>=1)      
		    <table class="table  table-hover table-striped" id="{{ $pageModule }}Table">
		        <thead>
					<tr>
						<th style="width: 1% !important;" class="number"> No </th>
						<th  style="width: 4% !important;"> 
							<!--<input type="checkbox" class="checkall filled-in" id="checked-all"  />-->
							<label for="checked-all"style="font-weight: 600;" > Selección</label>
						</th>
						<th  style="width: 5% !important;">{{ __('core.btn_action') }}</th>
						
						@foreach ($tableGrid as $t)
							@if($t['view'] =='1')				
								<?php $limited = isset($t['limited']) ? $t['limited'] :''; 
								if(SiteHelpers::filterColumn($limited ))
								{
									$addClass='class="tbl-sorting" ';
									if($insort ==$t['field'])
									{
										$dir_order = ($inorder =='desc' ? 'sort-desc' : 'sort-asc'); 
										$addClass='class="tbl-sorting '.$dir_order.'" ';
									}
									echo '<th align="'.$t['align'].'" '.$addClass.' width="'.$t['width'].'">'.\SiteHelpers::activeLang($t['label'],(isset($t['language'])? $t['language'] : array())).'</th>';				
								} 
								?>
							@endif
						@endforeach
						
					  </tr>
		        </thead>

		        <tbody>        						
		            @foreach ($rowData as $row)
		                <tr>
							<td class="thead"> {{ ++$i }} </td>
							 @if($row->Email != $email)
							<td ><img class="imagen" src="dashboardimage/cerrada2.png"></td>
							@else
							
							<td class="tcheckbox">
							    <div style="margin-top:6px;margin-right:-4px;">
								<input type="checkbox" class="ids filled-in" name="ids[]" value="{{ $row->ComID }}" id="val-{{ $row->ComID }}" /> 
								<label for="val-{{ $row->ComID }}"></label>
								</div>
							</td>
							@endif
							<td>

							 <div class="dropdown">
								  <button class="btn dropdown-toggle" type="button" data-toggle="dropdown"> {{ __('core.btn_action') }} </button>
								  <ul class="dropdown-menu">
								    <li class="nav-item"><a href="{{ url('uploadcomadm?Email='.$email.'&id='.$row->ComID.'')}}" class="nav-link tips"> Anexar Documento</a></li>  
								    @if($row->Status =='Chat')     
								    <li class="nav-item" ><a href="{{ url(''.$Chat.$row->chattabla.'.php?ID='.$row->ComID.'&Email='.$email.'&Nombre='.$Nombre.'&Apellido='.$Apellido.'&Mobile='.$Mobile.'&DB='.$DB.'')}}"   class="nav-link tips iframe-lightbox-link"> Chat </a><li>  
								      @if($row->Email == $email) 
								      <li><a  href="{{ url('chatcerrarmobileadm.php?ID='.$row->ComID.'&Email='.$email.'')}}" class="nav-link  tips" title="{{ __('core.btn_edit') }}">Cerrar Chat</text> </a></li>
								      @else
								      @endif
								  
								   @else
								   
								    	@if($row->Status =='Chatlock')   
									    <li> <a class="nav-link  tips" href="{{ url('chattabla?Tabla='.$row->chattabla.'&Email='.$email.'') }}"  > Ver Conversaci&oacute;n</a></li>
									    @else
									    
									    @if($row->Email == $email)   
									    <li><a  href="{{ url('chattablemobileadm.php?ID='.$row->ComID.'&Email='.$email.'')}}" class="nav-link  tips" title="{{ __('core.btn_edit') }}">Activar Chat</text> </a></li>
								        	<li class="nav-item"><a  href="{{ url('gestioncomunicacion/'.$row->ComID.'/edit?return='.$return) }}" class="nav-link  tips" title="{{ __('core.btn_edit') }}"> {{ __('core.btn_edit') }} </a></li>
									    @else
									    @endif
									    
									    @endif

								   @endif  
								    
								    
								    
								    
					
								    <!--@if($row->Status !=='No Enviada')
								    @else
								    <li class="nav-item"><a href="{{ url('mensajes.php?Email='.$email.'&id='.$row->ComID.'')}}" class="nav-link tips">Enviar</a></li>
								    @endif
								 	@if($access['is_detail'] ==1)
									<li class="nav-item"><a href="{{ url('comunicacion/'.$row->ComID.'?return='.$return)}}" class="nav-link tips" title="{{ __('core.btn_view') }}"> {{ __('core.btn_view') }} </a></li>
									@endif
									@if($row->Status !=='No Enviada')
								    @else
									@if($access['is_edit'] ==1)
									<li class="nav-item"><a  href="{{ url('comunicacion/'.$row->ComID.'/edit?return='.$return) }}" class="nav-link  tips" title="{{ __('core.btn_edit') }}"> {{ __('core.btn_edit') }} </a></li>
									@endif
									@endif-->
									<!--<div class="dropdown-divider"></div>-->
									<!--@if($access['is_remove'] ==1)
										<li class="nav-item"><a href="javascript://ajax"  onclick="SximoDelete();" class="nav-link  tips" title="{{ __('core.btn_remove') }}">
										Remove Selected </a></li>
									@endif -->
								  </ul>
								</div>

							</td>														
						 @foreach ($tableGrid as $field)
							 @if($field['view'] =='1')
							 	<?php $limited = isset($field['limited']) ? $field['limited'] :''; ?>
							 	@if(SiteHelpers::filterColumn($limited ))
							 	 <?php $addClass= ($insort ==$field['field'] ? 'class="tbl-sorting-active" ' : ''); ?>
								 <td style="word-wrap: break-word;min-width: 100px;max-width: 100px;" align="{{ $field['align'] }}" width=" {{ $field['width'] }}"  {!! $addClass !!} >					 
								 	{!! SiteHelpers::formatRows($row->{$field['field']},$field ,$row ) !!}						 
								 </td>
								@endif	
							 @endif					 
						 @endforeach			 
		                </tr>
						
		            @endforeach
		              
		        </tbody>
		      
		    </table>
		     @else

	<div style="margin:100px 0; text-align:center;">
	
		<p> No existen datos !</p>
	</div>
	
	@endif
		    </div>
			<input type="hidden" name="action_task" value="" />
			
			{!! Form::close() !!}
			
			
			<!-- End Table Grid -->

	</div>
	@include('footer')
<div>
<!-- Modal -->
  <div class="modal fade p-5 " id="myModal" role="dialog" style="margin-top:-60px;">
    <div class="modal-dialog modal-dialog-centered">
    
      <!-- Modal content-->
      <div class="modal-content modal-sm text-center" >
       
        <div class="modal-body">
        	<img src="sximo5/images/send2.png" style="width: 40%;" />
          <H5>Proceso de Env&iacute;o Completado !</H5>
          <button type="button" class="btn btn-default" data-dismiss="modal" style="border-color: #f29f41;margin-bottom: -1px;margin-top: 5px;font-size:13px;">Cerrar</button>
        </div>
        
      </div>
      
    </div>
  </div>
<!-- Modal -->
</div>
<link rel="stylesheet" href="iframe-lightbox.min.css" />
<script src="iframe-lightbox.min.js"></script>

<script>

[].forEach.call(document.getElementsByClassName("iframe-lightbox-link"), function (el) {
  el.lightbox = new IframeLightbox(el);
});



$(document).ready(function(){
	$('.copy').click(function() {
		var total = $('input[class="ids"]:checkbox:checked').length;
		if(confirm('are u sure Copy selected rows ?'))
		{
			$('input[name="action_task"]').val('copy');
			$('#SximoTable').submit();// do the rest here	
		}
	})	
	
});	

function cuota3() {
  $("#myModal").modal()
    
}
</script>
<style>
    
    td,th { text-align: center;
   

    }
    
 .btn:focus,.btn:active {
   outline: none !important;
   box-shadow: none;
}     
    
</style>	
	
@stop
