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") * * @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") * * @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("/store_location/{id}/parts", name="part_list_store_location") * * @return \Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\Response */ public function showStorelocation(Storelocation $storelocation, Request $request, DataTableFactory $dataTable) { $table = $dataTable->createFromType(PartsDataTable::class, ['storelocation' => $storelocation]) ->handleRequest($request); if ($table->isCallback()) { return $table->getResponse(); } return $this->render('Parts/lists/store_location_list.html.twig', [ 'datatable' => $table, 'entity' => $storelocation, ]); } /** * @Route("/supplier/{id}/parts", name="part_list_supplier") * * @return \Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\Response */ public function showSupplier(Supplier $supplier, Request $request, DataTableFactory $dataTable) { $table = $dataTable->createFromType(PartsDataTable::class, ['supplier' => $supplier]) ->handleRequest($request); if ($table->isCallback()) { return $table->getResponse(); } return $this->render('Parts/lists/supplier_list.html.twig', [ 'datatable' => $table, 'entity' => $supplier, ]); } /** * @Route("/parts/by_tag/{tag}", name="part_list_tags") * * @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", name="parts_search") */ public function showSearch(Request $request, DataTableFactory $dataTable) { $search = $request->get('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' => $search, ]); } /** * @Route("/parts", name="parts_show_all") * * @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]); } }