Script help
Posted: 2022-02-07 12:40
Hi Appgini community,
Need help with this script
In dueDate works fine, but take all inProdu td.cf-cf_in_production as success class.
Need help with this script
Code: Select all
$j(function () {
/* highlight unpaid invoices in table view */
$j('td.cf-cf_exp_date').each(function () {
var td = $j(this);
var td = td.parents('tr');
var dueDateTd = td.find('.cf-cf_exp_date');
var dueDate = moment(dueDateTd.text(), AppGini.datetimeFormat());
var today = moment().format('YYYY-MM-DD');
var inProdu = document.querySelector('td.cf-cf_in_production').textContent;
if (dueDate.isBefore(today)) {
td.find('.cf-cf_exp_date').addClass('danger');
td.find('.cf-cf_exp_date').addClass('text-danger');
td.find('.cf-cf_exp_date').addClass('text-bold');
} else if (dueDate.isSame(today)) {
td.find('.cf-cf_exp_date').addClass('warning');
td.find('.cf-cf_exp_date').addClass('text-warning text-bold');
}
if (inProdu =! null) {
td.find('.cf-cf_in_production').addClass('success');
td.find('.cf-cf_in_production').addClass('text-info');
td.find('.cf-cf_in_production').addClass('text-bold');
}
})
})
In dueDate works fine, but take all inProdu td.cf-cf_in_production as success class.