Added search and string value fields options.. ( #861mmjq77 )
This commit is contained in:
parent
b291d05a6c
commit
0863da593b
@ -75,6 +75,7 @@ class SearchString extends Component
|
|||||||
'type' => $this->getFilterType($options),
|
'type' => $this->getFilterType($options),
|
||||||
'url' => $this->getFilterUrl($column, $options),
|
'url' => $this->getFilterUrl($column, $options),
|
||||||
'values' => $this->getFilterValues($column, $options),
|
'values' => $this->getFilterValues($column, $options),
|
||||||
|
'value_option_fields' => $options['fields'] ?? [],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -372,7 +372,11 @@ return [
|
|||||||
'contact_phone' => ['searchable' => true],
|
'contact_phone' => ['searchable' => true],
|
||||||
'contact_address' => ['searchable' => true],
|
'contact_address' => ['searchable' => true],
|
||||||
'category_id' => [
|
'category_id' => [
|
||||||
'route' => ['categories.index', 'search=type:income enabled:1']
|
'route' => ['categories.index', 'search=type:income enabled:1'],
|
||||||
|
'fields' => [
|
||||||
|
'key' => 'id',
|
||||||
|
'value' => 'name',
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'parent_id',
|
'parent_id',
|
||||||
'recurring' => [
|
'recurring' => [
|
||||||
|
@ -433,10 +433,12 @@ export default {
|
|||||||
|
|
||||||
let option = false;
|
let option = false;
|
||||||
let option_url = false;
|
let option_url = false;
|
||||||
|
let option_fields = {};
|
||||||
|
|
||||||
for (let i = 0; i < this.filter_list.length; i++) {
|
for (let i = 0; i < this.filter_list.length; i++) {
|
||||||
if (this.filter_list[i].key == value) {
|
if (this.filter_list[i].key == value) {
|
||||||
option = this.filter_list[i].value;
|
option = this.filter_list[i].value;
|
||||||
|
option_fields = (this.filter_list[i]['value_option_fields']) ? this.filter_list[i].value_option_fields : {};
|
||||||
|
|
||||||
if (this.filter_list[i].values !== 'undefined' && Object.keys(this.filter_list[i].values).length) {
|
if (this.filter_list[i].values !== 'undefined' && Object.keys(this.filter_list[i].values).length) {
|
||||||
this.option_values[value] = this.convertOption(this.filter_list[i].values);
|
this.option_values[value] = this.convertOption(this.filter_list[i].values);
|
||||||
@ -485,7 +487,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.option_values[value] && option_url) {
|
if (! this.option_values[value] && option_url) {
|
||||||
if (option_url.indexOf('limit') === -1) {
|
if (option_url.indexOf('limit') === -1) {
|
||||||
option_url += ' limit:10';
|
option_url += ' limit:10';
|
||||||
}
|
}
|
||||||
@ -497,11 +499,19 @@ export default {
|
|||||||
this.values = [];
|
this.values = [];
|
||||||
|
|
||||||
data.forEach(function (item) {
|
data.forEach(function (item) {
|
||||||
this.values.push({
|
if (Object.keys(option_fields).length) {
|
||||||
key: (item.code) ? item.code : item.id,
|
this.values.push({
|
||||||
value: (item.title) ? item.title : (item.display_name) ? item.display_name : item.name,
|
key: (option_fields['key']) ? item[option_fields['key']] : (item.code) ? item.code : item.id,
|
||||||
level: (item.level) ? item.level : null,
|
value: (option_fields['value']) ? item[option_fields['value']] : (item.title) ? item.title : (item.display_name) ? item.display_name : item.name,
|
||||||
});
|
level: (option_fields['level']) ? item[option_fields['level']] : (item.level) ? item.level : null,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.values.push({
|
||||||
|
key: (item.code) ? item.code : item.id,
|
||||||
|
value: (item.title) ? item.title : (item.display_name) ? item.display_name : item.name,
|
||||||
|
level: (item.level) ? item.level : null,
|
||||||
|
});
|
||||||
|
}
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.option_values[value] = this.values;
|
this.option_values[value] = this.values;
|
||||||
@ -657,7 +667,7 @@ export default {
|
|||||||
let values = [];
|
let values = [];
|
||||||
|
|
||||||
// Option set sort_option data
|
// Option set sort_option data
|
||||||
if (!Array.isArray(options)) {
|
if (! Array.isArray(options)) {
|
||||||
for (const [key, value] of Object.entries(options)) {
|
for (const [key, value] of Object.entries(options)) {
|
||||||
values.push({
|
values.push({
|
||||||
key: (key).toString(),
|
key: (key).toString(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user