<?php
namespace App\Controller;
use App\Entity\Rup;
use App\Repository\JenisPengadaanRepository;
use App\Repository\KlasifikasiUsahaRepository;
use App\Repository\MetodePengadaanRepository;
use App\Repository\RupRepository;
use App\Repository\TenderPublishPokjaRepository;
use App\Repository\TenderRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class SearchController extends AbstractController
{
#[Route('/search', name: 'app_search')]
public function index(
JenisPengadaanRepository $jenisPengadaanRepository,
TenderRepository $tenderRepository,
RupRepository $rupRepository,
MetodePengadaanRepository $metodePengadaanRepository,
KlasifikasiUsahaRepository $klasifikasiUsahaRepository,
TenderPublishPokjaRepository $publishRepository,
Request $request
): Response {
$options = $jenisPengadaanRepository->findAll();
$options2 = $rupRepository->findAll();
$options3 = $metodePengadaanRepository->findAll();
$options4 = $klasifikasiUsahaRepository->findAll();
$publish = $publishRepository->findAll();
$iscari = $request->get('iscari');
$tenders = null;
$params = [
'jenis_pengadaan' => $request->get('jenis_pengadaan'),
'metode_pengadaan' => $request->get('metode_pengadaan'),
'rup' => $request->get('RUP'),
'kualifikasi_usaha' => $request->get('kualifikasi_usaha'),
'nama_tender' => $request->get('nama_tender')
];
if ($iscari == '1') {
$tenders = $tenderRepository->findBySearchForm($params);
}
return $this->render('search/index.html.twig', [
'options' => $options,
'tenders' => $tenders,
'publish' => $publish,
'iscari' => $iscari,
'options2' => $options2,
'options3' => $options3,
'options4' => $options4,
'params' => $params
]);
}
}