From ff843840241db9676272771616fb5087a85a4f33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Fri, 6 Nov 2020 01:48:49 +0300 Subject: [PATCH 1/6] Search and filter first commit --- app/Http/Controllers/Common/BulkActions.php | 4 +- app/View/Components/SearchString.php | 82 +++ config/search-string.php | 6 +- .../assets/js/components/AkauntingSearch.vue | 587 +++++++++++++----- resources/lang/en-GB/general.php | 2 +- .../views/auth/permissions/index.blade.php | 5 +- resources/views/auth/roles/index.blade.php | 5 +- resources/views/auth/users/index.blade.php | 5 +- .../views/banking/accounts/index.blade.php | 5 +- .../banking/reconciliations/index.blade.php | 5 +- .../banking/transactions/index.blade.php | 5 +- .../views/banking/transfers/index.blade.php | 5 +- .../views/common/companies/index.blade.php | 5 +- .../views/common/dashboards/index.blade.php | 5 +- resources/views/common/items/index.blade.php | 5 +- .../views/components/search-string.blade.php | 7 + .../views/purchases/bills/index.blade.php | 5 +- .../views/purchases/payments/index.blade.php | 5 +- .../views/purchases/vendors/index.blade.php | 5 +- .../views/sales/customers/index.blade.php | 5 +- .../views/sales/invoices/index.blade.php | 5 +- .../views/sales/revenues/index.blade.php | 5 +- .../views/settings/categories/index.blade.php | 5 +- .../views/settings/currencies/index.blade.php | 5 +- .../views/settings/taxes/index.blade.php | 5 +- 25 files changed, 552 insertions(+), 231 deletions(-) create mode 100644 app/View/Components/SearchString.php create mode 100644 resources/views/components/search-string.blade.php diff --git a/app/Http/Controllers/Common/BulkActions.php b/app/Http/Controllers/Common/BulkActions.php index e84694553..ef43531a8 100644 --- a/app/Http/Controllers/Common/BulkActions.php +++ b/app/Http/Controllers/Common/BulkActions.php @@ -6,9 +6,7 @@ use App\Abstracts\Http\Controller; use App\Http\Requests\Common\BulkAction as Request; use Illuminate\Support\Str; -class - -BulkActions extends Controller +class BulkActions extends Controller { /** diff --git a/app/View/Components/SearchString.php b/app/View/Components/SearchString.php new file mode 100644 index 000000000..d7969ad06 --- /dev/null +++ b/app/View/Components/SearchString.php @@ -0,0 +1,82 @@ +model = $model; + } + + /** + * Get the view / contents that represent the component. + * + * @return \Illuminate\Contracts\View\View|string + */ + public function render() + { + $searc_string = config('search-string'); + + $this->filters = false; + + if (!empty($searc_string[$this->model])) { + $columns = $searc_string[$this->model]['columns']; + + foreach ($columns as $column => $options) { + if (!empty($options['searchable'])) { + continue; + } + + if (!is_array($options)) { + $column = $options; + } + + $name = $this->getFilterName($column); + + $this->filters[] = [ + 'key' => $column, + 'value' => $name, + 'url' => !empty($options['route']) ? route($options['route'][0], $options['route'][1]) : '' + ]; + } + } + + return view('components.search-string'); + } + + protected function getFilterName($column) + { + if (strpos($column, '_id') !== false) { + $column = str_replace('_id', '', $column); + } + + $plural = Str::plural($column, 2); + + if (trans_choice('general.' . $plural, 1) !== 'general.' . $plural) { + return trans_choice('general.' . $plural, 1); + } elseif (trans_choice('search_string.colmuns.' . $plural, 1) !== 'search_string.colmuns.' . $plural) { + return trans_choice('search_string.colmuns.' . $plural, 1); + } + + $name = trans('general.' . $column); + + if ($name == 'general.' . $column) { + $name = trans('search_string.colmuns.' . $column); + } + + return $name; + } +} diff --git a/config/search-string.php b/config/search-string.php index 355e1a988..cf316c474 100644 --- a/config/search-string.php +++ b/config/search-string.php @@ -120,9 +120,9 @@ return [ 'name' => ['searchable' => true], 'description' => ['searchable' => true], 'enabled' => ['boolean' => true], - 'category_id' => ['key' => 'category_id'], - 'sale_price', - 'purchase_price', + 'category_id' => [ + 'route' => ['categories.index', 'search=type:item'] + ], ], ], diff --git a/resources/assets/js/components/AkauntingSearch.vue b/resources/assets/js/components/AkauntingSearch.vue index 639849c4a..238c34490 100644 --- a/resources/assets/js/components/AkauntingSearch.vue +++ b/resources/assets/js/components/AkauntingSearch.vue @@ -1,175 +1,466 @@ - - + + \ No newline at end of file diff --git a/resources/lang/en-GB/general.php b/resources/lang/en-GB/general.php index 7c3426789..86eb36c0e 100644 --- a/resources/lang/en-GB/general.php +++ b/resources/lang/en-GB/general.php @@ -105,7 +105,7 @@ return [ 'to' => 'To', 'print' => 'Print', 'search' => 'Search', - 'search_placeholder' => 'Type to search..', + 'search_placeholder' => 'Search or filter results..', 'filter' => 'Filter', 'help' => 'Help', 'all' => 'All', diff --git a/resources/views/auth/permissions/index.blade.php b/resources/views/auth/permissions/index.blade.php index 54d53b2e0..381594d41 100644 --- a/resources/views/auth/permissions/index.blade.php +++ b/resources/views/auth/permissions/index.blade.php @@ -18,10 +18,7 @@ 'class' => 'mb-0' ]) !!}
- +
{{ Form::bulkActionRowGroup('general.permissions', $bulk_actions, ['group' => 'auth', 'type' => 'permissions']) }} diff --git a/resources/views/auth/roles/index.blade.php b/resources/views/auth/roles/index.blade.php index a24fcabd3..992b7ff9e 100644 --- a/resources/views/auth/roles/index.blade.php +++ b/resources/views/auth/roles/index.blade.php @@ -18,10 +18,7 @@ 'class' => 'mb-0' ]) !!}
- +
{{ Form::bulkActionRowGroup('general.roles', $bulk_actions, ['group' => 'auth', 'type' => 'roles']) }} diff --git a/resources/views/auth/users/index.blade.php b/resources/views/auth/users/index.blade.php index 69e5cd50f..a5d283672 100644 --- a/resources/views/auth/users/index.blade.php +++ b/resources/views/auth/users/index.blade.php @@ -18,10 +18,7 @@ 'class' => 'mb-0' ]) !!}
- +
{{ Form::bulkActionRowGroup('general.users', $bulk_actions, ['group' => 'auth', 'type' => 'users']) }} diff --git a/resources/views/banking/accounts/index.blade.php b/resources/views/banking/accounts/index.blade.php index 888ff8cc7..24df6f215 100644 --- a/resources/views/banking/accounts/index.blade.php +++ b/resources/views/banking/accounts/index.blade.php @@ -18,10 +18,7 @@ 'class' => 'mb-0' ]) !!}
- +
{{ Form::bulkActionRowGroup('general.accounts', $bulk_actions, ['group' => 'banking', 'type' => 'accounts']) }} diff --git a/resources/views/banking/reconciliations/index.blade.php b/resources/views/banking/reconciliations/index.blade.php index 2c0a9b255..d5ceabef9 100644 --- a/resources/views/banking/reconciliations/index.blade.php +++ b/resources/views/banking/reconciliations/index.blade.php @@ -19,10 +19,7 @@ 'class' => 'mb-0' ]) !!}
- +
{{ Form::bulkActionRowGroup('general.reconciliations', $bulk_actions, ['group' => 'banking', 'type' => 'reconciliations']) }} diff --git a/resources/views/banking/transactions/index.blade.php b/resources/views/banking/transactions/index.blade.php index 58d9a3a95..6b16ba24a 100644 --- a/resources/views/banking/transactions/index.blade.php +++ b/resources/views/banking/transactions/index.blade.php @@ -22,10 +22,7 @@ 'role' => 'form', 'class' => 'mb-0' ]) !!} - + {!! Form::close() !!} diff --git a/resources/views/banking/transfers/index.blade.php b/resources/views/banking/transfers/index.blade.php index f2f3b08f0..3b13700ec 100644 --- a/resources/views/banking/transfers/index.blade.php +++ b/resources/views/banking/transfers/index.blade.php @@ -21,10 +21,7 @@ 'class' => 'mb-0' ]) !!}
- +
{{ Form::bulkActionRowGroup('general.transfers', $bulk_actions, ['group' => 'banking', 'type' => 'transfers']) }} diff --git a/resources/views/common/companies/index.blade.php b/resources/views/common/companies/index.blade.php index b4de518d9..40049bbe9 100644 --- a/resources/views/common/companies/index.blade.php +++ b/resources/views/common/companies/index.blade.php @@ -18,10 +18,7 @@ 'class' => 'mb-0' ]) !!}
- +
{{ Form::bulkActionRowGroup('general.companies', $bulk_actions, ['group' => 'common', 'type' => 'companies']) }} diff --git a/resources/views/common/dashboards/index.blade.php b/resources/views/common/dashboards/index.blade.php index 06cc6964a..a7536c528 100644 --- a/resources/views/common/dashboards/index.blade.php +++ b/resources/views/common/dashboards/index.blade.php @@ -18,10 +18,7 @@ 'class' => 'mb-0' ]) !!}
- +
{{ Form::bulkActionRowGroup('general.dashboards', $bulk_actions, ['group' => 'common', 'type' => 'dashboards']) }} diff --git a/resources/views/common/items/index.blade.php b/resources/views/common/items/index.blade.php index 6a7170a7f..9e6b48018 100644 --- a/resources/views/common/items/index.blade.php +++ b/resources/views/common/items/index.blade.php @@ -21,10 +21,7 @@ 'class' => 'mb-0' ]) !!}
- +
{{ Form::bulkActionRowGroup('general.items', $bulk_actions, ['group' => 'common', 'type' => 'items']) }} diff --git a/resources/views/components/search-string.blade.php b/resources/views/components/search-string.blade.php new file mode 100644 index 000000000..d655b6dc8 --- /dev/null +++ b/resources/views/components/search-string.blade.php @@ -0,0 +1,7 @@ + + diff --git a/resources/views/purchases/bills/index.blade.php b/resources/views/purchases/bills/index.blade.php index 97f715f75..540b72cc7 100644 --- a/resources/views/purchases/bills/index.blade.php +++ b/resources/views/purchases/bills/index.blade.php @@ -21,10 +21,7 @@ 'class' => 'mb-0' ]) !!}
- +
{{ Form::bulkActionRowGroup('general.bills', $bulk_actions, ['group' => 'purchases', 'type' => 'bills']) }} diff --git a/resources/views/purchases/payments/index.blade.php b/resources/views/purchases/payments/index.blade.php index 3c24e4cb6..7aa451d26 100644 --- a/resources/views/purchases/payments/index.blade.php +++ b/resources/views/purchases/payments/index.blade.php @@ -21,10 +21,7 @@ 'class' => 'mb-0' ]) !!}
- +
{{ Form::bulkActionRowGroup('general.payments', $bulk_actions, ['group' => 'purchases', 'type' => 'payments']) }} diff --git a/resources/views/purchases/vendors/index.blade.php b/resources/views/purchases/vendors/index.blade.php index 8d2f4501a..c1045e75b 100644 --- a/resources/views/purchases/vendors/index.blade.php +++ b/resources/views/purchases/vendors/index.blade.php @@ -21,10 +21,7 @@ 'class' => 'mb-0' ]) !!}
- +
{{ Form::bulkActionRowGroup('general.vendors', $bulk_actions, ['group' => 'purchases', 'type' => 'vendors']) }} diff --git a/resources/views/sales/customers/index.blade.php b/resources/views/sales/customers/index.blade.php index 0b067419d..824341b7a 100644 --- a/resources/views/sales/customers/index.blade.php +++ b/resources/views/sales/customers/index.blade.php @@ -21,10 +21,7 @@ 'class' => 'mb-0' ]) !!}
- +
{{ Form::bulkActionRowGroup('general.customers', $bulk_actions, ['group' => 'sales', 'type' => 'customers']) }} diff --git a/resources/views/sales/invoices/index.blade.php b/resources/views/sales/invoices/index.blade.php index ec9deea37..03649eb26 100644 --- a/resources/views/sales/invoices/index.blade.php +++ b/resources/views/sales/invoices/index.blade.php @@ -21,10 +21,7 @@ 'class' => 'mb-0' ]) !!}
- +
{{ Form::bulkActionRowGroup('general.invoices', $bulk_actions, ['group' => 'sales', 'type' => 'invoices']) }} diff --git a/resources/views/sales/revenues/index.blade.php b/resources/views/sales/revenues/index.blade.php index 75930749e..42f6cab05 100644 --- a/resources/views/sales/revenues/index.blade.php +++ b/resources/views/sales/revenues/index.blade.php @@ -21,10 +21,7 @@ 'class' => 'mb-0' ]) !!}
- +
{{ Form::bulkActionRowGroup('general.revenues', $bulk_actions, ['group' => 'sales', 'type' => 'revenues']) }} diff --git a/resources/views/settings/categories/index.blade.php b/resources/views/settings/categories/index.blade.php index 50d1a1ade..ac5b2a67f 100644 --- a/resources/views/settings/categories/index.blade.php +++ b/resources/views/settings/categories/index.blade.php @@ -18,10 +18,7 @@ 'class' => 'mb-0' ]) !!}
- +
{{ Form::bulkActionRowGroup('general.categories', $bulk_actions, ['group' => 'settings', 'type' => 'categories']) }} diff --git a/resources/views/settings/currencies/index.blade.php b/resources/views/settings/currencies/index.blade.php index 3a22a21ba..259cbfd45 100644 --- a/resources/views/settings/currencies/index.blade.php +++ b/resources/views/settings/currencies/index.blade.php @@ -18,10 +18,7 @@ 'class' => 'mb-0' ]) !!}
- +
{{ Form::bulkActionRowGroup('general.currencies', $bulk_actions, ['group' => 'settings', 'type' => 'currencies']) }} diff --git a/resources/views/settings/taxes/index.blade.php b/resources/views/settings/taxes/index.blade.php index fd22cde08..cbea11413 100644 --- a/resources/views/settings/taxes/index.blade.php +++ b/resources/views/settings/taxes/index.blade.php @@ -19,10 +19,7 @@ 'class' => 'mb-0' ]) !!}
- +
{{ Form::bulkActionRowGroup('general.taxes', $bulk_actions, ['group' => 'settings', 'type' => 'taxes']) }} From a9ab2e61a0f6a6a86ac001cc5bde8265e380c492 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Fri, 6 Nov 2020 22:34:53 +0300 Subject: [PATCH 2/6] refs search filter files.. --- app/View/Components/SearchString.php | 86 ++++++++++++- .../assets/js/components/AkauntingSearch.vue | 117 +++++++++++++++--- resources/lang/en-GB/general.php | 10 +- .../views/components/search-string.blade.php | 9 +- 4 files changed, 195 insertions(+), 27 deletions(-) diff --git a/app/View/Components/SearchString.php b/app/View/Components/SearchString.php index d7969ad06..cfedd9190 100644 --- a/app/View/Components/SearchString.php +++ b/app/View/Components/SearchString.php @@ -30,12 +30,13 @@ class SearchString extends Component { $searc_string = config('search-string'); - $this->filters = false; + $this->filters = []; if (!empty($searc_string[$this->model])) { $columns = $searc_string[$this->model]['columns']; foreach ($columns as $column => $options) { + // This column skip for filter if (!empty($options['searchable'])) { continue; } @@ -43,13 +44,13 @@ class SearchString extends Component if (!is_array($options)) { $column = $options; } - - $name = $this->getFilterName($column); $this->filters[] = [ - 'key' => $column, - 'value' => $name, - 'url' => !empty($options['route']) ? route($options['route'][0], $options['route'][1]) : '' + 'key' => $this->getFilterKey($column, $options), + 'value' => $this->getFilterName($column), + 'type' => $this->getFilterType($options), + 'url' => $this->getFilterUrl($column, $options), + 'values' => $this->getFilterValues($options), ]; } } @@ -57,6 +58,15 @@ class SearchString extends Component return view('components.search-string'); } + protected function getFilterKey($column, $options) + { + if (isset($options['relationship'])) { + $column .= '.id'; + } + + return $column; + } + protected function getFilterName($column) { if (strpos($column, '_id') !== false) { @@ -79,4 +89,68 @@ class SearchString extends Component return $name; } + + protected function getFilterType($options) + { + $type = 'select'; + + if (isset($options['boolean'])) { + $type = 'boolean'; + } + + return $type; + } + + protected function getFilterUrl($column, $options) + { + $url = ''; + + if (isset($options['boolean'])) { + return $url; + } + + if (!empty($options['route'])) { + if (is_array($options['route'])) { + $url = route($options['route'][0], $options['route'][1]); + } else { + $url = route($options['route']); + } + } else { + if (strpos($this->model, 'Modules') !== false) { + $module_class = explode('\\', $this->model); + + $url .= Str::slug($module_class[1], '-') . '::'; + } + + if (strpos($column, '_id') !== false) { + $column = str_replace('_id', '', $column); + } + + $plural = Str::plural($column, 2); + + $url = route($url . $plural . '.index'); + } + + return $url; + } + + protected function getFilterValues($options) + { + $values = []; + + if (isset($options['boolean'])) { + $values = [ + [ + 'key' => 0, + 'value' => trans('general.no'), + ], + [ + 'key' => 1, + 'value' => trans('general.yes'), + ], + ]; + } + + return $values; + } } diff --git a/resources/assets/js/components/AkauntingSearch.vue b/resources/assets/js/components/AkauntingSearch.vue index 238c34490..ed3f893d6 100644 --- a/resources/assets/js/components/AkauntingSearch.vue +++ b/resources/assets/js/components/AkauntingSearch.vue @@ -36,16 +36,16 @@ @@ -53,6 +53,9 @@ + @@ -68,11 +71,31 @@ export default { default: 'Search or filter results...', description: 'Input placeholder' }, - textSearch: { + searchText: { type: String, default: 'Search for this text', description: 'Input placeholder' }, + operatorIsText: { + type: String, + default: 'is', + description: 'Operator is "="' + }, + operatorIsNotText: { + type: String, + default: 'is not', + description: 'Operator is not "!="' + }, + noDataText: { + type: String, + default: 'No Data', + description: "Selectbox empty options message" + }, + noMatchingDataText: { + type: String, + default: 'No Matchign Data', + description: "Selectbox search option not found item message" + }, value: { type: String, default: null, @@ -113,6 +136,10 @@ export default { methods: { onInputFocus() { + if (!this.filters.length) { + return; + } + this.visible[this.filter_last_step] = true; this.$nextTick(() => { @@ -122,6 +149,31 @@ export default { onInput(evt) { this.search = evt.target.value; + + let option_url = this.selected_options[this.filter_index].url; + + if (this.search) { + option_url += '?search=' + this.search; + } + + window.axios.get(option_url) + .then(response => { + this.values = []; + + let data = response.data.data; + + data.forEach(function (item) { + this.values.push({ + key: item.id, + value: item.name + }); + }, this); + + this.option_values[value] = this.values; + }) + .catch(error => { + + }); this.$emit('input', evt.target.value); }, @@ -138,17 +190,17 @@ export default { args += '?search='; } - args += this.selected_options[index].key + ':' + this.selected_values[index].key; + args += this.selected_options[index].key + ':' + this.selected_values[index].key + ' '; }, this); - window.location = url + '/common/items' + args; + window.location = window.location.href.replace(window.location.search, '') + args; }, onOptionSelected(value) { this.current_value = value; let option = false; - let option_url = url + ''; + let option_url = url; for (let i = 0; i < this.filter_list.length; i++) { if (this.filter_list[i].key == value) { @@ -158,6 +210,10 @@ export default { option_url = this.filter_list[i].url; } + if (typeof this.filter_list[i].type !== 'undefined' && this.filter_list[i].type == 'boolean') { + this.option_values[value] = this.filter_list[i].values; + } + this.selected_options.push(this.filter_list[i]); this.filter_list.splice(i, 1); break; @@ -190,11 +246,7 @@ export default { this.option_values[value] = this.values; }) .catch(error => { - this.form.loading = false; - this.form.onFail(error); - - this.method_show_html = error.message; }); } else { this.values = this.option_values[value]; @@ -277,13 +329,15 @@ export default { onSearchAndFilterClear() { this.filtered = []; this.search = ''; + + this.onInputConfirm(); }, closeIfClickedOutside(event) { if (!document.getElementById('search-field-' + this._uid).contains(event.target)) { - this.visible.options = false; - this.visible.operator = false; - this.visible.values = false; + //this.visible.options = false; + //this.visible.operator = false; + //this.visible.values = false; document.removeEventListener('click', this.closeIfClickedOutside); } @@ -299,12 +353,41 @@ export default { this.search = string; } else { let filter = string.split(':'); + let option = ''; + let value = ''; + + this.filter_list.forEach(function (_filter, i) { + if (_filter.key == filter[0]) { + option = _filter.value; + + _filter.values.forEach(function (_value) { + if (_value.key == filter[1]) { + value = _value.value; + } + }, this); + + this.selected_options.push(this.filter_list[i]); + this.filter_list.splice(i, 1); + + this.option_values[_filter.key] = _filter.values; + + _filter.values.forEach(function (value, j) { + if (value.key == filter[1]) { + this.selected_values.push(value); + + this.option_values[_filter.key].splice(j, 1); + } + }, this); + } + }, this); this.filtered.push({ - option: filter[0], + option: option, operator: '=', - value: filter[1] - }) + value: value + }); + + this.filter_index++; } }, this); } diff --git a/resources/lang/en-GB/general.php b/resources/lang/en-GB/general.php index 86eb36c0e..6d6a1a153 100644 --- a/resources/lang/en-GB/general.php +++ b/resources/lang/en-GB/general.php @@ -105,7 +105,8 @@ return [ 'to' => 'To', 'print' => 'Print', 'search' => 'Search', - 'search_placeholder' => 'Search or filter results..', + 'search_text' => 'Search for this text', + 'search_placeholder' => 'Type to search..', 'filter' => 'Filter', 'help' => 'Help', 'all' => 'All', @@ -152,6 +153,8 @@ return [ 'no_matching_data' => 'No matching data', 'clear_cache' => 'Clear Cache', 'go_to_dashboard' => 'Go to dashboard', + 'is' => 'is', + 'isnot' => 'is not', 'card' => [ 'name' => 'Name on Card', @@ -181,6 +184,11 @@ return [ 'no_file_selected' => 'No file selected...', ], + 'placeholder' => [ + 'search' => 'Type to search..', + 'search_and_filter' => 'Search or filter results..', + ], + 'date_range' => [ 'today' => 'Today', 'yesterday' => 'Yesterday', diff --git a/resources/views/components/search-string.blade.php b/resources/views/components/search-string.blade.php index d655b6dc8..fe89a5f41 100644 --- a/resources/views/components/search-string.blade.php +++ b/resources/views/components/search-string.blade.php @@ -1,7 +1,10 @@ - From 4f8a1661fcb741ce6dc09f5c1bf760d915f293a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Mon, 9 Nov 2020 20:30:05 +0300 Subject: [PATCH 3/6] index blade fixes.. --- app/View/Components/SearchString.php | 18 +++- public/css/custom.css | 6 ++ public/vendor/js-cookie/js.cookie.js | 24 +++++- .../assets/js/components/AkauntingSearch.vue | 84 ++++++++++++++----- resources/assets/js/views/auth/roles.js | 2 +- .../banking/reconciliations/index.blade.php | 2 +- .../views/banking/transfers/index.blade.php | 2 +- resources/views/common/items/index.blade.php | 2 +- .../views/purchases/bills/index.blade.php | 2 +- .../views/purchases/payments/index.blade.php | 2 +- .../views/purchases/vendors/index.blade.php | 2 +- .../views/sales/customers/index.blade.php | 2 +- .../views/sales/invoices/index.blade.php | 2 +- .../views/sales/revenues/index.blade.php | 2 +- .../views/settings/taxes/index.blade.php | 2 +- 15 files changed, 117 insertions(+), 37 deletions(-) diff --git a/app/View/Components/SearchString.php b/app/View/Components/SearchString.php index cfedd9190..51ef8500c 100644 --- a/app/View/Components/SearchString.php +++ b/app/View/Components/SearchString.php @@ -50,7 +50,7 @@ class SearchString extends Component 'value' => $this->getFilterName($column), 'type' => $this->getFilterType($options), 'url' => $this->getFilterUrl($column, $options), - 'values' => $this->getFilterValues($options), + 'values' => $this->getFilterValues($column, $options), ]; } } @@ -134,7 +134,7 @@ class SearchString extends Component return $url; } - protected function getFilterValues($options) + protected function getFilterValues($column, $options) { $values = []; @@ -149,6 +149,20 @@ class SearchString extends Component 'value' => trans('general.yes'), ], ]; + } else if ($search = request()->get('search', false)) { + $fields = explode(' ', $search); + + foreach ($fields as $field) { + if (strpos($field, ':') === false) { + continue; + } + + $filters = explode(':', $field); + + if ($filters[0] != $column) { + continue; + } + } } return $values; diff --git a/public/css/custom.css b/public/css/custom.css index daf4d6f16..8feca3952 100644 --- a/public/css/custom.css +++ b/public/css/custom.css @@ -846,3 +846,9 @@ table .align-items-center td span.badge { border: 1px solid #3c3f72; } /*--lightbox Finish--*/ + +/*-- Search string & BulkAction Start --*/ +#app .card .card-header { + min-height: 88px; +} +/*-- Search string & BulkAction Finish --*/ \ No newline at end of file diff --git a/public/vendor/js-cookie/js.cookie.js b/public/vendor/js-cookie/js.cookie.js index 9a0945ed8..98f13c735 100644 --- a/public/vendor/js-cookie/js.cookie.js +++ b/public/vendor/js-cookie/js.cookie.js @@ -7,19 +7,26 @@ */ ;(function (factory) { var registeredInModuleLoader = false; + if (typeof define === 'function' && define.amd) { define(factory); + registeredInModuleLoader = true; } + if (typeof exports === 'object') { module.exports = factory(); + registeredInModuleLoader = true; } + if (!registeredInModuleLoader) { var OldCookies = window.Cookies; var api = window.Cookies = factory(); + api.noConflict = function () { window.Cookies = OldCookies; + return api; }; } @@ -27,24 +34,27 @@ function extend () { var i = 0; var result = {}; + for (; i < arguments.length; i++) { var attributes = arguments[ i ]; + for (var key in attributes) { result[key] = attributes[key]; } } + return result; } function init (converter) { function api (key, value, attributes) { var result; + if (typeof document === 'undefined') { return; } // Write - if (arguments.length > 1) { attributes = extend({ path: '/' @@ -52,7 +62,9 @@ if (typeof attributes.expires === 'number') { var expires = new Date(); + expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5); + attributes.expires = expires; } @@ -61,6 +73,7 @@ try { result = JSON.stringify(value); + if (/^[\{\[]/.test(result)) { value = result; } @@ -83,17 +96,20 @@ if (!attributes[attributeName]) { continue; } + stringifiedAttributes += '; ' + attributeName; + if (attributes[attributeName] === true) { continue; } + stringifiedAttributes += '=' + attributes[attributeName]; } + return (document.cookie = key + '=' + value + stringifiedAttributes); } // Read - if (!key) { result = {}; } @@ -115,6 +131,7 @@ try { var name = parts[0].replace(rdecode, decodeURIComponent); + cookie = converter.read ? converter.read(cookie, name) : converter(cookie, name) || cookie.replace(rdecode, decodeURIComponent); @@ -140,14 +157,17 @@ } api.set = api; + api.get = function (key) { return api.call(api, key); }; + api.getJSON = function () { return api.apply({ json: true }, [].slice.call(arguments)); }; + api.defaults = {}; api.remove = function (key, attributes) { diff --git a/resources/assets/js/components/AkauntingSearch.vue b/resources/assets/js/components/AkauntingSearch.vue index ed3f893d6..932cfc777 100644 --- a/resources/assets/js/components/AkauntingSearch.vue +++ b/resources/assets/js/components/AkauntingSearch.vue @@ -6,7 +6,7 @@ - {{ filter.operator }} + {{ (filter.operator == '=') ? operatorIsText : operatorIsNotText }} @@ -31,7 +31,7 @@ -