selectproject.html.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php echo html::hidden('feedbackID', '');?>
  2. <div class="modal fade" id="toTask">
  3. <div class="modal-dialog mw-500px">
  4. <div class="modal-content">
  5. <div class="modal-header">
  6. <h4 class="modal-title"><?php echo $lang->feedback->selectProjects;?></h4>
  7. </div>
  8. <div class="modal-body">
  9. <table class='table table-form'>
  10. <tr>
  11. <th><?php echo $lang->feedback->project;?></th>
  12. <td class='required'><?php echo html::select('taskProjects', $projects, '', "class='form-control chosen'");?></td>
  13. </tr>
  14. <tr>
  15. <th id='executionHead'><?php echo $lang->feedback->execution;?></th>
  16. <td class='required'><?php echo html::select('executions', '', '', "class='form-control chosen'");?></td>
  17. </tr>
  18. <tr>
  19. <td colspan='2' class='text-center'>
  20. <?php echo html::commonButton($lang->feedback->nextStep, "id='taskProjectButton'", 'btn btn-primary btn-wide');?>
  21. <?php echo html::commonButton($lang->cancel, "data-dismiss='modal'", 'btn btn-default btn-wide');?>
  22. </td>
  23. </tr>
  24. </table>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. <script>
  30. function getFeedbackID(obj)
  31. {
  32. var feedbackID = $(obj).attr("data-id");
  33. $('#feedbackID').val(feedbackID);
  34. $('#taskProjects').change();
  35. getProjects(obj);
  36. getExecutions(0);
  37. }
  38. function getProjects(obj)
  39. {
  40. var productID = $(obj).attr("data-product");
  41. var link = createLink('feedback', 'ajaxGetProjects', 'productID=' + productID + '&field=taskProjects&onchange=&getHTML=1');
  42. $.post(link, function(data)
  43. {
  44. $('#taskProjects').replaceWith(data);
  45. $('#taskProjects_chosen').remove();
  46. $('#taskProjects').chosen();
  47. })
  48. }
  49. function getExecutions(projectID)
  50. {
  51. if(projectID)
  52. {
  53. var langLink = createLink('feedback', 'ajaxGetExecutionLang', 'projectID=' + projectID);
  54. $.post(langLink, function(executionLang)
  55. {
  56. $('#executionHead').html(executionLang);
  57. })
  58. }
  59. var link = createLink('feedback', 'ajaxGetExecutions', 'projectID=' + projectID + '&getHTML=1');
  60. $.post(link, function(data)
  61. {
  62. $('#executions').replaceWith(data);
  63. $('#executions_chosen').remove();
  64. $('#executions').chosen();
  65. })
  66. }
  67. $('#taskProjectButton').on('click', function()
  68. {
  69. var projectID = $('#taskProjects').val();
  70. var executionID = $('#executions').val();
  71. var feedbackID = $('#feedbackID').val();
  72. var executionID = executionID ? parseInt(executionID) : 0;
  73. if(projectID && executionID)
  74. {
  75. location.href = createLink('task', 'create', 'executionID=' + executionID + '&storyID=0&moduleID=' + moduleID + '&taskID=0&todoID=0&extra=projectID=' + projectID + ',feedbackID=' + feedbackID) + '#app=feedback';
  76. }
  77. else if(!projectID)
  78. {
  79. alert('<?php echo $lang->feedback->noProject;?>');
  80. }
  81. else
  82. {
  83. alert('<?php echo $lang->feedback->noExecution;?>');
  84. }
  85. });
  86. </script>