@extends('layouts.app')

@section('content')
<?php					
$email = Auth::user()->email; 
$currentPath= Route::getFacadeRoot()->current()->uri();

?>


{{--*/ usort($tableGrid, "SiteHelpers::_sort") /*--}}
<div class="page-header" style="background-color: #6382a6;;">
  <div class="modulo"><img class="imagenmodulo1" src="../dashboardimage/usermas.png">
  <img class="imagenmodulo2" src="../dashboardimage/linea.png">&nbsp   CONTROL DE USUARIOS </div>
</div>



			<div class="toolbar-nav">
				<div class="row">
					<div class="col-md-8"> 
					
						@if($access['is_add'] ==1)
						<!--<a href="{{ url('core/users/create?return='.$return) }}" class="btn  btn-sm"  
							title="{{ __('core.btn_create') }}"><i class=" fa fa-plus "></i> Create New </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_excel'] ==1)
								<li class="nav-item"><a href="{{ url( $pageModule .'/export?do=excel&return='.$return) }}" class="nav-link"> Export CSV </a></li>	
							@endif
							@if($access['is_add'] ==1)
								<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>
								<li class="nav-item"><a href="javascript://ajax" class=" nav-link copy " title="Copy" > Copy selected</a></li>
							@endif-->	
								<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>  
					          	<!--<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>    <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 ">
						<!--<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>					
			<!-- End Toolbar Top -->

			<!-- Table Grid -->

	<div class="card">	
			<div class="card-body">
 			{!! Form::open(array('url'=>'core/users?'.$return, 'class'=>'form-horizontal m-t' ,'id' =>'SximoTable' )) !!}
 			
			<div class="table-responsive">
		    <table class="table  table-striped  " id="{{ $pageModule }}Table">
		        <thead>
					<tr style="text-align: center;">
						<th style="width: 3% !important;" class="number"> No </th>
						<th  style="width: 3% !important;"> <input type="checkbox" class="checkall minimal-green" /></th>
						<th  style="width: 10% !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 style="text-align: center;"> {{ ++$i }} </td>
							<td style="text-align: center;"><input type="checkbox" class="ids minimal-green" name="ids[]" value="{{ $row->id }}" />  </td>
							<td style="text-align: center;">

							 	<div class="dropdown">
								  <button class="btn btn-sm dropdown-toggle" type="button" data-toggle="dropdown"> {{ __('core.btn_action') }} </button>
								  <ul class="dropdown-menu">
								 	
									@if($access['is_edit'] ==1)
										
									<!--<li class="nav-item"><a  href="{{ url('core/users/'.$row->id.'/edit?return='.$return) }}" class="nav-link tips" title="{{ __('core.btn_edit') }}"> {{ __('core.btn_edit') }} </a></li>-->
									<li class="nav-item"><a href="{{ url('passwordmodal.php?Email='.$email.'&User='.$row->email.'')}}" onclick="SximoModal(this.href, 'Cambio de Contraseña'); return false;" class="nav-link ">Cambio de Contraseña</a></li>
									<li class="nav-item"><a href="{{ url('activarmobile.php?Email='.$row->email.'')}}" class="nav-link ">Activar</a></li>
									<li class="nav-item"><a href="{{ url('inactivarmobile.php?Email='.$row->email.'')}}" class="nav-link ">Inactivar</a></li>
									@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="text-align: center;" align="{{ $field['align'] }}" width=" {{ $field['width'] }}"  {!! $addClass !!} >					 
								 	{!! SiteHelpers::formatRows($row->{$field['field']},$field ,$row ) !!}						 
								 </td>
								@endif	
							 @endif					 
						 @endforeach			 
		                </tr>
						
		            @endforeach
		              
		        </tbody>
		      
		    </table>
		</div>
		    
			<input type="hidden" name="action_task" value="" />
			
			{!! Form::close() !!}
			
			</div>
			@include('footer')

			<!-- End Table Grid -->

</div>


<script>
$(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	
		}
	})	
	
});	
</script>
<style>
    
    /*td,th { text-align: center;
   

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