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), 'value' => $this->getFilterName($column),
'type' => $this->getFilterType($options), 'type' => $this->getFilterType($options),
'url' => $this->getFilterUrl($column, $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; return $url;
} }
protected function getFilterValues($options) protected function getFilterValues($column, $options)
{ {
$values = []; $values = [];
@ -149,6 +149,20 @@ class SearchString extends Component
'value' => trans('general.yes'), '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; return $values;

View File

@ -846,3 +846,9 @@ table .align-items-center td span.badge {
border: 1px solid #3c3f72; border: 1px solid #3c3f72;
} }
/*--lightbox Finish--*/ /*--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) { ;(function (factory) {
var registeredInModuleLoader = false; var registeredInModuleLoader = false;
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
define(factory); define(factory);
registeredInModuleLoader = true; registeredInModuleLoader = true;
} }
if (typeof exports === 'object') { if (typeof exports === 'object') {
module.exports = factory(); module.exports = factory();
registeredInModuleLoader = true; registeredInModuleLoader = true;
} }
if (!registeredInModuleLoader) { if (!registeredInModuleLoader) {
var OldCookies = window.Cookies; var OldCookies = window.Cookies;
var api = window.Cookies = factory(); var api = window.Cookies = factory();
api.noConflict = function () { api.noConflict = function () {
window.Cookies = OldCookies; window.Cookies = OldCookies;
return api; return api;
}; };
} }
@ -27,24 +34,27 @@
function extend () { function extend () {
var i = 0; var i = 0;
var result = {}; var result = {};
for (; i < arguments.length; i++) { for (; i < arguments.length; i++) {
var attributes = arguments[ i ]; var attributes = arguments[ i ];
for (var key in attributes) { for (var key in attributes) {
result[key] = attributes[key]; result[key] = attributes[key];
} }
} }
return result; return result;
} }
function init (converter) { function init (converter) {
function api (key, value, attributes) { function api (key, value, attributes) {
var result; var result;
if (typeof document === 'undefined') { if (typeof document === 'undefined') {
return; return;
} }
// Write // Write
if (arguments.length > 1) { if (arguments.length > 1) {
attributes = extend({ attributes = extend({
path: '/' path: '/'
@ -52,7 +62,9 @@
if (typeof attributes.expires === 'number') { if (typeof attributes.expires === 'number') {
var expires = new Date(); var expires = new Date();
expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5); expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
attributes.expires = expires; attributes.expires = expires;
} }
@ -61,6 +73,7 @@
try { try {
result = JSON.stringify(value); result = JSON.stringify(value);
if (/^[\{\[]/.test(result)) { if (/^[\{\[]/.test(result)) {
value = result; value = result;
} }
@ -83,17 +96,20 @@
if (!attributes[attributeName]) { if (!attributes[attributeName]) {
continue; continue;
} }
stringifiedAttributes += '; ' + attributeName; stringifiedAttributes += '; ' + attributeName;
if (attributes[attributeName] === true) { if (attributes[attributeName] === true) {
continue; continue;
} }
stringifiedAttributes += '=' + attributes[attributeName]; stringifiedAttributes += '=' + attributes[attributeName];
} }
return (document.cookie = key + '=' + value + stringifiedAttributes); return (document.cookie = key + '=' + value + stringifiedAttributes);
} }
// Read // Read
if (!key) { if (!key) {
result = {}; result = {};
} }
@ -115,6 +131,7 @@
try { try {
var name = parts[0].replace(rdecode, decodeURIComponent); var name = parts[0].replace(rdecode, decodeURIComponent);
cookie = converter.read ? cookie = converter.read ?
converter.read(cookie, name) : converter(cookie, name) || converter.read(cookie, name) : converter(cookie, name) ||
cookie.replace(rdecode, decodeURIComponent); cookie.replace(rdecode, decodeURIComponent);
@ -140,14 +157,17 @@
} }
api.set = api; api.set = api;
api.get = function (key) { api.get = function (key) {
return api.call(api, key); return api.call(api, key);
}; };
api.getJSON = function () { api.getJSON = function () {
return api.apply({ return api.apply({
json: true json: true
}, [].slice.call(arguments)); }, [].slice.call(arguments));
}; };
api.defaults = {}; api.defaults = {};
api.remove = function (key, attributes) { api.remove = function (key, attributes) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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