Search string add key for label

This commit is contained in:
Cüneyt Şentürk 2021-01-12 01:45:15 +03:00
parent afbced2e0c
commit 34b59de01c
2 changed files with 14 additions and 4 deletions

View File

@ -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) {

View File

@ -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' => [