diff --git a/config/routes/search.yaml b/config/routes/search.yaml index b3a53477..54bebd51 100644 --- a/config/routes/search.yaml +++ b/config/routes/search.yaml @@ -5,4 +5,4 @@ general_search: search_history: path: /search/history controller: App\Controller\SearchController::search - methods: [POST] + methods: [GET] diff --git a/src/Controller/SearchController.php b/src/Controller/SearchController.php index fe99eb86..45a582cd 100644 --- a/src/Controller/SearchController.php +++ b/src/Controller/SearchController.php @@ -33,8 +33,9 @@ class SearchController extends BaseController public function search(Request $req, GeneralSearch $search) { $this->denyAccessUnlessGranted('general.search', null, 'No access.'); + $params = $this->initParameters('general_search'); - $search_term = $req->request->get('data-rows-search'); + $search_term = $req->query->get('search'); $results = $search->search($search_term); // process rows @@ -43,7 +44,7 @@ class SearchController extends BaseController foreach($results['legacy_job_orders'] as $lrow) { $row['id'] = $lrow->getID(); - $row['name'] = $lrow->getCustName(); + $row['name'] = $lrow->getCustFirstName() . " " . $lrow->getCustLastName(); $row['plate_number'] = $lrow->getPlateNumber(); $rows[] = $row; @@ -69,8 +70,7 @@ class SearchController extends BaseController $rows[] = $row; } - return $this->json([ - 'data' => $rows - ]); + $params['data'] = $rows; + return $this->render('search/results.html.twig', $params); } } diff --git a/templates/search/list.html.twig b/templates/search/list.html.twig index 2a16c22d..0d715c80 100644 --- a/templates/search/list.html.twig +++ b/templates/search/list.html.twig @@ -23,9 +23,9 @@
| {{ result.id }} | +{{ result.name }} | +{{ result.plate_number }} | +