common.ui.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. $(function()
  2. {
  3. if(vision == 'or' && typeof browseType !== 'undefined')
  4. {
  5. $('#header #navbar .nav li a').removeClass('active');
  6. $('#header #navbar .nav li a[data-id="' + (browseType == 'bysearch' ? 'all' : browseType) + '"]').addClass('active');
  7. }
  8. })
  9. window.toggleBudgetUnit = function(unit)
  10. {
  11. $('[data-name="budget"] > .has-prefix > .input-control-prefix > a').text(currencySymbol[unit]);
  12. $('[name="budgetUnit"]').val(unit);
  13. }
  14. window.renderReviewerItem = function(result, info)
  15. {
  16. if(info.col.name == 'approval_node') result.push({html: "<input type='hidden' name='approval_id[]' value='" + info.row.data.approval_id + "' />"});
  17. if(info.col.name == 'approval_reviewer')
  18. {
  19. if(info.row.data.types.indexOf('reviewer') !== -1)
  20. {
  21. if(info.row.data.reviewers) result.push({html: '<div class="otherReview">' + info.row.data.reviewers + '</div>'}, {className: 'order-last'});
  22. }
  23. else
  24. {
  25. if(info.row.data.reviewers) result.push({html: info.row.data.reviewers})
  26. }
  27. }
  28. if(info.col.name == 'approval_ccer')
  29. {
  30. if(info.row.data.types.indexOf('ccer') !== -1)
  31. {
  32. if(info.row.data.ccers) result.push({html:'<div class="otherCcer">' + info.row.data.ccers + '</div>'}, {className: 'order-last'});
  33. }
  34. else
  35. {
  36. if(info.row.data.ccers) result.push({html: info.row.data.ccers});
  37. }
  38. }
  39. info.row.id = info.row.data.approval_id;
  40. return result;
  41. }
  42. window.getReviewerCellProps = function(cell)
  43. {
  44. const hasReviewer = cell.row.data.types.indexOf('reviewer') !== -1;
  45. return {items: cell.row.data.reviewerItems, multiple: true, className: 'mx-2' + (hasReviewer ? '' : ' hidden'), name: `approval_reviewer[${cell.row.index}]`};
  46. }
  47. window.getCcerCellProps = function(cell)
  48. {
  49. const hasCcer = cell.row.data.types.indexOf('ccer') !== -1;
  50. return {items: cell.row.data.ccerItems, multiple: true, className: 'mx-2' + (hasCcer ? '' : ' hidden'), name: `approval_ccer[${cell.row.index}]`};
  51. }