view.ui.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. window.waitDom('body.body-modal .toolbar', function()
  2. {
  3. $('.body-modal .toolbar a[data-load="modal"]').attr('data-toggle', 'modal').removeAttr('data-load');
  4. })
  5. window.renderCell = function(result, info)
  6. {
  7. const task = info.row.data;
  8. if(info.col.name == 'name' && result)
  9. {
  10. if(typeof result[0] == 'object') result[0].props.className = 'overflow-hidden';
  11. if(typeof task.delay != 'undefined' && task.delay > 0)
  12. {
  13. result[result.length] = {html:'<span class="label danger-pale ml-1 flex-none nowrap">' + delayWarning.replace('%s', task.delay) + '</span>', className:'flex items-end', style:{flexDirection:"column"}};
  14. }
  15. }
  16. if(info.col.name == 'deadline' && result[0])
  17. {
  18. if(['done', 'cancel', 'close'].includes(task.status)) return result;
  19. const today = zui.formatDate(zui.createDate(), 'yyyy-MM-dd');
  20. const yesterday = zui.formatDate(convertStringToDate(today) - 24 * 60 * 60 * 1000, 'yyyy-MM-dd');
  21. if(result[0] == today)
  22. {
  23. result[0] = {html: '<span class="label warning-pale rounded-full size-sm">' + todayLabel + '</span>'};
  24. }
  25. else if(result[0] == yesterday)
  26. {
  27. result[0] = {html: '<span class="label danger-pale rounded-full size-sm">' + yesterdayLabel + '</span>'};
  28. }
  29. else if(result[0] < yesterday)
  30. {
  31. result[0] = {html: '<span class="label danger-pale rounded-full size-sm">' + result[0] + '</span>'};
  32. }
  33. }
  34. return result;
  35. }
  36. function convertStringToDate(dateString)
  37. {
  38. dateString = dateString.split('-');
  39. dateString = dateString[1] + '/' + dateString[2] + '/' + dateString[0];
  40. return Date.parse(dateString);
  41. }