index blade fixes..

This commit is contained in:
Cüneyt Şentürk 2020-11-09 20:30:05 +03:00
parent a9ab2e61a0
commit 4f8a1661fc
15 changed files with 117 additions and 37 deletions

View File

@ -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;

View File

@ -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 --*/

View File

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

View File

@ -6,7 +6,7 @@
</span>
<span v-if="filter.operator" class="el-tag el-tag--primary el-tag--small el-tag--light el-tag-operator">
{{ filter.operator }}
{{ (filter.operator == '=') ? operatorIsText : operatorIsNotText }}
</span>
<span v-if="filter.value" class="el-tag el-tag--primary el-tag--small el-tag--light el-tag-value">
@ -31,7 +31,7 @@
<i class="el-tag__close el-icon-close"></i>
</button>
<div class="dropdown-menu" :class="[{'show': visible.options}]">
<div :id="'search-field-option-' + _uid" class="dropdown-menu" :class="[{'show': visible.options}]">
<li ref="" class="dropdown-item" v-for="option in filteredOptions" :data-value="option.key">
<button type="button" class="btn btn-link" @click="onOptionSelected(option.key)">{{ option.value }}</button>
</li>
@ -40,7 +40,7 @@
</li>
</div>
<div class="dropdown-menu" :class="[{'show': visible.operator}]">
<div :id="'search-field-operator-' + _uid" class="dropdown-menu" :class="[{'show': visible.operator}]">
<li ref="" class="dropdown-item">
<button type="button" class="btn btn-link" @click="onOperatorSelected('=')">{{ operatorIsText }}<span class="btn-helptext d-none">is</span></button>
</li>
@ -49,7 +49,7 @@
</li>
</div>
<div class="dropdown-menu" :class="[{'show': visible.values}]">
<div :id="'search-field-value-' + _uid" class="dropdown-menu" :class="[{'show': visible.values}]">
<li ref="" class="dropdown-item" v-for="(value) in filteredValues" :data-value="value.key">
<button type="button" class="btn btn-link" @click="onValueSelected(value.key)">{{ value.value }}</button>
</li>
@ -136,7 +136,7 @@ export default {
methods: {
onInputFocus() {
if (!this.filters.length) {
if (!this.filter_list.length) {
return;
}
@ -145,6 +145,8 @@ export default {
this.$nextTick(() => {
this.$refs['input-search-field-' + this._uid].focus();
});
console.log('Focus :' + this.filter_last_step);
},
onInput(evt) {
@ -179,21 +181,37 @@ export default {
},
onInputConfirm() {
let path = window.location.href.replace(window.location.search, '');
let args = '';
if (this.search) {
args += '?search=' + this.search;
args += '?search=' + this.search + ' ';
}
let now = new Date();
now.setTime(now.getTime() + 1 * 3600 * 1000);
let expires = now.toUTCString();
let serach_string = {};
serach_string[path] = {};
this.filtered.forEach(function (filter, index) {
if (!args) {
args += '?search=';
}
args += this.selected_options[index].key + ':' + this.selected_values[index].key + ' ';
serach_string[path][this.selected_options[index].key] = {
'key': this.selected_values[index].key,
'value': this.selected_values[index].value
};
}, this);
window.location = window.location.href.replace(window.location.search, '') + args;
Cookies.set('search-string', serach_string, expires);
window.location = path + args;
},
onOptionSelected(value) {
@ -252,6 +270,10 @@ export default {
this.values = this.option_values[value];
}
this.$nextTick(() => {
this.$refs['input-search-field-' + this._uid].focus();
});
this.visible = {
options: false,
operator: true,
@ -259,10 +281,6 @@ export default {
};
this.filter_last_step = 'operator';
this.$nextTick(() => {
this.$refs['input-search-field-' + this._uid].focus();
});
},
onOperatorSelected(value) {
@ -270,8 +288,6 @@ export default {
this.$emit('change', this.filtered);
this.operatorValue = '';
this.$nextTick(() => {
this.$refs['input-search-field-' + this._uid].focus();
});
@ -308,11 +324,19 @@ export default {
this.filter_index++;
this.visible = {
options: true,
operator: false,
values: false,
};
if (this.filter_list.length) {
this.visible = {
options: true,
operator: false,
values: false,
};
} else {
this.visible = {
options: false,
operator: false,
values: false,
};
}
this.filter_last_step = 'options';
},
@ -330,14 +354,16 @@ export default {
this.filtered = [];
this.search = '';
Cookies.remove('search-string');
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;
if (!document.getElementById('search-field-' + this._uid).contains(event.target) && event.target.className != 'btn btn-link') {
this.visible.options = false;
this.visible.operator = false;
this.visible.values = false;
document.removeEventListener('click', this.closeIfClickedOutside);
}
@ -345,6 +371,12 @@ export default {
},
created() {
let path = window.location.href.replace(window.location.search, '');
let cookie = Cookies.get('search-string');
cookie = JSON.parse(cookie)[path];
if (this.value) {
let serach_string = this.value.split(' ');
@ -366,6 +398,10 @@ export default {
}
}, this);
if (!value && cookie[_filter.key]) {
value = cookie[_filter.key].value;
}
this.selected_options.push(this.filter_list[i]);
this.filter_list.splice(i, 1);
@ -378,6 +414,10 @@ export default {
this.option_values[_filter.key].splice(j, 1);
}
}, this);
if (cookie[_filter.key]) {
this.selected_values.push(cookie[_filter.key]);
}
}
}, this);

View File

@ -26,7 +26,7 @@ const app = new Vue({
],
mounted() {
if (!this.form.permissions.length) {
if (typeof this.form.permissions !== 'undefined' && !this.form.permissions.length) {
this.form.permissions = [];
}
},

View File

@ -9,7 +9,7 @@
@endsection
@section('content')
@if ($reconciliations->count())
@if ($reconciliations->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([

View File

@ -11,7 +11,7 @@
@endsection
@section('content')
@if ($transfers->count())
@if ($transfers->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([

View File

@ -11,7 +11,7 @@
@endsection
@section('content')
@if ($items->count())
@if ($items->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([

View File

@ -11,7 +11,7 @@
@endsection
@section('content')
@if ($bills->count())
@if ($bills->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([

View File

@ -11,7 +11,7 @@
@endsection
@section('content')
@if ($payments->count())
@if ($payments->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([

View File

@ -11,7 +11,7 @@
@endsection
@section('content')
@if ($vendors->count())
@if ($vendors->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([

View File

@ -11,7 +11,7 @@
@endsection
@section('content')
@if ($customers->count())
@if ($customers->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([

View File

@ -11,7 +11,7 @@
@endsection
@section('content')
@if ($invoices->count())
@if ($invoices->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([

View File

@ -11,7 +11,7 @@
@endsection
@section('content')
@if ($revenues->count())
@if ($revenues->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([

View File

@ -9,7 +9,7 @@
@endcan
@section('content')
@if ($taxes->count())
@if ($taxes->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([