Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 34 additions & 3 deletions app/routes/events/view/tickets/orders/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,49 @@ export default class extends Route.extend(EmberTableRouteMixin) {

async model(params) {
this.set('params', params);
const searchField = 'identifier';
let filterOptions = [];
if (params.orders_status !== 'all') {
if (params.orders_status !== 'all' && params.search !== null) {
filterOptions = [
{
and: [
{
name : 'status',
op : 'eq',
val : params.orders_status
},
{
name : 'user',
op : 'has',
val : {
name : 'email',
op : 'ilike',
val : `%${params.search}%`
}
}
]
}
];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just push in search options if search is present. No need to create 2 more conditions like this. See the implementation of applySearchFilters

} else if (params.orders_status !== 'all') {
filterOptions = [
{
name : 'status',
op : 'eq',
val : params.orders_status
}
];
} else if (params.search !== null) {
filterOptions = [
{
name : 'user',
op : 'has',
val : {
name : 'email',
op : 'ilike',
val : `%${params.search}%`
}
}
];
}
filterOptions = this.applySearchFilters(filterOptions, params, searchField);

let queryString = {
include : 'tickets,user',
Expand Down