diff --git a/src/BaseFeatures/Data/Types/Bases/BaseType.php b/src/BaseFeatures/Data/Types/Bases/BaseType.php index 1508775..88fdc54 100755 --- a/src/BaseFeatures/Data/Types/Bases/BaseType.php +++ b/src/BaseFeatures/Data/Types/Bases/BaseType.php @@ -22,6 +22,8 @@ abstract class BaseType protected ?string $formatter = null; + protected string $filterView = 'report-engine::partials.base-filter'; + /** * @param mixed $value * @param object|null $result @@ -99,6 +101,26 @@ public function setDefaultValue($default_value) : self return $this; } + /** + * @return string + */ + public function getFilterView() : string + { + return $this->filterView; + } + + /** + * @param string $filterView + * + * @return $this + */ + public function setFilterView(string $filterView) : self + { + $this->filterView = $filterView; + + return $this; + } + public function getDefaultComparisonOperators() : array { return $this->default_comparison_operators; @@ -162,7 +184,7 @@ public function placeholder() : string */ public function renderFilter(string $label, string $name, array $action_types, self $columnType, Collection $value) { - return view('report-engine::partials.base-filter') + return view($this->filterView) ->with( $this->getConfig($label, $name, $action_types, $columnType, $value) ); diff --git a/src/BaseFeatures/Data/Types/DateTime.php b/src/BaseFeatures/Data/Types/DateTime.php index 1ebb5fa..c5c5977 100755 --- a/src/BaseFeatures/Data/Types/DateTime.php +++ b/src/BaseFeatures/Data/Types/DateTime.php @@ -25,6 +25,8 @@ class DateTime extends BaseType protected ?string $formatter = 'datetime'; + protected string $filterView = 'report-engine::partials.date-filter'; + public function __construct( string|null $outputFormat = null, string|null $placeholder = null, @@ -139,7 +141,7 @@ public function renderFilter(string $label, string $name, array $action_types, B return Carbon::parse($value)->isoFormat($this->outputFormat); }); - return view('report-engine::partials.date-filter')->with([ + return view($this->filterView)->with([ 'label' => $label, 'field' => $name, 'value' => $value, diff --git a/src/BaseFeatures/Data/Types/Enum.php b/src/BaseFeatures/Data/Types/Enum.php index 6c65b8e..35ed7b1 100755 --- a/src/BaseFeatures/Data/Types/Enum.php +++ b/src/BaseFeatures/Data/Types/Enum.php @@ -12,6 +12,7 @@ class Enum extends BaseType protected $prepend_all = true; protected $default_value; protected $use_keys = false; + protected string $filterView = 'report-engine::partials.enum-filter'; /** * Enum constructor. @@ -117,7 +118,7 @@ public function getOptions(): array */ public function renderFilter(string $label, string $name, array $action_types, BaseType $columnType, Collection $value) { - return view('report-engine::partials.enum-filter')->with([ + return view($this->filterView)->with([ 'label' => $label, 'field' => $name, 'options' => $this->options, diff --git a/src/BaseFeatures/Data/Types/NullableDateTime.php b/src/BaseFeatures/Data/Types/NullableDateTime.php index f8c2568..f41bbb1 100755 --- a/src/BaseFeatures/Data/Types/NullableDateTime.php +++ b/src/BaseFeatures/Data/Types/NullableDateTime.php @@ -9,6 +9,8 @@ class NullableDateTime extends DateTime { + protected string $filterView = 'report-engine::partials.empty-not-empty-filter'; + public function __construct(?string $date_time_format = null, ?string $placeholder = null, ?string $output_tz_name = null) { parent::__construct($date_time_format, $placeholder, $output_tz_name); @@ -27,7 +29,7 @@ public function __construct(?string $date_time_format = null, ?string $placehold */ public function renderFilter(string $label, string $name, array $action_types, BaseType $columnType, Collection $value) { - return view('report-engine::partials.empty-not-empty-filter')->with([ + return view($this->filterView)->with([ 'label' => $label, 'field' => $name, 'options' => collect($this->getOptions()), diff --git a/src/BaseFeatures/Data/Types/YesNo.php b/src/BaseFeatures/Data/Types/YesNo.php index 9d2fdb5..6137302 100755 --- a/src/BaseFeatures/Data/Types/YesNo.php +++ b/src/BaseFeatures/Data/Types/YesNo.php @@ -9,6 +9,8 @@ class YesNo extends BaseType { + protected string $filterView = 'report-engine::partials.yes-no-filter'; + /** * @param mixed $value * @param object|null $result @@ -44,7 +46,7 @@ public static function availableFilters(): array */ public function renderFilter(string $label, string $name, array $action_types, BaseType $columnType, Collection $value) { - return view('report-engine::partials.yes-no-filter')->with([ + return view($this->filterView)->with([ 'label' => $label, 'field' => $name, 'options' => collect($this->getOptions()),