Skip to content
Snippets Groups Projects
Commit 4deaf9fb authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Fixing filters

parent 628c746d
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,12 @@ class JoblistController extends AbstractAjaxController {
*/
private $companyRepository;
/**
* @var \SGalinski\SgJobs\Domain\Repository\JobRepository
* @inject
*/
private $jobRepository;
/**
* Show all job offers and options to manage them
*
......@@ -61,12 +67,7 @@ class JoblistController extends AbstractAjaxController {
'function' => $_POST['parameters']['function'],
];
// get all correct filter options, based on the selection
$this->view->assign('cities', FrontendFilterService::getLocations($filters, $recordPageId));
$this->view->assign('companies', FrontendFilterService::getCompanies($filters, $recordPageId));
$this->view->assign('areas', FrontendFilterService::getAreas($filters, $recordPageId));
$this->view->assign('functions', FrontendFilterService::getFunctions($filters, $recordPageId));
$this->view->assign('countries', $this->companyRepository->getAllCountries($recordPageId));
$this->assignFilterValues($recordPageId);
// set all filtered jobs
$this->view->assign('jobs', FrontendFilterService::getJobs($filters, $recordPageId));
......@@ -95,4 +96,26 @@ class JoblistController extends AbstractAjaxController {
$fileObject = $storage->getFile('/Extension/temp/' . $GLOBALS['TSFE']->fe_user->id . '/' . $type . '/' . $file);
$storage->deleteFile($fileObject);
}
/**
* Assign filter values
*
* @param int $rootPageId
*/
private function assignFilterValues($rootPageId) {
$countries = $this->companyRepository->getAllCountries($rootPageId);
$this->view->assign('countries', $countries);
$cities = $this->companyRepository->getAllCities($rootPageId);
$this->view->assign('cities', $cities);
$companies = $this->companyRepository->getAllCompanyNames($rootPageId);
$this->view->assign('companies', $companies);
$areas = $this->jobRepository->getAllAreas($rootPageId);
$this->view->assign('areas', $areas);
$functions = $this->jobRepository->getAllFunctions($rootPageId);
$this->view->assign('functions', $functions);
}
}
......@@ -60,15 +60,15 @@ class JoblistController extends ActionController {
* @throws \InvalidArgumentException
*/
public function indexAction() {
$recordPageId = (int) $this->configurationManager->getConfiguration(
$storagePid = (int) $this->configurationManager->getConfiguration(
ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK
)['persistence']['storagePid'];
$this->assignFilterValues($recordPageId);
$this->view->assign('recordPageId', $recordPageId);
$this->assignFilterValues($storagePid);
$this->view->assign('recordPageId', $storagePid);
// get all jobs for the next root page
$jobs = $this->jobRepository->findJobs($recordPageId);
$jobs = $this->jobRepository->findJobs($storagePid);
$this->view->assign('jobs', $jobs);
}
......
......@@ -12,7 +12,7 @@ export default class SgJobs {
*/
constructor() {
$('.remove-file').on('click', this._removeFile);
$('#sgjobs-joblist').delegate('.sgjobs-select', 'change', this._filterJoblist);
$('#sgjobs-joblist').on('change', '.sgjobs-select', this._filterJoblist);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment