diff --git a/module/Application/src/Controller/FormsController.php b/module/Application/src/Controller/FormsController.php deleted file mode 100644 index b2d12fe..0000000 --- a/module/Application/src/Controller/FormsController.php +++ /dev/null @@ -1,26 +0,0 @@ -searchService = $searchService; + $this->searchForm = $searchForm; } public function dashboardAction() @@ -56,8 +60,41 @@ public function detailAction() $viewModel = new ViewModel(); $jobDetail = $this->searchService->searchById($jobId); -// var_dump($jobDetail); + $viewModel->job = $jobDetail; return $viewModel; } + + public function manualSearchAction() + { + $viewModel = new ViewModel(); + $viewModel->form = $this->searchForm; + + $request = $this->getRequest(); + if(!$request->isPost()) { + return $viewModel; + } + + + $postData = $request->getPost(); + + $this->searchForm->setData($postData); + if(!$this->searchForm->isValid()) { + return $viewModel; + } + + $formData = $this->searchForm->getData(); + $position = $formData['position']; + $location = $formData['location']; + + try { + + $viewModel->result = $this->searchService->searchByCombinedParams($position, $location); + } catch (\Exception $ex) { + $viewModel->error = true; + return $viewModel; + } + + return $viewModel; + } } diff --git a/module/Application/src/Factory/IndexControllerFactory.php b/module/Application/src/Factory/IndexControllerFactory.php index 063beed..f75086a 100644 --- a/module/Application/src/Factory/IndexControllerFactory.php +++ b/module/Application/src/Factory/IndexControllerFactory.php @@ -4,6 +4,7 @@ use Application\Controller\IndexController; +use Application\Form\SearchForm; use Github\Service\SearchService; use Interop\Container\ContainerInterface; use Interop\Container\Exception\ContainerException; @@ -28,6 +29,8 @@ class IndexControllerFactory implements FactoryInterface */ public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { - return new IndexController($container->get(SearchService::class)); + $searchForm = $container->get('FormElementManager')->get(SearchForm::class); + + return new IndexController($container->get(SearchService::class), $searchForm); } } \ No newline at end of file diff --git a/module/Application/src/Form/SearchForm.php b/module/Application/src/Form/SearchForm.php new file mode 100644 index 0000000..1f2f743 --- /dev/null +++ b/module/Application/src/Form/SearchForm.php @@ -0,0 +1,32 @@ +setAttributes([ + 'class' => 'form-control has-feedback-left', + 'maxlength' => 10, + 'placeholder' => "PHP, JAVA, ...", + ]); + + $this->add($position); + + $location = new Text('location'); + $location->setAttributes([ + 'class' => 'form-control has-feedback-left', + 'maxlength' => 20, + 'placeholder' => "London, Berlin, ...", + ]); + + $this->add($location); + } +} \ No newline at end of file diff --git a/module/Application/view/application/index/dashboard.phtml b/module/Application/view/application/index/dashboard.phtml index 867a02b..a066e29 100755 --- a/module/Application/view/application/index/dashboard.phtml +++ b/module/Application/view/application/index/dashboard.phtml @@ -84,23 +84,25 @@ inlineScript()->captureStart(); +//echo $this->inlineScript()->captureStart(); echo $this->headScript() -// ->appendFile($this->basePath('vendors/Chart.js/dist/Chart.min.js')) -// ->appendFile($this->basePath('vendors/gauge.js/dista/gauge.min.js')) -// ->appendFile($this->basePath('vendors/bootstrap-progressbar/bootstrap-progressbar.min.js')) -// ->appendFile($this->basePath('vendors/iCheck/icheck.min.js')) -// ->appendFile($this->basePath('vendors/skycons/skycons.js')) -// ->appendFile($this->basePath('vendors/Flot/jquery.flot.js')) -// ->appendFile($this->basePath('vendors/Flot/jquery.flot.pie.js')) -// ->appendFile($this->basePath('vendors/Flot/jquery.flot.time.js')) -// ->appendFile($this->basePath('vendors/Flot/jquery.flot.stack.js')) -// ->appendFile($this->basePath('vendors/Flot/jquery.flot.resize.js')) -// ->appendFile($this->basePath('vendors/flot.orderbars/js/jquery.flot.orderBars.js')) -// ->appendFile($this->basePath('ve ndors/flot-spline/js/jquery.flot.spline.min.js')) -// ->appendFile($this->basePath('vendors/flot.curvedlines/curvedLines.js')) -// ->appendFile($this->basePath('vendors/DateJS/build/date.js')) +//// ->appendFile($this->basePath('vendors/Chart.js/dist/Chart.min.js')) +//// ->appendFile($this->basePath('vendors/gauge.js/dista/gauge.min.js')) +//// ->appendFile($this->basePath('vendors/bootstrap-progressbar/bootstrap-progressbar.min.js')) +//// ->appendFile($this->basePath('vendors/iCheck/icheck.min.js')) +//// ->appendFile($this->basePath('vendors/skycons/skycons.js')) +//// ->appendFile($this->basePath('vendors/Flot/jquery.flot.js')) +//// ->appendFile($this->basePath('vendors/Flot/jquery.flot.pie.js')) +//// ->appendFile($this->basePath('vendors/Flot/jquery.flot.time.js')) +//// ->appendFile($this->basePath('vendors/Flot/jquery.flot.stack.js')) +//// ->appendFile($this->basePath('vendors/Flot/jquery.flot.resize.js')) +//// ->appendFile($this->basePath('vendors/flot.orderbars/js/jquery.flot.orderBars.js')) +//// ->appendFile($this->basePath('ve ndors/flot-spline/js/jquery.flot.spline.min.js')) +//// ->appendFile($this->basePath('vendors/flot.curvedlines/curvedLines.js')) +//// ->appendFile($this->basePath('vendors/DateJS/build/date.js')) ->appendFile($this->basePath('build/js/custom.min.js')); -$this->inlineScript()->captureEnd(); \ No newline at end of file +//echo $this->headScript()->offsetSetScript(10, $this->basePath('build/js/custom.min.js'), 'text/javascript'); + +//echo $this->inlineScript()->captureEnd(); \ No newline at end of file diff --git a/module/Application/view/application/index/manual-search.phtml b/module/Application/view/application/index/manual-search.phtml new file mode 100644 index 0000000..dd9c79e --- /dev/null +++ b/module/Application/view/application/index/manual-search.phtml @@ -0,0 +1,99 @@ + + + + + + + + + + + +form; +$form->setAttribute('action', $this->url() . '/manual-search'); +$form->setAttribute('method', 'POST'); +$form->setAttribute('class', 'form-horizontal form-label-left input_mask col-md-offset-1'); +$form->prepare(); +?> + +
Company | +Title | +Location | +Type | ++ |
---|---|---|---|---|
+ | + | + | + | + + More + | +