I have a table called "relaties.php" where i insert customers and a table "takenlijst.php". In the table "takenlijst.php" i can add tasks with a end date. Whe the end date is clossing, the row changes color.
I did the following in my footer_extras.php
Code: Select all
<script>
$j(function(){
$j('td.takenlijst-ta_startdatum a').each(function(){
var ds = $j(this).html();
/* assuming date format of due_date is month/day/year */
var dc = new Date(ds.replace(/(\d{1,2})\/(\d{1,2})\/(\d{4})/, '$2/$1/$3'));
var today = new Date();
var days_ahead = parseInt((dc - today) / 86400 / 1000);
if(days_ahead >= 14){
// 14+ days left, use None highlighting
//$j(this).addClass('text-success').parent().addClass('stripe');
$j(this).parents().addClass('stripe');
}else if(days_ahead >= 8){
// 8+ days left, use green highlighting
//$j(this).addClass('text-success').parent().addClass('success');
$j(this).parents().addClass('success');
}else if(days_ahead >= 3){
// 3 days left, use yellow highlighting
//$j(this).addClass('text-warning').parent().addClass('warning');
$j(this).parents().addClass('warning');
}else{
// less than 3 days left, use red highlighting
//$j(this).addClass('text-danger').parent().addClass('danger');
$j(this).parents().addClass('danger');
}
});
});
</script>
The table "relaties" is the Parent table
The table "takenlijst" is the Child table
Please see the screenshot its not changes the row color. Please show my how to do this? and advice.