team.ui.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * Delete memeber of execution team.
  3. *
  4. * @param int $projectID
  5. * @param string $account
  6. * @param int $userID
  7. * @access public
  8. * @return void
  9. */
  10. window.deleteMember = function(researchID, userID)
  11. {
  12. zui.Modal.confirm({message: confirmUnlinkMember, icon:'icon-exclamation-sign', iconClass: 'warning-pale rounded-full icon-2x'}).then((res) =>
  13. {
  14. if(res)
  15. {
  16. $.ajaxSubmit({url: $.createLink('marketresearch', 'unlinkMember', 'researchID=' + researchID + '&userID=' + userID)});
  17. }
  18. })
  19. }
  20. /**
  21. * Set team summary for table footer.
  22. *
  23. * @access public
  24. * @return object
  25. */
  26. window.setStatistics = function()
  27. {
  28. const rows = this.layout.allRows;
  29. let totalHours = 0;
  30. rows.forEach(function(row)
  31. {
  32. totalHours += parseFloat(row.data.totalHours);
  33. });
  34. return {html: pageSummary.replace('%totalHours%', totalHours)};
  35. }
  36. window.renderCell = function(result, {col, row})
  37. {
  38. if(col.name == 'realname' && !deptUsers[row.data.userID])
  39. {
  40. result[0] = {html: "<a href='javascript:checkUserDept();'>" + row.data.realname + '</a>'};
  41. return result;
  42. }
  43. return result;
  44. }
  45. window.checkUserDept = function()
  46. {
  47. zui.Modal.alert(noAccess);
  48. }