File: /var/www/vhost/disk-apps/teamdemo.sports-crowd.com/resources/views/users/other-users.blade.php
@extends('modules.head') @section('contenido')
<style>
/* Ensure that the demo table scrolls */
/* th, */
td {
white-space: nowrap;
}
div.dataTables_wrapper {
height: fit-content;
margin: 0px 10px 0px 10px;
}
.dataTables_scrollBody {
max-height: none !important;
}
</style>
{{-- @if(!in_array(Auth::user()->rol->id, [16,15])) --}}
<div class="box-header">
<a class="auxiliar-black" href="{{url('/other-users/add')}}"> <button class="btn btnAdd pull-right">
<i class="fa fa-plus"></i> {{ Lang::get('messages.screen_other_users_tag1')}}</button></a>
</div>
{{-- @endif --}}
<!-- LISTADO otros usuarios -->
<div class="box">
<div class="box-header">
<h3 class="box-title">{{ Lang::get('messages.screen_other_users_tag2')}}</h3>
</div>
<!-- /.box-header -->
<div class="box-body table-responsive">
<table id="example2" class="stripe row-border order-column" style="width:100%" role="grid" aria-describedby="example2_info">
<thead>
<tr role="row">
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">{{ Lang::get('messages.screen_other_users_tag4')}}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">{{ Lang::get('messages.screen_other_users_tag3')}}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">{{ Lang::get('messages.screen_other_users_tag5')}}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">{{ Lang::get('messages.screen_other_users_tag7')}}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">{{ Lang::get('messages.screen_other_users_tag9')}}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">{{ Lang::get('messages.franchises')}}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">{{ Lang::get('messages.screen_other_users_tag10')}}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">{{ Lang::get('messages.screen_other_users_tag6')}}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending">{{ Lang::get('messages.screen_clients_tag0') }}</th>
</tr>
</thead>
</table>
</div>
<!-- /.box-body -->
</div>
<script src="{{ asset('js/jQuery/jquery-2.2.3.min.js') }}"></script>
<script src="{{ asset('js/other-users.js') . '?v=' . time() }}"></script>
<script src="{{ asset('js/ux.js') . '?v=' . time() }}"></script>
<script src="{{ asset('js/bootstrap/js/bootstrap.min.js') }}"></script>
<script type="text/javascript">
$(document).ready(function() {
let showFranchises = <?php echo json_encode($showFranchises); ?>;
let rol = 'Todos';
$(" select[name='roles']").on('change', function() {
rol = $(" select[name='roles']").val();
});
var sort_col = $('#example2').find("th:contains(" + Lang.get('messages.screen_clients_tag16') + ")")[0].cellIndex;
let fixedColumns = false;
let isMobileDevice = /Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
if (!isMobileDevice) {
fixedColumns = {
left: 2,
right: 2
};
}
_table = $('#example2').DataTable({
responsive: true,
processing: true,
serverSide: true,
order: [
[sort_col, 'desc']
],
language: {
url: window.DATATABLES_LANGUAGE_URL,
},
scrollX: true,
scrollCollapse: true,
paging: true,
fixedColumns: fixedColumns,
ajax: '{{ route("other-users.table") }}' + '/' + rol,
columns: [{
data: 'first_name',
name: 'first_name'
},
{
data: 'last_name',
name: 'last_name'
},
{
data: 'email',
name: 'email'
},
{
data: 'rol',
name: 'rols.name'
},
{
data: 'segmentation',
render: function(data, type, row) {
let tags = '';
if (row.segmentation) {
let list = row.segmentation.split(',');
let data = list.map(function(d) {
return '<li>' + d + '</li>';
});
tags = data.join('');
}
return tags;
},
name: 'tags.name',
},
{
data: 'locations',
visible: showFranchises,
name: 'academy_locations.name',
},
{
data: 'created_at',
name: 'created_at',
},
{
data: 'active',
name: 'active'
},
{
data: 'actions',
name: 'actions'
},
]
});
// Paginacion
$('#example2').on('page.dt', function() {
window.actualPage = $('#example2').DataTable().page();
localStorage.setItem("setPaginaActual", $('#example2').DataTable().page());
});
$('#example2').on('init.dt', function() {
if (localStorage.getItem("setPaginaActual")) {
let paginationCurrent = Number(localStorage.getItem("setPaginaActual", $('#example2').DataTable().page()));
if (parseInt(localStorage.getItem("setPaginaActual")) != paginationCurrent)
$('#example2').DataTable().page(paginationCurrent).draw('page');
}
});
var info = '<i class="fa fa-info-circle" id="btn-info-busqueda"></i><div class="dropdown-menu" id="menuBusqueda" style="left: 50%; padding: 5px; background-color: #f9fb8f;"><p data-toggle="modal">Busqueda por Cedula, Nombre y Correo</p></div>';
$('#example2_filter').append(info);
$('#btn-info-busqueda').on('click', function() {
$('#menuBusqueda').toggle();
});
});
// Paginacion inicial
var URLactual = window.location.href;
document.addEventListener('click', function(e) {
if (e.target.closest('a')) {
var href = e.target.closest('a').href || '';
href = href.split('#')[0];
if (URLactual != href) {
localStorage.setItem("setPaginaActual", 0);
}
}
}, false);
</script>
@endsection