otherproblem.html.php 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <form target="hiddenwin" id='otherproblems' name='otherproblems' method="post" action="<?php echo $this->createLink('milestone','saveOtherProblem');?>">
  2. <table class="table table-bordered" id="otherproblems">
  3. <thead>
  4. <tr>
  5. <th colspan='5'><?php echo $lang->milestone->otherproblem;?></th>
  6. </tr>
  7. </thead>
  8. <tbody>
  9. <tr>
  10. <td rowspan='<?php echo 2 + count($otherproblems);?>' id='problemTd'><?php echo $lang->milestone->problemandsuggest;?></td>
  11. <td><?php echo $lang->milestone->prodescr;?></td>
  12. <td><?php echo $lang->milestone->needhelp;?></td>
  13. <td><?php echo $lang->milestone->suggest;?></td>
  14. <td><?php echo $lang->milestone->options;?></td>
  15. </tr>
  16. <?php if(empty($otherproblems)): ?>
  17. <tr>
  18. <td><input type="text" value="" name="contents[]" class="form-control"/></td>
  19. <td><input type="text" value="" name="support[]" class="form-control"/></td>
  20. <td><input type="text" value="" name="measures[]" class="form-control"/></td>
  21. <td>
  22. <button type="button" class="btn btn-link btn-icon btn-add" onclick="addItems($(this))">
  23. <i class="icon icon-plus"></i></button>
  24. <button type="button" class="btn btn-link btn-icon btn-delete" onclick="deleteItems($(this))">
  25. <i class="icon icon-close"></i></button>
  26. <?php echo html::submitButton('', '', 'btn btn-wide btn-primary');?>
  27. </td>
  28. </tr>
  29. <?php endif;?>
  30. <?php foreach($otherproblems as $value):?>
  31. <tr>
  32. <td><input type="text" value="<?php echo $value->contents;?>" name="contents[]" class="form-control"/></td>
  33. <td><input type="text" value="<?php echo $value->support;?>" name="support[]" class="form-control"/></td>
  34. <td><input type="text" value="<?php echo $value->measures;?>" name="measures[]" class="form-control"/></td>
  35. <td>
  36. <button type="button" class="btn btn-link btn-icon btn-add" onclick="addItems($(this))">
  37. <i class="icon icon-plus"></i></button>
  38. <button type="button" class="btn btn-link btn-icon btn-delete" onclick="deleteItems($(this))">
  39. <i class="icon icon-close"></i></button>
  40. <?php echo html::submitButton('', '', 'btn btn-wide btn-primary');?>
  41. </td>
  42. </tr>
  43. <?php endforeach;?>
  44. </tbody>
  45. </table>
  46. <?php echo html::hidden('projectID', $projectID);?>
  47. <?php echo html::hidden('executionID', $executionID);?>
  48. </form>
  49. <?php js::set('save', $lang->milestone->save);?>
  50. <script>
  51. function addItems(obj)
  52. {
  53. var items = '<tr>\
  54. <td><input type="text" value="" name="contents[]" class="form-control"/></td>\
  55. <td><input type="text" value="" name="support[]" class="form-control"/></td>\
  56. <td><input type="text" value="" name="measures[]" class="form-control"/></td>\
  57. <td>\
  58. <button type="button" class="btn btn-link btn-icon btn-add" onclick="addItems($(this))">\
  59. <i class="icon icon-plus"></i></button>\
  60. <button type="button" class="btn btn-link btn-icon btn-delete" onclick="deleteItems($(this))">\
  61. <i class="icon icon-close"></i></button>\
  62. <button type="submit" id="submit" class="btn btn-wide btn-primary">' + save +'</button>\
  63. </td></tr>';
  64. obj.parent('td').parent('tr').after(items);
  65. $('#problemTd').attr('rowspan', $('#problemTd').attr('rowspan') + 1)
  66. }
  67. function deleteItems(obj)
  68. {
  69. var len = $('#otherproblems tbody tr').length;
  70. if(len > 2) obj.parent('td').parent('tr').remove();
  71. }
  72. </script>