Skip to content

Commit

Permalink
index blade fixes..
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Nov 9, 2020
1 parent a9ab2e6 commit 4f8a166
Show file tree
Hide file tree
Showing 15 changed files with 117 additions and 37 deletions.
18 changes: 16 additions & 2 deletions app/View/Components/SearchString.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function render()
'value' => $this->getFilterName($column),
'type' => $this->getFilterType($options),
'url' => $this->getFilterUrl($column, $options),
'values' => $this->getFilterValues($options),
'values' => $this->getFilterValues($column, $options),
];
}
}
Expand Down Expand Up @@ -134,7 +134,7 @@ protected function getFilterUrl($column, $options)
return $url;
}

protected function getFilterValues($options)
protected function getFilterValues($column, $options)
{
$values = [];

Expand All @@ -149,6 +149,20 @@ protected function getFilterValues($options)
'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;
Expand Down
6 changes: 6 additions & 0 deletions public/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 --*/
24 changes: 22 additions & 2 deletions public/vendor/js-cookie/js.cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,64 @@
*/
;(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;
};
}
}(function () {
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: '/'
}, api.defaults, attributes);

if (typeof attributes.expires === 'number') {
var expires = new Date();

expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);

attributes.expires = expires;
}

Expand All @@ -61,6 +73,7 @@

try {
result = JSON.stringify(value);

if (/^[\{\[]/.test(result)) {
value = result;
}
Expand All @@ -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 = {};
}
Expand All @@ -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);
Expand All @@ -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) {
Expand Down
84 changes: 62 additions & 22 deletions resources/assets/js/components/AkauntingSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -136,7 +136,7 @@ export default {
methods: {
onInputFocus() {
if (!this.filters.length) {
if (!this.filter_list.length) {
return;
}
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -252,26 +270,24 @@ export default {
this.values = this.option_values[value];
}
this.$nextTick(() => {
this.$refs['input-search-field-' + this._uid].focus();
});
this.visible = {
options: false,
operator: true,
values: false,
};
this.filter_last_step = 'operator';
this.$nextTick(() => {
this.$refs['input-search-field-' + this._uid].focus();
});
},
onOperatorSelected(value) {
this.filtered[this.filter_index].operator = value;
this.$emit('change', this.filtered);
this.operatorValue = '';
this.$nextTick(() => {
this.$refs['input-search-field-' + this._uid].focus();
});
Expand Down Expand Up @@ -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';
},
Expand All @@ -330,21 +354,29 @@ 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);
}
},
},
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(' ');
Expand All @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion resources/assets/js/views/auth/roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
}
},
Expand Down
2 changes: 1 addition & 1 deletion resources/views/banking/reconciliations/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down
Loading

0 comments on commit 4f8a166

Please sign in to comment.