taskeffort.html.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <?php
  2. /**
  3. * The taskeffort view file of execution module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2026 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
  6. * @license ZPL (http://zpl.pub/page/zplv12.html)
  7. * @author Hao Sun <sunhao@chandao.com>
  8. * @package execution
  9. * @version $Id: editrelation.html.php 935 2024-08-08 15:14:24Z $
  10. * @link https://www.zentao.net
  11. */
  12. namespace zin;
  13. $taskList = array();
  14. $groupIndex = 0;
  15. $rowIndex = 0;
  16. $canCreateTask = hasPriv('task', 'create', (object)['execution' => $executionID]);
  17. $createLink = createLink('task', 'create', "execution=$executionID" . (isset($moduleID) ? "&storyID=&moduleID=$moduleID" : ''));
  18. featureBar
  19. (
  20. hasPriv('execution', 'computeTaskEffort') ? btn(
  21. setClass('mr-2'),
  22. set::type('primary'),
  23. set::icon('refresh'),
  24. set::url('#computeModal'),
  25. toggle::modal(),
  26. $lang->execution->computeTaskEffort
  27. ) : null,
  28. btn(
  29. set::type('ghost'),
  30. set::url('execution', 'taskeffort', "executionID=$executionID&group=$groupBy&type=" . ($type == 'noweekend' ? 'withweekend' : 'noweekend')),
  31. set::hint($type == 'noweekend' ? $lang->execution->withweekend : $lang->execution->noweekend),
  32. div(setClass('checkbox-primary', $type == 'noweekend' ? '' : 'checked'), h::label($lang->execution->withweekend))
  33. )
  34. );
  35. $toolbarItems = [];
  36. if($canCreateTask) $toolbarItems[] = ['type' => 'primary', 'text' => $lang->task->create, 'icon' => 'plus', 'url' => $createLink];
  37. toolbar(set::items($toolbarItems));
  38. $mainContent = null;
  39. $hasTable = false;
  40. if(empty($tasks))
  41. {
  42. $mainContent = div
  43. (
  44. setClass('dtable-empty-tip'),
  45. span(setClass('text-gray'), $lang->task->noTask),
  46. $canCreateTask ? btn(
  47. setClass('ml-2'),
  48. set::type('primary-pale'),
  49. set::icon('plus'),
  50. set::url($createLink),
  51. $lang->task->create
  52. ) : null
  53. );
  54. }
  55. else
  56. {
  57. $executionBegin = helper::isZeroDate($execution->realBegan) ? $execution->begin : $execution->realBegan;
  58. if((time() - strtotime($executionBegin)) < 0)
  59. {
  60. $mainContent = div(setClass('dtable-empty-tip'), span(setClass('text-gray'), $lang->task->noStart));
  61. }
  62. else
  63. {
  64. $hasTable = true;
  65. }
  66. }
  67. div
  68. (
  69. setClass('shadow rounded ring canvas'),
  70. $mainContent,
  71. rawContent()
  72. );
  73. ?>
  74. <?php if($hasTable):?>
  75. <div id='tasksTable' class='load-indicator loading'>
  76. <div id='tableContainer' zui-init="initTaskEffortTable()">
  77. <div id='tableHeader'>
  78. <div id='headerColGroup'>
  79. <div id='groupMenu' class="dropdown">
  80. <button type="button" class="btn primary-pale w-full justify-between" data-toggle="dropdown">
  81. <span class="text"><?php echo zget($lang->execution->groups, $groupBy, null);?></span>
  82. <span class="caret"></span>
  83. </button>
  84. <ul class="dropdown-menu menu">
  85. <?php foreach($lang->execution->groups as $key => $value):?>
  86. <?php if(empty($key)) continue;?>
  87. <?php if($execution->type == 'ops' && $key == 'story') continue;?>
  88. <li class="menu-item item font-normal"><a <?php echo $key == $groupBy ? ' class="selected"' : ''; ?> href="<?php echo createLink('execution', 'taskeffort', "executionID=$executionID&groupBy=$key");?>"><?php echo $value;?></a></li>
  89. <?php endforeach;?>
  90. </ul>
  91. </div>
  92. </div>
  93. <div id='headerColName'><?php echo $lang->task->common;?></div>
  94. <div id='headerTimeline'>
  95. <div id='timeline'>
  96. <div id='timeList'></div>
  97. </div>
  98. </div>
  99. </div>
  100. <div id='tableBody'>
  101. <div id='groups'>
  102. <?php $isGroupByAssignTo = $groupBy == 'assignedTo';?>
  103. <?php foreach($tasks as $groupKey => $groupTasks):?>
  104. <?php
  105. $groupName = $groupKey;
  106. if($groupBy == 'story') $groupName = empty($groupName) ? $this->lang->task->noStory : zget($groupByList, $groupKey);
  107. if($isGroupByAssignTo and $groupName == '') $groupName = $this->lang->task->noAssigned;
  108. ?>
  109. <div class='row-group' data-id='<?php echo $groupIndex; ?>' id='group-<?php echo $groupIndex; ?>'>
  110. <?php $index = 0;?>
  111. <?php foreach($groupTasks as $task):?>
  112. <?php $taskList[] = isset($task->burn) ? $task->burn : 0; ?>
  113. <?php if($index == 0): ?>
  114. <div class='cell-group group-name'>
  115. <span class='<?php echo ($isGroupByAssignTo and $groupName == $app->user->account) ? 'text-red' : 'text-primary'; ?>'><?php echo $groupName; ?></an>
  116. <?php if($isGroupByAssignTo and isset($members[$task->assignedTo])): ?>
  117. <div class='small'><?php printf($lang->execution->memberHoursAB, $users[$task->assignedTo], $members[$task->assignedTo]->totalHours); ?></div>
  118. <?php endif; ?>
  119. </div>
  120. <div class='cell-group group-tasks'>
  121. <?php endif; ?>
  122. <div class='group-task' id='task-<?php echo $rowIndex; ?>' data-row='<?php echo $rowIndex; ?>' data-group='<?php echo $groupIndex; ?>' ta-index='<?php echo $index; ?>'>
  123. <?php
  124. if(isset($task->multiple)) echo '<span class="label label-light label-badge">' . $lang->task->multipleAB . '</span> ';
  125. if($task->parent > 0 && $task->isParent == '0') echo '<span class="label label-light label-badge">' . $lang->task->childrenAB . '</span> ';
  126. if($task->isParent) echo '<span class="label">' . $lang->task->parentAB . '</span> ';
  127. if(!common::printLink('task', 'view', "task=$task->id", $task->name, '', 'class="text-primary"')) echo $task->name;
  128. ?>
  129. </div>
  130. <?php $index++;?>
  131. <?php $rowIndex++;?>
  132. <?php endforeach;?>
  133. </div>
  134. </div>
  135. <?php $groupIndex++;?>
  136. <?php endforeach;?>
  137. </div>
  138. <div id='cellsContainer'>
  139. <div id='cells'></div>
  140. </div>
  141. </div>
  142. <div id='tableFooter'>
  143. <div id='footerTotal'><?php echo $lang->team->totalHours?></div>
  144. <div id='scrollbarContainer'>
  145. <div id='scrollbar'></div>
  146. </div>
  147. <div id='totalCells'>
  148. <div id='totalDays'></div>
  149. </div>
  150. </div>
  151. </div>
  152. </div>
  153. <?php
  154. jsVar('counts', $counts);
  155. jsVar('rowsCount', $rowIndex);
  156. jsVar('groupsCount', $groupIndex);
  157. jsVar('days', $dateList);
  158. jsVar('taskList', $taskList);
  159. jsVar('today', helper::today());
  160. jsVar('endMoreThanToday', $lang->execution->endMoreThanToday);
  161. jsVar('beginMoreThanEnd', $lang->execution->beginMoreThanEnd);
  162. jsVar('leftText', $lang->task->leftAB);
  163. jsVar('consumedText', $lang->task->consumedAB);
  164. ?>
  165. <?php endif;?>
  166. <div class="modal fade" id="computeModal">
  167. <div class="modal-dialog size-sm">
  168. <div class="modal-content">
  169. <div class="modal-header">
  170. <h4 class="modal-title"><?php echo $lang->execution->computeTaskEffort;?></h4>
  171. </div>
  172. <div class="modal-body">
  173. <form class="form form-horz">
  174. <div class="form-group">
  175. <label id='dateRange' class="form-label"><?php echo $lang->execution->beginAndEnd;?></label>
  176. <div class='input-group'>
  177. <?php echo html::input('begin', date('Y-m-d', strtotime('-30 days')), "class='form-control form-date'");?>
  178. <span class='input-group-addon'><?php echo $lang->execution->to;?></span>
  179. <?php echo html::input('end', date('Y-m-d'), "class='form-control form-date'");?>
  180. </div>
  181. </div>
  182. <div class="form-actions">
  183. <?php echo html::commonButton($lang->save, "id='saveButton' zui-on-click='computeTaskEffort()'", 'btn primary btn-wide');?>
  184. <?php echo html::commonButton($lang->cancel, "data-dismiss='modal'", 'btn btn-wide');?>
  185. </div>
  186. </form>
  187. </div>
  188. </div>
  189. </div>
  190. </div>