annualworkloadblock.html.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <?php
  2. /**
  3. * The annualworkload block view file of block module of ZenTaoPMS.
  4. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  5. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  6. * @author Yuting Wang <wangyuting@easycorp.ltd>
  7. * @package block
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. $spanWidth = (strlen((string)($maxStoryEstimate)) * 0.425 + 0.125) . 'rem';
  12. $doneStoryEstimateRows = array();
  13. foreach($doneStoryEstimate as $productID => $storyEstimate)
  14. {
  15. $doneStoryEstimateRows[] = cell
  16. (
  17. setClass('flex py-1.5 pr-4 text-sm'),
  18. cell
  19. (
  20. setClass('ellipsis overflow-hidden whitespace-nowrap mr-1 text-right'),
  21. set::width('50%'),
  22. span
  23. (
  24. set::title(zget($products, $productID)),
  25. zget($products, $productID)
  26. )
  27. ),
  28. cell
  29. (
  30. set::width('50%'),
  31. setClass('flex items-center'),
  32. div
  33. (
  34. width("calc(calc(100% - {$spanWidth}) * " . ($maxStoryEstimate ? $storyEstimate / $maxStoryEstimate : 0) . ')'),
  35. setClass('progress progress-bar h-2'),
  36. set('role', 'progressbar'),
  37. setStyle(array('background' => 'var(--color-primary-300)'))
  38. ),
  39. span
  40. (
  41. setClass('pl-0.5'),
  42. $storyEstimate
  43. )
  44. )
  45. );
  46. }
  47. $spanWidth = (strlen((string)($maxStoryCount)) * 0.425 + 0.125) . 'rem';
  48. $doneStoryCountRows = array();
  49. foreach($doneStoryCount as $productID => $storyCount)
  50. {
  51. $doneStoryCountRows[] = cell
  52. (
  53. setClass('flex py-1.5 pr-4 text-sm'),
  54. cell
  55. (
  56. setClass('ellipsis overflow-hidden whitespace-nowrap mr-1 text-right'),
  57. set::width('50%'),
  58. span(zget($products, $productID))
  59. ),
  60. cell
  61. (
  62. set::width('50%'),
  63. setClass('flex items-center'),
  64. div
  65. (
  66. width("calc(calc(100% - {$spanWidth}) * " . ($maxStoryCount ? $storyCount / $maxStoryCount : 0) . ')'),
  67. setClass('progress progress-bar h-2'),
  68. set('role', 'progressbar'),
  69. setStyle(array('background' => 'var(--color-primary-300)'))
  70. ),
  71. span
  72. (
  73. setClass('pl-0.5'),
  74. $storyCount
  75. )
  76. )
  77. );
  78. }
  79. $spanWidth = (strlen((string)($maxBugCount)) * 0.425 + 0.125) . 'rem';
  80. $resolvedBugCountRows = array();
  81. foreach($resolvedBugCount as $productID => $bugCount)
  82. {
  83. $resolvedBugCountRows[] = cell
  84. (
  85. setClass('flex py-1.5 pr-4 text-sm'),
  86. cell
  87. (
  88. setClass('ellipsis overflow-hidden whitespace-nowrap mr-1 text-right'),
  89. set::width('50%'),
  90. span(zget($products, $productID))
  91. ),
  92. cell
  93. (
  94. set::width('50%'),
  95. setClass('flex items-center'),
  96. div
  97. (
  98. width("calc(calc(100% - {$spanWidth}) * " . ($maxBugCount ? $bugCount / $maxBugCount : 0) . ')'),
  99. setClass('progress progress-bar h-2'),
  100. set('role', 'progressbar'),
  101. setStyle(array('background' => 'var(--color-primary-300)'))
  102. ),
  103. span
  104. (
  105. setClass('pl-0.5'),
  106. $bugCount
  107. )
  108. )
  109. );
  110. }
  111. blockPanel
  112. (
  113. to::titleSuffix
  114. (
  115. icon
  116. (
  117. setClass('text-light text-sm cursor-pointer'),
  118. toggle::tooltip
  119. (
  120. array
  121. (
  122. 'title' => sprintf($lang->block->tooltips['metricTime'], $metricTime),
  123. 'placement' => 'bottom',
  124. 'type' => 'white',
  125. 'className' => 'text-dark border border-light leading-5'
  126. )
  127. ),
  128. 'help'
  129. )
  130. ),
  131. div
  132. (
  133. setClass('flex h-full w-full' . ($longBlock ? ' flex-nowrap' : ' flex-wrap')),
  134. cell
  135. (
  136. setClass('flex flex-wrap overflow-hidden px-4 ' . ($longBlock ? 'py-2' : 'py-1 w-full mb-2')),
  137. set::width($longBlock ? '1/3' : '100%'),
  138. cell
  139. (
  140. setClass('w-full font-bold'),
  141. icon('card-archive mr-1 mb-2'),
  142. span($lang->block->annualworkload->doneStoryEstimate)
  143. ),
  144. cell
  145. (
  146. setClass('w-full overflow-y-auto' . ($longBlock ? ' h-64' : ' h-48')),
  147. $doneStoryEstimateRows
  148. )
  149. ),
  150. cell
  151. (
  152. setClass('flex flex-wrap overflow-hidden px-4 ' . ($longBlock ? 'py-2' : 'py-3 w-full my-2 border-t')),
  153. set::width($longBlock ? '1/3' : '100%'),
  154. cell
  155. (
  156. setClass('w-full font-bold'),
  157. icon('sub-review mr-1 mb-2'),
  158. span($lang->block->annualworkload->doneStoryCount)
  159. ),
  160. cell
  161. (
  162. setClass('w-full overflow-y-auto' . ($longBlock ? ' h-64' : ' h-48')),
  163. $doneStoryCountRows
  164. )
  165. ),
  166. cell
  167. (
  168. setClass('flex flex-wrap overflow-hidden px-4 ' . ($longBlock ? 'py-2' : 'py-3 w-full my-2 border-t')),
  169. set::width($longBlock ? '1/3' : '100%'),
  170. cell
  171. (
  172. setClass('w-full font-bold'),
  173. icon('bug mr-1 mb-2'),
  174. span($lang->block->annualworkload->resolvedBugCount)
  175. ),
  176. cell
  177. (
  178. setClass('w-full overflow-y-auto' . ($longBlock ? ' h-64' : ' h-48')),
  179. $resolvedBugCountRows
  180. )
  181. )
  182. )
  183. );
  184. render();