welcomeblock.html.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. /**
  3. * The welcome 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 LiuRuoGu <liuruogu@easycorp.ltd>
  7. * @package block
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. use zin\utils\style;
  12. $isEn = $app->getClientLang() == 'en';
  13. $getMeasureItem = function($data)
  14. {
  15. global $lang;
  16. $welcomeLabel = array_merge($lang->block->welcome->assignList, $lang->block->welcome->reviewList);
  17. $items = array();
  18. foreach($data as $key => $info)
  19. {
  20. if(empty($info['number'])) continue;
  21. if(count($items) >= 5) break;
  22. $items[] = cell
  23. (
  24. div
  25. (
  26. set('class', 'text-3xl h-10 num'),
  27. !empty($info['href']) ? a(setClass('text-primary'), set('href', $info['href']), $info['number']) : span($info['number'])
  28. ),
  29. div(zget($welcomeLabel, $key, ''))
  30. );
  31. }
  32. if(count($items) < 5)
  33. {
  34. foreach($data as $key => $info)
  35. {
  36. if(count($items) >= 5) break;
  37. if(empty($info['number']))
  38. {
  39. $items[] = cell
  40. (
  41. div
  42. (
  43. set('class', 'text-3xl h-10 num'),
  44. !empty($info['href']) ? a(setClass('text-primary'), set('href', $info['href']), $info['number']) : span($info['number'])
  45. ),
  46. div(zget($welcomeLabel, $key, ''))
  47. );
  48. }
  49. }
  50. }
  51. return $items;
  52. };
  53. blockPanel
  54. (
  55. set::title(false),
  56. set::headingClass('px-0 py-1 border-b-0'),
  57. set::bodyClass('p-0'),
  58. set::bodyProps(array('style' => array('background-image' => 'linear-gradient(90deg, var(--color-secondary-50) 0%, var(--color-canvas) 22%)'))),
  59. to::heading
  60. (
  61. row
  62. (
  63. setClass('flex-auto items-center p-2 gap-2'),
  64. cell
  65. (
  66. set::width('22%'),
  67. setClass('text-center font-bold text-md'),
  68. $todaySummary
  69. ),
  70. cell
  71. (
  72. setClass('text-sm'),
  73. html($welcomeSummary)
  74. )
  75. )
  76. ),
  77. row
  78. (
  79. setClass('h-full'),
  80. cell(setClass('center flex-none gap-2'), set::width('22%'), strong(sprintf($lang->block->welcomeList[$welcomeType], $app->user->realname)), userAvatar
  81. (
  82. set::className('welcome-avatar'),
  83. set('user', $this->app->user)
  84. ), $honorary ? label
  85. (
  86. setClass('rounded-full size-sm'),
  87. setStyle('background', 'linear-gradient(87.65deg, rgba(255, 186, 52, 0.8) -19.92%, rgba(253, 222, 164, 0.8) 112.97%)'),
  88. setStyle('border', '0.5px solid #FF9F46'),
  89. setStyle('color', '#7E5403'),
  90. $honorary
  91. ) : null),
  92. divider(setClass('h-10 self-center')),
  93. cell
  94. (
  95. setClass('col text-center py-4'),
  96. set::width($isEn ? '20%' : '16%'),
  97. div(span(setClass('font-bold text-md'), $lang->block->welcome->reviewByMe)),
  98. div(set::className('flex-auto center'), $getMeasureItem($reviewByMe))
  99. ),
  100. divider(setClass('h-10 self-center')),
  101. cell
  102. (
  103. setClass('col flex-auto py-4'),
  104. div(span(setClass('font-bold text-md ml-8'), $lang->block->welcome->assignToMe)),
  105. div(setClass('flex-auto flex justify-around text-center items-center'), $getMeasureItem($assignToMe))
  106. )
  107. ),
  108. h::css
  109. (
  110. '.block-welcome .tabs-nav > .nav-item > a {padding: 0 8px; border-radius: 4px; height: 28px}',
  111. '.block-welcome .tabs-nav > .nav-item > a:not(.active) {font-weight: normal; color: var(--color-gray-700)}',
  112. '.block-welcome .tabs-nav > .nav-item > a.active {font-weight: bold; color: var(--color-gray-900); background: var(--color-primary-50)}'
  113. )
  114. );