added search on supplier listings
This commit is contained in:
parent
eabc4e04fb
commit
653f495a70
3 changed files with 31 additions and 0 deletions
|
@ -64,6 +64,7 @@ sub post_lcc_suppliers {
|
|||
$v->optional('page')->number;
|
||||
$v->optional('sort_by');
|
||||
$v->optional('sort_dir');
|
||||
$v->optional('search');
|
||||
|
||||
my $order_by = [
|
||||
{ -asc => 'organisation.name' },
|
||||
|
@ -85,6 +86,12 @@ sub post_lcc_suppliers {
|
|||
my $lcc_suppliers = $c->schema->resultset('Entity')->search(
|
||||
{
|
||||
'sales.buyer_id' => $user->entity->id,
|
||||
( $v->param('search') ? (
|
||||
'-or' => [
|
||||
{ 'organisation.name' => { 'like' => $v->param('search') . '%' } },
|
||||
{ 'organisation.postcode' => { 'like' => $v->param('search') . '%' } },
|
||||
]
|
||||
) : () ),
|
||||
},
|
||||
{
|
||||
join => [ 'sales', 'organisation' ],
|
||||
|
|
Reference in a new issue