Estoy creando listado
con el plug-in
DataTable
. Hasta el momento ahí todo bien.
Uso php
, js
y mysql
MVC
en ella se encuentra el registro
Fecha Próxima etapa
.
Busco poder agregar un mensaje de alerta
en la columna de observaciones. donde si la Fecha Próxima etapa
es mayor a la fecha actual
, me avise que ya se paso "x" días y si es menor que faltan "x" días.
este es mi código
con el cual listo mi tabla
<div class="col-md-12">
<div class="box box-default box-solid">
<div class="box-header with-border">
<h3 class="box-title"> <b> CERDOS REPRODUCIDOS</b> </h3>
<!-- /.box-tools -->
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="form-group">
<div class="col-lg-10">
<div class="input-group">
<input type="text" class="global_filter form-control" id="global_filter" placeholder="Ingresar dato a buscar">
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div><br>
</div>
<div class="col-lg-2">
<button class="btn btn-danger" style="width:100%" onclick="AbrirModalRegistroReproducidos()"><i class="glyphicon glyphicon-plus"></i>Nuevo Registro</button>
</div>
</div>
<table id="listar_reproducidos" class="display responsive nowrap" style="width:100%">
<thead>
<tr>
<th>#</th>
<th>Fecha de Registro</th>
<th>Tatuaje</th>
<th>Madre</th>
<th>Padre</th>
<th>Fecha de Nacimiento</th>
<th>Sexo</th>
<th>Peso Promedio KG</th>
<th>Peso Real KG</th>
<th>Etapa</th>
<th>Fecha Proxima Etapa</th>
<th>Moviento</th>
<th>Acción</th>
<th>Observaciones</th>
</tr>
</thead>
<tfoot>
<tr>
<th>#</th>
<th>Fecha de Registro</th>
<th>Tatuaje</th>
<th>Madre</th>
<th>Padre</th>
<th>Fecha de Nacimiento</th>
<th>Sexo</th>
<th>Peso Promedio KG</th>
<th>Peso Real KG</th>
<th>Etapa</th>
<th>Fecha Proxima Etapa</th>
<th>Moviento</th>
<th>Acción</th>
<th>Observaciones</th>
</tr>
</tfoot>
</table>
</div>
<!-- /.box-body -->
</div>
</div>
y este mi js
con el que traigo los datos de la BD
var table;
function listar_reproducidos(){
table = $("#listar_reproducidos").DataTable({
"ordering":true,
"bLengthChange":true,
"searching": { "regex": false },
"lengthMenu": [ [10, 25, 50, 100, -1], [10, 25, 50, 100, "All"] ],
"pageLength": 10,
"destroy":true,
"async": false ,
"processing": true,
"ajax":{
"url":"../controlador/reproducidos/controlador_reproducidos_listar.php",
type:'POST'
},
"columns":[
{"data":"posicion"},
{"data":"cerp_fecharegistro"},
{"data":"cerp_tatuaje"},
{"data":"reproh_tatuaje"},
{"data":"reprom_tatuaje"},
{"data":"cerp_fechanacimiento"},
{"data":"cerp_sexo",
render: function (data, type, row ) {
if(data=='M'){
return "MACHO";
}else{
return "HEMBRA";
}
}
},
{"data":"cerp_pesopromedio"},
{"data":"cerp_pesoreal"},
{"data":"eta_nombre"},
{"data":"cerp_fechafinaletapa"},
{"data":"mov_nombre",
render: function (data, type, row ) {
if(data=='ACTIVO'){
return "<span class='label label-success'>"+data+"</span>";
}else{
return "<span class='label label-danger'>"+data+"</span>";
}
}
},
{"defaultContent":"<button style='font-size:13px;' type='button' class='editar btn btn-primary'><i class='fa fa-edit'></i></button> "},
{"defaultContent":""}
],
"language":idioma_espanol,
select: true
});
document.getElementById("listar_reproducidos_filter").style.display="none";
$('input.global_filter').on( 'keyup click', function () {
filterGlobal();
} );
$('input.column_filter').on( 'keyup click', function () {
filterColumn( $(this).parents('tr').attr('data-column') );
});
}
Muchas Gracias de ante mano y Bendiciones