<input type="hidden" name="_token" id="csrf-token" value="<?php echo e(csrf_token()); ?>" />
<div class="panel filterable block full table-responsive">
<div class="pull-right">
<button onclick="Reciclable.tableFilter(this)" id="filter" class="btn btn-default btn-xs btn-filter"><span class="glyphicon glyphicon-filter"></span> Filter</button>
</div>
<table class="table table-hover">
<thead>
<tr class="filters">
<th class="text-center"><input type="text" class="form-control text-center" placeholder="Reciclable" disabled /></th>
<th class="text-center"><input type="text" class="form-control text-center" placeholder="Chofer" disabled /></th>
<th class="text-center"><input type="text" class="form-control text-center" placeholder="Cliente" disabled /></th>
<th class="text-center"><input type="text" class="form-control text-center" placeholder="Fecha" disabled /></th>
<th class="text-center"><input type="text" class="form-control text-center" placeholder="Peso" disabled /></th>
<th class="text-center"><input type="text" class="form-control text-center" placeholder="Precio Chofer" disabled /></th>
<th class="text-center"><input type="text" class="form-control text-center" placeholder="Precio Cliente" disabled /></th>
</tr>
</thead>
<tbody>
<?php if(isset($costo_reciclable)): ?>
<?php foreach($costo_reciclable as $c_reciclable): ?>
<tr>
<td ><?php echo e($c_reciclable->reciclable); ?></td>
<td ><?php echo e($c_reciclable->username); ?></td>
<td class="text-center"><?php echo e($c_reciclable->nombre_comercial); ?></td>
<td class="text-center"><?php echo e($c_reciclable->fecha); ?></td>
<td class="text-center"><?php echo e($c_reciclable->peso_reciclable); ?></td>
<td class="text-center"><input type="number" onblur="Reciclable.modifyCostoReciclable(this)" data-type="1" data-reciclable_id="<?php echo e($c_reciclable->reciclable_id); ?>" data-user_id="<?php echo e($c_reciclable->user_id); ?>" data-fecha="<?php echo e($c_reciclable->fecha); ?>" data-cliente="<?php echo e($c_reciclable->cliente_id); ?>" class="form-control" step="0.01" min="0" value="<?php echo e(number_format($c_reciclable->costo_pago,2)); ?>" /></td>
<td class="text-center"><input type="number" onblur="Reciclable.modifyCostoReciclable(this)" data-type="2" data-reciclable_id="<?php echo e($c_reciclable->reciclable_id); ?>" data-user_id="<?php echo e($c_reciclable->user_id); ?>" data-fecha="<?php echo e($c_reciclable->fecha); ?>" data-cliente="<?php echo e($c_reciclable->cliente_id); ?>" class="form-control" step="0.01" min="0" value="<?php echo e(number_format($c_reciclable->costo_cliente,2)); ?>" /></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr><td class="text-center" colspan="8">No hay registros</td></tr>
<?php endif; ?>
</tbody>
</table>
</div>
<script type="text/javascript">
$('.filterable .filters input').keyup(function(e){
/* Ignore tab key */
var code = e.keyCode || e.which;
if (code == '9') return;
/* Useful DOM data and selectors */
var $input = $(this),
inputContent = $input.val().toLowerCase(),
$panel = $input.parents('.filterable'),
column = $panel.find('.filters th').index($input.parents('th')),
$table = $panel.find('.table'),
$rows = $table.find('tbody tr');
/* Dirtiest filter function ever ;) */
var $filteredRows = $rows.filter(function(){
var value = $(this).find('td').eq(column).text().toLowerCase();
return value.indexOf(inputContent) === -1;
});
/* Clean previous no-result if exist */
$table.find('tbody .no-result').remove();
/* Show all rows, hide filtered ones (never do that outside of a demo ! xD) */
$rows.show();
$filteredRows.hide();
/* Prepend no-result row if all rows are filtered */
if ($filteredRows.length === $rows.length) {
$table.find('tbody').prepend($('<tr class="no-result text-center"><td colspan="'+ $table.find('.filters th').length +'">No result found</td></tr>'));
}
});
</script>