+ zin: add resultFilter widget which can be used in pivot.

This commit is contained in:
liugang
2023-11-01 11:22:14 +08:00
parent 7bda2d0042
commit 4e31cdaa5b
+53
View File
@@ -0,0 +1,53 @@
<?php
declare(strict_types=1);
/**
* The filter widget class file of zin module of ZenTaoPMS.
*
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Gang Liu <liugang@easycorp.ltd>
* @package zin
* @link http://www.zentao.net
*/
namespace zin;
requireWg('filter');
class resultFilter extends filter
{
protected function buildDate(string $type): array
{
global $lang;
list($name, $value) = $this->prop(array('name', 'value'));
return array(
input
(
set::name($name),
set::type($type == 'datetime' ? 'datetime-local' : $type),
set::value(zget($value, 'begin', ''))
),
$lang->to,
input
(
set::name($name),
set::type($type == 'datetime' ? 'datetime-local' : $type),
set::value(zget($value, 'end', ''))
),
);
}
protected function build(): wg|array
{
$type = $this->prop('type');
if($type == 'date' || $type == 'datetime') return inputGroup
(
setClass('pr-4 mb-2 ' . $this->prop('class', $type == 'datetime' ? 'w-1/3' : 'w-1/4')),
$this->prop('title'),
$this->buildDate($type)
);
return parent::build();
}
}