createFromType(PartsDataTable::class, ['category' => $category]) ->handleRequest($request); if ($table->isCallback()) { return $table->getResponse(); } return $this->render('Parts/lists/category_list.html.twig', [ 'datatable' => $table, 'entity' => $category ]); } /** * @Route("/footprint/{id}/parts", name="part_list_footprint") * * @param $id int The id of the category * * @return \Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\Response */ public function showFootprint(Footprint $footprint, Request $request, DataTableFactory $dataTable) { $table = $dataTable->createFromType(PartsDataTable::class, ['footprint' => $footprint]) ->handleRequest($request); if ($table->isCallback()) { return $table->getResponse(); } return $this->render('Parts/lists/footprint_list.html.twig', [ 'datatable' => $table, 'entity' => $footprint ]); } /** * @Route("/manufacturer/{id}/parts", name="part_list_manufacturer") * * @param $id int The id of the category * * @return \Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\Response */ public function showManufacturer(Manufacturer $manufacturer, Request $request, DataTableFactory $dataTable) { $table = $dataTable->createFromType(PartsDataTable::class, ['manufacturer' => $manufacturer]) ->handleRequest($request); if ($table->isCallback()) { return $table->getResponse(); } return $this->render('Parts/lists/manufacturer_list.html.twig', [ 'datatable' => $table, 'entity' => $manufacturer ]); } /** * @Route("/parts/by_tag/{tag}", name="part_list_tags") * @param string $tag * @param Request $request * @param DataTableFactory $dataTable * @return \Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\Response */ public function showTag(string $tag, Request $request, DataTableFactory $dataTable) { $table = $dataTable->createFromType(PartsDataTable::class, ['tag' => $tag]) ->handleRequest($request); if ($table->isCallback()) { return $table->getResponse(); } return $this->render('Parts/lists/tags_list.html.twig', [ 'tag' => $tag, 'datatable' => $table ]); } /** * @Route("/parts/search/{keyword}", name="parts_search") */ public function showSearch(Request $request, DataTableFactory $dataTable, string $keyword = "") { $search = $keyword; $table = $dataTable->createFromType(PartsDataTable::class, ['search' => $search]) ->handleRequest($request); if ($table->isCallback()) { return $table->getResponse(); } return $this->render('Parts/lists/search_list.html.twig', [ 'datatable' => $table, 'keyword' => $keyword ]); } /** * @Route("/parts", name="parts_show_all") * * @param Request $request * @param DataTableFactory $dataTable * * @return \Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\Response */ public function showAll(Request $request, DataTableFactory $dataTable) { $table = $dataTable->createFromType(PartsDataTable::class) ->handleRequest($request); if ($table->isCallback()) { return $table->getResponse(); } return $this->render('Parts/lists/all_list.html.twig', ['datatable' => $table]); } }