Skip to content

Commit

Permalink
Merge pull request #1253 from suraj-webkul/Issue#1242
Browse files Browse the repository at this point in the history
Issue #1242 fixed.
  • Loading branch information
devansh-webkul authored Jun 19, 2024
2 parents bde276d + 007ffbf commit 30516c0
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class="lead-block"
'created_at': {
'type' : 'date_range',
'label' : "{{ trans('admin::app.datagrid.created_at') }}",
'values' : [null, null],
'values' : this.getQueryParams(),
'filterable' : true
},
}
Expand All @@ -150,7 +150,18 @@ class="lead-block"
toggleSidebarFilter: function () {
$('.sidebar-filter').toggleClass('show');
},
}
getQueryParams: function() {
const params = new URLSearchParams(window.location.search);
const createdAt = params.get('created_at[bw]');
if (createdAt) {
return createdAt.split(',');
}
return [null, null];
},
},
});
Vue.component('kanban-component', {
Expand Down Expand Up @@ -184,7 +195,7 @@ class="lead-block"
},
created: function () {
this.getLeads();
this.getLeads(false, window.location.search);
queueMicrotask(() => {
$('#search-field').on('search keyup', ({target}) => {
Expand Down Expand Up @@ -282,12 +293,31 @@ class="lead-block"
this.getLeads(searchedKeyword);
},
updateFilter: function (data) {
updateFilter: function ({ key, cond, value}) {
this.leads = [];
let href = data.key ? `?${data.key}[${data.cond}]=${data.value}` : false;
let href = key ? `?${key}[${cond}]=${value}` : false;
this.makeURL({
key,
cond,
value,
});
this.getLeads(false, href);
},
makeURL: function({ key, cond, value}) {
let params = key + "[" + cond + "]" + "=" + value;
let newURL =
window.location.origin +
window.location.pathname +
`${params != "" ? "?" + params : ""}`;
window.history.pushState({ path: newURL }, "", newURL);
},
toggleEmptyStateIcon: function () {
$('.empty-icon-container').remove();
Expand Down
2 changes: 1 addition & 1 deletion packages/Webkul/UI/publishable/assets/js/ui.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/Webkul/UI/publishable/assets/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/js/ui.js": "/js/ui.js?id=87d488f8ed9ba7dce038ff5d88483710",
"/js/ui.js": "/js/ui.js?id=10ef22a71bd0683f029cfc6956d6c1bc",
"/css/ui.css": "/css/ui.css?id=84b20446fe4083db9e4501ee2ec3e50f",
"/images/add-icon.svg": "/images/add-icon.svg?id=9135b4e0e1c239c36981c849a44a80e1",
"/images/alert-danger-icon.svg": "/images/alert-danger-icon.svg?id=d77f6a8646ed23b5c3b7721e9e236299",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
ref="startDate"
type="text"
class="control half"
:value="startDate"
:placeholder="__('ui.datagrid.filter.start_date')"
/>
</div>
Expand All @@ -16,6 +17,7 @@
ref="endDate"
type="text"
class="control half"
:value="endDate"
:placeholder="__('ui.datagrid.filter.end_date')"
/>
</div>
Expand Down

0 comments on commit 30516c0

Please sign in to comment.