b24-snippets/bx-custom-include/kanban-color/script.js

19 lines
671 B
JavaScript
Raw Normal View History

2024-09-19 11:52:09 -04:00
BX.addCustomEvent('Kanban.Grid:onRender', grid => {
if (grid.getData().entityType != 'DYNAMIC_183')
return;
const items = grid.getItems();
for (let key in items) {
if (key < 1) continue;
const item = items[key];
console.log(item);
if (!('data' in item) || !('dateCreate' in item.data)) continue;
const SIX_HOURS = 1000 * 60 * 60 * 6;
const createdDate = new Date(item.data.dateCreate);
if ((createdDate + SIX_HOURS) >= Date.now()) {
// new Date("18.09.2024 09:28:58", "DD.MM.YYYY HH:mm:ss")
BX.addClass(item.container, 'kanban-color-bg-animate');
}
}
});