diff --git a/app/View/Components/SearchString.php b/app/View/Components/SearchString.php index 839abf7f5..5c6a70fa1 100644 --- a/app/View/Components/SearchString.php +++ b/app/View/Components/SearchString.php @@ -52,7 +52,7 @@ class SearchString extends Component $this->filters[] = [ 'key' => $this->getFilterKey($column, $options), - 'value' => $this->getFilterName($column), + 'value' => $this->getFilterName($column, $options), 'type' => $this->getFilterType($options), 'url' => $this->getFilterUrl($column, $options), 'values' => $this->getFilterValues($column, $options), @@ -83,7 +83,7 @@ class SearchString extends Component return $column; } - protected function getFilterName($column) + protected function getFilterName($column, $options) { if (strpos($column, '_id') !== false) { $column = str_replace('_id', '', $column); @@ -91,6 +91,10 @@ class SearchString extends Component $column = str_replace('_code', '', $column); } + if (!empty($options['key'])) { + $column = $options['key']; + } + $plural = Str::plural($column, 2); if (trans_choice('general.' . $plural, 1) !== 'general.' . $plural) { diff --git a/config/search-string.php b/config/search-string.php index eb445f5b3..5317dd6d3 100644 --- a/config/search-string.php +++ b/config/search-string.php @@ -188,7 +188,10 @@ return [ 'document_number' => ['searchable' => true], 'order_number' => ['searchable' => true], 'status', - 'issued_at' => ['date' => true], + 'issued_at' => [ + 'key' => 'billed_at', + 'date' => true, + ], 'due_at' => ['date' => true], 'amount', 'currency_code' => [ @@ -231,7 +234,10 @@ return [ 'document_number' => ['searchable' => true], 'order_number' => ['searchable' => true], 'status', - 'issued_at' => ['date' => true], + 'issued_at' => [ + 'key' => 'invoiced_at', + 'date' => true, + ], 'due_at' => ['date' => true], 'amount', 'currency_code' => [