excel.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. $('#showData').on('change', '.picker-select', function(e)
  2. {
  3. var id = $(this).attr('id');
  4. var field = $(this).attr('data-field');
  5. var executionID = $(this).val();
  6. var num = Number(id.replace(/[^\d]/g, " "));
  7. if(field === 'execution')
  8. {
  9. if(typeof(num) == 'undefined') num = '';
  10. var productID = $(document.getElementById('product[' + num + ']')).val()
  11. var branch = $(document.getElementById('branch[' + num + ']')).val()
  12. if(typeof(branch) == 'undefined') branch = 0;
  13. if(typeof(oldStoryID) == 'undefined') oldStoryID = 0;
  14. var link = createLink('story', 'ajaxGetExecutionStories', 'executionID=' + executionID + '&productID=' + productID + '&branch=' + branch + '&moduleID=0&storyID=' + oldStoryID + '&number=' + num + '&type=full&status=all&from=bug');
  15. $.get(link, function(stories)
  16. {
  17. $('#story' + num).next('.picker').remove();
  18. $('#story' + num).replaceWith(stories);
  19. $('#story' + num).picker({chosenMode: true});
  20. $('#story' + num).attr('isInit', true);
  21. })
  22. }
  23. });
  24. var $modalButton = $("button[data-target='#importNoticeModal']");
  25. requiredFields = requiredFields.split(',');
  26. $modalButton.on('click', function()
  27. {
  28. var importData = $("#showData").closest('.main-form').serializeArray();
  29. var notice = '';
  30. var lineDatas = {};
  31. /* Set form data to line object.*/
  32. $.each(importData, function()
  33. {
  34. var oneData = this.name.split('[');
  35. if(oneData.length > 1)
  36. {
  37. var dataLine = oneData[1].replace('[]', '').replace(']', '');
  38. var dataName = oneData[0];
  39. dataLine--;
  40. if(!lineDatas[dataLine]) lineDatas[dataLine] = {};
  41. lineDatas[dataLine][dataName] = this.value;
  42. }
  43. });
  44. /* Check required fields. */
  45. $.each(lineDatas, function(line, lineData)
  46. {
  47. $.each(requiredFields, function(i, field)
  48. {
  49. if(field != 'project' && (!lineData[field] || lineData[field] === '0')) notice += noticeLang.replace('%s', line).replace('%s', bugLang[field]) + '\n';
  50. })
  51. })
  52. if(notice)
  53. {
  54. alert(notice);
  55. return false;
  56. }
  57. });