File: /var/www/vhost/disk-apps/teamdemo.sports-crowd.com/resources/views/photos_club/list.blade.php
@extends('modules.head')
@section('extra-css')
<style>
.expiredDate {
background-color: #FB5656 !important;
}
</style>
@endsection
@section('contenido')
<div class="box-header">
<a class="auxiliar-black" href="{{ url('/photos/add') }}">
<button class="btn btnAdd pull-right">
<i style="margin-right:5px;" class="fa fa-plus"></i>
{{ Lang::get('messages.photos_club.add') }}
</button></a>
</div>
<!-- List Data -->
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ Lang::get('messages.photos_club.title') }}</h3>
</div>
<!-- /.box-header -->
<div class="box-body table-responsive ">
<table id="example2" class="table table-bordered table-hover dataTable" 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.photos_club.name') }}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">{{ Lang::get('messages.photos_club.title_table') }}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">{{ Lang::get('messages.photos_club.init_date') }}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">{{ Lang::get('messages.photos_club.end_date') }}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">{{ Lang::get('messages.photos_club.description') }}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">{{ Lang::get('messages.academy_tournaments.segmentation') }}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">{{ Lang::get('messages.photos_club.likes_enabled') }}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">{{ Lang::get('messages.photos_club.comments_enabled') }}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">{{ Lang::get('messages.photos_club.active') }}</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.photos_club.actions') }}</th>
</tr>
</thead>
</table>
</div>
<!-- /.box-body -->
</div>
<script src="{{ asset('js/jQuery/jquery-2.2.3.min.js') }}"></script>
<script src="{{ asset('js/crud.js') . '?v=' . time() }}"></script>
<script src="{{ asset('js/photos_club.js') . '?v=' . time() }}"></script>
<script src="{{ asset('js/bootstrap/js/bootstrap.min.js') }}"></script>
<script async src="//www.instagram.com/embed.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var sort_col = $('#example2').find("th:contains("+ Lang.get('messages.photos_club.name')+")")[0].cellIndex;
_table = $('#example2').DataTable({
responsive: true,
processing: true,
serverSide: true,
order: [
[sort_col, 'desc']
],
language: {
url: window.DATATABLES_LANGUAGE_URL,
},
ajax: "{{ route('photos.table') }}",
columns: [{
data: 'name',
name: 'name'
},
{
data: 'image',
name: 'image'
},
{
data: 'init_date',
name: 'init_date'
},
{
data: 'end_date',
name: 'end_date'
},
{
data: 'description',
name: 'description'
},
{
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: 'likes_enabled',
name: 'likes_enabled',
render: function(data) {
return data == 1 ? 'Sí' : 'No';
}
},
{
data: 'comments_enabled',
name: 'comments_enabled',
render: function(data) {
return data == 1 ? 'Sí' : 'No';
}
},
{
data: 'active',
name: 'active'
},
{
data: 'actions',
name: 'actions'
},
],
"createdRow": function(row, data, dataIndex) {
var currentDate = new Date();
var endDate = new Date(data.end_date);
console.log(endDate, currentDate, "data fechas");
if (endDate < currentDate) {
console.log(data, "data");
$(row).addClass('expiredDate');
}
}
});
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 Nombre, Orden y Link</p></div>';
$('#example2_filter').append(info);
$('#btn-info-busqueda').on('click', function() {
$('#menuBusqueda').toggle();
});
});
</script>
@endsection